feat: add kelurahan & rw filter, and create a checklist harian page
parent
92f6f5890f
commit
c416754ce6
|
|
@ -11,7 +11,7 @@ namespace BpsRwApp.Controllers
|
|||
}
|
||||
|
||||
[HttpGet]
|
||||
public IActionResult Table()
|
||||
public IActionResult Table(string status = "all")
|
||||
{
|
||||
var data = new[]
|
||||
{
|
||||
|
|
@ -127,12 +127,13 @@ namespace BpsRwApp.Controllers
|
|||
}
|
||||
};
|
||||
|
||||
var response = new
|
||||
{
|
||||
data = data
|
||||
};
|
||||
if (status == "sudah")
|
||||
data = data.Where(x => x.status.Contains("badge-success")).ToArray();
|
||||
|
||||
return Json(response);
|
||||
if (status == "belum")
|
||||
data = data.Where(x => x.status.Contains("badge-error")).ToArray();
|
||||
|
||||
return Json(new { data });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@
|
|||
ViewData["Title"] = "Checklist Harian";
|
||||
}
|
||||
|
||||
<link href="https://cdn.jsdelivr.net/npm/tom-select@2.2.2/dist/css/tom-select.css" rel="stylesheet">
|
||||
|
||||
<div class="breadcrumbs text-sm">
|
||||
<ul>
|
||||
<li class="text-gray-500"><a>Checklist Harian</a></li>
|
||||
|
|
@ -26,20 +28,19 @@
|
|||
<!-- Tabs -->
|
||||
<div class="tabs tabs-lift">
|
||||
|
||||
<!-- TAB 1 -->
|
||||
<input type="radio" name="tab_checklist_harian" checked class="tab checked:text-white [--tab-bg:green]" aria-label="Semua" />
|
||||
<div class="tab-content bg-base-100 border-base-300 p-0">
|
||||
@await Html.PartialAsync("_TabIndexSemua")
|
||||
</div>
|
||||
|
||||
<!-- TAB 2 -->
|
||||
<input type="radio" name="tab_checklist_harian" class="tab checked:text-white [--tab-bg:green]" aria-label="Sudah Diverifikasi" />
|
||||
<div class="tab-content bg-base-100 border-base-300 p-0">
|
||||
@await Html.PartialAsync("_TabIndexSudahVerifikasi")
|
||||
</div>
|
||||
|
||||
<!-- TAB 3 -->
|
||||
<input type="radio" name="tab_checklist_harian" class="tab checked:text-white [--tab-bg:green]" aria-label="Belum Terverifikasi" />
|
||||
<div class="tab-content bg-base-100 border-base-300 p-0">
|
||||
@await Html.PartialAsync("_TabIndexBelumVerifikasi")
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
@ -70,6 +71,33 @@
|
|||
<input type="month" class="input w-full" placeholder="Pilih bulan">
|
||||
</fieldset>
|
||||
</div>
|
||||
<fieldset class="fieldset mt-4">
|
||||
<legend class="fieldset-legend">Kelurahan</legend>
|
||||
<select id="kelurahanSelect" class="w-full">
|
||||
<option value="">Pilih Kelurahan</option>
|
||||
<option value="Sukamaju">Kelurahan Sukamaju</option>
|
||||
<option value="Sukadamai">Kelurahan Sukadamai</option>
|
||||
<option value="Mekarsari">Kelurahan Mekarsari</option>
|
||||
<option value="HarapanJaya">Kelurahan Harapan Jaya</option>
|
||||
<option value="Cibinong">Kelurahan Cibinong</option>
|
||||
</select>
|
||||
</fieldset>
|
||||
<fieldset class="fieldset mt-4">
|
||||
<legend class="fieldset-legend">RW</legend>
|
||||
<select id="rwSelect" class="w-full">
|
||||
<option value="">Pilih RW</option>
|
||||
<option value="01">RW 01</option>
|
||||
<option value="02">RW 02</option>
|
||||
<option value="03">RW 03</option>
|
||||
<option value="04">RW 04</option>
|
||||
<option value="05">RW 05</option>
|
||||
<option value="06">RW 06</option>
|
||||
<option value="07">RW 07</option>
|
||||
<option value="08">RW 08</option>
|
||||
<option value="09">RW 09</option>
|
||||
<option value="10">RW 10</option>
|
||||
</select>
|
||||
</fieldset>
|
||||
<div class="modal-action">
|
||||
<button type="button" class="btn rounded-full" onclick="modal_filter_checklist.close()">Bersihkan</button>
|
||||
<button type="submit" class="btn btn-primary rounded-full text-white">Terapkan Filter</button>
|
||||
|
|
@ -82,29 +110,98 @@
|
|||
<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 src="https://cdn.jsdelivr.net/npm/tom-select@2.2.2/dist/js/tom-select.complete.min.js"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function () {
|
||||
|
||||
var tableChecklist = new DataTable('#tableChecklist', {
|
||||
ajax: '@Url.Action("Table", "ChecklistHarian")',
|
||||
new TomSelect("#kelurahanSelect", {
|
||||
closeAfterSelect: true,
|
||||
maxItems: 1,
|
||||
placeholder: "Pilih Kelurahan",
|
||||
});
|
||||
|
||||
new TomSelect("#rwSelect", {
|
||||
closeAfterSelect: true,
|
||||
maxItems: 1,
|
||||
placeholder: "Pilih RW",
|
||||
});
|
||||
|
||||
let tableSemua = null;
|
||||
let tableSudah = null;
|
||||
let tableBelum = null;
|
||||
|
||||
function initTableSemua() {
|
||||
if (tableSemua != null) return;
|
||||
|
||||
tableSemua = new DataTable('#tableChecklistSemua', {
|
||||
ajax: '@Url.Action("Table", "ChecklistHarian")?status=semua',
|
||||
scrollX: true,
|
||||
autoWidth: false,
|
||||
initComplete: function () {
|
||||
$('div.dt-scroll-body thead').css('visibility', 'collapse');
|
||||
},
|
||||
initComplete: () => $('div.dt-scroll-body thead').css('visibility', 'collapse'),
|
||||
columns: [
|
||||
{ data: null, render: (d, t, r, m) => m.row + 1, orderable: false, searchable: false },
|
||||
{ data: null, render: (d,t,r,m)=> m.row+1 },
|
||||
{ data: 'tanggal' },
|
||||
{ data: 'mudah_terurai' },
|
||||
{ data: 'material_daur_ulang' },
|
||||
{ data: 'b3' },
|
||||
{ data: 'residu' },
|
||||
{ data: 'status' },
|
||||
{ data: 'aksi', orderable: false, searchable: false }
|
||||
{ data: 'aksi' }
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
function initTableSudahVerifikasi() {
|
||||
if (tableSudah != null) return;
|
||||
|
||||
tableSudah = new DataTable('#tableChecklistSudahVerifikasi', {
|
||||
ajax: '@Url.Action("Table", "ChecklistHarian")?status=sudah',
|
||||
scrollX: true,
|
||||
autoWidth: false,
|
||||
initComplete: () => $('div.dt-scroll-body thead').css('visibility', 'collapse'),
|
||||
columns: [
|
||||
{ data: null, render: (d,t,r,m)=> m.row+1 },
|
||||
{ data: 'tanggal' },
|
||||
{ data: 'mudah_terurai' },
|
||||
{ data: 'material_daur_ulang' },
|
||||
{ data: 'b3' },
|
||||
{ data: 'residu' },
|
||||
{ data: 'status' },
|
||||
{ data: 'aksi' }
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
function initTableBelumVerifikasi() {
|
||||
if (tableBelum != null) return;
|
||||
|
||||
tableBelum = new DataTable('#tableChecklistBelumVerifikasi', {
|
||||
ajax: '@Url.Action("Table", "ChecklistHarian")?status=belum',
|
||||
scrollX: true,
|
||||
autoWidth: false,
|
||||
initComplete: () => $('div.dt-scroll-body thead').css('visibility', 'collapse'),
|
||||
columns: [
|
||||
{ data: null, render: (d,t,r,m)=> m.row+1 },
|
||||
{ data: 'tanggal' },
|
||||
{ data: 'mudah_terurai' },
|
||||
{ data: 'material_daur_ulang' },
|
||||
{ data: 'b3' },
|
||||
{ data: 'residu' },
|
||||
{ data: 'status' },
|
||||
{ data: 'aksi' }
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
document.querySelectorAll('input[name="tab_checklist_harian"]').forEach((tab, index) => {
|
||||
tab.addEventListener('change', () => {
|
||||
if (index === 0) initTableSemua();
|
||||
if (index === 1) initTableSudahVerifikasi();
|
||||
if (index === 2) initTableBelumVerifikasi();
|
||||
});
|
||||
});
|
||||
|
||||
initTableSemua();
|
||||
|
||||
</script>
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
<div class="card bg-base-100 rounded-none border border-base-300">
|
||||
<div class="card-body p-0">
|
||||
<!-- Table -->
|
||||
<div class="overflow-x-auto">
|
||||
<table class="table-zebra table w-full text-sm" id="tableChecklistBelumVerifikasi">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="w-[5%]">No</th>
|
||||
<th class="w-[15%]">Tanggal</th>
|
||||
<th class="w-[15%]">Mudah Terurai</th>
|
||||
<th class="w-[15%]">Material Daur Ulang</th>
|
||||
<th class="w-[10%]">B3</th>
|
||||
<th class="w-[10%]">Residu</th>
|
||||
<th class="w-[15%]">Status</th>
|
||||
<th class="w-[15%] text-center">Aksi</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody></tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
<div class="card-body p-0">
|
||||
<!-- Table -->
|
||||
<div class="overflow-x-auto">
|
||||
<table class="table-zebra table w-full text-sm" id="tableChecklist">
|
||||
<table class="table-zebra table w-full text-sm" id="tableChecklistSemua">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="w-[5%]">No</th>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,22 @@
|
|||
<div class="card bg-base-100 rounded-none border border-base-300">
|
||||
<div class="card-body p-0">
|
||||
<!-- Table -->
|
||||
<div class="overflow-x-auto">
|
||||
<table class="table-zebra table w-full text-sm" id="tableChecklistSudahVerifikasi">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="w-[5%]">No</th>
|
||||
<th class="w-[15%]">Tanggal</th>
|
||||
<th class="w-[15%]">Mudah Terurai</th>
|
||||
<th class="w-[15%]">Material Daur Ulang</th>
|
||||
<th class="w-[10%]">B3</th>
|
||||
<th class="w-[10%]">Residu</th>
|
||||
<th class="w-[15%]">Status</th>
|
||||
<th class="w-[15%] text-center">Aksi</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody></tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
Loading…
Reference in New Issue