@burdenoff/microfe-theglobalfuel 2026.1107.2 → 2026.1107.3
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/AllocateProductionSheet.d.ts.map +1 -1
- package/dist/theglobalfuel/components/AllocateProductionSheet.js +213 -164
- package/dist/theglobalfuel/components/AllocateProductionSheet.js.map +1 -1
- package/dist/theglobalfuel/components/AssignEntitlementDialog.d.ts +11 -0
- package/dist/theglobalfuel/components/AssignEntitlementDialog.d.ts.map +1 -0
- package/dist/theglobalfuel/components/AssignEntitlementDialog.js +117 -0
- package/dist/theglobalfuel/components/AssignEntitlementDialog.js.map +1 -0
- package/dist/theglobalfuel/components/ConfirmActionDialog.d.ts +17 -0
- package/dist/theglobalfuel/components/ConfirmActionDialog.d.ts.map +1 -0
- package/dist/theglobalfuel/components/ConfirmActionDialog.js +29 -0
- package/dist/theglobalfuel/components/ConfirmActionDialog.js.map +1 -0
- package/dist/theglobalfuel/components/InterestDeckSheet.d.ts +21 -0
- package/dist/theglobalfuel/components/InterestDeckSheet.d.ts.map +1 -0
- package/dist/theglobalfuel/components/InterestDeckSheet.js +287 -0
- package/dist/theglobalfuel/components/InterestDeckSheet.js.map +1 -0
- package/dist/theglobalfuel/components/StatusBadge.d.ts.map +1 -1
- package/dist/theglobalfuel/components/StatusBadge.js +7 -1
- package/dist/theglobalfuel/components/StatusBadge.js.map +1 -1
- package/dist/theglobalfuel/hooks/useTheGlobalFuelApi.d.ts +27 -1
- package/dist/theglobalfuel/hooks/useTheGlobalFuelApi.d.ts.map +1 -1
- package/dist/theglobalfuel/hooks/useTheGlobalFuelApi.js +221 -117
- package/dist/theglobalfuel/hooks/useTheGlobalFuelApi.js.map +1 -1
- package/dist/theglobalfuel/pages/production/AllocationsPanel.d.ts +4 -1
- package/dist/theglobalfuel/pages/production/AllocationsPanel.d.ts.map +1 -1
- package/dist/theglobalfuel/pages/production/AllocationsPanel.js +206 -165
- package/dist/theglobalfuel/pages/production/AllocationsPanel.js.map +1 -1
- package/dist/theglobalfuel/pages/production/EntitlementsPanel.d.ts +14 -0
- package/dist/theglobalfuel/pages/production/EntitlementsPanel.d.ts.map +1 -0
- package/dist/theglobalfuel/pages/production/EntitlementsPanel.js +205 -0
- package/dist/theglobalfuel/pages/production/EntitlementsPanel.js.map +1 -0
- package/dist/theglobalfuel/pages/production/InterestDecksPanel.d.ts +12 -0
- package/dist/theglobalfuel/pages/production/InterestDecksPanel.d.ts.map +1 -0
- package/dist/theglobalfuel/pages/production/InterestDecksPanel.js +243 -0
- package/dist/theglobalfuel/pages/production/InterestDecksPanel.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 +109 -95
- package/dist/theglobalfuel/pages/production/ProductionPage.js.map +1 -1
- package/dist/theglobalfuel/types/index.d.ts +83 -0
- package/dist/theglobalfuel/types/index.d.ts.map +1 -1
- package/dist/theglobalfuel/utils/allocationForm.d.ts +30 -4
- package/dist/theglobalfuel/utils/allocationForm.d.ts.map +1 -1
- package/dist/theglobalfuel/utils/allocationForm.js +43 -25
- package/dist/theglobalfuel/utils/allocationForm.js.map +1 -1
- package/dist/theglobalfuel/utils/interestDeckForm.d.ts +64 -0
- package/dist/theglobalfuel/utils/interestDeckForm.d.ts.map +1 -0
- package/dist/theglobalfuel/utils/interestDeckForm.js +140 -0
- package/dist/theglobalfuel/utils/interestDeckForm.js.map +1 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AllocateProductionSheet.d.ts","sourceRoot":"","sources":["../../../src/theglobalfuel/components/AllocateProductionSheet.tsx"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"AllocateProductionSheet.d.ts","sourceRoot":"","sources":["../../../src/theglobalfuel/components/AllocateProductionSheet.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAqCH,OAAO,KAAK,EAAuB,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAEzE,UAAU,4BAA4B;IACpC,IAAI,EAAE,OAAO,CAAC;IACd,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACtC,kFAAkF;IAClF,MAAM,EAAE,mBAAmB,GAAG,IAAI,CAAC;IACnC,sDAAsD;IACtD,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED,wBAAgB,uBAAuB,CAAC,EACtC,IAAI,EACJ,YAAY,EACZ,MAAM,EACN,oBAAoB,GACrB,EAAE,4BAA4B,+BAkW9B"}
|
|
@@ -1,53 +1,75 @@
|
|
|
1
1
|
import { cn as e } from "../utils/cn.js";
|
|
2
2
|
import { formatDate as t, formatNumber as n, formatVolume as r } from "../utils/formatters.js";
|
|
3
|
-
import { useTheAllAssets as i,
|
|
4
|
-
import { useNotify as
|
|
3
|
+
import { useTheAllAssets as i, useTheAllInterestDecks as a, useTheCreateProductionAllocation as o } from "../hooks/useTheGlobalFuelApi.js";
|
|
4
|
+
import { useNotify as s } from "../hooks/useNotify.js";
|
|
5
5
|
import "../hooks/index.js";
|
|
6
|
-
import { buildAllocationInput as
|
|
6
|
+
import { buildAllocationInput as ee, newAllocationRow as c, previewAllocation as te } from "../utils/allocationForm.js";
|
|
7
|
+
import { resolveDeckForPeriod as ne } from "../utils/interestDeckForm.js";
|
|
7
8
|
import { useMemo as l, useState as u } from "react";
|
|
8
|
-
import { Plus as
|
|
9
|
+
import { Plus as re, Trash2 as d } from "lucide-react";
|
|
9
10
|
import { jsx as f, jsxs as p } from "react/jsx-runtime";
|
|
10
|
-
import { Button as m, Input as h, Label as g, ResponsiveDialog as _, ResponsiveDialogContent as v, ResponsiveDialogDescription as y, ResponsiveDialogFooter as b, ResponsiveDialogHeader as
|
|
11
|
+
import { Button as m, Input as h, Label as g, ResponsiveDialog as _, ResponsiveDialogContent as v, ResponsiveDialogDescription as y, ResponsiveDialogFooter as b, ResponsiveDialogHeader as ie, ResponsiveDialogTitle as ae, Select as x, SelectContent as S, SelectItem as C, SelectTrigger as w, SelectValue as T, Textarea as E } from "@burdenoff/fe-libs/ui";
|
|
11
12
|
//#region src/theglobalfuel/components/AllocateProductionSheet.tsx
|
|
12
|
-
function
|
|
13
|
-
let
|
|
13
|
+
function D({ open: D, onOpenChange: O, record: k, measurementAssetName: A }) {
|
|
14
|
+
let j = s(), M = i({ enabled: D }), N = o(), P = l(() => [...M.data?.items ?? []].sort((e, t) => e.name.localeCompare(t.name)), [M.data]), oe = l(() => {
|
|
14
15
|
let e = /* @__PURE__ */ new Map();
|
|
15
|
-
for (let t of
|
|
16
|
+
for (let t of P) e.set(t.id, t.workingInterestPct);
|
|
16
17
|
return e;
|
|
17
|
-
}, [
|
|
18
|
-
|
|
19
|
-
let
|
|
18
|
+
}, [P]), [F, I] = u("MANUAL"), [L, R] = u(() => [c()]), [z, B] = u(""), [V, H] = u(null), U = D && k ? `open:${k.id}` : "closed", [W, G] = u(U);
|
|
19
|
+
U !== W && (G(U), D && k && (I("MANUAL"), R([c()]), B(""), H(null)));
|
|
20
|
+
let K = a({ enabled: D }), se = l(() => K.data?.items ?? [], [K.data]), q = (e) => {
|
|
21
|
+
let t = oe.get(e) ?? 100;
|
|
22
|
+
if (!k || !e) return {
|
|
23
|
+
workingInterestPct: t,
|
|
24
|
+
royaltyPct: 0,
|
|
25
|
+
overridingRoyaltyPct: 0,
|
|
26
|
+
source: "ASSET_DEFAULT"
|
|
27
|
+
};
|
|
28
|
+
let n = ne(se, e, k.periodStart, k.periodEnd);
|
|
29
|
+
return n.kind === "deck" ? {
|
|
30
|
+
workingInterestPct: n.workingInterestPct,
|
|
31
|
+
royaltyPct: n.deck.royaltyPct,
|
|
32
|
+
overridingRoyaltyPct: n.deck.overridingRoyaltyPct,
|
|
33
|
+
source: "INTEREST_DECK",
|
|
34
|
+
effectiveFrom: n.deck.effectiveFrom
|
|
35
|
+
} : {
|
|
36
|
+
workingInterestPct: t,
|
|
37
|
+
royaltyPct: 0,
|
|
38
|
+
overridingRoyaltyPct: 0,
|
|
39
|
+
source: n.kind === "spans" ? "SPANS" : "ASSET_DEFAULT"
|
|
40
|
+
};
|
|
41
|
+
}, J = k?.volume ?? 0, Y = k?.unit ?? "BARRELS", X = te(F, J, L, q), Z = (e, t) => R((n) => n.map((n) => n.key === e ? {
|
|
20
42
|
...n,
|
|
21
43
|
...t
|
|
22
|
-
} : n)),
|
|
23
|
-
if (!
|
|
24
|
-
let e =
|
|
25
|
-
productionRecordId:
|
|
26
|
-
method:
|
|
27
|
-
measuredVolume:
|
|
28
|
-
rows:
|
|
29
|
-
notes:
|
|
44
|
+
} : n)), ce = (e) => R((t) => t.length > 1 ? t.filter((t) => t.key !== e) : t), Q = () => O(!1), le = async () => {
|
|
45
|
+
if (!k) return;
|
|
46
|
+
let e = ee({
|
|
47
|
+
productionRecordId: k.id,
|
|
48
|
+
method: F,
|
|
49
|
+
measuredVolume: J,
|
|
50
|
+
rows: L,
|
|
51
|
+
notes: z
|
|
30
52
|
});
|
|
31
53
|
if (!e.ok) {
|
|
32
|
-
|
|
54
|
+
H(e.error), j.error(e.error);
|
|
33
55
|
return;
|
|
34
56
|
}
|
|
35
|
-
|
|
57
|
+
H(null);
|
|
36
58
|
try {
|
|
37
|
-
await
|
|
59
|
+
await N.mutateAsync(e.input), j.success("Allocation drafted — approve it to lock the split"), Q();
|
|
38
60
|
} catch (e) {
|
|
39
|
-
|
|
61
|
+
H(e instanceof Error ? e.message : "Failed to allocate production."), j.fromError(e);
|
|
40
62
|
}
|
|
41
|
-
},
|
|
63
|
+
}, $ = F === "PRO_RATA" ? "Factor" : "Volume";
|
|
42
64
|
return /* @__PURE__ */ f(_, {
|
|
43
|
-
open:
|
|
44
|
-
onOpenChange:
|
|
65
|
+
open: D && !!k,
|
|
66
|
+
onOpenChange: O,
|
|
45
67
|
children: /* @__PURE__ */ p(v, {
|
|
46
68
|
"data-testid": "allocate-production-sheet",
|
|
47
69
|
className: "md:max-w-3xl",
|
|
48
|
-
children: [/* @__PURE__ */ p(
|
|
70
|
+
children: [/* @__PURE__ */ p(ie, { children: [/* @__PURE__ */ f(ae, { children: "Allocate production" }), /* @__PURE__ */ f(y, { children: k ? `${r(k.volume, k.unit)} measured at ${A ?? "this asset"}, ${t(k.periodStart)} – ${t(k.periodEnd)}.` : "" })] }), /* @__PURE__ */ p("form", {
|
|
49
71
|
onSubmit: (e) => {
|
|
50
|
-
e.preventDefault(),
|
|
72
|
+
e.preventDefault(), le();
|
|
51
73
|
},
|
|
52
74
|
children: [/* @__PURE__ */ p("div", {
|
|
53
75
|
className: "grid gap-4 py-2",
|
|
@@ -59,175 +81,202 @@ function k({ open: k, onOpenChange: A, record: j, measurementAssetName: M }) {
|
|
|
59
81
|
htmlFor: "alMethod",
|
|
60
82
|
children: "Method"
|
|
61
83
|
}),
|
|
62
|
-
/* @__PURE__ */ p(
|
|
63
|
-
value:
|
|
64
|
-
onValueChange: (e) =>
|
|
65
|
-
children: [/* @__PURE__ */ f(
|
|
84
|
+
/* @__PURE__ */ p(x, {
|
|
85
|
+
value: F,
|
|
86
|
+
onValueChange: (e) => I(e),
|
|
87
|
+
children: [/* @__PURE__ */ f(w, {
|
|
66
88
|
id: "alMethod",
|
|
67
89
|
className: "h-11 md:h-10 md:w-72",
|
|
68
|
-
children: /* @__PURE__ */ f(
|
|
69
|
-
}), /* @__PURE__ */ p(
|
|
90
|
+
children: /* @__PURE__ */ f(T, {})
|
|
91
|
+
}), /* @__PURE__ */ p(S, { children: [/* @__PURE__ */ f(C, {
|
|
70
92
|
value: "MANUAL",
|
|
71
93
|
children: "Manual — enter each asset’s volume"
|
|
72
|
-
}), /* @__PURE__ */ f(
|
|
94
|
+
}), /* @__PURE__ */ f(C, {
|
|
73
95
|
value: "PRO_RATA",
|
|
74
96
|
children: "Pro rata — split by factor"
|
|
75
97
|
})] })]
|
|
76
98
|
}),
|
|
77
99
|
/* @__PURE__ */ f("p", {
|
|
78
100
|
className: "text-xs text-text-tertiary",
|
|
79
|
-
children:
|
|
101
|
+
children: F === "PRO_RATA" ? "Factors can be well-test rates, theoretical volumes or metered shares. The measured volume is split in proportion." : "The volumes must add up to the measured volume."
|
|
80
102
|
})
|
|
81
103
|
]
|
|
82
104
|
}),
|
|
83
105
|
/* @__PURE__ */ p("div", {
|
|
84
106
|
className: "grid gap-3",
|
|
85
107
|
children: [
|
|
86
|
-
|
|
108
|
+
M.data?.truncated && /* @__PURE__ */ p("p", {
|
|
87
109
|
className: "text-xs text-status-warning-text",
|
|
88
110
|
children: [
|
|
89
111
|
"Showing the first ",
|
|
90
|
-
|
|
112
|
+
P.length,
|
|
91
113
|
" assets of this workspace."
|
|
92
114
|
]
|
|
93
115
|
}),
|
|
94
|
-
|
|
95
|
-
let
|
|
116
|
+
L.map((i, a) => {
|
|
117
|
+
let o = X.rows[a], s = q(i.assetId);
|
|
96
118
|
return /* @__PURE__ */ p("div", {
|
|
97
119
|
className: "grid gap-2 rounded-lg border border-border-seam p-3",
|
|
98
120
|
"data-testid": "allocation-row",
|
|
99
|
-
children: [
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
121
|
+
children: [
|
|
122
|
+
/* @__PURE__ */ p("div", {
|
|
123
|
+
className: "grid grid-cols-1 gap-2 md:grid-cols-[minmax(0,2fr)_minmax(0,1fr)_minmax(0,1fr)_minmax(0,1fr)_minmax(0,1fr)_auto]",
|
|
124
|
+
children: [
|
|
125
|
+
/* @__PURE__ */ p("div", {
|
|
126
|
+
className: "grid gap-1",
|
|
127
|
+
children: [/* @__PURE__ */ f(g, {
|
|
128
|
+
htmlFor: `${i.key}-asset`,
|
|
129
|
+
className: "text-xs",
|
|
130
|
+
children: "Contributing asset"
|
|
131
|
+
}), /* @__PURE__ */ p(x, {
|
|
132
|
+
value: i.assetId,
|
|
133
|
+
onValueChange: (e) => Z(i.key, { assetId: e }),
|
|
134
|
+
children: [/* @__PURE__ */ f(w, {
|
|
135
|
+
id: `${i.key}-asset`,
|
|
136
|
+
className: "h-10",
|
|
137
|
+
children: /* @__PURE__ */ f(T, { placeholder: "Select an asset" })
|
|
138
|
+
}), /* @__PURE__ */ f(S, { children: P.map((e) => /* @__PURE__ */ f(C, {
|
|
139
|
+
value: e.id,
|
|
140
|
+
children: e.name
|
|
141
|
+
}, e.id)) })]
|
|
142
|
+
})]
|
|
143
|
+
}),
|
|
144
|
+
/* @__PURE__ */ p("div", {
|
|
145
|
+
className: "grid gap-1",
|
|
146
|
+
children: [/* @__PURE__ */ f(g, {
|
|
147
|
+
htmlFor: `${i.key}-amount`,
|
|
148
|
+
className: "text-xs",
|
|
149
|
+
children: $
|
|
150
|
+
}), /* @__PURE__ */ f(h, {
|
|
151
|
+
id: `${i.key}-amount`,
|
|
152
|
+
type: "number",
|
|
153
|
+
inputMode: "decimal",
|
|
154
|
+
min: "0",
|
|
155
|
+
step: "any",
|
|
156
|
+
className: "h-10 tabular-nums",
|
|
157
|
+
value: i.amount,
|
|
158
|
+
onChange: (e) => Z(i.key, { amount: e.target.value })
|
|
159
|
+
})]
|
|
160
|
+
}),
|
|
161
|
+
/* @__PURE__ */ p("div", {
|
|
162
|
+
className: "grid gap-1",
|
|
163
|
+
children: [/* @__PURE__ */ f(g, {
|
|
164
|
+
htmlFor: `${i.key}-wi`,
|
|
165
|
+
className: "text-xs",
|
|
166
|
+
children: "Working interest %"
|
|
167
|
+
}), /* @__PURE__ */ f(h, {
|
|
168
|
+
id: `${i.key}-wi`,
|
|
169
|
+
type: "number",
|
|
170
|
+
inputMode: "decimal",
|
|
171
|
+
min: "0",
|
|
172
|
+
max: "100",
|
|
173
|
+
step: "any",
|
|
174
|
+
className: "h-10 tabular-nums",
|
|
175
|
+
placeholder: n(s.workingInterestPct),
|
|
176
|
+
value: i.workingInterestPct,
|
|
177
|
+
onChange: (e) => Z(i.key, { workingInterestPct: e.target.value })
|
|
178
|
+
})]
|
|
179
|
+
}),
|
|
180
|
+
/* @__PURE__ */ p("div", {
|
|
181
|
+
className: "grid gap-1",
|
|
182
|
+
children: [/* @__PURE__ */ f(g, {
|
|
183
|
+
htmlFor: `${i.key}-royalty`,
|
|
184
|
+
className: "text-xs",
|
|
185
|
+
children: "Royalty %"
|
|
186
|
+
}), /* @__PURE__ */ f(h, {
|
|
187
|
+
id: `${i.key}-royalty`,
|
|
188
|
+
type: "number",
|
|
189
|
+
inputMode: "decimal",
|
|
190
|
+
min: "0",
|
|
191
|
+
max: "100",
|
|
192
|
+
step: "any",
|
|
193
|
+
className: "h-10 tabular-nums",
|
|
194
|
+
placeholder: n(s.royaltyPct),
|
|
195
|
+
value: i.royaltyPct,
|
|
196
|
+
onChange: (e) => Z(i.key, { royaltyPct: e.target.value })
|
|
197
|
+
})]
|
|
198
|
+
}),
|
|
199
|
+
/* @__PURE__ */ p("div", {
|
|
200
|
+
className: "grid gap-1",
|
|
201
|
+
children: [/* @__PURE__ */ f(g, {
|
|
202
|
+
htmlFor: `${i.key}-orri`,
|
|
203
|
+
className: "text-xs",
|
|
204
|
+
children: "ORRI %"
|
|
205
|
+
}), /* @__PURE__ */ f(h, {
|
|
206
|
+
id: `${i.key}-orri`,
|
|
207
|
+
type: "number",
|
|
208
|
+
inputMode: "decimal",
|
|
209
|
+
min: "0",
|
|
210
|
+
max: "100",
|
|
211
|
+
step: "any",
|
|
212
|
+
className: "h-10 tabular-nums",
|
|
213
|
+
placeholder: n(s.overridingRoyaltyPct),
|
|
214
|
+
value: i.overridingRoyaltyPct,
|
|
215
|
+
onChange: (e) => Z(i.key, { overridingRoyaltyPct: e.target.value })
|
|
216
|
+
})]
|
|
217
|
+
}),
|
|
218
|
+
/* @__PURE__ */ f("div", {
|
|
219
|
+
className: "flex items-end",
|
|
220
|
+
children: /* @__PURE__ */ f(m, {
|
|
221
|
+
type: "button",
|
|
222
|
+
variant: "ghost",
|
|
223
|
+
size: "icon",
|
|
224
|
+
"aria-label": `Remove row ${a + 1}`,
|
|
225
|
+
disabled: L.length === 1,
|
|
226
|
+
onClick: () => ce(i.key),
|
|
227
|
+
children: /* @__PURE__ */ f(d, { className: "h-4 w-4" })
|
|
228
|
+
})
|
|
186
229
|
})
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
"
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
230
|
+
]
|
|
231
|
+
}),
|
|
232
|
+
i.assetId && /* @__PURE__ */ f("p", {
|
|
233
|
+
className: e("text-xs", o?.needsAllTerms ? "text-status-warning-text" : "text-text-tertiary"),
|
|
234
|
+
"data-testid": "allocation-row-terms",
|
|
235
|
+
children: s.source === "INTEREST_DECK" ? `Terms from the interest deck effective ${t(s.effectiveFrom)}${o?.overridden ? " (with overrides)" : ""}.` : s.source === "SPANS" ? "Ownership changes inside this period — enter working interest, royalty and ORRI, or split the record at the change." : `No interest deck covers this period — using the asset's working interest${o?.overridden ? " (with overrides)" : ""}.`
|
|
236
|
+
}),
|
|
237
|
+
o && /* @__PURE__ */ p("p", {
|
|
238
|
+
className: "text-xs tabular-nums text-text-secondary",
|
|
239
|
+
children: [
|
|
240
|
+
"Gross ",
|
|
241
|
+
r(o.allocatedVolume, Y),
|
|
242
|
+
" (",
|
|
243
|
+
n(o.sharePct, { maximumFractionDigits: 2 }),
|
|
244
|
+
"%) · Net WI",
|
|
245
|
+
" ",
|
|
246
|
+
r(o.netWorkingInterestVolume, Y),
|
|
247
|
+
" · Royalty",
|
|
248
|
+
" ",
|
|
249
|
+
r(o.royaltyVolume, Y),
|
|
250
|
+
" · Net revenue",
|
|
251
|
+
" ",
|
|
252
|
+
r(o.netRevenueVolume, Y)
|
|
253
|
+
]
|
|
254
|
+
})
|
|
255
|
+
]
|
|
256
|
+
}, i.key);
|
|
208
257
|
}),
|
|
209
258
|
/* @__PURE__ */ f("div", { children: /* @__PURE__ */ p(m, {
|
|
210
259
|
type: "button",
|
|
211
260
|
variant: "outline",
|
|
212
261
|
size: "sm",
|
|
213
|
-
onClick: () =>
|
|
214
|
-
children: [/* @__PURE__ */ f(
|
|
262
|
+
onClick: () => R((e) => [...e, c()]),
|
|
263
|
+
children: [/* @__PURE__ */ f(re, { className: "mr-1.5 h-4 w-4" }), " Add asset"]
|
|
215
264
|
}) })
|
|
216
265
|
]
|
|
217
266
|
}),
|
|
218
267
|
/* @__PURE__ */ p("div", {
|
|
219
|
-
className: e("rounded-lg px-3 py-2 text-sm tabular-nums",
|
|
268
|
+
className: e("rounded-lg px-3 py-2 text-sm tabular-nums", X.balanced ? "bg-status-success-bg-subtle text-status-success-text" : "bg-status-warning-bg-subtle text-status-warning-text"),
|
|
220
269
|
"data-testid": "allocation-balance",
|
|
221
270
|
children: [
|
|
222
271
|
"Allocated ",
|
|
223
|
-
r(
|
|
272
|
+
r(X.allocatedTotal, Y),
|
|
224
273
|
" of",
|
|
225
274
|
" ",
|
|
226
|
-
r(
|
|
227
|
-
|
|
275
|
+
r(J, Y),
|
|
276
|
+
F === "MANUAL" && !X.balanced ? ` — ${r(Math.abs(X.difference), Y)} ${X.difference > 0 ? "left to allocate" : "over-allocated"}` : "",
|
|
228
277
|
" · ",
|
|
229
278
|
"Net revenue ",
|
|
230
|
-
r(
|
|
279
|
+
r(X.netRevenueTotal, Y)
|
|
231
280
|
]
|
|
232
281
|
}),
|
|
233
282
|
/* @__PURE__ */ p("div", {
|
|
@@ -235,18 +284,18 @@ function k({ open: k, onOpenChange: A, record: j, measurementAssetName: M }) {
|
|
|
235
284
|
children: [/* @__PURE__ */ f(g, {
|
|
236
285
|
htmlFor: "alNotes",
|
|
237
286
|
children: "Notes"
|
|
238
|
-
}), /* @__PURE__ */ f(
|
|
287
|
+
}), /* @__PURE__ */ f(E, {
|
|
239
288
|
id: "alNotes",
|
|
240
289
|
rows: 2,
|
|
241
|
-
value:
|
|
242
|
-
onChange: (e) =>
|
|
290
|
+
value: z,
|
|
291
|
+
onChange: (e) => B(e.target.value),
|
|
243
292
|
placeholder: "Basis for the split (well tests, meter proving, agreements)."
|
|
244
293
|
})]
|
|
245
294
|
}),
|
|
246
|
-
|
|
295
|
+
V && /* @__PURE__ */ f("p", {
|
|
247
296
|
role: "alert",
|
|
248
297
|
className: "text-sm text-status-error-text",
|
|
249
|
-
children:
|
|
298
|
+
children: V
|
|
250
299
|
})
|
|
251
300
|
]
|
|
252
301
|
}), /* @__PURE__ */ p(b, {
|
|
@@ -255,13 +304,13 @@ function k({ open: k, onOpenChange: A, record: j, measurementAssetName: M }) {
|
|
|
255
304
|
type: "button",
|
|
256
305
|
variant: "outline",
|
|
257
306
|
className: "max-md:h-11",
|
|
258
|
-
onClick:
|
|
307
|
+
onClick: Q,
|
|
259
308
|
children: "Cancel"
|
|
260
309
|
}), /* @__PURE__ */ f(m, {
|
|
261
310
|
type: "submit",
|
|
262
311
|
className: "max-md:h-11",
|
|
263
|
-
disabled:
|
|
264
|
-
children:
|
|
312
|
+
disabled: N.isPending,
|
|
313
|
+
children: N.isPending ? "Saving…" : "Save draft allocation"
|
|
265
314
|
})]
|
|
266
315
|
})]
|
|
267
316
|
})]
|
|
@@ -269,6 +318,6 @@ function k({ open: k, onOpenChange: A, record: j, measurementAssetName: M }) {
|
|
|
269
318
|
});
|
|
270
319
|
}
|
|
271
320
|
//#endregion
|
|
272
|
-
export {
|
|
321
|
+
export { D as AllocateProductionSheet };
|
|
273
322
|
|
|
274
323
|
//# sourceMappingURL=AllocateProductionSheet.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AllocateProductionSheet.js","names":[],"sources":["../../../src/theglobalfuel/components/AllocateProductionSheet.tsx"],"sourcesContent":["/**\n * AllocateProductionSheet — split one measured production record across the\n * assets that contributed to it (BOFF-4180).\n * @module theglobalfuel/components\n *\n * MANUAL: the operator enters each asset's volume; the rows must add up to the\n * measured volume. PRO_RATA: the operator enters a factor per asset (well-test\n * rate, theoretical volume, metered share) and the measured volume is split in\n * proportion. Each row can override the asset's working interest and add a\n * royalty burden; the live preview shows the split and the net volumes before\n * anything is saved. Writes `theCreateProductionAllocation` (creates a DRAFT).\n */\n\nimport { useMemo, useState } from 'react';\nimport { Plus, Trash2 } from 'lucide-react';\nimport {\n Button,\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, useTheCreateProductionAllocation } from '../hooks';\nimport { cn } from '../utils/cn';\nimport { formatDate, formatNumber, formatVolume } from '../utils/formatters';\nimport {\n buildAllocationInput,\n newAllocationRow,\n previewAllocation,\n type AllocationRowState,\n} from '../utils/allocationForm';\nimport type { TheAllocationMethod, TheProductionRecord } from '../types';\n\ninterface AllocateProductionSheetProps {\n open: boolean;\n onOpenChange: (open: boolean) => void;\n /** The measured record being allocated; the sheet renders nothing without one. */\n record: TheProductionRecord | null;\n /** Display name of the record's measurement asset. */\n measurementAssetName?: string;\n}\n\nexport function AllocateProductionSheet({\n open,\n onOpenChange,\n record,\n measurementAssetName,\n}: AllocateProductionSheetProps) {\n const notify = useNotify();\n // Every workspace asset, not just the first page: any of them can contribute.\n const assetsQuery = useTheAllAssets({ enabled: open });\n const createAllocation = useTheCreateProductionAllocation();\n const assets = useMemo(\n () => [...(assetsQuery.data?.items ?? [])].sort((a, b) => a.name.localeCompare(b.name)),\n [assetsQuery.data]\n );\n const workingInterestByAsset = useMemo(() => {\n const map = new Map<string, number>();\n for (const a of assets) map.set(a.id, a.workingInterestPct);\n return map;\n }, [assets]);\n\n const [method, setMethod] = useState<TheAllocationMethod>('MANUAL');\n const [rows, setRows] = useState<AllocationRowState[]>(() => [newAllocationRow()]);\n const [notes, setNotes] = useState('');\n const [formError, setFormError] = useState<string | null>(null);\n\n // Start from a clean form every time the sheet opens for a record (\"adjust\n // state on prop change\" while rendering, so the first frame is already fresh).\n const seedKey = open && record ? `open:${record.id}` : 'closed';\n const [prevSeedKey, setPrevSeedKey] = useState(seedKey);\n if (seedKey !== prevSeedKey) {\n setPrevSeedKey(seedKey);\n if (open && record) {\n setMethod('MANUAL');\n setRows([newAllocationRow()]);\n setNotes('');\n setFormError(null);\n }\n }\n\n const measured = record?.volume ?? 0;\n const unit = record?.unit ?? 'BARRELS';\n const preview = previewAllocation(\n method,\n measured,\n rows,\n (assetId) => workingInterestByAsset.get(assetId) ?? 100\n );\n\n const updateRow = (key: string, patch: Partial<AllocationRowState>) =>\n setRows((current) => current.map((r) => (r.key === key ? { ...r, ...patch } : r)));\n const removeRow = (key: string) =>\n setRows((current) => (current.length > 1 ? current.filter((r) => r.key !== key) : current));\n\n const close = () => onOpenChange(false);\n\n const handleSubmit = async () => {\n if (!record) return;\n const result = buildAllocationInput({\n productionRecordId: record.id,\n method,\n measuredVolume: measured,\n rows,\n notes,\n });\n if (!result.ok) {\n setFormError(result.error);\n notify.error(result.error);\n return;\n }\n setFormError(null);\n try {\n await createAllocation.mutateAsync(result.input);\n notify.success('Allocation drafted — approve it to lock the split');\n close();\n } catch (err) {\n setFormError(err instanceof Error ? err.message : 'Failed to allocate production.');\n notify.fromError(err);\n }\n };\n\n const amountLabel = method === 'PRO_RATA' ? 'Factor' : 'Volume';\n\n return (\n <ResponsiveDialog open={open && Boolean(record)} onOpenChange={onOpenChange}>\n <ResponsiveDialogContent data-testid=\"allocate-production-sheet\" className=\"md:max-w-3xl\">\n <ResponsiveDialogHeader>\n <ResponsiveDialogTitle>Allocate production</ResponsiveDialogTitle>\n <ResponsiveDialogDescription>\n {record\n ? `${formatVolume(record.volume, record.unit)} measured at ${\n measurementAssetName ?? 'this asset'\n }, ${formatDate(record.periodStart)} – ${formatDate(record.periodEnd)}.`\n : ''}\n </ResponsiveDialogDescription>\n </ResponsiveDialogHeader>\n\n <form\n onSubmit={(e) => {\n e.preventDefault();\n void handleSubmit();\n }}\n >\n <div className=\"grid gap-4 py-2\">\n <div className=\"grid gap-1.5\">\n <Label htmlFor=\"alMethod\">Method</Label>\n <Select value={method} onValueChange={(v) => setMethod(v as TheAllocationMethod)}>\n <SelectTrigger id=\"alMethod\" className=\"h-11 md:h-10 md:w-72\">\n <SelectValue />\n </SelectTrigger>\n <SelectContent>\n <SelectItem value=\"MANUAL\">Manual — enter each asset’s volume</SelectItem>\n <SelectItem value=\"PRO_RATA\">Pro rata — split by factor</SelectItem>\n </SelectContent>\n </Select>\n <p className=\"text-xs text-text-tertiary\">\n {method === 'PRO_RATA'\n ? 'Factors can be well-test rates, theoretical volumes or metered shares. The measured volume is split in proportion.'\n : 'The volumes must add up to the measured volume.'}\n </p>\n </div>\n\n <div className=\"grid gap-3\">\n {assetsQuery.data?.truncated && (\n <p className=\"text-xs text-status-warning-text\">\n Showing the first {assets.length} assets of this workspace.\n </p>\n )}\n {rows.map((row, i) => {\n const p = preview.rows[i];\n const assetWi = workingInterestByAsset.get(row.assetId);\n return (\n <div\n key={row.key}\n className=\"grid gap-2 rounded-lg border border-border-seam p-3\"\n data-testid=\"allocation-row\"\n >\n <div className=\"grid grid-cols-1 gap-2 md:grid-cols-[minmax(0,2fr)_minmax(0,1fr)_minmax(0,1fr)_minmax(0,1fr)_auto]\">\n <div className=\"grid gap-1\">\n <Label htmlFor={`${row.key}-asset`} 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}-asset`} 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}-amount`} className=\"text-xs\">\n {amountLabel}\n </Label>\n <Input\n id={`${row.key}-amount`}\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}-wi`} className=\"text-xs\">\n Working interest %\n </Label>\n <Input\n id={`${row.key}-wi`}\n type=\"number\"\n inputMode=\"decimal\"\n min=\"0\"\n max=\"100\"\n step=\"any\"\n className=\"h-10 tabular-nums\"\n placeholder={assetWi != null ? formatNumber(assetWi) : '100'}\n value={row.workingInterestPct}\n onChange={(e) =>\n updateRow(row.key, { workingInterestPct: e.target.value })\n }\n />\n </div>\n <div className=\"grid gap-1\">\n <Label htmlFor={`${row.key}-royalty`} className=\"text-xs\">\n Royalty %\n </Label>\n <Input\n id={`${row.key}-royalty`}\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 {p && (\n <p className=\"text-xs tabular-nums text-text-secondary\">\n Gross {formatVolume(p.allocatedVolume, unit)} (\n {formatNumber(p.sharePct, { maximumFractionDigits: 2 })}%) · Net WI{' '}\n {formatVolume(p.netWorkingInterestVolume, unit)} · Royalty{' '}\n {formatVolume(p.royaltyVolume, unit)} · Net revenue{' '}\n {formatVolume(p.netRevenueVolume, unit)}\n </p>\n )}\n </div>\n );\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\n className={cn(\n 'rounded-lg px-3 py-2 text-sm tabular-nums',\n preview.balanced\n ? 'bg-status-success-bg-subtle text-status-success-text'\n : 'bg-status-warning-bg-subtle text-status-warning-text'\n )}\n data-testid=\"allocation-balance\"\n >\n Allocated {formatVolume(preview.allocatedTotal, unit)} of{' '}\n {formatVolume(measured, unit)}\n {method === 'MANUAL' && !preview.balanced\n ? ` — ${formatVolume(Math.abs(preview.difference), unit)} ${\n preview.difference > 0 ? 'left to allocate' : 'over-allocated'\n }`\n : ''}\n {' · '}Net revenue {formatVolume(preview.netRevenueTotal, unit)}\n </div>\n\n <div className=\"grid gap-1.5\">\n <Label htmlFor=\"alNotes\">Notes</Label>\n <Textarea\n id=\"alNotes\"\n rows={2}\n value={notes}\n onChange={(e) => setNotes(e.target.value)}\n placeholder=\"Basis for the split (well tests, meter proving, agreements).\"\n />\n </div>\n\n {formError && (\n <p role=\"alert\" className=\"text-sm text-status-error-text\">\n {formError}\n </p>\n )}\n </div>\n\n <ResponsiveDialogFooter className=\"max-md:flex-col-reverse max-md:gap-2\">\n <Button type=\"button\" variant=\"outline\" className=\"max-md:h-11\" onClick={close}>\n Cancel\n </Button>\n <Button type=\"submit\" className=\"max-md:h-11\" disabled={createAllocation.isPending}>\n {createAllocation.isPending ? 'Saving…' : 'Save draft allocation'}\n </Button>\n </ResponsiveDialogFooter>\n </form>\n </ResponsiveDialogContent>\n </ResponsiveDialog>\n );\n}\n"],"mappings":";;;;;;;;;;;AAoDA,SAAgB,EAAwB,EACtC,SACA,iBACA,WACA,2BAC+B;CAC/B,IAAM,IAAS,IAAW,EAEpB,IAAc,EAAgB,EAAE,SAAS,GAAM,CAAC,EAChD,IAAmB,GAAkC,EACrD,IAAS,QACP,CAAC,GAAI,EAAY,MAAM,SAAS,EAAE,CAAE,CAAC,MAAM,GAAG,MAAM,EAAE,KAAK,cAAc,EAAE,KAAK,CAAC,EACvF,CAAC,EAAY,KAAK,CACnB,EACK,IAAyB,QAAc;EAC3C,IAAM,oBAAM,IAAI,KAAqB;AACrC,OAAK,IAAM,KAAK,EAAQ,GAAI,IAAI,EAAE,IAAI,E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OACE,WAAW,EACT,6CACA,EAAQ,WACJ,yDACA,uDACL;OACD,eAAY;iBAPd;QAQC;QACY,EAAa,EAAQ,gBAAgB,EAAK;QAAC;QAAI;QACzD,EAAa,GAAU,EAAK;QAC5B,MAAW,YAAY,CAAC,EAAQ,WAC7B,MAAM,EAAa,KAAK,IAAI,EAAQ,WAAW,EAAE,EAAK,CAAC,GACrD,EAAQ,aAAa,IAAI,qBAAqB,qBAEhD;QACH;QAAM;QAAa,EAAa,EAAQ,iBAAiB,EAAK;QAC3D;;MAEN,kBAAC,OAAD;OAAK,WAAU;iBAAf,CACE,kBAAC,GAAD;QAAO,SAAQ;kBAAU;QAAa,CAAA,EACtC,kBAAC,GAAD;QACE,IAAG;QACH,MAAM;QACN,OAAO;QACP,WAAW,MAAM,EAAS,EAAE,OAAO,MAAM;QACzC,aAAY;QACZ,CAAA,CACE;;MAEL,KACC,kBAAC,KAAD;OAAG,MAAK;OAAQ,WAAU;iBACvB;OACC,CAAA;MAEF;QAEN,kBAAC,GAAD;KAAwB,WAAU;eAAlC,CACE,kBAAC,GAAD;MAAQ,MAAK;MAAS,SAAQ;MAAU,WAAU;MAAc,SAAS;gBAAO;MAEvE,CAAA,EACT,kBAAC,GAAD;MAAQ,MAAK;MAAS,WAAU;MAAc,UAAU,EAAiB;gBACtE,EAAiB,YAAY,YAAY;MACnC,CAAA,CACc;OACpB;MACiB;;EACT,CAAA"}
|
|
1
|
+
{"version":3,"file":"AllocateProductionSheet.js","names":[],"sources":["../../../src/theglobalfuel/components/AllocateProductionSheet.tsx"],"sourcesContent":["/**\n * AllocateProductionSheet — split one measured production record across the\n * assets that contributed to it (BOFF-4180).\n * @module theglobalfuel/components\n *\n * MANUAL: the operator enters each asset's volume; the rows must add up to the\n * measured volume. PRO_RATA: the operator enters a factor per asset (well-test\n * rate, theoretical volume, metered share) and the measured volume is split in\n * proportion. Each row defaults to the terms of the interest deck in force for\n * the record's period (BOFF-10787) — else the asset's own working interest and\n * no royalty — and can override working interest, royalty and overriding\n * royalty; the live preview shows the split and the net volumes before\n * anything is saved. Writes `theCreateProductionAllocation` (creates a DRAFT).\n */\n\nimport { useMemo, useState } from 'react';\nimport { Plus, Trash2 } from 'lucide-react';\nimport {\n Button,\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 {\n useNotify,\n useTheAllAssets,\n useTheAllInterestDecks,\n useTheCreateProductionAllocation,\n} from '../hooks';\nimport { cn } from '../utils/cn';\nimport { formatDate, formatNumber, formatVolume } from '../utils/formatters';\nimport {\n buildAllocationInput,\n newAllocationRow,\n previewAllocation,\n type AllocationRowState,\n type PreviewTerms,\n} from '../utils/allocationForm';\nimport { resolveDeckForPeriod } from '../utils/interestDeckForm';\nimport type { TheAllocationMethod, TheProductionRecord } from '../types';\n\ninterface AllocateProductionSheetProps {\n open: boolean;\n onOpenChange: (open: boolean) => void;\n /** The measured record being allocated; the sheet renders nothing without one. */\n record: TheProductionRecord | null;\n /** Display name of the record's measurement asset. */\n measurementAssetName?: string;\n}\n\nexport function AllocateProductionSheet({\n open,\n onOpenChange,\n record,\n measurementAssetName,\n}: AllocateProductionSheetProps) {\n const notify = useNotify();\n // Every workspace asset, not just the first page: any of them can contribute.\n const assetsQuery = useTheAllAssets({ enabled: open });\n const createAllocation = useTheCreateProductionAllocation();\n const assets = useMemo(\n () => [...(assetsQuery.data?.items ?? [])].sort((a, b) => a.name.localeCompare(b.name)),\n [assetsQuery.data]\n );\n const workingInterestByAsset = useMemo(() => {\n const map = new Map<string, number>();\n for (const a of assets) map.set(a.id, a.workingInterestPct);\n return map;\n }, [assets]);\n\n const [method, setMethod] = useState<TheAllocationMethod>('MANUAL');\n const [rows, setRows] = useState<AllocationRowState[]>(() => [newAllocationRow()]);\n const [notes, setNotes] = useState('');\n const [formError, setFormError] = useState<string | null>(null);\n\n // Start from a clean form every time the sheet opens for a record (\"adjust\n // state on prop change\" while rendering, so the first frame is already fresh).\n const seedKey = open && record ? `open:${record.id}` : 'closed';\n const [prevSeedKey, setPrevSeedKey] = useState(seedKey);\n if (seedKey !== prevSeedKey) {\n setPrevSeedKey(seedKey);\n if (open && record) {\n setMethod('MANUAL');\n setRows([newAllocationRow()]);\n setNotes('');\n setFormError(null);\n }\n }\n\n // Interest decks: the deck in force for the record's period supplies each\n // row's default terms, exactly as the svc resolves them on save.\n const decksQuery = useTheAllInterestDecks({ enabled: open });\n const decks = useMemo(() => decksQuery.data?.items ?? [], [decksQuery.data]);\n const termsFor = (assetId: string): PreviewTerms & { effectiveFrom?: string } => {\n const assetWi = workingInterestByAsset.get(assetId) ?? 100;\n if (!record || !assetId) {\n return {\n workingInterestPct: assetWi,\n royaltyPct: 0,\n overridingRoyaltyPct: 0,\n source: 'ASSET_DEFAULT',\n };\n }\n const res = resolveDeckForPeriod(decks, assetId, record.periodStart, record.periodEnd);\n if (res.kind === 'deck') {\n return {\n workingInterestPct: res.workingInterestPct,\n royaltyPct: res.deck.royaltyPct,\n overridingRoyaltyPct: res.deck.overridingRoyaltyPct,\n source: 'INTEREST_DECK',\n effectiveFrom: res.deck.effectiveFrom,\n };\n }\n return {\n workingInterestPct: assetWi,\n royaltyPct: 0,\n overridingRoyaltyPct: 0,\n source: res.kind === 'spans' ? 'SPANS' : 'ASSET_DEFAULT',\n };\n };\n\n const measured = record?.volume ?? 0;\n const unit = record?.unit ?? 'BARRELS';\n const preview = previewAllocation(method, measured, rows, termsFor);\n\n const updateRow = (key: string, patch: Partial<AllocationRowState>) =>\n setRows((current) => current.map((r) => (r.key === key ? { ...r, ...patch } : r)));\n const removeRow = (key: string) =>\n setRows((current) => (current.length > 1 ? current.filter((r) => r.key !== key) : current));\n\n const close = () => onOpenChange(false);\n\n const handleSubmit = async () => {\n if (!record) return;\n const result = buildAllocationInput({\n productionRecordId: record.id,\n method,\n measuredVolume: measured,\n rows,\n notes,\n });\n if (!result.ok) {\n setFormError(result.error);\n notify.error(result.error);\n return;\n }\n setFormError(null);\n try {\n await createAllocation.mutateAsync(result.input);\n notify.success('Allocation drafted — approve it to lock the split');\n close();\n } catch (err) {\n setFormError(err instanceof Error ? err.message : 'Failed to allocate production.');\n notify.fromError(err);\n }\n };\n\n const amountLabel = method === 'PRO_RATA' ? 'Factor' : 'Volume';\n\n return (\n <ResponsiveDialog open={open && Boolean(record)} onOpenChange={onOpenChange}>\n <ResponsiveDialogContent data-testid=\"allocate-production-sheet\" className=\"md:max-w-3xl\">\n <ResponsiveDialogHeader>\n <ResponsiveDialogTitle>Allocate production</ResponsiveDialogTitle>\n <ResponsiveDialogDescription>\n {record\n ? `${formatVolume(record.volume, record.unit)} measured at ${\n measurementAssetName ?? 'this asset'\n }, ${formatDate(record.periodStart)} – ${formatDate(record.periodEnd)}.`\n : ''}\n </ResponsiveDialogDescription>\n </ResponsiveDialogHeader>\n\n <form\n onSubmit={(e) => {\n e.preventDefault();\n void handleSubmit();\n }}\n >\n <div className=\"grid gap-4 py-2\">\n <div className=\"grid gap-1.5\">\n <Label htmlFor=\"alMethod\">Method</Label>\n <Select value={method} onValueChange={(v) => setMethod(v as TheAllocationMethod)}>\n <SelectTrigger id=\"alMethod\" className=\"h-11 md:h-10 md:w-72\">\n <SelectValue />\n </SelectTrigger>\n <SelectContent>\n <SelectItem value=\"MANUAL\">Manual — enter each asset’s volume</SelectItem>\n <SelectItem value=\"PRO_RATA\">Pro rata — split by factor</SelectItem>\n </SelectContent>\n </Select>\n <p className=\"text-xs text-text-tertiary\">\n {method === 'PRO_RATA'\n ? 'Factors can be well-test rates, theoretical volumes or metered shares. The measured volume is split in proportion.'\n : 'The volumes must add up to the measured volume.'}\n </p>\n </div>\n\n <div className=\"grid gap-3\">\n {assetsQuery.data?.truncated && (\n <p className=\"text-xs text-status-warning-text\">\n Showing the first {assets.length} assets of this workspace.\n </p>\n )}\n {rows.map((row, i) => {\n const p = preview.rows[i];\n const terms = termsFor(row.assetId);\n return (\n <div\n key={row.key}\n className=\"grid gap-2 rounded-lg border border-border-seam p-3\"\n data-testid=\"allocation-row\"\n >\n <div className=\"grid grid-cols-1 gap-2 md:grid-cols-[minmax(0,2fr)_minmax(0,1fr)_minmax(0,1fr)_minmax(0,1fr)_minmax(0,1fr)_auto]\">\n <div className=\"grid gap-1\">\n <Label htmlFor={`${row.key}-asset`} 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}-asset`} 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}-amount`} className=\"text-xs\">\n {amountLabel}\n </Label>\n <Input\n id={`${row.key}-amount`}\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}-wi`} className=\"text-xs\">\n Working interest %\n </Label>\n <Input\n id={`${row.key}-wi`}\n type=\"number\"\n inputMode=\"decimal\"\n min=\"0\"\n max=\"100\"\n step=\"any\"\n className=\"h-10 tabular-nums\"\n placeholder={formatNumber(terms.workingInterestPct)}\n value={row.workingInterestPct}\n onChange={(e) =>\n updateRow(row.key, { workingInterestPct: e.target.value })\n }\n />\n </div>\n <div className=\"grid gap-1\">\n <Label htmlFor={`${row.key}-royalty`} className=\"text-xs\">\n Royalty %\n </Label>\n <Input\n id={`${row.key}-royalty`}\n type=\"number\"\n inputMode=\"decimal\"\n min=\"0\"\n max=\"100\"\n step=\"any\"\n className=\"h-10 tabular-nums\"\n placeholder={formatNumber(terms.royaltyPct)}\n value={row.royaltyPct}\n onChange={(e) => updateRow(row.key, { royaltyPct: e.target.value })}\n />\n </div>\n <div className=\"grid gap-1\">\n <Label htmlFor={`${row.key}-orri`} className=\"text-xs\">\n ORRI %\n </Label>\n <Input\n id={`${row.key}-orri`}\n type=\"number\"\n inputMode=\"decimal\"\n min=\"0\"\n max=\"100\"\n step=\"any\"\n className=\"h-10 tabular-nums\"\n placeholder={formatNumber(terms.overridingRoyaltyPct)}\n value={row.overridingRoyaltyPct}\n onChange={(e) =>\n updateRow(row.key, { overridingRoyaltyPct: e.target.value })\n }\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 {row.assetId && (\n <p\n className={cn(\n 'text-xs',\n p?.needsAllTerms ? 'text-status-warning-text' : 'text-text-tertiary'\n )}\n data-testid=\"allocation-row-terms\"\n >\n {terms.source === 'INTEREST_DECK'\n ? `Terms from the interest deck effective ${formatDate(terms.effectiveFrom)}${\n p?.overridden ? ' (with overrides)' : ''\n }.`\n : terms.source === 'SPANS'\n ? 'Ownership changes inside this period — enter working interest, royalty and ORRI, or split the record at the change.'\n : `No interest deck covers this period — using the asset's working interest${\n p?.overridden ? ' (with overrides)' : ''\n }.`}\n </p>\n )}\n {p && (\n <p className=\"text-xs tabular-nums text-text-secondary\">\n Gross {formatVolume(p.allocatedVolume, unit)} (\n {formatNumber(p.sharePct, { maximumFractionDigits: 2 })}%) · Net WI{' '}\n {formatVolume(p.netWorkingInterestVolume, unit)} · Royalty{' '}\n {formatVolume(p.royaltyVolume, unit)} · Net revenue{' '}\n {formatVolume(p.netRevenueVolume, unit)}\n </p>\n )}\n </div>\n );\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\n className={cn(\n 'rounded-lg px-3 py-2 text-sm tabular-nums',\n preview.balanced\n ? 'bg-status-success-bg-subtle text-status-success-text'\n : 'bg-status-warning-bg-subtle text-status-warning-text'\n )}\n data-testid=\"allocation-balance\"\n >\n Allocated {formatVolume(preview.allocatedTotal, unit)} of{' '}\n {formatVolume(measured, unit)}\n {method === 'MANUAL' && !preview.balanced\n ? ` — ${formatVolume(Math.abs(preview.difference), unit)} ${\n preview.difference > 0 ? 'left to allocate' : 'over-allocated'\n }`\n : ''}\n {' · '}Net revenue {formatVolume(preview.netRevenueTotal, unit)}\n </div>\n\n <div className=\"grid gap-1.5\">\n <Label htmlFor=\"alNotes\">Notes</Label>\n <Textarea\n id=\"alNotes\"\n rows={2}\n value={notes}\n onChange={(e) => setNotes(e.target.value)}\n placeholder=\"Basis for the split (well tests, meter proving, agreements).\"\n />\n </div>\n\n {formError && (\n <p role=\"alert\" className=\"text-sm text-status-error-text\">\n {formError}\n </p>\n )}\n </div>\n\n <ResponsiveDialogFooter className=\"max-md:flex-col-reverse max-md:gap-2\">\n <Button type=\"button\" variant=\"outline\" className=\"max-md:h-11\" onClick={close}>\n Cancel\n </Button>\n <Button type=\"submit\" className=\"max-md:h-11\" disabled={createAllocation.isPending}>\n {createAllocation.isPending ? 'Saving…' : 'Save draft allocation'}\n </Button>\n </ResponsiveDialogFooter>\n </form>\n </ResponsiveDialogContent>\n </ResponsiveDialog>\n );\n}\n"],"mappings":";;;;;;;;;;;;AA6DA,SAAgB,EAAwB,EACtC,SACA,iBACA,WACA,2BAC+B;CAC/B,IAAM,IAAS,GAAW,EAEpB,IAAc,EAAgB,EAAE,SAAS,GAAM,CAAC,EAChD,IAAmB,GAAkC,EACrD,IAAS,QACP,CAAC,GAAI,EAAY,MAAM,SAAS,EA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AAe,GAAS,MAAY,CAAC,GAAG,GAAS,GAAkB,CAAC,CAAC;mBAJvE,CAME,kBAAC,IAAD,EAAM,WAAU,kBAAmB,CAAA,EAAA,aAC5B;YACL,CAAA;QACF;;MAEN,kBAAC,OAAD;OACE,WAAW,EACT,6CACA,EAAQ,WACJ,yDACA,uDACL;OACD,eAAY;iBAPd;QAQC;QACY,EAAa,EAAQ,gBAAgB,EAAK;QAAC;QAAI;QACzD,EAAa,GAAU,EAAK;QAC5B,MAAW,YAAY,CAAC,EAAQ,WAC7B,MAAM,EAAa,KAAK,IAAI,EAAQ,WAAW,EAAE,EAAK,CAAC,GACrD,EAAQ,aAAa,IAAI,qBAAqB,qBAEhD;QACH;QAAM;QAAa,EAAa,EAAQ,iBAAiB,EAAK;QAC3D;;MAEN,kBAAC,OAAD;OAAK,WAAU;iBAAf,CACE,kBAAC,GAAD;QAAO,SAAQ;kBAAU;QAAa,CAAA,EACtC,kBAAC,GAAD;QACE,IAAG;QACH,MAAM;QACN,OAAO;QACP,WAAW,MAAM,EAAS,EAAE,OAAO,MAAM;QACzC,aAAY;QACZ,CAAA,CACE;;MAEL,KACC,kBAAC,KAAD;OAAG,MAAK;OAAQ,WAAU;iBACvB;OACC,CAAA;MAEF;QAEN,kBAAC,GAAD;KAAwB,WAAU;eAAlC,CACE,kBAAC,GAAD;MAAQ,MAAK;MAAS,SAAQ;MAAU,WAAU;MAAc,SAAS;gBAAO;MAEvE,CAAA,EACT,kBAAC,GAAD;MAAQ,MAAK;MAAS,WAAU;MAAc,UAAU,EAAiB;gBACtE,EAAiB,YAAY,YAAY;MACnC,CAAA,CACc;OACpB;MACiB;;EACT,CAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { TheAllocationEntry } from '../types';
|
|
2
|
+
|
|
3
|
+
interface AssignEntitlementDialogProps {
|
|
4
|
+
entry: TheAllocationEntry | null;
|
|
5
|
+
/** Net volume of the entry already assigned to contracts. */
|
|
6
|
+
assignedVolume: number;
|
|
7
|
+
onOpenChange: (open: boolean) => void;
|
|
8
|
+
}
|
|
9
|
+
export declare function AssignEntitlementDialog({ entry, assignedVolume, onOpenChange, }: AssignEntitlementDialogProps): import("react").JSX.Element;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=AssignEntitlementDialog.d.ts.map
|