From 343f200e1eadfeadff10f87506b79d23598076fc Mon Sep 17 00:00:00 2001 From: rahmagustin Date: Mon, 12 Jan 2026 20:59:12 +0700 Subject: [PATCH] crud kelola tps fiks --- ...247_add_alamat_tps_to_lokasi_tps_table.php | 13 +- resources/views/admin/template.blade.php | 20 +- resources/views/admin/tps/create.blade.php | 158 ++++++------ resources/views/admin/tps/edit.blade.php | 238 +++++++++--------- resources/views/admin/tps/index.blade.php | 220 +++++++++------- 5 files changed, 354 insertions(+), 295 deletions(-) diff --git a/database/migrations/2026_01_10_150247_add_alamat_tps_to_lokasi_tps_table.php b/database/migrations/2026_01_10_150247_add_alamat_tps_to_lokasi_tps_table.php index 68a3e20..67c603a 100644 --- a/database/migrations/2026_01_10_150247_add_alamat_tps_to_lokasi_tps_table.php +++ b/database/migrations/2026_01_10_150247_add_alamat_tps_to_lokasi_tps_table.php @@ -9,20 +9,19 @@ /** * Run the migrations. */ - public function up(): void + public function up() { Schema::table('lokasi_tps', function (Blueprint $table) { - // + $table->text('alamat_tps')->nullable()->after('nama_tps'); }); } - /** - * Reverse the migrations. - */ - public function down(): void + public function down() { Schema::table('lokasi_tps', function (Blueprint $table) { - // + if (Schema::hasColumn('lokasi_tps', 'alamat_tps')) { + $table->dropColumn('alamat_tps'); + } }); } }; diff --git a/resources/views/admin/template.blade.php b/resources/views/admin/template.blade.php index 4bfb70b..1cac8c1 100644 --- a/resources/views/admin/template.blade.php +++ b/resources/views/admin/template.blade.php @@ -21,6 +21,15 @@ + + + @@ -28,10 +37,10 @@
- @endsection diff --git a/resources/views/admin/tps/edit.blade.php b/resources/views/admin/tps/edit.blade.php index 073ff20..3ec7801 100644 --- a/resources/views/admin/tps/edit.blade.php +++ b/resources/views/admin/tps/edit.blade.php @@ -1,134 +1,134 @@ @extends('admin.template') @section('content') -
-
-
-
-
-

Edit TPS

-

- Form edit data Tempat Pembuangan Sampah -

+
+
+
+
+
+

Edit TPS

+

+ Form edit data Tempat Pembuangan Sampah +

-
- @csrf - @method('PUT') + + @csrf + @method('PUT') - {{-- Nama TPS --}} -
- - -
- - {{-- Alamat --}} -
- - -
- - {{-- Kategori TPS --}} -
- - -
- - {{-- Status TPS --}} -
- - -
- - {{-- Latitude --}} -
- - -
- - {{-- Longitude --}} -
- - -
- - {{-- Foto TPS --}} -
- - - - -
- - - - + {{-- Nama TPS --}} +
+ +
- {{-- Foto Lama --}} - @if($tps->foto_tps) -
- + {{-- Alamat --}} +
+ + +
+ + {{-- Kategori TPS --}} +
+ + +
+ + {{-- Tahun Pembuatan --}} +
+ + +
+ + {{-- Kapasitas TPS --}} +
+ + +
+ + {{-- Status TPS --}} +
+ + + +
+ + {{-- Latitude --}} +
+ + +
+ + {{-- Longitude --}} +
+ + +
+ + {{-- Foto TPS --}} +
+ + + + +
+ + + +
- @endif -
- {{-- Button --}} - - - Batal - + {{-- Foto Lama --}} + @if ($tps->foto_tps) +
+ +
+ @endif +
- + {{-- Button --}} + + + Batal + + + +
-
@endsection diff --git a/resources/views/admin/tps/index.blade.php b/resources/views/admin/tps/index.blade.php index b119b95..6577159 100644 --- a/resources/views/admin/tps/index.blade.php +++ b/resources/views/admin/tps/index.blade.php @@ -1,104 +1,146 @@ @extends('admin.template') @section('content') -
-
-
-
-
+
+
+
+
+
-
-
-

Data TPS

-

- Daftar Tempat Pengelolaan Sampah (TPS) -

+
+
+

Data TPS

+

+ Daftar Tempat Pengelolaan Sampah (TPS) +

+
+ + Tambah +
- - Tambah - -
-
- - - - - - - - - - - - - @forelse ($tps as $item) +
+
Nama TPSKategoriFotoStatusAksi
+ - - - - - - - - - - - - - - + + + + + - @empty - - - - @endforelse + + + + @forelse ($tps as $item) + + + + + + + + + + + + + + + + + + @empty + + + + @endforelse + + +
{{ $item->nama_tps }} - {{ $item->kategori->nama_kategori ?? '-' }} - - @if ($item->foto_tps) - Foto TPS - @else - - - @endif - - @if ($item->status_tps == 'Aktif') - - @elseif ($item->status_tps == 'Non-Aktif') - - @else - - @endif - - - - - -
- @csrf - @method('DELETE') - -
-
Nama TPSKategoriFotoStatusAksi
- Data TPS belum tersedia -
{{ $item->nama_tps }} + {{ $item->kategori->nama_kategori ?? '-' }} + + @if ($item->foto_tps) + Foto TPS + @else + - + @endif + + @if ($item->status_tps == 'Aktif') + + @elseif ($item->status_tps == 'Tidak Aktif') + + @else + + @endif + + + + + +
+ @csrf + @method('DELETE') + +
+ +
+ Data TPS belum tersedia +
+
- -
-
-
+ + + + + @if (session('success')) + + @endif @endsection