@nivaro/react 0.3.9 → 0.3.11
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/components/fields/FileField.js +20 -19
- package/dist/full.css +1 -1
- package/dist/hooks/useNivaroForm.js +129 -126
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +103 -4
- package/dist/index.js +512 -501
- package/dist/shared/components/CollectionBrowserView.js +1632 -1564
- package/dist/shared/components/ConformanceView.js +36 -35
- package/dist/shared/components/ForceReloadBanner.js +58 -34
- package/dist/shared/components/ItemEditForm.js +4386 -4142
- package/dist/shared/components/JsonMapEditor.js +18 -17
- package/dist/shared/components/MatrixEditor.js +8 -7
- package/dist/shared/components/MyWorkView.js +32 -31
- package/dist/shared/components/PageRenderer.js +527 -479
- package/dist/shared/components/QueryStatStrip.js +74 -70
- package/dist/shared/components/RecordGridEditor.js +76 -75
- package/dist/shared/components/ReportView.js +818 -827
- package/dist/shared/components/SheetHeaderBody.js +16 -14
- package/dist/shared/components/ai/AiMemorySuggestions.js +15 -14
- package/dist/shared/components/ai/AskPanel.js +55 -54
- package/dist/shared/components/bulk/BulkActionButtons.js +30 -29
- package/dist/shared/components/bulk/PushBulkButtons.js +57 -56
- package/dist/shared/components/chat/SlashCommands.js +30 -29
- package/dist/shared/components/chat/chat-outbox.js +76 -75
- package/dist/shared/components/help-videos/recorder/useLeaveWarning.js +6 -5
- package/dist/shared/components/integrations/console/SignalCard.js +124 -123
- package/dist/shared/components/integrations/console/SnoozeMenu.js +24 -23
- package/dist/shared/components/item-edit/CatalogPickerField.js +1029 -933
- package/dist/shared/components/item-edit/CloneDialog.js +85 -78
- package/dist/shared/components/item-edit/FieldRenderer.js +161 -156
- package/dist/shared/components/item-edit/FieldRow.js +20 -19
- package/dist/shared/components/item-edit/FilePickerField.js +52 -40
- package/dist/shared/components/item-edit/GroupSection.js +221 -221
- package/dist/shared/components/item-edit/InlineGridField.js +41 -41
- package/dist/shared/components/item-edit/InlineTableField.js +2287 -2275
- package/dist/shared/components/item-edit/M2MCombobox.js +46 -44
- package/dist/shared/components/item-edit/MembershipSetField.js +24 -23
- package/dist/shared/components/item-edit/NestedRelationEditor.js +11 -11
- package/dist/shared/components/item-edit/QuickCreateButton.js +8 -7
- package/dist/shared/components/item-edit/QuickPicker.js +263 -216
- package/dist/shared/components/item-edit/RecordLiveSync.js +101 -100
- package/dist/shared/components/item-edit/RelationCombobox.js +285 -245
- package/dist/shared/components/item-edit/RichTextEditorImpl.js +42 -32
- package/dist/shared/components/item-edit/RowHistorySheet.js +130 -134
- package/dist/shared/components/item-edit/SummaryPanel.js +305 -279
- package/dist/shared/components/item-edit/helpers.js +133 -134
- package/dist/shared/components/item-edit/line-qty.js +57 -0
- package/dist/shared/components/item-edit/option-disambiguate.js +53 -0
- package/dist/shared/components/item-edit/staged-links.js +86 -0
- package/dist/shared/components/layout-editor/LayoutEditor.js +275 -274
- package/dist/shared/components/layout-editor/editors/cascade-rule-row.js +18 -17
- package/dist/shared/components/layout-editor/inspector/HelpTab.js +37 -36
- package/dist/shared/components/layout-editor/matrix/FieldStateMatrix.js +50 -49
- package/dist/shared/components/panels/AddendumLinesDiff.js +87 -90
- package/dist/shared/components/panels/CommentPanel.js +350 -315
- package/dist/shared/components/panels/ItemLockBanner.js +297 -230
- package/dist/shared/components/panels/PipelinePanel.js +719 -701
- package/dist/shared/components/profile/AiMemoryCard.js +15 -14
- package/dist/shared/components/profile/PersonAdminTools.js +70 -67
- package/dist/shared/components/queue/QueueItemSheet.js +36 -35
- package/dist/shared/components/queue/QueueQuickFilters.js +43 -41
- package/dist/shared/components/queue/QueueWorklist.js +1026 -957
- package/dist/shared/components/widgets/ReviewListWidget.js +99 -93
- package/dist/shared/lib/client-version.js +63 -0
- package/dist/shared/lib/force-reload.js +36 -0
- package/dist/shared/lib/load-error.js +11 -10
- package/dist/shared/lib/obligation-banner.js +14 -13
- package/dist/shared/lib/obligation-reason-text.js +13 -0
- package/dist/shared/lib/presence-live.js +54 -35
- package/dist/shared/lib/query-filter-seed.js +34 -11
- package/dist/shared/lib/record-outbox.js +76 -75
- package/dist/shared/lib/safe-error.js +39 -0
- package/dist/shared/lib/sanitize-html.js +24 -15
- package/dist/shared/lib/server-clock.js +11 -7
- package/dist/shared/lib/sheet-def.js +38 -22
- package/dist/shared/lib/unique-options.js +10 -0
- package/dist/shared/lib/unsaved-work.js +62 -0
- package/dist/shared/lib/utils.js +57 -43
- package/dist/shared/lib/validation-rules.js +58 -34
- package/package.json +1 -1
|
@@ -1,81 +1,83 @@
|
|
|
1
|
-
import { jsxs as c, jsx as n, Fragment as
|
|
2
|
-
import { useQueryClient as
|
|
3
|
-
import { Search as
|
|
4
|
-
import { useState as
|
|
5
|
-
import { createPortal as
|
|
6
|
-
import { useNivaroClient as
|
|
7
|
-
import { canOpenCatalogItem as
|
|
8
|
-
import { get as
|
|
9
|
-
import { evaluateBoolean as
|
|
10
|
-
import { useLiveRefetchInterval as
|
|
11
|
-
import { submissionLineErrors as
|
|
12
|
-
import { titleCase as
|
|
13
|
-
import { ImportFromFileButton as
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
1
|
+
import { jsxs as c, jsx as n, Fragment as _t } from "react/jsx-runtime";
|
|
2
|
+
import { useQueryClient as Nr, useQuery as J, useQueries as St } from "@tanstack/react-query";
|
|
3
|
+
import { Search as st, Loader2 as oe, ChevronRight as qt, Star as Qe, AlertTriangle as Je, AlertCircle as Mt, X as at, ChevronDown as vr } from "lucide-react";
|
|
4
|
+
import { useState as Y, useRef as ze, useMemo as O, useEffect as je, Fragment as Ce } from "react";
|
|
5
|
+
import { createPortal as _r } from "react-dom";
|
|
6
|
+
import { useNivaroClient as $t, useParentDraft as Sr, useReimportHandler as qr } from "../../context.js";
|
|
7
|
+
import { canOpenCatalogItem as Zt, openCatalogItem as Gt } from "../../lib/catalog-item-open.js";
|
|
8
|
+
import { get as P, patch as Wt, del as $r, post as It } from "../../lib/commands.js";
|
|
9
|
+
import { evaluateBoolean as jr } from "../../lib/expression.js";
|
|
10
|
+
import { useLiveRefetchInterval as Fr } from "../../lib/live-queries.js";
|
|
11
|
+
import { submissionLineErrors as Tr, normalizeIdent as Or } from "../../lib/submission-errors.js";
|
|
12
|
+
import { titleCase as re, cn as z, matchesAllTokens as Pr } from "../../lib/utils.js";
|
|
13
|
+
import { ImportFromFileButton as Rr } from "../import/ImportFromFileButton.js";
|
|
14
|
+
import { Popover as Lr, PopoverAnchor as Er, PopoverContent as Ar } from "../ui/popover.js";
|
|
15
|
+
import { applyDisplayTemplate as Fe } from "./helpers.js";
|
|
16
|
+
import { evalClientFormula as Ke } from "./InlineTableField.js";
|
|
17
|
+
import { isIntegerFieldType as Cr, checkNumberEntry as Kr, mergePendingQtyRow as Jr } from "./line-qty.js";
|
|
18
|
+
import { resolveM2MRelatedCollection as Qr } from "./M2MCombobox.js";
|
|
19
|
+
import { useO2MStaging as zr } from "./O2MStagingContext.js";
|
|
20
|
+
import { RelationCombobox as Br } from "./RelationCombobox.js";
|
|
21
|
+
const Xt = (u, g) => {
|
|
22
|
+
let _ = u;
|
|
23
|
+
for (const q of g.split(".")) {
|
|
24
|
+
if (_ == null || typeof _ != "object") return;
|
|
25
|
+
_ = _[q];
|
|
24
26
|
}
|
|
25
|
-
return
|
|
27
|
+
return _;
|
|
26
28
|
};
|
|
27
|
-
async function
|
|
29
|
+
async function it(u, g, _) {
|
|
28
30
|
const q = [];
|
|
29
31
|
for (let l = 1; l <= 50; l++) {
|
|
30
|
-
const
|
|
31
|
-
if (q.push(...
|
|
32
|
+
const x = await u.request(P(g, { ..._, limit: 1e3, page: l })).then((h) => h.data ?? []);
|
|
33
|
+
if (q.push(...x), x.length < 1e3) break;
|
|
32
34
|
}
|
|
33
35
|
return q;
|
|
34
36
|
}
|
|
35
|
-
function
|
|
36
|
-
const
|
|
37
|
+
function Be(u, g) {
|
|
38
|
+
const _ = {};
|
|
37
39
|
let q = !1;
|
|
38
|
-
const l = (
|
|
39
|
-
if (typeof
|
|
40
|
-
const
|
|
41
|
-
return
|
|
40
|
+
const l = (x) => {
|
|
41
|
+
if (typeof x == "string" && x.startsWith("$parent.")) {
|
|
42
|
+
const h = g == null ? void 0 : g[x.slice(8)];
|
|
43
|
+
return h == null || h === "" ? (q = !0, x) : h;
|
|
42
44
|
}
|
|
43
|
-
return Array.isArray(
|
|
45
|
+
return Array.isArray(x) ? x.map(l) : x && typeof x == "object" ? Object.fromEntries(Object.entries(x).map(([h, $]) => [h, l($)])) : x;
|
|
44
46
|
};
|
|
45
|
-
for (const [
|
|
46
|
-
if (typeof
|
|
47
|
-
const $ =
|
|
47
|
+
for (const [x, h] of Object.entries(u ?? {}))
|
|
48
|
+
if (typeof h == "string" && h.startsWith("$parent.")) {
|
|
49
|
+
const $ = g == null ? void 0 : g[h.slice(8)];
|
|
48
50
|
if ($ == null || $ === "") {
|
|
49
51
|
q = !0;
|
|
50
52
|
continue;
|
|
51
53
|
}
|
|
52
|
-
|
|
53
|
-
} else
|
|
54
|
-
return q ? null :
|
|
54
|
+
_[x] = { _eq: $ };
|
|
55
|
+
} else h && typeof h == "object" ? _[x] = l(h) : _[x] = { _eq: h };
|
|
56
|
+
return q ? null : _;
|
|
55
57
|
}
|
|
56
|
-
function
|
|
57
|
-
if (!
|
|
58
|
-
for (const [
|
|
59
|
-
const l =
|
|
60
|
-
for (const [$,
|
|
58
|
+
function Yt(u, g) {
|
|
59
|
+
if (!u) return !0;
|
|
60
|
+
for (const [_, q] of Object.entries(u)) {
|
|
61
|
+
const l = g == null ? void 0 : g[_], x = l == null ? null : String(l), h = q && typeof q == "object" ? q : { _eq: q };
|
|
62
|
+
for (const [$, p] of Object.entries(h))
|
|
61
63
|
switch ($) {
|
|
62
64
|
case "_eq":
|
|
63
|
-
if (
|
|
65
|
+
if (x !== String(p)) return !1;
|
|
64
66
|
break;
|
|
65
67
|
case "_neq":
|
|
66
|
-
if (
|
|
68
|
+
if (x === String(p)) return !1;
|
|
67
69
|
break;
|
|
68
70
|
case "_in":
|
|
69
|
-
if (!Array.isArray(
|
|
71
|
+
if (!Array.isArray(p) || !p.map(String).includes(x ?? "")) return !1;
|
|
70
72
|
break;
|
|
71
73
|
case "_nin":
|
|
72
|
-
if (Array.isArray(
|
|
74
|
+
if (Array.isArray(p) && p.map(String).includes(x ?? "")) return !1;
|
|
73
75
|
break;
|
|
74
76
|
case "_null":
|
|
75
|
-
if (
|
|
77
|
+
if (x !== null) return !1;
|
|
76
78
|
break;
|
|
77
79
|
case "_nnull":
|
|
78
|
-
if (
|
|
80
|
+
if (x === null) return !1;
|
|
79
81
|
break;
|
|
80
82
|
default:
|
|
81
83
|
return !1;
|
|
@@ -83,440 +85,444 @@ function Ut(m, x) {
|
|
|
83
85
|
}
|
|
84
86
|
return !0;
|
|
85
87
|
}
|
|
86
|
-
const
|
|
87
|
-
function
|
|
88
|
-
relatedCollection:
|
|
89
|
-
manyField:
|
|
90
|
-
parentId:
|
|
88
|
+
const Vr = 2e3;
|
|
89
|
+
function bn({
|
|
90
|
+
relatedCollection: u,
|
|
91
|
+
manyField: g,
|
|
92
|
+
parentId: _,
|
|
91
93
|
parentCollection: q,
|
|
92
94
|
config: l,
|
|
93
|
-
readOnly:
|
|
95
|
+
readOnly: x = !1
|
|
94
96
|
}) {
|
|
95
|
-
var
|
|
96
|
-
const
|
|
97
|
-
queryKey: ["collection-relations",
|
|
98
|
-
queryFn: () =>
|
|
97
|
+
var Vt, Dt, Ut;
|
|
98
|
+
const h = $t(), $ = Nr(), p = zr(), L = Sr(), Z = qr(), B = l.editable_fields ?? [], A = _ === "new", V = l.qty_field ?? "quantity", [ce, ne] = Y(/* @__PURE__ */ new Set()), ye = ze(!1), [C, ke] = Y(""), [pe, G] = Y({}), [se, v] = Y(/* @__PURE__ */ new Set()), [F, j] = Y({}), { data: D = [], isPending: K } = J({
|
|
99
|
+
queryKey: ["collection-relations", u],
|
|
100
|
+
queryFn: () => h.request(P(`/collections/${u}`)).then((e) => {
|
|
99
101
|
var t;
|
|
100
102
|
return ((t = e.data) == null ? void 0 : t.relations) ?? [];
|
|
101
103
|
}),
|
|
102
104
|
staleTime: 10 * 6e4
|
|
103
|
-
}), b =
|
|
105
|
+
}), b = O(
|
|
104
106
|
() => {
|
|
105
107
|
var e;
|
|
106
|
-
return ((e =
|
|
107
|
-
(t) => t.many_collection ===
|
|
108
|
+
return ((e = D.find(
|
|
109
|
+
(t) => t.many_collection === u && t.many_field === l.item_field && !t.junction_field
|
|
108
110
|
)) == null ? void 0 : e.one_collection) ?? null;
|
|
109
111
|
},
|
|
110
|
-
[
|
|
111
|
-
), { data:
|
|
112
|
+
[D, u, l.item_field]
|
|
113
|
+
), { data: me = [] } = J({
|
|
114
|
+
queryKey: ["field-config", u, null],
|
|
115
|
+
queryFn: () => h.request(P(`/field-config/${u}`)).then((e) => e.data ?? []),
|
|
116
|
+
staleTime: 6e4
|
|
117
|
+
}), X = ((Vt = me.find((e) => e.field === V)) == null ? void 0 : Vt.type) ?? null, { data: U } = J({
|
|
112
118
|
queryKey: ["col-meta", b],
|
|
113
|
-
queryFn: () =>
|
|
114
|
-
|
|
119
|
+
queryFn: () => h.request(
|
|
120
|
+
P(`/collections/${b}`)
|
|
115
121
|
).then((e) => e.data),
|
|
116
122
|
enabled: !!b,
|
|
117
123
|
staleTime: 3e5
|
|
118
|
-
}),
|
|
124
|
+
}), H = U == null ? void 0 : U.display_template, R = O(() => {
|
|
119
125
|
const e = l.section_by.split(".")[0];
|
|
120
|
-
return ((
|
|
126
|
+
return ((U == null ? void 0 : U.relations) ?? []).find(
|
|
121
127
|
(t) => t.one_collection === b && t.one_field === e && !!t.junction_field
|
|
122
128
|
) ?? null;
|
|
123
|
-
}, [
|
|
124
|
-
queryKey: ["collection-relations",
|
|
125
|
-
queryFn: () =>
|
|
129
|
+
}, [U, b, l.section_by]), ue = (R == null ? void 0 : R.many_collection) ?? null, { data: Ve = [] } = J({
|
|
130
|
+
queryKey: ["collection-relations", ue],
|
|
131
|
+
queryFn: () => h.request(P(`/collections/${ue}`)).then((e) => {
|
|
126
132
|
var t;
|
|
127
133
|
return ((t = e.data) == null ? void 0 : t.relations) ?? [];
|
|
128
134
|
}),
|
|
129
|
-
enabled: !!
|
|
135
|
+
enabled: !!ue,
|
|
130
136
|
staleTime: 10 * 6e4
|
|
131
|
-
}),
|
|
132
|
-
if (!(
|
|
133
|
-
const e = String(
|
|
134
|
-
(
|
|
135
|
-
), r =
|
|
137
|
+
}), Q = O(() => {
|
|
138
|
+
if (!(R != null && R.many_field) || !ue) return null;
|
|
139
|
+
const e = String(R.junction_field), t = Ve.find(
|
|
140
|
+
(s) => s.many_collection === ue && s.many_field === e
|
|
141
|
+
), r = Qr(t);
|
|
136
142
|
return r ? {
|
|
137
|
-
junction:
|
|
138
|
-
fkToItem:
|
|
143
|
+
junction: ue,
|
|
144
|
+
fkToItem: R.many_field,
|
|
139
145
|
fkToSection: e,
|
|
140
146
|
target: r,
|
|
141
147
|
labelPath: l.section_by.split(".").slice(1).join(".") || "id"
|
|
142
148
|
} : null;
|
|
143
|
-
}, [
|
|
149
|
+
}, [R, ue, Ve, l.section_by]), ee = L == null ? void 0 : L.draft, { resolvedFilter: Te, resolvedSectionFilter: he, resolvedLinkFilter: ae, missingParents: xe } = O(() => {
|
|
144
150
|
const e = [], t = (o) => {
|
|
145
151
|
if (typeof o == "string" && o.startsWith("$parent.")) {
|
|
146
|
-
const
|
|
147
|
-
return
|
|
152
|
+
const i = o.slice(8), y = ee == null ? void 0 : ee[i];
|
|
153
|
+
return y == null || y === "" ? (e.push(i), o) : y;
|
|
148
154
|
}
|
|
149
|
-
return Array.isArray(o) ? o.map(t) : o && typeof o == "object" ? Object.fromEntries(Object.entries(o).map(([
|
|
150
|
-
}, r = l.filter ? t(l.filter) : void 0,
|
|
155
|
+
return Array.isArray(o) ? o.map(t) : o && typeof o == "object" ? Object.fromEntries(Object.entries(o).map(([i, y]) => [i, t(y)])) : o;
|
|
156
|
+
}, r = l.filter ? t(l.filter) : void 0, s = l.section_filter ? t(l.section_filter) : void 0, m = l.link_filter ? t(l.link_filter) : void 0;
|
|
151
157
|
return {
|
|
152
158
|
resolvedFilter: r,
|
|
153
|
-
resolvedSectionFilter:
|
|
154
|
-
resolvedLinkFilter:
|
|
159
|
+
resolvedSectionFilter: s,
|
|
160
|
+
resolvedLinkFilter: m,
|
|
155
161
|
missingParents: [...new Set(e)]
|
|
156
162
|
};
|
|
157
|
-
}, [l.filter, l.section_filter, l.link_filter,
|
|
158
|
-
if (!
|
|
163
|
+
}, [l.filter, l.section_filter, l.link_filter, ee]), Oe = O(() => {
|
|
164
|
+
if (!R || !he && !ae) return Te;
|
|
159
165
|
const e = {
|
|
160
|
-
...
|
|
161
|
-
...
|
|
162
|
-
}, t = { [
|
|
163
|
-
return
|
|
164
|
-
}, [
|
|
166
|
+
...he ?? {},
|
|
167
|
+
...ae ? { _link: ae } : {}
|
|
168
|
+
}, t = { [R.one_field]: { _some: e } };
|
|
169
|
+
return Te ? { _and: [Te, t] } : t;
|
|
170
|
+
}, [R, he, ae, Te]), a = O(() => {
|
|
165
171
|
const e = /* @__PURE__ */ new Set(["id"]);
|
|
166
|
-
|
|
167
|
-
for (const t of [...(
|
|
172
|
+
U && !R && e.add(l.section_by);
|
|
173
|
+
for (const t of [...(H ?? "").matchAll(/\{\{([\w.]+)\}\}/g)]) e.add(t[1]);
|
|
168
174
|
for (const t of Object.values(l.copy_fields ?? {})) e.add(t);
|
|
169
175
|
for (const t of l.columns ?? []) e.add(t.field);
|
|
170
176
|
return [...e].join(",");
|
|
171
|
-
}, [
|
|
177
|
+
}, [H, U, R, l.section_by, l.copy_fields, l.columns]), w = JSON.stringify(Oe ?? null), { data: E = [], isLoading: ie } = J(
|
|
172
178
|
{
|
|
173
|
-
queryKey: ["catalog-picker", b,
|
|
174
|
-
queryFn: () =>
|
|
175
|
-
|
|
176
|
-
limit:
|
|
177
|
-
fields:
|
|
178
|
-
...
|
|
179
|
+
queryKey: ["catalog-picker", b, a, w],
|
|
180
|
+
queryFn: () => h.request(
|
|
181
|
+
P(`/items/${b}`, {
|
|
182
|
+
limit: Vr,
|
|
183
|
+
fields: a,
|
|
184
|
+
...Oe ? { filter: JSON.stringify(Oe) } : {}
|
|
179
185
|
})
|
|
180
186
|
).then((e) => e.data ?? []),
|
|
181
187
|
// Wait for the catalog meta: a to-many section path both narrows this
|
|
182
188
|
// read and must stay out of its `fields=`.
|
|
183
|
-
enabled: !!b && !!
|
|
189
|
+
enabled: !!b && !!U && xe.length === 0 && (!R || !!Q),
|
|
184
190
|
staleTime: 6e4
|
|
185
191
|
}
|
|
186
|
-
),
|
|
187
|
-
queryKey: ["catalog-sections",
|
|
192
|
+
), te = JSON.stringify(he ?? null), { data: I = [], isLoading: M } = J({
|
|
193
|
+
queryKey: ["catalog-sections", Q == null ? void 0 : Q.target, Q == null ? void 0 : Q.labelPath, te],
|
|
188
194
|
queryFn: async () => {
|
|
189
|
-
const e =
|
|
190
|
-
return (await
|
|
195
|
+
const e = Q;
|
|
196
|
+
return (await it(h, `/items/${e.target}`, {
|
|
191
197
|
fields: `id,${e.labelPath}`,
|
|
192
|
-
...
|
|
198
|
+
...he ? { filter: JSON.stringify(he) } : {}
|
|
193
199
|
})).map((r) => ({
|
|
194
200
|
id: String(r.id),
|
|
195
|
-
name: String(
|
|
201
|
+
name: String(Xt(r, e.labelPath) ?? "").trim()
|
|
196
202
|
}));
|
|
197
203
|
},
|
|
198
|
-
enabled: !!
|
|
204
|
+
enabled: !!Q && xe.length === 0,
|
|
199
205
|
staleTime: 6e4
|
|
200
|
-
}),
|
|
206
|
+
}), W = O(() => I.map((e) => e.id), [I]), { data: we = [], isLoading: Ne } = J({
|
|
201
207
|
queryKey: [
|
|
202
208
|
"catalog-section-links",
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
JSON.stringify(
|
|
209
|
+
Q == null ? void 0 : Q.junction,
|
|
210
|
+
W.join(","),
|
|
211
|
+
JSON.stringify(ae ?? null)
|
|
206
212
|
],
|
|
207
213
|
queryFn: async () => {
|
|
208
|
-
const e =
|
|
209
|
-
for (let r = 0; r <
|
|
210
|
-
const
|
|
214
|
+
const e = Q, t = [];
|
|
215
|
+
for (let r = 0; r < W.length; r += 200) {
|
|
216
|
+
const s = W.slice(r, r + 200), m = await it(h, `/items/${e.junction}`, {
|
|
211
217
|
fields: `${e.fkToItem},${e.fkToSection}`,
|
|
212
218
|
filter: JSON.stringify(
|
|
213
|
-
|
|
219
|
+
ae ? { _and: [{ [e.fkToSection]: { _in: s } }, ae] } : { [e.fkToSection]: { _in: s } }
|
|
214
220
|
)
|
|
215
221
|
});
|
|
216
|
-
for (const o of
|
|
222
|
+
for (const o of m)
|
|
217
223
|
o[e.fkToItem] == null || o[e.fkToSection] == null || t.push({ item: String(o[e.fkToItem]), section: String(o[e.fkToSection]) });
|
|
218
224
|
}
|
|
219
225
|
return t;
|
|
220
226
|
},
|
|
221
|
-
enabled: !!
|
|
227
|
+
enabled: !!Q && W.length > 0,
|
|
222
228
|
staleTime: 6e4
|
|
223
|
-
}),
|
|
224
|
-
const e = new Map(
|
|
225
|
-
for (const r of
|
|
226
|
-
const
|
|
227
|
-
if (!
|
|
228
|
-
const
|
|
229
|
-
|
|
229
|
+
}), jt = O(() => {
|
|
230
|
+
const e = new Map(I.map((r) => [r.id, r.name])), t = /* @__PURE__ */ new Map();
|
|
231
|
+
for (const r of we) {
|
|
232
|
+
const s = e.get(r.section);
|
|
233
|
+
if (!s) continue;
|
|
234
|
+
const m = t.get(r.item) ?? [];
|
|
235
|
+
m.includes(s) || m.push(s), t.set(r.item, m);
|
|
230
236
|
}
|
|
231
237
|
return t;
|
|
232
|
-
}, [
|
|
238
|
+
}, [I, we]), De = !!R && (!Q || M || W.length > 0 && Ne), Ue = O(() => {
|
|
233
239
|
const e = /* @__PURE__ */ new Map();
|
|
234
|
-
for (const t of
|
|
240
|
+
for (const t of E) e.set(String(t.id), t);
|
|
235
241
|
return e;
|
|
236
|
-
}, [
|
|
237
|
-
queryKey: ["o2m-rows",
|
|
238
|
-
queryFn: () =>
|
|
239
|
-
|
|
240
|
-
filter: JSON.stringify({ [
|
|
242
|
+
}, [E]), { data: ve = [] } = J({
|
|
243
|
+
queryKey: ["o2m-rows", u, g, _],
|
|
244
|
+
queryFn: () => h.request(
|
|
245
|
+
P(`/items/${u}`, {
|
|
246
|
+
filter: JSON.stringify({ [g]: { _eq: _ } }),
|
|
241
247
|
limit: 1e3
|
|
242
248
|
})
|
|
243
249
|
).then((e) => e.data ?? []),
|
|
244
|
-
enabled: !
|
|
250
|
+
enabled: !A,
|
|
245
251
|
staleTime: 15e3
|
|
246
|
-
}),
|
|
247
|
-
() =>
|
|
248
|
-
const t =
|
|
252
|
+
}), Pe = !A && !!p, Se = p ? p.getPendingRows(u, g) : [], He = Pe ? p.getPendingEdits(u, g) : /* @__PURE__ */ new Map(), er = JSON.stringify([...He.entries()]), Me = O(
|
|
253
|
+
() => He.size === 0 ? ve : ve.map((e) => {
|
|
254
|
+
const t = He.get(String(e.id));
|
|
249
255
|
return t ? { ...e, ...t } : e;
|
|
250
256
|
}),
|
|
251
|
-
[
|
|
252
|
-
),
|
|
257
|
+
[ve, er]
|
|
258
|
+
), We = !A && p ? p.getPendingDeletes(u, g) : /* @__PURE__ */ new Set(), Ie = O(() => {
|
|
253
259
|
const e = /* @__PURE__ */ new Map();
|
|
254
|
-
for (const t of
|
|
260
|
+
for (const t of Me) {
|
|
255
261
|
const r = t[l.item_field];
|
|
256
262
|
r != null && e.set(String(r), t);
|
|
257
263
|
}
|
|
258
264
|
return e;
|
|
259
|
-
}, [
|
|
265
|
+
}, [Me, l.item_field]), lt = O(() => {
|
|
260
266
|
const e = /* @__PURE__ */ new Map();
|
|
261
|
-
return
|
|
262
|
-
const
|
|
263
|
-
|
|
267
|
+
return Se.forEach((t, r) => {
|
|
268
|
+
const s = t[l.item_field];
|
|
269
|
+
s != null && e.set(String(s), r);
|
|
264
270
|
}), e;
|
|
265
|
-
}, [
|
|
266
|
-
const e =
|
|
267
|
-
if (
|
|
268
|
-
const t =
|
|
269
|
-
return [...t, ...e.filter((
|
|
270
|
-
}, [
|
|
271
|
-
() =>
|
|
272
|
-
[
|
|
273
|
-
), { data:
|
|
274
|
-
queryKey: ["catalog-picker-labels", b,
|
|
275
|
-
queryFn: () =>
|
|
276
|
-
|
|
277
|
-
filter: JSON.stringify({ id: { _in:
|
|
278
|
-
fields:
|
|
279
|
-
limit:
|
|
271
|
+
}, [Se, l.item_field]), de = O(() => {
|
|
272
|
+
const e = Se.filter((s) => s[l.item_field] != null).map((s) => ({ key: String(s[l.item_field]), row: s }));
|
|
273
|
+
if (A) return e;
|
|
274
|
+
const t = Me.filter((s) => s[l.item_field] != null).map((s) => ({ key: String(s[l.item_field]), row: s })), r = new Set(t.map((s) => s.key));
|
|
275
|
+
return [...t, ...e.filter((s) => !r.has(s.key))];
|
|
276
|
+
}, [A, Se, Me, l.item_field]), Ye = O(
|
|
277
|
+
() => de.filter((e) => !Ue.has(e.key)).map((e) => e.key),
|
|
278
|
+
[de, Ue]
|
|
279
|
+
), { data: Ft = [] } = J({
|
|
280
|
+
queryKey: ["catalog-picker-labels", b, a, Ye.join(",")],
|
|
281
|
+
queryFn: () => h.request(
|
|
282
|
+
P(`/items/${b}`, {
|
|
283
|
+
filter: JSON.stringify({ id: { _in: Ye } }),
|
|
284
|
+
fields: a,
|
|
285
|
+
limit: Ye.length
|
|
280
286
|
})
|
|
281
287
|
).then((e) => e.data ?? []),
|
|
282
|
-
enabled: !!b &&
|
|
288
|
+
enabled: !!b && Ye.length > 0,
|
|
283
289
|
staleTime: 6e4
|
|
284
|
-
}), { data:
|
|
290
|
+
}), { data: ge = [] } = J({
|
|
285
291
|
queryKey: ["pinned-items", b],
|
|
286
|
-
queryFn: () =>
|
|
292
|
+
queryFn: () => h.request(P(`/pinned/${b}`)).then((e) => e.data ?? []),
|
|
287
293
|
enabled: !!b && !!l.favorites,
|
|
288
294
|
staleTime: 6e4
|
|
289
|
-
}),
|
|
290
|
-
queryKey: ["pinned-item-rows", b,
|
|
291
|
-
queryFn: () =>
|
|
292
|
-
|
|
293
|
-
filter: JSON.stringify({ id: { _in:
|
|
294
|
-
fields:
|
|
295
|
-
limit:
|
|
295
|
+
}), ot = O(() => new Set(ge), [ge]), { data: Re = [] } = J({
|
|
296
|
+
queryKey: ["pinned-item-rows", b, a, ge.join(",")],
|
|
297
|
+
queryFn: () => h.request(
|
|
298
|
+
P(`/items/${b}`, {
|
|
299
|
+
filter: JSON.stringify({ id: { _in: ge } }),
|
|
300
|
+
fields: a,
|
|
301
|
+
limit: ge.length
|
|
296
302
|
})
|
|
297
303
|
).then((e) => e.data ?? []),
|
|
298
|
-
enabled: !!b && !!l.favorites &&
|
|
304
|
+
enabled: !!b && !!l.favorites && ge.length > 0,
|
|
299
305
|
staleTime: 6e4
|
|
300
|
-
}), [
|
|
301
|
-
async function
|
|
302
|
-
if (!(!b ||
|
|
303
|
-
|
|
306
|
+
}), [Ze, Tt] = Y(/* @__PURE__ */ new Set());
|
|
307
|
+
async function Ot(e) {
|
|
308
|
+
if (!(!b || Ze.has(e))) {
|
|
309
|
+
Tt((t) => new Set(t).add(e));
|
|
304
310
|
try {
|
|
305
|
-
await
|
|
311
|
+
await h.request(It(`/pinned/${b}/${e}/toggle`)).catch(() => {
|
|
306
312
|
}), await $.invalidateQueries({ queryKey: ["pinned-items", b] });
|
|
307
313
|
} finally {
|
|
308
|
-
|
|
314
|
+
Tt((t) => {
|
|
309
315
|
const r = new Set(t);
|
|
310
316
|
return r.delete(e), r;
|
|
311
317
|
});
|
|
312
318
|
}
|
|
313
319
|
}
|
|
314
320
|
}
|
|
315
|
-
const [
|
|
321
|
+
const [tr, Pt] = Y(!1), Rt = ze(null), dt = (e) => l.favorites ? /* @__PURE__ */ n(
|
|
316
322
|
"button",
|
|
317
323
|
{
|
|
318
324
|
type: "button",
|
|
319
|
-
title:
|
|
320
|
-
disabled:
|
|
325
|
+
title: ot.has(e) ? "Remove from favorites" : "Add to favorites",
|
|
326
|
+
disabled: Ze.has(e),
|
|
321
327
|
onClick: (t) => {
|
|
322
|
-
t.stopPropagation(),
|
|
328
|
+
t.stopPropagation(), Ot(e);
|
|
323
329
|
},
|
|
324
330
|
className: "shrink-0 rounded p-0.5 transition-colors",
|
|
325
|
-
children:
|
|
326
|
-
|
|
331
|
+
children: Ze.has(e) ? /* @__PURE__ */ n(oe, { className: "h-3.5 w-3.5 animate-spin text-amber-400" }) : /* @__PURE__ */ n(
|
|
332
|
+
Qe,
|
|
327
333
|
{
|
|
328
|
-
className:
|
|
334
|
+
className: z(
|
|
329
335
|
"h-3.5 w-3.5",
|
|
330
|
-
|
|
336
|
+
ot.has(e) ? "fill-amber-400 text-amber-400" : "text-slate-300 hover:text-amber-400"
|
|
331
337
|
)
|
|
332
338
|
}
|
|
333
339
|
)
|
|
334
340
|
}
|
|
335
|
-
) : null, [
|
|
336
|
-
|
|
337
|
-
const e = setTimeout(() =>
|
|
341
|
+
) : null, [ct, rr] = Y("");
|
|
342
|
+
je(() => {
|
|
343
|
+
const e = setTimeout(() => rr(C), 300);
|
|
338
344
|
return () => clearTimeout(e);
|
|
339
|
-
}, [
|
|
340
|
-
const
|
|
345
|
+
}, [C]);
|
|
346
|
+
const nr = O(() => {
|
|
341
347
|
var t;
|
|
342
|
-
const e = (t = [...(
|
|
348
|
+
const e = (t = [...(H ?? "").matchAll(/\{\{([\w.]+)\}\}/g)][0]) == null ? void 0 : t[1];
|
|
343
349
|
return e && !e.includes(".") ? e : "id";
|
|
344
|
-
}, [
|
|
345
|
-
queryKey: ["catalog-full-search", b,
|
|
346
|
-
queryFn: () =>
|
|
347
|
-
|
|
348
|
-
search:
|
|
349
|
-
fields:
|
|
350
|
+
}, [H]), { data: sr = [], isFetching: mt } = J({
|
|
351
|
+
queryKey: ["catalog-full-search", b, a, ct],
|
|
352
|
+
queryFn: () => h.request(
|
|
353
|
+
P(`/items/${b}`, {
|
|
354
|
+
search: ct,
|
|
355
|
+
fields: a,
|
|
350
356
|
limit: 25,
|
|
351
|
-
sort:
|
|
357
|
+
sort: nr
|
|
352
358
|
})
|
|
353
359
|
).then((e) => e.data ?? []),
|
|
354
|
-
enabled: !!b &&
|
|
360
|
+
enabled: !!b && ct.trim().length > 0,
|
|
355
361
|
staleTime: 3e4,
|
|
356
362
|
placeholderData: (e) => e
|
|
357
|
-
}),
|
|
363
|
+
}), qe = sr, Ge = O(() => {
|
|
358
364
|
const e = /* @__PURE__ */ new Set();
|
|
359
|
-
for (const t of
|
|
360
|
-
for (const t of
|
|
361
|
-
for (const t of
|
|
362
|
-
for (const t of
|
|
365
|
+
for (const t of E) e.add(String(t.id));
|
|
366
|
+
for (const t of de) e.add(t.key);
|
|
367
|
+
for (const t of ge) e.add(t);
|
|
368
|
+
for (const t of qe) e.add(String(t.id));
|
|
363
369
|
return [...e];
|
|
364
|
-
}, [
|
|
370
|
+
}, [E, de, ge, qe]), Lt = St({
|
|
365
371
|
queries: (l.related_columns ?? []).map((e) => {
|
|
366
|
-
const t =
|
|
372
|
+
const t = Be(e.match, ee);
|
|
367
373
|
return {
|
|
368
374
|
queryKey: [
|
|
369
375
|
"catalog-related",
|
|
370
376
|
e.key,
|
|
371
377
|
e.collection,
|
|
372
378
|
JSON.stringify(t),
|
|
373
|
-
|
|
379
|
+
Ge.join(",")
|
|
374
380
|
],
|
|
375
381
|
queryFn: async () => {
|
|
376
|
-
const r = {},
|
|
377
|
-
for (let o = 0; o <
|
|
378
|
-
const
|
|
379
|
-
let
|
|
382
|
+
const r = {}, s = e.aggregate === "sum", m = s ? 150 : 400;
|
|
383
|
+
for (let o = 0; o < Ge.length; o += m) {
|
|
384
|
+
const i = Ge.slice(o, o + m);
|
|
385
|
+
let y = 1;
|
|
380
386
|
for (; ; ) {
|
|
381
|
-
const
|
|
382
|
-
|
|
383
|
-
limit:
|
|
384
|
-
...
|
|
387
|
+
const d = await h.request(
|
|
388
|
+
P(`/items/${e.collection}`, {
|
|
389
|
+
limit: s ? 1e3 : i.length,
|
|
390
|
+
...s ? { page: y } : {},
|
|
385
391
|
fields: `${e.item_field},${e.value_field}`,
|
|
386
|
-
filter: JSON.stringify({ ...t, [e.item_field]: { _in:
|
|
392
|
+
filter: JSON.stringify({ ...t, [e.item_field]: { _in: i } })
|
|
387
393
|
})
|
|
388
|
-
).then((
|
|
389
|
-
for (const
|
|
390
|
-
const
|
|
391
|
-
if (
|
|
392
|
-
if (
|
|
393
|
-
const
|
|
394
|
-
r[String(
|
|
394
|
+
).then((f) => f.data ?? []);
|
|
395
|
+
for (const f of d) {
|
|
396
|
+
const N = f[e.item_field];
|
|
397
|
+
if (N != null)
|
|
398
|
+
if (s) {
|
|
399
|
+
const T = Number(f[e.value_field]);
|
|
400
|
+
r[String(N)] = (Number(r[String(N)]) || 0) + (Number.isNaN(T) ? 0 : T);
|
|
395
401
|
} else
|
|
396
|
-
r[String(
|
|
402
|
+
r[String(N)] = f[e.value_field];
|
|
397
403
|
}
|
|
398
|
-
if (!
|
|
399
|
-
|
|
404
|
+
if (!s || d.length < 1e3) break;
|
|
405
|
+
y += 1;
|
|
400
406
|
}
|
|
401
407
|
}
|
|
402
408
|
return r;
|
|
403
409
|
},
|
|
404
|
-
enabled: !!b && t !== null &&
|
|
410
|
+
enabled: !!b && t !== null && Ge.length > 0,
|
|
405
411
|
staleTime: 3e4
|
|
406
412
|
};
|
|
407
413
|
})
|
|
408
|
-
}),
|
|
409
|
-
var
|
|
414
|
+
}), ut = (e, t) => {
|
|
415
|
+
var s, m;
|
|
410
416
|
const r = (l.related_columns ?? []).findIndex((o) => o.key === e);
|
|
411
417
|
if (r !== -1)
|
|
412
|
-
return (
|
|
413
|
-
},
|
|
414
|
-
var
|
|
418
|
+
return (m = (s = Lt[r]) == null ? void 0 : s.data) == null ? void 0 : m[t];
|
|
419
|
+
}, ft = (e) => {
|
|
420
|
+
var y;
|
|
415
421
|
const t = l.qty_warning;
|
|
416
422
|
if (!t) return null;
|
|
417
|
-
const r =
|
|
423
|
+
const r = be(e) ?? 0;
|
|
418
424
|
if (r <= 0) return null;
|
|
419
|
-
const
|
|
420
|
-
if (
|
|
421
|
-
const
|
|
422
|
-
if (
|
|
423
|
-
const o =
|
|
424
|
-
return Number.isNaN(
|
|
425
|
-
},
|
|
425
|
+
const s = (l.related_columns ?? []).findIndex((d) => d.key === t.column);
|
|
426
|
+
if (s === -1) return null;
|
|
427
|
+
const m = (y = Lt[s]) == null ? void 0 : y.data;
|
|
428
|
+
if (m === void 0) return null;
|
|
429
|
+
const o = m[e], i = o == null || o === "" ? 0 : Number(o);
|
|
430
|
+
return Number.isNaN(i) ? null : r > i ? { available: i, qty: r } : null;
|
|
431
|
+
}, ar = (e) => {
|
|
426
432
|
const t = l.row_flags ?? [];
|
|
427
433
|
if (t.length === 0) return [];
|
|
428
434
|
const r = [];
|
|
429
|
-
for (const
|
|
430
|
-
if (!(!(
|
|
435
|
+
for (const s of t)
|
|
436
|
+
if (!(!(s != null && s.when) || !s.label))
|
|
431
437
|
try {
|
|
432
|
-
const
|
|
433
|
-
|
|
438
|
+
const m = s.when.replace(/\{\{\s*([A-Za-z_][A-Za-z0-9_.]*)\s*\}\}/g, "$1");
|
|
439
|
+
jr(m, e) && r.push(s.label);
|
|
434
440
|
} catch {
|
|
435
441
|
}
|
|
436
442
|
return r;
|
|
437
|
-
},
|
|
443
|
+
}, bt = l.qty_warning ? l.qty_warning.label ?? ((Dt = (l.related_columns ?? []).find((e) => {
|
|
438
444
|
var t;
|
|
439
445
|
return e.key === ((t = l.qty_warning) == null ? void 0 : t.column);
|
|
440
|
-
})) == null ? void 0 :
|
|
446
|
+
})) == null ? void 0 : Dt.label) ?? re(l.qty_warning.column) : "", ir = !!l.submission_errors, Xe = O(
|
|
441
447
|
() => {
|
|
442
448
|
var e;
|
|
443
449
|
return typeof l.submission_errors == "object" && Array.isArray((e = l.submission_errors) == null ? void 0 : e.match_fields) ? l.submission_errors.match_fields.filter((t) => /^[A-Za-z_][A-Za-z0-9_]*$/.test(t)) : [];
|
|
444
450
|
},
|
|
445
451
|
[l.submission_errors]
|
|
446
|
-
),
|
|
447
|
-
queryKey: ["erp-submissions", q ?? "", String(
|
|
448
|
-
queryFn: () =>
|
|
449
|
-
enabled:
|
|
452
|
+
), lr = Fr(6e4), { data: Et } = J({
|
|
453
|
+
queryKey: ["erp-submissions", q ?? "", String(_)],
|
|
454
|
+
queryFn: () => h.request(P(`/erp-submissions/${q}/${encodeURIComponent(_)}`)).then((e) => e.data ?? []),
|
|
455
|
+
enabled: ir && !A && !!q,
|
|
450
456
|
staleTime: 15e3,
|
|
451
|
-
refetchInterval:
|
|
452
|
-
}),
|
|
453
|
-
const e = (
|
|
454
|
-
return !e || e.status !== "failed" ? null :
|
|
455
|
-
}, [
|
|
456
|
-
queryKey: ["catalog-suberr-idents", b,
|
|
457
|
+
refetchInterval: lr
|
|
458
|
+
}), pt = O(() => {
|
|
459
|
+
const e = (Et ?? [])[0];
|
|
460
|
+
return !e || e.status !== "failed" ? null : Tr(e.payload, e.last_error);
|
|
461
|
+
}, [Et]), or = de.map((e) => e.key).join(","), { data: ht } = J({
|
|
462
|
+
queryKey: ["catalog-suberr-idents", b, Xe.join(","), or],
|
|
457
463
|
queryFn: async () => {
|
|
458
|
-
const e =
|
|
464
|
+
const e = de.map((r) => r.key);
|
|
459
465
|
if (e.length === 0) return {};
|
|
460
|
-
const t = await
|
|
461
|
-
|
|
466
|
+
const t = await h.request(
|
|
467
|
+
P(`/items/${b}`, {
|
|
462
468
|
limit: e.length,
|
|
463
|
-
fields: ["id", ...
|
|
469
|
+
fields: ["id", ...Xe].join(","),
|
|
464
470
|
filter: JSON.stringify({ id: { _in: e } })
|
|
465
471
|
})
|
|
466
472
|
).then((r) => r.data ?? []);
|
|
467
473
|
return Object.fromEntries(t.map((r) => [String(r.id), r]));
|
|
468
474
|
},
|
|
469
|
-
enabled: !!b && !!
|
|
475
|
+
enabled: !!b && !!pt && Xe.length > 0 && de.length > 0,
|
|
470
476
|
staleTime: 6e4
|
|
471
|
-
}),
|
|
472
|
-
if (!
|
|
473
|
-
const t =
|
|
474
|
-
|
|
475
|
-
...
|
|
476
|
-
const
|
|
477
|
-
return
|
|
477
|
+
}), dr = (e) => {
|
|
478
|
+
if (!pt) return null;
|
|
479
|
+
const t = ht == null ? void 0 : ht[e], r = [
|
|
480
|
+
Bt(e),
|
|
481
|
+
...Xe.map((s) => {
|
|
482
|
+
const m = (t == null ? void 0 : t[s]) ?? $e(e)[s];
|
|
483
|
+
return m != null && m !== "" ? String(m) : null;
|
|
478
484
|
})
|
|
479
|
-
].filter((
|
|
480
|
-
return
|
|
481
|
-
},
|
|
482
|
-
queries:
|
|
483
|
-
queryKey: ["catalog-summary-m2m", e.field, e.m2m.junction,
|
|
485
|
+
].filter((s) => !!s).map(Or);
|
|
486
|
+
return pt.reasonFor(r);
|
|
487
|
+
}, et = l.summary_fields ?? [], cr = ve.map((e) => String(e.id)).join(","), mr = St({
|
|
488
|
+
queries: et.filter((e) => e.m2m).map((e) => ({
|
|
489
|
+
queryKey: ["catalog-summary-m2m", e.field, e.m2m.junction, cr],
|
|
484
490
|
queryFn: async () => {
|
|
485
|
-
const t =
|
|
491
|
+
const t = ve.map((f) => String(f.id));
|
|
486
492
|
if (t.length === 0) return {};
|
|
487
|
-
const r = e.m2m,
|
|
488
|
-
|
|
493
|
+
const r = e.m2m, s = await h.request(
|
|
494
|
+
P(`/items/${r.junction}`, {
|
|
489
495
|
limit: 1e3,
|
|
490
496
|
fields: `${r.fk_to_child},${r.related_field}`,
|
|
491
497
|
filter: JSON.stringify({ [r.fk_to_child]: { _in: t } })
|
|
492
498
|
})
|
|
493
|
-
).then((
|
|
494
|
-
|
|
499
|
+
).then((f) => f.data ?? []).catch(() => []), m = [...new Set(s.map((f) => String(f[r.related_field])))], o = r.label_field ?? "name", i = m.length ? await h.request(
|
|
500
|
+
P(`/items/${r.related_collection}`, {
|
|
495
501
|
limit: 500,
|
|
496
502
|
fields: `id,${o}`,
|
|
497
|
-
filter: JSON.stringify({ id: { _in:
|
|
503
|
+
filter: JSON.stringify({ id: { _in: m } })
|
|
498
504
|
})
|
|
499
|
-
).then((
|
|
500
|
-
for (const
|
|
501
|
-
const
|
|
502
|
-
|
|
505
|
+
).then((f) => f.data ?? []).catch(() => []) : [], y = new Map(i.map((f) => [String(f.id), String(f[o] ?? f.id)])), d = {};
|
|
506
|
+
for (const f of s) {
|
|
507
|
+
const N = String(f[r.fk_to_child]), T = y.get(String(f[r.related_field]));
|
|
508
|
+
T && (d[N] = d[N] ? `${d[N]}, ${T}` : T);
|
|
503
509
|
}
|
|
504
|
-
return
|
|
510
|
+
return d;
|
|
505
511
|
},
|
|
506
|
-
enabled: !
|
|
512
|
+
enabled: !A && ve.length > 0,
|
|
507
513
|
staleTime: 15e3
|
|
508
514
|
}))
|
|
509
|
-
}),
|
|
510
|
-
var
|
|
515
|
+
}), ur = (e, t) => {
|
|
516
|
+
var m, o;
|
|
511
517
|
if (!e.m2m) return t.row[e.field];
|
|
512
|
-
const r =
|
|
518
|
+
const r = et.filter((i) => i.m2m).findIndex((i) => i.field === e.field);
|
|
513
519
|
if (r === -1) return;
|
|
514
|
-
const
|
|
515
|
-
if (
|
|
516
|
-
return (o = (
|
|
517
|
-
},
|
|
518
|
-
if (!
|
|
519
|
-
const t = Number(e[l.fulfilment.qty_field ??
|
|
520
|
+
const s = t.row.id;
|
|
521
|
+
if (s != null)
|
|
522
|
+
return (o = (m = mr[r]) == null ? void 0 : m.data) == null ? void 0 : o[String(s)];
|
|
523
|
+
}, fr = !!((Ut = l.fulfilment) != null && Ut.shipped_field) && (l.fulfilment.show_when ? Yt(l.fulfilment.show_when, ee) : !0), br = (e) => {
|
|
524
|
+
if (!fr || !l.fulfilment) return null;
|
|
525
|
+
const t = Number(e[l.fulfilment.qty_field ?? V] ?? 0) || 0, r = Number(e[l.fulfilment.shipped_field] ?? 0) || 0, s = t > 0 && r >= t ? {
|
|
520
526
|
dot: "bg-emerald-500",
|
|
521
527
|
text: "text-emerald-700 dark:text-emerald-400",
|
|
522
528
|
label: "Shipped"
|
|
@@ -533,15 +539,15 @@ function en({
|
|
|
533
539
|
"span",
|
|
534
540
|
{
|
|
535
541
|
className: "inline-flex items-center gap-1.5 whitespace-nowrap",
|
|
536
|
-
"data-catalog-fulfilment":
|
|
542
|
+
"data-catalog-fulfilment": s.label.split(" ")[0].toLowerCase(),
|
|
537
543
|
title: `${l.fulfilment.label ?? "Warehouse"} · ${r} of ${t} shipped`,
|
|
538
544
|
children: [
|
|
539
|
-
/* @__PURE__ */ n("span", { "aria-hidden": !0, className: `h-1.5 w-1.5 rounded-full ${
|
|
540
|
-
/* @__PURE__ */ n("span", { className: `text-[11px] font-medium ${
|
|
545
|
+
/* @__PURE__ */ n("span", { "aria-hidden": !0, className: `h-1.5 w-1.5 rounded-full ${s.dot}` }),
|
|
546
|
+
/* @__PURE__ */ n("span", { className: `text-[11px] font-medium ${s.text}`, children: s.label })
|
|
541
547
|
]
|
|
542
548
|
}
|
|
543
549
|
);
|
|
544
|
-
},
|
|
550
|
+
}, At = l.columns ?? [], Ct = l.related_columns ?? [], xt = At.filter((e) => !e.summary_only), gt = Ct.filter((e) => !e.summary_only), Kt = At.filter((e) => !e.sections_only), Jt = Ct.filter((e) => !e.sections_only), Qt = xt.length > 0 || gt.length > 0, yt = ze(null), zt = (e) => {
|
|
545
551
|
let t = e.parentElement;
|
|
546
552
|
for (; t; ) {
|
|
547
553
|
const r = getComputedStyle(t);
|
|
@@ -551,14 +557,14 @@ function en({
|
|
|
551
557
|
}
|
|
552
558
|
t = t.parentElement;
|
|
553
559
|
}
|
|
554
|
-
},
|
|
555
|
-
|
|
560
|
+
}, pr = (e) => {
|
|
561
|
+
yt.current = e, e && zt(e);
|
|
556
562
|
};
|
|
557
|
-
|
|
563
|
+
je(() => {
|
|
558
564
|
let e = 0;
|
|
559
565
|
const t = () => {
|
|
560
566
|
e || (e = requestAnimationFrame(() => {
|
|
561
|
-
e = 0,
|
|
567
|
+
e = 0, yt.current && zt(yt.current);
|
|
562
568
|
}));
|
|
563
569
|
};
|
|
564
570
|
return window.addEventListener("scroll", t, !0), () => {
|
|
@@ -567,74 +573,74 @@ function en({
|
|
|
567
573
|
}, []);
|
|
568
574
|
const Le = (e, t) => {
|
|
569
575
|
let r = e;
|
|
570
|
-
for (const
|
|
576
|
+
for (const s of t.split(".")) {
|
|
571
577
|
if (r == null || typeof r != "object") return;
|
|
572
|
-
r = r[
|
|
578
|
+
r = r[s];
|
|
573
579
|
}
|
|
574
580
|
return r;
|
|
575
|
-
},
|
|
581
|
+
}, fe = (e, t) => {
|
|
576
582
|
if (t === "presence")
|
|
577
583
|
return e == null || e === "" || Number(e) === 0 ? "No" : "Yes";
|
|
578
584
|
if (e == null || e === "") return "—";
|
|
579
585
|
const r = Number(e);
|
|
580
586
|
return t === "currency" ? Number.isNaN(r) ? String(e) : r.toLocaleString(void 0, { style: "currency", currency: "USD" }) : t === "number" ? Number.isNaN(r) ? String(e) : r.toLocaleString(void 0, { maximumFractionDigits: 2 }) : String(e);
|
|
581
|
-
},
|
|
582
|
-
|
|
587
|
+
}, kt = (e, t) => /* @__PURE__ */ c(_t, { children: [
|
|
588
|
+
xt.map((r) => /* @__PURE__ */ n(
|
|
583
589
|
"span",
|
|
584
590
|
{
|
|
585
|
-
className:
|
|
591
|
+
className: z(
|
|
586
592
|
"truncate text-slate-500 dark:text-slate-400",
|
|
587
593
|
r.format ? "w-20 shrink-0 text-right" : "min-w-0 flex-1"
|
|
588
594
|
),
|
|
589
|
-
children:
|
|
595
|
+
children: fe(Le(t, r.field), r.format)
|
|
590
596
|
},
|
|
591
597
|
r.field
|
|
592
598
|
)),
|
|
593
|
-
|
|
599
|
+
gt.map((r) => /* @__PURE__ */ n(
|
|
594
600
|
"span",
|
|
595
601
|
{
|
|
596
602
|
className: "w-20 shrink-0 truncate text-right text-slate-500 dark:text-slate-400",
|
|
597
|
-
children:
|
|
603
|
+
children: fe(ut(r.key, e), r.format)
|
|
598
604
|
},
|
|
599
605
|
r.key
|
|
600
606
|
))
|
|
601
|
-
] }),
|
|
607
|
+
] }), wt = Qt ? "w-36 shrink-0 truncate text-slate-700 dark:text-slate-200" : "min-w-0 flex-1 truncate text-slate-700 dark:text-slate-200", hr = Zt(b), tt = (e, t, r) => hr ? /* @__PURE__ */ n(
|
|
602
608
|
"button",
|
|
603
609
|
{
|
|
604
610
|
type: "button",
|
|
605
|
-
onClick: () => b &&
|
|
611
|
+
onClick: () => b && Gt(b, e, ee),
|
|
606
612
|
title: "View stock & planning detail",
|
|
607
|
-
className:
|
|
613
|
+
className: z(
|
|
608
614
|
r,
|
|
609
615
|
"text-left underline decoration-slate-300 decoration-1 underline-offset-2 hover:text-[#009abe] hover:decoration-[#009abe] dark:decoration-slate-600"
|
|
610
616
|
),
|
|
611
617
|
children: t
|
|
612
618
|
}
|
|
613
|
-
) : /* @__PURE__ */ n("span", { className: r, children: t }),
|
|
614
|
-
const t =
|
|
615
|
-
return t ?
|
|
616
|
-
},
|
|
617
|
-
var
|
|
618
|
-
const t =
|
|
619
|
-
if (t) return
|
|
620
|
-
const r =
|
|
621
|
-
return r === void 0 ? null : Number(((
|
|
622
|
-
},
|
|
619
|
+
) : /* @__PURE__ */ n("span", { className: r, children: t }), Bt = (e) => {
|
|
620
|
+
const t = Ue.get(e) ?? Ft.find((r) => String(r.id) === e) ?? Re.find((r) => String(r.id) === e);
|
|
621
|
+
return t ? Fe(H, t) : `#${e}`;
|
|
622
|
+
}, $e = (e) => Ue.get(e) ?? Ft.find((t) => String(t.id) === e) ?? Re.find((t) => String(t.id) === e) ?? { id: e }, be = (e) => {
|
|
623
|
+
var s;
|
|
624
|
+
const t = A ? void 0 : Ie.get(e);
|
|
625
|
+
if (t) return We.has(String(t.id)) ? null : Number(t[V] ?? 0);
|
|
626
|
+
const r = lt.get(e);
|
|
627
|
+
return r === void 0 ? null : Number(((s = Se[r]) == null ? void 0 : s[V]) ?? 0);
|
|
628
|
+
}, xr = (e) => {
|
|
623
629
|
let t = e;
|
|
624
630
|
for (const r of l.section_by.split(".")) {
|
|
625
631
|
if (t == null || typeof t != "object") return "";
|
|
626
632
|
t = t[r];
|
|
627
633
|
}
|
|
628
634
|
return String(t ?? "").trim();
|
|
629
|
-
},
|
|
630
|
-
if (
|
|
631
|
-
|
|
635
|
+
}, rt = O(() => {
|
|
636
|
+
if (De) return [];
|
|
637
|
+
C.trim().toLowerCase();
|
|
632
638
|
const e = /* @__PURE__ */ new Map();
|
|
633
|
-
for (const t of
|
|
634
|
-
const r =
|
|
635
|
-
if (!(
|
|
636
|
-
for (const
|
|
637
|
-
const o =
|
|
639
|
+
for (const t of E) {
|
|
640
|
+
const r = Fe(H, t), s = R ? jt.get(String(t.id)) ?? [] : [xr(t)];
|
|
641
|
+
if (!(R && ae && s.length === 0))
|
|
642
|
+
for (const m of s.length ? s : [""]) {
|
|
643
|
+
const o = m || "Uncategorized";
|
|
638
644
|
e.has(o) || e.set(o, []), e.get(o).push({ id: String(t.id), label: r, row: t });
|
|
639
645
|
}
|
|
640
646
|
}
|
|
@@ -642,318 +648,398 @@ function en({
|
|
|
642
648
|
([t], [r]) => t === "Uncategorized" ? 1 : r === "Uncategorized" ? -1 : t.localeCompare(r)
|
|
643
649
|
).map(([t, r]) => ({
|
|
644
650
|
name: t,
|
|
645
|
-
items: r.sort((
|
|
651
|
+
items: r.sort((s, m) => s.label.localeCompare(m.label))
|
|
646
652
|
}));
|
|
647
653
|
}, [
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
654
|
+
E,
|
|
655
|
+
H,
|
|
656
|
+
C,
|
|
651
657
|
l.section_by,
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
658
|
+
R,
|
|
659
|
+
jt,
|
|
660
|
+
De,
|
|
661
|
+
ae
|
|
656
662
|
]);
|
|
657
|
-
if (!
|
|
658
|
-
|
|
663
|
+
if (!ye.current && rt.length > 0) {
|
|
664
|
+
ye.current = !0;
|
|
659
665
|
const e = /* @__PURE__ */ new Set();
|
|
660
|
-
for (const t of
|
|
661
|
-
t.items.some((
|
|
666
|
+
for (const t of rt)
|
|
667
|
+
t.items.some((s) => (be(s.id) ?? 0) > 0) || e.add(t.name);
|
|
662
668
|
ne(e);
|
|
663
669
|
}
|
|
664
|
-
async function
|
|
670
|
+
async function gr(e) {
|
|
665
671
|
const t = {};
|
|
666
672
|
for (const r of l.related_columns ?? []) {
|
|
667
673
|
if (!r.copy_to) continue;
|
|
668
|
-
let
|
|
669
|
-
if (
|
|
670
|
-
const
|
|
671
|
-
if (
|
|
672
|
-
|
|
673
|
-
|
|
674
|
+
let s = ut(r.key, e);
|
|
675
|
+
if (s === void 0) {
|
|
676
|
+
const m = Be(r.match, ee);
|
|
677
|
+
if (m === null) continue;
|
|
678
|
+
s = await h.request(
|
|
679
|
+
P(`/items/${r.collection}`, {
|
|
674
680
|
limit: 1,
|
|
675
681
|
fields: `${r.item_field},${r.value_field}`,
|
|
676
|
-
filter: JSON.stringify({ ...
|
|
682
|
+
filter: JSON.stringify({ ...m, [r.item_field]: { _eq: e } })
|
|
677
683
|
})
|
|
678
684
|
).then((o) => {
|
|
679
|
-
var
|
|
680
|
-
return (
|
|
685
|
+
var i, y;
|
|
686
|
+
return (y = (i = o.data) == null ? void 0 : i[0]) == null ? void 0 : y[r.value_field];
|
|
681
687
|
}).catch(() => {
|
|
682
688
|
});
|
|
683
689
|
}
|
|
684
|
-
|
|
690
|
+
s != null && (t[r.copy_to] = s);
|
|
685
691
|
}
|
|
686
692
|
return t;
|
|
687
693
|
}
|
|
688
|
-
function
|
|
689
|
-
const
|
|
694
|
+
function Ee(e, t, r, s = {}) {
|
|
695
|
+
const m = {
|
|
690
696
|
[l.item_field]: r.id ?? e,
|
|
691
|
-
[
|
|
697
|
+
[V]: t
|
|
692
698
|
};
|
|
693
|
-
for (const [o,
|
|
694
|
-
r[
|
|
695
|
-
Object.assign(
|
|
696
|
-
for (const [o,
|
|
697
|
-
const
|
|
698
|
-
|
|
699
|
+
for (const [o, i] of Object.entries(l.copy_fields ?? {}))
|
|
700
|
+
r[i] !== void 0 && (m[o] = r[i]);
|
|
701
|
+
Object.assign(m, s);
|
|
702
|
+
for (const [o, i] of Object.entries(l.compute_fields ?? {})) {
|
|
703
|
+
const y = Ke(i, m);
|
|
704
|
+
y !== null && (m[o] = y);
|
|
699
705
|
}
|
|
700
|
-
return
|
|
706
|
+
return m;
|
|
701
707
|
}
|
|
702
|
-
async function
|
|
703
|
-
const
|
|
704
|
-
if (
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
708
|
+
async function nt(e, t, r, s = {}) {
|
|
709
|
+
const m = Kr(t, { type: X, min: 0, label: "Quantity" });
|
|
710
|
+
if (!m.ok) {
|
|
711
|
+
j((d) => ({ ...d, [e]: { kind: "error", message: m.message } }));
|
|
712
|
+
return;
|
|
713
|
+
}
|
|
714
|
+
const o = m.value ?? 0;
|
|
715
|
+
if ((be(e) ?? 0) === o) return;
|
|
716
|
+
if (o === 0 && !s.confirmedRemove) {
|
|
717
|
+
j((d) => ({ ...d, [e]: { kind: "remove", row: r } }));
|
|
718
|
+
return;
|
|
719
|
+
}
|
|
720
|
+
const y = o > 0 ? await gr(e) : {};
|
|
721
|
+
if (Pe && p) {
|
|
722
|
+
const d = Ie.get(e);
|
|
723
|
+
if ((d == null ? void 0 : d.id) != null) {
|
|
724
|
+
const f = String(d.id);
|
|
725
|
+
if (o === 0) {
|
|
726
|
+
p.cancelPendingEdit(u, g, f), p.queueDelete(u, g, f);
|
|
712
727
|
return;
|
|
713
728
|
}
|
|
714
|
-
|
|
715
|
-
const N =
|
|
716
|
-
for (const
|
|
717
|
-
|
|
718
|
-
for (const [
|
|
719
|
-
const
|
|
720
|
-
|
|
729
|
+
We.has(f) && p.cancelPendingDelete(u, g, f);
|
|
730
|
+
const N = Ee(e, o, r, y);
|
|
731
|
+
for (const S of B)
|
|
732
|
+
d[S] != null && d[S] !== "" && (N[S] = d[S]);
|
|
733
|
+
for (const [S, le] of Object.entries(l.compute_fields ?? {})) {
|
|
734
|
+
const _e = Ke(le, { ...d, ...N });
|
|
735
|
+
_e !== null && (N[S] = _e);
|
|
721
736
|
}
|
|
722
|
-
const
|
|
723
|
-
Object.entries(N).filter(([
|
|
737
|
+
const T = ve.find((S) => String(S.id) === f) ?? {}, k = Object.fromEntries(
|
|
738
|
+
Object.entries(N).filter(([S, le]) => String(le ?? "") !== String(T[S] ?? ""))
|
|
724
739
|
);
|
|
725
|
-
Object.keys(
|
|
740
|
+
Object.keys(k).length === 0 ? p.cancelPendingEdit(u, g, f) : (p.cancelPendingEdit(u, g, f), p.queueEdit(u, g, f, k));
|
|
726
741
|
return;
|
|
727
742
|
}
|
|
728
743
|
}
|
|
729
|
-
if (
|
|
730
|
-
const
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
744
|
+
if (A || Pe) {
|
|
745
|
+
const d = lt.get(e);
|
|
746
|
+
o === 0 ? d !== void 0 && (p == null || p.removeRow(u, g, d)) : d !== void 0 ? p == null || p.updateRow(
|
|
747
|
+
u,
|
|
748
|
+
g,
|
|
749
|
+
d,
|
|
750
|
+
Jr(
|
|
751
|
+
Se[d],
|
|
752
|
+
Ee(e, o, r, y),
|
|
753
|
+
B,
|
|
754
|
+
l.compute_fields
|
|
755
|
+
)
|
|
756
|
+
) : p == null || p.queueRow(
|
|
757
|
+
u,
|
|
758
|
+
g,
|
|
759
|
+
Ee(e, o, r, y)
|
|
738
760
|
);
|
|
739
761
|
return;
|
|
740
762
|
}
|
|
741
|
-
|
|
763
|
+
v((d) => new Set(d).add(e));
|
|
742
764
|
try {
|
|
743
|
-
const
|
|
744
|
-
if (
|
|
745
|
-
(
|
|
746
|
-
else if ((
|
|
747
|
-
const
|
|
748
|
-
for (const
|
|
749
|
-
|
|
750
|
-
for (const [
|
|
751
|
-
const
|
|
752
|
-
|
|
765
|
+
const d = Ie.get(e);
|
|
766
|
+
if (o === 0)
|
|
767
|
+
(d == null ? void 0 : d.id) != null && await h.request($r(`/items/${u}/${d.id}`));
|
|
768
|
+
else if ((d == null ? void 0 : d.id) != null) {
|
|
769
|
+
const f = Ee(e, o, r, y);
|
|
770
|
+
for (const S of B)
|
|
771
|
+
d[S] != null && d[S] !== "" && (f[S] = d[S]);
|
|
772
|
+
for (const [S, le] of Object.entries(l.compute_fields ?? {})) {
|
|
773
|
+
const _e = Ke(le, { ...d, ...f });
|
|
774
|
+
_e !== null && (f[S] = _e);
|
|
753
775
|
}
|
|
754
|
-
const N = { ...
|
|
755
|
-
await
|
|
776
|
+
const N = { ...d, ...f }, { id: T, ...k } = N;
|
|
777
|
+
await h.request(Wt(`/items/${u}/${d.id}`, k));
|
|
756
778
|
} else
|
|
757
|
-
await
|
|
758
|
-
|
|
759
|
-
[
|
|
760
|
-
...
|
|
779
|
+
await h.request(
|
|
780
|
+
It(`/items/${u}`, {
|
|
781
|
+
[g]: _,
|
|
782
|
+
...Ee(e, o, r, y)
|
|
761
783
|
})
|
|
762
784
|
);
|
|
763
|
-
$.invalidateQueries({ queryKey: ["o2m-rows",
|
|
785
|
+
$.invalidateQueries({ queryKey: ["o2m-rows", u, g, _] });
|
|
764
786
|
} catch {
|
|
765
787
|
} finally {
|
|
766
|
-
|
|
767
|
-
const
|
|
768
|
-
return
|
|
788
|
+
v((d) => {
|
|
789
|
+
const f = new Set(d);
|
|
790
|
+
return f.delete(e), f;
|
|
769
791
|
});
|
|
770
792
|
}
|
|
771
793
|
}
|
|
772
|
-
async function
|
|
773
|
-
const
|
|
774
|
-
if (r.trim() !== "" && Number.isNaN(
|
|
775
|
-
const
|
|
776
|
-
const
|
|
777
|
-
for (const [
|
|
778
|
-
const
|
|
779
|
-
|
|
794
|
+
async function yr(e, t, r) {
|
|
795
|
+
const s = r.trim() === "" ? null : Number(r);
|
|
796
|
+
if (r.trim() !== "" && Number.isNaN(s)) return;
|
|
797
|
+
const m = (i) => {
|
|
798
|
+
const y = { ...i, [t]: s };
|
|
799
|
+
for (const [d, f] of Object.entries(l.compute_fields ?? {})) {
|
|
800
|
+
const N = Ke(f, y);
|
|
801
|
+
N !== null && (y[d] = N);
|
|
780
802
|
}
|
|
781
|
-
return
|
|
782
|
-
}, o =
|
|
803
|
+
return y;
|
|
804
|
+
}, o = A ? void 0 : Ie.get(e);
|
|
783
805
|
if ((o == null ? void 0 : o.id) == null) {
|
|
784
|
-
const
|
|
785
|
-
if (
|
|
786
|
-
|
|
806
|
+
const i = lt.get(e);
|
|
807
|
+
if (i === void 0) return;
|
|
808
|
+
p == null || p.updateRow(u, g, i, m(Se[i]));
|
|
787
809
|
return;
|
|
788
810
|
}
|
|
789
|
-
if (
|
|
790
|
-
const
|
|
791
|
-
Object.entries(
|
|
792
|
-
([
|
|
811
|
+
if (Pe && p) {
|
|
812
|
+
const i = m(o), y = ve.find((f) => String(f.id) === String(o.id)) ?? {}, d = Object.fromEntries(
|
|
813
|
+
Object.entries(i).filter(
|
|
814
|
+
([f, N]) => f !== "id" && String(N ?? "") !== String(y[f] ?? "")
|
|
793
815
|
)
|
|
794
816
|
);
|
|
795
|
-
|
|
817
|
+
p.cancelPendingEdit(u, g, String(o.id)), Object.keys(d).length > 0 && p.queueEdit(u, g, String(o.id), d);
|
|
796
818
|
return;
|
|
797
819
|
}
|
|
798
|
-
|
|
820
|
+
v((i) => new Set(i).add(e));
|
|
799
821
|
try {
|
|
800
|
-
const { id:
|
|
801
|
-
await
|
|
822
|
+
const { id: i, ...y } = m(o);
|
|
823
|
+
await h.request(Wt(`/items/${u}/${o.id}`, y)), $.invalidateQueries({ queryKey: ["o2m-rows", u, g, _] });
|
|
802
824
|
} catch {
|
|
803
825
|
} finally {
|
|
804
|
-
|
|
805
|
-
const
|
|
806
|
-
return
|
|
826
|
+
v((i) => {
|
|
827
|
+
const y = new Set(i);
|
|
828
|
+
return y.delete(e), y;
|
|
807
829
|
});
|
|
808
830
|
}
|
|
809
831
|
}
|
|
810
|
-
async function
|
|
832
|
+
async function kr(e) {
|
|
811
833
|
if (e == null || e === "" || !b) return;
|
|
812
|
-
const t = String(e), r =
|
|
813
|
-
let
|
|
814
|
-
Object.keys(r).length <= 1 && (
|
|
815
|
-
|
|
834
|
+
const t = String(e), r = $e(t);
|
|
835
|
+
let s = r;
|
|
836
|
+
Object.keys(r).length <= 1 && (s = await h.request(
|
|
837
|
+
P(`/items/${b}`, {
|
|
816
838
|
filter: JSON.stringify({ id: { _eq: e } }),
|
|
817
|
-
fields:
|
|
839
|
+
fields: a,
|
|
818
840
|
limit: 1
|
|
819
841
|
})
|
|
820
842
|
).then((o) => {
|
|
821
|
-
var
|
|
822
|
-
return ((
|
|
843
|
+
var i;
|
|
844
|
+
return ((i = o.data) == null ? void 0 : i[0]) ?? { id: e };
|
|
823
845
|
}).catch(() => ({ id: e })));
|
|
824
|
-
const
|
|
825
|
-
await
|
|
846
|
+
const m = (be(t) ?? 0) + 1;
|
|
847
|
+
await nt(t, String(m), s);
|
|
826
848
|
}
|
|
827
|
-
const
|
|
828
|
-
const r =
|
|
829
|
-
if (
|
|
849
|
+
const wr = de.length, Nt = Object.keys(l.copy_fields ?? {}), vt = Object.keys(l.compute_fields ?? {}), Ae = (e, t) => {
|
|
850
|
+
const r = be(e);
|
|
851
|
+
if (x)
|
|
830
852
|
return /* @__PURE__ */ n("span", { className: "inline-block w-20 shrink-0 text-right tabular-nums text-slate-700 dark:text-slate-200", children: r && r > 0 ? r : "—" });
|
|
831
|
-
const
|
|
832
|
-
|
|
853
|
+
const s = pe[e], m = s !== void 0 ? s : r && r > 0 ? String(r) : "", o = F[e], i = () => j((d) => {
|
|
854
|
+
if (!(e in d)) return d;
|
|
855
|
+
const f = { ...d };
|
|
856
|
+
return delete f[e], f;
|
|
857
|
+
}), y = /* @__PURE__ */ n(
|
|
833
858
|
"input",
|
|
834
859
|
{
|
|
835
860
|
type: "number",
|
|
836
861
|
min: 0,
|
|
837
|
-
|
|
838
|
-
|
|
862
|
+
step: Cr(X) ? 1 : "any",
|
|
863
|
+
disabled: x,
|
|
864
|
+
value: m,
|
|
839
865
|
placeholder: "0",
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
866
|
+
"aria-invalid": (o == null ? void 0 : o.kind) === "error" || void 0,
|
|
867
|
+
onFocus: i,
|
|
868
|
+
onChange: (d) => G((f) => ({ ...f, [e]: d.target.value })),
|
|
869
|
+
onBlur: (d) => {
|
|
870
|
+
const f = d.target.value;
|
|
871
|
+
G((N) => {
|
|
872
|
+
const T = { ...N };
|
|
873
|
+
return delete T[e], T;
|
|
874
|
+
}), nt(e, f, t);
|
|
847
875
|
},
|
|
848
|
-
onKeyDown: (
|
|
849
|
-
|
|
876
|
+
onKeyDown: (d) => {
|
|
877
|
+
d.key === "Enter" && d.currentTarget.blur();
|
|
850
878
|
},
|
|
851
|
-
className:
|
|
879
|
+
className: z(
|
|
880
|
+
"h-7 w-20 shrink-0 rounded border border-slate-200 bg-white px-2 text-right text-[12px] outline-none focus:border-nvr-cyan disabled:opacity-50 dark:border-border dark:bg-background",
|
|
881
|
+
(o == null ? void 0 : o.kind) === "error" && "border-red-400 dark:border-red-600"
|
|
882
|
+
)
|
|
852
883
|
}
|
|
853
884
|
);
|
|
885
|
+
return /* @__PURE__ */ c(Lr, { open: !!o, onOpenChange: (d) => !d && i(), children: [
|
|
886
|
+
/* @__PURE__ */ n(Er, { asChild: !0, children: y }),
|
|
887
|
+
/* @__PURE__ */ c(
|
|
888
|
+
Ar,
|
|
889
|
+
{
|
|
890
|
+
align: "end",
|
|
891
|
+
side: "bottom",
|
|
892
|
+
className: "w-auto max-w-[260px] p-2.5 text-[12px]",
|
|
893
|
+
onOpenAutoFocus: (d) => {
|
|
894
|
+
(o == null ? void 0 : o.kind) === "error" && d.preventDefault();
|
|
895
|
+
},
|
|
896
|
+
children: [
|
|
897
|
+
(o == null ? void 0 : o.kind) === "error" && /* @__PURE__ */ c(
|
|
898
|
+
"p",
|
|
899
|
+
{
|
|
900
|
+
role: "alert",
|
|
901
|
+
className: "flex items-start gap-1.5 text-red-600 dark:text-red-400",
|
|
902
|
+
"data-catalog-qty-error": !0,
|
|
903
|
+
children: [
|
|
904
|
+
/* @__PURE__ */ n(Mt, { className: "mt-px h-3.5 w-3.5 shrink-0" }),
|
|
905
|
+
o.message,
|
|
906
|
+
r && r > 0 ? ` — still ${r}` : ""
|
|
907
|
+
]
|
|
908
|
+
}
|
|
909
|
+
),
|
|
910
|
+
(o == null ? void 0 : o.kind) === "remove" && /* @__PURE__ */ c("div", { "data-catalog-qty-remove": !0, children: [
|
|
911
|
+
/* @__PURE__ */ n("p", { className: "text-slate-700 dark:text-slate-200", children: "Remove this line?" }),
|
|
912
|
+
/* @__PURE__ */ c("div", { className: "mt-2 flex justify-end gap-1.5", children: [
|
|
913
|
+
/* @__PURE__ */ n(
|
|
914
|
+
"button",
|
|
915
|
+
{
|
|
916
|
+
type: "button",
|
|
917
|
+
onClick: i,
|
|
918
|
+
className: "h-6 rounded border border-slate-200 px-2 text-[11px] text-slate-600 hover:bg-muted dark:border-border dark:text-slate-300",
|
|
919
|
+
children: "Keep"
|
|
920
|
+
}
|
|
921
|
+
),
|
|
922
|
+
/* @__PURE__ */ n(
|
|
923
|
+
"button",
|
|
924
|
+
{
|
|
925
|
+
type: "button",
|
|
926
|
+
onClick: () => {
|
|
927
|
+
const d = o.row;
|
|
928
|
+
i(), nt(e, "0", d, { confirmedRemove: !0 });
|
|
929
|
+
},
|
|
930
|
+
className: "h-6 rounded bg-red-600 px-2 text-[11px] font-medium text-white hover:bg-red-700",
|
|
931
|
+
children: "Remove"
|
|
932
|
+
}
|
|
933
|
+
)
|
|
934
|
+
] })
|
|
935
|
+
] })
|
|
936
|
+
]
|
|
937
|
+
}
|
|
938
|
+
)
|
|
939
|
+
] });
|
|
854
940
|
};
|
|
855
|
-
return !b &&
|
|
941
|
+
return !b && K ? /* @__PURE__ */ c("div", { className: "space-y-2 py-1", "aria-busy": "true", children: [
|
|
856
942
|
/* @__PURE__ */ n("div", { className: "h-8 w-full animate-pulse rounded bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" }),
|
|
857
943
|
/* @__PURE__ */ n("div", { className: "h-8 w-2/3 animate-pulse rounded bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" })
|
|
858
944
|
] }) : b ? /* @__PURE__ */ c("div", { className: "space-y-3", children: [
|
|
859
|
-
!
|
|
945
|
+
!x && /* @__PURE__ */ c(_t, { children: [
|
|
860
946
|
/* @__PURE__ */ c("div", { className: "rounded-lg border border-slate-200 text-[12px] dark:border-border", children: [
|
|
861
947
|
/* @__PURE__ */ c("div", { className: "flex items-center gap-2 border-b border-slate-200 px-3 py-2 dark:border-border", children: [
|
|
862
|
-
/* @__PURE__ */ n(
|
|
948
|
+
/* @__PURE__ */ n(st, { className: "h-3.5 w-3.5 shrink-0 text-slate-400" }),
|
|
863
949
|
/* @__PURE__ */ n(
|
|
864
950
|
"input",
|
|
865
951
|
{
|
|
866
|
-
value:
|
|
867
|
-
onChange: (e) =>
|
|
952
|
+
value: C,
|
|
953
|
+
onChange: (e) => ke(e.target.value),
|
|
868
954
|
placeholder: "Search catalog…",
|
|
869
955
|
className: "w-full bg-transparent text-[12px] outline-none placeholder:text-slate-400"
|
|
870
956
|
}
|
|
871
957
|
),
|
|
872
958
|
/* @__PURE__ */ c("span", { className: "shrink-0 rounded border border-slate-200 bg-slate-50 px-1.5 py-0.5 text-[10px] font-medium text-slate-500 dark:border-border dark:bg-muted dark:text-slate-400", children: [
|
|
873
|
-
|
|
959
|
+
wr,
|
|
874
960
|
" picked"
|
|
875
961
|
] })
|
|
876
962
|
] }),
|
|
877
|
-
|
|
963
|
+
Qt && // Sticky: the catalog list is tall and the page scroller carries it —
|
|
878
964
|
// without this the labels scroll away and favorites/section rows
|
|
879
965
|
// read as headerless columns. Opaque bg (not the /60 tint) so rows
|
|
880
966
|
// never bleed through while pinned.
|
|
881
967
|
/* @__PURE__ */ c(
|
|
882
968
|
"div",
|
|
883
969
|
{
|
|
884
|
-
ref:
|
|
970
|
+
ref: pr,
|
|
885
971
|
className: "sticky top-0 z-[5] flex items-center gap-2 border-b border-slate-200 bg-slate-50 px-3 py-1 text-[10px] font-medium uppercase tracking-wide text-slate-400 dark:border-border dark:bg-muted",
|
|
886
972
|
children: [
|
|
887
973
|
l.favorites && /* @__PURE__ */ n("span", { className: "w-[18px] shrink-0" }),
|
|
888
974
|
/* @__PURE__ */ n("span", { className: "w-36 shrink-0", children: "Item" }),
|
|
889
|
-
|
|
975
|
+
xt.map((e) => /* @__PURE__ */ n(
|
|
890
976
|
"span",
|
|
891
977
|
{
|
|
892
978
|
className: e.format ? "w-20 shrink-0 text-right" : "min-w-0 flex-1",
|
|
893
|
-
children: e.label ??
|
|
979
|
+
children: e.label ?? re(e.field.split(".")[0])
|
|
894
980
|
},
|
|
895
981
|
e.field
|
|
896
982
|
)),
|
|
897
|
-
|
|
983
|
+
gt.map((e) => /* @__PURE__ */ n("span", { className: "w-20 shrink-0 text-right", children: e.label ?? re(e.key) }, e.key)),
|
|
898
984
|
/* @__PURE__ */ n("span", { className: "w-20 shrink-0 text-right", children: "Qty" })
|
|
899
985
|
]
|
|
900
986
|
}
|
|
901
987
|
),
|
|
902
|
-
|
|
903
|
-
/* @__PURE__ */ n(
|
|
988
|
+
C.trim().length > 0 && qe.length === 0 && mt && /* @__PURE__ */ c("div", { className: "flex items-center justify-center gap-2 border-b border-slate-100 px-3 py-3 text-slate-400 dark:border-border/50", children: [
|
|
989
|
+
/* @__PURE__ */ n(oe, { className: "h-3.5 w-3.5 animate-spin" }),
|
|
904
990
|
" Searching the catalog…"
|
|
905
991
|
] }),
|
|
906
|
-
|
|
992
|
+
C.trim().length > 0 && qe.length === 0 && !mt && /* @__PURE__ */ c("p", { className: "px-3 py-4 text-center text-slate-400", children: [
|
|
907
993
|
'No CIFAs match "',
|
|
908
|
-
|
|
994
|
+
C.trim(),
|
|
909
995
|
'"'
|
|
910
996
|
] }),
|
|
911
|
-
|
|
997
|
+
C.trim().length > 0 && qe.length > 0 && /* @__PURE__ */ c(Ce, { children: [
|
|
912
998
|
/* @__PURE__ */ c("div", { className: "flex w-full items-center gap-1.5 border-b border-t border-slate-200 bg-sky-50/70 px-2 py-1.5 dark:border-border dark:bg-sky-900/10", children: [
|
|
913
|
-
/* @__PURE__ */ n(
|
|
999
|
+
/* @__PURE__ */ n(st, { className: "h-3 w-3 shrink-0 text-sky-500" }),
|
|
914
1000
|
/* @__PURE__ */ n("span", { className: "text-[11px] font-semibold text-slate-600 dark:text-slate-300", children: "Search results" }),
|
|
915
|
-
/* @__PURE__ */ n("span", { className: "rounded border border-slate-200 bg-white px-1.5 py-0.5 text-[10px] font-medium text-slate-500 dark:border-border dark:bg-background dark:text-slate-400", children:
|
|
1001
|
+
/* @__PURE__ */ n("span", { className: "rounded border border-slate-200 bg-white px-1.5 py-0.5 text-[10px] font-medium text-slate-500 dark:border-border dark:bg-background dark:text-slate-400", children: qe.length }),
|
|
916
1002
|
/* @__PURE__ */ n("span", { className: "text-[10px] text-slate-400", children: "across the entire catalog — enter a quantity to add" }),
|
|
917
|
-
|
|
1003
|
+
mt && /* @__PURE__ */ n(oe, { className: "h-3 w-3 shrink-0 animate-spin text-slate-400" })
|
|
918
1004
|
] }),
|
|
919
|
-
|
|
920
|
-
const r = String(e.id),
|
|
1005
|
+
qe.map((e, t) => {
|
|
1006
|
+
const r = String(e.id), s = be(r);
|
|
921
1007
|
return /* @__PURE__ */ c(
|
|
922
1008
|
"div",
|
|
923
1009
|
{
|
|
924
|
-
className:
|
|
1010
|
+
className: z(
|
|
925
1011
|
"flex items-center gap-2 border-b border-slate-100 px-3 py-1 dark:border-border/50",
|
|
926
1012
|
t % 2 === 0 ? "bg-white dark:bg-background" : "bg-slate-50/50 dark:bg-muted/30",
|
|
927
|
-
(
|
|
1013
|
+
(s ?? 0) > 0 && "bg-nvr-cyan/5"
|
|
928
1014
|
),
|
|
929
1015
|
children: [
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
se.has(r) && /* @__PURE__ */ n(
|
|
934
|
-
|
|
1016
|
+
dt(r),
|
|
1017
|
+
tt(r, Fe(H, e), wt),
|
|
1018
|
+
kt(r, e),
|
|
1019
|
+
se.has(r) && /* @__PURE__ */ n(oe, { className: "h-3 w-3 shrink-0 animate-spin text-slate-400" }),
|
|
1020
|
+
Ae(r, e)
|
|
935
1021
|
]
|
|
936
1022
|
},
|
|
937
1023
|
r
|
|
938
1024
|
);
|
|
939
1025
|
})
|
|
940
1026
|
] }),
|
|
941
|
-
|
|
1027
|
+
xe.length > 0 && !C.trim() && /* @__PURE__ */ c("p", { className: "px-3 py-6 text-center text-slate-400", children: [
|
|
942
1028
|
"Search the full catalog above, or select",
|
|
943
1029
|
" ",
|
|
944
|
-
|
|
1030
|
+
xe.map((e) => {
|
|
945
1031
|
var t;
|
|
946
|
-
return ((t =
|
|
1032
|
+
return ((t = L == null ? void 0 : L.fieldLabels) == null ? void 0 : t[e]) ?? re(e);
|
|
947
1033
|
}).join(", "),
|
|
948
1034
|
" ",
|
|
949
1035
|
"to browse by category"
|
|
950
1036
|
] }),
|
|
951
|
-
|
|
952
|
-
/* @__PURE__ */ n(
|
|
1037
|
+
xe.length === 0 && (ie || De) && /* @__PURE__ */ c("div", { className: "flex items-center justify-center gap-2 py-6 text-slate-400", children: [
|
|
1038
|
+
/* @__PURE__ */ n(oe, { className: "h-4 w-4 animate-spin" }),
|
|
953
1039
|
" Loading catalog…"
|
|
954
1040
|
] }),
|
|
955
|
-
|
|
956
|
-
l.favorites && /* @__PURE__ */ c(
|
|
1041
|
+
xe.length === 0 && !ie && !De && rt.length === 0 && /* @__PURE__ */ n("p", { className: "px-3 py-6 text-center text-slate-400", children: "No catalog items" }),
|
|
1042
|
+
l.favorites && /* @__PURE__ */ c(Ce, { children: [
|
|
957
1043
|
/* @__PURE__ */ c("div", { className: "flex w-full items-center gap-1.5 border-b border-slate-200 bg-amber-50/70 px-2 py-1 dark:border-border dark:bg-amber-900/10", children: [
|
|
958
1044
|
/* @__PURE__ */ c(
|
|
959
1045
|
"button",
|
|
@@ -966,82 +1052,82 @@ function en({
|
|
|
966
1052
|
className: "flex min-w-0 flex-1 items-center gap-1.5 py-0.5 text-left",
|
|
967
1053
|
children: [
|
|
968
1054
|
/* @__PURE__ */ n(
|
|
969
|
-
|
|
1055
|
+
qt,
|
|
970
1056
|
{
|
|
971
|
-
className:
|
|
1057
|
+
className: z(
|
|
972
1058
|
"h-3 w-3 shrink-0 text-slate-400 transition-transform",
|
|
973
|
-
!
|
|
1059
|
+
!ce.has("__favorites__") && "rotate-90"
|
|
974
1060
|
)
|
|
975
1061
|
}
|
|
976
1062
|
),
|
|
977
|
-
/* @__PURE__ */ n(
|
|
1063
|
+
/* @__PURE__ */ n(Qe, { className: "h-3 w-3 shrink-0 fill-amber-400 text-amber-400" }),
|
|
978
1064
|
/* @__PURE__ */ n("span", { className: "text-[11px] font-semibold text-slate-600 dark:text-slate-300", children: "Favorites" }),
|
|
979
|
-
/* @__PURE__ */ n("span", { className: "rounded border border-slate-200 bg-white px-1.5 py-0.5 text-[10px] font-medium text-slate-500 dark:border-border dark:bg-background dark:text-slate-400", children:
|
|
1065
|
+
/* @__PURE__ */ n("span", { className: "rounded border border-slate-200 bg-white px-1.5 py-0.5 text-[10px] font-medium text-slate-500 dark:border-border dark:bg-background dark:text-slate-400", children: Re.length })
|
|
980
1066
|
]
|
|
981
1067
|
}
|
|
982
1068
|
),
|
|
983
1069
|
/* @__PURE__ */ n(
|
|
984
1070
|
"button",
|
|
985
1071
|
{
|
|
986
|
-
ref:
|
|
1072
|
+
ref: Rt,
|
|
987
1073
|
type: "button",
|
|
988
|
-
onClick: () =>
|
|
1074
|
+
onClick: () => Pt(!0),
|
|
989
1075
|
className: "shrink-0 rounded border border-amber-200 bg-white px-2 py-0.5 text-[10px] font-semibold text-amber-700 transition-colors hover:border-amber-300 hover:bg-amber-50 dark:border-amber-400/30 dark:bg-transparent dark:text-amber-300 dark:hover:bg-amber-400/10",
|
|
990
1076
|
children: "Manage"
|
|
991
1077
|
}
|
|
992
1078
|
)
|
|
993
1079
|
] }),
|
|
994
|
-
!
|
|
995
|
-
!
|
|
996
|
-
const r = String(e.id),
|
|
1080
|
+
!ce.has("__favorites__") && Re.length === 0 && /* @__PURE__ */ n("p", { className: "border-b border-slate-100 px-3 py-2 text-center text-[11px] text-slate-400 dark:border-border/50", children: "No favorites yet — Manage lets you search the full catalog and star items." }),
|
|
1081
|
+
!ce.has("__favorites__") && Re.map((e, t) => {
|
|
1082
|
+
const r = String(e.id), s = be(r), m = ft(r);
|
|
997
1083
|
return /* @__PURE__ */ c(
|
|
998
1084
|
"div",
|
|
999
1085
|
{
|
|
1000
|
-
className:
|
|
1086
|
+
className: z(
|
|
1001
1087
|
"flex items-center gap-2 border-b border-slate-100 px-3 py-1 dark:border-border/50",
|
|
1002
1088
|
t % 2 === 0 ? "bg-white dark:bg-background" : "bg-slate-50/50 dark:bg-muted/30",
|
|
1003
|
-
(
|
|
1004
|
-
|
|
1089
|
+
(s ?? 0) > 0 && "bg-nvr-cyan/5",
|
|
1090
|
+
m && "bg-amber-50 dark:bg-amber-900/15"
|
|
1005
1091
|
),
|
|
1006
1092
|
children: [
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1093
|
+
dt(r),
|
|
1094
|
+
tt(r, Fe(H, e), wt),
|
|
1095
|
+
kt(r, e),
|
|
1096
|
+
m && /* @__PURE__ */ n(
|
|
1097
|
+
Je,
|
|
1012
1098
|
{
|
|
1013
1099
|
className: "h-3.5 w-3.5 shrink-0 text-amber-500",
|
|
1014
|
-
"aria-label": `${
|
|
1100
|
+
"aria-label": `${bt} ${m.available} — ${m.qty} requested`
|
|
1015
1101
|
}
|
|
1016
1102
|
),
|
|
1017
|
-
se.has(r) && /* @__PURE__ */ n(
|
|
1018
|
-
|
|
1103
|
+
se.has(r) && /* @__PURE__ */ n(oe, { className: "h-3 w-3 shrink-0 animate-spin text-slate-400" }),
|
|
1104
|
+
Ae(r, e)
|
|
1019
1105
|
]
|
|
1020
1106
|
},
|
|
1021
1107
|
r
|
|
1022
1108
|
);
|
|
1023
1109
|
})
|
|
1024
1110
|
] }),
|
|
1025
|
-
|
|
1026
|
-
const t =
|
|
1027
|
-
(
|
|
1111
|
+
xe.length === 0 && rt.map((e) => {
|
|
1112
|
+
const t = ce.has(e.name), r = e.items.reduce(
|
|
1113
|
+
(s, m) => s + ((be(m.id) ?? 0) > 0 ? 1 : 0),
|
|
1028
1114
|
0
|
|
1029
1115
|
);
|
|
1030
|
-
return /* @__PURE__ */ c(
|
|
1116
|
+
return /* @__PURE__ */ c(Ce, { children: [
|
|
1031
1117
|
/* @__PURE__ */ c(
|
|
1032
1118
|
"button",
|
|
1033
1119
|
{
|
|
1034
1120
|
type: "button",
|
|
1035
|
-
onClick: () => ne((
|
|
1036
|
-
const
|
|
1037
|
-
return
|
|
1121
|
+
onClick: () => ne((s) => {
|
|
1122
|
+
const m = new Set(s);
|
|
1123
|
+
return m.has(e.name) ? m.delete(e.name) : m.add(e.name), m;
|
|
1038
1124
|
}),
|
|
1039
1125
|
className: "flex w-full items-center gap-1.5 border-b border-slate-200 bg-slate-100/80 px-2 py-1.5 text-left dark:border-border dark:bg-muted",
|
|
1040
1126
|
children: [
|
|
1041
1127
|
/* @__PURE__ */ n(
|
|
1042
|
-
|
|
1128
|
+
qt,
|
|
1043
1129
|
{
|
|
1044
|
-
className:
|
|
1130
|
+
className: z(
|
|
1045
1131
|
"h-3 w-3 shrink-0 text-slate-400 transition-transform",
|
|
1046
1132
|
!t && "rotate-90"
|
|
1047
1133
|
)
|
|
@@ -1056,48 +1142,48 @@ function en({
|
|
|
1056
1142
|
]
|
|
1057
1143
|
}
|
|
1058
1144
|
),
|
|
1059
|
-
!t && e.items.map((
|
|
1060
|
-
const o =
|
|
1145
|
+
!t && e.items.map((s, m) => {
|
|
1146
|
+
const o = be(s.id), i = ft(s.id);
|
|
1061
1147
|
return /* @__PURE__ */ c(
|
|
1062
1148
|
"div",
|
|
1063
1149
|
{
|
|
1064
|
-
className:
|
|
1150
|
+
className: z(
|
|
1065
1151
|
"flex items-center gap-2 border-b border-slate-100 px-3 py-1 dark:border-border/50",
|
|
1066
|
-
|
|
1152
|
+
m % 2 === 0 ? "bg-white dark:bg-background" : "bg-slate-50/50 dark:bg-muted/30",
|
|
1067
1153
|
(o ?? 0) > 0 && "bg-nvr-cyan/5",
|
|
1068
|
-
|
|
1154
|
+
i && "bg-amber-50 dark:bg-amber-900/15"
|
|
1069
1155
|
),
|
|
1070
1156
|
children: [
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1157
|
+
dt(s.id),
|
|
1158
|
+
tt(s.id, s.label, wt),
|
|
1159
|
+
kt(s.id, s.row),
|
|
1160
|
+
i && /* @__PURE__ */ n(
|
|
1161
|
+
Je,
|
|
1076
1162
|
{
|
|
1077
1163
|
className: "h-3.5 w-3.5 shrink-0 text-amber-500",
|
|
1078
|
-
"aria-label": `${
|
|
1164
|
+
"aria-label": `${bt} ${i.available} — ${i.qty} requested`
|
|
1079
1165
|
}
|
|
1080
1166
|
),
|
|
1081
|
-
se.has(
|
|
1082
|
-
|
|
1167
|
+
se.has(s.id) && /* @__PURE__ */ n(oe, { className: "h-3 w-3 shrink-0 animate-spin text-slate-400" }),
|
|
1168
|
+
Ae(s.id, s.row)
|
|
1083
1169
|
]
|
|
1084
1170
|
},
|
|
1085
|
-
|
|
1171
|
+
s.id
|
|
1086
1172
|
);
|
|
1087
1173
|
})
|
|
1088
1174
|
] }, e.name);
|
|
1089
1175
|
})
|
|
1090
1176
|
] }),
|
|
1091
|
-
(l.builders ?? []).filter((e) =>
|
|
1092
|
-
|
|
1177
|
+
(l.builders ?? []).filter((e) => Yt(e.show_when, ee)).map((e) => /* @__PURE__ */ n(
|
|
1178
|
+
Dr,
|
|
1093
1179
|
{
|
|
1094
1180
|
builder: e,
|
|
1095
1181
|
defaultItemField: l.item_field,
|
|
1096
1182
|
catalogCol: b,
|
|
1097
|
-
catalogFields:
|
|
1098
|
-
tmpl:
|
|
1099
|
-
qtyInput:
|
|
1100
|
-
currentQty:
|
|
1183
|
+
catalogFields: a,
|
|
1184
|
+
tmpl: H,
|
|
1185
|
+
qtyInput: Ae,
|
|
1186
|
+
currentQty: be
|
|
1101
1187
|
},
|
|
1102
1188
|
e.label
|
|
1103
1189
|
))
|
|
@@ -1105,9 +1191,9 @@ function en({
|
|
|
1105
1191
|
/* @__PURE__ */ c("div", { className: "rounded-lg border border-slate-200 text-[12px] dark:border-border", children: [
|
|
1106
1192
|
/* @__PURE__ */ c("div", { className: "flex items-center justify-between gap-2 border-b border-slate-200 bg-slate-50 px-3 py-2 dark:border-border dark:bg-muted", children: [
|
|
1107
1193
|
/* @__PURE__ */ n("span", { className: "text-[11px] font-semibold text-slate-600 dark:text-slate-300", children: "Summary" }),
|
|
1108
|
-
!
|
|
1109
|
-
l.upload_template && !
|
|
1110
|
-
|
|
1194
|
+
!x && /* @__PURE__ */ c("div", { className: "flex items-center gap-2", onClick: (e) => e.stopPropagation(), children: [
|
|
1195
|
+
l.upload_template && !A && Z && q && /* @__PURE__ */ n(
|
|
1196
|
+
Rr,
|
|
1111
1197
|
{
|
|
1112
1198
|
collection: q,
|
|
1113
1199
|
templateFilter: (e) => {
|
|
@@ -1123,255 +1209,265 @@ function en({
|
|
|
1123
1209
|
}
|
|
1124
1210
|
),
|
|
1125
1211
|
/* @__PURE__ */ n("div", { className: "w-64", children: /* @__PURE__ */ n(
|
|
1126
|
-
|
|
1212
|
+
Br,
|
|
1127
1213
|
{
|
|
1128
1214
|
collection: b,
|
|
1129
1215
|
value: null,
|
|
1130
|
-
onChange: (e) => void
|
|
1216
|
+
onChange: (e) => void kr(e),
|
|
1131
1217
|
placeholder: "+ Add any item…"
|
|
1132
1218
|
}
|
|
1133
1219
|
) })
|
|
1134
1220
|
] })
|
|
1135
1221
|
] }),
|
|
1136
|
-
|
|
1137
|
-
const e =
|
|
1222
|
+
de.length === 0 ? /* @__PURE__ */ n("p", { className: "px-3 py-4 text-center text-slate-400", children: "Nothing picked yet" }) : (() => {
|
|
1223
|
+
const e = Kt.filter((i) => !i.format), t = e[0], r = e.slice(1), s = Kt.filter((i) => !!i.format), m = (i, y) => y === "presence" ? i == null || i === "" || Number(i) === 0 ? "No" : "Yes" : i === !0 || i === "true" ? "✓" : i === !1 || i === "false" || i == null || i === "" ? "—" : fe(i, y), o = (i) => /* @__PURE__ */ n("span", { className: "w-20 shrink-0 text-right text-[11px] font-medium text-slate-500", children: i });
|
|
1138
1224
|
return /* @__PURE__ */ c("div", { children: [
|
|
1139
1225
|
/* @__PURE__ */ c("div", { className: "flex items-center gap-2 border-b border-slate-200 px-3 py-1.5 dark:border-border", children: [
|
|
1140
1226
|
/* @__PURE__ */ n("span", { className: "flex-1 text-[11px] font-medium text-slate-500", children: "Item" }),
|
|
1141
|
-
|
|
1142
|
-
o(
|
|
1143
|
-
|
|
1144
|
-
!
|
|
1227
|
+
Nt.map((i) => /* @__PURE__ */ n(Ce, { children: o(re(i)) }, i)),
|
|
1228
|
+
o(re(V)),
|
|
1229
|
+
vt.map((i) => /* @__PURE__ */ n(Ce, { children: o(re(i)) }, i)),
|
|
1230
|
+
!x && /* @__PURE__ */ n("span", { className: "w-6 shrink-0" })
|
|
1145
1231
|
] }),
|
|
1146
|
-
|
|
1147
|
-
const
|
|
1232
|
+
de.map((i, y) => {
|
|
1233
|
+
const d = i.row.id != null ? String(i.row.id) : null, f = d != null && We.has(d), N = f ? null : ft(i.key), T = f ? null : dr(i.key);
|
|
1148
1234
|
return /* @__PURE__ */ c(
|
|
1149
1235
|
"div",
|
|
1150
1236
|
{
|
|
1151
|
-
className:
|
|
1237
|
+
className: z(
|
|
1152
1238
|
"border-b border-slate-100 px-3 py-2 last:border-b-0 dark:border-border/50",
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1239
|
+
y % 2 === 0 ? "bg-white dark:bg-background" : "bg-slate-50/50 dark:bg-muted/30",
|
|
1240
|
+
N && "bg-amber-50 dark:bg-amber-900/15",
|
|
1241
|
+
T && "bg-red-50/70 dark:bg-red-900/15",
|
|
1242
|
+
f && "opacity-60"
|
|
1157
1243
|
),
|
|
1158
1244
|
children: [
|
|
1159
1245
|
/* @__PURE__ */ c(
|
|
1160
1246
|
"div",
|
|
1161
1247
|
{
|
|
1162
|
-
className:
|
|
1248
|
+
className: z(
|
|
1163
1249
|
"flex items-center gap-2",
|
|
1164
|
-
|
|
1250
|
+
f && "line-through decoration-slate-400"
|
|
1165
1251
|
),
|
|
1166
1252
|
children: [
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1253
|
+
tt(
|
|
1254
|
+
i.key,
|
|
1255
|
+
Bt(i.key),
|
|
1170
1256
|
"shrink-0 font-semibold text-slate-800 dark:text-slate-100"
|
|
1171
1257
|
),
|
|
1172
|
-
|
|
1258
|
+
Pe && !f && (d == null || He.has(d)) && /* @__PURE__ */ n(
|
|
1173
1259
|
"span",
|
|
1174
1260
|
{
|
|
1175
|
-
"data-catalog-staged":
|
|
1261
|
+
"data-catalog-staged": d == null ? "new" : "edited",
|
|
1176
1262
|
"data-tip": "Applies when you save the record",
|
|
1177
1263
|
className: "shrink-0 rounded bg-amber-100 px-1.5 py-px text-[10px] font-semibold text-amber-800 dark:bg-amber-400/15 dark:text-amber-300",
|
|
1178
|
-
children:
|
|
1264
|
+
children: d == null ? "New" : "Edited"
|
|
1179
1265
|
}
|
|
1180
1266
|
),
|
|
1181
|
-
|
|
1267
|
+
T && /* @__PURE__ */ n(
|
|
1182
1268
|
"span",
|
|
1183
1269
|
{
|
|
1184
1270
|
className: "shrink-0",
|
|
1185
1271
|
"data-tip": `This line was in the failed submission
|
|
1186
|
-
${
|
|
1272
|
+
${T}`,
|
|
1187
1273
|
"data-submission-error": !0,
|
|
1188
|
-
children: /* @__PURE__ */ n(
|
|
1274
|
+
children: /* @__PURE__ */ n(Mt, { className: "h-3.5 w-3.5 text-red-500", strokeWidth: 2 })
|
|
1189
1275
|
}
|
|
1190
1276
|
),
|
|
1191
1277
|
t && /* @__PURE__ */ n(
|
|
1192
1278
|
"span",
|
|
1193
1279
|
{
|
|
1194
1280
|
className: "min-w-0 flex-1 truncate text-slate-600 dark:text-slate-300",
|
|
1195
|
-
title: String(Le(
|
|
1196
|
-
children:
|
|
1281
|
+
title: String(Le($e(i.key), t.field) ?? ""),
|
|
1282
|
+
children: fe(Le($e(i.key), t.field), void 0)
|
|
1197
1283
|
}
|
|
1198
1284
|
),
|
|
1199
1285
|
!t && /* @__PURE__ */ n("span", { className: "flex-1" }),
|
|
1200
|
-
r.map((
|
|
1201
|
-
const
|
|
1202
|
-
return
|
|
1286
|
+
r.map((k) => {
|
|
1287
|
+
const S = Le($e(i.key), k.field);
|
|
1288
|
+
return S == null || S === "" ? null : /* @__PURE__ */ n(
|
|
1203
1289
|
"span",
|
|
1204
1290
|
{
|
|
1205
1291
|
className: "shrink-0 rounded bg-slate-100 px-1.5 py-0.5 text-[10.5px] font-medium text-slate-600 dark:bg-muted dark:text-slate-300",
|
|
1206
|
-
children: String(
|
|
1292
|
+
children: String(S)
|
|
1207
1293
|
},
|
|
1208
|
-
|
|
1294
|
+
k.field
|
|
1209
1295
|
);
|
|
1210
1296
|
}),
|
|
1211
|
-
|
|
1212
|
-
(
|
|
1213
|
-
var
|
|
1214
|
-
return
|
|
1297
|
+
Nt.map(
|
|
1298
|
+
(k) => {
|
|
1299
|
+
var S;
|
|
1300
|
+
return B.includes(k) && !x ? /* @__PURE__ */ n(
|
|
1215
1301
|
"input",
|
|
1216
1302
|
{
|
|
1217
1303
|
type: "number",
|
|
1218
1304
|
min: 0,
|
|
1219
1305
|
step: "any",
|
|
1220
|
-
defaultValue:
|
|
1221
|
-
onBlur: (
|
|
1222
|
-
onKeyDown: (
|
|
1223
|
-
|
|
1306
|
+
defaultValue: i.row[k] == null ? "" : String(i.row[k]),
|
|
1307
|
+
onBlur: (le) => void yr(i.key, k, le.target.value),
|
|
1308
|
+
onKeyDown: (le) => {
|
|
1309
|
+
le.key === "Enter" && le.currentTarget.blur();
|
|
1224
1310
|
},
|
|
1225
1311
|
className: "h-7 w-20 shrink-0 rounded border border-slate-200 bg-white px-2 text-right text-[12px] outline-none focus:border-nvr-cyan dark:border-border dark:bg-background"
|
|
1226
1312
|
},
|
|
1227
|
-
`${
|
|
1313
|
+
`${i.key}:${k}:${String(i.row[k] ?? "")}`
|
|
1228
1314
|
) : /* @__PURE__ */ n(
|
|
1229
1315
|
"span",
|
|
1230
1316
|
{
|
|
1231
1317
|
className: "w-20 shrink-0 text-right tabular-nums text-slate-600 dark:text-slate-300",
|
|
1232
|
-
children:
|
|
1318
|
+
children: fe(i.row[k], (S = l.field_formats) == null ? void 0 : S[k])
|
|
1233
1319
|
},
|
|
1234
|
-
|
|
1320
|
+
k
|
|
1235
1321
|
);
|
|
1236
1322
|
}
|
|
1237
1323
|
),
|
|
1238
1324
|
/* @__PURE__ */ c("span", { className: "inline-flex w-20 shrink-0 items-center justify-end gap-1", children: [
|
|
1239
|
-
se.has(
|
|
1240
|
-
|
|
1325
|
+
se.has(i.key) && /* @__PURE__ */ n(oe, { className: "h-3 w-3 animate-spin text-slate-400" }),
|
|
1326
|
+
Ae(i.key, $e(i.key))
|
|
1241
1327
|
] }),
|
|
1242
|
-
|
|
1243
|
-
var
|
|
1244
|
-
|
|
1328
|
+
vt.map((k) => {
|
|
1329
|
+
var _e, Ht;
|
|
1330
|
+
if (f)
|
|
1331
|
+
return /* @__PURE__ */ n(
|
|
1332
|
+
"span",
|
|
1333
|
+
{
|
|
1334
|
+
"data-tip": "Not counted — this line is removed when you save",
|
|
1335
|
+
className: "w-20 shrink-0 text-right tabular-nums text-slate-400 dark:text-slate-500",
|
|
1336
|
+
children: "—"
|
|
1337
|
+
},
|
|
1338
|
+
k
|
|
1339
|
+
);
|
|
1340
|
+
const S = i.row[k], le = S != null && S !== "" ? S : Ke(((_e = l.compute_fields) == null ? void 0 : _e[k]) ?? "", i.row);
|
|
1245
1341
|
return /* @__PURE__ */ n(
|
|
1246
1342
|
"span",
|
|
1247
1343
|
{
|
|
1248
1344
|
className: "w-20 shrink-0 text-right tabular-nums text-slate-600 dark:text-slate-300",
|
|
1249
|
-
children:
|
|
1345
|
+
children: fe(le, (Ht = l.field_formats) == null ? void 0 : Ht[k])
|
|
1250
1346
|
},
|
|
1251
|
-
|
|
1347
|
+
k
|
|
1252
1348
|
);
|
|
1253
1349
|
}),
|
|
1254
|
-
!
|
|
1350
|
+
!x && f && /* @__PURE__ */ n(
|
|
1255
1351
|
"button",
|
|
1256
1352
|
{
|
|
1257
1353
|
type: "button",
|
|
1258
|
-
onClick: () =>
|
|
1354
|
+
onClick: () => p == null ? void 0 : p.cancelPendingDelete(u, g, d),
|
|
1259
1355
|
className: "shrink-0 rounded px-1.5 py-0.5 text-[11px] font-medium text-nvr-navy underline dark:text-nvr-cyan",
|
|
1260
1356
|
children: "Undo"
|
|
1261
1357
|
}
|
|
1262
1358
|
),
|
|
1263
|
-
!
|
|
1359
|
+
!x && !f && /* @__PURE__ */ n(
|
|
1264
1360
|
"button",
|
|
1265
1361
|
{
|
|
1266
1362
|
type: "button",
|
|
1267
1363
|
title: "Remove (applies on Save)",
|
|
1268
1364
|
onClick: () => {
|
|
1269
|
-
if (!
|
|
1270
|
-
|
|
1365
|
+
if (!A && p && d != null) {
|
|
1366
|
+
p.queueDelete(u, g, d);
|
|
1271
1367
|
return;
|
|
1272
1368
|
}
|
|
1273
|
-
|
|
1369
|
+
nt(i.key, "0", {}, { confirmedRemove: !0 });
|
|
1274
1370
|
},
|
|
1275
1371
|
className: "w-6 shrink-0 rounded p-0.5 text-slate-300 transition-colors hover:text-red-500",
|
|
1276
|
-
children: /* @__PURE__ */ n(
|
|
1372
|
+
children: /* @__PURE__ */ n(at, { className: "mx-auto h-3.5 w-3.5" })
|
|
1277
1373
|
}
|
|
1278
1374
|
)
|
|
1279
1375
|
]
|
|
1280
1376
|
}
|
|
1281
1377
|
),
|
|
1282
|
-
(
|
|
1283
|
-
|
|
1284
|
-
/* @__PURE__ */ n("span", { className: "text-slate-500 dark:text-muted-foreground", children:
|
|
1378
|
+
(s.length > 0 || Jt.length > 0 || et.length > 0) && /* @__PURE__ */ c("div", { className: "mt-1 flex flex-wrap items-baseline gap-x-4 gap-y-0.5 pl-0.5 text-[11px]", children: [
|
|
1379
|
+
s.map((k) => /* @__PURE__ */ c("span", { className: "whitespace-nowrap", children: [
|
|
1380
|
+
/* @__PURE__ */ n("span", { className: "text-slate-500 dark:text-muted-foreground", children: k.label ?? re(k.field.split(".")[0]) }),
|
|
1285
1381
|
" ",
|
|
1286
|
-
/* @__PURE__ */ n("span", { className: "font-medium tabular-nums text-slate-700 dark:text-slate-200", children:
|
|
1287
|
-
] },
|
|
1288
|
-
|
|
1289
|
-
/* @__PURE__ */ n("span", { className: "text-slate-500 dark:text-muted-foreground", children:
|
|
1382
|
+
/* @__PURE__ */ n("span", { className: "font-medium tabular-nums text-slate-700 dark:text-slate-200", children: m(Le($e(i.key), k.field), k.format) })
|
|
1383
|
+
] }, k.field)),
|
|
1384
|
+
Jt.map((k) => /* @__PURE__ */ c("span", { className: "whitespace-nowrap", children: [
|
|
1385
|
+
/* @__PURE__ */ n("span", { className: "text-slate-500 dark:text-muted-foreground", children: k.label ?? re(k.key) }),
|
|
1290
1386
|
" ",
|
|
1291
|
-
/* @__PURE__ */ n("span", { className: "font-medium tabular-nums text-slate-700 dark:text-slate-200", children:
|
|
1292
|
-
] },
|
|
1293
|
-
|
|
1294
|
-
|
|
1387
|
+
/* @__PURE__ */ n("span", { className: "font-medium tabular-nums text-slate-700 dark:text-slate-200", children: m(ut(k.key, i.key), k.format) })
|
|
1388
|
+
] }, k.key)),
|
|
1389
|
+
br(i.row),
|
|
1390
|
+
ar(i.row).map((k) => /* @__PURE__ */ c(
|
|
1295
1391
|
"span",
|
|
1296
1392
|
{
|
|
1297
1393
|
className: "inline-flex items-center gap-1 whitespace-nowrap rounded bg-amber-50 px-1.5 py-px text-[10.5px] font-medium text-amber-700 dark:bg-amber-500/10 dark:text-amber-300",
|
|
1298
|
-
"data-catalog-row-flag":
|
|
1394
|
+
"data-catalog-row-flag": k,
|
|
1299
1395
|
children: [
|
|
1300
|
-
/* @__PURE__ */ n(
|
|
1301
|
-
|
|
1396
|
+
/* @__PURE__ */ n(Je, { className: "h-3 w-3" }),
|
|
1397
|
+
k
|
|
1302
1398
|
]
|
|
1303
1399
|
},
|
|
1304
|
-
|
|
1400
|
+
k
|
|
1305
1401
|
)),
|
|
1306
|
-
|
|
1307
|
-
const
|
|
1402
|
+
et.map((k) => {
|
|
1403
|
+
const S = ur(k, i);
|
|
1308
1404
|
return /* @__PURE__ */ c("span", { className: "whitespace-nowrap", children: [
|
|
1309
|
-
/* @__PURE__ */ n("span", { className: "text-slate-500 dark:text-muted-foreground", children:
|
|
1405
|
+
/* @__PURE__ */ n("span", { className: "text-slate-500 dark:text-muted-foreground", children: k.label ?? re(k.field) }),
|
|
1310
1406
|
" ",
|
|
1311
|
-
/* @__PURE__ */ n("span", { className: "font-medium text-slate-700 dark:text-slate-200", children:
|
|
1312
|
-
] },
|
|
1407
|
+
/* @__PURE__ */ n("span", { className: "font-medium text-slate-700 dark:text-slate-200", children: m(S, k.format) })
|
|
1408
|
+
] }, k.field);
|
|
1313
1409
|
})
|
|
1314
1410
|
] }),
|
|
1315
|
-
|
|
1316
|
-
/* @__PURE__ */ n(
|
|
1317
|
-
|
|
1411
|
+
N && /* @__PURE__ */ c("p", { className: "mt-1 flex items-center gap-1 pl-0.5 text-[11px] font-medium text-amber-600 dark:text-amber-400", children: [
|
|
1412
|
+
/* @__PURE__ */ n(Je, { className: "h-3 w-3 shrink-0" }),
|
|
1413
|
+
bt,
|
|
1318
1414
|
" is ",
|
|
1319
|
-
|
|
1415
|
+
fe(N.available, "number"),
|
|
1320
1416
|
" —",
|
|
1321
1417
|
" ",
|
|
1322
|
-
|
|
1418
|
+
fe(N.qty, "number"),
|
|
1323
1419
|
" requested"
|
|
1324
1420
|
] }),
|
|
1325
|
-
|
|
1421
|
+
f && /* @__PURE__ */ n("p", { className: "mt-1 pl-0.5 text-[11px] text-red-500", children: "Removed — applies when you save" })
|
|
1326
1422
|
]
|
|
1327
1423
|
},
|
|
1328
|
-
|
|
1424
|
+
i.key
|
|
1329
1425
|
);
|
|
1330
1426
|
}),
|
|
1331
1427
|
(() => {
|
|
1332
|
-
const
|
|
1333
|
-
const
|
|
1334
|
-
return !(
|
|
1335
|
-
}),
|
|
1336
|
-
const
|
|
1337
|
-
return
|
|
1338
|
-
}, 0),
|
|
1339
|
-
var
|
|
1340
|
-
return ((
|
|
1341
|
-
},
|
|
1428
|
+
const i = de.filter((N) => {
|
|
1429
|
+
const T = N.row.id != null ? String(N.row.id) : null;
|
|
1430
|
+
return !(T != null && We.has(T));
|
|
1431
|
+
}), y = (N) => i.reduce((T, k) => {
|
|
1432
|
+
const S = Number(k.row[N]);
|
|
1433
|
+
return T + (Number.isFinite(S) ? S : 0);
|
|
1434
|
+
}, 0), d = (N) => {
|
|
1435
|
+
var T;
|
|
1436
|
+
return ((T = l.field_formats) == null ? void 0 : T[N]) ?? "number";
|
|
1437
|
+
}, f = (N) => /* @__PURE__ */ n(
|
|
1342
1438
|
"span",
|
|
1343
1439
|
{
|
|
1344
1440
|
className: "w-20 shrink-0 text-right text-[12px] font-semibold tabular-nums text-slate-800 dark:text-slate-100",
|
|
1345
|
-
children:
|
|
1441
|
+
children: fe(y(N), d(N))
|
|
1346
1442
|
},
|
|
1347
|
-
|
|
1443
|
+
N
|
|
1348
1444
|
);
|
|
1349
1445
|
return /* @__PURE__ */ c("div", { className: "flex items-center gap-2 border-t border-slate-200 bg-slate-50 px-3 py-1.5 dark:border-border dark:bg-muted/40", children: [
|
|
1350
1446
|
/* @__PURE__ */ n("span", { className: "flex-1 text-[11px] font-semibold uppercase tracking-wide text-slate-500", children: "Total" }),
|
|
1351
|
-
|
|
1352
|
-
/* @__PURE__ */ n("span", { className: "w-20 shrink-0 text-right text-[12px] font-semibold tabular-nums text-slate-800 dark:text-slate-100", children:
|
|
1353
|
-
|
|
1354
|
-
!
|
|
1447
|
+
Nt.map((N) => /* @__PURE__ */ n("span", { className: "w-20 shrink-0" }, N)),
|
|
1448
|
+
/* @__PURE__ */ n("span", { className: "w-20 shrink-0 text-right text-[12px] font-semibold tabular-nums text-slate-800 dark:text-slate-100", children: fe(y(V), "number") }),
|
|
1449
|
+
vt.map(f),
|
|
1450
|
+
!x && /* @__PURE__ */ n("span", { className: "w-6 shrink-0" })
|
|
1355
1451
|
] });
|
|
1356
1452
|
})()
|
|
1357
1453
|
] });
|
|
1358
1454
|
})()
|
|
1359
1455
|
] }),
|
|
1360
|
-
|
|
1361
|
-
|
|
1456
|
+
tr && b && /* @__PURE__ */ n(
|
|
1457
|
+
Hr,
|
|
1362
1458
|
{
|
|
1363
1459
|
catalogCol: b,
|
|
1364
|
-
tmpl:
|
|
1460
|
+
tmpl: H,
|
|
1365
1461
|
sectionBy: l.section_by,
|
|
1366
|
-
sectionM2M:
|
|
1367
|
-
pinnedSet:
|
|
1368
|
-
pinnedIds:
|
|
1369
|
-
savingIds:
|
|
1462
|
+
sectionM2M: Q,
|
|
1463
|
+
pinnedSet: ot,
|
|
1464
|
+
pinnedIds: ge,
|
|
1465
|
+
savingIds: Ze,
|
|
1370
1466
|
relatedCols: (l.favorites_manager_columns ?? []).map((e) => (l.related_columns ?? []).find((t) => t.key === e)).filter((e) => !!e),
|
|
1371
|
-
parentDraft:
|
|
1372
|
-
onToggle: (e) => void
|
|
1373
|
-
onClose: () =>
|
|
1374
|
-
anchor:
|
|
1467
|
+
parentDraft: ee,
|
|
1468
|
+
onToggle: (e) => void Ot(e),
|
|
1469
|
+
onClose: () => Pt(!1),
|
|
1470
|
+
anchor: Rt.current
|
|
1375
1471
|
}
|
|
1376
1472
|
)
|
|
1377
1473
|
] }) : /* @__PURE__ */ c("p", { className: "py-1 text-[12px] text-slate-400", children: [
|
|
@@ -1379,72 +1475,72 @@ ${_}`,
|
|
|
1379
1475
|
l.item_field,
|
|
1380
1476
|
'" does not resolve to an M2O relation on',
|
|
1381
1477
|
" ",
|
|
1382
|
-
|
|
1478
|
+
u
|
|
1383
1479
|
] });
|
|
1384
1480
|
}
|
|
1385
|
-
function
|
|
1386
|
-
builder:
|
|
1387
|
-
defaultItemField:
|
|
1388
|
-
catalogCol:
|
|
1481
|
+
function Dr({
|
|
1482
|
+
builder: u,
|
|
1483
|
+
defaultItemField: g,
|
|
1484
|
+
catalogCol: _,
|
|
1389
1485
|
catalogFields: q,
|
|
1390
1486
|
tmpl: l,
|
|
1391
|
-
qtyInput:
|
|
1392
|
-
currentQty:
|
|
1487
|
+
qtyInput: x,
|
|
1488
|
+
currentQty: h
|
|
1393
1489
|
}) {
|
|
1394
|
-
const $ =
|
|
1490
|
+
const $ = $t(), p = u.item_field ?? g, [L, Z] = Y(!1), [B, A] = Y({}), V = O(
|
|
1395
1491
|
() => [
|
|
1396
1492
|
"id",
|
|
1397
|
-
|
|
1398
|
-
...
|
|
1493
|
+
p,
|
|
1494
|
+
...u.attributes.flatMap((v) => [`${v.field}.id`, `${v.field}.${v.label_field}`])
|
|
1399
1495
|
].join(","),
|
|
1400
|
-
[
|
|
1401
|
-
), { data:
|
|
1496
|
+
[p, u.attributes]
|
|
1497
|
+
), { data: ce = [], isLoading: ne } = J({
|
|
1402
1498
|
queryKey: [
|
|
1403
1499
|
"catalog-builder",
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
JSON.stringify(
|
|
1500
|
+
u.collection,
|
|
1501
|
+
V,
|
|
1502
|
+
JSON.stringify(u.filter ?? null)
|
|
1407
1503
|
],
|
|
1408
1504
|
queryFn: () => $.request(
|
|
1409
|
-
|
|
1505
|
+
P(`/items/${u.collection}`, {
|
|
1410
1506
|
limit: 2e3,
|
|
1411
|
-
fields:
|
|
1412
|
-
...
|
|
1507
|
+
fields: V,
|
|
1508
|
+
...u.filter ? { filter: JSON.stringify(u.filter) } : {}
|
|
1413
1509
|
})
|
|
1414
|
-
).then((
|
|
1415
|
-
enabled:
|
|
1510
|
+
).then((v) => v.data ?? []),
|
|
1511
|
+
enabled: L,
|
|
1416
1512
|
staleTime: 6e4
|
|
1417
|
-
}),
|
|
1418
|
-
var
|
|
1419
|
-
const
|
|
1420
|
-
if (
|
|
1421
|
-
if (typeof
|
|
1422
|
-
const
|
|
1423
|
-
return { id: String(
|
|
1513
|
+
}), ye = (v, F) => {
|
|
1514
|
+
var D;
|
|
1515
|
+
const j = v[F];
|
|
1516
|
+
if (j == null) return null;
|
|
1517
|
+
if (typeof j == "object") {
|
|
1518
|
+
const K = j, b = ((D = u.attributes.find((me) => me.field === F)) == null ? void 0 : D.label_field) ?? "id";
|
|
1519
|
+
return { id: String(K.id ?? ""), label: String(K[b] ?? K.id ?? "") };
|
|
1424
1520
|
}
|
|
1425
|
-
return { id: String(
|
|
1426
|
-
},
|
|
1427
|
-
(
|
|
1428
|
-
var
|
|
1429
|
-
const
|
|
1430
|
-
return
|
|
1521
|
+
return { id: String(j), label: String(j) };
|
|
1522
|
+
}, C = (v) => ce.filter(
|
|
1523
|
+
(F) => u.attributes.slice(0, v).every((j) => {
|
|
1524
|
+
var K;
|
|
1525
|
+
const D = B[j.field];
|
|
1526
|
+
return D ? ((K = ye(F, j.field)) == null ? void 0 : K.id) === D : !0;
|
|
1431
1527
|
})
|
|
1432
|
-
),
|
|
1433
|
-
(
|
|
1434
|
-
var
|
|
1435
|
-
return ((
|
|
1528
|
+
), ke = u.attributes.every((v) => B[v.field]), pe = ke ? ce.find(
|
|
1529
|
+
(v) => u.attributes.every((F) => {
|
|
1530
|
+
var j;
|
|
1531
|
+
return ((j = ye(v, F.field)) == null ? void 0 : j.id) === B[F.field];
|
|
1436
1532
|
})
|
|
1437
|
-
) : void 0, G = (
|
|
1438
|
-
queryKey: ["catalog-builder-item",
|
|
1533
|
+
) : void 0, G = (pe == null ? void 0 : pe[p]) != null ? String(pe[p]) : null, { data: se } = J({
|
|
1534
|
+
queryKey: ["catalog-builder-item", _, q, G],
|
|
1439
1535
|
queryFn: () => $.request(
|
|
1440
|
-
|
|
1536
|
+
P(`/items/${_}`, {
|
|
1441
1537
|
filter: JSON.stringify({ id: { _eq: G } }),
|
|
1442
1538
|
fields: q,
|
|
1443
1539
|
limit: 1
|
|
1444
1540
|
})
|
|
1445
|
-
).then((
|
|
1446
|
-
var
|
|
1447
|
-
return ((
|
|
1541
|
+
).then((v) => {
|
|
1542
|
+
var F;
|
|
1543
|
+
return ((F = v.data) == null ? void 0 : F[0]) ?? null;
|
|
1448
1544
|
}),
|
|
1449
1545
|
enabled: !!G,
|
|
1450
1546
|
staleTime: 6e4
|
|
@@ -1454,316 +1550,316 @@ function Pr({
|
|
|
1454
1550
|
"button",
|
|
1455
1551
|
{
|
|
1456
1552
|
type: "button",
|
|
1457
|
-
onClick: () => Z((
|
|
1553
|
+
onClick: () => Z((v) => !v),
|
|
1458
1554
|
className: "flex w-full items-center gap-1.5 rounded-t-lg bg-slate-100/80 px-2 py-1.5 text-left dark:bg-muted",
|
|
1459
1555
|
children: [
|
|
1460
1556
|
/* @__PURE__ */ n(
|
|
1461
|
-
|
|
1557
|
+
qt,
|
|
1462
1558
|
{
|
|
1463
|
-
className:
|
|
1559
|
+
className: z(
|
|
1464
1560
|
"h-3 w-3 shrink-0 text-slate-400 transition-transform",
|
|
1465
|
-
|
|
1561
|
+
L && "rotate-90"
|
|
1466
1562
|
)
|
|
1467
1563
|
}
|
|
1468
1564
|
),
|
|
1469
|
-
/* @__PURE__ */ n("span", { className: "text-[11px] font-semibold text-slate-600 dark:text-slate-300", children:
|
|
1565
|
+
/* @__PURE__ */ n("span", { className: "text-[11px] font-semibold text-slate-600 dark:text-slate-300", children: u.label })
|
|
1470
1566
|
]
|
|
1471
1567
|
}
|
|
1472
1568
|
),
|
|
1473
|
-
|
|
1474
|
-
/* @__PURE__ */ n(
|
|
1569
|
+
L && /* @__PURE__ */ n("div", { className: "space-y-2 border-t border-slate-200 p-3 dark:border-border", children: ne ? /* @__PURE__ */ c("div", { className: "flex items-center gap-2 py-2 text-slate-400", children: [
|
|
1570
|
+
/* @__PURE__ */ n(oe, { className: "h-4 w-4 animate-spin" }),
|
|
1475
1571
|
" Loading options…"
|
|
1476
1572
|
] }) : /* @__PURE__ */ c("div", { className: "flex flex-wrap items-end gap-3", children: [
|
|
1477
|
-
|
|
1478
|
-
const
|
|
1479
|
-
for (const
|
|
1480
|
-
const
|
|
1481
|
-
|
|
1573
|
+
u.attributes.map((v, F) => {
|
|
1574
|
+
const j = /* @__PURE__ */ new Map();
|
|
1575
|
+
for (const K of C(F)) {
|
|
1576
|
+
const b = ye(K, v.field);
|
|
1577
|
+
b != null && b.id && j.set(b.id, b.label);
|
|
1482
1578
|
}
|
|
1483
|
-
const
|
|
1484
|
-
([,
|
|
1579
|
+
const D = [...j.entries()].sort(
|
|
1580
|
+
([, K], [, b]) => K.localeCompare(b, void 0, { numeric: !0 })
|
|
1485
1581
|
);
|
|
1486
1582
|
return /* @__PURE__ */ n(
|
|
1487
|
-
|
|
1583
|
+
Ur,
|
|
1488
1584
|
{
|
|
1489
|
-
label:
|
|
1490
|
-
value:
|
|
1491
|
-
valueLabel:
|
|
1492
|
-
options:
|
|
1493
|
-
disabled:
|
|
1494
|
-
onChange: (
|
|
1495
|
-
const
|
|
1496
|
-
for (let
|
|
1497
|
-
const
|
|
1498
|
-
|
|
1585
|
+
label: re(v.field),
|
|
1586
|
+
value: B[v.field] ?? null,
|
|
1587
|
+
valueLabel: B[v.field] ? j.get(B[v.field]) ?? B[v.field] : null,
|
|
1588
|
+
options: D,
|
|
1589
|
+
disabled: F > 0 && !B[u.attributes[F - 1].field],
|
|
1590
|
+
onChange: (K) => A((b) => {
|
|
1591
|
+
const me = {};
|
|
1592
|
+
for (let X = 0; X < F; X++) {
|
|
1593
|
+
const U = u.attributes[X].field;
|
|
1594
|
+
b[U] && (me[U] = b[U]);
|
|
1499
1595
|
}
|
|
1500
|
-
return
|
|
1596
|
+
return K && (me[v.field] = K), me;
|
|
1501
1597
|
})
|
|
1502
1598
|
},
|
|
1503
|
-
|
|
1599
|
+
v.field
|
|
1504
1600
|
);
|
|
1505
1601
|
}),
|
|
1506
|
-
/* @__PURE__ */ n("div", { className: "flex min-h-[28px] flex-1 items-center gap-2", children: G && se ? /* @__PURE__ */ c(
|
|
1507
|
-
/* @__PURE__ */ n("span", { className: "min-w-0 flex-1 truncate text-slate-700 dark:text-slate-200", children:
|
|
1508
|
-
(
|
|
1509
|
-
|
|
1510
|
-
] }) :
|
|
1602
|
+
/* @__PURE__ */ n("div", { className: "flex min-h-[28px] flex-1 items-center gap-2", children: G && se ? /* @__PURE__ */ c(_t, { children: [
|
|
1603
|
+
/* @__PURE__ */ n("span", { className: "min-w-0 flex-1 truncate text-slate-700 dark:text-slate-200", children: Fe(l, se) }),
|
|
1604
|
+
(h(G) ?? 0) > 0 && /* @__PURE__ */ n("span", { className: "rounded bg-nvr-cyan/10 px-1.5 py-0.5 text-[10px] font-semibold text-[#009abe]", children: "picked" }),
|
|
1605
|
+
x(G, se)
|
|
1606
|
+
] }) : ke ? /* @__PURE__ */ n("span", { className: "text-slate-400", children: "No matching item for this combination" }) : /* @__PURE__ */ n("span", { className: "text-slate-400", children: "Pick each attribute to resolve an item" }) })
|
|
1511
1607
|
] }) })
|
|
1512
1608
|
] });
|
|
1513
1609
|
}
|
|
1514
|
-
function
|
|
1515
|
-
label:
|
|
1516
|
-
value:
|
|
1517
|
-
valueLabel:
|
|
1610
|
+
function Ur({
|
|
1611
|
+
label: u,
|
|
1612
|
+
value: g,
|
|
1613
|
+
valueLabel: _,
|
|
1518
1614
|
options: q,
|
|
1519
1615
|
disabled: l,
|
|
1520
|
-
onChange:
|
|
1616
|
+
onChange: x
|
|
1521
1617
|
}) {
|
|
1522
|
-
const [
|
|
1523
|
-
return
|
|
1524
|
-
if (!
|
|
1525
|
-
const
|
|
1526
|
-
|
|
1618
|
+
const [h, $] = Y(!1), p = ze(null);
|
|
1619
|
+
return je(() => {
|
|
1620
|
+
if (!h) return;
|
|
1621
|
+
const L = (Z) => {
|
|
1622
|
+
p.current && !p.current.contains(Z.target) && $(!1);
|
|
1527
1623
|
};
|
|
1528
|
-
return document.addEventListener("mousedown",
|
|
1529
|
-
}, [
|
|
1530
|
-
/* @__PURE__ */ n("p", { className: "mb-1 text-[10px] font-medium text-slate-500 dark:text-slate-400", children:
|
|
1624
|
+
return document.addEventListener("mousedown", L), () => document.removeEventListener("mousedown", L);
|
|
1625
|
+
}, [h]), /* @__PURE__ */ c("div", { ref: p, className: "relative", children: [
|
|
1626
|
+
/* @__PURE__ */ n("p", { className: "mb-1 text-[10px] font-medium text-slate-500 dark:text-slate-400", children: u }),
|
|
1531
1627
|
/* @__PURE__ */ c(
|
|
1532
1628
|
"button",
|
|
1533
1629
|
{
|
|
1534
1630
|
type: "button",
|
|
1535
1631
|
disabled: l,
|
|
1536
|
-
onClick: () => $((
|
|
1632
|
+
onClick: () => $((L) => !L),
|
|
1537
1633
|
className: "flex w-44 items-center justify-between rounded border border-slate-200 bg-white px-2 py-1.5 text-left text-[12px] text-slate-700 hover:border-slate-300 disabled:opacity-50 dark:border-border dark:bg-background dark:text-slate-200",
|
|
1538
1634
|
children: [
|
|
1539
|
-
/* @__PURE__ */ n("span", { className:
|
|
1540
|
-
/* @__PURE__ */ n(
|
|
1635
|
+
/* @__PURE__ */ n("span", { className: z("truncate", !_ && "text-slate-400"), children: _ ?? "Select…" }),
|
|
1636
|
+
/* @__PURE__ */ n(vr, { className: "h-3.5 w-3.5 shrink-0 text-slate-400" })
|
|
1541
1637
|
]
|
|
1542
1638
|
}
|
|
1543
1639
|
),
|
|
1544
|
-
|
|
1545
|
-
|
|
1640
|
+
h && /* @__PURE__ */ c("div", { className: "absolute z-50 mt-1 max-h-52 w-44 overflow-y-auto rounded-md border border-border bg-popover py-1 shadow-md", children: [
|
|
1641
|
+
g && /* @__PURE__ */ c(
|
|
1546
1642
|
"button",
|
|
1547
1643
|
{
|
|
1548
1644
|
type: "button",
|
|
1549
1645
|
onClick: () => {
|
|
1550
|
-
|
|
1646
|
+
x(null), $(!1);
|
|
1551
1647
|
},
|
|
1552
1648
|
className: "flex w-full items-center gap-1.5 border-b border-slate-100 px-2 py-1 text-left text-[12px] text-slate-500 hover:bg-muted dark:border-border dark:text-slate-400",
|
|
1553
1649
|
children: [
|
|
1554
|
-
/* @__PURE__ */ n(
|
|
1650
|
+
/* @__PURE__ */ n(at, { className: "h-3 w-3 text-slate-400" }),
|
|
1555
1651
|
" Clear"
|
|
1556
1652
|
]
|
|
1557
1653
|
}
|
|
1558
1654
|
),
|
|
1559
|
-
q.map(([
|
|
1655
|
+
q.map(([L, Z]) => /* @__PURE__ */ n(
|
|
1560
1656
|
"button",
|
|
1561
1657
|
{
|
|
1562
1658
|
type: "button",
|
|
1563
1659
|
onClick: () => {
|
|
1564
|
-
|
|
1660
|
+
x(L), $(!1);
|
|
1565
1661
|
},
|
|
1566
|
-
className:
|
|
1662
|
+
className: z(
|
|
1567
1663
|
"block w-full truncate px-2 py-1 text-left text-[12px] hover:bg-muted",
|
|
1568
|
-
|
|
1664
|
+
L === g ? "font-medium text-nvr-cyan" : "text-slate-700 dark:text-slate-200"
|
|
1569
1665
|
),
|
|
1570
1666
|
children: Z
|
|
1571
1667
|
},
|
|
1572
|
-
|
|
1668
|
+
L
|
|
1573
1669
|
))
|
|
1574
1670
|
] })
|
|
1575
1671
|
] });
|
|
1576
1672
|
}
|
|
1577
|
-
function
|
|
1578
|
-
catalogCol:
|
|
1579
|
-
tmpl:
|
|
1580
|
-
sectionBy:
|
|
1673
|
+
function Hr({
|
|
1674
|
+
catalogCol: u,
|
|
1675
|
+
tmpl: g,
|
|
1676
|
+
sectionBy: _,
|
|
1581
1677
|
sectionM2M: q,
|
|
1582
1678
|
pinnedSet: l,
|
|
1583
|
-
pinnedIds:
|
|
1584
|
-
savingIds:
|
|
1679
|
+
pinnedIds: x,
|
|
1680
|
+
savingIds: h,
|
|
1585
1681
|
relatedCols: $,
|
|
1586
|
-
parentDraft:
|
|
1587
|
-
onToggle:
|
|
1682
|
+
parentDraft: p,
|
|
1683
|
+
onToggle: L,
|
|
1588
1684
|
onClose: Z,
|
|
1589
|
-
anchor:
|
|
1685
|
+
anchor: B
|
|
1590
1686
|
}) {
|
|
1591
|
-
const
|
|
1592
|
-
|
|
1593
|
-
const
|
|
1594
|
-
return () => clearTimeout(
|
|
1595
|
-
}, [
|
|
1596
|
-
var
|
|
1597
|
-
(
|
|
1598
|
-
}, []),
|
|
1599
|
-
const
|
|
1600
|
-
|
|
1687
|
+
const A = $t(), [V, ce] = Y(""), [ne, ye] = Y(""), [C, ke] = Y(1), pe = ze(null);
|
|
1688
|
+
je(() => {
|
|
1689
|
+
const a = setTimeout(() => ye(V), 300);
|
|
1690
|
+
return () => clearTimeout(a);
|
|
1691
|
+
}, [V]), je(() => ke(1), [ne]), je(() => {
|
|
1692
|
+
var a;
|
|
1693
|
+
(a = pe.current) == null || a.focus();
|
|
1694
|
+
}, []), je(() => {
|
|
1695
|
+
const a = (w) => {
|
|
1696
|
+
w.key === "Escape" && (w.stopPropagation(), Z());
|
|
1601
1697
|
};
|
|
1602
|
-
return window.addEventListener("keydown",
|
|
1698
|
+
return window.addEventListener("keydown", a, !0), () => window.removeEventListener("keydown", a, !0);
|
|
1603
1699
|
}, [Z]);
|
|
1604
|
-
const G =
|
|
1605
|
-
var
|
|
1606
|
-
const
|
|
1607
|
-
return
|
|
1608
|
-
}, [
|
|
1609
|
-
queryKey: ["favorites-manager-list",
|
|
1610
|
-
queryFn: () =>
|
|
1611
|
-
|
|
1700
|
+
const G = O(() => {
|
|
1701
|
+
var w;
|
|
1702
|
+
const a = (w = [...(g ?? "").matchAll(/\{\{([\w.]+)\}\}/g)][0]) == null ? void 0 : w[1];
|
|
1703
|
+
return a && !a.includes(".") ? a : "id";
|
|
1704
|
+
}, [g]), se = !q && _.includes(".") ? `*,${_}` : "*", v = 50, { data: F, isFetching: j } = J({
|
|
1705
|
+
queryKey: ["favorites-manager-list", u, ne, G, C],
|
|
1706
|
+
queryFn: () => A.request(
|
|
1707
|
+
P(`/items/${u}`, {
|
|
1612
1708
|
fields: se,
|
|
1613
|
-
limit:
|
|
1614
|
-
page:
|
|
1709
|
+
limit: v,
|
|
1710
|
+
page: C,
|
|
1615
1711
|
sort: G,
|
|
1616
1712
|
...ne.trim() ? { search: ne } : {}
|
|
1617
1713
|
})
|
|
1618
1714
|
),
|
|
1619
1715
|
staleTime: 3e4,
|
|
1620
|
-
placeholderData: (
|
|
1621
|
-
}),
|
|
1622
|
-
queryKey: ["favorites-manager-pinned",
|
|
1623
|
-
queryFn: () =>
|
|
1624
|
-
|
|
1625
|
-
filter: JSON.stringify({ id: { _in:
|
|
1716
|
+
placeholderData: (a) => a
|
|
1717
|
+
}), D = ((F == null ? void 0 : F.data) ?? []).filter((a) => !l.has(String(a.id))), K = (F == null ? void 0 : F.total) ?? D.length, b = Math.max(1, Math.ceil(K / v)), { data: me = [] } = J({
|
|
1718
|
+
queryKey: ["favorites-manager-pinned", u, se, x.join(",")],
|
|
1719
|
+
queryFn: () => A.request(
|
|
1720
|
+
P(`/items/${u}`, {
|
|
1721
|
+
filter: JSON.stringify({ id: { _in: x } }),
|
|
1626
1722
|
fields: se,
|
|
1627
|
-
limit:
|
|
1723
|
+
limit: x.length,
|
|
1628
1724
|
sort: G
|
|
1629
1725
|
})
|
|
1630
|
-
).then((
|
|
1631
|
-
enabled:
|
|
1726
|
+
).then((a) => a.data ?? []),
|
|
1727
|
+
enabled: x.length > 0,
|
|
1632
1728
|
staleTime: 3e4
|
|
1633
|
-
}),
|
|
1634
|
-
const
|
|
1635
|
-
for (const
|
|
1636
|
-
for (const
|
|
1637
|
-
return [...
|
|
1638
|
-
}, [
|
|
1639
|
-
queryKey: ["favorites-manager-sections", q == null ? void 0 : q.junction,
|
|
1729
|
+
}), X = O(() => {
|
|
1730
|
+
const a = /* @__PURE__ */ new Set();
|
|
1731
|
+
for (const w of D) a.add(String(w.id));
|
|
1732
|
+
for (const w of x) a.add(w);
|
|
1733
|
+
return [...a];
|
|
1734
|
+
}, [D, x]), { data: U = /* @__PURE__ */ new Map() } = J({
|
|
1735
|
+
queryKey: ["favorites-manager-sections", q == null ? void 0 : q.junction, X.join(",")],
|
|
1640
1736
|
queryFn: async () => {
|
|
1641
|
-
const
|
|
1642
|
-
fields: `${
|
|
1643
|
-
filter: JSON.stringify({ [
|
|
1644
|
-
}),
|
|
1645
|
-
fields: `id,${
|
|
1646
|
-
filter: JSON.stringify({ id: { _in:
|
|
1647
|
-
}) : [],
|
|
1648
|
-
|
|
1649
|
-
),
|
|
1650
|
-
for (const
|
|
1651
|
-
const
|
|
1652
|
-
if (!
|
|
1653
|
-
const
|
|
1654
|
-
|
|
1737
|
+
const a = q, w = await it(A, `/items/${a.junction}`, {
|
|
1738
|
+
fields: `${a.fkToItem},${a.fkToSection}`,
|
|
1739
|
+
filter: JSON.stringify({ [a.fkToItem]: { _in: X } })
|
|
1740
|
+
}), E = [...new Set(w.map((M) => String(M[a.fkToSection])))], ie = E.length ? await it(A, `/items/${a.target}`, {
|
|
1741
|
+
fields: `id,${a.labelPath}`,
|
|
1742
|
+
filter: JSON.stringify({ id: { _in: E } })
|
|
1743
|
+
}) : [], te = new Map(
|
|
1744
|
+
ie.map((M) => [String(M.id), String(Xt(M, a.labelPath) ?? "")])
|
|
1745
|
+
), I = /* @__PURE__ */ new Map();
|
|
1746
|
+
for (const M of w) {
|
|
1747
|
+
const W = te.get(String(M[a.fkToSection]));
|
|
1748
|
+
if (!W) continue;
|
|
1749
|
+
const we = String(M[a.fkToItem]), Ne = I.get(we) ?? [];
|
|
1750
|
+
Ne.includes(W) || Ne.push(W), I.set(we, Ne);
|
|
1655
1751
|
}
|
|
1656
|
-
return
|
|
1752
|
+
return I;
|
|
1657
1753
|
},
|
|
1658
|
-
enabled: !!q &&
|
|
1754
|
+
enabled: !!q && X.length > 0,
|
|
1659
1755
|
staleTime: 6e4
|
|
1660
|
-
}),
|
|
1661
|
-
const
|
|
1662
|
-
return typeof
|
|
1663
|
-
},
|
|
1664
|
-
if (q) return (
|
|
1665
|
-
if (!
|
|
1666
|
-
const
|
|
1667
|
-
return
|
|
1668
|
-
},
|
|
1669
|
-
if (
|
|
1670
|
-
return
|
|
1671
|
-
if (
|
|
1672
|
-
const
|
|
1673
|
-
return
|
|
1674
|
-
},
|
|
1675
|
-
queries: $.map((
|
|
1676
|
-
const
|
|
1756
|
+
}), H = (a) => g ? Fe(g, a) : String(a.cifa_number ?? a.name ?? `#${a.id}`), R = (a) => {
|
|
1757
|
+
const w = a.description ?? a.long_description ?? a.name;
|
|
1758
|
+
return typeof w == "string" && w.trim() && w.trim() !== H(a) ? w : "";
|
|
1759
|
+
}, ue = (a) => {
|
|
1760
|
+
if (q) return (U.get(String(a.id)) ?? []).join(", ");
|
|
1761
|
+
if (!_) return "";
|
|
1762
|
+
const w = Fe(`{{${_}}}`, a);
|
|
1763
|
+
return w === `{{${_}}}` ? "" : w;
|
|
1764
|
+
}, Ve = (a, w) => {
|
|
1765
|
+
if (w === "presence")
|
|
1766
|
+
return a == null || a === "" || Number(a) === 0 ? "No" : "Yes";
|
|
1767
|
+
if (a == null || a === "") return "—";
|
|
1768
|
+
const E = Number(a);
|
|
1769
|
+
return w === "currency" && Number.isFinite(E) ? E.toLocaleString("en-US", { style: "currency", currency: "USD" }) : w === "number" && Number.isFinite(E) ? E.toLocaleString() : String(a);
|
|
1770
|
+
}, Q = St({
|
|
1771
|
+
queries: $.map((a) => {
|
|
1772
|
+
const w = Be(a.match, p);
|
|
1677
1773
|
return {
|
|
1678
1774
|
queryKey: [
|
|
1679
1775
|
"favorites-manager-related",
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
JSON.stringify(
|
|
1683
|
-
|
|
1776
|
+
a.key,
|
|
1777
|
+
a.collection,
|
|
1778
|
+
JSON.stringify(w),
|
|
1779
|
+
X.join(",")
|
|
1684
1780
|
],
|
|
1685
1781
|
queryFn: async () => {
|
|
1686
|
-
const
|
|
1687
|
-
|
|
1688
|
-
filter: JSON.stringify({ [
|
|
1689
|
-
fields: `${
|
|
1782
|
+
const E = await A.request(
|
|
1783
|
+
P(`/items/${a.collection}`, {
|
|
1784
|
+
filter: JSON.stringify({ [a.item_field]: { _in: X }, ...w ?? {} }),
|
|
1785
|
+
fields: `${a.item_field},${a.value_field}`,
|
|
1690
1786
|
limit: 1e3
|
|
1691
1787
|
})
|
|
1692
|
-
).then((
|
|
1693
|
-
for (const
|
|
1694
|
-
const
|
|
1695
|
-
|
|
1788
|
+
).then((te) => te.data ?? []), ie = /* @__PURE__ */ new Map();
|
|
1789
|
+
for (const te of E) {
|
|
1790
|
+
const I = String(te[a.item_field]), M = te[a.value_field], W = ie.get(I);
|
|
1791
|
+
W === void 0 ? ie.set(I, M) : Number.isFinite(Number(W)) && Number.isFinite(Number(M)) && ie.set(I, Number(W) + Number(M));
|
|
1696
1792
|
}
|
|
1697
|
-
return
|
|
1793
|
+
return ie;
|
|
1698
1794
|
},
|
|
1699
|
-
enabled:
|
|
1795
|
+
enabled: X.length > 0 && (a.match === void 0 || w !== null),
|
|
1700
1796
|
staleTime: 3e4
|
|
1701
1797
|
};
|
|
1702
1798
|
})
|
|
1703
|
-
}),
|
|
1704
|
-
(
|
|
1705
|
-
),
|
|
1706
|
-
const
|
|
1799
|
+
}), ee = $.filter(
|
|
1800
|
+
(a) => a.match !== void 0 && Be(a.match, p) === null
|
|
1801
|
+
), Te = (a) => {
|
|
1802
|
+
const w = l.has(a);
|
|
1707
1803
|
return /* @__PURE__ */ n(
|
|
1708
1804
|
"button",
|
|
1709
1805
|
{
|
|
1710
1806
|
type: "button",
|
|
1711
|
-
title:
|
|
1712
|
-
disabled:
|
|
1713
|
-
onClick: () =>
|
|
1807
|
+
title: w ? "Remove from favorites" : "Add to favorites",
|
|
1808
|
+
disabled: h.has(a),
|
|
1809
|
+
onClick: () => L(a),
|
|
1714
1810
|
className: "shrink-0 rounded p-1 transition-colors hover:bg-amber-100/60 dark:hover:bg-amber-400/10",
|
|
1715
|
-
children:
|
|
1716
|
-
|
|
1811
|
+
children: h.has(a) ? /* @__PURE__ */ n(oe, { className: "h-4 w-4 animate-spin text-amber-400" }) : /* @__PURE__ */ n(
|
|
1812
|
+
Qe,
|
|
1717
1813
|
{
|
|
1718
|
-
className:
|
|
1814
|
+
className: z(
|
|
1719
1815
|
"h-4 w-4",
|
|
1720
|
-
|
|
1816
|
+
w ? "fill-amber-400 text-amber-400" : "text-slate-300 hover:text-amber-400"
|
|
1721
1817
|
)
|
|
1722
1818
|
}
|
|
1723
1819
|
)
|
|
1724
1820
|
}
|
|
1725
1821
|
);
|
|
1726
|
-
},
|
|
1727
|
-
const
|
|
1822
|
+
}, he = (a, w) => /* @__PURE__ */ n("tr", { children: /* @__PURE__ */ n("td", { colSpan: 4 + $.length, className: z("border-b px-3 py-1.5", w), children: a }) }), ae = (a, w) => {
|
|
1823
|
+
const E = String(a.id), ie = R(a);
|
|
1728
1824
|
return /* @__PURE__ */ c(
|
|
1729
1825
|
"tr",
|
|
1730
1826
|
{
|
|
1731
|
-
className:
|
|
1827
|
+
className: z(
|
|
1732
1828
|
"border-b border-slate-100 dark:border-border/50",
|
|
1733
|
-
|
|
1829
|
+
w % 2 === 0 ? "bg-white dark:bg-background" : "bg-slate-50/50 dark:bg-muted/30"
|
|
1734
1830
|
),
|
|
1735
1831
|
children: [
|
|
1736
|
-
/* @__PURE__ */ n("td", { className: "px-2 py-1", children:
|
|
1737
|
-
/* @__PURE__ */ n("td", { className: "px-2 py-1 font-medium tabular-nums text-slate-700 dark:text-slate-200", children:
|
|
1832
|
+
/* @__PURE__ */ n("td", { className: "px-2 py-1", children: Te(E) }),
|
|
1833
|
+
/* @__PURE__ */ n("td", { className: "px-2 py-1 font-medium tabular-nums text-slate-700 dark:text-slate-200", children: Zt(u) ? /* @__PURE__ */ n(
|
|
1738
1834
|
"button",
|
|
1739
1835
|
{
|
|
1740
1836
|
type: "button",
|
|
1741
|
-
onClick: () =>
|
|
1837
|
+
onClick: () => Gt(u, E, p),
|
|
1742
1838
|
title: "View stock & planning detail",
|
|
1743
1839
|
className: "text-left underline decoration-slate-300 decoration-1 underline-offset-2 hover:text-[#009abe] hover:decoration-[#009abe] dark:decoration-slate-600",
|
|
1744
|
-
children:
|
|
1840
|
+
children: H(a)
|
|
1745
1841
|
}
|
|
1746
|
-
) :
|
|
1747
|
-
/* @__PURE__ */ n("td", { className: "max-w-0 px-2 py-1", children: /* @__PURE__ */ n("p", { className: "truncate text-slate-600 dark:text-slate-300", "data-tip":
|
|
1748
|
-
/* @__PURE__ */ n("td", { className: "px-2 py-1", children: /* @__PURE__ */ n("p", { className: "truncate text-slate-500 dark:text-slate-400", children:
|
|
1749
|
-
$.map((
|
|
1750
|
-
var
|
|
1751
|
-
const
|
|
1842
|
+
) : H(a) }),
|
|
1843
|
+
/* @__PURE__ */ n("td", { className: "max-w-0 px-2 py-1", children: /* @__PURE__ */ n("p", { className: "truncate text-slate-600 dark:text-slate-300", "data-tip": ie || void 0, children: ie || "—" }) }),
|
|
1844
|
+
/* @__PURE__ */ n("td", { className: "px-2 py-1", children: /* @__PURE__ */ n("p", { className: "truncate text-slate-500 dark:text-slate-400", children: ue(a) || "—" }) }),
|
|
1845
|
+
$.map((te, I) => {
|
|
1846
|
+
var we, Ne;
|
|
1847
|
+
const M = te.match !== void 0 && Be(te.match, p) === null, W = M || (Ne = (we = Q[I]) == null ? void 0 : we.data) == null ? void 0 : Ne.get(E);
|
|
1752
1848
|
return /* @__PURE__ */ n(
|
|
1753
1849
|
"td",
|
|
1754
1850
|
{
|
|
1755
1851
|
className: "whitespace-nowrap px-2 py-1 text-right tabular-nums text-slate-600 dark:text-slate-300",
|
|
1756
|
-
children:
|
|
1852
|
+
children: M ? "—" : Ve(W, te.format)
|
|
1757
1853
|
},
|
|
1758
|
-
|
|
1854
|
+
te.key
|
|
1759
1855
|
);
|
|
1760
1856
|
})
|
|
1761
1857
|
]
|
|
1762
1858
|
},
|
|
1763
|
-
|
|
1859
|
+
E
|
|
1764
1860
|
);
|
|
1765
|
-
},
|
|
1766
|
-
return
|
|
1861
|
+
}, xe = (B == null ? void 0 : B.closest('[role="dialog"]')) ?? document.body, Oe = V.trim() ? me.filter((a) => Pr(`${H(a)} ${R(a)} ${ue(a)}`, V)) : me;
|
|
1862
|
+
return _r(
|
|
1767
1863
|
/* @__PURE__ */ c("div", { className: "fixed inset-0 z-[125]", role: "presentation", children: [
|
|
1768
1864
|
/* @__PURE__ */ n(
|
|
1769
1865
|
"div",
|
|
@@ -1781,7 +1877,7 @@ function Rr({
|
|
|
1781
1877
|
className: "absolute inset-y-0 right-0 flex flex-col border-l border-slate-200 bg-white shadow-2xl motion-safe:animate-in motion-safe:slide-in-from-right dark:border-border dark:bg-background",
|
|
1782
1878
|
children: [
|
|
1783
1879
|
/* @__PURE__ */ c("div", { className: "flex items-start gap-2.5 border-b border-slate-200 px-4 py-3 dark:border-border", children: [
|
|
1784
|
-
/* @__PURE__ */ n(
|
|
1880
|
+
/* @__PURE__ */ n(Qe, { className: "mt-0.5 h-4 w-4 shrink-0 fill-amber-400 text-amber-400" }),
|
|
1785
1881
|
/* @__PURE__ */ c("div", { className: "min-w-0 flex-1", children: [
|
|
1786
1882
|
/* @__PURE__ */ n("p", { className: "text-[13px] font-semibold text-slate-800 dark:text-slate-100", children: "CIFA favorites" }),
|
|
1787
1883
|
/* @__PURE__ */ n("p", { className: "text-[11px] leading-snug text-slate-500 dark:text-slate-400", children: "Browse the full catalog and star items — favorites appear at the top of every request's item list." })
|
|
@@ -1793,37 +1889,37 @@ function Rr({
|
|
|
1793
1889
|
onClick: Z,
|
|
1794
1890
|
className: "shrink-0 rounded p-1 text-slate-400 transition-colors hover:bg-slate-100 hover:text-slate-600 dark:hover:bg-white/[0.06]",
|
|
1795
1891
|
"aria-label": "Close",
|
|
1796
|
-
children: /* @__PURE__ */ n(
|
|
1892
|
+
children: /* @__PURE__ */ n(at, { className: "h-4 w-4" })
|
|
1797
1893
|
}
|
|
1798
1894
|
)
|
|
1799
1895
|
] }),
|
|
1800
1896
|
/* @__PURE__ */ c("div", { className: "border-b border-slate-200 px-3 py-2 dark:border-border", children: [
|
|
1801
1897
|
/* @__PURE__ */ c("div", { className: "flex items-center gap-2 rounded-md border border-slate-200 bg-slate-50 px-2.5 py-1.5 focus-within:border-nvr-cyan focus-within:bg-white dark:border-border dark:bg-muted/40 dark:focus-within:bg-background", children: [
|
|
1802
|
-
/* @__PURE__ */ n(
|
|
1898
|
+
/* @__PURE__ */ n(st, { className: "h-3.5 w-3.5 shrink-0 text-slate-400" }),
|
|
1803
1899
|
/* @__PURE__ */ n(
|
|
1804
1900
|
"input",
|
|
1805
1901
|
{
|
|
1806
|
-
ref:
|
|
1807
|
-
value:
|
|
1808
|
-
onChange: (
|
|
1902
|
+
ref: pe,
|
|
1903
|
+
value: V,
|
|
1904
|
+
onChange: (a) => ce(a.target.value),
|
|
1809
1905
|
placeholder: "Search by number or description…",
|
|
1810
1906
|
className: "min-w-0 flex-1 bg-transparent text-[12px] text-slate-700 outline-none placeholder:text-slate-400 dark:text-slate-200"
|
|
1811
1907
|
}
|
|
1812
1908
|
),
|
|
1813
|
-
|
|
1909
|
+
V && /* @__PURE__ */ n(
|
|
1814
1910
|
"button",
|
|
1815
1911
|
{
|
|
1816
1912
|
type: "button",
|
|
1817
|
-
onClick: () =>
|
|
1913
|
+
onClick: () => ce(""),
|
|
1818
1914
|
className: "shrink-0 text-slate-400 hover:text-slate-600",
|
|
1819
1915
|
"aria-label": "Clear search",
|
|
1820
|
-
children: /* @__PURE__ */ n(
|
|
1916
|
+
children: /* @__PURE__ */ n(at, { className: "h-3.5 w-3.5" })
|
|
1821
1917
|
}
|
|
1822
1918
|
)
|
|
1823
1919
|
] }),
|
|
1824
|
-
|
|
1825
|
-
/* @__PURE__ */ n(
|
|
1826
|
-
|
|
1920
|
+
ee.length > 0 && /* @__PURE__ */ c("p", { className: "mt-1.5 flex items-center gap-1 text-[10px] text-amber-600 dark:text-amber-400", children: [
|
|
1921
|
+
/* @__PURE__ */ n(Je, { className: "h-3 w-3 shrink-0" }),
|
|
1922
|
+
ee.map((a) => a.label ?? re(a.key)).join(", "),
|
|
1827
1923
|
" fill in once the form's warehouse selection is made."
|
|
1828
1924
|
] })
|
|
1829
1925
|
] }),
|
|
@@ -1833,43 +1929,43 @@ function Rr({
|
|
|
1833
1929
|
/* @__PURE__ */ n("col", { className: "w-[88px]" }),
|
|
1834
1930
|
/* @__PURE__ */ n("col", {}),
|
|
1835
1931
|
/* @__PURE__ */ n("col", { className: "w-[130px]" }),
|
|
1836
|
-
$.map((
|
|
1932
|
+
$.map((a) => /* @__PURE__ */ n("col", { className: "w-[86px]" }, a.key))
|
|
1837
1933
|
] }),
|
|
1838
1934
|
/* @__PURE__ */ n("thead", { className: "sticky top-0 z-[1]", children: /* @__PURE__ */ c("tr", { className: "bg-slate-100 text-left text-[10px] font-semibold uppercase tracking-wide text-slate-500 dark:bg-muted dark:text-slate-400", children: [
|
|
1839
1935
|
/* @__PURE__ */ n("th", { className: "px-2 py-1.5", "aria-label": "Favorite" }),
|
|
1840
1936
|
/* @__PURE__ */ n("th", { className: "px-2 py-1.5", children: "CIFA #" }),
|
|
1841
1937
|
/* @__PURE__ */ n("th", { className: "px-2 py-1.5", children: "Description" }),
|
|
1842
1938
|
/* @__PURE__ */ n("th", { className: "px-2 py-1.5", children: "Category" }),
|
|
1843
|
-
$.map((
|
|
1939
|
+
$.map((a) => /* @__PURE__ */ n("th", { className: "px-2 py-1.5 text-right", children: a.label ?? re(a.key) }, a.key))
|
|
1844
1940
|
] }) }),
|
|
1845
|
-
/* @__PURE__ */ c("tbody", { className:
|
|
1846
|
-
|
|
1941
|
+
/* @__PURE__ */ c("tbody", { className: z(j && "opacity-50 transition-opacity"), children: [
|
|
1942
|
+
he(
|
|
1847
1943
|
/* @__PURE__ */ c("span", { className: "flex items-center gap-1.5", children: [
|
|
1848
|
-
/* @__PURE__ */ n(
|
|
1944
|
+
/* @__PURE__ */ n(Qe, { className: "h-3 w-3 shrink-0 fill-amber-400 text-amber-400" }),
|
|
1849
1945
|
/* @__PURE__ */ n("span", { className: "text-[11px] font-semibold text-slate-600 dark:text-slate-300", children: "Your favorites" }),
|
|
1850
|
-
/* @__PURE__ */ n("span", { className: "rounded border border-slate-200 bg-white px-1.5 py-0.5 text-[10px] font-medium tabular-nums text-slate-500 dark:border-border dark:bg-background dark:text-slate-400", children:
|
|
1946
|
+
/* @__PURE__ */ n("span", { className: "rounded border border-slate-200 bg-white px-1.5 py-0.5 text-[10px] font-medium tabular-nums text-slate-500 dark:border-border dark:bg-background dark:text-slate-400", children: x.length })
|
|
1851
1947
|
] }),
|
|
1852
1948
|
"border-slate-200 bg-amber-50/70 dark:border-border dark:bg-amber-900/10"
|
|
1853
1949
|
),
|
|
1854
|
-
|
|
1950
|
+
Oe.length === 0 && /* @__PURE__ */ n("tr", { children: /* @__PURE__ */ n(
|
|
1855
1951
|
"td",
|
|
1856
1952
|
{
|
|
1857
1953
|
colSpan: 4 + $.length,
|
|
1858
1954
|
className: "border-b border-slate-100 px-4 py-3 text-center text-[11px] text-slate-400 dark:border-border/50",
|
|
1859
|
-
children:
|
|
1955
|
+
children: x.length === 0 ? "No favorites yet — star the items you order most." : "No favorites match your search."
|
|
1860
1956
|
}
|
|
1861
1957
|
) }),
|
|
1862
|
-
|
|
1863
|
-
|
|
1958
|
+
Oe.map((a, w) => ae(a, w)),
|
|
1959
|
+
he(
|
|
1864
1960
|
/* @__PURE__ */ c("span", { className: "flex items-center gap-1.5", children: [
|
|
1865
|
-
/* @__PURE__ */ n(
|
|
1961
|
+
/* @__PURE__ */ n(st, { className: "h-3 w-3 shrink-0 text-slate-400" }),
|
|
1866
1962
|
/* @__PURE__ */ n("span", { className: "text-[11px] font-semibold text-slate-600 dark:text-slate-300", children: "All CIFAs" }),
|
|
1867
|
-
/* @__PURE__ */ n("span", { className: "rounded border border-slate-200 bg-white px-1.5 py-0.5 text-[10px] font-medium tabular-nums text-slate-500 dark:border-border dark:bg-background dark:text-slate-400", children:
|
|
1868
|
-
|
|
1963
|
+
/* @__PURE__ */ n("span", { className: "rounded border border-slate-200 bg-white px-1.5 py-0.5 text-[10px] font-medium tabular-nums text-slate-500 dark:border-border dark:bg-background dark:text-slate-400", children: K.toLocaleString() }),
|
|
1964
|
+
j && /* @__PURE__ */ n(oe, { className: "h-3 w-3 animate-spin text-slate-400" })
|
|
1869
1965
|
] }),
|
|
1870
1966
|
"border-t border-slate-200 bg-slate-50 dark:border-border dark:bg-muted/40"
|
|
1871
1967
|
),
|
|
1872
|
-
!
|
|
1968
|
+
!j && D.length === 0 && /* @__PURE__ */ n("tr", { children: /* @__PURE__ */ n(
|
|
1873
1969
|
"td",
|
|
1874
1970
|
{
|
|
1875
1971
|
colSpan: 4 + $.length,
|
|
@@ -1877,19 +1973,19 @@ function Rr({
|
|
|
1877
1973
|
children: ne.trim() ? `No CIFAs match "${ne}".` : "No catalog items."
|
|
1878
1974
|
}
|
|
1879
1975
|
) }),
|
|
1880
|
-
|
|
1976
|
+
D.map((a, w) => ae(a, w))
|
|
1881
1977
|
] })
|
|
1882
1978
|
] }) }),
|
|
1883
|
-
|
|
1979
|
+
b > 1 && /* @__PURE__ */ c("div", { className: "flex shrink-0 items-center justify-between border-t border-slate-200 px-3 py-2 dark:border-border", children: [
|
|
1884
1980
|
/* @__PURE__ */ c("span", { className: "flex items-center gap-2 text-[10px] tabular-nums text-slate-400", children: [
|
|
1885
|
-
(
|
|
1981
|
+
(C - 1) * v + 1,
|
|
1886
1982
|
"–",
|
|
1887
|
-
Math.min(
|
|
1983
|
+
Math.min(C * v, K),
|
|
1888
1984
|
" of",
|
|
1889
1985
|
" ",
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
/* @__PURE__ */ n(
|
|
1986
|
+
K.toLocaleString(),
|
|
1987
|
+
j && /* @__PURE__ */ c("span", { className: "flex items-center gap-1 text-slate-500", children: [
|
|
1988
|
+
/* @__PURE__ */ n(oe, { className: "h-3 w-3 animate-spin" }),
|
|
1893
1989
|
" Loading…"
|
|
1894
1990
|
] })
|
|
1895
1991
|
] }),
|
|
@@ -1898,23 +1994,23 @@ function Rr({
|
|
|
1898
1994
|
"button",
|
|
1899
1995
|
{
|
|
1900
1996
|
type: "button",
|
|
1901
|
-
disabled:
|
|
1902
|
-
onClick: () =>
|
|
1997
|
+
disabled: C <= 1 || j,
|
|
1998
|
+
onClick: () => ke((a) => Math.max(1, a - 1)),
|
|
1903
1999
|
className: "rounded border border-slate-200 px-2 py-0.5 text-[11px] text-slate-600 transition-colors hover:bg-slate-50 disabled:opacity-40 dark:border-border dark:text-slate-300 dark:hover:bg-white/[0.04]",
|
|
1904
2000
|
children: "‹ Prev"
|
|
1905
2001
|
}
|
|
1906
2002
|
),
|
|
1907
2003
|
/* @__PURE__ */ c("span", { className: "px-1 text-[10px] tabular-nums text-slate-400", children: [
|
|
1908
|
-
|
|
2004
|
+
C,
|
|
1909
2005
|
" / ",
|
|
1910
|
-
|
|
2006
|
+
b.toLocaleString()
|
|
1911
2007
|
] }),
|
|
1912
2008
|
/* @__PURE__ */ n(
|
|
1913
2009
|
"button",
|
|
1914
2010
|
{
|
|
1915
2011
|
type: "button",
|
|
1916
|
-
disabled:
|
|
1917
|
-
onClick: () =>
|
|
2012
|
+
disabled: C >= b || j,
|
|
2013
|
+
onClick: () => ke((a) => Math.min(b, a + 1)),
|
|
1918
2014
|
className: "rounded border border-slate-200 px-2 py-0.5 text-[11px] text-slate-600 transition-colors hover:bg-slate-50 disabled:opacity-40 dark:border-border dark:text-slate-300 dark:hover:bg-white/[0.04]",
|
|
1919
2015
|
children: "Next ›"
|
|
1920
2016
|
}
|
|
@@ -1925,10 +2021,10 @@ function Rr({
|
|
|
1925
2021
|
}
|
|
1926
2022
|
)
|
|
1927
2023
|
] }),
|
|
1928
|
-
|
|
2024
|
+
xe
|
|
1929
2025
|
);
|
|
1930
2026
|
}
|
|
1931
2027
|
export {
|
|
1932
|
-
|
|
1933
|
-
|
|
2028
|
+
bn as CatalogPickerField,
|
|
2029
|
+
Yt as matchesShowWhen
|
|
1934
2030
|
};
|