add basket on rows, uniformize baskets

This commit is contained in:
Ludovic CANDELLIER
2023-03-21 23:16:47 +01:00
parent 06c68dd223
commit 20b3521c72
8 changed files with 52 additions and 51 deletions

View File

@@ -28,7 +28,9 @@ class CategoryController extends Controller
} else { } else {
// $product_type = Articles::getProductTypeByCategory($category_id); // $product_type = Articles::getProductTypeByCategory($category_id);
// dump($product_type); // dump($product_type);
switch ($request->input('article_nature')) { $article_nature = $request->input('article_nature');
switch ($article_nature) {
case 'semences': case 'semences':
$product_type = 'botanic'; $product_type = 'botanic';
$article_nature_id = 1; $article_nature_id = 1;
@@ -54,7 +56,7 @@ class CategoryController extends Controller
'breadcrumb' => Categories::getAncestorsByCategory($category_id), 'breadcrumb' => Categories::getAncestorsByCategory($category_id),
'display_by_rows' => $request->input('display_by_rows') ?? false, 'display_by_rows' => $request->input('display_by_rows') ?? false,
'product_type' => $product_type, 'product_type' => $product_type,
'article_nature' => $article_nature_id, 'article_nature' => $article_nature,
'tags_selected' => $request->input('tags') ?? [], 'tags_selected' => $request->input('tags') ?? [],
'articles' => Articles::getArticlesToSell([ 'articles' => Articles::getArticlesToSell([
'category_id' => $category_id, 'category_id' => $category_id,

View File

@@ -19,8 +19,17 @@
</div> </div>
@include('Shop.Articles.partials.article_' . $product_type) @include('Shop.Articles.partials.article_' . $product_type)
</a> </a>
<button type="button" class="btn btn-link bg-green text-white w-100 basket" data-id="{{ $article['offers'][0]['id'] ?? false }}"> @switch ($article_nature)
Ajout rapide @case(1)
</button> <button type="button" class="btn btn-link bg-green text-white w-100 basket" data-id="{{ $article['semences']['id'] ?? false }}">
Ajout rapide
</button>
@break
@case(2)
<button type="button" class="btn btn-link bg-green text-white w-100 basket" data-id="{{ $article['plants']['id'] ?? false }}">
Ajout rapide
</button>
@break
@endswitch
</div> </div>
</div> </div>

View File

@@ -0,0 +1,29 @@
@if ($article_nature == 'semences')
<div class="w-100 mt-3 p-1 bg-yellow yellow-dark rounded-lg border text-center">
<span style="font-size: 1.4em; font-weight: bold;">{{ $article['semences']['price'] ?? null }}</span> <br>
{{ $article['semences']['variation'] }}
<div>
Quantité : 1
</div>
@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,
])
</div>
@endif
@if ($article_nature == 'plants')
<div class="w-100 mt-3 p-1 bg-green green-dark rounded-lg border text-center text-white">
<span style="font-size: 1.4em; font-weight: bold;">{{ $article['plants']['price'] ?? null }}</span> <br>
{{ $article['plants']['variation'] }}
<div>
Quantité : 1
</div>
@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,
])
</div>
@endif

View File

@@ -1,5 +1,5 @@
@if ($article_nature == 'semences') @if ($article_nature == 'semences')
<div class="w-100 mt-3 p-1 bg-yellow yellow-dark rounded-lg border text-center"> <div class="w-100 mt-3 p-1 bg-green-light green-dark rounded-lg border text-center">
<span style="font-size: 1.4em; font-weight: bold;">{{ $article['semences']['price'] ?? null }}</span> <br> <span style="font-size: 1.4em; font-weight: bold;">{{ $article['semences']['price'] ?? null }}</span> <br>
{{ $article['semences']['variation'] }} {{ $article['semences']['variation'] }}
<div> <div>
@@ -14,7 +14,7 @@
@endif @endif
@if ($article_nature == 'plants') @if ($article_nature == 'plants')
<div class="w-100 mt-3 p-1 bg-green green-dark rounded-lg border text-center text-white"> <div class="w-100 mt-3 p-1 bg-green-light green-dark rounded-lg border text-center">
<span style="font-size: 1.4em; font-weight: bold;">{{ $article['plants']['price'] ?? null }}</span> <br> <span style="font-size: 1.4em; font-weight: bold;">{{ $article['plants']['price'] ?? null }}</span> <br>
{{ $article['plants']['variation'] }} {{ $article['plants']['variation'] }}
<div> <div>

View File

@@ -1,6 +1,6 @@
<div class="row mb-3"> <div class="row mb-3">
<div class="col-4"> <div class="col-4">
<div class="row btn h-100 products @if($article_nature == 1) shadow2 @endif" data-id="semences"> <div class="row btn h-100 products @if($article_nature == 'semences') shadow2 @endif" data-id="semences">
<div class="col-lg-6 col-xs-12"> <div class="col-lg-6 col-xs-12">
<img src="/img/article_natures/semences.png" class="img-fluid"> <img src="/img/article_natures/semences.png" class="img-fluid">
</div> </div>
@@ -8,7 +8,7 @@
</div> </div>
</div> </div>
<div class="col-4"> <div class="col-4">
<div class="row btn h-100 products @if($article_nature == 2) shadow2 @endif" data-id="plants"> <div class="row btn h-100 products @if($article_nature == 'plants') shadow2 @endif" data-id="plants">
<div class="col-lg-6 col-xs-12"> <div class="col-lg-6 col-xs-12">
<img src="/img/article_natures/plants.png" class="img-fluid" class="img-fluid"> <img src="/img/article_natures/plants.png" class="img-fluid" class="img-fluid">
</div> </div>
@@ -16,7 +16,7 @@
</div> </div>
</div> </div>
<div class="col-4"> <div class="col-4">
<div class="row btn h-100 products @if($article_nature == 3) shadow2 @endif" data-id="legumes"> <div class="row btn h-100 products @if($article_nature == 'legumes') shadow2 @endif" data-id="legumes">
<div class="col-lg-6 col-xs-12"> <div class="col-lg-6 col-xs-12">
<img src="/img/article_natures/legumes.png" class="img-fluid" class="img-fluid"> <img src="/img/article_natures/legumes.png" class="img-fluid" class="img-fluid">
</div> </div>

View File

@@ -46,3 +46,4 @@
}); });
</script> </script>
@endpush @endpush

View File

@@ -7,43 +7,3 @@
</div> </div>
</div> </div>
@endif @endif
@push('js')
<script>
$('.basket').click(function() {
var offer_id = $(this).data('id');
var quantity = 1;
var data = {
'offer_id': offer_id,
'quantity': quantity,
};
var buttons = {
cancel: {
label: '{{ __('Continuer mes achats') }}',
className: 'btn-secondary'
},
confirm: {
label: '{{ __('Commander') }}',
className: 'btn-success',
callback: function() {
// submitModal(form_id);
}
},
};
openModal(
'Ajout dans le panier',
'basket-form',
"{{ route('Shop.Basket.modalBasket') }}/" + offer_id + '/' + quantity,
"{{ route('Shop.Orders.order') }}",
"",
false,
true,
buttons,
"refreshBasketTop()",
);
});
</script>
@endpush