diff --git a/Views/Main/DataBankSampah/Index.cshtml b/Views/Main/DataBankSampah/Index.cshtml index a481d8d..81c3b08 100644 --- a/Views/Main/DataBankSampah/Index.cshtml +++ b/Views/Main/DataBankSampah/Index.cshtml @@ -59,7 +59,7 @@
-
+
@@ -83,6 +83,7 @@ + \ No newline at end of file + + 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(); + }); + } + diff --git a/Views/Main/DataOfftaker/Index.cshtml b/Views/Main/DataOfftaker/Index.cshtml index b396ae3..1e5f044 100644 --- a/Views/Main/DataOfftaker/Index.cshtml +++ b/Views/Main/DataOfftaker/Index.cshtml @@ -1,20 +1,20 @@ -@{ +@{ ViewData["Title"] = "Data Offtaker"; }
- + Data Offtaker
-
- - @@ -36,31 +36,119 @@
+ + + + + + + + +
-
+
-
- - - - - - - - - - - - -
NoNama OfftakerKabupatenKecamatanStatusAksi
+
+ + + + + + + + + + + + + +
NoNama OfftakerKabupatenKecamatanStatusAksi
+
@@ -73,7 +161,7 @@ $(document).ready(function () { table = new DataTable('#example', { - ajax: '/Main/DataNasabah/Table', + ajax: '/Main/DataOfftaker/Table', scrollX: true, autoWidth: false, initComplete: function () { @@ -89,23 +177,97 @@ ] }); - table.on("click", ".delete", function (e) { + // Delete button handler + $('#example').on('click', '.btn-circle.btn-error', function (e) { e.preventDefault(); - let url = $(this).data("url"); - swal.fire({ - title: "Apakah anda yakin?", + Swal.fire({ + title: 'Apakah anda yakin?', text: "Data yang dihapus tidak dapat dikembalikan lagi", - icon: "question", + icon: 'warning', showCancelButton: true, - confirmButtonText: "Ya, Hapus", - cancelButtonText: "Batal", + confirmButtonText: 'Ya, Hapus', + cancelButtonText: 'Batal', buttonsStyling: false, customClass: { - confirmButton: "btn btn-error text-white", - cancelButton: "btn btn-link no-underline text-gray-500", + 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(); + }); }); - \ No newline at end of file + + 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(); + }); + } + diff --git a/Views/Main/Maggot/Index.cshtml b/Views/Main/Maggot/Index.cshtml index 80025b9..79a8ed7 100644 --- a/Views/Main/Maggot/Index.cshtml +++ b/Views/Main/Maggot/Index.cshtml @@ -20,8 +20,9 @@ + + + + + + +
@@ -57,23 +91,91 @@ ] }); - table.on("click", ".delete", function (e) { + // Delete button handler + $('#example').on('click', '.btn-circle.btn-error', function (e) { e.preventDefault(); - let url = $(this).data("url"); - swal.fire({ - title: "Apakah anda yakin?", + Swal.fire({ + title: 'Apakah anda yakin?', text: "Data yang dihapus tidak dapat dikembalikan lagi", - icon: "question", + icon: 'warning', showCancelButton: true, - confirmButtonText: "Ya, Hapus", - cancelButtonText: "Batal", + confirmButtonText: 'Ya, Hapus', + cancelButtonText: 'Batal', buttonsStyling: false, customClass: { - confirmButton: "btn btn-error text-white", - cancelButton: "btn btn-link no-underline text-gray-500", + 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 Aktivitas'); + + // Populate form with row data + $('#nama').val(row.nama); + + // Open modal + modal_tambah.showModal(); + }); }); + + function closeModal() { + // Reset form + $('#formTambah')[0].reset(); + $('#edit_mode').val('false'); + $('#modal_title').text('Tambah Aktivitas'); + + // 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(); + }); + } \ No newline at end of file diff --git a/Views/Master/Artikel/Index.cshtml b/Views/Master/Artikel/Index.cshtml index 7809c19..91d29fb 100644 --- a/Views/Master/Artikel/Index.cshtml +++ b/Views/Master/Artikel/Index.cshtml @@ -1,4 +1,4 @@ -@{ +@{ ViewData["Title"] = "Artikel"; } @@ -10,28 +10,64 @@
-
+ + + + + + +
- - - - - - - - - - -
NoJudul ArtikelAksi
+
+ + + + + + + + + + +
NoNama ArtikelAksi
+
@@ -57,23 +93,91 @@ ] }); - table.on("click", ".delete", function (e) { + // Delete button handler + $('#example').on('click', '.btn-circle.btn-error', function (e) { e.preventDefault(); - let url = $(this).data("url"); - swal.fire({ - title: "Apakah anda yakin?", + Swal.fire({ + title: 'Apakah anda yakin?', text: "Data yang dihapus tidak dapat dikembalikan lagi", - icon: "question", + icon: 'warning', showCancelButton: true, - confirmButtonText: "Ya, Hapus", - cancelButtonText: "Batal", + confirmButtonText: 'Ya, Hapus', + cancelButtonText: 'Batal', buttonsStyling: false, customClass: { - confirmButton: "btn btn-error text-white", - cancelButton: "btn btn-link no-underline text-gray-500", + 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 Artikel'); + + // Populate form with row data + $('#nama').val(row.nama); + + // Open modal + modal_tambah.showModal(); + }); }); - \ No newline at end of file + + function closeModal() { + // Reset form + $('#formTambah')[0].reset(); + $('#edit_mode').val('false'); + $('#modal_title').text('Tambah Artikel'); + + // 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(); + }); + } + diff --git a/Views/Master/BadanHukum/Index.cshtml b/Views/Master/BadanHukum/Index.cshtml index b3016a1..1297b24 100644 --- a/Views/Master/BadanHukum/Index.cshtml +++ b/Views/Master/BadanHukum/Index.cshtml @@ -1,4 +1,4 @@ -@{ +@{ ViewData["Title"] = "Badan Hukum"; } @@ -10,28 +10,64 @@
-
+ + + + + + +
- - - - - - - - - - -
NoNama Badan HukumAksi
+
+ + + + + + + + + + +
NoNama Badan HukumAksi
+
@@ -57,23 +93,91 @@ ] }); - table.on("click", ".delete", function (e) { + // Delete button handler + $('#example').on('click', '.btn-circle.btn-error', function (e) { e.preventDefault(); - let url = $(this).data("url"); - swal.fire({ - title: "Apakah anda yakin?", + Swal.fire({ + title: 'Apakah anda yakin?', text: "Data yang dihapus tidak dapat dikembalikan lagi", - icon: "question", + icon: 'warning', showCancelButton: true, - confirmButtonText: "Ya, Hapus", - cancelButtonText: "Batal", + confirmButtonText: 'Ya, Hapus', + cancelButtonText: 'Batal', buttonsStyling: false, customClass: { - confirmButton: "btn btn-error text-white", - cancelButton: "btn btn-link no-underline text-gray-500", + 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 Badan Hukum'); + + // Populate form with row data + $('#nama').val(row.nama); + + // Open modal + modal_tambah.showModal(); + }); }); - \ No newline at end of file + + function closeModal() { + // Reset form + $('#formTambah')[0].reset(); + $('#edit_mode').val('false'); + $('#modal_title').text('Tambah Badan Hukum'); + + // 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(); + }); + } + diff --git a/Views/Master/Fasilitas/Index.cshtml b/Views/Master/Fasilitas/Index.cshtml index e54e2ad..fd5d103 100644 --- a/Views/Master/Fasilitas/Index.cshtml +++ b/Views/Master/Fasilitas/Index.cshtml @@ -1,4 +1,4 @@ -@{ +@{ ViewData["Title"] = "Fasilitas"; } @@ -10,28 +10,64 @@
-
+ + + + + + +
- - - - - - - - - - -
NoNama FasilitasAksi
+
+ + + + + + + + + + +
NoNama FasilitasAksi
+
@@ -57,23 +93,91 @@ ] }); - table.on("click", ".delete", function (e) { + // Delete button handler + $('#example').on('click', '.btn-circle.btn-error', function (e) { e.preventDefault(); - let url = $(this).data("url"); - swal.fire({ - title: "Apakah anda yakin?", + Swal.fire({ + title: 'Apakah anda yakin?', text: "Data yang dihapus tidak dapat dikembalikan lagi", - icon: "question", + icon: 'warning', showCancelButton: true, - confirmButtonText: "Ya, Hapus", - cancelButtonText: "Batal", + confirmButtonText: 'Ya, Hapus', + cancelButtonText: 'Batal', buttonsStyling: false, customClass: { - confirmButton: "btn btn-error text-white", - cancelButton: "btn btn-link no-underline text-gray-500", + 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 Fasilitas'); + + // Populate form with row data + $('#nama').val(row.nama); + + // Open modal + modal_tambah.showModal(); + }); }); - \ No newline at end of file + + function closeModal() { + // Reset form + $('#formTambah')[0].reset(); + $('#edit_mode').val('false'); + $('#modal_title').text('Tambah Fasilitas'); + + // 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(); + }); + } + diff --git a/Views/Master/JenisBankSampah/Index.cshtml b/Views/Master/JenisBankSampah/Index.cshtml index b232c09..e958dbb 100644 --- a/Views/Master/JenisBankSampah/Index.cshtml +++ b/Views/Master/JenisBankSampah/Index.cshtml @@ -1,4 +1,4 @@ -@{ +@{ ViewData["Title"] = "Jenis Bank Sampah"; } @@ -10,28 +10,64 @@
-
+ + + + + + +
- - - - - - - - - - -
NoNama Jenis Bank SampahAksi
+
+ + + + + + + + + + +
NoNama Jenis Bank SampahAksi
+
@@ -57,23 +93,91 @@ ] }); - table.on("click", ".delete", function (e) { + // Delete button handler + $('#example').on('click', '.btn-circle.btn-error', function (e) { e.preventDefault(); - let url = $(this).data("url"); - swal.fire({ - title: "Apakah anda yakin?", + Swal.fire({ + title: 'Apakah anda yakin?', text: "Data yang dihapus tidak dapat dikembalikan lagi", - icon: "question", + icon: 'warning', showCancelButton: true, - confirmButtonText: "Ya, Hapus", - cancelButtonText: "Batal", + confirmButtonText: 'Ya, Hapus', + cancelButtonText: 'Batal', buttonsStyling: false, customClass: { - confirmButton: "btn btn-error text-white", - cancelButton: "btn btn-link no-underline text-gray-500", + 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(); + }); }); - \ No newline at end of file + + 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(); + }); + } + diff --git a/Views/Master/JenisNasabah/Index.cshtml b/Views/Master/JenisNasabah/Index.cshtml index bd8cf7c..531e5a9 100644 --- a/Views/Master/JenisNasabah/Index.cshtml +++ b/Views/Master/JenisNasabah/Index.cshtml @@ -1,4 +1,4 @@ -@{ +@{ ViewData["Title"] = "Jenis Nasabah"; } @@ -10,32 +10,67 @@
-
+ + + + + + +
- - - - - - - - - - -
NoNama Jenis NasabahAksi
+
+ + + + + + + + + + +
NoNama Jenis NasabahAksi
+
- @@ -58,23 +93,91 @@ ] }); - table.on("click", ".delete", function (e) { + // Delete button handler + $('#example').on('click', '.btn-circle.btn-error', function (e) { e.preventDefault(); - let url = $(this).data("url"); - swal.fire({ - title: "Apakah anda yakin?", + Swal.fire({ + title: 'Apakah anda yakin?', text: "Data yang dihapus tidak dapat dikembalikan lagi", - icon: "question", + icon: 'warning', showCancelButton: true, - confirmButtonText: "Ya, Hapus", - cancelButtonText: "Batal", + confirmButtonText: 'Ya, Hapus', + cancelButtonText: 'Batal', buttonsStyling: false, customClass: { - confirmButton: "btn btn-error text-white", - cancelButton: "btn btn-link no-underline text-gray-500", + 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 Nasabah'); + + // Populate form with row data + $('#nama').val(row.nama); + + // Open modal + modal_tambah.showModal(); + }); }); - \ No newline at end of file + + function closeModal() { + // Reset form + $('#formTambah')[0].reset(); + $('#edit_mode').val('false'); + $('#modal_title').text('Tambah Jenis 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(); + }); + } + diff --git a/Views/Master/JenisPengolahan/Index.cshtml b/Views/Master/JenisPengolahan/Index.cshtml index 31661c3..f279bbc 100644 --- a/Views/Master/JenisPengolahan/Index.cshtml +++ b/Views/Master/JenisPengolahan/Index.cshtml @@ -1,4 +1,4 @@ -@{ +@{ ViewData["Title"] = "Jenis Pengolahan"; } @@ -10,28 +10,64 @@
-
+ + + + + + +
- - - - - - - - - - -
NoNama Jenis PengolahanAksi
+
+ + + + + + + + + + +
NoNama Jenis PengolahanAksi
+
@@ -57,23 +93,91 @@ ] }); - table.on("click", ".delete", function (e) { + // Delete button handler + $('#example').on('click', '.btn-circle.btn-error', function (e) { e.preventDefault(); - let url = $(this).data("url"); - swal.fire({ - title: "Apakah anda yakin?", + Swal.fire({ + title: 'Apakah anda yakin?', text: "Data yang dihapus tidak dapat dikembalikan lagi", - icon: "question", + icon: 'warning', showCancelButton: true, - confirmButtonText: "Ya, Hapus", - cancelButtonText: "Batal", + confirmButtonText: 'Ya, Hapus', + cancelButtonText: 'Batal', buttonsStyling: false, customClass: { - confirmButton: "btn btn-error text-white", - cancelButton: "btn btn-link no-underline text-gray-500", + 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 Pengolahan'); + + // Populate form with row data + $('#nama').val(row.nama); + + // Open modal + modal_tambah.showModal(); + }); }); - \ No newline at end of file + + function closeModal() { + // Reset form + $('#formTambah')[0].reset(); + $('#edit_mode').val('false'); + $('#modal_title').text('Tambah Jenis Pengolahan'); + + // 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(); + }); + } + diff --git a/Views/Master/JenisSampah/Index.cshtml b/Views/Master/JenisSampah/Index.cshtml index f3a2987..2c7e6db 100644 --- a/Views/Master/JenisSampah/Index.cshtml +++ b/Views/Master/JenisSampah/Index.cshtml @@ -1,4 +1,4 @@ -@{ +@{ ViewData["Title"] = "Jenis Sampah"; } @@ -10,28 +10,64 @@
-
+ + + + + + +
- - - - - - - - - - -
NoNama Jenis SampahAksi
+
+ + + + + + + + + + +
NoNama Jenis SampahAksi
+
@@ -57,23 +93,91 @@ ] }); - table.on("click", ".delete", function (e) { + // Delete button handler + $('#example').on('click', '.btn-circle.btn-error', function (e) { e.preventDefault(); - let url = $(this).data("url"); - swal.fire({ - title: "Apakah anda yakin?", + Swal.fire({ + title: 'Apakah anda yakin?', text: "Data yang dihapus tidak dapat dikembalikan lagi", - icon: "question", + icon: 'warning', showCancelButton: true, - confirmButtonText: "Ya, Hapus", - cancelButtonText: "Batal", + confirmButtonText: 'Ya, Hapus', + cancelButtonText: 'Batal', buttonsStyling: false, customClass: { - confirmButton: "btn btn-error text-white", - cancelButton: "btn btn-link no-underline text-gray-500", + 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(); + }); }); - \ No newline at end of file + + 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(); + }); + } + diff --git a/Views/Master/Kategori/Index.cshtml b/Views/Master/Kategori/Index.cshtml index d5ed4ee..4fb17d1 100644 --- a/Views/Master/Kategori/Index.cshtml +++ b/Views/Master/Kategori/Index.cshtml @@ -1,4 +1,4 @@ -@{ +@{ ViewData["Title"] = "Kategori"; } @@ -10,28 +10,64 @@
-
+ + + + + + +
- - - - - - - - - - -
NoNama KategoriAksi
+
+ + + + + + + + + + +
NoNama KategoriAksi
+
@@ -57,23 +93,91 @@ ] }); - table.on("click", ".delete", function (e) { + // Delete button handler + $('#example').on('click', '.btn-circle.btn-error', function (e) { e.preventDefault(); - let url = $(this).data("url"); - swal.fire({ - title: "Apakah anda yakin?", + Swal.fire({ + title: 'Apakah anda yakin?', text: "Data yang dihapus tidak dapat dikembalikan lagi", - icon: "question", + icon: 'warning', showCancelButton: true, - confirmButtonText: "Ya, Hapus", - cancelButtonText: "Batal", + confirmButtonText: 'Ya, Hapus', + cancelButtonText: 'Batal', buttonsStyling: false, customClass: { - confirmButton: "btn btn-error text-white", - cancelButton: "btn btn-link no-underline text-gray-500", + 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 Kategori'); + + // Populate form with row data + $('#nama').val(row.nama); + + // Open modal + modal_tambah.showModal(); + }); }); - \ No newline at end of file + + function closeModal() { + // Reset form + $('#formTambah')[0].reset(); + $('#edit_mode').val('false'); + $('#modal_title').text('Tambah Kategori'); + + // 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(); + }); + } + diff --git a/Views/Master/KategoriFasilitas/Index.cshtml b/Views/Master/KategoriFasilitas/Index.cshtml index ad44eef..6c6708a 100644 --- a/Views/Master/KategoriFasilitas/Index.cshtml +++ b/Views/Master/KategoriFasilitas/Index.cshtml @@ -1,4 +1,4 @@ -@{ +@{ ViewData["Title"] = "Kategori Fasilitas"; } @@ -10,28 +10,64 @@
-
+ + + + + + +
- - - - - - - - - - -
NoNama Kategori FasilitasAksi
+
+ + + + + + + + + + +
NoNama Kategori FasilitasAksi
+
@@ -57,23 +93,91 @@ ] }); - table.on("click", ".delete", function (e) { + // Delete button handler + $('#example').on('click', '.btn-circle.btn-error', function (e) { e.preventDefault(); - let url = $(this).data("url"); - swal.fire({ - title: "Apakah anda yakin?", + Swal.fire({ + title: 'Apakah anda yakin?', text: "Data yang dihapus tidak dapat dikembalikan lagi", - icon: "question", + icon: 'warning', showCancelButton: true, - confirmButtonText: "Ya, Hapus", - cancelButtonText: "Batal", + confirmButtonText: 'Ya, Hapus', + cancelButtonText: 'Batal', buttonsStyling: false, customClass: { - confirmButton: "btn btn-error text-white", - cancelButton: "btn btn-link no-underline text-gray-500", + 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 Kategori Fasilitas'); + + // Populate form with row data + $('#nama').val(row.nama); + + // Open modal + modal_tambah.showModal(); + }); }); - \ No newline at end of file + + function closeModal() { + // Reset form + $('#formTambah')[0].reset(); + $('#edit_mode').val('false'); + $('#modal_title').text('Tambah Kategori Fasilitas'); + + // 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(); + }); + } + diff --git a/Views/Master/KategoriSampah/Index.cshtml b/Views/Master/KategoriSampah/Index.cshtml index 373bb04..c942974 100644 --- a/Views/Master/KategoriSampah/Index.cshtml +++ b/Views/Master/KategoriSampah/Index.cshtml @@ -1,4 +1,4 @@ -@{ +@{ ViewData["Title"] = "Kategori Sampah"; } @@ -10,29 +10,64 @@
-
+ + + + + + +
- - - - - - - - - - - -
NoKategori SampahJenis SampahAksi
+
+ + + + + + + + + + +
NoNama Kategori SampahAksi
+
@@ -54,28 +89,95 @@ columns: [ { data: null, render: (d, t, r, m) => m.row + 1, orderable: false, searchable: false }, { data: 'nama' }, - { data: 'jenis_sampah' }, { data: 'aksi' }, ] }); - table.on("click", ".delete", function (e) { + // Delete button handler + $('#example').on('click', '.btn-circle.btn-error', function (e) { e.preventDefault(); - let url = $(this).data("url"); - swal.fire({ - title: "Apakah anda yakin?", + Swal.fire({ + title: 'Apakah anda yakin?', text: "Data yang dihapus tidak dapat dikembalikan lagi", - icon: "question", + icon: 'warning', showCancelButton: true, - confirmButtonText: "Ya, Hapus", - cancelButtonText: "Batal", + confirmButtonText: 'Ya, Hapus', + cancelButtonText: 'Batal', buttonsStyling: false, customClass: { - confirmButton: "btn btn-error text-white", - cancelButton: "btn btn-link no-underline text-gray-500", + 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 Kategori Sampah'); + + // Populate form with row data + $('#nama').val(row.nama); + + // Open modal + modal_tambah.showModal(); + }); }); - \ No newline at end of file + + function closeModal() { + // Reset form + $('#formTambah')[0].reset(); + $('#edit_mode').val('false'); + $('#modal_title').text('Tambah Kategori 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(); + }); + } + diff --git a/Views/Master/Mitra/Index.cshtml b/Views/Master/Mitra/Index.cshtml index ce16ae0..5d09cc0 100644 --- a/Views/Master/Mitra/Index.cshtml +++ b/Views/Master/Mitra/Index.cshtml @@ -1,4 +1,4 @@ -@{ +@{ ViewData["Title"] = "Mitra"; } @@ -10,28 +10,64 @@
-
+ + + + + + +
- - - - - - - - - - -
NoNama MitraAksi
+
+ + + + + + + + + + +
NoNama MitraAksi
+
@@ -57,23 +93,91 @@ ] }); - table.on("click", ".delete", function (e) { + // Delete button handler + $('#example').on('click', '.btn-circle.btn-error', function (e) { e.preventDefault(); - let url = $(this).data("url"); - swal.fire({ - title: "Apakah anda yakin?", + Swal.fire({ + title: 'Apakah anda yakin?', text: "Data yang dihapus tidak dapat dikembalikan lagi", - icon: "question", + icon: 'warning', showCancelButton: true, - confirmButtonText: "Ya, Hapus", - cancelButtonText: "Batal", + confirmButtonText: 'Ya, Hapus', + cancelButtonText: 'Batal', buttonsStyling: false, customClass: { - confirmButton: "btn btn-error text-white", - cancelButton: "btn btn-link no-underline text-gray-500", + 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 Mitra'); + + // Populate form with row data + $('#nama').val(row.nama); + + // Open modal + modal_tambah.showModal(); + }); }); - \ No newline at end of file + + function closeModal() { + // Reset form + $('#formTambah')[0].reset(); + $('#edit_mode').val('false'); + $('#modal_title').text('Tambah Mitra'); + + // 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(); + }); + } + diff --git a/Views/Master/StatusLahan/Index.cshtml b/Views/Master/StatusLahan/Index.cshtml index bbaf8c2..de70304 100644 --- a/Views/Master/StatusLahan/Index.cshtml +++ b/Views/Master/StatusLahan/Index.cshtml @@ -1,4 +1,4 @@ -@{ +@{ ViewData["Title"] = "Status Lahan"; } @@ -10,28 +10,64 @@
-
+ + + + + + +
- - - - - - - - - - -
NoNama Status LahanAksi
+
+ + + + + + + + + + +
NoNama Status LahanAksi
+
@@ -57,23 +93,91 @@ ] }); - table.on("click", ".delete", function (e) { + // Delete button handler + $('#example').on('click', '.btn-circle.btn-error', function (e) { e.preventDefault(); - let url = $(this).data("url"); - swal.fire({ - title: "Apakah anda yakin?", + Swal.fire({ + title: 'Apakah anda yakin?', text: "Data yang dihapus tidak dapat dikembalikan lagi", - icon: "question", + icon: 'warning', showCancelButton: true, - confirmButtonText: "Ya, Hapus", - cancelButtonText: "Batal", + confirmButtonText: 'Ya, Hapus', + cancelButtonText: 'Batal', buttonsStyling: false, customClass: { - confirmButton: "btn btn-error text-white", - cancelButton: "btn btn-link no-underline text-gray-500", + 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 Status Lahan'); + + // Populate form with row data + $('#nama').val(row.nama); + + // Open modal + modal_tambah.showModal(); + }); }); - \ No newline at end of file + + function closeModal() { + // Reset form + $('#formTambah')[0].reset(); + $('#edit_mode').val('false'); + $('#modal_title').text('Tambah Status Lahan'); + + // 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(); + }); + } + diff --git a/Views/Master/SubKategoriSampah/Index.cshtml b/Views/Master/SubKategoriSampah/Index.cshtml index f8d283d..da91e66 100644 --- a/Views/Master/SubKategoriSampah/Index.cshtml +++ b/Views/Master/SubKategoriSampah/Index.cshtml @@ -1,4 +1,4 @@ -@{ +@{ ViewData["Title"] = "Sub Kategori Sampah"; } @@ -10,30 +10,64 @@
-
+ + + + + + +
- - - - - - - - - - - - -
NoSub Kategori SampahKategori SampahJenis SampahAksi
+
+ + + + + + + + + + +
NoNama Sub Kategori SampahAksi
+
@@ -55,29 +89,95 @@ columns: [ { data: null, render: (d, t, r, m) => m.row + 1, orderable: false, searchable: false }, { data: 'nama' }, - { data: 'kategori_sampah' }, - { data: 'jenis_sampah' }, { data: 'aksi' }, ] }); - table.on("click", ".delete", function (e) { + // Delete button handler + $('#example').on('click', '.btn-circle.btn-error', function (e) { e.preventDefault(); - let url = $(this).data("url"); - swal.fire({ - title: "Apakah anda yakin?", + Swal.fire({ + title: 'Apakah anda yakin?', text: "Data yang dihapus tidak dapat dikembalikan lagi", - icon: "question", + icon: 'warning', showCancelButton: true, - confirmButtonText: "Ya, Hapus", - cancelButtonText: "Batal", + confirmButtonText: 'Ya, Hapus', + cancelButtonText: 'Batal', buttonsStyling: false, customClass: { - confirmButton: "btn btn-error text-white", - cancelButton: "btn btn-link no-underline text-gray-500", + 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 Sub Kategori Sampah'); + + // Populate form with row data + $('#nama').val(row.nama); + + // Open modal + modal_tambah.showModal(); + }); }); - \ No newline at end of file + + function closeModal() { + // Reset form + $('#formTambah')[0].reset(); + $('#edit_mode').val('false'); + $('#modal_title').text('Tambah Sub Kategori 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(); + }); + } + diff --git a/Views/Wilayah/Kecamatan/Index.cshtml b/Views/Wilayah/Kecamatan/Index.cshtml index f84d586..72ba38e 100644 --- a/Views/Wilayah/Kecamatan/Index.cshtml +++ b/Views/Wilayah/Kecamatan/Index.cshtml @@ -1,4 +1,4 @@ -@{ +@{ ViewData["Title"] = "Wilayah Kecamatan"; } @@ -14,21 +14,23 @@
- - - - - - - - - - - - - - -
NoKodeNama KecamatanNama KabupatenProvinsiLatitudeLongitude
+
+ + + + + + + + + + + + + + +
NoKodeNama KecamatanNama KabupatenProvinsiLatitudeLongitude
+
@@ -54,26 +56,8 @@ { data: 'kabupaten' }, { data: 'provinsi' }, { data: 'latitude' }, - { data: 'longitude' }, ] - }); - - table.on("click", ".delete", function (e) { - e.preventDefault(); - - let url = $(this).data("url"); - swal.fire({ - title: "Apakah anda yakin?", - text: "Data yang dihapus tidak dapat dikembalikan lagi", - icon: "question", - showCancelButton: true, - confirmButtonText: "Ya, Hapus", - cancelButtonText: "Batal", - buttonsStyling: false, - customClass: { - confirmButton: "btn btn-error text-white", - cancelButton: "btn btn-link no-underline text-gray-500", - }, - }); + { data: 'longitude' }, + ] }); }); - \ No newline at end of file + diff --git a/Views/Wilayah/Kelurahan/Index.cshtml b/Views/Wilayah/Kelurahan/Index.cshtml index bcf4202..1e05109 100644 --- a/Views/Wilayah/Kelurahan/Index.cshtml +++ b/Views/Wilayah/Kelurahan/Index.cshtml @@ -1,4 +1,4 @@ -@{ +@{ ViewData["Title"] = "Wilayah Kelurahan"; } @@ -14,20 +14,22 @@
- - - - - - - - - - - - - -
NoKodeNama KelurahanNama KecamatanNama KabupatenProvinsi
+
+ + + + + + + + + + + + + +
NoKodeNama KelurahanNama KecamatanNama KabupatenProvinsi
+
@@ -55,24 +57,5 @@ { data: 'provinsi' }, ] }); - - table.on("click", ".delete", function (e) { - e.preventDefault(); - - let url = $(this).data("url"); - swal.fire({ - title: "Apakah anda yakin?", - text: "Data yang dihapus tidak dapat dikembalikan lagi", - icon: "question", - showCancelButton: true, - confirmButtonText: "Ya, Hapus", - cancelButtonText: "Batal", - buttonsStyling: false, - customClass: { - confirmButton: "btn btn-error text-white", - cancelButton: "btn btn-link no-underline text-gray-500", - }, - }); - }); }); - \ No newline at end of file + diff --git a/Views/Wilayah/Kota/Index.cshtml b/Views/Wilayah/Kota/Index.cshtml index dd34598..7ae43be 100644 --- a/Views/Wilayah/Kota/Index.cshtml +++ b/Views/Wilayah/Kota/Index.cshtml @@ -14,20 +14,22 @@
- - - - - - - - - - - - - -
NoKodeNama KabupatenProvinsiLatitudeLongitude
+
+ + + + + + + + + + + + + +
NoKodeNama KabupatenProvinsiLatitudeLongitude
+
@@ -52,26 +54,8 @@ { data: 'kabupaten' }, { data: 'provinsi' }, { data: 'latitude' }, - { data: 'longitude' }, ] - }); - - table.on("click", ".delete", function (e) { - e.preventDefault(); - - let url = $(this).data("url"); - swal.fire({ - title: "Apakah anda yakin?", - text: "Data yang dihapus tidak dapat dikembalikan lagi", - icon: "question", - showCancelButton: true, - confirmButtonText: "Ya, Hapus", - cancelButtonText: "Batal", - buttonsStyling: false, - customClass: { - confirmButton: "btn btn-error text-white", - cancelButton: "btn btn-link no-underline text-gray-500", - }, - }); + { data: 'longitude' }, + ] }); }); \ No newline at end of file