mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-30 06:28:12 +00:00
Merge pull request #807 from Tria-plc/freight_feature/usermanagement
add contract clearance detail page and enhance contract requests fil…
This commit is contained in:
@@ -23,6 +23,7 @@ import {
|
||||
Clock,
|
||||
PackageCheck,
|
||||
PackagePlus,
|
||||
RotateCcw,
|
||||
ShieldCheck,
|
||||
} from "lucide-react";
|
||||
import type { Freight } from "@edr/types";
|
||||
@@ -110,6 +111,16 @@ export default function DocumentClearanceDetailPage() {
|
||||
hasPermission(user, FREIGHT_PERMS.contracts.createBooking) &&
|
||||
!isDjiboutiGl(user);
|
||||
|
||||
// The completed booking expired unpaid at train dispatch. Its per-booking
|
||||
// clearance is finished, so GL rebooks it onto a new day — the customer never
|
||||
// re-requests the shipment or pays the clearance fee again.
|
||||
const canRebookExpired =
|
||||
booking?.status === "EXPIRED" &&
|
||||
Boolean(booking?.contractId) &&
|
||||
Number(booking?.totalAmount ?? 0) > 0 &&
|
||||
hasPermission(user, FREIGHT_PERMS.contracts.createBooking) &&
|
||||
!isDjiboutiGl(user);
|
||||
|
||||
const docsPhaseComplete =
|
||||
clearance?.milestones?.some(
|
||||
(m) => m.milestoneCode === "DOCUMENTS_APPROVED" && m.status === "COMPLETED",
|
||||
@@ -194,6 +205,19 @@ export default function DocumentClearanceDetailPage() {
|
||||
>
|
||||
Create booking
|
||||
</Button>
|
||||
) : canRebookExpired ? (
|
||||
<Button
|
||||
color="edr-green"
|
||||
radius="md"
|
||||
leftSection={<RotateCcw size={16} />}
|
||||
onClick={() =>
|
||||
navigate(
|
||||
`/dashboard/contracts/${booking!.contractId}/bookings/${id}/complete?copyFrom=${id}`,
|
||||
)
|
||||
}
|
||||
>
|
||||
Rebook shipment
|
||||
</Button>
|
||||
) : undefined
|
||||
}
|
||||
/>
|
||||
|
||||
@@ -727,8 +727,12 @@ export default function ContractClearanceListPage() {
|
||||
)
|
||||
}
|
||||
onRebook={(row) =>
|
||||
// Re-complete the SAME expired booking (new day, same finished
|
||||
// per-booking clearance) — a fresh create-booking would spawn a
|
||||
// new instance and force the customer through clearance + fee
|
||||
// again.
|
||||
navigate(
|
||||
`/dashboard/contracts/${row.contractId}/create-booking?copyFrom=${row.id}`,
|
||||
`/dashboard/contracts/${row.contractId}/bookings/${row.id}/complete?copyFrom=${row.id}`,
|
||||
)
|
||||
}
|
||||
onViewContract={(contractId) =>
|
||||
|
||||
Reference in New Issue
Block a user