TIF_NGANJUK_E41220949/resources/views/admin/tps/index.blade.php

105 lines
5.0 KiB
PHP

@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="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>
<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)
<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>
</tr>
@empty
<tr>
<td colspan="5" class="text-center">
Data TPS belum tersedia
</td>
</tr>
@endforelse
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
@endsection