import MainLayout from "@/Layouts/MainLayout";
import { Head, Link, router } from "@inertiajs/react";
export default function PeminjamanIndex({ peminjamans }) {
const handleKembalikan = (id) => {
if (confirm("Konfirmasi pengembalian buku ini?")) {
router.post(`/peminjaman/${id}/kembalikan`);
}
};
const handleDelete = (id) => {
if (confirm("Yakin ingin menghapus data ini?")) {
router.delete(`/peminjaman/${id}`);
}
};
const statusColor = {
dipinjam: "bg-yellow-100 text-yellow-800",
dikembalikan: "bg-green-100 text-green-800",
terlambat: "bg-red-100 text-red-800",
};
return (
| No | Anggota | Buku | Tgl Pinjam | Tgl Kembali | Status | Denda | Aksi |
|---|---|---|---|---|---|---|---|
| {(peminjamans.current_page - 1) * peminjamans.per_page + index + 1} | {p.anggota?.nama} | {p.buku?.judul} | {p.tanggal_pinjam} | {p.tanggal_kembali_rencana} | {p.status} | {p.denda > 0 ? `Rp ${p.denda.toLocaleString("id-ID")}` : "-"} |
{p.status === "dipinjam" && (
)}
|
Menampilkan {peminjamans.from} - {peminjamans.to}{" "} dari {peminjamans.total} data