76 lines
2.0 KiB
PHP
76 lines
2.0 KiB
PHP
@if ($article['offers']['semences'] ?? false)
|
|
@include('Shop.Articles.partials.addBasket', [
|
|
'data' => $article['offers']['semences'],
|
|
'title' => 'Semence',
|
|
'model' => 'semences',
|
|
])
|
|
@endif
|
|
|
|
@if ($article['offers']['plants'] ?? false)
|
|
@include('Shop.Articles.partials.addBasket', [
|
|
'data' => $article['offers']['plants'],
|
|
'title' => 'Plant',
|
|
'model' => 'plants',
|
|
])
|
|
@endif
|
|
|
|
@if ($article['offers']['legumes'] ?? false)
|
|
@include('Shop.Articles.partials.addBasket', [
|
|
'data' => $article['offers']['legumes'],
|
|
'title' => 'Légume',
|
|
'model' => 'legumes',
|
|
])
|
|
@endif
|
|
|
|
@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() {
|
|
submitModal(form_id);
|
|
}
|
|
},
|
|
};
|
|
|
|
openModal(
|
|
'Ajout dans le panier',
|
|
'basket-form',
|
|
"{{ route('Shop.Basket.modalBasket') }}/" + offer_id + '/' + quantity,
|
|
"{{ route('Shop.Basket.addBasket') }}",
|
|
refreshBasketTop(),
|
|
false,
|
|
true,
|
|
buttons
|
|
);
|
|
});
|
|
|
|
function setPrice(model) {
|
|
var offer_id = $('#' + model + '-offer_id').find('option:selected').val();
|
|
var quantity = $('#' + model + '-quantity').val();
|
|
var data = {
|
|
'offer_id': offer_id,
|
|
'quantity': quantity,
|
|
};
|
|
$.post('{{ route("Shop.Basket.getPrice") }}', data, function(data) {
|
|
$('#' + model + '-price').html(data);
|
|
});
|
|
}
|
|
|
|
</script>
|
|
@endpush
|