feat: menu reduksi

main
Rohmad Eko Wahyudi 2025-11-12 05:22:30 +07:00
parent 381b6df9d1
commit 90ddab4628
No known key found for this signature in database
GPG Key ID: 4CCEDA68CB778BAF
3 changed files with 302 additions and 0 deletions

View File

@ -0,0 +1,223 @@
using Microsoft.AspNetCore.Mvc;
namespace BankSampahApp.Controllers.Main
{
[Route("Main/[controller]/[action]")]
public class ReduksiSampahController : Controller
{
public IActionResult Index()
{
return View("~/Views/Main/ReduksiSampah/Index.cshtml");
}
[HttpGet]
public IActionResult Table()
{
var data = new[]
{
new {
periode_bulan = "15 Mar 2024",
kecamatan = "Kecamatan Kramatjati",
maggot = 345,
composting = 345,
bank_sampah = 345,
total_reduksi = 1035
},
new {
periode_bulan = "18 Agt 2024",
kecamatan = "Kecamatan Jagakarsa",
maggot = 987,
composting = 987,
bank_sampah = 987,
total_reduksi = 2961
},
new {
periode_bulan = "22 Apr 2024",
kecamatan = "Kecamatan Makasar",
maggot = 234,
composting = 234,
bank_sampah = 234,
total_reduksi = 702
},
new {
periode_bulan = "12 Jun 2024",
kecamatan = "Kecamatan Ciracas",
maggot = 678,
composting = 678,
bank_sampah = 678,
total_reduksi = 2034
},
new {
periode_bulan = "29 Jul 2024",
kecamatan = "Kecamatan Cilandak",
maggot = 789,
composting = 789,
bank_sampah = 789,
total_reduksi = 2367
},
new {
periode_bulan = "01 Mei 2024",
kecamatan = "Kecamatan Pasar Rebo",
maggot = 456,
composting = 456,
bank_sampah = 456,
total_reduksi = 1368
},
new {
periode_bulan = "14 Feb 2024",
kecamatan = "Kecamatan Kebayoran Baru",
maggot = 521,
composting = 521,
bank_sampah = 521,
total_reduksi = 1563
},
new {
periode_bulan = "05 Sep 2024",
kecamatan = "Kecamatan Tebet",
maggot = 892,
composting = 892,
bank_sampah = 892,
total_reduksi = 2676
},
new {
periode_bulan = "19 Jan 2024",
kecamatan = "Kecamatan Pesanggrahan",
maggot = 367,
composting = 367,
bank_sampah = 367,
total_reduksi = 1101
},
new {
periode_bulan = "27 Okt 2024",
kecamatan = "Kecamatan Tanah Abang",
maggot = 745,
composting = 745,
bank_sampah = 745,
total_reduksi = 2235
},
new {
periode_bulan = "08 Des 2024",
kecamatan = "Kecamatan Menteng",
maggot = 612,
composting = 612,
bank_sampah = 612,
total_reduksi = 1836
},
new {
periode_bulan = "11 Nov 2024",
kecamatan = "Kecamatan Cakung",
maggot = 483,
composting = 483,
bank_sampah = 483,
total_reduksi = 1449
},
new {
periode_bulan = "23 Jun 2024",
kecamatan = "Kecamatan Duren Sawit",
maggot = 934,
composting = 934,
bank_sampah = 934,
total_reduksi = 2802
},
new {
periode_bulan = "16 Mei 2024",
kecamatan = "Kecamatan Jatinegara",
maggot = 556,
composting = 556,
bank_sampah = 556,
total_reduksi = 1668
},
new {
periode_bulan = "03 Apr 2024",
kecamatan = "Kecamatan Pulogadung",
maggot = 821,
composting = 821,
bank_sampah = 821,
total_reduksi = 2463
},
new {
periode_bulan = "21 Jul 2024",
kecamatan = "Kecamatan Pademangan",
maggot = 698,
composting = 698,
bank_sampah = 698,
total_reduksi = 2094
},
new {
periode_bulan = "09 Agt 2024",
kecamatan = "Kecamatan Tanjung Priok",
maggot = 427,
composting = 427,
bank_sampah = 427,
total_reduksi = 1281
},
new {
periode_bulan = "30 Mar 2024",
kecamatan = "Kecamatan Kelapa Gading",
maggot = 773,
composting = 773,
bank_sampah = 773,
total_reduksi = 2319
},
new {
periode_bulan = "17 Sep 2024",
kecamatan = "Kecamatan Grogol Petamburan",
maggot = 645,
composting = 645,
bank_sampah = 645,
total_reduksi = 1935
},
new {
periode_bulan = "06 Feb 2024",
kecamatan = "Kecamatan Palmerah",
maggot = 389,
composting = 389,
bank_sampah = 389,
total_reduksi = 1167
},
new {
periode_bulan = "24 Okt 2024",
kecamatan = "Kecamatan Kemayoran",
maggot = 912,
composting = 912,
bank_sampah = 912,
total_reduksi = 2736
},
new {
periode_bulan = "13 Jan 2024",
kecamatan = "Kecamatan Sawah Besar",
maggot = 534,
composting = 534,
bank_sampah = 534,
total_reduksi = 1602
},
new {
periode_bulan = "28 Des 2024",
kecamatan = "Kecamatan Tambora",
maggot = 867,
composting = 867,
bank_sampah = 867,
total_reduksi = 2601
},
new {
periode_bulan = "10 Nov 2024",
kecamatan = "Kecamatan Pasar Minggu",
maggot = 591,
composting = 591,
bank_sampah = 591,
total_reduksi = 1773
},
new {
periode_bulan = "02 Mei 2024",
kecamatan = "Kecamatan Pancoran",
maggot = 726,
composting = 726,
bank_sampah = 726,
total_reduksi = 2178
}
};
return Json(new { data = data });
}
}
}

View File

@ -0,0 +1,63 @@
@{
ViewData["Title"] = "Reduksi Sampah";
}
<div class="flex flex-col gap-2 md:flex-row md:justify-between md:gap-0">
<div class="prose">
<span class="text-xl font-semibold text-black">
Reduksi Sampah
</span>
</div>
</div>
<div class="h-6"></div>
<div class="card bg-white shadow-sm">
<div class="card-body p-2">
<div class="w-full overflow-x-auto">
<table class="table-zebra table w-full" id="example">
<!-- head -->
<thead>
<tr>
<th class="w-[8%]">No</th>
<th class="w-[15%]">Periode Bulan</th>
<th class="w-[20%]">Kecamatan</th>
<th class="w-[12%]">Maggot (Kg)</th>
<th class="w-[15%]">Composting (Kg)</th>
<th class="w-[15%]">Bank Sampah (Kg)</th>
<th class="w-[15%]">Total Reduksi (Kg)</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</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: '/Main/ReduksiSampah/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: 'periode_bulan' },
{ data: 'kecamatan' },
{ data: 'maggot' },
{ data: 'composting' },
{ data: 'bank_sampah' },
{ data: 'total_reduksi' },
]
});
});
</script>

View File

@ -58,6 +58,22 @@
</a>
</li>
<!-- Composting -->
<li>
<a asp-controller="Composting" asp-action="Index" class="rounded-full @(controller == "Composting" ? "menu-active" : "")">
<i class="ph ph-leaf me-2 text-lg"></i>
Composting
</a>
</li>
<!-- Reduksi Sampah -->
<li>
<a asp-controller="ReduksiSampah" asp-action="Index" class="rounded-full @(controller == "ReduksiSampah" ? "menu-active" : "")">
<i class="ph ph-chart-line me-2 text-lg"></i>
Reduksi Sampah
</a>
</li>
<!-- Data Offtaker -->
<li>
<a asp-controller="DataOfftaker" asp-action="Index" class="rounded-full @(controller == "DataOfftaker" ? "menu-active" : "")">