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