import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogDescription } from '@/components/ui/dialog'; import { Button } from '@/components/ui/button'; import { Badge } from '@/components/ui/badge'; import { Edit, CheckCircle, XCircle, Clock } from 'lucide-react'; import type { SubmissionItemWithDeps } from '@/lib/submissionItemsService'; interface ItemSelectorDialogProps { items: SubmissionItemWithDeps[]; open: boolean; onOpenChange: (open: boolean) => void; onSelectItem: (item: SubmissionItemWithDeps) => void; onBulkEdit?: () => void; } export function ItemSelectorDialog({ items, open, onOpenChange, onSelectItem, onBulkEdit }: ItemSelectorDialogProps) { const getStatusIcon = (status: string) => { switch (status) { case 'approved': return ; case 'rejected': return ; default: return ; } }; const getStatusColor = (status: string) => { switch (status) { case 'approved': return 'bg-green-100 text-green-800 border-green-200'; case 'rejected': return 'bg-red-100 text-red-800 border-red-200'; case 'pending': return 'bg-yellow-100 text-yellow-800 border-yellow-200'; default: return 'bg-gray-100 text-gray-800 border-gray-200'; } }; return ( Select Item to Edit This submission contains {items.length} items. Choose which one to edit, or edit all at once. {/* Bulk Edit Option */} {onBulkEdit && items.length > 1 && ( Edit All Items ({items.length}) Use tabbed interface to edit multiple items )} {/* Individual Items */} {items.map((item) => ( onSelectItem(item)} > {item.item_type.replace('_', ' ')} {typeof item.item_data === 'object' && item.item_data !== null && !Array.isArray(item.item_data) && 'name' in item.item_data && ( {String((item.item_data as Record).name)} )} {item.dependencies && item.dependencies.length > 0 && ( Depends on {item.dependencies.length} item(s) )} {getStatusIcon(item.status)} {item.status} ))} ); }