crud kelola tps fiks
This commit is contained in:
parent
1f0d13c9ba
commit
343f200e1e
|
|
@ -9,20 +9,19 @@
|
||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*/
|
*/
|
||||||
public function up(): void
|
public function up()
|
||||||
{
|
{
|
||||||
Schema::table('lokasi_tps', function (Blueprint $table) {
|
Schema::table('lokasi_tps', function (Blueprint $table) {
|
||||||
//
|
$table->text('alamat_tps')->nullable()->after('nama_tps');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function down()
|
||||||
* Reverse the migrations.
|
|
||||||
*/
|
|
||||||
public function down(): void
|
|
||||||
{
|
{
|
||||||
Schema::table('lokasi_tps', function (Blueprint $table) {
|
Schema::table('lokasi_tps', function (Blueprint $table) {
|
||||||
//
|
if (Schema::hasColumn('lokasi_tps', 'alamat_tps')) {
|
||||||
|
$table->dropColumn('alamat_tps');
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,15 @@
|
||||||
<!-- endinject -->
|
<!-- endinject -->
|
||||||
<link rel="shortcut icon" href="{{ asset('assets/admin/images/favicon.png') }}" />
|
<link rel="shortcut icon" href="{{ asset('assets/admin/images/favicon.png') }}" />
|
||||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.1/font/bootstrap-icons.css">
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.1/font/bootstrap-icons.css">
|
||||||
|
<link href="https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700&display=swap" rel="stylesheet">
|
||||||
|
|
||||||
|
<style>
|
||||||
|
/* Turunkan icon SweetAlert2 */
|
||||||
|
.swal2-icon {
|
||||||
|
margin-top: 30px !important;
|
||||||
|
margin-bottom: 10px !important;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
|
|
@ -28,10 +37,10 @@
|
||||||
<div class="container-scroller">
|
<div class="container-scroller">
|
||||||
<nav class="navbar col-lg-12 col-12 p-0 fixed-top d-flex flex-row">
|
<nav class="navbar col-lg-12 col-12 p-0 fixed-top d-flex flex-row">
|
||||||
<div class="text-center navbar-brand-wrapper d-flex align-items-center justify-content-center">
|
<div class="text-center navbar-brand-wrapper d-flex align-items-center justify-content-center">
|
||||||
<a class="navbar-brand brand-logo mr-5" href="index.html"><img src="{{ asset('assets/admin/images/logo.svg') }}" class="mr-2"
|
<a class="navbar-brand brand-logo mr-5" href="index.html"><img
|
||||||
alt="logo" /></a>
|
src="{{ asset('assets/admin/images/logo.svg') }}" class="mr-2" alt="logo" /></a>
|
||||||
<a class="navbar-brand brand-logo-mini" href="index.html"><img src="{{ asset('assets/admin/images/logo-mini.svg') }}"
|
<a class="navbar-brand brand-logo-mini" href="index.html"><img
|
||||||
alt="logo" /></a>
|
src="{{ asset('assets/admin/images/logo-mini.svg') }}" alt="logo" /></a>
|
||||||
</div>
|
</div>
|
||||||
<div class="navbar-menu-wrapper d-flex align-items-center justify-content-end">
|
<div class="navbar-menu-wrapper d-flex align-items-center justify-content-end">
|
||||||
<button class="navbar-toggler navbar-toggler align-self-center" type="button" data-toggle="minimize">
|
<button class="navbar-toggler navbar-toggler align-self-center" type="button" data-toggle="minimize">
|
||||||
|
|
@ -74,7 +83,7 @@
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link" href="{{ route('admin.kategori.index') }}">
|
<a class="nav-link" href="{{ route('admin.kategori.index') }}">
|
||||||
<i class="icon-paper menu-icon"></i>
|
<i class="icon-paper menu-icon"></i>
|
||||||
<span class="menu-title">Kategori TPS</span>
|
<span class="menu-title">Kategori TPS</span>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
@ -239,6 +248,7 @@
|
||||||
<script src="{{ asset('assets/admin/js/Chart.roundedBarCharts.js') }}"></script>
|
<script src="{{ asset('assets/admin/js/Chart.roundedBarCharts.js') }}"></script>
|
||||||
<script src="{{ asset('assets/admin/vendors/js/vendor.bundle.base.js') }}"></script>
|
<script src="{{ asset('assets/admin/vendors/js/vendor.bundle.base.js') }}"></script>
|
||||||
<script src="{{ asset('assets/admin/js/file-upload.js') }}"></script>
|
<script src="{{ asset('assets/admin/js/file-upload.js') }}"></script>
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
||||||
|
|
||||||
<!-- End custom js for this page-->
|
<!-- End custom js for this page-->
|
||||||
</body>
|
</body>
|
||||||
|
|
|
||||||
|
|
@ -1,95 +1,103 @@
|
||||||
@extends('admin.template')
|
@extends('admin.template')
|
||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
<div class="content-wrapper">
|
<div class="content-wrapper">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12 grid-margin stretch-card">
|
<div class="col-12 grid-margin stretch-card">
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<h4 class="card-title">Tambah TPS</h4>
|
<h4 class="card-title">Tambah TPS</h4>
|
||||||
<p class="card-description">Form tambah data TPS</p>
|
<p class="card-description">Form tambah data TPS</p>
|
||||||
|
|
||||||
<form action="{{ route('admin.tps.store') }}" method="POST" enctype="multipart/form-data">
|
<form action="{{ route('admin.tps.store') }}" method="POST" enctype="multipart/form-data">
|
||||||
@csrf
|
@csrf
|
||||||
|
|
||||||
<!-- NAMA TPS -->
|
<!-- NAMA TPS -->
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>Nama TPS</label>
|
<label>Nama TPS</label>
|
||||||
<input type="text" name="nama_tps" class="form-control"
|
<input type="text" name="nama_tps" class="form-control" placeholder="Nama TPS" required>
|
||||||
placeholder="Nama TPS" required>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>Alamat</label>
|
<label>Alamat</label>
|
||||||
<input type="text" name="alamat" class="form-control"
|
<input type="text" name="alamat_tps" class="form-control" placeholder="Alamat TPS"
|
||||||
placeholder="Alamat TPS" required>
|
required>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- KATEGORI TPS -->
|
<!-- KATEGORI TPS -->
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>Kategori TPS</label>
|
<label>Kategori TPS</label>
|
||||||
<select name="kategori_tps_id" class="form-control" required>
|
<select name="kategori_tps_id" class="form-control" required>
|
||||||
<option value="">Pilih Kategori</option>
|
<option value="">Pilih Kategori</option>
|
||||||
@foreach ($kategori as $item)
|
@foreach ($kategori as $item)
|
||||||
<option value="{{ $item->id }}">
|
<option value="{{ $item->id }}">
|
||||||
{{ $item->nama_kategori }}
|
{{ $item->nama_kategori }}
|
||||||
</option>
|
</option>
|
||||||
@endforeach
|
@endforeach
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- TAHUN -->
|
<!-- TAHUN -->
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>Tahun Pembuatan</label>
|
<label>Tahun Pembuatan</label>
|
||||||
<input type="number" name="tahun_pembuatan" class="form-control"
|
<input type="number" name="tahun_pembuatan" class="form-control"
|
||||||
placeholder="Tahun Pembuatan" required>
|
placeholder="Tahun Pembuatan" required>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- KAPASITAS -->
|
<!-- KAPASITAS -->
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>Kapasitas</label>
|
<label>Kapasitas</label>
|
||||||
<input type="text" name="kapasitas_tps" class="form-control"
|
<input type="text" name="kapasitas_tps" class="form-control" placeholder="Kapasitas TPS"
|
||||||
placeholder="Kapasitas TPS" required>
|
required>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- STATUS -->
|
<!-- STATUS -->
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>Status</label>
|
<label>Status</label>
|
||||||
<select name="status_tps" class="form-control" required>
|
<select name="status_tps" class="form-control" required>
|
||||||
<option value="Aktif">Aktif</option>
|
<option value="Aktif">Aktif</option>
|
||||||
<option value="Non-Aktif">Non-Aktif</option>
|
<option value="Non-Aktif">Non-Aktif</option>
|
||||||
<option value="Pembangunan">Pembangunan</option>
|
<option value="Pembangunan">Pembangunan</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- LATITUDE -->
|
<!-- LATITUDE -->
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>Latitude</label>
|
<label>Latitude</label>
|
||||||
<input type="text" name="latitude" class="form-control"
|
<input type="text" name="latitude" class="form-control" placeholder="Latitude" required>
|
||||||
placeholder="Latitude" required>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- LONGITUDE -->
|
<!-- LONGITUDE -->
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>Longitude</label>
|
<label>Longitude</label>
|
||||||
<input type="text" name="longitude" class="form-control"
|
<input type="text" name="longitude" class="form-control" placeholder="Longitude"
|
||||||
placeholder="Longitude" required>
|
required>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- FOTO -->
|
<!-- FOTO -->
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>Foto TPS</label>
|
<label>Foto TPS</label>
|
||||||
<input type="file" name="foto_tps"
|
|
||||||
class="form-control" accept="image/*">
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<button type="submit" class="btn btn-primary mr-2">Simpan</button>
|
<input type="file" name="foto_tps" id="foto_tps" class="file-upload-default">
|
||||||
<a href="{{ route('admin.tps.index') }}" class="btn btn-light">Batal</a>
|
|
||||||
</form>
|
|
||||||
|
|
||||||
|
<div class="input-group col-xs-12">
|
||||||
|
<input type="text" class="form-control file-upload-info" disabled
|
||||||
|
placeholder="Upload Foto">
|
||||||
|
<span class="input-group-append">
|
||||||
|
<button class="file-upload-browse btn btn-primary" type="button">
|
||||||
|
Upload
|
||||||
|
</button>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<button type="submit" class="btn btn-primary mr-2">Simpan</button>
|
||||||
|
<a href="{{ route('admin.tps.index') }}" class="btn btn-light">Batal</a>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
@endsection
|
@endsection
|
||||||
|
|
|
||||||
|
|
@ -1,134 +1,134 @@
|
||||||
@extends('admin.template')
|
@extends('admin.template')
|
||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
<div class="content-wrapper">
|
<div class="content-wrapper">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12 grid-margin stretch-card">
|
<div class="col-12 grid-margin stretch-card">
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<h4 class="card-title">Edit TPS</h4>
|
<h4 class="card-title">Edit TPS</h4>
|
||||||
<p class="card-description">
|
<p class="card-description">
|
||||||
Form edit data Tempat Pembuangan Sampah
|
Form edit data Tempat Pembuangan Sampah
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<form action="{{ route('admin.tps.update', $tps->id) }}"
|
<form action="{{ route('admin.tps.update', $tps->id) }}" method="POST" enctype="multipart/form-data"
|
||||||
method="POST"
|
class="forms-sample">
|
||||||
enctype="multipart/form-data"
|
@csrf
|
||||||
class="forms-sample">
|
@method('PUT')
|
||||||
@csrf
|
|
||||||
@method('PUT')
|
|
||||||
|
|
||||||
{{-- Nama TPS --}}
|
{{-- Nama TPS --}}
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>Nama TPS</label>
|
<label>Nama TPS</label>
|
||||||
<input type="text"
|
<input type="text" name="nama_tps" class="form-control"
|
||||||
name="nama_tps"
|
value="{{ old('nama_tps', $tps->nama_tps) }}" required>
|
||||||
class="form-control"
|
|
||||||
value="{{ old('nama_tps', $tps->nama_tps) }}"
|
|
||||||
required>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{{-- Alamat --}}
|
|
||||||
<div class="form-group">
|
|
||||||
<label>Alamat</label>
|
|
||||||
<input type="text"
|
|
||||||
name="alamat"
|
|
||||||
class="form-control"
|
|
||||||
value="{{ old('alamat', $tps->alamat) }}">
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{{-- Kategori TPS --}}
|
|
||||||
<div class="form-group">
|
|
||||||
<label>Kategori TPS</label>
|
|
||||||
<select name="kategori_tps_id" class="form-control" required>
|
|
||||||
<option value="">-- Pilih Kategori --</option>
|
|
||||||
@foreach($kategori as $item)
|
|
||||||
<option value="{{ $item->id }}"
|
|
||||||
{{ $tps->kategori_tps_id == $item->id ? 'selected' : '' }}>
|
|
||||||
{{ $item->nama_kategori }}
|
|
||||||
</option>
|
|
||||||
@endforeach
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{{-- Status TPS --}}
|
|
||||||
<div class="form-group">
|
|
||||||
<label>Status TPS</label>
|
|
||||||
<select name="status_tps" class="form-control" required>
|
|
||||||
<option value="">-- Pilih Status --</option>
|
|
||||||
<option value="Aktif"
|
|
||||||
{{ old('status_tps', $tps->status_tps) == 'Aktif' ? 'selected' : '' }}>
|
|
||||||
Aktif
|
|
||||||
</option>
|
|
||||||
<option value="Tidak Aktif"
|
|
||||||
{{ old('status_tps', $tps->status_tps) == 'Tidak Aktif' ? 'selected' : '' }}>
|
|
||||||
Tidak Aktif
|
|
||||||
</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{{-- Latitude --}}
|
|
||||||
<div class="form-group">
|
|
||||||
<label>Latitude</label>
|
|
||||||
<input type="text"
|
|
||||||
name="latitude"
|
|
||||||
class="form-control"
|
|
||||||
value="{{ old('latitude', $tps->latitude) }}">
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{{-- Longitude --}}
|
|
||||||
<div class="form-group">
|
|
||||||
<label>Longitude</label>
|
|
||||||
<input type="text"
|
|
||||||
name="longitude"
|
|
||||||
class="form-control"
|
|
||||||
value="{{ old('longitude', $tps->longitude) }}">
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{{-- Foto TPS --}}
|
|
||||||
<div class="form-group">
|
|
||||||
<label>Foto TPS</label>
|
|
||||||
|
|
||||||
<input type="file"
|
|
||||||
name="foto_tps"
|
|
||||||
class="file-upload-default">
|
|
||||||
|
|
||||||
<div class="input-group col-xs-12">
|
|
||||||
<input type="text"
|
|
||||||
class="form-control file-upload-info"
|
|
||||||
disabled
|
|
||||||
placeholder="Upload Foto TPS">
|
|
||||||
<span class="input-group-append">
|
|
||||||
<button class="file-upload-browse btn btn-primary"
|
|
||||||
type="button">
|
|
||||||
Upload
|
|
||||||
</button>
|
|
||||||
</span>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{-- Foto Lama --}}
|
{{-- Alamat --}}
|
||||||
@if($tps->foto_tps)
|
<div class="form-group">
|
||||||
<div class="mt-2">
|
<label>Alamat</label>
|
||||||
<img src="{{ asset('storage/'.$tps->foto_tps) }}"
|
<input type="text" name="alamat_tps" class="form-control"
|
||||||
width="120"
|
value="{{ old('alamat_tps', $tps->alamat_tps) }}">
|
||||||
class="img-thumbnail">
|
</div>
|
||||||
|
|
||||||
|
{{-- Kategori TPS --}}
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Kategori TPS</label>
|
||||||
|
<select name="kategori_tps_id" class="form-control" required>
|
||||||
|
<option value="">-- Pilih Kategori --</option>
|
||||||
|
@foreach ($kategori as $item)
|
||||||
|
<option value="{{ $item->id }}"
|
||||||
|
{{ $tps->kategori_tps_id == $item->id ? 'selected' : '' }}>
|
||||||
|
{{ $item->nama_kategori }}
|
||||||
|
</option>
|
||||||
|
@endforeach
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{-- Tahun Pembuatan --}}
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Tahun Pembuatan</label>
|
||||||
|
<input type="number" name="tahun_pembuatan" class="form-control"
|
||||||
|
value="{{ old('tahun_pembuatan', $tps->tahun_pembuatan) }}" required>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{-- Kapasitas TPS --}}
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Kapasitas TPS</label>
|
||||||
|
<input type="text" name="kapasitas_tps" class="form-control"
|
||||||
|
value="{{ old('kapasitas_tps', $tps->kapasitas_tps) }}" required>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{-- Status TPS --}}
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Status TPS</label>
|
||||||
|
<select name="status_tps" class="form-control" required>
|
||||||
|
<option value="Aktif"
|
||||||
|
{{ old('status_tps', $tps->status_tps) == 'Aktif' ? 'selected' : '' }}>
|
||||||
|
Aktif
|
||||||
|
</option>
|
||||||
|
<option value="Tidak Aktif"
|
||||||
|
{{ old('status_tps', $tps->status_tps) == 'Tidak Aktif' ? 'selected' : '' }}>
|
||||||
|
Tidak Aktif
|
||||||
|
</option>
|
||||||
|
<option value="Pembangunan"
|
||||||
|
{{ old('status_tps', $tps->status_tps) == 'Pembangunan' ? 'selected' : '' }}>
|
||||||
|
Pembangunan
|
||||||
|
</option>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{-- Latitude --}}
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Latitude</label>
|
||||||
|
<input type="text" name="latitude" class="form-control"
|
||||||
|
value="{{ old('latitude', $tps->latitude) }}">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{-- Longitude --}}
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Longitude</label>
|
||||||
|
<input type="text" name="longitude" class="form-control"
|
||||||
|
value="{{ old('longitude', $tps->longitude) }}">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{-- Foto TPS --}}
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Foto TPS</label>
|
||||||
|
|
||||||
|
<input type="file" name="foto_tps" class="file-upload-default">
|
||||||
|
|
||||||
|
<div class="input-group col-xs-12">
|
||||||
|
<input type="text" class="form-control file-upload-info" disabled
|
||||||
|
placeholder="Upload Foto TPS">
|
||||||
|
<span class="input-group-append">
|
||||||
|
<button class="file-upload-browse btn btn-primary" type="button">
|
||||||
|
Upload
|
||||||
|
</button>
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
@endif
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{{-- Button --}}
|
{{-- Foto Lama --}}
|
||||||
<button type="submit" class="btn btn-primary mr-2">
|
@if ($tps->foto_tps)
|
||||||
Simpan Perubahan
|
<div class="mt-2">
|
||||||
</button>
|
<img src="{{ asset('storage/' . $tps->foto_tps) }}" width="250"
|
||||||
<a href="{{ route('admin.tps.index') }}"
|
class="img-thumbnail">
|
||||||
class="btn btn-light">
|
</div>
|
||||||
Batal
|
@endif
|
||||||
</a>
|
</div>
|
||||||
|
|
||||||
</form>
|
{{-- Button --}}
|
||||||
|
<button type="submit" class="btn btn-primary mr-2">
|
||||||
|
Simpan
|
||||||
|
</button>
|
||||||
|
<a href="{{ route('admin.tps.index') }}" class="btn btn-light">
|
||||||
|
Batal
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
@endsection
|
@endsection
|
||||||
|
|
|
||||||
|
|
@ -1,104 +1,146 @@
|
||||||
@extends('admin.template')
|
@extends('admin.template')
|
||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
<div class="content-wrapper">
|
<div class="content-wrapper">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-lg-12 grid-margin stretch-card">
|
<div class="col-lg-12 grid-margin stretch-card">
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
|
|
||||||
<div class="d-flex justify-content-between align-items-center mb-3">
|
<div class="d-flex justify-content-between align-items-center mb-3">
|
||||||
<div>
|
<div>
|
||||||
<h4 class="card-title mb-0">Data TPS</h4>
|
<h4 class="card-title mb-0">Data TPS</h4>
|
||||||
<p class="card-description mb-0">
|
<p class="card-description mb-0">
|
||||||
Daftar Tempat Pengelolaan Sampah (TPS)
|
Daftar Tempat Pengelolaan Sampah (TPS)
|
||||||
</p>
|
</p>
|
||||||
|
</div>
|
||||||
|
<a href="{{ route('admin.tps.create') }}" class="btn btn-primary">
|
||||||
|
<i class="bi bi-plus-lg"></i> Tambah
|
||||||
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<a href="{{ route('admin.tps.create') }}" class="btn btn-primary">
|
|
||||||
<i class="bi bi-plus-lg"></i> Tambah
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
<table class="table">
|
<table class="table">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
|
||||||
<th>Nama TPS</th>
|
|
||||||
<th>Kategori</th>
|
|
||||||
<th>Foto</th>
|
|
||||||
<th>Status</th>
|
|
||||||
<th>Aksi</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
|
|
||||||
@forelse ($tps as $item)
|
|
||||||
<tr>
|
<tr>
|
||||||
<!-- NAMA -->
|
<th>Nama TPS</th>
|
||||||
<td>{{ $item->nama_tps }}</td>
|
<th>Kategori</th>
|
||||||
|
<th>Foto</th>
|
||||||
<!-- KATEGORI -->
|
<th>Status</th>
|
||||||
<td>
|
<th>Aksi</th>
|
||||||
{{ $item->kategori->nama_kategori ?? '-' }}
|
|
||||||
</td>
|
|
||||||
|
|
||||||
<!-- FOTO -->
|
|
||||||
<td>
|
|
||||||
@if ($item->foto_tps)
|
|
||||||
<img src="{{ asset('storage/' . $item->foto_tps) }}"
|
|
||||||
alt="Foto TPS"
|
|
||||||
height="60"
|
|
||||||
style="border-radius:6px">
|
|
||||||
@else
|
|
||||||
<span class="text-muted">-</span>
|
|
||||||
@endif
|
|
||||||
</td>
|
|
||||||
|
|
||||||
<!-- STATUS -->
|
|
||||||
<td>
|
|
||||||
@if ($item->status_tps == 'Aktif')
|
|
||||||
<label class="badge badge-success">Aktif</label>
|
|
||||||
@elseif ($item->status_tps == 'Non-Aktif')
|
|
||||||
<label class="badge badge-secondary">Non-Aktif</label>
|
|
||||||
@else
|
|
||||||
<label class="badge badge-warning">Pembangunan</label>
|
|
||||||
@endif
|
|
||||||
</td>
|
|
||||||
|
|
||||||
<!-- AKSI -->
|
|
||||||
<td class="text-center">
|
|
||||||
<a href="{{ route('admin.tps.edit', $item->id) }}"
|
|
||||||
class="btn btn-warning btn-sm me-1">
|
|
||||||
<i class="bi bi-pencil-square"></i>
|
|
||||||
</a>
|
|
||||||
|
|
||||||
<form action="{{ route('admin.tps.destroy', $item->id) }}"
|
|
||||||
method="POST"
|
|
||||||
style="display:inline;">
|
|
||||||
@csrf
|
|
||||||
@method('DELETE')
|
|
||||||
<button class="btn btn-danger btn-sm"
|
|
||||||
onclick="return confirm('Yakin ingin menghapus data ini?')">
|
|
||||||
<i class="bi bi-trash"></i>
|
|
||||||
</button>
|
|
||||||
</form>
|
|
||||||
</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
@empty
|
</thead>
|
||||||
<tr>
|
<tbody>
|
||||||
<td colspan="5" class="text-center">
|
|
||||||
Data TPS belum tersedia
|
@forelse ($tps as $item)
|
||||||
</td>
|
<tr>
|
||||||
</tr>
|
<!-- NAMA -->
|
||||||
@endforelse
|
<td>{{ $item->nama_tps }}</td>
|
||||||
|
|
||||||
|
<!-- KATEGORI -->
|
||||||
|
<td>
|
||||||
|
{{ $item->kategori->nama_kategori ?? '-' }}
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<!-- FOTO -->
|
||||||
|
<td>
|
||||||
|
@if ($item->foto_tps)
|
||||||
|
<img src="{{ asset('storage/' . $item->foto_tps) }}" alt="Foto TPS"
|
||||||
|
style="
|
||||||
|
width:200px;
|
||||||
|
height:auto;
|
||||||
|
border-radius:2px;
|
||||||
|
">
|
||||||
|
@else
|
||||||
|
<span class="text-muted">-</span>
|
||||||
|
@endif
|
||||||
|
</td>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- STATUS -->
|
||||||
|
<td>
|
||||||
|
@if ($item->status_tps == 'Aktif')
|
||||||
|
<label class="badge badge-success">Aktif</label>
|
||||||
|
@elseif ($item->status_tps == 'Tidak Aktif')
|
||||||
|
<label class="badge badge-secondary">Tidak Aktif</label>
|
||||||
|
@else
|
||||||
|
<label class="badge badge-warning">Pembangunan</label>
|
||||||
|
@endif
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<!-- AKSI -->
|
||||||
|
<td class="text-center">
|
||||||
|
<a href="{{ route('admin.tps.edit', $item->id) }}"
|
||||||
|
class="btn btn-warning btn-sm me-1">
|
||||||
|
<i class="bi bi-pencil-square"></i>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<form action="{{ route('admin.tps.destroy', $item->id) }}" method="POST"
|
||||||
|
class="form-hapus" style="display:inline;">
|
||||||
|
@csrf
|
||||||
|
@method('DELETE')
|
||||||
|
<button type="submit" class="btn btn-danger btn-sm">
|
||||||
|
<i class="bi bi-trash"></i>
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
@empty
|
||||||
|
<tr>
|
||||||
|
<td colspan="5" class="text-center">
|
||||||
|
Data TPS belum tersedia
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
@endforelse
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
<script>
|
||||||
|
document.querySelectorAll('.form-hapus').forEach(form => {
|
||||||
|
form.addEventListener('submit', function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
|
||||||
|
Swal.fire({
|
||||||
|
title: 'Hapus Data TPS?',
|
||||||
|
text: 'Data yang sudah dihapus tidak dapat dikembalikan!',
|
||||||
|
icon: 'warning',
|
||||||
|
showCancelButton: true,
|
||||||
|
confirmButtonColor: '#d33',
|
||||||
|
cancelButtonColor: '#6c757d',
|
||||||
|
confirmButtonText: 'Ya, Hapus',
|
||||||
|
cancelButtonText: 'Batal',
|
||||||
|
didOpen: () => {
|
||||||
|
document.querySelector('.swal2-popup').style.fontFamily =
|
||||||
|
'Nunito, sans-serif';
|
||||||
|
}
|
||||||
|
}).then((result) => {
|
||||||
|
if (result.isConfirmed) {
|
||||||
|
form.submit();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
@if (session('success'))
|
||||||
|
<script>
|
||||||
|
Swal.fire({
|
||||||
|
icon: 'success',
|
||||||
|
title: 'Berhasil',
|
||||||
|
text: '{{ session('success') }}',
|
||||||
|
timer: 2000,
|
||||||
|
showConfirmButton: false
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
@endif
|
||||||
@endsection
|
@endsection
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue