154 lines
6.0 KiB
Plaintext
154 lines
6.0 KiB
Plaintext
@{
|
|
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 class="flex flex-col gap-2 sm:flex-row">
|
|
<button class="btn btn-sm w-full sm:w-auto rounded-full bg-white border border-gray-300 hover:bg-gray-50" onclick="modal_download.showModal()">
|
|
<i class="ph ph-download"></i>
|
|
Download
|
|
</button>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Modal Download -->
|
|
<dialog id="modal_download" class="modal modal-bottom sm:modal-middle">
|
|
<div class="modal-box w-full sm:max-w-sm">
|
|
<form method="dialog">
|
|
<button class="btn btn-sm btn-circle btn-ghost absolute top-2 right-2">✕</button>
|
|
</form>
|
|
<h3 class="text-lg font-bold">Download Data</h3>
|
|
<form action="#" method="get">
|
|
<fieldset class="fieldset">
|
|
<legend class="fieldset-legend">Jumlah Nasabah</legend>
|
|
<select class="select w-full">
|
|
<option disabled selected>Semua</option>
|
|
</select>
|
|
</fieldset>
|
|
<div class="modal-action">
|
|
<button type="submit" class="btn bg-green-800 w-full rounded-full text-white hover:bg-green-900">Download</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</dialog>
|
|
<!-- /modal download -->
|
|
|
|
<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-[15%]">Nama Nasabah</th>
|
|
<th class="w-[13%]">Alamat</th>
|
|
<th class="w-[12%]">Bank Sampah</th>
|
|
<th class="w-[12%]">ID Bangunan</th>
|
|
<th class="w-[10%]">Jenis Nasabah</th>
|
|
<th class="w-[10%]">Status</th>
|
|
<th class="w-[9%]">Aksi</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
@section Scripts {
|
|
<script type="text/javascript">
|
|
var table;
|
|
|
|
$(document).ready(function () {
|
|
table = new DataTable('#example', {
|
|
ajax: '/Main/DataNasabah/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: null,
|
|
render: function (data) {
|
|
return `
|
|
<div class="flex flex-col gap-1">
|
|
<span class="text-sm font-semibold text-gray-900">${data.kabupaten}</span>
|
|
<div class="flex items-center gap-0 text-xs text-gray-500">
|
|
<span class="flex items-center gap-0">
|
|
${data.kecamatan}
|
|
</span>
|
|
<span class="text-gray-300">•</span>
|
|
<span>${data.kelurahan}</span>
|
|
</div>
|
|
</div>
|
|
`;
|
|
}
|
|
},
|
|
{ data: 'bank_sampah' },
|
|
{ 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) => {
|
|
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();
|
|
|
|
// Redirect to ProfilNasabah Edit page
|
|
window.location.href = '/Main/ProfilNasabah/Edit';
|
|
});
|
|
});
|
|
</script>
|
|
}
|