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