65 lines
3.1 KiB
PHP
65 lines
3.1 KiB
PHP
<x-app-layout>
|
|
@section('page-title', $pageTitle)
|
|
<div class="card shadow-sm border-0">
|
|
<div class="card-header bg-white d-flex justify-content-between align-items-center">
|
|
<h5 class="my-0 fw-bold">Kelola Rekomendasi Pembelajaran</h5>
|
|
<a href="{{ route('admin.rekomendasi.create') }}" class="btn btn-primary"><i class="bi bi-plus-circle-fill me-2"></i>Buat Rekomendasi</a>
|
|
</div>
|
|
<div class="card-body">
|
|
<div class="table-responsive">
|
|
<table class="table table-hover align-middle">
|
|
<thead><tr><th>No</th><th>Thumbnail</th><th>Judul</th><th>Kategori</th><th>Aksi</th></tr></thead>
|
|
<tbody>
|
|
@foreach($semuaRekomendasi as $item)
|
|
<tr>
|
|
<td>{{ $loop->iteration }}</td>
|
|
<td><img src="{{ $item['thumbnail'] }}" width="120" class="rounded" alt="Thumbnail"></td>
|
|
<td>{{ $item['judul'] }}</td>
|
|
<td>{{ $item['kategori'] }}</td>
|
|
<td>
|
|
<div class="d-flex gap-2">
|
|
<a href="{{ route('admin.rekomendasi.edit', $item['id']) }}" class="btn btn-sm btn-outline-secondary">
|
|
<i class="bi bi-pencil-fill"></i>
|
|
</a>
|
|
<button class="btn btn-sm btn-outline-danger btn-delete"
|
|
data-id="{{ $item['id'] }}"
|
|
data-title="{{ $item['judul'] }}">
|
|
<i class="bi bi-trash3-fill"></i>
|
|
</button>
|
|
<form id="delete-form-{{ $item['id'] }}" action="{{ route('admin.rekomendasi.destroy', $item['id']) }}" method="POST" style="display: none;">
|
|
@csrf
|
|
@method('DELETE')
|
|
</form>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
@endforeach
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
@push('scripts')
|
|
<script>
|
|
$(document).on('click', '.btn-delete', function() {
|
|
const id = $(this).data('id');
|
|
const title = $(this).data('title');
|
|
|
|
modernSwal.fire({
|
|
title: 'Hapus Rekomendasi?',
|
|
text: `Apakah Anda yakin ingin menghapus rekomendasi "${title}"?`,
|
|
icon: 'warning',
|
|
showCancelButton: true,
|
|
confirmButtonText: 'Ya, Hapus',
|
|
confirmButtonColor: '#dc3545',
|
|
cancelButtonText: 'Batal'
|
|
}).then((result) => {
|
|
if (result.isConfirmed) {
|
|
$(`#delete-form-${id}`).submit();
|
|
}
|
|
});
|
|
});
|
|
</script>
|
|
@endpush
|
|
</x-app-layout> |