@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.
Files changed (49) hide show
  1. package/dist/theglobalfuel/components/AllocateProductionSheet.d.ts.map +1 -1
  2. package/dist/theglobalfuel/components/AllocateProductionSheet.js +213 -164
  3. package/dist/theglobalfuel/components/AllocateProductionSheet.js.map +1 -1
  4. package/dist/theglobalfuel/components/AssignEntitlementDialog.d.ts +11 -0
  5. package/dist/theglobalfuel/components/AssignEntitlementDialog.d.ts.map +1 -0
  6. package/dist/theglobalfuel/components/AssignEntitlementDialog.js +117 -0
  7. package/dist/theglobalfuel/components/AssignEntitlementDialog.js.map +1 -0
  8. package/dist/theglobalfuel/components/ConfirmActionDialog.d.ts +17 -0
  9. package/dist/theglobalfuel/components/ConfirmActionDialog.d.ts.map +1 -0
  10. package/dist/theglobalfuel/components/ConfirmActionDialog.js +29 -0
  11. package/dist/theglobalfuel/components/ConfirmActionDialog.js.map +1 -0
  12. package/dist/theglobalfuel/components/InterestDeckSheet.d.ts +21 -0
  13. package/dist/theglobalfuel/components/InterestDeckSheet.d.ts.map +1 -0
  14. package/dist/theglobalfuel/components/InterestDeckSheet.js +287 -0
  15. package/dist/theglobalfuel/components/InterestDeckSheet.js.map +1 -0
  16. package/dist/theglobalfuel/components/StatusBadge.d.ts.map +1 -1
  17. package/dist/theglobalfuel/components/StatusBadge.js +7 -1
  18. package/dist/theglobalfuel/components/StatusBadge.js.map +1 -1
  19. package/dist/theglobalfuel/hooks/useTheGlobalFuelApi.d.ts +27 -1
  20. package/dist/theglobalfuel/hooks/useTheGlobalFuelApi.d.ts.map +1 -1
  21. package/dist/theglobalfuel/hooks/useTheGlobalFuelApi.js +221 -117
  22. package/dist/theglobalfuel/hooks/useTheGlobalFuelApi.js.map +1 -1
  23. package/dist/theglobalfuel/pages/production/AllocationsPanel.d.ts +4 -1
  24. package/dist/theglobalfuel/pages/production/AllocationsPanel.d.ts.map +1 -1
  25. package/dist/theglobalfuel/pages/production/AllocationsPanel.js +206 -165
  26. package/dist/theglobalfuel/pages/production/AllocationsPanel.js.map +1 -1
  27. package/dist/theglobalfuel/pages/production/EntitlementsPanel.d.ts +14 -0
  28. package/dist/theglobalfuel/pages/production/EntitlementsPanel.d.ts.map +1 -0
  29. package/dist/theglobalfuel/pages/production/EntitlementsPanel.js +205 -0
  30. package/dist/theglobalfuel/pages/production/EntitlementsPanel.js.map +1 -0
  31. package/dist/theglobalfuel/pages/production/InterestDecksPanel.d.ts +12 -0
  32. package/dist/theglobalfuel/pages/production/InterestDecksPanel.d.ts.map +1 -0
  33. package/dist/theglobalfuel/pages/production/InterestDecksPanel.js +243 -0
  34. package/dist/theglobalfuel/pages/production/InterestDecksPanel.js.map +1 -0
  35. package/dist/theglobalfuel/pages/production/ProductionPage.d.ts +3 -0
  36. package/dist/theglobalfuel/pages/production/ProductionPage.d.ts.map +1 -1
  37. package/dist/theglobalfuel/pages/production/ProductionPage.js +109 -95
  38. package/dist/theglobalfuel/pages/production/ProductionPage.js.map +1 -1
  39. package/dist/theglobalfuel/types/index.d.ts +83 -0
  40. package/dist/theglobalfuel/types/index.d.ts.map +1 -1
  41. package/dist/theglobalfuel/utils/allocationForm.d.ts +30 -4
  42. package/dist/theglobalfuel/utils/allocationForm.d.ts.map +1 -1
  43. package/dist/theglobalfuel/utils/allocationForm.js +43 -25
  44. package/dist/theglobalfuel/utils/allocationForm.js.map +1 -1
  45. package/dist/theglobalfuel/utils/interestDeckForm.d.ts +64 -0
  46. package/dist/theglobalfuel/utils/interestDeckForm.d.ts.map +1 -0
  47. package/dist/theglobalfuel/utils/interestDeckForm.js +140 -0
  48. package/dist/theglobalfuel/utils/interestDeckForm.js.map +1 -0
  49. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"AllocateProductionSheet.d.ts","sourceRoot":"","sources":["../../../src/theglobalfuel/components/AllocateProductionSheet.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AA8BH,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,+BAiS9B"}
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, useTheCreateProductionAllocation as a } from "../hooks/useTheGlobalFuelApi.js";
4
- import { useNotify as ee } from "../hooks/useNotify.js";
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 o, newAllocationRow as s, previewAllocation as c } from "../utils/allocationForm.js";
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 d, Trash2 as te } from "lucide-react";
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 x, ResponsiveDialogTitle as S, Select as C, SelectContent as w, SelectItem as T, SelectTrigger as E, SelectValue as D, Textarea as O } from "@burdenoff/fe-libs/ui";
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 k({ open: k, onOpenChange: A, record: j, measurementAssetName: M }) {
13
- let N = ee(), P = i({ enabled: k }), F = a(), I = l(() => [...P.data?.items ?? []].sort((e, t) => e.name.localeCompare(t.name)), [P.data]), L = l(() => {
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 I) e.set(t.id, t.workingInterestPct);
16
+ for (let t of P) e.set(t.id, t.workingInterestPct);
16
17
  return e;
17
- }, [I]), [R, z] = u("MANUAL"), [B, V] = u(() => [s()]), [H, U] = u(""), [W, G] = u(null), K = k && j ? `open:${j.id}` : "closed", [q, J] = u(K);
18
- K !== q && (J(K), k && j && (z("MANUAL"), V([s()]), U(""), G(null)));
19
- let Y = j?.volume ?? 0, X = j?.unit ?? "BARRELS", Z = c(R, Y, B, (e) => L.get(e) ?? 100), Q = (e, t) => V((n) => n.map((n) => n.key === e ? {
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)), ne = (e) => V((t) => t.length > 1 ? t.filter((t) => t.key !== e) : t), $ = () => A(!1), re = async () => {
23
- if (!j) return;
24
- let e = o({
25
- productionRecordId: j.id,
26
- method: R,
27
- measuredVolume: Y,
28
- rows: B,
29
- notes: H
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
- G(e.error), N.error(e.error);
54
+ H(e.error), j.error(e.error);
33
55
  return;
34
56
  }
35
- G(null);
57
+ H(null);
36
58
  try {
37
- await F.mutateAsync(e.input), N.success("Allocation drafted — approve it to lock the split"), $();
59
+ await N.mutateAsync(e.input), j.success("Allocation drafted — approve it to lock the split"), Q();
38
60
  } catch (e) {
39
- G(e instanceof Error ? e.message : "Failed to allocate production."), N.fromError(e);
61
+ H(e instanceof Error ? e.message : "Failed to allocate production."), j.fromError(e);
40
62
  }
41
- }, ie = R === "PRO_RATA" ? "Factor" : "Volume";
63
+ }, $ = F === "PRO_RATA" ? "Factor" : "Volume";
42
64
  return /* @__PURE__ */ f(_, {
43
- open: k && !!j,
44
- onOpenChange: A,
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(x, { children: [/* @__PURE__ */ f(S, { children: "Allocate production" }), /* @__PURE__ */ f(y, { children: j ? `${r(j.volume, j.unit)} measured at ${M ?? "this asset"}, ${t(j.periodStart)} – ${t(j.periodEnd)}.` : "" })] }), /* @__PURE__ */ p("form", {
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(), re();
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(C, {
63
- value: R,
64
- onValueChange: (e) => z(e),
65
- children: [/* @__PURE__ */ f(E, {
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(D, {})
69
- }), /* @__PURE__ */ p(w, { children: [/* @__PURE__ */ f(T, {
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(T, {
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: R === "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."
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
- P.data?.truncated && /* @__PURE__ */ p("p", {
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
- I.length,
112
+ P.length,
91
113
  " assets of this workspace."
92
114
  ]
93
115
  }),
94
- B.map((e, t) => {
95
- let i = Z.rows[t], a = L.get(e.assetId);
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: [/* @__PURE__ */ p("div", {
100
- className: "grid grid-cols-1 gap-2 md:grid-cols-[minmax(0,2fr)_minmax(0,1fr)_minmax(0,1fr)_minmax(0,1fr)_auto]",
101
- children: [
102
- /* @__PURE__ */ p("div", {
103
- className: "grid gap-1",
104
- children: [/* @__PURE__ */ f(g, {
105
- htmlFor: `${e.key}-asset`,
106
- className: "text-xs",
107
- children: "Contributing asset"
108
- }), /* @__PURE__ */ p(C, {
109
- value: e.assetId,
110
- onValueChange: (t) => Q(e.key, { assetId: t }),
111
- children: [/* @__PURE__ */ f(E, {
112
- id: `${e.key}-asset`,
113
- className: "h-10",
114
- children: /* @__PURE__ */ f(D, { placeholder: "Select an asset" })
115
- }), /* @__PURE__ */ f(w, { children: I.map((e) => /* @__PURE__ */ f(T, {
116
- value: e.id,
117
- children: e.name
118
- }, e.id)) })]
119
- })]
120
- }),
121
- /* @__PURE__ */ p("div", {
122
- className: "grid gap-1",
123
- children: [/* @__PURE__ */ f(g, {
124
- htmlFor: `${e.key}-amount`,
125
- className: "text-xs",
126
- children: ie
127
- }), /* @__PURE__ */ f(h, {
128
- id: `${e.key}-amount`,
129
- type: "number",
130
- inputMode: "decimal",
131
- min: "0",
132
- step: "any",
133
- className: "h-10 tabular-nums",
134
- value: e.amount,
135
- onChange: (t) => Q(e.key, { amount: t.target.value })
136
- })]
137
- }),
138
- /* @__PURE__ */ p("div", {
139
- className: "grid gap-1",
140
- children: [/* @__PURE__ */ f(g, {
141
- htmlFor: `${e.key}-wi`,
142
- className: "text-xs",
143
- children: "Working interest %"
144
- }), /* @__PURE__ */ f(h, {
145
- id: `${e.key}-wi`,
146
- type: "number",
147
- inputMode: "decimal",
148
- min: "0",
149
- max: "100",
150
- step: "any",
151
- className: "h-10 tabular-nums",
152
- placeholder: a == null ? "100" : n(a),
153
- value: e.workingInterestPct,
154
- onChange: (t) => Q(e.key, { workingInterestPct: t.target.value })
155
- })]
156
- }),
157
- /* @__PURE__ */ p("div", {
158
- className: "grid gap-1",
159
- children: [/* @__PURE__ */ f(g, {
160
- htmlFor: `${e.key}-royalty`,
161
- className: "text-xs",
162
- children: "Royalty %"
163
- }), /* @__PURE__ */ f(h, {
164
- id: `${e.key}-royalty`,
165
- type: "number",
166
- inputMode: "decimal",
167
- min: "0",
168
- max: "100",
169
- step: "any",
170
- className: "h-10 tabular-nums",
171
- placeholder: "0",
172
- value: e.royaltyPct,
173
- onChange: (t) => Q(e.key, { royaltyPct: t.target.value })
174
- })]
175
- }),
176
- /* @__PURE__ */ f("div", {
177
- className: "flex items-end",
178
- children: /* @__PURE__ */ f(m, {
179
- type: "button",
180
- variant: "ghost",
181
- size: "icon",
182
- "aria-label": `Remove row ${t + 1}`,
183
- disabled: B.length === 1,
184
- onClick: () => ne(e.key),
185
- children: /* @__PURE__ */ f(te, { className: "h-4 w-4" })
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
- }), i && /* @__PURE__ */ p("p", {
190
- className: "text-xs tabular-nums text-text-secondary",
191
- children: [
192
- "Gross ",
193
- r(i.allocatedVolume, X),
194
- " (",
195
- n(i.sharePct, { maximumFractionDigits: 2 }),
196
- "%) · Net WI",
197
- " ",
198
- r(i.netWorkingInterestVolume, X),
199
- " · Royalty",
200
- " ",
201
- r(i.royaltyVolume, X),
202
- " · Net revenue",
203
- " ",
204
- r(i.netRevenueVolume, X)
205
- ]
206
- })]
207
- }, e.key);
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: () => V((e) => [...e, s()]),
214
- children: [/* @__PURE__ */ f(d, { className: "mr-1.5 h-4 w-4" }), " Add asset"]
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", Z.balanced ? "bg-status-success-bg-subtle text-status-success-text" : "bg-status-warning-bg-subtle text-status-warning-text"),
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(Z.allocatedTotal, X),
272
+ r(X.allocatedTotal, Y),
224
273
  " of",
225
274
  " ",
226
- r(Y, X),
227
- R === "MANUAL" && !Z.balanced ? ` — ${r(Math.abs(Z.difference), X)} ${Z.difference > 0 ? "left to allocate" : "over-allocated"}` : "",
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(Z.netRevenueTotal, X)
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(O, {
287
+ }), /* @__PURE__ */ f(E, {
239
288
  id: "alNotes",
240
289
  rows: 2,
241
- value: H,
242
- onChange: (e) => U(e.target.value),
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
- W && /* @__PURE__ */ f("p", {
295
+ V && /* @__PURE__ */ f("p", {
247
296
  role: "alert",
248
297
  className: "text-sm text-status-error-text",
249
- children: W
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: F.isPending,
264
- children: F.isPending ? "Saving…" : "Save draft allocation"
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 { k as AllocateProductionSheet };
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&rsquo;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,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,kBAAC,OAAD,EAAA,UACE,kBAAC,GAAD;SACE,MAAK;SACL,SAAQ;SACR,MAAK;SACL,eAAe,GAAS,MAAY,CAAC,GAAG,GAAS,GAAkB,CAAC,CAAC;mBAJvE,CAME,kBAAC,GAAD,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"}
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&rsquo;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 </Res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A,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