fix: merge

This commit is contained in:
Nathnael
2026-07-22 07:26:25 +00:00
parent 8d4b133277
commit 1da08131ea

View File

@@ -442,7 +442,9 @@ export default function NewContractPage({
mutationFn: async (profileId: string) => {
const res = await auth.reapplyProfile(profileId);
if (!res.success) {
throw new Error(res.error?.message ?? "Failed to resubmit for approval");
throw new Error(
res.error?.message ?? "Failed to resubmit for approval",
);
}
},
onSuccess: () => setPendingApprovalProfile(null),
@@ -509,17 +511,6 @@ export default function NewContractPage({
? (PROFILE_TYPE_LABELS[createTarget] ?? createTarget)
: "";
const onboardingDocs = useMemo(() => {
const profiles = auth.company?.company?.companyProfiles ?? [];
const targetType = operationType
? operationToProfileType(operationType, profileTypes)
: null;
const active =
(targetType && profiles.find((p) => p.type === targetType)) ??
profiles[0];
return active?.licenseFiles ?? [];
}, [auth.company, operationType, profileTypes]);
async function handleContinue() {
const fields = contractStepFields[step];
if (fields.length > 0) {
@@ -552,16 +543,16 @@ export default function NewContractPage({
// GENERAL contract until its validity expires.
const cargoScope: Freight.CreateContractCargoScopeDto[] = isContainer
? data.enabledContainerSizes.map((size) => ({
containerSize: size,
// Required cargo description — what the containers carry.
cargoFreeText: data.cargoFreeText.trim() || undefined,
}))
containerSize: size,
// Required cargo description — what the containers carry.
cargoFreeText: data.cargoFreeText.trim() || undefined,
}))
: [
{
cargoTypeId: data.cargoTypePath?.[1] || undefined,
cargoFreeText: data.cargoFreeText || undefined,
},
];
{
cargoTypeId: data.cargoTypePath?.[1] || undefined,
cargoFreeText: data.cargoFreeText || undefined,
},
];
// Route — a single origin→destination lane, general contracts included.
const routes: Freight.CreateContractRouteInputDto[] = [
@@ -576,12 +567,12 @@ export default function NewContractPage({
// a forwarder apart from a direct import/export).
const forwarderProfileId =
data.operationType &&
isForwarderOperation(data.operationType, profileTypes)
isForwarderOperation(data.operationType, profileTypes)
? (auth.company?.company?.companyProfiles ?? []).find(
(p) =>
p.type ===
operationToProfileType(data.operationType!, profileTypes),
)?.id
(p) =>
p.type ===
operationToProfileType(data.operationType!, profileTypes),
)?.id
: undefined;
return {
@@ -600,11 +591,11 @@ export default function NewContractPage({
// booking time, but only on contracts created WITH_RETURN.
...(isContainer
? {
equipmentReturn:
data.equipmentReturn === "with_return"
? "WITH_RETURN"
: "WITHOUT_RETURN",
}
equipmentReturn:
data.equipmentReturn === "with_return"
? "WITH_RETURN"
: "WITHOUT_RETURN",
}
: {}),
isHazardous: data.isHazardous,
// Reefer is a contract-level flag for both container and bulk.
@@ -633,7 +624,8 @@ export default function NewContractPage({
? { customsClearingEnabled: true }
: {
customsClearingEnabled: false,
customsClearingAgent: data.customsClearingAgent?.trim() || undefined,
customsClearingAgent:
data.customsClearingAgent?.trim() || undefined,
}),
cargoScope,
routes,
@@ -748,10 +740,7 @@ export default function NewContractPage({
<Text size="sm" fw={600}>
What the reviewer asked for:
</Text>
<Text
size="sm"
style={{ whiteSpace: "pre-wrap" }}
>
<Text size="sm" style={{ whiteSpace: "pre-wrap" }}>
{editContract.latestChangeRequestNote}
</Text>
<Text size="sm" c="dimmed" mt={2}>
@@ -1300,7 +1289,8 @@ export default function NewContractPage({
<>
<Text size="sm" c="dimmed">
Your {label} profile was submitted and is under staff
review. You can start a contract under it once it's approved.
review. You can start a contract under it once it's
approved.
</Text>
<Group justify="flex-end" gap="sm">
<Button