import { useState } from "react"; import { Eye, Trash2 } from "lucide-react"; import { Button } from "@/Components/ui/button"; import { Link, useForm } from "@inertiajs/react"; import { toast } from "sonner"; import { Can } from "@/Components/Permission/Can"; import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, } from "@/Components/ui/alert-dialog"; export interface GoodsReceipt { id: number; code: string; warehouse_id: number; warehouse?: { name: string }; vendor_id?: number; vendor?: { name: string }; received_date: string; status: string; type?: string; items_sum_total_amount?: number; user?: { name: string }; } export default function GoodsReceiptActions({ receipt, }: { receipt: GoodsReceipt }) { const [showDeleteDialog, setShowDeleteDialog] = useState(false); const { delete: destroy, processing } = useForm({}); const handleConfirmDelete = () => { // @ts-ignore destroy(route('goods-receipts.destroy', receipt.id), { onSuccess: () => { toast.success("進貨單已成功刪除"); setShowDeleteDialog(false); }, onError: (errors: any) => toast.error(errors.error || "刪除過程中發生錯誤"), }); }; return (