From 7100ed234228103edd096742a3f94d19f66939ef Mon Sep 17 00:00:00 2001 From: rahmagustin Date: Tue, 17 Feb 2026 21:18:50 +0700 Subject: [PATCH] validasi kelola tps --- .../Controllers/Admin/DashboardController.php | 24 +- app/Http/Controllers/Admin/TpsController.php | 363 +++++++++------ .../Auth/AuthenticatedSessionController.php | 2 +- app/Http/Controllers/IndexController.php | 5 +- public/assets/user/css/main.css | 117 +++++ resources/views/admin/aduan/index.blade.php | 13 - resources/views/admin/profil.blade.php | 139 ++++-- resources/views/admin/tps/create.blade.php | 228 +++++----- resources/views/admin/tps/edit.blade.php | 290 ++++++------ resources/views/coba.blade.php | 97 ++-- resources/views/user/index.blade.php | 421 +++++++----------- routes/web.php | 14 +- 12 files changed, 931 insertions(+), 782 deletions(-) diff --git a/app/Http/Controllers/Admin/DashboardController.php b/app/Http/Controllers/Admin/DashboardController.php index 5aa22f7..df1e3c7 100644 --- a/app/Http/Controllers/Admin/DashboardController.php +++ b/app/Http/Controllers/Admin/DashboardController.php @@ -4,20 +4,22 @@ use App\Http\Controllers\Controller; use Illuminate\Http\Request; +use App\Models\LokasiTps; +use App\Models\AduanTps; +use App\Models\Sampah; class DashboardController extends Controller { public function index() -{ - $totalTps = \App\Models\LokasiTps::count(); - $totalAduan = \App\Models\AduanTps::count(); - $sampahTerbaru = \App\Models\Sampah::orderBy('created_at', 'desc')->first(); - - return view('admin.index', compact( - 'totalTps', - 'totalAduan', - 'sampahTerbaru' - )); -} + { + $totalTps = LokasiTps::count(); + $totalAduan = AduanTps::count(); + $sampahTerbaru = Sampah::orderBy('created_at', 'desc')->first(); + return view('admin.index', compact( + 'totalTps', + 'totalAduan', + 'sampahTerbaru' + )); + } } diff --git a/app/Http/Controllers/Admin/TpsController.php b/app/Http/Controllers/Admin/TpsController.php index 8d9cd86..f8dc192 100644 --- a/app/Http/Controllers/Admin/TpsController.php +++ b/app/Http/Controllers/Admin/TpsController.php @@ -10,140 +10,241 @@ class TpsController extends Controller { -public function index() -{ - $title = 'Data TPS'; - $tps = LokasiTps::with('kategori') - ->withCount('aduan') - ->get(); - return view('admin.tps.index', compact('title', 'tps')); -} + public function index() + { + $title = 'Data TPS'; + $tps = LokasiTps::with('kategori') + ->withCount('aduan') + ->get(); -public function create() -{ - $title = 'Tambah TPS'; - $kategori = KategoriTps::all(); - return view('admin.tps.create', compact('title', 'kategori')); -} -private function convertToDecimal($coordinate) -{ - if (is_numeric($coordinate)) { - return (float) $coordinate; - } - $coordinate = html_entity_decode($coordinate); - $coordinate = strtoupper(trim($coordinate)); - $coordinate = str_replace( - ['°', "'", '"'], - [' ', ' ', ' '], - $coordinate - ); - preg_match('/([NSEW])/', $coordinate, $dirMatch); - if (!$dirMatch) return null; - $direction = $dirMatch[1]; - preg_match_all('/\d+(\.\d+)?/', $coordinate, $numbers); - if (count($numbers[0]) < 3) return null; - [$deg, $min, $sec] = array_map('floatval', $numbers[0]); - $decimal = $deg + ($min / 60) + ($sec / 3600); - if (in_array($direction, ['S', 'W'])) { - $decimal *= -1; + return view('admin.tps.index', compact('title', 'tps')); } - return $decimal; -} -public function store(Request $request) -{ - $request->validate([ - 'kategori_tps_id' => 'required|exists:kategori_tps,id_kategori_tps', - 'nama_tps' => 'required|string|max:255', - 'alamat_tps' => 'required|string|max:255', - 'status_tps' => 'required', - 'tahun_pembuatan' => 'required|numeric', - 'kapasitas_tps' => 'required', - 'latitude' => 'required', - 'longitude' => 'required', - 'foto_tps' => 'nullable|image|mimes:jpg,jpeg,png|max:2048', - ]); - $latitude = $this->convertToDecimal($request->latitude); - $longitude = $this->convertToDecimal($request->longitude); - if ($latitude === null || $longitude === null) { - return back()->withErrors(['Koordinat tidak valid'])->withInput(); - } - $foto = $request->hasFile('foto_tps') - ? $request->file('foto_tps')->store('foto-tps', 'public') - : null; - LokasiTps::create([ - 'kategori_tps_id' => $request->kategori_tps_id, - 'nama_tps' => $request->nama_tps, - 'alamat_tps' => $request->alamat_tps, - 'status_tps' => $request->status_tps, - 'tahun_pembuatan' => $request->tahun_pembuatan, - 'kapasitas_tps' => $request->kapasitas_tps, - 'latitude' => $latitude, - 'longitude' => $longitude, - 'foto_tps' => $foto, - ]); - return redirect()->route('admin.tps.index') - ->with('success', 'Data TPS berhasil ditambahkan'); -} -public function edit($id) -{ - $title = 'Edit TPS'; - $tps = LokasiTps::findOrFail($id); - $kategori = KategoriTps::all(); - return view('admin.tps.edit', compact('title', 'tps', 'kategori')); -} -public function update(Request $request, $id) -{ - $tps = LokasiTps::findOrFail($id); - $request->validate([ - 'kategori_tps_id' => 'required|exists:kategori_tps,id_kategori_tps', - 'nama_tps' => 'required|string|max:255', - 'alamat_tps' => 'required|string|max:255', - 'status_tps' => 'required', - 'tahun_pembuatan' => 'required|numeric', - 'kapasitas_tps' => 'required', - 'latitude' => 'required', - 'longitude' => 'required', - 'foto_tps' => 'nullable|image|mimes:jpg,jpeg,png|max:4096', - ]); - $latitude = $this->convertToDecimal($request->latitude); - $longitude = $this->convertToDecimal($request->longitude); - if ($latitude === null || $longitude === null) { - return back() - ->withErrors(['Koordinat tidak valid. Gunakan format Decimal atau DMS.']) - ->withInput(); + public function create() + { + $title = 'Tambah TPS'; + $kategori = KategoriTps::all(); + + return view('admin.tps.create', compact('title', 'kategori')); } - if ($request->hasFile('foto_tps')) { - if ($tps->foto_tps) { - Storage::disk('public')->delete($tps->foto_tps); - } - $foto = $request->file('foto_tps')->store('foto-tps', 'public'); - } else { - $foto = $tps->foto_tps; - } - $tps->update([ - 'kategori_tps_id' => $request->kategori_tps_id, - 'nama_tps' => $request->nama_tps, - 'alamat_tps' => $request->alamat_tps, - 'status_tps' => $request->status_tps, - 'tahun_pembuatan' => $request->tahun_pembuatan, - 'kapasitas_tps' => $request->kapasitas_tps, - 'latitude' => $latitude, - 'longitude' => $longitude, - 'foto_tps' => $foto, - ]); - return redirect()->route('admin.tps.index') - ->with('success', 'Data TPS berhasil diperbarui'); -} -public function destroy($id) -{ - $tps = LokasiTps::findOrFail($id); - if ($tps->foto_tps) { - Storage::disk('public')->delete($tps->foto_tps); - } - $tps->delete(); - return redirect()->route('admin.tps.index') - ->with('success', 'Data TPS berhasil dihapus'); -} + /* + |-------------------------------------------------------------------------- + | KONVERSI KOORDINAT (DECIMAL / DMS) + |-------------------------------------------------------------------------- + */ + private function convertToDecimal($coordinate) + { + if (is_numeric($coordinate)) { + return (float) $coordinate; + } + + $coordinate = html_entity_decode($coordinate); + $coordinate = strtoupper(trim($coordinate)); + $coordinate = str_replace(['°', "'", '"'], [' ', ' ', ' '], $coordinate); + + preg_match('/([NSEW])/', $coordinate, $dir); + if (!$dir) { + return null; + } + + preg_match_all('/\d+(\.\d+)?/', $coordinate, $numbers); + if (count($numbers[0]) < 3) { + return null; + } + + [$deg, $min, $sec] = array_map('floatval', $numbers[0]); + $decimal = $deg + ($min / 60) + ($sec / 3600); + + if (in_array($dir[1], ['S', 'W'])) { + $decimal *= -1; + } + + return $decimal; + } + + /* + |-------------------------------------------------------------------------- + | STORE (CREATE) + |-------------------------------------------------------------------------- + */ + public function store(Request $request) + { + // VALIDASI DASAR + PESAN CUSTOM + $request->validate( + [ + 'kategori_tps_id' => 'required|exists:kategori_tps,id_kategori_tps', + 'nama_tps' => 'required|string|max:255', + 'alamat_tps' => 'required|string|max:255', + 'status_tps' => 'required|in:Aktif,Tidak Aktif,Pembangunan', + 'tahun_pembuatan' => 'required|digits:4', + 'kapasitas_tps' => 'required|integer|min:1', + 'latitude' => 'required', + 'longitude' => 'required', + 'foto_tps' => 'nullable|image|mimes:jpg,jpeg,png|max:2048', + ], + [ + 'kategori_tps_id.required' => 'Kategori TPS wajib dipilih.', + 'kategori_tps_id.exists' => 'Kategori TPS tidak valid.', + + 'nama_tps.required' => 'Nama TPS wajib diisi.', + 'alamat_tps.required' => 'Alamat TPS wajib diisi.', + + 'status_tps.required' => 'Status TPS wajib dipilih.', + 'status_tps.in' => 'Status TPS tidak valid.', + + 'tahun_pembuatan.required' => 'Tahun pembuatan wajib diisi.', + 'tahun_pembuatan.digits' => 'Tahun pembuatan harus 4 digit (contoh: 2022).', + + 'kapasitas_tps.required' => 'Kapasitas TPS wajib diisi.', + 'kapasitas_tps.integer' => 'Kapasitas TPS harus berupa angka.', + 'kapasitas_tps.min' => 'Kapasitas TPS minimal 1.', + + 'latitude.required' => 'Latitude wajib diisi.', + 'longitude.required' => 'Longitude wajib diisi.', + + 'foto_tps.image' => 'Foto TPS harus berupa gambar.', + 'foto_tps.mimes' => 'Format foto TPS harus jpg, jpeg, atau png.', + ] + ); + + // VALIDASI KOORDINAT (TIDAK DOBEL ERROR) + $latitude = $this->convertToDecimal($request->latitude); + $longitude = $this->convertToDecimal($request->longitude); + + $errors = []; + + if ($latitude === null || $latitude < -90 || $latitude > 90) { + $errors['latitude'] = 'Latitude tidak valid. Contoh: -7.623 atau 7.623'; + } + + if ($longitude === null || $longitude < -180 || $longitude > 180) { + $errors['longitude'] = 'Longitude tidak valid. Contoh: 111.980 atau -111.980'; + } + + if (!empty($errors)) { + return back()->withErrors($errors)->withInput(); + } + + // UPLOAD FOTO + $foto = $request->hasFile('foto_tps') + ? $request->file('foto_tps')->store('foto-tps', 'public') + : null; + + LokasiTps::create([ + 'kategori_tps_id' => $request->kategori_tps_id, + 'nama_tps' => $request->nama_tps, + 'alamat_tps' => $request->alamat_tps, + 'status_tps' => $request->status_tps, + 'tahun_pembuatan' => $request->tahun_pembuatan, + 'kapasitas_tps' => $request->kapasitas_tps, + 'latitude' => $latitude, + 'longitude' => $longitude, + 'foto_tps' => $foto, + ]); + + return redirect()->route('admin.tps.index') + ->with('success', 'Data TPS berhasil ditambahkan.'); + } + + /* + |-------------------------------------------------------------------------- + | EDIT + |-------------------------------------------------------------------------- + */ + public function edit($id) + { + $title = 'Edit TPS'; + $tps = LokasiTps::findOrFail($id); + $kategori = KategoriTps::all(); + + return view('admin.tps.edit', compact('title', 'tps', 'kategori')); + } + + /* + |-------------------------------------------------------------------------- + | UPDATE + |-------------------------------------------------------------------------- + */ + public function update(Request $request, $id) + { + $tps = LokasiTps::findOrFail($id); + + $request->validate( + [ + 'kategori_tps_id' => 'required|exists:kategori_tps,id_kategori_tps', + 'nama_tps' => 'required|string|max:255', + 'alamat_tps' => 'required|string|max:255', + 'status_tps' => 'required|in:Aktif,Tidak Aktif,Pembangunan', + 'tahun_pembuatan' => 'required|digits:4', + 'kapasitas_tps' => 'required|integer|min:1', + 'latitude' => 'required', + 'longitude' => 'required', + 'foto_tps' => 'nullable|image|mimes:jpg,jpeg,png|max:4096', + ], + [ + 'tahun_pembuatan.digits' => 'Tahun pembuatan harus 4 digit.', + ] + ); + + $latitude = $this->convertToDecimal($request->latitude); + $longitude = $this->convertToDecimal($request->longitude); + + $errors = []; + + if ($latitude === null || $latitude < -90 || $latitude > 90) { + $errors['latitude'] = 'Latitude tidak valid.'; + } + + if ($longitude === null || $longitude < -180 || $longitude > 180) { + $errors['longitude'] = 'Longitude tidak valid.'; + } + + if (!empty($errors)) { + return back()->withErrors($errors)->withInput(); + } + + if ($request->hasFile('foto_tps')) { + if ($tps->foto_tps) { + Storage::disk('public')->delete($tps->foto_tps); + } + $foto = $request->file('foto_tps')->store('foto-tps', 'public'); + } else { + $foto = $tps->foto_tps; + } + + $tps->update([ + 'kategori_tps_id' => $request->kategori_tps_id, + 'nama_tps' => $request->nama_tps, + 'alamat_tps' => $request->alamat_tps, + 'status_tps' => $request->status_tps, + 'tahun_pembuatan' => $request->tahun_pembuatan, + 'kapasitas_tps' => $request->kapasitas_tps, + 'latitude' => $latitude, + 'longitude' => $longitude, + 'foto_tps' => $foto, + ]); + + return redirect()->route('admin.tps.index') + ->with('success', 'Data TPS berhasil diperbarui.'); + } + + /* + |-------------------------------------------------------------------------- + | DELETE + |-------------------------------------------------------------------------- + */ + public function destroy($id) + { + $tps = LokasiTps::findOrFail($id); + + if ($tps->foto_tps) { + Storage::disk('public')->delete($tps->foto_tps); + } + + $tps->delete(); + + return redirect()->route('admin.tps.index') + ->with('success', 'Data TPS berhasil dihapus.'); + } } diff --git a/app/Http/Controllers/Auth/AuthenticatedSessionController.php b/app/Http/Controllers/Auth/AuthenticatedSessionController.php index f569678..27ddb90 100644 --- a/app/Http/Controllers/Auth/AuthenticatedSessionController.php +++ b/app/Http/Controllers/Auth/AuthenticatedSessionController.php @@ -33,6 +33,6 @@ public function destroy(Request $request): RedirectResponse $request->session()->regenerateToken(); - return redirect('/index'); + return redirect('/'); } } diff --git a/app/Http/Controllers/IndexController.php b/app/Http/Controllers/IndexController.php index 98d47e9..d0d7758 100644 --- a/app/Http/Controllers/IndexController.php +++ b/app/Http/Controllers/IndexController.php @@ -14,7 +14,10 @@ public function index() $sampah = Sampah::orderBy('tahun', 'desc')->first(); $kategoriTps = KategoriTps::orderBy('id_kategori_tps')->get(); $lokasiTps = LokasiTps::all(); + $jumlahTps = LokasiTps::where('kategori_tps_id', '3')->count(); + $jumlahTps3r = LokasiTps::where('kategori_tps_id', '5')->count(); + $jumlahTpa = LokasiTps::where('kategori_tps_id', '6')->count(); - return view('user.index', compact('sampah', 'kategoriTps', 'lokasiTps')); + return view('user.index', compact('sampah', 'kategoriTps', 'lokasiTps', 'jumlahTps', 'jumlahTps3r', 'jumlahTpa')); } } diff --git a/public/assets/user/css/main.css b/public/assets/user/css/main.css index 905a4b1..0db001a 100644 --- a/public/assets/user/css/main.css +++ b/public/assets/user/css/main.css @@ -3068,3 +3068,120 @@ .btn-lokasi:focus:hover { color: var(--contrast-color); background: color-mix(in srgb, var(--accent-color), transparent 15%); } + +/* ================================ + GEO STAT SECTION – FINAL VERSION + ================================ */ + +.geo-stat-section { + position: relative; + padding: 50px 0; + background: #ffffff; + color: #2f2f2f; + overflow: hidden; +} + +/* Badge kecil */ +.geo-badge { + font-size: 13px; + letter-spacing: 1px; + color: var(--heading-color); + text-transform: uppercase; +} + +/* Judul utama */ +.geo-title { + font-size: 38px; + font-weight: 700; + line-height: 1.3; + margin: 12px 0; + color: var(--accent-color) +} + +/* Deskripsi */ +.geo-desc { + font-size: 15px; + color: #6b7280; + max-width: 420px; + line-height: 1.6; +} + +/* ================================ + STATISTIK AREA + ================================ */ + +.geo-stats { + display: flex; + align-items: center; + justify-content: space-between; +} + +.geo-item { + text-align: center; + flex: 1; +} + +/* Icon box */ +.geo-icon { + width: 64px; + height: 64px; + border-radius: 16px; + display: flex; + align-items: center; + justify-content: center; + font-size: 28px; + margin: 0 auto 14px; + background: rgba(11, 93, 59, 0.08); + color: #0b5d3b; +} + +/* Variasi icon */ +.geo-icon.recycle { + background: rgba(32, 201, 151, 0.18); + color: #20c997; +} + +.geo-icon.location { + background: rgba(255, 193, 7, 0.18); + color: #f59f00; +} + +/* Angka statistik */ +.geo-item h3 { + font-size: 46px; + font-weight: 800; + color: var(--heading-color); + margin: 0; +} + +/* Label bawah angka */ +.geo-item span { + font-size: 14px; + letter-spacing: .6px; + color: #6b7280; +} + +/* Garis pemisah */ +.geo-line { + width: 2px; + height: 110px; + background: rgba(0, 0, 0, 0.15); +} + +/* ================================ + RESPONSIVE (AMAN MOBILE) + ================================ */ +@media (max-width: 768px) { + .geo-stats { + flex-direction: column; + gap: 32px; + } + + .geo-line { + display: none; + } + + .geo-title { + font-size: 30px; + } +} diff --git a/resources/views/admin/aduan/index.blade.php b/resources/views/admin/aduan/index.blade.php index 93b6f9b..c8492d6 100644 --- a/resources/views/admin/aduan/index.blade.php +++ b/resources/views/admin/aduan/index.blade.php @@ -24,7 +24,6 @@ TPS Nama Pelapor - {{-- Alamat Pelapor --}} Tanggal Aduan Status Aksi @@ -33,7 +32,6 @@ @forelse ($aduan as $item) - {{ $item->lokasiTps->nama_tps ?? '-' }} @@ -43,19 +41,10 @@ {{ $item->lokasiTps->alamat_tps ?? '' }} - - {{ $item->nama_pelapor }} - - - {{-- {{ $item->alamat_pelapor }} --}} - - {{ \Carbon\Carbon::parse($item->tanggal_aduan)->format('d M Y') }} - - @if ($item->tanggapan_admin) Ditanggapi @@ -63,8 +52,6 @@ Belum @endif - - -
-
-
-
-

Profil Admin

+
+ @endsection diff --git a/resources/views/admin/tps/create.blade.php b/resources/views/admin/tps/create.blade.php index 027031a..30b9e34 100644 --- a/resources/views/admin/tps/create.blade.php +++ b/resources/views/admin/tps/create.blade.php @@ -1,119 +1,141 @@ @extends('admin.template') @section('content') -
-
-
-
-
-

Tambah Data TPS

-

Form tambah data TPS

+
+
+
+
+
+

Tambah Data TPS

+

Form tambah data TPS

- @if ($errors->any()) -
-
    - @foreach ($errors->all() as $error) -
  • {{ $error }}
  • - @endforeach -
-
- @endif +
+ @csrf + +
+ + + @error('nama_tps') + {{ $message }} + @enderror +
- - @csrf + +
+ + + @error('alamat_tps') + {{ $message }} + @enderror +
- -
- - + +
+ + + @error('kategori_tps_id') + {{ $message }} + @enderror +
+ + +
+ + + @error('tahun_pembuatan') + {{ $message }} + @enderror +
+ + +
+ + + @error('kapasitas_tps') + {{ $message }} + @enderror +
+ + +
+ + + @error('status_tps') + {{ $message }} + @enderror +
+ + +
+ + + @error('latitude') + {{ $message }} + @enderror +
+ + +
+ + + @error('longitude') + {{ $message }} + @enderror +
+ + +
+ + + + +
+ + + +
-
- - -
+ @error('foto_tps') + {{ $message }} + @enderror +
-
- - -
+ + Batal + - -
- - -
- - -
- - -
- - -
- - -
- - -
- - -
- -
- - -
- -
- - -
- - -
- - - - -
- - - - -
-
- - - Batal - - -
+
@endsection diff --git a/resources/views/admin/tps/edit.blade.php b/resources/views/admin/tps/edit.blade.php index 6fe761f..bedbafc 100644 --- a/resources/views/admin/tps/edit.blade.php +++ b/resources/views/admin/tps/edit.blade.php @@ -1,11 +1,11 @@ @php function decimalToDms($decimal, $type = 'lat') { - if ($decimal === null || $decimal === '') return ''; + if ($decimal === null || $decimal === '') { + return ''; + } - $direction = $decimal >= 0 - ? ($type === 'lat' ? 'N' : 'E') - : ($type === 'lat' ? 'S' : 'W'); + $direction = $decimal >= 0 ? ($type === 'lat' ? 'N' : 'E') : ($type === 'lat' ? 'S' : 'W'); $decimal = abs($decimal); @@ -21,140 +21,172 @@ function decimalToDms($decimal, $type = 'lat') @extends('admin.template') @section('content') -
-
-
-
-
-

Edit Data TPS

-

- Form edit data Tempat Pembuangan Sampah -

+
+
+
+
+
+

Edit Data TPS

+

+ Form edit data Tempat Pembuangan Sampah +

-
- @csrf - @method('PUT') + + @csrf + @method('PUT') - {{-- Nama TPS --}} -
- - -
- - {{-- Alamat --}} -
- - -
- -
- - -
- - {{-- Kategori TPS --}} -
- - -
- - {{-- Tahun Pembuatan --}} -
- - -
- - {{-- Kapasitas TPS --}} -
- - -
- - {{-- Status TPS --}} -
- - -
- - {{-- Latitude (DMS) --}} -
- - -
- - {{-- Longitude (DMS) --}} -
- - -
- - {{-- Foto TPS --}} -
- - - -
- - - - + {{-- Nama TPS --}} +
+ + + @error('nama_tps') + {{ $message }} + @enderror
- {{-- Foto Lama --}} - @if ($tps->foto_tps) -
- + {{-- Alamat --}} +
+ + + @error('alamat_tps') + {{ $message }} + @enderror +
+ + {{-- Kategori TPS --}} +
+ + + @error('kategori_tps_id') + {{ $message }} + @enderror +
+ + {{-- Tahun Pembuatan --}} +
+ + + @error('tahun_pembuatan') + {{ $message }} + @enderror +
+ + {{-- Kapasitas TPS --}} +
+ + + @error('kapasitas_tps') + {{ $message }} + @enderror +
+ + {{-- Status TPS --}} +
+ + + @error('status_tps') + {{ $message }} + @enderror +
+ + {{-- Latitude --}} +
+ + + @error('latitude') + {{ $message }} + @enderror +
+ + {{-- Longitude --}} +
+ + + @error('longitude') + {{ $message }} + @enderror +
+ + {{-- Foto TPS --}} +
+ + + + +
+ + + +
- @endif -
- {{-- Button --}} - - - Batal - + @error('foto_tps') + {{ $message }} + @enderror - + @if ($tps->foto_tps) +
+ +
+ @endif +
+ + {{-- Button --}} + + Batal + + +
-
+ @endsection diff --git a/resources/views/coba.blade.php b/resources/views/coba.blade.php index d3c6de4..5fc977f 100644 --- a/resources/views/coba.blade.php +++ b/resources/views/coba.blade.php @@ -1,67 +1,30 @@ -validate([ - 'tahun' => 'required|numeric', - 'total_sampah' => 'required|numeric', - 'total_kelola' => 'required|numeric', - 'total_daur_ulang' => 'required|numeric', - ]); - $sisa_sampah = $request->total_sampah - - ($request->total_kelola + $request->total_daur_ulang); - Sampah::create([ - 'user_id' => Auth::id(), - 'tahun' => $request->tahun, - 'total_sampah' => $request->total_sampah, - 'total_kelola' => $request->total_kelola, - 'total_daur_ulang' => $request->total_daur_ulang, - 'sisa_sampah' => $sisa_sampah, - ]); - return redirect()->route('admin.sampah.index') - ->with('success', 'Data sampah berhasil ditambahkan'); -} - -public function edit($id) -{ - $title = 'Edit Data Sampah'; - $sampah = Sampah::findOrFail($id); - $users = User::all(); - return view('admin.sampah.edit', compact('title', 'sampah', 'users')); -} -public function update(Request $request, $id) -{ - $sampah = Sampah::findOrFail($id); - $request->validate([ - 'user_id' => 'required|exists:users,id', - 'tahun' => 'required|numeric', - 'total_sampah' => 'required|numeric', - 'total_kelola' => 'required|numeric', - 'total_daur_ulang' => 'required|numeric', - ]); - $sisa_sampah = $request->total_sampah - - ($request->total_kelola + $request->total_daur_ulang); - $sampah->update([ - 'user_id' => $request->user_id, - 'tahun' => $request->tahun, - 'total_sampah' => $request->total_sampah, - 'total_kelola' => $request->total_kelola, - 'total_daur_ulang' => $request->total_daur_ulang, - 'sisa_sampah' => $sisa_sampah, - ]); - return redirect()->route('admin.sampah.index') - ->with('success', 'Data sampah berhasil diperbarui'); -} - -public function destroy($id) -{ - $sampah = Sampah::findOrFail($id); - $sampah->delete(); - return redirect()->route('admin.sampah.index') - ->with('success', 'Data sampah berhasil dihapus'); -} + + @foreach ($kategori as $item) + + {{ $item->nama_kategori }} + + @if ($item->foto_kategori) + + @else + - + @endif + + +
+ {{ $item->deskripsi ?? '-' }} +
+ + + + + +
+ @csrf + @method('DELETE') + +
+ + + diff --git a/resources/views/user/index.blade.php b/resources/views/user/index.blade.php index b921a61..ed8d700 100644 --- a/resources/views/user/index.blade.php +++ b/resources/views/user/index.blade.php @@ -8,8 +8,7 @@

Selamat Datang di SIG TPS

Sistem Informasi Geografis Pemetaan Tempat Pembuangan Sampah di Kabupaten Nganjuk

@@ -19,12 +18,11 @@
@@ -60,10 +58,10 @@
-

+

{{ number_format($sampah->total_daur_ulang ?? 0, 2, ',', '.') }} -

-

Total Sampah Didaur Ulang

+ +

Total Sampah Didaur Ulang (ton)

@@ -73,10 +71,10 @@
-

+

{{ number_format($sampah->sisa_sampah ?? 0, 2, ',', '.') }} -

-

Total Sisa Sampah

+ +

Total Sisa Sampah (ton)

@@ -98,54 +96,40 @@
-
-
-

Sistem Informasi Geografis Tempat Pembuangan Sampah di Kabupaten Nganjuk

- -
-
-

Sistem Informasi Geografis yang menampilkan visualisasi lokasi Tempat Pembuangan Sampah di Kabupaten Nganjuk secara mudah, cepat, dan interaktif.

-

Peta Interaktif Lokasi TPS

Peta digital yang memudahkan pengguna menemukan lokasi TPS terdekat, lengkap dengan tampilan yang intuitif sehingga informasi dapat diakses dengan cepat dan jelas.

-

Informasi TPS Lengkap

Menyajikan berbagai informasi penting seperti kapasitas, kondisi, status, hingga jenis pengelolaan TPS, sehingga pengguna dapat memahami keadaan TPS secara menyeluruh.

-

Layanan Aduan TPS

Fitur yang memungkinkan masyarakat menyampaikan keluhan atau laporan terkait TPS dengan mudah, membantu pemerintah dalam memperbaiki serta meningkatkan pengelolaan sampah.

- -
+
-
-
-
@@ -191,7 +175,6 @@

{{ explode('.', $item->deskripsi)[0] }}.

-
@@ -201,266 +184,172 @@
- - {{-- Leaflet CSS & JS --}} - - +
+
- - -
- - -
-

Peta Sebaran TPS

-

Sistem Informasi Geografis Tempat Pembuangan Sampah di Kabupaten Nganjuk

-
- - -
-
-
-
- - - - -
- - -
-

Aduan TPS

-

Laporkan permasalahan Tempat Pembuangan Sampah (TPS) di sekitar Anda

-
- - -
-
- - -
-
-

Temukan Masalah di TPS?

+
+

Pertanyaan yang Sering Diajukan

- Jika Anda menemukan TPS yang penuh, kotor, atau bermasalah, - silakan laporkan agar dapat segera ditindaklanjuti oleh petugas. + Berikut adalah beberapa pertanyaan yang sering diajukan oleh pengguna terkait + informasi, fitur, dan layanan pada website.

- -
- -
-

Cepat & Mudah

-

Aduan dapat dikirim hanya dalam beberapa langkah.

-
-
- -
- -
-

Berbasis Lokasi TPS

-

Pilih TPS langsung dari peta.

-
-
- -
- -
-

Ditanggapi Admin

-

Aduan akan diproses oleh admin terkait.

-
-
-
- -
-
-

Ingin Mengajukan Aduan?

-

- Klik tombol di bawah ini untuk memilih TPS dan mengisi form aduan. -

+
- {{-- - Pilih TPS di Peta - + +
+ +

Apa tujuan utama website ini?

+
+

+ Website ini bertujuan untuk menyediakan informasi yang akurat dan mudah diakses + oleh masyarakat mengenai lokasi dan data Tempat Pembuangan Sampah (TPS). Dengan adanya + website ini, diharapkan masyarakat dapat lebih memahami kondisi + TPS serta mendukung pengelolaan lingkungan yang lebih baik. +

+
+ +
-

atau

--}} + +
+ +

Bagaimana cara melihat peta sebaran TPS?

+
+

+ Peta sebaran TPS dapat dilihat melalui menu Sebaran TPS yang tersedia pada halaman utama + website. Peta tersebut bersifat interaktif dan menampilkan lokasi TPS berdasarkan + wilayah. Pengguna dapat mengklik setiap penanda lokasi untuk melihat detail informasi + seperti alamat TPS dan keterangan tambahan lainnya. +

+ {{--

+ +

--}} +
+ +
+ + +
+ +

Bagaimana cara mengadukan permasalahan TPS?

+
+

+ Pengaduan permasalahan TPS dapat dilakukan melalui menu Aduan TPS yang tersedia + pada website dengan mengisi formulir yang telah disediakan. Laporan yang masuk akan + diteruskan kepada pihak terkait untuk ditindaklanjuti + guna meningkatkan kualitas pengelolaan TPS. +

+
+ +
+ + +
+ +

Apakah website ini dapat diakses melalui perangkat mobile?

+
+

+ Ya, website ini dirancang secara responsif sehingga dapat diakses melalui + berbagai perangkat, termasuk smartphone dan tablet. Tampilan website akan menyesuaikan + ukuran layar perangkat pengguna tanpa + mengurangi fungsi dan informasi yang tersedia. +

+
+ +
- - Laporkan Aduan -
-
+
+
+ +
@endsection diff --git a/routes/web.php b/routes/web.php index 1ba1b8b..4f9c153 100644 --- a/routes/web.php +++ b/routes/web.php @@ -22,10 +22,10 @@ */ Route::get('/', function () { - return view('welcome'); + return view('user.index'); }); -Route::get('/index', [IndexController::class, 'index'])->name('user.index'); +Route::get('/', [IndexController::class, 'index'])->name('user.index'); Route::get('/about', [AboutController::class, 'index'])->name('user.about'); Route::get('/about/{id}', [AboutController::class, 'show'])->name('user.about.kategori'); @@ -37,16 +37,6 @@ Route::get('/kontak', [KontakController::class, 'index'])->name('user.kontak'); -/* -|-------------------------------------------------------------------------- -| ROUTE AUTH (LARAVEL BREEZE) -|-------------------------------------------------------------------------- -| -| Login : /login -| Logout : /logout -| -*/ - require __DIR__.'/auth.php'; /*