@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,39 +1,34 @@
1
1
  import { useTheGlobalFuel as e } from "../../context/TheGlobalFuelContext.js";
2
2
  import { PageLayout as t } from "../../components/PageLayout.js";
3
3
  import { MetricsCard as n } from "../../components/MetricsCard.js";
4
- import { formatDate as r, formatEnumLabel as i, formatMoney as ee, formatUnit as a, formatVolume as o } from "../../utils/formatters.js";
5
- import { StatusBadge as s } from "../../components/StatusBadge.js";
4
+ import { formatDate as r, formatEnumLabel as i, formatMoney as ee, formatUnit as a, formatVolume as o, toBackendDate as s } from "../../utils/formatters.js";
5
+ import { StatusBadge as c } from "../../components/StatusBadge.js";
6
6
  import { MiniBar as te } from "../../components/MiniBar.js";
7
7
  import { DataTable as ne } from "../../components/DataTable.js";
8
8
  import { ErrorView as re, LoadingView as ie, Section as ae } from "../../components/StateViews.js";
9
- import { EmptyState as c } from "../../components/EmptyState.js";
9
+ import { EmptyState as l } from "../../components/EmptyState.js";
10
10
  import "../../context/index.js";
11
11
  import { useTheContract as oe, useTheDeliverShipment as se, useTheScheduleShipment as ce, useTheTransitionContract as le, useTheUpdateContract as ue } from "../../hooks/useTheGlobalFuelApi.js";
12
+ import { useNotify as de } from "../../hooks/useNotify.js";
12
13
  import "../../hooks/index.js";
13
- import { Tabs as de } from "../../components/Tabs.js";
14
- import { FileLink as fe } from "../../components/FileLink.js";
15
- import { TheDiscussion as pe } from "../../components/TheDiscussion.js";
16
- import { TheTags as me } from "../../components/TheTags.js";
17
- import { useState as l } from "react";
18
- import { ArrowLeft as u, Building2 as he, Calendar as ge, CheckCircle2 as _e, Coins as ve, FileSignature as ye, Gauge as be, MapPin as xe, MessageSquare as Se, Package as Ce, Pencil as we, Plus as d, Ship as f, Tag as Te } from "lucide-react";
19
- import { useParams as Ee } from "react-router-dom";
20
- import { Fragment as p, jsx as m, jsxs as h } from "react/jsx-runtime";
21
- import { Button as g, GlassCard as _, Input as v, Label as y, ResponsiveDialog as b, ResponsiveDialogContent as x, ResponsiveDialogDescription as S, ResponsiveDialogFooter as C, ResponsiveDialogHeader as w, ResponsiveDialogTitle as T, Select as E, SelectContent as D, SelectItem as O, SelectTrigger as k, SelectValue as A, Textarea as j } from "@burdenoff/fe-libs/ui";
14
+ import { CONTRACT_TRANSITIONS as fe, nextStatuses as pe } from "../../utils/transitions.js";
15
+ import { Tabs as me } from "../../components/Tabs.js";
16
+ import { EvidenceUpload as he } from "../../components/EvidenceUpload.js";
17
+ import { FileLink as ge } from "../../components/FileLink.js";
18
+ import { TheDiscussion as _e } from "../../components/TheDiscussion.js";
19
+ import { TheTags as ve } from "../../components/TheTags.js";
20
+ import { useState as u } from "react";
21
+ import { ArrowLeft as d, Building2 as ye, Calendar as be, CheckCircle2 as xe, Coins as Se, FileSignature as Ce, Gauge as we, MapPin as Te, MessageSquare as Ee, Package as De, Pencil as Oe, Plus as f, Ship as p, Tag as ke } from "lucide-react";
22
+ import { useParams as Ae } from "react-router-dom";
23
+ import { Fragment as m, jsx as h, jsxs as g } from "react/jsx-runtime";
24
+ import { Button as _, GlassCard as v, Input as y, Label as b, ResponsiveDialog as x, ResponsiveDialogContent as S, ResponsiveDialogDescription as C, ResponsiveDialogFooter as w, ResponsiveDialogHeader as T, ResponsiveDialogTitle as je, Select as E, SelectContent as D, SelectItem as O, SelectTrigger as k, SelectValue as A, Textarea as j } from "@burdenoff/fe-libs/ui";
22
25
  //#region src/theglobalfuel/pages/contracts/ContractDetailPage.tsx
23
- var De = [
24
- "DRAFT",
25
- "NEGOTIATION",
26
- "SIGNED",
27
- "ACTIVE",
28
- "COMPLETED",
29
- "SUSPENDED",
30
- "TERMINATED"
31
- ], Oe = [
26
+ var Me = [
32
27
  "FIXED",
33
28
  "INDEX_LINKED",
34
29
  "FORMULA",
35
30
  "SPOT"
36
- ], ke = [
31
+ ], Ne = [
37
32
  "PIPELINE",
38
33
  "TANKER",
39
34
  "VESSEL_BULK",
@@ -48,11 +43,11 @@ var De = [
48
43
  "MWH",
49
44
  "GJ",
50
45
  "MCF"
51
- ], Ae = new Set([
46
+ ], Pe = new Set([
52
47
  "SCHEDULED",
53
48
  "LOADING",
54
49
  "IN_TRANSIT"
55
- ]), je = (e) => Math.max(0, Math.min(100, e)), N = (e) => e ? e.slice(0, 10) : "", P = (e) => ({
50
+ ]), Fe = (e) => Math.max(0, Math.min(100, e)), N = (e) => e ? e.slice(0, 10) : "", P = (e) => ({
56
51
  reference: "",
57
52
  mode: "VESSEL_BULK",
58
53
  carrier: "",
@@ -64,117 +59,129 @@ var De = [
64
59
  notes: ""
65
60
  });
66
61
  function F() {
67
- let { id: F } = Ee(), { navigateTo: I } = e(), { data: L, isLoading: Me, isError: R, refetch: Ne } = oe(F), z = ue(), Pe = le(), B = ce(), V = se(), [H, Fe] = l("shipments"), [Ie, U] = l(!1), [W, G] = l(null), [Le, K] = l(!1), [q, J] = l(P("BARRELS")), [Y, X] = l(null);
68
- if (Me) return /* @__PURE__ */ m(t, {
62
+ let { id: F } = Ae(), { navigateTo: I } = e(), L = de(), { data: R, isLoading: Ie, isError: z, refetch: Le } = oe(F), B = ue(), Re = le(), V = ce(), H = se(), [U, ze] = u("shipments"), [Be, W] = u(!1), [G, K] = u(null), [Ve, q] = u(!1), [J, Y] = u(P("BARRELS")), [He, X] = u(null), [Z, Q] = u(null);
63
+ if (Ie) return /* @__PURE__ */ h(t, {
69
64
  title: "Contract",
70
- children: /* @__PURE__ */ m(ie, {})
65
+ children: /* @__PURE__ */ h(ie, {})
71
66
  });
72
- if (R || !L) return /* @__PURE__ */ m(t, {
67
+ if (z || !R) return /* @__PURE__ */ h(t, {
73
68
  title: "Contract",
74
- actions: /* @__PURE__ */ h(g, {
69
+ actions: /* @__PURE__ */ g(_, {
75
70
  variant: "ghost",
76
71
  onClick: () => I("contracts"),
77
- children: [/* @__PURE__ */ m(u, { className: "mr-1.5 h-4 w-4" }), " Back"]
72
+ children: [/* @__PURE__ */ h(d, { className: "mr-1.5 h-4 w-4" }), " Back"]
78
73
  }),
79
- children: R ? /* @__PURE__ */ m(re, {
74
+ children: z ? /* @__PURE__ */ h(re, {
80
75
  message: "This contract could not be loaded.",
81
- onRetry: () => Ne()
82
- }) : /* @__PURE__ */ m(c, {
76
+ onRetry: () => Le()
77
+ }) : /* @__PURE__ */ h(l, {
83
78
  illustration: "empty-search",
84
- icon: /* @__PURE__ */ m(ye, { className: "h-10 w-10" }),
79
+ icon: /* @__PURE__ */ h(Ce, { className: "h-10 w-10" }),
85
80
  title: "Contract not found",
86
81
  description: "This contract may have been removed or you may not have access to it.",
87
- action: /* @__PURE__ */ m(g, {
82
+ action: /* @__PURE__ */ h(_, {
88
83
  onClick: () => I("contracts"),
89
84
  children: "Back to contracts"
90
85
  })
91
86
  })
92
87
  });
93
- let Z = L.shipments ?? [], Q = L.contractedVolume > 0 ? je(L.deliveredVolume / L.contractedVolume * 100) : 0, Re = () => {
94
- G({
95
- counterparty: L.counterparty,
96
- pricingBasis: L.pricingBasis,
97
- pricePerUnit: L.pricePerUnit ? String(L.pricePerUnit) : "",
98
- priceIndex: L.priceIndex ?? "",
99
- currency: L.currency,
100
- contractedVolume: L.contractedVolume ? String(L.contractedVolume) : "",
101
- unit: L.unit,
102
- deliveryLocation: L.deliveryLocation ?? "",
103
- startDate: N(L.startDate),
104
- endDate: N(L.endDate),
105
- notes: L.notes ?? ""
106
- }), X(null), U(!0);
107
- }, $ = () => {
108
- J(P(L.unit)), X(null), K(!0);
109
- }, ze = (e) => {
110
- e !== L.status && (X(null), Pe.mutate({
111
- id: L.id,
88
+ let $ = R.shipments ?? [], Ue = R.contractedVolume > 0 ? Fe(R.deliveredVolume / R.contractedVolume * 100) : 0, We = pe(fe, R.status), Ge = () => {
89
+ K({
90
+ counterparty: R.counterparty,
91
+ pricingBasis: R.pricingBasis,
92
+ pricePerUnit: R.pricePerUnit ? String(R.pricePerUnit) : "",
93
+ priceIndex: R.priceIndex ?? "",
94
+ currency: R.currency,
95
+ contractedVolume: R.contractedVolume ? String(R.contractedVolume) : "",
96
+ unit: R.unit,
97
+ deliveryLocation: R.deliveryLocation ?? "",
98
+ startDate: N(R.startDate),
99
+ endDate: N(R.endDate),
100
+ notes: R.notes ?? ""
101
+ }), Q(null), W(!0);
102
+ }, Ke = () => {
103
+ Y(P(R.unit)), X(null), Q(null), q(!0);
104
+ }, qe = (e) => {
105
+ e !== R.status && (Q(null), Re.mutate({
106
+ id: R.id,
112
107
  status: e
113
- }, { onError: (e) => X(e instanceof Error ? e.message : "Failed to update contract status.") }));
114
- }, Be = async () => {
115
- if (W) {
116
- if (!W.counterparty.trim()) {
117
- X("Counterparty is required.");
108
+ }, {
109
+ onSuccess: () => L.success("Contract status updated"),
110
+ onError: (e) => {
111
+ Q(e instanceof Error ? e.message : "Failed to update contract status."), L.fromError(e);
112
+ }
113
+ }));
114
+ }, Je = async () => {
115
+ if (G) {
116
+ if (!G.counterparty.trim()) {
117
+ Q("Counterparty is required.");
118
118
  return;
119
119
  }
120
- X(null);
120
+ Q(null);
121
121
  try {
122
- await z.mutateAsync({
123
- id: L.id,
122
+ await B.mutateAsync({
123
+ id: R.id,
124
124
  input: {
125
- counterparty: W.counterparty.trim(),
126
- pricingBasis: W.pricingBasis,
127
- pricePerUnit: W.pricePerUnit ? Number(W.pricePerUnit) : null,
128
- priceIndex: W.priceIndex.trim() || null,
129
- currency: W.currency.trim() || "USD",
130
- contractedVolume: W.contractedVolume ? Number(W.contractedVolume) : null,
131
- unit: W.unit,
132
- deliveryLocation: W.deliveryLocation.trim() || null,
133
- startDate: W.startDate ? new Date(W.startDate).toISOString() : null,
134
- endDate: W.endDate ? new Date(W.endDate).toISOString() : null,
135
- notes: W.notes.trim() || null
125
+ counterparty: G.counterparty.trim(),
126
+ pricingBasis: G.pricingBasis,
127
+ pricePerUnit: G.pricePerUnit ? Number(G.pricePerUnit) : null,
128
+ priceIndex: G.priceIndex.trim() || null,
129
+ currency: G.currency.trim().toUpperCase() || "USD",
130
+ contractedVolume: G.contractedVolume ? Number(G.contractedVolume) : null,
131
+ unit: G.unit,
132
+ deliveryLocation: G.deliveryLocation.trim() || null,
133
+ startDate: s(G.startDate) ?? null,
134
+ endDate: s(G.endDate) ?? null,
135
+ notes: G.notes.trim() || null
136
136
  }
137
- }), U(!1);
137
+ }), L.success("Contract updated"), W(!1);
138
138
  } catch (e) {
139
- X(e instanceof Error ? e.message : "Failed to update contract.");
139
+ Q(e instanceof Error ? e.message : "Failed to update contract."), L.fromError(e);
140
140
  }
141
141
  }
142
- }, Ve = async () => {
143
- if (!q.reference.trim()) {
144
- X("Shipment reference is required.");
142
+ }, Ye = async () => {
143
+ if (!J.reference.trim()) {
144
+ Q("Shipment reference is required.");
145
145
  return;
146
146
  }
147
- if (!q.volume) {
148
- X("Shipment volume is required.");
147
+ let e = Number(J.volume);
148
+ if (!J.volume || Number.isNaN(e) || e <= 0) {
149
+ Q("Enter a volume greater than zero."), L.error("Enter a volume greater than zero.");
149
150
  return;
150
151
  }
151
- X(null);
152
+ Q(null);
152
153
  try {
153
- await B.mutateAsync({
154
- contractId: L.id,
155
- reference: q.reference.trim(),
156
- mode: q.mode,
157
- carrier: q.carrier.trim() || null,
158
- origin: q.origin.trim() || null,
159
- destination: q.destination.trim() || null,
160
- volume: Number(q.volume),
161
- unit: q.unit,
162
- scheduledAt: q.scheduledAt ? new Date(q.scheduledAt).toISOString() : null,
163
- notes: q.notes.trim() || null
164
- }), K(!1);
154
+ await V.mutateAsync({
155
+ contractId: R.id,
156
+ reference: J.reference.trim(),
157
+ mode: J.mode,
158
+ carrier: J.carrier.trim() || null,
159
+ origin: J.origin.trim() || null,
160
+ destination: J.destination.trim() || null,
161
+ volume: e,
162
+ unit: J.unit,
163
+ scheduledAt: s(J.scheduledAt) ?? null,
164
+ documentFileId: He?.fileId ?? null,
165
+ notes: J.notes.trim() || null
166
+ }), L.success("Shipment scheduled"), q(!1);
165
167
  } catch (e) {
166
- X(e instanceof Error ? e.message : "Failed to schedule shipment.");
168
+ Q(e instanceof Error ? e.message : "Failed to schedule shipment."), L.fromError(e);
167
169
  }
168
- }, He = (e) => {
169
- X(null), V.mutate(e, { onError: (e) => X(e instanceof Error ? e.message : "Failed to mark shipment delivered.") });
170
- }, Ue = [
170
+ }, Xe = (e) => {
171
+ Q(null), H.mutate(e, {
172
+ onSuccess: () => L.success("Shipment delivered"),
173
+ onError: (e) => {
174
+ Q(e instanceof Error ? e.message : "Failed to mark shipment delivered."), L.fromError(e);
175
+ }
176
+ });
177
+ }, Ze = [
171
178
  {
172
179
  key: "reference",
173
180
  header: "Shipment",
174
- render: (e) => /* @__PURE__ */ h("div", { children: [/* @__PURE__ */ m("p", {
181
+ render: (e) => /* @__PURE__ */ g("div", { children: [/* @__PURE__ */ h("p", {
175
182
  className: "font-medium text-text-primary",
176
183
  children: e.reference
177
- }), /* @__PURE__ */ m("p", {
184
+ }), /* @__PURE__ */ h("p", {
178
185
  className: "text-xs text-text-tertiary",
179
186
  children: i(e.mode)
180
187
  })] })
@@ -182,13 +189,13 @@ function F() {
182
189
  {
183
190
  key: "status",
184
191
  header: "Status",
185
- render: (e) => /* @__PURE__ */ m(s, { status: e.status })
192
+ render: (e) => /* @__PURE__ */ h(c, { status: e.status })
186
193
  },
187
194
  {
188
195
  key: "carrier",
189
196
  header: "Carrier",
190
197
  hideOnMobile: !0,
191
- render: (e) => /* @__PURE__ */ m("span", {
198
+ render: (e) => /* @__PURE__ */ h("span", {
192
199
  className: "text-text-secondary",
193
200
  children: e.carrier ?? "—"
194
201
  })
@@ -197,19 +204,19 @@ function F() {
197
204
  key: "route",
198
205
  header: "Route",
199
206
  hideOnMobile: !0,
200
- render: (e) => e.origin || e.destination ? /* @__PURE__ */ h("span", {
207
+ render: (e) => e.origin || e.destination ? /* @__PURE__ */ g("span", {
201
208
  className: "text-text-secondary",
202
209
  children: [
203
210
  e.origin ?? "—",
204
211
  " ",
205
- /* @__PURE__ */ m("span", {
212
+ /* @__PURE__ */ h("span", {
206
213
  className: "text-text-tertiary",
207
214
  children: "→"
208
215
  }),
209
216
  " ",
210
217
  e.destination ?? "—"
211
218
  ]
212
- }) : /* @__PURE__ */ m("span", {
219
+ }) : /* @__PURE__ */ h("span", {
213
220
  className: "text-text-tertiary",
214
221
  children: "—"
215
222
  })
@@ -219,7 +226,7 @@ function F() {
219
226
  header: "Volume",
220
227
  align: "right",
221
228
  sortValue: (e) => e.volume,
222
- render: (e) => /* @__PURE__ */ m("span", {
229
+ render: (e) => /* @__PURE__ */ h("span", {
223
230
  className: "tabular-nums text-text-secondary",
224
231
  children: o(e.volume, e.unit)
225
232
  })
@@ -228,7 +235,7 @@ function F() {
228
235
  key: "schedule",
229
236
  header: "Scheduled",
230
237
  hideOnMobile: !0,
231
- render: (e) => /* @__PURE__ */ m("span", {
238
+ render: (e) => /* @__PURE__ */ h("span", {
232
239
  className: "text-text-tertiary",
233
240
  children: r(e.scheduledAt)
234
241
  })
@@ -237,7 +244,7 @@ function F() {
237
244
  key: "document",
238
245
  header: "Document",
239
246
  hideOnMobile: !0,
240
- render: (e) => e.document?.id ? /* @__PURE__ */ m(fe, { fileId: e.document.id }) : /* @__PURE__ */ m("span", {
247
+ render: (e) => e.document?.id ? /* @__PURE__ */ h(ge, { fileId: e.document.id }) : /* @__PURE__ */ h("span", {
241
248
  className: "text-text-tertiary",
242
249
  children: "—"
243
250
  })
@@ -246,522 +253,543 @@ function F() {
246
253
  key: "action",
247
254
  header: "",
248
255
  align: "right",
249
- render: (e) => Ae.has(e.status) ? /* @__PURE__ */ h(g, {
256
+ render: (e) => Pe.has(e.status) ? /* @__PURE__ */ g(_, {
250
257
  size: "sm",
251
258
  variant: "outline",
252
- onClick: () => He(e.id),
253
- disabled: V.isPending,
254
- children: [/* @__PURE__ */ m(_e, { className: "mr-1.5 h-4 w-4" }), " Mark delivered"]
259
+ onClick: () => Xe(e.id),
260
+ disabled: H.isPending,
261
+ children: [/* @__PURE__ */ h(xe, { className: "mr-1.5 h-4 w-4" }), " Mark delivered"]
255
262
  }) : null
256
263
  }
257
- ], We = [
264
+ ], Qe = [
258
265
  {
259
266
  value: "shipments",
260
267
  label: "Shipments",
261
- icon: /* @__PURE__ */ m(f, { className: "h-4 w-4" }),
262
- count: Z.length
268
+ icon: /* @__PURE__ */ h(p, { className: "h-4 w-4" }),
269
+ count: $.length
263
270
  },
264
271
  {
265
272
  value: "tags",
266
273
  label: "Tags",
267
- icon: /* @__PURE__ */ m(Te, { className: "h-4 w-4" })
274
+ icon: /* @__PURE__ */ h(ke, { className: "h-4 w-4" })
268
275
  },
269
276
  {
270
277
  value: "discussion",
271
278
  label: "Discussion",
272
- icon: /* @__PURE__ */ m(Se, { className: "h-4 w-4" })
279
+ icon: /* @__PURE__ */ h(Ee, { className: "h-4 w-4" })
273
280
  }
274
- ], Ge = L.startDate || L.endDate ? `${r(L.startDate)} – ${r(L.endDate)}` : "—";
275
- return /* @__PURE__ */ h(t, {
276
- title: L.reference,
277
- description: `${L.counterparty} · ${i(L.commodity)}`,
278
- actions: /* @__PURE__ */ h(p, { children: [
279
- /* @__PURE__ */ m(s, { status: L.status }),
280
- /* @__PURE__ */ h(E, {
281
- value: L.status,
282
- onValueChange: (e) => ze(e),
283
- children: [/* @__PURE__ */ m(k, {
281
+ ], $e = R.startDate || R.endDate ? `${r(R.startDate)} – ${r(R.endDate)}` : "—";
282
+ return /* @__PURE__ */ g(t, {
283
+ title: R.reference,
284
+ description: `${R.counterparty} · ${i(R.commodity)}`,
285
+ actions: /* @__PURE__ */ g(m, { children: [
286
+ /* @__PURE__ */ h(c, { status: R.status }),
287
+ /* @__PURE__ */ g(E, {
288
+ value: R.status,
289
+ onValueChange: (e) => qe(e),
290
+ disabled: We.length === 0,
291
+ children: [/* @__PURE__ */ h(k, {
284
292
  className: "h-9 w-40",
285
293
  "aria-label": "Change contract status",
286
- children: /* @__PURE__ */ m(A, {})
287
- }), /* @__PURE__ */ m(D, { children: De.map((e) => /* @__PURE__ */ m(O, {
294
+ children: /* @__PURE__ */ h(A, {})
295
+ }), /* @__PURE__ */ g(D, { children: [/* @__PURE__ */ h(O, {
296
+ value: R.status,
297
+ disabled: !0,
298
+ children: i(R.status)
299
+ }), We.map((e) => /* @__PURE__ */ h(O, {
288
300
  value: e,
289
301
  children: i(e)
290
- }, e)) })]
302
+ }, e))] })]
291
303
  }),
292
- /* @__PURE__ */ h(g, {
304
+ /* @__PURE__ */ g(_, {
293
305
  variant: "outline",
294
- onClick: Re,
295
- children: [/* @__PURE__ */ m(we, { className: "mr-1.5 h-4 w-4" }), " Edit"]
306
+ onClick: Ge,
307
+ children: [/* @__PURE__ */ h(Oe, { className: "mr-1.5 h-4 w-4" }), " Edit"]
296
308
  }),
297
- /* @__PURE__ */ h(g, {
309
+ /* @__PURE__ */ g(_, {
298
310
  variant: "ghost",
299
311
  onClick: () => I("contracts"),
300
- children: [/* @__PURE__ */ m(u, { className: "mr-1.5 h-4 w-4" }), " Back"]
312
+ children: [/* @__PURE__ */ h(d, { className: "mr-1.5 h-4 w-4" }), " Back"]
301
313
  })
302
314
  ] }),
303
315
  children: [
304
- /* @__PURE__ */ h("div", {
316
+ /* @__PURE__ */ g("div", {
305
317
  className: "grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4",
306
318
  children: [
307
- /* @__PURE__ */ m(n, {
308
- icon: /* @__PURE__ */ m(he, { className: "h-5 w-5" }),
309
- value: L.counterparty,
319
+ /* @__PURE__ */ h(n, {
320
+ icon: /* @__PURE__ */ h(ye, { className: "h-5 w-5" }),
321
+ value: R.counterparty,
310
322
  label: "Counterparty",
311
323
  featured: !0
312
324
  }),
313
- /* @__PURE__ */ m(n, {
314
- icon: /* @__PURE__ */ m(Ce, { className: "h-5 w-5" }),
315
- value: i(L.commodity),
325
+ /* @__PURE__ */ h(n, {
326
+ icon: /* @__PURE__ */ h(De, { className: "h-5 w-5" }),
327
+ value: i(R.commodity),
316
328
  label: "Commodity & side",
317
- footer: /* @__PURE__ */ m(s, { status: L.side })
329
+ footer: /* @__PURE__ */ h(c, { status: R.side })
318
330
  }),
319
- /* @__PURE__ */ m(n, {
320
- icon: /* @__PURE__ */ m(ve, { className: "h-5 w-5" }),
321
- value: ee(L.pricePerUnit, L.currency),
322
- label: `Price per ${a(L.unit)}`,
323
- footer: /* @__PURE__ */ m(s, { status: L.pricingBasis })
331
+ /* @__PURE__ */ h(n, {
332
+ icon: /* @__PURE__ */ h(Se, { className: "h-5 w-5" }),
333
+ value: ee(R.pricePerUnit, R.currency),
334
+ label: `Price per ${a(R.unit)}`,
335
+ footer: /* @__PURE__ */ h(c, { status: R.pricingBasis })
324
336
  }),
325
- /* @__PURE__ */ m(n, {
326
- icon: /* @__PURE__ */ m(be, { className: "h-5 w-5" }),
327
- value: o(L.deliveredVolume, L.unit),
328
- label: `of ${o(L.contractedVolume, L.unit)} delivered`,
329
- footer: /* @__PURE__ */ h("div", {
337
+ /* @__PURE__ */ h(n, {
338
+ icon: /* @__PURE__ */ h(we, { className: "h-5 w-5" }),
339
+ value: o(R.deliveredVolume, R.unit),
340
+ label: `of ${o(R.contractedVolume, R.unit)} delivered`,
341
+ footer: /* @__PURE__ */ g("div", {
330
342
  className: "space-y-2",
331
- children: [/* @__PURE__ */ m(te, {
332
- value: Q,
343
+ children: [/* @__PURE__ */ h(te, {
344
+ value: Ue,
333
345
  barClassName: "bg-[var(--color-status-success-text)]"
334
- }), /* @__PURE__ */ h("p", {
346
+ }), /* @__PURE__ */ g("p", {
335
347
  className: "text-xs tabular-nums text-text-tertiary",
336
- children: [Math.round(Q), "% fulfilled"]
348
+ children: [Math.round(Ue), "% fulfilled"]
337
349
  })]
338
350
  })
339
351
  })
340
352
  ]
341
353
  }),
342
- /* @__PURE__ */ h(_, {
354
+ /* @__PURE__ */ g(v, {
343
355
  treatment: "glass",
344
356
  className: "mt-4 p-6",
345
- children: [/* @__PURE__ */ h("dl", {
357
+ children: [/* @__PURE__ */ g("dl", {
346
358
  className: "grid grid-cols-2 gap-x-6 gap-y-4 sm:grid-cols-3 lg:grid-cols-4",
347
359
  children: [
348
- /* @__PURE__ */ h("div", { children: [/* @__PURE__ */ m("dt", {
360
+ /* @__PURE__ */ g("div", { children: [/* @__PURE__ */ h("dt", {
349
361
  className: "text-xs text-text-tertiary",
350
362
  children: "Pricing basis"
351
- }), /* @__PURE__ */ m("dd", {
363
+ }), /* @__PURE__ */ h("dd", {
352
364
  className: "mt-1",
353
- children: /* @__PURE__ */ m(s, { status: L.pricingBasis })
365
+ children: /* @__PURE__ */ h(c, { status: R.pricingBasis })
354
366
  })] }),
355
- /* @__PURE__ */ h("div", { children: [/* @__PURE__ */ m("dt", {
367
+ /* @__PURE__ */ g("div", { children: [/* @__PURE__ */ h("dt", {
356
368
  className: "text-xs text-text-tertiary",
357
369
  children: "Price index"
358
- }), /* @__PURE__ */ m("dd", {
370
+ }), /* @__PURE__ */ h("dd", {
359
371
  className: "mt-0.5 text-sm text-text-primary",
360
- children: L.priceIndex ?? "—"
372
+ children: R.priceIndex ?? "—"
361
373
  })] }),
362
- /* @__PURE__ */ h("div", { children: [/* @__PURE__ */ m("dt", {
374
+ /* @__PURE__ */ g("div", { children: [/* @__PURE__ */ h("dt", {
363
375
  className: "text-xs text-text-tertiary",
364
376
  children: "Currency"
365
- }), /* @__PURE__ */ m("dd", {
377
+ }), /* @__PURE__ */ h("dd", {
366
378
  className: "mt-0.5 text-sm text-text-primary",
367
- children: L.currency
379
+ children: R.currency
368
380
  })] }),
369
- /* @__PURE__ */ h("div", { children: [/* @__PURE__ */ m("dt", {
381
+ /* @__PURE__ */ g("div", { children: [/* @__PURE__ */ h("dt", {
370
382
  className: "text-xs text-text-tertiary",
371
383
  children: "Delivery location"
372
- }), /* @__PURE__ */ m("dd", {
384
+ }), /* @__PURE__ */ h("dd", {
373
385
  className: "mt-0.5 flex items-center gap-1.5 text-sm text-text-primary",
374
- children: L.deliveryLocation ? /* @__PURE__ */ h(p, { children: [/* @__PURE__ */ m(xe, { className: "h-3.5 w-3.5 shrink-0 text-text-tertiary" }), L.deliveryLocation] }) : "—"
386
+ children: R.deliveryLocation ? /* @__PURE__ */ g(m, { children: [/* @__PURE__ */ h(Te, { className: "h-3.5 w-3.5 shrink-0 text-text-tertiary" }), R.deliveryLocation] }) : "—"
375
387
  })] }),
376
- /* @__PURE__ */ h("div", {
388
+ /* @__PURE__ */ g("div", {
377
389
  className: "col-span-2",
378
- children: [/* @__PURE__ */ m("dt", {
390
+ children: [/* @__PURE__ */ h("dt", {
379
391
  className: "text-xs text-text-tertiary",
380
392
  children: "Term"
381
- }), /* @__PURE__ */ h("dd", {
393
+ }), /* @__PURE__ */ g("dd", {
382
394
  className: "mt-0.5 flex items-center gap-1.5 text-sm text-text-primary tabular-nums",
383
- children: [/* @__PURE__ */ m(ge, { className: "h-3.5 w-3.5 shrink-0 text-text-tertiary" }), Ge]
395
+ children: [/* @__PURE__ */ h(be, { className: "h-3.5 w-3.5 shrink-0 text-text-tertiary" }), $e]
384
396
  })]
385
397
  }),
386
- /* @__PURE__ */ h("div", { children: [/* @__PURE__ */ m("dt", {
398
+ /* @__PURE__ */ g("div", { children: [/* @__PURE__ */ h("dt", {
387
399
  className: "text-xs text-text-tertiary",
388
400
  children: "Signed"
389
- }), /* @__PURE__ */ m("dd", {
401
+ }), /* @__PURE__ */ h("dd", {
390
402
  className: "mt-0.5 text-sm text-text-primary",
391
- children: r(L.signedAt)
403
+ children: r(R.signedAt)
392
404
  })] }),
393
- /* @__PURE__ */ h("div", { children: [/* @__PURE__ */ m("dt", {
405
+ /* @__PURE__ */ g("div", { children: [/* @__PURE__ */ h("dt", {
394
406
  className: "text-xs text-text-tertiary",
395
407
  children: "Created"
396
- }), /* @__PURE__ */ m("dd", {
408
+ }), /* @__PURE__ */ h("dd", {
397
409
  className: "mt-0.5 text-sm text-text-primary",
398
- children: r(L.createdAt)
410
+ children: r(R.createdAt)
399
411
  })] })
400
412
  ]
401
- }), L.notes && /* @__PURE__ */ m("p", {
413
+ }), R.notes && /* @__PURE__ */ h("p", {
402
414
  className: "mt-5 rounded-lg bg-bg-sunken/60 p-3 text-sm text-text-secondary",
403
- children: L.notes
415
+ children: R.notes
404
416
  })]
405
417
  }),
406
- Y && /* @__PURE__ */ m("p", {
418
+ Z && /* @__PURE__ */ h("p", {
407
419
  className: "mt-4 text-sm text-status-error-text",
408
- children: Y
420
+ children: Z
409
421
  }),
410
- /* @__PURE__ */ m("div", {
422
+ /* @__PURE__ */ h("div", {
411
423
  className: "mt-6",
412
- children: /* @__PURE__ */ m(de, {
413
- items: We,
414
- value: H,
415
- onChange: Fe
424
+ children: /* @__PURE__ */ h(me, {
425
+ items: Qe,
426
+ value: U,
427
+ onChange: ze
416
428
  })
417
429
  }),
418
- H === "shipments" && /* @__PURE__ */ m("div", {
430
+ U === "shipments" && /* @__PURE__ */ h("div", {
419
431
  className: "mt-6",
420
- children: /* @__PURE__ */ m(ae, {
432
+ children: /* @__PURE__ */ h(ae, {
421
433
  title: "Shipments",
422
434
  description: "Physical movements delivering against this contract's volume.",
423
- action: /* @__PURE__ */ h(g, {
435
+ action: /* @__PURE__ */ g(_, {
424
436
  size: "sm",
425
- onClick: $,
426
- children: [/* @__PURE__ */ m(d, { className: "mr-1.5 h-4 w-4" }), " Schedule shipment"]
437
+ onClick: Ke,
438
+ children: [/* @__PURE__ */ h(f, { className: "mr-1.5 h-4 w-4" }), " Schedule shipment"]
427
439
  }),
428
- children: Z.length === 0 ? /* @__PURE__ */ m(c, {
440
+ children: $.length === 0 ? /* @__PURE__ */ h(l, {
429
441
  illustration: "empty-data",
430
- icon: /* @__PURE__ */ m(f, { className: "h-10 w-10" }),
442
+ icon: /* @__PURE__ */ h(p, { className: "h-10 w-10" }),
431
443
  title: "No shipments scheduled",
432
444
  description: "Schedule a shipment to start delivering against this contract.",
433
- action: /* @__PURE__ */ h(g, {
434
- onClick: $,
435
- children: [/* @__PURE__ */ m(d, { className: "mr-1.5 h-4 w-4" }), " Schedule shipment"]
445
+ action: /* @__PURE__ */ g(_, {
446
+ onClick: Ke,
447
+ children: [/* @__PURE__ */ h(f, { className: "mr-1.5 h-4 w-4" }), " Schedule shipment"]
436
448
  })
437
- }) : /* @__PURE__ */ m(ne, {
438
- columns: Ue,
439
- rows: Z,
449
+ }) : /* @__PURE__ */ h(ne, {
450
+ columns: Ze,
451
+ rows: $,
440
452
  rowKey: (e) => e.id
441
453
  })
442
454
  })
443
455
  }),
444
- H === "tags" && /* @__PURE__ */ m("div", {
456
+ U === "tags" && /* @__PURE__ */ h("div", {
445
457
  className: "mt-6",
446
- children: /* @__PURE__ */ m(_, {
458
+ children: /* @__PURE__ */ h(v, {
447
459
  treatment: "glass",
448
460
  className: "p-6",
449
- children: /* @__PURE__ */ m(me, {
461
+ children: /* @__PURE__ */ h(ve, {
450
462
  entityType: "theglobalfuel-contract",
451
- entityId: L.id
463
+ entityId: R.id
452
464
  })
453
465
  })
454
466
  }),
455
- H === "discussion" && /* @__PURE__ */ m("div", {
467
+ U === "discussion" && /* @__PURE__ */ h("div", {
456
468
  className: "mt-6",
457
- children: /* @__PURE__ */ m(pe, {
469
+ children: /* @__PURE__ */ h(_e, {
458
470
  entityType: "theglobalfuel-contract",
459
- entityId: L.id,
471
+ entityId: R.id,
460
472
  description: "Coordinate negotiation, delivery and settlement with your team."
461
473
  })
462
474
  }),
463
- /* @__PURE__ */ m(b, {
464
- open: Le,
465
- onOpenChange: K,
466
- children: /* @__PURE__ */ h(x, { children: [
467
- /* @__PURE__ */ h(w, { children: [/* @__PURE__ */ m(T, { children: "Schedule shipment" }), /* @__PURE__ */ h(S, { children: [
468
- "Log a physical movement delivering against ",
469
- L.reference,
470
- "."
471
- ] })] }),
472
- /* @__PURE__ */ h("div", {
475
+ /* @__PURE__ */ h(x, {
476
+ open: Ve,
477
+ onOpenChange: (e) => {
478
+ q(e), e || (Y(P(R.unit)), X(null), Q(null));
479
+ },
480
+ children: /* @__PURE__ */ g(S, { children: [/* @__PURE__ */ g(T, { children: [/* @__PURE__ */ h(je, { children: "Schedule shipment" }), /* @__PURE__ */ g(C, { children: [
481
+ "Log a physical movement delivering against ",
482
+ R.reference,
483
+ "."
484
+ ] })] }), /* @__PURE__ */ g("form", {
485
+ onSubmit: (e) => {
486
+ e.preventDefault(), Ye();
487
+ },
488
+ children: [/* @__PURE__ */ g("div", {
473
489
  className: "grid gap-4 py-2",
474
490
  children: [
475
- /* @__PURE__ */ h("div", {
491
+ /* @__PURE__ */ g("div", {
476
492
  className: "grid gap-2 sm:grid-cols-2",
477
- children: [/* @__PURE__ */ h("div", {
493
+ children: [/* @__PURE__ */ g("div", {
478
494
  className: "grid gap-1.5",
479
- children: [/* @__PURE__ */ m(y, {
495
+ children: [/* @__PURE__ */ h(b, {
480
496
  htmlFor: "shipReference",
481
497
  children: "Reference *"
482
- }), /* @__PURE__ */ m(v, {
498
+ }), /* @__PURE__ */ h(y, {
483
499
  id: "shipReference",
484
- value: q.reference,
485
- onChange: (e) => J({
486
- ...q,
500
+ value: J.reference,
501
+ onChange: (e) => Y({
502
+ ...J,
487
503
  reference: e.target.value
488
504
  }),
489
505
  placeholder: "SHP-2026-0031"
490
506
  })]
491
- }), /* @__PURE__ */ h("div", {
507
+ }), /* @__PURE__ */ g("div", {
492
508
  className: "grid gap-1.5",
493
- children: [/* @__PURE__ */ m(y, {
509
+ children: [/* @__PURE__ */ h(b, {
494
510
  htmlFor: "shipMode",
495
511
  children: "Mode"
496
- }), /* @__PURE__ */ h(E, {
497
- value: q.mode,
498
- onValueChange: (e) => J({
499
- ...q,
512
+ }), /* @__PURE__ */ g(E, {
513
+ value: J.mode,
514
+ onValueChange: (e) => Y({
515
+ ...J,
500
516
  mode: e
501
517
  }),
502
- children: [/* @__PURE__ */ m(k, {
518
+ children: [/* @__PURE__ */ h(k, {
503
519
  id: "shipMode",
504
- children: /* @__PURE__ */ m(A, {})
505
- }), /* @__PURE__ */ m(D, { children: ke.map((e) => /* @__PURE__ */ m(O, {
520
+ children: /* @__PURE__ */ h(A, {})
521
+ }), /* @__PURE__ */ h(D, { children: Ne.map((e) => /* @__PURE__ */ h(O, {
506
522
  value: e,
507
523
  children: i(e)
508
524
  }, e)) })]
509
525
  })]
510
526
  })]
511
527
  }),
512
- /* @__PURE__ */ h("div", {
528
+ /* @__PURE__ */ g("div", {
513
529
  className: "grid gap-1.5",
514
- children: [/* @__PURE__ */ m(y, {
530
+ children: [/* @__PURE__ */ h(b, {
515
531
  htmlFor: "shipCarrier",
516
532
  children: "Carrier"
517
- }), /* @__PURE__ */ m(v, {
533
+ }), /* @__PURE__ */ h(y, {
518
534
  id: "shipCarrier",
519
- value: q.carrier,
520
- onChange: (e) => J({
521
- ...q,
535
+ value: J.carrier,
536
+ onChange: (e) => Y({
537
+ ...J,
522
538
  carrier: e.target.value
523
539
  }),
524
540
  placeholder: "Maersk Tankers"
525
541
  })]
526
542
  }),
527
- /* @__PURE__ */ h("div", {
543
+ /* @__PURE__ */ g("div", {
528
544
  className: "grid gap-2 sm:grid-cols-2",
529
- children: [/* @__PURE__ */ h("div", {
545
+ children: [/* @__PURE__ */ g("div", {
530
546
  className: "grid gap-1.5",
531
- children: [/* @__PURE__ */ m(y, {
547
+ children: [/* @__PURE__ */ h(b, {
532
548
  htmlFor: "shipOrigin",
533
549
  children: "Origin"
534
- }), /* @__PURE__ */ m(v, {
550
+ }), /* @__PURE__ */ h(y, {
535
551
  id: "shipOrigin",
536
- value: q.origin,
537
- onChange: (e) => J({
538
- ...q,
552
+ value: J.origin,
553
+ onChange: (e) => Y({
554
+ ...J,
539
555
  origin: e.target.value
540
556
  }),
541
557
  placeholder: "Ras Tanura"
542
558
  })]
543
- }), /* @__PURE__ */ h("div", {
559
+ }), /* @__PURE__ */ g("div", {
544
560
  className: "grid gap-1.5",
545
- children: [/* @__PURE__ */ m(y, {
561
+ children: [/* @__PURE__ */ h(b, {
546
562
  htmlFor: "shipDestination",
547
563
  children: "Destination"
548
- }), /* @__PURE__ */ m(v, {
564
+ }), /* @__PURE__ */ h(y, {
549
565
  id: "shipDestination",
550
- value: q.destination,
551
- onChange: (e) => J({
552
- ...q,
566
+ value: J.destination,
567
+ onChange: (e) => Y({
568
+ ...J,
553
569
  destination: e.target.value
554
570
  }),
555
571
  placeholder: "Rotterdam"
556
572
  })]
557
573
  })]
558
574
  }),
559
- /* @__PURE__ */ h("div", {
575
+ /* @__PURE__ */ g("div", {
560
576
  className: "grid gap-2 sm:grid-cols-3",
561
577
  children: [
562
- /* @__PURE__ */ h("div", {
578
+ /* @__PURE__ */ g("div", {
563
579
  className: "grid gap-1.5",
564
- children: [/* @__PURE__ */ m(y, {
580
+ children: [/* @__PURE__ */ h(b, {
565
581
  htmlFor: "shipVolume",
566
582
  children: "Volume *"
567
- }), /* @__PURE__ */ m(v, {
583
+ }), /* @__PURE__ */ h(y, {
568
584
  id: "shipVolume",
569
585
  type: "number",
570
586
  min: "0",
571
587
  step: "any",
572
- value: q.volume,
573
- onChange: (e) => J({
574
- ...q,
588
+ value: J.volume,
589
+ onChange: (e) => Y({
590
+ ...J,
575
591
  volume: e.target.value
576
592
  }),
577
593
  placeholder: "50000"
578
594
  })]
579
595
  }),
580
- /* @__PURE__ */ h("div", {
596
+ /* @__PURE__ */ g("div", {
581
597
  className: "grid gap-1.5",
582
- children: [/* @__PURE__ */ m(y, {
598
+ children: [/* @__PURE__ */ h(b, {
583
599
  htmlFor: "shipUnit",
584
600
  children: "Unit"
585
- }), /* @__PURE__ */ h(E, {
586
- value: q.unit,
587
- onValueChange: (e) => J({
588
- ...q,
601
+ }), /* @__PURE__ */ g(E, {
602
+ value: J.unit,
603
+ onValueChange: (e) => Y({
604
+ ...J,
589
605
  unit: e
590
606
  }),
591
- children: [/* @__PURE__ */ m(k, {
607
+ children: [/* @__PURE__ */ h(k, {
592
608
  id: "shipUnit",
593
- children: /* @__PURE__ */ m(A, {})
594
- }), /* @__PURE__ */ m(D, { children: M.map((e) => /* @__PURE__ */ m(O, {
609
+ children: /* @__PURE__ */ h(A, {})
610
+ }), /* @__PURE__ */ h(D, { children: M.map((e) => /* @__PURE__ */ h(O, {
595
611
  value: e,
596
612
  children: a(e)
597
613
  }, e)) })]
598
614
  })]
599
615
  }),
600
- /* @__PURE__ */ h("div", {
616
+ /* @__PURE__ */ g("div", {
601
617
  className: "grid gap-1.5",
602
- children: [/* @__PURE__ */ m(y, {
618
+ children: [/* @__PURE__ */ h(b, {
603
619
  htmlFor: "shipScheduled",
604
620
  children: "Scheduled at"
605
- }), /* @__PURE__ */ m(v, {
621
+ }), /* @__PURE__ */ h(y, {
606
622
  id: "shipScheduled",
607
623
  type: "date",
608
- value: q.scheduledAt,
609
- onChange: (e) => J({
610
- ...q,
624
+ value: J.scheduledAt,
625
+ onChange: (e) => Y({
626
+ ...J,
611
627
  scheduledAt: e.target.value
612
628
  })
613
629
  })]
614
630
  })
615
631
  ]
616
632
  }),
617
- /* @__PURE__ */ h("div", {
633
+ /* @__PURE__ */ h(he, {
634
+ id: "ship-doc",
635
+ label: "Bill of lading / document",
636
+ value: He,
637
+ onChange: X,
638
+ accept: "image/*,application/pdf",
639
+ hint: "Attach the bill of lading or shipping document (PDF or image)."
640
+ }),
641
+ /* @__PURE__ */ g("div", {
618
642
  className: "grid gap-1.5",
619
- children: [/* @__PURE__ */ m(y, {
643
+ children: [/* @__PURE__ */ h(b, {
620
644
  htmlFor: "shipNotes",
621
645
  children: "Notes"
622
- }), /* @__PURE__ */ m(j, {
646
+ }), /* @__PURE__ */ h(j, {
623
647
  id: "shipNotes",
624
648
  rows: 2,
625
- value: q.notes,
626
- onChange: (e) => J({
627
- ...q,
649
+ value: J.notes,
650
+ onChange: (e) => Y({
651
+ ...J,
628
652
  notes: e.target.value
629
653
  }),
630
654
  placeholder: "Optional context about this shipment."
631
655
  })]
632
656
  }),
633
- Y && /* @__PURE__ */ m("p", {
657
+ Z && /* @__PURE__ */ h("p", {
634
658
  className: "text-sm text-status-error-text",
635
- children: Y
659
+ children: Z
636
660
  })
637
661
  ]
638
- }),
639
- /* @__PURE__ */ h(C, { children: [/* @__PURE__ */ m(g, {
662
+ }), /* @__PURE__ */ g(w, { children: [/* @__PURE__ */ h(_, {
663
+ type: "button",
640
664
  variant: "outline",
641
- onClick: () => K(!1),
665
+ onClick: () => {
666
+ q(!1), Y(P(R.unit)), X(null), Q(null);
667
+ },
642
668
  children: "Cancel"
643
- }), /* @__PURE__ */ m(g, {
644
- onClick: Ve,
645
- disabled: B.isPending,
646
- children: B.isPending ? "Scheduling…" : "Schedule shipment"
647
- })] })
648
- ] })
669
+ }), /* @__PURE__ */ h(_, {
670
+ type: "submit",
671
+ disabled: V.isPending,
672
+ children: V.isPending ? "Scheduling…" : "Schedule shipment"
673
+ })] })]
674
+ })] })
649
675
  }),
650
- /* @__PURE__ */ m(b, {
651
- open: Ie,
652
- onOpenChange: U,
653
- children: /* @__PURE__ */ h(x, { children: [
654
- /* @__PURE__ */ h(w, { children: [/* @__PURE__ */ m(T, { children: "Edit contract" }), /* @__PURE__ */ h(S, { children: [
655
- "Update the commercial terms of ",
656
- L.reference,
657
- "."
658
- ] })] }),
659
- W && /* @__PURE__ */ h("div", {
676
+ /* @__PURE__ */ h(x, {
677
+ open: Be,
678
+ onOpenChange: W,
679
+ children: /* @__PURE__ */ g(S, { children: [/* @__PURE__ */ g(T, { children: [/* @__PURE__ */ h(je, { children: "Edit contract" }), /* @__PURE__ */ g(C, { children: [
680
+ "Update the commercial terms of ",
681
+ R.reference,
682
+ "."
683
+ ] })] }), /* @__PURE__ */ g("form", {
684
+ onSubmit: (e) => {
685
+ e.preventDefault(), Je();
686
+ },
687
+ children: [G && /* @__PURE__ */ g("div", {
660
688
  className: "grid gap-4 py-2",
661
689
  children: [
662
- /* @__PURE__ */ h("div", {
690
+ /* @__PURE__ */ g("div", {
663
691
  className: "grid gap-1.5",
664
- children: [/* @__PURE__ */ m(y, {
692
+ children: [/* @__PURE__ */ h(b, {
665
693
  htmlFor: "editCounterparty",
666
694
  children: "Counterparty *"
667
- }), /* @__PURE__ */ m(v, {
695
+ }), /* @__PURE__ */ h(y, {
668
696
  id: "editCounterparty",
669
- value: W.counterparty,
670
- onChange: (e) => G({
671
- ...W,
697
+ value: G.counterparty,
698
+ onChange: (e) => K({
699
+ ...G,
672
700
  counterparty: e.target.value
673
701
  }),
674
702
  placeholder: "Vitol S.A."
675
703
  })]
676
704
  }),
677
- /* @__PURE__ */ h("div", {
705
+ /* @__PURE__ */ g("div", {
678
706
  className: "grid gap-2 sm:grid-cols-2",
679
- children: [/* @__PURE__ */ h("div", {
707
+ children: [/* @__PURE__ */ g("div", {
680
708
  className: "grid gap-1.5",
681
- children: [/* @__PURE__ */ m(y, {
709
+ children: [/* @__PURE__ */ h(b, {
682
710
  htmlFor: "editPricingBasis",
683
711
  children: "Pricing basis"
684
- }), /* @__PURE__ */ h(E, {
685
- value: W.pricingBasis,
686
- onValueChange: (e) => G({
687
- ...W,
712
+ }), /* @__PURE__ */ g(E, {
713
+ value: G.pricingBasis,
714
+ onValueChange: (e) => K({
715
+ ...G,
688
716
  pricingBasis: e
689
717
  }),
690
- children: [/* @__PURE__ */ m(k, {
718
+ children: [/* @__PURE__ */ h(k, {
691
719
  id: "editPricingBasis",
692
- children: /* @__PURE__ */ m(A, {})
693
- }), /* @__PURE__ */ m(D, { children: Oe.map((e) => /* @__PURE__ */ m(O, {
720
+ children: /* @__PURE__ */ h(A, {})
721
+ }), /* @__PURE__ */ h(D, { children: Me.map((e) => /* @__PURE__ */ h(O, {
694
722
  value: e,
695
723
  children: i(e)
696
724
  }, e)) })]
697
725
  })]
698
- }), /* @__PURE__ */ h("div", {
726
+ }), /* @__PURE__ */ g("div", {
699
727
  className: "grid gap-1.5",
700
- children: [/* @__PURE__ */ m(y, {
728
+ children: [/* @__PURE__ */ h(b, {
701
729
  htmlFor: "editPriceIndex",
702
730
  children: "Price index"
703
- }), /* @__PURE__ */ m(v, {
731
+ }), /* @__PURE__ */ h(y, {
704
732
  id: "editPriceIndex",
705
- value: W.priceIndex,
706
- onChange: (e) => G({
707
- ...W,
733
+ value: G.priceIndex,
734
+ onChange: (e) => K({
735
+ ...G,
708
736
  priceIndex: e.target.value
709
737
  }),
710
738
  placeholder: "Brent, TTF, Henry Hub"
711
739
  })]
712
740
  })]
713
741
  }),
714
- /* @__PURE__ */ h("div", {
742
+ /* @__PURE__ */ g("div", {
715
743
  className: "grid gap-2 sm:grid-cols-3",
716
744
  children: [
717
- /* @__PURE__ */ h("div", {
745
+ /* @__PURE__ */ g("div", {
718
746
  className: "grid gap-1.5",
719
- children: [/* @__PURE__ */ m(y, {
747
+ children: [/* @__PURE__ */ h(b, {
720
748
  htmlFor: "editPrice",
721
749
  children: "Price / unit"
722
- }), /* @__PURE__ */ m(v, {
750
+ }), /* @__PURE__ */ h(y, {
723
751
  id: "editPrice",
724
752
  type: "number",
725
753
  min: "0",
726
754
  step: "any",
727
- value: W.pricePerUnit,
728
- onChange: (e) => G({
729
- ...W,
755
+ value: G.pricePerUnit,
756
+ onChange: (e) => K({
757
+ ...G,
730
758
  pricePerUnit: e.target.value
731
759
  }),
732
760
  placeholder: "82.50"
733
761
  })]
734
762
  }),
735
- /* @__PURE__ */ h("div", {
763
+ /* @__PURE__ */ g("div", {
736
764
  className: "grid gap-1.5",
737
- children: [/* @__PURE__ */ m(y, {
765
+ children: [/* @__PURE__ */ h(b, {
738
766
  htmlFor: "editCurrency",
739
767
  children: "Currency"
740
- }), /* @__PURE__ */ m(v, {
768
+ }), /* @__PURE__ */ h(y, {
741
769
  id: "editCurrency",
742
- value: W.currency,
743
- onChange: (e) => G({
744
- ...W,
770
+ value: G.currency,
771
+ onChange: (e) => K({
772
+ ...G,
745
773
  currency: e.target.value
746
774
  }),
747
775
  placeholder: "USD"
748
776
  })]
749
777
  }),
750
- /* @__PURE__ */ h("div", {
778
+ /* @__PURE__ */ g("div", {
751
779
  className: "grid gap-1.5",
752
- children: [/* @__PURE__ */ m(y, {
780
+ children: [/* @__PURE__ */ h(b, {
753
781
  htmlFor: "editUnit",
754
782
  children: "Unit"
755
- }), /* @__PURE__ */ h(E, {
756
- value: W.unit,
757
- onValueChange: (e) => G({
758
- ...W,
783
+ }), /* @__PURE__ */ g(E, {
784
+ value: G.unit,
785
+ onValueChange: (e) => K({
786
+ ...G,
759
787
  unit: e
760
788
  }),
761
- children: [/* @__PURE__ */ m(k, {
789
+ children: [/* @__PURE__ */ h(k, {
762
790
  id: "editUnit",
763
- children: /* @__PURE__ */ m(A, {})
764
- }), /* @__PURE__ */ m(D, { children: M.map((e) => /* @__PURE__ */ m(O, {
791
+ children: /* @__PURE__ */ h(A, {})
792
+ }), /* @__PURE__ */ h(D, { children: M.map((e) => /* @__PURE__ */ h(O, {
765
793
  value: e,
766
794
  children: a(e)
767
795
  }, e)) })]
@@ -769,105 +797,105 @@ function F() {
769
797
  })
770
798
  ]
771
799
  }),
772
- /* @__PURE__ */ h("div", {
800
+ /* @__PURE__ */ g("div", {
773
801
  className: "grid gap-2 sm:grid-cols-2",
774
- children: [/* @__PURE__ */ h("div", {
802
+ children: [/* @__PURE__ */ g("div", {
775
803
  className: "grid gap-1.5",
776
- children: [/* @__PURE__ */ m(y, {
804
+ children: [/* @__PURE__ */ h(b, {
777
805
  htmlFor: "editVolume",
778
806
  children: "Contracted volume"
779
- }), /* @__PURE__ */ m(v, {
807
+ }), /* @__PURE__ */ h(y, {
780
808
  id: "editVolume",
781
809
  type: "number",
782
810
  min: "0",
783
811
  step: "any",
784
- value: W.contractedVolume,
785
- onChange: (e) => G({
786
- ...W,
812
+ value: G.contractedVolume,
813
+ onChange: (e) => K({
814
+ ...G,
787
815
  contractedVolume: e.target.value
788
816
  }),
789
817
  placeholder: "500000"
790
818
  })]
791
- }), /* @__PURE__ */ h("div", {
819
+ }), /* @__PURE__ */ g("div", {
792
820
  className: "grid gap-1.5",
793
- children: [/* @__PURE__ */ m(y, {
821
+ children: [/* @__PURE__ */ h(b, {
794
822
  htmlFor: "editLocation",
795
823
  children: "Delivery location"
796
- }), /* @__PURE__ */ m(v, {
824
+ }), /* @__PURE__ */ h(y, {
797
825
  id: "editLocation",
798
- value: W.deliveryLocation,
799
- onChange: (e) => G({
800
- ...W,
826
+ value: G.deliveryLocation,
827
+ onChange: (e) => K({
828
+ ...G,
801
829
  deliveryLocation: e.target.value
802
830
  }),
803
831
  placeholder: "Rotterdam"
804
832
  })]
805
833
  })]
806
834
  }),
807
- /* @__PURE__ */ h("div", {
835
+ /* @__PURE__ */ g("div", {
808
836
  className: "grid gap-2 sm:grid-cols-2",
809
- children: [/* @__PURE__ */ h("div", {
837
+ children: [/* @__PURE__ */ g("div", {
810
838
  className: "grid gap-1.5",
811
- children: [/* @__PURE__ */ m(y, {
839
+ children: [/* @__PURE__ */ h(b, {
812
840
  htmlFor: "editStart",
813
841
  children: "Start date"
814
- }), /* @__PURE__ */ m(v, {
842
+ }), /* @__PURE__ */ h(y, {
815
843
  id: "editStart",
816
844
  type: "date",
817
- value: W.startDate,
818
- onChange: (e) => G({
819
- ...W,
845
+ value: G.startDate,
846
+ onChange: (e) => K({
847
+ ...G,
820
848
  startDate: e.target.value
821
849
  })
822
850
  })]
823
- }), /* @__PURE__ */ h("div", {
851
+ }), /* @__PURE__ */ g("div", {
824
852
  className: "grid gap-1.5",
825
- children: [/* @__PURE__ */ m(y, {
853
+ children: [/* @__PURE__ */ h(b, {
826
854
  htmlFor: "editEnd",
827
855
  children: "End date"
828
- }), /* @__PURE__ */ m(v, {
856
+ }), /* @__PURE__ */ h(y, {
829
857
  id: "editEnd",
830
858
  type: "date",
831
- value: W.endDate,
832
- onChange: (e) => G({
833
- ...W,
859
+ value: G.endDate,
860
+ onChange: (e) => K({
861
+ ...G,
834
862
  endDate: e.target.value
835
863
  })
836
864
  })]
837
865
  })]
838
866
  }),
839
- /* @__PURE__ */ h("div", {
867
+ /* @__PURE__ */ g("div", {
840
868
  className: "grid gap-1.5",
841
- children: [/* @__PURE__ */ m(y, {
869
+ children: [/* @__PURE__ */ h(b, {
842
870
  htmlFor: "editNotes",
843
871
  children: "Notes"
844
- }), /* @__PURE__ */ m(j, {
872
+ }), /* @__PURE__ */ h(j, {
845
873
  id: "editNotes",
846
874
  rows: 2,
847
- value: W.notes,
848
- onChange: (e) => G({
849
- ...W,
875
+ value: G.notes,
876
+ onChange: (e) => K({
877
+ ...G,
850
878
  notes: e.target.value
851
879
  }),
852
880
  placeholder: "Optional context about this contract."
853
881
  })]
854
882
  }),
855
- Y && /* @__PURE__ */ m("p", {
883
+ Z && /* @__PURE__ */ h("p", {
856
884
  className: "text-sm text-status-error-text",
857
- children: Y
885
+ children: Z
858
886
  })
859
887
  ]
860
- }),
861
- /* @__PURE__ */ h(C, { children: [/* @__PURE__ */ m(g, {
888
+ }), /* @__PURE__ */ g(w, { children: [/* @__PURE__ */ h(_, {
889
+ type: "button",
862
890
  variant: "outline",
863
- onClick: () => U(!1),
891
+ onClick: () => W(!1),
864
892
  children: "Cancel"
865
- }), /* @__PURE__ */ m(g, {
866
- onClick: Be,
867
- disabled: z.isPending,
868
- children: z.isPending ? "Saving…" : "Save changes"
869
- })] })
870
- ] })
893
+ }), /* @__PURE__ */ h(_, {
894
+ type: "submit",
895
+ disabled: B.isPending,
896
+ children: B.isPending ? "Saving…" : "Save changes"
897
+ })] })]
898
+ })] })
871
899
  })
872
900
  ]
873
901
  });