crud kategori tps fiks
This commit is contained in:
parent
343f200e1e
commit
4781744c9a
|
|
@ -45,17 +45,16 @@ class="form-control" required>
|
|||
</div>
|
||||
|
||||
<!-- PREVIEW FOTO LAMA -->
|
||||
@if (!empty($kategori->foto_kategori))
|
||||
<div class="mt-3">
|
||||
<small class="text-muted">Foto saat ini:</small><br>
|
||||
<img src="{{ asset('storage/' . $kategori->foto_kategori) }}" alt="Foto Kategori"
|
||||
width="120" class="img-thumbnail mt-1">
|
||||
@if ($kategori->foto_kategori)
|
||||
<div class="mt-2">
|
||||
<img src="{{ asset('storage/' . $kategori->foto_kategori) }}" width="250"
|
||||
class="img-thumbnail">
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
|
||||
<button class="btn btn-primary">Update</button>
|
||||
<button class="btn btn-primary">Simpan</button>
|
||||
<a href="{{ route('admin.kategori.index') }}" class="btn btn-light">Batal</a>
|
||||
</form>
|
||||
|
||||
|
|
|
|||
|
|
@ -29,9 +29,14 @@
|
|||
<td>{{ $item->nama_kategori }}</td>
|
||||
<td>
|
||||
@if ($item->foto_kategori)
|
||||
<img src="{{ asset('storage/' . $item->foto_kategori) }}" width="60">
|
||||
<img src="{{ asset('storage/' . $item->foto_kategori) }}" alt="Foto Kategori"
|
||||
style="
|
||||
width:200px;
|
||||
height:auto;
|
||||
border-radius:2px;
|
||||
">
|
||||
@else
|
||||
-
|
||||
<span class="text-muted">-</span>
|
||||
@endif
|
||||
</td>
|
||||
<td>{{ $item->deskripsi ?? '-' }}</td>
|
||||
|
|
@ -40,13 +45,11 @@
|
|||
class="btn btn-warning btn-sm me-1" title="Edit">
|
||||
<i class="bi bi-pencil-square"></i>
|
||||
</a>
|
||||
<form action="{{ route('admin.kategori.destroy', $item->id) }}"
|
||||
method="POST" style="display:inline-block"
|
||||
onsubmit="return confirm('Yakin ingin menghapus data ini?')">
|
||||
<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" title="Hapus">
|
||||
<button type="submit" class="btn btn-danger btn-sm">
|
||||
<i class="bi bi-trash"></i>
|
||||
</button>
|
||||
</form>
|
||||
|
|
@ -63,4 +66,43 @@ class="btn btn-warning btn-sm me-1" title="Edit">
|
|||
</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