Commit e5fbb257 authored by ArifMubarok's avatar ArifMubarok
Browse files

fix: kembalian

parent 179e1b5a
Showing with 15 additions and 1 deletion
+15 -1
......@@ -100,6 +100,7 @@
$('.invalid-feedback').text('');
},
success: function(data) {
console.log(data);
if (data.status == 0) {
// enable button
submit.disabled = false;
......@@ -116,8 +117,13 @@
return;
}
if (data.route) {
console.log(data.route);
window.location.href = data.route
}
},
error: function(error) {
console.error(error);
}
});
});
......
......@@ -123,7 +123,7 @@ class="fa fa-plus me-2"></i>Add Member</a>
<h5>Total </h5>
<h6 id="total-price">Rp 0</h6>
</li>
<li>
<li class="total-value">
<h5>Kembalian </h5>
<h6 id="total-change">Rp 0</h6>
</li>
......@@ -161,6 +161,8 @@ class="fa fa-plus me-2"></i>Add Member</a>
const totalItemField = $('#total-item')
const totalPriceField = $('#total-price')
const totalChangeField = $('#total-change')
const uangBayarField = $('#uang-bayar')
let totalItem = 0;
const incrementTotalItem = () => {
totalItem++;
......@@ -181,6 +183,8 @@ class="fa fa-plus me-2"></i>Add Member</a>
const price = cart.jml * (cart.priceSell - cart.discount)
newTotalPrice += price;
})
newTotalChange = +uangBayarField.val() - +newTotalPrice < 0 ? 0 : +uangBayarField.val() - +newTotalPrice;
totalChangeField.text(`Rp ${newTotalChange}`)
totalPriceField.text(`Rp ${newTotalPrice}`)
}
const addCartTemporary = (object) => {
......@@ -537,5 +541,9 @@ class="fa fa-plus me-2"></i>Add Member</a>
}
})
})
$(document).on('keyup', '#uang-bayar', function() {
reRenderTotalPrice();
})
</script>
@endsection
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment