@burdenoff/microfe-movethewheels 2026.1012.1 → 2026.1013.1

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.
@@ -2,31 +2,33 @@ import { Clock as e } from "../node_modules/lucide-react/dist/esm/icons/clock.js
2
2
  import { useMoveTheWheels as t } from "../providers/MoveTheWheelsProvider.js";
3
3
  import { Button as n, Input as r } from "../components/ui.js";
4
4
  import { PageLayout as i } from "../components/PageLayout.js";
5
- import { useConditionAction as a, useConditionQuery as o } from "../hooks/useContainerCondition.js";
6
- import { ContainerEvidencePicker as ee } from "../components/ContainerEvidencePicker.js";
5
+ import { useConditionAction as ee, useConditionQuery as a } from "../hooks/useContainerCondition.js";
6
+ import { ContainerEvidencePicker as te } from "../components/ContainerEvidencePicker.js";
7
+ import { useShipmentPermissions as o } from "../hooks/useShipmentPermissions.js";
7
8
  import { freeTimeIso as s } from "../utils/freeTimeDate.js";
8
- import { FreeTimeAgreementForm as te } from "../components/FreeTimeAgreementForm.js";
9
- import { DecideFreeExtensionDocument as ne, FreeAgreementsDocument as c, FreeClocksDocument as re, FreeContainersDocument as ie, FreeCyclesDocument as ae, FreeEventsDocument as oe, FreeExposureDocument as se, FreeExtensionsDocument as ce, OpenFreeClockDocument as le, RecordFreeAgreementDocument as ue, RequestFreeExtensionDocument as de } from "../src/generated/free-time-operations.js";
10
- import { useState as l } from "react";
11
- import { Fragment as u, jsx as d, jsxs as f } from "react/jsx-runtime";
9
+ import { FreeTimeAgreementForm as ne } from "../components/FreeTimeAgreementForm.js";
10
+ import { DecideFreeExtensionDocument as re, FreeAgreementsDocument as ie, FreeClocksDocument as ae, FreeContainersDocument as oe, FreeCyclesDocument as se, FreeEventsDocument as ce, FreeExposureDocument as le, FreeExtensionsDocument as ue, OpenFreeClockDocument as de, RecordFreeAgreementDocument as fe, RequestFreeExtensionDocument as pe } from "../src/generated/free-time-operations.js";
11
+ import { useState as c } from "react";
12
+ import { Fragment as l, jsx as u, jsxs as d } from "react/jsx-runtime";
13
+ import { PermissionProvider as f } from "@burdenoff/fe-libs/shared/providers/shell";
12
14
  //#region src/movethewheels/pages/FreeTimePage.tsx
13
15
  var p = "space-y-4 rounded-xl border bg-bg-surface p-5", m = "mt-1 w-full rounded-md border bg-bg-surface p-2 text-sm", h = 25;
14
16
  function g({ page: e, offset: t, setOffset: r, busy: i }) {
15
- return /* @__PURE__ */ f("div", {
17
+ return /* @__PURE__ */ d("div", {
16
18
  className: "flex flex-wrap items-center gap-2",
17
19
  children: [
18
- /* @__PURE__ */ d(n, {
20
+ /* @__PURE__ */ u(n, {
19
21
  type: "button",
20
22
  variant: "outline",
21
23
  disabled: i || t === 0,
22
24
  onClick: () => r(Math.max(0, t - h)),
23
25
  children: "Previous"
24
26
  }),
25
- /* @__PURE__ */ d("span", {
27
+ /* @__PURE__ */ u("span", {
26
28
  className: "text-sm",
27
29
  children: e ? `${e.total} records; page ${Math.floor(t / h) + 1}` : "Waiting for records"
28
30
  }),
29
- /* @__PURE__ */ d(n, {
31
+ /* @__PURE__ */ u(n, {
30
32
  type: "button",
31
33
  variant: "outline",
32
34
  disabled: i || !e?.hasMore || e.nextOffset == null || e.nextOffset > 1e4,
@@ -39,12 +41,12 @@ function g({ page: e, offset: t, setOffset: r, busy: i }) {
39
41
  });
40
42
  }
41
43
  function _({ error: e, loading: t, children: n }) {
42
- return /* @__PURE__ */ f(u, { children: [
43
- e && /* @__PURE__ */ d("p", {
44
+ return /* @__PURE__ */ d(l, { children: [
45
+ e && /* @__PURE__ */ u("p", {
44
46
  role: "alert",
45
47
  children: e
46
48
  }),
47
- t && /* @__PURE__ */ d("p", {
49
+ t && /* @__PURE__ */ u("p", {
48
50
  role: "status",
49
51
  children: "Loading records…"
50
52
  }),
@@ -52,120 +54,127 @@ function _({ error: e, loading: t, children: n }) {
52
54
  ] });
53
55
  }
54
56
  function v() {
55
- let { workspaceId: n, tenantId: r, currentUser: a, apiGatewayUrl: o } = t();
56
- return /* @__PURE__ */ d(i, {
57
+ let { workspaceId: n, tenantId: r, currentUser: ee, apiGatewayUrl: a } = t();
58
+ return /* @__PURE__ */ u(i, {
57
59
  title: "Free time and extension decisions",
58
60
  subtitle: "Separate sourced commercial obligations, actual events and recorded counterparty decisions.",
59
- icon: /* @__PURE__ */ d(e, { "aria-hidden": "true" }),
60
- children: /* @__PURE__ */ d(y, {}, `${n}:${r}:${a?.id}:${o}`)
61
+ icon: /* @__PURE__ */ u(e, { "aria-hidden": "true" }),
62
+ children: /* @__PURE__ */ u(f, {
63
+ scopeId: n ?? null,
64
+ gateway: "workspace",
65
+ children: /* @__PURE__ */ u(y, {})
66
+ }, `${n}:${r}:${ee?.id}:${a}`)
61
67
  });
62
68
  }
63
69
  function y() {
64
- let [e, t] = l(""), [i, v] = l(""), [y, b] = l(""), [x, fe] = l(0), [pe, me] = l(0), [he, S] = l(0), [ge, C] = l(0), [_e, w] = l(0), [T, E] = l(0), [D, O] = l("open"), [k, ve] = l("DEMURRAGE"), [A, j] = l(""), [M, ye] = l((/* @__PURE__ */ new Date()).toISOString()), [be, xe] = l(M), [N, P] = l(null), [F, I] = l([]), [L, R] = l(""), [z, Se] = l("ACCEPTED"), B = a(), V = o(ie, { pagination: {
70
+ return /* @__PURE__ */ u(b, { access: o() });
71
+ }
72
+ function b({ access: e }) {
73
+ let [t, i] = c(""), [o, f] = c(""), [v, y] = c(""), [b, me] = c(0), [he, x] = c(0), [S, C] = c(0), [ge, w] = c(0), [_e, T] = c(0), [E, D] = c(0), [O, k] = c("open"), [ve, ye] = c("DEMURRAGE"), [A, j] = c(""), [M, be] = c((/* @__PURE__ */ new Date()).toISOString()), [xe, Se] = c(M), [N, P] = c(null), [F, I] = c([]), [L, R] = c(""), [z, Ce] = c("ACCEPTED"), B = ee(), V = a(oe, e.canRead ? { pagination: {
65
74
  limit: h,
66
- offset: x
67
- } }), H = o(ae, e ? {
68
- containerId: e,
75
+ offset: b
76
+ } } : null), H = a(se, e.canRead && t ? {
77
+ containerId: t,
69
78
  pagination: {
70
79
  limit: h,
71
- offset: pe
80
+ offset: he
72
81
  }
73
- } : null), U = o(oe, i ? {
74
- cycleId: i,
82
+ } : null), U = a(ce, e.canRead && o ? {
83
+ cycleId: o,
75
84
  pagination: {
76
85
  limit: h,
77
- offset: he
86
+ offset: S
78
87
  }
79
- } : null, B.revision), W = o(re, i ? {
80
- cycleId: i,
88
+ } : null, B.revision), W = a(ae, e.canRead && o ? {
89
+ cycleId: o,
81
90
  pagination: {
82
91
  limit: h,
83
92
  offset: ge
84
93
  }
85
- } : null, B.revision), G = o(c, y ? {
86
- clockId: y,
94
+ } : null, B.revision), G = a(ie, e.canRead && v ? {
95
+ clockId: v,
87
96
  pagination: {
88
97
  limit: h,
89
98
  offset: _e
90
99
  }
91
- } : null, B.revision), K = o(c, y ? {
92
- clockId: y,
100
+ } : null, B.revision), K = a(ie, e.canRead && v ? {
101
+ clockId: v,
93
102
  pagination: {
94
103
  limit: 1,
95
104
  offset: 0
96
105
  }
97
- } : null, B.revision), q = o(ce, y ? {
98
- clockId: y,
106
+ } : null, B.revision), q = a(ue, e.canRead && v ? {
107
+ clockId: v,
99
108
  pagination: {
100
109
  limit: h,
101
- offset: T
110
+ offset: E
102
111
  }
103
- } : null, B.revision), J = o(se, y ? {
104
- clockId: y,
105
- asOf: be
106
- } : null, B.revision), Y = W.data?.mtwFreeTimeClockPage.items.find((e) => e.id === y), X = K.data?.mtwFreeTimeAgreementPage.items[0], Ce = q.data?.mtwFreeTimeExtensionPage.items.filter((e) => !e.decision) ?? [], Z = () => {
107
- b(""), w(0), E(0), R(""), I([]), O("open"), j(""), P(null), B.resetFeedback();
108
- }, Q = J.data?.mtwFreeTimeExposure, $ = G.data?.mtwFreeTimeAgreementPage.items.find((e) => e.id === Q?.agreementId) ?? (X?.id === Q?.agreementId ? X : void 0), we = () => {
112
+ } : null, B.revision), J = a(le, e.canRead && v ? {
113
+ clockId: v,
114
+ asOf: xe
115
+ } : null, B.revision), Y = W.data?.mtwFreeTimeClockPage.items.find((e) => e.id === v), X = K.data?.mtwFreeTimeAgreementPage.items[0], we = q.data?.mtwFreeTimeExtensionPage.items.filter((e) => !e.decision) ?? [], Z = () => {
116
+ y(""), T(0), D(0), R(""), I([]), k("open"), j(""), P(null), B.resetFeedback();
117
+ }, Q = J.data?.mtwFreeTimeExposure, $ = G.data?.mtwFreeTimeAgreementPage.items.find((e) => e.id === Q?.agreementId) ?? (X?.id === Q?.agreementId ? X : void 0), Te = () => {
109
118
  if (!F.length) throw Error("Select exact decision/request evidence versions.");
110
119
  return F.map(({ fileId: e, versionId: t }) => ({
111
120
  fileId: e,
112
121
  versionId: t
113
122
  }));
114
123
  };
115
- return /* @__PURE__ */ f("div", {
124
+ return e.canRead ? /* @__PURE__ */ d("div", {
116
125
  className: "space-y-6",
117
126
  children: [
118
- /* @__PURE__ */ d("p", {
127
+ /* @__PURE__ */ u("p", {
119
128
  className: "rounded-lg border p-4 text-sm",
120
129
  children: "These are estimates under recorded source terms. Separate storage, demurrage and detention may overlap commercially; they are not automatically merged or summed across currencies. An extension changes the clock only after external acceptance is recorded. This service does not negotiate or certify acceptance."
121
130
  }),
122
- /* @__PURE__ */ f("section", {
131
+ /* @__PURE__ */ d("section", {
123
132
  className: p,
124
133
  "aria-label": "Container and commercial obligation",
125
134
  children: [
126
- /* @__PURE__ */ f("label", {
135
+ /* @__PURE__ */ d("label", {
127
136
  className: "block",
128
- children: ["Container", /* @__PURE__ */ f("select", {
137
+ children: ["Container", /* @__PURE__ */ d("select", {
129
138
  className: m,
130
- value: e,
139
+ value: t,
131
140
  disabled: B.busy,
132
141
  onChange: (e) => {
133
- t(e.target.value), v(""), me(0), S(0), C(0), Z();
142
+ i(e.target.value), f(""), x(0), C(0), w(0), Z();
134
143
  },
135
- children: [/* @__PURE__ */ d("option", {
144
+ children: [/* @__PURE__ */ u("option", {
136
145
  value: "",
137
146
  children: "Choose container"
138
- }), V.data?.mtwContainerPage.items.map((e) => /* @__PURE__ */ d("option", {
147
+ }), V.data?.mtwContainerPage.items.map((e) => /* @__PURE__ */ u("option", {
139
148
  value: e.id,
140
149
  children: e.containerNumber
141
150
  }, e.id))]
142
151
  })]
143
152
  }),
144
- /* @__PURE__ */ d(_, {
153
+ /* @__PURE__ */ u(_, {
145
154
  error: V.error,
146
155
  loading: V.loading,
147
- children: /* @__PURE__ */ d(g, {
156
+ children: /* @__PURE__ */ u(g, {
148
157
  page: V.data?.mtwContainerPage,
149
- offset: x,
158
+ offset: b,
150
159
  busy: V.loading || B.busy,
151
160
  setOffset: (e) => {
152
- fe(e), t(""), v(""), Z();
161
+ me(e), i(""), f(""), Z();
153
162
  }
154
163
  })
155
164
  }),
156
- /* @__PURE__ */ f("label", {
165
+ /* @__PURE__ */ d("label", {
157
166
  className: "block",
158
- children: ["Usage cycle", /* @__PURE__ */ f("select", {
167
+ children: ["Usage cycle", /* @__PURE__ */ d("select", {
159
168
  className: m,
160
- value: i,
161
- disabled: !e || B.busy,
169
+ value: o,
170
+ disabled: !t || B.busy,
162
171
  onChange: (e) => {
163
- v(e.target.value), S(0), C(0), Z();
172
+ f(e.target.value), C(0), w(0), Z();
164
173
  },
165
- children: [/* @__PURE__ */ d("option", {
174
+ children: [/* @__PURE__ */ u("option", {
166
175
  value: "",
167
176
  children: "Choose cycle"
168
- }), H.data?.mtwContainerCyclePage.items.map((e) => /* @__PURE__ */ f("option", {
177
+ }), H.data?.mtwContainerCyclePage.items.map((e) => /* @__PURE__ */ d("option", {
169
178
  value: e.id,
170
179
  children: [
171
180
  e.bookingReference ?? e.id,
@@ -177,31 +186,31 @@ function y() {
177
186
  }, e.id))]
178
187
  })]
179
188
  }),
180
- /* @__PURE__ */ d(_, {
189
+ /* @__PURE__ */ u(_, {
181
190
  error: H.error,
182
191
  loading: H.loading,
183
- children: /* @__PURE__ */ d(g, {
192
+ children: /* @__PURE__ */ u(g, {
184
193
  page: H.data?.mtwContainerCyclePage,
185
- offset: pe,
194
+ offset: he,
186
195
  busy: H.loading || B.busy,
187
196
  setOffset: (e) => {
188
- me(e), v(""), Z();
197
+ x(e), f(""), Z();
189
198
  }
190
199
  })
191
200
  }),
192
- /* @__PURE__ */ f("label", {
201
+ /* @__PURE__ */ d("label", {
193
202
  className: "block",
194
- children: ["Commercial obligation", /* @__PURE__ */ f("select", {
203
+ children: ["Commercial obligation", /* @__PURE__ */ d("select", {
195
204
  className: m,
196
- value: y,
197
- disabled: !i || B.busy,
205
+ value: v,
206
+ disabled: !o || B.busy,
198
207
  onChange: (e) => {
199
- b(e.target.value), w(0), E(0), R(""), I([]), O("correct"), P(null), B.resetFeedback();
208
+ y(e.target.value), T(0), D(0), R(""), I([]), k("correct"), P(null), B.resetFeedback();
200
209
  },
201
- children: [/* @__PURE__ */ d("option", {
210
+ children: [/* @__PURE__ */ u("option", {
202
211
  value: "",
203
212
  children: "New obligation / choose existing"
204
- }), W.data?.mtwFreeTimeClockPage.items.map((e) => /* @__PURE__ */ f("option", {
213
+ }), W.data?.mtwFreeTimeClockPage.items.map((e) => /* @__PURE__ */ d("option", {
205
214
  value: e.id,
206
215
  children: [
207
216
  e.chargeKind,
@@ -211,65 +220,65 @@ function y() {
211
220
  }, e.id))]
212
221
  })]
213
222
  }),
214
- /* @__PURE__ */ d(_, {
223
+ /* @__PURE__ */ u(_, {
215
224
  error: W.error,
216
225
  loading: W.loading,
217
- children: /* @__PURE__ */ d(g, {
226
+ children: /* @__PURE__ */ u(g, {
218
227
  page: W.data?.mtwFreeTimeClockPage,
219
228
  offset: ge,
220
229
  busy: W.loading || B.busy,
221
230
  setOffset: (e) => {
222
- C(e), Z();
231
+ w(e), Z();
223
232
  }
224
233
  })
225
234
  })
226
235
  ]
227
236
  }),
228
- y && /* @__PURE__ */ f("section", {
237
+ v && /* @__PURE__ */ d("section", {
229
238
  className: p,
230
239
  "aria-label": "Recorded exposure",
231
240
  children: [
232
- /* @__PURE__ */ d("h2", {
241
+ /* @__PURE__ */ u("h2", {
233
242
  className: "text-lg font-semibold",
234
243
  children: "Recorded exposure"
235
244
  }),
236
- /* @__PURE__ */ f("form", {
245
+ /* @__PURE__ */ d("form", {
237
246
  className: "flex flex-wrap items-end gap-3",
238
247
  onSubmit: (e) => {
239
248
  e.preventDefault();
240
249
  try {
241
- xe(s(M)), P(null);
250
+ Se(s(M)), P(null);
242
251
  } catch (e) {
243
252
  P(e instanceof Error ? e.message : "Invalid evaluation time");
244
253
  }
245
254
  },
246
- children: [/* @__PURE__ */ f("label", { children: ["Evaluate at time with timezone", /* @__PURE__ */ d(r, {
255
+ children: [/* @__PURE__ */ d("label", { children: ["Evaluate at time with timezone", /* @__PURE__ */ u(r, {
247
256
  value: M,
248
- onChange: (e) => ye(e.target.value),
257
+ onChange: (e) => be(e.target.value),
249
258
  required: !0
250
- })] }), /* @__PURE__ */ d(n, {
259
+ })] }), /* @__PURE__ */ u(n, {
251
260
  type: "submit",
252
261
  children: "Estimate exposure"
253
262
  })]
254
263
  }),
255
- /* @__PURE__ */ d(_, {
264
+ /* @__PURE__ */ u(_, {
256
265
  error: J.error,
257
266
  loading: J.loading,
258
- children: Q && /* @__PURE__ */ f(u, { children: [
259
- /* @__PURE__ */ f("p", { children: [
267
+ children: Q && /* @__PURE__ */ d(l, { children: [
268
+ /* @__PURE__ */ d("p", { children: [
260
269
  "Evaluation agreement: ",
261
270
  Q.agreementId ?? "Unknown",
262
271
  ".",
263
272
  " ",
264
273
  $ ? `${$.payer} → ${$.payee}. Source: ${$.sourceReference}. Timezone: ${$.terms?.timeZone ?? "Pricing terms unavailable"}.` : "See the matching history version for source and parties."
265
274
  ] }),
266
- /* @__PURE__ */ d("p", { children: Q.status === "ESTIMATED" ? "Estimated under recorded terms" : `Cannot estimate: ${Q.reason ?? "Incomplete data"}` }),
267
- /* @__PURE__ */ f("p", { children: [
275
+ /* @__PURE__ */ u("p", { children: Q.status === "ESTIMATED" ? "Estimated under recorded terms" : `Cannot estimate: ${Q.reason ?? "Incomplete data"}` }),
276
+ /* @__PURE__ */ d("p", { children: [
268
277
  "Exact deadline: ",
269
278
  Q.freeUntil ?? "Unknown",
270
279
  Q.localLastFreeDate ? `; local last-free date ${Q.localLastFreeDate}` : ""
271
280
  ] }),
272
- Q.status === "ESTIMATED" && /* @__PURE__ */ f("p", { children: [
281
+ Q.status === "ESTIMATED" && /* @__PURE__ */ d("p", { children: [
273
282
  Q.chargedDays,
274
283
  " charged dates;",
275
284
  " ",
@@ -278,7 +287,7 @@ function y() {
278
287
  Q.deadlineSource,
279
288
  "."
280
289
  ] }),
281
- /* @__PURE__ */ d("p", {
290
+ /* @__PURE__ */ u("p", {
282
291
  className: "text-sm",
283
292
  children: "The exact timestamp takes precedence over a date label. Recalculated using versions effective at evaluation time; this does not reconstruct what was known then. Prospective segmented tariffs are unsupported."
284
293
  })
@@ -286,19 +295,19 @@ function y() {
286
295
  })
287
296
  ]
288
297
  }),
289
- i && /* @__PURE__ */ f("section", {
298
+ o && e.canUpdate && /* @__PURE__ */ d("section", {
290
299
  className: p,
291
300
  "aria-label": "Record contractual change",
292
301
  children: [
293
- /* @__PURE__ */ d("h2", {
302
+ /* @__PURE__ */ u("h2", {
294
303
  className: "text-lg font-semibold",
295
304
  children: "Record contractual change"
296
305
  }),
297
- /* @__PURE__ */ f("label", {
306
+ /* @__PURE__ */ d("label", {
298
307
  className: "block",
299
- children: ["Free-time action", /* @__PURE__ */ f("select", {
308
+ children: ["Free-time action", /* @__PURE__ */ d("select", {
300
309
  className: m,
301
- value: D,
310
+ value: O,
302
311
  disabled: B.busy,
303
312
  onChange: (e) => {
304
313
  let t = [
@@ -307,24 +316,24 @@ function y() {
307
316
  "request",
308
317
  "decision"
309
318
  ].find((t) => t === e.target.value);
310
- t && (O(t), B.resetFeedback(), R(""), I([]), P(null));
319
+ t && (k(t), B.resetFeedback(), R(""), I([]), P(null));
311
320
  },
312
321
  children: [
313
- /* @__PURE__ */ d("option", {
322
+ /* @__PURE__ */ u("option", {
314
323
  value: "open",
315
324
  children: "Open a separate sourced obligation"
316
325
  }),
317
- /* @__PURE__ */ d("option", {
326
+ /* @__PURE__ */ u("option", {
318
327
  value: "correct",
319
328
  disabled: !Y,
320
329
  children: "Correct agreement / actual event binding"
321
330
  }),
322
- /* @__PURE__ */ d("option", {
331
+ /* @__PURE__ */ u("option", {
323
332
  value: "request",
324
333
  disabled: !Y,
325
334
  children: "Record extension request"
326
335
  }),
327
- /* @__PURE__ */ d("option", {
336
+ /* @__PURE__ */ u("option", {
328
337
  value: "decision",
329
338
  disabled: !Y,
330
339
  children: "Record external decision"
@@ -332,26 +341,26 @@ function y() {
332
341
  ]
333
342
  })]
334
343
  }),
335
- (D === "open" || D === "correct") && /* @__PURE__ */ f(u, { children: [
336
- D === "open" && /* @__PURE__ */ f("div", {
344
+ (O === "open" || O === "correct") && /* @__PURE__ */ d(l, { children: [
345
+ O === "open" && /* @__PURE__ */ d("div", {
337
346
  className: "grid gap-3 md:grid-cols-2",
338
- children: [/* @__PURE__ */ f("label", { children: ["Charge kind", /* @__PURE__ */ f("select", {
347
+ children: [/* @__PURE__ */ d("label", { children: ["Charge kind", /* @__PURE__ */ d("select", {
339
348
  className: m,
340
- value: k,
349
+ value: ve,
341
350
  onChange: (e) => {
342
351
  let t = [
343
352
  "DEMURRAGE",
344
353
  "DETENTION",
345
354
  "TERMINAL_STORAGE"
346
355
  ].find((t) => t === e.target.value);
347
- t && ve(t);
356
+ t && ye(t);
348
357
  },
349
358
  children: [
350
- /* @__PURE__ */ d("option", { children: "DEMURRAGE" }),
351
- /* @__PURE__ */ d("option", { children: "DETENTION" }),
352
- /* @__PURE__ */ d("option", { children: "TERMINAL_STORAGE" })
359
+ /* @__PURE__ */ u("option", { children: "DEMURRAGE" }),
360
+ /* @__PURE__ */ u("option", { children: "DETENTION" }),
361
+ /* @__PURE__ */ u("option", { children: "TERMINAL_STORAGE" })
353
362
  ]
354
- })] }), /* @__PURE__ */ f("label", { children: ["Commercial obligation reference", /* @__PURE__ */ d(r, {
363
+ })] }), /* @__PURE__ */ d("label", { children: ["Commercial obligation reference", /* @__PURE__ */ u(r, {
355
364
  required: !0,
356
365
  maxLength: 255,
357
366
  value: A,
@@ -359,70 +368,72 @@ function y() {
359
368
  placeholder: "Payee / terminal / booking / segment"
360
369
  })] })]
361
370
  }),
362
- /* @__PURE__ */ d(_, {
371
+ /* @__PURE__ */ u(_, {
363
372
  error: U.error,
364
373
  loading: U.loading,
365
- children: /* @__PURE__ */ d(g, {
374
+ children: /* @__PURE__ */ u(g, {
366
375
  page: U.data?.mtwContainerEventPage,
367
- offset: he,
368
- setOffset: S,
376
+ offset: S,
377
+ setOffset: C,
369
378
  busy: U.loading || B.busy
370
379
  })
371
380
  }),
372
- (D === "open" || X) && /* @__PURE__ */ d(te, {
381
+ (O === "open" || X) && /* @__PURE__ */ u(ne, {
373
382
  events: U.data?.mtwContainerEventPage.items ?? [],
374
- initial: D === "correct" ? X : void 0,
375
- busy: B.busy || U.loading || D === "correct" && K.loading,
376
- onSubmit: async (e) => {
377
- if (D === "open") {
383
+ initial: O === "correct" ? X : void 0,
384
+ busy: B.busy || U.loading || O === "correct" && K.loading,
385
+ onSubmit: async (t) => {
386
+ if (!e.allows("update")) throw Error("Shipment update permission is required.");
387
+ if (O === "open") {
378
388
  if (!A.trim()) throw Error("Enter a distinct commercial obligation reference.");
379
- await B.run(le, {
380
- cycleId: i,
381
- chargeKind: k,
389
+ await B.run(de, {
390
+ cycleId: o,
391
+ chargeKind: ve,
382
392
  obligationReference: A,
383
- agreement: e
393
+ agreement: t
384
394
  }, "Sourced clock opened.");
385
395
  } else {
386
396
  if (!Y || !X) throw Error("Reload the current obligation before correcting it.");
387
- await B.run(ue, {
388
- clockId: y,
397
+ await B.run(fe, {
398
+ clockId: v,
389
399
  expectedVersion: Y.version,
390
- agreement: e
400
+ agreement: t
391
401
  }, "New immutable agreement version recorded.");
392
402
  }
393
403
  }
394
- }, `${D}:${i}:${y}:${X?.id}`)
404
+ }, `${O}:${o}:${v}:${X?.id}`)
395
405
  ] }),
396
- (D === "request" || D === "decision") && /* @__PURE__ */ f("form", {
406
+ (O === "request" || O === "decision") && /* @__PURE__ */ d("form", {
397
407
  className: "space-y-4",
398
- onSubmit: async (e) => {
399
- e.preventDefault(), P(null);
408
+ onSubmit: async (t) => {
409
+ t.preventDefault(), P(null);
400
410
  try {
411
+ if (!e.allows("update")) throw Error("Shipment update permission is required.");
401
412
  if (!Y || !X) throw Error("Reload the current obligation and agreement.");
402
- let t = new FormData(e.currentTarget), n = (e) => String(t.get(e) ?? "").trim();
403
- if (D === "request") await B.run(de, {
404
- clockId: y,
413
+ let n = new FormData(t.currentTarget), r = (e) => String(n.get(e) ?? "").trim();
414
+ if (O === "request") await B.run(pe, {
415
+ clockId: v,
405
416
  expectedVersion: Y.version,
406
417
  baseAgreementId: X.id,
407
- requestedFreeUntil: s(n("requestedDeadline")),
408
- requestedAt: s(n("requestedAt")),
409
- expiresAt: s(n("expiresAt")),
410
- reason: n("reason"),
411
- evidence: we()
418
+ requestedFreeUntil: s(r("requestedDeadline")),
419
+ requestedAt: s(r("requestedAt")),
420
+ expiresAt: s(r("expiresAt")),
421
+ reason: r("reason"),
422
+ evidence: Te()
412
423
  }, "Request recorded; current terms remain unchanged.");
413
424
  else {
414
- if (!Ce.some((e) => e.id === L)) throw Error("Choose an unanswered request.");
415
- await B.run(ne, {
425
+ if (!we.some((e) => e.id === L)) throw Error("Choose an unanswered request.");
426
+ await B.run(re, {
416
427
  extensionId: L,
417
428
  expectedVersion: Y.version,
418
429
  decision: z,
419
- decidedAt: s(n("decidedAt")),
420
- effectiveAt: z === "ACCEPTED" ? s(n("effectiveAt")) : null,
421
- acceptedFreeUntil: z === "ACCEPTED" ? s(n("acceptedDeadline")) : null,
422
- counterparty: n("counterparty"),
423
- sourceReference: n("confirmation"),
424
- note: n("note"),
425
- evidence: we()
430
+ decidedAt: s(r("decidedAt")),
431
+ effectiveAt: z === "ACCEPTED" ? s(r("effectiveAt")) : null,
432
+ acceptedFreeUntil: z === "ACCEPTED" ? s(r("acceptedDeadline")) : null,
433
+ counterparty: r("counterparty"),
434
+ sourceReference: r("confirmation"),
435
+ note: r("note"),
436
+ evidence: Te()
426
437
  }, "External decision recorded with immutable history.");
427
438
  }
428
439
  } catch (e) {
@@ -430,33 +441,33 @@ function y() {
430
441
  }
431
442
  },
432
443
  children: [
433
- D === "request" ? /* @__PURE__ */ f("div", {
444
+ O === "request" ? /* @__PURE__ */ d("div", {
434
445
  className: "grid gap-3 md:grid-cols-2",
435
446
  children: [[
436
447
  ["requestedDeadline", "Requested deadline with timezone"],
437
448
  ["requestedAt", "Actual request time with timezone"],
438
449
  ["expiresAt", "Request expiry with timezone"]
439
- ].map(([e, t]) => /* @__PURE__ */ f("label", { children: [t, /* @__PURE__ */ d(r, {
450
+ ].map(([e, t]) => /* @__PURE__ */ d("label", { children: [t, /* @__PURE__ */ u(r, {
440
451
  name: e,
441
452
  required: !0,
442
453
  placeholder: "2026-10-04T09:00:00+05:30"
443
- })] }, e)), /* @__PURE__ */ f("label", { children: ["Request reason", /* @__PURE__ */ d(r, {
454
+ })] }, e)), /* @__PURE__ */ d("label", { children: ["Request reason", /* @__PURE__ */ u(r, {
444
455
  name: "reason",
445
456
  required: !0,
446
457
  maxLength: 2e3
447
458
  })] })]
448
- }) : /* @__PURE__ */ f(u, { children: [
449
- /* @__PURE__ */ f("label", {
459
+ }) : /* @__PURE__ */ d(l, { children: [
460
+ /* @__PURE__ */ d("label", {
450
461
  className: "block",
451
- children: ["Unanswered extension request", /* @__PURE__ */ f("select", {
462
+ children: ["Unanswered extension request", /* @__PURE__ */ d("select", {
452
463
  className: m,
453
464
  required: !0,
454
465
  value: L,
455
466
  onChange: (e) => R(e.target.value),
456
- children: [/* @__PURE__ */ d("option", {
467
+ children: [/* @__PURE__ */ u("option", {
457
468
  value: "",
458
469
  children: "Choose request from this page"
459
- }), Ce.map((e) => /* @__PURE__ */ f("option", {
470
+ }), we.map((e) => /* @__PURE__ */ d("option", {
460
471
  value: e.id,
461
472
  children: [
462
473
  e.requestedFreeUntil,
@@ -469,9 +480,9 @@ function y() {
469
480
  }, e.id))]
470
481
  })]
471
482
  }),
472
- /* @__PURE__ */ f("label", {
483
+ /* @__PURE__ */ d("label", {
473
484
  className: "block",
474
- children: ["Recorded decision", /* @__PURE__ */ f("select", {
485
+ children: ["Recorded decision", /* @__PURE__ */ d("select", {
475
486
  className: m,
476
487
  value: z,
477
488
  onChange: (e) => {
@@ -480,77 +491,77 @@ function y() {
480
491
  "REJECTED",
481
492
  "EXPIRED"
482
493
  ].find((t) => t === e.target.value);
483
- t && Se(t);
494
+ t && Ce(t);
484
495
  },
485
496
  children: [
486
- /* @__PURE__ */ d("option", { children: "ACCEPTED" }),
487
- /* @__PURE__ */ d("option", { children: "REJECTED" }),
488
- /* @__PURE__ */ d("option", { children: "EXPIRED" })
497
+ /* @__PURE__ */ u("option", { children: "ACCEPTED" }),
498
+ /* @__PURE__ */ u("option", { children: "REJECTED" }),
499
+ /* @__PURE__ */ u("option", { children: "EXPIRED" })
489
500
  ]
490
501
  })]
491
502
  }),
492
- /* @__PURE__ */ f("div", {
503
+ /* @__PURE__ */ d("div", {
493
504
  className: "grid gap-3 md:grid-cols-2",
494
505
  children: [
495
- /* @__PURE__ */ f("label", { children: ["Actual decision time with timezone", /* @__PURE__ */ d(r, {
506
+ /* @__PURE__ */ d("label", { children: ["Actual decision time with timezone", /* @__PURE__ */ u(r, {
496
507
  name: "decidedAt",
497
508
  required: !0
498
509
  })] }),
499
- /* @__PURE__ */ f("label", { children: ["Counterparty / expiry authority", /* @__PURE__ */ d(r, {
510
+ /* @__PURE__ */ d("label", { children: ["Counterparty / expiry authority", /* @__PURE__ */ u(r, {
500
511
  name: "counterparty",
501
512
  required: !0,
502
513
  maxLength: 255
503
514
  })] }),
504
- /* @__PURE__ */ f("label", { children: ["External confirmation source reference", /* @__PURE__ */ d(r, {
515
+ /* @__PURE__ */ d("label", { children: ["External confirmation source reference", /* @__PURE__ */ u(r, {
505
516
  name: "confirmation",
506
517
  required: !0,
507
518
  maxLength: 255
508
519
  })] }),
509
- z === "ACCEPTED" && /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ f("label", { children: ["Externally accepted deadline with timezone", /* @__PURE__ */ d(r, {
520
+ z === "ACCEPTED" && /* @__PURE__ */ d(l, { children: [/* @__PURE__ */ d("label", { children: ["Externally accepted deadline with timezone", /* @__PURE__ */ u(r, {
510
521
  name: "acceptedDeadline",
511
522
  required: !0
512
- })] }), /* @__PURE__ */ f("label", { children: ["Explicit effective time with timezone", /* @__PURE__ */ d(r, {
523
+ })] }), /* @__PURE__ */ d("label", { children: ["Explicit effective time with timezone", /* @__PURE__ */ u(r, {
513
524
  name: "effectiveAt",
514
525
  required: !0
515
526
  })] })] }),
516
- /* @__PURE__ */ f("label", { children: ["Decision note and applicability", /* @__PURE__ */ d(r, {
527
+ /* @__PURE__ */ d("label", { children: ["Decision note and applicability", /* @__PURE__ */ u(r, {
517
528
  name: "note",
518
529
  required: !0,
519
530
  maxLength: 2e3
520
531
  })] })
521
532
  ]
522
533
  }),
523
- /* @__PURE__ */ d("p", {
534
+ /* @__PURE__ */ u("p", {
524
535
  className: "text-sm",
525
536
  children: "Requested and accepted deadlines can differ. Accepted extensions must move a known current cutoff later. Late decisions or a superseded base agreement require explicit reconciliation. Expiry never reverses an accepted agreement."
526
537
  })
527
538
  ] }),
528
- /* @__PURE__ */ d(ee, {
539
+ /* @__PURE__ */ u(te, {
529
540
  description: "Choose exact source versions. Integrity does not independently establish contractual terms or counterparty acceptance.",
530
541
  value: F,
531
542
  onChange: I
532
543
  }),
533
- /* @__PURE__ */ d(n, {
544
+ /* @__PURE__ */ u(n, {
534
545
  type: "submit",
535
546
  disabled: B.busy || K.loading || !Y || !X,
536
- children: D === "request" ? "Record extension request" : "Record counterparty decision"
547
+ children: O === "request" ? "Record extension request" : "Record counterparty decision"
537
548
  })
538
549
  ]
539
550
  }),
540
- (N || B.error) && /* @__PURE__ */ d("p", {
551
+ (N || B.error) && /* @__PURE__ */ u("p", {
541
552
  role: "alert",
542
553
  children: N ?? B.error
543
554
  }),
544
- B.notice && /* @__PURE__ */ d("p", {
555
+ B.notice && /* @__PURE__ */ u("p", {
545
556
  role: "status",
546
557
  children: B.notice
547
558
  }),
548
- B.hasPendingAttempt && /* @__PURE__ */ f("div", {
559
+ B.hasPendingAttempt && /* @__PURE__ */ d("div", {
549
560
  className: "space-y-2",
550
- children: [/* @__PURE__ */ d("p", {
561
+ children: [/* @__PURE__ */ u("p", {
551
562
  className: "text-sm",
552
563
  children: "A failed response may still mean the record was saved. Check history before discarding or repeating the action, especially after reopening this page."
553
- }), /* @__PURE__ */ d(n, {
564
+ }), /* @__PURE__ */ u(n, {
554
565
  type: "button",
555
566
  variant: "outline",
556
567
  disabled: B.busy,
@@ -560,19 +571,19 @@ function y() {
560
571
  })
561
572
  ]
562
573
  }),
563
- y && /* @__PURE__ */ f("div", {
574
+ v && /* @__PURE__ */ d("div", {
564
575
  className: "grid gap-6 xl:grid-cols-2",
565
- children: [/* @__PURE__ */ f("section", {
576
+ children: [/* @__PURE__ */ d("section", {
566
577
  className: p,
567
- children: [/* @__PURE__ */ d("h2", {
578
+ children: [/* @__PURE__ */ u("h2", {
568
579
  className: "text-lg font-semibold",
569
580
  children: "Agreement history"
570
- }), /* @__PURE__ */ f(_, {
581
+ }), /* @__PURE__ */ d(_, {
571
582
  error: G.error,
572
583
  loading: G.loading,
573
- children: [/* @__PURE__ */ d("ul", {
584
+ children: [/* @__PURE__ */ u("ul", {
574
585
  className: "space-y-3",
575
- children: G.data?.mtwFreeTimeAgreementPage.items.map((e) => /* @__PURE__ */ f("li", {
586
+ children: G.data?.mtwFreeTimeAgreementPage.items.map((e) => /* @__PURE__ */ d("li", {
576
587
  className: "break-words rounded-lg border p-3 text-sm",
577
588
  children: [
578
589
  "Version ",
@@ -596,7 +607,7 @@ function y() {
596
607
  ". Reason ",
597
608
  e.changeReason,
598
609
  ".",
599
- /* @__PURE__ */ d("ul", { children: e.evidence.map((e) => /* @__PURE__ */ f("li", {
610
+ /* @__PURE__ */ u("ul", { children: e.evidence.map((e) => /* @__PURE__ */ d("li", {
600
611
  className: "break-all",
601
612
  children: [
602
613
  "Evidence version ",
@@ -607,24 +618,24 @@ function y() {
607
618
  }, e.versionId)) })
608
619
  ]
609
620
  }, e.id))
610
- }), /* @__PURE__ */ d(g, {
621
+ }), /* @__PURE__ */ u(g, {
611
622
  page: G.data?.mtwFreeTimeAgreementPage,
612
623
  offset: _e,
613
- setOffset: w,
624
+ setOffset: T,
614
625
  busy: G.loading || B.busy
615
626
  })]
616
627
  })]
617
- }), /* @__PURE__ */ f("section", {
628
+ }), /* @__PURE__ */ d("section", {
618
629
  className: p,
619
- children: [/* @__PURE__ */ d("h2", {
630
+ children: [/* @__PURE__ */ u("h2", {
620
631
  className: "text-lg font-semibold",
621
632
  children: "Extension decisions"
622
- }), /* @__PURE__ */ f(_, {
633
+ }), /* @__PURE__ */ d(_, {
623
634
  error: q.error,
624
635
  loading: q.loading,
625
- children: [/* @__PURE__ */ d("ul", {
636
+ children: [/* @__PURE__ */ u("ul", {
626
637
  className: "space-y-3",
627
- children: q.data?.mtwFreeTimeExtensionPage.items.map((e) => /* @__PURE__ */ f("li", {
638
+ children: q.data?.mtwFreeTimeExtensionPage.items.map((e) => /* @__PURE__ */ d("li", {
628
639
  className: "break-words rounded-lg border p-3 text-sm",
629
640
  children: [
630
641
  "Requested ",
@@ -639,18 +650,21 @@ function y() {
639
650
  e.decision ? `${e.decision.decision}: ${e.decision.acceptedFreeUntil ?? "Terms unchanged"}; ${e.decision.counterparty}; ${e.decision.sourceReference}; ${e.decision.note}` : "REQUESTED — no terminal decision recorded."
640
651
  ]
641
652
  }, e.id))
642
- }), /* @__PURE__ */ d(g, {
653
+ }), /* @__PURE__ */ u(g, {
643
654
  page: q.data?.mtwFreeTimeExtensionPage,
644
- offset: T,
655
+ offset: E,
645
656
  busy: q.loading || B.busy,
646
657
  setOffset: (e) => {
647
- E(e), R("");
658
+ D(e), R("");
648
659
  }
649
660
  })]
650
661
  })]
651
662
  })]
652
663
  })
653
664
  ]
665
+ }) : /* @__PURE__ */ u("p", {
666
+ role: e.failed ? "alert" : "status",
667
+ children: e.loading ? "Checking shipment permissions…" : e.failed ? "Shipment permissions are unavailable. Reload to retry." : "Shipment read permission is required."
654
668
  });
655
669
  }
656
670
  //#endregion