feat: menu nasabah
parent
90ddab4628
commit
6fda2709d5
|
|
@ -0,0 +1,328 @@
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
|
namespace BankSampahApp.Controllers.Main
|
||||||
|
{
|
||||||
|
[Route("Main/[controller]/[action]")]
|
||||||
|
public class NasabahController : Controller
|
||||||
|
{
|
||||||
|
public IActionResult Index()
|
||||||
|
{
|
||||||
|
return View("~/Views/Main/Nasabah/Index.cshtml");
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
public IActionResult Table()
|
||||||
|
{
|
||||||
|
var data = new[]
|
||||||
|
{
|
||||||
|
new {
|
||||||
|
id = 1,
|
||||||
|
nama = "Andi Prabowo",
|
||||||
|
tgl_pendaftaran = "15 Nov 2023",
|
||||||
|
status = "Aktif",
|
||||||
|
saldo_awal = 400000,
|
||||||
|
status_penarikan = "-",
|
||||||
|
aksi = "<div class=\"flex gap-2\">" +
|
||||||
|
"<button class=\"p-2 bg-amber-500 rounded-full w-[36px] h-[36px] edit-btn\" data-id=\"1\"><i class=\"ph ph-note-pencil text-white text-sm\"></i></button>" +
|
||||||
|
"<button class=\"p-2 bg-red-500 rounded-full w-[36px] h-[36px] delete-btn\" data-id=\"1\"><i class=\"ph ph-trash text-white text-sm\"></i></button>" +
|
||||||
|
"</div>",
|
||||||
|
},
|
||||||
|
new {
|
||||||
|
id = 2,
|
||||||
|
nama = "Siti Nurhaliza",
|
||||||
|
tgl_pendaftaran = "8 Jan 2025",
|
||||||
|
status = "Aktif",
|
||||||
|
saldo_awal = 600000,
|
||||||
|
status_penarikan = "-",
|
||||||
|
aksi = "<div class=\"flex gap-2\">" +
|
||||||
|
"<button class=\"p-2 bg-amber-500 rounded-full w-[36px] h-[36px] edit-btn\" data-id=\"2\"><i class=\"ph ph-note-pencil text-white text-sm\"></i></button>" +
|
||||||
|
"<button class=\"p-2 bg-red-500 rounded-full w-[36px] h-[36px] delete-btn\" data-id=\"2\"><i class=\"ph ph-trash text-white text-sm\"></i></button>" +
|
||||||
|
"</div>",
|
||||||
|
},
|
||||||
|
new {
|
||||||
|
id = 3,
|
||||||
|
nama = "Budi Santoso",
|
||||||
|
tgl_pendaftaran = "19 Sep 2023",
|
||||||
|
status = "Aktif",
|
||||||
|
saldo_awal = 500000,
|
||||||
|
status_penarikan = "-",
|
||||||
|
aksi = "<div class=\"flex gap-2\">" +
|
||||||
|
"<button class=\"p-2 bg-amber-500 rounded-full w-[36px] h-[36px] edit-btn\" data-id=\"3\"><i class=\"ph ph-note-pencil text-white text-sm\"></i></button>" +
|
||||||
|
"<button class=\"p-2 bg-red-500 rounded-full w-[36px] h-[36px] delete-btn\" data-id=\"3\"><i class=\"ph ph-trash text-white text-sm\"></i></button>" +
|
||||||
|
"</div>",
|
||||||
|
},
|
||||||
|
new {
|
||||||
|
id = 4,
|
||||||
|
nama = "Nina Sari",
|
||||||
|
tgl_pendaftaran = "3 Des 2024",
|
||||||
|
status = "Aktif",
|
||||||
|
saldo_awal = 100000,
|
||||||
|
status_penarikan = "-",
|
||||||
|
aksi = "<div class=\"flex gap-2\">" +
|
||||||
|
"<button class=\"p-2 bg-amber-500 rounded-full w-[36px] h-[36px] edit-btn\" data-id=\"4\"><i class=\"ph ph-note-pencil text-white text-sm\"></i></button>" +
|
||||||
|
"<button class=\"p-2 bg-red-500 rounded-full w-[36px] h-[36px] delete-btn\" data-id=\"4\"><i class=\"ph ph-trash text-white text-sm\"></i></button>" +
|
||||||
|
"</div>",
|
||||||
|
},
|
||||||
|
new {
|
||||||
|
id = 5,
|
||||||
|
nama = "Dewi Lestari",
|
||||||
|
tgl_pendaftaran = "27 Apr 2026",
|
||||||
|
status = "Tidak Aktif",
|
||||||
|
saldo_awal = 300000,
|
||||||
|
status_penarikan = "-",
|
||||||
|
aksi = "<div class=\"flex gap-2\">" +
|
||||||
|
"<button class=\"p-2 bg-amber-500 rounded-full w-[36px] h-[36px] edit-btn\" data-id=\"5\"><i class=\"ph ph-note-pencil text-white text-sm\"></i></button>" +
|
||||||
|
"<button class=\"p-2 bg-red-500 rounded-full w-[36px] h-[36px] delete-btn\" data-id=\"5\"><i class=\"ph ph-trash text-white text-sm\"></i></button>" +
|
||||||
|
"</div>",
|
||||||
|
},
|
||||||
|
new {
|
||||||
|
id = 6,
|
||||||
|
nama = "Rudi Hartono",
|
||||||
|
tgl_pendaftaran = "11 Jul 2025",
|
||||||
|
status = "Tidak Aktif",
|
||||||
|
saldo_awal = 200000,
|
||||||
|
status_penarikan = "-",
|
||||||
|
aksi = "<div class=\"flex gap-2\">" +
|
||||||
|
"<button class=\"p-2 bg-amber-500 rounded-full w-[36px] h-[36px] edit-btn\" data-id=\"6\"><i class=\"ph ph-note-pencil text-white text-sm\"></i></button>" +
|
||||||
|
"<button class=\"p-2 bg-red-500 rounded-full w-[36px] h-[36px] delete-btn\" data-id=\"6\"><i class=\"ph ph-trash text-white text-sm\"></i></button>" +
|
||||||
|
"</div>",
|
||||||
|
},
|
||||||
|
new {
|
||||||
|
id = 7,
|
||||||
|
nama = "Fitri Handayani",
|
||||||
|
tgl_pendaftaran = "22 Feb 2024",
|
||||||
|
status = "Aktif",
|
||||||
|
saldo_awal = 450000,
|
||||||
|
status_penarikan = "-",
|
||||||
|
aksi = "<div class=\"flex gap-2\">" +
|
||||||
|
"<button class=\"p-2 bg-amber-500 rounded-full w-[36px] h-[36px] edit-btn\" data-id=\"7\"><i class=\"ph ph-note-pencil text-white text-sm\"></i></button>" +
|
||||||
|
"<button class=\"p-2 bg-red-500 rounded-full w-[36px] h-[36px] delete-btn\" data-id=\"7\"><i class=\"ph ph-trash text-white text-sm\"></i></button>" +
|
||||||
|
"</div>",
|
||||||
|
},
|
||||||
|
new {
|
||||||
|
id = 8,
|
||||||
|
nama = "Ahmad Fauzi",
|
||||||
|
tgl_pendaftaran = "5 Mei 2023",
|
||||||
|
status = "Aktif",
|
||||||
|
saldo_awal = 350000,
|
||||||
|
status_penarikan = "-",
|
||||||
|
aksi = "<div class=\"flex gap-2\">" +
|
||||||
|
"<button class=\"p-2 bg-amber-500 rounded-full w-[36px] h-[36px] edit-btn\" data-id=\"8\"><i class=\"ph ph-note-pencil text-white text-sm\"></i></button>" +
|
||||||
|
"<button class=\"p-2 bg-red-500 rounded-full w-[36px] h-[36px] delete-btn\" data-id=\"8\"><i class=\"ph ph-trash text-white text-sm\"></i></button>" +
|
||||||
|
"</div>",
|
||||||
|
},
|
||||||
|
new {
|
||||||
|
id = 9,
|
||||||
|
nama = "Linda Wijaya",
|
||||||
|
tgl_pendaftaran = "14 Jun 2024",
|
||||||
|
status = "Aktif",
|
||||||
|
saldo_awal = 550000,
|
||||||
|
status_penarikan = "-",
|
||||||
|
aksi = "<div class=\"flex gap-2\">" +
|
||||||
|
"<button class=\"p-2 bg-amber-500 rounded-full w-[36px] h-[36px] edit-btn\" data-id=\"9\"><i class=\"ph ph-note-pencil text-white text-sm\"></i></button>" +
|
||||||
|
"<button class=\"p-2 bg-red-500 rounded-full w-[36px] h-[36px] delete-btn\" data-id=\"9\"><i class=\"ph ph-trash text-white text-sm\"></i></button>" +
|
||||||
|
"</div>",
|
||||||
|
},
|
||||||
|
new {
|
||||||
|
id = 10,
|
||||||
|
nama = "Bambang Suryanto",
|
||||||
|
tgl_pendaftaran = "30 Okt 2023",
|
||||||
|
status = "Tidak Aktif",
|
||||||
|
saldo_awal = 250000,
|
||||||
|
status_penarikan = "-",
|
||||||
|
aksi = "<div class=\"flex gap-2\">" +
|
||||||
|
"<button class=\"p-2 bg-amber-500 rounded-full w-[36px] h-[36px] edit-btn\" data-id=\"10\"><i class=\"ph ph-note-pencil text-white text-sm\"></i></button>" +
|
||||||
|
"<button class=\"p-2 bg-red-500 rounded-full w-[36px] h-[36px] delete-btn\" data-id=\"10\"><i class=\"ph ph-trash text-white text-sm\"></i></button>" +
|
||||||
|
"</div>",
|
||||||
|
},
|
||||||
|
new {
|
||||||
|
id = 11,
|
||||||
|
nama = "Rina Kusuma",
|
||||||
|
tgl_pendaftaran = "17 Mar 2024",
|
||||||
|
status = "Aktif",
|
||||||
|
saldo_awal = 480000,
|
||||||
|
status_penarikan = "-",
|
||||||
|
aksi = "<div class=\"flex gap-2\">" +
|
||||||
|
"<button class=\"p-2 bg-amber-500 rounded-full w-[36px] h-[36px] edit-btn\" data-id=\"11\"><i class=\"ph ph-note-pencil text-white text-sm\"></i></button>" +
|
||||||
|
"<button class=\"p-2 bg-red-500 rounded-full w-[36px] h-[36px] delete-btn\" data-id=\"11\"><i class=\"ph ph-trash text-white text-sm\"></i></button>" +
|
||||||
|
"</div>",
|
||||||
|
},
|
||||||
|
new {
|
||||||
|
id = 12,
|
||||||
|
nama = "Joko Susilo",
|
||||||
|
tgl_pendaftaran = "9 Agt 2023",
|
||||||
|
status = "Aktif",
|
||||||
|
saldo_awal = 420000,
|
||||||
|
status_penarikan = "-",
|
||||||
|
aksi = "<div class=\"flex gap-2\">" +
|
||||||
|
"<button class=\"p-2 bg-amber-500 rounded-full w-[36px] h-[36px] edit-btn\" data-id=\"12\"><i class=\"ph ph-note-pencil text-white text-sm\"></i></button>" +
|
||||||
|
"<button class=\"p-2 bg-red-500 rounded-full w-[36px] h-[36px] delete-btn\" data-id=\"12\"><i class=\"ph ph-trash text-white text-sm\"></i></button>" +
|
||||||
|
"</div>",
|
||||||
|
},
|
||||||
|
new {
|
||||||
|
id = 13,
|
||||||
|
nama = "Sri Wahyuni",
|
||||||
|
tgl_pendaftaran = "25 Des 2024",
|
||||||
|
status = "Aktif",
|
||||||
|
saldo_awal = 380000,
|
||||||
|
status_penarikan = "-",
|
||||||
|
aksi = "<div class=\"flex gap-2\">" +
|
||||||
|
"<button class=\"p-2 bg-amber-500 rounded-full w-[36px] h-[36px] edit-btn\" data-id=\"13\"><i class=\"ph ph-note-pencil text-white text-sm\"></i></button>" +
|
||||||
|
"<button class=\"p-2 bg-red-500 rounded-full w-[36px] h-[36px] delete-btn\" data-id=\"13\"><i class=\"ph ph-trash text-white text-sm\"></i></button>" +
|
||||||
|
"</div>",
|
||||||
|
},
|
||||||
|
new {
|
||||||
|
id = 14,
|
||||||
|
nama = "Agus Setiawan",
|
||||||
|
tgl_pendaftaran = "12 Apr 2024",
|
||||||
|
status = "Tidak Aktif",
|
||||||
|
saldo_awal = 320000,
|
||||||
|
status_penarikan = "-",
|
||||||
|
aksi = "<div class=\"flex gap-2\">" +
|
||||||
|
"<button class=\"p-2 bg-amber-500 rounded-full w-[36px] h-[36px] edit-btn\" data-id=\"14\"><i class=\"ph ph-note-pencil text-white text-sm\"></i></button>" +
|
||||||
|
"<button class=\"p-2 bg-red-500 rounded-full w-[36px] h-[36px] delete-btn\" data-id=\"14\"><i class=\"ph ph-trash text-white text-sm\"></i></button>" +
|
||||||
|
"</div>",
|
||||||
|
},
|
||||||
|
new {
|
||||||
|
id = 15,
|
||||||
|
nama = "Maya Putri",
|
||||||
|
tgl_pendaftaran = "6 Jul 2023",
|
||||||
|
status = "Aktif",
|
||||||
|
saldo_awal = 520000,
|
||||||
|
status_penarikan = "-",
|
||||||
|
aksi = "<div class=\"flex gap-2\">" +
|
||||||
|
"<button class=\"p-2 bg-amber-500 rounded-full w-[36px] h-[36px] edit-btn\" data-id=\"15\"><i class=\"ph ph-note-pencil text-white text-sm\"></i></button>" +
|
||||||
|
"<button class=\"p-2 bg-red-500 rounded-full w-[36px] h-[36px] delete-btn\" data-id=\"15\"><i class=\"ph ph-trash text-white text-sm\"></i></button>" +
|
||||||
|
"</div>",
|
||||||
|
},
|
||||||
|
new {
|
||||||
|
id = 16,
|
||||||
|
nama = "Hendra Gunawan",
|
||||||
|
tgl_pendaftaran = "28 Nov 2024",
|
||||||
|
status = "Aktif",
|
||||||
|
saldo_awal = 410000,
|
||||||
|
status_penarikan = "-",
|
||||||
|
aksi = "<div class=\"flex gap-2\">" +
|
||||||
|
"<button class=\"p-2 bg-amber-500 rounded-full w-[36px] h-[36px] edit-btn\" data-id=\"16\"><i class=\"ph ph-note-pencil text-white text-sm\"></i></button>" +
|
||||||
|
"<button class=\"p-2 bg-red-500 rounded-full w-[36px] h-[36px] delete-btn\" data-id=\"16\"><i class=\"ph ph-trash text-white text-sm\"></i></button>" +
|
||||||
|
"</div>",
|
||||||
|
},
|
||||||
|
new {
|
||||||
|
id = 17,
|
||||||
|
nama = "Yuni Astuti",
|
||||||
|
tgl_pendaftaran = "3 Feb 2024",
|
||||||
|
status = "Aktif",
|
||||||
|
saldo_awal = 470000,
|
||||||
|
status_penarikan = "-",
|
||||||
|
aksi = "<div class=\"flex gap-2\">" +
|
||||||
|
"<button class=\"p-2 bg-amber-500 rounded-full w-[36px] h-[36px] edit-btn\" data-id=\"17\"><i class=\"ph ph-note-pencil text-white text-sm\"></i></button>" +
|
||||||
|
"<button class=\"p-2 bg-red-500 rounded-full w-[36px] h-[36px] delete-btn\" data-id=\"17\"><i class=\"ph ph-trash text-white text-sm\"></i></button>" +
|
||||||
|
"</div>",
|
||||||
|
},
|
||||||
|
new {
|
||||||
|
id = 18,
|
||||||
|
nama = "Dedi Kurniawan",
|
||||||
|
tgl_pendaftaran = "19 Mei 2023",
|
||||||
|
status = "Tidak Aktif",
|
||||||
|
saldo_awal = 290000,
|
||||||
|
status_penarikan = "-",
|
||||||
|
aksi = "<div class=\"flex gap-2\">" +
|
||||||
|
"<button class=\"p-2 bg-amber-500 rounded-full w-[36px] h-[36px] edit-btn\" data-id=\"18\"><i class=\"ph ph-note-pencil text-white text-sm\"></i></button>" +
|
||||||
|
"<button class=\"p-2 bg-red-500 rounded-full w-[36px] h-[36px] delete-btn\" data-id=\"18\"><i class=\"ph ph-trash text-white text-sm\"></i></button>" +
|
||||||
|
"</div>",
|
||||||
|
},
|
||||||
|
new {
|
||||||
|
id = 19,
|
||||||
|
nama = "Taufik Rahman",
|
||||||
|
tgl_pendaftaran = "7 Sep 2024",
|
||||||
|
status = "Aktif",
|
||||||
|
saldo_awal = 530000,
|
||||||
|
status_penarikan = "-",
|
||||||
|
aksi = "<div class=\"flex gap-2\">" +
|
||||||
|
"<button class=\"p-2 bg-amber-500 rounded-full w-[36px] h-[36px] edit-btn\" data-id=\"19\"><i class=\"ph ph-note-pencil text-white text-sm\"></i></button>" +
|
||||||
|
"<button class=\"p-2 bg-red-500 rounded-full w-[36px] h-[36px] delete-btn\" data-id=\"19\"><i class=\"ph ph-trash text-white text-sm\"></i></button>" +
|
||||||
|
"</div>",
|
||||||
|
},
|
||||||
|
new {
|
||||||
|
id = 20,
|
||||||
|
nama = "Sari Indah",
|
||||||
|
tgl_pendaftaran = "21 Jan 2024",
|
||||||
|
status = "Aktif",
|
||||||
|
saldo_awal = 390000,
|
||||||
|
status_penarikan = "-",
|
||||||
|
aksi = "<div class=\"flex gap-2\">" +
|
||||||
|
"<button class=\"p-2 bg-amber-500 rounded-full w-[36px] h-[36px] edit-btn\" data-id=\"20\"><i class=\"ph ph-note-pencil text-white text-sm\"></i></button>" +
|
||||||
|
"<button class=\"p-2 bg-red-500 rounded-full w-[36px] h-[36px] delete-btn\" data-id=\"20\"><i class=\"ph ph-trash text-white text-sm\"></i></button>" +
|
||||||
|
"</div>",
|
||||||
|
},
|
||||||
|
new {
|
||||||
|
id = 21,
|
||||||
|
nama = "Indra Permana",
|
||||||
|
tgl_pendaftaran = "15 Okt 2023",
|
||||||
|
status = "Tidak Aktif",
|
||||||
|
saldo_awal = 270000,
|
||||||
|
status_penarikan = "-",
|
||||||
|
aksi = "<div class=\"flex gap-2\">" +
|
||||||
|
"<button class=\"p-2 bg-amber-500 rounded-full w-[36px] h-[36px] edit-btn\" data-id=\"21\"><i class=\"ph ph-note-pencil text-white text-sm\"></i></button>" +
|
||||||
|
"<button class=\"p-2 bg-red-500 rounded-full w-[36px] h-[36px] delete-btn\" data-id=\"21\"><i class=\"ph ph-trash text-white text-sm\"></i></button>" +
|
||||||
|
"</div>",
|
||||||
|
},
|
||||||
|
new {
|
||||||
|
id = 22,
|
||||||
|
nama = "Lina Marlina",
|
||||||
|
tgl_pendaftaran = "4 Jun 2024",
|
||||||
|
status = "Aktif",
|
||||||
|
saldo_awal = 490000,
|
||||||
|
status_penarikan = "-",
|
||||||
|
aksi = "<div class=\"flex gap-2\">" +
|
||||||
|
"<button class=\"p-2 bg-amber-500 rounded-full w-[36px] h-[36px] edit-btn\" data-id=\"22\"><i class=\"ph ph-note-pencil text-white text-sm\"></i></button>" +
|
||||||
|
"<button class=\"p-2 bg-red-500 rounded-full w-[36px] h-[36px] delete-btn\" data-id=\"22\"><i class=\"ph ph-trash text-white text-sm\"></i></button>" +
|
||||||
|
"</div>",
|
||||||
|
},
|
||||||
|
new {
|
||||||
|
id = 23,
|
||||||
|
nama = "Fajar Hidayat",
|
||||||
|
tgl_pendaftaran = "18 Mar 2024",
|
||||||
|
status = "Aktif",
|
||||||
|
saldo_awal = 430000,
|
||||||
|
status_penarikan = "-",
|
||||||
|
aksi = "<div class=\"flex gap-2\">" +
|
||||||
|
"<button class=\"p-2 bg-amber-500 rounded-full w-[36px] h-[36px] edit-btn\" data-id=\"23\"><i class=\"ph ph-note-pencil text-white text-sm\"></i></button>" +
|
||||||
|
"<button class=\"p-2 bg-red-500 rounded-full w-[36px] h-[36px] delete-btn\" data-id=\"23\"><i class=\"ph ph-trash text-white text-sm\"></i></button>" +
|
||||||
|
"</div>",
|
||||||
|
},
|
||||||
|
new {
|
||||||
|
id = 24,
|
||||||
|
nama = "Wati Suryani",
|
||||||
|
tgl_pendaftaran = "10 Agt 2023",
|
||||||
|
status = "Tidak Aktif",
|
||||||
|
saldo_awal = 310000,
|
||||||
|
status_penarikan = "-",
|
||||||
|
aksi = "<div class=\"flex gap-2\">" +
|
||||||
|
"<button class=\"p-2 bg-amber-500 rounded-full w-[36px] h-[36px] edit-btn\" data-id=\"24\"><i class=\"ph ph-note-pencil text-white text-sm\"></i></button>" +
|
||||||
|
"<button class=\"p-2 bg-red-500 rounded-full w-[36px] h-[36px] delete-btn\" data-id=\"24\"><i class=\"ph ph-trash text-white text-sm\"></i></button>" +
|
||||||
|
"</div>",
|
||||||
|
},
|
||||||
|
new {
|
||||||
|
id = 25,
|
||||||
|
nama = "Eko Prasetyo",
|
||||||
|
tgl_pendaftaran = "26 Des 2024",
|
||||||
|
status = "Aktif",
|
||||||
|
saldo_awal = 560000,
|
||||||
|
status_penarikan = "-",
|
||||||
|
aksi = "<div class=\"flex gap-2\">" +
|
||||||
|
"<button class=\"p-2 bg-amber-500 rounded-full w-[36px] h-[36px] edit-btn\" data-id=\"25\"><i class=\"ph ph-note-pencil text-white text-sm\"></i></button>" +
|
||||||
|
"<button class=\"p-2 bg-red-500 rounded-full w-[36px] h-[36px] delete-btn\" data-id=\"25\"><i class=\"ph ph-trash text-white text-sm\"></i></button>" +
|
||||||
|
"</div>",
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
var response = new
|
||||||
|
{
|
||||||
|
data = data
|
||||||
|
};
|
||||||
|
|
||||||
|
return Json(response);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,275 @@
|
||||||
|
@{
|
||||||
|
ViewData["Title"] = "Data Nasabah";
|
||||||
|
}
|
||||||
|
|
||||||
|
<div class="flex flex-col gap-2 md:flex-row md:justify-between md:gap-0">
|
||||||
|
<div class="prose">
|
||||||
|
<span class="text-xl font-semibold text-gray-900 font-['Plus_Jakarta_Sans']">
|
||||||
|
Data Nasabah
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<button class="btn btn-sm rounded-full bg-green-800 text-white hover:bg-green-900" onclick="modal_tambah.showModal()">
|
||||||
|
<i class="ph ph-plus"></i>
|
||||||
|
Tambah Data
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Modal Tambah/Edit Data -->
|
||||||
|
<dialog id="modal_tambah" class="modal modal-bottom sm:modal-middle">
|
||||||
|
<div class="modal-box w-full max-w-3xl p-6 bg-white rounded-2xl">
|
||||||
|
<h3 id="modal_title" class="text-gray-900 text-xl font-semibold font-['Plus_Jakarta_Sans'] leading-8 mb-8">Tambah Data Nasabah</h3>
|
||||||
|
<form id="formTambah" onsubmit="submitForm(event)">
|
||||||
|
<input type="hidden" id="edit_mode" value="false">
|
||||||
|
<input type="hidden" id="nasabah_id" value="">
|
||||||
|
<div class="flex flex-col gap-6">
|
||||||
|
<!-- Row 1 -->
|
||||||
|
<div class="grid grid-cols-1 sm:grid-cols-2 gap-6">
|
||||||
|
<div class="flex flex-col gap-1.5">
|
||||||
|
<label class="text-slate-800 text-base font-normal font-['Plus_Jakarta_Sans'] leading-6">
|
||||||
|
Nama
|
||||||
|
<span class="text-red-500 text-sm font-semibold">*</span>
|
||||||
|
</label>
|
||||||
|
<input type="text" id="nama" class="px-3.5 py-3 bg-white rounded-lg outline outline-1 outline-offset-[-1px] outline-gray-300 text-base font-['Plus_Jakarta_Sans'] placeholder:text-gray-400 focus:outline-2 focus:outline-green-800" placeholder="Nama Nasabah" required />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="flex flex-col gap-1.5">
|
||||||
|
<label class="text-slate-800 text-base font-normal font-['Plus_Jakarta_Sans'] leading-6">
|
||||||
|
Tanggal Pendaftaran
|
||||||
|
<span class="text-red-500 text-sm font-semibold">*</span>
|
||||||
|
</label>
|
||||||
|
<input type="date" id="tgl_pendaftaran" class="px-3.5 py-3 bg-white rounded-lg outline outline-1 outline-offset-[-1px] outline-gray-300 text-base font-['Plus_Jakarta_Sans'] focus:outline-2 focus:outline-green-800" required />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Row 2 -->
|
||||||
|
<div class="grid grid-cols-1 sm:grid-cols-2 gap-6">
|
||||||
|
<div class="flex flex-col gap-1.5">
|
||||||
|
<label class="text-slate-800 text-base font-normal font-['Plus_Jakarta_Sans'] leading-6">
|
||||||
|
Status
|
||||||
|
<span class="text-red-500 text-sm font-semibold">*</span>
|
||||||
|
</label>
|
||||||
|
<select id="status" class="px-3.5 py-3 bg-white rounded-lg outline outline-1 outline-offset-[-1px] outline-gray-300 text-base font-['Plus_Jakarta_Sans'] text-slate-800 focus:outline-2 focus:outline-green-800" required>
|
||||||
|
<option value="" class="text-gray-400">Pilih status</option>
|
||||||
|
<option value="Aktif" class="text-slate-800">Aktif</option>
|
||||||
|
<option value="Tidak Aktif" class="text-slate-800">Tidak Aktif</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="flex flex-col gap-1.5">
|
||||||
|
<label class="text-slate-800 text-base font-normal font-['Plus_Jakarta_Sans'] leading-6">
|
||||||
|
Saldo Awal (Rp)
|
||||||
|
<span class="text-red-500 text-sm font-semibold">*</span>
|
||||||
|
</label>
|
||||||
|
<input type="number" id="saldo_awal" class="px-3.5 py-3 bg-white rounded-lg outline outline-1 outline-offset-[-1px] outline-gray-300 text-base font-['Plus_Jakarta_Sans'] placeholder:text-gray-400 focus:outline-2 focus:outline-green-800" placeholder="Saldo Awal" required />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Row 3 -->
|
||||||
|
<div class="flex flex-col gap-1.5">
|
||||||
|
<label class="text-slate-800 text-base font-normal font-['Plus_Jakarta_Sans'] leading-6">
|
||||||
|
Status Penarikan
|
||||||
|
</label>
|
||||||
|
<input type="text" id="status_penarikan" class="px-3.5 py-3 bg-white rounded-lg outline outline-1 outline-offset-[-1px] outline-gray-300 text-base font-['Plus_Jakarta_Sans'] placeholder:text-gray-400 focus:outline-2 focus:outline-green-800" placeholder="Status Penarikan" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Buttons -->
|
||||||
|
<div class="flex gap-3 justify-end">
|
||||||
|
<button type="button" class="px-8 py-2.5 bg-white rounded-full outline outline-1 outline-offset-[-1px] outline-gray-300 text-slate-800 text-base font-semibold font-['Plus_Jakarta_Sans'] leading-6 hover:bg-gray-50" onclick="closeModal()">
|
||||||
|
Batal
|
||||||
|
</button>
|
||||||
|
<button type="submit" class="px-8 py-2.5 bg-green-800 rounded-full text-white text-base font-semibold font-['Plus_Jakarta_Sans'] leading-6 hover:bg-green-900">
|
||||||
|
Simpan
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
<form method="dialog" class="modal-backdrop">
|
||||||
|
<button>close</button>
|
||||||
|
</form>
|
||||||
|
</dialog>
|
||||||
|
<!-- /modal tambah/edit -->
|
||||||
|
|
||||||
|
<div class="h-6"></div>
|
||||||
|
|
||||||
|
<div class="card bg-white shadow-sm">
|
||||||
|
<div class="card-body p-2">
|
||||||
|
<div class="w-full overflow-x-auto">
|
||||||
|
<table class="table-zebra table w-full" id="example">
|
||||||
|
<!-- head -->
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th class="w-[5%]">No</th>
|
||||||
|
<th class="w-[20%]">Nama</th>
|
||||||
|
<th class="w-[15%]">Tgl Pendaftaran</th>
|
||||||
|
<th class="w-[12%]">Status</th>
|
||||||
|
<th class="w-[15%]">Saldo Awal (Rp)</th>
|
||||||
|
<th class="w-[15%]">Status Penarikan</th>
|
||||||
|
<th class="w-[10%]">Aksi</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</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 () {
|
||||||
|
table = new DataTable('#example', {
|
||||||
|
ajax: '/Main/Nasabah/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: 'nama' },
|
||||||
|
{ data: 'tgl_pendaftaran' },
|
||||||
|
{
|
||||||
|
data: 'status',
|
||||||
|
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();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// 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');
|
||||||
|
$('#nasabah_id').val(row.id);
|
||||||
|
$('#modal_title').text('Edit Data Nasabah');
|
||||||
|
|
||||||
|
// Convert date format from "15 Nov 2023" to "2023-11-15"
|
||||||
|
var tglPendaftaran = convertDateToInput(row.tgl_pendaftaran);
|
||||||
|
|
||||||
|
// Populate form with row data
|
||||||
|
$('#nama').val(row.nama);
|
||||||
|
$('#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>
|
||||||
|
|
@ -74,6 +74,19 @@
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
|
<!-- Data -->
|
||||||
|
<li>
|
||||||
|
<details @(new[] { "Nasabah" }.Contains(controller) ? "open" : "")>
|
||||||
|
<summary>
|
||||||
|
<i class="ph ph-database me-2 text-lg"></i>
|
||||||
|
Data
|
||||||
|
</summary>
|
||||||
|
<ul>
|
||||||
|
<li><a asp-controller="Nasabah" class="@(controller == "Nasabah" ? "menu-active" : "")">Nasabah</a></li>
|
||||||
|
</ul>
|
||||||
|
</details>
|
||||||
|
</li>
|
||||||
|
|
||||||
<!-- Data Offtaker -->
|
<!-- Data Offtaker -->
|
||||||
<li>
|
<li>
|
||||||
<a asp-controller="DataOfftaker" asp-action="Index" class="rounded-full @(controller == "DataOfftaker" ? "menu-active" : "")">
|
<a asp-controller="DataOfftaker" asp-action="Index" class="rounded-full @(controller == "DataOfftaker" ? "menu-active" : "")">
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue