From 8ddaf329934f063966d2f5bb38af605459d2f281 Mon Sep 17 00:00:00 2001 From: Regiaaaaaa Date: Mon, 24 Nov 2025 15:33:40 +0700 Subject: [PATCH] feat: create edit modal & change NIK To Input Nik --- Controllers/RumahRwController.cs | 2 +- Views/DataRumahRw/Index.cshtml | 87 ++++++++++++++++++++++++++++++-- 2 files changed, 83 insertions(+), 6 deletions(-) diff --git a/Controllers/RumahRwController.cs b/Controllers/RumahRwController.cs index 61cb132..f4a3011 100644 --- a/Controllers/RumahRwController.cs +++ b/Controllers/RumahRwController.cs @@ -37,7 +37,7 @@ namespace BpsRwApp.Controllers {(status == "Aktif" - ? "" + ? "" : "")} " }; diff --git a/Views/DataRumahRw/Index.cshtml b/Views/DataRumahRw/Index.cshtml index 85602a4..5871cc2 100644 --- a/Views/DataRumahRw/Index.cshtml +++ b/Views/DataRumahRw/Index.cshtml @@ -167,11 +167,14 @@ -
- +
+
+ . + +
@@ -242,6 +245,45 @@
+ + + + + @@ -294,6 +336,14 @@ modal_input_nik.showModal(); }); + $('#example tbody').on('click', '.btn-edit-rumah', function () { + let row = table.row($(this).closest('tr')).data(); + $('#edit-rt').val(row.rt); + $('#edit-nama-pemilik').val(row.nama_pemilik); + $('#edit-alamat').val(row.alamat); + modal_edit.showModal(); + }); + $('#BtnSimpanRumahRw').on('click', function (e) { e.preventDefault(); @@ -321,6 +371,33 @@ }); }); + $('#BtnUpdateRumahRw').on('click', function (e) { + e.preventDefault(); + + modal_edit.close(); + + Swal.fire({ + title: 'Simpan Perubahan?', + text: "Pastikan semua data sudah benar.", + icon: 'question', + showCancelButton: true, + confirmButtonColor: '#22c55e', + cancelButtonColor: '#6b7280', + confirmButtonText: 'Simpan', + cancelButtonText: 'Batal' + }).then((result) => { + if (result.isConfirmed) { + Swal.fire({ + title: 'Berhasil!', + text: 'Data Rumah berhasil diperbarui.', + icon: 'success', + confirmButtonText: 'OK', + confirmButtonColor: '#22c55e' + }); + } + }); + }); + $('#BtnSimpanNik').on('click', function (e) { e.preventDefault();