@burdenoff/microfe-movethewheels 2026.1017.15 → 2026.1017.17
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/MoveTheWheelsRoot.js +5 -0
- package/dist/MoveTheWheelsRoutes.js +8 -4
- package/dist/generated/consumed-fuel-preview-operations.d.ts +132 -0
- package/dist/hooks/useConsumedFuelPreview.js +90 -0
- package/dist/movethewheels/hooks/useConsumedFuelPreview.d.ts +33 -0
- package/dist/movethewheels/pages/ConsumedFuelPreviewPage.d.ts +1 -0
- package/dist/movethewheels/utils/consumedFuelInput.d.ts +27 -0
- package/dist/movethewheels/utils/consumedFuelResponse.d.ts +4 -0
- package/dist/pages/ConsumedFuelPreviewPage.js +267 -0
- package/dist/src/generated/consumed-fuel-preview-operations.js +213 -0
- package/dist/utils/consumedFuelInput.js +110 -0
- package/dist/utils/consumedFuelResponse.js +89 -0
- package/package.json +5 -4
- package/src/generated/consumed-fuel-preview-operations.ts +126 -0
- package/src/movethewheels/MoveTheWheelsRoot.tsx +6 -0
- package/src/movethewheels/MoveTheWheelsRoutes.tsx +2 -0
- package/src/movethewheels/hooks/useConsumedFuelPreview.ts +114 -0
- package/src/movethewheels/pages/ConsumedFuelPreviewPage.tsx +389 -0
- package/src/movethewheels/utils/consumedFuelInput.ts +148 -0
- package/src/movethewheels/utils/consumedFuelResponse.ts +140 -0
- package/src/operations/consumed-fuel-preview/preview.graphql +1 -0
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
//#region src/generated/consumed-fuel-preview-operations.ts
|
|
2
|
+
var e = {
|
|
3
|
+
kind: "Document",
|
|
4
|
+
definitions: [{
|
|
5
|
+
kind: "OperationDefinition",
|
|
6
|
+
operation: "query",
|
|
7
|
+
name: {
|
|
8
|
+
kind: "Name",
|
|
9
|
+
value: "MtwConsumedFuelPreview"
|
|
10
|
+
},
|
|
11
|
+
variableDefinitions: [{
|
|
12
|
+
kind: "VariableDefinition",
|
|
13
|
+
variable: {
|
|
14
|
+
kind: "Variable",
|
|
15
|
+
name: {
|
|
16
|
+
kind: "Name",
|
|
17
|
+
value: "input"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
type: {
|
|
21
|
+
kind: "NonNullType",
|
|
22
|
+
type: {
|
|
23
|
+
kind: "NamedType",
|
|
24
|
+
name: {
|
|
25
|
+
kind: "Name",
|
|
26
|
+
value: "MtwConsumedFuelPreviewInput"
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}],
|
|
31
|
+
selectionSet: {
|
|
32
|
+
kind: "SelectionSet",
|
|
33
|
+
selections: [{
|
|
34
|
+
kind: "Field",
|
|
35
|
+
name: {
|
|
36
|
+
kind: "Name",
|
|
37
|
+
value: "mtwConsumedFuelPreview"
|
|
38
|
+
},
|
|
39
|
+
arguments: [{
|
|
40
|
+
kind: "Argument",
|
|
41
|
+
name: {
|
|
42
|
+
kind: "Name",
|
|
43
|
+
value: "input"
|
|
44
|
+
},
|
|
45
|
+
value: {
|
|
46
|
+
kind: "Variable",
|
|
47
|
+
name: {
|
|
48
|
+
kind: "Name",
|
|
49
|
+
value: "input"
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}],
|
|
53
|
+
selectionSet: {
|
|
54
|
+
kind: "SelectionSet",
|
|
55
|
+
selections: [
|
|
56
|
+
{
|
|
57
|
+
kind: "Field",
|
|
58
|
+
name: {
|
|
59
|
+
kind: "Name",
|
|
60
|
+
value: "status"
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
kind: "Field",
|
|
65
|
+
name: {
|
|
66
|
+
kind: "Name",
|
|
67
|
+
value: "litresPer100Km"
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
kind: "Field",
|
|
72
|
+
name: {
|
|
73
|
+
kind: "Name",
|
|
74
|
+
value: "reasons"
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
kind: "Field",
|
|
79
|
+
name: {
|
|
80
|
+
kind: "Name",
|
|
81
|
+
value: "qualification"
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
kind: "Field",
|
|
86
|
+
name: {
|
|
87
|
+
kind: "Name",
|
|
88
|
+
value: "distance"
|
|
89
|
+
},
|
|
90
|
+
selectionSet: {
|
|
91
|
+
kind: "SelectionSet",
|
|
92
|
+
selections: [
|
|
93
|
+
{
|
|
94
|
+
kind: "Field",
|
|
95
|
+
name: {
|
|
96
|
+
kind: "Name",
|
|
97
|
+
value: "metres"
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
kind: "Field",
|
|
102
|
+
name: {
|
|
103
|
+
kind: "Name",
|
|
104
|
+
value: "intervalFrom"
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
kind: "Field",
|
|
109
|
+
name: {
|
|
110
|
+
kind: "Name",
|
|
111
|
+
value: "intervalUntil"
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
kind: "Field",
|
|
116
|
+
name: {
|
|
117
|
+
kind: "Name",
|
|
118
|
+
value: "basis"
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
kind: "Field",
|
|
123
|
+
name: {
|
|
124
|
+
kind: "Name",
|
|
125
|
+
value: "coverage"
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
kind: "Field",
|
|
130
|
+
name: {
|
|
131
|
+
kind: "Name",
|
|
132
|
+
value: "sourceReference"
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
kind: "Field",
|
|
137
|
+
name: {
|
|
138
|
+
kind: "Name",
|
|
139
|
+
value: "sourceRevision"
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
]
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
kind: "Field",
|
|
147
|
+
name: {
|
|
148
|
+
kind: "Name",
|
|
149
|
+
value: "fuel"
|
|
150
|
+
},
|
|
151
|
+
selectionSet: {
|
|
152
|
+
kind: "SelectionSet",
|
|
153
|
+
selections: [
|
|
154
|
+
{
|
|
155
|
+
kind: "Field",
|
|
156
|
+
name: {
|
|
157
|
+
kind: "Name",
|
|
158
|
+
value: "millilitres"
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
kind: "Field",
|
|
163
|
+
name: {
|
|
164
|
+
kind: "Name",
|
|
165
|
+
value: "intervalFrom"
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
kind: "Field",
|
|
170
|
+
name: {
|
|
171
|
+
kind: "Name",
|
|
172
|
+
value: "intervalUntil"
|
|
173
|
+
}
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
kind: "Field",
|
|
177
|
+
name: {
|
|
178
|
+
kind: "Name",
|
|
179
|
+
value: "basis"
|
|
180
|
+
}
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
kind: "Field",
|
|
184
|
+
name: {
|
|
185
|
+
kind: "Name",
|
|
186
|
+
value: "coverage"
|
|
187
|
+
}
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
kind: "Field",
|
|
191
|
+
name: {
|
|
192
|
+
kind: "Name",
|
|
193
|
+
value: "sourceReference"
|
|
194
|
+
}
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
kind: "Field",
|
|
198
|
+
name: {
|
|
199
|
+
kind: "Name",
|
|
200
|
+
value: "sourceRevision"
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
]
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
]
|
|
207
|
+
}
|
|
208
|
+
}]
|
|
209
|
+
}
|
|
210
|
+
}]
|
|
211
|
+
};
|
|
212
|
+
//#endregion
|
|
213
|
+
export { e as MtwConsumedFuelPreviewDocument };
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
//#region src/movethewheels/utils/consumedFuelInput.ts
|
|
2
|
+
function e() {
|
|
3
|
+
let e = () => ({
|
|
4
|
+
included: !1,
|
|
5
|
+
amount: "",
|
|
6
|
+
intervalFrom: "",
|
|
7
|
+
intervalUntil: "",
|
|
8
|
+
basis: "",
|
|
9
|
+
coverage: "",
|
|
10
|
+
sourceReference: "",
|
|
11
|
+
sourceRevision: ""
|
|
12
|
+
});
|
|
13
|
+
return {
|
|
14
|
+
distance: e(),
|
|
15
|
+
fuel: e()
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
var t = class extends Error {
|
|
19
|
+
field;
|
|
20
|
+
kind;
|
|
21
|
+
constructor(e, t) {
|
|
22
|
+
super("Review the supplied interval observations."), this.field = e, this.kind = t;
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
function n(e, n) {
|
|
26
|
+
if (e === "") return null;
|
|
27
|
+
if (e.length > 11 || !/^(0|[1-9]\d*)(\.\d{1,3})?$/.test(e) || e.trim() !== e) throw new t(n, "QUANTITY");
|
|
28
|
+
let [r, i = ""] = e.split("."), a = Number(r) * 1e3 + Number(i.padEnd(3, "0"));
|
|
29
|
+
if (!Number.isSafeInteger(a) || a > 2147483647) throw new t(n, "QUANTITY");
|
|
30
|
+
return a;
|
|
31
|
+
}
|
|
32
|
+
function r(e, n) {
|
|
33
|
+
if (e.length < 20 || e.length > 24) throw new t(n, "INSTANT");
|
|
34
|
+
let r = e.slice(0, 19), i = e.slice(19), a = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})$/.exec(r);
|
|
35
|
+
if (!a || a[0] !== r || a[1] === "0000" || !/^(Z|\.\d{1,3}Z)$/.test(i)) throw new t(n, "INSTANT");
|
|
36
|
+
let o = Number(a[1]), s = Number(a[2]), c = Number(a[3]), l = [
|
|
37
|
+
31,
|
|
38
|
+
o % 4 == 0 && (o % 100 != 0 || o % 400 == 0) ? 29 : 28,
|
|
39
|
+
31,
|
|
40
|
+
30,
|
|
41
|
+
31,
|
|
42
|
+
30,
|
|
43
|
+
31,
|
|
44
|
+
31,
|
|
45
|
+
30,
|
|
46
|
+
31,
|
|
47
|
+
30,
|
|
48
|
+
31
|
|
49
|
+
];
|
|
50
|
+
if (s < 1 || s > 12 || c < 1 || c > (l[s - 1] ?? 0) || Number(a[4]) > 23 || Number(a[5]) > 59 || Number(a[6]) > 59) throw new t(n, "INSTANT");
|
|
51
|
+
let u = `${r}.${(i === "Z" ? "" : i.slice(1, -1)).padEnd(3, "0")}Z`, d = Date.parse(u);
|
|
52
|
+
if (!Number.isFinite(d) || new Date(d).toISOString() !== u) throw new t(n, "INSTANT");
|
|
53
|
+
return u;
|
|
54
|
+
}
|
|
55
|
+
function i(e, n) {
|
|
56
|
+
if (e === "") return null;
|
|
57
|
+
let r = e.trim();
|
|
58
|
+
if (!r || r.length > 255) throw new t(n, "SOURCE");
|
|
59
|
+
return r;
|
|
60
|
+
}
|
|
61
|
+
function a(e, n) {
|
|
62
|
+
if (e === "COMPLETE" || e === "PARTIAL") return e;
|
|
63
|
+
throw new t(n, "CHOICE");
|
|
64
|
+
}
|
|
65
|
+
function o(e) {
|
|
66
|
+
if (e === "MEASURED" || e === "PROVIDER_ESTIMATE" || e === "OPERATOR_ESTIMATE") return e;
|
|
67
|
+
throw new t("distance-basis", "CHOICE");
|
|
68
|
+
}
|
|
69
|
+
function s(e) {
|
|
70
|
+
if (e === "MEASURED_CONSUMPTION" || e === "ESTIMATED_CONSUMPTION" || e === "PURCHASED_OR_REFUELLED" || e === "UNKNOWN") return e;
|
|
71
|
+
throw new t("fuel-basis", "CHOICE");
|
|
72
|
+
}
|
|
73
|
+
function c(e, n, o) {
|
|
74
|
+
let s = r(e.intervalFrom, `${n}-intervalFrom`), c = r(e.intervalUntil, `${n}-intervalUntil`);
|
|
75
|
+
if (Date.parse(s) >= Date.parse(c) || Date.parse(c) > o) throw new t(`${n}-intervalUntil`, "INTERVAL");
|
|
76
|
+
return {
|
|
77
|
+
intervalFrom: s,
|
|
78
|
+
intervalUntil: c,
|
|
79
|
+
coverage: a(e.coverage, `${n}-coverage`),
|
|
80
|
+
sourceReference: i(e.sourceReference, `${n}-sourceReference`),
|
|
81
|
+
sourceRevision: i(e.sourceRevision, `${n}-sourceRevision`)
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
function l(e, r = Date.now()) {
|
|
85
|
+
if (!Number.isFinite(r)) throw new t("distance-intervalUntil", "INSTANT");
|
|
86
|
+
return {
|
|
87
|
+
distance: e.distance.included ? {
|
|
88
|
+
...c(e.distance, "distance", r),
|
|
89
|
+
metres: n(e.distance.amount, "distance-amount"),
|
|
90
|
+
basis: o(e.distance.basis)
|
|
91
|
+
} : null,
|
|
92
|
+
fuel: e.fuel.included ? {
|
|
93
|
+
...c(e.fuel, "fuel", r),
|
|
94
|
+
millilitres: n(e.fuel.amount, "fuel-amount"),
|
|
95
|
+
basis: s(e.fuel.basis)
|
|
96
|
+
} : null
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
function u(e, t) {
|
|
100
|
+
if (!Number.isFinite(e) || e < 0) throw Error("Invalid ratio");
|
|
101
|
+
return e > 0 && e < .01 ? `<${new Intl.NumberFormat(t, {
|
|
102
|
+
minimumFractionDigits: 2,
|
|
103
|
+
maximumFractionDigits: 2
|
|
104
|
+
}).format(.01)} L/100 km` : `${e > 0 ? "≈ " : ""}${new Intl.NumberFormat(t, {
|
|
105
|
+
minimumFractionDigits: 2,
|
|
106
|
+
maximumFractionDigits: 2
|
|
107
|
+
}).format(e)} L/100 km`;
|
|
108
|
+
}
|
|
109
|
+
//#endregion
|
|
110
|
+
export { t as ConsumedFuelInputError, l as consumedFuelInput, u as formatFuelRatio, e as newConsumedFuelDraft, r as strictFuelInstant };
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { strictFuelInstant as e } from "./consumedFuelInput.js";
|
|
2
|
+
//#region src/movethewheels/utils/consumedFuelResponse.ts
|
|
3
|
+
function t() {
|
|
4
|
+
throw Error("The consumption preview response could not be verified.");
|
|
5
|
+
}
|
|
6
|
+
function n(e) {
|
|
7
|
+
return typeof e == "object" && !!e && !Array.isArray(e);
|
|
8
|
+
}
|
|
9
|
+
function r(e) {
|
|
10
|
+
return n(e) ? e : t();
|
|
11
|
+
}
|
|
12
|
+
function i(e, n) {
|
|
13
|
+
let r = new Set(n);
|
|
14
|
+
(n.some((t) => !Object.hasOwn(e, t)) || Object.keys(e).some((e) => e !== "__typename" && !r.has(e))) && t();
|
|
15
|
+
}
|
|
16
|
+
function a(e) {
|
|
17
|
+
switch (e) {
|
|
18
|
+
case "DISTANCE_UNKNOWN":
|
|
19
|
+
case "FUEL_UNKNOWN":
|
|
20
|
+
case "SOURCE_UNKNOWN":
|
|
21
|
+
case "NON_MEASURED_DISTANCE":
|
|
22
|
+
case "UNSUPPORTED_FUEL_BASIS":
|
|
23
|
+
case "INTERVAL_MISMATCH":
|
|
24
|
+
case "PARTIAL_COVERAGE":
|
|
25
|
+
case "ZERO_DISTANCE": return e;
|
|
26
|
+
default: return t();
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
function o(e) {
|
|
30
|
+
let n = r(e);
|
|
31
|
+
i(n, ["data", ...Object.hasOwn(n, "errors") ? ["errors"] : []]), Object.hasOwn(n, "errors") && (!Array.isArray(n.errors) || n.errors.length !== 0) && t(), i(r(n.data), ["mtwConsumedFuelPreview"]);
|
|
32
|
+
}
|
|
33
|
+
function s(n, o) {
|
|
34
|
+
let s = r(n);
|
|
35
|
+
i(s, ["mtwConsumedFuelPreview"]);
|
|
36
|
+
let c = r(s.mtwConsumedFuelPreview);
|
|
37
|
+
i(c, [
|
|
38
|
+
"status",
|
|
39
|
+
"litresPer100Km",
|
|
40
|
+
"reasons",
|
|
41
|
+
"qualification",
|
|
42
|
+
"distance",
|
|
43
|
+
"fuel"
|
|
44
|
+
]);
|
|
45
|
+
let l = (t) => ({
|
|
46
|
+
intervalFrom: e(t.intervalFrom, "response"),
|
|
47
|
+
intervalUntil: e(t.intervalUntil, "response"),
|
|
48
|
+
sourceReference: t.sourceReference?.trim() ?? null,
|
|
49
|
+
sourceRevision: t.sourceRevision?.trim() ?? null
|
|
50
|
+
}), u = o.distance ? {
|
|
51
|
+
...o.distance,
|
|
52
|
+
...l(o.distance),
|
|
53
|
+
metres: o.distance.metres ?? null
|
|
54
|
+
} : null, d = o.fuel ? {
|
|
55
|
+
...o.fuel,
|
|
56
|
+
...l(o.fuel),
|
|
57
|
+
millilitres: o.fuel.millilitres ?? null
|
|
58
|
+
} : null, f = (e, n) => {
|
|
59
|
+
if (n === null) {
|
|
60
|
+
e !== null && t();
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
let a = r(e);
|
|
64
|
+
i(a, Object.keys(n));
|
|
65
|
+
for (let [e, r] of Object.entries(n)) a[e] !== r && t();
|
|
66
|
+
};
|
|
67
|
+
if (f(c.distance, u), f(c.fuel, d), c.qualification !== "OPERATOR_REPORTED_UNVERIFIED" || c.status !== "KNOWN" && c.status !== "UNKNOWN" || !Array.isArray(c.reasons)) return t();
|
|
68
|
+
let p = c.reasons.map(a);
|
|
69
|
+
new Set(p).size !== p.length && t();
|
|
70
|
+
let m = [];
|
|
71
|
+
u?.metres ?? m.push("DISTANCE_UNKNOWN"), d?.millilitres ?? m.push("FUEL_UNKNOWN"), (!u?.sourceReference || !u.sourceRevision || !d?.sourceReference || !d.sourceRevision) && m.push("SOURCE_UNKNOWN"), u && u.basis !== "MEASURED" && m.push("NON_MEASURED_DISTANCE"), d && d.basis !== "MEASURED_CONSUMPTION" && m.push("UNSUPPORTED_FUEL_BASIS"), u && d && (u.intervalFrom !== d.intervalFrom || u.intervalUntil !== d.intervalUntil) && m.push("INTERVAL_MISMATCH"), (u?.coverage === "PARTIAL" || d?.coverage === "PARTIAL") && m.push("PARTIAL_COVERAGE"), u?.metres === 0 && m.push("ZERO_DISTANCE"), JSON.stringify(p) !== JSON.stringify(m) && t();
|
|
72
|
+
let h = c.litresPer100Km;
|
|
73
|
+
return p.length ? (c.status !== "UNKNOWN" || h !== null) && t() : (c.status !== "KNOWN" || typeof h != "number" || !Number.isFinite(h) || h < 0 || !u?.metres || d?.millilitres == null || h !== 100 * d.millilitres / u.metres) && t(), {
|
|
74
|
+
status: c.status,
|
|
75
|
+
litresPer100Km: h,
|
|
76
|
+
reasons: p,
|
|
77
|
+
qualification: "OPERATOR_REPORTED_UNVERIFIED",
|
|
78
|
+
distance: u ? {
|
|
79
|
+
...u,
|
|
80
|
+
metres: u.metres ?? null
|
|
81
|
+
} : null,
|
|
82
|
+
fuel: d ? {
|
|
83
|
+
...d,
|
|
84
|
+
millilitres: d.millilitres ?? null
|
|
85
|
+
} : null
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
//#endregion
|
|
89
|
+
export { s as parseConsumedFuelPreview, o as validateConsumedFuelEnvelope };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@burdenoff/microfe-movethewheels",
|
|
3
|
-
"version": "2026.1017.
|
|
3
|
+
"version": "2026.1017.17",
|
|
4
4
|
"description": "Burdenoff MoveTheWheels Microfrontend - Logistics & Supply Chain Management Platform",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"format": "prettier --write \"src/**/*.{ts,tsx}\"",
|
|
38
38
|
"type:check": "bash scripts/build-limits.sh tsc --noEmit",
|
|
39
39
|
"validate:schema-drift": "graphql-schema-drift",
|
|
40
|
-
"sanity": "bash scripts/build-limits.sh --gate bash -c 'bun run codegen && bun run validate:schema-drift && bun run lint:sanity && bun run format && bun run type:check && bun run verify:live-logistics-contract && bun run verify:empty-reuse-retry && bun run verify:empty-reuse-recovery && bun run verify:trip-utilization-input && bun run verify:trip-draft-context && bun run verify:stock-binding-input && bun run verify:stock-observation-input && bun run verify:pending-pick-input && bun run verify:pick-review-ack && bun run verify:driver-license-expiry && bun run verify:freight-input && bun run verify:freight-recovery && bun run verify:freight-commercial && bun run verify:freight-invoice && bun run verify:procedure-input && bun run verify:consolidation && bun run verify:multimodal-single-attempt && bun run verify:workspace-predispatch && bun run verify:tracking-quality-outcomes && bun run verify:shipment-status-authority && bun run verify:free-time-permissions && bun run verify:core-codegen && bun run verify:order-vehicle-hold && bun run verify:pallet-preview && bun run build && bun run build-storybook'",
|
|
40
|
+
"sanity": "bash scripts/build-limits.sh --gate bash -c 'bun run codegen && bun run validate:schema-drift && bun run lint:sanity && bun run format && bun run type:check && bun run verify:live-logistics-contract && bun run verify:empty-reuse-retry && bun run verify:empty-reuse-recovery && bun run verify:trip-utilization-input && bun run verify:trip-draft-context && bun run verify:stock-binding-input && bun run verify:stock-observation-input && bun run verify:pending-pick-input && bun run verify:pick-review-ack && bun run verify:driver-license-expiry && bun run verify:freight-input && bun run verify:freight-recovery && bun run verify:freight-commercial && bun run verify:freight-invoice && bun run verify:procedure-input && bun run verify:consolidation && bun run verify:multimodal-single-attempt && bun run verify:workspace-predispatch && bun run verify:tracking-quality-outcomes && bun run verify:shipment-status-authority && bun run verify:free-time-permissions && bun run verify:core-codegen && bun run verify:order-vehicle-hold && bun run verify:pallet-preview && bun run verify:consumed-fuel-preview && bun run build && bun run build-storybook'",
|
|
41
41
|
"storybook": "storybook dev -p 6006",
|
|
42
42
|
"build-storybook": "storybook build",
|
|
43
43
|
"test:storybook": "vitest run --project=storybook",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"schema:pull:introspect": "bash scripts/schema-pull.sh --mode introspect",
|
|
46
46
|
"schema:check": "bash scripts/schema-pull.sh --check",
|
|
47
47
|
"verify:stock-binding-input": "bun scripts/verify-stock-binding-input.mjs",
|
|
48
|
-
"codegen": "bun scripts/codegen.ts --project wspace && bun scripts/codegen.ts --project container-foundation && bun scripts/codegen.ts --project container-condition && bun scripts/codegen.ts --project free-time && bun scripts/codegen.ts --project empty-reuse && bun scripts/codegen.ts --project trip-utilization && bun scripts/codegen.ts --project stock-binding && bun scripts/codegen.ts --project stock-observation && bun scripts/codegen.ts --project pending-pick && bun scripts/codegen.ts --project freight-cost && bun scripts/codegen.ts --project freight-invoice && bun scripts/codegen.ts --project logistics-procedure && bun scripts/codegen.ts --project consolidation && bun scripts/codegen.ts --project tracking-quality && bun scripts/codegen.ts --project shipment-status-authority && bun scripts/codegen.ts --project pallet-preview",
|
|
48
|
+
"codegen": "bun scripts/codegen.ts --project wspace && bun scripts/codegen.ts --project container-foundation && bun scripts/codegen.ts --project container-condition && bun scripts/codegen.ts --project free-time && bun scripts/codegen.ts --project empty-reuse && bun scripts/codegen.ts --project trip-utilization && bun scripts/codegen.ts --project stock-binding && bun scripts/codegen.ts --project stock-observation && bun scripts/codegen.ts --project pending-pick && bun scripts/codegen.ts --project freight-cost && bun scripts/codegen.ts --project freight-invoice && bun scripts/codegen.ts --project logistics-procedure && bun scripts/codegen.ts --project consolidation && bun scripts/codegen.ts --project tracking-quality && bun scripts/codegen.ts --project shipment-status-authority && bun scripts/codegen.ts --project pallet-preview && bun scripts/codegen.ts --project consumed-fuel-preview",
|
|
49
49
|
"codegen:all": "bun run schema:pull && bun run codegen",
|
|
50
50
|
"switch:status": "bun scripts/deps-mode.ts status",
|
|
51
51
|
"switch:remote": "bun scripts/deps-mode.ts remote",
|
|
@@ -71,7 +71,8 @@
|
|
|
71
71
|
"verify:freight-invoice": "bun test scripts/verify-invoice-comparison.test.ts && bun scripts/verify-invoice-recovery-hook.mjs",
|
|
72
72
|
"verify:driver-license-expiry": "bun test scripts/check-driver-license-expiry.test.ts",
|
|
73
73
|
"verify:core-codegen": "bun test scripts/codegen.test.ts && node --test scripts/check-package-types.test.mjs",
|
|
74
|
-
"verify:pallet-preview": "bun test scripts/check-pallet-preview.test.ts && bun scripts/verify-pallet-preview-hook.mjs"
|
|
74
|
+
"verify:pallet-preview": "bun test scripts/check-pallet-preview.test.ts && bun scripts/verify-pallet-preview-hook.mjs",
|
|
75
|
+
"verify:consumed-fuel-preview": "bun test scripts/check-consumed-fuel-preview.test.ts && bun scripts/verify-consumed-fuel-preview-hook.mjs && bun scripts/verify-consumed-fuel-preview-component.mjs"
|
|
75
76
|
},
|
|
76
77
|
"dependencies": {
|
|
77
78
|
"@apollo/client": "^4.0.11",
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/** Internal type. DO NOT USE DIRECTLY. */
|
|
2
|
+
type Exact<T extends { [key: string]: unknown }> = { [K in keyof T]: T[K] };
|
|
3
|
+
/** Internal type. DO NOT USE DIRECTLY. */
|
|
4
|
+
export type Incremental<T> = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never };
|
|
5
|
+
import type * as Types from './consumed-fuel-preview-operations';
|
|
6
|
+
|
|
7
|
+
import type { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/core';
|
|
8
|
+
export type Maybe<T> = T | null;
|
|
9
|
+
export type InputMaybe<T> = Maybe<T>;
|
|
10
|
+
/** All built-in and custom scalars, mapped to their actual values */
|
|
11
|
+
export type Scalars = {
|
|
12
|
+
ID: { input: string; output: string; }
|
|
13
|
+
String: { input: string; output: string; }
|
|
14
|
+
Boolean: { input: boolean; output: boolean; }
|
|
15
|
+
Int: { input: number; output: number; }
|
|
16
|
+
Float: { input: number; output: number; }
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export type MtwConsumedFuelBasis =
|
|
20
|
+
| 'ESTIMATED_CONSUMPTION'
|
|
21
|
+
| 'MEASURED_CONSUMPTION'
|
|
22
|
+
| 'PURCHASED_OR_REFUELLED'
|
|
23
|
+
| 'UNKNOWN';
|
|
24
|
+
|
|
25
|
+
export type MtwConsumedFuelPreview = {
|
|
26
|
+
__typename?: 'MtwConsumedFuelPreview';
|
|
27
|
+
distance?: Maybe<MtwFuelDistanceObservation>;
|
|
28
|
+
fuel?: Maybe<MtwFuelVolumeObservation>;
|
|
29
|
+
litresPer100Km?: Maybe<Scalars['Float']['output']>;
|
|
30
|
+
qualification: MtwConsumedFuelQualification;
|
|
31
|
+
reasons: Array<MtwConsumedFuelReason>;
|
|
32
|
+
status: MtwUtilizationMetricStatus;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export type MtwConsumedFuelPreviewInput = {
|
|
36
|
+
distance?: InputMaybe<MtwFuelDistanceObservationInput>;
|
|
37
|
+
fuel?: InputMaybe<MtwFuelVolumeObservationInput>;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export type MtwConsumedFuelQualification =
|
|
41
|
+
| 'OPERATOR_REPORTED_UNVERIFIED';
|
|
42
|
+
|
|
43
|
+
export type MtwConsumedFuelReason =
|
|
44
|
+
| 'DISTANCE_UNKNOWN'
|
|
45
|
+
| 'FUEL_UNKNOWN'
|
|
46
|
+
| 'INTERVAL_MISMATCH'
|
|
47
|
+
| 'NON_MEASURED_DISTANCE'
|
|
48
|
+
| 'PARTIAL_COVERAGE'
|
|
49
|
+
| 'SOURCE_UNKNOWN'
|
|
50
|
+
| 'UNSUPPORTED_FUEL_BASIS'
|
|
51
|
+
| 'ZERO_DISTANCE';
|
|
52
|
+
|
|
53
|
+
export type MtwFuelDistanceObservation = {
|
|
54
|
+
__typename?: 'MtwFuelDistanceObservation';
|
|
55
|
+
basis: MtwUtilizationDistanceBasis;
|
|
56
|
+
coverage: MtwTripUtilizationCoverage;
|
|
57
|
+
intervalFrom: Scalars['String']['output'];
|
|
58
|
+
intervalUntil: Scalars['String']['output'];
|
|
59
|
+
metres?: Maybe<Scalars['Int']['output']>;
|
|
60
|
+
sourceReference?: Maybe<Scalars['String']['output']>;
|
|
61
|
+
sourceRevision?: Maybe<Scalars['String']['output']>;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
export type MtwFuelDistanceObservationInput = {
|
|
65
|
+
basis: MtwUtilizationDistanceBasis;
|
|
66
|
+
coverage: MtwTripUtilizationCoverage;
|
|
67
|
+
intervalFrom: Scalars['String']['input'];
|
|
68
|
+
intervalUntil: Scalars['String']['input'];
|
|
69
|
+
metres?: InputMaybe<Scalars['Int']['input']>;
|
|
70
|
+
sourceReference?: InputMaybe<Scalars['String']['input']>;
|
|
71
|
+
sourceRevision?: InputMaybe<Scalars['String']['input']>;
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export type MtwFuelVolumeObservation = {
|
|
75
|
+
__typename?: 'MtwFuelVolumeObservation';
|
|
76
|
+
basis: MtwConsumedFuelBasis;
|
|
77
|
+
coverage: MtwTripUtilizationCoverage;
|
|
78
|
+
intervalFrom: Scalars['String']['output'];
|
|
79
|
+
intervalUntil: Scalars['String']['output'];
|
|
80
|
+
millilitres?: Maybe<Scalars['Int']['output']>;
|
|
81
|
+
sourceReference?: Maybe<Scalars['String']['output']>;
|
|
82
|
+
sourceRevision?: Maybe<Scalars['String']['output']>;
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
export type MtwFuelVolumeObservationInput = {
|
|
86
|
+
basis: MtwConsumedFuelBasis;
|
|
87
|
+
coverage: MtwTripUtilizationCoverage;
|
|
88
|
+
intervalFrom: Scalars['String']['input'];
|
|
89
|
+
intervalUntil: Scalars['String']['input'];
|
|
90
|
+
millilitres?: InputMaybe<Scalars['Int']['input']>;
|
|
91
|
+
sourceReference?: InputMaybe<Scalars['String']['input']>;
|
|
92
|
+
sourceRevision?: InputMaybe<Scalars['String']['input']>;
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
export type MtwTripUtilizationCoverage =
|
|
96
|
+
| 'COMPLETE'
|
|
97
|
+
| 'PARTIAL';
|
|
98
|
+
|
|
99
|
+
export type MtwUtilizationDistanceBasis =
|
|
100
|
+
| 'MEASURED'
|
|
101
|
+
| 'OPERATOR_ESTIMATE'
|
|
102
|
+
| 'PROVIDER_ESTIMATE';
|
|
103
|
+
|
|
104
|
+
export type MtwUtilizationMetricStatus =
|
|
105
|
+
| 'KNOWN'
|
|
106
|
+
| 'UNKNOWN';
|
|
107
|
+
|
|
108
|
+
export type Query = {
|
|
109
|
+
__typename?: 'Query';
|
|
110
|
+
mtwConsumedFuelPreview: MtwConsumedFuelPreview;
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
export type QueryMtwConsumedFuelPreviewArgs = {
|
|
115
|
+
input: MtwConsumedFuelPreviewInput;
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
export type MtwConsumedFuelPreviewQueryVariables = Exact<{
|
|
119
|
+
input: Types.MtwConsumedFuelPreviewInput;
|
|
120
|
+
}>;
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
export type MtwConsumedFuelPreviewQuery = { mtwConsumedFuelPreview: { status: Types.MtwUtilizationMetricStatus, litresPer100Km: number | null, reasons: Array<Types.MtwConsumedFuelReason>, qualification: Types.MtwConsumedFuelQualification, distance: { metres: number | null, intervalFrom: string, intervalUntil: string, basis: Types.MtwUtilizationDistanceBasis, coverage: Types.MtwTripUtilizationCoverage, sourceReference: string | null, sourceRevision: string | null } | null, fuel: { millilitres: number | null, intervalFrom: string, intervalUntil: string, basis: Types.MtwConsumedFuelBasis, coverage: Types.MtwTripUtilizationCoverage, sourceReference: string | null, sourceRevision: string | null } | null } };
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
export const MtwConsumedFuelPreviewDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"MtwConsumedFuelPreview"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"MtwConsumedFuelPreviewInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"mtwConsumedFuelPreview"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"litresPer100Km"}},{"kind":"Field","name":{"kind":"Name","value":"reasons"}},{"kind":"Field","name":{"kind":"Name","value":"qualification"}},{"kind":"Field","name":{"kind":"Name","value":"distance"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"metres"}},{"kind":"Field","name":{"kind":"Name","value":"intervalFrom"}},{"kind":"Field","name":{"kind":"Name","value":"intervalUntil"}},{"kind":"Field","name":{"kind":"Name","value":"basis"}},{"kind":"Field","name":{"kind":"Name","value":"coverage"}},{"kind":"Field","name":{"kind":"Name","value":"sourceReference"}},{"kind":"Field","name":{"kind":"Name","value":"sourceRevision"}}]}},{"kind":"Field","name":{"kind":"Name","value":"fuel"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"millilitres"}},{"kind":"Field","name":{"kind":"Name","value":"intervalFrom"}},{"kind":"Field","name":{"kind":"Name","value":"intervalUntil"}},{"kind":"Field","name":{"kind":"Name","value":"basis"}},{"kind":"Field","name":{"kind":"Name","value":"coverage"}},{"kind":"Field","name":{"kind":"Name","value":"sourceReference"}},{"kind":"Field","name":{"kind":"Name","value":"sourceRevision"}}]}}]}}]}}]} as unknown as DocumentNode<MtwConsumedFuelPreviewQuery, MtwConsumedFuelPreviewQueryVariables>;
|
|
@@ -256,6 +256,12 @@ const NavRegistrar: FC<Pick<MoveTheWheelsRootProps, 'registerNavItems' | 'basePa
|
|
|
256
256
|
path: joinPath(basePath, 'routes/trip-utilization'),
|
|
257
257
|
icon: <Truck size={16} />,
|
|
258
258
|
},
|
|
259
|
+
{
|
|
260
|
+
id: 'mtw-fuel-preview',
|
|
261
|
+
label: tr('movethewheels.root.nav.fuelPreview', 'Consumed fuel preview'),
|
|
262
|
+
path: joinPath(basePath, 'fuel-preview'),
|
|
263
|
+
icon: <Truck size={16} />,
|
|
264
|
+
},
|
|
259
265
|
],
|
|
260
266
|
},
|
|
261
267
|
{
|
|
@@ -94,6 +94,7 @@ const PendingPickPage = lazy(() => import('./pages/PendingPickPage'));
|
|
|
94
94
|
const StockObservationsPage = lazy(() => import('./pages/StockObservationsPage'));
|
|
95
95
|
const StockBindingPage = lazy(() => import('./pages/StockBindingPage'));
|
|
96
96
|
const TripUtilizationPage = lazy(() => import('./pages/TripUtilizationPage'));
|
|
97
|
+
const ConsumedFuelPreviewPage = lazy(() => import('./pages/ConsumedFuelPreviewPage'));
|
|
97
98
|
const EmptyReusePage = lazy(() => import('./pages/EmptyReusePage'));
|
|
98
99
|
|
|
99
100
|
export function MoveTheWheelsRoutes() {
|
|
@@ -162,6 +163,7 @@ export function MoveTheWheelsRoutes() {
|
|
|
162
163
|
{/* Routes */}
|
|
163
164
|
<Route path="routes" element={<RoutesPage />} />
|
|
164
165
|
<Route path="routes/trip-utilization" element={<TripUtilizationPage />} />
|
|
166
|
+
<Route path="fuel-preview" element={<ConsumedFuelPreviewPage />} />
|
|
165
167
|
<Route path="routes/new" element={<RouteDetailsPage />} />
|
|
166
168
|
<Route path="routes/:routeId" element={<RouteDetailsPage />} />
|
|
167
169
|
<Route path="routes/:routeId/edit" element={<RouteDetailsPage />} />
|