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:
marshal
2026-06-21 09:38:57 +03:00
parent b6d5047d27
commit dd07442b92
5 changed files with 11 additions and 8 deletions

View File

@@ -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';

View File

@@ -1,3 +1,3 @@
export const API_BASE_URL = 'https://edrfreightapi.triaplc.com';
// export const API_BASE_URL = 'http://localhost:3001';
// export const API_BASE_URL = 'https://edrfreightapi.triaplc.com';
export const API_BASE_URL = 'http://localhost:3001';

View File

@@ -128,7 +128,7 @@ export function Step1ContractType({
(sl) => sl.id === booking.shippingLineId,
);
if (shippingLine) {
form.setValue("shippingLine", shippingLine.name);
form.setValue("shippingLine", shippingLine.id);
}
}

View File

@@ -35,7 +35,7 @@ export function Step4Route({
const shippingLineOptions = useMemo(() => {
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
// duplicate option would crash Mantine's Select ("Duplicate options...").
const seen = new Set<string>();
@@ -43,7 +43,7 @@ export function Step4Route({
for (const sl of referenceData.shipping_line) {
if (!sl.name || seen.has(sl.name)) continue;
seen.add(sl.name);
options.push({ value: sl.name, label: sl.name });
options.push({ value: sl.id, label: sl.name });
}
return options;
}, [referenceData]);

View File

@@ -151,6 +151,9 @@ export function Step8Review({
const serviceType = referenceData?.service.find(
(s) => s.id === values.serviceTypeId,
);
const shippingLine = referenceData?.shipping_line.find(
(sl) => sl.id === values.shippingLine,
);
const containerSummary =
values.cargoType === "container" && values.containers.length > 0
@@ -274,7 +277,7 @@ export function Step8Review({
value={`${originYardName}${destinationYardName}`}
/>
<DetailRow label="Trade direction" value={directionLabel} />
<DetailRow label="Shipping line" value={values.shippingLine || "—"} />
<DetailRow label="Shipping line" value={shippingLine?.name || "—"} />
<DetailRow
label="Modifiers"
value={