bps-rw/Views/DataRw/Index.cshtml

180 lines
7.0 KiB
Plaintext

@{
ViewData["Title"] = "Data RW";
}
<div class="breadcrumbs text-sm">
<ul>
<li class="text-gray-500"><a>Master Data</a></li>
<li><a>Data RW</a></li>
</ul>
</div>
<!-- Header -->
<div class="grid grid-cols-1 gap-4 lg:grid-cols-2">
<div class="prose">
<h3 class="mb-2">Data RW</h3>
</div>
<div class="justify-self-end lg:self-center">
<a class="btn rounded-full bg-white" href="#">
<span class="icon icon-fill me-2">filter_list</span>
Filter
</a>
</div>
</div>
<div class="h-8"></div>
<div class="card bg-white shadow-sm">
<div class="card-body p-0">
<table class="table-zebra table" id="example">
<thead>
<tr>
<th class="w-[5%]">No</th>
<th class="w-[5%]">RW</th>
<th class="w-[40%]">Kecamatan</th>
<th class="w-[15%]">Jumlah Rumah Memilah</th>
<th class="w-[15%]">Jumlah Rumah Nasabah</th>
<th class="w-[15%]">Jumlah Bank Sampah</th>
<th class="w-[5%]">Aksi</th>
</tr>
</thead>
<tbody></tbody>
</table>
</div>
</div>
<dialog id="rw-detail-modal" class="modal modal-bottom sm:modal-middle">
<div class="modal-box">
<h3 class="text-lg font-semibold mb-4">Detail RW</h3>
<div class="grid grid-cols-1 md:grid-cols-2 md:gap-4">
<div class="flex flex-col">
<span class="text-gray-500">Nama Ketua RW</span>
<span class="font-semibold">Ahmad Kurniawan</span>
</div>
<div class="flex flex-col">
<span class="text-gray-500">No. HP Ketua RW</span>
<span class="font-semibold">2260</span>
</div>
<div class="flex flex-col">
<span class="text-gray-500">Jumlah KK</span>
<span class="font-semibold">341</span>
</div>
<div class="flex flex-col">
<span class="text-gray-500">Jumlah Rumah Memilah</span>
<span class="font-semibold" id="detail-jumlah-rumah-memilah">-</span>
</div>
<div class="flex flex-col">
<span class="text-gray-500">Jumlah RT</span>
<span class="font-semibold">9</span>
</div>
<div class="flex flex-col">
<span class="text-gray-500">Luas RW (m<sup>2</sup>)</span>
<span class="font-semibold">10</span>
</div>
<div class="flex flex-col">
<span class="text-gray-500">Jumlah Jiwa</span>
<span class="font-semibold">2260</span>
</div>
<div class="flex flex-col">
<span class="text-gray-500">Jumlah Timbulan Sampah Per Hari (Kg)</span>
<span class="font-semibold">2260</span>
</div>
<div class="flex flex-col">
<span class="text-gray-500">Kota / Kabupaten</span>
<span class="font-semibold">Kota Adm. Jakarta Barat</span>
</div>
<div class="flex flex-col">
<span class="text-gray-500">Kecamatan</span>
<span class="font-semibold" id="detail-kecamatan">-</span>
</div>
<div class="flex flex-col">
<span class="text-gray-500">Kelurahan</span>
<span class="font-semibold">Grogol</span>
</div>
<div class="flex flex-col">
<span class="text-gray-500">RW</span>
<span class="font-semibold" id="detail-rw">-</span>
</div>
<div class="flex flex-col">
<span class="text-gray-500">No. SK RW</span>
<span class="font-semibold">SK-/1838/83293</span>
</div>
<div class="flex flex-col">
<span class="text-gray-500">Jumlah Rumah Nasabah</span>
<span class="font-semibold" id="detail-jumlah-rumah-nasabah">-</span>
</div>
<div class="flex flex-col">
<span class="text-gray-500">Jumlah Bank Sampah</span>
<span class="font-semibold" id="detail-jumlah-bank-sampah">-</span>
</div>
</div>
<div class="modal-action">
<form method="dialog">
<button class="btn rounded-full">
<span class="icon me-1">cancel</span>
Tutup
</button>
</form>
<button type="button" class="btn rounded-full btn-primary">
<span class="icon">print</span>
Cetak
</button>
</div>
</div>
<form method="dialog" class="modal-backdrop">
<button>Tutup</button>
</form>
</dialog>
<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 () {
const detailModal = document.getElementById('rw-detail-modal');
const detailElements = {
rw: document.getElementById('detail-rw'),
kecamatan: document.getElementById('detail-kecamatan'),
rumahMemilah: document.getElementById('detail-jumlah-rumah-memilah'),
rumahNasabah: document.getElementById('detail-jumlah-rumah-nasabah'),
bankSampah: document.getElementById('detail-jumlah-bank-sampah')
};
table = new DataTable('#example', {
ajax: '@Url.Action("Table", "DataRw")',
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: 'rw' },
{ data: 'kecamatan' },
{ data: 'jumlah_rumah_memilah' },
{ data: 'jumlah_rumah_nasabah' },
{ data: 'jumlah_bank_sampah' },
{ data: 'aksi' },
]
});
$('#example tbody').on('click', '.btn-view-detail', function (event) {
event.preventDefault();
if (!detailModal || typeof detailModal.showModal !== 'function') {
return;
}
const dataset = this.dataset;
detailElements.rw.textContent = dataset.rw || '-';
detailElements.kecamatan.textContent = dataset.kecamatan || '-';
detailElements.rumahMemilah.textContent = dataset.jumlahRumahMemilah || '-';
detailElements.rumahNasabah.textContent = dataset.jumlahRumahNasabah || '-';
detailElements.bankSampah.textContent = dataset.jumlahBankSampah || '-';
detailModal.showModal();
});
});
</script>