-
+
@@ -421,6 +421,30 @@
});
$(function () {
+ $("#kt_modal_add_hapus_buku_form").submit(function (e) {
+ e.preventDefault(); // avoid to execute the actual submit of the form.
+
+ var form = $(this);
+ var actionUrl = form.attr('action');
+
+ $.ajax({
+ type: "POST",
+ url: actionUrl,
+ data: form.serialize(),
+ success: function (data) {
+ var _data = JSON.parse(data);
+ toastr.success(_data.message);
+ window.location.href = "{{ route('pencatatan.hapus_buku.index') }}";
+ },
+ error: function (data, textStatus, errorThrown) {
+ var errors = data.responseJSON.errors;
+ $.each(errors, function (key, value) {
+ toastr.error(value);
+ });
+ }
+ });
+ });
+
$('#baki_debet,#suku_bunga,#jumlah_bunga,#jumlah_kewajiban_lain,#lama_hari').on('change', function () {
calcTotKewajiban();
})
@@ -482,8 +506,8 @@
function calcTotAllKewajiban() {
var total;
- var biaya_lain = $('#biaya_lain').val() ?? 0;
- var denda = $('#denda').val() ?? 0;
+ var biaya_lain = $('#biaya_lain').val() === '' ? 0 : $('#biaya_lain').val();
+ var denda = $('#denda').val() === '' ? 0 : $('#denda').val();
total = parseFloat($('#total_kewajiban').val()) +
parseFloat($('#total_bunga_extra').val()) + parseFloat($('#bunga_extra').val()) + parseFloat(denda) + parseFloat(biaya_lain);
diff --git a/Resources/views/pencatatan/hapus_buku/index.blade.php b/Resources/views/pencatatan/hapus_buku/index.blade.php
index 4128b75..208ca0a 100644
--- a/Resources/views/pencatatan/hapus_buku/index.blade.php
+++ b/Resources/views/pencatatan/hapus_buku/index.blade.php
@@ -66,7 +66,6 @@
});
document.addEventListener('livewire:initialized', function () {
Livewire.on('success', function () {
- $('#kt_modal_add_hapus_buku').modal('show');
$('#kt_modal_nomor_pinjaman').modal('hide');
window.LaravelDataTables['hapus-buku-table'].ajax.reload();
});