fix basket

This commit is contained in:
ludo
2023-10-31 17:05:41 +01:00
parent a9432bd3c1
commit 746cf661ce
14 changed files with 144 additions and 88 deletions

View File

@@ -25,43 +25,11 @@
])
@endif
@include('load.basket')
@push('js')
<script>
$('.basket').click(function() {
var type = $(this).data('type');
var offer_id = $('#' + type + '-offer_id').find('option:selected').val();
var quantity = $('#' + type + '-quantity').val();
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() {
window.location = "{{ route('Shop.Basket.basket') }}";
}
},
};
openModal(
'Ajout dans le panier',
'basket-form',
"{{ route('Shop.Basket.modalBasket') }}/" + offer_id + '/' + quantity,
"{{ route('Shop.Orders.order') }}",
false,
false,
true,
buttons,
"refreshBasketTop()",
);
});
initBasket();
function setPrice(model) {
var offer_id = $('#' + model + '-offer_id').find('option:selected').val();

View File

@@ -1,7 +1,7 @@
@component('components.card', [
'id_card' => $model . '-basket',
'title' => $title,
'class' => 'mb-3 ' . ($bgClass ?? null),
'class' => 'mb-3 addBasket ' . ($bgClass ?? null),
'classTitle' => 'mb-0',
'outline' => false,
])
@@ -10,13 +10,14 @@
'name' => 'offer_id',
'id_name' => $model . '-offer_id',
'list' => collect($data)->pluck('name', 'id')->toArray(),
'class' => 'select2 mb-2',
'class' => 'select2 mb-2 offer_id',
])
<div class="row">
<div class="col-5">
@include('components.form.inputs.number', [
'name' => 'quantity',
'class' => 'quantity',
'id_name' => $model . '-quantity',
'value' => 1,
])

View File

@@ -1,29 +1,41 @@
@if ($article_nature == 'semences')
<div class="w-100 mt-3 p-1 bg-green-light green-dark rounded-lg border text-center">
<div class="w-100 mt-3 p-1 bg-green-light green-dark rounded-lg border text-center addBasket">
<span style="font-size: 1.4em; font-weight: bold;">{{ $article['semences']['price'] ?? null }}</span> <br>
{{ $article['semences']['variation'] }}
<div>
Quantité : 1
Quantité :
@include('components.form.inputs.number', [
'name' => uniqid(),
'class' => 'quantity',
'value' => 1,
'style' => 'max-width: 64px; display: inline-block',
])
</div>
<input type="hidden" class="offer_id" value="{{ $article['semences']['offer_id'] ?? null }}" />
@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-light green-dark rounded-lg border text-center">
<div class="w-100 mt-3 p-1 bg-green-light green-dark rounded-lg border text-center addBasket">
<span style="font-size: 1.4em; font-weight: bold;">{{ $article['plants']['price'] ?? null }}</span> <br>
{{ $article['plants']['variation'] }}
<div>
Quantité : 1
Quantité :
@include('components.form.inputs.number', [
'name' => uniqid(),
'class' => 'quantity',
'value' => 1,
'style' => 'max-width: 64px; display: inline-block',
])
</div>
<input type="hidden" class="offer_id" value="{{ $article['plants']['offer_id'] ?? null }}" />
@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