mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-30 00:38:11 +00:00
changes export flow
This commit is contained in:
@@ -86,6 +86,13 @@ export default function BuildTrainModal({ opened, onClose, onBuilt }: BuildTrain
|
||||
}, [opened]);
|
||||
|
||||
const handleBuild = async () => {
|
||||
if (!trainName.trim()) {
|
||||
toast({
|
||||
title: "Enter the vogue number",
|
||||
variant: "destructive",
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (!yardId || locomotiveIds.length < 1) {
|
||||
toast({
|
||||
title: "Pick a yard and couple at least one locomotive",
|
||||
@@ -108,7 +115,7 @@ export default function BuildTrainModal({ opened, onClose, onBuilt }: BuildTrain
|
||||
importTrainNumber: importTrainNumber.trim(),
|
||||
currentYardId: yardId,
|
||||
locomotiveIds,
|
||||
...(trainName.trim() ? { trainName: trainName.trim() } : {}),
|
||||
trainName: trainName.trim(),
|
||||
...(notes.trim() ? { notes: notes.trim() } : {}),
|
||||
});
|
||||
toast({ title: `Train ${composition.code} built` });
|
||||
@@ -143,11 +150,12 @@ export default function BuildTrainModal({ opened, onClose, onBuilt }: BuildTrain
|
||||
wagons are attached on the next screen.
|
||||
</Text>
|
||||
<TextInput
|
||||
label="Name (optional)"
|
||||
placeholder="e.g. Fertilizer block"
|
||||
label="Vogue number"
|
||||
placeholder="Enter vogue number"
|
||||
value={trainName}
|
||||
onChange={(e) => setTrainName(e.currentTarget.value)}
|
||||
maxLength={100}
|
||||
required
|
||||
/>
|
||||
<Group grow>
|
||||
{/* Fixed by the import run — derived, never typed. */}
|
||||
|
||||
@@ -363,14 +363,17 @@ export default function BookingWindowSettingsModal({
|
||||
/>
|
||||
<DurationField
|
||||
label="Payment window"
|
||||
description="Time a selected customer has to pay"
|
||||
description={
|
||||
isExport
|
||||
? "Time an export customer has to pay before the reserved wagons are released — overrides the global export payment window for THIS train only"
|
||||
: "Time a selected customer has to pay"
|
||||
}
|
||||
value={form.paymentWindowMinutes}
|
||||
nativeUnit="minutes"
|
||||
onChange={(v) =>
|
||||
setForm((f) => f && { ...f, paymentWindowMinutes: v })
|
||||
}
|
||||
min={1}
|
||||
disabled={isExport}
|
||||
/>
|
||||
</Group>
|
||||
{!isExport ? (
|
||||
|
||||
@@ -163,6 +163,7 @@ const WAGON_STATUS_OPTIONS = [
|
||||
{ label: "Assigned", value: Freight.WagonStatus.Assigned },
|
||||
{ label: "Maintenance", value: Freight.WagonStatus.Maintenance },
|
||||
{ label: "Detained", value: Freight.WagonStatus.Detained },
|
||||
{ label: "Out of service", value: Freight.WagonStatus.OutOfService },
|
||||
];
|
||||
|
||||
// Statuses staff may set BY HAND on the create/edit form. ASSIGNED is omitted
|
||||
|
||||
@@ -66,6 +66,7 @@ export default function TrainSchedulingGlobalRulesPage() {
|
||||
"windowDurationHours",
|
||||
"docReviewMinutes",
|
||||
"paymentWindowMinutes",
|
||||
"exportPaymentWindowMinutes",
|
||||
];
|
||||
const payload: Partial<Record<keyof TrainSchedulingGlobalRules, number>> = {};
|
||||
for (const key of fields) {
|
||||
@@ -209,8 +210,8 @@ export default function TrainSchedulingGlobalRulesPage() {
|
||||
disabled={loading}
|
||||
/>
|
||||
<DurationField
|
||||
label="Payment window"
|
||||
description="Time a selected customer has to pay before the slot expires"
|
||||
label="Import payment window"
|
||||
description="Time an import/domestic customer has to pay before the reserved slot expires"
|
||||
value={form.paymentWindowMinutes ?? ""}
|
||||
nativeUnit="minutes"
|
||||
onChange={(value) =>
|
||||
@@ -219,6 +220,17 @@ export default function TrainSchedulingGlobalRulesPage() {
|
||||
min={1}
|
||||
disabled={loading}
|
||||
/>
|
||||
<DurationField
|
||||
label="Export payment window"
|
||||
description="Time an export customer has to pay before the reserved wagons are released"
|
||||
value={form.exportPaymentWindowMinutes ?? ""}
|
||||
nativeUnit="minutes"
|
||||
onChange={(value) =>
|
||||
setForm((current) => ({ ...current, exportPaymentWindowMinutes: value }))
|
||||
}
|
||||
min={1}
|
||||
disabled={loading}
|
||||
/>
|
||||
</Stack>
|
||||
</Card>
|
||||
|
||||
|
||||
@@ -119,7 +119,10 @@ export interface TrainSchedulingGlobalRules {
|
||||
windowCloseHour: number;
|
||||
windowDurationHours: number;
|
||||
docReviewMinutes: number;
|
||||
/** Import/domestic customer pay window, minutes. */
|
||||
paymentWindowMinutes: number;
|
||||
/** Export customer pay window, minutes — tuned separately from import. */
|
||||
exportPaymentWindowMinutes: number;
|
||||
/** Minutes before departure the import window closes; null = close at departure. */
|
||||
importCloseOffsetMinutes: number | null;
|
||||
/** Minutes before departure the export window closes; null = close at departure. */
|
||||
|
||||
Reference in New Issue
Block a user