style: add menu Data Kecamatan - Data Kecamatan role Admin
parent
453d56ef50
commit
65be286ec3
|
|
@ -0,0 +1,129 @@
|
|||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace BpsRwApp.Areas.Admin.Controllers
|
||||
{
|
||||
[Area("Admin")]
|
||||
[Route("Admin/[controller]/[action]")]
|
||||
public class DataKecamatanController : Controller
|
||||
{
|
||||
public IActionResult Index()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public IActionResult Table()
|
||||
{
|
||||
var data = new[]
|
||||
{
|
||||
new {
|
||||
kecamatan = "Kebayoran",
|
||||
jumlah_rumah_memilah = 581,
|
||||
jumlah_rumah_nasabah = 701,
|
||||
neraca_sampah = 581,
|
||||
jumlah_bank_sampah = 581,
|
||||
aksi = "<div class=\"flex gap-2\">" +
|
||||
"<a href=\"#\" class=\"btn btn-ghost btn-square btn-xs\"><span class=\"icon icon-fill text-sm\">more_horiz</span></a>" +
|
||||
"</div>",
|
||||
},
|
||||
new {
|
||||
kecamatan = "Tebet",
|
||||
jumlah_rumah_memilah = 889,
|
||||
jumlah_rumah_nasabah = 934,
|
||||
neraca_sampah = 889,
|
||||
jumlah_bank_sampah = 889,
|
||||
aksi = "<div class=\"flex gap-2\">" +
|
||||
"<a href=\"#\" class=\"btn btn-ghost btn-square btn-xs\"><span class=\"icon icon-fill text-sm\">more_horiz</span></a>" +
|
||||
"</div>",
|
||||
},
|
||||
new {
|
||||
kecamatan = "Menteng",
|
||||
jumlah_rumah_memilah = 673,
|
||||
jumlah_rumah_nasabah = 1378,
|
||||
neraca_sampah = 673,
|
||||
jumlah_bank_sampah = 673,
|
||||
aksi = "<div class=\"flex gap-2\">" +
|
||||
"<a href=\"#\" class=\"btn btn-ghost btn-square btn-xs\"><span class=\"icon icon-fill text-sm\">more_horiz</span></a>" +
|
||||
"</div>",
|
||||
},
|
||||
new {
|
||||
kecamatan = "Cilandak",
|
||||
jumlah_rumah_memilah = 790,
|
||||
jumlah_rumah_nasabah = 1094,
|
||||
neraca_sampah = 790,
|
||||
jumlah_bank_sampah = 790,
|
||||
aksi = "<div class=\"flex gap-2\">" +
|
||||
"<a href=\"#\" class=\"btn btn-ghost btn-square btn-xs\"><span class=\"icon icon-fill text-sm\">more_horiz</span></a>" +
|
||||
"</div>",
|
||||
},
|
||||
new {
|
||||
kecamatan = "Setiabudi",
|
||||
jumlah_rumah_memilah = 750,
|
||||
jumlah_rumah_nasabah = 794,
|
||||
neraca_sampah = 750,
|
||||
jumlah_bank_sampah = 750,
|
||||
aksi = "<div class=\"flex gap-2\">" +
|
||||
"<a href=\"#\" class=\"btn btn-ghost btn-square btn-xs\"><span class=\"icon icon-fill text-sm\">more_horiz</span></a>" +
|
||||
"</div>",
|
||||
},
|
||||
new {
|
||||
kecamatan = "Gambir",
|
||||
jumlah_rumah_memilah = 780,
|
||||
jumlah_rumah_nasabah = 1573,
|
||||
neraca_sampah = 780,
|
||||
jumlah_bank_sampah = 780,
|
||||
aksi = "<div class=\"flex gap-2\">" +
|
||||
"<a href=\"#\" class=\"btn btn-ghost btn-square btn-xs\"><span class=\"icon icon-fill text-sm\">more_horiz</span></a>" +
|
||||
"</div>",
|
||||
},
|
||||
new {
|
||||
kecamatan = "Cakung",
|
||||
jumlah_rumah_memilah = 552,
|
||||
jumlah_rumah_nasabah = 1160,
|
||||
neraca_sampah = 552,
|
||||
jumlah_bank_sampah = 552,
|
||||
aksi = "<div class=\"flex gap-2\">" +
|
||||
"<a href=\"#\" class=\"btn btn-ghost btn-square btn-xs\"><span class=\"icon icon-fill text-sm\">more_horiz</span></a>" +
|
||||
"</div>",
|
||||
},
|
||||
new {
|
||||
kecamatan = "Kelapa Gading",
|
||||
jumlah_rumah_memilah = 582,
|
||||
jumlah_rumah_nasabah = 1663,
|
||||
neraca_sampah = 582,
|
||||
jumlah_bank_sampah = 582,
|
||||
aksi = "<div class=\"flex gap-2\">" +
|
||||
"<a href=\"#\" class=\"btn btn-ghost btn-square btn-xs\"><span class=\"icon icon-fill text-sm\">more_horiz</span></a>" +
|
||||
"</div>",
|
||||
},
|
||||
new {
|
||||
kecamatan = "Pancoran",
|
||||
jumlah_rumah_memilah = 935,
|
||||
jumlah_rumah_nasabah = 730,
|
||||
neraca_sampah = 935,
|
||||
jumlah_bank_sampah = 935,
|
||||
aksi = "<div class=\"flex gap-2\">" +
|
||||
"<a href=\"#\" class=\"btn btn-ghost btn-square btn-xs\"><span class=\"icon icon-fill text-sm\">more_horiz</span></a>" +
|
||||
"</div>",
|
||||
},
|
||||
new {
|
||||
kecamatan = "Tanah Abang",
|
||||
jumlah_rumah_memilah = 593,
|
||||
jumlah_rumah_nasabah = 1046,
|
||||
neraca_sampah = 593,
|
||||
jumlah_bank_sampah = 593,
|
||||
aksi = "<div class=\"flex gap-2\">" +
|
||||
"<a href=\"#\" class=\"btn btn-ghost btn-square btn-xs\"><span class=\"icon icon-fill text-sm\">more_horiz</span></a>" +
|
||||
"</div>",
|
||||
},
|
||||
};
|
||||
|
||||
var response = new
|
||||
{
|
||||
data = data
|
||||
};
|
||||
|
||||
return Json(response);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,91 @@
|
|||
@{
|
||||
ViewData["Title"] = "Data Kecamatan";
|
||||
}
|
||||
|
||||
<div class="breadcrumbs text-sm">
|
||||
<ul>
|
||||
<li class="text-gray-500"><a>Data Kecamatan</a></li>
|
||||
<li>Data Kecamatan</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<!-- Header -->
|
||||
<div class="grid grid-cols-1 gap-4 lg:grid-cols-2">
|
||||
<div class="prose">
|
||||
<h3 class="mb-2">Data Kecamatan</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 Rumah Memilah</th>
|
||||
<th class="w-[10%]">Jumlah Rumah Nasabah</th>
|
||||
<th class="w-[10%]">Neraca Sampah</th>
|
||||
<th class="w-[10%]">Jumlah Bank Sampah</th>
|
||||
<th class="w-[10%]">Aksi</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody></tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="https://code.jquery.com/jquery-3.7.1.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></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/DataKecamatan/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_rumah_memilah' },
|
||||
{ data: 'jumlah_rumah_nasabah' },
|
||||
{ data: 'neraca_sampah' },
|
||||
{ data: 'jumlah_bank_sampah' },
|
||||
{ data: 'aksi' },
|
||||
]
|
||||
});
|
||||
|
||||
table.on("click", ".delete", function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
let url = $(this).data("url");
|
||||
swal.fire({
|
||||
title: "Apakah anda yakin?",
|
||||
text: "Data yang dihapus tidak dapat dikembalikan lagi",
|
||||
icon: "question",
|
||||
showCancelButton: true,
|
||||
confirmButtonText: "Ya, Hapus",
|
||||
cancelButtonText: "Batal",
|
||||
buttonsStyling: false,
|
||||
customClass: {
|
||||
confirmButton: "btn btn-error text-white",
|
||||
cancelButton: "btn btn-link no-underline text-gray-500",
|
||||
},
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
|
@ -40,11 +40,11 @@
|
|||
</details>
|
||||
</li>
|
||||
<li>
|
||||
<details>
|
||||
<details @(new[] { "DataKecamatan"}.Contains(controller) ? "open" : "")>
|
||||
<summary class="font-semibold text-primary-500">DATA KECAMATAN</summary>
|
||||
<ul>
|
||||
<li>
|
||||
<a class="text-gray-500">
|
||||
<a asp-area="Admin" asp-controller="DataKecamatan" asp-action="Index" class="text-gray-500 @(controller == "DataKecamatan" ? "menu-active" : "")">
|
||||
<span class="icon icon-fill">list</span>
|
||||
Data Kecamatan
|
||||
</a>
|
||||
|
|
|
|||
Loading…
Reference in New Issue