mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-29 22:18:12 +00:00
Merge pull request #1114 from Tria-plc/freight_feature/usermanagement
always-on calendar, currency cards
This commit is contained in:
@@ -20,7 +20,6 @@ import {
|
||||
Loader,
|
||||
Modal,
|
||||
Paper,
|
||||
SegmentedControl,
|
||||
Select,
|
||||
Stack,
|
||||
Switch,
|
||||
@@ -49,7 +48,11 @@ import {
|
||||
X,
|
||||
} from "lucide-react";
|
||||
import type { Freight } from "@edr/types";
|
||||
import { ExportTrainPicker, OperationDatePicker } from "@edr/ui-common";
|
||||
import {
|
||||
CurrencySelector,
|
||||
ExportTrainPicker,
|
||||
OperationDatePicker,
|
||||
} from "@edr/ui-common";
|
||||
|
||||
import { api } from "@/services/api";
|
||||
import { PageContainer } from "@/components/page";
|
||||
@@ -1713,47 +1716,42 @@ export default function GlCreateBookingForm() {
|
||||
title="Schedule"
|
||||
description="Pick the binding shipment day. Only days with an open train that has enough matching wagons for the cargo can be selected."
|
||||
/>
|
||||
{cargoQuery === null ? (
|
||||
<Alert
|
||||
color="yellow"
|
||||
variant="light"
|
||||
radius="md"
|
||||
icon={<AlertCircle size={16} />}
|
||||
>
|
||||
Enter your cargo details first — available shipment days depend
|
||||
on the wagons your cargo needs.
|
||||
</Alert>
|
||||
) : (
|
||||
<Box>
|
||||
<StepLabel>Shipment day *</StepLabel>
|
||||
<Box mt={10} w="100%">
|
||||
<OperationDatePicker
|
||||
fullWidth
|
||||
availableDays={availableDays ?? []}
|
||||
isLoading={daysLoading}
|
||||
value={scheduledDate}
|
||||
onChange={(d) => {
|
||||
setScheduledDate(d);
|
||||
// A new day invalidates the old train pick.
|
||||
setTrainScheduleId("");
|
||||
}}
|
||||
/>
|
||||
</Box>
|
||||
{showErrors && dateError && (
|
||||
<Text fz="xs" c="red" mt={6}>
|
||||
{dateError}
|
||||
</Text>
|
||||
)}
|
||||
{isExportPick && scheduledDate ? (
|
||||
<ExportTrainPicker
|
||||
options={exportTrainsQuery.data ?? []}
|
||||
loading={exportTrainsQuery.isLoading}
|
||||
value={trainScheduleId}
|
||||
onChange={setTrainScheduleId}
|
||||
/>
|
||||
) : null}
|
||||
<Box>
|
||||
<StepLabel>Shipment day *</StepLabel>
|
||||
<Box mt={10} w="100%">
|
||||
{/* Calendar stays visible before cargo is entered — all days
|
||||
disabled with a hint, since availability depends on cargo. */}
|
||||
<OperationDatePicker
|
||||
fullWidth
|
||||
availableDays={cargoQuery === null ? [] : (availableDays ?? [])}
|
||||
isLoading={cargoQuery !== null && daysLoading}
|
||||
emptyMessage={
|
||||
cargoQuery === null
|
||||
? "Enter the cargo details first — available shipment days depend on the wagons the cargo needs."
|
||||
: undefined
|
||||
}
|
||||
value={scheduledDate}
|
||||
onChange={(d) => {
|
||||
setScheduledDate(d);
|
||||
// A new day invalidates the old train pick.
|
||||
setTrainScheduleId("");
|
||||
}}
|
||||
/>
|
||||
</Box>
|
||||
)}
|
||||
{showErrors && dateError && (
|
||||
<Text fz="xs" c="red" mt={6}>
|
||||
{dateError}
|
||||
</Text>
|
||||
)}
|
||||
{isExportPick && scheduledDate ? (
|
||||
<ExportTrainPicker
|
||||
options={exportTrainsQuery.data ?? []}
|
||||
loading={exportTrainsQuery.isLoading}
|
||||
value={trainScheduleId}
|
||||
onChange={setTrainScheduleId}
|
||||
/>
|
||||
) : null}
|
||||
</Box>
|
||||
</StepCard>
|
||||
)}
|
||||
|
||||
@@ -1769,16 +1767,10 @@ export default function GlCreateBookingForm() {
|
||||
? "Requested by the customer on their shipment request."
|
||||
: "The contract is quoted in USD — pick the currency this shipment is invoiced in."}
|
||||
</Text>
|
||||
<SegmentedControl
|
||||
<CurrencySelector
|
||||
value={isIntercity ? "ETB" : paymentCurrency}
|
||||
onChange={(v) => setPaymentCurrency(v as "USD" | "ETB")}
|
||||
onChange={setPaymentCurrency}
|
||||
disabled={isIntercity}
|
||||
data={[
|
||||
{ label: "USD", value: "USD" },
|
||||
{ label: "ETB", value: "ETB" },
|
||||
]}
|
||||
color="edr-green"
|
||||
radius={10}
|
||||
/>
|
||||
</Box>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user