feat: add module reduksi sampah dinas
parent
ef45bb6359
commit
5870b012e5
|
|
@ -0,0 +1,254 @@
|
|||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace BankSampahApp.Controllers.Main
|
||||
{
|
||||
[Route("Main/[controller]/[action]")]
|
||||
public class ReduksiSampahDinasController : Controller
|
||||
{
|
||||
public IActionResult Index()
|
||||
{
|
||||
return View("~/Views/Main/ReduksiSampahDinas/Index.cshtml");
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public IActionResult Table()
|
||||
{
|
||||
var data = new[] {
|
||||
new {
|
||||
id = 1,
|
||||
periode_bulan = "Jan 2025",
|
||||
nama_lokasi = "Jakarta Pusat",
|
||||
alamat = @"
|
||||
<div class=""flex flex-col gap-1"">
|
||||
<span class=""text-sm font-semibold text-gray-900"">Tanah Abang</span>
|
||||
<div class=""flex items-center gap-1 text-xs text-gray-500"">
|
||||
<span>Cideng</span>
|
||||
<span>RT 002</span>
|
||||
<span>RW 001</span>
|
||||
</div>
|
||||
</div>",
|
||||
jenis_lokasi = "Maggot",
|
||||
berat_maggot = 1,
|
||||
berat_komposting = 5,
|
||||
berat_bank_sampah = 6,
|
||||
aksi = @"<div class=""flex gap-2"">
|
||||
<a href=""#"" class=""btn btn-circle btn-warning text-white btn-sm btn-edit""><i class=""ph ph-note-pencil""></i></a>
|
||||
<a href=""#"" class=""btn btn-circle btn-success text-white btn-sm btn-preview""><i class=""ph ph-eye""></i></a>
|
||||
<a href=""#"" class=""btn btn-circle bg-blue-500 text-white btn-sm btn-history""><i class=""ph ph-clock-counter-clockwise""></i></a>
|
||||
</div>",
|
||||
},
|
||||
new {
|
||||
id = 2,
|
||||
periode_bulan = "Feb 2025",
|
||||
nama_lokasi = "Jakarta Barat",
|
||||
alamat = @"
|
||||
<div class=""flex flex-col gap-1"">
|
||||
<span class=""text-sm font-semibold text-gray-900"">Palmerah</span>
|
||||
<div class=""flex items-center gap-1 text-xs text-gray-500"">
|
||||
<span>Kemanggisan</span>
|
||||
<span>RT 003</span>
|
||||
<span>RW 004</span>
|
||||
</div>
|
||||
</div>",
|
||||
jenis_lokasi = "Organik",
|
||||
berat_maggot = 2,
|
||||
berat_komposting = 4,
|
||||
berat_bank_sampah = 3,
|
||||
aksi = @"<div class=""flex gap-2"">
|
||||
<a href=""#"" class=""btn btn-circle btn-warning text-white btn-sm btn-edit""><i class=""ph ph-note-pencil""></i></a>
|
||||
<a href=""#"" class=""btn btn-circle btn-success text-white btn-sm btn-preview""><i class=""ph ph-eye""></i></a>
|
||||
<a href=""#"" class=""btn btn-circle bg-blue-500 text-white btn-sm btn-history""><i class=""ph ph-clock-counter-clockwise""></i></a>
|
||||
</div>",
|
||||
},
|
||||
new {
|
||||
id = 3,
|
||||
periode_bulan = "Mar 2025",
|
||||
nama_lokasi = "Jakarta Selatan",
|
||||
alamat = @"
|
||||
<div class=""flex flex-col gap-1"">
|
||||
<span class=""text-sm font-semibold text-gray-900"">Tebet</span>
|
||||
<div class=""flex items-center gap-1 text-xs text-gray-500"">
|
||||
<span>Manggarai</span>
|
||||
<span>RT 001</span>
|
||||
<span>RW 002</span>
|
||||
</div>
|
||||
</div>",
|
||||
jenis_lokasi = "Maggot",
|
||||
berat_maggot = 3,
|
||||
berat_komposting = 6,
|
||||
berat_bank_sampah = 2,
|
||||
aksi = @"<div class=""flex gap-2"">
|
||||
<a href=""#"" class=""btn btn-circle btn-warning text-white btn-sm btn-edit""><i class=""ph ph-note-pencil""></i></a>
|
||||
<a href=""#"" class=""btn btn-circle btn-success text-white btn-sm btn-preview""><i class=""ph ph-eye""></i></a>
|
||||
<a href=""#"" class=""btn btn-circle bg-blue-500 text-white btn-sm btn-history""><i class=""ph ph-clock-counter-clockwise""></i></a>
|
||||
</div>",
|
||||
},
|
||||
new {
|
||||
id = 4,
|
||||
periode_bulan = "Apr 2025",
|
||||
nama_lokasi = "Jakarta Timur",
|
||||
alamat = @"
|
||||
<div class=""flex flex-col gap-1"">
|
||||
<span class=""text-sm font-semibold text-gray-900"">Cakung</span>
|
||||
<div class=""flex items-center gap-1 text-xs text-gray-500"">
|
||||
<span>Jatinegara</span>
|
||||
<span>RT 004</span>
|
||||
<span>RW 006</span>
|
||||
</div>
|
||||
</div>",
|
||||
jenis_lokasi = "Anorganik",
|
||||
berat_maggot = 1,
|
||||
berat_komposting = 3,
|
||||
berat_bank_sampah = 7,
|
||||
aksi = @"<div class=""flex gap-2"">
|
||||
<a href=""#"" class=""btn btn-circle btn-warning text-white btn-sm btn-edit""><i class=""ph ph-note-pencil""></i></a>
|
||||
<a href=""#"" class=""btn btn-circle btn-success text-white btn-sm btn-preview""><i class=""ph ph-eye""></i></a>
|
||||
<a href=""#"" class=""btn btn-circle bg-blue-500 text-white btn-sm btn-history""><i class=""ph ph-clock-counter-clockwise""></i></a>
|
||||
</div>",
|
||||
},
|
||||
new {
|
||||
id = 5,
|
||||
periode_bulan = "Mei 2025",
|
||||
nama_lokasi = "Jakarta Utara",
|
||||
alamat = @"
|
||||
<div class=""flex flex-col gap-1"">
|
||||
<span class=""text-sm font-semibold text-gray-900"">Koja</span>
|
||||
<div class=""flex items-center gap-1 text-xs text-gray-500"">
|
||||
<span>Lagoa</span>
|
||||
<span>RT 005</span>
|
||||
<span>RW 003</span>
|
||||
</div>
|
||||
</div>",
|
||||
jenis_lokasi = "Maggot",
|
||||
berat_maggot = 4,
|
||||
berat_komposting = 5,
|
||||
berat_bank_sampah = 1,
|
||||
aksi = @"<div class=""flex gap-2"">
|
||||
<a href=""#"" class=""btn btn-circle btn-warning text-white btn-sm btn-edit""><i class=""ph ph-note-pencil""></i></a>
|
||||
<a href=""#"" class=""btn btn-circle btn-success text-white btn-sm btn-preview""><i class=""ph ph-eye""></i></a>
|
||||
<a href=""#"" class=""btn btn-circle bg-blue-500 text-white btn-sm btn-history""><i class=""ph ph-clock-counter-clockwise""></i></a>
|
||||
</div>",
|
||||
},
|
||||
new {
|
||||
id = 6,
|
||||
periode_bulan = "Jun 2025",
|
||||
nama_lokasi = "Depok",
|
||||
alamat = @"
|
||||
<div class=""flex flex-col gap-1"">
|
||||
<span class=""text-sm font-semibold text-gray-900"">Beji</span>
|
||||
<div class=""flex items-center gap-1 text-xs text-gray-500"">
|
||||
<span>Kukusan</span>
|
||||
<span>RT 002</span>
|
||||
<span>RW 007</span>
|
||||
</div>
|
||||
</div>",
|
||||
jenis_lokasi = "Organik",
|
||||
berat_maggot = 2,
|
||||
berat_komposting = 6,
|
||||
berat_bank_sampah = 4,
|
||||
aksi = @"<div class=""flex gap-2"">
|
||||
<a href=""#"" class=""btn btn-circle btn-warning text-white btn-sm btn-edit""><i class=""ph ph-note-pencil""></i></a>
|
||||
<a href=""#"" class=""btn btn-circle btn-success text-white btn-sm btn-preview""><i class=""ph ph-eye""></i></a>
|
||||
<a href=""#"" class=""btn btn-circle bg-blue-500 text-white btn-sm btn-history""><i class=""ph ph-clock-counter-clockwise""></i></a>
|
||||
</div>",
|
||||
},
|
||||
new {
|
||||
id = 7,
|
||||
periode_bulan = "Jul 2025",
|
||||
nama_lokasi = "Bekasi",
|
||||
alamat = @"
|
||||
<div class=""flex flex-col gap-1"">
|
||||
<span class=""text-sm font-semibold text-gray-900"">Pondok Gede</span>
|
||||
<div class=""flex items-center gap-1 text-xs text-gray-500"">
|
||||
<span>Jatibening</span>
|
||||
<span>RT 006</span>
|
||||
<span>RW 002</span>
|
||||
</div>
|
||||
</div>",
|
||||
jenis_lokasi = "Maggot",
|
||||
berat_maggot = 5,
|
||||
berat_komposting = 3,
|
||||
berat_bank_sampah = 2,
|
||||
aksi = @"<div class=""flex gap-2"">
|
||||
<a href=""#"" class=""btn btn-circle btn-warning text-white btn-sm btn-edit""><i class=""ph ph-note-pencil""></i></a>
|
||||
<a href=""#"" class=""btn btn-circle btn-success text-white btn-sm btn-preview""><i class=""ph ph-eye""></i></a>
|
||||
<a href=""#"" class=""btn btn-circle bg-blue-500 text-white btn-sm btn-history""><i class=""ph ph-clock-counter-clockwise""></i></a>
|
||||
</div>",
|
||||
},
|
||||
new {
|
||||
id = 8,
|
||||
periode_bulan = "Agu 2025",
|
||||
nama_lokasi = "Tangerang",
|
||||
alamat = @"
|
||||
<div class=""flex flex-col gap-1"">
|
||||
<span class=""text-sm font-semibold text-gray-900"">Ciledug</span>
|
||||
<div class=""flex items-center gap-1 text-xs text-gray-500"">
|
||||
<span>Paninggilan</span>
|
||||
<span>RT 001</span>
|
||||
<span>RW 005</span>
|
||||
</div>
|
||||
</div>",
|
||||
jenis_lokasi = "Anorganik",
|
||||
berat_maggot = 1,
|
||||
berat_komposting = 2,
|
||||
berat_bank_sampah = 6,
|
||||
aksi = @"<div class=""flex gap-2"">
|
||||
<a href=""#"" class=""btn btn-circle btn-warning text-white btn-sm btn-edit""><i class=""ph ph-note-pencil""></i></a>
|
||||
<a href=""#"" class=""btn btn-circle btn-success text-white btn-sm btn-preview""><i class=""ph ph-eye""></i></a>
|
||||
<a href=""#"" class=""btn btn-circle bg-blue-500 text-white btn-sm btn-history""><i class=""ph ph-clock-counter-clockwise""></i></a>
|
||||
</div>",
|
||||
},
|
||||
new {
|
||||
id = 9,
|
||||
periode_bulan = "Sep 2025",
|
||||
nama_lokasi = "Bogor",
|
||||
alamat = @"
|
||||
<div class=""flex flex-col gap-1"">
|
||||
<span class=""text-sm font-semibold text-gray-900"">Cibinong</span>
|
||||
<div class=""flex items-center gap-1 text-xs text-gray-500"">
|
||||
<span>Pabuaran</span>
|
||||
<span>RT 003</span>
|
||||
<span>RW 004</span>
|
||||
</div>
|
||||
</div>",
|
||||
jenis_lokasi = "Organik",
|
||||
berat_maggot = 2,
|
||||
berat_komposting = 5,
|
||||
berat_bank_sampah = 3,
|
||||
aksi = @"<div class=""flex gap-2"">
|
||||
<a href=""#"" class=""btn btn-circle btn-warning text-white btn-sm btn-edit""><i class=""ph ph-note-pencil""></i></a>
|
||||
<a href=""#"" class=""btn btn-circle btn-success text-white btn-sm btn-preview""><i class=""ph ph-eye""></i></a>
|
||||
<a href=""#"" class=""btn btn-circle bg-blue-500 text-white btn-sm btn-history""><i class=""ph ph-clock-counter-clockwise""></i></a>
|
||||
</div>",
|
||||
},
|
||||
new {
|
||||
id = 10,
|
||||
periode_bulan = "Okt 2025",
|
||||
nama_lokasi = "Jakarta Selatan",
|
||||
alamat = @"
|
||||
<div class=""flex flex-col gap-1"">
|
||||
<span class=""text-sm font-semibold text-gray-900"">Pasar Minggu</span>
|
||||
<div class=""flex items-center gap-1 text-xs text-gray-500"">
|
||||
<span>Pejaten</span>
|
||||
<span>RT 007</span>
|
||||
<span>RW 008</span>
|
||||
</div>
|
||||
</div>",
|
||||
jenis_lokasi = "Maggot",
|
||||
berat_maggot = 6,
|
||||
berat_komposting = 4,
|
||||
berat_bank_sampah = 2,
|
||||
aksi = @"<div class=""flex gap-2"">
|
||||
<a href=""#"" class=""btn btn-circle btn-warning text-white btn-sm btn-edit""><i class=""ph ph-note-pencil""></i></a>
|
||||
<a href=""#"" class=""btn btn-circle btn-success text-white btn-sm btn-preview""><i class=""ph ph-eye""></i></a>
|
||||
<a href=""#"" class=""btn btn-circle bg-blue-500 text-white btn-sm btn-history""><i class=""ph ph-clock-counter-clockwise""></i></a>
|
||||
</div>",
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
return Json(new { data = data });
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,92 @@
|
|||
@{
|
||||
ViewData["Title"] = "Reduksi Sampah Dinas";
|
||||
}
|
||||
|
||||
<div class="flex flex-col gap-2 md:flex-row md:justify-between md:gap-0 items-center">
|
||||
<div class="prose">
|
||||
<span class="text-xl font-semibold text-black">
|
||||
Reduksi Sampah Dinas
|
||||
</span>
|
||||
</div>
|
||||
<div class="flex gap-2 items-center">
|
||||
<select class="select rounded-full">
|
||||
<option disabled selected>Pilih Tahun</option>
|
||||
<option>2025</option>
|
||||
<option>2024</option>
|
||||
<option>2023</option>
|
||||
<option>2022</option>
|
||||
<option>2021</option>
|
||||
<option>2020</option>
|
||||
</select>
|
||||
</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>No</th>
|
||||
<th>Periode</th>
|
||||
<th>Nama Lokasi</th>
|
||||
<th>Alamat</th>
|
||||
<th>Berat Maggot(Kg)</th>
|
||||
<th>Berat Komposting(Kg)</th>
|
||||
<th>Berat Bank Sampah(Kg)</th>
|
||||
<th>Total Reduksi(Kg)</th>
|
||||
<th>Aksi</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@section Scripts {
|
||||
<script type="text/javascript">
|
||||
var table;
|
||||
$(document).ready(function () {
|
||||
table = new DataTable('#example', {
|
||||
ajax: '/Main/ReduksiSampahDinas/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: 'nama_lokasi' },
|
||||
{ data: 'alamat' },
|
||||
{ data: 'berat_maggot' },
|
||||
{ data: 'berat_komposting' },
|
||||
{ data: 'berat_bank_sampah' },
|
||||
{
|
||||
data: null,
|
||||
render: function (data, type, row) {
|
||||
let maggot = parseFloat(row.berat_maggot) || 0;
|
||||
let komposting = parseFloat(row.berat_komposting) || 0;
|
||||
let bankSampah = parseFloat(row.berat_bank_sampah) || 0;
|
||||
|
||||
let total = maggot + komposting + bankSampah;
|
||||
return total;
|
||||
}
|
||||
},
|
||||
{ data: 'aksi', orderable: false, searchable: false },
|
||||
]
|
||||
});
|
||||
|
||||
$('#example').on('click', '.btn-history', function (e) {
|
||||
e.preventDefault();
|
||||
modal_history.showModal();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
}
|
||||
|
|
@ -181,6 +181,12 @@
|
|||
</li>
|
||||
|
||||
<!-- Reduksi -->
|
||||
<li>
|
||||
<a asp-controller="ReduksiSampahDinas" class="rounded-full @(controller == "ReduksiSampahDinas" ? "menu-active" : "")">
|
||||
<i class="ph ph-database me-2 text-lg"></i>
|
||||
Reduksi Sampah Dinas
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a asp-controller="ReduksiSampahSatpel" class="rounded-full @(controller == "ReduksiSampahSatpel" ? "menu-active" : "")">
|
||||
<i class="ph ph-database me-2 text-lg"></i>
|
||||
|
|
|
|||
Loading…
Reference in New Issue