@nivaro/react 0.3.52 → 0.3.53
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/full.css +1 -1
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +47 -3
- package/dist/shared/components/ItemEditForm.js +3851 -3821
- package/dist/shared/components/NotificationBell.js +163 -150
- package/dist/shared/components/PageRenderer.js +600 -549
- package/dist/shared/components/ProfileView.js +36 -34
- package/dist/shared/components/QueryStatStrip.js +96 -89
- package/dist/shared/components/QueryTable.js +214 -215
- package/dist/shared/components/ReportView.js +548 -529
- package/dist/shared/components/alerts/AlertManagerView.js +346 -320
- package/dist/shared/components/item-edit/CatalogPickerField.js +1300 -1219
- package/dist/shared/components/item-edit/FieldAffordances.js +145 -136
- package/dist/shared/components/item-edit/FieldRenderer.js +366 -326
- package/dist/shared/components/item-edit/InlineTableField.js +3047 -2932
- package/dist/shared/components/item-edit/NestedRelationEditor.js +149 -143
- package/dist/shared/components/item-edit/PlanGrid.js +718 -705
- package/dist/shared/components/item-edit/SummaryPanel.js +351 -337
- package/dist/shared/components/item-edit/line-qty.js +115 -53
- package/dist/shared/components/item-edit/save-refusal.js +18 -18
- package/dist/shared/components/item-edit/usePersonalDefaults.js +210 -207
- package/dist/shared/components/panels/CommentPanel.js +204 -197
- package/dist/shared/components/panels/ItemLockBanner.js +318 -291
- package/dist/shared/components/panels/PipelinePanel.js +1388 -1218
- package/dist/shared/components/panels/RecordIntegrityBanner.js +201 -172
- package/dist/shared/components/panels/RevisionsPanel.js +101 -106
- package/dist/shared/components/panels/TransitionRequirementsDialog.js +564 -534
- package/dist/shared/components/panels/requirement-side-effects.js +46 -29
- package/dist/shared/components/queue/QueueItemSheet.js +219 -146
- package/dist/shared/components/queue/QueueWorklist.js +738 -730
- package/dist/shared/components/widgets/ReviewListWidget.js +236 -201
- package/dist/shared/lib/activity-sentence.js +236 -227
- package/dist/shared/lib/record-ref.js +43 -34
- package/package.json +1 -1
|
@@ -1,180 +1,192 @@
|
|
|
1
|
-
import { jsx as t, jsxs as d, Fragment as
|
|
2
|
-
import { useQueryClient as
|
|
3
|
-
import { ChevronDown as
|
|
4
|
-
import { useRef as
|
|
1
|
+
import { jsx as t, jsxs as d, Fragment as Xt } from "react/jsx-runtime";
|
|
2
|
+
import { useQueryClient as ea, useQuery as ce } from "@tanstack/react-query";
|
|
3
|
+
import { ChevronDown as $t, ChevronRight as Ct, Lock as ta, MoreHorizontal as aa, Split as St, Undo2 as la, History as na, Trash2 as ra, Plus as sa } from "lucide-react";
|
|
4
|
+
import { useRef as $e, useEffect as pe, useMemo as G, useCallback as ee, useState as H } from "react";
|
|
5
5
|
import { toast as de } from "sonner";
|
|
6
|
-
import { useNivaroClient as
|
|
7
|
-
import { get as ue, post as
|
|
8
|
-
import { useAfterIdle as
|
|
9
|
-
import { evaluateNumeric as
|
|
10
|
-
import { userErrorMessage as
|
|
11
|
-
import { cn as B, formatRelative as
|
|
12
|
-
import { NumberDraftInput as
|
|
13
|
-
import { Popover as
|
|
14
|
-
import { resolveCompareEndpoint as
|
|
15
|
-
import { useO2MStaging as
|
|
16
|
-
import { usePlanGridHost as
|
|
17
|
-
import { RowHistorySheet as
|
|
18
|
-
import { RowWatchButton as
|
|
19
|
-
const
|
|
20
|
-
function D(
|
|
21
|
-
const n = Math.abs(
|
|
22
|
-
return
|
|
6
|
+
import { useNivaroClient as oa, useParentDraft as ia, useItemEditAuth as da } from "../../context.js";
|
|
7
|
+
import { get as ue, post as rt } from "../../lib/commands.js";
|
|
8
|
+
import { useAfterIdle as ca } from "../../lib/defer.js";
|
|
9
|
+
import { evaluateNumeric as at } from "../../lib/expression.js";
|
|
10
|
+
import { userErrorMessage as ua } from "../../lib/safe-error.js";
|
|
11
|
+
import { cn as B, formatRelative as pa } from "../../lib/utils.js";
|
|
12
|
+
import { NumberDraftInput as ma } from "../ui/number-draft-input.js";
|
|
13
|
+
import { Popover as it, PopoverTrigger as dt, PopoverContent as ct } from "../ui/popover.js";
|
|
14
|
+
import { resolveCompareEndpoint as ha, useCompareSeries as fa, compareColumnClosed as xa, planLabel as Pt, closedThroughLabel as ga, CompareProposalBanner as ya, CompareStripChips as ba, GridStatChip as _t, monthLabel as st, extraSeriesValue as we, SeriesFigurePopover as Ot, monthLabelLong as Ee, unitWord as ka } from "./CompareSeries.js";
|
|
15
|
+
import { useO2MStaging as va, useLiveRows as Na } from "./O2MStagingContext.js";
|
|
16
|
+
import { usePlanGridHost as wa } from "./PlanGridHost.js";
|
|
17
|
+
import { RowHistorySheet as $a } from "./RowHistorySheet.js";
|
|
18
|
+
import { RowWatchButton as Ca } from "./RowWatchButton.js";
|
|
19
|
+
const Ie = "unclassified", I = (v) => Number(v) || 0, T = (v) => Math.round(v * 100) / 100;
|
|
20
|
+
function D(v) {
|
|
21
|
+
const n = Math.abs(v - Math.round(v)) < 5e-3;
|
|
22
|
+
return v.toLocaleString("en-US", {
|
|
23
23
|
style: "currency",
|
|
24
24
|
currency: "USD",
|
|
25
25
|
minimumFractionDigits: n ? 0 : 2,
|
|
26
26
|
maximumFractionDigits: n ? 0 : 2
|
|
27
27
|
});
|
|
28
28
|
}
|
|
29
|
-
function
|
|
30
|
-
const n =
|
|
29
|
+
function qt(v) {
|
|
30
|
+
const n = v.replace(/[$,\s]/g, "");
|
|
31
31
|
if (n === "" || n === "-" || n === "—") return 0;
|
|
32
|
-
const p = /^\(.*\)$/.test(n),
|
|
33
|
-
return Number.isFinite(
|
|
32
|
+
const p = /^\(.*\)$/.test(n), g = Number(p ? n.slice(1, -1) : n);
|
|
33
|
+
return Number.isFinite(g) ? T(p ? -g : g) : null;
|
|
34
34
|
}
|
|
35
|
-
function
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
if (o === "
|
|
41
|
-
|
|
42
|
-
let k
|
|
35
|
+
function Sa(v, n) {
|
|
36
|
+
return v[0] === "item" && v.length >= 3 && String(v[2]) === String(n);
|
|
37
|
+
}
|
|
38
|
+
function _a(v) {
|
|
39
|
+
const { column: n, actual: p, openColumns: g, mode: o } = v, C = v.targetRow != null, R = T(I(v.row[n]) - p), K = { [n]: T(p) }, F = v.targetRow ?? v.row, L = C ? {} : K;
|
|
40
|
+
if (o === "none" || Math.abs(R) < 5e-3 || g.length === 0)
|
|
41
|
+
return { patch: K, moved: 0, unabsorbed: o === "none" ? 0 : R, targets: [] };
|
|
42
|
+
let f, k;
|
|
43
|
+
if (o === "next" ? (f = [g[0]], k = [1]) : o === "weighted" ? (f = g.filter((x) => I(F[x]) > 5e-3), k = f.map((x) => I(F[x])), f.length === 0 && C && R > 0 && (f = g, k = f.map(() => 1))) : (f = g, k = f.map(() => 1)), f.length === 0) return { patch: K, moved: 0, unabsorbed: R, targets: [] };
|
|
44
|
+
const S = k.reduce((x, j) => x + j, 0) || 1;
|
|
45
|
+
let b = R;
|
|
43
46
|
if (f.forEach((x, j) => {
|
|
44
|
-
const
|
|
45
|
-
L[x] =
|
|
46
|
-
}), Math.abs(
|
|
47
|
+
const N = j === f.length - 1 ? b : T(R * k[j] / S), y = Math.max(0, T(I(F[x]) + N)), i = T(y - I(F[x]));
|
|
48
|
+
L[x] = y, b = T(b - i);
|
|
49
|
+
}), Math.abs(b) >= 5e-3 && b < 0)
|
|
47
50
|
for (const x of f) {
|
|
48
|
-
if (Math.abs(
|
|
49
|
-
const j = Math.min(L[x], -
|
|
50
|
-
L[x] =
|
|
51
|
+
if (Math.abs(b) < 5e-3) break;
|
|
52
|
+
const j = Math.min(L[x], -b);
|
|
53
|
+
L[x] = T(L[x] - j), b = T(b + j);
|
|
51
54
|
}
|
|
52
|
-
return
|
|
55
|
+
return C ? {
|
|
53
56
|
patch: K,
|
|
54
57
|
targetPatch: L,
|
|
55
|
-
moved:
|
|
56
|
-
unabsorbed:
|
|
58
|
+
moved: T(R - b),
|
|
59
|
+
unabsorbed: b,
|
|
57
60
|
targets: f
|
|
58
|
-
} : { patch: L, moved:
|
|
61
|
+
} : { patch: L, moved: T(R - b), unabsorbed: b, targets: f };
|
|
59
62
|
}
|
|
60
|
-
const
|
|
61
|
-
function
|
|
63
|
+
const Lt = 176, Rt = 112, Mt = 128, be = "sticky left-0 z-[2] bg-white dark:bg-[hsl(var(--card))] border-r border-slate-200 dark:border-border", ke = "sticky right-0 z-[2] bg-white dark:bg-[hsl(var(--card))] border-l border-slate-200 dark:border-border", Ce = "bg-slate-50 dark:bg-white/[0.035]";
|
|
64
|
+
function Ya(v) {
|
|
62
65
|
const {
|
|
63
66
|
relatedCollection: n,
|
|
64
67
|
manyField: p,
|
|
65
|
-
parentId:
|
|
68
|
+
parentId: g,
|
|
66
69
|
config: o,
|
|
67
|
-
compareSeries:
|
|
68
|
-
stats:
|
|
70
|
+
compareSeries: C,
|
|
71
|
+
stats: R,
|
|
69
72
|
sumCap: K,
|
|
70
73
|
remaining: F,
|
|
71
74
|
readOnly: L = !1,
|
|
72
75
|
showHistory: f = !0,
|
|
73
|
-
emptyLabel:
|
|
74
|
-
} =
|
|
75
|
-
data:
|
|
76
|
-
isLoading:
|
|
77
|
-
dataUpdatedAt:
|
|
76
|
+
emptyLabel: k
|
|
77
|
+
} = v, S = oa(), b = ea(), x = va(), j = Na(), E = ia(), N = E == null ? void 0 : E.draft, { isAdmin: y } = da(), i = !g || g === "new", z = !L && !!x, m = o.value_fields, M = o.total_field ?? null, {
|
|
78
|
+
data: P = [],
|
|
79
|
+
isLoading: se,
|
|
80
|
+
dataUpdatedAt: ve
|
|
78
81
|
} = ce({
|
|
79
|
-
queryKey: ["o2m-rows", n, p,
|
|
80
|
-
queryFn: () =>
|
|
81
|
-
ue(`/items/${n}`, { filter: JSON.stringify({ [p]: { _eq:
|
|
82
|
+
queryKey: ["o2m-rows", n, p, g, ""],
|
|
83
|
+
queryFn: () => S.request(
|
|
84
|
+
ue(`/items/${n}`, { filter: JSON.stringify({ [p]: { _eq: g } }), limit: 200 })
|
|
82
85
|
).then((e) => e.data ?? []),
|
|
83
86
|
enabled: !i,
|
|
84
87
|
staleTime: 3e4
|
|
85
|
-
}),
|
|
86
|
-
queryKey: ["o2m-cell-provenance", n, p,
|
|
87
|
-
queryFn: () =>
|
|
88
|
+
}), q = ca(2e3), { data: le = {} } = ce({
|
|
89
|
+
queryKey: ["o2m-cell-provenance", n, p, g, ve],
|
|
90
|
+
queryFn: () => S.request(
|
|
88
91
|
ue("/revisions/o2m-cell-provenance", {
|
|
89
92
|
collection: n,
|
|
90
93
|
many_field: p,
|
|
91
|
-
parent_id:
|
|
94
|
+
parent_id: g
|
|
92
95
|
})
|
|
93
96
|
).then((e) => e.data ?? {}),
|
|
94
|
-
enabled:
|
|
97
|
+
enabled: q && f && !i && P.length > 0,
|
|
95
98
|
staleTime: 6e4,
|
|
96
99
|
placeholderData: (e) => e
|
|
97
|
-
}),
|
|
100
|
+
}), V = (e, a) => e.id ? `${n}:${e.id}:${a}` : void 0, oe = (e, a) => {
|
|
98
101
|
var l;
|
|
99
102
|
return e.id && !e.edited ? (l = le[e.id]) == null ? void 0 : l[a] : void 0;
|
|
100
|
-
},
|
|
103
|
+
}, w = $e(null), me = (e, a) => {
|
|
101
104
|
!e || typeof window > "u" || window.dispatchEvent(new CustomEvent("nvr:cell-editing", { detail: { cell: e, state: a } }));
|
|
102
|
-
},
|
|
103
|
-
var l,
|
|
104
|
-
const a = ((
|
|
105
|
-
a !==
|
|
106
|
-
},
|
|
105
|
+
}, jt = (e) => {
|
|
106
|
+
var l, r, s;
|
|
107
|
+
const a = ((s = (r = (l = e.target) == null ? void 0 : l.closest) == null ? void 0 : r.call(l, "[data-grid-cell]")) == null ? void 0 : s.getAttribute("data-grid-cell")) ?? null;
|
|
108
|
+
a !== w.current && (w.current && me(w.current, "end"), w.current = a, a && me(a, "start"));
|
|
109
|
+
}, Ft = (e) => {
|
|
107
110
|
var a, l;
|
|
108
|
-
(l = (a = e.relatedTarget) == null ? void 0 : a.closest) != null && l.call(a, "[data-grid-cell]") || (
|
|
111
|
+
(l = (a = e.relatedTarget) == null ? void 0 : a.closest) != null && l.call(a, "[data-grid-cell]") || (w.current && me(w.current, "end"), w.current = null);
|
|
109
112
|
};
|
|
110
|
-
|
|
113
|
+
pe(
|
|
111
114
|
() => () => {
|
|
112
|
-
|
|
115
|
+
w.current && me(w.current, "end");
|
|
113
116
|
},
|
|
114
117
|
[]
|
|
115
118
|
);
|
|
116
|
-
const
|
|
117
|
-
() =>
|
|
118
|
-
[
|
|
119
|
-
),
|
|
120
|
-
client:
|
|
121
|
-
endpoint:
|
|
122
|
-
enabled:
|
|
123
|
-
}), c =
|
|
119
|
+
const Pe = G(
|
|
120
|
+
() => C != null && C.endpoint ? ha(C.endpoint, N) : null,
|
|
121
|
+
[C == null ? void 0 : C.endpoint, N]
|
|
122
|
+
), Be = fa({
|
|
123
|
+
client: S,
|
|
124
|
+
endpoint: Pe,
|
|
125
|
+
enabled: !!C && !i
|
|
126
|
+
}), c = C && !i ? Be.data ?? null : null, he = G(() => !o.split_endpoint || i ? null : o.split_endpoint.replace(
|
|
124
127
|
/\$parent\.([A-Za-z_][A-Za-z0-9_]*)/g,
|
|
125
|
-
(e, a) => String(a === "id" ?
|
|
126
|
-
), [o.split_endpoint, i,
|
|
127
|
-
queryKey:
|
|
128
|
-
queryFn: () =>
|
|
129
|
-
enabled: !!
|
|
128
|
+
(e, a) => String(a === "id" ? g : (N == null ? void 0 : N[a]) ?? "")
|
|
129
|
+
), [o.split_endpoint, i, g, N]), De = G(() => ["plan-grid-split-info", he], [he]), { data: ie = null } = ce({
|
|
130
|
+
queryKey: De,
|
|
131
|
+
queryFn: () => S.request(ue(he)).then((e) => e.data ?? null).catch(() => null),
|
|
132
|
+
enabled: !!he,
|
|
130
133
|
staleTime: 3e4
|
|
131
|
-
}), { data:
|
|
134
|
+
}), { data: ut = {} } = ce({
|
|
132
135
|
queryKey: ["plan-grid-categories", o.category_collection, o.category_label_field],
|
|
133
136
|
queryFn: async () => {
|
|
134
|
-
const e = o.category_label_field ?? "name", a = await
|
|
137
|
+
const e = o.category_label_field ?? "name", a = await S.request(
|
|
135
138
|
ue(`/items/${o.category_collection}`, { fields: `id,${e}`, limit: 100 })
|
|
136
139
|
);
|
|
137
140
|
return Object.fromEntries((a.data ?? []).map((l) => [String(l.id), String(l[e] ?? l.id)]));
|
|
138
141
|
},
|
|
139
142
|
enabled: !!o.category_collection,
|
|
140
143
|
staleTime: 10 * 6e4
|
|
141
|
-
}),
|
|
142
|
-
(e) => e ===
|
|
143
|
-
[
|
|
144
|
-
),
|
|
144
|
+
}), Se = ee(
|
|
145
|
+
(e) => e === Ie ? o.unclassified_label ?? "Unclassified" : ut[e] ?? `#${e}`,
|
|
146
|
+
[ut, o.unclassified_label]
|
|
147
|
+
), ze = G(() => (o.categories ?? []).map(String), [o.categories]), Ue = (x == null ? void 0 : x.getPendingRows(n, p)) ?? [], fe = x == null ? void 0 : x.getPendingEdits(n, p), xe = x == null ? void 0 : x.getPendingDeletes(n, p), qe = Ue.length + ((fe == null ? void 0 : fe.size) ?? 0) + ((xe == null ? void 0 : xe.size) ?? 0), pt = $e(qe);
|
|
148
|
+
pe(() => {
|
|
149
|
+
const e = pt.current;
|
|
150
|
+
if (pt.current = qe, i || !(e > 0 && qe === 0)) return;
|
|
151
|
+
const a = () => void b.invalidateQueries({ predicate: (r) => Sa(r.queryKey, g) });
|
|
152
|
+
a();
|
|
153
|
+
const l = setTimeout(a, 2e3);
|
|
154
|
+
return () => clearTimeout(l);
|
|
155
|
+
}, [qe, i, g, b]);
|
|
156
|
+
const Z = G(() => {
|
|
145
157
|
const e = [], a = (l) => l && typeof l == "object" && "id" in l ? l.id : l;
|
|
146
|
-
for (const l of
|
|
147
|
-
const
|
|
148
|
-
if (
|
|
149
|
-
const
|
|
158
|
+
for (const l of P) {
|
|
159
|
+
const r = String(l.id);
|
|
160
|
+
if (xe != null && xe.has(r)) continue;
|
|
161
|
+
const s = fe == null ? void 0 : fe.get(r), u = s ? { ...l, ...s } : l, O = a(u[o.category_field]);
|
|
150
162
|
e.push({
|
|
151
|
-
uid: `s:${
|
|
152
|
-
id:
|
|
163
|
+
uid: `s:${r}`,
|
|
164
|
+
id: r,
|
|
153
165
|
pendingIndex: null,
|
|
154
166
|
key: String(a(u[o.key_field]) ?? ""),
|
|
155
167
|
cat: O == null || O === "" ? null : String(O),
|
|
156
168
|
values: u,
|
|
157
|
-
edited: !!
|
|
169
|
+
edited: !!s && Object.keys(s).some((U) => !U.startsWith("_")),
|
|
158
170
|
isNew: !1
|
|
159
171
|
});
|
|
160
172
|
}
|
|
161
|
-
return
|
|
162
|
-
const
|
|
173
|
+
return Ue.forEach((l, r) => {
|
|
174
|
+
const s = a(l[o.category_field]);
|
|
163
175
|
e.push({
|
|
164
|
-
uid: `p:${
|
|
176
|
+
uid: `p:${r}`,
|
|
165
177
|
id: null,
|
|
166
|
-
pendingIndex:
|
|
178
|
+
pendingIndex: r,
|
|
167
179
|
key: String(a(l[o.key_field]) ?? ""),
|
|
168
|
-
cat:
|
|
180
|
+
cat: s == null || s === "" ? null : String(s),
|
|
169
181
|
values: l,
|
|
170
182
|
edited: !1,
|
|
171
183
|
isNew: !0
|
|
172
184
|
});
|
|
173
185
|
}), e;
|
|
174
|
-
}, [
|
|
175
|
-
(e) =>
|
|
186
|
+
}, [P, Ue, fe, xe, o.key_field, o.category_field]), Y = ee(
|
|
187
|
+
(e) => T(m.reduce((a, l) => a + I(e[l]), 0)),
|
|
176
188
|
[m]
|
|
177
|
-
),
|
|
189
|
+
), re = G(() => {
|
|
178
190
|
const e = /* @__PURE__ */ new Map();
|
|
179
191
|
for (const a of Z) {
|
|
180
192
|
if (!a.key) continue;
|
|
@@ -182,288 +194,288 @@ function Ja(_) {
|
|
|
182
194
|
l || (l = { key: a.key, mode: "top", top: null, cats: [] }, e.set(a.key, l)), a.cat == null ? l.top = l.top ?? a : l.cats.push(a);
|
|
183
195
|
}
|
|
184
196
|
for (const a of e.values())
|
|
185
|
-
a.cats.length && (a.mode = "split", a.cats.sort((l,
|
|
186
|
-
const
|
|
187
|
-
return (
|
|
197
|
+
a.cats.length && (a.mode = "split", a.cats.sort((l, r) => {
|
|
198
|
+
const s = ze.indexOf(l.cat), u = ze.indexOf(r.cat);
|
|
199
|
+
return (s < 0 ? 99 : s) - (u < 0 ? 99 : u);
|
|
188
200
|
}));
|
|
189
201
|
for (const a of (c == null ? void 0 : c.rows) ?? []) {
|
|
190
202
|
const l = String(a.key);
|
|
191
|
-
e.has(l) || m.some((
|
|
203
|
+
e.has(l) || m.some((r) => Math.abs(I(a.values[r])) >= 5e-3) && e.set(l, { key: l, mode: "ghost", top: null, cats: [] });
|
|
192
204
|
}
|
|
193
205
|
return [...e.values()].sort(
|
|
194
206
|
(a, l) => Number(a.key) - Number(l.key) || a.key.localeCompare(l.key)
|
|
195
207
|
);
|
|
196
|
-
}, [Z, c, m,
|
|
197
|
-
() => Z.map((e) =>
|
|
198
|
-
[Z,
|
|
199
|
-
),
|
|
200
|
-
|
|
201
|
-
if (
|
|
202
|
-
if (
|
|
203
|
-
|
|
208
|
+
}, [Z, c, m, ze]), _e = G(
|
|
209
|
+
() => Z.map((e) => M ? { ...e.values, [M]: Y(e.values) } : e.values),
|
|
210
|
+
[Z, M, Y]
|
|
211
|
+
), ge = j == null ? void 0 : j.report;
|
|
212
|
+
pe(() => {
|
|
213
|
+
if (ge) {
|
|
214
|
+
if (se) {
|
|
215
|
+
ge(n, p, null);
|
|
204
216
|
return;
|
|
205
217
|
}
|
|
206
|
-
|
|
218
|
+
ge(n, p, _e);
|
|
207
219
|
}
|
|
208
|
-
}, [
|
|
209
|
-
const
|
|
220
|
+
}, [ge, n, p, _e, se]);
|
|
221
|
+
const mt = $e(() => {
|
|
210
222
|
});
|
|
211
|
-
|
|
212
|
-
const
|
|
223
|
+
mt.current = () => ge == null ? void 0 : ge(n, p, null), pe(() => () => mt.current(), []);
|
|
224
|
+
const Oe = ee(
|
|
213
225
|
(e) => {
|
|
214
|
-
if (e.startsWith("$parent.")) return (
|
|
226
|
+
if (e.startsWith("$parent.")) return (N == null ? void 0 : N[e.slice(8)]) ?? 0;
|
|
215
227
|
if (e.startsWith("$sum.")) {
|
|
216
228
|
const a = e.slice(5);
|
|
217
|
-
return
|
|
229
|
+
return _e.reduce((l, r) => l + I(r[a]), 0);
|
|
218
230
|
}
|
|
219
|
-
return e === "$count" ?
|
|
231
|
+
return e === "$count" ? _e.length : N == null ? void 0 : N[e];
|
|
220
232
|
},
|
|
221
|
-
[
|
|
222
|
-
),
|
|
223
|
-
() => (
|
|
224
|
-
[
|
|
225
|
-
),
|
|
226
|
-
() =>
|
|
233
|
+
[N, _e]
|
|
234
|
+
), ht = G(
|
|
235
|
+
() => (R ?? []).map((e) => ({ ...e, result: at(e.value, Oe) })),
|
|
236
|
+
[R, Oe]
|
|
237
|
+
), He = G(
|
|
238
|
+
() => T(Z.reduce((e, a) => e + Y(a.values), 0)),
|
|
227
239
|
[Z, Y]
|
|
228
|
-
),
|
|
229
|
-
const a =
|
|
230
|
-
Z.filter((l) => l.cat === String(e.id)).reduce((l,
|
|
240
|
+
), Le = G(() => ie ? ie.categories.filter((e) => e.cap > 5e-3 || Z.some((a) => a.cat === String(e.id))).map((e) => {
|
|
241
|
+
const a = T(
|
|
242
|
+
Z.filter((l) => l.cat === String(e.id)).reduce((l, r) => l + Y(r.values), 0)
|
|
231
243
|
);
|
|
232
244
|
return {
|
|
233
245
|
id: String(e.id),
|
|
234
246
|
label: e.label,
|
|
235
247
|
cap: e.cap,
|
|
236
248
|
planned: a,
|
|
237
|
-
left:
|
|
249
|
+
left: T(e.cap - a)
|
|
238
250
|
};
|
|
239
251
|
}) : [], [ie, Z, Y]), J = ee(
|
|
240
|
-
(e, a) =>
|
|
252
|
+
(e, a) => xa(c, e, a),
|
|
241
253
|
[c]
|
|
242
|
-
),
|
|
243
|
-
(e, a) => !
|
|
244
|
-
[
|
|
245
|
-
),
|
|
254
|
+
), je = ee(
|
|
255
|
+
(e, a) => !z || J(e, a) && !!(c != null && c.closed_locked) && !y,
|
|
256
|
+
[z, J, c == null ? void 0 : c.closed_locked, y]
|
|
257
|
+
), Re = ee(
|
|
246
258
|
(e, a, l) => {
|
|
247
|
-
var u, O,
|
|
248
|
-
const
|
|
249
|
-
if (!
|
|
250
|
-
if (a == null) return { value: I(
|
|
251
|
-
const
|
|
252
|
-
return { value: I(
|
|
259
|
+
var u, O, U;
|
|
260
|
+
const r = c == null ? void 0 : c.rows.find((A) => String(A.key) === e);
|
|
261
|
+
if (!r) return { value: 0, details: [] };
|
|
262
|
+
if (a == null) return { value: I(r.values[l]), details: ((u = r.details) == null ? void 0 : u[l]) ?? [] };
|
|
263
|
+
const s = (O = r.by_category) == null ? void 0 : O[a];
|
|
264
|
+
return { value: I(s == null ? void 0 : s.values[l]), details: ((U = s == null ? void 0 : s.details) == null ? void 0 : U[l]) ?? [] };
|
|
253
265
|
},
|
|
254
266
|
[c]
|
|
255
|
-
), [
|
|
256
|
-
(e, a, l,
|
|
267
|
+
), [ft, We] = H(null), X = ee(
|
|
268
|
+
(e, a, l, r) => {
|
|
257
269
|
if (!x) return !1;
|
|
258
|
-
const
|
|
259
|
-
if (
|
|
270
|
+
const s = (r == null ? void 0 : r.credit) ?? 0, u = { ...e.values, ...a }, O = Y(e.values), U = Y(u);
|
|
271
|
+
if (U - s > O + 5e-3) {
|
|
260
272
|
if (K) {
|
|
261
|
-
const A =
|
|
262
|
-
if (A != null &&
|
|
263
|
-
return
|
|
264
|
-
`${K.message ?? `${K.label ?? "The total"} cannot exceed ${D(A)}`} — this would reach ${D(
|
|
273
|
+
const A = at(K.cap, Oe), _ = T(He - O + U - s);
|
|
274
|
+
if (A != null && _ > A + 5e-3)
|
|
275
|
+
return We(
|
|
276
|
+
`${K.message ?? `${K.label ?? "The total"} cannot exceed ${D(A)}`} — this would reach ${D(_)}, ${D(T(_ - A))} over.`
|
|
265
277
|
), !1;
|
|
266
278
|
}
|
|
267
279
|
if (e.cat != null) {
|
|
268
|
-
const A =
|
|
280
|
+
const A = Le.find((_) => _.id === e.cat);
|
|
269
281
|
if (A) {
|
|
270
|
-
const
|
|
271
|
-
if (
|
|
272
|
-
return
|
|
273
|
-
`${A.label} would reach ${D(
|
|
282
|
+
const _ = T(A.planned - O + U - s);
|
|
283
|
+
if (_ > A.cap + 5e-3)
|
|
284
|
+
return We(
|
|
285
|
+
`${A.label} would reach ${D(_)} — ${D(T(_ - A.cap))} over its ${D(A.cap)}.`
|
|
274
286
|
), !1;
|
|
275
287
|
}
|
|
276
288
|
}
|
|
277
289
|
}
|
|
278
|
-
return
|
|
290
|
+
return We(null), e.id ? x.queueEdit(n, p, e.id, {
|
|
279
291
|
...a,
|
|
280
292
|
...l ? { _change_reason: l } : {},
|
|
281
|
-
...
|
|
293
|
+
...r != null && r.early ? { __flush_early: !0 } : {}
|
|
282
294
|
}) : e.pendingIndex != null && x.updateRow(n, p, e.pendingIndex, {
|
|
283
295
|
...e.values,
|
|
284
296
|
...a,
|
|
285
297
|
...l ? { _change_reason: l } : {}
|
|
286
298
|
}), !0;
|
|
287
299
|
},
|
|
288
|
-
[x, Y, K,
|
|
289
|
-
),
|
|
290
|
-
(e, a, l,
|
|
300
|
+
[x, Y, K, Oe, He, Le, n, p]
|
|
301
|
+
), Me = ee(
|
|
302
|
+
(e, a, l, r) => {
|
|
291
303
|
x && x.queueRow(n, p, {
|
|
292
304
|
[o.key_field]: e,
|
|
293
|
-
...
|
|
294
|
-
...Object.fromEntries(m.map((
|
|
305
|
+
...r != null ? { [o.category_field]: /^\d+$/.test(r) ? Number(r) : r } : {},
|
|
306
|
+
...Object.fromEntries(m.map((s) => [s, (a == null ? void 0 : a[s]) ?? 0])),
|
|
295
307
|
...l ? { _change_reason: l } : {}
|
|
296
308
|
});
|
|
297
309
|
},
|
|
298
310
|
[x, n, p, o.key_field, o.category_field, m]
|
|
299
|
-
), { data:
|
|
311
|
+
), { data: Qe } = ce({
|
|
300
312
|
queryKey: ["plan-grid-keys", o.key_collection],
|
|
301
|
-
queryFn: () =>
|
|
313
|
+
queryFn: () => S.request(
|
|
302
314
|
ue(`/items/${o.key_collection}`, { fields: "id", sort: "-id", limit: 200 })
|
|
303
315
|
).then((e) => (e.data ?? []).map((a) => a.id)),
|
|
304
316
|
enabled: !!o.key_collection && !!(c != null && c.closed_through),
|
|
305
317
|
staleTime: 10 * 6e4
|
|
306
|
-
}),
|
|
318
|
+
}), Ve = ee(
|
|
307
319
|
(e, a) => {
|
|
308
320
|
const l = Number(e);
|
|
309
321
|
if (!Number.isInteger(l)) return null;
|
|
310
|
-
const
|
|
311
|
-
let O = null,
|
|
312
|
-
return o.key_collection &&
|
|
322
|
+
const r = String(l + 1), s = m.filter((A) => !J(r, A)), u = re.find((A) => A.key === r);
|
|
323
|
+
let O = null, U = null;
|
|
324
|
+
return o.key_collection && Qe && !Qe.some((A) => String(A) === r) ? U = `${r} is not set up yet` : s.length === 0 ? U = `${r} has no open period either` : (u == null ? void 0 : u.mode) === "split" ? a == null ? U = `${r} is planned by category and this line is not` : O = u.cats.find((A) => A.cat === a) ?? null : (u == null ? void 0 : u.mode) === "top" && (a != null ? U = `${r} is planned as one line and this one is by category` : O = u.top), { key: r, cat: a, openColumns: s, row: O, blocked: U };
|
|
313
325
|
},
|
|
314
|
-
[m, J,
|
|
315
|
-
),
|
|
316
|
-
(e, a, l,
|
|
317
|
-
if (!
|
|
318
|
-
const
|
|
319
|
-
Y({ ...(u == null ? void 0 : u.values) ?? {}, ...
|
|
326
|
+
[m, J, re, o.key_collection, Qe]
|
|
327
|
+
), Je = ee(
|
|
328
|
+
(e, a, l, r) => {
|
|
329
|
+
if (!r || Object.keys(r.patch).length === 0) return X(e, a, l);
|
|
330
|
+
const s = T(Y({ ...e.values, ...a }) - Y(e.values)), u = r.target.row, O = T(
|
|
331
|
+
Y({ ...(u == null ? void 0 : u.values) ?? {}, ...r.patch }) - Y((u == null ? void 0 : u.values) ?? {})
|
|
320
332
|
);
|
|
321
|
-
return
|
|
333
|
+
return s <= 0 ? u ? X(u, r.patch, l, { credit: -s }) ? X(e, a, l, { early: !0 }) : !1 : O > -s + 5e-3 || !X(e, a, l, { early: !0 }) ? !1 : (Me(Number(r.target.key), r.patch, l, r.target.cat), !0) : u ? X(e, a, l, { credit: -O }) ? X(u, r.patch, l, { early: !0 }) : !1 : X(e, a, l);
|
|
322
334
|
},
|
|
323
|
-
[X, Y,
|
|
324
|
-
),
|
|
335
|
+
[X, Y, Me]
|
|
336
|
+
), At = ee(
|
|
325
337
|
(e) => {
|
|
326
338
|
if (!x) return;
|
|
327
339
|
const a = [...e.top ? [e.top] : [], ...e.cats];
|
|
328
|
-
for (const l of a.filter((
|
|
340
|
+
for (const l of a.filter((r) => r.pendingIndex != null).sort((r, s) => (s.pendingIndex ?? 0) - (r.pendingIndex ?? 0)))
|
|
329
341
|
x.removeRow(n, p, l.pendingIndex);
|
|
330
342
|
for (const l of a) l.id && x.queueDelete(n, p, l.id);
|
|
331
343
|
},
|
|
332
344
|
[x, n, p]
|
|
333
|
-
),
|
|
334
|
-
|
|
335
|
-
}, [
|
|
345
|
+
), Kt = ee(() => {
|
|
346
|
+
b.invalidateQueries({ queryKey: ["o2m-rows", n, p, g] }), b.invalidateQueries({ queryKey: De }), Pe && b.invalidateQueries({ queryKey: ["o2m-compare", Pe] });
|
|
347
|
+
}, [b, n, p, g, De, Pe]), Ge = $e(null), ye = G(() => {
|
|
336
348
|
const e = [];
|
|
337
|
-
for (const a of
|
|
349
|
+
for (const a of re)
|
|
338
350
|
if (a.mode === "top" && a.top && e.push(a.top.uid), a.mode === "split") for (const l of a.cats) e.push(l.uid);
|
|
339
351
|
return e;
|
|
340
|
-
}, [
|
|
341
|
-
var
|
|
342
|
-
const l = (
|
|
352
|
+
}, [re]), xt = ee((e, a) => {
|
|
353
|
+
var r;
|
|
354
|
+
const l = (r = Ge.current) == null ? void 0 : r.querySelector(`[data-pg-cell="${e}:${a}"]`);
|
|
343
355
|
return l ? (l.focus(), l.select(), !0) : !1;
|
|
344
|
-
}, []),
|
|
345
|
-
(e, a, l,
|
|
346
|
-
let
|
|
356
|
+
}, []), gt = ee(
|
|
357
|
+
(e, a, l, r) => {
|
|
358
|
+
let s = ye.indexOf(e), u = m.indexOf(a);
|
|
347
359
|
for (let O = 0; O < 40; O++)
|
|
348
|
-
if (
|
|
360
|
+
if (s += l, u += r, s < 0 || s >= ye.length || u < 0 || u >= m.length || xt(ye[s], m[u])) return;
|
|
349
361
|
},
|
|
350
|
-
[
|
|
351
|
-
),
|
|
362
|
+
[ye, m, xt]
|
|
363
|
+
), yt = ee(
|
|
352
364
|
(e, a, l) => {
|
|
353
|
-
const
|
|
354
|
-
`).filter((
|
|
365
|
+
const r = l.replace(/\r/g, "").split(`
|
|
366
|
+
`).filter((U) => U.trim() !== ""), s = ye.indexOf(e.uid), u = m.indexOf(a);
|
|
355
367
|
let O = 0;
|
|
356
|
-
|
|
357
|
-
const
|
|
358
|
-
if (!
|
|
359
|
-
const
|
|
360
|
-
|
|
361
|
-
const
|
|
362
|
-
if (
|
|
363
|
-
const ae =
|
|
364
|
-
ae == null || ae < 0 || (
|
|
365
|
-
}), Object.keys(
|
|
368
|
+
r.forEach((U, A) => {
|
|
369
|
+
const _ = Z.find((te) => te.uid === ye[s + A]);
|
|
370
|
+
if (!_) return;
|
|
371
|
+
const W = {};
|
|
372
|
+
U.split(" ").forEach((te, h) => {
|
|
373
|
+
const $ = m[u + h];
|
|
374
|
+
if (!$ || je(_.key, $)) return;
|
|
375
|
+
const ae = qt(te);
|
|
376
|
+
ae == null || ae < 0 || (W[$] = ae);
|
|
377
|
+
}), Object.keys(W).length && X(_, W) && (O += Object.keys(W).length);
|
|
366
378
|
}), O && de.success(`Pasted ${O} ${O === 1 ? "figure" : "figures"}`);
|
|
367
379
|
},
|
|
368
|
-
[
|
|
369
|
-
), [
|
|
370
|
-
|
|
380
|
+
[ye, m, Z, je, X]
|
|
381
|
+
), [It, bt] = H(/* @__PURE__ */ new Set()), Ze = $e(null);
|
|
382
|
+
pe(() => {
|
|
371
383
|
const e = (a) => {
|
|
372
384
|
const l = a.detail;
|
|
373
385
|
if (!l || l.collection !== n || l.rowId == null) return;
|
|
374
|
-
const
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
}, 8e3),
|
|
378
|
-
if (!
|
|
379
|
-
const u = new Set(
|
|
380
|
-
return u.delete(
|
|
386
|
+
const r = Z.find((s) => s.id === String(l.rowId));
|
|
387
|
+
r && (l.handled = !0, Ze.current !== r.id && (Ze.current = r.id, window.setTimeout(() => {
|
|
388
|
+
Ze.current = null;
|
|
389
|
+
}, 8e3), bt((s) => {
|
|
390
|
+
if (!s.has(r.key)) return s;
|
|
391
|
+
const u = new Set(s);
|
|
392
|
+
return u.delete(r.key), u;
|
|
381
393
|
}), window.setTimeout(() => {
|
|
382
394
|
var u;
|
|
383
|
-
const
|
|
384
|
-
|
|
395
|
+
const s = (u = Ge.current) == null ? void 0 : u.querySelector(`[data-o2m-row="${n}:${r.id}"]`);
|
|
396
|
+
s && (s.scrollIntoView({ block: "center", behavior: "smooth" }), s.classList.remove("nvr-row-flash"), s.offsetWidth, s.classList.add("nvr-row-flash"));
|
|
385
397
|
}, 60)));
|
|
386
398
|
};
|
|
387
399
|
return window.addEventListener("nvr:grid-open-row", e), () => window.removeEventListener("nvr:grid-open-row", e);
|
|
388
400
|
}, [n, Z]);
|
|
389
|
-
const [
|
|
401
|
+
const [Bt, Dt] = H(() => {
|
|
390
402
|
try {
|
|
391
403
|
return new Set(
|
|
392
|
-
JSON.parse(localStorage.getItem(`nvr_pg_dismissed:${n}:${
|
|
404
|
+
JSON.parse(localStorage.getItem(`nvr_pg_dismissed:${n}:${g}`) ?? "[]")
|
|
393
405
|
);
|
|
394
406
|
} catch {
|
|
395
407
|
return /* @__PURE__ */ new Set();
|
|
396
408
|
}
|
|
397
|
-
}),
|
|
398
|
-
|
|
399
|
-
const
|
|
409
|
+
}), kt = ((c == null ? void 0 : c.proposals) ?? []).filter((e) => !Bt.has(e.id)), vt = (e, a) => {
|
|
410
|
+
Dt((l) => {
|
|
411
|
+
const r = new Set(l).add(e.id);
|
|
400
412
|
if (a)
|
|
401
413
|
try {
|
|
402
|
-
localStorage.setItem(`nvr_pg_dismissed:${n}:${
|
|
414
|
+
localStorage.setItem(`nvr_pg_dismissed:${n}:${g}`, JSON.stringify([...r]));
|
|
403
415
|
} catch {
|
|
404
416
|
}
|
|
405
|
-
return
|
|
417
|
+
return r;
|
|
406
418
|
});
|
|
407
|
-
},
|
|
419
|
+
}, zt = (e) => {
|
|
408
420
|
let a = 0;
|
|
409
421
|
for (const l of e.rows) {
|
|
410
|
-
const
|
|
411
|
-
if ((
|
|
422
|
+
const r = String(l.key), s = re.find((_) => _.key === r);
|
|
423
|
+
if ((s == null ? void 0 : s.mode) === "split" != (l.category != null)) continue;
|
|
412
424
|
const u = e.mode === "add", O = Object.fromEntries(
|
|
413
425
|
Object.entries(l.values).filter(
|
|
414
|
-
([
|
|
426
|
+
([_, W]) => m.includes(_) && !J(r, _) && (u ? I(W) !== 0 : I(W) > 0)
|
|
415
427
|
)
|
|
416
|
-
),
|
|
417
|
-
Object.entries(O).map(([
|
|
418
|
-
), A = l.category != null ?
|
|
428
|
+
), U = (_) => Object.fromEntries(
|
|
429
|
+
Object.entries(O).map(([W, te]) => [W, Math.max(0, T(I(_ == null ? void 0 : _[W]) + I(te)))]).filter(([W, te]) => Math.abs(te - I(_ == null ? void 0 : _[W])) >= 5e-3)
|
|
430
|
+
), A = l.category != null ? s == null ? void 0 : s.cats.find((_) => String(_.cat) === String(l.category)) : null;
|
|
419
431
|
if (l.category != null) {
|
|
420
432
|
if (!A) continue;
|
|
421
|
-
const
|
|
422
|
-
Object.keys(
|
|
423
|
-
} else if (
|
|
424
|
-
const
|
|
433
|
+
const _ = u ? U(A.values) : Object.fromEntries(Object.entries(O).filter(([W]) => I(A.values[W]) === 0));
|
|
434
|
+
Object.keys(_).length && X(A, _, e.change_reason) && (a += Object.keys(_).length);
|
|
435
|
+
} else if (s != null && s.top) {
|
|
436
|
+
const _ = u ? U(s.top.values) : Object.fromEntries(Object.entries(O).filter(([W]) => {
|
|
425
437
|
var te;
|
|
426
|
-
return I((te =
|
|
438
|
+
return I((te = s.top) == null ? void 0 : te.values[W]) === 0;
|
|
427
439
|
}));
|
|
428
|
-
Object.keys(
|
|
429
|
-
} else Object.keys(O).length && !(u && Object.values(O).every((
|
|
440
|
+
Object.keys(_).length && X(s.top, _, e.change_reason) && (a += Object.keys(_).length);
|
|
441
|
+
} else Object.keys(O).length && !(u && Object.values(O).every((_) => I(_) < 0)) && (Me(l.key, u ? U(void 0) : O, e.change_reason), a += Object.keys(O).length);
|
|
430
442
|
}
|
|
431
443
|
a ? de.success(
|
|
432
444
|
`${e.label}: ${a} ${a === 1 ? "figure" : "figures"} staged — Save to keep them`
|
|
433
445
|
) : de.message(
|
|
434
446
|
e.mode === "add" ? "Nothing to move — no open period could take it" : "Nothing to fill — those periods already hold a figure"
|
|
435
|
-
),
|
|
436
|
-
}, [
|
|
447
|
+
), vt(e, !1);
|
|
448
|
+
}, [Q, Ye] = H(null), Fe = wa(), Xe = Q && (Fe != null && Fe.renderRowHistory) ? Fe.renderRowHistory({
|
|
437
449
|
collection: n,
|
|
438
|
-
parentId:
|
|
439
|
-
rowId:
|
|
440
|
-
key:
|
|
441
|
-
category:
|
|
442
|
-
categoryLabel: (e) =>
|
|
443
|
-
onClose: () =>
|
|
444
|
-
}) : null, { data:
|
|
445
|
-
queryKey: ["o2m-row-revisions", n,
|
|
446
|
-
queryFn: () =>
|
|
447
|
-
ue("/revisions", { collection: n, item: String(
|
|
450
|
+
parentId: g,
|
|
451
|
+
rowId: Q.id,
|
|
452
|
+
key: Q.key,
|
|
453
|
+
category: Q.cat,
|
|
454
|
+
categoryLabel: (e) => Se(String(e)),
|
|
455
|
+
onClose: () => Ye(null)
|
|
456
|
+
}) : null, { data: Ut = [], isLoading: Ht } = ce({
|
|
457
|
+
queryKey: ["o2m-row-revisions", n, Q == null ? void 0 : Q.id],
|
|
458
|
+
queryFn: () => S.request(
|
|
459
|
+
ue("/revisions", { collection: n, item: String(Q == null ? void 0 : Q.id) })
|
|
448
460
|
).then((e) => e.data ?? []),
|
|
449
|
-
enabled: !!(
|
|
461
|
+
enabled: !!(Q != null && Q.id) && Xe == null,
|
|
450
462
|
staleTime: 15e3
|
|
451
|
-
}), { data:
|
|
463
|
+
}), { data: Nt = [] } = ce({
|
|
452
464
|
queryKey: ["plan-grid-fields", n],
|
|
453
|
-
queryFn: () =>
|
|
454
|
-
enabled: !!
|
|
465
|
+
queryFn: () => S.request(ue(`/field-config/${n}`)).then((e) => e.data ?? []),
|
|
466
|
+
enabled: !!Q,
|
|
455
467
|
staleTime: 5 * 6e4
|
|
456
|
-
}), [
|
|
457
|
-
if (
|
|
458
|
-
const e = m.filter((a) => J(String(
|
|
468
|
+
}), [et, Wt] = H(!1), wt = re.some((e) => e.mode === "split"), Ae = Pt(c), Ne = (c == null ? void 0 : c.label) ?? (C == null ? void 0 : C.label) ?? "Actual", Ke = ga(c == null ? void 0 : c.closed_through), Te = c != null && c.closed_through ? Number(c.closed_through.split("-")[0]) : null, Qt = G(() => {
|
|
469
|
+
if (Te == null) return null;
|
|
470
|
+
const e = m.filter((a) => J(String(Te), a));
|
|
459
471
|
return e[e.length - 1] ?? null;
|
|
460
|
-
}, [
|
|
461
|
-
() => new Set(
|
|
462
|
-
[
|
|
463
|
-
),
|
|
464
|
-
let a =
|
|
472
|
+
}, [Te, m, J]), Vt = G(
|
|
473
|
+
() => new Set(re.filter((e) => e.mode !== "ghost").map((e) => e.key)),
|
|
474
|
+
[re]
|
|
475
|
+
), Jt = F ? at(F, Oe) : null, Gt = (e) => {
|
|
476
|
+
let a = Jt ?? 0;
|
|
465
477
|
if (e.cat != null) {
|
|
466
|
-
const u =
|
|
478
|
+
const u = Le.find((O) => O.id === e.cat);
|
|
467
479
|
u && (a = Math.min(a, u.left));
|
|
468
480
|
}
|
|
469
481
|
const l = m.filter((u) => !J(e.key, u) && I(e.values[u]) === 0);
|
|
@@ -473,43 +485,43 @@ function Ja(_) {
|
|
|
473
485
|
);
|
|
474
486
|
return;
|
|
475
487
|
}
|
|
476
|
-
const
|
|
488
|
+
const r = Math.floor(a / l.length * 100) / 100, s = {};
|
|
477
489
|
l.forEach((u, O) => {
|
|
478
|
-
|
|
479
|
-
}), X(e,
|
|
480
|
-
},
|
|
490
|
+
s[u] = O === l.length - 1 ? T(a - r * (l.length - 1)) : r;
|
|
491
|
+
}), X(e, s) && de.success(`${D(a)} spread over ${l.length} open periods`);
|
|
492
|
+
}, tt = G(() => {
|
|
481
493
|
const e = {}, a = {};
|
|
482
494
|
for (const l of m)
|
|
483
|
-
e[l] =
|
|
495
|
+
e[l] = T(Z.reduce((r, s) => r + I(s.values[l]), 0)), a[l] = T(((c == null ? void 0 : c.rows) ?? []).reduce((r, s) => r + I(s.values[l]), 0));
|
|
484
496
|
return { planBy: e, actualBy: a };
|
|
485
|
-
}, [m, Z, c]),
|
|
486
|
-
return !i &&
|
|
497
|
+
}, [m, Z, c]), Zt = Lt + m.length * Rt + Mt;
|
|
498
|
+
return !i && se ? /* @__PURE__ */ t("div", { className: "space-y-1.5", "data-plan-grid-loading": !0, children: [0, 1, 2].map((e) => /* @__PURE__ */ t(
|
|
487
499
|
"div",
|
|
488
500
|
{
|
|
489
501
|
className: "h-8 animate-pulse rounded",
|
|
490
502
|
style: { background: "hsl(var(--nvr-skeleton))" }
|
|
491
503
|
},
|
|
492
504
|
e
|
|
493
|
-
)) }) : /* @__PURE__ */ d("div", { ref:
|
|
494
|
-
c &&
|
|
495
|
-
|
|
505
|
+
)) }) : /* @__PURE__ */ d("div", { ref: Ge, "data-plan-grid": n, className: "min-w-0", children: [
|
|
506
|
+
c && kt.length > 0 && z && /* @__PURE__ */ t(
|
|
507
|
+
ya,
|
|
496
508
|
{
|
|
497
|
-
proposals:
|
|
498
|
-
onApply:
|
|
499
|
-
onDismiss: (e) =>
|
|
509
|
+
proposals: kt,
|
|
510
|
+
onApply: zt,
|
|
511
|
+
onDismiss: (e) => vt(e, !0)
|
|
500
512
|
}
|
|
501
513
|
),
|
|
502
|
-
(
|
|
514
|
+
(ht.length > 0 || C) && /* @__PURE__ */ d("div", { className: "mb-2 flex flex-wrap items-center gap-1.5", "data-o2m-stats": !0, children: [
|
|
503
515
|
/* @__PURE__ */ t(
|
|
504
|
-
|
|
516
|
+
ba,
|
|
505
517
|
{
|
|
506
518
|
data: c,
|
|
507
|
-
loading:
|
|
508
|
-
error:
|
|
519
|
+
loading: !!C && !i && Be.isLoading,
|
|
520
|
+
error: !!C && !i && Be.isError
|
|
509
521
|
}
|
|
510
522
|
),
|
|
511
|
-
|
|
512
|
-
|
|
523
|
+
ht.map((e) => /* @__PURE__ */ t(
|
|
524
|
+
_t,
|
|
513
525
|
{
|
|
514
526
|
label: e.label,
|
|
515
527
|
value: e.result,
|
|
@@ -518,23 +530,23 @@ function Ja(_) {
|
|
|
518
530
|
},
|
|
519
531
|
e.label
|
|
520
532
|
)),
|
|
521
|
-
|
|
533
|
+
Le.length > 1 && wt && /* @__PURE__ */ d(
|
|
522
534
|
"button",
|
|
523
535
|
{
|
|
524
536
|
type: "button",
|
|
525
537
|
"data-plan-grid-categories-toggle": !0,
|
|
526
|
-
"aria-expanded":
|
|
527
|
-
onClick: () =>
|
|
538
|
+
"aria-expanded": et,
|
|
539
|
+
onClick: () => Wt((e) => !e),
|
|
528
540
|
className: "inline-flex h-[28px] items-center gap-1 rounded-md px-2 text-[11.5px] font-medium text-slate-600 hover:bg-muted dark:text-slate-300",
|
|
529
541
|
children: [
|
|
530
|
-
|
|
542
|
+
et ? /* @__PURE__ */ t($t, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ t(Ct, { className: "h-3.5 w-3.5" }),
|
|
531
543
|
"By category"
|
|
532
544
|
]
|
|
533
545
|
}
|
|
534
546
|
)
|
|
535
547
|
] }),
|
|
536
|
-
|
|
537
|
-
|
|
548
|
+
et && wt && /* @__PURE__ */ t("div", { className: "mb-2 flex flex-wrap gap-1.5", "data-plan-grid-categories": !0, children: Le.map((e) => /* @__PURE__ */ t(
|
|
549
|
+
_t,
|
|
538
550
|
{
|
|
539
551
|
dataKey: `category:${e.id}`,
|
|
540
552
|
label: `${e.label} left of ${D(e.cap)}`,
|
|
@@ -549,56 +561,56 @@ function Ja(_) {
|
|
|
549
561
|
{
|
|
550
562
|
className: "overflow-x-auto rounded-lg border border-slate-200 dark:border-border",
|
|
551
563
|
"data-plan-grid-scroll": !0,
|
|
552
|
-
onFocusCapture:
|
|
553
|
-
onBlurCapture:
|
|
564
|
+
onFocusCapture: jt,
|
|
565
|
+
onBlurCapture: Ft,
|
|
554
566
|
children: /* @__PURE__ */ d(
|
|
555
567
|
"table",
|
|
556
568
|
{
|
|
557
569
|
className: "border-separate border-spacing-0 text-[12px] tabular-nums",
|
|
558
|
-
style: { width: "100%", minWidth:
|
|
570
|
+
style: { width: "100%", minWidth: Zt, tableLayout: "fixed" },
|
|
559
571
|
children: [
|
|
560
572
|
/* @__PURE__ */ d("colgroup", { children: [
|
|
561
|
-
/* @__PURE__ */ t("col", { style: { width:
|
|
562
|
-
m.map((e) => /* @__PURE__ */ t("col", { style: { width:
|
|
563
|
-
/* @__PURE__ */ t("col", { style: { width:
|
|
573
|
+
/* @__PURE__ */ t("col", { style: { width: Lt } }),
|
|
574
|
+
m.map((e) => /* @__PURE__ */ t("col", { style: { width: Rt } }, e)),
|
|
575
|
+
/* @__PURE__ */ t("col", { style: { width: Mt } })
|
|
564
576
|
] }),
|
|
565
577
|
/* @__PURE__ */ t("thead", { children: /* @__PURE__ */ d("tr", { children: [
|
|
566
578
|
/* @__PURE__ */ t(
|
|
567
579
|
"th",
|
|
568
580
|
{
|
|
569
581
|
className: B(
|
|
570
|
-
|
|
582
|
+
be,
|
|
571
583
|
"z-[3] border-b px-3 py-1.5 text-left text-[10.5px] font-semibold uppercase tracking-wide text-slate-500 dark:text-slate-400"
|
|
572
584
|
),
|
|
573
|
-
children:
|
|
585
|
+
children: lt(o.key_field)
|
|
574
586
|
}
|
|
575
587
|
),
|
|
576
588
|
m.map((e) => {
|
|
577
|
-
const a =
|
|
589
|
+
const a = Te != null && J(String(Te), e);
|
|
578
590
|
return /* @__PURE__ */ t(
|
|
579
591
|
"th",
|
|
580
592
|
{
|
|
581
593
|
className: B(
|
|
582
594
|
"border-b border-slate-200 px-2.5 py-1.5 text-right text-[10.5px] font-semibold uppercase tracking-wide text-slate-500 dark:border-border dark:text-slate-400",
|
|
583
|
-
a &&
|
|
595
|
+
a && Ce
|
|
584
596
|
),
|
|
585
597
|
children: /* @__PURE__ */ d("span", { className: "inline-flex items-center justify-end gap-1", children: [
|
|
586
|
-
e ===
|
|
598
|
+
e === Qt && /* @__PURE__ */ t(
|
|
587
599
|
"span",
|
|
588
600
|
{
|
|
589
601
|
"data-plan-grid-lock": !0,
|
|
590
|
-
"data-tip": `Closed through ${
|
|
602
|
+
"data-tip": `Closed through ${Ke ?? ""}${c != null && c.closed_rule ? ` — ${c.closed_rule}` : ""}`,
|
|
591
603
|
className: "inline-flex",
|
|
592
604
|
children: /* @__PURE__ */ t(
|
|
593
|
-
|
|
605
|
+
ta,
|
|
594
606
|
{
|
|
595
607
|
className: "h-3 w-3",
|
|
596
|
-
"aria-label": `Closed through ${
|
|
608
|
+
"aria-label": `Closed through ${Ke ?? ""}`
|
|
597
609
|
}
|
|
598
610
|
)
|
|
599
611
|
}
|
|
600
612
|
),
|
|
601
|
-
|
|
613
|
+
st(e)
|
|
602
614
|
] })
|
|
603
615
|
},
|
|
604
616
|
e
|
|
@@ -608,34 +620,34 @@ function Ja(_) {
|
|
|
608
620
|
"th",
|
|
609
621
|
{
|
|
610
622
|
className: B(
|
|
611
|
-
|
|
623
|
+
ke,
|
|
612
624
|
"z-[3] border-b px-3 py-1.5 text-right text-[10.5px] font-semibold uppercase tracking-wide text-slate-500 dark:text-slate-400"
|
|
613
625
|
),
|
|
614
626
|
children: o.total_label ?? "Total"
|
|
615
627
|
}
|
|
616
628
|
)
|
|
617
629
|
] }) }),
|
|
618
|
-
|
|
630
|
+
re.length === 0 && /* @__PURE__ */ t("tbody", { children: /* @__PURE__ */ t("tr", { children: /* @__PURE__ */ d(
|
|
619
631
|
"td",
|
|
620
632
|
{
|
|
621
633
|
colSpan: m.length + 2,
|
|
622
634
|
className: "px-3 py-6 text-[12.5px] text-slate-500 dark:text-slate-400",
|
|
623
635
|
children: [
|
|
624
|
-
`No ${(
|
|
625
|
-
|
|
636
|
+
`No ${(k ?? "rows").toLowerCase()} yet.`,
|
|
637
|
+
z ? ` Add a ${lt(o.key_field).toLowerCase()} to start planning.` : ""
|
|
626
638
|
]
|
|
627
639
|
}
|
|
628
640
|
) }) }),
|
|
629
|
-
|
|
630
|
-
var
|
|
631
|
-
const l = !
|
|
632
|
-
var
|
|
633
|
-
return e.mode === "split" ?
|
|
634
|
-
},
|
|
635
|
-
(h) => Math.abs(
|
|
641
|
+
re.map((e, a) => {
|
|
642
|
+
var _, W, te;
|
|
643
|
+
const l = !It.has(e.key), r = (h) => {
|
|
644
|
+
var $;
|
|
645
|
+
return e.mode === "split" ? T(e.cats.reduce((ae, Yt) => ae + I(Yt.values[h]), 0)) : I(($ = e.top) == null ? void 0 : $.values[h]);
|
|
646
|
+
}, s = T(m.reduce((h, $) => h + r($), 0)), u = m.some(
|
|
647
|
+
(h) => Math.abs(Re(e.key, Ie, h).value) >= 5e-3
|
|
636
648
|
), O = ((c == null ? void 0 : c.series) ?? []).filter(
|
|
637
|
-
(h) => m.some((
|
|
638
|
-
),
|
|
649
|
+
(h) => m.some(($) => Math.abs(we(h, e.key, $) ?? 0) >= 5e-3)
|
|
650
|
+
), U = m.some((h) => Math.abs(Re(e.key, null, h).value) >= 5e-3), A = (((_ = e.top) == null ? void 0 : _.edited) || ((W = e.top) == null ? void 0 : W.isNew) || e.cats.some((h) => h.edited || h.isNew)) ?? !1;
|
|
639
651
|
return /* @__PURE__ */ d(
|
|
640
652
|
"tbody",
|
|
641
653
|
{
|
|
@@ -651,19 +663,19 @@ function Ja(_) {
|
|
|
651
663
|
a > 0 && "[&>td]:border-t [&>td]:border-slate-200 dark:[&>td]:border-border"
|
|
652
664
|
),
|
|
653
665
|
children: [
|
|
654
|
-
/* @__PURE__ */ t("td", { className: B(
|
|
666
|
+
/* @__PURE__ */ t("td", { className: B(be, "px-2 py-1"), children: /* @__PURE__ */ d("div", { className: "flex items-center gap-1", children: [
|
|
655
667
|
e.mode === "split" ? /* @__PURE__ */ t(
|
|
656
668
|
"button",
|
|
657
669
|
{
|
|
658
670
|
type: "button",
|
|
659
671
|
"aria-expanded": l,
|
|
660
672
|
"aria-label": `${l ? "Collapse" : "Expand"} ${e.key}`,
|
|
661
|
-
onClick: () =>
|
|
662
|
-
const
|
|
663
|
-
return
|
|
673
|
+
onClick: () => bt((h) => {
|
|
674
|
+
const $ = new Set(h);
|
|
675
|
+
return $.has(e.key) ? $.delete(e.key) : $.add(e.key), $;
|
|
664
676
|
}),
|
|
665
677
|
className: "rounded p-0.5 text-slate-500 hover:bg-muted",
|
|
666
|
-
children: l ? /* @__PURE__ */ t(
|
|
678
|
+
children: l ? /* @__PURE__ */ t($t, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ t(Ct, { className: "h-3.5 w-3.5" })
|
|
667
679
|
}
|
|
668
680
|
) : /* @__PURE__ */ t("span", { className: "w-[18px]" }),
|
|
669
681
|
/* @__PURE__ */ t("span", { className: "text-[13px] font-semibold text-slate-900 dark:text-slate-100", children: e.key }),
|
|
@@ -675,26 +687,26 @@ function Ja(_) {
|
|
|
675
687
|
className: "h-1.5 w-1.5 rounded-full bg-amber-500"
|
|
676
688
|
}
|
|
677
689
|
),
|
|
678
|
-
/* @__PURE__ */ t("span", { className: "ml-auto text-[10.5px] font-medium text-slate-500 dark:text-slate-400", children: e.mode === "ghost" ? "" :
|
|
679
|
-
|
|
680
|
-
|
|
690
|
+
/* @__PURE__ */ t("span", { className: "ml-auto text-[10.5px] font-medium text-slate-500 dark:text-slate-400", children: e.mode === "ghost" ? "" : Ae }),
|
|
691
|
+
z && e.mode !== "ghost" && /* @__PURE__ */ t(
|
|
692
|
+
Ra,
|
|
681
693
|
{
|
|
682
694
|
block: e,
|
|
683
695
|
config: o,
|
|
684
|
-
canSplit: !!
|
|
685
|
-
splitUnavailable:
|
|
686
|
-
const h = ie.categories.filter((
|
|
696
|
+
canSplit: !!he && !!(ie != null && ie.can_split) && !i,
|
|
697
|
+
splitUnavailable: he && ie && !ie.can_split && !i ? (() => {
|
|
698
|
+
const h = ie.categories.filter(($) => $.cap > 5e-3);
|
|
687
699
|
return h.length === 1 ? `Every line on this record is ${h[0].label} — there is nothing to split between.` : "This record has no categorised lines yet — add lines first.";
|
|
688
700
|
})() : null,
|
|
689
|
-
splitBase:
|
|
690
|
-
client:
|
|
701
|
+
splitBase: he,
|
|
702
|
+
client: S,
|
|
691
703
|
cols: m,
|
|
692
|
-
catLabel:
|
|
704
|
+
catLabel: Se,
|
|
693
705
|
showHistory: f,
|
|
694
|
-
onHistory:
|
|
695
|
-
onSpread: F ?
|
|
696
|
-
onRemove: () =>
|
|
697
|
-
onDone:
|
|
706
|
+
onHistory: Ye,
|
|
707
|
+
onSpread: F ? Gt : null,
|
|
708
|
+
onRemove: () => At(e),
|
|
709
|
+
onDone: Kt,
|
|
698
710
|
rc: n
|
|
699
711
|
}
|
|
700
712
|
)
|
|
@@ -705,13 +717,13 @@ function Ja(_) {
|
|
|
705
717
|
colSpan: m.length,
|
|
706
718
|
className: "px-3 py-1 text-[12px] text-slate-500 dark:text-slate-400",
|
|
707
719
|
children: [
|
|
708
|
-
`No ${
|
|
709
|
-
|
|
720
|
+
`No ${Ae.toLowerCase()} for ${e.key}`,
|
|
721
|
+
z && /* @__PURE__ */ t(
|
|
710
722
|
"button",
|
|
711
723
|
{
|
|
712
724
|
type: "button",
|
|
713
725
|
"data-plan-add-ghost": e.key,
|
|
714
|
-
onClick: () =>
|
|
726
|
+
onClick: () => Me(Number.isFinite(Number(e.key)) ? Number(e.key) : e.key),
|
|
715
727
|
className: "ml-2 font-medium text-slate-800 underline underline-offset-2 dark:text-slate-100",
|
|
716
728
|
children: "Add it"
|
|
717
729
|
}
|
|
@@ -719,30 +731,30 @@ function Ja(_) {
|
|
|
719
731
|
]
|
|
720
732
|
}
|
|
721
733
|
) : m.map((h) => {
|
|
722
|
-
const
|
|
734
|
+
const $ = J(e.key, h);
|
|
723
735
|
return e.mode === "split" ? /* @__PURE__ */ t(
|
|
724
736
|
"td",
|
|
725
737
|
{
|
|
726
738
|
className: B(
|
|
727
739
|
"px-2.5 py-1 text-right font-semibold text-slate-900 dark:text-slate-100",
|
|
728
|
-
|
|
740
|
+
$ && Ce
|
|
729
741
|
),
|
|
730
|
-
children: /* @__PURE__ */ t(ne, { n:
|
|
742
|
+
children: /* @__PURE__ */ t(ne, { n: r(h) })
|
|
731
743
|
},
|
|
732
744
|
h
|
|
733
745
|
) : /* @__PURE__ */ t(
|
|
734
|
-
|
|
746
|
+
Tt,
|
|
735
747
|
{
|
|
736
748
|
row: e.top,
|
|
737
749
|
col: h,
|
|
738
|
-
closed:
|
|
750
|
+
closed: $,
|
|
739
751
|
prov: oe(e.top, h),
|
|
740
|
-
cellKey:
|
|
741
|
-
locked:
|
|
742
|
-
lockedTip:
|
|
752
|
+
cellKey: V(e.top, h),
|
|
753
|
+
locked: je(e.key, h),
|
|
754
|
+
lockedTip: $ ? (c == null ? void 0 : c.closed_locked_message) ?? "This period is closed" : void 0,
|
|
743
755
|
onCommit: (ae) => X(e.top, { [h]: ae }),
|
|
744
|
-
onMove:
|
|
745
|
-
onPaste:
|
|
756
|
+
onMove: gt,
|
|
757
|
+
onPaste: yt
|
|
746
758
|
},
|
|
747
759
|
h
|
|
748
760
|
);
|
|
@@ -751,34 +763,34 @@ function Ja(_) {
|
|
|
751
763
|
"td",
|
|
752
764
|
{
|
|
753
765
|
className: B(
|
|
754
|
-
|
|
766
|
+
ke,
|
|
755
767
|
"px-3 py-1 text-right font-semibold text-slate-900 dark:text-slate-100"
|
|
756
768
|
),
|
|
757
|
-
children: e.mode === "ghost" ? "" : /* @__PURE__ */ t(ne, { n:
|
|
769
|
+
children: e.mode === "ghost" ? "" : /* @__PURE__ */ t(ne, { n: s })
|
|
758
770
|
}
|
|
759
771
|
)
|
|
760
772
|
]
|
|
761
773
|
}
|
|
762
774
|
),
|
|
763
775
|
c && /* @__PURE__ */ t(
|
|
764
|
-
|
|
776
|
+
nt,
|
|
765
777
|
{
|
|
766
|
-
label:
|
|
778
|
+
label: Ne,
|
|
767
779
|
blockKey: e.key,
|
|
768
780
|
cat: null,
|
|
769
781
|
cols: m,
|
|
770
782
|
compare: c,
|
|
771
|
-
planOf:
|
|
772
|
-
actualFor:
|
|
783
|
+
planOf: r,
|
|
784
|
+
actualFor: Re,
|
|
773
785
|
isClosed: J,
|
|
774
786
|
row: e.mode === "top" ? e.top : null,
|
|
775
|
-
canReconcile:
|
|
776
|
-
onReconcile:
|
|
777
|
-
carryFor:
|
|
787
|
+
canReconcile: z && e.mode === "top",
|
|
788
|
+
onReconcile: Je,
|
|
789
|
+
carryFor: Ve
|
|
778
790
|
}
|
|
779
791
|
),
|
|
780
792
|
e.mode !== "split" && O.map((h) => /* @__PURE__ */ d("tr", { "data-compare-series": h.key, children: [
|
|
781
|
-
/* @__PURE__ */ t("td", { className: B(
|
|
793
|
+
/* @__PURE__ */ t("td", { className: B(be, "px-2 py-0.5"), children: /* @__PURE__ */ t(
|
|
782
794
|
"span",
|
|
783
795
|
{
|
|
784
796
|
"data-tip": h.hint ?? "",
|
|
@@ -786,46 +798,46 @@ function Ja(_) {
|
|
|
786
798
|
children: h.label
|
|
787
799
|
}
|
|
788
800
|
) }),
|
|
789
|
-
m.map((
|
|
801
|
+
m.map(($) => /* @__PURE__ */ t(
|
|
790
802
|
"td",
|
|
791
803
|
{
|
|
792
804
|
className: B(
|
|
793
805
|
"px-2.5 py-0.5 text-right text-[11.5px] text-slate-500 dark:text-slate-400",
|
|
794
|
-
J(e.key,
|
|
806
|
+
J(e.key, $) && Ce
|
|
795
807
|
),
|
|
796
|
-
children: Math.abs(
|
|
797
|
-
|
|
808
|
+
children: Math.abs(we(h, e.key, $) ?? 0) >= 5e-3 ? /* @__PURE__ */ t(
|
|
809
|
+
Ot,
|
|
798
810
|
{
|
|
799
811
|
series: h,
|
|
800
|
-
value:
|
|
801
|
-
periodLabel: `${
|
|
802
|
-
children: /* @__PURE__ */ t(ne, { n:
|
|
812
|
+
value: we(h, e.key, $) ?? 0,
|
|
813
|
+
periodLabel: `${Ee($)} ${e.key}`,
|
|
814
|
+
children: /* @__PURE__ */ t(ne, { n: we(h, e.key, $) ?? 0, muted: !0 })
|
|
803
815
|
}
|
|
804
816
|
) : /* @__PURE__ */ t(ne, { n: 0, muted: !0 })
|
|
805
817
|
},
|
|
806
|
-
|
|
818
|
+
$
|
|
807
819
|
)),
|
|
808
820
|
/* @__PURE__ */ t(
|
|
809
821
|
"td",
|
|
810
822
|
{
|
|
811
823
|
className: B(
|
|
812
|
-
|
|
824
|
+
ke,
|
|
813
825
|
"px-3 py-0.5 text-right text-[11.5px] text-slate-500 dark:text-slate-400"
|
|
814
826
|
),
|
|
815
827
|
children: /* @__PURE__ */ t(
|
|
816
|
-
|
|
828
|
+
Ot,
|
|
817
829
|
{
|
|
818
830
|
series: h,
|
|
819
|
-
value:
|
|
820
|
-
m.reduce((
|
|
831
|
+
value: T(
|
|
832
|
+
m.reduce(($, ae) => $ + (we(h, e.key, ae) ?? 0), 0)
|
|
821
833
|
),
|
|
822
834
|
periodLabel: String(e.key),
|
|
823
835
|
whole: !0,
|
|
824
836
|
children: /* @__PURE__ */ t(
|
|
825
837
|
ne,
|
|
826
838
|
{
|
|
827
|
-
n:
|
|
828
|
-
m.reduce((
|
|
839
|
+
n: T(
|
|
840
|
+
m.reduce(($, ae) => $ + (we(h, e.key, ae) ?? 0), 0)
|
|
829
841
|
),
|
|
830
842
|
muted: !0
|
|
831
843
|
}
|
|
@@ -835,39 +847,39 @@ function Ja(_) {
|
|
|
835
847
|
}
|
|
836
848
|
)
|
|
837
849
|
] }, h.key)),
|
|
838
|
-
e.mode === "split" && l && e.cats.map((h) => /* @__PURE__ */ d(
|
|
850
|
+
e.mode === "split" && l && e.cats.map((h) => /* @__PURE__ */ d(Oa, { children: [
|
|
839
851
|
/* @__PURE__ */ d(
|
|
840
852
|
"tr",
|
|
841
853
|
{
|
|
842
854
|
"data-o2m-row": h.id ? `${n}:${h.id}` : void 0,
|
|
843
855
|
"data-plan-category": h.cat ?? "",
|
|
844
856
|
children: [
|
|
845
|
-
/* @__PURE__ */ t("td", { className: B(
|
|
846
|
-
/* @__PURE__ */ t("span", { className: "truncate text-[12.5px] font-medium text-slate-800 dark:text-slate-100", children:
|
|
857
|
+
/* @__PURE__ */ t("td", { className: B(be, "px-2 py-1"), children: /* @__PURE__ */ d("div", { className: "flex items-center gap-1 pl-[22px]", children: [
|
|
858
|
+
/* @__PURE__ */ t("span", { className: "truncate text-[12.5px] font-medium text-slate-800 dark:text-slate-100", children: Se(h.cat) }),
|
|
847
859
|
(h.edited || h.isNew) && /* @__PURE__ */ t("span", { className: "h-1.5 w-1.5 rounded-full bg-amber-500" }),
|
|
848
|
-
/* @__PURE__ */ t("span", { className: "ml-auto text-[10.5px] font-medium text-slate-500 dark:text-slate-400", children:
|
|
860
|
+
/* @__PURE__ */ t("span", { className: "ml-auto text-[10.5px] font-medium text-slate-500 dark:text-slate-400", children: Ae })
|
|
849
861
|
] }) }),
|
|
850
|
-
m.map((
|
|
851
|
-
|
|
862
|
+
m.map(($) => /* @__PURE__ */ t(
|
|
863
|
+
Tt,
|
|
852
864
|
{
|
|
853
865
|
row: h,
|
|
854
|
-
col:
|
|
855
|
-
closed: J(e.key,
|
|
856
|
-
prov: oe(h,
|
|
857
|
-
cellKey:
|
|
858
|
-
locked:
|
|
859
|
-
lockedTip: J(e.key,
|
|
860
|
-
onCommit: (ae) => X(h, { [
|
|
861
|
-
onMove:
|
|
862
|
-
onPaste:
|
|
866
|
+
col: $,
|
|
867
|
+
closed: J(e.key, $),
|
|
868
|
+
prov: oe(h, $),
|
|
869
|
+
cellKey: V(h, $),
|
|
870
|
+
locked: je(e.key, $),
|
|
871
|
+
lockedTip: J(e.key, $) ? (c == null ? void 0 : c.closed_locked_message) ?? "This period is closed" : void 0,
|
|
872
|
+
onCommit: (ae) => X(h, { [$]: ae }),
|
|
873
|
+
onMove: gt,
|
|
874
|
+
onPaste: yt
|
|
863
875
|
},
|
|
864
|
-
|
|
876
|
+
$
|
|
865
877
|
)),
|
|
866
878
|
/* @__PURE__ */ t(
|
|
867
879
|
"td",
|
|
868
880
|
{
|
|
869
881
|
className: B(
|
|
870
|
-
|
|
882
|
+
ke,
|
|
871
883
|
"px-3 py-1 text-right font-medium text-slate-800 dark:text-slate-100"
|
|
872
884
|
),
|
|
873
885
|
children: /* @__PURE__ */ t(ne, { n: Y(h.values) })
|
|
@@ -876,41 +888,41 @@ function Ja(_) {
|
|
|
876
888
|
]
|
|
877
889
|
}
|
|
878
890
|
),
|
|
879
|
-
c &&
|
|
880
|
-
|
|
891
|
+
c && U && /* @__PURE__ */ t(
|
|
892
|
+
nt,
|
|
881
893
|
{
|
|
882
|
-
label:
|
|
894
|
+
label: Ne,
|
|
883
895
|
blockKey: e.key,
|
|
884
896
|
cat: h.cat,
|
|
885
897
|
cols: m,
|
|
886
898
|
compare: c,
|
|
887
|
-
planOf: (
|
|
888
|
-
actualFor:
|
|
899
|
+
planOf: ($) => I(h.values[$]),
|
|
900
|
+
actualFor: Re,
|
|
889
901
|
isClosed: J,
|
|
890
902
|
row: h,
|
|
891
|
-
canReconcile:
|
|
892
|
-
onReconcile:
|
|
893
|
-
carryFor:
|
|
903
|
+
canReconcile: z,
|
|
904
|
+
onReconcile: Je,
|
|
905
|
+
carryFor: Ve,
|
|
894
906
|
indent: !0
|
|
895
907
|
}
|
|
896
908
|
)
|
|
897
909
|
] }, h.uid)),
|
|
898
910
|
e.mode === "split" && l && c && u && /* @__PURE__ */ t(
|
|
899
|
-
|
|
911
|
+
nt,
|
|
900
912
|
{
|
|
901
|
-
label: `${
|
|
902
|
-
tip: `${
|
|
913
|
+
label: `${Se(Ie)} · ${Ne.toLowerCase()}`,
|
|
914
|
+
tip: `${Ne} the source could not place in a category — it counts in the ${e.key} total only.`,
|
|
903
915
|
blockKey: e.key,
|
|
904
|
-
cat:
|
|
916
|
+
cat: Ie,
|
|
905
917
|
cols: m,
|
|
906
918
|
compare: c,
|
|
907
919
|
planOf: () => 0,
|
|
908
|
-
actualFor:
|
|
920
|
+
actualFor: Re,
|
|
909
921
|
isClosed: J,
|
|
910
922
|
row: null,
|
|
911
923
|
canReconcile: !1,
|
|
912
|
-
onReconcile:
|
|
913
|
-
carryFor:
|
|
924
|
+
onReconcile: Je,
|
|
925
|
+
carryFor: Ve,
|
|
914
926
|
indent: !0,
|
|
915
927
|
plain: !0
|
|
916
928
|
}
|
|
@@ -920,17 +932,17 @@ function Ja(_) {
|
|
|
920
932
|
e.key
|
|
921
933
|
);
|
|
922
934
|
}),
|
|
923
|
-
|
|
935
|
+
re.length > 1 && /* @__PURE__ */ d("tfoot", { children: [
|
|
924
936
|
/* @__PURE__ */ d("tr", { className: "[&>td]:border-t [&>td]:border-slate-300 dark:[&>td]:border-border", children: [
|
|
925
|
-
/* @__PURE__ */ t("td", { className: B(
|
|
937
|
+
/* @__PURE__ */ t("td", { className: B(be, "px-2 py-1.5"), children: /* @__PURE__ */ d("div", { className: "flex items-center pl-[22px]", children: [
|
|
926
938
|
/* @__PURE__ */ t("span", { className: "text-[12px] font-semibold text-slate-900 dark:text-slate-100", children: "All" }),
|
|
927
|
-
/* @__PURE__ */ t("span", { className: "ml-auto text-[10.5px] font-medium text-slate-500 dark:text-slate-400", children:
|
|
939
|
+
/* @__PURE__ */ t("span", { className: "ml-auto text-[10.5px] font-medium text-slate-500 dark:text-slate-400", children: Ae })
|
|
928
940
|
] }) }),
|
|
929
941
|
m.map((e) => /* @__PURE__ */ t(
|
|
930
942
|
"td",
|
|
931
943
|
{
|
|
932
944
|
className: "px-2.5 py-1.5 text-right font-semibold text-slate-900 dark:text-slate-100",
|
|
933
|
-
children: /* @__PURE__ */ t(ne, { n:
|
|
945
|
+
children: /* @__PURE__ */ t(ne, { n: tt.planBy[e] })
|
|
934
946
|
},
|
|
935
947
|
e
|
|
936
948
|
)),
|
|
@@ -938,20 +950,20 @@ function Ja(_) {
|
|
|
938
950
|
"td",
|
|
939
951
|
{
|
|
940
952
|
className: B(
|
|
941
|
-
|
|
953
|
+
ke,
|
|
942
954
|
"px-3 py-1.5 text-right font-semibold text-slate-900 dark:text-slate-100"
|
|
943
955
|
),
|
|
944
|
-
children: /* @__PURE__ */ t(ne, { n:
|
|
956
|
+
children: /* @__PURE__ */ t(ne, { n: He })
|
|
945
957
|
}
|
|
946
958
|
)
|
|
947
959
|
] }),
|
|
948
960
|
c && /* @__PURE__ */ d("tr", { children: [
|
|
949
|
-
/* @__PURE__ */ t("td", { className: B(
|
|
961
|
+
/* @__PURE__ */ t("td", { className: B(be, "px-2 pb-1.5 pt-0"), children: /* @__PURE__ */ t("span", { className: "block text-right text-[10.5px] font-medium text-slate-500 dark:text-slate-400", children: Ne }) }),
|
|
950
962
|
m.map((e) => /* @__PURE__ */ t(
|
|
951
963
|
"td",
|
|
952
964
|
{
|
|
953
965
|
className: "px-2.5 pb-1.5 pt-0 text-right text-[11.5px] text-slate-600 dark:text-slate-300",
|
|
954
|
-
children: /* @__PURE__ */ t(ne, { n:
|
|
966
|
+
children: /* @__PURE__ */ t(ne, { n: tt.actualBy[e], muted: !0 })
|
|
955
967
|
},
|
|
956
968
|
e
|
|
957
969
|
)),
|
|
@@ -959,10 +971,10 @@ function Ja(_) {
|
|
|
959
971
|
"td",
|
|
960
972
|
{
|
|
961
973
|
className: B(
|
|
962
|
-
|
|
974
|
+
ke,
|
|
963
975
|
"px-3 pb-1.5 pt-0 text-right text-[11.5px] text-slate-600 dark:text-slate-300"
|
|
964
976
|
),
|
|
965
|
-
children: /* @__PURE__ */ t(ne, { n:
|
|
977
|
+
children: /* @__PURE__ */ t(ne, { n: T(m.reduce((e, a) => e + tt.actualBy[a], 0)), muted: !0 })
|
|
966
978
|
}
|
|
967
979
|
)
|
|
968
980
|
] })
|
|
@@ -972,41 +984,41 @@ function Ja(_) {
|
|
|
972
984
|
)
|
|
973
985
|
}
|
|
974
986
|
),
|
|
975
|
-
|
|
987
|
+
ft && /* @__PURE__ */ t(
|
|
976
988
|
"p",
|
|
977
989
|
{
|
|
978
990
|
role: "alert",
|
|
979
991
|
"data-plan-grid-notice": !0,
|
|
980
992
|
className: "mt-1.5 text-[12px] font-medium text-red-700 dark:text-red-300",
|
|
981
|
-
children:
|
|
993
|
+
children: ft
|
|
982
994
|
}
|
|
983
995
|
),
|
|
984
|
-
|
|
996
|
+
z && /* @__PURE__ */ d("div", { className: "mt-2 flex items-center gap-2", children: [
|
|
985
997
|
/* @__PURE__ */ t(
|
|
986
|
-
|
|
998
|
+
Ea,
|
|
987
999
|
{
|
|
988
1000
|
config: o,
|
|
989
|
-
client:
|
|
990
|
-
used:
|
|
991
|
-
onAdd: (e) =>
|
|
992
|
-
label: `Add ${
|
|
1001
|
+
client: S,
|
|
1002
|
+
used: Vt,
|
|
1003
|
+
onAdd: (e) => Me(e),
|
|
1004
|
+
label: `Add ${lt(o.key_field).toLowerCase()}`
|
|
993
1005
|
}
|
|
994
1006
|
),
|
|
995
|
-
(c == null ? void 0 : c.closed_locked) && !
|
|
1007
|
+
(c == null ? void 0 : c.closed_locked) && !y && Ke && /* @__PURE__ */ t("span", { className: "text-[11.5px] text-slate-500 dark:text-slate-400", children: `Periods through ${Ke} are closed — open a highlighted ${Ne.toLowerCase()} figure to reconcile one.` })
|
|
996
1008
|
] }),
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1009
|
+
Xe,
|
|
1010
|
+
Q && Xe == null && /* @__PURE__ */ t(
|
|
1011
|
+
$a,
|
|
1000
1012
|
{
|
|
1001
1013
|
open: !0,
|
|
1002
1014
|
onOpenChange: (e) => {
|
|
1003
|
-
e ||
|
|
1015
|
+
e || Ye(null);
|
|
1004
1016
|
},
|
|
1005
|
-
rowTitle: `${
|
|
1006
|
-
revisions:
|
|
1007
|
-
loading:
|
|
1008
|
-
fields:
|
|
1009
|
-
displayCols:
|
|
1017
|
+
rowTitle: `${Q.key}${Q.cat ? ` · ${Se(Q.cat)}` : ""}`,
|
|
1018
|
+
revisions: Ut,
|
|
1019
|
+
loading: Ht,
|
|
1020
|
+
fields: Nt,
|
|
1021
|
+
displayCols: Nt.filter(
|
|
1010
1022
|
(e) => m.includes(e.field) || e.field === o.category_field
|
|
1011
1023
|
),
|
|
1012
1024
|
parentField: p,
|
|
@@ -1014,7 +1026,7 @@ function Ja(_) {
|
|
|
1014
1026
|
relations: [],
|
|
1015
1027
|
collection: n,
|
|
1016
1028
|
m2oDisplays: {},
|
|
1017
|
-
client:
|
|
1029
|
+
client: S,
|
|
1018
1030
|
allowRestore: !1,
|
|
1019
1031
|
onRestore: () => {
|
|
1020
1032
|
}
|
|
@@ -1022,84 +1034,84 @@ function Ja(_) {
|
|
|
1022
1034
|
)
|
|
1023
1035
|
] });
|
|
1024
1036
|
}
|
|
1025
|
-
function
|
|
1026
|
-
return
|
|
1037
|
+
function lt(v) {
|
|
1038
|
+
return v.replace(/_/g, " ").replace(/^\w/, (n) => n.toUpperCase());
|
|
1027
1039
|
}
|
|
1028
|
-
function
|
|
1029
|
-
return /* @__PURE__ */ t(
|
|
1040
|
+
function Oa(v) {
|
|
1041
|
+
return /* @__PURE__ */ t(Xt, { children: v.children });
|
|
1030
1042
|
}
|
|
1031
|
-
function ne(
|
|
1032
|
-
return Math.abs(
|
|
1043
|
+
function ne(v) {
|
|
1044
|
+
return Math.abs(v.n) < 5e-3 ? /* @__PURE__ */ t("span", { className: "text-slate-400 dark:text-slate-500", children: "—" }) : /* @__PURE__ */ t("span", { children: D(v.n) });
|
|
1033
1045
|
}
|
|
1034
|
-
function
|
|
1035
|
-
const { row: n, col: p, closed:
|
|
1036
|
-
Reason: “${
|
|
1046
|
+
function Tt(v) {
|
|
1047
|
+
const { row: n, col: p, closed: g, locked: o, lockedTip: C, prov: R, cellKey: K, onCommit: F, onMove: L, onPaste: f } = v, k = I(n.values[p]), S = R ? `${Ee(p)} · changed ${pa(R.at)} by ${R.who}${R.reason ? `
|
|
1048
|
+
Reason: “${R.reason}”` : ""}` : void 0, b = R != null && R.reason ? /* @__PURE__ */ t(
|
|
1037
1049
|
"span",
|
|
1038
1050
|
{
|
|
1039
1051
|
"aria-hidden": "true",
|
|
1040
1052
|
"data-cell-reason": !0,
|
|
1041
1053
|
className: "pointer-events-none absolute left-0 top-0 h-0 w-0 border-r-[6px] border-t-[6px] border-r-transparent border-t-nvr-cyan"
|
|
1042
1054
|
}
|
|
1043
|
-
) : null, [x, j] =
|
|
1055
|
+
) : null, [x, j] = H(null), E = $e(!1);
|
|
1044
1056
|
if (o)
|
|
1045
1057
|
return /* @__PURE__ */ d(
|
|
1046
1058
|
"td",
|
|
1047
1059
|
{
|
|
1048
|
-
"data-plan-locked":
|
|
1049
|
-
"data-tip": [
|
|
1060
|
+
"data-plan-locked": g ? "closed" : "readonly",
|
|
1061
|
+
"data-tip": [C, S].filter(Boolean).join(`
|
|
1050
1062
|
`) || void 0,
|
|
1051
1063
|
"data-grid-cell": K,
|
|
1052
1064
|
className: B(
|
|
1053
1065
|
"relative px-2.5 py-1 text-right text-slate-700 dark:text-slate-200",
|
|
1054
|
-
|
|
1066
|
+
g && Ce
|
|
1055
1067
|
),
|
|
1056
1068
|
children: [
|
|
1057
|
-
|
|
1058
|
-
/* @__PURE__ */ t(ne, { n:
|
|
1069
|
+
b,
|
|
1070
|
+
/* @__PURE__ */ t(ne, { n: k })
|
|
1059
1071
|
]
|
|
1060
1072
|
}
|
|
1061
1073
|
);
|
|
1062
|
-
const
|
|
1074
|
+
const N = () => {
|
|
1063
1075
|
if (x == null) return;
|
|
1064
|
-
const
|
|
1065
|
-
if (j(null),
|
|
1066
|
-
|
|
1076
|
+
const y = qt(x);
|
|
1077
|
+
if (j(null), E.current) {
|
|
1078
|
+
E.current = !1;
|
|
1067
1079
|
return;
|
|
1068
1080
|
}
|
|
1069
|
-
if (
|
|
1081
|
+
if (y == null || y < 0) {
|
|
1070
1082
|
de.error("Enter an amount of zero or more");
|
|
1071
1083
|
return;
|
|
1072
1084
|
}
|
|
1073
|
-
Math.abs(
|
|
1085
|
+
Math.abs(y - k) < 5e-3 || F(y);
|
|
1074
1086
|
};
|
|
1075
1087
|
return /* @__PURE__ */ d(
|
|
1076
1088
|
"td",
|
|
1077
1089
|
{
|
|
1078
|
-
className: B("relative p-0",
|
|
1090
|
+
className: B("relative p-0", g && Ce),
|
|
1079
1091
|
"data-grid-cell": K,
|
|
1080
|
-
"data-tip":
|
|
1092
|
+
"data-tip": S,
|
|
1081
1093
|
children: [
|
|
1082
|
-
|
|
1094
|
+
b,
|
|
1083
1095
|
/* @__PURE__ */ t(
|
|
1084
1096
|
"input",
|
|
1085
1097
|
{
|
|
1086
1098
|
"data-pg-cell": `${n.uid}:${p}`,
|
|
1087
|
-
"aria-label": `${
|
|
1099
|
+
"aria-label": `${Ee(p)} ${n.key}`,
|
|
1088
1100
|
inputMode: "decimal",
|
|
1089
|
-
value: x ?? (
|
|
1101
|
+
value: x ?? (k === 0 ? "" : D(k)),
|
|
1090
1102
|
placeholder: "—",
|
|
1091
|
-
onFocus: (
|
|
1092
|
-
j(
|
|
1103
|
+
onFocus: (y) => {
|
|
1104
|
+
j(k === 0 ? "" : String(k)), requestAnimationFrame(() => y.target.select());
|
|
1093
1105
|
},
|
|
1094
|
-
onChange: (
|
|
1095
|
-
onBlur:
|
|
1096
|
-
onPaste: (
|
|
1097
|
-
const i =
|
|
1098
|
-
/[\t\n]/.test(i.trim()) && (
|
|
1106
|
+
onChange: (y) => j(y.target.value),
|
|
1107
|
+
onBlur: N,
|
|
1108
|
+
onPaste: (y) => {
|
|
1109
|
+
const i = y.clipboardData.getData("text");
|
|
1110
|
+
/[\t\n]/.test(i.trim()) && (y.preventDefault(), E.current = !0, y.target.blur(), f(n, p, i));
|
|
1099
1111
|
},
|
|
1100
|
-
onKeyDown: (
|
|
1101
|
-
const i =
|
|
1102
|
-
|
|
1112
|
+
onKeyDown: (y) => {
|
|
1113
|
+
const i = y.currentTarget, z = i.selectionStart === 0 && i.selectionEnd === 0, m = i.selectionStart === i.value.length && i.selectionEnd === i.value.length;
|
|
1114
|
+
y.key === "Enter" || y.key === "ArrowDown" ? (y.preventDefault(), N(), L(n.uid, p, 1, 0)) : y.key === "ArrowUp" ? (y.preventDefault(), N(), L(n.uid, p, -1, 0)) : y.key === "ArrowLeft" && z ? (y.preventDefault(), N(), L(n.uid, p, 0, -1)) : y.key === "ArrowRight" && m ? (y.preventDefault(), N(), L(n.uid, p, 0, 1)) : y.key === "Escape" && (E.current = !0, i.blur());
|
|
1103
1115
|
},
|
|
1104
1116
|
className: "h-[30px] w-full bg-transparent px-2.5 text-right text-[12px] tabular-nums text-slate-900 outline-none placeholder:text-slate-400 hover:bg-muted/60 focus:bg-white focus:shadow-[inset_0_0_0_2px_rgb(var(--nvr-cyan-rgb))] dark:text-slate-100 dark:placeholder:text-slate-500 dark:focus:bg-[hsl(var(--background))]"
|
|
1105
1117
|
}
|
|
@@ -1108,25 +1120,25 @@ Reason: “${M.reason}”` : ""}` : void 0, k = M != null && M.reason ? /* @__PU
|
|
|
1108
1120
|
}
|
|
1109
1121
|
);
|
|
1110
1122
|
}
|
|
1111
|
-
function
|
|
1123
|
+
function nt(v) {
|
|
1112
1124
|
const {
|
|
1113
1125
|
label: n,
|
|
1114
1126
|
tip: p,
|
|
1115
|
-
blockKey:
|
|
1127
|
+
blockKey: g,
|
|
1116
1128
|
cat: o,
|
|
1117
|
-
cols:
|
|
1118
|
-
compare:
|
|
1129
|
+
cols: C,
|
|
1130
|
+
compare: R,
|
|
1119
1131
|
planOf: K,
|
|
1120
1132
|
actualFor: F,
|
|
1121
1133
|
isClosed: L,
|
|
1122
1134
|
row: f,
|
|
1123
|
-
canReconcile:
|
|
1124
|
-
onReconcile:
|
|
1125
|
-
carryFor:
|
|
1135
|
+
canReconcile: k,
|
|
1136
|
+
onReconcile: S,
|
|
1137
|
+
carryFor: b,
|
|
1126
1138
|
plain: x
|
|
1127
|
-
} =
|
|
1139
|
+
} = v, j = T(C.reduce((E, N) => E + F(g, o, N).value, 0));
|
|
1128
1140
|
return /* @__PURE__ */ d("tr", { "data-plan-actual": o ?? "all", children: [
|
|
1129
|
-
/* @__PURE__ */ t("td", { className: B(
|
|
1141
|
+
/* @__PURE__ */ t("td", { className: B(be, "px-2 pb-1 pt-0"), children: /* @__PURE__ */ t(
|
|
1130
1142
|
"span",
|
|
1131
1143
|
{
|
|
1132
1144
|
"data-tip": p,
|
|
@@ -1134,43 +1146,43 @@ function at(_) {
|
|
|
1134
1146
|
children: n
|
|
1135
1147
|
}
|
|
1136
1148
|
) }),
|
|
1137
|
-
|
|
1138
|
-
const
|
|
1149
|
+
C.map((E) => {
|
|
1150
|
+
const N = L(g, E), y = F(g, o, E), i = K(E), z = !x && N && Math.abs(y.value - i) >= 5e-3, m = !x && !N && y.value > i + 5e-3;
|
|
1139
1151
|
return /* @__PURE__ */ t(
|
|
1140
1152
|
"td",
|
|
1141
1153
|
{
|
|
1142
|
-
"data-compare-cell":
|
|
1143
|
-
className: B("px-2.5 pb-1 pt-0 text-right text-[11.5px]",
|
|
1144
|
-
children: Math.abs(
|
|
1145
|
-
|
|
1154
|
+
"data-compare-cell": E,
|
|
1155
|
+
className: B("px-2.5 pb-1 pt-0 text-right text-[11.5px]", N && Ce),
|
|
1156
|
+
children: Math.abs(y.value) < 5e-3 && !z ? /* @__PURE__ */ t("span", { className: "text-slate-400 dark:text-slate-500", children: "—" }) : /* @__PURE__ */ t(
|
|
1157
|
+
La,
|
|
1146
1158
|
{
|
|
1147
|
-
title: `${
|
|
1148
|
-
compare:
|
|
1159
|
+
title: `${Ee(E)} ${g}`,
|
|
1160
|
+
compare: R,
|
|
1149
1161
|
actualName: n,
|
|
1150
|
-
actual:
|
|
1162
|
+
actual: y.value,
|
|
1151
1163
|
planned: i,
|
|
1152
|
-
closed:
|
|
1164
|
+
closed: N,
|
|
1153
1165
|
plain: !!x,
|
|
1154
|
-
details:
|
|
1155
|
-
tone:
|
|
1156
|
-
reconcile:
|
|
1166
|
+
details: y.details,
|
|
1167
|
+
tone: z ? "warn" : m ? "danger" : "neutral",
|
|
1168
|
+
reconcile: z && k && f ? {
|
|
1157
1169
|
row: f,
|
|
1158
|
-
column:
|
|
1159
|
-
openColumns:
|
|
1160
|
-
carry: (
|
|
1161
|
-
onApply: (
|
|
1170
|
+
column: E,
|
|
1171
|
+
openColumns: C.filter((M) => !L(g, M)),
|
|
1172
|
+
carry: (b == null ? void 0 : b(g, o)) ?? null,
|
|
1173
|
+
onApply: (M, P, se) => S(f, M, P, se)
|
|
1162
1174
|
} : null
|
|
1163
1175
|
}
|
|
1164
1176
|
)
|
|
1165
1177
|
},
|
|
1166
|
-
|
|
1178
|
+
E
|
|
1167
1179
|
);
|
|
1168
1180
|
}),
|
|
1169
1181
|
/* @__PURE__ */ t(
|
|
1170
1182
|
"td",
|
|
1171
1183
|
{
|
|
1172
1184
|
className: B(
|
|
1173
|
-
|
|
1185
|
+
ke,
|
|
1174
1186
|
"px-3 pb-1 pt-0 text-right text-[11.5px] text-slate-600 dark:text-slate-300"
|
|
1175
1187
|
),
|
|
1176
1188
|
children: /* @__PURE__ */ t(ne, { n: j, muted: !0 })
|
|
@@ -1178,55 +1190,55 @@ function at(_) {
|
|
|
1178
1190
|
)
|
|
1179
1191
|
] });
|
|
1180
1192
|
}
|
|
1181
|
-
const
|
|
1193
|
+
const Et = {
|
|
1182
1194
|
warn: "text-amber-700 dark:text-amber-300 font-medium",
|
|
1183
1195
|
danger: "text-red-700 dark:text-red-300 font-medium",
|
|
1184
1196
|
neutral: "text-slate-600 dark:text-slate-300"
|
|
1185
1197
|
};
|
|
1186
|
-
function
|
|
1187
|
-
var
|
|
1188
|
-
const { title: n, compare: p, actualName:
|
|
1198
|
+
function La(v) {
|
|
1199
|
+
var V, oe;
|
|
1200
|
+
const { title: n, compare: p, actualName: g, actual: o, planned: C, closed: R, plain: K, details: F, tone: L, reconcile: f } = v, [k, S] = H(!1), [b, x] = H("next"), [j, E] = H(""), N = Pt(p), y = T(C - o), i = f && f.openColumns.length === 0 && f.carry && !f.carry.blocked ? f.carry : null, z = f && f.openColumns.length === 0 ? ((V = f.carry) == null ? void 0 : V.blocked) ?? null : null, m = i ? ((oe = i.row) == null ? void 0 : oe.values) ?? {} : (f == null ? void 0 : f.row.values) ?? {}, M = i ? i.openColumns : (f == null ? void 0 : f.openColumns) ?? [], P = G(
|
|
1189
1201
|
() => {
|
|
1190
|
-
var
|
|
1191
|
-
return f ?
|
|
1202
|
+
var w;
|
|
1203
|
+
return f ? _a({
|
|
1192
1204
|
row: f.row.values,
|
|
1193
1205
|
column: f.column,
|
|
1194
1206
|
actual: o,
|
|
1195
1207
|
openColumns: i ? i.openColumns : f.openColumns,
|
|
1196
|
-
mode:
|
|
1197
|
-
...i ? { targetRow: ((
|
|
1208
|
+
mode: b,
|
|
1209
|
+
...i ? { targetRow: ((w = i.row) == null ? void 0 : w.values) ?? {} } : {}
|
|
1198
1210
|
}) : null;
|
|
1199
1211
|
},
|
|
1200
|
-
[f, i, o,
|
|
1201
|
-
),
|
|
1202
|
-
const
|
|
1203
|
-
if (!
|
|
1204
|
-
const
|
|
1205
|
-
return
|
|
1206
|
-
}, [n,
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
}, [
|
|
1212
|
+
[f, i, o, b]
|
|
1213
|
+
), se = P ? P.targetPatch ?? P.patch : {}, ve = M.some((w) => I(m[w]) > 5e-3), q = G(() => {
|
|
1214
|
+
const w = `Reconciled ${n} to ${g.toLowerCase()} (${D(o)})`;
|
|
1215
|
+
if (!P || Math.abs(P.moved) < 5e-3) return w;
|
|
1216
|
+
const me = `${P.targets.length === 1 ? Ee(P.targets[0]) : `${P.targets.length} open periods`}${i ? ` ${i.key}` : ""}`;
|
|
1217
|
+
return P.moved > 0 ? `${w} — moved ${D(P.moved)} to ${me}` : `${w} — took ${D(-P.moved)} from ${me}`;
|
|
1218
|
+
}, [n, g, o, P, i]);
|
|
1219
|
+
pe(() => {
|
|
1220
|
+
k && E(q);
|
|
1221
|
+
}, [k, q]);
|
|
1210
1222
|
const le = f ? [
|
|
1211
1223
|
{
|
|
1212
1224
|
key: "next",
|
|
1213
|
-
label:
|
|
1214
|
-
disabled:
|
|
1225
|
+
label: M[0] ? `Next open period (${st(M[0])}${i ? ` ${i.key}` : ""})` : "Next open period",
|
|
1226
|
+
disabled: M.length === 0
|
|
1215
1227
|
},
|
|
1216
1228
|
{
|
|
1217
1229
|
key: "even",
|
|
1218
1230
|
label: i ? `Evenly over ${i.key}'s open periods` : "Evenly over every open period",
|
|
1219
|
-
disabled:
|
|
1231
|
+
disabled: M.length === 0
|
|
1220
1232
|
},
|
|
1221
1233
|
{
|
|
1222
1234
|
key: "weighted",
|
|
1223
|
-
label: i ? `In proportion to the ${
|
|
1224
|
-
disabled: !
|
|
1235
|
+
label: i ? `In proportion to the ${N.toLowerCase()} already in ${i.key}` : `In proportion to the ${N.toLowerCase()} already there`,
|
|
1236
|
+
disabled: !ve
|
|
1225
1237
|
},
|
|
1226
1238
|
{ key: "none", label: "Nowhere — drop it from the plan" }
|
|
1227
1239
|
] : [];
|
|
1228
|
-
return /* @__PURE__ */ d(
|
|
1229
|
-
/* @__PURE__ */ t(
|
|
1240
|
+
return /* @__PURE__ */ d(it, { open: k, onOpenChange: S, children: [
|
|
1241
|
+
/* @__PURE__ */ t(dt, { asChild: !0, children: /* @__PURE__ */ t(
|
|
1230
1242
|
"button",
|
|
1231
1243
|
{
|
|
1232
1244
|
type: "button",
|
|
@@ -1235,65 +1247,65 @@ function _a(_) {
|
|
|
1235
1247
|
"data-plan-off": L === "warn" ? "true" : void 0,
|
|
1236
1248
|
className: B(
|
|
1237
1249
|
"rounded px-0.5 underline-offset-2 hover:underline focus-visible:underline",
|
|
1238
|
-
|
|
1250
|
+
Et[L]
|
|
1239
1251
|
),
|
|
1240
1252
|
children: D(o)
|
|
1241
1253
|
}
|
|
1242
1254
|
) }),
|
|
1243
|
-
/* @__PURE__ */ d(
|
|
1255
|
+
/* @__PURE__ */ d(ct, { align: "end", sideOffset: 6, className: "w-[360px] p-0 text-[12px]", children: [
|
|
1244
1256
|
/* @__PURE__ */ d("div", { className: "border-b border-slate-200 px-3 py-2 dark:border-border", children: [
|
|
1245
1257
|
/* @__PURE__ */ t("p", { className: "text-[12.5px] font-semibold text-slate-900 dark:text-slate-100", children: n }),
|
|
1246
1258
|
/* @__PURE__ */ d("dl", { className: "mt-1 grid grid-cols-3 gap-2 tabular-nums", children: [
|
|
1247
1259
|
!K && /* @__PURE__ */ d("div", { children: [
|
|
1248
|
-
/* @__PURE__ */ t("dt", { className: "text-[10.5px] text-slate-500 dark:text-slate-400", children:
|
|
1249
|
-
/* @__PURE__ */ t("dd", { className: "font-medium text-slate-800 dark:text-slate-100", children: D(
|
|
1260
|
+
/* @__PURE__ */ t("dt", { className: "text-[10.5px] text-slate-500 dark:text-slate-400", children: N }),
|
|
1261
|
+
/* @__PURE__ */ t("dd", { className: "font-medium text-slate-800 dark:text-slate-100", children: D(C) })
|
|
1250
1262
|
] }),
|
|
1251
1263
|
/* @__PURE__ */ d("div", { children: [
|
|
1252
|
-
/* @__PURE__ */ t("dt", { className: "text-[10.5px] text-slate-500 dark:text-slate-400", children:
|
|
1264
|
+
/* @__PURE__ */ t("dt", { className: "text-[10.5px] text-slate-500 dark:text-slate-400", children: g }),
|
|
1253
1265
|
/* @__PURE__ */ t("dd", { className: "font-medium text-slate-800 dark:text-slate-100", children: D(o) })
|
|
1254
1266
|
] }),
|
|
1255
1267
|
!K && /* @__PURE__ */ d("div", { children: [
|
|
1256
|
-
/* @__PURE__ */ t("dt", { className: "text-[10.5px] text-slate-500 dark:text-slate-400", children:
|
|
1268
|
+
/* @__PURE__ */ t("dt", { className: "text-[10.5px] text-slate-500 dark:text-slate-400", children: R ? "Difference" : "Still to come" }),
|
|
1257
1269
|
/* @__PURE__ */ t(
|
|
1258
1270
|
"dd",
|
|
1259
1271
|
{
|
|
1260
1272
|
className: B(
|
|
1261
1273
|
"font-medium",
|
|
1262
|
-
Math.abs(
|
|
1274
|
+
Math.abs(y) < 5e-3 ? "text-slate-800 dark:text-slate-100" : Et[L === "neutral" ? "neutral" : L]
|
|
1263
1275
|
),
|
|
1264
|
-
children: D(
|
|
1276
|
+
children: D(y)
|
|
1265
1277
|
}
|
|
1266
1278
|
)
|
|
1267
1279
|
] })
|
|
1268
1280
|
] })
|
|
1269
1281
|
] }),
|
|
1270
|
-
F.length > 0 && /* @__PURE__ */ t("ul", { className: "max-h-[168px] overflow-y-auto px-3 py-1.5", children: F.map((
|
|
1282
|
+
F.length > 0 && /* @__PURE__ */ t("ul", { className: "max-h-[168px] overflow-y-auto px-3 py-1.5", children: F.map((w) => /* @__PURE__ */ d("li", { className: "flex items-baseline gap-2 py-0.5", children: [
|
|
1271
1283
|
/* @__PURE__ */ d("span", { className: "min-w-0 flex-1 truncate text-slate-700 dark:text-slate-200", children: [
|
|
1272
|
-
|
|
1273
|
-
|
|
1284
|
+
w.label,
|
|
1285
|
+
w.sub ? /* @__PURE__ */ t("span", { className: "text-slate-500 dark:text-slate-400", children: ` · ${w.sub}` }) : null
|
|
1274
1286
|
] }),
|
|
1275
|
-
/* @__PURE__ */ t("span", { className: "tabular-nums text-slate-800 dark:text-slate-100", children: D(
|
|
1276
|
-
] }, String(
|
|
1277
|
-
F.length === 0 && /* @__PURE__ */ t("p", { className: "px-3 py-2 text-slate-500 dark:text-slate-400", children: `No ${
|
|
1278
|
-
f &&
|
|
1287
|
+
/* @__PURE__ */ t("span", { className: "tabular-nums text-slate-800 dark:text-slate-100", children: D(w.amount) })
|
|
1288
|
+
] }, String(w.id))) }),
|
|
1289
|
+
F.length === 0 && /* @__PURE__ */ t("p", { className: "px-3 py-2 text-slate-500 dark:text-slate-400", children: `No ${ka(p, 2)} behind this figure.` }),
|
|
1290
|
+
f && P && /* @__PURE__ */ d(
|
|
1279
1291
|
"div",
|
|
1280
1292
|
{
|
|
1281
1293
|
className: "border-t border-slate-200 px-3 py-2 dark:border-border",
|
|
1282
1294
|
"data-plan-reconcile": !0,
|
|
1283
1295
|
children: [
|
|
1284
|
-
/* @__PURE__ */ t("p", { className: "font-medium text-slate-900 dark:text-slate-100", children: `Set the ${
|
|
1296
|
+
/* @__PURE__ */ t("p", { className: "font-medium text-slate-900 dark:text-slate-100", children: `Set the ${N.toLowerCase()} to ${D(o)} and put the ${D(Math.abs(y))} ${y > 0 ? "left over" : "shortfall"}…` }),
|
|
1285
1297
|
/* @__PURE__ */ t(
|
|
1286
1298
|
"div",
|
|
1287
1299
|
{
|
|
1288
1300
|
className: "mt-1.5 space-y-1",
|
|
1289
1301
|
role: "radiogroup",
|
|
1290
1302
|
"aria-label": "Where the difference goes",
|
|
1291
|
-
children: le.map((
|
|
1303
|
+
children: le.map((w) => /* @__PURE__ */ d(
|
|
1292
1304
|
"label",
|
|
1293
1305
|
{
|
|
1294
1306
|
className: B(
|
|
1295
1307
|
"flex cursor-pointer items-center gap-2",
|
|
1296
|
-
|
|
1308
|
+
w.disabled && "cursor-not-allowed opacity-50"
|
|
1297
1309
|
),
|
|
1298
1310
|
children: [
|
|
1299
1311
|
/* @__PURE__ */ t(
|
|
@@ -1301,21 +1313,21 @@ function _a(_) {
|
|
|
1301
1313
|
{
|
|
1302
1314
|
type: "radio",
|
|
1303
1315
|
name: "pg-reconcile",
|
|
1304
|
-
"data-plan-reconcile-mode":
|
|
1305
|
-
disabled:
|
|
1306
|
-
checked:
|
|
1307
|
-
onChange: () => x(
|
|
1316
|
+
"data-plan-reconcile-mode": w.key,
|
|
1317
|
+
disabled: w.disabled,
|
|
1318
|
+
checked: b === w.key,
|
|
1319
|
+
onChange: () => x(w.key),
|
|
1308
1320
|
className: "accent-[rgb(var(--nvr-cyan-rgb))]"
|
|
1309
1321
|
}
|
|
1310
1322
|
),
|
|
1311
|
-
/* @__PURE__ */ t("span", { className: "text-slate-700 dark:text-slate-200", children:
|
|
1323
|
+
/* @__PURE__ */ t("span", { className: "text-slate-700 dark:text-slate-200", children: w.label })
|
|
1312
1324
|
]
|
|
1313
1325
|
},
|
|
1314
|
-
|
|
1326
|
+
w.key
|
|
1315
1327
|
))
|
|
1316
1328
|
}
|
|
1317
1329
|
),
|
|
1318
|
-
i &&
|
|
1330
|
+
i && b !== "none" && /* @__PURE__ */ t(
|
|
1319
1331
|
"p",
|
|
1320
1332
|
{
|
|
1321
1333
|
className: "mt-1.5 text-[11.5px] text-slate-600 dark:text-slate-300",
|
|
@@ -1323,33 +1335,33 @@ function _a(_) {
|
|
|
1323
1335
|
children: i.row ? `Every period of this row is closed, so it goes to ${i.key}.` : `Every period of this row is closed and ${i.key} has no row for this line — one is added, and shows as pending until you save.`
|
|
1324
1336
|
}
|
|
1325
1337
|
),
|
|
1326
|
-
|
|
1338
|
+
z && /* @__PURE__ */ t(
|
|
1327
1339
|
"p",
|
|
1328
1340
|
{
|
|
1329
1341
|
className: "mt-1.5 text-[11.5px] text-amber-700 dark:text-amber-300",
|
|
1330
1342
|
"data-plan-reconcile-blocked": !0,
|
|
1331
|
-
children: `Every period of this row is closed, and ${
|
|
1343
|
+
children: `Every period of this row is closed, and ${z} — the difference can only be dropped from here.`
|
|
1332
1344
|
}
|
|
1333
1345
|
),
|
|
1334
|
-
|
|
1346
|
+
P.targets.length > 0 && /* @__PURE__ */ d(
|
|
1335
1347
|
"p",
|
|
1336
1348
|
{
|
|
1337
1349
|
className: "mt-1.5 text-[11.5px] tabular-nums text-slate-600 dark:text-slate-300",
|
|
1338
1350
|
"data-plan-reconcile-preview": !0,
|
|
1339
1351
|
children: [
|
|
1340
|
-
|
|
1341
|
-
(
|
|
1352
|
+
P.targets.slice(0, 6).map(
|
|
1353
|
+
(w) => `${st(w)}${i ? ` ${i.key}` : ""} ${D(I(m[w]))} → ${D(se[w])}`
|
|
1342
1354
|
).join(" · "),
|
|
1343
|
-
|
|
1355
|
+
P.targets.length > 6 ? ` · +${P.targets.length - 6} more` : ""
|
|
1344
1356
|
]
|
|
1345
1357
|
}
|
|
1346
1358
|
),
|
|
1347
|
-
|
|
1359
|
+
b !== "none" && Math.abs(P.unabsorbed) >= 5e-3 && /* @__PURE__ */ t("p", { className: "mt-1 text-[11.5px] text-amber-700 dark:text-amber-300", children: `${D(Math.abs(P.unabsorbed))} has nowhere to go — it leaves the ${N.toLowerCase()}.` }),
|
|
1348
1360
|
/* @__PURE__ */ t(
|
|
1349
1361
|
"textarea",
|
|
1350
1362
|
{
|
|
1351
1363
|
value: j,
|
|
1352
|
-
onChange: (
|
|
1364
|
+
onChange: (w) => E(w.target.value),
|
|
1353
1365
|
rows: 2,
|
|
1354
1366
|
"aria-label": "Reason",
|
|
1355
1367
|
className: "mt-2 w-full resize-none rounded-md border border-slate-200 bg-background px-2 py-1 text-[12px] text-slate-800 outline-none focus:border-slate-400 dark:border-border dark:text-slate-100"
|
|
@@ -1361,10 +1373,10 @@ function _a(_) {
|
|
|
1361
1373
|
type: "button",
|
|
1362
1374
|
"data-plan-reconcile-apply": !0,
|
|
1363
1375
|
onClick: () => {
|
|
1364
|
-
const
|
|
1365
|
-
f.onApply(
|
|
1366
|
-
|
|
1367
|
-
),
|
|
1376
|
+
const w = i && P.targetPatch && Object.keys(P.targetPatch).length > 0 ? { target: i, patch: P.targetPatch } : void 0;
|
|
1377
|
+
f.onApply(P.patch, j.trim() || q, w) && (de.success(
|
|
1378
|
+
w ? `Reconcile staged across ${n.split(" ").pop()} and ${i == null ? void 0 : i.key} — Save to keep it` : "Reconcile staged — Save to keep it"
|
|
1379
|
+
), S(!1));
|
|
1368
1380
|
},
|
|
1369
1381
|
className: "rounded-md bg-nvr-cyan px-3 py-1 text-[12px] font-medium text-white",
|
|
1370
1382
|
children: "Stage it"
|
|
@@ -1376,144 +1388,144 @@ function _a(_) {
|
|
|
1376
1388
|
] })
|
|
1377
1389
|
] });
|
|
1378
1390
|
}
|
|
1379
|
-
function
|
|
1391
|
+
function Ra(v) {
|
|
1380
1392
|
const {
|
|
1381
1393
|
block: n,
|
|
1382
1394
|
config: p,
|
|
1383
|
-
canSplit:
|
|
1395
|
+
canSplit: g,
|
|
1384
1396
|
splitUnavailable: o,
|
|
1385
|
-
splitBase:
|
|
1386
|
-
client:
|
|
1397
|
+
splitBase: C,
|
|
1398
|
+
client: R,
|
|
1387
1399
|
cols: K,
|
|
1388
1400
|
catLabel: F,
|
|
1389
1401
|
showHistory: L,
|
|
1390
1402
|
onHistory: f,
|
|
1391
|
-
onSpread:
|
|
1392
|
-
onRemove:
|
|
1393
|
-
onDone:
|
|
1403
|
+
onSpread: k,
|
|
1404
|
+
onRemove: S,
|
|
1405
|
+
onDone: b,
|
|
1394
1406
|
rc: x
|
|
1395
|
-
} =
|
|
1396
|
-
|
|
1397
|
-
j &&
|
|
1407
|
+
} = v, [j, E] = H(!1), [N, y] = H("menu");
|
|
1408
|
+
pe(() => {
|
|
1409
|
+
j && y("menu");
|
|
1398
1410
|
}, [j]);
|
|
1399
|
-
const i = [...n.top ? [n.top] : [], ...n.cats],
|
|
1400
|
-
return /* @__PURE__ */ d(
|
|
1401
|
-
/* @__PURE__ */ t(
|
|
1411
|
+
const i = [...n.top ? [n.top] : [], ...n.cats], z = i.some((M) => M.edited || M.isNew), m = "flex w-full items-center gap-2 rounded px-2 py-1.5 text-left text-[12.5px] text-slate-700 hover:bg-muted disabled:cursor-not-allowed disabled:opacity-50 dark:text-slate-200";
|
|
1412
|
+
return /* @__PURE__ */ d(it, { open: j, onOpenChange: E, children: [
|
|
1413
|
+
/* @__PURE__ */ t(dt, { asChild: !0, children: /* @__PURE__ */ t(
|
|
1402
1414
|
"button",
|
|
1403
1415
|
{
|
|
1404
1416
|
type: "button",
|
|
1405
1417
|
"data-plan-menu": n.key,
|
|
1406
1418
|
"aria-label": `Actions for ${n.key}`,
|
|
1407
1419
|
className: "rounded p-0.5 text-slate-500 hover:bg-muted hover:text-slate-800 dark:hover:text-slate-100",
|
|
1408
|
-
children: /* @__PURE__ */ t(
|
|
1420
|
+
children: /* @__PURE__ */ t(aa, { className: "h-3.5 w-3.5" })
|
|
1409
1421
|
}
|
|
1410
1422
|
) }),
|
|
1411
1423
|
/* @__PURE__ */ d(
|
|
1412
|
-
|
|
1424
|
+
ct,
|
|
1413
1425
|
{
|
|
1414
1426
|
align: "start",
|
|
1415
1427
|
sideOffset: 6,
|
|
1416
|
-
className: B("p-1.5",
|
|
1428
|
+
className: B("p-1.5", N === "split" ? "w-[440px]" : "w-[300px]"),
|
|
1417
1429
|
children: [
|
|
1418
|
-
|
|
1419
|
-
n.mode === "top" &&
|
|
1430
|
+
N === "menu" && /* @__PURE__ */ d("div", { children: [
|
|
1431
|
+
n.mode === "top" && g && /* @__PURE__ */ d(
|
|
1420
1432
|
"button",
|
|
1421
1433
|
{
|
|
1422
1434
|
type: "button",
|
|
1423
1435
|
"data-plan-split": n.key,
|
|
1424
|
-
disabled:
|
|
1425
|
-
onClick: () =>
|
|
1436
|
+
disabled: z,
|
|
1437
|
+
onClick: () => y("split"),
|
|
1426
1438
|
className: m,
|
|
1427
1439
|
children: [
|
|
1428
|
-
/* @__PURE__ */ t(
|
|
1440
|
+
/* @__PURE__ */ t(St, { className: "h-3.5 w-3.5" }),
|
|
1429
1441
|
p.split_label ?? "Plan by category"
|
|
1430
1442
|
]
|
|
1431
1443
|
}
|
|
1432
1444
|
),
|
|
1433
|
-
n.mode === "top" && !
|
|
1445
|
+
n.mode === "top" && !g && o && /* @__PURE__ */ d("div", { "data-plan-split-unavailable": !0, className: "px-2 py-1.5", children: [
|
|
1434
1446
|
/* @__PURE__ */ d("p", { className: "flex items-center gap-2 text-[12.5px] text-slate-400 dark:text-slate-500", children: [
|
|
1435
|
-
/* @__PURE__ */ t(
|
|
1447
|
+
/* @__PURE__ */ t(St, { className: "h-3.5 w-3.5" }),
|
|
1436
1448
|
p.split_label ?? "Plan by category"
|
|
1437
1449
|
] }),
|
|
1438
1450
|
/* @__PURE__ */ t("p", { className: "mt-0.5 pl-[22px] text-[11px] text-slate-500 dark:text-slate-400", children: o })
|
|
1439
1451
|
] }),
|
|
1440
|
-
n.mode === "split" &&
|
|
1452
|
+
n.mode === "split" && C && /* @__PURE__ */ d(
|
|
1441
1453
|
"button",
|
|
1442
1454
|
{
|
|
1443
1455
|
type: "button",
|
|
1444
1456
|
"data-plan-merge": n.key,
|
|
1445
|
-
disabled:
|
|
1446
|
-
onClick: () =>
|
|
1457
|
+
disabled: z,
|
|
1458
|
+
onClick: () => y("merge"),
|
|
1447
1459
|
className: m,
|
|
1448
1460
|
children: [
|
|
1449
|
-
/* @__PURE__ */ t(
|
|
1461
|
+
/* @__PURE__ */ t(la, { className: "h-3.5 w-3.5" }),
|
|
1450
1462
|
p.merge_label ?? "Merge back to one line"
|
|
1451
1463
|
]
|
|
1452
1464
|
}
|
|
1453
1465
|
),
|
|
1454
|
-
|
|
1455
|
-
|
|
1466
|
+
z && (n.mode === "split" || g) && /* @__PURE__ */ t("p", { className: "px-2 pb-1 text-[11px] text-slate-500 dark:text-slate-400", children: "Save your changes to this block first." }),
|
|
1467
|
+
k && i.map((M) => /* @__PURE__ */ d(
|
|
1456
1468
|
"button",
|
|
1457
1469
|
{
|
|
1458
1470
|
type: "button",
|
|
1459
|
-
"data-plan-spread":
|
|
1471
|
+
"data-plan-spread": M.uid,
|
|
1460
1472
|
onClick: () => {
|
|
1461
|
-
|
|
1473
|
+
k(M), E(!1);
|
|
1462
1474
|
},
|
|
1463
1475
|
className: m,
|
|
1464
1476
|
children: [
|
|
1465
1477
|
/* @__PURE__ */ t("span", { className: "w-3.5" }),
|
|
1466
|
-
`Spread what is left${
|
|
1478
|
+
`Spread what is left${M.cat ? ` · ${F(M.cat)}` : ""}`
|
|
1467
1479
|
]
|
|
1468
1480
|
},
|
|
1469
|
-
|
|
1481
|
+
M.uid
|
|
1470
1482
|
)),
|
|
1471
|
-
L && i.filter((
|
|
1483
|
+
L && i.filter((M) => M.id).map((M) => /* @__PURE__ */ d("div", { className: "flex items-center", children: [
|
|
1472
1484
|
/* @__PURE__ */ d(
|
|
1473
1485
|
"button",
|
|
1474
1486
|
{
|
|
1475
1487
|
type: "button",
|
|
1476
1488
|
onClick: () => {
|
|
1477
|
-
f(
|
|
1489
|
+
f(M), E(!1);
|
|
1478
1490
|
},
|
|
1479
1491
|
className: m,
|
|
1480
1492
|
children: [
|
|
1481
|
-
/* @__PURE__ */ t(
|
|
1482
|
-
`History${
|
|
1493
|
+
/* @__PURE__ */ t(na, { className: "h-3.5 w-3.5" }),
|
|
1494
|
+
`History${M.cat ? ` · ${F(M.cat)}` : ""}`
|
|
1483
1495
|
]
|
|
1484
1496
|
}
|
|
1485
1497
|
),
|
|
1486
1498
|
/* @__PURE__ */ t(
|
|
1487
|
-
|
|
1499
|
+
Ca,
|
|
1488
1500
|
{
|
|
1489
1501
|
collection: x,
|
|
1490
|
-
rowId:
|
|
1491
|
-
rowLabel: `${n.key}${
|
|
1502
|
+
rowId: M.id,
|
|
1503
|
+
rowLabel: `${n.key}${M.cat ? ` ${F(M.cat)}` : ""}`
|
|
1492
1504
|
}
|
|
1493
1505
|
)
|
|
1494
|
-
] },
|
|
1506
|
+
] }, M.uid)),
|
|
1495
1507
|
/* @__PURE__ */ d(
|
|
1496
1508
|
"button",
|
|
1497
1509
|
{
|
|
1498
1510
|
type: "button",
|
|
1499
1511
|
"data-plan-remove": n.key,
|
|
1500
|
-
onClick: () =>
|
|
1512
|
+
onClick: () => y("remove"),
|
|
1501
1513
|
className: B(m, "text-red-700 dark:text-red-300"),
|
|
1502
1514
|
children: [
|
|
1503
|
-
/* @__PURE__ */ t(
|
|
1515
|
+
/* @__PURE__ */ t(ra, { className: "h-3.5 w-3.5" }),
|
|
1504
1516
|
`Remove ${n.key}`
|
|
1505
1517
|
]
|
|
1506
1518
|
}
|
|
1507
1519
|
)
|
|
1508
1520
|
] }),
|
|
1509
|
-
|
|
1521
|
+
N === "remove" && /* @__PURE__ */ d("div", { className: "p-1.5", children: [
|
|
1510
1522
|
/* @__PURE__ */ t("p", { className: "text-[12.5px] text-slate-700 dark:text-slate-200", children: `Remove the ${n.key} plan? It leaves with the next Save.` }),
|
|
1511
1523
|
/* @__PURE__ */ d("div", { className: "mt-2 flex justify-end gap-2", children: [
|
|
1512
1524
|
/* @__PURE__ */ t(
|
|
1513
1525
|
"button",
|
|
1514
1526
|
{
|
|
1515
1527
|
type: "button",
|
|
1516
|
-
onClick: () =>
|
|
1528
|
+
onClick: () => y("menu"),
|
|
1517
1529
|
className: "rounded-md px-2.5 py-1 text-[12px] text-slate-600 hover:bg-muted dark:text-slate-300",
|
|
1518
1530
|
children: "Keep it"
|
|
1519
1531
|
}
|
|
@@ -1524,7 +1536,7 @@ function Sa(_) {
|
|
|
1524
1536
|
type: "button",
|
|
1525
1537
|
"data-plan-remove-confirm": !0,
|
|
1526
1538
|
onClick: () => {
|
|
1527
|
-
|
|
1539
|
+
S(), E(!1);
|
|
1528
1540
|
},
|
|
1529
1541
|
className: "rounded-md bg-red-600 px-2.5 py-1 text-[12px] font-medium text-white",
|
|
1530
1542
|
children: "Remove"
|
|
@@ -1532,30 +1544,30 @@ function Sa(_) {
|
|
|
1532
1544
|
)
|
|
1533
1545
|
] })
|
|
1534
1546
|
] }),
|
|
1535
|
-
|
|
1536
|
-
|
|
1547
|
+
N === "split" && C && n.top && /* @__PURE__ */ t(
|
|
1548
|
+
Ma,
|
|
1537
1549
|
{
|
|
1538
1550
|
block: n,
|
|
1539
1551
|
config: p,
|
|
1540
|
-
splitBase:
|
|
1541
|
-
client:
|
|
1552
|
+
splitBase: C,
|
|
1553
|
+
client: R,
|
|
1542
1554
|
cols: K,
|
|
1543
|
-
onCancel: () =>
|
|
1555
|
+
onCancel: () => y("menu"),
|
|
1544
1556
|
onDone: () => {
|
|
1545
|
-
|
|
1557
|
+
E(!1), b();
|
|
1546
1558
|
}
|
|
1547
1559
|
}
|
|
1548
1560
|
),
|
|
1549
|
-
|
|
1550
|
-
|
|
1561
|
+
N === "merge" && C && /* @__PURE__ */ t(
|
|
1562
|
+
Ta,
|
|
1551
1563
|
{
|
|
1552
1564
|
block: n,
|
|
1553
1565
|
config: p,
|
|
1554
|
-
splitBase:
|
|
1555
|
-
client:
|
|
1556
|
-
onCancel: () =>
|
|
1566
|
+
splitBase: C,
|
|
1567
|
+
client: R,
|
|
1568
|
+
onCancel: () => y("menu"),
|
|
1557
1569
|
onDone: () => {
|
|
1558
|
-
|
|
1570
|
+
E(!1), b();
|
|
1559
1571
|
}
|
|
1560
1572
|
}
|
|
1561
1573
|
)
|
|
@@ -1564,84 +1576,84 @@ function Sa(_) {
|
|
|
1564
1576
|
)
|
|
1565
1577
|
] });
|
|
1566
1578
|
}
|
|
1567
|
-
function
|
|
1568
|
-
return
|
|
1579
|
+
function ot(v) {
|
|
1580
|
+
return ua(v, "Something went wrong");
|
|
1569
1581
|
}
|
|
1570
|
-
function
|
|
1571
|
-
var
|
|
1572
|
-
const { block: n, config: p, splitBase:
|
|
1573
|
-
|
|
1574
|
-
let
|
|
1582
|
+
function Ma(v) {
|
|
1583
|
+
var se, ve;
|
|
1584
|
+
const { block: n, config: p, splitBase: g, client: o, cols: C, onCancel: R, onDone: K } = v, F = Number.isFinite(Number(n.key)) ? Number(n.key) : n.key, [L, f] = H(null), [k, S] = H(null), [b, x] = H(null), [j, E] = H(!1), [N, y] = H(""), i = JSON.stringify(L);
|
|
1585
|
+
pe(() => {
|
|
1586
|
+
let q = !0;
|
|
1575
1587
|
const le = window.setTimeout(
|
|
1576
1588
|
() => {
|
|
1577
1589
|
o.request(
|
|
1578
|
-
|
|
1590
|
+
rt(`${g}/split`, {
|
|
1579
1591
|
[p.key_field]: F,
|
|
1580
1592
|
preview: !0,
|
|
1581
1593
|
...L ? { shares: L } : {}
|
|
1582
1594
|
})
|
|
1583
|
-
).then((
|
|
1584
|
-
|
|
1595
|
+
).then((V) => {
|
|
1596
|
+
q && (S(V.data), x(null), L || f(
|
|
1585
1597
|
Object.fromEntries(
|
|
1586
|
-
|
|
1598
|
+
V.data.categories.map((oe) => [String(oe.id), Math.round(oe.share * 1e3) / 10])
|
|
1587
1599
|
)
|
|
1588
1600
|
));
|
|
1589
|
-
}).catch((
|
|
1601
|
+
}).catch((V) => q && x(ot(V)));
|
|
1590
1602
|
},
|
|
1591
1603
|
L ? 250 : 0
|
|
1592
1604
|
);
|
|
1593
1605
|
return () => {
|
|
1594
|
-
|
|
1606
|
+
q = !1, window.clearTimeout(le);
|
|
1595
1607
|
};
|
|
1596
|
-
}, [i,
|
|
1597
|
-
const
|
|
1598
|
-
|
|
1608
|
+
}, [i, g]);
|
|
1609
|
+
const z = (k == null ? void 0 : k.categories.map((q) => q.label).join(" / ")) ?? "", m = `Split the ${n.key} plan into ${z}`, M = async () => {
|
|
1610
|
+
E(!0);
|
|
1599
1611
|
try {
|
|
1600
1612
|
await o.request(
|
|
1601
|
-
|
|
1613
|
+
rt(`${g}/split`, {
|
|
1602
1614
|
[p.key_field]: F,
|
|
1603
1615
|
shares: L ?? void 0,
|
|
1604
|
-
reason:
|
|
1616
|
+
reason: N.trim() || m
|
|
1605
1617
|
})
|
|
1606
|
-
), de.success(`${n.key} is now planned by ${
|
|
1607
|
-
} catch (
|
|
1608
|
-
x(
|
|
1618
|
+
), de.success(`${n.key} is now planned by ${z}`), K();
|
|
1619
|
+
} catch (q) {
|
|
1620
|
+
x(ot(q));
|
|
1609
1621
|
} finally {
|
|
1610
|
-
|
|
1622
|
+
E(!1);
|
|
1611
1623
|
}
|
|
1612
|
-
},
|
|
1624
|
+
}, P = (q) => T(C.reduce((le, V) => le + I(q[V]), 0));
|
|
1613
1625
|
return /* @__PURE__ */ d("div", { className: "p-1.5", "data-plan-split-pane": !0, children: [
|
|
1614
1626
|
/* @__PURE__ */ t("p", { className: "text-[12.5px] font-semibold text-slate-900 dark:text-slate-100", children: `${p.split_label ?? "Plan by category"} · ${n.key}` }),
|
|
1615
1627
|
/* @__PURE__ */ t("p", { className: "mt-0.5 text-[11.5px] text-slate-600 dark:text-slate-300", children: "Every period is divided by these shares. Closed periods keep their totals; open ones can be changed in the grid afterwards." }),
|
|
1616
|
-
!
|
|
1628
|
+
!k && !b && /* @__PURE__ */ t(
|
|
1617
1629
|
"div",
|
|
1618
1630
|
{
|
|
1619
1631
|
className: "mt-2 h-16 animate-pulse rounded",
|
|
1620
1632
|
style: { background: "hsl(var(--nvr-skeleton))" }
|
|
1621
1633
|
}
|
|
1622
1634
|
),
|
|
1623
|
-
|
|
1635
|
+
k && (((se = k.share_sets) == null ? void 0 : se.length) ?? 0) > 1 && /* @__PURE__ */ d("div", { className: "mt-2 flex flex-wrap items-center gap-1", "data-plan-share-sets": !0, children: [
|
|
1624
1636
|
/* @__PURE__ */ t("span", { className: "text-[11px] text-slate-500 dark:text-slate-400", children: "Shares from" }),
|
|
1625
|
-
(
|
|
1637
|
+
(ve = k.share_sets) == null ? void 0 : ve.map((q) => {
|
|
1626
1638
|
const le = Object.fromEntries(
|
|
1627
|
-
Object.entries(
|
|
1628
|
-
),
|
|
1639
|
+
Object.entries(q.shares).map(([oe, w]) => [oe, Math.round(w * 1e3) / 10])
|
|
1640
|
+
), V = JSON.stringify(le) === i;
|
|
1629
1641
|
return /* @__PURE__ */ t(
|
|
1630
1642
|
"button",
|
|
1631
1643
|
{
|
|
1632
1644
|
type: "button",
|
|
1633
|
-
"data-plan-share-set":
|
|
1634
|
-
"aria-pressed":
|
|
1635
|
-
"data-tip":
|
|
1645
|
+
"data-plan-share-set": q.key,
|
|
1646
|
+
"aria-pressed": V,
|
|
1647
|
+
"data-tip": q.hint ?? "",
|
|
1636
1648
|
onClick: () => f(le),
|
|
1637
|
-
className: `h-6 rounded-md border px-1.5 text-[11px] font-medium ${
|
|
1638
|
-
children:
|
|
1649
|
+
className: `h-6 rounded-md border px-1.5 text-[11px] font-medium ${V ? "border-transparent bg-nvr-cyan text-white" : "border-slate-200 text-slate-600 hover:bg-muted dark:border-border dark:text-slate-300"}`,
|
|
1650
|
+
children: q.label
|
|
1639
1651
|
},
|
|
1640
|
-
|
|
1652
|
+
q.key
|
|
1641
1653
|
);
|
|
1642
1654
|
})
|
|
1643
1655
|
] }),
|
|
1644
|
-
|
|
1656
|
+
k && /* @__PURE__ */ d("table", { className: "mt-2 w-full text-[12px] tabular-nums", children: [
|
|
1645
1657
|
/* @__PURE__ */ t("thead", { children: /* @__PURE__ */ d("tr", { className: "text-left text-[10.5px] text-slate-500 dark:text-slate-400", children: [
|
|
1646
1658
|
/* @__PURE__ */ t("th", { className: "py-1 font-medium", children: "Category" }),
|
|
1647
1659
|
/* @__PURE__ */ t("th", { className: "py-1 text-right font-medium", children: "Share" }),
|
|
@@ -1649,49 +1661,49 @@ function Oa(_) {
|
|
|
1649
1661
|
/* @__PURE__ */ t("th", { className: "py-1 text-right font-medium", children: "Ceiling" })
|
|
1650
1662
|
] }) }),
|
|
1651
1663
|
/* @__PURE__ */ d("tbody", { children: [
|
|
1652
|
-
|
|
1653
|
-
/* @__PURE__ */ t("td", { className: "py-1 text-slate-800 dark:text-slate-100", children:
|
|
1664
|
+
k.categories.map((q) => /* @__PURE__ */ d("tr", { className: "border-t border-slate-100 dark:border-border", children: [
|
|
1665
|
+
/* @__PURE__ */ t("td", { className: "py-1 text-slate-800 dark:text-slate-100", children: q.label }),
|
|
1654
1666
|
/* @__PURE__ */ d("td", { className: "py-1 text-right", children: [
|
|
1655
1667
|
/* @__PURE__ */ t(
|
|
1656
|
-
|
|
1668
|
+
ma,
|
|
1657
1669
|
{
|
|
1658
1670
|
bare: !0,
|
|
1659
1671
|
type: "text",
|
|
1660
1672
|
allowNegative: !1,
|
|
1661
|
-
"data-plan-share": String(
|
|
1662
|
-
"aria-label": `${
|
|
1663
|
-
value: (L == null ? void 0 : L[String(
|
|
1664
|
-
onValue: (le) => f((
|
|
1673
|
+
"data-plan-share": String(q.id),
|
|
1674
|
+
"aria-label": `${q.label} share`,
|
|
1675
|
+
value: (L == null ? void 0 : L[String(q.id)]) ?? "",
|
|
1676
|
+
onValue: (le) => f((V) => ({ ...V ?? {}, [String(q.id)]: le ?? 0 })),
|
|
1665
1677
|
className: "h-6 w-16 rounded border border-slate-200 bg-background px-1.5 text-right text-[12px] outline-none focus:border-slate-400 dark:border-border"
|
|
1666
1678
|
}
|
|
1667
1679
|
),
|
|
1668
1680
|
/* @__PURE__ */ t("span", { className: "ml-0.5 text-slate-500", children: "%" })
|
|
1669
1681
|
] }),
|
|
1670
|
-
/* @__PURE__ */ t("td", { className: "py-1 text-right text-slate-800 dark:text-slate-100", children: D(q
|
|
1671
|
-
/* @__PURE__ */ t("td", { className: "py-1 text-right text-slate-500 dark:text-slate-400", children: D(
|
|
1672
|
-
] }, String(
|
|
1682
|
+
/* @__PURE__ */ t("td", { className: "py-1 text-right text-slate-800 dark:text-slate-100", children: D(P(q.values)) }),
|
|
1683
|
+
/* @__PURE__ */ t("td", { className: "py-1 text-right text-slate-500 dark:text-slate-400", children: D(q.cap) })
|
|
1684
|
+
] }, String(q.id))),
|
|
1673
1685
|
/* @__PURE__ */ d("tr", { className: "border-t border-slate-200 font-medium dark:border-border", children: [
|
|
1674
1686
|
/* @__PURE__ */ t("td", { className: "py-1 text-slate-800 dark:text-slate-100", children: p.total_label ?? "Total" }),
|
|
1675
1687
|
/* @__PURE__ */ t("td", {}),
|
|
1676
|
-
/* @__PURE__ */ t("td", { className: "py-1 text-right text-slate-800 dark:text-slate-100", children: D(
|
|
1688
|
+
/* @__PURE__ */ t("td", { className: "py-1 text-right text-slate-800 dark:text-slate-100", children: D(P(k.original)) }),
|
|
1677
1689
|
/* @__PURE__ */ t("td", {})
|
|
1678
1690
|
] })
|
|
1679
1691
|
] })
|
|
1680
1692
|
] }),
|
|
1681
|
-
(
|
|
1693
|
+
(b || (k == null ? void 0 : k.blocked)) && /* @__PURE__ */ t(
|
|
1682
1694
|
"p",
|
|
1683
1695
|
{
|
|
1684
1696
|
role: "alert",
|
|
1685
1697
|
"data-plan-split-blocked": !0,
|
|
1686
1698
|
className: "mt-1.5 text-[11.5px] font-medium text-red-700 dark:text-red-300",
|
|
1687
|
-
children:
|
|
1699
|
+
children: b ?? (k == null ? void 0 : k.blocked)
|
|
1688
1700
|
}
|
|
1689
1701
|
),
|
|
1690
1702
|
/* @__PURE__ */ t(
|
|
1691
1703
|
"textarea",
|
|
1692
1704
|
{
|
|
1693
|
-
value:
|
|
1694
|
-
onChange: (
|
|
1705
|
+
value: N,
|
|
1706
|
+
onChange: (q) => y(q.target.value),
|
|
1695
1707
|
placeholder: m,
|
|
1696
1708
|
rows: 2,
|
|
1697
1709
|
"aria-label": "Reason",
|
|
@@ -1703,7 +1715,7 @@ function Oa(_) {
|
|
|
1703
1715
|
"button",
|
|
1704
1716
|
{
|
|
1705
1717
|
type: "button",
|
|
1706
|
-
onClick:
|
|
1718
|
+
onClick: R,
|
|
1707
1719
|
className: "rounded-md px-2.5 py-1 text-[12px] text-slate-600 hover:bg-muted dark:text-slate-300",
|
|
1708
1720
|
children: "Back"
|
|
1709
1721
|
}
|
|
@@ -1713,8 +1725,8 @@ function Oa(_) {
|
|
|
1713
1725
|
{
|
|
1714
1726
|
type: "button",
|
|
1715
1727
|
"data-plan-split-apply": !0,
|
|
1716
|
-
disabled: j || !
|
|
1717
|
-
onClick:
|
|
1728
|
+
disabled: j || !k || !!k.blocked,
|
|
1729
|
+
onClick: M,
|
|
1718
1730
|
className: "rounded-md bg-nvr-cyan px-3 py-1 text-[12px] font-medium text-white disabled:opacity-50",
|
|
1719
1731
|
children: j ? "Splitting…" : "Split it"
|
|
1720
1732
|
}
|
|
@@ -1722,12 +1734,12 @@ function Oa(_) {
|
|
|
1722
1734
|
] })
|
|
1723
1735
|
] });
|
|
1724
1736
|
}
|
|
1725
|
-
function
|
|
1726
|
-
const { block: n, config: p, splitBase:
|
|
1737
|
+
function Ta(v) {
|
|
1738
|
+
const { block: n, config: p, splitBase: g, client: o, onCancel: C, onDone: R } = v, K = Number.isFinite(Number(n.key)) ? Number(n.key) : n.key, [F, L] = H(""), [f, k] = H(!1), [S, b] = H(null), x = `Merged the ${n.key} plan back to one line`;
|
|
1727
1739
|
return /* @__PURE__ */ d("div", { className: "p-1.5", "data-plan-merge-pane": !0, children: [
|
|
1728
1740
|
/* @__PURE__ */ t("p", { className: "text-[12.5px] font-semibold text-slate-900 dark:text-slate-100", children: `${p.merge_label ?? "Merge back to one line"} · ${n.key}` }),
|
|
1729
1741
|
/* @__PURE__ */ t("p", { className: "mt-0.5 text-[11.5px] text-slate-600 dark:text-slate-300", children: "The category lines are added together, period by period. Their history stays on the record." }),
|
|
1730
|
-
|
|
1742
|
+
S && /* @__PURE__ */ t("p", { role: "alert", className: "mt-1.5 text-[11.5px] font-medium text-red-700 dark:text-red-300", children: S }),
|
|
1731
1743
|
/* @__PURE__ */ t(
|
|
1732
1744
|
"textarea",
|
|
1733
1745
|
{
|
|
@@ -1744,7 +1756,7 @@ function La(_) {
|
|
|
1744
1756
|
"button",
|
|
1745
1757
|
{
|
|
1746
1758
|
type: "button",
|
|
1747
|
-
onClick:
|
|
1759
|
+
onClick: C,
|
|
1748
1760
|
className: "rounded-md px-2.5 py-1 text-[12px] text-slate-600 hover:bg-muted dark:text-slate-300",
|
|
1749
1761
|
children: "Back"
|
|
1750
1762
|
}
|
|
@@ -1756,18 +1768,18 @@ function La(_) {
|
|
|
1756
1768
|
"data-plan-merge-apply": !0,
|
|
1757
1769
|
disabled: f,
|
|
1758
1770
|
onClick: async () => {
|
|
1759
|
-
|
|
1771
|
+
k(!0);
|
|
1760
1772
|
try {
|
|
1761
1773
|
await o.request(
|
|
1762
|
-
|
|
1774
|
+
rt(`${g}/merge`, {
|
|
1763
1775
|
[p.key_field]: K,
|
|
1764
1776
|
reason: F.trim() || x
|
|
1765
1777
|
})
|
|
1766
|
-
), de.success(`${n.key} is one line again`),
|
|
1778
|
+
), de.success(`${n.key} is one line again`), R();
|
|
1767
1779
|
} catch (j) {
|
|
1768
|
-
|
|
1780
|
+
b(ot(j));
|
|
1769
1781
|
} finally {
|
|
1770
|
-
|
|
1782
|
+
k(!1);
|
|
1771
1783
|
}
|
|
1772
1784
|
},
|
|
1773
1785
|
className: "rounded-md bg-nvr-cyan px-3 py-1 text-[12px] font-medium text-white disabled:opacity-50",
|
|
@@ -1777,56 +1789,56 @@ function La(_) {
|
|
|
1777
1789
|
] })
|
|
1778
1790
|
] });
|
|
1779
1791
|
}
|
|
1780
|
-
function
|
|
1781
|
-
const { config: n, client: p, used:
|
|
1792
|
+
function Ea(v) {
|
|
1793
|
+
const { config: n, client: p, used: g, onAdd: o, label: C } = v, [R, K] = H(!1), [F, L] = H(""), { data: f = [] } = ce({
|
|
1782
1794
|
queryKey: ["plan-grid-keys", n.key_collection],
|
|
1783
1795
|
queryFn: () => p.request(
|
|
1784
1796
|
ue(`/items/${n.key_collection}`, { fields: "id", sort: "-id", limit: 200 })
|
|
1785
|
-
).then((
|
|
1786
|
-
enabled:
|
|
1797
|
+
).then((S) => (S.data ?? []).map((b) => b.id)),
|
|
1798
|
+
enabled: R && !!n.key_collection,
|
|
1787
1799
|
staleTime: 10 * 6e4
|
|
1788
|
-
}),
|
|
1789
|
-
return /* @__PURE__ */ d(
|
|
1790
|
-
/* @__PURE__ */ t(
|
|
1800
|
+
}), k = f.filter((S) => !g.has(String(S)));
|
|
1801
|
+
return /* @__PURE__ */ d(it, { open: R, onOpenChange: K, children: [
|
|
1802
|
+
/* @__PURE__ */ t(dt, { asChild: !0, children: /* @__PURE__ */ d(
|
|
1791
1803
|
"button",
|
|
1792
1804
|
{
|
|
1793
1805
|
type: "button",
|
|
1794
1806
|
"data-plan-add": !0,
|
|
1795
1807
|
className: "inline-flex h-7 items-center gap-1 rounded-md border border-slate-200 px-2 text-[12px] font-medium text-slate-700 hover:bg-muted dark:border-border dark:text-slate-200",
|
|
1796
1808
|
children: [
|
|
1797
|
-
/* @__PURE__ */ t(
|
|
1798
|
-
|
|
1809
|
+
/* @__PURE__ */ t(sa, { className: "h-3.5 w-3.5" }),
|
|
1810
|
+
C
|
|
1799
1811
|
]
|
|
1800
1812
|
}
|
|
1801
1813
|
) }),
|
|
1802
|
-
/* @__PURE__ */ t(
|
|
1803
|
-
|
|
1804
|
-
|
|
1814
|
+
/* @__PURE__ */ t(ct, { align: "start", sideOffset: 6, className: "w-[200px] p-1.5", children: n.key_collection ? /* @__PURE__ */ d("ul", { className: "max-h-[220px] overflow-y-auto", children: [
|
|
1815
|
+
k.length === 0 && /* @__PURE__ */ t("li", { className: "px-2 py-1.5 text-[12px] text-slate-500", children: "Every one is already here." }),
|
|
1816
|
+
k.map((S) => /* @__PURE__ */ t("li", { children: /* @__PURE__ */ t(
|
|
1805
1817
|
"button",
|
|
1806
1818
|
{
|
|
1807
1819
|
type: "button",
|
|
1808
|
-
"data-plan-add-key": String(
|
|
1820
|
+
"data-plan-add-key": String(S),
|
|
1809
1821
|
onClick: () => {
|
|
1810
|
-
o(
|
|
1822
|
+
o(S), K(!1);
|
|
1811
1823
|
},
|
|
1812
1824
|
className: "w-full rounded px-2 py-1.5 text-left text-[12.5px] text-slate-700 hover:bg-muted dark:text-slate-200",
|
|
1813
|
-
children: String(
|
|
1825
|
+
children: String(S)
|
|
1814
1826
|
}
|
|
1815
|
-
) }, String(
|
|
1827
|
+
) }, String(S)))
|
|
1816
1828
|
] }) : /* @__PURE__ */ t(
|
|
1817
1829
|
"form",
|
|
1818
1830
|
{
|
|
1819
|
-
onSubmit: (
|
|
1820
|
-
|
|
1821
|
-
const
|
|
1822
|
-
!
|
|
1831
|
+
onSubmit: (S) => {
|
|
1832
|
+
S.preventDefault();
|
|
1833
|
+
const b = F.trim();
|
|
1834
|
+
!b || g.has(b) || (o(Number.isFinite(Number(b)) ? Number(b) : b), L(""), K(!1));
|
|
1823
1835
|
},
|
|
1824
1836
|
children: /* @__PURE__ */ t(
|
|
1825
1837
|
"input",
|
|
1826
1838
|
{
|
|
1827
1839
|
value: F,
|
|
1828
|
-
onChange: (
|
|
1829
|
-
"aria-label":
|
|
1840
|
+
onChange: (S) => L(S.target.value),
|
|
1841
|
+
"aria-label": C,
|
|
1830
1842
|
className: "h-7 w-full rounded border border-slate-200 bg-background px-2 text-[12.5px] outline-none focus:border-slate-400 dark:border-border"
|
|
1831
1843
|
}
|
|
1832
1844
|
)
|
|
@@ -1835,8 +1847,9 @@ function Ma(_) {
|
|
|
1835
1847
|
] });
|
|
1836
1848
|
}
|
|
1837
1849
|
export {
|
|
1838
|
-
|
|
1850
|
+
Ya as PlanGridField,
|
|
1839
1851
|
D as fmtFigure,
|
|
1840
|
-
|
|
1841
|
-
|
|
1852
|
+
Sa as isParentItemKey,
|
|
1853
|
+
qt as parseFigure,
|
|
1854
|
+
_a as reconcilePatch
|
|
1842
1855
|
};
|