@burdenoff/microfe-theglobalfuel 2026.1102.1 → 2026.1107.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/theglobalfuel/components/BulkAllocateSheet.d.ts +19 -0
- package/dist/theglobalfuel/components/BulkAllocateSheet.d.ts.map +1 -0
- package/dist/theglobalfuel/components/BulkAllocateSheet.js +340 -0
- package/dist/theglobalfuel/components/BulkAllocateSheet.js.map +1 -0
- package/dist/theglobalfuel/components/StatusBadge.d.ts.map +1 -1
- package/dist/theglobalfuel/components/StatusBadge.js +8 -1
- package/dist/theglobalfuel/components/StatusBadge.js.map +1 -1
- package/dist/theglobalfuel/hooks/useTheGlobalFuelApi.d.ts +31 -1
- package/dist/theglobalfuel/hooks/useTheGlobalFuelApi.d.ts.map +1 -1
- package/dist/theglobalfuel/hooks/useTheGlobalFuelApi.js +230 -138
- package/dist/theglobalfuel/hooks/useTheGlobalFuelApi.js.map +1 -1
- package/dist/theglobalfuel/pages/production/PeriodClosePanel.d.ts +17 -0
- package/dist/theglobalfuel/pages/production/PeriodClosePanel.d.ts.map +1 -0
- package/dist/theglobalfuel/pages/production/PeriodClosePanel.js +563 -0
- package/dist/theglobalfuel/pages/production/PeriodClosePanel.js.map +1 -0
- package/dist/theglobalfuel/pages/production/ProductionPage.d.ts +3 -0
- package/dist/theglobalfuel/pages/production/ProductionPage.d.ts.map +1 -1
- package/dist/theglobalfuel/pages/production/ProductionPage.js +122 -103
- package/dist/theglobalfuel/pages/production/ProductionPage.js.map +1 -1
- package/dist/theglobalfuel/types/index.d.ts +77 -0
- package/dist/theglobalfuel/types/index.d.ts.map +1 -1
- package/dist/theglobalfuel/utils/allocationForm.d.ts +14 -1
- package/dist/theglobalfuel/utils/allocationForm.d.ts.map +1 -1
- package/dist/theglobalfuel/utils/allocationForm.js +50 -43
- package/dist/theglobalfuel/utils/allocationForm.js.map +1 -1
- package/dist/theglobalfuel/utils/periodClose.d.ts +39 -0
- package/dist/theglobalfuel/utils/periodClose.d.ts.map +1 -0
- package/dist/theglobalfuel/utils/periodClose.js +120 -0
- package/dist/theglobalfuel/utils/periodClose.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* BulkAllocateSheet — apply one set of pro-rata factors (e.g. the latest well
|
|
3
|
+
* tests) to every unallocated production record of a field or facility in a
|
|
4
|
+
* period, in one action (BOFF-10788).
|
|
5
|
+
* @module theglobalfuel/components
|
|
6
|
+
*
|
|
7
|
+
* "Validate" runs `theBulkAllocateProduction` as a dry run (nothing is
|
|
8
|
+
* written) so the operator sees which records would be allocated, skipped or
|
|
9
|
+
* refused (for example because the period is closed). "Allocate" runs it for
|
|
10
|
+
* real, optionally approving every allocation it creates. Each record is
|
|
11
|
+
* reported with its own outcome.
|
|
12
|
+
*/
|
|
13
|
+
interface BulkAllocateSheetProps {
|
|
14
|
+
open: boolean;
|
|
15
|
+
onOpenChange: (open: boolean) => void;
|
|
16
|
+
}
|
|
17
|
+
export declare function BulkAllocateSheet({ open, onOpenChange }: BulkAllocateSheetProps): import("react").JSX.Element;
|
|
18
|
+
export {};
|
|
19
|
+
//# sourceMappingURL=BulkAllocateSheet.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BulkAllocateSheet.d.ts","sourceRoot":"","sources":["../../../src/theglobalfuel/components/BulkAllocateSheet.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AA8BH,UAAU,sBAAsB;IAC9B,IAAI,EAAE,OAAO,CAAC;IACd,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;CACvC;AAID,wBAAgB,iBAAiB,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,EAAE,sBAAsB,+BA4V/E"}
|
|
@@ -0,0 +1,340 @@
|
|
|
1
|
+
import { formatDate as e, formatNumber as t, formatVolume as n } from "../utils/formatters.js";
|
|
2
|
+
import { StatusBadge as r } from "./StatusBadge.js";
|
|
3
|
+
import { useTheAllAssets as i, useTheBulkAllocateProduction as a } from "../hooks/useTheGlobalFuelApi.js";
|
|
4
|
+
import { useNotify as o } from "../hooks/useNotify.js";
|
|
5
|
+
import "../hooks/index.js";
|
|
6
|
+
import { todayInputDate as s } from "../utils/productionForm.js";
|
|
7
|
+
import { newAllocationRow as c } from "../utils/allocationForm.js";
|
|
8
|
+
import { buildBulkAllocationInput as l } from "../utils/periodClose.js";
|
|
9
|
+
import { useMemo as u, useState as d } from "react";
|
|
10
|
+
import { Plus as f, Trash2 as ee } from "lucide-react";
|
|
11
|
+
import { jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
12
|
+
import { Button as h, Checkbox as g, Input as _, Label as v, ResponsiveDialog as te, ResponsiveDialogContent as ne, ResponsiveDialogDescription as re, ResponsiveDialogFooter as ie, ResponsiveDialogHeader as y, ResponsiveDialogTitle as b, Select as x, SelectContent as S, SelectItem as C, SelectTrigger as w, SelectValue as T, Textarea as E } from "@burdenoff/fe-libs/ui";
|
|
13
|
+
//#region src/theglobalfuel/components/BulkAllocateSheet.tsx
|
|
14
|
+
var D = (e) => `${e.slice(0, 7)}-01`;
|
|
15
|
+
function O({ open: O, onOpenChange: k }) {
|
|
16
|
+
let A = o(), j = i({ enabled: O }), M = a(), N = u(() => [...j.data?.items ?? []].sort((e, t) => e.name.localeCompare(t.name)), [j.data]), P = s(), [F, I] = d(""), [L, R] = d(() => D(P)), [z, B] = d(P), [V, H] = d(() => [c()]), [U, W] = d(!1), [G, K] = d(""), [q, J] = d(null), [Y, X] = d(null), Z = O ? "open" : "closed", [ae, oe] = d(Z);
|
|
17
|
+
Z !== ae && (oe(Z), O && (I(""), R(D(P)), B(P), H([c()]), W(!1), K(""), J(null), X(null)));
|
|
18
|
+
let Q = (e, t) => {
|
|
19
|
+
X(null), H((n) => n.map((n) => n.key === e ? {
|
|
20
|
+
...n,
|
|
21
|
+
...t
|
|
22
|
+
} : n));
|
|
23
|
+
}, se = (e) => H((t) => t.length > 1 ? t.filter((t) => t.key !== e) : t), $ = async (e) => {
|
|
24
|
+
let t = l({
|
|
25
|
+
measurementAssetId: F,
|
|
26
|
+
from: L,
|
|
27
|
+
to: z,
|
|
28
|
+
rows: V,
|
|
29
|
+
approve: U,
|
|
30
|
+
dryRun: e,
|
|
31
|
+
notes: G
|
|
32
|
+
});
|
|
33
|
+
if (!t.ok) {
|
|
34
|
+
J(t.error), A.error(t.error);
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
J(null);
|
|
38
|
+
try {
|
|
39
|
+
let n = await M.mutateAsync(t.input);
|
|
40
|
+
X(n), e ? A.success(`${n.validatedCount} of ${n.recordCount} record(s) can be allocated`) : A.success(n.approve ? `${n.approvedCount} allocation(s) created and approved` : `${n.allocatedCount} draft allocation(s) created`);
|
|
41
|
+
} catch (e) {
|
|
42
|
+
J(e instanceof Error ? e.message : "Bulk allocation failed."), A.fromError(e);
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
return /* @__PURE__ */ p(te, {
|
|
46
|
+
open: O,
|
|
47
|
+
onOpenChange: k,
|
|
48
|
+
children: /* @__PURE__ */ m(ne, {
|
|
49
|
+
"data-testid": "bulk-allocate-sheet",
|
|
50
|
+
className: "md:max-w-3xl",
|
|
51
|
+
children: [/* @__PURE__ */ m(y, { children: [/* @__PURE__ */ p(b, { children: "Bulk allocate production" }), /* @__PURE__ */ p(re, { children: "Apply one set of pro-rata factors to every unallocated record measured at a field or facility in a period. Records that already have an allocation are left alone." })] }), /* @__PURE__ */ m("form", {
|
|
52
|
+
onSubmit: (e) => {
|
|
53
|
+
e.preventDefault(), $(!1);
|
|
54
|
+
},
|
|
55
|
+
children: [/* @__PURE__ */ m("div", {
|
|
56
|
+
className: "grid gap-4 py-2",
|
|
57
|
+
children: [
|
|
58
|
+
/* @__PURE__ */ m("div", {
|
|
59
|
+
className: "grid gap-2 md:grid-cols-3",
|
|
60
|
+
children: [
|
|
61
|
+
/* @__PURE__ */ m("div", {
|
|
62
|
+
className: "grid gap-1.5",
|
|
63
|
+
children: [/* @__PURE__ */ p(v, {
|
|
64
|
+
htmlFor: "baField",
|
|
65
|
+
children: "Measured at *"
|
|
66
|
+
}), /* @__PURE__ */ m(x, {
|
|
67
|
+
value: F,
|
|
68
|
+
onValueChange: (e) => {
|
|
69
|
+
X(null), I(e);
|
|
70
|
+
},
|
|
71
|
+
children: [/* @__PURE__ */ p(w, {
|
|
72
|
+
id: "baField",
|
|
73
|
+
className: "h-10",
|
|
74
|
+
children: /* @__PURE__ */ p(T, { placeholder: "Select a field or facility" })
|
|
75
|
+
}), /* @__PURE__ */ p(S, { children: N.map((e) => /* @__PURE__ */ p(C, {
|
|
76
|
+
value: e.id,
|
|
77
|
+
children: e.name
|
|
78
|
+
}, e.id)) })]
|
|
79
|
+
})]
|
|
80
|
+
}),
|
|
81
|
+
/* @__PURE__ */ m("div", {
|
|
82
|
+
className: "grid gap-1.5",
|
|
83
|
+
children: [/* @__PURE__ */ p(v, {
|
|
84
|
+
htmlFor: "baFrom",
|
|
85
|
+
children: "Period from *"
|
|
86
|
+
}), /* @__PURE__ */ p(_, {
|
|
87
|
+
id: "baFrom",
|
|
88
|
+
type: "date",
|
|
89
|
+
className: "h-10",
|
|
90
|
+
value: L,
|
|
91
|
+
onChange: (e) => {
|
|
92
|
+
X(null), R(e.target.value);
|
|
93
|
+
}
|
|
94
|
+
})]
|
|
95
|
+
}),
|
|
96
|
+
/* @__PURE__ */ m("div", {
|
|
97
|
+
className: "grid gap-1.5",
|
|
98
|
+
children: [/* @__PURE__ */ p(v, {
|
|
99
|
+
htmlFor: "baTo",
|
|
100
|
+
children: "Period to *"
|
|
101
|
+
}), /* @__PURE__ */ p(_, {
|
|
102
|
+
id: "baTo",
|
|
103
|
+
type: "date",
|
|
104
|
+
className: "h-10",
|
|
105
|
+
value: z,
|
|
106
|
+
onChange: (e) => {
|
|
107
|
+
X(null), B(e.target.value);
|
|
108
|
+
}
|
|
109
|
+
})]
|
|
110
|
+
})
|
|
111
|
+
]
|
|
112
|
+
}),
|
|
113
|
+
/* @__PURE__ */ m("div", {
|
|
114
|
+
className: "grid gap-3",
|
|
115
|
+
children: [
|
|
116
|
+
/* @__PURE__ */ p("p", {
|
|
117
|
+
className: "text-xs text-text-tertiary",
|
|
118
|
+
children: "Factors can be well-test rates, theoretical volumes or metered shares. Each record’s measured volume is split in proportion."
|
|
119
|
+
}),
|
|
120
|
+
V.map((e, t) => /* @__PURE__ */ m("div", {
|
|
121
|
+
className: "grid grid-cols-1 gap-2 rounded-lg border border-border-seam p-3 md:grid-cols-[minmax(0,2fr)_minmax(0,1fr)_minmax(0,1fr)_minmax(0,1fr)_auto]",
|
|
122
|
+
"data-testid": "bulk-allocation-row",
|
|
123
|
+
children: [
|
|
124
|
+
/* @__PURE__ */ m("div", {
|
|
125
|
+
className: "grid gap-1",
|
|
126
|
+
children: [/* @__PURE__ */ p(v, {
|
|
127
|
+
htmlFor: `${e.key}-basset`,
|
|
128
|
+
className: "text-xs",
|
|
129
|
+
children: "Contributing asset"
|
|
130
|
+
}), /* @__PURE__ */ m(x, {
|
|
131
|
+
value: e.assetId,
|
|
132
|
+
onValueChange: (t) => Q(e.key, { assetId: t }),
|
|
133
|
+
children: [/* @__PURE__ */ p(w, {
|
|
134
|
+
id: `${e.key}-basset`,
|
|
135
|
+
className: "h-10",
|
|
136
|
+
children: /* @__PURE__ */ p(T, { placeholder: "Select an asset" })
|
|
137
|
+
}), /* @__PURE__ */ p(S, { children: N.map((e) => /* @__PURE__ */ p(C, {
|
|
138
|
+
value: e.id,
|
|
139
|
+
children: e.name
|
|
140
|
+
}, e.id)) })]
|
|
141
|
+
})]
|
|
142
|
+
}),
|
|
143
|
+
/* @__PURE__ */ m("div", {
|
|
144
|
+
className: "grid gap-1",
|
|
145
|
+
children: [/* @__PURE__ */ p(v, {
|
|
146
|
+
htmlFor: `${e.key}-bfactor`,
|
|
147
|
+
className: "text-xs",
|
|
148
|
+
children: "Factor"
|
|
149
|
+
}), /* @__PURE__ */ p(_, {
|
|
150
|
+
id: `${e.key}-bfactor`,
|
|
151
|
+
type: "number",
|
|
152
|
+
inputMode: "decimal",
|
|
153
|
+
min: "0",
|
|
154
|
+
step: "any",
|
|
155
|
+
className: "h-10 tabular-nums",
|
|
156
|
+
value: e.amount,
|
|
157
|
+
onChange: (t) => Q(e.key, { amount: t.target.value })
|
|
158
|
+
})]
|
|
159
|
+
}),
|
|
160
|
+
/* @__PURE__ */ m("div", {
|
|
161
|
+
className: "grid gap-1",
|
|
162
|
+
children: [/* @__PURE__ */ p(v, {
|
|
163
|
+
htmlFor: `${e.key}-bwi`,
|
|
164
|
+
className: "text-xs",
|
|
165
|
+
children: "Working interest %"
|
|
166
|
+
}), /* @__PURE__ */ p(_, {
|
|
167
|
+
id: `${e.key}-bwi`,
|
|
168
|
+
type: "number",
|
|
169
|
+
inputMode: "decimal",
|
|
170
|
+
min: "0",
|
|
171
|
+
max: "100",
|
|
172
|
+
step: "any",
|
|
173
|
+
className: "h-10 tabular-nums",
|
|
174
|
+
placeholder: "Asset default",
|
|
175
|
+
value: e.workingInterestPct,
|
|
176
|
+
onChange: (t) => Q(e.key, { workingInterestPct: t.target.value })
|
|
177
|
+
})]
|
|
178
|
+
}),
|
|
179
|
+
/* @__PURE__ */ m("div", {
|
|
180
|
+
className: "grid gap-1",
|
|
181
|
+
children: [/* @__PURE__ */ p(v, {
|
|
182
|
+
htmlFor: `${e.key}-broyalty`,
|
|
183
|
+
className: "text-xs",
|
|
184
|
+
children: "Royalty %"
|
|
185
|
+
}), /* @__PURE__ */ p(_, {
|
|
186
|
+
id: `${e.key}-broyalty`,
|
|
187
|
+
type: "number",
|
|
188
|
+
inputMode: "decimal",
|
|
189
|
+
min: "0",
|
|
190
|
+
max: "100",
|
|
191
|
+
step: "any",
|
|
192
|
+
className: "h-10 tabular-nums",
|
|
193
|
+
placeholder: "0",
|
|
194
|
+
value: e.royaltyPct,
|
|
195
|
+
onChange: (t) => Q(e.key, { royaltyPct: t.target.value })
|
|
196
|
+
})]
|
|
197
|
+
}),
|
|
198
|
+
/* @__PURE__ */ p("div", {
|
|
199
|
+
className: "flex items-end",
|
|
200
|
+
children: /* @__PURE__ */ p(h, {
|
|
201
|
+
type: "button",
|
|
202
|
+
variant: "ghost",
|
|
203
|
+
size: "icon",
|
|
204
|
+
"aria-label": `Remove row ${t + 1}`,
|
|
205
|
+
disabled: V.length === 1,
|
|
206
|
+
onClick: () => se(e.key),
|
|
207
|
+
children: /* @__PURE__ */ p(ee, { className: "h-4 w-4" })
|
|
208
|
+
})
|
|
209
|
+
})
|
|
210
|
+
]
|
|
211
|
+
}, e.key)),
|
|
212
|
+
/* @__PURE__ */ p("div", { children: /* @__PURE__ */ m(h, {
|
|
213
|
+
type: "button",
|
|
214
|
+
variant: "outline",
|
|
215
|
+
size: "sm",
|
|
216
|
+
onClick: () => H((e) => [...e, c()]),
|
|
217
|
+
children: [/* @__PURE__ */ p(f, { className: "mr-1.5 h-4 w-4" }), " Add asset"]
|
|
218
|
+
}) })
|
|
219
|
+
]
|
|
220
|
+
}),
|
|
221
|
+
/* @__PURE__ */ m("div", {
|
|
222
|
+
className: "flex items-center gap-2",
|
|
223
|
+
children: [/* @__PURE__ */ p(g, {
|
|
224
|
+
id: "baApprove",
|
|
225
|
+
checked: U,
|
|
226
|
+
onCheckedChange: (e) => W(e === !0)
|
|
227
|
+
}), /* @__PURE__ */ p(v, {
|
|
228
|
+
htmlFor: "baApprove",
|
|
229
|
+
className: "text-sm font-normal",
|
|
230
|
+
children: "Approve each allocation as it is created"
|
|
231
|
+
})]
|
|
232
|
+
}),
|
|
233
|
+
/* @__PURE__ */ m("div", {
|
|
234
|
+
className: "grid gap-1.5",
|
|
235
|
+
children: [/* @__PURE__ */ p(v, {
|
|
236
|
+
htmlFor: "baNotes",
|
|
237
|
+
children: "Notes"
|
|
238
|
+
}), /* @__PURE__ */ p(E, {
|
|
239
|
+
id: "baNotes",
|
|
240
|
+
rows: 2,
|
|
241
|
+
value: G,
|
|
242
|
+
onChange: (e) => K(e.target.value),
|
|
243
|
+
placeholder: "Basis for the factors (well-test date, report reference)."
|
|
244
|
+
})]
|
|
245
|
+
}),
|
|
246
|
+
q && /* @__PURE__ */ p("p", {
|
|
247
|
+
role: "alert",
|
|
248
|
+
className: "text-sm text-status-error-text",
|
|
249
|
+
children: q
|
|
250
|
+
}),
|
|
251
|
+
Y && /* @__PURE__ */ m("div", {
|
|
252
|
+
className: "grid gap-2",
|
|
253
|
+
"data-testid": "bulk-allocation-result",
|
|
254
|
+
children: [/* @__PURE__ */ m("p", {
|
|
255
|
+
className: "text-sm text-text-secondary",
|
|
256
|
+
children: [
|
|
257
|
+
Y.dryRun ? "Validation" : "Result",
|
|
258
|
+
": ",
|
|
259
|
+
Y.recordCount,
|
|
260
|
+
" record(s) ·",
|
|
261
|
+
" ",
|
|
262
|
+
Y.dryRun ? `${Y.validatedCount} can be allocated` : `${Y.allocatedCount} allocated${Y.approve ? ` (${Y.approvedCount} approved)` : ""}`,
|
|
263
|
+
" ",
|
|
264
|
+
"· ",
|
|
265
|
+
Y.skippedCount,
|
|
266
|
+
" skipped · ",
|
|
267
|
+
Y.failedCount,
|
|
268
|
+
" failed",
|
|
269
|
+
Y.truncated ? " · more records remain, run again for the rest" : ""
|
|
270
|
+
]
|
|
271
|
+
}), Y.results.length > 0 && /* @__PURE__ */ p("ul", {
|
|
272
|
+
className: "max-h-56 divide-y divide-border-seam overflow-y-auto rounded-lg border border-border-seam",
|
|
273
|
+
children: Y.results.map((i) => /* @__PURE__ */ m("li", {
|
|
274
|
+
className: "flex flex-wrap items-center justify-between gap-2 px-3 py-2 text-sm",
|
|
275
|
+
children: [/* @__PURE__ */ m("span", {
|
|
276
|
+
className: "text-text-secondary",
|
|
277
|
+
children: [
|
|
278
|
+
e(i.periodStart),
|
|
279
|
+
" – ",
|
|
280
|
+
e(i.periodEnd),
|
|
281
|
+
" ·",
|
|
282
|
+
" ",
|
|
283
|
+
/* @__PURE__ */ p("span", {
|
|
284
|
+
className: "tabular-nums",
|
|
285
|
+
children: n(i.measuredVolume, i.unit)
|
|
286
|
+
}),
|
|
287
|
+
i.allocation ? /* @__PURE__ */ m("span", {
|
|
288
|
+
className: "tabular-nums",
|
|
289
|
+
children: [
|
|
290
|
+
" ",
|
|
291
|
+
"· net revenue ",
|
|
292
|
+
t(i.allocation.netRevenueTotal)
|
|
293
|
+
]
|
|
294
|
+
}) : null
|
|
295
|
+
]
|
|
296
|
+
}), /* @__PURE__ */ m("span", {
|
|
297
|
+
className: "flex items-center gap-2",
|
|
298
|
+
children: [i.message && i.outcome !== "SKIPPED" && /* @__PURE__ */ p("span", {
|
|
299
|
+
className: "text-xs text-status-error-text",
|
|
300
|
+
children: i.message
|
|
301
|
+
}), /* @__PURE__ */ p(r, { status: i.outcome })]
|
|
302
|
+
})]
|
|
303
|
+
}, i.productionRecordId))
|
|
304
|
+
})]
|
|
305
|
+
})
|
|
306
|
+
]
|
|
307
|
+
}), /* @__PURE__ */ m(ie, {
|
|
308
|
+
className: "max-md:flex-col-reverse max-md:gap-2",
|
|
309
|
+
children: [
|
|
310
|
+
/* @__PURE__ */ p(h, {
|
|
311
|
+
type: "button",
|
|
312
|
+
variant: "outline",
|
|
313
|
+
className: "max-md:h-11",
|
|
314
|
+
onClick: () => k(!1),
|
|
315
|
+
children: "Close"
|
|
316
|
+
}),
|
|
317
|
+
/* @__PURE__ */ p(h, {
|
|
318
|
+
type: "button",
|
|
319
|
+
variant: "outline",
|
|
320
|
+
className: "max-md:h-11",
|
|
321
|
+
disabled: M.isPending,
|
|
322
|
+
onClick: () => void $(!0),
|
|
323
|
+
children: "Validate"
|
|
324
|
+
}),
|
|
325
|
+
/* @__PURE__ */ p(h, {
|
|
326
|
+
type: "submit",
|
|
327
|
+
className: "max-md:h-11",
|
|
328
|
+
disabled: M.isPending,
|
|
329
|
+
children: M.isPending ? "Working…" : U ? "Allocate and approve" : "Allocate"
|
|
330
|
+
})
|
|
331
|
+
]
|
|
332
|
+
})]
|
|
333
|
+
})]
|
|
334
|
+
})
|
|
335
|
+
});
|
|
336
|
+
}
|
|
337
|
+
//#endregion
|
|
338
|
+
export { O as BulkAllocateSheet };
|
|
339
|
+
|
|
340
|
+
//# sourceMappingURL=BulkAllocateSheet.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BulkAllocateSheet.js","names":[],"sources":["../../../src/theglobalfuel/components/BulkAllocateSheet.tsx"],"sourcesContent":["/**\n * BulkAllocateSheet — apply one set of pro-rata factors (e.g. the latest well\n * tests) to every unallocated production record of a field or facility in a\n * period, in one action (BOFF-10788).\n * @module theglobalfuel/components\n *\n * \"Validate\" runs `theBulkAllocateProduction` as a dry run (nothing is\n * written) so the operator sees which records would be allocated, skipped or\n * refused (for example because the period is closed). \"Allocate\" runs it for\n * real, optionally approving every allocation it creates. Each record is\n * reported with its own outcome.\n */\n\nimport { useMemo, useState } from 'react';\nimport { Plus, Trash2 } from 'lucide-react';\nimport {\n Button,\n Checkbox,\n Input,\n Label,\n Textarea,\n Select,\n SelectContent,\n SelectItem,\n SelectTrigger,\n SelectValue,\n ResponsiveDialog,\n ResponsiveDialogContent,\n ResponsiveDialogHeader,\n ResponsiveDialogTitle,\n ResponsiveDialogDescription,\n ResponsiveDialogFooter,\n} from '@burdenoff/fe-libs/ui';\nimport { useNotify, useTheAllAssets, useTheBulkAllocateProduction } from '../hooks';\nimport { StatusBadge } from './StatusBadge';\nimport { formatDate, formatNumber, formatVolume } from '../utils/formatters';\nimport { newAllocationRow, type AllocationRowState } from '../utils/allocationForm';\nimport { buildBulkAllocationInput } from '../utils/periodClose';\nimport { todayInputDate } from '../utils/productionForm';\nimport type { TheBulkAllocationResult } from '../types';\n\ninterface BulkAllocateSheetProps {\n open: boolean;\n onOpenChange: (open: boolean) => void;\n}\n\nconst monthStart = (today: string): string => `${today.slice(0, 7)}-01`;\n\nexport function BulkAllocateSheet({ open, onOpenChange }: BulkAllocateSheetProps) {\n const notify = useNotify();\n const assetsQuery = useTheAllAssets({ enabled: open });\n const bulkAllocate = useTheBulkAllocateProduction();\n const assets = useMemo(\n () => [...(assetsQuery.data?.items ?? [])].sort((a, b) => a.name.localeCompare(b.name)),\n [assetsQuery.data]\n );\n\n const today = todayInputDate();\n const [measurementAssetId, setMeasurementAssetId] = useState('');\n const [from, setFrom] = useState(() => monthStart(today));\n const [to, setTo] = useState(today);\n const [rows, setRows] = useState<AllocationRowState[]>(() => [newAllocationRow()]);\n const [approve, setApprove] = useState(false);\n const [notes, setNotes] = useState('');\n const [formError, setFormError] = useState<string | null>(null);\n const [result, setResult] = useState<TheBulkAllocationResult | null>(null);\n\n // Fresh form every time the sheet opens.\n const seedKey = open ? 'open' : 'closed';\n const [prevSeedKey, setPrevSeedKey] = useState(seedKey);\n if (seedKey !== prevSeedKey) {\n setPrevSeedKey(seedKey);\n if (open) {\n setMeasurementAssetId('');\n setFrom(monthStart(today));\n setTo(today);\n setRows([newAllocationRow()]);\n setApprove(false);\n setNotes('');\n setFormError(null);\n setResult(null);\n }\n }\n\n const updateRow = (key: string, patch: Partial<AllocationRowState>) => {\n setResult(null);\n setRows((current) => current.map((r) => (r.key === key ? { ...r, ...patch } : r)));\n };\n const removeRow = (key: string) =>\n setRows((current) => (current.length > 1 ? current.filter((r) => r.key !== key) : current));\n\n const run = async (dryRun: boolean) => {\n const built = buildBulkAllocationInput({\n measurementAssetId,\n from,\n to,\n rows,\n approve,\n dryRun,\n notes,\n });\n if (!built.ok) {\n setFormError(built.error);\n notify.error(built.error);\n return;\n }\n setFormError(null);\n try {\n const out = await bulkAllocate.mutateAsync(built.input);\n setResult(out);\n if (dryRun) {\n notify.success(`${out.validatedCount} of ${out.recordCount} record(s) can be allocated`);\n } else {\n notify.success(\n out.approve\n ? `${out.approvedCount} allocation(s) created and approved`\n : `${out.allocatedCount} draft allocation(s) created`\n );\n }\n } catch (err) {\n setFormError(err instanceof Error ? err.message : 'Bulk allocation failed.');\n notify.fromError(err);\n }\n };\n\n return (\n <ResponsiveDialog open={open} onOpenChange={onOpenChange}>\n <ResponsiveDialogContent data-testid=\"bulk-allocate-sheet\" className=\"md:max-w-3xl\">\n <ResponsiveDialogHeader>\n <ResponsiveDialogTitle>Bulk allocate production</ResponsiveDialogTitle>\n <ResponsiveDialogDescription>\n Apply one set of pro-rata factors to every unallocated record measured at a field or\n facility in a period. Records that already have an allocation are left alone.\n </ResponsiveDialogDescription>\n </ResponsiveDialogHeader>\n\n <form\n onSubmit={(e) => {\n e.preventDefault();\n void run(false);\n }}\n >\n <div className=\"grid gap-4 py-2\">\n <div className=\"grid gap-2 md:grid-cols-3\">\n <div className=\"grid gap-1.5\">\n <Label htmlFor=\"baField\">Measured at *</Label>\n <Select\n value={measurementAssetId}\n onValueChange={(v) => {\n setResult(null);\n setMeasurementAssetId(v);\n }}\n >\n <SelectTrigger id=\"baField\" className=\"h-10\">\n <SelectValue placeholder=\"Select a field or facility\" />\n </SelectTrigger>\n <SelectContent>\n {assets.map((a) => (\n <SelectItem key={a.id} value={a.id}>\n {a.name}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n </div>\n <div className=\"grid gap-1.5\">\n <Label htmlFor=\"baFrom\">Period from *</Label>\n <Input\n id=\"baFrom\"\n type=\"date\"\n className=\"h-10\"\n value={from}\n onChange={(e) => {\n setResult(null);\n setFrom(e.target.value);\n }}\n />\n </div>\n <div className=\"grid gap-1.5\">\n <Label htmlFor=\"baTo\">Period to *</Label>\n <Input\n id=\"baTo\"\n type=\"date\"\n className=\"h-10\"\n value={to}\n onChange={(e) => {\n setResult(null);\n setTo(e.target.value);\n }}\n />\n </div>\n </div>\n\n <div className=\"grid gap-3\">\n <p className=\"text-xs text-text-tertiary\">\n Factors can be well-test rates, theoretical volumes or metered shares. Each\n record’s measured volume is split in proportion.\n </p>\n {rows.map((row, i) => (\n <div\n key={row.key}\n className=\"grid grid-cols-1 gap-2 rounded-lg border border-border-seam p-3 md:grid-cols-[minmax(0,2fr)_minmax(0,1fr)_minmax(0,1fr)_minmax(0,1fr)_auto]\"\n data-testid=\"bulk-allocation-row\"\n >\n <div className=\"grid gap-1\">\n <Label htmlFor={`${row.key}-basset`} className=\"text-xs\">\n Contributing asset\n </Label>\n <Select\n value={row.assetId}\n onValueChange={(v) => updateRow(row.key, { assetId: v })}\n >\n <SelectTrigger id={`${row.key}-basset`} className=\"h-10\">\n <SelectValue placeholder=\"Select an asset\" />\n </SelectTrigger>\n <SelectContent>\n {assets.map((a) => (\n <SelectItem key={a.id} value={a.id}>\n {a.name}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n </div>\n <div className=\"grid gap-1\">\n <Label htmlFor={`${row.key}-bfactor`} className=\"text-xs\">\n Factor\n </Label>\n <Input\n id={`${row.key}-bfactor`}\n type=\"number\"\n inputMode=\"decimal\"\n min=\"0\"\n step=\"any\"\n className=\"h-10 tabular-nums\"\n value={row.amount}\n onChange={(e) => updateRow(row.key, { amount: e.target.value })}\n />\n </div>\n <div className=\"grid gap-1\">\n <Label htmlFor={`${row.key}-bwi`} className=\"text-xs\">\n Working interest %\n </Label>\n <Input\n id={`${row.key}-bwi`}\n type=\"number\"\n inputMode=\"decimal\"\n min=\"0\"\n max=\"100\"\n step=\"any\"\n className=\"h-10 tabular-nums\"\n placeholder=\"Asset default\"\n value={row.workingInterestPct}\n onChange={(e) => updateRow(row.key, { workingInterestPct: e.target.value })}\n />\n </div>\n <div className=\"grid gap-1\">\n <Label htmlFor={`${row.key}-broyalty`} className=\"text-xs\">\n Royalty %\n </Label>\n <Input\n id={`${row.key}-broyalty`}\n type=\"number\"\n inputMode=\"decimal\"\n min=\"0\"\n max=\"100\"\n step=\"any\"\n className=\"h-10 tabular-nums\"\n placeholder=\"0\"\n value={row.royaltyPct}\n onChange={(e) => updateRow(row.key, { royaltyPct: e.target.value })}\n />\n </div>\n <div className=\"flex items-end\">\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"icon\"\n aria-label={`Remove row ${i + 1}`}\n disabled={rows.length === 1}\n onClick={() => removeRow(row.key)}\n >\n <Trash2 className=\"h-4 w-4\" />\n </Button>\n </div>\n </div>\n ))}\n <div>\n <Button\n type=\"button\"\n variant=\"outline\"\n size=\"sm\"\n onClick={() => setRows((current) => [...current, newAllocationRow()])}\n >\n <Plus className=\"mr-1.5 h-4 w-4\" /> Add asset\n </Button>\n </div>\n </div>\n\n <div className=\"flex items-center gap-2\">\n <Checkbox\n id=\"baApprove\"\n checked={approve}\n onCheckedChange={(v) => setApprove(v === true)}\n />\n <Label htmlFor=\"baApprove\" className=\"text-sm font-normal\">\n Approve each allocation as it is created\n </Label>\n </div>\n\n <div className=\"grid gap-1.5\">\n <Label htmlFor=\"baNotes\">Notes</Label>\n <Textarea\n id=\"baNotes\"\n rows={2}\n value={notes}\n onChange={(e) => setNotes(e.target.value)}\n placeholder=\"Basis for the factors (well-test date, report reference).\"\n />\n </div>\n\n {formError && (\n <p role=\"alert\" className=\"text-sm text-status-error-text\">\n {formError}\n </p>\n )}\n\n {result && (\n <div className=\"grid gap-2\" data-testid=\"bulk-allocation-result\">\n <p className=\"text-sm text-text-secondary\">\n {result.dryRun ? 'Validation' : 'Result'}: {result.recordCount} record(s) ·{' '}\n {result.dryRun\n ? `${result.validatedCount} can be allocated`\n : `${result.allocatedCount} allocated${result.approve ? ` (${result.approvedCount} approved)` : ''}`}{' '}\n · {result.skippedCount} skipped · {result.failedCount} failed\n {result.truncated ? ' · more records remain, run again for the rest' : ''}\n </p>\n {result.results.length > 0 && (\n <ul className=\"max-h-56 divide-y divide-border-seam overflow-y-auto rounded-lg border border-border-seam\">\n {result.results.map((r) => (\n <li\n key={r.productionRecordId}\n className=\"flex flex-wrap items-center justify-between gap-2 px-3 py-2 text-sm\"\n >\n <span className=\"text-text-secondary\">\n {formatDate(r.periodStart)} – {formatDate(r.periodEnd)} ·{' '}\n <span className=\"tabular-nums\">\n {formatVolume(r.measuredVolume, r.unit)}\n </span>\n {r.allocation ? (\n <span className=\"tabular-nums\">\n {' '}\n · net revenue {formatNumber(r.allocation.netRevenueTotal)}\n </span>\n ) : null}\n </span>\n <span className=\"flex items-center gap-2\">\n {r.message && r.outcome !== 'SKIPPED' && (\n <span className=\"text-xs text-status-error-text\">{r.message}</span>\n )}\n <StatusBadge status={r.outcome} />\n </span>\n </li>\n ))}\n </ul>\n )}\n </div>\n )}\n </div>\n\n <ResponsiveDialogFooter className=\"max-md:flex-col-reverse max-md:gap-2\">\n <Button\n type=\"button\"\n variant=\"outline\"\n className=\"max-md:h-11\"\n onClick={() => onOpenChange(false)}\n >\n Close\n </Button>\n <Button\n type=\"button\"\n variant=\"outline\"\n className=\"max-md:h-11\"\n disabled={bulkAllocate.isPending}\n onClick={() => void run(true)}\n >\n Validate\n </Button>\n <Button type=\"submit\" className=\"max-md:h-11\" disabled={bulkAllocate.isPending}>\n {bulkAllocate.isPending ? 'Working…' : approve ? 'Allocate and approve' : 'Allocate'}\n </Button>\n </ResponsiveDialogFooter>\n </form>\n </ResponsiveDialogContent>\n </ResponsiveDialog>\n );\n}\n"],"mappings":";;;;;;;;;;;;;AA8CA,IAAM,KAAc,MAA0B,GAAG,EAAM,MAAM,GAAG,EAAE,CAAC;AAEnE,SAAgB,EAAkB,EAAE,SAAM,mBAAwC;CAChF,IAAM,IAAS,GAAW,EACpB,IAAc,EAAgB,EAAE,SAAS,GAAM,CAAC,EAChD,IAAe,GAA8B,EAC7C,IAAS,QACP,CAAC,GAAI,EAAY,MAAM,SAAS,EAAE,CAAE,CAAC,MAAM,GAAG,MAAM,EAAE,KAAK,cAAc,EAAE,KAAK,CAAC,EACvF,CAAC,EAAY,KAAK,CACnB,EAEK,IAAQ,GAAgB,EACxB,CAAC,GAAoB,KAAyB,EAAS,GAAG,EAC1D,CAAC,GAAM,KAAW,QAAe,EAAW,EAAM,CAAC,EACnD,CAAC,GAAI,KAAS,EAAS,EAAM,EAC7B,CAAC,GAAM,KAAW,QAAqC,CAAC,GAA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,mBAqBJ,CACL;QACC,CAAA,CAEH;;MAEJ;QAEN,kBAAC,IAAD;KAAwB,WAAU;eAAlC;MACE,kBAAC,GAAD;OACE,MAAK;OACL,SAAQ;OACR,WAAU;OACV,eAAe,EAAa,GAAM;iBACnC;OAEQ,CAAA;MACT,kBAAC,GAAD;OACE,MAAK;OACL,SAAQ;OACR,WAAU;OACV,UAAU,EAAa;OACvB,eAAe,KAAK,EAAI,GAAK;iBAC9B;OAEQ,CAAA;MACT,kBAAC,GAAD;OAAQ,MAAK;OAAS,WAAU;OAAc,UAAU,EAAa;iBAClE,EAAa,YAAY,aAAa,IAAU,yBAAyB;OACnE,CAAA;MACc;OACpB;MACiB;;EACT,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StatusBadge.d.ts","sourceRoot":"","sources":["../../../src/theglobalfuel/components/StatusBadge.tsx"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAIhC,UAAU,gBAAgB;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;
|
|
1
|
+
{"version":3,"file":"StatusBadge.d.ts","sourceRoot":"","sources":["../../../src/theglobalfuel/components/StatusBadge.tsx"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAIhC,UAAU,gBAAgB;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAyHD,eAAO,MAAM,WAAW,EAAE,EAAE,CAAC,gBAAgB,CAsB5C,CAAC"}
|
|
@@ -75,7 +75,14 @@ var i = {
|
|
|
75
75
|
OPEN: "warning",
|
|
76
76
|
IN_PROGRESS: "info",
|
|
77
77
|
VERIFIED: "success",
|
|
78
|
-
FINAL: "success"
|
|
78
|
+
FINAL: "success",
|
|
79
|
+
REOPENED: "warning",
|
|
80
|
+
VALIDATED: "info",
|
|
81
|
+
ALLOCATED: "success",
|
|
82
|
+
SKIPPED: "outline",
|
|
83
|
+
FAILED: "destructive",
|
|
84
|
+
UNALLOCATED: "warning",
|
|
85
|
+
DRAFT_PENDING: "secondary"
|
|
79
86
|
}, s = ({ status: s, className: c }) => {
|
|
80
87
|
let l = s.toUpperCase(), u = o[l] ?? "secondary", d = a.has(l);
|
|
81
88
|
return /* @__PURE__ */ r("span", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StatusBadge.js","names":[],"sources":["../../../src/theglobalfuel/components/StatusBadge.tsx"],"sourcesContent":["/**\n * Status Badge Component\n * @module theglobalfuel/components\n *\n * A colored badge for TheGlobalFuel domain statuses (asset lifecycle, contract\n * lifecycle & side, shipment status, inventory status, compliance status,\n * emission scope, reserve category, pricing basis) with semantic color mapping.\n * Accepts the raw server enum value.\n */\n\nimport type { FC } from 'react';\nimport { cn } from '../utils/cn';\nimport { formatEnumLabel } from '../utils/formatters';\n\ninterface StatusBadgeProps {\n status: string;\n className?: string;\n}\n\ntype BadgeVariant = 'success' | 'warning' | 'destructive' | 'secondary' | 'info' | 'outline';\n\nconst variantStyles: Record<BadgeVariant, string> = {\n success: 'bg-status-success-bg-subtle text-status-success-text',\n warning: 'bg-status-warning-bg-subtle text-status-warning-text',\n destructive: 'bg-status-error-bg-subtle text-status-error-text',\n secondary: 'bg-bg-sunken text-text-secondary',\n info: 'bg-[var(--color-accent-soft)] text-text-primary',\n outline: 'border border-border-seam text-text-primary',\n};\n\n// Statuses that represent a \"live\" / in-progress condition get a subtle,\n// opacity-only glow pulse (reduced-motion safe via motion-safe:).\nconst liveStatuses = new Set(['PRODUCING', 'ACTIVE', 'IN_TRANSIT', 'LOADING']);\n\nconst statusVariantMap: Record<string, BadgeVariant> = {\n // Asset lifecycle\n EXPLORATION: 'secondary',\n APPRAISAL: 'info',\n DEVELOPMENT: 'warning',\n PRODUCING: 'success',\n SUSPENDED: 'warning',\n DECOMMISSIONING: 'warning',\n RETIRED: 'outline',\n\n // Offtake-contract lifecycle\n DRAFT: 'secondary',\n NEGOTIATION: 'info',\n SIGNED: 'info',\n ACTIVE: 'success',\n COMPLETED: 'success',\n TERMINATED: 'destructive',\n\n // Contract side\n BUY: 'info',\n SELL: 'secondary',\n\n // Pricing basis\n FIXED: 'outline',\n INDEX_LINKED: 'outline',\n FORMULA: 'outline',\n SPOT: 'secondary',\n\n // Shipment status\n SCHEDULED: 'secondary',\n LOADING: 'info',\n IN_TRANSIT: 'warning',\n DELIVERED: 'success',\n CANCELLED: 'destructive',\n\n // Inventory status\n AVAILABLE: 'success',\n RESERVED: 'info',\n CONSUMED: 'outline',\n WRITTEN_OFF: 'destructive',\n\n // Compliance status\n PENDING: 'secondary',\n SUBMITTED: 'info',\n APPROVED: 'success',\n REVERSED: 'outline',\n REJECTED: 'destructive',\n EXPIRED: 'warning',\n REVOKED: 'destructive',\n\n // Emission scope\n SCOPE_1: 'destructive',\n SCOPE_2: 'warning',\n SCOPE_3: 'info',\n\n // Reserve category\n PROVED: 'success',\n PROBABLE: 'info',\n POSSIBLE: 'warning',\n CONTINGENT: 'secondary',\n PROSPECTIVE: 'outline',\n\n // Safety incident category\n NEAR_MISS: 'info',\n INJURY: 'destructive',\n SPILL: 'warning',\n RELEASE: 'warning',\n EQUIPMENT_FAILURE: 'secondary',\n\n // Safety incident severity\n LOW: 'secondary',\n MEDIUM: 'warning',\n HIGH: 'destructive',\n CRITICAL: 'destructive',\n\n // Safety incident investigation lifecycle\n REPORTED: 'secondary',\n INVESTIGATING: 'info',\n ROOT_CAUSE_IDENTIFIED: 'warning',\n CORRECTIVE_ACTION: 'warning',\n CLOSED: 'success',\n\n // Corrective/preventive action lifecycle\n OPEN: 'warning',\n IN_PROGRESS: 'info',\n VERIFIED: 'success',\n\n // ESG disclosure status (DRAFT is shared with the contract lifecycle above)\n FINAL: 'success',\n};\n\nexport const StatusBadge: FC<StatusBadgeProps> = ({ status, className }) => {\n const key = status.toUpperCase();\n const variant = statusVariantMap[key] ?? 'secondary';\n const isLive = liveStatuses.has(key);\n\n return (\n <span\n className={cn(\n 'inline-flex items-center gap-1.5 rounded-full px-2.5 py-0.5 text-xs font-medium',\n variantStyles[variant],\n className\n )}\n >\n {isLive && (\n <span\n aria-hidden=\"true\"\n className=\"size-1.5 rounded-full bg-current motion-safe:animate-vc-glow-pulse\"\n />\n )}\n {formatEnumLabel(status)}\n </span>\n );\n};\n"],"mappings":";;;;AAqBA,IAAM,IAA8C;CAClD,SAAS;CACT,SAAS;CACT,aAAa;CACb,WAAW;CACX,MAAM;CACN,SAAS;CACV,EAIK,IAAe,IAAI,IAAI;CAAC;CAAa;CAAU;CAAc;CAAU,CAAC,EAExE,IAAiD;CAErD,aAAa;CACb,WAAW;CACX,aAAa;CACb,WAAW;CACX,WAAW;CACX,iBAAiB;CACjB,SAAS;CAGT,OAAO;CACP,aAAa;CACb,QAAQ;CACR,QAAQ;CACR,WAAW;CACX,YAAY;CAGZ,KAAK;CACL,MAAM;CAGN,OAAO;CACP,cAAc;CACd,SAAS;CACT,MAAM;CAGN,WAAW;CACX,SAAS;CACT,YAAY;CACZ,WAAW;CACX,WAAW;CAGX,WAAW;CACX,UAAU;CACV,UAAU;CACV,aAAa;CAGb,SAAS;CACT,WAAW;CACX,UAAU;CACV,UAAU;CACV,UAAU;CACV,SAAS;CACT,SAAS;CAGT,SAAS;CACT,SAAS;CACT,SAAS;CAGT,QAAQ;CACR,UAAU;CACV,UAAU;CACV,YAAY;CACZ,aAAa;CAGb,WAAW;CACX,QAAQ;CACR,OAAO;CACP,SAAS;CACT,mBAAmB;CAGnB,KAAK;CACL,QAAQ;CACR,MAAM;CACN,UAAU;CAGV,UAAU;CACV,eAAe;CACf,uBAAuB;CACvB,mBAAmB;CACnB,QAAQ;CAGR,MAAM;CACN,aAAa;CACb,UAAU;CAGV,OAAO;
|
|
1
|
+
{"version":3,"file":"StatusBadge.js","names":[],"sources":["../../../src/theglobalfuel/components/StatusBadge.tsx"],"sourcesContent":["/**\n * Status Badge Component\n * @module theglobalfuel/components\n *\n * A colored badge for TheGlobalFuel domain statuses (asset lifecycle, contract\n * lifecycle & side, shipment status, inventory status, compliance status,\n * emission scope, reserve category, pricing basis) with semantic color mapping.\n * Accepts the raw server enum value.\n */\n\nimport type { FC } from 'react';\nimport { cn } from '../utils/cn';\nimport { formatEnumLabel } from '../utils/formatters';\n\ninterface StatusBadgeProps {\n status: string;\n className?: string;\n}\n\ntype BadgeVariant = 'success' | 'warning' | 'destructive' | 'secondary' | 'info' | 'outline';\n\nconst variantStyles: Record<BadgeVariant, string> = {\n success: 'bg-status-success-bg-subtle text-status-success-text',\n warning: 'bg-status-warning-bg-subtle text-status-warning-text',\n destructive: 'bg-status-error-bg-subtle text-status-error-text',\n secondary: 'bg-bg-sunken text-text-secondary',\n info: 'bg-[var(--color-accent-soft)] text-text-primary',\n outline: 'border border-border-seam text-text-primary',\n};\n\n// Statuses that represent a \"live\" / in-progress condition get a subtle,\n// opacity-only glow pulse (reduced-motion safe via motion-safe:).\nconst liveStatuses = new Set(['PRODUCING', 'ACTIVE', 'IN_TRANSIT', 'LOADING']);\n\nconst statusVariantMap: Record<string, BadgeVariant> = {\n // Asset lifecycle\n EXPLORATION: 'secondary',\n APPRAISAL: 'info',\n DEVELOPMENT: 'warning',\n PRODUCING: 'success',\n SUSPENDED: 'warning',\n DECOMMISSIONING: 'warning',\n RETIRED: 'outline',\n\n // Offtake-contract lifecycle\n DRAFT: 'secondary',\n NEGOTIATION: 'info',\n SIGNED: 'info',\n ACTIVE: 'success',\n COMPLETED: 'success',\n TERMINATED: 'destructive',\n\n // Contract side\n BUY: 'info',\n SELL: 'secondary',\n\n // Pricing basis\n FIXED: 'outline',\n INDEX_LINKED: 'outline',\n FORMULA: 'outline',\n SPOT: 'secondary',\n\n // Shipment status\n SCHEDULED: 'secondary',\n LOADING: 'info',\n IN_TRANSIT: 'warning',\n DELIVERED: 'success',\n CANCELLED: 'destructive',\n\n // Inventory status\n AVAILABLE: 'success',\n RESERVED: 'info',\n CONSUMED: 'outline',\n WRITTEN_OFF: 'destructive',\n\n // Compliance status\n PENDING: 'secondary',\n SUBMITTED: 'info',\n APPROVED: 'success',\n REVERSED: 'outline',\n REJECTED: 'destructive',\n EXPIRED: 'warning',\n REVOKED: 'destructive',\n\n // Emission scope\n SCOPE_1: 'destructive',\n SCOPE_2: 'warning',\n SCOPE_3: 'info',\n\n // Reserve category\n PROVED: 'success',\n PROBABLE: 'info',\n POSSIBLE: 'warning',\n CONTINGENT: 'secondary',\n PROSPECTIVE: 'outline',\n\n // Safety incident category\n NEAR_MISS: 'info',\n INJURY: 'destructive',\n SPILL: 'warning',\n RELEASE: 'warning',\n EQUIPMENT_FAILURE: 'secondary',\n\n // Safety incident severity\n LOW: 'secondary',\n MEDIUM: 'warning',\n HIGH: 'destructive',\n CRITICAL: 'destructive',\n\n // Safety incident investigation lifecycle\n REPORTED: 'secondary',\n INVESTIGATING: 'info',\n ROOT_CAUSE_IDENTIFIED: 'warning',\n CORRECTIVE_ACTION: 'warning',\n CLOSED: 'success',\n\n // Corrective/preventive action lifecycle\n OPEN: 'warning',\n IN_PROGRESS: 'info',\n VERIFIED: 'success',\n\n // ESG disclosure status (DRAFT is shared with the contract lifecycle above)\n FINAL: 'success',\n\n // Allocation period close (CLOSED is shared with the incident lifecycle above)\n REOPENED: 'warning',\n\n // Bulk allocation outcomes (APPROVED is shared above)\n VALIDATED: 'info',\n ALLOCATED: 'success',\n SKIPPED: 'outline',\n FAILED: 'destructive',\n\n // Allocation exceptions\n UNALLOCATED: 'warning',\n DRAFT_PENDING: 'secondary',\n};\n\nexport const StatusBadge: FC<StatusBadgeProps> = ({ status, className }) => {\n const key = status.toUpperCase();\n const variant = statusVariantMap[key] ?? 'secondary';\n const isLive = liveStatuses.has(key);\n\n return (\n <span\n className={cn(\n 'inline-flex items-center gap-1.5 rounded-full px-2.5 py-0.5 text-xs font-medium',\n variantStyles[variant],\n className\n )}\n >\n {isLive && (\n <span\n aria-hidden=\"true\"\n className=\"size-1.5 rounded-full bg-current motion-safe:animate-vc-glow-pulse\"\n />\n )}\n {formatEnumLabel(status)}\n </span>\n );\n};\n"],"mappings":";;;;AAqBA,IAAM,IAA8C;CAClD,SAAS;CACT,SAAS;CACT,aAAa;CACb,WAAW;CACX,MAAM;CACN,SAAS;CACV,EAIK,IAAe,IAAI,IAAI;CAAC;CAAa;CAAU;CAAc;CAAU,CAAC,EAExE,IAAiD;CAErD,aAAa;CACb,WAAW;CACX,aAAa;CACb,WAAW;CACX,WAAW;CACX,iBAAiB;CACjB,SAAS;CAGT,OAAO;CACP,aAAa;CACb,QAAQ;CACR,QAAQ;CACR,WAAW;CACX,YAAY;CAGZ,KAAK;CACL,MAAM;CAGN,OAAO;CACP,cAAc;CACd,SAAS;CACT,MAAM;CAGN,WAAW;CACX,SAAS;CACT,YAAY;CACZ,WAAW;CACX,WAAW;CAGX,WAAW;CACX,UAAU;CACV,UAAU;CACV,aAAa;CAGb,SAAS;CACT,WAAW;CACX,UAAU;CACV,UAAU;CACV,UAAU;CACV,SAAS;CACT,SAAS;CAGT,SAAS;CACT,SAAS;CACT,SAAS;CAGT,QAAQ;CACR,UAAU;CACV,UAAU;CACV,YAAY;CACZ,aAAa;CAGb,WAAW;CACX,QAAQ;CACR,OAAO;CACP,SAAS;CACT,mBAAmB;CAGnB,KAAK;CACL,QAAQ;CACR,MAAM;CACN,UAAU;CAGV,UAAU;CACV,eAAe;CACf,uBAAuB;CACvB,mBAAmB;CACnB,QAAQ;CAGR,MAAM;CACN,aAAa;CACb,UAAU;CAGV,OAAO;CAGP,UAAU;CAGV,WAAW;CACX,WAAW;CACX,SAAS;CACT,QAAQ;CAGR,aAAa;CACb,eAAe;CAChB,EAEY,KAAqC,EAAE,WAAQ,mBAAgB;CAC1E,IAAM,IAAM,EAAO,aAAa,EAC1B,IAAU,EAAiB,MAAQ,aACnC,IAAS,EAAa,IAAI,EAAI;AAEpC,QACE,kBAAC,QAAD;EACE,WAAW,EACT,mFACA,EAAc,IACd,EACD;YALH,CAOG,KACC,kBAAC,QAAD;GACE,eAAY;GACZ,WAAU;GACV,CAAA,EAEH,EAAgB,EAAO,CACnB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { QuotaOverviewRow } from '../utils/quotaUsage';
|
|
2
|
-
import { TheConnection, TheAsset, TheAssetKind, TheAssetStatus, TheCommodityType, TheProductionRecord, TheReserveEstimate, TheReserveCategory, TheOfftakeContract, TheContractSide, TheContractStatus, TheShipment, TheShipmentStatus, TheInventoryLot, TheInventoryStatus, TheEmissionRecord, TheEmissionScope, TheComplianceCert, TheComplianceCategory, TheComplianceStatus, TheEsgDisclosure, TheEsgFramework, TheGenerateEsgDisclosureInput, TheCreateAssetInput, TheUpdateAssetInput, TheRecordProductionInput, TheProductionAllocation, TheAllocationStatus, TheCreateProductionAllocationInput, TheNetProductionPosition, TheCreateReserveEstimateInput, TheCreateOfftakeContractInput, TheUpdateOfftakeContractInput, TheCreateShipmentInput, TheUpdateShipmentInput, TheCreateInventoryLotInput, TheRecordEmissionInput, TheCreateComplianceCertInput, TheSafetyIncident, TheSafetyIncidentCategory, TheSafetyIncidentSeverity, TheSafetyIncidentStatus, TheCorrectiveAction, TheCorrectiveActionStatus, TheSafetyDashboard, TheReportSafetyIncidentInput, TheCreateCorrectiveActionInput, PaginationInput } from '../types';
|
|
2
|
+
import { TheConnection, TheAsset, TheAssetKind, TheAssetStatus, TheCommodityType, TheProductionRecord, TheReserveEstimate, TheReserveCategory, TheOfftakeContract, TheContractSide, TheContractStatus, TheShipment, TheShipmentStatus, TheInventoryLot, TheInventoryStatus, TheEmissionRecord, TheEmissionScope, TheComplianceCert, TheComplianceCategory, TheComplianceStatus, TheEsgDisclosure, TheEsgFramework, TheGenerateEsgDisclosureInput, TheCreateAssetInput, TheUpdateAssetInput, TheRecordProductionInput, TheProductionAllocation, TheAllocationStatus, TheCreateProductionAllocationInput, TheNetProductionPosition, TheAllocationPeriodClose, TheAllocationPeriodStatus, TheCloseAllocationPeriodInput, TheBulkAllocateProductionInput, TheBulkAllocationResult, TheAllocationException, TheAllocationStatement, TheCreateReserveEstimateInput, TheCreateOfftakeContractInput, TheUpdateOfftakeContractInput, TheCreateShipmentInput, TheUpdateShipmentInput, TheCreateInventoryLotInput, TheRecordEmissionInput, TheCreateComplianceCertInput, TheSafetyIncident, TheSafetyIncidentCategory, TheSafetyIncidentSeverity, TheSafetyIncidentStatus, TheCorrectiveAction, TheCorrectiveActionStatus, TheSafetyDashboard, TheReportSafetyIncidentInput, TheCreateCorrectiveActionInput, PaginationInput } from '../types';
|
|
3
3
|
|
|
4
4
|
/** Quota assignments are workspace-scoped and must not survive a context switch. */
|
|
5
5
|
export declare const useTheQuotaOverview: () => import('@tanstack/react-query').UseQueryResult<QuotaOverviewRow[], Error>;
|
|
@@ -62,6 +62,36 @@ export interface NetPositionWindow {
|
|
|
62
62
|
assetId?: string;
|
|
63
63
|
}
|
|
64
64
|
export declare const useTheNetProductionPosition: (window: NetPositionWindow, options?: QueryToggle) => import('@tanstack/react-query').UseQueryResult<TheNetProductionPosition, Error>;
|
|
65
|
+
export interface PeriodCloseFilters {
|
|
66
|
+
status?: TheAllocationPeriodStatus;
|
|
67
|
+
assetId?: string;
|
|
68
|
+
pagination?: PaginationInput;
|
|
69
|
+
}
|
|
70
|
+
/** Period closes, newest period first — including REOPENED rows (the audit trail). */
|
|
71
|
+
export declare const useTheAllocationPeriodCloses: (filters?: PeriodCloseFilters) => import('@tanstack/react-query').UseQueryResult<TheConnection<TheAllocationPeriodClose>, Error>;
|
|
72
|
+
export declare const useTheCloseAllocationPeriod: () => import('@tanstack/react-query').UseMutationResult<TheAllocationPeriodClose, Error, TheCloseAllocationPeriodInput, unknown>;
|
|
73
|
+
export declare const useTheReopenAllocationPeriod: () => import('@tanstack/react-query').UseMutationResult<TheAllocationPeriodClose, Error, {
|
|
74
|
+
id: string;
|
|
75
|
+
reason: string;
|
|
76
|
+
}, unknown>;
|
|
77
|
+
export interface AllocationExceptionsPage {
|
|
78
|
+
items: TheAllocationException[];
|
|
79
|
+
pageInfo: TheConnection<TheAllocationException>['pageInfo'];
|
|
80
|
+
totalCount: number;
|
|
81
|
+
}
|
|
82
|
+
/** Records inside a closed period with no approved allocation (offset paging). */
|
|
83
|
+
export declare const useTheAllocationExceptions: (filters?: {
|
|
84
|
+
measurementAssetId?: string;
|
|
85
|
+
pagination?: PaginationInput;
|
|
86
|
+
}) => import('@tanstack/react-query').UseQueryResult<AllocationExceptionsPage, Error>;
|
|
87
|
+
export interface AllocationStatementWindow {
|
|
88
|
+
periodStart: string;
|
|
89
|
+
periodEnd: string;
|
|
90
|
+
measurementAssetId?: string;
|
|
91
|
+
}
|
|
92
|
+
/** Allocation statement for a window (net position, detail, closes and CSV). */
|
|
93
|
+
export declare const useTheAllocationStatement: (window: AllocationStatementWindow | null, options?: QueryToggle) => import('@tanstack/react-query').UseQueryResult<TheAllocationStatement, Error>;
|
|
94
|
+
export declare const useTheBulkAllocateProduction: () => import('@tanstack/react-query').UseMutationResult<TheBulkAllocationResult, Error, TheBulkAllocateProductionInput, unknown>;
|
|
65
95
|
export declare const useTheCreateProductionAllocation: () => import('@tanstack/react-query').UseMutationResult<TheProductionAllocation, Error, TheCreateProductionAllocationInput, unknown>;
|
|
66
96
|
export declare const useTheApproveProductionAllocation: () => import('@tanstack/react-query').UseMutationResult<TheProductionAllocation, Error, string, unknown>;
|
|
67
97
|
export declare const useTheReverseProductionAllocation: () => import('@tanstack/react-query').UseMutationResult<TheProductionAllocation, Error, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTheGlobalFuelApi.d.ts","sourceRoot":"","sources":["../../../src/theglobalfuel/hooks/useTheGlobalFuelApi.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAMH,OAAO,EAAyB,KAAK,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEnF,OAAO,KAAK,EACV,aAAa,EACb,QAAQ,EACR,YAAY,EACZ,cAAc,EACd,gBAAgB,EAChB,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,EAClB,eAAe,EACf,iBAAiB,EACjB,WAAW,EACX,iBAAiB,EACjB,eAAe,EACf,kBAAkB,EAClB,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EACjB,qBAAqB,EACrB,mBAAmB,EACnB,gBAAgB,EAChB,eAAe,EACf,6BAA6B,EAC7B,mBAAmB,EACnB,mBAAmB,EACnB,wBAAwB,EACxB,uBAAuB,EACvB,mBAAmB,EACnB,kCAAkC,EAClC,wBAAwB,EACxB,6BAA6B,EAC7B,6BAA6B,EAC7B,6BAA6B,EAC7B,sBAAsB,EACtB,sBAAsB,EACtB,0BAA0B,EAC1B,sBAAsB,EACtB,4BAA4B,EAC5B,iBAAiB,EACjB,yBAAyB,EACzB,yBAAyB,EACzB,uBAAuB,EACvB,mBAAmB,EACnB,yBAAyB,EACzB,kBAAkB,EAClB,4BAA4B,EAC5B,8BAA8B,EAC9B,eAAe,EAChB,MAAM,UAAU,CAAC;AAmDlB,oFAAoF;AACpF,eAAO,MAAM,mBAAmB,iFAiB/B,CAAC;
|
|
1
|
+
{"version":3,"file":"useTheGlobalFuelApi.d.ts","sourceRoot":"","sources":["../../../src/theglobalfuel/hooks/useTheGlobalFuelApi.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAMH,OAAO,EAAyB,KAAK,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEnF,OAAO,KAAK,EACV,aAAa,EACb,QAAQ,EACR,YAAY,EACZ,cAAc,EACd,gBAAgB,EAChB,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,EAClB,eAAe,EACf,iBAAiB,EACjB,WAAW,EACX,iBAAiB,EACjB,eAAe,EACf,kBAAkB,EAClB,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EACjB,q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