@burdenoff/microfe-theglobalfuel 2026.704.1 → 2026.705.2

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.
Files changed (133) hide show
  1. package/dist/node_modules/{.bun/clsx@2.1.1/node_modules/clsx → clsx}/dist/clsx.js +1 -1
  2. package/dist/node_modules/clsx/dist/clsx.js.map +1 -0
  3. package/dist/node_modules/{.bun/tailwind-merge@3.5.0/node_modules/tailwind-merge → tailwind-merge}/dist/bundle-mjs.js +212 -170
  4. package/dist/node_modules/tailwind-merge/dist/bundle-mjs.js.map +1 -0
  5. package/dist/theglobalfuel/components/DataTable.js +37 -27
  6. package/dist/theglobalfuel/components/DataTable.js.map +1 -1
  7. package/dist/theglobalfuel/hooks/index.js +1 -0
  8. package/dist/theglobalfuel/hooks/useNotify.js +19 -0
  9. package/dist/theglobalfuel/hooks/useNotify.js.map +1 -0
  10. package/dist/theglobalfuel/hooks/useTheFiles.js +4 -1
  11. package/dist/theglobalfuel/hooks/useTheFiles.js.map +1 -1
  12. package/dist/theglobalfuel/hooks/useTheGlobalFuelApi.js +59 -31
  13. package/dist/theglobalfuel/hooks/useTheGlobalFuelApi.js.map +1 -1
  14. package/dist/theglobalfuel/pages/assets/AssetDetailPage.js +367 -321
  15. package/dist/theglobalfuel/pages/assets/AssetDetailPage.js.map +1 -1
  16. package/dist/theglobalfuel/pages/assets/AssetsPage.js +66 -54
  17. package/dist/theglobalfuel/pages/assets/AssetsPage.js.map +1 -1
  18. package/dist/theglobalfuel/pages/compliance/CompliancePage.js +346 -182
  19. package/dist/theglobalfuel/pages/compliance/CompliancePage.js.map +1 -1
  20. package/dist/theglobalfuel/pages/contracts/ContractDetailPage.js +418 -390
  21. package/dist/theglobalfuel/pages/contracts/ContractDetailPage.js.map +1 -1
  22. package/dist/theglobalfuel/pages/contracts/ContractsPage.js +238 -230
  23. package/dist/theglobalfuel/pages/contracts/ContractsPage.js.map +1 -1
  24. package/dist/theglobalfuel/pages/dashboard/DashboardPage.js +5 -3
  25. package/dist/theglobalfuel/pages/dashboard/DashboardPage.js.map +1 -1
  26. package/dist/theglobalfuel/pages/emissions/EmissionsPage.js +201 -177
  27. package/dist/theglobalfuel/pages/emissions/EmissionsPage.js.map +1 -1
  28. package/dist/theglobalfuel/pages/inventory/InventoryPage.js +271 -238
  29. package/dist/theglobalfuel/pages/inventory/InventoryPage.js.map +1 -1
  30. package/dist/theglobalfuel/pages/production/ProductionPage.js +185 -177
  31. package/dist/theglobalfuel/pages/production/ProductionPage.js.map +1 -1
  32. package/dist/theglobalfuel/pages/reserves/ReservesPage.js +160 -138
  33. package/dist/theglobalfuel/pages/reserves/ReservesPage.js.map +1 -1
  34. package/dist/theglobalfuel/pages/shipments/ShipmentsPage.js +250 -198
  35. package/dist/theglobalfuel/pages/shipments/ShipmentsPage.js.map +1 -1
  36. package/dist/theglobalfuel/utils/cn.js +2 -2
  37. package/dist/theglobalfuel/utils/formatters.js +6 -1
  38. package/dist/theglobalfuel/utils/formatters.js.map +1 -1
  39. package/dist/theglobalfuel/utils/transitions.js +70 -0
  40. package/dist/theglobalfuel/utils/transitions.js.map +1 -0
  41. package/package.json +1 -1
  42. package/dist/dev/main.d.ts +0 -2
  43. package/dist/dev/main.d.ts.map +0 -1
  44. package/dist/index.d.ts +0 -2
  45. package/dist/index.d.ts.map +0 -1
  46. package/dist/node_modules/.bun/clsx@2.1.1/node_modules/clsx/dist/clsx.js.map +0 -1
  47. package/dist/node_modules/.bun/tailwind-merge@3.5.0/node_modules/tailwind-merge/dist/bundle-mjs.js.map +0 -1
  48. package/dist/theglobalfuel/TheGlobalFuelRoot.d.ts +0 -5
  49. package/dist/theglobalfuel/TheGlobalFuelRoot.d.ts.map +0 -1
  50. package/dist/theglobalfuel/TheGlobalFuelRoutes.d.ts +0 -4
  51. package/dist/theglobalfuel/TheGlobalFuelRoutes.d.ts.map +0 -1
  52. package/dist/theglobalfuel/components/DataTable.d.ts +0 -28
  53. package/dist/theglobalfuel/components/DataTable.d.ts.map +0 -1
  54. package/dist/theglobalfuel/components/EmptyState.d.ts +0 -18
  55. package/dist/theglobalfuel/components/EmptyState.d.ts.map +0 -1
  56. package/dist/theglobalfuel/components/EvidenceUpload.d.ts +0 -14
  57. package/dist/theglobalfuel/components/EvidenceUpload.d.ts.map +0 -1
  58. package/dist/theglobalfuel/components/FileLink.d.ts +0 -15
  59. package/dist/theglobalfuel/components/FileLink.d.ts.map +0 -1
  60. package/dist/theglobalfuel/components/FilterTabs.d.ts +0 -18
  61. package/dist/theglobalfuel/components/FilterTabs.d.ts.map +0 -1
  62. package/dist/theglobalfuel/components/MetricsCard.d.ts +0 -23
  63. package/dist/theglobalfuel/components/MetricsCard.d.ts.map +0 -1
  64. package/dist/theglobalfuel/components/MiniBar.d.ts +0 -16
  65. package/dist/theglobalfuel/components/MiniBar.d.ts.map +0 -1
  66. package/dist/theglobalfuel/components/PageLayout.d.ts +0 -16
  67. package/dist/theglobalfuel/components/PageLayout.d.ts.map +0 -1
  68. package/dist/theglobalfuel/components/Pagination.d.ts +0 -22
  69. package/dist/theglobalfuel/components/Pagination.d.ts.map +0 -1
  70. package/dist/theglobalfuel/components/StateViews.d.ts +0 -24
  71. package/dist/theglobalfuel/components/StateViews.d.ts.map +0 -1
  72. package/dist/theglobalfuel/components/StatusBadge.d.ts +0 -9
  73. package/dist/theglobalfuel/components/StatusBadge.d.ts.map +0 -1
  74. package/dist/theglobalfuel/components/Tabs.d.ts +0 -17
  75. package/dist/theglobalfuel/components/Tabs.d.ts.map +0 -1
  76. package/dist/theglobalfuel/components/TheDiscussion.d.ts +0 -18
  77. package/dist/theglobalfuel/components/TheDiscussion.d.ts.map +0 -1
  78. package/dist/theglobalfuel/components/TheTags.d.ts +0 -17
  79. package/dist/theglobalfuel/components/TheTags.d.ts.map +0 -1
  80. package/dist/theglobalfuel/components/index.d.ts +0 -19
  81. package/dist/theglobalfuel/components/index.d.ts.map +0 -1
  82. package/dist/theglobalfuel/context/TheGlobalFuelContext.d.ts +0 -16
  83. package/dist/theglobalfuel/context/TheGlobalFuelContext.d.ts.map +0 -1
  84. package/dist/theglobalfuel/context/index.d.ts +0 -6
  85. package/dist/theglobalfuel/context/index.d.ts.map +0 -1
  86. package/dist/theglobalfuel/hooks/index.d.ts +0 -10
  87. package/dist/theglobalfuel/hooks/index.d.ts.map +0 -1
  88. package/dist/theglobalfuel/hooks/useCursorPager.d.ts +0 -33
  89. package/dist/theglobalfuel/hooks/useCursorPager.d.ts.map +0 -1
  90. package/dist/theglobalfuel/hooks/useTheComments.d.ts +0 -36
  91. package/dist/theglobalfuel/hooks/useTheComments.d.ts.map +0 -1
  92. package/dist/theglobalfuel/hooks/useTheFiles.d.ts +0 -47
  93. package/dist/theglobalfuel/hooks/useTheFiles.d.ts.map +0 -1
  94. package/dist/theglobalfuel/hooks/useTheGlobalFuelApi.d.ts +0 -75
  95. package/dist/theglobalfuel/hooks/useTheGlobalFuelApi.d.ts.map +0 -1
  96. package/dist/theglobalfuel/hooks/useTheTags.d.ts +0 -44
  97. package/dist/theglobalfuel/hooks/useTheTags.d.ts.map +0 -1
  98. package/dist/theglobalfuel/index.d.ts +0 -9
  99. package/dist/theglobalfuel/index.d.ts.map +0 -1
  100. package/dist/theglobalfuel/pages/assets/AssetDetailPage.d.ts +0 -13
  101. package/dist/theglobalfuel/pages/assets/AssetDetailPage.d.ts.map +0 -1
  102. package/dist/theglobalfuel/pages/assets/AssetsPage.d.ts +0 -10
  103. package/dist/theglobalfuel/pages/assets/AssetsPage.d.ts.map +0 -1
  104. package/dist/theglobalfuel/pages/compliance/CompliancePage.d.ts +0 -11
  105. package/dist/theglobalfuel/pages/compliance/CompliancePage.d.ts.map +0 -1
  106. package/dist/theglobalfuel/pages/contracts/ContractDetailPage.d.ts +0 -9
  107. package/dist/theglobalfuel/pages/contracts/ContractDetailPage.d.ts.map +0 -1
  108. package/dist/theglobalfuel/pages/contracts/ContractsPage.d.ts +0 -8
  109. package/dist/theglobalfuel/pages/contracts/ContractsPage.d.ts.map +0 -1
  110. package/dist/theglobalfuel/pages/dashboard/DashboardPage.d.ts +0 -13
  111. package/dist/theglobalfuel/pages/dashboard/DashboardPage.d.ts.map +0 -1
  112. package/dist/theglobalfuel/pages/emissions/EmissionsPage.d.ts +0 -12
  113. package/dist/theglobalfuel/pages/emissions/EmissionsPage.d.ts.map +0 -1
  114. package/dist/theglobalfuel/pages/inventory/InventoryPage.d.ts +0 -11
  115. package/dist/theglobalfuel/pages/inventory/InventoryPage.d.ts.map +0 -1
  116. package/dist/theglobalfuel/pages/production/ProductionPage.d.ts +0 -11
  117. package/dist/theglobalfuel/pages/production/ProductionPage.d.ts.map +0 -1
  118. package/dist/theglobalfuel/pages/reserves/ReservesPage.d.ts +0 -10
  119. package/dist/theglobalfuel/pages/reserves/ReservesPage.d.ts.map +0 -1
  120. package/dist/theglobalfuel/pages/shipments/ShipmentsPage.d.ts +0 -10
  121. package/dist/theglobalfuel/pages/shipments/ShipmentsPage.d.ts.map +0 -1
  122. package/dist/theglobalfuel/types/index.d.ts +0 -376
  123. package/dist/theglobalfuel/types/index.d.ts.map +0 -1
  124. package/dist/theglobalfuel/utils/cn.d.ts +0 -4
  125. package/dist/theglobalfuel/utils/cn.d.ts.map +0 -1
  126. package/dist/theglobalfuel/utils/formatters.d.ts +0 -36
  127. package/dist/theglobalfuel/utils/formatters.d.ts.map +0 -1
  128. package/dist/theglobalfuel/utils/i18n.d.ts +0 -6
  129. package/dist/theglobalfuel/utils/i18n.d.ts.map +0 -1
  130. package/dist/theglobalfuel/utils/index.d.ts +0 -9
  131. package/dist/theglobalfuel/utils/index.d.ts.map +0 -1
  132. package/dist/theglobalfuel/utils/navigation.d.ts +0 -14
  133. package/dist/theglobalfuel/utils/navigation.d.ts.map +0 -1
@@ -1,21 +1,25 @@
1
1
  import { PageLayout as e } from "../../components/PageLayout.js";
2
2
  import { MetricsCard as t } from "../../components/MetricsCard.js";
3
- import { formatDate as n, formatEnumLabel as r, formatVolume as ee } from "../../utils/formatters.js";
3
+ import { formatDate as n, formatEnumLabel as r, formatVolume as i, toBackendDate as ee } from "../../utils/formatters.js";
4
4
  import { StatusBadge as te } from "../../components/StatusBadge.js";
5
5
  import { DataTable as ne } from "../../components/DataTable.js";
6
- import { ErrorView as i, LoadingView as a } from "../../components/StateViews.js";
7
- import { EmptyState as o } from "../../components/EmptyState.js";
8
- import { useTheContracts as s, useTheDeliverShipment as c, useTheScheduleShipment as l, useTheShipments as u } from "../../hooks/useTheGlobalFuelApi.js";
6
+ import { ErrorView as re, LoadingView as ie } from "../../components/StateViews.js";
7
+ import { EmptyState as ae } from "../../components/EmptyState.js";
8
+ import { useTheContracts as oe, useTheDeliverShipment as se, useTheScheduleShipment as ce, useTheShipments as a, useTheTransitionShipment as le } from "../../hooks/useTheGlobalFuelApi.js";
9
+ import { useCursorPager as o } from "../../hooks/useCursorPager.js";
10
+ import { useNotify as ue } from "../../hooks/useNotify.js";
9
11
  import "../../hooks/index.js";
10
- import { FilterTabs as re } from "../../components/FilterTabs.js";
11
- import { EvidenceUpload as ie } from "../../components/EvidenceUpload.js";
12
- import { FileLink as ae } from "../../components/FileLink.js";
13
- import { useMemo as d, useState as f } from "react";
14
- import { ArrowRight as oe, CalendarClock as p, PackageCheck as m, Plus as h, Ship as g, Truck as _ } from "lucide-react";
15
- import { jsx as v, jsxs as y } from "react/jsx-runtime";
16
- import { Button as b, Input as x, Label as S, ResponsiveDialog as se, ResponsiveDialogContent as ce, ResponsiveDialogDescription as le, ResponsiveDialogFooter as ue, ResponsiveDialogHeader as de, ResponsiveDialogTitle as fe, Select as C, SelectContent as w, SelectItem as T, SelectTrigger as E, SelectValue as D, Textarea as pe } from "@burdenoff/fe-libs/ui";
12
+ import { SHIPMENT_DELIVERABLE_FROM as de, SHIPMENT_TRANSITIONS as fe, nextStatuses as pe } from "../../utils/transitions.js";
13
+ import { FilterTabs as me } from "../../components/FilterTabs.js";
14
+ import { Pagination as s } from "../../components/Pagination.js";
15
+ import { EvidenceUpload as he } from "../../components/EvidenceUpload.js";
16
+ import { FileLink as ge } from "../../components/FileLink.js";
17
+ import { useMemo as c, useState as l } from "react";
18
+ import { ArrowRight as _e, CalendarClock as ve, PackageCheck as u, Plus as d, Ship as f, Truck as ye } from "lucide-react";
19
+ import { Fragment as p, jsx as m, jsxs as h } from "react/jsx-runtime";
20
+ import { Button as g, Input as _, Label as v, ResponsiveDialog as be, ResponsiveDialogContent as xe, ResponsiveDialogDescription as Se, ResponsiveDialogFooter as Ce, ResponsiveDialogHeader as we, ResponsiveDialogTitle as Te, Select as y, SelectContent as b, SelectItem as x, SelectTrigger as S, SelectValue as C, Textarea as w } from "@burdenoff/fe-libs/ui";
17
21
  //#region src/theglobalfuel/pages/shipments/ShipmentsPage.tsx
18
- var me = [
22
+ var T = [
19
23
  {
20
24
  value: "ALL",
21
25
  label: "All"
@@ -40,14 +44,14 @@ var me = [
40
44
  value: "CANCELLED",
41
45
  label: "Cancelled"
42
46
  }
43
- ], he = [
47
+ ], E = [
44
48
  "PIPELINE",
45
49
  "TANKER",
46
50
  "VESSEL_BULK",
47
51
  "RAIL",
48
52
  "TRUCK",
49
53
  "GRID"
50
- ], O = [
54
+ ], D = [
51
55
  "BARRELS",
52
56
  "CUBIC_METERS",
53
57
  "TONNES",
@@ -55,7 +59,7 @@ var me = [
55
59
  "MWH",
56
60
  "GJ",
57
61
  "MCF"
58
- ], k = {
62
+ ], O = 25, k = {
59
63
  contractId: "",
60
64
  reference: "",
61
65
  mode: "TANKER",
@@ -68,62 +72,65 @@ var me = [
68
72
  notes: ""
69
73
  };
70
74
  function A() {
71
- let [A, j] = f("ALL"), [M, N] = f("ALL"), [P, F] = f(!1), [I, L] = f(k), [R, z] = f(null), [B, V] = f(null), H = M === "ALL" ? void 0 : M, { data: U, isLoading: ge, isError: _e, refetch: ve } = u(H, A === "ALL" ? void 0 : A), W = u(H, void 0), G = s({ pagination: { limit: 100 } }), K = d(() => G.data?.items ?? [], [G.data]), q = d(() => {
75
+ let [A, Ee] = l("ALL"), [j, De] = l("ALL"), M = o(), [Oe, N] = l(!1), [P, F] = l(k), [I, L] = l(null), [R, z] = l(null), [ke, B] = l(null), V = ue(), H = j === "ALL" ? void 0 : j, { data: U, isLoading: Ae, isError: je, refetch: Me } = a(H, A === "ALL" ? void 0 : A, {
76
+ limit: O,
77
+ cursor: M.cursor
78
+ }), W = a(H, void 0, { limit: 200 }), G = oe({ pagination: { limit: 100 } }), K = c(() => G.data?.items ?? [], [G.data]), q = c(() => {
72
79
  let e = /* @__PURE__ */ new Map();
73
80
  for (let t of K) e.set(t.id, t);
74
81
  return e;
75
- }, [K]), J = l(), Y = c(), X = d(() => U ?? [], [U]), Z = d(() => W.data ?? [], [W.data]), ye = Z.filter((e) => e.status === "SCHEDULED").length, be = Z.filter((e) => e.status === "IN_TRANSIT").length, xe = Z.filter((e) => e.status === "DELIVERED").length, Se = d(() => {
82
+ }, [K]), J = ce(), Y = se(), Ne = le(), X = c(() => U?.items ?? [], [U]), Z = c(() => W.data?.items ?? [], [W.data]), Pe = Z.filter((e) => e.status === "SCHEDULED").length, Fe = Z.filter((e) => e.status === "IN_TRANSIT").length, Ie = Z.filter((e) => e.status === "DELIVERED").length, Le = c(() => {
76
83
  let e = {};
77
84
  for (let t of Z) e[t.status] = (e[t.status] ?? 0) + 1;
78
85
  return e;
79
- }, [Z]), Ce = me.map((e) => ({
86
+ }, [Z]), Re = T.map((e) => ({
80
87
  value: e.value,
81
88
  label: e.label,
82
- count: e.value === "ALL" ? Z.length : Se[e.value] ?? 0
89
+ count: e.value === "ALL" ? Z.length : Le[e.value] ?? 0
83
90
  })), Q = () => {
84
- L(k), z(null), V(null);
85
- }, we = async () => {
86
- if (!I.contractId) {
87
- V("Select the contract this shipment fulfils.");
91
+ F(k), L(null), z(null);
92
+ }, ze = async () => {
93
+ if (!P.contractId) {
94
+ z("Select the contract this shipment fulfils.");
88
95
  return;
89
96
  }
90
- if (!I.reference.trim()) {
91
- V("A shipment reference is required.");
97
+ if (!P.reference.trim()) {
98
+ z("A shipment reference is required.");
92
99
  return;
93
100
  }
94
- let e = Number(I.volume);
95
- if (!I.volume || Number.isNaN(e) || e <= 0) {
96
- V("Enter a volume greater than zero.");
101
+ let e = Number(P.volume);
102
+ if (!P.volume || Number.isNaN(e) || e <= 0) {
103
+ z("Enter a volume greater than zero."), V.error("Enter a volume greater than zero.");
97
104
  return;
98
105
  }
99
- V(null);
106
+ z(null);
100
107
  try {
101
108
  await J.mutateAsync({
102
- contractId: I.contractId,
103
- reference: I.reference.trim(),
104
- mode: I.mode,
105
- carrier: I.carrier.trim() || null,
106
- origin: I.origin.trim() || null,
107
- destination: I.destination.trim() || null,
109
+ contractId: P.contractId,
110
+ reference: P.reference.trim(),
111
+ mode: P.mode,
112
+ carrier: P.carrier.trim() || null,
113
+ origin: P.origin.trim() || null,
114
+ destination: P.destination.trim() || null,
108
115
  volume: e,
109
- unit: I.unit,
110
- scheduledAt: I.scheduledAt ? new Date(I.scheduledAt).toISOString() : null,
111
- documentFileId: R?.fileId ?? null,
112
- notes: I.notes.trim() || null
113
- }), F(!1), Q();
116
+ unit: P.unit,
117
+ scheduledAt: ee(P.scheduledAt) ?? null,
118
+ documentFileId: I?.fileId ?? null,
119
+ notes: P.notes.trim() || null
120
+ }), V.success("Shipment scheduled"), N(!1), Q();
114
121
  } catch (e) {
115
- V(e instanceof Error ? e.message : "Failed to schedule shipment.");
122
+ z(e instanceof Error ? e.message : "Failed to schedule shipment."), V.fromError(e);
116
123
  }
117
- }, Te = [
124
+ }, Be = [
118
125
  {
119
126
  key: "reference",
120
127
  header: "Shipment",
121
- render: (e) => /* @__PURE__ */ y("div", {
128
+ render: (e) => /* @__PURE__ */ h("div", {
122
129
  className: "min-w-0",
123
- children: [/* @__PURE__ */ v("p", {
130
+ children: [/* @__PURE__ */ m("p", {
124
131
  className: "truncate font-semibold text-text-primary",
125
132
  children: e.reference
126
- }), /* @__PURE__ */ v("p", {
133
+ }), /* @__PURE__ */ m("p", {
127
134
  className: "truncate text-xs text-text-tertiary md:hidden",
128
135
  children: r(e.mode)
129
136
  })]
@@ -135,16 +142,16 @@ function A() {
135
142
  hideOnMobile: !0,
136
143
  render: (e) => {
137
144
  let t = q.get(e.contractId);
138
- return t ? /* @__PURE__ */ y("div", {
145
+ return t ? /* @__PURE__ */ h("div", {
139
146
  className: "min-w-0",
140
- children: [/* @__PURE__ */ v("p", {
147
+ children: [/* @__PURE__ */ m("p", {
141
148
  className: "truncate font-medium text-text-primary",
142
149
  children: t.reference
143
- }), /* @__PURE__ */ v("p", {
150
+ }), /* @__PURE__ */ m("p", {
144
151
  className: "truncate text-xs text-text-tertiary",
145
152
  children: t.counterparty
146
153
  })]
147
- }) : /* @__PURE__ */ v("span", {
154
+ }) : /* @__PURE__ */ m("span", {
148
155
  className: "font-mono text-xs text-text-tertiary",
149
156
  children: e.contractId.slice(0, 8)
150
157
  });
@@ -154,7 +161,7 @@ function A() {
154
161
  key: "mode",
155
162
  header: "Mode",
156
163
  hideOnMobile: !0,
157
- render: (e) => /* @__PURE__ */ v("span", {
164
+ render: (e) => /* @__PURE__ */ m("span", {
158
165
  className: "text-text-secondary",
159
166
  children: r(e.mode)
160
167
  })
@@ -162,7 +169,7 @@ function A() {
162
169
  {
163
170
  key: "status",
164
171
  header: "Status",
165
- render: (e) => /* @__PURE__ */ v(te, { status: e.status })
172
+ render: (e) => /* @__PURE__ */ m(te, { status: e.status })
166
173
  },
167
174
  {
168
175
  key: "route",
@@ -170,18 +177,18 @@ function A() {
170
177
  hideOnMobile: !0,
171
178
  render: (e) => {
172
179
  let t = e.origin?.trim(), n = e.destination?.trim();
173
- return !t && !n ? /* @__PURE__ */ v("span", {
180
+ return !t && !n ? /* @__PURE__ */ m("span", {
174
181
  className: "text-text-tertiary",
175
182
  children: "—"
176
- }) : /* @__PURE__ */ y("span", {
183
+ }) : /* @__PURE__ */ h("span", {
177
184
  className: "inline-flex items-center gap-1.5 text-text-secondary",
178
185
  children: [
179
- /* @__PURE__ */ v("span", {
186
+ /* @__PURE__ */ m("span", {
180
187
  className: "truncate",
181
188
  children: t ?? "—"
182
189
  }),
183
- /* @__PURE__ */ v(oe, { className: "h-3.5 w-3.5 shrink-0 text-text-tertiary" }),
184
- /* @__PURE__ */ v("span", {
190
+ /* @__PURE__ */ m(_e, { className: "h-3.5 w-3.5 shrink-0 text-text-tertiary" }),
191
+ /* @__PURE__ */ m("span", {
185
192
  className: "truncate",
186
193
  children: n ?? "—"
187
194
  })
@@ -194,9 +201,9 @@ function A() {
194
201
  header: "Volume",
195
202
  align: "right",
196
203
  sortValue: (e) => e.volume,
197
- render: (e) => /* @__PURE__ */ v("span", {
204
+ render: (e) => /* @__PURE__ */ m("span", {
198
205
  className: "tabular-nums text-text-primary",
199
- children: ee(e.volume, e.unit)
206
+ children: i(e.volume, e.unit)
200
207
  })
201
208
  },
202
209
  {
@@ -205,7 +212,7 @@ function A() {
205
212
  align: "right",
206
213
  hideOnMobile: !0,
207
214
  sortValue: (e) => e.scheduledAt ?? "",
208
- render: (e) => /* @__PURE__ */ v("span", {
215
+ render: (e) => /* @__PURE__ */ m("span", {
209
216
  className: "text-text-tertiary",
210
217
  children: n(e.scheduledAt)
211
218
  })
@@ -214,7 +221,7 @@ function A() {
214
221
  key: "document",
215
222
  header: "Document",
216
223
  hideOnMobile: !0,
217
- render: (e) => e.document?.id ? /* @__PURE__ */ v(ae, { fileId: e.document.id }) : /* @__PURE__ */ v("span", {
224
+ render: (e) => e.document?.id ? /* @__PURE__ */ m(ge, { fileId: e.document.id }) : /* @__PURE__ */ m("span", {
218
225
  className: "text-text-tertiary",
219
226
  children: "—"
220
227
  })
@@ -223,70 +230,105 @@ function A() {
223
230
  key: "action",
224
231
  header: "",
225
232
  align: "right",
226
- render: (e) => e.status === "DELIVERED" || e.status === "CANCELLED" ? /* @__PURE__ */ v("span", {
227
- className: "text-text-tertiary",
228
- children: "—"
229
- }) : /* @__PURE__ */ y(b, {
230
- size: "sm",
231
- variant: "outline",
232
- disabled: Y.isPending,
233
- onClick: () => Y.mutate(e.id),
234
- children: [/* @__PURE__ */ v(m, { className: "mr-1.5 h-4 w-4" }), " Mark delivered"]
235
- })
233
+ render: (e) => {
234
+ let t = pe(fe, e.status), n = de.includes(e.status), i = ke === e.id;
235
+ return t.length === 0 && !n ? /* @__PURE__ */ m("span", {
236
+ className: "text-text-tertiary",
237
+ children: "—"
238
+ }) : /* @__PURE__ */ h("div", {
239
+ className: "flex items-center justify-end gap-2",
240
+ children: [t.length > 0 && /* @__PURE__ */ h(y, {
241
+ value: e.status,
242
+ disabled: i,
243
+ onValueChange: (t) => {
244
+ t !== e.status && (B(e.id), Ne.mutate({
245
+ id: e.id,
246
+ status: t
247
+ }, {
248
+ onSuccess: () => V.success("Shipment updated"),
249
+ onError: (e) => V.fromError(e),
250
+ onSettled: () => B(null)
251
+ }));
252
+ },
253
+ children: [/* @__PURE__ */ m(S, {
254
+ className: "h-8 w-36",
255
+ "aria-label": `Change status for shipment ${e.reference}`,
256
+ children: /* @__PURE__ */ m(C, { placeholder: r(e.status) })
257
+ }), /* @__PURE__ */ m(b, { children: t.map((e) => /* @__PURE__ */ m(x, {
258
+ value: e,
259
+ children: r(e)
260
+ }, e)) })]
261
+ }), n && /* @__PURE__ */ h(g, {
262
+ size: "sm",
263
+ variant: "outline",
264
+ disabled: Y.isPending || i,
265
+ onClick: () => Y.mutate(e.id, {
266
+ onSuccess: () => V.success("Shipment delivered"),
267
+ onError: (e) => V.fromError(e)
268
+ }),
269
+ children: [/* @__PURE__ */ m(u, { className: "mr-1.5 h-4 w-4" }), " Mark delivered"]
270
+ })]
271
+ });
272
+ }
236
273
  }
237
- ], $ = A !== "ALL" || M !== "ALL";
238
- return /* @__PURE__ */ y(e, {
274
+ ], $ = A !== "ALL" || j !== "ALL";
275
+ return /* @__PURE__ */ h(e, {
239
276
  title: "Shipments",
240
277
  description: "Cargo movements delivering offtake contracts — pipelines, tankers, vessels, rail & grid.",
241
- actions: /* @__PURE__ */ y(b, {
242
- onClick: () => F(!0),
243
- children: [/* @__PURE__ */ v(h, { className: "mr-1.5 h-4 w-4" }), " Schedule shipment"]
278
+ actions: /* @__PURE__ */ h(g, {
279
+ onClick: () => N(!0),
280
+ children: [/* @__PURE__ */ m(d, { className: "mr-1.5 h-4 w-4" }), " Schedule shipment"]
244
281
  }),
245
282
  children: [
246
- /* @__PURE__ */ y("div", {
283
+ /* @__PURE__ */ h("div", {
247
284
  className: "mb-6 grid grid-cols-2 gap-4 lg:grid-cols-4",
248
285
  children: [
249
- /* @__PURE__ */ v(t, {
286
+ /* @__PURE__ */ m(t, {
250
287
  featured: !0,
251
- icon: /* @__PURE__ */ v(g, { className: "h-5 w-5" }),
288
+ icon: /* @__PURE__ */ m(f, { className: "h-5 w-5" }),
252
289
  value: Z.length,
253
290
  label: "Total shipments"
254
291
  }),
255
- /* @__PURE__ */ v(t, {
256
- icon: /* @__PURE__ */ v(p, { className: "h-5 w-5" }),
257
- value: ye,
292
+ /* @__PURE__ */ m(t, {
293
+ icon: /* @__PURE__ */ m(ve, { className: "h-5 w-5" }),
294
+ value: Pe,
258
295
  label: "Scheduled"
259
296
  }),
260
- /* @__PURE__ */ v(t, {
297
+ /* @__PURE__ */ m(t, {
261
298
  accent: "warning",
262
- icon: /* @__PURE__ */ v(_, { className: "h-5 w-5" }),
263
- value: be,
299
+ icon: /* @__PURE__ */ m(ye, { className: "h-5 w-5" }),
300
+ value: Fe,
264
301
  label: "In transit"
265
302
  }),
266
- /* @__PURE__ */ v(t, {
303
+ /* @__PURE__ */ m(t, {
267
304
  accent: "success",
268
- icon: /* @__PURE__ */ v(m, { className: "h-5 w-5" }),
269
- value: xe,
305
+ icon: /* @__PURE__ */ m(u, { className: "h-5 w-5" }),
306
+ value: Ie,
270
307
  label: "Delivered"
271
308
  })
272
309
  ]
273
310
  }),
274
- /* @__PURE__ */ y("div", {
311
+ /* @__PURE__ */ h("div", {
275
312
  className: "mb-5 flex flex-wrap items-center gap-3",
276
- children: [/* @__PURE__ */ v(re, {
277
- options: Ce,
313
+ children: [/* @__PURE__ */ m(me, {
314
+ options: Re,
278
315
  value: A,
279
- onChange: j
280
- }), /* @__PURE__ */ y(C, {
281
- value: M,
282
- onValueChange: (e) => N(e),
283
- children: [/* @__PURE__ */ v(E, {
316
+ onChange: (e) => {
317
+ Ee(e), M.reset();
318
+ }
319
+ }), /* @__PURE__ */ h(y, {
320
+ value: j,
321
+ onValueChange: (e) => {
322
+ De(e), M.reset();
323
+ },
324
+ children: [/* @__PURE__ */ m(S, {
284
325
  className: "w-56",
285
- children: /* @__PURE__ */ v(D, { placeholder: "All contracts" })
286
- }), /* @__PURE__ */ y(w, { children: [/* @__PURE__ */ v(T, {
326
+ "aria-label": "Filter by contract",
327
+ children: /* @__PURE__ */ m(C, { placeholder: "All contracts" })
328
+ }), /* @__PURE__ */ h(b, { children: [/* @__PURE__ */ m(x, {
287
329
  value: "ALL",
288
330
  children: "All contracts"
289
- }), K.map((e) => /* @__PURE__ */ y(T, {
331
+ }), K.map((e) => /* @__PURE__ */ h(x, {
290
332
  value: e.id,
291
333
  children: [
292
334
  e.reference,
@@ -296,60 +338,68 @@ function A() {
296
338
  }, e.id))] })]
297
339
  })]
298
340
  }),
299
- ge ? /* @__PURE__ */ v(a, { label: "Loading shipments…" }) : _e ? /* @__PURE__ */ v(i, {
341
+ Ae ? /* @__PURE__ */ m(ie, { label: "Loading shipments…" }) : je ? /* @__PURE__ */ m(re, {
300
342
  message: "Couldn't load shipments.",
301
- onRetry: () => ve()
302
- }) : X.length === 0 ? /* @__PURE__ */ v(o, {
343
+ onRetry: () => Me()
344
+ }) : X.length === 0 ? /* @__PURE__ */ m(ae, {
303
345
  illustration: "empty-data",
304
- icon: /* @__PURE__ */ v(g, { className: "h-10 w-10" }),
346
+ icon: /* @__PURE__ */ m(f, { className: "h-10 w-10" }),
305
347
  title: $ ? "No matching shipments" : "No shipments yet",
306
348
  description: $ ? "No shipments match these filters. Try a different status or contract." : "Schedule your first shipment to start tracking cargo against your offtake contracts.",
307
- action: /* @__PURE__ */ y(b, {
308
- onClick: () => F(!0),
309
- children: [/* @__PURE__ */ v(h, { className: "mr-1.5 h-4 w-4" }), " Schedule shipment"]
349
+ action: /* @__PURE__ */ h(g, {
350
+ onClick: () => N(!0),
351
+ children: [/* @__PURE__ */ m(d, { className: "mr-1.5 h-4 w-4" }), " Schedule shipment"]
310
352
  })
311
- }) : /* @__PURE__ */ v(ne, {
312
- columns: Te,
353
+ }) : /* @__PURE__ */ h(p, { children: [/* @__PURE__ */ m(ne, {
354
+ columns: Be,
313
355
  rows: X,
314
356
  rowKey: (e) => e.id,
315
357
  defaultSort: {
316
358
  key: "scheduledAt",
317
359
  dir: "desc"
318
360
  }
319
- }),
320
- /* @__PURE__ */ v(se, {
321
- open: P,
361
+ }), /* @__PURE__ */ m(s, {
362
+ page: M.page,
363
+ pageSize: O,
364
+ itemCount: X.length,
365
+ hasMore: U?.pageInfo?.hasMore ?? !1,
366
+ onPageChange: (e) => M.onPageChange(e, U?.pageInfo?.cursor)
367
+ })] }),
368
+ /* @__PURE__ */ m(be, {
369
+ open: Oe,
322
370
  onOpenChange: (e) => {
323
- F(e), e || Q();
371
+ N(e), e || Q();
324
372
  },
325
- children: /* @__PURE__ */ y(ce, { children: [
326
- /* @__PURE__ */ y(de, { children: [/* @__PURE__ */ v(fe, { children: "Schedule shipment" }), /* @__PURE__ */ v(le, { children: "Book a cargo movement against an offtake contract and track it to delivery." })] }),
327
- /* @__PURE__ */ y("div", {
373
+ children: /* @__PURE__ */ h(xe, { children: [/* @__PURE__ */ h(we, { children: [/* @__PURE__ */ m(Te, { children: "Schedule shipment" }), /* @__PURE__ */ m(Se, { children: "Book a cargo movement against an offtake contract and track it to delivery." })] }), /* @__PURE__ */ h("form", {
374
+ onSubmit: (e) => {
375
+ e.preventDefault(), ze();
376
+ },
377
+ children: [/* @__PURE__ */ h("div", {
328
378
  className: "grid gap-4 py-2",
329
379
  children: [
330
- /* @__PURE__ */ y("div", {
380
+ /* @__PURE__ */ h("div", {
331
381
  className: "grid gap-1.5",
332
- children: [/* @__PURE__ */ v(S, {
382
+ children: [/* @__PURE__ */ m(v, {
333
383
  htmlFor: "shipContract",
334
384
  children: "Contract *"
335
- }), /* @__PURE__ */ y(C, {
336
- value: I.contractId,
385
+ }), /* @__PURE__ */ h(y, {
386
+ value: P.contractId,
337
387
  onValueChange: (e) => {
338
388
  let t = q.get(e);
339
- L((n) => ({
389
+ F((n) => ({
340
390
  ...n,
341
391
  contractId: e,
342
392
  unit: t?.unit ?? n.unit
343
393
  }));
344
394
  },
345
- children: [/* @__PURE__ */ v(E, {
395
+ children: [/* @__PURE__ */ m(S, {
346
396
  id: "shipContract",
347
- children: /* @__PURE__ */ v(D, { placeholder: "Select a contract" })
348
- }), /* @__PURE__ */ v(w, { children: K.length === 0 ? /* @__PURE__ */ v(T, {
397
+ children: /* @__PURE__ */ m(C, { placeholder: "Select a contract" })
398
+ }), /* @__PURE__ */ m(b, { children: K.length === 0 ? /* @__PURE__ */ m(x, {
349
399
  value: "none",
350
400
  disabled: !0,
351
401
  children: "No contracts available"
352
- }) : K.map((e) => /* @__PURE__ */ y(T, {
402
+ }) : K.map((e) => /* @__PURE__ */ h(x, {
353
403
  value: e.id,
354
404
  children: [
355
405
  e.reference,
@@ -359,187 +409,189 @@ function A() {
359
409
  }, e.id)) })]
360
410
  })]
361
411
  }),
362
- /* @__PURE__ */ y("div", {
412
+ /* @__PURE__ */ h("div", {
363
413
  className: "grid gap-2 sm:grid-cols-2",
364
- children: [/* @__PURE__ */ y("div", {
414
+ children: [/* @__PURE__ */ h("div", {
365
415
  className: "grid gap-1.5",
366
- children: [/* @__PURE__ */ v(S, {
416
+ children: [/* @__PURE__ */ m(v, {
367
417
  htmlFor: "shipRef",
368
418
  children: "Reference *"
369
- }), /* @__PURE__ */ v(x, {
419
+ }), /* @__PURE__ */ m(_, {
370
420
  id: "shipRef",
371
- value: I.reference,
372
- onChange: (e) => L({
373
- ...I,
421
+ value: P.reference,
422
+ onChange: (e) => F({
423
+ ...P,
374
424
  reference: e.target.value
375
425
  }),
376
426
  placeholder: "SHP-2026-0142"
377
427
  })]
378
- }), /* @__PURE__ */ y("div", {
428
+ }), /* @__PURE__ */ h("div", {
379
429
  className: "grid gap-1.5",
380
- children: [/* @__PURE__ */ v(S, {
430
+ children: [/* @__PURE__ */ m(v, {
381
431
  htmlFor: "shipMode",
382
432
  children: "Mode"
383
- }), /* @__PURE__ */ y(C, {
384
- value: I.mode,
385
- onValueChange: (e) => L({
386
- ...I,
433
+ }), /* @__PURE__ */ h(y, {
434
+ value: P.mode,
435
+ onValueChange: (e) => F({
436
+ ...P,
387
437
  mode: e
388
438
  }),
389
- children: [/* @__PURE__ */ v(E, {
439
+ children: [/* @__PURE__ */ m(S, {
390
440
  id: "shipMode",
391
- children: /* @__PURE__ */ v(D, {})
392
- }), /* @__PURE__ */ v(w, { children: he.map((e) => /* @__PURE__ */ v(T, {
441
+ children: /* @__PURE__ */ m(C, {})
442
+ }), /* @__PURE__ */ m(b, { children: E.map((e) => /* @__PURE__ */ m(x, {
393
443
  value: e,
394
444
  children: r(e)
395
445
  }, e)) })]
396
446
  })]
397
447
  })]
398
448
  }),
399
- /* @__PURE__ */ y("div", {
449
+ /* @__PURE__ */ h("div", {
400
450
  className: "grid gap-2 sm:grid-cols-2",
401
- children: [/* @__PURE__ */ y("div", {
451
+ children: [/* @__PURE__ */ h("div", {
402
452
  className: "grid gap-1.5",
403
- children: [/* @__PURE__ */ v(S, {
453
+ children: [/* @__PURE__ */ m(v, {
404
454
  htmlFor: "shipOrigin",
405
455
  children: "Origin"
406
- }), /* @__PURE__ */ v(x, {
456
+ }), /* @__PURE__ */ m(_, {
407
457
  id: "shipOrigin",
408
- value: I.origin,
409
- onChange: (e) => L({
410
- ...I,
458
+ value: P.origin,
459
+ onChange: (e) => F({
460
+ ...P,
411
461
  origin: e.target.value
412
462
  }),
413
463
  placeholder: "Ras Tanura Terminal"
414
464
  })]
415
- }), /* @__PURE__ */ y("div", {
465
+ }), /* @__PURE__ */ h("div", {
416
466
  className: "grid gap-1.5",
417
- children: [/* @__PURE__ */ v(S, {
467
+ children: [/* @__PURE__ */ m(v, {
418
468
  htmlFor: "shipDest",
419
469
  children: "Destination"
420
- }), /* @__PURE__ */ v(x, {
470
+ }), /* @__PURE__ */ m(_, {
421
471
  id: "shipDest",
422
- value: I.destination,
423
- onChange: (e) => L({
424
- ...I,
472
+ value: P.destination,
473
+ onChange: (e) => F({
474
+ ...P,
425
475
  destination: e.target.value
426
476
  }),
427
477
  placeholder: "Rotterdam"
428
478
  })]
429
479
  })]
430
480
  }),
431
- /* @__PURE__ */ y("div", {
481
+ /* @__PURE__ */ h("div", {
432
482
  className: "grid gap-2 sm:grid-cols-3",
433
483
  children: [
434
- /* @__PURE__ */ y("div", {
484
+ /* @__PURE__ */ h("div", {
435
485
  className: "grid gap-1.5",
436
- children: [/* @__PURE__ */ v(S, {
486
+ children: [/* @__PURE__ */ m(v, {
437
487
  htmlFor: "shipVolume",
438
488
  children: "Volume *"
439
- }), /* @__PURE__ */ v(x, {
489
+ }), /* @__PURE__ */ m(_, {
440
490
  id: "shipVolume",
441
491
  type: "number",
442
492
  min: "0",
443
493
  step: "any",
444
- value: I.volume,
445
- onChange: (e) => L({
446
- ...I,
494
+ value: P.volume,
495
+ onChange: (e) => F({
496
+ ...P,
447
497
  volume: e.target.value
448
498
  }),
449
499
  placeholder: "500000"
450
500
  })]
451
501
  }),
452
- /* @__PURE__ */ y("div", {
502
+ /* @__PURE__ */ h("div", {
453
503
  className: "grid gap-1.5",
454
- children: [/* @__PURE__ */ v(S, {
504
+ children: [/* @__PURE__ */ m(v, {
455
505
  htmlFor: "shipUnit",
456
506
  children: "Unit"
457
- }), /* @__PURE__ */ y(C, {
458
- value: I.unit,
459
- onValueChange: (e) => L({
460
- ...I,
507
+ }), /* @__PURE__ */ h(y, {
508
+ value: P.unit,
509
+ onValueChange: (e) => F({
510
+ ...P,
461
511
  unit: e
462
512
  }),
463
- children: [/* @__PURE__ */ v(E, {
513
+ children: [/* @__PURE__ */ m(S, {
464
514
  id: "shipUnit",
465
- children: /* @__PURE__ */ v(D, {})
466
- }), /* @__PURE__ */ v(w, { children: O.map((e) => /* @__PURE__ */ v(T, {
515
+ children: /* @__PURE__ */ m(C, {})
516
+ }), /* @__PURE__ */ m(b, { children: D.map((e) => /* @__PURE__ */ m(x, {
467
517
  value: e,
468
518
  children: r(e)
469
519
  }, e)) })]
470
520
  })]
471
521
  }),
472
- /* @__PURE__ */ y("div", {
522
+ /* @__PURE__ */ h("div", {
473
523
  className: "grid gap-1.5",
474
- children: [/* @__PURE__ */ v(S, {
524
+ children: [/* @__PURE__ */ m(v, {
475
525
  htmlFor: "shipScheduled",
476
526
  children: "Scheduled date"
477
- }), /* @__PURE__ */ v(x, {
527
+ }), /* @__PURE__ */ m(_, {
478
528
  id: "shipScheduled",
479
529
  type: "date",
480
- value: I.scheduledAt,
481
- onChange: (e) => L({
482
- ...I,
530
+ value: P.scheduledAt,
531
+ onChange: (e) => F({
532
+ ...P,
483
533
  scheduledAt: e.target.value
484
534
  })
485
535
  })]
486
536
  })
487
537
  ]
488
538
  }),
489
- /* @__PURE__ */ y("div", {
539
+ /* @__PURE__ */ h("div", {
490
540
  className: "grid gap-1.5",
491
- children: [/* @__PURE__ */ v(S, {
541
+ children: [/* @__PURE__ */ m(v, {
492
542
  htmlFor: "shipCarrier",
493
543
  children: "Carrier"
494
- }), /* @__PURE__ */ v(x, {
544
+ }), /* @__PURE__ */ m(_, {
495
545
  id: "shipCarrier",
496
- value: I.carrier,
497
- onChange: (e) => L({
498
- ...I,
546
+ value: P.carrier,
547
+ onChange: (e) => F({
548
+ ...P,
499
549
  carrier: e.target.value
500
550
  }),
501
551
  placeholder: "Frontline Ltd."
502
552
  })]
503
553
  }),
504
- /* @__PURE__ */ v(ie, {
554
+ /* @__PURE__ */ m(he, {
505
555
  id: "shipDocument",
506
556
  label: "Bill of lading (optional)",
507
- value: R,
508
- onChange: z,
557
+ value: I,
558
+ onChange: L,
509
559
  hint: "Attach the bill of lading or shipping document (PDF or image)."
510
560
  }),
511
- /* @__PURE__ */ y("div", {
561
+ /* @__PURE__ */ h("div", {
512
562
  className: "grid gap-1.5",
513
- children: [/* @__PURE__ */ v(S, {
563
+ children: [/* @__PURE__ */ m(v, {
514
564
  htmlFor: "shipNotes",
515
565
  children: "Notes"
516
- }), /* @__PURE__ */ v(pe, {
566
+ }), /* @__PURE__ */ m(w, {
517
567
  id: "shipNotes",
518
- value: I.notes,
519
- onChange: (e) => L({
520
- ...I,
568
+ value: P.notes,
569
+ onChange: (e) => F({
570
+ ...P,
521
571
  notes: e.target.value
522
572
  }),
523
573
  placeholder: "Optional context — laycan window, inspector, terms.",
524
574
  rows: 2
525
575
  })]
526
576
  }),
527
- B && /* @__PURE__ */ v("p", {
577
+ R && /* @__PURE__ */ m("p", {
528
578
  className: "text-sm text-status-error-text",
529
- children: B
579
+ children: R
530
580
  })
531
581
  ]
532
- }),
533
- /* @__PURE__ */ y(ue, { children: [/* @__PURE__ */ v(b, {
582
+ }), /* @__PURE__ */ h(Ce, { children: [/* @__PURE__ */ m(g, {
583
+ type: "button",
534
584
  variant: "outline",
535
- onClick: () => F(!1),
585
+ onClick: () => {
586
+ N(!1), Q();
587
+ },
536
588
  children: "Cancel"
537
- }), /* @__PURE__ */ v(b, {
538
- onClick: we,
589
+ }), /* @__PURE__ */ m(g, {
590
+ type: "submit",
539
591
  disabled: J.isPending,
540
592
  children: J.isPending ? "Scheduling…" : "Schedule shipment"
541
- })] })
542
- ] })
593
+ })] })]
594
+ })] })
543
595
  })
544
596
  ]
545
597
  });