From cafd0a49e7482a9ad776a48bb9b2a2926af50d0c Mon Sep 17 00:00:00 2001 From: Ludovic CANDELLIER Date: Fri, 10 Feb 2023 23:11:48 +0100 Subject: [PATCH] change registration or connection in order page, change filter on shelve page, add new api to get article_nature by product_type, css fixes --- .../Controllers/Admin/Shop/ArticleController.php | 1 - .../Admin/Shop/ArticleNatureController.php | 5 +++++ .../Admin/Shop/MerchandiseController.php | 2 -- app/Models/Shop/ArticleNature.php | 15 +++++++++++++++ app/Repositories/Shop/ArticleNatures.php | 15 +++++++++++++++ build/css/site.css | 7 ++----- .../Articles/partials/characteristics.blade.php | 4 ++++ resources/views/Shop/Baskets/basket.blade.php | 7 +++++++ .../Customers/partials/registration.blade.php | 6 ++---- resources/views/Shop/Orders/order.blade.php | 14 ++++++++------ .../partials/category_articles_rows.blade.php | 10 +++++++--- .../views/Shop/auth/partials/register.blade.php | 2 +- .../Shop/layout/partials/header-profile.blade.php | 8 +++++++- routes/Admin/Shop/ArticleNatures.php | 2 +- 14 files changed, 74 insertions(+), 24 deletions(-) diff --git a/app/Http/Controllers/Admin/Shop/ArticleController.php b/app/Http/Controllers/Admin/Shop/ArticleController.php index 23318eaa..c228eaa7 100644 --- a/app/Http/Controllers/Admin/Shop/ArticleController.php +++ b/app/Http/Controllers/Admin/Shop/ArticleController.php @@ -101,5 +101,4 @@ class ArticleController extends Controller $data = Articles::toggleHomepage($request->input('id'), ($request->input('homepage') == 'true') ? 1 : 0); return response()->json(['error' => 0]); } - } diff --git a/app/Http/Controllers/Admin/Shop/ArticleNatureController.php b/app/Http/Controllers/Admin/Shop/ArticleNatureController.php index 6007628a..4ff24bfe 100644 --- a/app/Http/Controllers/Admin/Shop/ArticleNatureController.php +++ b/app/Http/Controllers/Admin/Shop/ArticleNatureController.php @@ -41,4 +41,9 @@ class ArticleNatureController extends Controller { return ArticleNatures::destroy($id); } + + public static function getOptions($product_type) + { + return response()->json(['0' => ''] + ArticleNatures::getOptionsByProductType($product_type)); + } } diff --git a/app/Http/Controllers/Admin/Shop/MerchandiseController.php b/app/Http/Controllers/Admin/Shop/MerchandiseController.php index 0cda97b7..1bdd174e 100644 --- a/app/Http/Controllers/Admin/Shop/MerchandiseController.php +++ b/app/Http/Controllers/Admin/Shop/MerchandiseController.php @@ -9,8 +9,6 @@ use App\Repositories\Shop\Producers; use App\Repositories\Shop\TagGroups; use App\Datatables\Shop\MerchandisesDataTable; -use App\Models\Shop\Merchandise; - class MerchandiseController extends Controller { public function index(MerchandisesDataTable $dataTable) diff --git a/app/Models/Shop/ArticleNature.php b/app/Models/Shop/ArticleNature.php index cb44600d..490ec75a 100644 --- a/app/Models/Shop/ArticleNature.php +++ b/app/Models/Shop/ArticleNature.php @@ -24,4 +24,19 @@ class ArticleNature extends Model { return $query->where($this->table . '.id', $id); } + + public function scopeByBotanic($query); + { + return $query->where($this->table . '.product_type', 1); + } + + public function scopeByMerchandise($query); + { + return $query->where($this->table . '.product_type', 2); + } + + public function scopeByProductType($query, $type) + { + return $query->where($this->table . '.product_type', $type); + } } diff --git a/app/Repositories/Shop/ArticleNatures.php b/app/Repositories/Shop/ArticleNatures.php index b13f8d5a..08a5ae7b 100644 --- a/app/Repositories/Shop/ArticleNatures.php +++ b/app/Repositories/Shop/ArticleNatures.php @@ -11,6 +11,21 @@ class ArticleNatures return ArticleNature::get()->pluck('name', 'id')->toArray(); } + public static function getOptionsByMerchandise() + { + return self::getOptionsByProductType(2); + } + + public static function getOptionsByBotanic() + { + return self::getOptionsByProductType(1); + } + + public static function getOptionsByProductType($type) + { + return ArticleNature::byProductType($type)->get()->pluck('name', 'id')->toArray(); + } + public static function getAll() { return ArticleNature::orderBy('name', 'asc')->get(); diff --git a/build/css/site.css b/build/css/site.css index 8e70b88d..e1f0729b 100644 --- a/build/css/site.css +++ b/build/css/site.css @@ -108,16 +108,13 @@ a.nav-link { background-color: #f3f8f1; } -.green { - color: #517C39; -} - -a.green { +.green, a.green { color: #517C39 !important; } .green-dark, a.green-dark { color: #335012; + text-decoration: none; } a.green-dark:hover { diff --git a/resources/views/Admin/Shop/Articles/partials/characteristics.blade.php b/resources/views/Admin/Shop/Articles/partials/characteristics.blade.php index 1a35f812..f8838499 100644 --- a/resources/views/Admin/Shop/Articles/partials/characteristics.blade.php +++ b/resources/views/Admin/Shop/Articles/partials/characteristics.blade.php @@ -39,6 +39,7 @@ {{ Form::label('article_nature_id', __('shop.article_natures.name')) }}
@include('components.form.select', [ 'name' => 'article_nature_id', + 'id_name' => 'article_nature_id', 'list' => $natures_options, 'value' => $article['article_nature_id'] ?? null, 'class' => 'select2', @@ -155,12 +156,15 @@ switch (product_type) { case 'App\\Models\\Botanic\\Specie': var url = '{{ route('Admin.Botanic.Species.getSelect') }}'; + var product_type = 1; break; case 'App\\Models\\Botanic\\Variety': var url = '{{ route('Admin.Botanic.Varieties.getSelect') }}'; + var product_type = 1; break; case 'App\\Models\\Shop\\Merchandise': var url = '{{ route('Admin.Shop.Merchandises.getSelect') }}'; + var product_type = 2; break; } loadProducts(url); diff --git a/resources/views/Shop/Baskets/basket.blade.php b/resources/views/Shop/Baskets/basket.blade.php index 9d2fdd14..d83a6e9f 100644 --- a/resources/views/Shop/Baskets/basket.blade.php +++ b/resources/views/Shop/Baskets/basket.blade.php @@ -38,6 +38,13 @@ + @else +
+
+

Panier

+ Votre panier est vide +
+
@endif @endsection diff --git a/resources/views/Shop/Customers/partials/registration.blade.php b/resources/views/Shop/Customers/partials/registration.blade.php index ffb5351d..839a6a69 100644 --- a/resources/views/Shop/Customers/partials/registration.blade.php +++ b/resources/views/Shop/Customers/partials/registration.blade.php @@ -15,16 +15,14 @@
-
+
@include('components.form.input', [ 'name' => 'company', 'value' => $customer['company'] ?? '', 'label' => 'Société', ])
-
-
-
+
@include('components.form.input', [ 'name' => 'tva', 'value' => $customer['tva'] ?? '', diff --git a/resources/views/Shop/Orders/order.blade.php b/resources/views/Shop/Orders/order.blade.php index 8491b065..2d6a34bb 100644 --- a/resources/views/Shop/Orders/order.blade.php +++ b/resources/views/Shop/Orders/order.blade.php @@ -4,7 +4,7 @@ @section('content')
-
+
@if (!App\Repositories\Shop\Customers::isConnected())

Déja client ? @@ -39,11 +39,13 @@ {!! Form::close() !!}

-
- - @include('Shop.Baskets.partials.basketTotal') - -
+ @if ($basket['count']) +
+ + @include('Shop.Baskets.partials.basketTotal') + +
+ @endif
@endsection diff --git a/resources/views/Shop/Shelves/partials/category_articles_rows.blade.php b/resources/views/Shop/Shelves/partials/category_articles_rows.blade.php index 9288baad..d4846404 100644 --- a/resources/views/Shop/Shelves/partials/category_articles_rows.blade.php +++ b/resources/views/Shop/Shelves/partials/category_articles_rows.blade.php @@ -1,7 +1,11 @@ @if ($articles ?? false) - @foreach ($articles as $product_name => $article) - @include('Shop.Articles.partials.article_rows') - @endforeach +
+
+ @foreach ($articles as $product_name => $article) + @include('Shop.Articles.partials.article_rows') + @endforeach +
+
@endif @push('js') diff --git a/resources/views/Shop/auth/partials/register.blade.php b/resources/views/Shop/auth/partials/register.blade.php index e03213dd..ddccafd1 100644 --- a/resources/views/Shop/auth/partials/register.blade.php +++ b/resources/views/Shop/auth/partials/register.blade.php @@ -42,7 +42,7 @@
-
diff --git a/resources/views/Shop/layout/partials/header-profile.blade.php b/resources/views/Shop/layout/partials/header-profile.blade.php index f718df12..ef37c24f 100644 --- a/resources/views/Shop/layout/partials/header-profile.blade.php +++ b/resources/views/Shop/layout/partials/header-profile.blade.php @@ -25,7 +25,7 @@ @else @@ -34,5 +34,11 @@ Creer votre compte + + @endif diff --git a/routes/Admin/Shop/ArticleNatures.php b/routes/Admin/Shop/ArticleNatures.php index f015c60c..9a9a743b 100644 --- a/routes/Admin/Shop/ArticleNatures.php +++ b/routes/Admin/Shop/ArticleNatures.php @@ -6,5 +6,5 @@ Route::prefix('ArticleNatures')->name('ArticleNatures.')->group(function () { Route::delete('destroy/{id?}', 'ArticleNatureController@destroy')->name('destroy'); Route::post('store', 'ArticleNatureController@store')->name('store'); Route::get('edit/{id}', 'ArticleNatureController@edit')->name('edit'); - + Route::get('getOptions/{id}', 'ArticleNatureController@getOptions')->name('getOptions'); });