crud kelola tps fiks
This commit is contained in:
parent
1f0d13c9ba
commit
343f200e1e
|
|
@ -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');
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -21,6 +21,15 @@
|
|||
<!-- endinject -->
|
||||
<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 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>
|
||||
|
||||
|
|
@ -28,10 +37,10 @@
|
|||
<div class="container-scroller">
|
||||
<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">
|
||||
<a class="navbar-brand brand-logo mr-5" href="index.html"><img 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') }}"
|
||||
alt="logo" /></a>
|
||||
<a class="navbar-brand brand-logo mr-5" href="index.html"><img
|
||||
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') }}" alt="logo" /></a>
|
||||
</div>
|
||||
<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">
|
||||
|
|
@ -74,7 +83,7 @@
|
|||
</li>
|
||||
<li class="nav-item">
|
||||
<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>
|
||||
</a>
|
||||
</li>
|
||||
|
|
@ -239,6 +248,7 @@
|
|||
<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/js/file-upload.js') }}"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
||||
|
||||
<!-- End custom js for this page-->
|
||||
</body>
|
||||
|
|
|
|||
|
|
@ -1,95 +1,103 @@
|
|||
@extends('admin.template')
|
||||
|
||||
@section('content')
|
||||
<div class="content-wrapper">
|
||||
<div class="row">
|
||||
<div class="col-12 grid-margin stretch-card">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h4 class="card-title">Tambah TPS</h4>
|
||||
<p class="card-description">Form tambah data TPS</p>
|
||||
<div class="content-wrapper">
|
||||
<div class="row">
|
||||
<div class="col-12 grid-margin stretch-card">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h4 class="card-title">Tambah TPS</h4>
|
||||
<p class="card-description">Form tambah data TPS</p>
|
||||
|
||||
<form action="{{ route('admin.tps.store') }}" method="POST" enctype="multipart/form-data">
|
||||
@csrf
|
||||
<form action="{{ route('admin.tps.store') }}" method="POST" enctype="multipart/form-data">
|
||||
@csrf
|
||||
|
||||
<!-- NAMA TPS -->
|
||||
<div class="form-group">
|
||||
<label>Nama TPS</label>
|
||||
<input type="text" name="nama_tps" class="form-control"
|
||||
placeholder="Nama TPS" required>
|
||||
</div>
|
||||
<!-- NAMA TPS -->
|
||||
<div class="form-group">
|
||||
<label>Nama TPS</label>
|
||||
<input type="text" name="nama_tps" class="form-control" placeholder="Nama TPS" required>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Alamat</label>
|
||||
<input type="text" name="alamat" class="form-control"
|
||||
placeholder="Alamat TPS" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Alamat</label>
|
||||
<input type="text" name="alamat_tps" class="form-control" placeholder="Alamat TPS"
|
||||
required>
|
||||
</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 }}">
|
||||
{{ $item->nama_kategori }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</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 }}">
|
||||
{{ $item->nama_kategori }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<!-- TAHUN -->
|
||||
<div class="form-group">
|
||||
<label>Tahun Pembuatan</label>
|
||||
<input type="number" name="tahun_pembuatan" class="form-control"
|
||||
placeholder="Tahun Pembuatan" required>
|
||||
</div>
|
||||
<!-- TAHUN -->
|
||||
<div class="form-group">
|
||||
<label>Tahun Pembuatan</label>
|
||||
<input type="number" name="tahun_pembuatan" class="form-control"
|
||||
placeholder="Tahun Pembuatan" required>
|
||||
</div>
|
||||
|
||||
<!-- KAPASITAS -->
|
||||
<div class="form-group">
|
||||
<label>Kapasitas</label>
|
||||
<input type="text" name="kapasitas_tps" class="form-control"
|
||||
placeholder="Kapasitas TPS" required>
|
||||
</div>
|
||||
<!-- KAPASITAS -->
|
||||
<div class="form-group">
|
||||
<label>Kapasitas</label>
|
||||
<input type="text" name="kapasitas_tps" class="form-control" placeholder="Kapasitas TPS"
|
||||
required>
|
||||
</div>
|
||||
|
||||
<!-- STATUS -->
|
||||
<div class="form-group">
|
||||
<label>Status</label>
|
||||
<select name="status_tps" class="form-control" required>
|
||||
<option value="Aktif">Aktif</option>
|
||||
<option value="Non-Aktif">Non-Aktif</option>
|
||||
<option value="Pembangunan">Pembangunan</option>
|
||||
</select>
|
||||
</div>
|
||||
<!-- STATUS -->
|
||||
<div class="form-group">
|
||||
<label>Status</label>
|
||||
<select name="status_tps" class="form-control" required>
|
||||
<option value="Aktif">Aktif</option>
|
||||
<option value="Non-Aktif">Non-Aktif</option>
|
||||
<option value="Pembangunan">Pembangunan</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<!-- LATITUDE -->
|
||||
<div class="form-group">
|
||||
<label>Latitude</label>
|
||||
<input type="text" name="latitude" class="form-control"
|
||||
placeholder="Latitude" required>
|
||||
</div>
|
||||
<!-- LATITUDE -->
|
||||
<div class="form-group">
|
||||
<label>Latitude</label>
|
||||
<input type="text" name="latitude" class="form-control" placeholder="Latitude" required>
|
||||
</div>
|
||||
|
||||
<!-- LONGITUDE -->
|
||||
<div class="form-group">
|
||||
<label>Longitude</label>
|
||||
<input type="text" name="longitude" class="form-control"
|
||||
placeholder="Longitude" required>
|
||||
</div>
|
||||
<!-- LONGITUDE -->
|
||||
<div class="form-group">
|
||||
<label>Longitude</label>
|
||||
<input type="text" name="longitude" class="form-control" placeholder="Longitude"
|
||||
required>
|
||||
</div>
|
||||
|
||||
<!-- FOTO -->
|
||||
<div class="form-group">
|
||||
<label>Foto TPS</label>
|
||||
<input type="file" name="foto_tps"
|
||||
class="form-control" accept="image/*">
|
||||
</div>
|
||||
<!-- FOTO -->
|
||||
<div class="form-group">
|
||||
<label>Foto TPS</label>
|
||||
|
||||
<button type="submit" class="btn btn-primary mr-2">Simpan</button>
|
||||
<a href="{{ route('admin.tps.index') }}" class="btn btn-light">Batal</a>
|
||||
</form>
|
||||
<input type="file" name="foto_tps" id="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">
|
||||
<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>
|
||||
@endsection
|
||||
|
|
|
|||
|
|
@ -1,134 +1,134 @@
|
|||
@extends('admin.template')
|
||||
|
||||
@section('content')
|
||||
<div class="content-wrapper">
|
||||
<div class="row">
|
||||
<div class="col-12 grid-margin stretch-card">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h4 class="card-title">Edit TPS</h4>
|
||||
<p class="card-description">
|
||||
Form edit data Tempat Pembuangan Sampah
|
||||
</p>
|
||||
<div class="content-wrapper">
|
||||
<div class="row">
|
||||
<div class="col-12 grid-margin stretch-card">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h4 class="card-title">Edit TPS</h4>
|
||||
<p class="card-description">
|
||||
Form edit data Tempat Pembuangan Sampah
|
||||
</p>
|
||||
|
||||
<form action="{{ route('admin.tps.update', $tps->id) }}"
|
||||
method="POST"
|
||||
enctype="multipart/form-data"
|
||||
class="forms-sample">
|
||||
@csrf
|
||||
@method('PUT')
|
||||
<form action="{{ route('admin.tps.update', $tps->id) }}" method="POST" enctype="multipart/form-data"
|
||||
class="forms-sample">
|
||||
@csrf
|
||||
@method('PUT')
|
||||
|
||||
{{-- Nama TPS --}}
|
||||
<div class="form-group">
|
||||
<label>Nama TPS</label>
|
||||
<input type="text"
|
||||
name="nama_tps"
|
||||
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>
|
||||
{{-- Nama TPS --}}
|
||||
<div class="form-group">
|
||||
<label>Nama TPS</label>
|
||||
<input type="text" name="nama_tps" class="form-control"
|
||||
value="{{ old('nama_tps', $tps->nama_tps) }}" required>
|
||||
</div>
|
||||
|
||||
{{-- Foto Lama --}}
|
||||
@if($tps->foto_tps)
|
||||
<div class="mt-2">
|
||||
<img src="{{ asset('storage/'.$tps->foto_tps) }}"
|
||||
width="120"
|
||||
class="img-thumbnail">
|
||||
{{-- Alamat --}}
|
||||
<div class="form-group">
|
||||
<label>Alamat</label>
|
||||
<input type="text" name="alamat_tps" class="form-control"
|
||||
value="{{ old('alamat_tps', $tps->alamat_tps) }}">
|
||||
</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>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
{{-- Button --}}
|
||||
<button type="submit" class="btn btn-primary mr-2">
|
||||
Simpan Perubahan
|
||||
</button>
|
||||
<a href="{{ route('admin.tps.index') }}"
|
||||
class="btn btn-light">
|
||||
Batal
|
||||
</a>
|
||||
{{-- Foto Lama --}}
|
||||
@if ($tps->foto_tps)
|
||||
<div class="mt-2">
|
||||
<img src="{{ asset('storage/' . $tps->foto_tps) }}" width="250"
|
||||
class="img-thumbnail">
|
||||
</div>
|
||||
@endif
|
||||
</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>
|
||||
@endsection
|
||||
|
|
|
|||
|
|
@ -1,104 +1,146 @@
|
|||
@extends('admin.template')
|
||||
|
||||
@section('content')
|
||||
<div class="content-wrapper">
|
||||
<div class="row">
|
||||
<div class="col-lg-12 grid-margin stretch-card">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="content-wrapper">
|
||||
<div class="row">
|
||||
<div class="col-lg-12 grid-margin stretch-card">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
|
||||
<div class="d-flex justify-content-between align-items-center mb-3">
|
||||
<div>
|
||||
<h4 class="card-title mb-0">Data TPS</h4>
|
||||
<p class="card-description mb-0">
|
||||
Daftar Tempat Pengelolaan Sampah (TPS)
|
||||
</p>
|
||||
<div class="d-flex justify-content-between align-items-center mb-3">
|
||||
<div>
|
||||
<h4 class="card-title mb-0">Data TPS</h4>
|
||||
<p class="card-description mb-0">
|
||||
Daftar Tempat Pengelolaan Sampah (TPS)
|
||||
</p>
|
||||
</div>
|
||||
<a href="{{ route('admin.tps.create') }}" class="btn btn-primary">
|
||||
<i class="bi bi-plus-lg"></i> Tambah
|
||||
</a>
|
||||
</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">
|
||||
<table class="table">
|
||||
<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)
|
||||
<div class="table-responsive">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<!-- NAMA -->
|
||||
<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"
|
||||
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>
|
||||
<th>Nama TPS</th>
|
||||
<th>Kategori</th>
|
||||
<th>Foto</th>
|
||||
<th>Status</th>
|
||||
<th>Aksi</th>
|
||||
</tr>
|
||||
@empty
|
||||
<tr>
|
||||
<td colspan="5" class="text-center">
|
||||
Data TPS belum tersedia
|
||||
</td>
|
||||
</tr>
|
||||
@endforelse
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
@forelse ($tps as $item)
|
||||
<tr>
|
||||
<!-- NAMA -->
|
||||
<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>
|
||||
|
||||
<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
|
||||
|
|
|
|||
Loading…
Reference in New Issue