add basket on merchandise form

This commit is contained in:
ludo
2023-11-25 20:42:15 +01:00
parent 9949ae95cf
commit 4bcfc7bc6d

View File

@@ -1,47 +1,55 @@
@if ($article['offers']['semences'] ?? false) @if ($article['offers']['semences'] ?? false)
@include('Shop.Articles.partials.addBasket', [ @include('Shop.Articles.partials.addBasket', [
'data' => $article['offers']['semences'], 'data' => $article['offers']['semences'],
'title' => 'Semences', 'title' => 'Semences',
'model' => 'semences', 'model' => 'semences',
'bgClass' => 'bg-green-light', 'bgClass' => 'bg-green-light',
]) ])
@endif @endif
@if ($article['offers']['plants'] ?? false) @if ($article['offers']['plants'] ?? false)
@include('Shop.Articles.partials.addBasket', [ @include('Shop.Articles.partials.addBasket', [
'data' => $article['offers']['plants'], 'data' => $article['offers']['plants'],
'title' => 'Plants', 'title' => 'Plants',
'model' => 'plants', 'model' => 'plants',
'bgClass' => 'bg-green-light', 'bgClass' => 'bg-green-light',
]) ])
@endif @endif
@if ($article['offers']['legumes'] ?? false) @if ($article['offers']['legumes'] ?? false)
@include('Shop.Articles.partials.addBasket', [ @include('Shop.Articles.partials.addBasket', [
'data' => $article['offers']['legumes'], 'data' => $article['offers']['legumes'],
'title' => 'Légumes', 'title' => 'Légumes',
'model' => 'legumes', 'model' => 'legumes',
'bgClass' => 'bg-green-light', 'bgClass' => 'bg-green-light',
]) ])
@endif
@if ($article['offers']['marchandise'] ?? false)
@include('Shop.Articles.partials.addBasket', [
'data' => $article['offers']['marchandise'],
'title' => 'Marchandises',
'model' => 'marchandise',
'bgClass' => 'bg-green-light',
])
@endif @endif
@include('load.basket') @include('load.basket')
@push('js') @push('js')
<script> <script>
initBasket(); initBasket();
function setPrice(model) { function setPrice(model) {
var offer_id = $('#' + model + '-offer_id').find('option:selected').val(); var offer_id = $('#' + model + '-offer_id').find('option:selected').val();
var quantity = $('#' + model + '-quantity').val(); var quantity = $('#' + model + '-quantity').val();
var data = { var data = {
'offer_id': offer_id, 'offer_id': offer_id,
'quantity': quantity, 'quantity': quantity,
}; };
$.post('{{ route("Shop.Basket.getPrice") }}', data, function(data) { $.post('{{ route('Shop.Basket.getPrice') }}', data, function(data) {
$('#' + model + '-price').html(data); $('#' + model + '-price').html(data);
}); });
} }
</script>
</script>
@endpush @endpush