diff --git a/apps/edr-freight-web/portal/src/pages/contracts/NewContractPage.tsx b/apps/edr-freight-web/portal/src/pages/contracts/NewContractPage.tsx
index 67a1a9071..8636726ca 100644
--- a/apps/edr-freight-web/portal/src/pages/contracts/NewContractPage.tsx
+++ b/apps/edr-freight-web/portal/src/pages/contracts/NewContractPage.tsx
@@ -39,11 +39,9 @@ import {
import useAuth from "@/hooks/useAuth";
import {
CONTRACT_STEPS,
- EDIT_CONTRACT_STEPS,
ContractFormInputValues,
contractFormSchema,
contractStepFields,
- editContractStepFields,
initialContractFormValues,
OPERATION_TYPES,
type ContractFormValues,
@@ -55,12 +53,6 @@ import {
operationToTradeDirection,
} from "./new-contract-form/helpers";
import { contractToFormValues } from "./new-contract-form/contractToForm";
-import {
- ContractDocsEditor,
- documentSettingCode,
- missingRequiredDocKeys,
- useCompanyDocuments,
-} from "./new-contract-form/ContractDocsEditor";
import { PROFILE_TYPE_LABELS } from "@/constants/profileMode";
import type { ProfileTypeValue } from "@/services/companies.service";
import { StepIndicator } from "./new-contract-form/StepIndicator";
@@ -84,8 +76,8 @@ type PriceModalMode = "submit" | "draft";
* The contract wizard, used both to create a new contract and — in `edit` mode —
* to continue an unsubmitted DRAFT or edit & resubmit a contract staff returned
* with CHANGES_REQUESTED. Edit mode hydrates the form from the saved contract,
- * lets the customer change any term and replace documents, then runs the same
- * update → price → submit flow.
+ * lets the customer change any term, then runs the same update → price →
+ * submit flow. Same 3 steps as create — there is no separate documents step.
*/
export default function NewContractPage({
mode = "create",
@@ -105,22 +97,6 @@ export default function NewContractPage({
...api.contracts.get.queryOptions({ input: { id: editId ?? "" } }),
enabled: isEdit,
});
- // Onboarding document requirements — used in edit mode to block resubmit until
- // every required document is on file (existing or freshly attached).
- const editDocSettingQuery = useQuery({
- ...api.fileUploadSettings.getByCode.queryOptions({
- input: {
- code: documentSettingCode(
- auth.company?.company?.nationality as string | null | undefined,
- ),
- },
- }),
- enabled: isEdit,
- });
- // Profile documents (TIN, licenses, IDs) satisfy requirements too — the API
- // carries them onto the contract on save.
- const companyDocs = useCompanyDocuments();
-
// Contract creation is gated on profile approval, same as bookings.
if (!auth.isPending && auth.company && !auth.canBook) {
return ;
@@ -167,12 +143,6 @@ export default function NewContractPage({
const [priceContractId, setPriceContractId] = useState(
isEdit ? (editId ?? null) : null,
);
- // Documents freshly attached on the review step (edit mode only). Merged into
- // the form's `documents` map before the contract is updated.
- const [editDocuments, setEditDocuments] = useState<
- Record
- >({});
- const [showDocErrors, setShowDocErrors] = useState(false);
const [priceModalMode, setPriceModalMode] = useState(
null,
);
@@ -311,10 +281,9 @@ export default function NewContractPage({
const destinationYard = form.watch("destinationYard");
const operationType = form.watch("operationType");
- const visibleSteps = useMemo(
- () => (isEdit ? EDIT_CONTRACT_STEPS : CONTRACT_STEPS),
- [isEdit],
- );
+ // Create and edit share the same 3 steps — documents come along automatically
+ // (company profile docs are carried onto the contract by the API on save).
+ const visibleSteps = CONTRACT_STEPS;
const visibleStepIds = useMemo(
() => visibleSteps.map((s) => s.id),
[visibleSteps],
@@ -519,25 +488,11 @@ export default function NewContractPage({
}, [auth.company, auth.activeCompanyProfileId]);
async function handleContinue() {
- const stepFields = isEdit ? editContractStepFields : contractStepFields;
- const fields = stepFields[step];
+ const fields = contractStepFields[step];
if (fields.length > 0) {
const valid = await form.trigger(fields, { shouldFocus: true });
if (!valid) return;
}
- if (isEdit && step === 2 && editContract) {
- const missing = missingRequiredDocKeys(
- editDocSettingQuery.data,
- editContract,
- editDocuments,
- companyDocs,
- );
- if (missing.length > 0) {
- setShowDocErrors(true);
- return;
- }
- setShowDocErrors(false);
- }
goToStep(1);
}
@@ -649,26 +604,6 @@ export default function NewContractPage({
const handleSubmitContract = form.handleSubmit((data) => {
try {
- // Edit mode: all required documents must be on file (already uploaded or
- // freshly attached) before resubmitting, and freshly attached files are
- // merged into the form's documents map so the update sends them.
- if (isEdit && editContract) {
- const missing = missingRequiredDocKeys(
- editDocSettingQuery.data,
- editContract,
- editDocuments,
- companyDocs,
- );
- if (missing.length > 0) {
- setShowDocErrors(true);
- return;
- }
- setShowDocErrors(false);
- form.setValue("documents", {
- ...(form.getValues("documents") ?? {}),
- ...editDocuments,
- });
- }
const apiPayload = buildApiPayload(data);
persistAndPriceMutation.mutate({
payload: apiPayload,
@@ -724,8 +659,8 @@ export default function NewContractPage({
{isEdit
? editContract?.status === "CHANGES_REQUESTED"
- ? "Update your contract details and documents, then resubmit it for EDR staff review."
- : "Update your draft contract details and documents, then submit it for EDR staff review."
+ ? "Update your contract details, then resubmit it for EDR staff review."
+ : "Update your draft contract details, then submit it for EDR staff review."
: "Define your freight contract — scope, routes, and unit rates. Book shipments against it after signing."}
@@ -769,12 +704,12 @@ export default function NewContractPage({
{editContract.latestChangeRequestNote}
- Update the details or documents below, then resubmit the
- contract for review.
+ Update the details below, then resubmit the contract for
+ review.
) : (
- "Update any contract detail or document that needs to change, then resubmit the contract for review."
+ "Update any contract detail that needs to change, then resubmit the contract for review."
)}
)}
@@ -843,35 +778,8 @@ export default function NewContractPage({
)}
- {/* Step 2 (edit) — Documents. */}
- {step === 2 && isEdit && editContract && (
-
-
- [k, "Required"]),
- )
- : {}
- }
- />
-
- )}
-
- {/* Step 2 (create) / Step 3 (edit) — Review & Submit. */}
- {((step === 2 && !isEdit) || (step === 3 && isEdit)) && (
+ {/* Step 2 — Review & Submit. */}
+ {step === 2 && (
>
-> = {
- 0: contractStepFields[0],
- 1: contractStepFields[1],
- // Step 2 — Documents: validated via missingRequiredDocKeys in the wizard.
- 2: [],
- 3: ["notes"],
-};