@burdenoff/microfe-movethewheels 2026.1016.2 → 2026.1016.4
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/README.md +10 -0
- package/dist/MoveTheWheelsRoot.js +5 -0
- package/dist/MoveTheWheelsRoutes.js +25 -21
- package/dist/components/ContainerEvidencePicker.js +55 -55
- package/dist/components/FleetAlertsPanel.js +2 -2
- 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/components/freight-invoice/InvoiceForm.js +366 -0
- package/dist/components/freight-invoice/InvoiceResults.js +240 -0
- package/dist/generated/consolidation-operations.d.ts +195 -265
- package/dist/generated/container-condition-operations.d.ts +124 -187
- package/dist/generated/container-operations.d.ts +59 -85
- package/dist/generated/empty-reuse-operations.d.ts +165 -271
- package/dist/generated/free-time-operations.d.ts +120 -184
- package/dist/generated/freight-cost-operations.d.ts +955 -165
- package/dist/generated/freight-invoice-operations.d.ts +1447 -0
- package/dist/generated/logistics-procedure-operations.d.ts +100 -156
- package/dist/generated/pending-pick-operations.d.ts +769 -1025
- package/dist/generated/shipment-status-authority-operations.d.ts +82 -103
- package/dist/generated/stock-binding-operations.d.ts +188 -260
- package/dist/generated/stock-observation-operations.d.ts +103 -138
- package/dist/generated/tracking-quality-operations.d.ts +27 -41
- package/dist/generated/trip-utilization-operations.d.ts +137 -185
- package/dist/generated/wspace-operations.d.ts +628 -2272
- package/dist/generated/wspace-types.d.ts +4 -23
- package/dist/hooks/useFreightRecoveryAction.js +20 -20
- package/dist/hooks/useInvoiceComparisonRecovery.js +118 -0
- package/dist/movethewheels/components/ContainerEvidencePicker.d.ts +2 -1
- 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/components/freight-invoice/InvoiceForm.d.ts +19 -0
- package/dist/movethewheels/components/freight-invoice/InvoiceResults.d.ts +9 -0
- package/dist/movethewheels/hooks/useFleet.d.ts +1 -1
- package/dist/movethewheels/hooks/useFleetIntelligence.d.ts +1 -1
- package/dist/movethewheels/hooks/useInvoiceComparisonRecovery.d.ts +22 -0
- package/dist/movethewheels/hooks/useProcedureSelection.d.ts +1 -3
- package/dist/movethewheels/pages/FreightInvoicePage.d.ts +10 -0
- package/dist/movethewheels/utils/driverLicenseExpiry.d.ts +6 -0
- package/dist/movethewheels/utils/freightCommercial.d.ts +44 -0
- package/dist/movethewheels/utils/invoiceComparison.d.ts +32 -0
- package/dist/pages/DriverDetailsPage.js +306 -282
- package/dist/pages/FreightEstimatePage.js +97 -92
- package/dist/pages/FreightInvoicePage.js +346 -0
- package/dist/src/generated/consolidation-operations.js +3961 -503
- package/dist/src/generated/container-condition-operations.js +2968 -206
- package/dist/src/generated/container-operations.js +997 -99
- package/dist/src/generated/empty-reuse-operations.js +4811 -747
- package/dist/src/generated/free-time-operations.js +2824 -233
- package/dist/src/generated/freight-cost-operations.js +4852 -323
- package/dist/src/generated/freight-invoice-operations.js +4894 -0
- package/dist/src/generated/logistics-procedure-operations.js +2707 -360
- package/dist/src/generated/pending-pick-operations.js +8244 -1196
- package/dist/src/generated/shipment-status-authority-operations.js +1157 -84
- package/dist/src/generated/stock-binding-operations.js +2779 -173
- package/dist/src/generated/stock-observation-operations.js +1274 -91
- package/dist/src/generated/tracking-quality-operations.js +407 -42
- package/dist/src/generated/trip-utilization-operations.js +1765 -138
- package/dist/src/generated/wspace-operations.js +428 -706
- package/dist/utils/driverLicenseExpiry.js +14 -0
- package/dist/utils/freightAcknowledgement.js +6 -5
- package/dist/utils/freightCommercial.js +194 -0
- package/dist/utils/freightRecovery.js +22 -22
- package/dist/utils/invoiceComparison.js +272 -0
- package/package.json +30 -29
- package/src/generated/consolidation-operations.ts +60 -559
- package/src/generated/container-condition-operations.ts +63 -265
- package/src/generated/container-operations.ts +37 -132
- package/src/generated/empty-reuse-operations.ts +83 -824
- package/src/generated/free-time-operations.ts +55 -284
- package/src/generated/freight-cost-operations.ts +373 -349
- package/src/generated/freight-invoice-operations.ts +830 -0
- package/src/generated/logistics-procedure-operations.ts +60 -414
- package/src/generated/pending-pick-operations.ts +48 -1239
- package/src/generated/shipment-status-authority-operations.ts +33 -113
- package/src/generated/stock-binding-operations.ts +29 -198
- package/src/generated/stock-observation-operations.ts +24 -111
- package/src/generated/tracking-quality-operations.ts +19 -57
- package/src/generated/trip-utilization-operations.ts +32 -166
- package/src/generated/wspace-operations.ts +284 -2906
- package/src/generated/wspace-types.ts +2 -8
- package/src/movethewheels/MoveTheWheelsRoot.tsx +6 -0
- package/src/movethewheels/MoveTheWheelsRoutes.tsx +2 -0
- package/src/movethewheels/components/ContainerEvidencePicker.tsx +12 -4
- package/src/movethewheels/components/FleetAlertsPanel.tsx +4 -2
- 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/components/freight-invoice/InvoiceForm.tsx +412 -0
- package/src/movethewheels/components/freight-invoice/InvoiceResults.tsx +162 -0
- package/src/movethewheels/hooks/useFleet.ts +1 -1
- package/src/movethewheels/hooks/useFleetIntelligence.ts +5 -1
- package/src/movethewheels/hooks/useFreightRecoveryAction.ts +2 -1
- package/src/movethewheels/hooks/useInvoiceComparisonRecovery.ts +227 -0
- package/src/movethewheels/pages/DriverDetailsPage.tsx +35 -9
- package/src/movethewheels/pages/FreightEstimatePage.tsx +15 -7
- package/src/movethewheels/pages/FreightInvoicePage.tsx +477 -0
- package/src/movethewheels/utils/driverLicenseExpiry.ts +25 -0
- 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/movethewheels/utils/invoiceComparison.ts +520 -0
- package/src/operations/freight-cost/commercial.graphql +483 -0
- package/src/operations/freight-invoice/comparison.graphql +40 -0
- package/src/operations/wspace/freight-invoice-evidence.graphql +6 -0
- package/patches/braces@3.0.3.patch +0 -87
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
import { Button as e } from "../ui.js";
|
|
2
|
+
import { newCommercialFact as t } from "../../utils/freightCommercial.js";
|
|
3
|
+
import { FreightSelect as n, FreightText as r } from "./FreightFields.js";
|
|
4
|
+
import { freightInstant as i, freightLocalTime as a } from "../../utils/freightDraft.js";
|
|
5
|
+
import { useState as o } from "react";
|
|
6
|
+
import { Fragment as s, jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
7
|
+
//#region src/movethewheels/components/freight-cost/FreightCommercialFactEditor.tsx
|
|
8
|
+
function u({ slot: i, value: a, onChange: s, evidence: u }) {
|
|
9
|
+
let [p, m] = o(!1), h = i[0].toUpperCase() + i.slice(1), g = (e) => s({
|
|
10
|
+
...a,
|
|
11
|
+
...e
|
|
12
|
+
});
|
|
13
|
+
return /* @__PURE__ */ l("fieldset", {
|
|
14
|
+
className: "min-w-0 space-y-3 rounded border p-3",
|
|
15
|
+
children: [
|
|
16
|
+
/* @__PURE__ */ c("legend", {
|
|
17
|
+
className: "px-1 font-semibold",
|
|
18
|
+
children: h
|
|
19
|
+
}),
|
|
20
|
+
/* @__PURE__ */ l(n, {
|
|
21
|
+
label: `${h} status`,
|
|
22
|
+
value: a.status,
|
|
23
|
+
onChange: (e) => {
|
|
24
|
+
(e === "UNKNOWN" || e === "SOURCED" || e === "NOT_APPLICABLE") && (m(!1), s(t(e)));
|
|
25
|
+
},
|
|
26
|
+
children: [
|
|
27
|
+
/* @__PURE__ */ c("option", {
|
|
28
|
+
value: "UNKNOWN",
|
|
29
|
+
children: "Unknown — not recorded"
|
|
30
|
+
}),
|
|
31
|
+
/* @__PURE__ */ c("option", {
|
|
32
|
+
value: "SOURCED",
|
|
33
|
+
children: "Sourced"
|
|
34
|
+
}),
|
|
35
|
+
/* @__PURE__ */ c("option", {
|
|
36
|
+
value: "NOT_APPLICABLE",
|
|
37
|
+
children: "Not applicable"
|
|
38
|
+
})
|
|
39
|
+
]
|
|
40
|
+
}),
|
|
41
|
+
a.status === "UNKNOWN" && !p && /* @__PURE__ */ l("div", {
|
|
42
|
+
className: "flex flex-wrap items-center gap-2",
|
|
43
|
+
children: [/* @__PURE__ */ c("p", { children: a.reason }), /* @__PURE__ */ l(e, {
|
|
44
|
+
type: "button",
|
|
45
|
+
variant: "outline",
|
|
46
|
+
onClick: () => m(!0),
|
|
47
|
+
children: [
|
|
48
|
+
"Edit ",
|
|
49
|
+
h.toLowerCase(),
|
|
50
|
+
" reason"
|
|
51
|
+
]
|
|
52
|
+
})]
|
|
53
|
+
}),
|
|
54
|
+
(a.status === "NOT_APPLICABLE" || a.status === "UNKNOWN" && p) && /* @__PURE__ */ c(r, {
|
|
55
|
+
label: `${h} reason`,
|
|
56
|
+
value: a.reason,
|
|
57
|
+
required: !0,
|
|
58
|
+
onChange: (e) => g({ reason: e })
|
|
59
|
+
}),
|
|
60
|
+
a.status === "SOURCED" && /* @__PURE__ */ c(d, {
|
|
61
|
+
slot: i,
|
|
62
|
+
label: h,
|
|
63
|
+
value: a,
|
|
64
|
+
patch: g
|
|
65
|
+
}),
|
|
66
|
+
a.status !== "UNKNOWN" && /* @__PURE__ */ c(f, {
|
|
67
|
+
label: h,
|
|
68
|
+
value: a,
|
|
69
|
+
patch: g,
|
|
70
|
+
evidence: u
|
|
71
|
+
})
|
|
72
|
+
]
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
function d({ slot: e, label: t, value: i, patch: a }) {
|
|
76
|
+
return /* @__PURE__ */ l(s, { children: [
|
|
77
|
+
(e === "origin" || e === "destination") && /* @__PURE__ */ l(s, { children: [/* @__PURE__ */ l(n, {
|
|
78
|
+
label: `${t} label kind`,
|
|
79
|
+
value: i.kind,
|
|
80
|
+
onChange: (e) => a({ kind: e }),
|
|
81
|
+
children: [/* @__PURE__ */ c("option", {
|
|
82
|
+
value: "",
|
|
83
|
+
children: "Choose a label kind"
|
|
84
|
+
}), [
|
|
85
|
+
"ADDRESS_LABEL",
|
|
86
|
+
"PORT_LABEL",
|
|
87
|
+
"TERMINAL_LABEL",
|
|
88
|
+
"POSTCODE_LABEL",
|
|
89
|
+
"CUSTOM_LABEL"
|
|
90
|
+
].map((e) => /* @__PURE__ */ c("option", {
|
|
91
|
+
value: e,
|
|
92
|
+
children: e.replaceAll("_", " ").toLowerCase()
|
|
93
|
+
}, e))]
|
|
94
|
+
}), /* @__PURE__ */ c(r, {
|
|
95
|
+
label: `${t} jurisdiction label (optional)`,
|
|
96
|
+
value: i.jurisdiction,
|
|
97
|
+
onChange: (e) => a({ jurisdiction: e })
|
|
98
|
+
})] }),
|
|
99
|
+
e === "carrier" && /* @__PURE__ */ c(r, {
|
|
100
|
+
label: "Carrier reference",
|
|
101
|
+
value: i.reference,
|
|
102
|
+
required: !0,
|
|
103
|
+
onChange: (e) => a({ reference: e })
|
|
104
|
+
}),
|
|
105
|
+
e !== "weight" && e !== "volume" && /* @__PURE__ */ c(r, {
|
|
106
|
+
label: e === "cargo" ? "Cargo classification label" : e === "equipment" ? "Equipment type label" : `${t} label`,
|
|
107
|
+
value: i.label,
|
|
108
|
+
required: !0,
|
|
109
|
+
onChange: (e) => a({ label: e })
|
|
110
|
+
}),
|
|
111
|
+
e === "cargo" && /* @__PURE__ */ c(r, {
|
|
112
|
+
label: "Cargo description",
|
|
113
|
+
value: i.description,
|
|
114
|
+
required: !0,
|
|
115
|
+
onChange: (e) => a({ description: e })
|
|
116
|
+
}),
|
|
117
|
+
(e === "weight" || e === "volume") && /* @__PURE__ */ l(s, { children: [
|
|
118
|
+
/* @__PURE__ */ c(r, {
|
|
119
|
+
label: `${t} amount`,
|
|
120
|
+
value: i.amount,
|
|
121
|
+
required: !0,
|
|
122
|
+
onChange: (e) => a({
|
|
123
|
+
amount: e,
|
|
124
|
+
zeroReason: e === "0" ? i.zeroReason : ""
|
|
125
|
+
})
|
|
126
|
+
}),
|
|
127
|
+
/* @__PURE__ */ l(n, {
|
|
128
|
+
label: `${t} recorded unit`,
|
|
129
|
+
value: i.unit,
|
|
130
|
+
onChange: (e) => a({ unit: e }),
|
|
131
|
+
children: [/* @__PURE__ */ c("option", {
|
|
132
|
+
value: "",
|
|
133
|
+
children: "Choose a unit"
|
|
134
|
+
}), (e === "weight" ? [
|
|
135
|
+
"KG",
|
|
136
|
+
"TONNE",
|
|
137
|
+
"LB"
|
|
138
|
+
] : ["M3", "FT3"]).map((e) => /* @__PURE__ */ c("option", {
|
|
139
|
+
value: e,
|
|
140
|
+
children: e
|
|
141
|
+
}, e))]
|
|
142
|
+
}),
|
|
143
|
+
i.amount === "0" && /* @__PURE__ */ c(r, {
|
|
144
|
+
label: `${t} recorded zero reason`,
|
|
145
|
+
value: i.zeroReason,
|
|
146
|
+
required: !0,
|
|
147
|
+
onChange: (e) => a({ zeroReason: e })
|
|
148
|
+
}),
|
|
149
|
+
/* @__PURE__ */ c("p", {
|
|
150
|
+
className: "text-sm",
|
|
151
|
+
children: "Record the source unit. No conversion is inferred."
|
|
152
|
+
})
|
|
153
|
+
] }),
|
|
154
|
+
e === "equipment" && /* @__PURE__ */ c(r, {
|
|
155
|
+
label: "Equipment count",
|
|
156
|
+
value: i.count,
|
|
157
|
+
required: !0,
|
|
158
|
+
onChange: (e) => a({ count: e })
|
|
159
|
+
})
|
|
160
|
+
] });
|
|
161
|
+
}
|
|
162
|
+
function f({ label: e, value: t, patch: n, evidence: o }) {
|
|
163
|
+
return /* @__PURE__ */ l(s, { children: [
|
|
164
|
+
/* @__PURE__ */ l("h4", {
|
|
165
|
+
className: "font-medium",
|
|
166
|
+
children: [e, " source declaration"]
|
|
167
|
+
}),
|
|
168
|
+
/* @__PURE__ */ c(r, {
|
|
169
|
+
label: `${e} source reference`,
|
|
170
|
+
value: t.sourceReference,
|
|
171
|
+
required: !0,
|
|
172
|
+
onChange: (e) => n({ sourceReference: e })
|
|
173
|
+
}),
|
|
174
|
+
/* @__PURE__ */ c(r, {
|
|
175
|
+
label: `${e} source revision`,
|
|
176
|
+
value: t.sourceRevision,
|
|
177
|
+
required: !0,
|
|
178
|
+
onChange: (e) => n({ sourceRevision: e })
|
|
179
|
+
}),
|
|
180
|
+
/* @__PURE__ */ c(r, {
|
|
181
|
+
label: `${e} observed at (local time, optional)`,
|
|
182
|
+
type: "datetime-local",
|
|
183
|
+
value: t.observedAt ? a(t.observedAt) : "",
|
|
184
|
+
onChange: (e) => n({ observedAt: e ? i(e) : "" })
|
|
185
|
+
}),
|
|
186
|
+
/* @__PURE__ */ c("p", {
|
|
187
|
+
className: "text-sm",
|
|
188
|
+
children: "Blank observation time is recorded as Unknown. No date is inferred from the upload or file check."
|
|
189
|
+
}),
|
|
190
|
+
/* @__PURE__ */ c("p", {
|
|
191
|
+
className: "text-sm",
|
|
192
|
+
children: "Choose 1–2 versions from the evidence selected below for this record. This declares the source; it does not verify its authority."
|
|
193
|
+
}),
|
|
194
|
+
o.map((e) => {
|
|
195
|
+
let r = t.evidenceLinks.some((t) => t.fileId === e.fileId && t.versionId === e.versionId);
|
|
196
|
+
return /* @__PURE__ */ l("label", {
|
|
197
|
+
className: "flex min-h-11 items-center gap-2 break-words text-sm",
|
|
198
|
+
children: [/* @__PURE__ */ c("input", {
|
|
199
|
+
type: "checkbox",
|
|
200
|
+
checked: r,
|
|
201
|
+
disabled: !r && t.evidenceLinks.length >= 2,
|
|
202
|
+
onChange: () => n({ evidenceLinks: r ? t.evidenceLinks.filter((t) => !(t.fileId === e.fileId && t.versionId === e.versionId)) : [...t.evidenceLinks, {
|
|
203
|
+
fileId: e.fileId,
|
|
204
|
+
versionId: e.versionId
|
|
205
|
+
}] })
|
|
206
|
+
}), e.label]
|
|
207
|
+
}, e.versionId);
|
|
208
|
+
}),
|
|
209
|
+
!o.length && /* @__PURE__ */ c("p", { children: "Select an exact Files version in Evidence for this record." }),
|
|
210
|
+
t.evidenceLinks.some((e) => !o.some((t) => t.fileId === e.fileId && t.versionId === e.versionId)) && /* @__PURE__ */ c("p", {
|
|
211
|
+
role: "alert",
|
|
212
|
+
children: "A linked evidence version was removed. Select the fact status again and review its source links before saving."
|
|
213
|
+
})
|
|
214
|
+
] });
|
|
215
|
+
}
|
|
216
|
+
//#endregion
|
|
217
|
+
export { u as FreightCommercialFactEditor };
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { commercialSlots as e } from "../../utils/freightCommercial.js";
|
|
2
|
+
import { freightLabel as t } from "../../utils/freightDraft.js";
|
|
3
|
+
import { jsx as n, jsxs as r } from "react/jsx-runtime";
|
|
4
|
+
//#region src/movethewheels/components/freight-cost/FreightCommercialHistory.tsx
|
|
5
|
+
function i({ capture: i }) {
|
|
6
|
+
return i === void 0 ? /* @__PURE__ */ n("p", {
|
|
7
|
+
role: "alert",
|
|
8
|
+
children: "Commercial context is unavailable in this reply."
|
|
9
|
+
}) : i === null ? /* @__PURE__ */ n("p", { children: "Commercial context was not captured with this version." }) : /* @__PURE__ */ r("section", {
|
|
10
|
+
className: "min-w-0 space-y-4 break-words rounded border p-4",
|
|
11
|
+
children: [
|
|
12
|
+
/* @__PURE__ */ r("h3", {
|
|
13
|
+
className: "font-semibold",
|
|
14
|
+
children: ["Recorded commercial context — schema ", i.schemaVersion]
|
|
15
|
+
}),
|
|
16
|
+
/* @__PURE__ */ n("p", {
|
|
17
|
+
className: "text-sm",
|
|
18
|
+
children: "These are source declarations, not quote acceptance, verified authority or a complete commercial checklist."
|
|
19
|
+
}),
|
|
20
|
+
/* @__PURE__ */ n("div", {
|
|
21
|
+
className: "grid min-w-0 gap-3 md:grid-cols-2",
|
|
22
|
+
children: e.map((e) => {
|
|
23
|
+
let a = i[e];
|
|
24
|
+
return /* @__PURE__ */ r("article", {
|
|
25
|
+
className: "space-y-2 rounded border p-3",
|
|
26
|
+
children: [
|
|
27
|
+
/* @__PURE__ */ r("h4", {
|
|
28
|
+
className: "font-medium",
|
|
29
|
+
children: [
|
|
30
|
+
t(e),
|
|
31
|
+
" — ",
|
|
32
|
+
t(a.status)
|
|
33
|
+
]
|
|
34
|
+
}),
|
|
35
|
+
a.reason && /* @__PURE__ */ n("p", { children: a.reason }),
|
|
36
|
+
typeof a.value == "string" ? /* @__PURE__ */ n("p", { children: a.value }) : a.value && /* @__PURE__ */ n("dl", { children: Object.entries(a.value).filter(([e]) => e !== "__typename").map(([e, t]) => /* @__PURE__ */ r("div", { children: [/* @__PURE__ */ r("dt", {
|
|
37
|
+
className: "inline font-medium",
|
|
38
|
+
children: [e, ": "]
|
|
39
|
+
}), /* @__PURE__ */ n("dd", {
|
|
40
|
+
className: "inline",
|
|
41
|
+
children: t == null ? "Not recorded" : String(t)
|
|
42
|
+
})] }, e)) }),
|
|
43
|
+
a.provenance && /* @__PURE__ */ r("div", {
|
|
44
|
+
className: "text-sm",
|
|
45
|
+
children: [/* @__PURE__ */ r("p", { children: [
|
|
46
|
+
"Declared source ",
|
|
47
|
+
a.provenance.sourceReference,
|
|
48
|
+
" /",
|
|
49
|
+
" ",
|
|
50
|
+
a.provenance.sourceRevision,
|
|
51
|
+
"; observed",
|
|
52
|
+
" ",
|
|
53
|
+
a.provenance.observedAt ?? "Unknown",
|
|
54
|
+
"."
|
|
55
|
+
] }), a.provenance.evidenceLinks.map((e) => /* @__PURE__ */ r("p", { children: [
|
|
56
|
+
"Exact Files link: ",
|
|
57
|
+
e.fileId,
|
|
58
|
+
"; version ",
|
|
59
|
+
e.versionId,
|
|
60
|
+
"."
|
|
61
|
+
] }, JSON.stringify([e.fileId, e.versionId])))]
|
|
62
|
+
})
|
|
63
|
+
]
|
|
64
|
+
}, e);
|
|
65
|
+
})
|
|
66
|
+
}),
|
|
67
|
+
/* @__PURE__ */ r("section", {
|
|
68
|
+
className: "space-y-2",
|
|
69
|
+
children: [
|
|
70
|
+
/* @__PURE__ */ n("h4", {
|
|
71
|
+
className: "font-medium",
|
|
72
|
+
children: "Server-recorded owner context (separate from declared facts)"
|
|
73
|
+
}),
|
|
74
|
+
/* @__PURE__ */ r("p", { children: [
|
|
75
|
+
"Shipment ",
|
|
76
|
+
i.ownerShipment.shipmentId,
|
|
77
|
+
"; revision at ",
|
|
78
|
+
i.ownerShipment.updatedAt,
|
|
79
|
+
"; mode ",
|
|
80
|
+
i.ownerShipment.primaryMode,
|
|
81
|
+
"."
|
|
82
|
+
] }),
|
|
83
|
+
i.ownerLegs.length === 0 && /* @__PURE__ */ n("p", { children: "No legs selected for this capture. This does not mean the shipment has no legs." }),
|
|
84
|
+
i.ownerLegs.map((e) => /* @__PURE__ */ r("p", { children: [
|
|
85
|
+
"Leg ",
|
|
86
|
+
e.legNumber,
|
|
87
|
+
" (",
|
|
88
|
+
e.id,
|
|
89
|
+
") / ",
|
|
90
|
+
e.mode,
|
|
91
|
+
"; revision ",
|
|
92
|
+
e.updatedAt,
|
|
93
|
+
"; carrier",
|
|
94
|
+
" ",
|
|
95
|
+
e.carrierName ?? "Not recorded",
|
|
96
|
+
" (",
|
|
97
|
+
e.carrierId ?? "No carrier reference",
|
|
98
|
+
"); weight",
|
|
99
|
+
" ",
|
|
100
|
+
e.weightKg ?? "Not recorded",
|
|
101
|
+
" kg; volume ",
|
|
102
|
+
e.volumeCbm ?? "Not recorded",
|
|
103
|
+
" m³; equipment ",
|
|
104
|
+
e.containerType ?? "Not recorded",
|
|
105
|
+
" × ",
|
|
106
|
+
e.containerCount ?? "Not recorded",
|
|
107
|
+
"."
|
|
108
|
+
] }, e.id))
|
|
109
|
+
]
|
|
110
|
+
})
|
|
111
|
+
]
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
//#endregion
|
|
115
|
+
export { i as FreightCommercialHistory };
|
|
@@ -1,96 +1,105 @@
|
|
|
1
1
|
import { Button as e } from "../ui.js";
|
|
2
2
|
import { ContainerEvidencePicker as t } from "../ContainerEvidencePicker.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
3
|
+
import { commercialCanonical as n, commercialCaptureInput as r } from "../../utils/freightCommercial.js";
|
|
4
|
+
import { FreightCurrency as i, FreightSelect as a, FreightText as o } from "./FreightFields.js";
|
|
5
|
+
import { freightInstant as s, freightLocalTime as c, newFreightFacts as l, newFreightLine as u } from "../../utils/freightDraft.js";
|
|
6
|
+
import { FreightCommercialEditor as d } from "./FreightCommercialEditor.js";
|
|
7
|
+
import { FreightLineEditor as f } from "./FreightLineEditor.js";
|
|
8
|
+
import { FreightScopeEditor as p } from "./FreightScopeEditor.js";
|
|
9
|
+
import { FreightFxEditor as m } from "./FreightFxEditor.js";
|
|
10
|
+
import { FreightTotals as h } from "./FreightTotals.js";
|
|
11
|
+
import { useRef as g, useState as _ } from "react";
|
|
12
|
+
import { jsx as v, jsxs as y } from "react/jsx-runtime";
|
|
11
13
|
//#region src/movethewheels/components/freight-cost/FreightDraftForm.tsx
|
|
12
|
-
function
|
|
13
|
-
let [
|
|
14
|
-
...
|
|
14
|
+
function b({ disabled: b, shipmentId: x, onPreview: S, onSave: C }) {
|
|
15
|
+
let [w, T] = _(null), [E, D] = _(l), [O, k] = _([]), [A, j] = _(null), [M, N] = _(null), [P, F] = _(!1), I = g(!1), L = JSON.stringify(E), R = A?.body === L ? A.value : null, z = (e) => D({
|
|
16
|
+
...E,
|
|
15
17
|
...e
|
|
16
|
-
}),
|
|
17
|
-
if (
|
|
18
|
-
|
|
19
|
-
let e = structuredClone(
|
|
18
|
+
}), B = async () => {
|
|
19
|
+
if (I.current) return;
|
|
20
|
+
I.current = !0, F(!0), N(null);
|
|
21
|
+
let e = structuredClone(E);
|
|
20
22
|
try {
|
|
21
|
-
let t = await
|
|
22
|
-
|
|
23
|
+
let t = await S(e);
|
|
24
|
+
j({
|
|
23
25
|
body: JSON.stringify(e),
|
|
24
26
|
value: t
|
|
25
27
|
});
|
|
26
28
|
} catch (e) {
|
|
27
|
-
|
|
29
|
+
N(e instanceof Error ? e.message : "Unable to preview these costs.");
|
|
28
30
|
} finally {
|
|
29
|
-
|
|
31
|
+
I.current = !1, F(!1);
|
|
30
32
|
}
|
|
31
33
|
};
|
|
32
|
-
return /* @__PURE__ */
|
|
34
|
+
return /* @__PURE__ */ y("form", {
|
|
33
35
|
className: "space-y-6",
|
|
34
36
|
onSubmit: (e) => {
|
|
35
|
-
if (e.preventDefault(), !
|
|
36
|
-
|
|
37
|
+
if (e.preventDefault(), !R) {
|
|
38
|
+
B();
|
|
37
39
|
return;
|
|
38
40
|
}
|
|
39
|
-
|
|
41
|
+
N(null);
|
|
42
|
+
try {
|
|
43
|
+
if (w && w.reviewed !== n(w.selectedLegs)) throw Error("Explicitly review the commercial leg selection before saving.");
|
|
44
|
+
let e = w ? r(w.facts, w.selectedLegs, O) : void 0;
|
|
45
|
+
C(structuredClone(E), structuredClone(O), e).catch((e) => N(e instanceof Error ? e.message : "Unable to save this cost record."));
|
|
46
|
+
} catch (e) {
|
|
47
|
+
N(e instanceof Error ? e.message : "Review commercial facts before saving.");
|
|
48
|
+
}
|
|
40
49
|
},
|
|
41
50
|
children: [
|
|
42
|
-
/* @__PURE__ */
|
|
43
|
-
disabled:
|
|
51
|
+
/* @__PURE__ */ y("fieldset", {
|
|
52
|
+
disabled: b || P,
|
|
44
53
|
className: "space-y-5",
|
|
45
54
|
children: [
|
|
46
|
-
/* @__PURE__ */
|
|
55
|
+
/* @__PURE__ */ v("legend", {
|
|
47
56
|
className: "text-lg font-semibold",
|
|
48
57
|
children: "Sourced cost draft"
|
|
49
58
|
}),
|
|
50
|
-
/* @__PURE__ */
|
|
59
|
+
/* @__PURE__ */ y("div", {
|
|
51
60
|
className: "grid gap-3 md:grid-cols-2",
|
|
52
61
|
children: [
|
|
53
|
-
/* @__PURE__ */
|
|
62
|
+
/* @__PURE__ */ v(o, {
|
|
54
63
|
label: "Estimate title",
|
|
55
|
-
value:
|
|
64
|
+
value: E.title,
|
|
56
65
|
required: !0,
|
|
57
|
-
onChange: (e) =>
|
|
66
|
+
onChange: (e) => z({ title: e })
|
|
58
67
|
}),
|
|
59
|
-
/* @__PURE__ */
|
|
68
|
+
/* @__PURE__ */ y(a, {
|
|
60
69
|
label: "Record type",
|
|
61
|
-
value:
|
|
70
|
+
value: E.kind,
|
|
62
71
|
onChange: (e) => {
|
|
63
|
-
(e === "ESTIMATE" || e === "QUOTE") &&
|
|
72
|
+
(e === "ESTIMATE" || e === "QUOTE") && z({ kind: e });
|
|
64
73
|
},
|
|
65
|
-
children: [/* @__PURE__ */
|
|
74
|
+
children: [/* @__PURE__ */ v("option", {
|
|
66
75
|
value: "ESTIMATE",
|
|
67
76
|
children: "Estimate"
|
|
68
|
-
}), /* @__PURE__ */
|
|
77
|
+
}), /* @__PURE__ */ v("option", {
|
|
69
78
|
value: "QUOTE",
|
|
70
79
|
children: "Reported quote"
|
|
71
80
|
})]
|
|
72
81
|
}),
|
|
73
|
-
/* @__PURE__ */
|
|
82
|
+
/* @__PURE__ */ v(o, {
|
|
74
83
|
label: "Commercial source",
|
|
75
|
-
value:
|
|
84
|
+
value: E.sourceReference,
|
|
76
85
|
required: !0,
|
|
77
|
-
onChange: (e) =>
|
|
86
|
+
onChange: (e) => z({ sourceReference: e })
|
|
78
87
|
}),
|
|
79
|
-
/* @__PURE__ */
|
|
88
|
+
/* @__PURE__ */ v(o, {
|
|
80
89
|
label: "Source version",
|
|
81
|
-
value:
|
|
90
|
+
value: E.sourceRevision,
|
|
82
91
|
required: !0,
|
|
83
|
-
onChange: (e) =>
|
|
92
|
+
onChange: (e) => z({ sourceRevision: e })
|
|
84
93
|
})
|
|
85
94
|
]
|
|
86
95
|
}),
|
|
87
|
-
/* @__PURE__ */
|
|
96
|
+
/* @__PURE__ */ v(o, {
|
|
88
97
|
label: "Shipment and services covered by this source",
|
|
89
|
-
value:
|
|
98
|
+
value: E.commercialScope,
|
|
90
99
|
required: !0,
|
|
91
|
-
onChange: (e) =>
|
|
100
|
+
onChange: (e) => z({ commercialScope: e })
|
|
92
101
|
}),
|
|
93
|
-
/* @__PURE__ */
|
|
102
|
+
/* @__PURE__ */ y("p", {
|
|
94
103
|
className: "text-sm",
|
|
95
104
|
children: [
|
|
96
105
|
"Dates use your local time zone: ",
|
|
@@ -98,116 +107,122 @@ function _({ disabled: _, onPreview: v, onSave: y }) {
|
|
|
98
107
|
". They are recorded as exact UTC instants."
|
|
99
108
|
]
|
|
100
109
|
}),
|
|
101
|
-
/* @__PURE__ */
|
|
110
|
+
/* @__PURE__ */ v(o, {
|
|
102
111
|
label: "Price applies at",
|
|
103
112
|
type: "datetime-local",
|
|
104
|
-
value:
|
|
113
|
+
value: c(E.pricingAt),
|
|
105
114
|
required: !0,
|
|
106
115
|
onChange: (e) => {
|
|
107
|
-
e &&
|
|
116
|
+
e && z({ pricingAt: s(e) });
|
|
108
117
|
}
|
|
109
118
|
}),
|
|
110
|
-
/* @__PURE__ */
|
|
119
|
+
/* @__PURE__ */ y("section", {
|
|
111
120
|
className: "space-y-4",
|
|
112
121
|
children: [
|
|
113
|
-
/* @__PURE__ */
|
|
122
|
+
/* @__PURE__ */ v("h3", {
|
|
114
123
|
className: "font-semibold",
|
|
115
124
|
children: "Cost items"
|
|
116
125
|
}),
|
|
117
|
-
/* @__PURE__ */
|
|
126
|
+
/* @__PURE__ */ v("p", {
|
|
118
127
|
className: "text-sm",
|
|
119
128
|
children: "Blank amounts are unknown. Currency codes and decimal places are recorded conventions."
|
|
120
129
|
}),
|
|
121
|
-
|
|
130
|
+
E.lines.map((e) => /* @__PURE__ */ v(f, {
|
|
122
131
|
line: e,
|
|
123
|
-
others:
|
|
124
|
-
onChange: (t) =>
|
|
125
|
-
onRemove: () =>
|
|
132
|
+
others: E.lines,
|
|
133
|
+
onChange: (t) => z({ lines: E.lines.map((n) => n.id === e.id ? t : n) }),
|
|
134
|
+
onRemove: () => z({ lines: E.lines.filter((t) => t.id !== e.id) })
|
|
126
135
|
}, e.id)),
|
|
127
|
-
/* @__PURE__ */
|
|
136
|
+
/* @__PURE__ */ v(e, {
|
|
128
137
|
type: "button",
|
|
129
138
|
variant: "outline",
|
|
130
|
-
disabled:
|
|
131
|
-
onClick: () =>
|
|
139
|
+
disabled: E.lines.length >= 100,
|
|
140
|
+
onClick: () => z({ lines: [...E.lines, u()] }),
|
|
132
141
|
children: "Add cost item"
|
|
133
142
|
})
|
|
134
143
|
]
|
|
135
144
|
}),
|
|
136
|
-
/* @__PURE__ */
|
|
145
|
+
/* @__PURE__ */ y("details", {
|
|
137
146
|
className: "space-y-4 rounded border p-4",
|
|
138
147
|
children: [
|
|
139
|
-
/* @__PURE__ */
|
|
148
|
+
/* @__PURE__ */ v("summary", {
|
|
140
149
|
className: "min-h-11 cursor-pointer font-medium",
|
|
141
150
|
children: "Review cost scope, dates and conversion"
|
|
142
151
|
}),
|
|
143
|
-
/* @__PURE__ */
|
|
144
|
-
value:
|
|
145
|
-
onChange: (e) =>
|
|
152
|
+
/* @__PURE__ */ v(p, {
|
|
153
|
+
value: E.requirements,
|
|
154
|
+
onChange: (e) => z({ requirements: e })
|
|
146
155
|
}),
|
|
147
|
-
/* @__PURE__ */
|
|
156
|
+
/* @__PURE__ */ y("section", {
|
|
148
157
|
className: "space-y-3",
|
|
149
|
-
children: [/* @__PURE__ */
|
|
158
|
+
children: [/* @__PURE__ */ v("h3", {
|
|
150
159
|
className: "font-semibold",
|
|
151
160
|
children: "Recorded quote dates"
|
|
152
161
|
}), [
|
|
153
162
|
"quotedAt",
|
|
154
163
|
"validFrom",
|
|
155
164
|
"validUntil"
|
|
156
|
-
].map((e) => /* @__PURE__ */
|
|
165
|
+
].map((e) => /* @__PURE__ */ v(o, {
|
|
157
166
|
label: e === "quotedAt" ? "Quote received at" : e === "validFrom" ? "Quote valid from" : "Quote valid until",
|
|
158
167
|
type: "datetime-local",
|
|
159
|
-
value:
|
|
160
|
-
onChange: (t) =>
|
|
168
|
+
value: E[e] ? c(E[e]) : "",
|
|
169
|
+
onChange: (t) => z({ [e]: t ? s(t) : null })
|
|
161
170
|
}, e))]
|
|
162
171
|
}),
|
|
163
|
-
/* @__PURE__ */
|
|
172
|
+
/* @__PURE__ */ y(a, {
|
|
164
173
|
label: "Reporting total",
|
|
165
|
-
value:
|
|
166
|
-
onChange: (e) =>
|
|
174
|
+
value: E.reportingCurrency ? "RECORDED" : "UNKNOWN",
|
|
175
|
+
onChange: (e) => z({ reportingCurrency: e === "RECORDED" ? {
|
|
167
176
|
code: "USD",
|
|
168
177
|
minorUnitDigits: 2
|
|
169
178
|
} : null }),
|
|
170
|
-
children: [/* @__PURE__ */
|
|
179
|
+
children: [/* @__PURE__ */ v("option", {
|
|
171
180
|
value: "UNKNOWN",
|
|
172
181
|
children: "No reporting currency yet"
|
|
173
|
-
}), /* @__PURE__ */
|
|
182
|
+
}), /* @__PURE__ */ v("option", {
|
|
174
183
|
value: "RECORDED",
|
|
175
184
|
children: "Use a recorded currency convention"
|
|
176
185
|
})]
|
|
177
186
|
}),
|
|
178
|
-
|
|
187
|
+
E.reportingCurrency && /* @__PURE__ */ v(i, {
|
|
179
188
|
label: "Reporting currency convention",
|
|
180
|
-
value:
|
|
181
|
-
onChange: (e) =>
|
|
189
|
+
value: E.reportingCurrency,
|
|
190
|
+
onChange: (e) => z({ reportingCurrency: e })
|
|
182
191
|
}),
|
|
183
|
-
/* @__PURE__ */
|
|
184
|
-
value:
|
|
185
|
-
onChange: (e) =>
|
|
192
|
+
/* @__PURE__ */ v(m, {
|
|
193
|
+
value: E.fx,
|
|
194
|
+
onChange: (e) => z({ fx: e })
|
|
186
195
|
})
|
|
187
196
|
]
|
|
188
197
|
}),
|
|
189
|
-
/* @__PURE__ */
|
|
190
|
-
value:
|
|
191
|
-
onChange:
|
|
198
|
+
/* @__PURE__ */ v(d, {
|
|
199
|
+
value: w,
|
|
200
|
+
onChange: T,
|
|
201
|
+
shipmentId: x,
|
|
202
|
+
evidence: O
|
|
203
|
+
}),
|
|
204
|
+
/* @__PURE__ */ v(t, {
|
|
205
|
+
value: O,
|
|
206
|
+
onChange: k,
|
|
192
207
|
description: "Choose the exact source document versions. A readable document supports this reported record; it does not accept a quote or confirm capacity."
|
|
193
208
|
})
|
|
194
209
|
]
|
|
195
210
|
}),
|
|
196
|
-
|
|
211
|
+
M && /* @__PURE__ */ v("p", {
|
|
197
212
|
role: "alert",
|
|
198
|
-
children:
|
|
213
|
+
children: M
|
|
199
214
|
}),
|
|
200
|
-
|
|
201
|
-
value:
|
|
202
|
-
currency:
|
|
215
|
+
R && /* @__PURE__ */ v(h, {
|
|
216
|
+
value: R,
|
|
217
|
+
currency: E.reportingCurrency
|
|
203
218
|
}),
|
|
204
|
-
/* @__PURE__ */
|
|
219
|
+
/* @__PURE__ */ v(e, {
|
|
205
220
|
type: "submit",
|
|
206
|
-
disabled:
|
|
207
|
-
children:
|
|
221
|
+
disabled: b || P || E.lines.length === 0 || !!R && O.length === 0,
|
|
222
|
+
children: P ? "Previewing…" : R ? "Save immutable cost version" : "Preview costs and missing facts"
|
|
208
223
|
})
|
|
209
224
|
]
|
|
210
225
|
});
|
|
211
226
|
}
|
|
212
227
|
//#endregion
|
|
213
|
-
export {
|
|
228
|
+
export { b as FreightDraftForm };
|