mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-29 21:08:12 +00:00
feat: add yard/zone fields and returned containers table
Add Yard and Zone input fields to standalone return modal. Add table showing all returned containers with: container number, booking ref, returned date, facility, yard, condition, status. Table appears at top of Container Returns page when returns exist. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -69,6 +69,13 @@ export default function ContainerReturnsPage() {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const { data: returnedContainers = [] } = useQuery({
|
||||||
|
queryKey: ["empty-container-returns"],
|
||||||
|
queryFn: async () => {
|
||||||
|
return await importOperationsService.listEmptyReturns().catch(() => []);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
const bookingIds = unloadedQueue.map((item) => item.bookingId).filter(Boolean) as string[];
|
const bookingIds = unloadedQueue.map((item) => item.bookingId).filter(Boolean) as string[];
|
||||||
const containerReturnsQuery = useQuery({
|
const containerReturnsQuery = useQuery({
|
||||||
queryKey: ["container-returns", bookingIds],
|
queryKey: ["container-returns", bookingIds],
|
||||||
@@ -249,6 +256,42 @@ export default function ContainerReturnsPage() {
|
|||||||
</Button>
|
</Button>
|
||||||
</Group>
|
</Group>
|
||||||
|
|
||||||
|
{returnedContainers.length > 0 && (
|
||||||
|
<>
|
||||||
|
<Text fw={600} mb="xs">Returned Containers</Text>
|
||||||
|
<Table.ScrollContainer minWidth={1000} mb="lg">
|
||||||
|
<Table striped highlightOnHover verticalSpacing="xs">
|
||||||
|
<Table.Thead>
|
||||||
|
<Table.Tr>
|
||||||
|
<Table.Th>Container Number</Table.Th>
|
||||||
|
<Table.Th>Booking Ref</Table.Th>
|
||||||
|
<Table.Th>Returned Date</Table.Th>
|
||||||
|
<Table.Th>Facility</Table.Th>
|
||||||
|
<Table.Th>Yard</Table.Th>
|
||||||
|
<Table.Th>Condition</Table.Th>
|
||||||
|
<Table.Th>Status</Table.Th>
|
||||||
|
</Table.Tr>
|
||||||
|
</Table.Thead>
|
||||||
|
<Table.Tbody>
|
||||||
|
{returnedContainers.map((ret: any) => (
|
||||||
|
<Table.Tr key={ret.id}>
|
||||||
|
<Table.Td>{ret.containerNumber}</Table.Td>
|
||||||
|
<Table.Td>{ret.bookingId ? "Associated" : "—"}</Table.Td>
|
||||||
|
<Table.Td>{ret.returnDate ? new Date(ret.returnDate).toLocaleDateString() : "—"}</Table.Td>
|
||||||
|
<Table.Td>{ret.facility || "—"}</Table.Td>
|
||||||
|
<Table.Td>{ret.yard || "—"}</Table.Td>
|
||||||
|
<Table.Td>{ret.condition || "—"}</Table.Td>
|
||||||
|
<Table.Td>
|
||||||
|
<Badge size="sm">{ret.status}</Badge>
|
||||||
|
</Table.Td>
|
||||||
|
</Table.Tr>
|
||||||
|
))}
|
||||||
|
</Table.Tbody>
|
||||||
|
</Table>
|
||||||
|
</Table.ScrollContainer>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
|
||||||
{filteredGroups.length === 0 ? (
|
{filteredGroups.length === 0 ? (
|
||||||
<Alert color="gray">No {filterType !== "all" ? filterType : ""} container returns found.</Alert>
|
<Alert color="gray">No {filterType !== "all" ? filterType : ""} container returns found.</Alert>
|
||||||
) : (
|
) : (
|
||||||
@@ -517,6 +560,8 @@ function StandaloneReturnModal({ opened, onClose, onSubmit, loading }: Standalon
|
|||||||
const [containerNumber, setContainerNumber] = useState<string>("");
|
const [containerNumber, setContainerNumber] = useState<string>("");
|
||||||
const [returnDate, setReturnDate] = useState<string>(new Date().toISOString().split("T")[0]);
|
const [returnDate, setReturnDate] = useState<string>(new Date().toISOString().split("T")[0]);
|
||||||
const [warehouse, setWarehouse] = useState<string | null>(null);
|
const [warehouse, setWarehouse] = useState<string | null>(null);
|
||||||
|
const [yard, setYard] = useState<string>("");
|
||||||
|
const [zone, setZone] = useState<string>("");
|
||||||
const [condition, setCondition] = useState<string>("");
|
const [condition, setCondition] = useState<string>("");
|
||||||
const [handoverNote, setHandoverNote] = useState<string>("");
|
const [handoverNote, setHandoverNote] = useState<string>("");
|
||||||
|
|
||||||
@@ -562,6 +607,8 @@ function StandaloneReturnModal({ opened, onClose, onSubmit, loading }: Standalon
|
|||||||
setContainerNumber("");
|
setContainerNumber("");
|
||||||
setReturnDate(new Date().toISOString().split("T")[0]);
|
setReturnDate(new Date().toISOString().split("T")[0]);
|
||||||
setWarehouse(null);
|
setWarehouse(null);
|
||||||
|
setYard("");
|
||||||
|
setZone("");
|
||||||
setCondition("");
|
setCondition("");
|
||||||
setHandoverNote("");
|
setHandoverNote("");
|
||||||
onClose();
|
onClose();
|
||||||
@@ -592,6 +639,20 @@ function StandaloneReturnModal({ opened, onClose, onSubmit, loading }: Standalon
|
|||||||
searchable
|
searchable
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<TextInput
|
||||||
|
label="Yard"
|
||||||
|
placeholder="e.g., Yard A, Main Yard"
|
||||||
|
value={yard}
|
||||||
|
onChange={(e) => setYard(e.currentTarget.value)}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<TextInput
|
||||||
|
label="Zone"
|
||||||
|
placeholder="e.g., Zone 1, North Zone"
|
||||||
|
value={zone}
|
||||||
|
onChange={(e) => setZone(e.currentTarget.value)}
|
||||||
|
/>
|
||||||
|
|
||||||
<input
|
<input
|
||||||
type="date"
|
type="date"
|
||||||
value={returnDate}
|
value={returnDate}
|
||||||
|
|||||||
Reference in New Issue
Block a user