@burdenoff/microfe-movethewheels 2026.1016.2 → 2026.1016.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/freight-cost/FreightCommercialEditor.js +217 -0
- package/dist/components/freight-cost/FreightCommercialFactEditor.js +217 -0
- package/dist/components/freight-cost/FreightCommercialHistory.js +115 -0
- package/dist/components/freight-cost/FreightDraftForm.js +106 -91
- package/dist/components/freight-cost/FreightHistory.js +42 -40
- package/dist/generated/freight-cost-operations.d.ts +959 -0
- package/dist/hooks/useFreightRecoveryAction.js +20 -20
- package/dist/movethewheels/components/freight-cost/FreightCommercialEditor.d.ts +8 -0
- package/dist/movethewheels/components/freight-cost/FreightCommercialFactEditor.d.ts +8 -0
- package/dist/movethewheels/components/freight-cost/FreightCommercialHistory.d.ts +4 -0
- package/dist/movethewheels/components/freight-cost/FreightDraftForm.d.ts +4 -2
- package/dist/movethewheels/components/freight-cost/FreightHistory.d.ts +2 -2
- package/dist/movethewheels/utils/freightCommercial.d.ts +44 -0
- package/dist/pages/FreightEstimatePage.js +96 -92
- package/dist/src/generated/freight-cost-operations.js +495 -6
- package/dist/utils/freightAcknowledgement.js +6 -5
- package/dist/utils/freightCommercial.js +194 -0
- package/dist/utils/freightRecovery.js +22 -22
- package/package.json +4 -3
- package/src/generated/freight-cost-operations.ts +831 -1
- package/src/movethewheels/components/freight-cost/FreightCommercialEditor.tsx +236 -0
- package/src/movethewheels/components/freight-cost/FreightCommercialFactEditor.tsx +258 -0
- package/src/movethewheels/components/freight-cost/FreightCommercialHistory.tsx +90 -0
- package/src/movethewheels/components/freight-cost/FreightDraftForm.tsx +33 -4
- package/src/movethewheels/components/freight-cost/FreightHistory.tsx +4 -2
- package/src/movethewheels/hooks/useFreightRecoveryAction.ts +2 -1
- package/src/movethewheels/pages/FreightEstimatePage.tsx +14 -7
- package/src/movethewheels/utils/freightAcknowledgement.ts +3 -1
- package/src/movethewheels/utils/freightCommercial.ts +388 -0
- package/src/movethewheels/utils/freightRecovery.ts +6 -2
- package/src/operations/freight-cost/commercial.graphql +483 -0
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { useMoveTheWheels as e } from "../providers/MoveTheWheelsProvider.js";
|
|
2
2
|
import { useConditionApi as t } from "./useContainerCondition.js";
|
|
3
3
|
import { reuseRecoveryContextKey as n, reuseRecoveryScope as r, sameReuseRecoveryScope as i } from "../utils/reuseRecovery.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { FREIGHT_RECOVERY_STORAGE as
|
|
7
|
-
import { useRef as
|
|
8
|
-
import { print as
|
|
4
|
+
import { SaveFreightCommercialCostsDocument as a, SaveFreightCostsDocument as o } from "../src/generated/freight-cost-operations.js";
|
|
5
|
+
import { matchesFreightAcknowledgement as s } from "../utils/freightAcknowledgement.js";
|
|
6
|
+
import { FREIGHT_RECOVERY_STORAGE as c, decodeFreightRecovery as l, encodeFreightRecovery as u } from "../utils/freightRecovery.js";
|
|
7
|
+
import { useRef as d, useState as f } from "react";
|
|
8
|
+
import { print as p } from "graphql";
|
|
9
9
|
//#region src/movethewheels/hooks/useFreightRecoveryAction.ts
|
|
10
|
-
var
|
|
11
|
-
function
|
|
10
|
+
var m = [o, a];
|
|
11
|
+
function h() {
|
|
12
12
|
try {
|
|
13
|
-
let e = sessionStorage.getItem(
|
|
13
|
+
let e = sessionStorage.getItem(c), t = l(e);
|
|
14
14
|
return {
|
|
15
15
|
attempt: t,
|
|
16
16
|
blocked: e !== null && t === null
|
|
@@ -22,8 +22,8 @@ function m() {
|
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
|
-
function
|
|
26
|
-
let
|
|
25
|
+
function g() {
|
|
26
|
+
let a = t("SINGLE_ATTEMPT"), o = e(), g = r(o.currentUser?.id, o.workspaceId, o.tenantId, o.apiGatewayUrl, o.workspaceToken), [_] = f(h), [v, y] = f(_.attempt), [b, x] = f(_.blocked), S = d(v), C = d(!1), [w, T] = f(!1), E = n(g), [D, O] = f({
|
|
27
27
|
scopeKey: E,
|
|
28
28
|
error: null,
|
|
29
29
|
notice: null
|
|
@@ -35,25 +35,25 @@ function h() {
|
|
|
35
35
|
scopeKey: E,
|
|
36
36
|
error: null,
|
|
37
37
|
notice: e
|
|
38
|
-
}), [j, M] =
|
|
39
|
-
if (e) sessionStorage.setItem(
|
|
38
|
+
}), [j, M] = f(0), N = (e, t) => {
|
|
39
|
+
if (e) sessionStorage.setItem(c, u(e));
|
|
40
40
|
else {
|
|
41
|
-
let e =
|
|
42
|
-
(!t || e?.key === t.key && i(e.scope, t.scope)) && sessionStorage.removeItem(
|
|
41
|
+
let e = l(sessionStorage.getItem(c));
|
|
42
|
+
(!t || e?.key === t.key && i(e.scope, t.scope)) && sessionStorage.removeItem(c);
|
|
43
43
|
}
|
|
44
44
|
S.current = e, y(e), x(!1);
|
|
45
45
|
}, P = async (e) => {
|
|
46
46
|
if (C.current) return null;
|
|
47
47
|
if (!i(e.scope, g)) return k("Return to the original account, organization, workspace and project before retrying."), null;
|
|
48
|
-
let t =
|
|
48
|
+
let t = m.find((t) => p(t) === e.operation);
|
|
49
49
|
if (!t) return k("The saved operation changed. Check history before abandoning this attempt."), null;
|
|
50
50
|
C.current = !0, T(!0), k(null), A(null);
|
|
51
51
|
try {
|
|
52
|
-
let n = await
|
|
52
|
+
let n = await a(t, { input: {
|
|
53
53
|
...e.input,
|
|
54
54
|
idempotencyKey: e.key
|
|
55
55
|
} });
|
|
56
|
-
if (!
|
|
56
|
+
if (!s(n, e.input)) throw Error("The save reply could not be confirmed. Keep the original request and check history.");
|
|
57
57
|
return N(null, e), M((e) => e + 1), A(e.success), n;
|
|
58
58
|
} catch (e) {
|
|
59
59
|
return k(e instanceof Error ? e.message : "Unable to save. Check history before retrying."), null;
|
|
@@ -65,8 +65,8 @@ function h() {
|
|
|
65
65
|
run: async (e, t, n) => {
|
|
66
66
|
if (C.current || S.current || b) return k("Resolve the original request before starting another."), null;
|
|
67
67
|
if (!g) return k("Wait for the current account and workspace session."), null;
|
|
68
|
-
let r =
|
|
69
|
-
if (!
|
|
68
|
+
let r = p(e);
|
|
69
|
+
if (!m.some((e) => p(e) === r)) return k("Unsupported freight operation."), null;
|
|
70
70
|
try {
|
|
71
71
|
if (sessionStorage.getItem("movethewheels.freight.unresolved.v1") !== null) return k("A saved request is unresolved. Reload this page and check history before starting another."), null;
|
|
72
72
|
} catch {
|
|
@@ -114,4 +114,4 @@ function h() {
|
|
|
114
114
|
};
|
|
115
115
|
}
|
|
116
116
|
//#endregion
|
|
117
|
-
export {
|
|
117
|
+
export { g as useFreightRecoveryAction };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { CommercialEditorState } from '../../utils/freightCommercial';
|
|
2
|
+
import { SelectedEvidence } from '../ContainerEvidencePicker';
|
|
3
|
+
export declare function FreightCommercialEditor({ value, onChange, shipmentId, evidence, }: {
|
|
4
|
+
value: CommercialEditorState | null;
|
|
5
|
+
onChange: (value: CommercialEditorState | null) => void;
|
|
6
|
+
shipmentId: string;
|
|
7
|
+
evidence: SelectedEvidence[];
|
|
8
|
+
}): import('react').JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { CommercialSlot, CommercialFactDraft } from '../../utils/freightCommercial';
|
|
2
|
+
import { SelectedEvidence } from '../ContainerEvidencePicker';
|
|
3
|
+
export declare function FreightCommercialFactEditor({ slot, value, onChange, evidence, }: {
|
|
4
|
+
slot: CommercialSlot;
|
|
5
|
+
value: CommercialFactDraft;
|
|
6
|
+
onChange: (value: CommercialFactDraft) => void;
|
|
7
|
+
evidence: SelectedEvidence[];
|
|
8
|
+
}): import('react').JSX.Element;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { FreightCommercialVersionQuery } from '../../../generated/freight-cost-operations';
|
|
2
|
+
export declare function FreightCommercialHistory({ capture, }: {
|
|
3
|
+
capture: FreightCommercialVersionQuery['mtwFreightEstimateVersion']['commercialCapture'];
|
|
4
|
+
}): import('react').JSX.Element;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { CommercialCapture } from '../../utils/freightCommercial';
|
|
1
2
|
import { MtwFreightFactsInput, PreviewFreightCostsQuery } from '../../../generated/freight-cost-operations';
|
|
2
3
|
import { SelectedEvidence } from '../ContainerEvidencePicker';
|
|
3
|
-
export declare function FreightDraftForm({ disabled, onPreview, onSave, }: {
|
|
4
|
+
export declare function FreightDraftForm({ disabled, shipmentId, onPreview, onSave, }: {
|
|
4
5
|
disabled: boolean;
|
|
6
|
+
shipmentId: string;
|
|
5
7
|
onPreview: (facts: MtwFreightFactsInput) => Promise<PreviewFreightCostsQuery['previewMtwFreightTotal']>;
|
|
6
|
-
onSave: (facts: MtwFreightFactsInput, evidence: SelectedEvidence[]) => Promise<void>;
|
|
8
|
+
onSave: (facts: MtwFreightFactsInput, evidence: SelectedEvidence[], commercialCapture?: CommercialCapture) => Promise<void>;
|
|
7
9
|
}): import('react').JSX.Element;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FreightCommercialVersionQuery } from '../../../generated/freight-cost-operations';
|
|
2
2
|
export declare function FreightHistory({ record, }: {
|
|
3
|
-
record:
|
|
3
|
+
record: FreightCommercialVersionQuery['mtwFreightEstimateVersion'];
|
|
4
4
|
}): import('react').JSX.Element;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { MtwFreightCommercialCaptureInput, MtwFreightCommercialStatus, FreightCommercialLegsQuery } from '../../generated/freight-cost-operations';
|
|
2
|
+
export declare const commercialSlots: readonly ["origin", "destination", "carrier", "service", "cargo", "weight", "volume", "equipment"];
|
|
3
|
+
export type CommercialSlot = (typeof commercialSlots)[number];
|
|
4
|
+
export type CommercialLeg = NonNullable<FreightCommercialLegsQuery['shipment']>['legs'][number];
|
|
5
|
+
export type CommercialCapture = MtwFreightCommercialCaptureInput;
|
|
6
|
+
export declare const unrecordedCommercialReason = "Not recorded for this cost version";
|
|
7
|
+
export interface CommercialFactDraft {
|
|
8
|
+
status: MtwFreightCommercialStatus;
|
|
9
|
+
reason: string;
|
|
10
|
+
label: string;
|
|
11
|
+
reference: string;
|
|
12
|
+
description: string;
|
|
13
|
+
kind: string;
|
|
14
|
+
jurisdiction: string;
|
|
15
|
+
amount: string;
|
|
16
|
+
unit: string;
|
|
17
|
+
zeroReason: string;
|
|
18
|
+
count: string;
|
|
19
|
+
sourceReference: string;
|
|
20
|
+
sourceRevision: string;
|
|
21
|
+
observedAt: string;
|
|
22
|
+
evidenceLinks: {
|
|
23
|
+
fileId: string;
|
|
24
|
+
versionId: string;
|
|
25
|
+
}[];
|
|
26
|
+
}
|
|
27
|
+
export type CommercialDraft = Record<CommercialSlot, CommercialFactDraft>;
|
|
28
|
+
export interface CommercialEditorState {
|
|
29
|
+
facts: CommercialDraft;
|
|
30
|
+
selectedLegs: CommercialCapture['selectedLegs'];
|
|
31
|
+
reviewed: string | null;
|
|
32
|
+
}
|
|
33
|
+
export declare function newCommercialEditor(): CommercialEditorState;
|
|
34
|
+
export declare function newCommercialFact(status?: MtwFreightCommercialStatus): CommercialFactDraft;
|
|
35
|
+
export declare function newCommercialDraft(): CommercialDraft;
|
|
36
|
+
/** No source values are inferred from the owner snapshot or other fact slots. */
|
|
37
|
+
export declare function commercialCaptureInput(draft: CommercialDraft, pins: CommercialCapture['selectedLegs'], evidence: {
|
|
38
|
+
fileId: string;
|
|
39
|
+
versionId: string;
|
|
40
|
+
}[]): CommercialCapture;
|
|
41
|
+
export declare function commercialPinsMatch(pins: CommercialCapture['selectedLegs'], legs: CommercialLeg[], shipmentId: string): boolean;
|
|
42
|
+
/** Compare typed GraphQL output with the canonical input without trusting __typename or key order. */
|
|
43
|
+
export declare function commercialCanonical(value: unknown): string;
|
|
44
|
+
export declare function matchesCommercialCapture(receipt: unknown, input: Record<string, unknown>): boolean;
|
|
@@ -3,144 +3,147 @@ import { Button as t } from "../components/ui.js";
|
|
|
3
3
|
import { PageLayout as n } from "../components/PageLayout.js";
|
|
4
4
|
import { useConditionApi as r, useConditionQuery as i } from "../hooks/useContainerCondition.js";
|
|
5
5
|
import { PinnedSelect as a, ReusePager as o, ReuseState as s, reuseCard as c } from "../components/ReuseControls.js";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
6
|
+
import { FreightCommercialVersionDocument as l, FreightHistoryDocument as u, FreightShipmentDocument as d, FreightShipmentsDocument as f, PreviewFreightCostsDocument as ee, SaveFreightCommercialCostsDocument as p, SaveFreightCostsDocument as m } from "../src/generated/freight-cost-operations.js";
|
|
7
|
+
import { FreightText as h } from "../components/freight-cost/FreightFields.js";
|
|
8
|
+
import { freightPinMatches as g, freightSaveInput as _ } from "../utils/freightDraft.js";
|
|
9
|
+
import { FreightDraftForm as v } from "../components/freight-cost/FreightDraftForm.js";
|
|
10
|
+
import { FreightHistory as te } from "../components/freight-cost/FreightHistory.js";
|
|
11
11
|
import { useFreightRecoveryAction as y } from "../hooks/useFreightRecoveryAction.js";
|
|
12
|
-
import { useEffect as
|
|
13
|
-
import { Fragment as
|
|
12
|
+
import { useEffect as b, useRef as x, useState as S } from "react";
|
|
13
|
+
import { Fragment as C, jsx as w, jsxs as T } from "react/jsx-runtime";
|
|
14
14
|
//#region src/movethewheels/pages/FreightEstimatePage.tsx
|
|
15
|
-
function
|
|
15
|
+
function E() {
|
|
16
16
|
let t = y();
|
|
17
|
-
return /* @__PURE__ */
|
|
17
|
+
return /* @__PURE__ */ w(n, {
|
|
18
18
|
title: "Freight cost estimates",
|
|
19
19
|
subtitle: "Dated source costs, visible unknowns and immutable versions.",
|
|
20
|
-
icon: /* @__PURE__ */
|
|
21
|
-
children: /* @__PURE__ */
|
|
20
|
+
icon: /* @__PURE__ */ w(e, { "aria-hidden": "true" }),
|
|
21
|
+
children: /* @__PURE__ */ w(D, { actions: t }, t.contextKey)
|
|
22
22
|
});
|
|
23
23
|
}
|
|
24
|
-
function
|
|
25
|
-
let n = r(), [y,
|
|
26
|
-
|
|
24
|
+
function D({ actions: e }) {
|
|
25
|
+
let n = r(), [y, E] = S(0), [D, O] = S(0), [k, A] = S(null), [j, M] = S(""), [N, P] = S(null), [F, I] = S(null), [ne, L] = S(!1), [R, z] = S(!1), [B, V] = S(null), H = x(!0), U = x(!1);
|
|
26
|
+
b(() => (H.current = !0, () => {
|
|
27
27
|
H.current = !1;
|
|
28
28
|
}), []);
|
|
29
|
-
let W = i(
|
|
29
|
+
let W = i(f, { pagination: {
|
|
30
30
|
limit: 25,
|
|
31
31
|
offset: y
|
|
32
|
-
} }, e.revision), G = i(
|
|
33
|
-
shipmentId:
|
|
34
|
-
estimateReference:
|
|
32
|
+
} }, e.revision), G = i(d, k ? { id: k.id } : null, e.revision), K = i(u, k && j.trim() ? {
|
|
33
|
+
shipmentId: k.id,
|
|
34
|
+
estimateReference: j.trim(),
|
|
35
35
|
pagination: {
|
|
36
36
|
limit: 1,
|
|
37
37
|
offset: 0
|
|
38
38
|
}
|
|
39
|
-
} : null, e.revision), q = e.uncertain ? e.originalHistoryTarget :
|
|
40
|
-
shipmentId:
|
|
39
|
+
} : null, e.revision), q = e.uncertain ? e.originalHistoryTarget : k ? {
|
|
40
|
+
shipmentId: k.id,
|
|
41
41
|
estimateReference: void 0
|
|
42
|
-
} : null, J = i(
|
|
42
|
+
} : null, J = i(u, q ? {
|
|
43
43
|
shipmentId: q.shipmentId,
|
|
44
44
|
estimateReference: q.estimateReference,
|
|
45
45
|
pagination: {
|
|
46
46
|
limit: 10,
|
|
47
|
-
offset:
|
|
47
|
+
offset: D
|
|
48
48
|
}
|
|
49
|
-
} : null, e.revision), Y = i(
|
|
49
|
+
} : null, e.revision), Y = i(l, q && N ? {
|
|
50
50
|
shipmentId: q.shipmentId,
|
|
51
|
-
id:
|
|
52
|
-
} : null, e.revision), X = K.data?.mtwFreightEstimatePage.items[0] ?? null, Z = !!
|
|
51
|
+
id: N
|
|
52
|
+
} : null, e.revision), X = K.data?.mtwFreightEstimatePage.items[0] ?? null, Z = !!F && !!G.data && !!K.data && !g(F, G.data.shipment, X), Q = e.busy || ne || e.uncertain, $ = W.data?.shipments.map((e) => ({
|
|
53
53
|
id: e.id,
|
|
54
54
|
label: `${e.shipmentNumber} — ${e.primaryMode} — ${e.status}`
|
|
55
55
|
})) ?? [];
|
|
56
|
-
|
|
57
|
-
id:
|
|
58
|
-
label: `${
|
|
56
|
+
k && !$.some((e) => e.id === k.id) && $.unshift({
|
|
57
|
+
id: k.id,
|
|
58
|
+
label: `${k.label} — selected outside this page`
|
|
59
59
|
});
|
|
60
|
-
let
|
|
60
|
+
let re = async (t, r, i) => {
|
|
61
61
|
if (U.current || Q) return;
|
|
62
|
-
if (!
|
|
62
|
+
if (!F) throw Error("Review the shipment and current cost history first.");
|
|
63
63
|
U.current = !0, L(!0), V(null);
|
|
64
|
-
let
|
|
64
|
+
let a = F;
|
|
65
65
|
try {
|
|
66
|
-
let
|
|
67
|
-
shipmentId:
|
|
68
|
-
estimateReference:
|
|
66
|
+
let o = await n(d, { id: a.shipmentId }), s = await n(u, {
|
|
67
|
+
shipmentId: a.shipmentId,
|
|
68
|
+
estimateReference: a.estimateReference,
|
|
69
69
|
pagination: {
|
|
70
70
|
limit: 1,
|
|
71
71
|
offset: 0
|
|
72
72
|
}
|
|
73
73
|
});
|
|
74
74
|
if (!H.current) throw Error("The current workspace changed. Nothing was sent.");
|
|
75
|
-
let
|
|
76
|
-
|
|
77
|
-
let
|
|
75
|
+
let c = s.mtwFreightEstimatePage.items[0] ?? null;
|
|
76
|
+
g(a, o.shipment, c) || z(!0);
|
|
77
|
+
let l = _(a, o.shipment, c, t, r.map(({ fileId: e, versionId: t }) => ({
|
|
78
78
|
fileId: e,
|
|
79
79
|
versionId: t
|
|
80
|
-
}))),
|
|
81
|
-
|
|
80
|
+
}))), f = await e.run(i ? p : m, i ? {
|
|
81
|
+
...l,
|
|
82
|
+
commercialCapture: i
|
|
83
|
+
} : l, "Sourced cost version recorded.");
|
|
84
|
+
f && H.current && (P(f.saveMtwFreightEstimate.id), I(null), O(0));
|
|
82
85
|
} finally {
|
|
83
86
|
H.current && L(!1), U.current = !1;
|
|
84
87
|
}
|
|
85
|
-
},
|
|
88
|
+
}, ie = W.data ? {
|
|
86
89
|
total: W.data.shipmentsCount,
|
|
87
90
|
limit: 25,
|
|
88
91
|
offset: y,
|
|
89
92
|
hasMore: y + W.data.shipments.length < W.data.shipmentsCount,
|
|
90
93
|
nextOffset: y + 25
|
|
91
94
|
} : void 0;
|
|
92
|
-
return /* @__PURE__ */
|
|
95
|
+
return /* @__PURE__ */ T("div", {
|
|
93
96
|
className: "min-w-0 space-y-6 break-words",
|
|
94
97
|
children: [
|
|
95
|
-
/* @__PURE__ */
|
|
98
|
+
/* @__PURE__ */ w("p", {
|
|
96
99
|
className: "rounded border p-4 text-sm",
|
|
97
100
|
children: "Record the costs stated by your source. Missing facts are not zero. Saving does not book freight, accept a quote or settle an invoice."
|
|
98
101
|
}),
|
|
99
|
-
/* @__PURE__ */
|
|
102
|
+
/* @__PURE__ */ T("section", {
|
|
100
103
|
className: c,
|
|
101
104
|
children: [
|
|
102
|
-
/* @__PURE__ */
|
|
105
|
+
/* @__PURE__ */ w("h2", {
|
|
103
106
|
className: "text-lg font-semibold",
|
|
104
107
|
children: "Shipment and cost sheet"
|
|
105
108
|
}),
|
|
106
|
-
/* @__PURE__ */
|
|
109
|
+
/* @__PURE__ */ w(a, {
|
|
107
110
|
label: "Shipment",
|
|
108
|
-
value:
|
|
111
|
+
value: k?.id ?? "",
|
|
109
112
|
options: $,
|
|
110
113
|
disabled: Q,
|
|
111
114
|
onChange: (e) => {
|
|
112
115
|
let t = $.find((t) => t.id === e);
|
|
113
|
-
|
|
116
|
+
A(t ? {
|
|
114
117
|
id: t.id,
|
|
115
118
|
label: t.label
|
|
116
|
-
} : null),
|
|
119
|
+
} : null), I(null), P(null), O(0), z(!1);
|
|
117
120
|
}
|
|
118
121
|
}),
|
|
119
|
-
/* @__PURE__ */
|
|
122
|
+
/* @__PURE__ */ w(s, {
|
|
120
123
|
loading: W.loading,
|
|
121
124
|
error: W.error
|
|
122
125
|
}),
|
|
123
|
-
/* @__PURE__ */
|
|
124
|
-
page:
|
|
126
|
+
/* @__PURE__ */ w(o, {
|
|
127
|
+
page: ie,
|
|
125
128
|
busy: W.loading || Q,
|
|
126
129
|
offset: y,
|
|
127
|
-
onChange:
|
|
130
|
+
onChange: E
|
|
128
131
|
}),
|
|
129
|
-
/* @__PURE__ */
|
|
132
|
+
/* @__PURE__ */ w(h, {
|
|
130
133
|
label: "Cost sheet reference",
|
|
131
|
-
value:
|
|
132
|
-
disabled: Q ||
|
|
133
|
-
onChange:
|
|
134
|
+
value: j,
|
|
135
|
+
disabled: Q || F !== null,
|
|
136
|
+
onChange: M
|
|
134
137
|
}),
|
|
135
|
-
/* @__PURE__ */
|
|
138
|
+
/* @__PURE__ */ w(s, {
|
|
136
139
|
loading: G.loading,
|
|
137
140
|
error: G.error
|
|
138
141
|
}),
|
|
139
|
-
/* @__PURE__ */
|
|
142
|
+
/* @__PURE__ */ w(s, {
|
|
140
143
|
loading: K.loading,
|
|
141
144
|
error: K.error
|
|
142
145
|
}),
|
|
143
|
-
G.data?.shipment && /* @__PURE__ */
|
|
146
|
+
G.data?.shipment && /* @__PURE__ */ T("p", { children: [
|
|
144
147
|
G.data.shipment.shipmentNumber,
|
|
145
148
|
" — ",
|
|
146
149
|
G.data.shipment.primaryMode,
|
|
@@ -149,23 +152,23 @@ function E({ actions: e }) {
|
|
|
149
152
|
X ? `latest sheet version ${X.version}` : "no version in the loaded sheet",
|
|
150
153
|
"."
|
|
151
154
|
] }),
|
|
152
|
-
/* @__PURE__ */
|
|
155
|
+
/* @__PURE__ */ T("div", {
|
|
153
156
|
className: "flex flex-wrap gap-3",
|
|
154
|
-
children: [/* @__PURE__ */
|
|
157
|
+
children: [/* @__PURE__ */ w(t, {
|
|
155
158
|
type: "button",
|
|
156
159
|
variant: "outline",
|
|
157
160
|
disabled: Q,
|
|
158
161
|
onClick: e.refresh,
|
|
159
162
|
children: "Refresh current records"
|
|
160
|
-
}), /* @__PURE__ */
|
|
163
|
+
}), /* @__PURE__ */ w(t, {
|
|
161
164
|
type: "button",
|
|
162
|
-
disabled: Q || G.loading || K.loading || !!G.error || !!K.error || !G.data?.shipment || !K.data || !
|
|
165
|
+
disabled: Q || G.loading || K.loading || !!G.error || !!K.error || !G.data?.shipment || !K.data || !j.trim(),
|
|
163
166
|
onClick: () => {
|
|
164
167
|
let e = G.data?.shipment;
|
|
165
|
-
e && K.data && (
|
|
168
|
+
e && K.data && (I({
|
|
166
169
|
shipmentId: e.id,
|
|
167
170
|
shipmentUpdatedAt: e.updatedAt,
|
|
168
|
-
estimateReference:
|
|
171
|
+
estimateReference: j.trim(),
|
|
169
172
|
previousId: X?.id ?? null,
|
|
170
173
|
version: X?.version ?? 0,
|
|
171
174
|
generation: crypto.randomUUID()
|
|
@@ -176,42 +179,43 @@ function E({ actions: e }) {
|
|
|
176
179
|
})
|
|
177
180
|
]
|
|
178
181
|
}),
|
|
179
|
-
(Z || R) && /* @__PURE__ */
|
|
182
|
+
(Z || R) && /* @__PURE__ */ w("p", {
|
|
180
183
|
role: "alert",
|
|
181
184
|
children: "The shipment or cost history changed. Review the current records and explicitly start a new draft; entered facts were not rebound."
|
|
182
185
|
}),
|
|
183
|
-
|
|
186
|
+
F && !Z && !R && /* @__PURE__ */ w(v, {
|
|
187
|
+
shipmentId: F.shipmentId,
|
|
184
188
|
disabled: Q || G.loading || K.loading || !!G.error || !!K.error,
|
|
185
|
-
onPreview: async (e) => (await n(
|
|
186
|
-
onSave:
|
|
187
|
-
},
|
|
188
|
-
B && /* @__PURE__ */
|
|
189
|
+
onPreview: async (e) => (await n(ee, { input: e })).previewMtwFreightTotal,
|
|
190
|
+
onSave: re
|
|
191
|
+
}, F.generation),
|
|
192
|
+
B && /* @__PURE__ */ w("p", {
|
|
189
193
|
role: "alert",
|
|
190
194
|
children: B
|
|
191
195
|
}),
|
|
192
|
-
e.error && /* @__PURE__ */
|
|
196
|
+
e.error && /* @__PURE__ */ w("p", {
|
|
193
197
|
role: "alert",
|
|
194
198
|
children: e.error
|
|
195
199
|
}),
|
|
196
|
-
e.notice && /* @__PURE__ */
|
|
200
|
+
e.notice && /* @__PURE__ */ w("p", {
|
|
197
201
|
role: "status",
|
|
198
202
|
children: e.notice
|
|
199
203
|
}),
|
|
200
|
-
e.uncertain && /* @__PURE__ */
|
|
204
|
+
e.uncertain && /* @__PURE__ */ T("section", {
|
|
201
205
|
className: "space-y-4 rounded-xl border bg-bg-surface p-5",
|
|
202
206
|
children: [
|
|
203
|
-
/* @__PURE__ */
|
|
207
|
+
/* @__PURE__ */ w("h2", {
|
|
204
208
|
className: "font-semibold",
|
|
205
209
|
children: "Resolve the original save"
|
|
206
210
|
}),
|
|
207
|
-
/* @__PURE__ */
|
|
208
|
-
/* @__PURE__ */
|
|
211
|
+
/* @__PURE__ */ w("p", { children: "The server may already have recorded it. Check history first. Return to the original account, organization, workspace and project before retrying." }),
|
|
212
|
+
/* @__PURE__ */ w(t, {
|
|
209
213
|
type: "button",
|
|
210
214
|
disabled: !e.canRetry || e.busy,
|
|
211
215
|
onClick: () => void e.retryOriginal(),
|
|
212
216
|
children: "Retry original request"
|
|
213
217
|
}),
|
|
214
|
-
/* @__PURE__ */
|
|
218
|
+
/* @__PURE__ */ w(t, {
|
|
215
219
|
type: "button",
|
|
216
220
|
variant: "outline",
|
|
217
221
|
disabled: e.busy,
|
|
@@ -222,38 +226,38 @@ function E({ actions: e }) {
|
|
|
222
226
|
})
|
|
223
227
|
]
|
|
224
228
|
}),
|
|
225
|
-
e.uncertain && !e.originalHistoryTarget && /* @__PURE__ */
|
|
229
|
+
e.uncertain && !e.originalHistoryTarget && /* @__PURE__ */ w("p", {
|
|
226
230
|
role: "status",
|
|
227
231
|
children: "Original history is unavailable in this context. Return to the original account, organization, workspace and project. A malformed saved request cannot supply a history target."
|
|
228
232
|
}),
|
|
229
|
-
q && /* @__PURE__ */
|
|
233
|
+
q && /* @__PURE__ */ T("section", {
|
|
230
234
|
className: "space-y-4 rounded-xl border bg-bg-surface p-5",
|
|
231
235
|
children: [
|
|
232
|
-
/* @__PURE__ */
|
|
236
|
+
/* @__PURE__ */ w("h2", {
|
|
233
237
|
className: "text-lg font-semibold",
|
|
234
238
|
children: e.uncertain ? "Original request cost history" : "Immutable cost history"
|
|
235
239
|
}),
|
|
236
|
-
e.uncertain && /* @__PURE__ */
|
|
240
|
+
e.uncertain && /* @__PURE__ */ T(C, { children: [/* @__PURE__ */ T("p", { children: [
|
|
237
241
|
"Shipment ",
|
|
238
242
|
q.shipmentId,
|
|
239
243
|
"; sheet ",
|
|
240
244
|
q.estimateReference,
|
|
241
245
|
". Reading these records does not confirm the original request key or clear recovery."
|
|
242
|
-
] }), /* @__PURE__ */
|
|
246
|
+
] }), /* @__PURE__ */ w(t, {
|
|
243
247
|
type: "button",
|
|
244
248
|
variant: "outline",
|
|
245
249
|
disabled: e.busy,
|
|
246
250
|
onClick: e.refresh,
|
|
247
251
|
children: "Refresh original history"
|
|
248
252
|
})] }),
|
|
249
|
-
/* @__PURE__ */
|
|
253
|
+
/* @__PURE__ */ w(s, {
|
|
250
254
|
loading: J.loading,
|
|
251
255
|
error: J.error
|
|
252
256
|
}),
|
|
253
|
-
J.data?.mtwFreightEstimatePage.items.map((e) => /* @__PURE__ */
|
|
257
|
+
J.data?.mtwFreightEstimatePage.items.map((e) => /* @__PURE__ */ T(t, {
|
|
254
258
|
type: "button",
|
|
255
259
|
variant: "outline",
|
|
256
|
-
onClick: () =>
|
|
260
|
+
onClick: () => P(e.id),
|
|
257
261
|
children: [
|
|
258
262
|
e.facts.title,
|
|
259
263
|
" / ",
|
|
@@ -265,20 +269,20 @@ function E({ actions: e }) {
|
|
|
265
269
|
new Date(e.recordedAt).toLocaleString()
|
|
266
270
|
]
|
|
267
271
|
}, e.id)),
|
|
268
|
-
/* @__PURE__ */
|
|
272
|
+
/* @__PURE__ */ w(o, {
|
|
269
273
|
page: J.data?.mtwFreightEstimatePage,
|
|
270
274
|
busy: J.loading,
|
|
271
|
-
offset:
|
|
272
|
-
onChange:
|
|
275
|
+
offset: D,
|
|
276
|
+
onChange: O
|
|
273
277
|
})
|
|
274
278
|
]
|
|
275
279
|
}),
|
|
276
|
-
q &&
|
|
280
|
+
q && N && /* @__PURE__ */ T(C, { children: [/* @__PURE__ */ w(s, {
|
|
277
281
|
loading: Y.loading,
|
|
278
282
|
error: Y.error
|
|
279
|
-
}), Y.data && /* @__PURE__ */
|
|
283
|
+
}), Y.data && /* @__PURE__ */ w(te, { record: Y.data.mtwFreightEstimateVersion })] })
|
|
280
284
|
]
|
|
281
285
|
});
|
|
282
286
|
}
|
|
283
287
|
//#endregion
|
|
284
|
-
export {
|
|
288
|
+
export { E as default };
|