style: add menu Data Kecamatan - Rumah Memilah role Admin

main-dlh
Yuri Dimas 2025-11-09 22:26:50 +07:00
parent 9dabae098f
commit 8aa441ee0c
3 changed files with 181 additions and 2 deletions

View File

@ -0,0 +1,108 @@
using Microsoft.AspNetCore.Mvc;
namespace BpsRwApp.Areas.Admin.Controllers
{
[Area("Admin")]
public class DataKecamatanRumahMemilahController : Controller
{
public IActionResult Index()
{
return View();
}
[HttpGet]
public IActionResult Table()
{
var data = new[]
{
new {
kecamatan = "Kebayoran",
jumlah_rw = 92,
total_rumah = 701,
rumah_aktif_memilah = 581,
rumah_nasabah = 581,
bank_sampah = 581,
},
new {
kecamatan = "Tebet",
jumlah_rw = 44,
total_rumah = 934,
rumah_aktif_memilah = 889,
rumah_nasabah = 889,
bank_sampah = 889,
},
new {
kecamatan = "Menteng",
jumlah_rw = 9,
total_rumah = 1378,
rumah_aktif_memilah = 673,
rumah_nasabah = 673,
bank_sampah = 673,
},
new {
kecamatan = "Cilandak",
jumlah_rw = 18,
total_rumah = 1094,
rumah_aktif_memilah = 790,
rumah_nasabah = 790,
bank_sampah = 790,
},
new {
kecamatan = "Setiabudi",
jumlah_rw = 17,
total_rumah = 794,
rumah_aktif_memilah = 750,
rumah_nasabah = 750,
bank_sampah = 750,
},
new {
kecamatan = "Gambir",
jumlah_rw = 4,
total_rumah = 1573,
rumah_aktif_memilah = 780,
rumah_nasabah = 780,
bank_sampah = 780,
},
new {
kecamatan = "Cakung",
jumlah_rw = 55,
total_rumah = 1160,
rumah_aktif_memilah = 553,
rumah_nasabah = 553,
bank_sampah = 553,
},
new {
kecamatan = "Kelapa Gading",
jumlah_rw = 95,
total_rumah = 1663,
rumah_aktif_memilah = 582,
rumah_nasabah = 582,
bank_sampah = 582,
},
new {
kecamatan = "Pancoran",
jumlah_rw = 48,
total_rumah = 730,
rumah_aktif_memilah = 935,
rumah_nasabah = 935,
bank_sampah = 935,
},
new {
kecamatan = "Tanah Abang",
jumlah_rw = 80,
total_rumah = 1046,
rumah_aktif_memilah = 593,
rumah_nasabah = 593,
bank_sampah = 593,
},
};
var response = new
{
data = data
};
return Json(response);
}
}
}

View File

@ -0,0 +1,71 @@
@{
ViewData["Title"] = "Rumah Memilah";
}
<div class="breadcrumbs text-sm">
<ul>
<li class="text-gray-500"><a>Data Kecamatan</a></li>
<li>Rumah Memilah</li>
</ul>
</div>
<!-- Header -->
<div class="grid grid-cols-1 gap-4 lg:grid-cols-2">
<div class="prose">
<h3 class="mb-2">Rumah Memilah</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-[45%]">Kecamatan</th>
<th class="w-[10%]">Jumlah RW</th>
<th class="w-[10%]">Total Rumah</th>
<th class="w-[10%]">Rumah Aktif Memilah</th>
<th class="w-[10%]">Rumah Nasabah</th>
<th class="w-[10%]">Bank Sampah</th>
</tr>
</thead>
<tbody></tbody>
</table>
</div>
</div>
<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 () {
table = new DataTable('#example', {
ajax: '/Admin/DataKecamatanRumahMemilah/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: 'kecamatan' },
{ data: 'jumlah_rw' },
{ data: 'total_rumah' },
{ data: 'rumah_aktif_memilah' },
{ data: 'rumah_nasabah' },
{ data: 'bank_sampah' },
]
});
});
</script>

View File

@ -40,7 +40,7 @@
</details> </details>
</li> </li>
<li> <li>
<details @(new[] { "DataKecamatan" }.Contains(controller) ? "open" : "")> <details @(new[] { "DataKecamatan", "DataKecamatanRumahMemilah" }.Contains(controller) ? "open" : "")>
<summary>DATA KECAMATAN</summary> <summary>DATA KECAMATAN</summary>
<ul> <ul>
<li> <li>
@ -50,7 +50,7 @@
</a> </a>
</li> </li>
<li> <li>
<a> <a asp-area="Admin" asp-controller="DataKecamatanRumahMemilah" asp-action="Index" class="@(controller == "DataKecamatanRumahMemilah" ? "menu-active" : "")">
<span class="icon icon-fill">house</span> <span class="icon icon-fill">house</span>
Rumah Memilah Rumah Memilah
</a> </a>