CRUD petugas/pegawai + filter-sort-rekap transaksi parkir + fix save member kartu + hilangkan alert ganti Swal-loading

This commit is contained in:
2026-10-14 11:21:07 +07:00
parent ee1f43977a
commit f3818f03f5
23 changed files with 747 additions and 53 deletions
+17 -2
View File
@@ -155,6 +155,8 @@
$(document).ready(function () {
$(document).on('click', '.hardware-button', function () {
let btn = $(this);
let btnHtml = btn.html();
let row = $(this).closest('tr');
// kalau sudah ada baris edit, hapus dulu
@@ -166,6 +168,8 @@
// # base url tanpa parameter biar tidak dobel slash
let baseUrl = "{{ url('setup/master/gate-hardware') }}";
btn.prop('disabled', true).html('<span class="spinner-border spinner-border-sm me-1"></span>Memuat...');
$.ajax({
url: baseUrl + "/" + id,
type: 'GET',
@@ -244,6 +248,10 @@ class="form-control form-control-sm edit-mode d-none"
},
error: function (xhr) {
console.error(xhr.responseText);
Swal.fire({icon: 'error', title: 'Gagal memuat hardware', text: xhr.responseJSON?.message || 'Cek koneksi / hubungi admin.'});
},
complete: function () {
btn.prop('disabled', false).html(btnHtml);
}
});
});
@@ -275,6 +283,8 @@ class="form-control form-control-sm edit-mode d-none"
// SAVE
$(document).on('click', '.btn-save', function () {
const btn = $(this);
const origHtml = btn.html();
let dataToSend = {};
let gateId = $('.edit-row').data('id');
@@ -289,6 +299,8 @@ class="form-control form-control-sm edit-mode d-none"
// # base url tanpa parameter biar tidak dobel slash
let baseUrl = "{{ url('setup/master/gate-hardware') }}";
btn.prop('disabled', true).html('<span class="spinner-border spinner-border-sm me-1"></span>Menyimpan...');
$.ajax({
url: baseUrl + "/" + gateId,
type: "POST",
@@ -308,11 +320,14 @@ class="form-control form-control-sm edit-mode d-none"
});
$('.btn-cancel').click();
alert('Berhasil disimpan');
Swal.fire({icon: 'success', title: 'Berhasil', text: 'Konfigurasi hardware tersimpan.'});
},
error: function (xhr) {
console.error(xhr.responseText);
alert('Gagal menyimpan. Cek koneksi / hubungi admin.');
Swal.fire({icon: 'error', title: 'Gagal menyimpan', text: xhr.responseJSON?.message || 'Cek koneksi / hubungi admin.'});
},
complete: function () {
btn.prop('disabled', false).html(origHtml);
}
});
});