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