diff --git a/distribution_fe/app/(dashboard)/operations/deliveries/_components/delivery-task-view-sheet.tsx b/distribution_fe/app/(dashboard)/operations/deliveries/_components/delivery-task-view-sheet.tsx new file mode 100644 index 0000000..c02e689 --- /dev/null +++ b/distribution_fe/app/(dashboard)/operations/deliveries/_components/delivery-task-view-sheet.tsx @@ -0,0 +1,100 @@ +'use client' + +import { Badge } from '@/components/ui/badge' +import { + Dialog, + DialogContent, + DialogHeader, + DialogTitle, +} from '@/components/ui/dialog' +import { Separator } from '@/components/ui/separator' +import type { DeliveryTaskResponse, DeliveryTaskStatus } from '@/types/api' + +const TASK_STATUS_VARIANT: Record = { + Pending: 'secondary', + Delivered: 'default', + PartiallyDelivered: 'secondary', + Failed: 'destructive', +} + +const fmtDateTime = (v: string | null) => + v + ? new Date(v).toLocaleString('en-GB', { + day: '2-digit', month: 'short', year: 'numeric', hour: '2-digit', minute: '2-digit', + }) + : '—' + +interface DeliveryTaskViewSheetProps { + open: boolean + onClose: () => void + task: DeliveryTaskResponse | null +} + +function Row({ label, value }: { label: string; value: React.ReactNode }) { + return ( +
+ {label} + {value} +
+ ) +} + +export function DeliveryTaskViewSheet({ open, onClose, task }: DeliveryTaskViewSheetProps) { + if (!task) return null + + return ( + !v && onClose()}> + + + Delivery Task Details + + +
+ + + {task.status}} /> + + + + +
+ + + +
+

Items ({task.items.length})

+
+ + + + + + + + + + + {task.items.length === 0 ? ( + + + + ) : ( + task.items.map((item) => ( + + + + + + + )) + )} + +
ItemOrderedFulfilledUnit Price
+ No items on this task. +
{item.itemName}{item.quantity}{item.quantityFulfilled}{item.unitPrice}
+
+
+
+
+ ) +}