using BpsRwApp.Models.ProfilRw; using Microsoft.AspNetCore.Mvc; using System.Collections.Generic; using System.Linq; namespace BpsRwApp.Controllers { public class ProfilRwController : AppControllerBase { private static readonly List SampleAlatPengumpul = new() { new AlatPengumpulSampahViewModel { Id = 1, Kelurahan = "Kelurahan Cililitan", Rw = "005", Rt = "003", GerobakDorong = 1, GerobakMotor = 2, MobilPickup = 1, Truk = 1, Dustbin = 4, Container = 1, Landasan = 2, JenisPetugas = "Petugas Harian Lepas", NamaPetugas = "Taufik Hidayat", Jadwal = new List { "Senin", "Rabu", "Jumat" }, TpsTujuan = "TPS Jakarta Timur" }, new AlatPengumpulSampahViewModel { Id = 2, Kelurahan = "Kelurahan Rawamangun", Rw = "004", Rt = "002", GerobakDorong = 2, GerobakMotor = 3, MobilPickup = 1, Truk = 0, Dustbin = 3, Container = 1, Landasan = 1, JenisPetugas = "DLH", NamaPetugas = "Bambang Wijaya", Jadwal = new List { "Selasa", "Kamis", "Sabtu" }, TpsTujuan = "TPS Cililitan" }, new AlatPengumpulSampahViewModel { Id = 3, Kelurahan = "Kelurahan Duren Sawit", Rw = "003", Rt = "005", GerobakDorong = 1, GerobakMotor = 1, MobilPickup = 0, Truk = 1, Dustbin = 5, Container = 2, Landasan = 2, JenisPetugas = "Swadaya Warga", NamaPetugas = "Rini Setiawan", Jadwal = new List { "Senin", "Rabu", "Jumat" }, TpsTujuan = "TPS Duren Sawit" }, new AlatPengumpulSampahViewModel { Id = 4, Kelurahan = "Kelurahan Balekambang", Rw = "002", Rt = "001", GerobakDorong = 2, GerobakMotor = 1, MobilPickup = 1, Truk = 1, Dustbin = 2, Container = 1, Landasan = 1, JenisPetugas = "Kader Lingkungan", NamaPetugas = "Eko Nugroho", Jadwal = new List { "Selasa", "Kamis" }, TpsTujuan = "TPS Kampung Melayu" }, new AlatPengumpulSampahViewModel { Id = 5, Kelurahan = "Kelurahan Pondok Bambu", Rw = "001", Rt = "007", GerobakDorong = 3, GerobakMotor = 2, MobilPickup = 2, Truk = 1, Dustbin = 6, Container = 2, Landasan = 3, JenisPetugas = "Petugas Harian Lepas", NamaPetugas = "Ratna Sari", Jadwal = new List { "Rabu", "Jumat", "Minggu" }, TpsTujuan = "TPS Pondok Bambu" } }; public IActionResult Index() { return View(); } [HttpGet] public IActionResult TableLokasi() { var data = new[] { new { usulan = "Lokasi G", alamat = "Perumahan Mawar Indah", statusLahan = "Inventaris", pemilikLahan = "Larasati Wulandari", luasLahan = 500, statusUsulan = "Aktif" }, new { usulan = "Lokasi I", alamat = "Jl. Bougenville, RT 02", statusLahan = "Inventaris", pemilikLahan = "Arya Dwipangga", luasLahan = 500, statusUsulan = "Aktif" }, new { usulan = "Lokasi F", alamat = "Lingk. Edelweiss, No. 7", statusLahan = "Inventaris", pemilikLahan = "Kirana Lazuardi", luasLahan = 500, statusUsulan = "Aktif" }, new { usulan = "Lokasi C", alamat = "Jl. Anggrek No. 14", statusLahan = "Inventaris", pemilikLahan = "Bagas Priambodo", luasLahan = 500, statusUsulan = "Aktif" }, new { usulan = "Lokasi B", alamat = "Jl. Tulip, Kel. Gardenia", statusLahan = "Inventaris", pemilikLahan = "Raisa Adiwangsa", luasLahan = 500, statusUsulan = "Aktif" }, new { usulan = "Lokasi E", alamat = "Jl. Lavender, RT 09", statusLahan = "Inventaris", pemilikLahan = "Satria Gunawan", luasLahan = 500, statusUsulan = "Aktif" }, new { usulan = "Lokasi A", alamat = "Komp. Melati, No. 22", statusLahan = "Inventaris", pemilikLahan = "Kartika Hastuti", luasLahan = 500, statusUsulan = "Aktif" }, new { usulan = "Lokasi D", alamat = "Gg. Dahlia, RT 05", statusLahan = "Inventaris", pemilikLahan = "Bayu Anggoro", luasLahan = 500, statusUsulan = "Aktif" }, new { usulan = "Lokasi H", alamat = "Ds. Cempaka, Kab. Anyer", statusLahan = "Inventaris", pemilikLahan = "Citra Kirani", luasLahan = 500, statusUsulan = "Aktif" }, new { usulan = "Lokasi J", alamat = "Jl. Kenanga, Blok C", statusLahan = "Inventaris", pemilikLahan = "Galih Prasetya", luasLahan = 500, statusUsulan = "Aktif" }, }; var response = new { data = data }; return Json(response); } [HttpGet] public IActionResult TableSuratUsulan() { var data = new[] { new { nama_surat = "Surat Permohonan Perbaikan Jalan Lingkungan", tanggal_surat = ControllerSampleData.FormatTanggal(new DateTime(2023, 7, 11)), file_upload = "Surat Pengantar Proposal", status = "
Aktif
", aksi = "
" + "Detail" + "Edit" + "Delete" + "
" }, new { nama_surat = "Surat Rekomendasi untuk Pengajuan Kredit UMKM", tanggal_surat = ControllerSampleData.FormatTanggal(new DateTime(2023, 1, 9)), file_upload = "Surat Undangan Rapat Warga", status = "
Aktif
", aksi = "
" + "Detail" + "Edit" + "Delete" + "
" }, new { nama_surat = "Surat Pernyataan Persetujuan Pembangunan Pos Kamling", tanggal_surat = ControllerSampleData.FormatTanggal(new DateTime(2023, 4, 21)), file_upload = "Surat Pemberitahuan Gotong Royong", status = "
Aktif
", aksi = "
" + "Detail" + "Edit" + "Delete" + "
" }, new { nama_surat = "Surat Keterangan Tidak Mampu untuk Berobat", tanggal_surat = ControllerSampleData.FormatTanggal(new DateTime(2023, 2, 17)), file_upload = "Surat Keputusan Ketua RW", status = "
Aktif
", aksi = "
" + "Detail" + "Edit" + "Delete" + "
" }, new { nama_surat = "Laporan Keuangan RW Triwulan II 2023", tanggal_surat = ControllerSampleData.FormatTanggal(new DateTime(2023, 8, 18)), file_upload = "Surat Edaran Kebersihan", status = "
Aktif
", aksi = "
" + "Detail" + "Edit" + "Delete" + "
" }, new { nama_surat = "Surat Keputusan RW tentang Jadwal Ronda Malam", tanggal_surat = ControllerSampleData.FormatTanggal(new DateTime(2023, 5, 14)), file_upload = "Surat Rekomendasi Usaha", status = "
Aktif
", aksi = "
" + "Detail" + "Edit" + "Delete" + "
" }, new { nama_surat = "Surat Pemberitahuan Kerja Bakti Rutin", tanggal_surat = ControllerSampleData.FormatTanggal(new DateTime(2023, 6, 2)), file_upload = "Laporan Kegiatan RW", status = "
Aktif
", aksi = "
" + "Detail" + "Edit" + "Delete" + "
" }, new { nama_surat = "Surat Edaran tentang Pembayaran Iuran Sampah", tanggal_surat = ControllerSampleData.FormatTanggal(new DateTime(2023, 6, 22)), file_upload = "Surat Keterangan Domisili", status = "
Aktif
", aksi = "
" + "Detail" + "Edit" + "Delete" + "
" }, new { nama_surat = "Surat Pengantar untuk Pembuatan KTP", tanggal_surat = ControllerSampleData.FormatTanggal(new DateTime(2023, 3, 1)), file_upload = "Surat Permohonan Bantuan Dana", status = "
Aktif
", aksi = "
" + "Detail" + "Edit" + "Delete" + "
" }, new { nama_surat = "Surat Undangan Pertemuan Rutin PKK", tanggal_surat = ControllerSampleData.FormatTanggal(new DateTime(2023, 4, 28)), file_upload = "Surat Pernyataan Kesanggupan", status = "
Aktif
", aksi = "
" + "Detail" + "Edit" + "Delete" + "
" }, }; var response = new { data = data }; return Json(response); } [HttpGet] public IActionResult TablePengadaanWadah() { var data = new[] { new { rt = "001", jumlah_kepala_keluarga = "11", total_wadah_unit = "07", status = "
Aktif
", }, new { rt = "002", jumlah_kepala_keluarga = "09", total_wadah_unit = "01", status = "
Aktif
", }, new { rt = "003", jumlah_kepala_keluarga = "21", total_wadah_unit = "04", status = "
Aktif
", }, new { rt = "004", jumlah_kepala_keluarga = "17", total_wadah_unit = "02", status = "
Aktif
", }, new { rt = "005", jumlah_kepala_keluarga = "18", total_wadah_unit = "08", status = "
Aktif
", }, new { rt = "006", jumlah_kepala_keluarga = "14", total_wadah_unit = "05", status = "
Aktif
", }, new { rt = "007", jumlah_kepala_keluarga = "02", total_wadah_unit = "06", status = "
Aktif
", }, new { rt = "008", jumlah_kepala_keluarga = "22", total_wadah_unit = "06", status = "
Aktif
", }, new { rt = "009", jumlah_kepala_keluarga = "01", total_wadah_unit = "03", status = "
Aktif
", }, new { rt = "010", jumlah_kepala_keluarga = "28", total_wadah_unit = "04", status = "
Aktif
", }, }; var response = new { data = data }; return Json(response); } [HttpGet] public IActionResult TableKebutuhanSarpras() { var data = new[] { new { rt = "001", tanggal = ControllerSampleData.FormatTanggal(new DateTime(2023, 4, 11)), jumlah_unit = "507", aksi = "
" + "Detail" + "Edit" + "Delete" + "
" }, new { rt = "002", tanggal = ControllerSampleData.FormatTanggal(new DateTime(2023, 4, 9)), jumlah_unit = "501", aksi = "
" + "Detail" + "Edit" + "Delete" + "
" }, new { rt = "003", tanggal = ControllerSampleData.FormatTanggal(new DateTime(2023, 4, 21)), jumlah_unit = "504", aksi = "
" + "Detail" + "Edit" + "Delete" + "
" }, new { rt = "004", tanggal = ControllerSampleData.FormatTanggal(new DateTime(2023, 4, 17)), jumlah_unit = "502", aksi = "
" + "Detail" + "Edit" + "Delete" + "
" }, new { rt = "005", tanggal = ControllerSampleData.FormatTanggal(new DateTime(2023, 4, 18)), jumlah_unit = "508", aksi = "
" + "Detail" + "Edit" + "Delete" + "
" }, new { rt = "006", tanggal = ControllerSampleData.FormatTanggal(new DateTime(2023, 4, 14)), jumlah_unit = "505", aksi = "
" + "Detail" + "Edit" + "Delete" + "
" }, new { rt = "007", tanggal = ControllerSampleData.FormatTanggal(new DateTime(2023, 4, 2)), jumlah_unit = "506", aksi = "
" + "Detail" + "Edit" + "Delete" + "
" }, new { rt = "008", tanggal = ControllerSampleData.FormatTanggal(new DateTime(2023, 4, 22)), jumlah_unit = "506", aksi = "
" + "Detail" + "Edit" + "Delete" + "
" }, new { rt = "009", tanggal = ControllerSampleData.FormatTanggal(new DateTime(2023, 4, 1)), jumlah_unit = "503", aksi = "
" + "Detail" + "Edit" + "Delete" + "
" }, new { rt = "010", tanggal = ControllerSampleData.FormatTanggal(new DateTime(2023, 4, 28)), jumlah_unit = "504", aksi = "
" + "Detail" + "Edit" + "Delete" + "
" }, }; var response = new { data = data }; return Json(response); } [HttpGet] public IActionResult CreateKebutuhanSarpras() { return View(); } [HttpGet] public IActionResult TableAlatPengumpulSampah() { string BuildActionButtons(int id) { var detailUrl = Url.Action("DetailAlatPengumpulSampah", "ProfilRw", new { id }) ?? "#"; var editUrl = Url.Action("EditAlatPengumpulSampah", "ProfilRw", new { id }) ?? "#"; return "
" + $"Detail" + $"Edit" + $"" + "
"; } string CreateAlatBadge(string label, int value) { return $"
{label} = {value}
"; } string BuildAlatPengumpulBadges(int gerobakDorong, int gerobakMotor, int mobilPickup, int truk, int dustbin, int container, int landasan) { return string.Concat( CreateAlatBadge("Gerobak Dorong", gerobakDorong), CreateAlatBadge("Gerobak Motor", gerobakMotor), CreateAlatBadge("Mobil Pickup", mobilPickup), CreateAlatBadge("Truk", truk), CreateAlatBadge("Dustbin", dustbin), CreateAlatBadge("Container", container), CreateAlatBadge("Landasan", landasan) ); } string CreateJadwalBadge(string hari) { return $"
{hari}
"; } string BuildJadwalBadges(IEnumerable jadwal) { return string.Concat(jadwal.Select(CreateJadwalBadge)); } var data = SampleAlatPengumpul.Select(item => new { id = item.Id, wilayah = $"{item.Kelurahan} - RW {item.Rw} / RT {item.Rt}", kelurahan = item.Kelurahan, rw = item.Rw, rt = item.Rt, gerobakDorong = item.GerobakDorong, gerobakMotor = item.GerobakMotor, mobilPickup = item.MobilPickup, truk = item.Truk, dustbin = item.Dustbin, container = item.Container, landasan = item.Landasan, jenisPetugas = item.JenisPetugas, jadwalList = item.Jadwal, alat_pengumpul = BuildAlatPengumpulBadges(item.GerobakDorong, item.GerobakMotor, item.MobilPickup, item.Truk, item.Dustbin, item.Container, item.Landasan), petugas = item.NamaPetugas, jadwal = BuildJadwalBadges(item.Jadwal), tps_tujuan = item.TpsTujuan, aksi = BuildActionButtons(item.Id) }).ToList(); return Json(new { data }); } [HttpGet] public IActionResult DetailAlatPengumpulSampah(int id) { var data = SampleAlatPengumpul.FirstOrDefault(x => x.Id == id); if (data == null) { return NotFound(); } return View(data); } [HttpGet] public IActionResult EditAlatPengumpulSampah(int id) { var data = SampleAlatPengumpul.FirstOrDefault(x => x.Id == id); if (data == null) { return NotFound(); } return View(data); } [HttpGet] public IActionResult CreateAlatPengumpulSampah() { return View(); } } }