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