feat: optimasi script
parent
9bda154947
commit
ea82109dcb
|
|
@ -203,157 +203,158 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="https://code.jquery.com/jquery-3.7.1.js"></script>
|
|
||||||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
let currentData = {
|
|
||||||
aktivitas: [],
|
|
||||||
fasilitas: [],
|
|
||||||
jenis_pengolahan: []
|
|
||||||
};
|
|
||||||
|
|
||||||
$(document).ready(function () {
|
@section Scripts {
|
||||||
loadData();
|
<script type="text/javascript">
|
||||||
});
|
let currentData = {
|
||||||
|
aktivitas: [],
|
||||||
|
fasilitas: [],
|
||||||
|
jenis_pengolahan: []
|
||||||
|
};
|
||||||
|
|
||||||
function loadData() {
|
$(document).ready(function () {
|
||||||
$.ajax({
|
loadData();
|
||||||
url: '/Data/Aktivitas/Get',
|
|
||||||
type: 'GET',
|
|
||||||
success: function(data) {
|
|
||||||
currentData = data;
|
|
||||||
updateViewMode();
|
|
||||||
},
|
|
||||||
error: function() {
|
|
||||||
Swal.fire({
|
|
||||||
title: 'Error!',
|
|
||||||
text: 'Gagal memuat data',
|
|
||||||
icon: 'error',
|
|
||||||
confirmButtonText: 'OK',
|
|
||||||
buttonsStyling: false,
|
|
||||||
customClass: {
|
|
||||||
confirmButton: 'btn bg-green-800 text-white hover:bg-green-900 px-4 py-2 rounded-full',
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function updateViewMode() {
|
|
||||||
// Update Aktivitas - tampilkan dalam satu baris
|
|
||||||
if (currentData.aktivitas && currentData.aktivitas.length > 0) {
|
|
||||||
const aktivitasHtml = currentData.aktivitas.map(item =>
|
|
||||||
`<div class="justify-start text-slate-800 text-base font-normal font-['Plus_Jakarta_Sans'] leading-6">${item}</div>`
|
|
||||||
).join('');
|
|
||||||
$('#viewAktivitas').html(aktivitasHtml);
|
|
||||||
} else {
|
|
||||||
$('#viewAktivitas').html('<div class="text-gray-400">-</div>');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update Fasilitas - tampilkan dalam satu baris
|
|
||||||
if (currentData.fasilitas && currentData.fasilitas.length > 0) {
|
|
||||||
const fasilitasHtml = currentData.fasilitas.map(item =>
|
|
||||||
`<div class="justify-start text-slate-800 text-base font-normal font-['Plus_Jakarta_Sans'] leading-6">${item}</div>`
|
|
||||||
).join('');
|
|
||||||
$('#viewFasilitas').html(fasilitasHtml);
|
|
||||||
} else {
|
|
||||||
$('#viewFasilitas').html('<div class="text-gray-400">-</div>');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update Jenis Pengolahan - tampilkan dalam satu baris
|
|
||||||
if (currentData.jenis_pengolahan && currentData.jenis_pengolahan.length > 0) {
|
|
||||||
const jenisPengolahanHtml = currentData.jenis_pengolahan.map(item =>
|
|
||||||
`<div class="justify-start text-slate-800 text-base font-normal font-['Plus_Jakarta_Sans'] leading-6">${item}</div>`
|
|
||||||
).join('');
|
|
||||||
$('#viewJenisPengolahan').html(jenisPengolahanHtml);
|
|
||||||
} else {
|
|
||||||
$('#viewJenisPengolahan').html('<div class="text-gray-400">-</div>');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function toggleEditMode() {
|
|
||||||
$('#viewMode').addClass('hidden');
|
|
||||||
$('#editMode').removeClass('hidden').addClass('flex');
|
|
||||||
|
|
||||||
// Set checkboxes based on current data
|
|
||||||
$('input[name="aktivitas"]').each(function() {
|
|
||||||
$(this).prop('checked', currentData.aktivitas.includes($(this).val()));
|
|
||||||
});
|
|
||||||
$('input[name="fasilitas"]').each(function() {
|
|
||||||
$(this).prop('checked', currentData.fasilitas.includes($(this).val()));
|
|
||||||
});
|
|
||||||
$('input[name="jenis_pengolahan"]').each(function() {
|
|
||||||
$(this).prop('checked', currentData.jenis_pengolahan.includes($(this).val()));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function cancelEdit() {
|
|
||||||
$('#editMode').addClass('hidden').removeClass('flex');
|
|
||||||
$('#viewMode').removeClass('hidden');
|
|
||||||
}
|
|
||||||
|
|
||||||
function saveData() {
|
|
||||||
// Collect checked values
|
|
||||||
const aktivitas = [];
|
|
||||||
$('input[name="aktivitas"]:checked').each(function() {
|
|
||||||
aktivitas.push($(this).val());
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const fasilitas = [];
|
function loadData() {
|
||||||
$('input[name="fasilitas"]:checked').each(function() {
|
$.ajax({
|
||||||
fasilitas.push($(this).val());
|
url: '/Data/Aktivitas/Get',
|
||||||
});
|
type: 'GET',
|
||||||
|
success: function(data) {
|
||||||
const jenisPengolahan = [];
|
currentData = data;
|
||||||
$('input[name="jenis_pengolahan"]:checked').each(function() {
|
updateViewMode();
|
||||||
jenisPengolahan.push($(this).val());
|
},
|
||||||
});
|
error: function() {
|
||||||
|
|
||||||
// Send to server
|
|
||||||
$.ajax({
|
|
||||||
url: '/Data/Aktivitas/Save',
|
|
||||||
type: 'POST',
|
|
||||||
contentType: 'application/json',
|
|
||||||
data: JSON.stringify({
|
|
||||||
Aktivitas: aktivitas,
|
|
||||||
Fasilitas: fasilitas,
|
|
||||||
JenisPengolahan: jenisPengolahan
|
|
||||||
}),
|
|
||||||
success: function(response) {
|
|
||||||
if (response.success) {
|
|
||||||
Swal.fire({
|
Swal.fire({
|
||||||
title: 'Berhasil!',
|
title: 'Error!',
|
||||||
text: response.message,
|
text: 'Gagal memuat data',
|
||||||
icon: 'success',
|
icon: 'error',
|
||||||
confirmButtonText: 'OK',
|
confirmButtonText: 'OK',
|
||||||
buttonsStyling: false,
|
buttonsStyling: false,
|
||||||
customClass: {
|
customClass: {
|
||||||
confirmButton: 'btn bg-green-800 text-white hover:bg-green-900 px-4 py-2 rounded-full',
|
confirmButton: 'btn bg-green-800 text-white hover:bg-green-900 px-4 py-2 rounded-full',
|
||||||
},
|
},
|
||||||
}).then(() => {
|
|
||||||
// Update current data and switch to view mode
|
|
||||||
currentData = {
|
|
||||||
aktivitas: aktivitas,
|
|
||||||
fasilitas: fasilitas,
|
|
||||||
jenis_pengolahan: jenisPengolahan
|
|
||||||
};
|
|
||||||
updateViewMode();
|
|
||||||
cancelEdit();
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
});
|
||||||
error: function() {
|
}
|
||||||
Swal.fire({
|
|
||||||
title: 'Error!',
|
function updateViewMode() {
|
||||||
text: 'Gagal menyimpan data',
|
// Update Aktivitas - tampilkan dalam satu baris
|
||||||
icon: 'error',
|
if (currentData.aktivitas && currentData.aktivitas.length > 0) {
|
||||||
confirmButtonText: 'OK',
|
const aktivitasHtml = currentData.aktivitas.map(item =>
|
||||||
buttonsStyling: false,
|
`<div class="justify-start text-slate-800 text-base font-normal font-['Plus_Jakarta_Sans'] leading-6">${item}</div>`
|
||||||
customClass: {
|
).join('');
|
||||||
confirmButton: 'btn bg-green-800 text-white hover:bg-green-900 px-4 py-2 rounded-full',
|
$('#viewAktivitas').html(aktivitasHtml);
|
||||||
},
|
} else {
|
||||||
});
|
$('#viewAktivitas').html('<div class="text-gray-400">-</div>');
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
// Update Fasilitas - tampilkan dalam satu baris
|
||||||
</script>
|
if (currentData.fasilitas && currentData.fasilitas.length > 0) {
|
||||||
|
const fasilitasHtml = currentData.fasilitas.map(item =>
|
||||||
|
`<div class="justify-start text-slate-800 text-base font-normal font-['Plus_Jakarta_Sans'] leading-6">${item}</div>`
|
||||||
|
).join('');
|
||||||
|
$('#viewFasilitas').html(fasilitasHtml);
|
||||||
|
} else {
|
||||||
|
$('#viewFasilitas').html('<div class="text-gray-400">-</div>');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update Jenis Pengolahan - tampilkan dalam satu baris
|
||||||
|
if (currentData.jenis_pengolahan && currentData.jenis_pengolahan.length > 0) {
|
||||||
|
const jenisPengolahanHtml = currentData.jenis_pengolahan.map(item =>
|
||||||
|
`<div class="justify-start text-slate-800 text-base font-normal font-['Plus_Jakarta_Sans'] leading-6">${item}</div>`
|
||||||
|
).join('');
|
||||||
|
$('#viewJenisPengolahan').html(jenisPengolahanHtml);
|
||||||
|
} else {
|
||||||
|
$('#viewJenisPengolahan').html('<div class="text-gray-400">-</div>');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function toggleEditMode() {
|
||||||
|
$('#viewMode').addClass('hidden');
|
||||||
|
$('#editMode').removeClass('hidden').addClass('flex');
|
||||||
|
|
||||||
|
// Set checkboxes based on current data
|
||||||
|
$('input[name="aktivitas"]').each(function() {
|
||||||
|
$(this).prop('checked', currentData.aktivitas.includes($(this).val()));
|
||||||
|
});
|
||||||
|
$('input[name="fasilitas"]').each(function() {
|
||||||
|
$(this).prop('checked', currentData.fasilitas.includes($(this).val()));
|
||||||
|
});
|
||||||
|
$('input[name="jenis_pengolahan"]').each(function() {
|
||||||
|
$(this).prop('checked', currentData.jenis_pengolahan.includes($(this).val()));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function cancelEdit() {
|
||||||
|
$('#editMode').addClass('hidden').removeClass('flex');
|
||||||
|
$('#viewMode').removeClass('hidden');
|
||||||
|
}
|
||||||
|
|
||||||
|
function saveData() {
|
||||||
|
// Collect checked values
|
||||||
|
const aktivitas = [];
|
||||||
|
$('input[name="aktivitas"]:checked').each(function() {
|
||||||
|
aktivitas.push($(this).val());
|
||||||
|
});
|
||||||
|
|
||||||
|
const fasilitas = [];
|
||||||
|
$('input[name="fasilitas"]:checked').each(function() {
|
||||||
|
fasilitas.push($(this).val());
|
||||||
|
});
|
||||||
|
|
||||||
|
const jenisPengolahan = [];
|
||||||
|
$('input[name="jenis_pengolahan"]:checked').each(function() {
|
||||||
|
jenisPengolahan.push($(this).val());
|
||||||
|
});
|
||||||
|
|
||||||
|
// Send to server
|
||||||
|
$.ajax({
|
||||||
|
url: '/Data/Aktivitas/Save',
|
||||||
|
type: 'POST',
|
||||||
|
contentType: 'application/json',
|
||||||
|
data: JSON.stringify({
|
||||||
|
Aktivitas: aktivitas,
|
||||||
|
Fasilitas: fasilitas,
|
||||||
|
JenisPengolahan: jenisPengolahan
|
||||||
|
}),
|
||||||
|
success: function(response) {
|
||||||
|
if (response.success) {
|
||||||
|
Swal.fire({
|
||||||
|
title: 'Berhasil!',
|
||||||
|
text: response.message,
|
||||||
|
icon: 'success',
|
||||||
|
confirmButtonText: 'OK',
|
||||||
|
buttonsStyling: false,
|
||||||
|
customClass: {
|
||||||
|
confirmButton: 'btn bg-green-800 text-white hover:bg-green-900 px-4 py-2 rounded-full',
|
||||||
|
},
|
||||||
|
}).then(() => {
|
||||||
|
// Update current data and switch to view mode
|
||||||
|
currentData = {
|
||||||
|
aktivitas: aktivitas,
|
||||||
|
fasilitas: fasilitas,
|
||||||
|
jenis_pengolahan: jenisPengolahan
|
||||||
|
};
|
||||||
|
updateViewMode();
|
||||||
|
cancelEdit();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: function() {
|
||||||
|
Swal.fire({
|
||||||
|
title: 'Error!',
|
||||||
|
text: 'Gagal menyimpan data',
|
||||||
|
icon: 'error',
|
||||||
|
confirmButtonText: 'OK',
|
||||||
|
buttonsStyling: false,
|
||||||
|
customClass: {
|
||||||
|
confirmButton: 'btn bg-green-800 text-white hover:bg-green-900 px-4 py-2 rounded-full',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -98,149 +98,148 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="https://code.jquery.com/jquery-3.7.1.js"></script>
|
|
||||||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
|
||||||
<script src="https://cdn.datatables.net/2.3.4/js/dataTables.js"></script>
|
|
||||||
<script src="/plugins/datatables/dataTables.tailwindcss.js"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
var table;
|
|
||||||
|
|
||||||
$(document).ready(function () {
|
@section Scripts {
|
||||||
table = new DataTable('#example', {
|
<script type="text/javascript">
|
||||||
ajax: '/Data/BankSampahInduk/Table',
|
var table;
|
||||||
scrollX: true,
|
|
||||||
autoWidth: false,
|
$(document).ready(function () {
|
||||||
initComplete: function () {
|
table = new DataTable('#example', {
|
||||||
$('div.dt-scroll-body thead').css('visibility', 'collapse');
|
ajax: '/Data/BankSampahInduk/Table',
|
||||||
},
|
scrollX: true,
|
||||||
columns: [
|
autoWidth: false,
|
||||||
{ data: null, render: (d, t, r, m) => m.row + 1, orderable: false, searchable: false },
|
initComplete: function () {
|
||||||
{ data: 'nama' },
|
$('div.dt-scroll-body thead').css('visibility', 'collapse');
|
||||||
{ data: 'tgl_pendaftaran' },
|
},
|
||||||
{
|
columns: [
|
||||||
data: 'status',
|
{ data: null, render: (d, t, r, m) => m.row + 1, orderable: false, searchable: false },
|
||||||
render: function(data, type, row) {
|
{ data: 'nama' },
|
||||||
if (data === 'Aktif') {
|
{ data: 'tgl_pendaftaran' },
|
||||||
return '<div class="px-2 py-1 bg-green-100 rounded-full inline-flex items-center justify-center"><span class="text-green-600 text-xs font-semibold font-[\'Plus_Jakarta_Sans\']">Aktif</span></div>';
|
{
|
||||||
} else {
|
data: 'status',
|
||||||
return '<div class="px-2 py-1 bg-red-50 rounded-full inline-flex items-center justify-center"><span class="text-red-600 text-xs font-medium font-[\'Plus_Jakarta_Sans\']">Tidak Aktif</span></div>';
|
render: function(data, type, row) {
|
||||||
|
if (data === 'Aktif') {
|
||||||
|
return '<div class="px-2 py-1 bg-green-100 rounded-full inline-flex items-center justify-center"><span class="text-green-600 text-xs font-semibold font-[\'Plus_Jakarta_Sans\']">Aktif</span></div>';
|
||||||
|
} else {
|
||||||
|
return '<div class="px-2 py-1 bg-red-50 rounded-full inline-flex items-center justify-center"><span class="text-red-600 text-xs font-medium font-[\'Plus_Jakarta_Sans\']">Tidak Aktif</span></div>';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{ data: 'aksi' },
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
|
// Delete button handler
|
||||||
|
$('#example').on('click', '.delete-btn', function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
|
||||||
|
var id = $(this).data('id');
|
||||||
|
|
||||||
|
Swal.fire({
|
||||||
|
title: 'Apakah anda yakin?',
|
||||||
|
text: "Data yang dihapus tidak dapat dikembalikan lagi",
|
||||||
|
icon: 'warning',
|
||||||
|
showCancelButton: true,
|
||||||
|
confirmButtonText: 'Ya, Hapus',
|
||||||
|
cancelButtonText: 'Batal',
|
||||||
|
buttonsStyling: false,
|
||||||
|
customClass: {
|
||||||
|
confirmButton: 'btn bg-red-500 text-white hover:bg-red-600 px-4 py-2 rounded-full mr-2',
|
||||||
|
cancelButton: 'btn bg-white text-gray-500 hover:bg-gray-50 px-4 py-2 rounded-full border border-gray-300',
|
||||||
|
},
|
||||||
|
}).then((result) => {
|
||||||
|
if (result.isConfirmed) {
|
||||||
|
// TODO: Implement actual delete API call
|
||||||
|
Swal.fire({
|
||||||
|
title: 'Terhapus!',
|
||||||
|
text: 'Data berhasil dihapus.',
|
||||||
|
icon: 'success',
|
||||||
|
confirmButtonText: 'OK',
|
||||||
|
buttonsStyling: false,
|
||||||
|
customClass: {
|
||||||
|
confirmButton: 'btn bg-green-800 text-white hover:bg-green-900 px-4 py-2 rounded-full',
|
||||||
|
},
|
||||||
|
}).then(() => {
|
||||||
|
// Reload table
|
||||||
|
table.ajax.reload();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
},
|
});
|
||||||
{ data: 'aksi' },
|
});
|
||||||
]
|
|
||||||
});
|
|
||||||
|
|
||||||
// Delete button handler
|
// Edit button handler
|
||||||
$('#example').on('click', '.delete-btn', function (e) {
|
$('#example').on('click', '.edit-btn', function (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
var id = $(this).data('id');
|
// Get row data
|
||||||
|
var row = table.row($(this).parents('tr')).data();
|
||||||
|
|
||||||
Swal.fire({
|
// Set edit mode
|
||||||
title: 'Apakah anda yakin?',
|
$('#edit_mode').val('true');
|
||||||
text: "Data yang dihapus tidak dapat dikembalikan lagi",
|
$('#bank_sampah_induk_id').val(row.id);
|
||||||
icon: 'warning',
|
$('#modal_title').text('Edit Data Bank Sampah Induk');
|
||||||
showCancelButton: true,
|
|
||||||
confirmButtonText: 'Ya, Hapus',
|
// Convert date format from "15 Nov 2023" to "2023-11-15"
|
||||||
cancelButtonText: 'Batal',
|
var tglPendaftaran = convertDateToInput(row.tgl_pendaftaran);
|
||||||
buttonsStyling: false,
|
|
||||||
customClass: {
|
// Populate form with row data
|
||||||
confirmButton: 'btn bg-red-500 text-white hover:bg-red-600 px-4 py-2 rounded-full mr-2',
|
$('#nama').val(row.nama);
|
||||||
cancelButton: 'btn bg-white text-gray-500 hover:bg-gray-50 px-4 py-2 rounded-full border border-gray-300',
|
$('#tgl_pendaftaran').val(tglPendaftaran);
|
||||||
},
|
$('#status').val(row.status);
|
||||||
}).then((result) => {
|
|
||||||
if (result.isConfirmed) {
|
// Open modal
|
||||||
// TODO: Implement actual delete API call
|
modal_tambah.showModal();
|
||||||
Swal.fire({
|
|
||||||
title: 'Terhapus!',
|
|
||||||
text: 'Data berhasil dihapus.',
|
|
||||||
icon: 'success',
|
|
||||||
confirmButtonText: 'OK',
|
|
||||||
buttonsStyling: false,
|
|
||||||
customClass: {
|
|
||||||
confirmButton: 'btn bg-green-800 text-white hover:bg-green-900 px-4 py-2 rounded-full',
|
|
||||||
},
|
|
||||||
}).then(() => {
|
|
||||||
// Reload table
|
|
||||||
table.ajax.reload();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// Edit button handler
|
// Function to convert date format "15 Nov 2023" to "2023-11-15"
|
||||||
$('#example').on('click', '.edit-btn', function (e) {
|
function convertDateToInput(dateStr) {
|
||||||
|
const monthMap = {
|
||||||
|
'Jan': '01', 'Feb': '02', 'Mar': '03', 'Apr': '04',
|
||||||
|
'Mei': '05', 'Jun': '06', 'Jul': '07', 'Agt': '08',
|
||||||
|
'Sep': '09', 'Okt': '10', 'Nov': '11', 'Des': '12'
|
||||||
|
};
|
||||||
|
|
||||||
|
const parts = dateStr.split(' ');
|
||||||
|
const day = parts[0].padStart(2, '0');
|
||||||
|
const month = monthMap[parts[1]];
|
||||||
|
const year = parts[2];
|
||||||
|
|
||||||
|
return `${year}-${month}-${day}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
function closeModal() {
|
||||||
|
// Reset form
|
||||||
|
$('#formTambah')[0].reset();
|
||||||
|
$('#edit_mode').val('false');
|
||||||
|
$('#bank_sampah_induk_id').val('');
|
||||||
|
$('#modal_title').text('Tambah Data Bank Sampah Induk');
|
||||||
|
|
||||||
|
// Close modal
|
||||||
|
modal_tambah.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
function submitForm(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
// Get row data
|
var isEditMode = $('#edit_mode').val() === 'true';
|
||||||
var row = table.row($(this).parents('tr')).data();
|
|
||||||
|
|
||||||
// Set edit mode
|
// TODO: Implement form submission logic
|
||||||
$('#edit_mode').val('true');
|
Swal.fire({
|
||||||
$('#bank_sampah_induk_id').val(row.id);
|
title: 'Berhasil!',
|
||||||
$('#modal_title').text('Edit Data Bank Sampah Induk');
|
text: isEditMode ? 'Data berhasil diperbarui' : 'Data berhasil ditambahkan',
|
||||||
|
icon: 'success',
|
||||||
|
confirmButtonText: 'OK',
|
||||||
|
buttonsStyling: false,
|
||||||
|
customClass: {
|
||||||
|
confirmButton: 'btn bg-green-800 text-white hover:bg-green-900 px-4 py-2 rounded-full',
|
||||||
|
},
|
||||||
|
}).then(() => {
|
||||||
|
closeModal();
|
||||||
|
|
||||||
// Convert date format from "15 Nov 2023" to "2023-11-15"
|
// Reload table
|
||||||
var tglPendaftaran = convertDateToInput(row.tgl_pendaftaran);
|
table.ajax.reload();
|
||||||
|
});
|
||||||
// Populate form with row data
|
}
|
||||||
$('#nama').val(row.nama);
|
</script>
|
||||||
$('#tgl_pendaftaran').val(tglPendaftaran);
|
}
|
||||||
$('#status').val(row.status);
|
|
||||||
|
|
||||||
// Open modal
|
|
||||||
modal_tambah.showModal();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
// Function to convert date format "15 Nov 2023" to "2023-11-15"
|
|
||||||
function convertDateToInput(dateStr) {
|
|
||||||
const monthMap = {
|
|
||||||
'Jan': '01', 'Feb': '02', 'Mar': '03', 'Apr': '04',
|
|
||||||
'Mei': '05', 'Jun': '06', 'Jul': '07', 'Agt': '08',
|
|
||||||
'Sep': '09', 'Okt': '10', 'Nov': '11', 'Des': '12'
|
|
||||||
};
|
|
||||||
|
|
||||||
const parts = dateStr.split(' ');
|
|
||||||
const day = parts[0].padStart(2, '0');
|
|
||||||
const month = monthMap[parts[1]];
|
|
||||||
const year = parts[2];
|
|
||||||
|
|
||||||
return `${year}-${month}-${day}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
function closeModal() {
|
|
||||||
// Reset form
|
|
||||||
$('#formTambah')[0].reset();
|
|
||||||
$('#edit_mode').val('false');
|
|
||||||
$('#bank_sampah_induk_id').val('');
|
|
||||||
$('#modal_title').text('Tambah Data Bank Sampah Induk');
|
|
||||||
|
|
||||||
// Close modal
|
|
||||||
modal_tambah.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
function submitForm(e) {
|
|
||||||
e.preventDefault();
|
|
||||||
|
|
||||||
var isEditMode = $('#edit_mode').val() === 'true';
|
|
||||||
|
|
||||||
// TODO: Implement form submission logic
|
|
||||||
Swal.fire({
|
|
||||||
title: 'Berhasil!',
|
|
||||||
text: isEditMode ? 'Data berhasil diperbarui' : 'Data berhasil ditambahkan',
|
|
||||||
icon: 'success',
|
|
||||||
confirmButtonText: 'OK',
|
|
||||||
buttonsStyling: false,
|
|
||||||
customClass: {
|
|
||||||
confirmButton: 'btn bg-green-800 text-white hover:bg-green-900 px-4 py-2 rounded-full',
|
|
||||||
},
|
|
||||||
}).then(() => {
|
|
||||||
closeModal();
|
|
||||||
|
|
||||||
// Reload table
|
|
||||||
table.ajax.reload();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
|
||||||
|
|
@ -82,119 +82,118 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="https://code.jquery.com/jquery-3.7.1.js"></script>
|
|
||||||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
|
||||||
<script src="https://cdn.datatables.net/2.3.4/js/dataTables.js"></script>
|
|
||||||
<script src="/plugins/datatables/dataTables.tailwindcss.js"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
var table;
|
|
||||||
|
|
||||||
$(document).ready(function () {
|
@section Scripts {
|
||||||
table = new DataTable('#example', {
|
<script type="text/javascript">
|
||||||
ajax: '/Data/HargaSampah/Table',
|
var table;
|
||||||
scrollX: true,
|
|
||||||
autoWidth: false,
|
$(document).ready(function () {
|
||||||
initComplete: function () {
|
table = new DataTable('#example', {
|
||||||
$('div.dt-scroll-body thead').css('visibility', 'collapse');
|
ajax: '/Data/HargaSampah/Table',
|
||||||
},
|
scrollX: true,
|
||||||
columns: [
|
autoWidth: false,
|
||||||
{ data: null, render: (d, t, r, m) => m.row + 1, orderable: false, searchable: false },
|
initComplete: function () {
|
||||||
{ data: 'nama_subkategori' },
|
$('div.dt-scroll-body thead').css('visibility', 'collapse');
|
||||||
{
|
},
|
||||||
data: 'harga',
|
columns: [
|
||||||
render: function(data) {
|
{ data: null, render: (d, t, r, m) => m.row + 1, orderable: false, searchable: false },
|
||||||
return new Intl.NumberFormat('id-ID').format(data);
|
{ data: 'nama_subkategori' },
|
||||||
|
{
|
||||||
|
data: 'harga',
|
||||||
|
render: function(data) {
|
||||||
|
return new Intl.NumberFormat('id-ID').format(data);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ data: 'aksi' },
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
|
// Delete button handler
|
||||||
|
$('#example').on('click', '.p-2.bg-red-500', function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
|
||||||
|
Swal.fire({
|
||||||
|
title: 'Anda yakin ingin menghapus data ini?',
|
||||||
|
icon: 'warning',
|
||||||
|
showCancelButton: true,
|
||||||
|
confirmButtonText: 'Ya',
|
||||||
|
cancelButtonText: 'Tidak',
|
||||||
|
buttonsStyling: false,
|
||||||
|
customClass: {
|
||||||
|
confirmButton: 'btn bg-green-800 text-white hover:bg-green-900 px-8 py-2 rounded-full mr-2',
|
||||||
|
cancelButton: 'btn bg-white text-gray-500 hover:bg-gray-50 px-8 py-2 rounded-full border border-gray-300',
|
||||||
|
},
|
||||||
|
}).then((result) => {
|
||||||
|
if (result.isConfirmed) {
|
||||||
|
// TODO: Implement actual delete API call
|
||||||
|
Swal.fire({
|
||||||
|
title: 'Berhasil!',
|
||||||
|
text: 'Data berhasil dihapus.',
|
||||||
|
icon: 'success',
|
||||||
|
confirmButtonText: 'OK',
|
||||||
|
buttonsStyling: false,
|
||||||
|
customClass: {
|
||||||
|
confirmButton: 'btn bg-green-800 text-white hover:bg-green-900 px-4 py-2 rounded-full',
|
||||||
|
},
|
||||||
|
}).then(() => {
|
||||||
|
// Reload table
|
||||||
|
table.ajax.reload();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
},
|
});
|
||||||
{ data: 'aksi' },
|
});
|
||||||
]
|
|
||||||
});
|
|
||||||
|
|
||||||
// Delete button handler
|
// Edit button handler
|
||||||
$('#example').on('click', '.p-2.bg-red-500', function (e) {
|
$('#example').on('click', '.p-2.bg-amber-500', function (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
Swal.fire({
|
// Get row data
|
||||||
title: 'Anda yakin ingin menghapus data ini?',
|
var row = table.row($(this).parents('tr')).data();
|
||||||
icon: 'warning',
|
|
||||||
showCancelButton: true,
|
// Set edit mode
|
||||||
confirmButtonText: 'Ya',
|
$('#edit_mode').val('true');
|
||||||
cancelButtonText: 'Tidak',
|
$('#modal_title').text('Edit Data Harga Sampah');
|
||||||
buttonsStyling: false,
|
|
||||||
customClass: {
|
// Populate form with row data
|
||||||
confirmButton: 'btn bg-green-800 text-white hover:bg-green-900 px-8 py-2 rounded-full mr-2',
|
$('#nama_subkategori').val(row.nama_subkategori);
|
||||||
cancelButton: 'btn bg-white text-gray-500 hover:bg-gray-50 px-8 py-2 rounded-full border border-gray-300',
|
$('#harga').val(row.harga);
|
||||||
},
|
|
||||||
}).then((result) => {
|
// Open modal
|
||||||
if (result.isConfirmed) {
|
modal_tambah.showModal();
|
||||||
// TODO: Implement actual delete API call
|
|
||||||
Swal.fire({
|
|
||||||
title: 'Berhasil!',
|
|
||||||
text: 'Data berhasil dihapus.',
|
|
||||||
icon: 'success',
|
|
||||||
confirmButtonText: 'OK',
|
|
||||||
buttonsStyling: false,
|
|
||||||
customClass: {
|
|
||||||
confirmButton: 'btn bg-green-800 text-white hover:bg-green-900 px-4 py-2 rounded-full',
|
|
||||||
},
|
|
||||||
}).then(() => {
|
|
||||||
// Reload table
|
|
||||||
table.ajax.reload();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// Edit button handler
|
function closeModal() {
|
||||||
$('#example').on('click', '.p-2.bg-amber-500', function (e) {
|
// Reset form
|
||||||
|
$('#formTambah')[0].reset();
|
||||||
|
$('#edit_mode').val('false');
|
||||||
|
$('#modal_title').text('Tambah Data Harga Sampah');
|
||||||
|
|
||||||
|
// Close modal
|
||||||
|
modal_tambah.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
function submitForm(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
// Get row data
|
var isEditMode = $('#edit_mode').val() === 'true';
|
||||||
var row = table.row($(this).parents('tr')).data();
|
|
||||||
|
|
||||||
// Set edit mode
|
// TODO: Implement form submission logic
|
||||||
$('#edit_mode').val('true');
|
Swal.fire({
|
||||||
$('#modal_title').text('Edit Data Harga Sampah');
|
title: 'Berhasil!',
|
||||||
|
text: isEditMode ? 'Data berhasil diperbarui' : 'Data berhasil ditambahkan',
|
||||||
|
icon: 'success',
|
||||||
|
confirmButtonText: 'OK',
|
||||||
|
buttonsStyling: false,
|
||||||
|
customClass: {
|
||||||
|
confirmButton: 'btn bg-green-800 text-white hover:bg-green-900 px-4 py-2 rounded-full',
|
||||||
|
},
|
||||||
|
}).then(() => {
|
||||||
|
closeModal();
|
||||||
|
|
||||||
// Populate form with row data
|
// Reload table
|
||||||
$('#nama_subkategori').val(row.nama_subkategori);
|
table.ajax.reload();
|
||||||
$('#harga').val(row.harga);
|
});
|
||||||
|
}
|
||||||
// Open modal
|
</script>
|
||||||
modal_tambah.showModal();
|
}
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
function closeModal() {
|
|
||||||
// Reset form
|
|
||||||
$('#formTambah')[0].reset();
|
|
||||||
$('#edit_mode').val('false');
|
|
||||||
$('#modal_title').text('Tambah Data Harga Sampah');
|
|
||||||
|
|
||||||
// Close modal
|
|
||||||
modal_tambah.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
function submitForm(e) {
|
|
||||||
e.preventDefault();
|
|
||||||
|
|
||||||
var isEditMode = $('#edit_mode').val() === 'true';
|
|
||||||
|
|
||||||
// TODO: Implement form submission logic
|
|
||||||
Swal.fire({
|
|
||||||
title: 'Berhasil!',
|
|
||||||
text: isEditMode ? 'Data berhasil diperbarui' : 'Data berhasil ditambahkan',
|
|
||||||
icon: 'success',
|
|
||||||
confirmButtonText: 'OK',
|
|
||||||
buttonsStyling: false,
|
|
||||||
customClass: {
|
|
||||||
confirmButton: 'btn bg-green-800 text-white hover:bg-green-900 px-4 py-2 rounded-full',
|
|
||||||
},
|
|
||||||
}).then(() => {
|
|
||||||
closeModal();
|
|
||||||
|
|
||||||
// Reload table
|
|
||||||
table.ajax.reload();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
|
||||||
|
|
@ -118,158 +118,157 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="https://code.jquery.com/jquery-3.7.1.js"></script>
|
|
||||||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
|
||||||
<script src="https://cdn.datatables.net/2.3.4/js/dataTables.js"></script>
|
|
||||||
<script src="/plugins/datatables/dataTables.tailwindcss.js"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
var table;
|
|
||||||
|
|
||||||
$(document).ready(function () {
|
@section Scripts {
|
||||||
table = new DataTable('#example', {
|
<script type="text/javascript">
|
||||||
ajax: '/Data/Nasabah/Table',
|
var table;
|
||||||
scrollX: true,
|
|
||||||
autoWidth: false,
|
$(document).ready(function () {
|
||||||
initComplete: function () {
|
table = new DataTable('#example', {
|
||||||
$('div.dt-scroll-body thead').css('visibility', 'collapse');
|
ajax: '/Data/Nasabah/Table',
|
||||||
},
|
scrollX: true,
|
||||||
columns: [
|
autoWidth: false,
|
||||||
{ data: null, render: (d, t, r, m) => m.row + 1, orderable: false, searchable: false },
|
initComplete: function () {
|
||||||
{ data: 'nama' },
|
$('div.dt-scroll-body thead').css('visibility', 'collapse');
|
||||||
{ data: 'tgl_pendaftaran' },
|
},
|
||||||
{
|
columns: [
|
||||||
data: 'status',
|
{ data: null, render: (d, t, r, m) => m.row + 1, orderable: false, searchable: false },
|
||||||
render: function(data, type, row) {
|
{ data: 'nama' },
|
||||||
if (data === 'Aktif') {
|
{ data: 'tgl_pendaftaran' },
|
||||||
return '<div class="px-2 py-1 bg-green-100 rounded-full inline-flex items-center justify-center"><span class="text-green-600 text-xs font-semibold font-[\'Plus_Jakarta_Sans\']">Aktif</span></div>';
|
{
|
||||||
} else {
|
data: 'status',
|
||||||
return '<div class="px-2 py-1 bg-red-50 rounded-full inline-flex items-center justify-center"><span class="text-red-600 text-xs font-medium font-[\'Plus_Jakarta_Sans\']">Tidak Aktif</span></div>';
|
render: function(data, type, row) {
|
||||||
|
if (data === 'Aktif') {
|
||||||
|
return '<div class="px-2 py-1 bg-green-100 rounded-full inline-flex items-center justify-center"><span class="text-green-600 text-xs font-semibold font-[\'Plus_Jakarta_Sans\']">Aktif</span></div>';
|
||||||
|
} else {
|
||||||
|
return '<div class="px-2 py-1 bg-red-50 rounded-full inline-flex items-center justify-center"><span class="text-red-600 text-xs font-medium font-[\'Plus_Jakarta_Sans\']">Tidak Aktif</span></div>';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
data: 'saldo_awal',
|
||||||
|
render: function(data, type, row) {
|
||||||
|
return new Intl.NumberFormat('id-ID').format(data);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ data: 'status_penarikan' },
|
||||||
|
{ data: 'aksi' },
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
|
// Delete button handler
|
||||||
|
$('#example').on('click', '.delete-btn', function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
|
||||||
|
var id = $(this).data('id');
|
||||||
|
|
||||||
|
Swal.fire({
|
||||||
|
title: 'Apakah anda yakin?',
|
||||||
|
text: "Data yang dihapus tidak dapat dikembalikan lagi",
|
||||||
|
icon: 'warning',
|
||||||
|
showCancelButton: true,
|
||||||
|
confirmButtonText: 'Ya, Hapus',
|
||||||
|
cancelButtonText: 'Batal',
|
||||||
|
buttonsStyling: false,
|
||||||
|
customClass: {
|
||||||
|
confirmButton: 'btn bg-red-500 text-white hover:bg-red-600 px-4 py-2 rounded-full mr-2',
|
||||||
|
cancelButton: 'btn bg-white text-gray-500 hover:bg-gray-50 px-4 py-2 rounded-full border border-gray-300',
|
||||||
|
},
|
||||||
|
}).then((result) => {
|
||||||
|
if (result.isConfirmed) {
|
||||||
|
// TODO: Implement actual delete API call
|
||||||
|
Swal.fire({
|
||||||
|
title: 'Terhapus!',
|
||||||
|
text: 'Data berhasil dihapus.',
|
||||||
|
icon: 'success',
|
||||||
|
confirmButtonText: 'OK',
|
||||||
|
buttonsStyling: false,
|
||||||
|
customClass: {
|
||||||
|
confirmButton: 'btn bg-green-800 text-white hover:bg-green-900 px-4 py-2 rounded-full',
|
||||||
|
},
|
||||||
|
}).then(() => {
|
||||||
|
// Reload table
|
||||||
|
table.ajax.reload();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
},
|
});
|
||||||
{
|
});
|
||||||
data: 'saldo_awal',
|
|
||||||
render: function(data, type, row) {
|
|
||||||
return new Intl.NumberFormat('id-ID').format(data);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{ data: 'status_penarikan' },
|
|
||||||
{ data: 'aksi' },
|
|
||||||
]
|
|
||||||
});
|
|
||||||
|
|
||||||
// Delete button handler
|
// Edit button handler
|
||||||
$('#example').on('click', '.delete-btn', function (e) {
|
$('#example').on('click', '.edit-btn', function (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
var id = $(this).data('id');
|
// Get row data
|
||||||
|
var row = table.row($(this).parents('tr')).data();
|
||||||
|
|
||||||
Swal.fire({
|
// Set edit mode
|
||||||
title: 'Apakah anda yakin?',
|
$('#edit_mode').val('true');
|
||||||
text: "Data yang dihapus tidak dapat dikembalikan lagi",
|
$('#nasabah_id').val(row.id);
|
||||||
icon: 'warning',
|
$('#modal_title').text('Edit Data Nasabah');
|
||||||
showCancelButton: true,
|
|
||||||
confirmButtonText: 'Ya, Hapus',
|
// Convert date format from "15 Nov 2023" to "2023-11-15"
|
||||||
cancelButtonText: 'Batal',
|
var tglPendaftaran = convertDateToInput(row.tgl_pendaftaran);
|
||||||
buttonsStyling: false,
|
|
||||||
customClass: {
|
// Populate form with row data
|
||||||
confirmButton: 'btn bg-red-500 text-white hover:bg-red-600 px-4 py-2 rounded-full mr-2',
|
$('#nama').val(row.nama);
|
||||||
cancelButton: 'btn bg-white text-gray-500 hover:bg-gray-50 px-4 py-2 rounded-full border border-gray-300',
|
$('#tgl_pendaftaran').val(tglPendaftaran);
|
||||||
},
|
$('#status').val(row.status);
|
||||||
}).then((result) => {
|
$('#saldo_awal').val(row.saldo_awal);
|
||||||
if (result.isConfirmed) {
|
$('#status_penarikan').val(row.status_penarikan);
|
||||||
// TODO: Implement actual delete API call
|
|
||||||
Swal.fire({
|
// Open modal
|
||||||
title: 'Terhapus!',
|
modal_tambah.showModal();
|
||||||
text: 'Data berhasil dihapus.',
|
|
||||||
icon: 'success',
|
|
||||||
confirmButtonText: 'OK',
|
|
||||||
buttonsStyling: false,
|
|
||||||
customClass: {
|
|
||||||
confirmButton: 'btn bg-green-800 text-white hover:bg-green-900 px-4 py-2 rounded-full',
|
|
||||||
},
|
|
||||||
}).then(() => {
|
|
||||||
// Reload table
|
|
||||||
table.ajax.reload();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// Edit button handler
|
// Function to convert date format "15 Nov 2023" to "2023-11-15"
|
||||||
$('#example').on('click', '.edit-btn', function (e) {
|
function convertDateToInput(dateStr) {
|
||||||
|
const monthMap = {
|
||||||
|
'Jan': '01', 'Feb': '02', 'Mar': '03', 'Apr': '04',
|
||||||
|
'Mei': '05', 'Jun': '06', 'Jul': '07', 'Agt': '08',
|
||||||
|
'Sep': '09', 'Okt': '10', 'Nov': '11', 'Des': '12'
|
||||||
|
};
|
||||||
|
|
||||||
|
const parts = dateStr.split(' ');
|
||||||
|
const day = parts[0].padStart(2, '0');
|
||||||
|
const month = monthMap[parts[1]];
|
||||||
|
const year = parts[2];
|
||||||
|
|
||||||
|
return `${year}-${month}-${day}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
function closeModal() {
|
||||||
|
// Reset form
|
||||||
|
$('#formTambah')[0].reset();
|
||||||
|
$('#edit_mode').val('false');
|
||||||
|
$('#nasabah_id').val('');
|
||||||
|
$('#modal_title').text('Tambah Data Nasabah');
|
||||||
|
|
||||||
|
// Close modal
|
||||||
|
modal_tambah.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
function submitForm(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
// Get row data
|
var isEditMode = $('#edit_mode').val() === 'true';
|
||||||
var row = table.row($(this).parents('tr')).data();
|
|
||||||
|
|
||||||
// Set edit mode
|
// TODO: Implement form submission logic
|
||||||
$('#edit_mode').val('true');
|
Swal.fire({
|
||||||
$('#nasabah_id').val(row.id);
|
title: 'Berhasil!',
|
||||||
$('#modal_title').text('Edit Data Nasabah');
|
text: isEditMode ? 'Data berhasil diperbarui' : 'Data berhasil ditambahkan',
|
||||||
|
icon: 'success',
|
||||||
|
confirmButtonText: 'OK',
|
||||||
|
buttonsStyling: false,
|
||||||
|
customClass: {
|
||||||
|
confirmButton: 'btn bg-green-800 text-white hover:bg-green-900 px-4 py-2 rounded-full',
|
||||||
|
},
|
||||||
|
}).then(() => {
|
||||||
|
closeModal();
|
||||||
|
|
||||||
// Convert date format from "15 Nov 2023" to "2023-11-15"
|
// Reload table
|
||||||
var tglPendaftaran = convertDateToInput(row.tgl_pendaftaran);
|
table.ajax.reload();
|
||||||
|
});
|
||||||
// Populate form with row data
|
}
|
||||||
$('#nama').val(row.nama);
|
</script>
|
||||||
$('#tgl_pendaftaran').val(tglPendaftaran);
|
}
|
||||||
$('#status').val(row.status);
|
|
||||||
$('#saldo_awal').val(row.saldo_awal);
|
|
||||||
$('#status_penarikan').val(row.status_penarikan);
|
|
||||||
|
|
||||||
// Open modal
|
|
||||||
modal_tambah.showModal();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
// Function to convert date format "15 Nov 2023" to "2023-11-15"
|
|
||||||
function convertDateToInput(dateStr) {
|
|
||||||
const monthMap = {
|
|
||||||
'Jan': '01', 'Feb': '02', 'Mar': '03', 'Apr': '04',
|
|
||||||
'Mei': '05', 'Jun': '06', 'Jul': '07', 'Agt': '08',
|
|
||||||
'Sep': '09', 'Okt': '10', 'Nov': '11', 'Des': '12'
|
|
||||||
};
|
|
||||||
|
|
||||||
const parts = dateStr.split(' ');
|
|
||||||
const day = parts[0].padStart(2, '0');
|
|
||||||
const month = monthMap[parts[1]];
|
|
||||||
const year = parts[2];
|
|
||||||
|
|
||||||
return `${year}-${month}-${day}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
function closeModal() {
|
|
||||||
// Reset form
|
|
||||||
$('#formTambah')[0].reset();
|
|
||||||
$('#edit_mode').val('false');
|
|
||||||
$('#nasabah_id').val('');
|
|
||||||
$('#modal_title').text('Tambah Data Nasabah');
|
|
||||||
|
|
||||||
// Close modal
|
|
||||||
modal_tambah.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
function submitForm(e) {
|
|
||||||
e.preventDefault();
|
|
||||||
|
|
||||||
var isEditMode = $('#edit_mode').val() === 'true';
|
|
||||||
|
|
||||||
// TODO: Implement form submission logic
|
|
||||||
Swal.fire({
|
|
||||||
title: 'Berhasil!',
|
|
||||||
text: isEditMode ? 'Data berhasil diperbarui' : 'Data berhasil ditambahkan',
|
|
||||||
icon: 'success',
|
|
||||||
confirmButtonText: 'OK',
|
|
||||||
buttonsStyling: false,
|
|
||||||
customClass: {
|
|
||||||
confirmButton: 'btn bg-green-800 text-white hover:bg-green-900 px-4 py-2 rounded-full',
|
|
||||||
},
|
|
||||||
}).then(() => {
|
|
||||||
closeModal();
|
|
||||||
|
|
||||||
// Reload table
|
|
||||||
table.ajax.reload();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
|
||||||
|
|
@ -2,10 +2,6 @@
|
||||||
ViewData["Title"] = "Offtaker Sampah";
|
ViewData["Title"] = "Offtaker Sampah";
|
||||||
}
|
}
|
||||||
|
|
||||||
@section Styles {
|
|
||||||
<link rel="stylesheet" href="https://cdn.datatables.net/2.3.4/css/dataTables.tailwindcss.css" />
|
|
||||||
}
|
|
||||||
|
|
||||||
<div class="flex flex-col gap-2 md:flex-row md:justify-between md:gap-0">
|
<div class="flex flex-col gap-2 md:flex-row md:justify-between md:gap-0">
|
||||||
<div class="prose">
|
<div class="prose">
|
||||||
<span class="text-xl font-semibold text-gray-900 font-['Plus_Jakarta_Sans']">
|
<span class="text-xl font-semibold text-gray-900 font-['Plus_Jakarta_Sans']">
|
||||||
|
|
@ -230,134 +226,132 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="https://code.jquery.com/jquery-3.7.1.js"></script>
|
@section Scripts {
|
||||||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
<script type="text/javascript">
|
||||||
<script src="https://cdn.datatables.net/2.3.4/js/dataTables.js"></script>
|
var table;
|
||||||
<script src="/plugins/datatables/dataTables.tailwindcss.js"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
var table;
|
|
||||||
|
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
table = new DataTable('#example', {
|
table = new DataTable('#example', {
|
||||||
ajax: '/Data/Offtaker/Table',
|
ajax: '/Data/Offtaker/Table',
|
||||||
scrollX: true,
|
scrollX: true,
|
||||||
autoWidth: false,
|
autoWidth: false,
|
||||||
initComplete: function () {
|
initComplete: function () {
|
||||||
$('div.dt-scroll-body thead').css('visibility', 'collapse');
|
$('div.dt-scroll-body thead').css('visibility', 'collapse');
|
||||||
},
|
|
||||||
columns: [
|
|
||||||
{ data: null, render: (d, t, r, m) => m.row + 1, orderable: false, searchable: false },
|
|
||||||
{ data: 'nama_offtaker' },
|
|
||||||
{ data: 'kabupaten' },
|
|
||||||
{ data: 'kecamatan' },
|
|
||||||
{ data: 'kelurahan' },
|
|
||||||
{ data: 'status' },
|
|
||||||
{ data: 'aksi' },
|
|
||||||
]
|
|
||||||
});
|
|
||||||
|
|
||||||
// Delete button handler
|
|
||||||
$('#example').on('click', '.p-2.bg-red-500', function (e) {
|
|
||||||
e.preventDefault();
|
|
||||||
|
|
||||||
Swal.fire({
|
|
||||||
title: 'Anda yakin ingin menghapus data ini?',
|
|
||||||
icon: 'warning',
|
|
||||||
showCancelButton: true,
|
|
||||||
confirmButtonText: 'Ya',
|
|
||||||
cancelButtonText: 'Tidak',
|
|
||||||
buttonsStyling: false,
|
|
||||||
customClass: {
|
|
||||||
confirmButton: 'btn bg-green-800 text-white hover:bg-green-900 px-8 py-2 rounded-full mr-2',
|
|
||||||
cancelButton: 'btn bg-white text-gray-500 hover:bg-gray-50 px-8 py-2 rounded-full border border-gray-300',
|
|
||||||
},
|
},
|
||||||
}).then((result) => {
|
columns: [
|
||||||
if (result.isConfirmed) {
|
{ data: null, render: (d, t, r, m) => m.row + 1, orderable: false, searchable: false },
|
||||||
// TODO: Implement actual delete API call
|
{ data: 'nama_offtaker' },
|
||||||
Swal.fire({
|
{ data: 'kabupaten' },
|
||||||
title: 'Berhasil!',
|
{ data: 'kecamatan' },
|
||||||
text: 'Data berhasil dihapus.',
|
{ data: 'kelurahan' },
|
||||||
icon: 'success',
|
{ data: 'status' },
|
||||||
confirmButtonText: 'OK',
|
{ data: 'aksi' },
|
||||||
buttonsStyling: false,
|
]
|
||||||
customClass: {
|
});
|
||||||
confirmButton: 'btn bg-green-800 text-white hover:bg-green-900 px-4 py-2 rounded-full',
|
|
||||||
},
|
// Delete button handler
|
||||||
}).then(() => {
|
$('#example').on('click', '.p-2.bg-red-500', function (e) {
|
||||||
// Reload table
|
e.preventDefault();
|
||||||
table.ajax.reload();
|
|
||||||
});
|
Swal.fire({
|
||||||
}
|
title: 'Anda yakin ingin menghapus data ini?',
|
||||||
|
icon: 'warning',
|
||||||
|
showCancelButton: true,
|
||||||
|
confirmButtonText: 'Ya',
|
||||||
|
cancelButtonText: 'Tidak',
|
||||||
|
buttonsStyling: false,
|
||||||
|
customClass: {
|
||||||
|
confirmButton: 'btn bg-green-800 text-white hover:bg-green-900 px-8 py-2 rounded-full mr-2',
|
||||||
|
cancelButton: 'btn bg-white text-gray-500 hover:bg-gray-50 px-8 py-2 rounded-full border border-gray-300',
|
||||||
|
},
|
||||||
|
}).then((result) => {
|
||||||
|
if (result.isConfirmed) {
|
||||||
|
// TODO: Implement actual delete API call
|
||||||
|
Swal.fire({
|
||||||
|
title: 'Berhasil!',
|
||||||
|
text: 'Data berhasil dihapus.',
|
||||||
|
icon: 'success',
|
||||||
|
confirmButtonText: 'OK',
|
||||||
|
buttonsStyling: false,
|
||||||
|
customClass: {
|
||||||
|
confirmButton: 'btn bg-green-800 text-white hover:bg-green-900 px-4 py-2 rounded-full',
|
||||||
|
},
|
||||||
|
}).then(() => {
|
||||||
|
// Reload table
|
||||||
|
table.ajax.reload();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// Edit button handler
|
||||||
|
$('#example').on('click', '.p-2.bg-amber-500', function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
|
||||||
|
// Get row data
|
||||||
|
var row = table.row($(this).parents('tr')).data();
|
||||||
|
|
||||||
|
// Set edit mode
|
||||||
|
$('#edit_mode').val('true');
|
||||||
|
$('#modal_title').text('Edit Offtaker');
|
||||||
|
|
||||||
|
// Show status field in edit mode
|
||||||
|
$('#status_wrapper').show();
|
||||||
|
|
||||||
|
// Populate form with row data
|
||||||
|
$('#nama_offtaker').val(row.nama_offtaker);
|
||||||
|
$('#email').val(row.email);
|
||||||
|
$('#no_hp').val(row.no_hp);
|
||||||
|
$('#provinsi').val(row.provinsi);
|
||||||
|
$('#kabupaten').val(row.kabupaten);
|
||||||
|
$('#kecamatan').val(row.kecamatan);
|
||||||
|
$('#kelurahan').val(row.kelurahan);
|
||||||
|
$('#alamat').val(row.alamat);
|
||||||
|
$('#rt').val(row.rt);
|
||||||
|
$('#rw').val(row.rw);
|
||||||
|
$('#kode_pos').val(row.kode_pos);
|
||||||
|
|
||||||
|
// Extract status from HTML badge
|
||||||
|
var statusText = $(row.status).text().trim();
|
||||||
|
$('#status').val(statusText);
|
||||||
|
|
||||||
|
// Open modal
|
||||||
|
modal_tambah.showModal();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// Edit button handler
|
function closeModal() {
|
||||||
$('#example').on('click', '.p-2.bg-amber-500', function (e) {
|
// Reset form
|
||||||
|
$('#formTambah')[0].reset();
|
||||||
|
$('#edit_mode').val('false');
|
||||||
|
$('#modal_title').text('Tambah Offtaker');
|
||||||
|
$('#status_wrapper').hide();
|
||||||
|
|
||||||
|
// Close modal
|
||||||
|
modal_tambah.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
function submitForm(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
// Get row data
|
var isEditMode = $('#edit_mode').val() === 'true';
|
||||||
var row = table.row($(this).parents('tr')).data();
|
|
||||||
|
|
||||||
// Set edit mode
|
// TODO: Implement form submission logic
|
||||||
$('#edit_mode').val('true');
|
Swal.fire({
|
||||||
$('#modal_title').text('Edit Offtaker');
|
title: 'Berhasil!',
|
||||||
|
text: isEditMode ? 'Data berhasil diperbarui' : 'Data berhasil ditambahkan',
|
||||||
|
icon: 'success',
|
||||||
|
confirmButtonText: 'OK',
|
||||||
|
buttonsStyling: false,
|
||||||
|
customClass: {
|
||||||
|
confirmButton: 'btn bg-green-800 text-white hover:bg-green-900 px-4 py-2 rounded-full',
|
||||||
|
},
|
||||||
|
}).then(() => {
|
||||||
|
closeModal();
|
||||||
|
|
||||||
// Show status field in edit mode
|
// Reload table
|
||||||
$('#status_wrapper').show();
|
table.ajax.reload();
|
||||||
|
});
|
||||||
// Populate form with row data
|
}
|
||||||
$('#nama_offtaker').val(row.nama_offtaker);
|
</script>
|
||||||
$('#email').val(row.email);
|
}
|
||||||
$('#no_hp').val(row.no_hp);
|
|
||||||
$('#provinsi').val(row.provinsi);
|
|
||||||
$('#kabupaten').val(row.kabupaten);
|
|
||||||
$('#kecamatan').val(row.kecamatan);
|
|
||||||
$('#kelurahan').val(row.kelurahan);
|
|
||||||
$('#alamat').val(row.alamat);
|
|
||||||
$('#rt').val(row.rt);
|
|
||||||
$('#rw').val(row.rw);
|
|
||||||
$('#kode_pos').val(row.kode_pos);
|
|
||||||
|
|
||||||
// Extract status from HTML badge
|
|
||||||
var statusText = $(row.status).text().trim();
|
|
||||||
$('#status').val(statusText);
|
|
||||||
|
|
||||||
// Open modal
|
|
||||||
modal_tambah.showModal();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
function closeModal() {
|
|
||||||
// Reset form
|
|
||||||
$('#formTambah')[0].reset();
|
|
||||||
$('#edit_mode').val('false');
|
|
||||||
$('#modal_title').text('Tambah Offtaker');
|
|
||||||
$('#status_wrapper').hide();
|
|
||||||
|
|
||||||
// Close modal
|
|
||||||
modal_tambah.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
function submitForm(e) {
|
|
||||||
e.preventDefault();
|
|
||||||
|
|
||||||
var isEditMode = $('#edit_mode').val() === 'true';
|
|
||||||
|
|
||||||
// TODO: Implement form submission logic
|
|
||||||
Swal.fire({
|
|
||||||
title: 'Berhasil!',
|
|
||||||
text: isEditMode ? 'Data berhasil diperbarui' : 'Data berhasil ditambahkan',
|
|
||||||
icon: 'success',
|
|
||||||
confirmButtonText: 'OK',
|
|
||||||
buttonsStyling: false,
|
|
||||||
customClass: {
|
|
||||||
confirmButton: 'btn bg-green-800 text-white hover:bg-green-900 px-4 py-2 rounded-full',
|
|
||||||
},
|
|
||||||
}).then(() => {
|
|
||||||
closeModal();
|
|
||||||
|
|
||||||
// Reload table
|
|
||||||
table.ajax.reload();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
|
||||||
|
|
@ -194,152 +194,151 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="https://code.jquery.com/jquery-3.7.1.js"></script>
|
|
||||||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
|
||||||
<script src="https://cdn.datatables.net/2.3.4/js/dataTables.js"></script>
|
|
||||||
<script src="/plugins/datatables/dataTables.tailwindcss.js"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
var table;
|
|
||||||
|
|
||||||
$(document).ready(function () {
|
@section Scripts {
|
||||||
table = new DataTable('#example', {
|
<script type="text/javascript">
|
||||||
ajax: '/Main/BankSampah/Table',
|
var table;
|
||||||
scrollX: true,
|
|
||||||
autoWidth: false,
|
|
||||||
initComplete: function () {
|
|
||||||
$('div.dt-scroll-body thead').css('visibility', 'collapse');
|
|
||||||
},
|
|
||||||
columns: [
|
|
||||||
{ data: null, render: (d, t, r, m) => m.row + 1, orderable: false, searchable: false },
|
|
||||||
{ data: 'tgl_pemilahan' },
|
|
||||||
{ data: 'nama_bank_sampah' },
|
|
||||||
{ data: 'nama_penanggung_jawab' },
|
|
||||||
{ data: 'jenis_sampah' },
|
|
||||||
{ data: 'kategori_sampah' },
|
|
||||||
{ data: 'jumlah' },
|
|
||||||
{ data: 'asal_sampah' },
|
|
||||||
{ data: 'status_validasi' },
|
|
||||||
{ data: 'catatan' },
|
|
||||||
{ data: 'aksi' },
|
|
||||||
]
|
|
||||||
});
|
|
||||||
|
|
||||||
// Delete button handler
|
$(document).ready(function () {
|
||||||
$('#example').on('click', '.p-2.bg-red-500', function (e) {
|
table = new DataTable('#example', {
|
||||||
e.preventDefault();
|
ajax: '/Main/BankSampah/Table',
|
||||||
|
scrollX: true,
|
||||||
Swal.fire({
|
autoWidth: false,
|
||||||
title: 'Apakah anda yakin?',
|
initComplete: function () {
|
||||||
text: "Data yang dihapus tidak dapat dikembalikan lagi",
|
$('div.dt-scroll-body thead').css('visibility', 'collapse');
|
||||||
icon: 'warning',
|
|
||||||
showCancelButton: true,
|
|
||||||
confirmButtonText: 'Ya, Hapus',
|
|
||||||
cancelButtonText: 'Batal',
|
|
||||||
buttonsStyling: false,
|
|
||||||
customClass: {
|
|
||||||
confirmButton: 'btn bg-red-500 text-white hover:bg-red-600 px-4 py-2 rounded-full mr-2',
|
|
||||||
cancelButton: 'btn bg-white text-gray-500 hover:bg-gray-50 px-4 py-2 rounded-full border border-gray-300',
|
|
||||||
},
|
},
|
||||||
}).then((result) => {
|
columns: [
|
||||||
if (result.isConfirmed) {
|
{ data: null, render: (d, t, r, m) => m.row + 1, orderable: false, searchable: false },
|
||||||
// TODO: Implement actual delete API call
|
{ data: 'tgl_pemilahan' },
|
||||||
Swal.fire({
|
{ data: 'nama_bank_sampah' },
|
||||||
title: 'Terhapus!',
|
{ data: 'nama_penanggung_jawab' },
|
||||||
text: 'Data berhasil dihapus.',
|
{ data: 'jenis_sampah' },
|
||||||
icon: 'success',
|
{ data: 'kategori_sampah' },
|
||||||
confirmButtonText: 'OK',
|
{ data: 'jumlah' },
|
||||||
buttonsStyling: false,
|
{ data: 'asal_sampah' },
|
||||||
customClass: {
|
{ data: 'status_validasi' },
|
||||||
confirmButton: 'btn bg-green-800 text-white hover:bg-green-900 px-4 py-2 rounded-full',
|
{ data: 'catatan' },
|
||||||
},
|
{ data: 'aksi' },
|
||||||
}).then(() => {
|
]
|
||||||
// Reload table
|
});
|
||||||
table.ajax.reload();
|
|
||||||
});
|
// Delete button handler
|
||||||
}
|
$('#example').on('click', '.p-2.bg-red-500', function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
|
||||||
|
Swal.fire({
|
||||||
|
title: 'Apakah anda yakin?',
|
||||||
|
text: "Data yang dihapus tidak dapat dikembalikan lagi",
|
||||||
|
icon: 'warning',
|
||||||
|
showCancelButton: true,
|
||||||
|
confirmButtonText: 'Ya, Hapus',
|
||||||
|
cancelButtonText: 'Batal',
|
||||||
|
buttonsStyling: false,
|
||||||
|
customClass: {
|
||||||
|
confirmButton: 'btn bg-red-500 text-white hover:bg-red-600 px-4 py-2 rounded-full mr-2',
|
||||||
|
cancelButton: 'btn bg-white text-gray-500 hover:bg-gray-50 px-4 py-2 rounded-full border border-gray-300',
|
||||||
|
},
|
||||||
|
}).then((result) => {
|
||||||
|
if (result.isConfirmed) {
|
||||||
|
// TODO: Implement actual delete API call
|
||||||
|
Swal.fire({
|
||||||
|
title: 'Terhapus!',
|
||||||
|
text: 'Data berhasil dihapus.',
|
||||||
|
icon: 'success',
|
||||||
|
confirmButtonText: 'OK',
|
||||||
|
buttonsStyling: false,
|
||||||
|
customClass: {
|
||||||
|
confirmButton: 'btn bg-green-800 text-white hover:bg-green-900 px-4 py-2 rounded-full',
|
||||||
|
},
|
||||||
|
}).then(() => {
|
||||||
|
// Reload table
|
||||||
|
table.ajax.reload();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// Edit button handler
|
||||||
|
$('#example').on('click', '.p-2.bg-amber-500', function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
|
||||||
|
// Get row data
|
||||||
|
var row = table.row($(this).parents('tr')).data();
|
||||||
|
|
||||||
|
// Set edit mode
|
||||||
|
$('#edit_mode').val('true');
|
||||||
|
$('#modal_title').text('Edit Data Pemilahan');
|
||||||
|
|
||||||
|
// Convert date format from "15 Mar 2024" to "2024-03-15"
|
||||||
|
var tglPemilahan = convertDateToInput(row.tgl_pemilahan);
|
||||||
|
|
||||||
|
// Populate form with row data
|
||||||
|
$('#tgl_pemilahan').val(tglPemilahan);
|
||||||
|
$('#nama_bank_sampah').val(row.nama_bank_sampah);
|
||||||
|
$('#nama_penanggung_jawab').val(row.nama_penanggung_jawab);
|
||||||
|
$('#jenis_sampah').val(row.jenis_sampah);
|
||||||
|
$('#kategori_sampah').val(row.kategori_sampah);
|
||||||
|
$('#jumlah').val(row.jumlah);
|
||||||
|
$('#asal_sampah').val(row.asal_sampah);
|
||||||
|
|
||||||
|
// Extract status from HTML badge
|
||||||
|
var statusText = $(row.status_validasi).text().trim();
|
||||||
|
$('#status_validasi').val(statusText);
|
||||||
|
|
||||||
|
$('#catatan').val(row.catatan);
|
||||||
|
|
||||||
|
// Open modal
|
||||||
|
modal_tambah.showModal();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// Edit button handler
|
// Function to convert date format "15 Mar 2024" to "2024-03-15"
|
||||||
$('#example').on('click', '.p-2.bg-amber-500', function (e) {
|
function convertDateToInput(dateStr) {
|
||||||
|
const monthMap = {
|
||||||
|
'Jan': '01', 'Feb': '02', 'Mar': '03', 'Apr': '04',
|
||||||
|
'Mei': '05', 'Jun': '06', 'Jul': '07', 'Agt': '08',
|
||||||
|
'Sep': '09', 'Okt': '10', 'Nov': '11', 'Des': '12'
|
||||||
|
};
|
||||||
|
|
||||||
|
const parts = dateStr.split(' ');
|
||||||
|
const day = parts[0].padStart(2, '0');
|
||||||
|
const month = monthMap[parts[1]];
|
||||||
|
const year = parts[2];
|
||||||
|
|
||||||
|
return `${year}-${month}-${day}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
function closeModal() {
|
||||||
|
// Reset form
|
||||||
|
$('#formTambah')[0].reset();
|
||||||
|
$('#edit_mode').val('false');
|
||||||
|
$('#modal_title').text('Tambah Data Pemilahan');
|
||||||
|
|
||||||
|
// Close modal
|
||||||
|
modal_tambah.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
function submitForm(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
// Get row data
|
var isEditMode = $('#edit_mode').val() === 'true';
|
||||||
var row = table.row($(this).parents('tr')).data();
|
|
||||||
|
|
||||||
// Set edit mode
|
// TODO: Implement form submission logic
|
||||||
$('#edit_mode').val('true');
|
Swal.fire({
|
||||||
$('#modal_title').text('Edit Data Pemilahan');
|
title: 'Berhasil!',
|
||||||
|
text: isEditMode ? 'Data berhasil diperbarui' : 'Data berhasil ditambahkan',
|
||||||
|
icon: 'success',
|
||||||
|
confirmButtonText: 'OK',
|
||||||
|
buttonsStyling: false,
|
||||||
|
customClass: {
|
||||||
|
confirmButton: 'btn bg-green-800 text-white hover:bg-green-900 px-4 py-2 rounded-full',
|
||||||
|
},
|
||||||
|
}).then(() => {
|
||||||
|
closeModal();
|
||||||
|
|
||||||
// Convert date format from "15 Mar 2024" to "2024-03-15"
|
// Reload table
|
||||||
var tglPemilahan = convertDateToInput(row.tgl_pemilahan);
|
table.ajax.reload();
|
||||||
|
});
|
||||||
// Populate form with row data
|
}
|
||||||
$('#tgl_pemilahan').val(tglPemilahan);
|
</script>
|
||||||
$('#nama_bank_sampah').val(row.nama_bank_sampah);
|
}
|
||||||
$('#nama_penanggung_jawab').val(row.nama_penanggung_jawab);
|
|
||||||
$('#jenis_sampah').val(row.jenis_sampah);
|
|
||||||
$('#kategori_sampah').val(row.kategori_sampah);
|
|
||||||
$('#jumlah').val(row.jumlah);
|
|
||||||
$('#asal_sampah').val(row.asal_sampah);
|
|
||||||
|
|
||||||
// Extract status from HTML badge
|
|
||||||
var statusText = $(row.status_validasi).text().trim();
|
|
||||||
$('#status_validasi').val(statusText);
|
|
||||||
|
|
||||||
$('#catatan').val(row.catatan);
|
|
||||||
|
|
||||||
// Open modal
|
|
||||||
modal_tambah.showModal();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
// Function to convert date format "15 Mar 2024" to "2024-03-15"
|
|
||||||
function convertDateToInput(dateStr) {
|
|
||||||
const monthMap = {
|
|
||||||
'Jan': '01', 'Feb': '02', 'Mar': '03', 'Apr': '04',
|
|
||||||
'Mei': '05', 'Jun': '06', 'Jul': '07', 'Agt': '08',
|
|
||||||
'Sep': '09', 'Okt': '10', 'Nov': '11', 'Des': '12'
|
|
||||||
};
|
|
||||||
|
|
||||||
const parts = dateStr.split(' ');
|
|
||||||
const day = parts[0].padStart(2, '0');
|
|
||||||
const month = monthMap[parts[1]];
|
|
||||||
const year = parts[2];
|
|
||||||
|
|
||||||
return `${year}-${month}-${day}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
function closeModal() {
|
|
||||||
// Reset form
|
|
||||||
$('#formTambah')[0].reset();
|
|
||||||
$('#edit_mode').val('false');
|
|
||||||
$('#modal_title').text('Tambah Data Pemilahan');
|
|
||||||
|
|
||||||
// Close modal
|
|
||||||
modal_tambah.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
function submitForm(e) {
|
|
||||||
e.preventDefault();
|
|
||||||
|
|
||||||
var isEditMode = $('#edit_mode').val() === 'true';
|
|
||||||
|
|
||||||
// TODO: Implement form submission logic
|
|
||||||
Swal.fire({
|
|
||||||
title: 'Berhasil!',
|
|
||||||
text: isEditMode ? 'Data berhasil diperbarui' : 'Data berhasil ditambahkan',
|
|
||||||
icon: 'success',
|
|
||||||
confirmButtonText: 'OK',
|
|
||||||
buttonsStyling: false,
|
|
||||||
customClass: {
|
|
||||||
confirmButton: 'btn bg-green-800 text-white hover:bg-green-900 px-4 py-2 rounded-full',
|
|
||||||
},
|
|
||||||
}).then(() => {
|
|
||||||
closeModal();
|
|
||||||
|
|
||||||
// Reload table
|
|
||||||
table.ajax.reload();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
|
||||||
|
|
@ -112,135 +112,134 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="https://code.jquery.com/jquery-3.7.1.js"></script>
|
|
||||||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
|
||||||
<script src="https://cdn.datatables.net/2.3.4/js/dataTables.js"></script>
|
|
||||||
<script src="/plugins/datatables/dataTables.tailwindcss.js"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
var table;
|
|
||||||
|
|
||||||
$(document).ready(function () {
|
@section Scripts {
|
||||||
table = new DataTable('#example', {
|
<script type="text/javascript">
|
||||||
ajax: '/Main/BankSampahNasabah/Table',
|
var table;
|
||||||
scrollX: true,
|
|
||||||
autoWidth: false,
|
|
||||||
responsive: true,
|
|
||||||
initComplete: function () {
|
|
||||||
$('div.dt-scroll-body thead').css('visibility', 'collapse');
|
|
||||||
},
|
|
||||||
columns: [
|
|
||||||
{ data: null, render: (d, t, r, m) => m.row + 1, orderable: false, searchable: false },
|
|
||||||
{ data: 'nama' },
|
|
||||||
{ data: 'tgl_pendaftaran' },
|
|
||||||
{ data: 'status' },
|
|
||||||
{ data: 'aksi' },
|
|
||||||
]
|
|
||||||
});
|
|
||||||
|
|
||||||
// Delete button handler
|
$(document).ready(function () {
|
||||||
$('#example').on('click', '.delete-btn', function (e) {
|
table = new DataTable('#example', {
|
||||||
e.preventDefault();
|
ajax: '/Main/BankSampahNasabah/Table',
|
||||||
|
scrollX: true,
|
||||||
Swal.fire({
|
autoWidth: false,
|
||||||
title: 'Apakah anda yakin?',
|
responsive: true,
|
||||||
text: "Data yang dihapus tidak dapat dikembalikan lagi",
|
initComplete: function () {
|
||||||
icon: 'warning',
|
$('div.dt-scroll-body thead').css('visibility', 'collapse');
|
||||||
showCancelButton: true,
|
|
||||||
confirmButtonText: 'Ya, Hapus',
|
|
||||||
cancelButtonText: 'Batal',
|
|
||||||
buttonsStyling: false,
|
|
||||||
customClass: {
|
|
||||||
confirmButton: 'btn bg-red-500 text-white hover:bg-red-600 px-4 py-2 rounded-full mr-2',
|
|
||||||
cancelButton: 'btn bg-white text-gray-500 hover:bg-gray-50 px-4 py-2 rounded-full border border-gray-300',
|
|
||||||
},
|
},
|
||||||
}).then((result) => {
|
columns: [
|
||||||
if (result.isConfirmed) {
|
{ data: null, render: (d, t, r, m) => m.row + 1, orderable: false, searchable: false },
|
||||||
// TODO: Implement actual delete API call
|
{ data: 'nama' },
|
||||||
Swal.fire({
|
{ data: 'tgl_pendaftaran' },
|
||||||
title: 'Terhapus!',
|
{ data: 'status' },
|
||||||
text: 'Data berhasil dihapus.',
|
{ data: 'aksi' },
|
||||||
icon: 'success',
|
]
|
||||||
confirmButtonText: 'OK',
|
});
|
||||||
buttonsStyling: false,
|
|
||||||
customClass: {
|
// Delete button handler
|
||||||
confirmButton: 'btn bg-green-800 text-white hover:bg-green-900 px-4 py-2 rounded-full',
|
$('#example').on('click', '.delete-btn', function (e) {
|
||||||
},
|
e.preventDefault();
|
||||||
}).then(() => {
|
|
||||||
// Reload table
|
Swal.fire({
|
||||||
table.ajax.reload();
|
title: 'Apakah anda yakin?',
|
||||||
});
|
text: "Data yang dihapus tidak dapat dikembalikan lagi",
|
||||||
}
|
icon: 'warning',
|
||||||
|
showCancelButton: true,
|
||||||
|
confirmButtonText: 'Ya, Hapus',
|
||||||
|
cancelButtonText: 'Batal',
|
||||||
|
buttonsStyling: false,
|
||||||
|
customClass: {
|
||||||
|
confirmButton: 'btn bg-red-500 text-white hover:bg-red-600 px-4 py-2 rounded-full mr-2',
|
||||||
|
cancelButton: 'btn bg-white text-gray-500 hover:bg-gray-50 px-4 py-2 rounded-full border border-gray-300',
|
||||||
|
},
|
||||||
|
}).then((result) => {
|
||||||
|
if (result.isConfirmed) {
|
||||||
|
// TODO: Implement actual delete API call
|
||||||
|
Swal.fire({
|
||||||
|
title: 'Terhapus!',
|
||||||
|
text: 'Data berhasil dihapus.',
|
||||||
|
icon: 'success',
|
||||||
|
confirmButtonText: 'OK',
|
||||||
|
buttonsStyling: false,
|
||||||
|
customClass: {
|
||||||
|
confirmButton: 'btn bg-green-800 text-white hover:bg-green-900 px-4 py-2 rounded-full',
|
||||||
|
},
|
||||||
|
}).then(() => {
|
||||||
|
// Reload table
|
||||||
|
table.ajax.reload();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// Edit button handler
|
||||||
|
$('#example').on('click', '.edit-btn', function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
|
||||||
|
// Get row data
|
||||||
|
var row = table.row($(this).parents('tr')).data();
|
||||||
|
|
||||||
|
// Set edit mode
|
||||||
|
$('#edit_mode').val('true');
|
||||||
|
$('#modal_title').text('Edit Bank Sampah Saya');
|
||||||
|
|
||||||
|
// Populate form with row data
|
||||||
|
$('#daftar_bank_sampah').val(row.nama);
|
||||||
|
|
||||||
|
// Open modal
|
||||||
|
modal_tambah.showModal();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// Edit button handler
|
function closeModal() {
|
||||||
$('#example').on('click', '.edit-btn', function (e) {
|
// Reset form
|
||||||
|
$('#formTambah')[0].reset();
|
||||||
|
$('#edit_mode').val('false');
|
||||||
|
$('#modal_title').text('Tambah Bank Sampah Saya');
|
||||||
|
|
||||||
|
// Close modal
|
||||||
|
modal_tambah.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
function submitForm(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
// Get row data
|
var isEditMode = $('#edit_mode').val() === 'true';
|
||||||
var row = table.row($(this).parents('tr')).data();
|
|
||||||
|
|
||||||
// Set edit mode
|
// Get form data
|
||||||
$('#edit_mode').val('true');
|
var kelurahan = $('#kelurahan').val();
|
||||||
$('#modal_title').text('Edit Bank Sampah Saya');
|
var daftarBankSampah = $('#daftar_bank_sampah').val();
|
||||||
|
|
||||||
// Populate form with row data
|
// Validate
|
||||||
$('#daftar_bank_sampah').val(row.nama);
|
if (!kelurahan || !daftarBankSampah) {
|
||||||
|
Swal.fire({
|
||||||
|
title: 'Error!',
|
||||||
|
text: 'Mohon lengkapi semua field yang wajib diisi',
|
||||||
|
icon: 'error',
|
||||||
|
confirmButtonText: 'OK',
|
||||||
|
buttonsStyling: false,
|
||||||
|
customClass: {
|
||||||
|
confirmButton: 'btn bg-green-800 text-white hover:bg-green-900 px-4 py-2 rounded-full',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Open modal
|
// TODO: Implement form submission logic
|
||||||
modal_tambah.showModal();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
function closeModal() {
|
|
||||||
// Reset form
|
|
||||||
$('#formTambah')[0].reset();
|
|
||||||
$('#edit_mode').val('false');
|
|
||||||
$('#modal_title').text('Tambah Bank Sampah Saya');
|
|
||||||
|
|
||||||
// Close modal
|
|
||||||
modal_tambah.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
function submitForm(e) {
|
|
||||||
e.preventDefault();
|
|
||||||
|
|
||||||
var isEditMode = $('#edit_mode').val() === 'true';
|
|
||||||
|
|
||||||
// Get form data
|
|
||||||
var kelurahan = $('#kelurahan').val();
|
|
||||||
var daftarBankSampah = $('#daftar_bank_sampah').val();
|
|
||||||
|
|
||||||
// Validate
|
|
||||||
if (!kelurahan || !daftarBankSampah) {
|
|
||||||
Swal.fire({
|
Swal.fire({
|
||||||
title: 'Error!',
|
title: 'Berhasil!',
|
||||||
text: 'Mohon lengkapi semua field yang wajib diisi',
|
text: isEditMode ? 'Data berhasil diperbarui' : 'Data berhasil ditambahkan',
|
||||||
icon: 'error',
|
icon: 'success',
|
||||||
confirmButtonText: 'OK',
|
confirmButtonText: 'OK',
|
||||||
buttonsStyling: false,
|
buttonsStyling: false,
|
||||||
customClass: {
|
customClass: {
|
||||||
confirmButton: 'btn bg-green-800 text-white hover:bg-green-900 px-4 py-2 rounded-full',
|
confirmButton: 'btn bg-green-800 text-white hover:bg-green-900 px-4 py-2 rounded-full',
|
||||||
},
|
},
|
||||||
|
}).then(() => {
|
||||||
|
closeModal();
|
||||||
|
|
||||||
|
// Reload table
|
||||||
|
table.ajax.reload();
|
||||||
});
|
});
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
</script>
|
||||||
// TODO: Implement form submission logic
|
}
|
||||||
Swal.fire({
|
|
||||||
title: 'Berhasil!',
|
|
||||||
text: isEditMode ? 'Data berhasil diperbarui' : 'Data berhasil ditambahkan',
|
|
||||||
icon: 'success',
|
|
||||||
confirmButtonText: 'OK',
|
|
||||||
buttonsStyling: false,
|
|
||||||
customClass: {
|
|
||||||
confirmButton: 'btn bg-green-800 text-white hover:bg-green-900 px-4 py-2 rounded-full',
|
|
||||||
},
|
|
||||||
}).then(() => {
|
|
||||||
closeModal();
|
|
||||||
|
|
||||||
// Reload table
|
|
||||||
table.ajax.reload();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
|
||||||
|
|
@ -207,155 +207,154 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="https://code.jquery.com/jquery-3.7.1.js"></script>
|
|
||||||
<script src="https://cdn.datatables.net/2.3.4/js/dataTables.js"></script>
|
|
||||||
<script src="/plugins/datatables/dataTables.tailwindcss.js"></script>
|
|
||||||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
var table;
|
|
||||||
|
|
||||||
$(document).ready(function () {
|
@section Scripts {
|
||||||
table = new DataTable('#example', {
|
<script type="text/javascript">
|
||||||
ajax: '/Main/Composting/Table',
|
var table;
|
||||||
scrollX: true,
|
|
||||||
autoWidth: false,
|
$(document).ready(function () {
|
||||||
initComplete: function () {
|
table = new DataTable('#example', {
|
||||||
$('div.dt-scroll-body thead').css('visibility', 'collapse');
|
ajax: '/Main/Composting/Table',
|
||||||
},
|
scrollX: true,
|
||||||
columns: [
|
autoWidth: false,
|
||||||
{ data: null, render: (d, t, r, m) => m.row + 1, orderable: false, searchable: false },
|
initComplete: function () {
|
||||||
{ data: 'tgl_pencatatan' },
|
$('div.dt-scroll-body thead').css('visibility', 'collapse');
|
||||||
{ data: 'nama_bank_sampah' },
|
},
|
||||||
{ data: 'nama_penanggung_jawab' },
|
columns: [
|
||||||
{ data: 'jenis_sampah_organik' },
|
{ data: null, render: (d, t, r, m) => m.row + 1, orderable: false, searchable: false },
|
||||||
{ data: 'jumlah_sampah_masuk' },
|
{ data: 'tgl_pencatatan' },
|
||||||
{ data: 'jumlah_kompos_dihasilkan' },
|
{ data: 'nama_bank_sampah' },
|
||||||
{ data: 'lama_proses' },
|
{ data: 'nama_penanggung_jawab' },
|
||||||
{ data: 'status_validasi' },
|
{ data: 'jenis_sampah_organik' },
|
||||||
{ data: 'catatan' },
|
{ data: 'jumlah_sampah_masuk' },
|
||||||
{ data: 'aksi' },
|
{ data: 'jumlah_kompos_dihasilkan' },
|
||||||
]
|
{ data: 'lama_proses' },
|
||||||
|
{ data: 'status_validasi' },
|
||||||
|
{ data: 'catatan' },
|
||||||
|
{ data: 'aksi' },
|
||||||
|
]
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
// Edit button handler
|
// Edit button handler
|
||||||
$('#example').on('click', '.p-2.bg-amber-500', function (e) {
|
$('#example').on('click', '.p-2.bg-amber-500', function (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
var row = table.row($(this).parents('tr')).data();
|
var row = table.row($(this).parents('tr')).data();
|
||||||
|
|
||||||
// Set edit mode
|
// Set edit mode
|
||||||
$('#edit_mode').val('true');
|
$('#edit_mode').val('true');
|
||||||
$('#modal_title').text('Edit Data Composting');
|
$('#modal_title').text('Edit Data Composting');
|
||||||
|
|
||||||
// Populate form fields
|
// Populate form fields
|
||||||
var tglPencatatan = convertDateToInput(row.tgl_pencatatan);
|
var tglPencatatan = convertDateToInput(row.tgl_pencatatan);
|
||||||
$('#tgl_pencatatan').val(tglPencatatan);
|
$('#tgl_pencatatan').val(tglPencatatan);
|
||||||
$('#nama_bank_sampah').val(row.nama_bank_sampah);
|
$('#nama_bank_sampah').val(row.nama_bank_sampah);
|
||||||
$('#nama_penanggung_jawab').val(row.nama_penanggung_jawab);
|
$('#nama_penanggung_jawab').val(row.nama_penanggung_jawab);
|
||||||
$('#jenis_sampah_organik').val(row.jenis_sampah_organik);
|
$('#jenis_sampah_organik').val(row.jenis_sampah_organik);
|
||||||
$('#jumlah_sampah_masuk').val(row.jumlah_sampah_masuk);
|
$('#jumlah_sampah_masuk').val(row.jumlah_sampah_masuk);
|
||||||
$('#jumlah_kompos_dihasilkan').val(row.jumlah_kompos_dihasilkan);
|
$('#jumlah_kompos_dihasilkan').val(row.jumlah_kompos_dihasilkan);
|
||||||
$('#lama_proses').val(row.lama_proses);
|
$('#lama_proses').val(row.lama_proses);
|
||||||
|
|
||||||
// Extract status text from badge HTML
|
// Extract status text from badge HTML
|
||||||
var statusText = $(row.status_validasi).text().trim();
|
var statusText = $(row.status_validasi).text().trim();
|
||||||
$('#status_validasi').val(statusText);
|
$('#status_validasi').val(statusText);
|
||||||
|
|
||||||
$('#catatan').val(row.catatan);
|
$('#catatan').val(row.catatan);
|
||||||
|
|
||||||
// Show modal
|
// Show modal
|
||||||
modal_tambah.showModal();
|
modal_tambah.showModal();
|
||||||
});
|
|
||||||
|
|
||||||
// Delete button handler
|
|
||||||
$('#example').on('click', '.p-2.bg-red-500', function (e) {
|
|
||||||
e.preventDefault();
|
|
||||||
|
|
||||||
Swal.fire({
|
|
||||||
title: 'Apakah anda yakin?',
|
|
||||||
text: "Data yang dihapus tidak dapat dikembalikan lagi",
|
|
||||||
icon: 'warning',
|
|
||||||
showCancelButton: true,
|
|
||||||
confirmButtonColor: '#d33',
|
|
||||||
cancelButtonColor: '#3085d6',
|
|
||||||
confirmButtonText: 'Ya, Hapus',
|
|
||||||
cancelButtonText: 'Batal',
|
|
||||||
customClass: {
|
|
||||||
confirmButton: 'btn bg-red-500 text-white hover:bg-red-600 border-0',
|
|
||||||
cancelButton: 'btn bg-gray-300 text-gray-800 hover:bg-gray-400 border-0'
|
|
||||||
},
|
|
||||||
buttonsStyling: false
|
|
||||||
}).then((result) => {
|
|
||||||
if (result.isConfirmed) {
|
|
||||||
// TODO: Implement actual delete API call here
|
|
||||||
// For now, just show success message
|
|
||||||
|
|
||||||
Swal.fire({
|
|
||||||
title: 'Terhapus!',
|
|
||||||
text: 'Data berhasil dihapus.',
|
|
||||||
icon: 'success',
|
|
||||||
confirmButtonColor: '#166534',
|
|
||||||
confirmButtonText: 'OK',
|
|
||||||
customClass: {
|
|
||||||
confirmButton: 'btn bg-green-800 text-white hover:bg-green-900 border-0'
|
|
||||||
},
|
|
||||||
buttonsStyling: false
|
|
||||||
}).then(() => {
|
|
||||||
// Reload table
|
|
||||||
table.ajax.reload();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
function convertDateToInput(dateStr) {
|
// Delete button handler
|
||||||
// Convert "15 Mar 2024" to "2024-03-15"
|
$('#example').on('click', '.p-2.bg-red-500', function (e) {
|
||||||
const monthMap = {
|
e.preventDefault();
|
||||||
'Jan': '01', 'Feb': '02', 'Mar': '03', 'Apr': '04',
|
|
||||||
'Mei': '05', 'Jun': '06', 'Jul': '07', 'Agt': '08',
|
|
||||||
'Sep': '09', 'Okt': '10', 'Nov': '11', 'Des': '12'
|
|
||||||
};
|
|
||||||
|
|
||||||
const parts = dateStr.split(' ');
|
Swal.fire({
|
||||||
const day = parts[0].padStart(2, '0');
|
title: 'Apakah anda yakin?',
|
||||||
const month = monthMap[parts[1]];
|
text: "Data yang dihapus tidak dapat dikembalikan lagi",
|
||||||
const year = parts[2];
|
icon: 'warning',
|
||||||
|
showCancelButton: true,
|
||||||
|
confirmButtonColor: '#d33',
|
||||||
|
cancelButtonColor: '#3085d6',
|
||||||
|
confirmButtonText: 'Ya, Hapus',
|
||||||
|
cancelButtonText: 'Batal',
|
||||||
|
customClass: {
|
||||||
|
confirmButton: 'btn bg-red-500 text-white hover:bg-red-600 border-0',
|
||||||
|
cancelButton: 'btn bg-gray-300 text-gray-800 hover:bg-gray-400 border-0'
|
||||||
|
},
|
||||||
|
buttonsStyling: false
|
||||||
|
}).then((result) => {
|
||||||
|
if (result.isConfirmed) {
|
||||||
|
// TODO: Implement actual delete API call here
|
||||||
|
// For now, just show success message
|
||||||
|
|
||||||
return `${year}-${month}-${day}`;
|
Swal.fire({
|
||||||
}
|
title: 'Terhapus!',
|
||||||
|
text: 'Data berhasil dihapus.',
|
||||||
function closeModal() {
|
icon: 'success',
|
||||||
// Reset form
|
confirmButtonColor: '#166534',
|
||||||
$('#formTambah')[0].reset();
|
confirmButtonText: 'OK',
|
||||||
$('#edit_mode').val('false');
|
customClass: {
|
||||||
$('#modal_title').text('Tambah Transaksi BSI');
|
confirmButton: 'btn bg-green-800 text-white hover:bg-green-900 border-0'
|
||||||
modal_tambah.close();
|
},
|
||||||
}
|
buttonsStyling: false
|
||||||
|
}).then(() => {
|
||||||
function submitForm(e) {
|
// Reload table
|
||||||
e.preventDefault();
|
table.ajax.reload();
|
||||||
|
});
|
||||||
var isEditMode = $('#edit_mode').val() === 'true';
|
}
|
||||||
|
});
|
||||||
// TODO: Implement actual save/update API call here
|
|
||||||
// For now, just show success message
|
|
||||||
|
|
||||||
Swal.fire({
|
|
||||||
title: 'Berhasil!',
|
|
||||||
text: isEditMode ? 'Data berhasil diperbarui.' : 'Data berhasil ditambahkan.',
|
|
||||||
icon: 'success',
|
|
||||||
confirmButtonColor: '#166534',
|
|
||||||
confirmButtonText: 'OK',
|
|
||||||
customClass: {
|
|
||||||
confirmButton: 'btn bg-green-800 text-white hover:bg-green-900 border-0'
|
|
||||||
},
|
|
||||||
buttonsStyling: false
|
|
||||||
}).then(() => {
|
|
||||||
closeModal();
|
|
||||||
|
|
||||||
// Reload table
|
|
||||||
table.ajax.reload();
|
|
||||||
});
|
});
|
||||||
}
|
|
||||||
</script>
|
function convertDateToInput(dateStr) {
|
||||||
|
// Convert "15 Mar 2024" to "2024-03-15"
|
||||||
|
const monthMap = {
|
||||||
|
'Jan': '01', 'Feb': '02', 'Mar': '03', 'Apr': '04',
|
||||||
|
'Mei': '05', 'Jun': '06', 'Jul': '07', 'Agt': '08',
|
||||||
|
'Sep': '09', 'Okt': '10', 'Nov': '11', 'Des': '12'
|
||||||
|
};
|
||||||
|
|
||||||
|
const parts = dateStr.split(' ');
|
||||||
|
const day = parts[0].padStart(2, '0');
|
||||||
|
const month = monthMap[parts[1]];
|
||||||
|
const year = parts[2];
|
||||||
|
|
||||||
|
return `${year}-${month}-${day}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
function closeModal() {
|
||||||
|
// Reset form
|
||||||
|
$('#formTambah')[0].reset();
|
||||||
|
$('#edit_mode').val('false');
|
||||||
|
$('#modal_title').text('Tambah Transaksi BSI');
|
||||||
|
modal_tambah.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
function submitForm(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
|
||||||
|
var isEditMode = $('#edit_mode').val() === 'true';
|
||||||
|
|
||||||
|
// TODO: Implement actual save/update API call here
|
||||||
|
// For now, just show success message
|
||||||
|
|
||||||
|
Swal.fire({
|
||||||
|
title: 'Berhasil!',
|
||||||
|
text: isEditMode ? 'Data berhasil diperbarui.' : 'Data berhasil ditambahkan.',
|
||||||
|
icon: 'success',
|
||||||
|
confirmButtonColor: '#166534',
|
||||||
|
confirmButtonText: 'OK',
|
||||||
|
customClass: {
|
||||||
|
confirmButton: 'btn bg-green-800 text-white hover:bg-green-900 border-0'
|
||||||
|
},
|
||||||
|
buttonsStyling: false
|
||||||
|
}).then(() => {
|
||||||
|
closeModal();
|
||||||
|
|
||||||
|
// Reload table
|
||||||
|
table.ajax.reload();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -199,165 +199,163 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="https://code.jquery.com/jquery-3.7.1.js"></script>
|
@section Scripts {
|
||||||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
<script type="text/javascript">
|
||||||
<script src="https://cdn.datatables.net/2.3.4/js/dataTables.js"></script>
|
var table;
|
||||||
<script src="/plugins/datatables/dataTables.tailwindcss.js"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
var table;
|
|
||||||
|
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
table = new DataTable('#example', {
|
table = new DataTable('#example', {
|
||||||
ajax: '/Main/DataBankSampah/Table',
|
ajax: '/Main/DataBankSampah/Table',
|
||||||
scrollX: true,
|
scrollX: true,
|
||||||
autoWidth: false,
|
autoWidth: false,
|
||||||
initComplete: function () {
|
initComplete: function () {
|
||||||
$('div.dt-scroll-body thead').css('visibility', 'collapse');
|
$('div.dt-scroll-body thead').css('visibility', 'collapse');
|
||||||
},
|
},
|
||||||
columns: [
|
columns: [
|
||||||
{ data: null, render: (d, t, r, m) => m.row + 1, orderable: false, searchable: false },
|
{ data: null, render: (d, t, r, m) => m.row + 1, orderable: false, searchable: false },
|
||||||
{ data: 'nama' },
|
{ data: 'nama' },
|
||||||
{ data: 'kabupaten' },
|
{ data: 'kabupaten' },
|
||||||
{ data: 'kecamatan' },
|
{ data: 'kecamatan' },
|
||||||
{ data: 'kelurahan' },
|
{ data: 'kelurahan' },
|
||||||
{ data: 'jenis' },
|
{ data: 'jenis' },
|
||||||
{ data: 'kategori' },
|
{ data: 'kategori' },
|
||||||
{ data: 'status' },
|
{ data: 'status' },
|
||||||
{ data: 'aksi' },
|
{ data: 'aksi' },
|
||||||
]
|
]
|
||||||
|
});
|
||||||
|
|
||||||
|
// Delete button handler
|
||||||
|
$('#example').on('click', '.btn-circle.btn-error', function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
|
||||||
|
// Get row data
|
||||||
|
var row = table.row($(this).parents('tr')).data();
|
||||||
|
|
||||||
|
Swal.fire({
|
||||||
|
title: 'Apakah anda yakin?',
|
||||||
|
text: "Data yang dihapus tidak dapat dikembalikan lagi",
|
||||||
|
icon: 'warning',
|
||||||
|
showCancelButton: true,
|
||||||
|
confirmButtonText: 'Ya, Hapus',
|
||||||
|
cancelButtonText: 'Batal',
|
||||||
|
buttonsStyling: false,
|
||||||
|
customClass: {
|
||||||
|
confirmButton: 'btn bg-red-500 text-white hover:bg-red-600 px-4 py-2 rounded-full mr-2',
|
||||||
|
cancelButton: 'btn bg-white text-gray-500 hover:bg-gray-50 px-4 py-2 rounded-full border border-gray-300',
|
||||||
|
},
|
||||||
|
}).then((result) => {
|
||||||
|
if (result.isConfirmed) {
|
||||||
|
// TODO: Implement actual delete API call
|
||||||
|
Swal.fire({
|
||||||
|
title: 'Terhapus!',
|
||||||
|
text: 'Data berhasil dihapus.',
|
||||||
|
icon: 'success',
|
||||||
|
confirmButtonText: 'OK',
|
||||||
|
buttonsStyling: false,
|
||||||
|
customClass: {
|
||||||
|
confirmButton: 'btn bg-green-800 text-white hover:bg-green-900 px-4 py-2 rounded-full',
|
||||||
|
},
|
||||||
|
}).then(() => {
|
||||||
|
// Reload table
|
||||||
|
table.ajax.reload();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// Edit button handler
|
||||||
|
$('#example').on('click', '.btn-circle.btn-warning', function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
|
||||||
|
// Get row data
|
||||||
|
var row = table.row($(this).parents('tr')).data();
|
||||||
|
|
||||||
|
// Set edit mode
|
||||||
|
$('#edit_mode').val('true');
|
||||||
|
$('#modal_title').text('Edit Data Bank Sampah');
|
||||||
|
|
||||||
|
// Populate form with row data
|
||||||
|
$('#nama').val(row.nama);
|
||||||
|
$('#kabupaten').val(row.kabupaten);
|
||||||
|
$('#kecamatan').val(row.kecamatan);
|
||||||
|
$('#kelurahan').val(row.kelurahan);
|
||||||
|
$('#jenis').val(row.jenis);
|
||||||
|
$('#kategori').val(row.kategori);
|
||||||
|
|
||||||
|
// Extract status from HTML badge
|
||||||
|
var statusText = $(row.status).text().trim();
|
||||||
|
$('#status').val(statusText);
|
||||||
|
|
||||||
|
// Open modal
|
||||||
|
modal_tambah.showModal();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// Delete button handler
|
function closeModal() {
|
||||||
$('#example').on('click', '.btn-circle.btn-error', function (e) {
|
// Reset form
|
||||||
|
$('#formTambah')[0].reset();
|
||||||
|
$('#edit_mode').val('false');
|
||||||
|
$('#modal_title').text('Tambah Data Bank Sampah');
|
||||||
|
|
||||||
|
// Close modal
|
||||||
|
modal_tambah.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
function submitForm(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
// Get row data
|
var isEditMode = $('#edit_mode').val() === 'true';
|
||||||
var row = table.row($(this).parents('tr')).data();
|
|
||||||
|
// Collect form data
|
||||||
|
var formData = {
|
||||||
|
nama: $('#nama').val(),
|
||||||
|
kabupaten: $('#kabupaten').val(),
|
||||||
|
kecamatan: $('#kecamatan').val(),
|
||||||
|
kelurahan: $('#kelurahan').val(),
|
||||||
|
jenis: $('#jenis').val(),
|
||||||
|
kategori: $('#kategori').val(),
|
||||||
|
status: $('#status').val()
|
||||||
|
};
|
||||||
|
|
||||||
|
// TODO: Implement form submission logic (API call)
|
||||||
|
console.log('Form data:', formData);
|
||||||
|
|
||||||
Swal.fire({
|
Swal.fire({
|
||||||
title: 'Apakah anda yakin?',
|
title: 'Berhasil!',
|
||||||
text: "Data yang dihapus tidak dapat dikembalikan lagi",
|
text: isEditMode ? 'Data berhasil diperbarui' : 'Data berhasil ditambahkan',
|
||||||
icon: 'warning',
|
icon: 'success',
|
||||||
showCancelButton: true,
|
confirmButtonText: 'OK',
|
||||||
confirmButtonText: 'Ya, Hapus',
|
|
||||||
cancelButtonText: 'Batal',
|
|
||||||
buttonsStyling: false,
|
buttonsStyling: false,
|
||||||
customClass: {
|
customClass: {
|
||||||
confirmButton: 'btn bg-red-500 text-white hover:bg-red-600 px-4 py-2 rounded-full mr-2',
|
confirmButton: 'btn bg-green-800 text-white hover:bg-green-900 px-4 py-2 rounded-full',
|
||||||
cancelButton: 'btn bg-white text-gray-500 hover:bg-gray-50 px-4 py-2 rounded-full border border-gray-300',
|
|
||||||
},
|
},
|
||||||
}).then((result) => {
|
}).then(() => {
|
||||||
if (result.isConfirmed) {
|
closeModal();
|
||||||
// TODO: Implement actual delete API call
|
|
||||||
Swal.fire({
|
|
||||||
title: 'Terhapus!',
|
|
||||||
text: 'Data berhasil dihapus.',
|
|
||||||
icon: 'success',
|
|
||||||
confirmButtonText: 'OK',
|
|
||||||
buttonsStyling: false,
|
|
||||||
customClass: {
|
|
||||||
confirmButton: 'btn bg-green-800 text-white hover:bg-green-900 px-4 py-2 rounded-full',
|
|
||||||
},
|
|
||||||
}).then(() => {
|
|
||||||
// Reload table
|
|
||||||
table.ajax.reload();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
// Edit button handler
|
// Reload table
|
||||||
$('#example').on('click', '.btn-circle.btn-warning', function (e) {
|
table.ajax.reload();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function applyFilter(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
// Get row data
|
const jenis = $('#filterJenis').val();
|
||||||
var row = table.row($(this).parents('tr')).data();
|
const kategori = $('#filterKategori').val();
|
||||||
|
const status = $('#filterStatus').val();
|
||||||
|
|
||||||
// Set edit mode
|
table.ajax.url('/Main/DataBankSampah/Table').load((json) => {
|
||||||
$('#edit_mode').val('true');
|
const filtered = json.data.filter(row => {
|
||||||
$('#modal_title').text('Edit Data Bank Sampah');
|
return (!jenis || row.jenis === jenis)
|
||||||
|
&& (!kategori || row.kategori === kategori)
|
||||||
|
&& (!status || row.status === status);
|
||||||
|
});
|
||||||
|
|
||||||
// Populate form with row data
|
table.clear();
|
||||||
$('#nama').val(row.nama);
|
table.rows.add(filtered).draw();
|
||||||
$('#kabupaten').val(row.kabupaten);
|
|
||||||
$('#kecamatan').val(row.kecamatan);
|
|
||||||
$('#kelurahan').val(row.kelurahan);
|
|
||||||
$('#jenis').val(row.jenis);
|
|
||||||
$('#kategori').val(row.kategori);
|
|
||||||
|
|
||||||
// Extract status from HTML badge
|
|
||||||
var statusText = $(row.status).text().trim();
|
|
||||||
$('#status').val(statusText);
|
|
||||||
|
|
||||||
// Open modal
|
|
||||||
modal_tambah.showModal();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
function closeModal() {
|
|
||||||
// Reset form
|
|
||||||
$('#formTambah')[0].reset();
|
|
||||||
$('#edit_mode').val('false');
|
|
||||||
$('#modal_title').text('Tambah Data Bank Sampah');
|
|
||||||
|
|
||||||
// Close modal
|
|
||||||
modal_tambah.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
function submitForm(e) {
|
|
||||||
e.preventDefault();
|
|
||||||
|
|
||||||
var isEditMode = $('#edit_mode').val() === 'true';
|
|
||||||
|
|
||||||
// Collect form data
|
|
||||||
var formData = {
|
|
||||||
nama: $('#nama').val(),
|
|
||||||
kabupaten: $('#kabupaten').val(),
|
|
||||||
kecamatan: $('#kecamatan').val(),
|
|
||||||
kelurahan: $('#kelurahan').val(),
|
|
||||||
jenis: $('#jenis').val(),
|
|
||||||
kategori: $('#kategori').val(),
|
|
||||||
status: $('#status').val()
|
|
||||||
};
|
|
||||||
|
|
||||||
// TODO: Implement form submission logic (API call)
|
|
||||||
console.log('Form data:', formData);
|
|
||||||
|
|
||||||
Swal.fire({
|
|
||||||
title: 'Berhasil!',
|
|
||||||
text: isEditMode ? 'Data berhasil diperbarui' : 'Data berhasil ditambahkan',
|
|
||||||
icon: 'success',
|
|
||||||
confirmButtonText: 'OK',
|
|
||||||
buttonsStyling: false,
|
|
||||||
customClass: {
|
|
||||||
confirmButton: 'btn bg-green-800 text-white hover:bg-green-900 px-4 py-2 rounded-full',
|
|
||||||
},
|
|
||||||
}).then(() => {
|
|
||||||
closeModal();
|
|
||||||
|
|
||||||
// Reload table
|
|
||||||
table.ajax.reload();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function applyFilter(e) {
|
|
||||||
e.preventDefault();
|
|
||||||
|
|
||||||
const jenis = $('#filterJenis').val();
|
|
||||||
const kategori = $('#filterKategori').val();
|
|
||||||
const status = $('#filterStatus').val();
|
|
||||||
|
|
||||||
table.ajax.url('/Main/DataBankSampah/Table').load((json) => {
|
|
||||||
const filtered = json.data.filter(row => {
|
|
||||||
return (!jenis || row.jenis === jenis)
|
|
||||||
&& (!kategori || row.kategori === kategori)
|
|
||||||
&& (!status || row.status === status);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
table.clear();
|
modal_filter.close();
|
||||||
table.rows.add(filtered).draw();
|
}
|
||||||
});
|
</script>
|
||||||
|
}
|
||||||
modal_filter.close();
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
@ -202,128 +202,126 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="https://code.jquery.com/jquery-3.7.1.js"></script>
|
@section Scripts {
|
||||||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
<script type="text/javascript">
|
||||||
<script src="https://cdn.datatables.net/2.3.4/js/dataTables.js"></script>
|
var table;
|
||||||
<script src="/plugins/datatables/dataTables.tailwindcss.js"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
var table;
|
|
||||||
|
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
table = new DataTable('#example', {
|
table = new DataTable('#example', {
|
||||||
ajax: '/Main/DataNasabah/Table',
|
ajax: '/Main/DataNasabah/Table',
|
||||||
scrollX: true,
|
scrollX: true,
|
||||||
autoWidth: false,
|
autoWidth: false,
|
||||||
initComplete: function () {
|
initComplete: function () {
|
||||||
$('div.dt-scroll-body thead').css('visibility', 'collapse');
|
$('div.dt-scroll-body thead').css('visibility', 'collapse');
|
||||||
},
|
|
||||||
columns: [
|
|
||||||
{ data: null, render: (d, t, r, m) => m.row + 1, orderable: false, searchable: false },
|
|
||||||
{ data: 'nama' },
|
|
||||||
{ data: 'kabupaten' },
|
|
||||||
{ data: 'kecamatan' },
|
|
||||||
{ data: 'kelurahan' },
|
|
||||||
{ data: 'id_bangunan' },
|
|
||||||
{ data: 'jenis' },
|
|
||||||
{ data: 'status' },
|
|
||||||
{ data: 'aksi' },
|
|
||||||
]
|
|
||||||
});
|
|
||||||
|
|
||||||
// Delete button handler
|
|
||||||
$('#example').on('click', '.btn-circle.btn-error', function (e) {
|
|
||||||
e.preventDefault();
|
|
||||||
|
|
||||||
Swal.fire({
|
|
||||||
title: 'Apakah anda yakin?',
|
|
||||||
text: "Data yang dihapus tidak dapat dikembalikan lagi",
|
|
||||||
icon: 'warning',
|
|
||||||
showCancelButton: true,
|
|
||||||
confirmButtonText: 'Ya, Hapus',
|
|
||||||
cancelButtonText: 'Batal',
|
|
||||||
buttonsStyling: false,
|
|
||||||
customClass: {
|
|
||||||
confirmButton: 'btn bg-red-500 text-white hover:bg-red-600 px-4 py-2 rounded-full mr-2',
|
|
||||||
cancelButton: 'btn bg-white text-gray-500 hover:bg-gray-50 px-4 py-2 rounded-full border border-gray-300',
|
|
||||||
},
|
},
|
||||||
}).then((result) => {
|
columns: [
|
||||||
if (result.isConfirmed) {
|
{ data: null, render: (d, t, r, m) => m.row + 1, orderable: false, searchable: false },
|
||||||
// TODO: Implement actual delete API call
|
{ data: 'nama' },
|
||||||
Swal.fire({
|
{ data: 'kabupaten' },
|
||||||
title: 'Terhapus!',
|
{ data: 'kecamatan' },
|
||||||
text: 'Data berhasil dihapus.',
|
{ data: 'kelurahan' },
|
||||||
icon: 'success',
|
{ data: 'id_bangunan' },
|
||||||
confirmButtonText: 'OK',
|
{ data: 'jenis' },
|
||||||
buttonsStyling: false,
|
{ data: 'status' },
|
||||||
customClass: {
|
{ data: 'aksi' },
|
||||||
confirmButton: 'btn bg-green-800 text-white hover:bg-green-900 px-4 py-2 rounded-full',
|
]
|
||||||
},
|
});
|
||||||
}).then(() => {
|
|
||||||
// Reload table
|
// Delete button handler
|
||||||
table.ajax.reload();
|
$('#example').on('click', '.btn-circle.btn-error', function (e) {
|
||||||
});
|
e.preventDefault();
|
||||||
}
|
|
||||||
|
Swal.fire({
|
||||||
|
title: 'Apakah anda yakin?',
|
||||||
|
text: "Data yang dihapus tidak dapat dikembalikan lagi",
|
||||||
|
icon: 'warning',
|
||||||
|
showCancelButton: true,
|
||||||
|
confirmButtonText: 'Ya, Hapus',
|
||||||
|
cancelButtonText: 'Batal',
|
||||||
|
buttonsStyling: false,
|
||||||
|
customClass: {
|
||||||
|
confirmButton: 'btn bg-red-500 text-white hover:bg-red-600 px-4 py-2 rounded-full mr-2',
|
||||||
|
cancelButton: 'btn bg-white text-gray-500 hover:bg-gray-50 px-4 py-2 rounded-full border border-gray-300',
|
||||||
|
},
|
||||||
|
}).then((result) => {
|
||||||
|
if (result.isConfirmed) {
|
||||||
|
// TODO: Implement actual delete API call
|
||||||
|
Swal.fire({
|
||||||
|
title: 'Terhapus!',
|
||||||
|
text: 'Data berhasil dihapus.',
|
||||||
|
icon: 'success',
|
||||||
|
confirmButtonText: 'OK',
|
||||||
|
buttonsStyling: false,
|
||||||
|
customClass: {
|
||||||
|
confirmButton: 'btn bg-green-800 text-white hover:bg-green-900 px-4 py-2 rounded-full',
|
||||||
|
},
|
||||||
|
}).then(() => {
|
||||||
|
// Reload table
|
||||||
|
table.ajax.reload();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// Edit button handler
|
||||||
|
$('#example').on('click', '.btn-circle.btn-warning', function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
|
||||||
|
// Get row data
|
||||||
|
var row = table.row($(this).parents('tr')).data();
|
||||||
|
|
||||||
|
// Set edit mode
|
||||||
|
$('#edit_mode').val('true');
|
||||||
|
$('#modal_title').text('Edit Data Nasabah');
|
||||||
|
|
||||||
|
// Populate form with row data
|
||||||
|
$('#nama').val(row.nama);
|
||||||
|
$('#kabupaten').val(row.kabupaten);
|
||||||
|
$('#kecamatan').val(row.kecamatan);
|
||||||
|
$('#kelurahan').val(row.kelurahan);
|
||||||
|
$('#id_bangunan').val(row.id_bangunan);
|
||||||
|
$('#jenis').val(row.jenis);
|
||||||
|
|
||||||
|
// Extract status from HTML badge
|
||||||
|
var statusText = $(row.status).text().trim();
|
||||||
|
$('#status').val(statusText);
|
||||||
|
|
||||||
|
// Open modal
|
||||||
|
modal_tambah.showModal();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// Edit button handler
|
function closeModal() {
|
||||||
$('#example').on('click', '.btn-circle.btn-warning', function (e) {
|
// Reset form
|
||||||
|
$('#formTambah')[0].reset();
|
||||||
|
$('#edit_mode').val('false');
|
||||||
|
$('#modal_title').text('Tambah Data Nasabah');
|
||||||
|
|
||||||
|
// Close modal
|
||||||
|
modal_tambah.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
function submitForm(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
// Get row data
|
var isEditMode = $('#edit_mode').val() === 'true';
|
||||||
var row = table.row($(this).parents('tr')).data();
|
|
||||||
|
|
||||||
// Set edit mode
|
// TODO: Implement form submission logic
|
||||||
$('#edit_mode').val('true');
|
Swal.fire({
|
||||||
$('#modal_title').text('Edit Data Nasabah');
|
title: 'Berhasil!',
|
||||||
|
text: isEditMode ? 'Data berhasil diperbarui' : 'Data berhasil ditambahkan',
|
||||||
|
icon: 'success',
|
||||||
|
confirmButtonText: 'OK',
|
||||||
|
buttonsStyling: false,
|
||||||
|
customClass: {
|
||||||
|
confirmButton: 'btn bg-green-800 text-white hover:bg-green-900 px-4 py-2 rounded-full',
|
||||||
|
},
|
||||||
|
}).then(() => {
|
||||||
|
closeModal();
|
||||||
|
|
||||||
// Populate form with row data
|
// Reload table
|
||||||
$('#nama').val(row.nama);
|
table.ajax.reload();
|
||||||
$('#kabupaten').val(row.kabupaten);
|
});
|
||||||
$('#kecamatan').val(row.kecamatan);
|
}
|
||||||
$('#kelurahan').val(row.kelurahan);
|
</script>
|
||||||
$('#id_bangunan').val(row.id_bangunan);
|
}
|
||||||
$('#jenis').val(row.jenis);
|
|
||||||
|
|
||||||
// Extract status from HTML badge
|
|
||||||
var statusText = $(row.status).text().trim();
|
|
||||||
$('#status').val(statusText);
|
|
||||||
|
|
||||||
// Open modal
|
|
||||||
modal_tambah.showModal();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
function closeModal() {
|
|
||||||
// Reset form
|
|
||||||
$('#formTambah')[0].reset();
|
|
||||||
$('#edit_mode').val('false');
|
|
||||||
$('#modal_title').text('Tambah Data Nasabah');
|
|
||||||
|
|
||||||
// Close modal
|
|
||||||
modal_tambah.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
function submitForm(e) {
|
|
||||||
e.preventDefault();
|
|
||||||
|
|
||||||
var isEditMode = $('#edit_mode').val() === 'true';
|
|
||||||
|
|
||||||
// TODO: Implement form submission logic
|
|
||||||
Swal.fire({
|
|
||||||
title: 'Berhasil!',
|
|
||||||
text: isEditMode ? 'Data berhasil diperbarui' : 'Data berhasil ditambahkan',
|
|
||||||
icon: 'success',
|
|
||||||
confirmButtonText: 'OK',
|
|
||||||
buttonsStyling: false,
|
|
||||||
customClass: {
|
|
||||||
confirmButton: 'btn bg-green-800 text-white hover:bg-green-900 px-4 py-2 rounded-full',
|
|
||||||
},
|
|
||||||
}).then(() => {
|
|
||||||
closeModal();
|
|
||||||
|
|
||||||
// Reload table
|
|
||||||
table.ajax.reload();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
|
||||||
|
|
@ -152,122 +152,120 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="https://code.jquery.com/jquery-3.7.1.js"></script>
|
@section Scripts {
|
||||||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
<script type="text/javascript">
|
||||||
<script src="https://cdn.datatables.net/2.3.4/js/dataTables.js"></script>
|
var table;
|
||||||
<script src="/plugins/datatables/dataTables.tailwindcss.js"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
var table;
|
|
||||||
|
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
table = new DataTable('#example', {
|
table = new DataTable('#example', {
|
||||||
ajax: '/Main/DataOfftaker/Table',
|
ajax: '/Main/DataOfftaker/Table',
|
||||||
scrollX: true,
|
scrollX: true,
|
||||||
autoWidth: false,
|
autoWidth: false,
|
||||||
initComplete: function () {
|
initComplete: function () {
|
||||||
$('div.dt-scroll-body thead').css('visibility', 'collapse');
|
$('div.dt-scroll-body thead').css('visibility', 'collapse');
|
||||||
},
|
|
||||||
columns: [
|
|
||||||
{ data: null, render: (d, t, r, m) => m.row + 1, orderable: false, searchable: false },
|
|
||||||
{ data: 'nama' },
|
|
||||||
{ data: 'kabupaten' },
|
|
||||||
{ data: 'kecamatan' },
|
|
||||||
{ data: 'status' },
|
|
||||||
{ data: 'aksi' },
|
|
||||||
]
|
|
||||||
});
|
|
||||||
|
|
||||||
// Delete button handler
|
|
||||||
$('#example').on('click', '.btn-circle.btn-error', function (e) {
|
|
||||||
e.preventDefault();
|
|
||||||
|
|
||||||
Swal.fire({
|
|
||||||
title: 'Apakah anda yakin?',
|
|
||||||
text: "Data yang dihapus tidak dapat dikembalikan lagi",
|
|
||||||
icon: 'warning',
|
|
||||||
showCancelButton: true,
|
|
||||||
confirmButtonText: 'Ya, Hapus',
|
|
||||||
cancelButtonText: 'Batal',
|
|
||||||
buttonsStyling: false,
|
|
||||||
customClass: {
|
|
||||||
confirmButton: 'btn bg-red-500 text-white hover:bg-red-600 px-4 py-2 rounded-full mr-2',
|
|
||||||
cancelButton: 'btn bg-white text-gray-500 hover:bg-gray-50 px-4 py-2 rounded-full border border-gray-300',
|
|
||||||
},
|
},
|
||||||
}).then((result) => {
|
columns: [
|
||||||
if (result.isConfirmed) {
|
{ data: null, render: (d, t, r, m) => m.row + 1, orderable: false, searchable: false },
|
||||||
// TODO: Implement actual delete API call
|
{ data: 'nama' },
|
||||||
Swal.fire({
|
{ data: 'kabupaten' },
|
||||||
title: 'Terhapus!',
|
{ data: 'kecamatan' },
|
||||||
text: 'Data berhasil dihapus.',
|
{ data: 'status' },
|
||||||
icon: 'success',
|
{ data: 'aksi' },
|
||||||
confirmButtonText: 'OK',
|
]
|
||||||
buttonsStyling: false,
|
});
|
||||||
customClass: {
|
|
||||||
confirmButton: 'btn bg-green-800 text-white hover:bg-green-900 px-4 py-2 rounded-full',
|
// Delete button handler
|
||||||
},
|
$('#example').on('click', '.btn-circle.btn-error', function (e) {
|
||||||
}).then(() => {
|
e.preventDefault();
|
||||||
// Reload table
|
|
||||||
table.ajax.reload();
|
Swal.fire({
|
||||||
});
|
title: 'Apakah anda yakin?',
|
||||||
}
|
text: "Data yang dihapus tidak dapat dikembalikan lagi",
|
||||||
|
icon: 'warning',
|
||||||
|
showCancelButton: true,
|
||||||
|
confirmButtonText: 'Ya, Hapus',
|
||||||
|
cancelButtonText: 'Batal',
|
||||||
|
buttonsStyling: false,
|
||||||
|
customClass: {
|
||||||
|
confirmButton: 'btn bg-red-500 text-white hover:bg-red-600 px-4 py-2 rounded-full mr-2',
|
||||||
|
cancelButton: 'btn bg-white text-gray-500 hover:bg-gray-50 px-4 py-2 rounded-full border border-gray-300',
|
||||||
|
},
|
||||||
|
}).then((result) => {
|
||||||
|
if (result.isConfirmed) {
|
||||||
|
// TODO: Implement actual delete API call
|
||||||
|
Swal.fire({
|
||||||
|
title: 'Terhapus!',
|
||||||
|
text: 'Data berhasil dihapus.',
|
||||||
|
icon: 'success',
|
||||||
|
confirmButtonText: 'OK',
|
||||||
|
buttonsStyling: false,
|
||||||
|
customClass: {
|
||||||
|
confirmButton: 'btn bg-green-800 text-white hover:bg-green-900 px-4 py-2 rounded-full',
|
||||||
|
},
|
||||||
|
}).then(() => {
|
||||||
|
// Reload table
|
||||||
|
table.ajax.reload();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// Edit button handler
|
||||||
|
$('#example').on('click', '.btn-circle.btn-warning', function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
|
||||||
|
// Get row data
|
||||||
|
var row = table.row($(this).parents('tr')).data();
|
||||||
|
|
||||||
|
// Set edit mode
|
||||||
|
$('#edit_mode').val('true');
|
||||||
|
$('#modal_title').text('Edit Data Offtaker');
|
||||||
|
|
||||||
|
// Populate form with row data
|
||||||
|
$('#nama').val(row.nama);
|
||||||
|
$('#kabupaten').val(row.kabupaten);
|
||||||
|
$('#kecamatan').val(row.kecamatan);
|
||||||
|
|
||||||
|
// Extract status from HTML badge
|
||||||
|
var statusText = $(row.status).text().trim();
|
||||||
|
$('#status').val(statusText);
|
||||||
|
|
||||||
|
// Open modal
|
||||||
|
modal_tambah.showModal();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// Edit button handler
|
function closeModal() {
|
||||||
$('#example').on('click', '.btn-circle.btn-warning', function (e) {
|
// Reset form
|
||||||
|
$('#formTambah')[0].reset();
|
||||||
|
$('#edit_mode').val('false');
|
||||||
|
$('#modal_title').text('Tambah Data Offtaker');
|
||||||
|
|
||||||
|
// Close modal
|
||||||
|
modal_tambah.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
function submitForm(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
// Get row data
|
var isEditMode = $('#edit_mode').val() === 'true';
|
||||||
var row = table.row($(this).parents('tr')).data();
|
|
||||||
|
|
||||||
// Set edit mode
|
// TODO: Implement form submission logic
|
||||||
$('#edit_mode').val('true');
|
Swal.fire({
|
||||||
$('#modal_title').text('Edit Data Offtaker');
|
title: 'Berhasil!',
|
||||||
|
text: isEditMode ? 'Data berhasil diperbarui' : 'Data berhasil ditambahkan',
|
||||||
|
icon: 'success',
|
||||||
|
confirmButtonText: 'OK',
|
||||||
|
buttonsStyling: false,
|
||||||
|
customClass: {
|
||||||
|
confirmButton: 'btn bg-green-800 text-white hover:bg-green-900 px-4 py-2 rounded-full',
|
||||||
|
},
|
||||||
|
}).then(() => {
|
||||||
|
closeModal();
|
||||||
|
|
||||||
// Populate form with row data
|
// Reload table
|
||||||
$('#nama').val(row.nama);
|
table.ajax.reload();
|
||||||
$('#kabupaten').val(row.kabupaten);
|
});
|
||||||
$('#kecamatan').val(row.kecamatan);
|
}
|
||||||
|
</script>
|
||||||
// Extract status from HTML badge
|
}
|
||||||
var statusText = $(row.status).text().trim();
|
|
||||||
$('#status').val(statusText);
|
|
||||||
|
|
||||||
// Open modal
|
|
||||||
modal_tambah.showModal();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
function closeModal() {
|
|
||||||
// Reset form
|
|
||||||
$('#formTambah')[0].reset();
|
|
||||||
$('#edit_mode').val('false');
|
|
||||||
$('#modal_title').text('Tambah Data Offtaker');
|
|
||||||
|
|
||||||
// Close modal
|
|
||||||
modal_tambah.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
function submitForm(e) {
|
|
||||||
e.preventDefault();
|
|
||||||
|
|
||||||
var isEditMode = $('#edit_mode').val() === 'true';
|
|
||||||
|
|
||||||
// TODO: Implement form submission logic
|
|
||||||
Swal.fire({
|
|
||||||
title: 'Berhasil!',
|
|
||||||
text: isEditMode ? 'Data berhasil diperbarui' : 'Data berhasil ditambahkan',
|
|
||||||
icon: 'success',
|
|
||||||
confirmButtonText: 'OK',
|
|
||||||
buttonsStyling: false,
|
|
||||||
customClass: {
|
|
||||||
confirmButton: 'btn bg-green-800 text-white hover:bg-green-900 px-4 py-2 rounded-full',
|
|
||||||
},
|
|
||||||
}).then(() => {
|
|
||||||
closeModal();
|
|
||||||
|
|
||||||
// Reload table
|
|
||||||
table.ajax.reload();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
|
||||||
|
|
@ -186,150 +186,148 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="https://code.jquery.com/jquery-3.7.1.js"></script>
|
@section Scripts {
|
||||||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
<script type="text/javascript">
|
||||||
<script src="https://cdn.datatables.net/2.3.4/js/dataTables.js"></script>
|
var table;
|
||||||
<script src="/plugins/datatables/dataTables.tailwindcss.js"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
var table;
|
|
||||||
|
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
table = new DataTable('#example', {
|
table = new DataTable('#example', {
|
||||||
ajax: '/Main/Maggot/Table',
|
ajax: '/Main/Maggot/Table',
|
||||||
scrollX: true,
|
scrollX: true,
|
||||||
autoWidth: false,
|
autoWidth: false,
|
||||||
initComplete: function () {
|
initComplete: function () {
|
||||||
$('div.dt-scroll-body thead').css('visibility', 'collapse');
|
$('div.dt-scroll-body thead').css('visibility', 'collapse');
|
||||||
},
|
|
||||||
columns: [
|
|
||||||
{ data: null, render: (d, t, r, m) => m.row + 1, orderable: false, searchable: false },
|
|
||||||
{ data: 'tanggal_pencatatan' },
|
|
||||||
{ data: 'nama_bank_sampah' },
|
|
||||||
{ data: 'nama_penanggung_jawab' },
|
|
||||||
{ data: 'jenis_sampah_organik' },
|
|
||||||
{ data: 'jumlah_sampah_masuk' },
|
|
||||||
{ data: 'jumlah_maggot_dihasilkan' },
|
|
||||||
{ data: 'status_validasi' },
|
|
||||||
{ data: 'catatan' },
|
|
||||||
{ data: 'aksi' },
|
|
||||||
]
|
|
||||||
});
|
|
||||||
|
|
||||||
// Delete button handler
|
|
||||||
$('#example').on('click', '.p-2.bg-red-500', function (e) {
|
|
||||||
e.preventDefault();
|
|
||||||
|
|
||||||
Swal.fire({
|
|
||||||
title: 'Apakah anda yakin?',
|
|
||||||
text: "Data yang dihapus tidak dapat dikembalikan lagi",
|
|
||||||
icon: 'warning',
|
|
||||||
showCancelButton: true,
|
|
||||||
confirmButtonText: 'Ya, Hapus',
|
|
||||||
cancelButtonText: 'Batal',
|
|
||||||
buttonsStyling: false,
|
|
||||||
customClass: {
|
|
||||||
confirmButton: 'btn bg-red-500 text-white hover:bg-red-600 px-4 py-2 rounded-full mr-2',
|
|
||||||
cancelButton: 'btn bg-white text-gray-500 hover:bg-gray-50 px-4 py-2 rounded-full border border-gray-300',
|
|
||||||
},
|
},
|
||||||
}).then((result) => {
|
columns: [
|
||||||
if (result.isConfirmed) {
|
{ data: null, render: (d, t, r, m) => m.row + 1, orderable: false, searchable: false },
|
||||||
// TODO: Implement actual delete API call
|
{ data: 'tanggal_pencatatan' },
|
||||||
Swal.fire({
|
{ data: 'nama_bank_sampah' },
|
||||||
title: 'Terhapus!',
|
{ data: 'nama_penanggung_jawab' },
|
||||||
text: 'Data berhasil dihapus.',
|
{ data: 'jenis_sampah_organik' },
|
||||||
icon: 'success',
|
{ data: 'jumlah_sampah_masuk' },
|
||||||
confirmButtonText: 'OK',
|
{ data: 'jumlah_maggot_dihasilkan' },
|
||||||
buttonsStyling: false,
|
{ data: 'status_validasi' },
|
||||||
customClass: {
|
{ data: 'catatan' },
|
||||||
confirmButton: 'btn bg-green-800 text-white hover:bg-green-900 px-4 py-2 rounded-full',
|
{ data: 'aksi' },
|
||||||
},
|
]
|
||||||
}).then(() => {
|
});
|
||||||
// Reload table
|
|
||||||
table.ajax.reload();
|
// Delete button handler
|
||||||
});
|
$('#example').on('click', '.p-2.bg-red-500', function (e) {
|
||||||
}
|
e.preventDefault();
|
||||||
|
|
||||||
|
Swal.fire({
|
||||||
|
title: 'Apakah anda yakin?',
|
||||||
|
text: "Data yang dihapus tidak dapat dikembalikan lagi",
|
||||||
|
icon: 'warning',
|
||||||
|
showCancelButton: true,
|
||||||
|
confirmButtonText: 'Ya, Hapus',
|
||||||
|
cancelButtonText: 'Batal',
|
||||||
|
buttonsStyling: false,
|
||||||
|
customClass: {
|
||||||
|
confirmButton: 'btn bg-red-500 text-white hover:bg-red-600 px-4 py-2 rounded-full mr-2',
|
||||||
|
cancelButton: 'btn bg-white text-gray-500 hover:bg-gray-50 px-4 py-2 rounded-full border border-gray-300',
|
||||||
|
},
|
||||||
|
}).then((result) => {
|
||||||
|
if (result.isConfirmed) {
|
||||||
|
// TODO: Implement actual delete API call
|
||||||
|
Swal.fire({
|
||||||
|
title: 'Terhapus!',
|
||||||
|
text: 'Data berhasil dihapus.',
|
||||||
|
icon: 'success',
|
||||||
|
confirmButtonText: 'OK',
|
||||||
|
buttonsStyling: false,
|
||||||
|
customClass: {
|
||||||
|
confirmButton: 'btn bg-green-800 text-white hover:bg-green-900 px-4 py-2 rounded-full',
|
||||||
|
},
|
||||||
|
}).then(() => {
|
||||||
|
// Reload table
|
||||||
|
table.ajax.reload();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// Edit button handler
|
||||||
|
$('#example').on('click', '.p-2.bg-amber-500', function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
|
||||||
|
// Get row data
|
||||||
|
var row = table.row($(this).parents('tr')).data();
|
||||||
|
|
||||||
|
// Set edit mode
|
||||||
|
$('#edit_mode').val('true');
|
||||||
|
$('#modal_title').text('Edit Data Maggot');
|
||||||
|
|
||||||
|
// Convert date format from "15 Mar 2024" to "2024-03-15"
|
||||||
|
var tglPencatatan = convertDateToInput(row.tanggal_pencatatan);
|
||||||
|
|
||||||
|
// Populate form with row data
|
||||||
|
$('#tgl_pencatatan').val(tglPencatatan);
|
||||||
|
$('#nama_bank_sampah').val(row.nama_bank_sampah);
|
||||||
|
$('#nama_penanggung_jawab').val(row.nama_penanggung_jawab);
|
||||||
|
$('#jenis_sampah_organik').val(row.jenis_sampah_organik);
|
||||||
|
$('#jumlah_sampah_masuk').val(row.jumlah_sampah_masuk);
|
||||||
|
$('#jumlah_maggot_dihasilkan').val(row.jumlah_maggot_dihasilkan);
|
||||||
|
|
||||||
|
// Extract status from HTML badge
|
||||||
|
var statusText = $(row.status_validasi).text().trim();
|
||||||
|
$('#status_validasi').val(statusText);
|
||||||
|
|
||||||
|
$('#catatan').val(row.catatan);
|
||||||
|
|
||||||
|
// Open modal
|
||||||
|
modal_tambah.showModal();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// Edit button handler
|
// Function to convert date format "15 Mar 2024" to "2024-03-15"
|
||||||
$('#example').on('click', '.p-2.bg-amber-500', function (e) {
|
function convertDateToInput(dateStr) {
|
||||||
|
const monthMap = {
|
||||||
|
'Jan': '01', 'Feb': '02', 'Mar': '03', 'Apr': '04',
|
||||||
|
'Mei': '05', 'Jun': '06', 'Jul': '07', 'Agt': '08',
|
||||||
|
'Sep': '09', 'Okt': '10', 'Nov': '11', 'Des': '12'
|
||||||
|
};
|
||||||
|
|
||||||
|
const parts = dateStr.split(' ');
|
||||||
|
const day = parts[0].padStart(2, '0');
|
||||||
|
const month = monthMap[parts[1]];
|
||||||
|
const year = parts[2];
|
||||||
|
|
||||||
|
return `${year}-${month}-${day}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
function closeModal() {
|
||||||
|
// Reset form
|
||||||
|
$('#formTambah')[0].reset();
|
||||||
|
$('#edit_mode').val('false');
|
||||||
|
$('#modal_title').text('Tambah Data Maggot');
|
||||||
|
|
||||||
|
// Close modal
|
||||||
|
modal_tambah.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
function submitForm(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
// Get row data
|
var isEditMode = $('#edit_mode').val() === 'true';
|
||||||
var row = table.row($(this).parents('tr')).data();
|
|
||||||
|
|
||||||
// Set edit mode
|
// TODO: Implement form submission logic
|
||||||
$('#edit_mode').val('true');
|
Swal.fire({
|
||||||
$('#modal_title').text('Edit Data Maggot');
|
title: 'Berhasil!',
|
||||||
|
text: isEditMode ? 'Data berhasil diperbarui' : 'Data berhasil ditambahkan',
|
||||||
|
icon: 'success',
|
||||||
|
confirmButtonText: 'OK',
|
||||||
|
buttonsStyling: false,
|
||||||
|
customClass: {
|
||||||
|
confirmButton: 'btn bg-green-800 text-white hover:bg-green-900 px-4 py-2 rounded-full',
|
||||||
|
},
|
||||||
|
}).then(() => {
|
||||||
|
closeModal();
|
||||||
|
|
||||||
// Convert date format from "15 Mar 2024" to "2024-03-15"
|
// Reload table
|
||||||
var tglPencatatan = convertDateToInput(row.tanggal_pencatatan);
|
table.ajax.reload();
|
||||||
|
});
|
||||||
// Populate form with row data
|
}
|
||||||
$('#tgl_pencatatan').val(tglPencatatan);
|
</script>
|
||||||
$('#nama_bank_sampah').val(row.nama_bank_sampah);
|
}
|
||||||
$('#nama_penanggung_jawab').val(row.nama_penanggung_jawab);
|
|
||||||
$('#jenis_sampah_organik').val(row.jenis_sampah_organik);
|
|
||||||
$('#jumlah_sampah_masuk').val(row.jumlah_sampah_masuk);
|
|
||||||
$('#jumlah_maggot_dihasilkan').val(row.jumlah_maggot_dihasilkan);
|
|
||||||
|
|
||||||
// Extract status from HTML badge
|
|
||||||
var statusText = $(row.status_validasi).text().trim();
|
|
||||||
$('#status_validasi').val(statusText);
|
|
||||||
|
|
||||||
$('#catatan').val(row.catatan);
|
|
||||||
|
|
||||||
// Open modal
|
|
||||||
modal_tambah.showModal();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
// Function to convert date format "15 Mar 2024" to "2024-03-15"
|
|
||||||
function convertDateToInput(dateStr) {
|
|
||||||
const monthMap = {
|
|
||||||
'Jan': '01', 'Feb': '02', 'Mar': '03', 'Apr': '04',
|
|
||||||
'Mei': '05', 'Jun': '06', 'Jul': '07', 'Agt': '08',
|
|
||||||
'Sep': '09', 'Okt': '10', 'Nov': '11', 'Des': '12'
|
|
||||||
};
|
|
||||||
|
|
||||||
const parts = dateStr.split(' ');
|
|
||||||
const day = parts[0].padStart(2, '0');
|
|
||||||
const month = monthMap[parts[1]];
|
|
||||||
const year = parts[2];
|
|
||||||
|
|
||||||
return `${year}-${month}-${day}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
function closeModal() {
|
|
||||||
// Reset form
|
|
||||||
$('#formTambah')[0].reset();
|
|
||||||
$('#edit_mode').val('false');
|
|
||||||
$('#modal_title').text('Tambah Data Maggot');
|
|
||||||
|
|
||||||
// Close modal
|
|
||||||
modal_tambah.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
function submitForm(e) {
|
|
||||||
e.preventDefault();
|
|
||||||
|
|
||||||
var isEditMode = $('#edit_mode').val() === 'true';
|
|
||||||
|
|
||||||
// TODO: Implement form submission logic
|
|
||||||
Swal.fire({
|
|
||||||
title: 'Berhasil!',
|
|
||||||
text: isEditMode ? 'Data berhasil diperbarui' : 'Data berhasil ditambahkan',
|
|
||||||
icon: 'success',
|
|
||||||
confirmButtonText: 'OK',
|
|
||||||
buttonsStyling: false,
|
|
||||||
customClass: {
|
|
||||||
confirmButton: 'btn bg-green-800 text-white hover:bg-green-900 px-4 py-2 rounded-full',
|
|
||||||
},
|
|
||||||
}).then(() => {
|
|
||||||
closeModal();
|
|
||||||
|
|
||||||
// Reload table
|
|
||||||
table.ajax.reload();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
|
||||||
|
|
@ -35,29 +35,29 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="https://code.jquery.com/jquery-3.7.1.js"></script>
|
|
||||||
<script src="https://cdn.datatables.net/2.3.4/js/dataTables.js"></script>
|
|
||||||
<script src="/plugins/datatables/dataTables.tailwindcss.js"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
var table;
|
|
||||||
|
|
||||||
$(document).ready(function () {
|
@section Scripts {
|
||||||
table = new DataTable('#example', {
|
<script type="text/javascript">
|
||||||
ajax: '/Main/ReduksiSampah/Table',
|
var table;
|
||||||
scrollX: true,
|
|
||||||
autoWidth: false,
|
$(document).ready(function () {
|
||||||
initComplete: function () {
|
table = new DataTable('#example', {
|
||||||
$('div.dt-scroll-body thead').css('visibility', 'collapse');
|
ajax: '/Main/ReduksiSampah/Table',
|
||||||
},
|
scrollX: true,
|
||||||
columns: [
|
autoWidth: false,
|
||||||
{ data: null, render: (d, t, r, m) => m.row + 1, orderable: false, searchable: false },
|
initComplete: function () {
|
||||||
{ data: 'periode_bulan' },
|
$('div.dt-scroll-body thead').css('visibility', 'collapse');
|
||||||
{ data: 'kecamatan' },
|
},
|
||||||
{ data: 'maggot' },
|
columns: [
|
||||||
{ data: 'composting' },
|
{ data: null, render: (d, t, r, m) => m.row + 1, orderable: false, searchable: false },
|
||||||
{ data: 'bank_sampah' },
|
{ data: 'periode_bulan' },
|
||||||
{ data: 'total_reduksi' },
|
{ data: 'kecamatan' },
|
||||||
]
|
{ data: 'maggot' },
|
||||||
|
{ data: 'composting' },
|
||||||
|
{ data: 'bank_sampah' },
|
||||||
|
{ data: 'total_reduksi' },
|
||||||
|
]
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
</script>
|
||||||
</script>
|
}
|
||||||
|
|
|
||||||
|
|
@ -121,160 +121,159 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="https://code.jquery.com/jquery-3.7.1.js"></script>
|
|
||||||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
|
||||||
<script src="https://cdn.datatables.net/2.3.4/js/dataTables.js"></script>
|
|
||||||
<script src="/plugins/datatables/dataTables.tailwindcss.js"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
var table;
|
|
||||||
|
|
||||||
$(document).ready(function () {
|
@section Scripts {
|
||||||
table = new DataTable('#example', {
|
<script type="text/javascript">
|
||||||
ajax: '/Main/TransaksiNasabah/Table',
|
var table;
|
||||||
scrollX: true,
|
|
||||||
autoWidth: false,
|
|
||||||
responsive: true,
|
|
||||||
initComplete: function () {
|
|
||||||
$('div.dt-scroll-body thead').css('visibility', 'collapse');
|
|
||||||
},
|
|
||||||
columns: [
|
|
||||||
{ data: null, render: (d, t, r, m) => m.row + 1, orderable: false, searchable: false },
|
|
||||||
{ data: 'tgl_transaksi' },
|
|
||||||
{ data: 'nama_bank_samoah' },
|
|
||||||
{ data: 'nilai_transaksi' },
|
|
||||||
{ data: 'total_sampah' },
|
|
||||||
{ data: 'aksi' },
|
|
||||||
]
|
|
||||||
});
|
|
||||||
|
|
||||||
// Delete button handler
|
$(document).ready(function () {
|
||||||
$('#example').on('click', '.delete-btn', function (e) {
|
table = new DataTable('#example', {
|
||||||
e.preventDefault();
|
ajax: '/Main/TransaksiNasabah/Table',
|
||||||
|
scrollX: true,
|
||||||
Swal.fire({
|
autoWidth: false,
|
||||||
title: 'Apakah anda yakin?',
|
responsive: true,
|
||||||
text: "Data yang dihapus tidak dapat dikembalikan lagi",
|
initComplete: function () {
|
||||||
icon: 'warning',
|
$('div.dt-scroll-body thead').css('visibility', 'collapse');
|
||||||
showCancelButton: true,
|
|
||||||
confirmButtonText: 'Ya, Hapus',
|
|
||||||
cancelButtonText: 'Batal',
|
|
||||||
buttonsStyling: false,
|
|
||||||
customClass: {
|
|
||||||
confirmButton: 'btn bg-red-500 text-white hover:bg-red-600 px-4 py-2 rounded-full mr-2',
|
|
||||||
cancelButton: 'btn bg-white text-gray-500 hover:bg-gray-50 px-4 py-2 rounded-full border border-gray-300',
|
|
||||||
},
|
},
|
||||||
}).then((result) => {
|
columns: [
|
||||||
if (result.isConfirmed) {
|
{ data: null, render: (d, t, r, m) => m.row + 1, orderable: false, searchable: false },
|
||||||
// TODO: Implement actual delete API call
|
{ data: 'tgl_transaksi' },
|
||||||
Swal.fire({
|
{ data: 'nama_bank_samoah' },
|
||||||
title: 'Terhapus!',
|
{ data: 'nilai_transaksi' },
|
||||||
text: 'Data berhasil dihapus.',
|
{ data: 'total_sampah' },
|
||||||
icon: 'success',
|
{ data: 'aksi' },
|
||||||
confirmButtonText: 'OK',
|
]
|
||||||
buttonsStyling: false,
|
});
|
||||||
customClass: {
|
|
||||||
confirmButton: 'btn bg-green-800 text-white hover:bg-green-900 px-4 py-2 rounded-full',
|
// Delete button handler
|
||||||
},
|
$('#example').on('click', '.delete-btn', function (e) {
|
||||||
}).then(() => {
|
e.preventDefault();
|
||||||
// Reload table
|
|
||||||
table.ajax.reload();
|
Swal.fire({
|
||||||
});
|
title: 'Apakah anda yakin?',
|
||||||
}
|
text: "Data yang dihapus tidak dapat dikembalikan lagi",
|
||||||
|
icon: 'warning',
|
||||||
|
showCancelButton: true,
|
||||||
|
confirmButtonText: 'Ya, Hapus',
|
||||||
|
cancelButtonText: 'Batal',
|
||||||
|
buttonsStyling: false,
|
||||||
|
customClass: {
|
||||||
|
confirmButton: 'btn bg-red-500 text-white hover:bg-red-600 px-4 py-2 rounded-full mr-2',
|
||||||
|
cancelButton: 'btn bg-white text-gray-500 hover:bg-gray-50 px-4 py-2 rounded-full border border-gray-300',
|
||||||
|
},
|
||||||
|
}).then((result) => {
|
||||||
|
if (result.isConfirmed) {
|
||||||
|
// TODO: Implement actual delete API call
|
||||||
|
Swal.fire({
|
||||||
|
title: 'Terhapus!',
|
||||||
|
text: 'Data berhasil dihapus.',
|
||||||
|
icon: 'success',
|
||||||
|
confirmButtonText: 'OK',
|
||||||
|
buttonsStyling: false,
|
||||||
|
customClass: {
|
||||||
|
confirmButton: 'btn bg-green-800 text-white hover:bg-green-900 px-4 py-2 rounded-full',
|
||||||
|
},
|
||||||
|
}).then(() => {
|
||||||
|
// Reload table
|
||||||
|
table.ajax.reload();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// Edit button handler
|
||||||
|
$('#example').on('click', '.edit-btn', function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
|
||||||
|
// Get row data
|
||||||
|
var row = table.row($(this).parents('tr')).data();
|
||||||
|
|
||||||
|
// Set edit mode
|
||||||
|
$('#edit_mode').val('true');
|
||||||
|
$('#modal_title').text('Edit Transaksi');
|
||||||
|
|
||||||
|
// Convert date format from "15 Nov 2023" to "2023-11-15"
|
||||||
|
var tglTransaksi = convertDateToInput(row.tgl_transaksi);
|
||||||
|
|
||||||
|
// Populate form with row data
|
||||||
|
$('#tgl_transaksi').val(tglTransaksi);
|
||||||
|
$('#nama_bank_samoah').val(row.nama_bank_samoah);
|
||||||
|
$('#nilai_transaksi').val(row.nilai_transaksi);
|
||||||
|
$('#total_sampah').val(row.total_sampah);
|
||||||
|
|
||||||
|
// Open modal
|
||||||
|
modal_tambah.showModal();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// Edit button handler
|
// Function to convert date format "15 Nov 2023" to "2023-11-15"
|
||||||
$('#example').on('click', '.edit-btn', function (e) {
|
function convertDateToInput(dateStr) {
|
||||||
|
const monthMap = {
|
||||||
|
'Jan': '01', 'Feb': '02', 'Mar': '03', 'Apr': '04',
|
||||||
|
'Mei': '05', 'Jun': '06', 'Jul': '07', 'Agt': '08',
|
||||||
|
'Sep': '09', 'Okt': '10', 'Nov': '11', 'Des': '12'
|
||||||
|
};
|
||||||
|
|
||||||
|
const parts = dateStr.split(' ');
|
||||||
|
const day = parts[0].padStart(2, '0');
|
||||||
|
const month = monthMap[parts[1]];
|
||||||
|
const year = parts[2];
|
||||||
|
|
||||||
|
return `${year}-${month}-${day}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
function closeModal() {
|
||||||
|
// Reset form
|
||||||
|
$('#formTambah')[0].reset();
|
||||||
|
$('#edit_mode').val('false');
|
||||||
|
$('#modal_title').text('Tambah Transaksi');
|
||||||
|
|
||||||
|
// Close modal
|
||||||
|
modal_tambah.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
function submitForm(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
// Get row data
|
var isEditMode = $('#edit_mode').val() === 'true';
|
||||||
var row = table.row($(this).parents('tr')).data();
|
|
||||||
|
|
||||||
// Set edit mode
|
// Get form data
|
||||||
$('#edit_mode').val('true');
|
var tglTransaksi = $('#tgl_transaksi').val();
|
||||||
$('#modal_title').text('Edit Transaksi');
|
var namaBankSamoah = $('#nama_bank_samoah').val();
|
||||||
|
var nilaiTransaksi = $('#nilai_transaksi').val();
|
||||||
|
var totalSampah = $('#total_sampah').val();
|
||||||
|
|
||||||
// Convert date format from "15 Nov 2023" to "2023-11-15"
|
// Validate
|
||||||
var tglTransaksi = convertDateToInput(row.tgl_transaksi);
|
if (!tglTransaksi || !namaBankSamoah || !nilaiTransaksi || !totalSampah) {
|
||||||
|
Swal.fire({
|
||||||
|
title: 'Error!',
|
||||||
|
text: 'Mohon lengkapi semua field yang wajib diisi',
|
||||||
|
icon: 'error',
|
||||||
|
confirmButtonText: 'OK',
|
||||||
|
buttonsStyling: false,
|
||||||
|
customClass: {
|
||||||
|
confirmButton: 'btn bg-green-800 text-white hover:bg-green-900 px-4 py-2 rounded-full',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Populate form with row data
|
// TODO: Implement form submission logic
|
||||||
$('#tgl_transaksi').val(tglTransaksi);
|
|
||||||
$('#nama_bank_samoah').val(row.nama_bank_samoah);
|
|
||||||
$('#nilai_transaksi').val(row.nilai_transaksi);
|
|
||||||
$('#total_sampah').val(row.total_sampah);
|
|
||||||
|
|
||||||
// Open modal
|
|
||||||
modal_tambah.showModal();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
// Function to convert date format "15 Nov 2023" to "2023-11-15"
|
|
||||||
function convertDateToInput(dateStr) {
|
|
||||||
const monthMap = {
|
|
||||||
'Jan': '01', 'Feb': '02', 'Mar': '03', 'Apr': '04',
|
|
||||||
'Mei': '05', 'Jun': '06', 'Jul': '07', 'Agt': '08',
|
|
||||||
'Sep': '09', 'Okt': '10', 'Nov': '11', 'Des': '12'
|
|
||||||
};
|
|
||||||
|
|
||||||
const parts = dateStr.split(' ');
|
|
||||||
const day = parts[0].padStart(2, '0');
|
|
||||||
const month = monthMap[parts[1]];
|
|
||||||
const year = parts[2];
|
|
||||||
|
|
||||||
return `${year}-${month}-${day}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
function closeModal() {
|
|
||||||
// Reset form
|
|
||||||
$('#formTambah')[0].reset();
|
|
||||||
$('#edit_mode').val('false');
|
|
||||||
$('#modal_title').text('Tambah Transaksi');
|
|
||||||
|
|
||||||
// Close modal
|
|
||||||
modal_tambah.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
function submitForm(e) {
|
|
||||||
e.preventDefault();
|
|
||||||
|
|
||||||
var isEditMode = $('#edit_mode').val() === 'true';
|
|
||||||
|
|
||||||
// Get form data
|
|
||||||
var tglTransaksi = $('#tgl_transaksi').val();
|
|
||||||
var namaBankSamoah = $('#nama_bank_samoah').val();
|
|
||||||
var nilaiTransaksi = $('#nilai_transaksi').val();
|
|
||||||
var totalSampah = $('#total_sampah').val();
|
|
||||||
|
|
||||||
// Validate
|
|
||||||
if (!tglTransaksi || !namaBankSamoah || !nilaiTransaksi || !totalSampah) {
|
|
||||||
Swal.fire({
|
Swal.fire({
|
||||||
title: 'Error!',
|
title: 'Berhasil!',
|
||||||
text: 'Mohon lengkapi semua field yang wajib diisi',
|
text: isEditMode ? 'Data berhasil diperbarui' : 'Data berhasil ditambahkan',
|
||||||
icon: 'error',
|
icon: 'success',
|
||||||
confirmButtonText: 'OK',
|
confirmButtonText: 'OK',
|
||||||
buttonsStyling: false,
|
buttonsStyling: false,
|
||||||
customClass: {
|
customClass: {
|
||||||
confirmButton: 'btn bg-green-800 text-white hover:bg-green-900 px-4 py-2 rounded-full',
|
confirmButton: 'btn bg-green-800 text-white hover:bg-green-900 px-4 py-2 rounded-full',
|
||||||
},
|
},
|
||||||
|
}).then(() => {
|
||||||
|
closeModal();
|
||||||
|
|
||||||
|
// Reload table
|
||||||
|
table.ajax.reload();
|
||||||
});
|
});
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
</script>
|
||||||
// TODO: Implement form submission logic
|
}
|
||||||
Swal.fire({
|
|
||||||
title: 'Berhasil!',
|
|
||||||
text: isEditMode ? 'Data berhasil diperbarui' : 'Data berhasil ditambahkan',
|
|
||||||
icon: 'success',
|
|
||||||
confirmButtonText: 'OK',
|
|
||||||
buttonsStyling: false,
|
|
||||||
customClass: {
|
|
||||||
confirmButton: 'btn bg-green-800 text-white hover:bg-green-900 px-4 py-2 rounded-full',
|
|
||||||
},
|
|
||||||
}).then(() => {
|
|
||||||
closeModal();
|
|
||||||
|
|
||||||
// Reload table
|
|
||||||
table.ajax.reload();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
|
||||||
|
|
@ -69,10 +69,8 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="https://code.jquery.com/jquery-3.7.1.js"></script>
|
|
||||||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
@section Scripts {
|
||||||
<script src="https://cdn.datatables.net/2.3.4/js/dataTables.js"></script>
|
|
||||||
<script src="/plugins/datatables/dataTables.tailwindcss.js"></script>
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var table;
|
var table;
|
||||||
|
|
||||||
|
|
@ -179,3 +177,4 @@
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -71,10 +71,8 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="https://code.jquery.com/jquery-3.7.1.js"></script>
|
|
||||||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
@section Scripts {
|
||||||
<script src="https://cdn.datatables.net/2.3.4/js/dataTables.js"></script>
|
|
||||||
<script src="/plugins/datatables/dataTables.tailwindcss.js"></script>
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var table;
|
var table;
|
||||||
|
|
||||||
|
|
@ -181,3 +179,4 @@
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -71,10 +71,8 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="https://code.jquery.com/jquery-3.7.1.js"></script>
|
|
||||||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
@section Scripts {
|
||||||
<script src="https://cdn.datatables.net/2.3.4/js/dataTables.js"></script>
|
|
||||||
<script src="/plugins/datatables/dataTables.tailwindcss.js"></script>
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var table;
|
var table;
|
||||||
|
|
||||||
|
|
@ -181,3 +179,4 @@
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -71,10 +71,8 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="https://code.jquery.com/jquery-3.7.1.js"></script>
|
|
||||||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
@section Scripts {
|
||||||
<script src="https://cdn.datatables.net/2.3.4/js/dataTables.js"></script>
|
|
||||||
<script src="/plugins/datatables/dataTables.tailwindcss.js"></script>
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var table;
|
var table;
|
||||||
|
|
||||||
|
|
@ -181,3 +179,4 @@
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -71,113 +71,111 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="https://code.jquery.com/jquery-3.7.1.js"></script>
|
@section Scripts {
|
||||||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
<script type="text/javascript">
|
||||||
<script src="https://cdn.datatables.net/2.3.4/js/dataTables.js"></script>
|
var table;
|
||||||
<script src="/plugins/datatables/dataTables.tailwindcss.js"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
var table;
|
|
||||||
|
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
table = new DataTable('#example', {
|
table = new DataTable('#example', {
|
||||||
ajax: '/Master/JenisBankSampah/Table',
|
ajax: '/Master/JenisBankSampah/Table',
|
||||||
scrollX: true,
|
scrollX: true,
|
||||||
autoWidth: false,
|
autoWidth: false,
|
||||||
initComplete: function () {
|
initComplete: function () {
|
||||||
$('div.dt-scroll-body thead').css('visibility', 'collapse');
|
$('div.dt-scroll-body thead').css('visibility', 'collapse');
|
||||||
},
|
|
||||||
columns: [
|
|
||||||
{ data: null, render: (d, t, r, m) => m.row + 1, orderable: false, searchable: false },
|
|
||||||
{ data: 'nama' },
|
|
||||||
{ data: 'aksi' },
|
|
||||||
]
|
|
||||||
});
|
|
||||||
|
|
||||||
// Delete button handler
|
|
||||||
$('#example').on('click', '.btn-circle.btn-error', function (e) {
|
|
||||||
e.preventDefault();
|
|
||||||
|
|
||||||
Swal.fire({
|
|
||||||
title: 'Apakah anda yakin?',
|
|
||||||
text: "Data yang dihapus tidak dapat dikembalikan lagi",
|
|
||||||
icon: 'warning',
|
|
||||||
showCancelButton: true,
|
|
||||||
confirmButtonText: 'Ya, Hapus',
|
|
||||||
cancelButtonText: 'Batal',
|
|
||||||
buttonsStyling: false,
|
|
||||||
customClass: {
|
|
||||||
confirmButton: 'btn bg-red-500 text-white hover:bg-red-600 px-4 py-2 rounded-full mr-2',
|
|
||||||
cancelButton: 'btn bg-white text-gray-500 hover:bg-gray-50 px-4 py-2 rounded-full border border-gray-300',
|
|
||||||
},
|
},
|
||||||
}).then((result) => {
|
columns: [
|
||||||
if (result.isConfirmed) {
|
{ data: null, render: (d, t, r, m) => m.row + 1, orderable: false, searchable: false },
|
||||||
// TODO: Implement actual delete API call
|
{ data: 'nama' },
|
||||||
Swal.fire({
|
{ data: 'aksi' },
|
||||||
title: 'Terhapus!',
|
]
|
||||||
text: 'Data berhasil dihapus.',
|
});
|
||||||
icon: 'success',
|
|
||||||
confirmButtonText: 'OK',
|
// Delete button handler
|
||||||
buttonsStyling: false,
|
$('#example').on('click', '.btn-circle.btn-error', function (e) {
|
||||||
customClass: {
|
e.preventDefault();
|
||||||
confirmButton: 'btn bg-green-800 text-white hover:bg-green-900 px-4 py-2 rounded-full',
|
|
||||||
},
|
Swal.fire({
|
||||||
}).then(() => {
|
title: 'Apakah anda yakin?',
|
||||||
// Reload table
|
text: "Data yang dihapus tidak dapat dikembalikan lagi",
|
||||||
table.ajax.reload();
|
icon: 'warning',
|
||||||
});
|
showCancelButton: true,
|
||||||
}
|
confirmButtonText: 'Ya, Hapus',
|
||||||
|
cancelButtonText: 'Batal',
|
||||||
|
buttonsStyling: false,
|
||||||
|
customClass: {
|
||||||
|
confirmButton: 'btn bg-red-500 text-white hover:bg-red-600 px-4 py-2 rounded-full mr-2',
|
||||||
|
cancelButton: 'btn bg-white text-gray-500 hover:bg-gray-50 px-4 py-2 rounded-full border border-gray-300',
|
||||||
|
},
|
||||||
|
}).then((result) => {
|
||||||
|
if (result.isConfirmed) {
|
||||||
|
// TODO: Implement actual delete API call
|
||||||
|
Swal.fire({
|
||||||
|
title: 'Terhapus!',
|
||||||
|
text: 'Data berhasil dihapus.',
|
||||||
|
icon: 'success',
|
||||||
|
confirmButtonText: 'OK',
|
||||||
|
buttonsStyling: false,
|
||||||
|
customClass: {
|
||||||
|
confirmButton: 'btn bg-green-800 text-white hover:bg-green-900 px-4 py-2 rounded-full',
|
||||||
|
},
|
||||||
|
}).then(() => {
|
||||||
|
// Reload table
|
||||||
|
table.ajax.reload();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// Edit button handler
|
||||||
|
$('#example').on('click', '.btn-circle.btn-warning', function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
|
||||||
|
// Get row data
|
||||||
|
var row = table.row($(this).parents('tr')).data();
|
||||||
|
|
||||||
|
// Set edit mode
|
||||||
|
$('#edit_mode').val('true');
|
||||||
|
$('#modal_title').text('Edit Jenis Bank Sampah');
|
||||||
|
|
||||||
|
// Populate form with row data
|
||||||
|
$('#nama').val(row.nama);
|
||||||
|
|
||||||
|
// Open modal
|
||||||
|
modal_tambah.showModal();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// Edit button handler
|
function closeModal() {
|
||||||
$('#example').on('click', '.btn-circle.btn-warning', function (e) {
|
// Reset form
|
||||||
|
$('#formTambah')[0].reset();
|
||||||
|
$('#edit_mode').val('false');
|
||||||
|
$('#modal_title').text('Tambah Jenis Bank Sampah');
|
||||||
|
|
||||||
|
// Close modal
|
||||||
|
modal_tambah.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
function submitForm(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
// Get row data
|
var isEditMode = $('#edit_mode').val() === 'true';
|
||||||
var row = table.row($(this).parents('tr')).data();
|
|
||||||
|
|
||||||
// Set edit mode
|
// TODO: Implement form submission logic
|
||||||
$('#edit_mode').val('true');
|
Swal.fire({
|
||||||
$('#modal_title').text('Edit Jenis Bank Sampah');
|
title: 'Berhasil!',
|
||||||
|
text: isEditMode ? 'Data berhasil diperbarui' : 'Data berhasil ditambahkan',
|
||||||
|
icon: 'success',
|
||||||
|
confirmButtonText: 'OK',
|
||||||
|
buttonsStyling: false,
|
||||||
|
customClass: {
|
||||||
|
confirmButton: 'btn bg-green-800 text-white hover:bg-green-900 px-4 py-2 rounded-full',
|
||||||
|
},
|
||||||
|
}).then(() => {
|
||||||
|
closeModal();
|
||||||
|
|
||||||
// Populate form with row data
|
// Reload table
|
||||||
$('#nama').val(row.nama);
|
table.ajax.reload();
|
||||||
|
});
|
||||||
// Open modal
|
}
|
||||||
modal_tambah.showModal();
|
</script>
|
||||||
});
|
}
|
||||||
});
|
|
||||||
|
|
||||||
function closeModal() {
|
|
||||||
// Reset form
|
|
||||||
$('#formTambah')[0].reset();
|
|
||||||
$('#edit_mode').val('false');
|
|
||||||
$('#modal_title').text('Tambah Jenis Bank Sampah');
|
|
||||||
|
|
||||||
// Close modal
|
|
||||||
modal_tambah.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
function submitForm(e) {
|
|
||||||
e.preventDefault();
|
|
||||||
|
|
||||||
var isEditMode = $('#edit_mode').val() === 'true';
|
|
||||||
|
|
||||||
// TODO: Implement form submission logic
|
|
||||||
Swal.fire({
|
|
||||||
title: 'Berhasil!',
|
|
||||||
text: isEditMode ? 'Data berhasil diperbarui' : 'Data berhasil ditambahkan',
|
|
||||||
icon: 'success',
|
|
||||||
confirmButtonText: 'OK',
|
|
||||||
buttonsStyling: false,
|
|
||||||
customClass: {
|
|
||||||
confirmButton: 'btn bg-green-800 text-white hover:bg-green-900 px-4 py-2 rounded-full',
|
|
||||||
},
|
|
||||||
}).then(() => {
|
|
||||||
closeModal();
|
|
||||||
|
|
||||||
// Reload table
|
|
||||||
table.ajax.reload();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
|
||||||
|
|
@ -71,10 +71,8 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="https://code.jquery.com/jquery-3.7.1.js"></script>
|
|
||||||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
@section Scripts {
|
||||||
<script src="https://cdn.datatables.net/2.3.4/js/dataTables.js"></script>
|
|
||||||
<script src="/plugins/datatables/dataTables.tailwindcss.js"></script>
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var table;
|
var table;
|
||||||
|
|
||||||
|
|
@ -181,3 +179,4 @@
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -71,10 +71,8 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="https://code.jquery.com/jquery-3.7.1.js"></script>
|
|
||||||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
@section Scripts {
|
||||||
<script src="https://cdn.datatables.net/2.3.4/js/dataTables.js"></script>
|
|
||||||
<script src="/plugins/datatables/dataTables.tailwindcss.js"></script>
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var table;
|
var table;
|
||||||
|
|
||||||
|
|
@ -181,3 +179,4 @@
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -71,113 +71,111 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="https://code.jquery.com/jquery-3.7.1.js"></script>
|
@section Scripts {
|
||||||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
<script type="text/javascript">
|
||||||
<script src="https://cdn.datatables.net/2.3.4/js/dataTables.js"></script>
|
var table;
|
||||||
<script src="/plugins/datatables/dataTables.tailwindcss.js"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
var table;
|
|
||||||
|
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
table = new DataTable('#example', {
|
table = new DataTable('#example', {
|
||||||
ajax: '/Master/JenisSampah/Table',
|
ajax: '/Master/JenisSampah/Table',
|
||||||
scrollX: true,
|
scrollX: true,
|
||||||
autoWidth: false,
|
autoWidth: false,
|
||||||
initComplete: function () {
|
initComplete: function () {
|
||||||
$('div.dt-scroll-body thead').css('visibility', 'collapse');
|
$('div.dt-scroll-body thead').css('visibility', 'collapse');
|
||||||
},
|
|
||||||
columns: [
|
|
||||||
{ data: null, render: (d, t, r, m) => m.row + 1, orderable: false, searchable: false },
|
|
||||||
{ data: 'nama' },
|
|
||||||
{ data: 'aksi' },
|
|
||||||
]
|
|
||||||
});
|
|
||||||
|
|
||||||
// Delete button handler
|
|
||||||
$('#example').on('click', '.btn-circle.btn-error', function (e) {
|
|
||||||
e.preventDefault();
|
|
||||||
|
|
||||||
Swal.fire({
|
|
||||||
title: 'Apakah anda yakin?',
|
|
||||||
text: "Data yang dihapus tidak dapat dikembalikan lagi",
|
|
||||||
icon: 'warning',
|
|
||||||
showCancelButton: true,
|
|
||||||
confirmButtonText: 'Ya, Hapus',
|
|
||||||
cancelButtonText: 'Batal',
|
|
||||||
buttonsStyling: false,
|
|
||||||
customClass: {
|
|
||||||
confirmButton: 'btn bg-red-500 text-white hover:bg-red-600 px-4 py-2 rounded-full mr-2',
|
|
||||||
cancelButton: 'btn bg-white text-gray-500 hover:bg-gray-50 px-4 py-2 rounded-full border border-gray-300',
|
|
||||||
},
|
},
|
||||||
}).then((result) => {
|
columns: [
|
||||||
if (result.isConfirmed) {
|
{ data: null, render: (d, t, r, m) => m.row + 1, orderable: false, searchable: false },
|
||||||
// TODO: Implement actual delete API call
|
{ data: 'nama' },
|
||||||
Swal.fire({
|
{ data: 'aksi' },
|
||||||
title: 'Terhapus!',
|
]
|
||||||
text: 'Data berhasil dihapus.',
|
});
|
||||||
icon: 'success',
|
|
||||||
confirmButtonText: 'OK',
|
// Delete button handler
|
||||||
buttonsStyling: false,
|
$('#example').on('click', '.btn-circle.btn-error', function (e) {
|
||||||
customClass: {
|
e.preventDefault();
|
||||||
confirmButton: 'btn bg-green-800 text-white hover:bg-green-900 px-4 py-2 rounded-full',
|
|
||||||
},
|
Swal.fire({
|
||||||
}).then(() => {
|
title: 'Apakah anda yakin?',
|
||||||
// Reload table
|
text: "Data yang dihapus tidak dapat dikembalikan lagi",
|
||||||
table.ajax.reload();
|
icon: 'warning',
|
||||||
});
|
showCancelButton: true,
|
||||||
}
|
confirmButtonText: 'Ya, Hapus',
|
||||||
|
cancelButtonText: 'Batal',
|
||||||
|
buttonsStyling: false,
|
||||||
|
customClass: {
|
||||||
|
confirmButton: 'btn bg-red-500 text-white hover:bg-red-600 px-4 py-2 rounded-full mr-2',
|
||||||
|
cancelButton: 'btn bg-white text-gray-500 hover:bg-gray-50 px-4 py-2 rounded-full border border-gray-300',
|
||||||
|
},
|
||||||
|
}).then((result) => {
|
||||||
|
if (result.isConfirmed) {
|
||||||
|
// TODO: Implement actual delete API call
|
||||||
|
Swal.fire({
|
||||||
|
title: 'Terhapus!',
|
||||||
|
text: 'Data berhasil dihapus.',
|
||||||
|
icon: 'success',
|
||||||
|
confirmButtonText: 'OK',
|
||||||
|
buttonsStyling: false,
|
||||||
|
customClass: {
|
||||||
|
confirmButton: 'btn bg-green-800 text-white hover:bg-green-900 px-4 py-2 rounded-full',
|
||||||
|
},
|
||||||
|
}).then(() => {
|
||||||
|
// Reload table
|
||||||
|
table.ajax.reload();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// Edit button handler
|
||||||
|
$('#example').on('click', '.btn-circle.btn-warning', function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
|
||||||
|
// Get row data
|
||||||
|
var row = table.row($(this).parents('tr')).data();
|
||||||
|
|
||||||
|
// Set edit mode
|
||||||
|
$('#edit_mode').val('true');
|
||||||
|
$('#modal_title').text('Edit Jenis Sampah');
|
||||||
|
|
||||||
|
// Populate form with row data
|
||||||
|
$('#nama').val(row.nama);
|
||||||
|
|
||||||
|
// Open modal
|
||||||
|
modal_tambah.showModal();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// Edit button handler
|
function closeModal() {
|
||||||
$('#example').on('click', '.btn-circle.btn-warning', function (e) {
|
// Reset form
|
||||||
|
$('#formTambah')[0].reset();
|
||||||
|
$('#edit_mode').val('false');
|
||||||
|
$('#modal_title').text('Tambah Jenis Sampah');
|
||||||
|
|
||||||
|
// Close modal
|
||||||
|
modal_tambah.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
function submitForm(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
// Get row data
|
var isEditMode = $('#edit_mode').val() === 'true';
|
||||||
var row = table.row($(this).parents('tr')).data();
|
|
||||||
|
|
||||||
// Set edit mode
|
// TODO: Implement form submission logic
|
||||||
$('#edit_mode').val('true');
|
Swal.fire({
|
||||||
$('#modal_title').text('Edit Jenis Sampah');
|
title: 'Berhasil!',
|
||||||
|
text: isEditMode ? 'Data berhasil diperbarui' : 'Data berhasil ditambahkan',
|
||||||
|
icon: 'success',
|
||||||
|
confirmButtonText: 'OK',
|
||||||
|
buttonsStyling: false,
|
||||||
|
customClass: {
|
||||||
|
confirmButton: 'btn bg-green-800 text-white hover:bg-green-900 px-4 py-2 rounded-full',
|
||||||
|
},
|
||||||
|
}).then(() => {
|
||||||
|
closeModal();
|
||||||
|
|
||||||
// Populate form with row data
|
// Reload table
|
||||||
$('#nama').val(row.nama);
|
table.ajax.reload();
|
||||||
|
});
|
||||||
// Open modal
|
}
|
||||||
modal_tambah.showModal();
|
</script>
|
||||||
});
|
}
|
||||||
});
|
|
||||||
|
|
||||||
function closeModal() {
|
|
||||||
// Reset form
|
|
||||||
$('#formTambah')[0].reset();
|
|
||||||
$('#edit_mode').val('false');
|
|
||||||
$('#modal_title').text('Tambah Jenis Sampah');
|
|
||||||
|
|
||||||
// Close modal
|
|
||||||
modal_tambah.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
function submitForm(e) {
|
|
||||||
e.preventDefault();
|
|
||||||
|
|
||||||
var isEditMode = $('#edit_mode').val() === 'true';
|
|
||||||
|
|
||||||
// TODO: Implement form submission logic
|
|
||||||
Swal.fire({
|
|
||||||
title: 'Berhasil!',
|
|
||||||
text: isEditMode ? 'Data berhasil diperbarui' : 'Data berhasil ditambahkan',
|
|
||||||
icon: 'success',
|
|
||||||
confirmButtonText: 'OK',
|
|
||||||
buttonsStyling: false,
|
|
||||||
customClass: {
|
|
||||||
confirmButton: 'btn bg-green-800 text-white hover:bg-green-900 px-4 py-2 rounded-full',
|
|
||||||
},
|
|
||||||
}).then(() => {
|
|
||||||
closeModal();
|
|
||||||
|
|
||||||
// Reload table
|
|
||||||
table.ajax.reload();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
|
||||||
|
|
@ -71,10 +71,8 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="https://code.jquery.com/jquery-3.7.1.js"></script>
|
|
||||||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
@section Scripts {
|
||||||
<script src="https://cdn.datatables.net/2.3.4/js/dataTables.js"></script>
|
|
||||||
<script src="/plugins/datatables/dataTables.tailwindcss.js"></script>
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var table;
|
var table;
|
||||||
|
|
||||||
|
|
@ -181,3 +179,4 @@
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -71,10 +71,8 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="https://code.jquery.com/jquery-3.7.1.js"></script>
|
|
||||||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
@section Scripts {
|
||||||
<script src="https://cdn.datatables.net/2.3.4/js/dataTables.js"></script>
|
|
||||||
<script src="/plugins/datatables/dataTables.tailwindcss.js"></script>
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var table;
|
var table;
|
||||||
|
|
||||||
|
|
@ -181,3 +179,4 @@
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -71,10 +71,8 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="https://code.jquery.com/jquery-3.7.1.js"></script>
|
|
||||||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
@section Scripts {
|
||||||
<script src="https://cdn.datatables.net/2.3.4/js/dataTables.js"></script>
|
|
||||||
<script src="/plugins/datatables/dataTables.tailwindcss.js"></script>
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var table;
|
var table;
|
||||||
|
|
||||||
|
|
@ -181,3 +179,4 @@
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -71,10 +71,8 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="https://code.jquery.com/jquery-3.7.1.js"></script>
|
|
||||||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
@section Scripts {
|
||||||
<script src="https://cdn.datatables.net/2.3.4/js/dataTables.js"></script>
|
|
||||||
<script src="/plugins/datatables/dataTables.tailwindcss.js"></script>
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var table;
|
var table;
|
||||||
|
|
||||||
|
|
@ -181,3 +179,4 @@
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -71,10 +71,8 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="https://code.jquery.com/jquery-3.7.1.js"></script>
|
|
||||||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
@section Scripts {
|
||||||
<script src="https://cdn.datatables.net/2.3.4/js/dataTables.js"></script>
|
|
||||||
<script src="/plugins/datatables/dataTables.tailwindcss.js"></script>
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var table;
|
var table;
|
||||||
|
|
||||||
|
|
@ -181,3 +179,4 @@
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -71,10 +71,8 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="https://code.jquery.com/jquery-3.7.1.js"></script>
|
|
||||||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
@section Scripts {
|
||||||
<script src="https://cdn.datatables.net/2.3.4/js/dataTables.js"></script>
|
|
||||||
<script src="/plugins/datatables/dataTables.tailwindcss.js"></script>
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var table;
|
var table;
|
||||||
|
|
||||||
|
|
@ -181,3 +179,4 @@
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,7 @@
|
||||||
|
|
||||||
<!-- CSS -->
|
<!-- CSS -->
|
||||||
<link rel="stylesheet" href="~/css/site.css" asp-append-version="true" />
|
<link rel="stylesheet" href="~/css/site.css" asp-append-version="true" />
|
||||||
|
<link rel="stylesheet" href="https://cdn.datatables.net/2.3.4/css/dataTables.tailwindcss.css" />
|
||||||
@await RenderSectionAsync("Styles", required: false)
|
@await RenderSectionAsync("Styles", required: false)
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
|
|
@ -62,6 +63,10 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Scripts -->
|
<!-- Scripts -->
|
||||||
|
<script src="https://code.jquery.com/jquery-3.7.1.js"></script>
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
||||||
|
<script src="https://cdn.datatables.net/2.3.4/js/dataTables.js"></script>
|
||||||
|
<script src="/plugins/datatables/dataTables.tailwindcss.js"></script>
|
||||||
<script src="~/js/site.js" asp-append-version="true"></script>
|
<script src="~/js/site.js" asp-append-version="true"></script>
|
||||||
@await RenderSectionAsync("Scripts", required: false)
|
@await RenderSectionAsync("Scripts", required: false)
|
||||||
</body>
|
</body>
|
||||||
|
|
|
||||||
|
|
@ -34,30 +34,28 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="https://code.jquery.com/jquery-3.7.1.js"></script>
|
@section Scripts {
|
||||||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
<script type="text/javascript">
|
||||||
<script src="https://cdn.datatables.net/2.3.4/js/dataTables.js"></script>
|
var table;
|
||||||
<script src="/plugins/datatables/dataTables.tailwindcss.js"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
var table;
|
|
||||||
|
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
table = new DataTable('#example', {
|
table = new DataTable('#example', {
|
||||||
ajax: '/Wilayah/Kecamatan/Table',
|
ajax: '/Wilayah/Kecamatan/Table',
|
||||||
scrollX: true,
|
scrollX: true,
|
||||||
autoWidth: false,
|
autoWidth: false,
|
||||||
initComplete: function () {
|
initComplete: function () {
|
||||||
$('div.dt-scroll-body thead').css('visibility', 'collapse');
|
$('div.dt-scroll-body thead').css('visibility', 'collapse');
|
||||||
},
|
},
|
||||||
columns: [
|
columns: [
|
||||||
{ data: null, render: (d, t, r, m) => m.row + 1, orderable: false, searchable: false },
|
{ data: null, render: (d, t, r, m) => m.row + 1, orderable: false, searchable: false },
|
||||||
{ data: 'kode' },
|
{ data: 'kode' },
|
||||||
{ data: 'kecamatan' },
|
{ data: 'kecamatan' },
|
||||||
{ data: 'kabupaten' },
|
{ data: 'kabupaten' },
|
||||||
{ data: 'provinsi' },
|
{ data: 'provinsi' },
|
||||||
{ data: 'latitude' },
|
{ data: 'latitude' },
|
||||||
{ data: 'longitude' },
|
{ data: 'longitude' },
|
||||||
]
|
]
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
</script>
|
||||||
</script>
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,29 +33,27 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="https://code.jquery.com/jquery-3.7.1.js"></script>
|
@section Scripts {
|
||||||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
<script type="text/javascript">
|
||||||
<script src="https://cdn.datatables.net/2.3.4/js/dataTables.js"></script>
|
var table;
|
||||||
<script src="/plugins/datatables/dataTables.tailwindcss.js"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
var table;
|
|
||||||
|
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
table = new DataTable('#example', {
|
table = new DataTable('#example', {
|
||||||
ajax: '/Wilayah/Kelurahan/Table',
|
ajax: '/Wilayah/Kelurahan/Table',
|
||||||
scrollX: true,
|
scrollX: true,
|
||||||
autoWidth: false,
|
autoWidth: false,
|
||||||
initComplete: function () {
|
initComplete: function () {
|
||||||
$('div.dt-scroll-body thead').css('visibility', 'collapse');
|
$('div.dt-scroll-body thead').css('visibility', 'collapse');
|
||||||
},
|
},
|
||||||
columns: [
|
columns: [
|
||||||
{ data: null, render: (d, t, r, m) => m.row + 1, orderable: false, searchable: false },
|
{ data: null, render: (d, t, r, m) => m.row + 1, orderable: false, searchable: false },
|
||||||
{ data: 'kode' },
|
{ data: 'kode' },
|
||||||
{ data: 'kelurahan' },
|
{ data: 'kelurahan' },
|
||||||
{ data: 'kecamatan' },
|
{ data: 'kecamatan' },
|
||||||
{ data: 'kabupaten' },
|
{ data: 'kabupaten' },
|
||||||
{ data: 'provinsi' },
|
{ data: 'provinsi' },
|
||||||
]
|
]
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
</script>
|
||||||
</script>
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,29 +33,27 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="https://code.jquery.com/jquery-3.7.1.js"></script>
|
@section Scripts {
|
||||||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
<script type="text/javascript">
|
||||||
<script src="https://cdn.datatables.net/2.3.4/js/dataTables.js"></script>
|
var table;
|
||||||
<script src="/plugins/datatables/dataTables.tailwindcss.js"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
var table;
|
|
||||||
|
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
table = new DataTable('#example', {
|
table = new DataTable('#example', {
|
||||||
ajax: '/Wilayah/Kota/Table',
|
ajax: '/Wilayah/Kota/Table',
|
||||||
scrollX: true,
|
scrollX: true,
|
||||||
autoWidth: false,
|
autoWidth: false,
|
||||||
initComplete: function () {
|
initComplete: function () {
|
||||||
$('div.dt-scroll-body thead').css('visibility', 'collapse');
|
$('div.dt-scroll-body thead').css('visibility', 'collapse');
|
||||||
},
|
},
|
||||||
columns: [
|
columns: [
|
||||||
{ data: null, render: (d, t, r, m) => m.row + 1, orderable: false, searchable: false },
|
{ data: null, render: (d, t, r, m) => m.row + 1, orderable: false, searchable: false },
|
||||||
{ data: 'kode' },
|
{ data: 'kode' },
|
||||||
{ data: 'kabupaten' },
|
{ data: 'kabupaten' },
|
||||||
{ data: 'provinsi' },
|
{ data: 'provinsi' },
|
||||||
{ data: 'latitude' },
|
{ data: 'latitude' },
|
||||||
{ data: 'longitude' },
|
{ data: 'longitude' },
|
||||||
]
|
]
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
</script>
|
||||||
</script>
|
}
|
||||||
Loading…
Reference in New Issue