fix on basket
This commit is contained in:
@@ -28,7 +28,7 @@
|
||||
@endforeach
|
||||
</div>
|
||||
<div class="col-4">
|
||||
@component('components.card', ['class' => 'shadow'])
|
||||
@component('components.card', ['class' => 'shadow bg-light'])
|
||||
<div class="row mb-3">
|
||||
<div class="col-6 text-uppercase">
|
||||
Tarif appliqué
|
||||
@@ -74,8 +74,10 @@
|
||||
|
||||
$('.basket-quantity').change(function() {
|
||||
var offer_id = $(this).data('id');
|
||||
quantity = $('.basket-quantity').value;
|
||||
addBasket(offer_id, quantity, function() {
|
||||
var quantity = $(this).val();
|
||||
console.log("add basket");
|
||||
console.log(quantity);
|
||||
updateBasket(offer_id, quantity, function() {
|
||||
calculatePrice($(this).parents('.basket-row'));
|
||||
calculateTotal();
|
||||
});
|
||||
@@ -83,15 +85,15 @@
|
||||
|
||||
$('.basket-delete').click(function() {
|
||||
var offer_id = $(this).data('id');
|
||||
addBasket(offer_id, 0, function() {
|
||||
updateBasket(offer_id, 0, function() {
|
||||
$('#basket_offer-' + offer_id).remove();
|
||||
calculateTotal();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function addBasket(offer_id, quantity, callback) {
|
||||
var data = {offer_id: offer_id, quantity: 0};
|
||||
function updateBasket(offer_id, quantity, callback) {
|
||||
var data = {offer_id: offer_id, quantity: quantity, update: true};
|
||||
$.post("{{ route('Shop.Basket.addBasket') }}", data, callback);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user