import { useState } from "react"; import { Head, router } from '@inertiajs/react'; import AppLayout from '@/Layouts/AppLayout.jsx'; import { BreadcrumbItem, BreadcrumbPage, BreadcrumbSeparator } from "@/components/ui/breadcrumb"; import { Button } from '@/components/ui/button'; import Checkbox from "@/components/Checkbox"; import { Pagination, PaginationContent, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious } from "@/components/ui/pagination" import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table"; import { useToast } from "@/hooks/use-toast.js"; export default function Histories({ auth, histories }) { const { toast } = useToast(); const [ids, setIds] = useState([]); const checkboxOnChangeHandler = (e) => { if (e.target.checked) { // Add to ids setIds([...ids, e.target.dataset.hid]); } else { setIds(ids.filter(id => id !== e.target.dataset.hid)); } } const deleteButtonOnClickHandler = (e) => { if (ids.length === 0) { toast({ title: "Error", description: `No items selected.`, }); return; } router.visit(route('comics.destroyHistories'), { data: { ids: ids }, method: "PATCH", only: ['histories'], onSuccess: data => { toast({ title: "All set", description: `The histories has been deleted.`, }); } }); } return ( Histories }> Histories
Select Comic Chapter Read at { histories.data.map((h, i) => ( { h.name } { h.comic.name } { h.created_at } )) }
{ histories.current_page > 1 && ( ) } { histories.current_page } { histories.current_page < histories.last_page && ( ) }
); }