From ba8f87cff47720b31bc41665f48f8ad523ba3d27 Mon Sep 17 00:00:00 2001 From: Ludovic CANDELLIER Date: Tue, 21 Mar 2023 23:16:47 +0100 Subject: [PATCH] add basket on rows, uniformize baskets --- .../Controllers/Shop/CategoryController.php | 6 ++- .../Shop/Articles/partials/article.blade.php | 15 +++++-- .../partials/article_rows_addBasket.blade.php | 29 ++++++++++++++ .../partials/article_rows_botanic.blade.php | 4 +- .../Shelves/partials/category_add.blade.php | 6 +-- .../partials/category_articles.blade.php | 1 + .../partials/category_articles_rows.blade.php | 40 ------------------- resources/views/Shop/Shelves/shelve.blade.php | 2 +- 8 files changed, 52 insertions(+), 51 deletions(-) create mode 100644 resources/views/Shop/Articles/partials/article_rows_addBasket.blade.php diff --git a/app/Http/Controllers/Shop/CategoryController.php b/app/Http/Controllers/Shop/CategoryController.php index d0aa6565..66f7c4d1 100644 --- a/app/Http/Controllers/Shop/CategoryController.php +++ b/app/Http/Controllers/Shop/CategoryController.php @@ -28,7 +28,9 @@ class CategoryController extends Controller } else { // $product_type = Articles::getProductTypeByCategory($category_id); // dump($product_type); - switch ($request->input('article_nature')) { + $article_nature = $request->input('article_nature'); + + switch ($article_nature) { case 'semences': $product_type = 'botanic'; $article_nature_id = 1; @@ -54,7 +56,7 @@ class CategoryController extends Controller 'breadcrumb' => Categories::getAncestorsByCategory($category_id), 'display_by_rows' => $request->input('display_by_rows') ?? false, 'product_type' => $product_type, - 'article_nature' => $article_nature_id, + 'article_nature' => $article_nature, 'tags_selected' => $request->input('tags') ?? [], 'articles' => Articles::getArticlesToSell([ 'category_id' => $category_id, diff --git a/resources/views/Shop/Articles/partials/article.blade.php b/resources/views/Shop/Articles/partials/article.blade.php index 45f0c294..3060f1ec 100644 --- a/resources/views/Shop/Articles/partials/article.blade.php +++ b/resources/views/Shop/Articles/partials/article.blade.php @@ -19,8 +19,17 @@ @include('Shop.Articles.partials.article_' . $product_type) - + @switch ($article_nature) + @case(1) + + @break + @case(2) + + @break + @endswitch diff --git a/resources/views/Shop/Articles/partials/article_rows_addBasket.blade.php b/resources/views/Shop/Articles/partials/article_rows_addBasket.blade.php new file mode 100644 index 00000000..4a104aab --- /dev/null +++ b/resources/views/Shop/Articles/partials/article_rows_addBasket.blade.php @@ -0,0 +1,29 @@ +@if ($article_nature == 'semences') +
+ {{ $article['semences']['price'] ?? null }}
+ {{ $article['semences']['variation'] }} +
+ Quantité : 1 +
+ @include('components.form.button', [ + 'class' => 'btn-green-dark basket semences mb-3 mt-2 shadow', + 'txt' => 'Ajouter au panier', + 'data_id' => $article['semences']['offer_id'] ?? null, + ]) +
+@endif + +@if ($article_nature == 'plants') +
+ {{ $article['plants']['price'] ?? null }}
+ {{ $article['plants']['variation'] }} +
+ Quantité : 1 +
+ @include('components.form.button', [ + 'class' => 'btn-success basket plants mb-3 mt-2 shadow', + 'txt' => 'Ajouter au panier', + 'data_id' => $article['plants']['offer_id'] ?? null, + ]) +
+@endif \ No newline at end of file diff --git a/resources/views/Shop/Articles/partials/article_rows_botanic.blade.php b/resources/views/Shop/Articles/partials/article_rows_botanic.blade.php index 4a104aab..221d2831 100644 --- a/resources/views/Shop/Articles/partials/article_rows_botanic.blade.php +++ b/resources/views/Shop/Articles/partials/article_rows_botanic.blade.php @@ -1,5 +1,5 @@ @if ($article_nature == 'semences') -
+
{{ $article['semences']['price'] ?? null }}
{{ $article['semences']['variation'] }}
@@ -14,7 +14,7 @@ @endif @if ($article_nature == 'plants') -
+
{{ $article['plants']['price'] ?? null }}
{{ $article['plants']['variation'] }}
diff --git a/resources/views/Shop/Shelves/partials/category_add.blade.php b/resources/views/Shop/Shelves/partials/category_add.blade.php index 54429d3e..e767d4f8 100644 --- a/resources/views/Shop/Shelves/partials/category_add.blade.php +++ b/resources/views/Shop/Shelves/partials/category_add.blade.php @@ -1,6 +1,6 @@
-
+
@@ -8,7 +8,7 @@
-
+
@@ -16,7 +16,7 @@
-
+
diff --git a/resources/views/Shop/Shelves/partials/category_articles.blade.php b/resources/views/Shop/Shelves/partials/category_articles.blade.php index c6c80c1e..a60a2232 100644 --- a/resources/views/Shop/Shelves/partials/category_articles.blade.php +++ b/resources/views/Shop/Shelves/partials/category_articles.blade.php @@ -46,3 +46,4 @@ }); @endpush + 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 d4846404..f2487ae2 100644 --- a/resources/views/Shop/Shelves/partials/category_articles_rows.blade.php +++ b/resources/views/Shop/Shelves/partials/category_articles_rows.blade.php @@ -7,43 +7,3 @@
@endif - -@push('js') - -@endpush \ No newline at end of file diff --git a/resources/views/Shop/Shelves/shelve.blade.php b/resources/views/Shop/Shelves/shelve.blade.php index 18e59c37..64ec872d 100644 --- a/resources/views/Shop/Shelves/shelve.blade.php +++ b/resources/views/Shop/Shelves/shelve.blade.php @@ -44,4 +44,4 @@ @endsection -@include('load.layout.modal') \ No newline at end of file +@include('load.layout.modal')