Rapihin setup/member/lot-parking + fitur intercom, exclude WIP controller & file sampah dari git
Kumpulan perubahan yang udah numpuk di working tree: refactor Setup (Gate/Vehicle/Member), rapihin memberin & stiker, service parking baru (ParkingUtilsServices, NetworkService), model/migration lot-parking & DHCP reservation, dan fitur baru Intercom (controller/model/migration/ view). ReportTransaksiController versi lokal ini WIP (~90%, masih didebug) - versi yang bener ada di server, jadi dikeluarin dari git (ditambahin ke .gitignore) biar gak numpuk nindihin punya server pas git pull di sana. Sekalian keluarin dump mentah tabel softseting (1.8MB, nyasar ke-commit), file .bak, dan arsip ad-hoc (api.tgz, c.zip) yang emang bukan source code. Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01EAJc2mrpj2cSTe4oowLPzQ
This commit is contained in:
+106
-78
@@ -1,74 +1,101 @@
|
||||
$(document).ready(function () {
|
||||
|
||||
$(document).on('change', '.form-select', function () {
|
||||
if ($('option:selected', this).val() == '') {
|
||||
$(".nama").css('display', 'none');
|
||||
$(".nopol").css('display', 'none');
|
||||
$(".nocard").css('display', 'none');
|
||||
$(".notrans").css('display', 'none');
|
||||
$(document).on("change", ".form-select", function () {
|
||||
if ($("option:selected", this).val() == "") {
|
||||
$(".nama").css("display", "none");
|
||||
$(".nopol").css("display", "none");
|
||||
$(".nocard").css("display", "none");
|
||||
$(".notrans").css("display", "none");
|
||||
// $(".site").val('');
|
||||
} else if ($('option:selected', this).val() == 'nama') {
|
||||
$(".nama").css('display', 'block');
|
||||
$(".nopol").css('display', 'none');
|
||||
$(".nocard").css('display', 'none');
|
||||
$(".notrans").css('display', 'none');
|
||||
$(".input-default").val('');
|
||||
} else if ($('option:selected', this).val() == 'nopol') {
|
||||
$(".nama").css('display', 'none');
|
||||
$(".nopol").css('display', 'block');
|
||||
$(".nocard").css('display', 'none');
|
||||
$(".notrans").css('display', 'none');
|
||||
$(".input-default").val('');
|
||||
} else if ($('option:selected', this).val() == 'nocard') {
|
||||
$(".nama").css('display', 'none');
|
||||
$(".nopol").css('display', 'none');
|
||||
$(".nocard").css('display', 'block');
|
||||
$(".notrans").css('display', 'none');
|
||||
$(".input-default").val('');
|
||||
} else if ($('option:selected', this).val() == 'notrans') {
|
||||
$(".nama").css('display', 'none');
|
||||
$(".nopol").css('display', 'none');
|
||||
$(".nocard").css('display', 'none');
|
||||
$(".notrans").css('display', 'block');
|
||||
$(".input-default").val('');
|
||||
} else if ($("option:selected", this).val() == "nama") {
|
||||
$(".nama").css("display", "block");
|
||||
$(".nopol").css("display", "none");
|
||||
$(".nocard").css("display", "none");
|
||||
$(".notrans").css("display", "none");
|
||||
$(".input-default").val("");
|
||||
} else if ($("option:selected", this).val() == "nopol") {
|
||||
$(".nama").css("display", "none");
|
||||
$(".nopol").css("display", "block");
|
||||
$(".nocard").css("display", "none");
|
||||
$(".notrans").css("display", "none");
|
||||
$(".input-default").val("");
|
||||
} else if ($("option:selected", this).val() == "nocard") {
|
||||
$(".nama").css("display", "none");
|
||||
$(".nopol").css("display", "none");
|
||||
$(".nocard").css("display", "block");
|
||||
$(".notrans").css("display", "none");
|
||||
$(".input-default").val("");
|
||||
} else if ($("option:selected", this).val() == "notrans") {
|
||||
$(".nama").css("display", "none");
|
||||
$(".nopol").css("display", "none");
|
||||
$(".nocard").css("display", "none");
|
||||
$(".notrans").css("display", "block");
|
||||
$(".input-default").val("");
|
||||
} else {
|
||||
$(".position").css('display', 'none');
|
||||
$(".level-area").css('display', 'none');
|
||||
$(".input-default").val('');
|
||||
$(".position").css("display", "none");
|
||||
$(".level-area").css("display", "none");
|
||||
$(".input-default").val("");
|
||||
}
|
||||
});
|
||||
|
||||
var url = $('#example').data('url');
|
||||
|
||||
$('#search-button').on('click', function () {
|
||||
// Ambil nilai dari selected option
|
||||
var option = $('.select-option').val();
|
||||
var url = $("#example").data("url");
|
||||
|
||||
// Cek jika option yang dipilih bukan 'Pencarian Data...' yang berarti pilihan valid
|
||||
if (option && option !== '') {
|
||||
var inputField = $('.input-default:visible');
|
||||
$("#search-button").on("click", function () {
|
||||
let searchBy = $("#search-by").val();
|
||||
let searchValue = $("#search-value").val().trim();
|
||||
|
||||
// Periksa apakah input tersebut kosong
|
||||
if (inputField.length === 0 || inputField.val().trim() === '') {
|
||||
// Jika kosong, tampilkan alert
|
||||
alert('Harap masukkan ' + (option === 'nopol' ? 'No. Polisi' : option === 'nocard' ? 'No. Card' : option === 'nama' ? 'Nama' : option === 'notrans' ? 'No. Transaksi' : 'No. Transaksi'));
|
||||
inputField.focus();
|
||||
return; // Hentikan proses jika input kosong
|
||||
}
|
||||
let memberType = $("#member-type").val();
|
||||
let department = $("#department").val();
|
||||
let vehicle = $("#vehicle").val();
|
||||
|
||||
// =========================
|
||||
// VALIDASI PENCARIAN
|
||||
// =========================
|
||||
|
||||
if (searchBy !== "" && searchValue === "") {
|
||||
let label = {
|
||||
nama: "Nama",
|
||||
alamat: "Alamat",
|
||||
nopol: "No. Polisi",
|
||||
nocard: "No. Card",
|
||||
notrans: "No. Transaksi",
|
||||
};
|
||||
|
||||
alert("Harap masukkan " + (label[searchBy] || "kata kunci"));
|
||||
|
||||
$("#search-value").focus();
|
||||
|
||||
return;
|
||||
}
|
||||
console.log(option);
|
||||
|
||||
var formData = $('#search-form .input-default:visible').val();
|
||||
console.log(formData);
|
||||
|
||||
// =========================
|
||||
// DEBUG
|
||||
// =========================
|
||||
|
||||
console.log({
|
||||
searchBy,
|
||||
searchValue,
|
||||
memberType,
|
||||
department,
|
||||
vehicle,
|
||||
});
|
||||
|
||||
// =========================
|
||||
// AJAX
|
||||
// =========================
|
||||
$.ajax({
|
||||
url: url,
|
||||
type: "POST",
|
||||
data: $('#search-form').serialize(),
|
||||
headers: {'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')},
|
||||
dataType: 'json',
|
||||
data: $("#search-form").serialize(),
|
||||
headers: { "X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr("content") },
|
||||
dataType: "json",
|
||||
beforeSend: function () {
|
||||
$("#search-button").prop("disabled", true).html(`
|
||||
<i class="fa fa-spinner fa-spin me-2"></i>
|
||||
Mencari...
|
||||
`);
|
||||
},
|
||||
success: function (response) {
|
||||
var tbody = $('#example tbody');
|
||||
var tbody = $("#example tbody");
|
||||
tbody.empty();
|
||||
|
||||
if (response.length !== 0) {
|
||||
@@ -98,34 +125,35 @@ $(document).ready(function () {
|
||||
data-awal="${element.awal}"
|
||||
data-akhir="${element.akhir}"
|
||||
>
|
||||
${rowIndex === 0 ? `<td rowspan="${rowspan}" class="p2" style="text-align: center;">${index + 1}</td>` : ''}
|
||||
${rowIndex === 0 ? `<td rowspan="${rowspan}" class="p2" style="padding: 2px;">${element.notrans}</td>` : ''}
|
||||
${rowIndex === 0 ? `<td rowspan="${rowspan}" style="padding: 2px;">${element.nama}</td>` : ''}
|
||||
${rowIndex === 0 ? `<td rowspan="${rowspan}" style="padding: 2px;">${element.alamat}</td>` : ''}
|
||||
${rowIndex === 0 ? `<td rowspan="${rowspan}" style="padding: 2px;">${element.telepon}</td>` : ''}
|
||||
${rowIndex === 0 ? `<td rowspan="${rowspan}" style="padding: 2px;">${element.jmember}</td>` : ''}
|
||||
${rowIndex === 0 ? `<td rowspan="${rowspan}" style="padding: 2px;">${element.dept}</td>` : ''}
|
||||
${rowIndex === 0 ? `<td rowspan="${rowspan}" width="200" style="text-align: center; padding: 2px;">${element.awal} <br> ${element.akhir}</td>` : ''}
|
||||
${rowIndex === 0 ? `<td rowspan="${rowspan}" class="p-2" style="padding: 2px;"> ${[...new Set(rows.map(r => `${r.nopol || 'No. Polisi tidak ada'} (${r.vehicle || ''})`))].join('<br>')} </td>` : ''}
|
||||
${rowIndex === 0 ? `<td rowspan="${rowspan}" style="padding: 2px;">${[...new Set(rows.map(r => r.no_card || 'Tidak ada kartu'))].join('<br>')}</td>` : ''}
|
||||
${rowIndex === 0 ? `<td rowspan="${rowspan}" class="p2" style="text-align: center;">${index + 1}</td>` : ""}
|
||||
${rowIndex === 0 ? `<td rowspan="${rowspan}" class="p2" style="padding: 2px;">${element.notrans}</td>` : ""}
|
||||
${rowIndex === 0 ? `<td rowspan="${rowspan}" style="padding: 2px;">${element.nama}</td>` : ""}
|
||||
${rowIndex === 0 ? `<td rowspan="${rowspan}" style="padding: 2px;">${element.alamat}</td>` : ""}
|
||||
${rowIndex === 0 ? `<td rowspan="${rowspan}" style="padding: 2px;">${element.telepon}</td>` : ""}
|
||||
${rowIndex === 0 ? `<td rowspan="${rowspan}" style="padding: 2px;">${element.jmember}</td>` : ""}
|
||||
${rowIndex === 0 ? `<td rowspan="${rowspan}" style="padding: 2px;">${element.dept}</td>` : ""}
|
||||
${rowIndex === 0 ? `<td rowspan="${rowspan}" width="200" style="text-align: center; padding: 2px;">${element.awal} <br> ${element.akhir}</td>` : ""}
|
||||
${rowIndex === 0 ? `<td rowspan="${rowspan}" class="p-2" style="padding: 2px;"> ${[...new Set(rows.map((r) => `${r.nopol || "No. Polisi tidak ada"} (${r.vehicle || ""})`))].join("<br>")} </td>` : ""}
|
||||
${rowIndex === 0 ? `<td rowspan="${rowspan}" style="padding: 2px;">${[...new Set(rows.map((r) => r.no_card || "Tidak ada kartu"))].join("<br>")}</td>` : ""}
|
||||
</tr>
|
||||
`;
|
||||
// ${rowIndex === 0 ? `<td rowspan="${rowspan}" class="p-2" style="text-align: center;">
|
||||
// <button class="btn btn-secondary btn-xs extend-button mb-1" data-id="${element.notrans}">Extend</button>
|
||||
// <button class="btn btn-primary btn-xs edit-button mb-1" data-id="${element.notrans}">Edit</button>
|
||||
// <button class="btn btn-danger btn-xs delete-button mb-1" data-id="${element.notrans}">Delete</button>
|
||||
// </td>` : ''}
|
||||
// ${rowIndex === 0 ? `<td rowspan="${rowspan}" class="p-2" style="text-align: center;">
|
||||
// <button class="btn btn-secondary btn-xs extend-button mb-1" data-id="${element.notrans}">Extend</button>
|
||||
// <button class="btn btn-primary btn-xs edit-button mb-1" data-id="${element.notrans}">Edit</button>
|
||||
// <button class="btn btn-danger btn-xs delete-button mb-1" data-id="${element.notrans}">Delete</button>
|
||||
// </td>` : ''}
|
||||
tbody.append(rowHtml);
|
||||
});
|
||||
});
|
||||
} else {
|
||||
alert("Data tidak ditemukan.");
|
||||
$('#example tbody').html(
|
||||
$("#example tbody").html(
|
||||
`<tr>
|
||||
<td colspan="11" style="text-align: center;"><p class="text-danger mt-3">Tidak ditemukan data</p></td>
|
||||
<tr>`);
|
||||
<tr>`,
|
||||
);
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
});
|
||||
},
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -243,6 +243,8 @@ $(document).ready(function () {
|
||||
cardNumber: cardCollect,
|
||||
};
|
||||
|
||||
console.log("FORM ADD:", allData);
|
||||
|
||||
if ($(".tambah-member").valid()) {
|
||||
$.ajax({
|
||||
url: $("#add-member").attr("action"),
|
||||
@@ -250,23 +252,27 @@ $(document).ready(function () {
|
||||
data: allData,
|
||||
headers: { "X-CSRF-token": $('meta[name="csrf-token"]').attr("content") },
|
||||
beforeSend: function () {
|
||||
tombol.attr("disabled", true);
|
||||
// tombol.attr("disabled", true);
|
||||
},
|
||||
success: function (r) {
|
||||
// alert('Data berhasil dikirim');
|
||||
$("#modal-member").modal("hide");
|
||||
if (r.response == true) {
|
||||
$("#modal-member").modal("hide");
|
||||
Swal.fire({
|
||||
title: "Berhasil!!",
|
||||
text: "Member anda telah terdaftar !!",
|
||||
text: "Member berhasil di daftarkan.. !!",
|
||||
timer: 5000,
|
||||
showConfirmButton: !1,
|
||||
// showConfirmButton: !1,
|
||||
}).then(function () {
|
||||
// Reload halaman setelah SweetAlert ditutup
|
||||
location.reload(); // Ini akan me-reload halaman
|
||||
// location.reload(); // Ini akan me-reload halaman
|
||||
});
|
||||
} else if (r.response == false) {
|
||||
Swal.fire("Oops...", "Terjadi kendala !!", "silahkan hubungi admin", "error");
|
||||
Swal.fire({
|
||||
icon: "error",
|
||||
title: "Oops...",
|
||||
text: r.message || "Terjadi kendala, silakan hubungi admin.",
|
||||
});
|
||||
}
|
||||
console.log(r);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user