slicing: new page laporan rw (satpel) on the data verifikasi menu
parent
90ad7526d8
commit
5bf9911dc1
|
|
@ -0,0 +1,47 @@
|
|||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace BpsRwApp.Controllers
|
||||
{
|
||||
[Route("[controller]/[action]")]
|
||||
public class LaporanRwSatpelController : AppControllerBase
|
||||
{
|
||||
public IActionResult Index()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public IActionResult Table()
|
||||
{
|
||||
var data = Enumerable.Range(0, 100)
|
||||
.Select(index =>
|
||||
{
|
||||
var wilayah = ControllerSampleData.WilayahSeeds[index % ControllerSampleData.WilayahSeeds.Length];
|
||||
var bulan = ControllerSampleData.BulanNames[index % ControllerSampleData.BulanNames.Length];
|
||||
var status = index % 4 == 0
|
||||
? "<div class=\"badge badge-error badge-soft rounded-full\">Belum Verifikasi</div>"
|
||||
: "<div class=\"badge badge-success badge-soft rounded-full\">Verifikasi</div>";
|
||||
|
||||
return new
|
||||
{
|
||||
kelurahan = wilayah.Kelurahan,
|
||||
rw = (index % 20) + 1,
|
||||
bulan,
|
||||
rumah_aktif_memilah = 450 + (index * 11 % 600),
|
||||
status,
|
||||
aksi = "<div class=\"flex gap-2\">" +
|
||||
"<button class=\"btn bg-white rounded-full btn-sm btn-detail\">Detail</button>" +
|
||||
"</div>",
|
||||
};
|
||||
})
|
||||
.ToArray();
|
||||
|
||||
var response = new
|
||||
{
|
||||
data = data
|
||||
};
|
||||
|
||||
return Json(response);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,247 @@
|
|||
@{
|
||||
ViewData["Title"] = "Laporan RW";
|
||||
}
|
||||
|
||||
<div class="breadcrumbs text-sm">
|
||||
<ul>
|
||||
<li class="text-gray-500"><a>Data Verifikasi</a></li>
|
||||
<li>Laporan RW (Satpel)</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<!-- Header -->
|
||||
<div class="grid grid-cols-1 gap-4 lg:grid-cols-2">
|
||||
<div class="prose">
|
||||
<h3 class="mb-2">Laporan RW (Satpel)</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">download</span>
|
||||
Unduh Laporan
|
||||
</a>
|
||||
<button class="btn rounded-full bg-white" onclick="modal_filter.showModal()">
|
||||
<span class="icon icon-fill me-2">filter_list</span>
|
||||
Filter
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="h-8"></div>
|
||||
|
||||
<!-- Filter Modal -->
|
||||
<dialog id="modal_filter" class="modal modal-bottom sm:modal-middle">
|
||||
<div class="modal-box w-full sm:max-w-sm">
|
||||
<h3 class="text-lg font-bold">Filter</h3>
|
||||
<form action="#" method="get">
|
||||
<p class="py-4">
|
||||
<fieldset class="fieldset max-w-sm">
|
||||
<legend class="fieldset-legend">Bulan Awal</legend>
|
||||
<input type="month" class="input w-full">
|
||||
</fieldset>
|
||||
<fieldset class="fieldset max-w-sm">
|
||||
<legend class="fieldset-legend">Bulan Akhir</legend>
|
||||
<input type="month" class="input w-full">
|
||||
</fieldset>
|
||||
<fieldset class="fieldset max-w-sm">
|
||||
<legend class="fieldset-legend">Kecamatan</legend>
|
||||
<select id="filter-kecamatan" class="w-full">
|
||||
<option value="">Pilih Kecamatan</option>
|
||||
<option value="Matraman">Matraman</option>
|
||||
<option value="Pulogadung">Pulogadung</option>
|
||||
<option value="Jatinegara">Jatinegara</option>
|
||||
<option value="Kramat Jati">Kramat Jati</option>
|
||||
<option value="Pasar Rebo">Pasar Rebo</option>
|
||||
</select>
|
||||
</fieldset>
|
||||
<fieldset class="fieldset max-w-sm">
|
||||
<legend class="fieldset-legend">Kelurahan</legend>
|
||||
<select id="filter-kelurahan" class="w-full">
|
||||
<option value="">Pilih Kelurahan</option>
|
||||
<option value="Sukamaju">Sukamaju</option>
|
||||
<option value="Sukadamai">Sukadamai</option>
|
||||
<option value="Mekarsari">Mekarsari</option>
|
||||
<option value="HarapanJaya">Harapan Jaya</option>
|
||||
<option value="Cibinong">Cibinong</option>
|
||||
</select>
|
||||
</fieldset>
|
||||
<fieldset class="fieldset max-w-sm">
|
||||
<legend class="fieldset-legend">RW</legend>
|
||||
<select id="filter-rw" class="w-full">
|
||||
<option value="">Pilih RW</option>
|
||||
<option value="01">01</option>
|
||||
<option value="02">02</option>
|
||||
<option value="03">03</option>
|
||||
<option value="04">04</option>
|
||||
<option value="05">05</option>
|
||||
<option value="06">06</option>
|
||||
<option value="07">07</option>
|
||||
<option value="08">08</option>
|
||||
<option value="09">09</option>
|
||||
<option value="10">10</option>
|
||||
</select>
|
||||
</fieldset>
|
||||
<fieldset class="fieldset max-w-sm">
|
||||
<legend class="fieldset-legend">Status</legend>
|
||||
<select id="filter-status" class="select w-full">
|
||||
<option disabled selected>Pilih Status</option>
|
||||
<option value="verifikasi">Verifikasi</option>
|
||||
<option value="belum">Belum Verifikasi</option>
|
||||
</select>
|
||||
</fieldset>
|
||||
</p>
|
||||
<div class="modal-action">
|
||||
<button type="button" class="btn" onclick="modal_filter.close()">Bersihkan</button>
|
||||
<button type="submit" class="btn btn-neutral">Terapkan Filter</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</dialog>
|
||||
|
||||
<!-- Detail Modal -->
|
||||
<dialog id="modal_detail" class="modal modal-bottom sm:modal-middle">
|
||||
<div class="modal-box w-full max-w-2xl">
|
||||
<form method="dialog">
|
||||
<button class="btn btn-sm btn-circle btn-ghost absolute right-2 top-2">✕</button>
|
||||
<h3 class="text-lg font-bold mb-4">Detail Laporan RW</h3>
|
||||
<div class="grid grid-cols-2 gap-4 mb-6">
|
||||
<div>
|
||||
<p class="text-sm text-gray-500">Kelurahan</p>
|
||||
<p class="font-semibold" id="detail_kelurahan">-</p>
|
||||
</div>
|
||||
<div>
|
||||
<p class="text-sm text-gray-500">RW</p>
|
||||
<p class="font-semibold" id="detail_rw">-</p>
|
||||
</div>
|
||||
<div>
|
||||
<p class="text-sm text-gray-500">Period</p>
|
||||
<p class="font-semibold" id="detail_period">-</p>
|
||||
</div>
|
||||
<div>
|
||||
<p class="text-sm text-gray-500">Rumah Aktif Memilah</p>
|
||||
<p class="font-semibold" id="detail_rumah_aktif">-</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="overflow-x-auto">
|
||||
<table class="table table-zebra w-full">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="w-[10%]">No</th>
|
||||
<th class="w-[50%]">Rumah</th>
|
||||
<th class="w-[20%]">RT</th>
|
||||
<th class="w-[20%]">Checklist</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="detail_table_body">
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="modal-action mt-6">
|
||||
<button type="button" class="btn btn-ghost rounded-full" onclick="modal_detail.close()">
|
||||
<span class="icon me-2">close</span>
|
||||
Tutup
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<form method="dialog" class="modal-backdrop">
|
||||
<button>close</button>
|
||||
</form>
|
||||
</dialog>
|
||||
|
||||
<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-[40%]">Kelurahan</th>
|
||||
<th class="w-[5%]">RW</th>
|
||||
<th class="w-[10%]">Bulan</th>
|
||||
<th class="w-[10%]">Rumah Aktif Memilah</th>
|
||||
<th class="w-[10%]">Status</th>
|
||||
<th class="w-[15%]">Aksi</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody></tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="/lib/jquery/jquery-3.7.1.js"></script>
|
||||
<script src="/lib/datatables/dataTables.js"></script>
|
||||
<script src="/plugins/datatables/dataTables.tailwindcss.js"></script>
|
||||
<link href="https://cdn.jsdelivr.net/npm/tom-select@2.2.2/dist/css/tom-select.css" rel="stylesheet">
|
||||
<script src="https://cdn.jsdelivr.net/npm/tom-select@2.2.2/dist/js/tom-select.complete.min.js"></script>
|
||||
<script type="text/javascript">
|
||||
var table;
|
||||
|
||||
$(document).ready(function () {
|
||||
new TomSelect("#filter-kecamatan", {
|
||||
closeAfterSelect: true,
|
||||
maxItems: 1,
|
||||
placeholder: "Pilih Kecamatan",
|
||||
});
|
||||
|
||||
new TomSelect("#filter-kelurahan", {
|
||||
closeAfterSelect: true,
|
||||
maxItems: 1,
|
||||
placeholder: "Pilih Kelurahan",
|
||||
});
|
||||
|
||||
new TomSelect("#filter-rw", {
|
||||
closeAfterSelect: true,
|
||||
maxItems: 1,
|
||||
placeholder: "Pilih RW",
|
||||
});
|
||||
|
||||
table = new DataTable('#example', {
|
||||
ajax: '@Url.Action("Table", "LaporanRw")',
|
||||
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: 'kelurahan' },
|
||||
{ data: 'rw' },
|
||||
{ data: 'bulan' },
|
||||
{ data: 'rumah_aktif_memilah' },
|
||||
{ data: 'status' },
|
||||
{ data: 'aksi' },
|
||||
]
|
||||
});
|
||||
|
||||
|
||||
table.on("click", ".btn-detail", function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
let rowData = table.row($(this).closest('tr')).data();
|
||||
$('#detail_kelurahan').text(rowData.kelurahan);
|
||||
$('#detail_rw').text(rowData.rw);
|
||||
$('#detail_period').text(rowData.bulan);
|
||||
$('#detail_rumah_aktif').text(rowData.rumah_aktif_memilah);
|
||||
|
||||
let detailRows = '';
|
||||
let sampleHouses = [
|
||||
{ rumah: 'Jl. Cipinang Raya No 34', rt: '03', checklist: '11' },
|
||||
{ rumah: 'Jl. Cipinang Baru No 22', rt: '01', checklist: '23' }
|
||||
];
|
||||
|
||||
sampleHouses.forEach((house, index) => {
|
||||
detailRows += `
|
||||
<tr>
|
||||
<td>${index + 1}</td>
|
||||
<td>${house.rumah}</td>
|
||||
<td>${house.rt}</td>
|
||||
<td>${house.checklist}</td>
|
||||
</tr>
|
||||
`;
|
||||
});
|
||||
|
||||
$('#detail_table_body').html(detailRows);
|
||||
|
||||
modal_detail.showModal();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
|
@ -152,6 +152,13 @@
|
|||
Laporan RW
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a asp-controller="LaporanRwSatpel" asp-action="Index"
|
||||
class="@(controller == "LaporanRwSatpel" ? "menu-active" : "")">
|
||||
<span class="icon icon-fill">house</span>
|
||||
Laporan RW (Satpel)
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a asp-controller="DataVerifikasiChecklistHarian" asp-action="Index"
|
||||
class="@(controller == "DataVerifikasiChecklistHarian" ? "menu-active" : "")">
|
||||
|
|
|
|||
Loading…
Reference in New Issue