diff --git a/src/components/InspectionChecklist.tsx b/src/components/InspectionChecklist.tsx new file mode 100644 index 0000000..9705518 --- /dev/null +++ b/src/components/InspectionChecklist.tsx @@ -0,0 +1,136 @@ +import { CheckCircle, XCircle, Clock, MessageSquare } from 'lucide-react'; +import { Button } from '@/components/ui/button'; +import { Textarea } from '@/components/ui/textarea'; +import { useModelStore, type ChecklistItem } from '@/stores/useModelStore'; +import { useState } from 'react'; +import { toast } from 'sonner'; + +function ChecklistRow({ item }: { item: ChecklistItem }) { + const { setChecklistItemStatus, setChecklistItemNote } = useModelStore(); + const [showNote, setShowNote] = useState(item.status === 'rejected'); + + const handleApprove = () => { + setChecklistItemStatus(item.id, 'approved'); + setShowNote(false); + toast.success(`"${item.label}" aprovado`); + }; + + const handleReject = () => { + setChecklistItemStatus(item.id, 'rejected'); + setShowNote(true); + toast.error(`"${item.label}" reprovado — adicione uma anotação`); + }; + + const statusColor = + item.status === 'approved' ? 'text-success' : + item.status === 'rejected' ? 'text-destructive' : + 'text-muted-foreground'; + + const StatusIcon = + item.status === 'approved' ? CheckCircle : + item.status === 'rejected' ? XCircle : + Clock; + + return ( +
+
+
+ + {item.label} +
+
+ + +
+
+ + {(showNote || item.status === 'rejected') && ( +
+
+ + Anotação +
+