mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-30 13:28:11 +00:00
feat: switch API base URL to localhost for development and fix shipping line ID handling in booking form
- Changed API_BASE_URL from production to localhost in both backoffice and portal configurations. - Updated booking form to use shipping line ID instead of name throughout the flow. - Fixed Step1ContractType to set shipping line ID when loading existing booking. - Updated Step4Route to key shipping line options by ID as required by API. - Enhanced Step8Review to display shipping line name by
This commit is contained in:
@@ -1,3 +1,3 @@
|
|||||||
export const API_BASE_URL = 'https://edrfreightapi.triaplc.com';
|
// export const API_BASE_URL = 'https://edrfreightapi.triaplc.com';
|
||||||
|
|
||||||
// export const API_BASE_URL = 'http://localhost:3001';
|
export const API_BASE_URL = 'http://localhost:3001';
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
export const API_BASE_URL = 'https://edrfreightapi.triaplc.com';
|
// export const API_BASE_URL = 'https://edrfreightapi.triaplc.com';
|
||||||
// export const API_BASE_URL = 'http://localhost:3001';
|
export const API_BASE_URL = 'http://localhost:3001';
|
||||||
|
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ export function Step1ContractType({
|
|||||||
(sl) => sl.id === booking.shippingLineId,
|
(sl) => sl.id === booking.shippingLineId,
|
||||||
);
|
);
|
||||||
if (shippingLine) {
|
if (shippingLine) {
|
||||||
form.setValue("shippingLine", shippingLine.name);
|
form.setValue("shippingLine", shippingLine.id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ export function Step4Route({
|
|||||||
|
|
||||||
const shippingLineOptions = useMemo(() => {
|
const shippingLineOptions = useMemo(() => {
|
||||||
if (!referenceData?.shipping_line) return [];
|
if (!referenceData?.shipping_line) return [];
|
||||||
// The form keys shipping line by name, so options are keyed by name too.
|
// The form keys shipping line by ID (required by API as UUID).
|
||||||
// Dedupe by name: if the reference data has two lines sharing a name, a
|
// Dedupe by name: if the reference data has two lines sharing a name, a
|
||||||
// duplicate option would crash Mantine's Select ("Duplicate options...").
|
// duplicate option would crash Mantine's Select ("Duplicate options...").
|
||||||
const seen = new Set<string>();
|
const seen = new Set<string>();
|
||||||
@@ -43,7 +43,7 @@ export function Step4Route({
|
|||||||
for (const sl of referenceData.shipping_line) {
|
for (const sl of referenceData.shipping_line) {
|
||||||
if (!sl.name || seen.has(sl.name)) continue;
|
if (!sl.name || seen.has(sl.name)) continue;
|
||||||
seen.add(sl.name);
|
seen.add(sl.name);
|
||||||
options.push({ value: sl.name, label: sl.name });
|
options.push({ value: sl.id, label: sl.name });
|
||||||
}
|
}
|
||||||
return options;
|
return options;
|
||||||
}, [referenceData]);
|
}, [referenceData]);
|
||||||
|
|||||||
@@ -151,6 +151,9 @@ export function Step8Review({
|
|||||||
const serviceType = referenceData?.service.find(
|
const serviceType = referenceData?.service.find(
|
||||||
(s) => s.id === values.serviceTypeId,
|
(s) => s.id === values.serviceTypeId,
|
||||||
);
|
);
|
||||||
|
const shippingLine = referenceData?.shipping_line.find(
|
||||||
|
(sl) => sl.id === values.shippingLine,
|
||||||
|
);
|
||||||
|
|
||||||
const containerSummary =
|
const containerSummary =
|
||||||
values.cargoType === "container" && values.containers.length > 0
|
values.cargoType === "container" && values.containers.length > 0
|
||||||
@@ -274,7 +277,7 @@ export function Step8Review({
|
|||||||
value={`${originYardName} → ${destinationYardName}`}
|
value={`${originYardName} → ${destinationYardName}`}
|
||||||
/>
|
/>
|
||||||
<DetailRow label="Trade direction" value={directionLabel} />
|
<DetailRow label="Trade direction" value={directionLabel} />
|
||||||
<DetailRow label="Shipping line" value={values.shippingLine || "—"} />
|
<DetailRow label="Shipping line" value={shippingLine?.name || "—"} />
|
||||||
<DetailRow
|
<DetailRow
|
||||||
label="Modifiers"
|
label="Modifiers"
|
||||||
value={
|
value={
|
||||||
|
|||||||
Reference in New Issue
Block a user