@nivaro/react 0.3.139 → 0.3.141
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 +95 -92
- package/dist/full.css +1 -1
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +39 -2
- package/dist/shared/components/AudienceConfirmPanel.js +19 -19
- package/dist/shared/components/BroadcastView.js +213 -211
- package/dist/shared/components/CollectionBrowserView.js +2702 -2671
- package/dist/shared/components/ConfigHistory.js +45 -45
- package/dist/shared/components/ConformanceView.js +110 -110
- package/dist/shared/components/DataTable.js +51 -51
- package/dist/shared/components/FilePreviewLightbox.js +26 -25
- package/dist/shared/components/ItemEditForm.js +3475 -3458
- package/dist/shared/components/LiveCount.js +27 -23
- package/dist/shared/components/LiveTraceView.js +62 -61
- package/dist/shared/components/PageRenderer.js +422 -410
- package/dist/shared/components/ProfileView.js +199 -199
- package/dist/shared/components/QualityRulesView.js +70 -70
- package/dist/shared/components/QueryTable.js +131 -130
- package/dist/shared/components/RecordGraph.js +98 -98
- package/dist/shared/components/RecordReadView.js +287 -288
- package/dist/shared/components/ReportView.js +1279 -1259
- package/dist/shared/components/RowPresence.js +83 -76
- package/dist/shared/components/SlaRulesView.js +73 -74
- package/dist/shared/components/UnseenDot.js +183 -22
- package/dist/shared/components/WidgetSlot.js +73 -73
- package/dist/shared/components/ai/AiChart.js +36 -32
- package/dist/shared/components/ai/AiMarkdown.js +136 -129
- package/dist/shared/components/ai/TaskDo.js +87 -87
- package/dist/shared/components/ai/answer-formats.js +37 -30
- package/dist/shared/components/ai/call-log/format.js +17 -16
- package/dist/shared/components/bulk/BulkActionButtons.js +66 -66
- package/dist/shared/components/bulk/BulkFieldUpdate.js +59 -59
- package/dist/shared/components/bulk/BulkSelectionNotices.js +34 -34
- package/dist/shared/components/bulk/MessageStakeholders.js +31 -29
- package/dist/shared/components/bulk/PushBulkButtons.js +83 -82
- package/dist/shared/components/bulk/bulk-field-options.js +10 -10
- package/dist/shared/components/cbv/column-totals.js +53 -51
- package/dist/shared/components/chat/ChatAnalyticsView.js +87 -87
- package/dist/shared/components/collections-directory/CollectionsToolbar.js +18 -18
- package/dist/shared/components/command-center/announce.js +7 -6
- package/dist/shared/components/command-center/panels/AttentionPanel.js +32 -31
- package/dist/shared/components/command-center/panels/FlowPanel.js +29 -28
- package/dist/shared/components/command-center/panels/PeoplePanel.js +39 -39
- package/dist/shared/components/delegation/DelegationConsoleView.js +27 -27
- package/dist/shared/components/delivery-analytics/drill.js +32 -32
- package/dist/shared/components/imports/RunDetailSheet.js +1 -1
- package/dist/shared/components/integrations/IntegrationObligationsView.js +119 -119
- package/dist/shared/components/integrations/console/EventsView.js +35 -35
- package/dist/shared/components/integrations/console/FirefightView.js +15 -14
- package/dist/shared/components/integrations/console/PartnerDetail.js +78 -78
- package/dist/shared/components/integrations/console/ReadyToSendView.js +103 -103
- package/dist/shared/components/integrations/console/SignalCard.js +67 -67
- package/dist/shared/components/item-edit/CatalogPickerField.js +536 -527
- package/dist/shared/components/item-edit/ChangesTray.js +88 -74
- package/dist/shared/components/item-edit/FilePickerField.js +123 -123
- package/dist/shared/components/item-edit/GroupSection.js +301 -292
- package/dist/shared/components/item-edit/HeaderSummaryChip.js +54 -54
- package/dist/shared/components/item-edit/InlineGridField.js +45 -36
- package/dist/shared/components/item-edit/InlineTableField.js +1390 -1376
- package/dist/shared/components/item-edit/NestedRelationEditor.js +106 -99
- package/dist/shared/components/item-edit/RecordChatMentionsChip.js +11 -11
- package/dist/shared/components/item-edit/RecordRecapChanges.js +116 -74
- package/dist/shared/components/item-edit/RecordRecapStrip.js +148 -160
- package/dist/shared/components/item-edit/summary-layout-request.js +15 -0
- package/dist/shared/components/layout-editor/ai-forms/SlimPanel.js +43 -44
- package/dist/shared/components/layout-editor/parity-keys.json.js +1 -1
- package/dist/shared/components/layout-editor/settings/ResolveSettings.js +226 -157
- package/dist/shared/components/layout-editor/settings/WhoSection.js +53 -52
- package/dist/shared/components/layout-editor/settings/controls.js +98 -90
- package/dist/shared/components/layout-editor/settings/settings-registry.js +8 -0
- package/dist/shared/components/monitoring/ApiRequestLog.js +35 -35
- package/dist/shared/components/notifications/NotificationCenterView.js +268 -268
- package/dist/shared/components/ops-report/format.js +37 -36
- package/dist/shared/components/panels/ReferencedByPanel.js +21 -20
- package/dist/shared/components/panels/RevisionsPanel.js +306 -305
- package/dist/shared/components/pipeline/OwnerMatrixVersionsCard.js +12 -12
- package/dist/shared/components/pipeline/PipelineEditorView.js +483 -482
- package/dist/shared/components/pipeline/PipelineHealthCards.js +33 -32
- package/dist/shared/components/pipeline/TeamsView.js +189 -130
- package/dist/shared/components/profile/AgentsPanel.js +6 -6
- package/dist/shared/components/profile/DelegationCard.js +13 -12
- package/dist/shared/components/profile/PersonActivity.js +48 -48
- package/dist/shared/components/profile/PersonExtras.js +107 -107
- package/dist/shared/components/profile/PersonWeek.js +9 -9
- package/dist/shared/components/queue/QueueBulkBar.js +19 -18
- package/dist/shared/components/queue/QueueBulkMove.js +21 -20
- package/dist/shared/components/queue/QueueItemSheet.js +136 -131
- package/dist/shared/components/queue/QueueWorklist.js +884 -872
- package/dist/shared/components/queue/worklist-helpers.js +36 -21
- package/dist/shared/components/support/RequestList.js +123 -123
- package/dist/shared/components/support/SupportAnalytics.js +29 -29
- package/dist/shared/lib/activity-sentence.js +251 -229
- package/dist/shared/lib/format-value.js +5 -4
- package/dist/shared/lib/layout-resolve.js +64 -48
- package/dist/shared/lib/number-format.js +87 -0
- package/dist/shared/lib/number-kind.js +133 -0
- package/dist/shared/lib/utils.js +24 -20
- package/dist/shared/lib/watch-list.js +1 -1
- package/dist/shared/lib/widget-value-format.js +26 -12
- package/package.json +1 -1
|
@@ -1,66 +1,67 @@
|
|
|
1
1
|
import { jsxs as u, jsx as a, Fragment as Se } from "react/jsx-runtime";
|
|
2
|
-
import { useQueryClient as
|
|
3
|
-
import { Search as At, Loader2 as ue, PackageCheck as
|
|
4
|
-
import { useState as
|
|
5
|
-
import { createPortal as
|
|
6
|
-
import { useNivaroClient as ht, useParentDraft as
|
|
7
|
-
import { canOpenCatalogItem as
|
|
8
|
-
import { get as A, del as
|
|
9
|
-
import { evaluateBoolean as
|
|
10
|
-
import { useLiveRefetchInterval as
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
2
|
+
import { useQueryClient as os, useQuery as Q, useQueries as yn } from "@tanstack/react-query";
|
|
3
|
+
import { Search as At, Loader2 as ue, PackageCheck as ds, ChevronRight as Jt, Star as ft, AlertTriangle as Ke, AlertCircle as hn, X as pt, Plus as yr, ChevronDown as cs } from "lucide-react";
|
|
4
|
+
import { useState as H, useRef as je, useMemo as R, useEffect as Fe, Fragment as ut } from "react";
|
|
5
|
+
import { createPortal as us } from "react-dom";
|
|
6
|
+
import { useNivaroClient as ht, useParentDraft as ms, useReimportHandler as fs, useItemEditAuth as mr } from "../../context.js";
|
|
7
|
+
import { canOpenCatalogItem as gr, openCatalogItem as kr } from "../../lib/catalog-item-open.js";
|
|
8
|
+
import { get as A, del as ps, patch as fr, post as pr } from "../../lib/commands.js";
|
|
9
|
+
import { evaluateBoolean as hs } from "../../lib/expression.js";
|
|
10
|
+
import { useLiveRefetchInterval as bs } from "../../lib/live-queries.js";
|
|
11
|
+
import { formatCurrency as xs, formatFieldNumber as ys } from "../../lib/number-format.js";
|
|
12
|
+
import { fetchCollectionRelations as gn, queryKeys as Kt } from "../../lib/query-keys.js";
|
|
13
|
+
import { tokenize as gs, matchesSearch as ks } from "../../lib/search-text.js";
|
|
14
|
+
import { registerStagedRowLabel as ws } from "../../lib/staged-row-labels.js";
|
|
15
|
+
import { submissionLineErrors as Ns, normalizeIdent as vs } from "../../lib/submission-errors.js";
|
|
16
|
+
import { titleCase as G, cn as V, formatNumber as bn, matchesAllTokens as Ss } from "../../lib/utils.js";
|
|
17
|
+
import { ImportFromFileButton as _s } from "../import/ImportFromFileButton.js";
|
|
18
|
+
import { SearchHighlight as kn } from "../SearchHighlight.js";
|
|
19
|
+
import { useOverflowTip as qs } from "../TipLayer.js";
|
|
20
|
+
import { useColumnWidths as hr, ResetColumnsButton as xn, ColResizeHandle as $s, fitWidth as js } from "./catalog-columns.js";
|
|
21
|
+
import { facetsComplete as Fs, facetResults as Ts, facetOptions as Rs, setFacetPick as Os } from "./catalog-facets.js";
|
|
22
|
+
import { usePlaceName as Ps, useCatalogLineLive as Ls, stockShortText as Es, catalogPriceText as Cs, linePriceChange as Ks } from "./catalog-line-watch.js";
|
|
23
|
+
import { orderCatalogMatches as As, rowMatchesFields as Js } from "./catalog-search.js";
|
|
23
24
|
import { applyDisplayTemplate as Ae } from "./helpers.js";
|
|
24
25
|
import { evalClientFormula as Ee } from "./InlineTableField.js";
|
|
25
|
-
import { isIntegerFieldType as mt, checkNumberEntry as
|
|
26
|
-
import { resolveM2MRelatedCollection as
|
|
27
|
-
import { useO2MStaging as
|
|
28
|
-
import { RelationCombobox as
|
|
29
|
-
const
|
|
30
|
-
let
|
|
26
|
+
import { isIntegerFieldType as mt, checkNumberEntry as wn, mergePendingQtyRow as Is, decimalPlacesProblem as Qs, lineRuleErrors as zs, MAX_LINE_MONEY as Us } from "./line-qty.js";
|
|
27
|
+
import { resolveM2MRelatedCollection as Ms } from "./M2MCombobox.js";
|
|
28
|
+
import { useO2MStaging as Vs } from "./O2MStagingContext.js";
|
|
29
|
+
import { RelationCombobox as Ws, RelatedItemLabel as Bs } from "./RelationCombobox.js";
|
|
30
|
+
const wr = (i, m) => {
|
|
31
|
+
let f = i;
|
|
31
32
|
for (const g of m.split(".")) {
|
|
32
|
-
if (
|
|
33
|
-
|
|
33
|
+
if (f == null || typeof f != "object") return;
|
|
34
|
+
f = f[g];
|
|
34
35
|
}
|
|
35
|
-
return
|
|
36
|
+
return f;
|
|
36
37
|
};
|
|
37
|
-
async function It(i, m,
|
|
38
|
+
async function It(i, m, f) {
|
|
38
39
|
const g = [];
|
|
39
40
|
for (let _ = 1; _ <= 50; _++) {
|
|
40
|
-
const s = await i.request(A(m, { ...
|
|
41
|
+
const s = await i.request(A(m, { ...f, limit: 1e3, page: _ })).then((k) => k.data ?? []);
|
|
41
42
|
if (g.push(...s), s.length < 1e3) break;
|
|
42
43
|
}
|
|
43
44
|
return g;
|
|
44
45
|
}
|
|
45
|
-
function
|
|
46
|
+
function Ds(i, m, f, g) {
|
|
46
47
|
const _ = {}, s = { ...g ?? {} };
|
|
47
48
|
for (const k of m) {
|
|
48
49
|
const w = i[k], O = w == null || w === "", v = !O && (g == null ? void 0 : g[k]) !== void 0 && g[k] === String(w);
|
|
49
50
|
if (!O && !v) continue;
|
|
50
|
-
const L =
|
|
51
|
+
const L = f(k);
|
|
51
52
|
L == null || L === "" || !O && String(L) === String(w) || (_[k] = L, s[k] = String(L));
|
|
52
53
|
}
|
|
53
54
|
return Object.keys(_).length > 0 ? { updates: _, auto: s } : null;
|
|
54
55
|
}
|
|
55
|
-
function
|
|
56
|
+
function Nn(i, m = /* @__PURE__ */ new Set()) {
|
|
56
57
|
if (typeof i == "string" && i.startsWith("$parent.")) m.add(i.slice(8));
|
|
57
|
-
else if (Array.isArray(i)) for (const
|
|
58
|
+
else if (Array.isArray(i)) for (const f of i) Nn(f, m);
|
|
58
59
|
else if (i && typeof i == "object")
|
|
59
|
-
for (const
|
|
60
|
+
for (const f of Object.values(i)) Nn(f, m);
|
|
60
61
|
return m;
|
|
61
62
|
}
|
|
62
63
|
function Ge(i, m) {
|
|
63
|
-
const
|
|
64
|
+
const f = {};
|
|
64
65
|
let g = !1;
|
|
65
66
|
const _ = (s) => {
|
|
66
67
|
if (typeof s == "string" && s.startsWith("$parent.")) {
|
|
@@ -76,14 +77,14 @@ function Ge(i, m) {
|
|
|
76
77
|
g = !0;
|
|
77
78
|
continue;
|
|
78
79
|
}
|
|
79
|
-
|
|
80
|
-
} else k && typeof k == "object" ?
|
|
81
|
-
return g ? null :
|
|
80
|
+
f[s] = { _eq: w };
|
|
81
|
+
} else k && typeof k == "object" ? f[s] = _(k) : f[s] = { _eq: k };
|
|
82
|
+
return g ? null : f;
|
|
82
83
|
}
|
|
83
|
-
function
|
|
84
|
+
function br(i, m) {
|
|
84
85
|
if (!i) return !0;
|
|
85
|
-
for (const [
|
|
86
|
-
const _ = m == null ? void 0 : m[
|
|
86
|
+
for (const [f, g] of Object.entries(i)) {
|
|
87
|
+
const _ = m == null ? void 0 : m[f], s = _ == null ? null : String(_), k = g && typeof g == "object" ? g : { _eq: g };
|
|
87
88
|
for (const [w, O] of Object.entries(k))
|
|
88
89
|
switch (w) {
|
|
89
90
|
case "_eq":
|
|
@@ -110,87 +111,95 @@ function hr(i, m) {
|
|
|
110
111
|
}
|
|
111
112
|
return !0;
|
|
112
113
|
}
|
|
113
|
-
const
|
|
114
|
-
function
|
|
114
|
+
const Hs = 2e3;
|
|
115
|
+
function Ys(i, m) {
|
|
115
116
|
if (/e/i.test(i.trim())) return "Type the quantity in full digits";
|
|
116
|
-
const
|
|
117
|
-
if (mt(m) && i.trim() !== "" && !Number.isNaN(
|
|
117
|
+
const f = Number(i);
|
|
118
|
+
if (mt(m) && i.trim() !== "" && !Number.isNaN(f) && !Number.isInteger(f))
|
|
118
119
|
return "Whole numbers only";
|
|
119
|
-
const g =
|
|
120
|
+
const g = wn(i, { type: m, min: 0, label: "Quantity" });
|
|
120
121
|
return g.ok ? null : g.message;
|
|
121
122
|
}
|
|
122
|
-
function
|
|
123
|
+
function Zs(i, m, f) {
|
|
123
124
|
const g = i.reduce((_, s) => {
|
|
124
|
-
const k = s[m], w = k != null && k !== "" ? k :
|
|
125
|
+
const k = s[m], w = k != null && k !== "" ? k : f != null && f[m] ? Ee(f[m], s) : null, O = Number(w);
|
|
125
126
|
return _ + (w != null && Number.isFinite(O) ? O : 0);
|
|
126
127
|
}, 0);
|
|
127
128
|
return Math.round(g * 1e6) / 1e6;
|
|
128
129
|
}
|
|
129
|
-
const
|
|
130
|
+
const Gs = `[data-cpf-lines]{container:cpflines/inline-size}
|
|
130
131
|
@container cpflines (max-width: 559px){
|
|
131
132
|
[data-cpf-lines] [data-cpf-line-main]{flex-wrap:wrap;column-gap:8px;row-gap:6px}
|
|
132
133
|
[data-cpf-lines] [data-cpf-line-break]{display:block!important;flex-basis:100%;height:0}
|
|
133
134
|
[data-cpf-lines] [data-cpf-line-break]~:not(button):not([data-cpf-fixed]){flex:1 1 0!important;min-width:0!important;width:auto!important}
|
|
134
135
|
[data-cpf-lines] [data-cpf-line-break]~:not(button):not([data-cpf-fixed])>span,[data-cpf-lines] [data-cpf-line-break]~:not(button):not([data-cpf-fixed]) input{width:100%!important}
|
|
135
136
|
}`;
|
|
136
|
-
function
|
|
137
|
-
const
|
|
138
|
-
return
|
|
137
|
+
function Xs(i, m) {
|
|
138
|
+
const f = m.trim();
|
|
139
|
+
return f ? `${i} — ${f} not used` : i;
|
|
139
140
|
}
|
|
140
|
-
function
|
|
141
|
+
function ea(i) {
|
|
141
142
|
const m = { ...i.probe };
|
|
142
|
-
for (const [
|
|
143
|
+
for (const [f, g] of Object.entries(i.compute)) {
|
|
143
144
|
const _ = Ee(g, m);
|
|
144
145
|
if (_ === null) continue;
|
|
145
|
-
m[
|
|
146
|
-
const s = i.ruleError(
|
|
146
|
+
m[f] = _;
|
|
147
|
+
const s = i.ruleError(f, _, m);
|
|
147
148
|
if (s) return s;
|
|
148
|
-
if (Math.abs(_) >
|
|
149
|
-
return `${i.labelOf(
|
|
149
|
+
if (Math.abs(_) > Us)
|
|
150
|
+
return `${i.labelOf(f)} would be ${_.toLocaleString(void 0, { maximumFractionDigits: 2 })} — too large to save`;
|
|
150
151
|
}
|
|
151
152
|
return null;
|
|
152
153
|
}
|
|
153
|
-
function
|
|
154
|
-
const m = Object.entries(i.copyFields ?? {}).filter(([,
|
|
155
|
-
for (const
|
|
154
|
+
function ta(i) {
|
|
155
|
+
const m = Object.entries(i.copyFields ?? {}).filter(([, f]) => f === i.field).map(([f]) => f);
|
|
156
|
+
for (const f of m)
|
|
156
157
|
for (const g of i.related ?? []) {
|
|
157
|
-
if (g.copy_to !==
|
|
158
|
+
if (g.copy_to !== f) continue;
|
|
158
159
|
const _ = i.lookup(g.key);
|
|
159
160
|
if (_ != null && _ !== "") return _;
|
|
160
161
|
}
|
|
161
162
|
return i.catalogValue;
|
|
162
163
|
}
|
|
163
|
-
function
|
|
164
|
-
return i.map((
|
|
164
|
+
function na(i, m) {
|
|
165
|
+
return i.map((f) => [f.id, ...m.map((g) => f[g])].map((g) => String(g ?? "")).join("")).join("");
|
|
165
166
|
}
|
|
166
|
-
function
|
|
167
|
+
function ra(i) {
|
|
167
168
|
const m = Object.keys(i).filter((g) => i[g].kind === "error");
|
|
168
169
|
if (m.length === 0) return i;
|
|
169
|
-
const
|
|
170
|
-
for (const g of m) delete
|
|
171
|
-
return
|
|
170
|
+
const f = { ...i };
|
|
171
|
+
for (const g of m) delete f[g];
|
|
172
|
+
return f;
|
|
172
173
|
}
|
|
173
|
-
function
|
|
174
|
+
function sa(i, m, f) {
|
|
174
175
|
const g = Number(i[m]);
|
|
175
176
|
if (!Number.isFinite(g) || g <= 0) return !1;
|
|
176
|
-
const _ =
|
|
177
|
+
const _ = f.find((k) => k in i);
|
|
177
178
|
if (!_) return !1;
|
|
178
179
|
const s = i[_];
|
|
179
180
|
return s == null || s === "" || Number(s) === 0;
|
|
180
181
|
}
|
|
181
|
-
function
|
|
182
|
+
function Nr(i, m) {
|
|
183
|
+
const f = (m ?? "").split(".").pop() ?? "";
|
|
184
|
+
if (typeof i == "number" || typeof i == "string" && /(^|_)price$/i.test(f)) {
|
|
185
|
+
if (/(^|_)price$/i.test(f)) return xs(i) || String(i);
|
|
186
|
+
if (typeof i == "number") return ys(i, { field: f }) || String(i);
|
|
187
|
+
}
|
|
188
|
+
return String(i);
|
|
189
|
+
}
|
|
190
|
+
function Ja({
|
|
182
191
|
relatedCollection: i,
|
|
183
192
|
manyField: m,
|
|
184
|
-
parentId:
|
|
193
|
+
parentId: f,
|
|
185
194
|
parentCollection: g,
|
|
186
195
|
field: _,
|
|
187
196
|
config: s,
|
|
188
197
|
readOnly: k = !1
|
|
189
198
|
}) {
|
|
190
|
-
var
|
|
191
|
-
const w = ht(), O =
|
|
199
|
+
var tr, nr, rr, sr, ar, ir, lr, or, dr;
|
|
200
|
+
const w = ht(), O = os(), v = Vs(), L = ms(), Y = fs(), M = s.editable_fields ?? [], me = s.catalog_locked_fields ?? [], { isAdmin: fe } = mr(), T = f === "new", be = g && !T ? `?parent_collection=${encodeURIComponent(g)}&parent_id=${encodeURIComponent(f)}` : "", z = s.qty_field ?? "quantity", [pe, ge] = H(/* @__PURE__ */ new Set()), ke = je(!1), [W, Te] = H(""), [he, re] = H({}), [ee, X] = H(/* @__PURE__ */ new Set()), [B, se] = H({}), [ie, _e] = H({}), { data: xe = [], isPending: F } = Q({
|
|
192
201
|
queryKey: Kt.collectionRelations(i),
|
|
193
|
-
queryFn: () =>
|
|
202
|
+
queryFn: () => gn(w, i),
|
|
194
203
|
staleTime: 10 * 6e4
|
|
195
204
|
}), y = R(
|
|
196
205
|
() => {
|
|
@@ -204,12 +213,12 @@ function La({
|
|
|
204
213
|
queryKey: Kt.fieldConfig(i, null),
|
|
205
214
|
queryFn: () => w.request(A(`/field-config/${i}`)).then((e) => e.data ?? []),
|
|
206
215
|
staleTime: 6e4
|
|
207
|
-
}), E = ((
|
|
216
|
+
}), E = ((tr = N.find((e) => e.field === z)) == null ? void 0 : tr.type) ?? null, P = (e, t, n) => {
|
|
208
217
|
var r;
|
|
209
|
-
return ((r =
|
|
218
|
+
return ((r = zs(
|
|
210
219
|
N.filter((l) => l.field === e).map((l) => ({
|
|
211
220
|
field: l.field,
|
|
212
|
-
label: l.label ||
|
|
221
|
+
label: l.label || G(l.field),
|
|
213
222
|
type: l.type,
|
|
214
223
|
validation_rules: l.validation_rules
|
|
215
224
|
})),
|
|
@@ -228,14 +237,14 @@ function La({
|
|
|
228
237
|
) ?? null;
|
|
229
238
|
}, [j, y, s.section_by]), te = (K == null ? void 0 : K.many_collection) ?? null, { data: Je = [] } = Q({
|
|
230
239
|
queryKey: Kt.collectionRelations(te),
|
|
231
|
-
queryFn: () =>
|
|
240
|
+
queryFn: () => gn(w, te),
|
|
232
241
|
enabled: !!te,
|
|
233
242
|
staleTime: 10 * 6e4
|
|
234
243
|
}), d = R(() => {
|
|
235
244
|
if (!(K != null && K.many_field) || !te) return null;
|
|
236
245
|
const e = String(K.junction_field), t = Je.find(
|
|
237
246
|
(r) => r.many_collection === te && r.many_field === e
|
|
238
|
-
), n =
|
|
247
|
+
), n = Ms(t);
|
|
239
248
|
return n ? {
|
|
240
249
|
junction: te,
|
|
241
250
|
fkToItem: K.many_field,
|
|
@@ -243,13 +252,13 @@ function La({
|
|
|
243
252
|
target: n,
|
|
244
253
|
labelPath: s.section_by.split(".").slice(1).join(".") || "id"
|
|
245
254
|
} : null;
|
|
246
|
-
}, [K, te, Je, s.section_by]), S = L == null ? void 0 : L.draft, { resolvedFilter:
|
|
255
|
+
}, [K, te, Je, s.section_by]), S = L == null ? void 0 : L.draft, { resolvedFilter: le, resolvedSectionFilter: Z, resolvedLinkFilter: D, missingParents: ae } = R(() => {
|
|
247
256
|
const e = [], t = (o) => {
|
|
248
257
|
if (typeof o == "string" && o.startsWith("$parent.")) {
|
|
249
|
-
const
|
|
250
|
-
return c == null || c === "" ? (e.push(
|
|
258
|
+
const p = o.slice(8), c = S == null ? void 0 : S[p];
|
|
259
|
+
return c == null || c === "" ? (e.push(p), o) : c;
|
|
251
260
|
}
|
|
252
|
-
return Array.isArray(o) ? o.map(t) : o && typeof o == "object" ? Object.fromEntries(Object.entries(o).map(([
|
|
261
|
+
return Array.isArray(o) ? o.map(t) : o && typeof o == "object" ? Object.fromEntries(Object.entries(o).map(([p, c]) => [p, t(c)])) : o;
|
|
253
262
|
}, n = s.filter ? t(s.filter) : void 0, r = s.section_filter ? t(s.section_filter) : void 0, l = s.link_filter ? t(s.link_filter) : void 0;
|
|
254
263
|
return {
|
|
255
264
|
resolvedFilter: n,
|
|
@@ -258,25 +267,25 @@ function La({
|
|
|
258
267
|
missingParents: [...new Set(e)]
|
|
259
268
|
};
|
|
260
269
|
}, [s.filter, s.section_filter, s.link_filter, S]), ne = R(() => {
|
|
261
|
-
if (!K || !
|
|
270
|
+
if (!K || !Z && !D) return le;
|
|
262
271
|
const e = {
|
|
263
|
-
...
|
|
264
|
-
...
|
|
272
|
+
...Z ?? {},
|
|
273
|
+
...D ? { _link: D } : {}
|
|
265
274
|
}, t = { [K.one_field]: { _some: e } };
|
|
266
|
-
return
|
|
267
|
-
}, [K,
|
|
275
|
+
return le ? { _and: [le, t] } : t;
|
|
276
|
+
}, [K, Z, D, le]), U = R(() => {
|
|
268
277
|
const e = /* @__PURE__ */ new Set(["id"]);
|
|
269
278
|
j && !K && e.add(s.section_by);
|
|
270
279
|
for (const t of [...(C ?? "").matchAll(/\{\{([\w.]+)\}\}/g)]) e.add(t[1]);
|
|
271
280
|
for (const t of Object.values(s.copy_fields ?? {})) e.add(t);
|
|
272
281
|
for (const t of s.columns ?? []) e.add(t.field);
|
|
273
282
|
return [...e].join(",");
|
|
274
|
-
}, [C, j, K, s.section_by, s.copy_fields, s.columns]), Ie = JSON.stringify(ne ?? null), { data: oe = [], isLoading:
|
|
283
|
+
}, [C, j, K, s.section_by, s.copy_fields, s.columns]), Ie = JSON.stringify(ne ?? null), { data: oe = [], isLoading: vn } = Q(
|
|
275
284
|
{
|
|
276
285
|
queryKey: ["catalog-picker", y, U, Ie],
|
|
277
286
|
queryFn: () => w.request(
|
|
278
287
|
A(`/items/${y}`, {
|
|
279
|
-
limit:
|
|
288
|
+
limit: Hs,
|
|
280
289
|
fields: U,
|
|
281
290
|
...ne ? { filter: JSON.stringify(ne) } : {}
|
|
282
291
|
})
|
|
@@ -286,26 +295,26 @@ function La({
|
|
|
286
295
|
enabled: !!y && !!j && ae.length === 0 && (!K || !!d),
|
|
287
296
|
staleTime: 6e4
|
|
288
297
|
}
|
|
289
|
-
),
|
|
290
|
-
queryKey: ["catalog-sections", d == null ? void 0 : d.target, d == null ? void 0 : d.labelPath,
|
|
298
|
+
), Sr = JSON.stringify(Z ?? null), { data: bt = [], isLoading: _r } = Q({
|
|
299
|
+
queryKey: ["catalog-sections", d == null ? void 0 : d.target, d == null ? void 0 : d.labelPath, Sr],
|
|
291
300
|
queryFn: async () => {
|
|
292
301
|
const e = d;
|
|
293
302
|
return (await It(w, `/items/${e.target}`, {
|
|
294
303
|
fields: `id,${e.labelPath}`,
|
|
295
|
-
...
|
|
304
|
+
...Z ? { filter: JSON.stringify(Z) } : {}
|
|
296
305
|
})).map((n) => ({
|
|
297
306
|
id: String(n.id),
|
|
298
|
-
name: String(
|
|
307
|
+
name: String(wr(n, e.labelPath) ?? "").trim()
|
|
299
308
|
}));
|
|
300
309
|
},
|
|
301
310
|
enabled: !!d && ae.length === 0,
|
|
302
311
|
staleTime: 6e4
|
|
303
|
-
}), Xe = R(() => bt.map((e) => e.id), [bt]), { data:
|
|
312
|
+
}), Xe = R(() => bt.map((e) => e.id), [bt]), { data: Sn = [], isLoading: qr } = Q({
|
|
304
313
|
queryKey: [
|
|
305
314
|
"catalog-section-links",
|
|
306
315
|
d == null ? void 0 : d.junction,
|
|
307
316
|
Xe.join(","),
|
|
308
|
-
JSON.stringify(
|
|
317
|
+
JSON.stringify(D ?? null)
|
|
309
318
|
],
|
|
310
319
|
queryFn: async () => {
|
|
311
320
|
const e = d, t = [];
|
|
@@ -313,7 +322,7 @@ function La({
|
|
|
313
322
|
const r = Xe.slice(n, n + 200), l = await It(w, `/items/${e.junction}`, {
|
|
314
323
|
fields: `${e.fkToItem},${e.fkToSection}`,
|
|
315
324
|
filter: JSON.stringify(
|
|
316
|
-
|
|
325
|
+
D ? { _and: [{ [e.fkToSection]: { _in: r } }, D] } : { [e.fkToSection]: { _in: r } }
|
|
317
326
|
)
|
|
318
327
|
});
|
|
319
328
|
for (const o of l)
|
|
@@ -323,57 +332,57 @@ function La({
|
|
|
323
332
|
},
|
|
324
333
|
enabled: !!d && Xe.length > 0,
|
|
325
334
|
staleTime: 6e4
|
|
326
|
-
}),
|
|
335
|
+
}), _n = R(() => {
|
|
327
336
|
const e = new Map(bt.map((n) => [n.id, n.name])), t = /* @__PURE__ */ new Map();
|
|
328
|
-
for (const n of
|
|
337
|
+
for (const n of Sn) {
|
|
329
338
|
const r = e.get(n.section);
|
|
330
339
|
if (!r) continue;
|
|
331
340
|
const l = t.get(n.item) ?? [];
|
|
332
341
|
l.includes(r) || l.push(r), t.set(n.item, l);
|
|
333
342
|
}
|
|
334
343
|
return t;
|
|
335
|
-
}, [bt,
|
|
344
|
+
}, [bt, Sn]), xt = !!K && (!d || _r || Xe.length > 0 && qr), yt = R(() => {
|
|
336
345
|
const e = /* @__PURE__ */ new Map();
|
|
337
346
|
for (const t of oe) e.set(String(t.id), t);
|
|
338
347
|
return e;
|
|
339
348
|
}, [oe]), { data: we = [] } = Q({
|
|
340
|
-
queryKey: ["o2m-rows", i, m,
|
|
349
|
+
queryKey: ["o2m-rows", i, m, f],
|
|
341
350
|
queryFn: () => w.request(
|
|
342
351
|
A(`/items/${i}`, {
|
|
343
|
-
filter: JSON.stringify({ [m]: { _eq:
|
|
352
|
+
filter: JSON.stringify({ [m]: { _eq: f } }),
|
|
344
353
|
limit: 1e3
|
|
345
354
|
})
|
|
346
355
|
).then((e) => e.data ?? []),
|
|
347
356
|
enabled: !T,
|
|
348
357
|
staleTime: 15e3
|
|
349
358
|
}), Qt = R(
|
|
350
|
-
() =>
|
|
359
|
+
() => na(we, [
|
|
351
360
|
s.item_field,
|
|
352
361
|
z,
|
|
353
362
|
...M,
|
|
354
363
|
...Object.keys(s.compute_fields ?? {})
|
|
355
364
|
]),
|
|
356
365
|
[we, s.item_field, z, M, s.compute_fields]
|
|
357
|
-
),
|
|
366
|
+
), qn = je(null), zt = je(B);
|
|
358
367
|
zt.current = B, Fe(() => {
|
|
359
|
-
const e =
|
|
360
|
-
if (
|
|
368
|
+
const e = qn.current;
|
|
369
|
+
if (qn.current = Qt, e === null || e === Qt) return;
|
|
361
370
|
const t = Object.keys(zt.current).filter(
|
|
362
371
|
(n) => zt.current[n].kind === "error"
|
|
363
372
|
);
|
|
364
|
-
se((n) =>
|
|
373
|
+
se((n) => ra(n)), _e((n) => Object.keys(n).length === 0 ? n : {}), t.length > 0 && re((n) => {
|
|
365
374
|
if (!t.some((l) => l in n)) return n;
|
|
366
375
|
const r = { ...n };
|
|
367
376
|
for (const l of t) delete r[l];
|
|
368
377
|
return r;
|
|
369
378
|
});
|
|
370
379
|
}, [Qt]);
|
|
371
|
-
const et = !T && !!v, Re = v ? v.getPendingRows(i, m) : [], gt = et ? v.getPendingEdits(i, m) : /* @__PURE__ */ new Map(),
|
|
380
|
+
const et = !T && !!v, Re = v ? v.getPendingRows(i, m) : [], gt = et ? v.getPendingEdits(i, m) : /* @__PURE__ */ new Map(), $r = JSON.stringify([...gt.entries()]), Me = R(
|
|
372
381
|
() => gt.size === 0 ? we : we.map((e) => {
|
|
373
382
|
const t = gt.get(String(e.id));
|
|
374
383
|
return t ? { ...e, ...t } : e;
|
|
375
384
|
}),
|
|
376
|
-
[we,
|
|
385
|
+
[we, $r]
|
|
377
386
|
), kt = !T && v ? v.getPendingDeletes(i, m) : /* @__PURE__ */ new Set(), tt = R(() => {
|
|
378
387
|
const e = /* @__PURE__ */ new Map();
|
|
379
388
|
for (const t of Me) {
|
|
@@ -422,51 +431,51 @@ function La({
|
|
|
422
431
|
).then((e) => e.data ?? []),
|
|
423
432
|
enabled: !!y && !!s.favorites && Pe.length > 0,
|
|
424
433
|
staleTime: 6e4
|
|
425
|
-
}), [vt,
|
|
426
|
-
async function
|
|
434
|
+
}), [vt, $n] = H(/* @__PURE__ */ new Set());
|
|
435
|
+
async function jn(e) {
|
|
427
436
|
if (!(!y || vt.has(e))) {
|
|
428
|
-
|
|
437
|
+
$n((t) => new Set(t).add(e));
|
|
429
438
|
try {
|
|
430
|
-
await w.request(
|
|
439
|
+
await w.request(pr(`/pinned/${y}/${e}/toggle`)).catch(() => {
|
|
431
440
|
}), await O.invalidateQueries({ queryKey: ["pinned-items", y] });
|
|
432
441
|
} finally {
|
|
433
|
-
|
|
442
|
+
$n((t) => {
|
|
434
443
|
const n = new Set(t);
|
|
435
444
|
return n.delete(e), n;
|
|
436
445
|
});
|
|
437
446
|
}
|
|
438
447
|
}
|
|
439
448
|
}
|
|
440
|
-
const [
|
|
449
|
+
const [jr, Fn] = H(!1), Tn = je(null), Vt = (e) => s.favorites ? /* @__PURE__ */ a(
|
|
441
450
|
"button",
|
|
442
451
|
{
|
|
443
452
|
type: "button",
|
|
444
453
|
title: Mt.has(e) ? "Remove from favorites" : "Add to favorites",
|
|
445
454
|
disabled: vt.has(e),
|
|
446
455
|
onClick: (t) => {
|
|
447
|
-
t.stopPropagation(),
|
|
456
|
+
t.stopPropagation(), jn(e);
|
|
448
457
|
},
|
|
449
458
|
className: "shrink-0 rounded p-0.5 transition-colors",
|
|
450
459
|
children: vt.has(e) ? /* @__PURE__ */ a(ue, { className: "h-3.5 w-3.5 animate-spin text-amber-400" }) : /* @__PURE__ */ a(
|
|
451
460
|
ft,
|
|
452
461
|
{
|
|
453
|
-
className:
|
|
462
|
+
className: V(
|
|
454
463
|
"h-3.5 w-3.5",
|
|
455
464
|
Mt.has(e) ? "fill-amber-400 text-amber-400" : "text-slate-300 hover:text-amber-400"
|
|
456
465
|
)
|
|
457
466
|
}
|
|
458
467
|
)
|
|
459
468
|
}
|
|
460
|
-
) : null, [ye,
|
|
469
|
+
) : null, [ye, Fr] = H("");
|
|
461
470
|
Fe(() => {
|
|
462
|
-
const e = setTimeout(() =>
|
|
471
|
+
const e = setTimeout(() => Fr(W), 300);
|
|
463
472
|
return () => clearTimeout(e);
|
|
464
|
-
}, [
|
|
465
|
-
const
|
|
473
|
+
}, [W]);
|
|
474
|
+
const Rn = R(() => {
|
|
466
475
|
var t;
|
|
467
476
|
const e = (t = [...(C ?? "").matchAll(/\{\{([\w.]+)\}\}/g)][0]) == null ? void 0 : t[1];
|
|
468
477
|
return e && !e.includes(".") ? e : "id";
|
|
469
|
-
}, [C]), { shownSearchFields: Qe, otherSearchFields:
|
|
478
|
+
}, [C]), { shownSearchFields: Qe, otherSearchFields: On } = R(() => {
|
|
470
479
|
const e = new Set(
|
|
471
480
|
((j == null ? void 0 : j.relations) ?? []).filter((r) => r.one_collection === y && r.one_field).map((r) => r.one_field)
|
|
472
481
|
), t = new Set(
|
|
@@ -478,28 +487,28 @@ function La({
|
|
|
478
487
|
shownSearchFields: [...n],
|
|
479
488
|
otherSearchFields: [...t].filter((r) => !n.has(r))
|
|
480
489
|
};
|
|
481
|
-
}, [j, y, C, s.columns]),
|
|
490
|
+
}, [j, y, C, s.columns]), Ve = R(() => {
|
|
482
491
|
const e = s.related_columns ?? [], t = e.findIndex((n) => n.stock === !0);
|
|
483
492
|
return t !== -1 ? t : e.findIndex((n) => n.key === "on_hand" && n.stock !== !1);
|
|
484
|
-
}, [s.related_columns]), de =
|
|
493
|
+
}, [s.related_columns]), de = Ve === -1 ? null : (s.related_columns ?? [])[Ve] ?? null, Le = de ? Ge(de.match, S) : null, ze = R(() => {
|
|
485
494
|
for (const e of Object.values((de == null ? void 0 : de.match) ?? {}))
|
|
486
495
|
if (typeof e == "string" && e.startsWith("$parent.")) return e.slice(8);
|
|
487
496
|
return null;
|
|
488
|
-
}, [de]),
|
|
497
|
+
}, [de]), Pn = ze ? S == null ? void 0 : S[ze] : null, Tr = ze ? ((nr = L == null ? void 0 : L.fieldLabels) == null ? void 0 : nr[ze]) ?? G(ze) : null, We = y ? `nvr:catalog-in-stock:${y}:${i}.${m}` : null, [Ln, En] = H(!1);
|
|
489
498
|
Fe(() => {
|
|
490
|
-
if (
|
|
499
|
+
if (We)
|
|
491
500
|
try {
|
|
492
|
-
|
|
501
|
+
En(localStorage.getItem(We) === "1");
|
|
493
502
|
} catch {
|
|
494
503
|
}
|
|
495
|
-
}, [
|
|
496
|
-
const
|
|
497
|
-
if (
|
|
504
|
+
}, [We]);
|
|
505
|
+
const Wt = (e) => {
|
|
506
|
+
if (En(e), !!We)
|
|
498
507
|
try {
|
|
499
|
-
e ? localStorage.setItem(
|
|
508
|
+
e ? localStorage.setItem(We, "1") : localStorage.removeItem(We);
|
|
500
509
|
} catch {
|
|
501
510
|
}
|
|
502
|
-
}, ce = !!de &&
|
|
511
|
+
}, ce = !!de && Ln && Le !== null, Bt = R(() => {
|
|
503
512
|
if (!de) return null;
|
|
504
513
|
const e = ((j == null ? void 0 : j.relations) ?? []).find(
|
|
505
514
|
(t) => t.many_collection === de.collection && t.many_field === de.item_field && t.one_collection === y && !!t.one_field && !t.junction_field
|
|
@@ -511,7 +520,7 @@ function La({
|
|
|
511
520
|
), Ht = JSON.stringify(Dt), St = ce && !Dt ? 100 : 25, Yt = (e, t) => {
|
|
512
521
|
const n = [t, Dt].filter(Boolean);
|
|
513
522
|
return n.length === 0 ? e : { ...e, filter: JSON.stringify(n.length === 1 ? n[0] : { _and: n }) };
|
|
514
|
-
}, Zt =
|
|
523
|
+
}, Zt = mr().userId, _t = s.recent === !1 ? 0 : typeof s.recent == "object" && Number((rr = s.recent) == null ? void 0 : rr.days) || 30, Gt = ["user_created", "created_by", "creator"].find(
|
|
515
524
|
(e) => N.some((t) => t.field === e)
|
|
516
525
|
), rt = ["date_created", "created_at"].find(
|
|
517
526
|
(e) => N.some((t) => t.field === e)
|
|
@@ -538,14 +547,14 @@ function La({
|
|
|
538
547
|
})
|
|
539
548
|
).then((l) => l.data ?? []).catch(() => []), r = [];
|
|
540
549
|
for (const l of n) {
|
|
541
|
-
const o = l[s.item_field],
|
|
542
|
-
if (
|
|
550
|
+
const o = l[s.item_field], p = o != null && typeof o == "object" ? o.id : o;
|
|
551
|
+
if (p != null && p !== "" && !r.includes(String(p)) && r.push(String(p)), r.length >= 150) break;
|
|
543
552
|
}
|
|
544
553
|
return r;
|
|
545
554
|
},
|
|
546
555
|
enabled: _t > 0 && !!Zt && !!Gt && !k,
|
|
547
556
|
staleTime: 5 * 6e4
|
|
548
|
-
}),
|
|
557
|
+
}), Rr = R(() => new Set(st), [st]), Xt = !!y && ye.trim().length > 0, { data: en = [], isFetching: Or } = Q({
|
|
549
558
|
queryKey: [
|
|
550
559
|
"catalog-shown-search",
|
|
551
560
|
y,
|
|
@@ -564,14 +573,14 @@ function La({
|
|
|
564
573
|
search_rank: "1",
|
|
565
574
|
fields: U,
|
|
566
575
|
limit: St,
|
|
567
|
-
sort:
|
|
576
|
+
sort: Rn
|
|
568
577
|
})
|
|
569
578
|
)
|
|
570
579
|
).then((e) => e.data ?? []),
|
|
571
580
|
enabled: Xt && Qe.length > 0,
|
|
572
581
|
staleTime: 3e4,
|
|
573
582
|
placeholderData: (e) => e
|
|
574
|
-
}), qt =
|
|
583
|
+
}), qt = On.join(","), { data: Cn = [], isFetching: Pr } = Q({
|
|
575
584
|
queryKey: [
|
|
576
585
|
"catalog-full-search",
|
|
577
586
|
y,
|
|
@@ -588,21 +597,21 @@ function La({
|
|
|
588
597
|
search: ye,
|
|
589
598
|
fields: [U, qt].filter(Boolean).join(","),
|
|
590
599
|
limit: St,
|
|
591
|
-
sort:
|
|
600
|
+
sort: Rn
|
|
592
601
|
})
|
|
593
602
|
)
|
|
594
603
|
).then((e) => e.data ?? []),
|
|
595
604
|
enabled: Xt,
|
|
596
605
|
staleTime: 3e4,
|
|
597
606
|
placeholderData: (e) => e
|
|
598
|
-
}),
|
|
607
|
+
}), Lr = st.join(","), { data: Kn = [] } = Q({
|
|
599
608
|
queryKey: [
|
|
600
609
|
"catalog-recent-search",
|
|
601
610
|
y,
|
|
602
611
|
U,
|
|
603
612
|
ye,
|
|
604
613
|
qt,
|
|
605
|
-
|
|
614
|
+
Lr,
|
|
606
615
|
Ht
|
|
607
616
|
],
|
|
608
617
|
queryFn: () => w.request(
|
|
@@ -622,41 +631,41 @@ function La({
|
|
|
622
631
|
enabled: Xt && st.length > 0,
|
|
623
632
|
staleTime: 3e4,
|
|
624
633
|
placeholderData: (e) => e
|
|
625
|
-
}), tn =
|
|
626
|
-
() =>
|
|
634
|
+
}), tn = Or || Pr, Be = R(
|
|
635
|
+
() => As({
|
|
627
636
|
shown: en,
|
|
628
|
-
other:
|
|
629
|
-
recent:
|
|
637
|
+
other: Cn,
|
|
638
|
+
recent: Kn,
|
|
630
639
|
shownFields: Qe,
|
|
631
640
|
q: ye
|
|
632
641
|
}),
|
|
633
|
-
[en,
|
|
634
|
-
),
|
|
635
|
-
if (Qe.length === 0 || en.some((n) => String(n.id) === String(e.id)) ||
|
|
636
|
-
const t =
|
|
637
|
-
for (const n of
|
|
642
|
+
[en, Cn, Kn, Qe, ye]
|
|
643
|
+
), Er = (e) => {
|
|
644
|
+
if (Qe.length === 0 || en.some((n) => String(n.id) === String(e.id)) || Js(e, Qe, ye)) return null;
|
|
645
|
+
const t = gs(ye);
|
|
646
|
+
for (const n of On) {
|
|
638
647
|
const r = e[n];
|
|
639
648
|
if (r == null || typeof r == "object") continue;
|
|
640
649
|
const l = String(r);
|
|
641
|
-
if (t.some((o) =>
|
|
642
|
-
return `${
|
|
650
|
+
if (t.some((o) => ks(l, o)))
|
|
651
|
+
return `${G(n)}: ${l.length > 40 ? `${l.slice(0, 40)}…` : l}`;
|
|
643
652
|
}
|
|
644
653
|
return null;
|
|
645
|
-
},
|
|
654
|
+
}, An = R(
|
|
646
655
|
() => [.../* @__PURE__ */ new Set(["id", ...Object.values(s.copy_fields ?? {})])].join(","),
|
|
647
656
|
[s.copy_fields]
|
|
648
657
|
), at = R(
|
|
649
658
|
() => T ? [] : Me.map((e) => e[s.item_field]).filter((e) => e != null && e !== "").map(String),
|
|
650
659
|
[T, Me, s.item_field]
|
|
651
|
-
), { data:
|
|
652
|
-
queryKey: ["catalog-line-sources", y,
|
|
660
|
+
), { data: Jn = [] } = Q({
|
|
661
|
+
queryKey: ["catalog-line-sources", y, An, at.join(",")],
|
|
653
662
|
queryFn: async () => {
|
|
654
663
|
const e = [];
|
|
655
664
|
for (let t = 0; t < at.length; t += 200) {
|
|
656
665
|
const n = at.slice(t, t + 200), r = await w.request(
|
|
657
666
|
A(`/items/${y}`, {
|
|
658
667
|
filter: JSON.stringify({ id: { _in: n } }),
|
|
659
|
-
fields:
|
|
668
|
+
fields: An,
|
|
660
669
|
limit: n.length
|
|
661
670
|
})
|
|
662
671
|
).then((l) => l.data ?? []);
|
|
@@ -666,9 +675,9 @@ function La({
|
|
|
666
675
|
},
|
|
667
676
|
enabled: !k && !!y && at.length > 0 && Object.keys(s.copy_fields ?? {}).length > 0,
|
|
668
677
|
staleTime: 6e4
|
|
669
|
-
}),
|
|
670
|
-
() => new Map(
|
|
671
|
-
[
|
|
678
|
+
}), Cr = R(
|
|
679
|
+
() => new Map(Jn.map((e) => [String(e.id).toUpperCase(), e])),
|
|
680
|
+
[Jn]
|
|
672
681
|
), De = R(() => {
|
|
673
682
|
const e = /* @__PURE__ */ new Set();
|
|
674
683
|
for (const t of oe) e.add(String(t.id));
|
|
@@ -676,7 +685,7 @@ function La({
|
|
|
676
685
|
for (const t of Pe) e.add(t);
|
|
677
686
|
for (const t of Be) e.add(String(t.id));
|
|
678
687
|
return [...e];
|
|
679
|
-
}, [oe, Ne, Pe, Be]), it =
|
|
688
|
+
}, [oe, Ne, Pe, Be]), it = yn({
|
|
680
689
|
queries: (s.related_columns ?? []).map((e) => {
|
|
681
690
|
const t = Ge(e.match, S);
|
|
682
691
|
return {
|
|
@@ -692,15 +701,15 @@ function La({
|
|
|
692
701
|
if (e.count_all && e.aggregate === "sum" && g && _) {
|
|
693
702
|
const o = {};
|
|
694
703
|
if (T)
|
|
695
|
-
for (const
|
|
696
|
-
o[
|
|
697
|
-
for (let
|
|
698
|
-
const c = De.slice(
|
|
704
|
+
for (const p of Nn(e.match))
|
|
705
|
+
o[p] = (S == null ? void 0 : S[p]) ?? null;
|
|
706
|
+
for (let p = 0; p < De.length; p += 200) {
|
|
707
|
+
const c = De.slice(p, p + 200), h = await w.request(
|
|
699
708
|
A("/catalog-related/count-all", {
|
|
700
709
|
collection: g,
|
|
701
710
|
field: _,
|
|
702
711
|
key: e.key,
|
|
703
|
-
record: T ? "new" :
|
|
712
|
+
record: T ? "new" : f,
|
|
704
713
|
...T ? { parent: JSON.stringify(o) } : {},
|
|
705
714
|
ids: c.join(",")
|
|
706
715
|
})
|
|
@@ -711,15 +720,15 @@ function La({
|
|
|
711
720
|
}
|
|
712
721
|
const r = e.aggregate === "sum", l = r ? 150 : 400;
|
|
713
722
|
for (let o = 0; o < De.length; o += l) {
|
|
714
|
-
const
|
|
723
|
+
const p = De.slice(o, o + l);
|
|
715
724
|
let c = 1;
|
|
716
725
|
for (; ; ) {
|
|
717
726
|
const h = await w.request(
|
|
718
727
|
A(`/items/${e.collection}`, {
|
|
719
|
-
limit: r ? 1e3 :
|
|
728
|
+
limit: r ? 1e3 : p.length,
|
|
720
729
|
...r ? { page: c } : {},
|
|
721
730
|
fields: `${e.item_field},${e.value_field}`,
|
|
722
|
-
filter: JSON.stringify({ ...t, [e.item_field]: { _in:
|
|
731
|
+
filter: JSON.stringify({ ...t, [e.item_field]: { _in: p } })
|
|
723
732
|
})
|
|
724
733
|
).then((b) => b.data ?? []);
|
|
725
734
|
for (const b of h) {
|
|
@@ -746,11 +755,11 @@ function La({
|
|
|
746
755
|
const n = (s.related_columns ?? []).findIndex((o) => o.key === e);
|
|
747
756
|
if (n !== -1)
|
|
748
757
|
return (l = (r = it[n]) == null ? void 0 : r.data) == null ? void 0 : l[t];
|
|
749
|
-
}, ot =
|
|
758
|
+
}, ot = Ve === -1 || (sr = it[Ve]) == null ? void 0 : sr.data, Kr = ce && !!((ar = it[Ve]) != null && ar.isFetching), In = (e) => {
|
|
750
759
|
if (!ce || ot === void 0) return !0;
|
|
751
760
|
const t = Number(ot[e]);
|
|
752
761
|
return Number.isFinite(t) && t > 0;
|
|
753
|
-
}, dt = ce ? Be.filter((e) =>
|
|
762
|
+
}, dt = ce ? Be.filter((e) => In(String(e.id))) : Be, nn = ce ? nt.filter((e) => In(String(e.id))) : nt, rn = (e) => {
|
|
754
763
|
var c;
|
|
755
764
|
const t = s.qty_warning;
|
|
756
765
|
if (!t) return null;
|
|
@@ -760,9 +769,9 @@ function La({
|
|
|
760
769
|
if (r === -1) return null;
|
|
761
770
|
const l = (c = it[r]) == null ? void 0 : c.data;
|
|
762
771
|
if (l === void 0) return null;
|
|
763
|
-
const o = l[e],
|
|
764
|
-
return Number.isNaN(
|
|
765
|
-
},
|
|
772
|
+
const o = l[e], p = o == null || o === "" ? 0 : Number(o);
|
|
773
|
+
return Number.isNaN(p) ? null : n > p ? { available: p, qty: n } : null;
|
|
774
|
+
}, Ar = (e) => {
|
|
766
775
|
const t = s.row_flags ?? [];
|
|
767
776
|
if (t.length === 0) return [];
|
|
768
777
|
const n = [];
|
|
@@ -770,30 +779,30 @@ function La({
|
|
|
770
779
|
if (!(!(r != null && r.when) || !r.label))
|
|
771
780
|
try {
|
|
772
781
|
const l = r.when.replace(/\{\{\s*([A-Za-z_][A-Za-z0-9_.]*)\s*\}\}/g, "$1");
|
|
773
|
-
|
|
782
|
+
hs(l, e) && n.push(r.label);
|
|
774
783
|
} catch {
|
|
775
784
|
}
|
|
776
785
|
return n;
|
|
777
|
-
}, sn = s.qty_warning ? s.qty_warning.label ?? ((
|
|
786
|
+
}, sn = s.qty_warning ? s.qty_warning.label ?? ((ir = (s.related_columns ?? []).find((e) => {
|
|
778
787
|
var t;
|
|
779
788
|
return e.key === ((t = s.qty_warning) == null ? void 0 : t.column);
|
|
780
|
-
})) == null ? void 0 :
|
|
789
|
+
})) == null ? void 0 : ir.label) ?? G(s.qty_warning.column) : "", Jr = !!s.submission_errors, $t = R(
|
|
781
790
|
() => {
|
|
782
791
|
var e;
|
|
783
792
|
return typeof s.submission_errors == "object" && Array.isArray((e = s.submission_errors) == null ? void 0 : e.match_fields) ? s.submission_errors.match_fields.filter((t) => /^[A-Za-z_][A-Za-z0-9_]*$/.test(t)) : [];
|
|
784
793
|
},
|
|
785
794
|
[s.submission_errors]
|
|
786
|
-
),
|
|
787
|
-
queryKey: ["erp-submissions", g ?? "", String(
|
|
788
|
-
queryFn: () => w.request(A(`/erp-submissions/${g}/${encodeURIComponent(
|
|
789
|
-
enabled:
|
|
795
|
+
), Ir = bs(6e4), { data: Qn } = Q({
|
|
796
|
+
queryKey: ["erp-submissions", g ?? "", String(f)],
|
|
797
|
+
queryFn: () => w.request(A(`/erp-submissions/${g}/${encodeURIComponent(f)}`)).then((e) => e.data ?? []),
|
|
798
|
+
enabled: Jr && !T && !!g,
|
|
790
799
|
staleTime: 15e3,
|
|
791
|
-
refetchInterval:
|
|
800
|
+
refetchInterval: Ir
|
|
792
801
|
}), an = R(() => {
|
|
793
|
-
const e = (
|
|
794
|
-
return !e || e.status !== "failed" ? null :
|
|
795
|
-
}, [
|
|
796
|
-
queryKey: ["catalog-suberr-idents", y, $t.join(","),
|
|
802
|
+
const e = (Qn ?? [])[0];
|
|
803
|
+
return !e || e.status !== "failed" ? null : Ns(e.payload, e.last_error);
|
|
804
|
+
}, [Qn]), Qr = Ne.map((e) => e.key).join(","), { data: ln } = Q({
|
|
805
|
+
queryKey: ["catalog-suberr-idents", y, $t.join(","), Qr],
|
|
797
806
|
queryFn: async () => {
|
|
798
807
|
const e = Ne.map((n) => n.key);
|
|
799
808
|
if (e.length === 0) return {};
|
|
@@ -808,7 +817,7 @@ function La({
|
|
|
808
817
|
},
|
|
809
818
|
enabled: !!y && !!an && $t.length > 0 && Ne.length > 0,
|
|
810
819
|
staleTime: 6e4
|
|
811
|
-
}),
|
|
820
|
+
}), zr = (e) => {
|
|
812
821
|
if (!an) return null;
|
|
813
822
|
const t = ln == null ? void 0 : ln[e], n = [
|
|
814
823
|
Pt(e),
|
|
@@ -816,11 +825,11 @@ function La({
|
|
|
816
825
|
const l = (t == null ? void 0 : t[r]) ?? Ue(e)[r];
|
|
817
826
|
return l != null && l !== "" ? String(l) : null;
|
|
818
827
|
})
|
|
819
|
-
].filter((r) => !!r).map(
|
|
828
|
+
].filter((r) => !!r).map(vs);
|
|
820
829
|
return an.reasonFor(n);
|
|
821
|
-
}, jt = s.summary_fields ?? [],
|
|
830
|
+
}, jt = s.summary_fields ?? [], Ur = we.map((e) => String(e.id)).join(","), Mr = yn({
|
|
822
831
|
queries: jt.filter((e) => e.m2m).map((e) => ({
|
|
823
|
-
queryKey: ["catalog-summary-m2m", e.field, e.m2m.junction,
|
|
832
|
+
queryKey: ["catalog-summary-m2m", e.field, e.m2m.junction, Ur],
|
|
824
833
|
queryFn: async () => {
|
|
825
834
|
const t = we.map((b) => String(b.id));
|
|
826
835
|
if (t.length === 0) return {};
|
|
@@ -830,13 +839,13 @@ function La({
|
|
|
830
839
|
fields: `${n.fk_to_child},${n.related_field}`,
|
|
831
840
|
filter: JSON.stringify({ [n.fk_to_child]: { _in: t } })
|
|
832
841
|
})
|
|
833
|
-
).then((b) => b.data ?? []).catch(() => []), l = [...new Set(r.map((b) => String(b[n.related_field])))], o = n.label_field ?? "name",
|
|
842
|
+
).then((b) => b.data ?? []).catch(() => []), l = [...new Set(r.map((b) => String(b[n.related_field])))], o = n.label_field ?? "name", p = l.length ? await w.request(
|
|
834
843
|
A(`/items/${n.related_collection}`, {
|
|
835
844
|
limit: 500,
|
|
836
845
|
fields: `id,${o}`,
|
|
837
846
|
filter: JSON.stringify({ id: { _in: l } })
|
|
838
847
|
})
|
|
839
|
-
).then((b) => b.data ?? []).catch(() => []) : [], c = new Map(
|
|
848
|
+
).then((b) => b.data ?? []).catch(() => []) : [], c = new Map(p.map((b) => [String(b.id), String(b[o] ?? b.id)])), h = {};
|
|
840
849
|
for (const b of r) {
|
|
841
850
|
const q = String(b[n.fk_to_child]), $ = c.get(String(b[n.related_field]));
|
|
842
851
|
$ && (h[q] = h[q] ? `${h[q]}, ${$}` : $);
|
|
@@ -846,16 +855,16 @@ function La({
|
|
|
846
855
|
enabled: !T && we.length > 0,
|
|
847
856
|
staleTime: 15e3
|
|
848
857
|
}))
|
|
849
|
-
}),
|
|
858
|
+
}), Vr = (e, t) => {
|
|
850
859
|
var l, o;
|
|
851
860
|
if (!e.m2m) return t.row[e.field];
|
|
852
|
-
const n = jt.filter((
|
|
861
|
+
const n = jt.filter((p) => p.m2m).findIndex((p) => p.field === e.field);
|
|
853
862
|
if (n === -1) return;
|
|
854
863
|
const r = t.row.id;
|
|
855
864
|
if (r != null)
|
|
856
|
-
return (o = (l =
|
|
857
|
-
},
|
|
858
|
-
if (!
|
|
865
|
+
return (o = (l = Mr[n]) == null ? void 0 : l.data) == null ? void 0 : o[String(r)];
|
|
866
|
+
}, Wr = !!((lr = s.fulfilment) != null && lr.shipped_field) && (s.fulfilment.show_when ? br(s.fulfilment.show_when, S) : !0), Br = (e) => {
|
|
867
|
+
if (!Wr || !s.fulfilment) return null;
|
|
859
868
|
const t = Number(e[s.fulfilment.qty_field ?? z] ?? 0) || 0, n = Number(e[s.fulfilment.shipped_field] ?? 0) || 0, r = t > 0 && n >= t ? {
|
|
860
869
|
dot: "bg-emerald-500",
|
|
861
870
|
text: "text-emerald-700 dark:text-emerald-400",
|
|
@@ -883,7 +892,7 @@ function La({
|
|
|
883
892
|
]
|
|
884
893
|
}
|
|
885
894
|
);
|
|
886
|
-
},
|
|
895
|
+
}, zn = s.columns ?? [], Un = s.related_columns ?? [], Ft = zn.filter((e) => !e.summary_only), on = Un.filter((e) => !e.summary_only), Mn = zn.filter((e) => !e.sections_only), Vn = Un.filter((e) => !e.sections_only), Wn = Ft.length > 0 || on.length > 0, dn = je(null), Bn = (e) => {
|
|
887
896
|
let t = e.parentElement;
|
|
888
897
|
for (; t; ) {
|
|
889
898
|
const n = getComputedStyle(t);
|
|
@@ -893,14 +902,14 @@ function La({
|
|
|
893
902
|
}
|
|
894
903
|
t = t.parentElement;
|
|
895
904
|
}
|
|
896
|
-
},
|
|
897
|
-
dn.current = e, e &&
|
|
905
|
+
}, Dr = (e) => {
|
|
906
|
+
dn.current = e, e && Bn(e);
|
|
898
907
|
};
|
|
899
908
|
Fe(() => {
|
|
900
909
|
let e = 0;
|
|
901
910
|
const t = () => {
|
|
902
911
|
e || (e = requestAnimationFrame(() => {
|
|
903
|
-
e = 0, dn.current &&
|
|
912
|
+
e = 0, dn.current && Bn(dn.current);
|
|
904
913
|
}));
|
|
905
914
|
};
|
|
906
915
|
return window.addEventListener("scroll", t, !0), () => {
|
|
@@ -914,46 +923,46 @@ function La({
|
|
|
914
923
|
n = n[r];
|
|
915
924
|
}
|
|
916
925
|
return n;
|
|
917
|
-
}, ve = (e, t) => {
|
|
926
|
+
}, ve = (e, t, n) => {
|
|
918
927
|
if (t === "presence")
|
|
919
928
|
return e == null || e === "" || Number(e) === 0 ? "No" : "Yes";
|
|
920
929
|
if (e == null || e === "") return "—";
|
|
921
|
-
const
|
|
922
|
-
return t === "currency" ? Number.isNaN(
|
|
923
|
-
}, Rt = y ? `${y}:${i}.${m}` : null, Ce =
|
|
924
|
-
const n =
|
|
930
|
+
const r = Number(e);
|
|
931
|
+
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 }) : Nr(e, n);
|
|
932
|
+
}, Rt = y ? `${y}:${i}.${m}` : null, Ce = hr(Rt && `${Rt}:catalog`), Oe = hr(Rt && `${Rt}:summary`), Dn = je(null), Hr = (e, t) => {
|
|
933
|
+
const n = js(Dn.current, t);
|
|
925
934
|
n != null && e.setWidth(t, n);
|
|
926
935
|
}, Ot = (e, t, n, r, l) => {
|
|
927
936
|
const o = e.box(t, r, l);
|
|
928
|
-
return /* @__PURE__ */ u("span", { ...o, className:
|
|
937
|
+
return /* @__PURE__ */ u("span", { ...o, className: V("relative", o.className), children: [
|
|
929
938
|
/* @__PURE__ */ a("span", { "data-cpf-fit": !0, className: "block truncate", children: n }),
|
|
930
939
|
/* @__PURE__ */ a(
|
|
931
|
-
|
|
940
|
+
$s,
|
|
932
941
|
{
|
|
933
942
|
label: n,
|
|
934
|
-
onResize: (
|
|
935
|
-
onFit: () =>
|
|
943
|
+
onResize: (p) => e.setWidth(t, p),
|
|
944
|
+
onFit: () => Hr(e, t)
|
|
936
945
|
}
|
|
937
946
|
)
|
|
938
947
|
] }, t);
|
|
939
|
-
},
|
|
948
|
+
}, Yr = (or = Ft.find((e) => !e.format)) == null ? void 0 : or.field, Hn = (e) => e.format ? ["w-20 shrink-0", "text-right"] : e.field === Yr ? ["min-w-0 flex-[3]", ""] : ["w-36 shrink-0", ""], cn = (e, t, n) => /* @__PURE__ */ u(Se, { children: [
|
|
940
949
|
Ft.map((r) => {
|
|
941
|
-
const [l, o] =
|
|
950
|
+
const [l, o] = Hn(r);
|
|
942
951
|
return /* @__PURE__ */ a(
|
|
943
|
-
|
|
952
|
+
xr,
|
|
944
953
|
{
|
|
945
954
|
text: ve(
|
|
946
|
-
|
|
955
|
+
ta({
|
|
947
956
|
field: r.field,
|
|
948
957
|
catalogValue: Tt(t, r.field),
|
|
949
958
|
copyFields: s.copy_fields,
|
|
950
959
|
related: s.related_columns,
|
|
951
|
-
lookup: (
|
|
960
|
+
lookup: (p) => lt(p, e)
|
|
952
961
|
}),
|
|
953
962
|
r.format
|
|
954
963
|
),
|
|
955
964
|
highlight: r.format ? void 0 : n,
|
|
956
|
-
...Ce.box(r.field, l,
|
|
965
|
+
...Ce.box(r.field, l, V("text-slate-500 dark:text-slate-400", o))
|
|
957
966
|
},
|
|
958
967
|
r.field
|
|
959
968
|
);
|
|
@@ -971,23 +980,23 @@ function La({
|
|
|
971
980
|
r.key
|
|
972
981
|
)),
|
|
973
982
|
/* @__PURE__ */ a("span", { "aria-hidden": !0, className: "ml-auto" })
|
|
974
|
-
] }),
|
|
983
|
+
] }), Zr = gr(y), Yn = (e, t, n, r, l) => Zr ? /* @__PURE__ */ a(
|
|
975
984
|
"button",
|
|
976
985
|
{
|
|
977
986
|
type: "button",
|
|
978
987
|
"data-cpf-fit": r || void 0,
|
|
979
|
-
onClick: () => y &&
|
|
988
|
+
onClick: () => y && kr(y, e, S),
|
|
980
989
|
title: "View stock & planning detail",
|
|
981
|
-
className:
|
|
990
|
+
className: V(
|
|
982
991
|
n,
|
|
983
992
|
"text-left underline decoration-slate-300 decoration-1 underline-offset-2 hover:text-[#009abe] hover:decoration-[#009abe] dark:decoration-slate-600"
|
|
984
993
|
),
|
|
985
|
-
children: l ? /* @__PURE__ */ a(
|
|
994
|
+
children: l ? /* @__PURE__ */ a(kn, { text: t, query: l }) : t
|
|
986
995
|
}
|
|
987
|
-
) : /* @__PURE__ */ a("span", { className: n, "data-cpf-fit": r || void 0, children: l ? /* @__PURE__ */ a(
|
|
996
|
+
) : /* @__PURE__ */ a("span", { className: n, "data-cpf-fit": r || void 0, children: l ? /* @__PURE__ */ a(kn, { text: t, query: l }) : t }), un = (e, t, n, r) => {
|
|
988
997
|
const l = Ce.box("item", Wn ? "w-36 shrink-0" : "min-w-0 flex-1");
|
|
989
|
-
return /* @__PURE__ */ u("span", { ...l, className:
|
|
990
|
-
|
|
998
|
+
return /* @__PURE__ */ u("span", { ...l, className: V("flex min-w-0 items-center gap-1.5", l.className), children: [
|
|
999
|
+
Yn(
|
|
991
1000
|
e,
|
|
992
1001
|
t,
|
|
993
1002
|
"min-w-0 truncate text-slate-700 dark:text-slate-200",
|
|
@@ -999,14 +1008,14 @@ function La({
|
|
|
999
1008
|
}, Pt = (e) => {
|
|
1000
1009
|
const t = yt.get(e) ?? Ut.find((n) => String(n.id) === e) ?? nt.find((n) => String(n.id) === e);
|
|
1001
1010
|
return t ? Ae(C, t) : `#${e}`;
|
|
1002
|
-
},
|
|
1003
|
-
|
|
1004
|
-
const
|
|
1005
|
-
|
|
1006
|
-
() =>
|
|
1007
|
-
const t =
|
|
1011
|
+
}, Zn = je(Pt);
|
|
1012
|
+
Zn.current = Pt;
|
|
1013
|
+
const Gn = je(we);
|
|
1014
|
+
Gn.current = we, Fe(
|
|
1015
|
+
() => ws(i, (e) => {
|
|
1016
|
+
const t = Gn.current.find((o) => String(o.id) === String(e)), n = t == null ? void 0 : t[s.item_field], r = n && typeof n == "object" ? n.id : n;
|
|
1008
1017
|
if (r == null || r === "") return null;
|
|
1009
|
-
const l =
|
|
1018
|
+
const l = Zn.current(String(r));
|
|
1010
1019
|
return l.startsWith("#") ? null : l;
|
|
1011
1020
|
}),
|
|
1012
1021
|
[i, s.item_field]
|
|
@@ -1017,7 +1026,7 @@ function La({
|
|
|
1017
1026
|
if (t) return kt.has(String(t.id)) ? null : Number(t[z] ?? 0);
|
|
1018
1027
|
const n = wt.get(e);
|
|
1019
1028
|
return n === void 0 ? null : Number(((r = Re[n]) == null ? void 0 : r[z]) ?? 0);
|
|
1020
|
-
},
|
|
1029
|
+
}, Gr = (e) => {
|
|
1021
1030
|
let t = e;
|
|
1022
1031
|
for (const n of s.section_by.split(".")) {
|
|
1023
1032
|
if (t == null || typeof t != "object") return "";
|
|
@@ -1026,12 +1035,12 @@ function La({
|
|
|
1026
1035
|
return String(t ?? "").trim();
|
|
1027
1036
|
}, Lt = R(() => {
|
|
1028
1037
|
if (xt) return [];
|
|
1029
|
-
|
|
1038
|
+
W.trim().toLowerCase();
|
|
1030
1039
|
const e = /* @__PURE__ */ new Map();
|
|
1031
1040
|
for (const t of oe) {
|
|
1032
1041
|
if (ce && ot !== void 0 && !(Number(ot[String(t.id)]) > 0)) continue;
|
|
1033
|
-
const n = Ae(C, t), r = K ?
|
|
1034
|
-
if (!(K &&
|
|
1042
|
+
const n = Ae(C, t), r = K ? _n.get(String(t.id)) ?? [] : [Gr(t)];
|
|
1043
|
+
if (!(K && D && r.length === 0))
|
|
1035
1044
|
for (const l of r.length ? r : [""]) {
|
|
1036
1045
|
const o = l || "Uncategorized";
|
|
1037
1046
|
e.has(o) || e.set(o, []), e.get(o).push({ id: String(t.id), label: n, row: t });
|
|
@@ -1046,12 +1055,12 @@ function La({
|
|
|
1046
1055
|
}, [
|
|
1047
1056
|
oe,
|
|
1048
1057
|
C,
|
|
1049
|
-
|
|
1058
|
+
W,
|
|
1050
1059
|
s.section_by,
|
|
1051
1060
|
K,
|
|
1052
|
-
|
|
1061
|
+
_n,
|
|
1053
1062
|
xt,
|
|
1054
|
-
|
|
1063
|
+
D,
|
|
1055
1064
|
ce,
|
|
1056
1065
|
ot
|
|
1057
1066
|
]);
|
|
@@ -1062,7 +1071,7 @@ function La({
|
|
|
1062
1071
|
t.items.some((r) => (qe(r.id) ?? 0) > 0) || e.add(t.name);
|
|
1063
1072
|
ge(e);
|
|
1064
1073
|
}
|
|
1065
|
-
async function
|
|
1074
|
+
async function Xr(e) {
|
|
1066
1075
|
const t = {};
|
|
1067
1076
|
for (const n of s.related_columns ?? []) {
|
|
1068
1077
|
if (!n.copy_to) continue;
|
|
@@ -1077,8 +1086,8 @@ function La({
|
|
|
1077
1086
|
filter: JSON.stringify({ ...l, [n.item_field]: { _eq: e } })
|
|
1078
1087
|
})
|
|
1079
1088
|
).then((o) => {
|
|
1080
|
-
var
|
|
1081
|
-
return (c = (
|
|
1089
|
+
var p, c;
|
|
1090
|
+
return (c = (p = o.data) == null ? void 0 : p[0]) == null ? void 0 : c[n.value_field];
|
|
1082
1091
|
}).catch(() => {
|
|
1083
1092
|
});
|
|
1084
1093
|
}
|
|
@@ -1090,14 +1099,14 @@ function La({
|
|
|
1090
1099
|
var l;
|
|
1091
1100
|
for (const o of s.related_columns ?? []) {
|
|
1092
1101
|
if (o.copy_to !== t) continue;
|
|
1093
|
-
const
|
|
1094
|
-
if (
|
|
1102
|
+
const p = lt(o.key, e);
|
|
1103
|
+
if (p != null && p !== "") return p;
|
|
1095
1104
|
}
|
|
1096
1105
|
const n = (l = s.copy_fields) == null ? void 0 : l[t];
|
|
1097
1106
|
if (!n) return;
|
|
1098
|
-
const r =
|
|
1107
|
+
const r = Cr.get(e.toUpperCase());
|
|
1099
1108
|
return r && n in r ? r[n] : Ue(e)[n];
|
|
1100
|
-
},
|
|
1109
|
+
}, Xn = je(/* @__PURE__ */ new Map()), ct = R(() => {
|
|
1101
1110
|
const e = new Set(Object.keys(s.copy_fields ?? {}));
|
|
1102
1111
|
for (const t of s.related_columns ?? []) t.copy_to && e.add(t.copy_to);
|
|
1103
1112
|
return [...e];
|
|
@@ -1106,8 +1115,8 @@ function La({
|
|
|
1106
1115
|
var t;
|
|
1107
1116
|
return !(e in (s.compute_fields ?? {})) && (((t = s.field_formats) == null ? void 0 : t[e]) === "currency" || /(^|_)price$/i.test(e));
|
|
1108
1117
|
}
|
|
1109
|
-
),
|
|
1110
|
-
const r =
|
|
1118
|
+
), es = (e, t) => fn.map((n) => {
|
|
1119
|
+
const r = Ks(e[n], mn(t, n));
|
|
1111
1120
|
return r ? { field: n, change: r } : null;
|
|
1112
1121
|
}).filter((n) => !!n), pn = R(() => {
|
|
1113
1122
|
const e = (s.related_columns ?? []).find((t) => {
|
|
@@ -1119,23 +1128,23 @@ function La({
|
|
|
1119
1128
|
if (typeof n == "string" && n.startsWith("$parent.")) return n.slice(8);
|
|
1120
1129
|
}
|
|
1121
1130
|
return null;
|
|
1122
|
-
}, [s.related_columns, (
|
|
1131
|
+
}, [s.related_columns, (dr = s.qty_warning) == null ? void 0 : dr.column]), ts = Ps(
|
|
1123
1132
|
k ? null : g,
|
|
1124
1133
|
pn,
|
|
1125
1134
|
pn ? S == null ? void 0 : S[pn] : null
|
|
1126
1135
|
);
|
|
1127
|
-
|
|
1136
|
+
Ls({
|
|
1128
1137
|
enabled: !k && Ne.length > 0,
|
|
1129
1138
|
catalogCol: y,
|
|
1130
1139
|
pickedIds: at,
|
|
1131
1140
|
related: (s.related_columns ?? []).filter(
|
|
1132
1141
|
(e, t) => {
|
|
1133
1142
|
var n;
|
|
1134
|
-
return t ===
|
|
1143
|
+
return t === Ve || e.key === ((n = s.qty_warning) == null ? void 0 : n.column) || !!e.copy_to && fn.includes(e.copy_to);
|
|
1135
1144
|
}
|
|
1136
1145
|
).map((e) => ({ key: e.key, collection: e.collection }))
|
|
1137
1146
|
});
|
|
1138
|
-
const
|
|
1147
|
+
const ns = JSON.stringify([
|
|
1139
1148
|
Re.map((e) => [e[s.item_field], ...ct.map((t) => e[t] ?? null)]),
|
|
1140
1149
|
it.map((e) => e.dataUpdatedAt),
|
|
1141
1150
|
oe.length,
|
|
@@ -1145,23 +1154,23 @@ function La({
|
|
|
1145
1154
|
k || !v || ct.length === 0 || Re.forEach((e, t) => {
|
|
1146
1155
|
const n = e[s.item_field];
|
|
1147
1156
|
if (n == null) return;
|
|
1148
|
-
const r =
|
|
1157
|
+
const r = Ds(
|
|
1149
1158
|
e,
|
|
1150
1159
|
ct,
|
|
1151
1160
|
(o) => mn(String(n), o),
|
|
1152
|
-
|
|
1161
|
+
Xn.current.get(String(n))
|
|
1153
1162
|
);
|
|
1154
1163
|
if (!r) return;
|
|
1155
|
-
|
|
1164
|
+
Xn.current.set(String(n), r.auto);
|
|
1156
1165
|
const l = { ...e, ...r.updates };
|
|
1157
|
-
for (const [o,
|
|
1158
|
-
const c = Ee(
|
|
1166
|
+
for (const [o, p] of Object.entries(s.compute_fields ?? {})) {
|
|
1167
|
+
const c = Ee(p, l);
|
|
1159
1168
|
c !== null && (l[o] = c);
|
|
1160
1169
|
}
|
|
1161
1170
|
v.updateRow(i, m, t, l);
|
|
1162
1171
|
});
|
|
1163
|
-
}, [
|
|
1164
|
-
const
|
|
1172
|
+
}, [ns, k, ct]);
|
|
1173
|
+
const rs = (e, t) => {
|
|
1165
1174
|
if (k || !M.includes(t)) return !1;
|
|
1166
1175
|
if (fe || !me.includes(t)) return !0;
|
|
1167
1176
|
const n = mn(e, t);
|
|
@@ -1172,28 +1181,28 @@ function La({
|
|
|
1172
1181
|
[s.item_field]: n.id ?? e,
|
|
1173
1182
|
[z]: t
|
|
1174
1183
|
};
|
|
1175
|
-
for (const [o,
|
|
1176
|
-
n[
|
|
1184
|
+
for (const [o, p] of Object.entries(s.copy_fields ?? {}))
|
|
1185
|
+
n[p] !== void 0 && (l[o] = n[p]);
|
|
1177
1186
|
Object.assign(l, r);
|
|
1178
|
-
for (const [o,
|
|
1179
|
-
const c = Ee(
|
|
1187
|
+
for (const [o, p] of Object.entries(s.compute_fields ?? {})) {
|
|
1188
|
+
const c = Ee(p, l);
|
|
1180
1189
|
c !== null && (l[o] = c);
|
|
1181
1190
|
}
|
|
1182
1191
|
return l;
|
|
1183
1192
|
}
|
|
1184
|
-
function
|
|
1185
|
-
return
|
|
1193
|
+
function ss(e, t, n, r) {
|
|
1194
|
+
return ea({
|
|
1186
1195
|
compute: s.compute_fields ?? {},
|
|
1187
1196
|
probe: { ...He(e, t, n), ...r, [z]: t },
|
|
1188
1197
|
ruleError: P,
|
|
1189
1198
|
labelOf: (l) => {
|
|
1190
1199
|
var o;
|
|
1191
|
-
return ((o = N.find((
|
|
1200
|
+
return ((o = N.find((p) => p.field === l)) == null ? void 0 : o.label) || G(l);
|
|
1192
1201
|
}
|
|
1193
1202
|
});
|
|
1194
1203
|
}
|
|
1195
1204
|
async function Ye(e, t, n, r = {}) {
|
|
1196
|
-
const l =
|
|
1205
|
+
const l = wn(t, { type: E, min: 0, label: "Quantity" });
|
|
1197
1206
|
if (!l.ok) {
|
|
1198
1207
|
se((h) => ({ ...h, [e]: { kind: "error", message: l.message } }));
|
|
1199
1208
|
return;
|
|
@@ -1205,13 +1214,13 @@ function La({
|
|
|
1205
1214
|
return;
|
|
1206
1215
|
}
|
|
1207
1216
|
if (o > 0) {
|
|
1208
|
-
const h = wt.get(e), b = (T ? void 0 : tt.get(e)) ?? (h !== void 0 ? Re[h] : void 0) ?? {}, q = P(z, o, b) ??
|
|
1217
|
+
const h = wt.get(e), b = (T ? void 0 : tt.get(e)) ?? (h !== void 0 ? Re[h] : void 0) ?? {}, q = P(z, o, b) ?? ss(e, o, n, b);
|
|
1209
1218
|
if (q) {
|
|
1210
1219
|
se(($) => ({ ...$, [e]: { kind: "error", message: q } }));
|
|
1211
1220
|
return;
|
|
1212
1221
|
}
|
|
1213
1222
|
}
|
|
1214
|
-
const c = o > 0 ? await
|
|
1223
|
+
const c = o > 0 ? await Xr(e) : {};
|
|
1215
1224
|
if (et && v) {
|
|
1216
1225
|
const h = tt.get(e);
|
|
1217
1226
|
if ((h == null ? void 0 : h.id) != null) {
|
|
@@ -1241,7 +1250,7 @@ function La({
|
|
|
1241
1250
|
i,
|
|
1242
1251
|
m,
|
|
1243
1252
|
h,
|
|
1244
|
-
|
|
1253
|
+
Is(
|
|
1245
1254
|
Re[h],
|
|
1246
1255
|
He(e, o, n, c),
|
|
1247
1256
|
M,
|
|
@@ -1254,11 +1263,11 @@ function La({
|
|
|
1254
1263
|
);
|
|
1255
1264
|
return;
|
|
1256
1265
|
}
|
|
1257
|
-
|
|
1266
|
+
X((h) => new Set(h).add(e));
|
|
1258
1267
|
try {
|
|
1259
1268
|
const h = tt.get(e);
|
|
1260
1269
|
if (o === 0)
|
|
1261
|
-
(h == null ? void 0 : h.id) != null && await w.request(
|
|
1270
|
+
(h == null ? void 0 : h.id) != null && await w.request(ps(`/items/${i}/${h.id}${be}`));
|
|
1262
1271
|
else if ((h == null ? void 0 : h.id) != null) {
|
|
1263
1272
|
const b = He(e, o, n, c);
|
|
1264
1273
|
for (const x of M)
|
|
@@ -1268,28 +1277,28 @@ function La({
|
|
|
1268
1277
|
$e !== null && (b[x] = $e);
|
|
1269
1278
|
}
|
|
1270
1279
|
const q = { ...h, ...b }, { id: $, ...J } = q;
|
|
1271
|
-
await w.request(
|
|
1280
|
+
await w.request(fr(`/items/${i}/${h.id}${be}`, J));
|
|
1272
1281
|
} else
|
|
1273
1282
|
await w.request(
|
|
1274
|
-
|
|
1275
|
-
[m]:
|
|
1283
|
+
pr(`/items/${i}${be}`, {
|
|
1284
|
+
[m]: f,
|
|
1276
1285
|
...He(e, o, n, c)
|
|
1277
1286
|
})
|
|
1278
1287
|
);
|
|
1279
|
-
O.invalidateQueries({ queryKey: ["o2m-rows", i, m,
|
|
1288
|
+
O.invalidateQueries({ queryKey: ["o2m-rows", i, m, f] });
|
|
1280
1289
|
} catch {
|
|
1281
1290
|
} finally {
|
|
1282
|
-
|
|
1291
|
+
X((h) => {
|
|
1283
1292
|
const b = new Set(h);
|
|
1284
1293
|
return b.delete(e), b;
|
|
1285
1294
|
});
|
|
1286
1295
|
}
|
|
1287
1296
|
}
|
|
1288
|
-
async function
|
|
1297
|
+
async function er(e, t, n) {
|
|
1289
1298
|
const r = n.trim() === "" ? null : Number(n);
|
|
1290
1299
|
if (n.trim() !== "" && Number.isNaN(r)) return;
|
|
1291
|
-
const l = (
|
|
1292
|
-
const c = { ...
|
|
1300
|
+
const l = (p) => {
|
|
1301
|
+
const c = { ...p, [t]: r };
|
|
1293
1302
|
for (const [h, b] of Object.entries(s.compute_fields ?? {})) {
|
|
1294
1303
|
const q = Ee(b, c);
|
|
1295
1304
|
q !== null && (c[h] = q);
|
|
@@ -1297,33 +1306,33 @@ function La({
|
|
|
1297
1306
|
return c;
|
|
1298
1307
|
}, o = T ? void 0 : tt.get(e);
|
|
1299
1308
|
if ((o == null ? void 0 : o.id) == null) {
|
|
1300
|
-
const
|
|
1301
|
-
if (
|
|
1302
|
-
v == null || v.updateRow(i, m,
|
|
1309
|
+
const p = wt.get(e);
|
|
1310
|
+
if (p === void 0) return;
|
|
1311
|
+
v == null || v.updateRow(i, m, p, l(Re[p]));
|
|
1303
1312
|
return;
|
|
1304
1313
|
}
|
|
1305
1314
|
if (et && v) {
|
|
1306
|
-
const
|
|
1307
|
-
Object.entries(
|
|
1315
|
+
const p = l(o), c = we.find((b) => String(b.id) === String(o.id)) ?? {}, h = Object.fromEntries(
|
|
1316
|
+
Object.entries(p).filter(
|
|
1308
1317
|
([b, q]) => b !== "id" && String(q ?? "") !== String(c[b] ?? "")
|
|
1309
1318
|
)
|
|
1310
1319
|
);
|
|
1311
1320
|
v.cancelPendingEdit(i, m, String(o.id)), Object.keys(h).length > 0 && v.queueEdit(i, m, String(o.id), h);
|
|
1312
1321
|
return;
|
|
1313
1322
|
}
|
|
1314
|
-
|
|
1323
|
+
X((p) => new Set(p).add(e));
|
|
1315
1324
|
try {
|
|
1316
|
-
const { id:
|
|
1317
|
-
await w.request(
|
|
1325
|
+
const { id: p, ...c } = l(o);
|
|
1326
|
+
await w.request(fr(`/items/${i}/${o.id}${be}`, c)), O.invalidateQueries({ queryKey: ["o2m-rows", i, m, f] });
|
|
1318
1327
|
} catch {
|
|
1319
1328
|
} finally {
|
|
1320
|
-
|
|
1321
|
-
const c = new Set(
|
|
1329
|
+
X((p) => {
|
|
1330
|
+
const c = new Set(p);
|
|
1322
1331
|
return c.delete(e), c;
|
|
1323
1332
|
});
|
|
1324
1333
|
}
|
|
1325
1334
|
}
|
|
1326
|
-
async function
|
|
1335
|
+
async function as(e) {
|
|
1327
1336
|
if (e == null || e === "" || !y) return;
|
|
1328
1337
|
const t = String(e), n = Ue(t);
|
|
1329
1338
|
let r = n;
|
|
@@ -1334,17 +1343,17 @@ function La({
|
|
|
1334
1343
|
limit: 1
|
|
1335
1344
|
})
|
|
1336
1345
|
).then((o) => {
|
|
1337
|
-
var
|
|
1338
|
-
return ((
|
|
1346
|
+
var p;
|
|
1347
|
+
return ((p = o.data) == null ? void 0 : p[0]) ?? { id: e };
|
|
1339
1348
|
}).catch(() => ({ id: e })));
|
|
1340
1349
|
const l = (qe(t) ?? 0) + 1;
|
|
1341
1350
|
await Ye(t, String(l), r);
|
|
1342
1351
|
}
|
|
1343
|
-
const
|
|
1352
|
+
const is = Ne.length, Et = Object.keys(s.copy_fields ?? {}), Ze = Object.keys(s.compute_fields ?? {}), Ct = (e, t) => {
|
|
1344
1353
|
const n = qe(e);
|
|
1345
1354
|
if (k)
|
|
1346
1355
|
return /* @__PURE__ */ a("span", { className: "inline-block w-20 shrink-0 text-right tabular-nums text-slate-700 dark:text-slate-200", children: n && n > 0 ? n.toLocaleString("en-US") : "—" });
|
|
1347
|
-
const r = he[e], l = r !== void 0 ? r : n && n > 0 ? String(n) : "", o = B[e],
|
|
1356
|
+
const r = he[e], l = r !== void 0 ? r : n && n > 0 ? String(n) : "", o = B[e], p = () => se((h) => {
|
|
1348
1357
|
if (!(e in h)) return h;
|
|
1349
1358
|
const b = { ...h };
|
|
1350
1359
|
return delete b[e], b;
|
|
@@ -1358,17 +1367,17 @@ function La({
|
|
|
1358
1367
|
value: l,
|
|
1359
1368
|
placeholder: "0",
|
|
1360
1369
|
"aria-invalid": (o == null ? void 0 : o.kind) === "error" || void 0,
|
|
1361
|
-
onFocus:
|
|
1370
|
+
onFocus: p,
|
|
1362
1371
|
onChange: (h) => re((b) => ({ ...b, [e]: h.target.value })),
|
|
1363
1372
|
onBlur: (h) => {
|
|
1364
|
-
const b = h.target.value, q =
|
|
1373
|
+
const b = h.target.value, q = Ys(b, E);
|
|
1365
1374
|
if (q) {
|
|
1366
1375
|
re(($) => {
|
|
1367
1376
|
const J = { ...$ };
|
|
1368
1377
|
return delete J[e], J;
|
|
1369
1378
|
}), se(($) => ({
|
|
1370
1379
|
...$,
|
|
1371
|
-
[e]: { kind: "error", message:
|
|
1380
|
+
[e]: { kind: "error", message: Xs(q, b) }
|
|
1372
1381
|
}));
|
|
1373
1382
|
return;
|
|
1374
1383
|
}
|
|
@@ -1380,7 +1389,7 @@ function La({
|
|
|
1380
1389
|
onKeyDown: (h) => {
|
|
1381
1390
|
h.key === "Enter" && h.currentTarget.blur();
|
|
1382
1391
|
},
|
|
1383
|
-
className:
|
|
1392
|
+
className: V(
|
|
1384
1393
|
"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",
|
|
1385
1394
|
(o == null ? void 0 : o.kind) === "error" && "border-red-400 dark:border-red-600"
|
|
1386
1395
|
)
|
|
@@ -1413,7 +1422,7 @@ function La({
|
|
|
1413
1422
|
"button",
|
|
1414
1423
|
{
|
|
1415
1424
|
type: "button",
|
|
1416
|
-
onClick:
|
|
1425
|
+
onClick: p,
|
|
1417
1426
|
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",
|
|
1418
1427
|
children: "Keep"
|
|
1419
1428
|
}
|
|
@@ -1424,7 +1433,7 @@ function La({
|
|
|
1424
1433
|
type: "button",
|
|
1425
1434
|
onClick: () => {
|
|
1426
1435
|
const h = o.row;
|
|
1427
|
-
|
|
1436
|
+
p(), Ye(e, "0", h, { confirmedRemove: !0 });
|
|
1428
1437
|
},
|
|
1429
1438
|
className: "h-6 rounded bg-red-600 px-2 text-[11px] font-medium text-white hover:bg-red-700",
|
|
1430
1439
|
children: "Remove"
|
|
@@ -1434,12 +1443,12 @@ function La({
|
|
|
1434
1443
|
}
|
|
1435
1444
|
)
|
|
1436
1445
|
] });
|
|
1437
|
-
},
|
|
1446
|
+
}, ls = (e, t, n) => {
|
|
1438
1447
|
const r = `${e}:${t}`, l = ie[r], o = () => _e((b) => {
|
|
1439
1448
|
if (!(r in b)) return b;
|
|
1440
1449
|
const q = { ...b };
|
|
1441
1450
|
return delete q[r], q;
|
|
1442
|
-
}),
|
|
1451
|
+
}), p = n[t] == null ? "" : String(n[t]), c = N.find((b) => b.field === t), h = !mt(c == null ? void 0 : c.type);
|
|
1443
1452
|
return /* @__PURE__ */ u("span", { className: "inline-flex shrink-0 flex-col items-end", children: [
|
|
1444
1453
|
/* @__PURE__ */ a(
|
|
1445
1454
|
"input",
|
|
@@ -1447,29 +1456,29 @@ function La({
|
|
|
1447
1456
|
type: "number",
|
|
1448
1457
|
min: 0,
|
|
1449
1458
|
step: h ? "0.01" : "any",
|
|
1450
|
-
defaultValue:
|
|
1459
|
+
defaultValue: p,
|
|
1451
1460
|
"aria-invalid": !!l || void 0,
|
|
1452
1461
|
onFocus: o,
|
|
1453
1462
|
onBlur: (b) => {
|
|
1454
1463
|
const q = b.target.value;
|
|
1455
|
-
if (q !==
|
|
1456
|
-
const $ = c, J = ($ == null ? void 0 : $.label) ||
|
|
1464
|
+
if (q !== p) {
|
|
1465
|
+
const $ = c, J = ($ == null ? void 0 : $.label) || G(t), x = wn(q, { type: $ == null ? void 0 : $.type, label: J }), I = x.ok ? (h ? Qs(q, J) : null) ?? P(t, x.value, n) : x.message;
|
|
1457
1466
|
if (I) {
|
|
1458
|
-
b.target.value =
|
|
1467
|
+
b.target.value = p, _e(($e) => ({ ...$e, [r]: I }));
|
|
1459
1468
|
return;
|
|
1460
1469
|
}
|
|
1461
1470
|
}
|
|
1462
|
-
|
|
1471
|
+
er(e, t, q);
|
|
1463
1472
|
},
|
|
1464
1473
|
onKeyDown: (b) => {
|
|
1465
1474
|
b.key === "Enter" && b.currentTarget.blur();
|
|
1466
1475
|
},
|
|
1467
|
-
className:
|
|
1476
|
+
className: V(
|
|
1468
1477
|
"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",
|
|
1469
1478
|
l && "border-red-400 dark:border-red-600"
|
|
1470
1479
|
)
|
|
1471
1480
|
},
|
|
1472
|
-
`${r}:${
|
|
1481
|
+
`${r}:${p}`
|
|
1473
1482
|
),
|
|
1474
1483
|
l && /* @__PURE__ */ u(
|
|
1475
1484
|
"span",
|
|
@@ -1480,7 +1489,7 @@ function La({
|
|
|
1480
1489
|
children: [
|
|
1481
1490
|
/* @__PURE__ */ a(hn, { className: "mt-px h-3 w-3 shrink-0" }),
|
|
1482
1491
|
l,
|
|
1483
|
-
|
|
1492
|
+
p !== "" ? ` — still ${p}` : ""
|
|
1484
1493
|
]
|
|
1485
1494
|
}
|
|
1486
1495
|
)
|
|
@@ -1489,7 +1498,7 @@ function La({
|
|
|
1489
1498
|
return !y && F ? /* @__PURE__ */ u("div", { className: "space-y-2 py-1", "aria-busy": "true", children: [
|
|
1490
1499
|
/* @__PURE__ */ a("div", { className: "h-8 w-full animate-pulse rounded bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" }),
|
|
1491
1500
|
/* @__PURE__ */ a("div", { className: "h-8 w-2/3 animate-pulse rounded bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" })
|
|
1492
|
-
] }) : y ? /* @__PURE__ */ u("div", { ref:
|
|
1501
|
+
] }) : y ? /* @__PURE__ */ u("div", { ref: Dn, className: "space-y-3", children: [
|
|
1493
1502
|
!k && /* @__PURE__ */ u(Se, { children: [
|
|
1494
1503
|
/* @__PURE__ */ u("div", { className: "rounded-lg border border-slate-200 text-[12px] dark:border-border", children: [
|
|
1495
1504
|
/* @__PURE__ */ u("div", { className: "flex items-center gap-2 border-b border-slate-200 px-3 py-2 dark:border-border", children: [
|
|
@@ -1497,7 +1506,7 @@ function La({
|
|
|
1497
1506
|
/* @__PURE__ */ a(
|
|
1498
1507
|
"input",
|
|
1499
1508
|
{
|
|
1500
|
-
value:
|
|
1509
|
+
value: W,
|
|
1501
1510
|
onChange: (e) => Te(e.target.value),
|
|
1502
1511
|
placeholder: "Search catalog…",
|
|
1503
1512
|
className: "w-full bg-transparent text-[12px] outline-none placeholder:text-slate-400"
|
|
@@ -1510,26 +1519,26 @@ function La({
|
|
|
1510
1519
|
"aria-pressed": ce,
|
|
1511
1520
|
"aria-disabled": Le === null ? "true" : void 0,
|
|
1512
1521
|
onClick: () => {
|
|
1513
|
-
Le !== null &&
|
|
1522
|
+
Le !== null && Wt(!Ln);
|
|
1514
1523
|
},
|
|
1515
1524
|
"data-catalog-in-stock": ce ? "on" : "off",
|
|
1516
|
-
"data-tip": Le === null ? `Choose ${
|
|
1517
|
-
className:
|
|
1525
|
+
"data-tip": Le === null ? `Choose ${Tr ?? "where stock is counted"} to show only items in stock there` : ce ? "Showing only items with stock on hand — click to show everything" : "Show only items with stock on hand",
|
|
1526
|
+
className: V(
|
|
1518
1527
|
"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",
|
|
1519
1528
|
ce ? "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"
|
|
1520
1529
|
),
|
|
1521
1530
|
children: [
|
|
1522
|
-
|
|
1531
|
+
Kr ? /* @__PURE__ */ a(ue, { className: "h-3 w-3 shrink-0 animate-spin" }) : /* @__PURE__ */ a(ds, { className: "h-3 w-3 shrink-0" }),
|
|
1523
1532
|
/* @__PURE__ */ u("span", { className: "truncate", children: [
|
|
1524
1533
|
"In stock",
|
|
1525
|
-
Le !== null && ze &&
|
|
1534
|
+
Le !== null && ze && Pn != null && /* @__PURE__ */ u(Se, { children: [
|
|
1526
1535
|
" at ",
|
|
1527
1536
|
/* @__PURE__ */ a(
|
|
1528
|
-
|
|
1537
|
+
la,
|
|
1529
1538
|
{
|
|
1530
1539
|
parentCollection: g,
|
|
1531
1540
|
field: ze,
|
|
1532
|
-
id:
|
|
1541
|
+
id: Pn
|
|
1533
1542
|
}
|
|
1534
1543
|
)
|
|
1535
1544
|
] })
|
|
@@ -1539,10 +1548,10 @@ function La({
|
|
|
1539
1548
|
),
|
|
1540
1549
|
de && Le === null && /* @__PURE__ */ a("span", { className: "shrink-0 text-[11px] text-slate-500 dark:text-slate-400", children: "Pick a place first" }),
|
|
1541
1550
|
/* @__PURE__ */ u("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: [
|
|
1542
|
-
|
|
1551
|
+
is,
|
|
1543
1552
|
" picked"
|
|
1544
1553
|
] }),
|
|
1545
|
-
/* @__PURE__ */ a(
|
|
1554
|
+
/* @__PURE__ */ a(xn, { show: Ce.customized, onReset: Ce.reset })
|
|
1546
1555
|
] }),
|
|
1547
1556
|
Wn && // Sticky: the catalog list is tall and the page scroller carries it —
|
|
1548
1557
|
// without this the labels scroll away and favorites/section rows
|
|
@@ -1551,17 +1560,17 @@ function La({
|
|
|
1551
1560
|
/* @__PURE__ */ u(
|
|
1552
1561
|
"div",
|
|
1553
1562
|
{
|
|
1554
|
-
ref:
|
|
1563
|
+
ref: Dr,
|
|
1555
1564
|
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",
|
|
1556
1565
|
children: [
|
|
1557
1566
|
s.favorites && /* @__PURE__ */ a("span", { className: "w-[18px] shrink-0" }),
|
|
1558
1567
|
Ot(Ce, "item", "Item", "w-36 shrink-0"),
|
|
1559
1568
|
Ft.map((e) => {
|
|
1560
|
-
const [t, n] =
|
|
1569
|
+
const [t, n] = Hn(e);
|
|
1561
1570
|
return Ot(
|
|
1562
1571
|
Ce,
|
|
1563
1572
|
e.field,
|
|
1564
|
-
e.label ??
|
|
1573
|
+
e.label ?? G(e.field.split(".")[0]),
|
|
1565
1574
|
t,
|
|
1566
1575
|
n
|
|
1567
1576
|
);
|
|
@@ -1570,7 +1579,7 @@ function La({
|
|
|
1570
1579
|
(e) => Ot(
|
|
1571
1580
|
Ce,
|
|
1572
1581
|
`rel:${e.key}`,
|
|
1573
|
-
e.label ??
|
|
1582
|
+
e.label ?? G(e.key),
|
|
1574
1583
|
"w-20 shrink-0",
|
|
1575
1584
|
"text-right"
|
|
1576
1585
|
)
|
|
@@ -1581,20 +1590,20 @@ function La({
|
|
|
1581
1590
|
]
|
|
1582
1591
|
}
|
|
1583
1592
|
),
|
|
1584
|
-
|
|
1593
|
+
W.trim().length > 0 && dt.length === 0 && tn && /* @__PURE__ */ u("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: [
|
|
1585
1594
|
/* @__PURE__ */ a(ue, { className: "h-3.5 w-3.5 animate-spin" }),
|
|
1586
1595
|
" Searching the catalog…"
|
|
1587
1596
|
] }),
|
|
1588
|
-
|
|
1597
|
+
W.trim().length > 0 && dt.length === 0 && !tn && /* @__PURE__ */ a("p", { className: "px-3 py-4 text-center text-slate-500 dark:text-slate-400", children: ce && Be.length > 0 ? /* @__PURE__ */ u(Se, { children: [
|
|
1589
1598
|
'Nothing in stock matches "',
|
|
1590
|
-
|
|
1599
|
+
W.trim(),
|
|
1591
1600
|
'" —',
|
|
1592
1601
|
" ",
|
|
1593
1602
|
/* @__PURE__ */ u(
|
|
1594
1603
|
"button",
|
|
1595
1604
|
{
|
|
1596
1605
|
type: "button",
|
|
1597
|
-
onClick: () =>
|
|
1606
|
+
onClick: () => Wt(!1),
|
|
1598
1607
|
className: "font-medium text-[#00728d] underline-offset-2 hover:underline dark:text-nvr-cyan",
|
|
1599
1608
|
children: [
|
|
1600
1609
|
"show ",
|
|
@@ -1605,14 +1614,14 @@ function La({
|
|
|
1605
1614
|
)
|
|
1606
1615
|
] }) : /* @__PURE__ */ u(Se, { children: [
|
|
1607
1616
|
'No items match "',
|
|
1608
|
-
|
|
1617
|
+
W.trim(),
|
|
1609
1618
|
'"'
|
|
1610
1619
|
] }) }),
|
|
1611
|
-
|
|
1620
|
+
W.trim().length > 0 && dt.length > 0 && /* @__PURE__ */ u(ut, { children: [
|
|
1612
1621
|
/* @__PURE__ */ u("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: [
|
|
1613
1622
|
/* @__PURE__ */ a(At, { className: "h-3 w-3 shrink-0 text-sky-500" }),
|
|
1614
1623
|
/* @__PURE__ */ a("span", { className: "text-[11px] font-semibold text-slate-600 dark:text-slate-300", children: "Search results" }),
|
|
1615
|
-
/* @__PURE__ */ a("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 }),
|
|
1624
|
+
/* @__PURE__ */ a("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: bn(dt.length) }),
|
|
1616
1625
|
/* @__PURE__ */ u("span", { className: "text-[11px] text-slate-500 dark:text-slate-400", children: [
|
|
1617
1626
|
"across the entire catalog",
|
|
1618
1627
|
ce ? ", in stock only" : "",
|
|
@@ -1625,18 +1634,18 @@ function La({
|
|
|
1625
1634
|
return /* @__PURE__ */ u(
|
|
1626
1635
|
"div",
|
|
1627
1636
|
{
|
|
1628
|
-
className:
|
|
1637
|
+
className: V(
|
|
1629
1638
|
"flex items-center gap-4 border-b border-slate-100 px-3 py-1 dark:border-border/50",
|
|
1630
1639
|
t % 2 === 0 ? "bg-white dark:bg-background" : "bg-slate-50/50 dark:bg-muted/30",
|
|
1631
1640
|
(r ?? 0) > 0 && "bg-nvr-cyan/5"
|
|
1632
1641
|
),
|
|
1633
1642
|
children: [
|
|
1634
|
-
|
|
1643
|
+
Vt(n),
|
|
1635
1644
|
un(
|
|
1636
1645
|
n,
|
|
1637
1646
|
Ae(C, e),
|
|
1638
1647
|
(() => {
|
|
1639
|
-
const l =
|
|
1648
|
+
const l = Er(e), o = Rr.has(n);
|
|
1640
1649
|
return !l && !o ? null : /* @__PURE__ */ u(Se, { children: [
|
|
1641
1650
|
o && /* @__PURE__ */ a(
|
|
1642
1651
|
"span",
|
|
@@ -1670,32 +1679,32 @@ function La({
|
|
|
1670
1679
|
);
|
|
1671
1680
|
})
|
|
1672
1681
|
] }),
|
|
1673
|
-
ae.length > 0 && !
|
|
1682
|
+
ae.length > 0 && !W.trim() && /* @__PURE__ */ u("p", { className: "px-3 py-6 text-center text-slate-400", children: [
|
|
1674
1683
|
"Search the full catalog above, or select",
|
|
1675
1684
|
" ",
|
|
1676
1685
|
ae.map((e) => {
|
|
1677
1686
|
var t;
|
|
1678
|
-
return ((t = L == null ? void 0 : L.fieldLabels) == null ? void 0 : t[e]) ??
|
|
1687
|
+
return ((t = L == null ? void 0 : L.fieldLabels) == null ? void 0 : t[e]) ?? G(e);
|
|
1679
1688
|
}).join(", "),
|
|
1680
1689
|
" ",
|
|
1681
1690
|
"to browse by category"
|
|
1682
1691
|
] }),
|
|
1683
|
-
ae.length === 0 && (
|
|
1692
|
+
ae.length === 0 && (vn || xt) && /* @__PURE__ */ u("div", { className: "flex items-center justify-center gap-2 py-6 text-slate-500 dark:text-slate-400", children: [
|
|
1684
1693
|
/* @__PURE__ */ a(ue, { className: "h-4 w-4 animate-spin" }),
|
|
1685
1694
|
" Loading catalog…"
|
|
1686
1695
|
] }),
|
|
1687
|
-
ae.length === 0 && !
|
|
1696
|
+
ae.length === 0 && !vn && !xt && Lt.length === 0 && /* @__PURE__ */ a("p", { className: "px-3 py-6 text-center text-slate-500 dark:text-slate-400", children: ce && oe.length > 0 ? /* @__PURE__ */ u(Se, { children: [
|
|
1688
1697
|
"Nothing in this catalog is in stock here —",
|
|
1689
1698
|
" ",
|
|
1690
1699
|
/* @__PURE__ */ u(
|
|
1691
1700
|
"button",
|
|
1692
1701
|
{
|
|
1693
1702
|
type: "button",
|
|
1694
|
-
onClick: () =>
|
|
1703
|
+
onClick: () => Wt(!1),
|
|
1695
1704
|
className: "font-medium text-[#00728d] underline-offset-2 hover:underline dark:text-nvr-cyan",
|
|
1696
1705
|
children: [
|
|
1697
1706
|
"show all ",
|
|
1698
|
-
oe.length
|
|
1707
|
+
bn(oe.length)
|
|
1699
1708
|
]
|
|
1700
1709
|
}
|
|
1701
1710
|
)
|
|
@@ -1715,7 +1724,7 @@ function La({
|
|
|
1715
1724
|
/* @__PURE__ */ a(
|
|
1716
1725
|
Jt,
|
|
1717
1726
|
{
|
|
1718
|
-
className:
|
|
1727
|
+
className: V(
|
|
1719
1728
|
"h-3 w-3 shrink-0 text-slate-400 transition-transform",
|
|
1720
1729
|
!pe.has("__favorites__") && "rotate-90"
|
|
1721
1730
|
)
|
|
@@ -1723,16 +1732,16 @@ function La({
|
|
|
1723
1732
|
),
|
|
1724
1733
|
/* @__PURE__ */ a(ft, { className: "h-3 w-3 shrink-0 fill-amber-400 text-amber-400" }),
|
|
1725
1734
|
/* @__PURE__ */ a("span", { className: "text-[11px] font-semibold text-slate-600 dark:text-slate-300", children: "Favorites" }),
|
|
1726
|
-
/* @__PURE__ */ a("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: nn.length })
|
|
1735
|
+
/* @__PURE__ */ a("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: bn(nn.length) })
|
|
1727
1736
|
]
|
|
1728
1737
|
}
|
|
1729
1738
|
),
|
|
1730
1739
|
/* @__PURE__ */ a(
|
|
1731
1740
|
"button",
|
|
1732
1741
|
{
|
|
1733
|
-
ref:
|
|
1742
|
+
ref: Tn,
|
|
1734
1743
|
type: "button",
|
|
1735
|
-
onClick: () =>
|
|
1744
|
+
onClick: () => Fn(!0),
|
|
1736
1745
|
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",
|
|
1737
1746
|
children: "Manage"
|
|
1738
1747
|
}
|
|
@@ -1744,14 +1753,14 @@ function La({
|
|
|
1744
1753
|
return /* @__PURE__ */ u(
|
|
1745
1754
|
"div",
|
|
1746
1755
|
{
|
|
1747
|
-
className:
|
|
1756
|
+
className: V(
|
|
1748
1757
|
"flex items-center gap-4 border-b border-slate-100 px-3 py-1 dark:border-border/50",
|
|
1749
1758
|
t % 2 === 0 ? "bg-white dark:bg-background" : "bg-slate-50/50 dark:bg-muted/30",
|
|
1750
1759
|
(r ?? 0) > 0 && "bg-nvr-cyan/5",
|
|
1751
1760
|
l && "bg-amber-50 dark:bg-amber-900/15"
|
|
1752
1761
|
),
|
|
1753
1762
|
children: [
|
|
1754
|
-
|
|
1763
|
+
Vt(n),
|
|
1755
1764
|
un(n, Ae(C, e)),
|
|
1756
1765
|
cn(n, e),
|
|
1757
1766
|
/* @__PURE__ */ a("span", { className: "flex w-3.5 shrink-0 items-center justify-center", children: ee.has(n) ? /* @__PURE__ */ a(ue, { className: "h-3 w-3 animate-spin text-slate-400" }) : l && /* @__PURE__ */ a(
|
|
@@ -1787,7 +1796,7 @@ function La({
|
|
|
1787
1796
|
/* @__PURE__ */ a(
|
|
1788
1797
|
Jt,
|
|
1789
1798
|
{
|
|
1790
|
-
className:
|
|
1799
|
+
className: V(
|
|
1791
1800
|
"h-3 w-3 shrink-0 text-slate-400 transition-transform",
|
|
1792
1801
|
!t && "rotate-90"
|
|
1793
1802
|
)
|
|
@@ -1803,25 +1812,25 @@ function La({
|
|
|
1803
1812
|
}
|
|
1804
1813
|
),
|
|
1805
1814
|
!t && e.items.map((r, l) => {
|
|
1806
|
-
const o = qe(r.id),
|
|
1815
|
+
const o = qe(r.id), p = rn(r.id);
|
|
1807
1816
|
return /* @__PURE__ */ u(
|
|
1808
1817
|
"div",
|
|
1809
1818
|
{
|
|
1810
|
-
className:
|
|
1819
|
+
className: V(
|
|
1811
1820
|
"flex items-center gap-4 border-b border-slate-100 px-3 py-1 dark:border-border/50",
|
|
1812
1821
|
l % 2 === 0 ? "bg-white dark:bg-background" : "bg-slate-50/50 dark:bg-muted/30",
|
|
1813
1822
|
(o ?? 0) > 0 && "bg-nvr-cyan/5",
|
|
1814
|
-
|
|
1823
|
+
p && "bg-amber-50 dark:bg-amber-900/15"
|
|
1815
1824
|
),
|
|
1816
1825
|
children: [
|
|
1817
|
-
|
|
1826
|
+
Vt(r.id),
|
|
1818
1827
|
un(r.id, r.label),
|
|
1819
1828
|
cn(r.id, r.row),
|
|
1820
|
-
/* @__PURE__ */ a("span", { className: "flex w-3.5 shrink-0 items-center justify-center", children: ee.has(r.id) ? /* @__PURE__ */ a(ue, { className: "h-3 w-3 animate-spin text-slate-400" }) :
|
|
1829
|
+
/* @__PURE__ */ a("span", { className: "flex w-3.5 shrink-0 items-center justify-center", children: ee.has(r.id) ? /* @__PURE__ */ a(ue, { className: "h-3 w-3 animate-spin text-slate-400" }) : p && /* @__PURE__ */ a(
|
|
1821
1830
|
Ke,
|
|
1822
1831
|
{
|
|
1823
1832
|
className: "h-3.5 w-3.5 text-amber-500",
|
|
1824
|
-
"aria-label": `${sn} ${
|
|
1833
|
+
"aria-label": `${sn} ${p.available} — ${p.qty} requested`
|
|
1825
1834
|
}
|
|
1826
1835
|
) }),
|
|
1827
1836
|
Ct(r.id, r.row)
|
|
@@ -1833,11 +1842,11 @@ function La({
|
|
|
1833
1842
|
] }, e.name);
|
|
1834
1843
|
})
|
|
1835
1844
|
] }),
|
|
1836
|
-
(s.builders ?? []).filter((e) =>
|
|
1845
|
+
(s.builders ?? []).filter((e) => br(e.show_when, S)).map(
|
|
1837
1846
|
(e) => {
|
|
1838
1847
|
var t;
|
|
1839
1848
|
return (t = e.facets) != null && t.length && e.source ? /* @__PURE__ */ a(
|
|
1840
|
-
|
|
1849
|
+
ia,
|
|
1841
1850
|
{
|
|
1842
1851
|
builder: e,
|
|
1843
1852
|
catalogCol: y,
|
|
@@ -1850,7 +1859,7 @@ function La({
|
|
|
1850
1859
|
},
|
|
1851
1860
|
e.label
|
|
1852
1861
|
) : /* @__PURE__ */ a(
|
|
1853
|
-
|
|
1862
|
+
aa,
|
|
1854
1863
|
{
|
|
1855
1864
|
builder: e,
|
|
1856
1865
|
defaultItemField: s.item_field,
|
|
@@ -1871,8 +1880,8 @@ function La({
|
|
|
1871
1880
|
/* @__PURE__ */ u("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: [
|
|
1872
1881
|
/* @__PURE__ */ a("span", { className: "text-[11px] font-semibold text-slate-600 dark:text-slate-300", children: "Summary" }),
|
|
1873
1882
|
!k && /* @__PURE__ */ u("div", { className: "flex items-center gap-2", onClick: (e) => e.stopPropagation(), children: [
|
|
1874
|
-
s.upload_template && !T &&
|
|
1875
|
-
|
|
1883
|
+
s.upload_template && !T && Y && g && /* @__PURE__ */ a(
|
|
1884
|
+
_s,
|
|
1876
1885
|
{
|
|
1877
1886
|
collection: g,
|
|
1878
1887
|
templateFilter: (e) => {
|
|
@@ -1883,32 +1892,32 @@ function La({
|
|
|
1883
1892
|
var t;
|
|
1884
1893
|
return ((t = e.reimport) == null ? void 0 : t.button_label) ?? e.button_label;
|
|
1885
1894
|
},
|
|
1886
|
-
onParsed: (e, t) =>
|
|
1895
|
+
onParsed: (e, t) => Y(e, t),
|
|
1887
1896
|
compact: !0
|
|
1888
1897
|
}
|
|
1889
1898
|
),
|
|
1890
1899
|
/* @__PURE__ */ a("div", { className: "w-64", children: /* @__PURE__ */ a(
|
|
1891
|
-
|
|
1900
|
+
Ws,
|
|
1892
1901
|
{
|
|
1893
1902
|
collection: y,
|
|
1894
1903
|
value: null,
|
|
1895
|
-
onChange: (e) => void
|
|
1904
|
+
onChange: (e) => void as(e),
|
|
1896
1905
|
placeholder: "+ Add any item…",
|
|
1897
|
-
displayTemplate:
|
|
1906
|
+
displayTemplate: da(C, s.columns)
|
|
1898
1907
|
}
|
|
1899
1908
|
) })
|
|
1900
1909
|
] })
|
|
1901
1910
|
] }),
|
|
1902
1911
|
Ne.length === 0 ? /* @__PURE__ */ a("p", { className: "px-3 py-4 text-center text-slate-400", children: "Nothing picked yet" }) : (() => {
|
|
1903
|
-
const e =
|
|
1912
|
+
const e = Mn.filter((c) => !c.format), t = e[0], n = e.slice(1), r = Mn.filter((c) => !!c.format), l = (c, h) => h === "presence" ? c == null || c === "" || Number(c) === 0 ? "No" : "Yes" : c === !0 || c === "true" ? "✓" : c === !1 || c === "false" || c == null || c === "" ? "—" : ve(c, h), o = (c, h) => h ? Ot(
|
|
1904
1913
|
Oe,
|
|
1905
1914
|
h,
|
|
1906
1915
|
c,
|
|
1907
1916
|
"w-20 shrink-0",
|
|
1908
1917
|
"text-right text-[11px] font-medium text-slate-500 dark:text-slate-400"
|
|
1909
|
-
) : /* @__PURE__ */ a("span", { className: "w-20 shrink-0 text-right text-[11px] font-medium text-slate-500 dark:text-slate-400", children: c }),
|
|
1918
|
+
) : /* @__PURE__ */ a("span", { className: "w-20 shrink-0 text-right text-[11px] font-medium text-slate-500 dark:text-slate-400", children: c }), p = (c) => M.includes(c) && !k ? void 0 : `s:${c}`;
|
|
1910
1919
|
return /* @__PURE__ */ u("div", { "data-cpf-lines": !0, children: [
|
|
1911
|
-
/* @__PURE__ */ a("style", { children:
|
|
1920
|
+
/* @__PURE__ */ a("style", { children: Gs }),
|
|
1912
1921
|
/* @__PURE__ */ u(
|
|
1913
1922
|
"div",
|
|
1914
1923
|
{
|
|
@@ -1918,7 +1927,7 @@ function La({
|
|
|
1918
1927
|
/* @__PURE__ */ u("span", { className: "flex flex-1 items-center gap-1 text-[11px] font-medium text-slate-500 dark:text-slate-400", children: [
|
|
1919
1928
|
"Item",
|
|
1920
1929
|
k && /* @__PURE__ */ a(
|
|
1921
|
-
|
|
1930
|
+
xn,
|
|
1922
1931
|
{
|
|
1923
1932
|
show: Oe.customized,
|
|
1924
1933
|
onReset: Oe.reset,
|
|
@@ -1927,19 +1936,19 @@ function La({
|
|
|
1927
1936
|
)
|
|
1928
1937
|
] }),
|
|
1929
1938
|
/* @__PURE__ */ a("span", { "data-cpf-line-break": !0, "aria-hidden": !0, className: "hidden" }),
|
|
1930
|
-
Et.map((c) => /* @__PURE__ */ a(ut, { children: o(
|
|
1931
|
-
o(
|
|
1932
|
-
Ze.map((c) => /* @__PURE__ */ a(ut, { children: o(
|
|
1933
|
-
!k && /* @__PURE__ */ a("span", { "data-cpf-fixed": !0, className: "-my-1 flex w-6 shrink-0 justify-end", children: /* @__PURE__ */ a(
|
|
1939
|
+
Et.map((c) => /* @__PURE__ */ a(ut, { children: o(G(c), p(c)) }, c)),
|
|
1940
|
+
o(G(z)),
|
|
1941
|
+
Ze.map((c) => /* @__PURE__ */ a(ut, { children: o(G(c), `s:${c}`) }, c)),
|
|
1942
|
+
!k && /* @__PURE__ */ a("span", { "data-cpf-fixed": !0, className: "-my-1 flex w-6 shrink-0 justify-end", children: /* @__PURE__ */ a(xn, { show: Oe.customized, onReset: Oe.reset }) })
|
|
1934
1943
|
]
|
|
1935
1944
|
}
|
|
1936
1945
|
),
|
|
1937
1946
|
Ne.map((c, h) => {
|
|
1938
|
-
const b = c.row.id != null ? String(c.row.id) : null, q = b != null && kt.has(b), $ = q ? null : rn(c.key), J = q ? null :
|
|
1947
|
+
const b = c.row.id != null ? String(c.row.id) : null, q = b != null && kt.has(b), $ = q ? null : rn(c.key), J = q ? null : zr(c.key);
|
|
1939
1948
|
return /* @__PURE__ */ u(
|
|
1940
1949
|
"div",
|
|
1941
1950
|
{
|
|
1942
|
-
className:
|
|
1951
|
+
className: V(
|
|
1943
1952
|
"border-b border-slate-100 px-3 py-2 last:border-b-0 dark:border-border/50",
|
|
1944
1953
|
h % 2 === 0 ? "bg-white dark:bg-background" : "bg-slate-50/50 dark:bg-muted/30",
|
|
1945
1954
|
$ && "bg-amber-50 dark:bg-amber-900/15",
|
|
@@ -1951,12 +1960,12 @@ function La({
|
|
|
1951
1960
|
"div",
|
|
1952
1961
|
{
|
|
1953
1962
|
"data-cpf-line-main": !0,
|
|
1954
|
-
className:
|
|
1963
|
+
className: V(
|
|
1955
1964
|
"flex items-center gap-4",
|
|
1956
1965
|
q && "line-through decoration-slate-400"
|
|
1957
1966
|
),
|
|
1958
1967
|
children: [
|
|
1959
|
-
|
|
1968
|
+
Yn(
|
|
1960
1969
|
c.key,
|
|
1961
1970
|
Pt(c.key),
|
|
1962
1971
|
"shrink-0 font-semibold text-slate-800 dark:text-slate-100"
|
|
@@ -1981,7 +1990,7 @@ ${J}`,
|
|
|
1981
1990
|
}
|
|
1982
1991
|
),
|
|
1983
1992
|
t && /* @__PURE__ */ a(
|
|
1984
|
-
|
|
1993
|
+
xr,
|
|
1985
1994
|
{
|
|
1986
1995
|
text: ve(Tt(Ue(c.key), t.field), void 0),
|
|
1987
1996
|
className: "min-w-0 flex-1 text-slate-600 dark:text-slate-300"
|
|
@@ -2003,7 +2012,7 @@ ${J}`,
|
|
|
2003
2012
|
Et.map(
|
|
2004
2013
|
(x) => {
|
|
2005
2014
|
var I;
|
|
2006
|
-
return
|
|
2015
|
+
return rs(c.key, x) ? ls(c.key, x, c.row) : /* @__PURE__ */ a(
|
|
2007
2016
|
"span",
|
|
2008
2017
|
{
|
|
2009
2018
|
"data-catalog-locked": !k && M.includes(x) ? x : void 0,
|
|
@@ -2013,7 +2022,7 @@ ${J}`,
|
|
|
2013
2022
|
"w-20 shrink-0",
|
|
2014
2023
|
"truncate text-right tabular-nums text-slate-600 dark:text-slate-300"
|
|
2015
2024
|
),
|
|
2016
|
-
children: ve(c.row[x], (I = s.field_formats) == null ? void 0 : I[x])
|
|
2025
|
+
children: ve(c.row[x], (I = s.field_formats) == null ? void 0 : I[x], x)
|
|
2017
2026
|
},
|
|
2018
2027
|
x
|
|
2019
2028
|
);
|
|
@@ -2024,7 +2033,7 @@ ${J}`,
|
|
|
2024
2033
|
Ct(c.key, Ue(c.key))
|
|
2025
2034
|
] }),
|
|
2026
2035
|
Ze.map((x) => {
|
|
2027
|
-
var
|
|
2036
|
+
var cr, ur;
|
|
2028
2037
|
if (q)
|
|
2029
2038
|
return /* @__PURE__ */ a(
|
|
2030
2039
|
"span",
|
|
@@ -2039,7 +2048,7 @@ ${J}`,
|
|
|
2039
2048
|
},
|
|
2040
2049
|
x
|
|
2041
2050
|
);
|
|
2042
|
-
const I = c.row[x], $e = I != null && I !== "" ? I : Ee(((
|
|
2051
|
+
const I = c.row[x], $e = I != null && I !== "" ? I : Ee(((cr = s.compute_fields) == null ? void 0 : cr[x]) ?? "", c.row);
|
|
2043
2052
|
return /* @__PURE__ */ a(
|
|
2044
2053
|
"span",
|
|
2045
2054
|
{
|
|
@@ -2048,7 +2057,7 @@ ${J}`,
|
|
|
2048
2057
|
"w-20 shrink-0",
|
|
2049
2058
|
"truncate text-right tabular-nums text-slate-600 dark:text-slate-300"
|
|
2050
2059
|
),
|
|
2051
|
-
children: ve($e, (
|
|
2060
|
+
children: ve($e, (ur = s.field_formats) == null ? void 0 : ur[x], x)
|
|
2052
2061
|
},
|
|
2053
2062
|
x
|
|
2054
2063
|
);
|
|
@@ -2081,19 +2090,19 @@ ${J}`,
|
|
|
2081
2090
|
]
|
|
2082
2091
|
}
|
|
2083
2092
|
),
|
|
2084
|
-
(r.length > 0 ||
|
|
2093
|
+
(r.length > 0 || Vn.length > 0 || jt.length > 0) && /* @__PURE__ */ u("div", { className: "mt-1 flex flex-wrap items-baseline gap-x-4 gap-y-0.5 pl-0.5 text-[11px]", children: [
|
|
2085
2094
|
r.map((x) => /* @__PURE__ */ u("span", { className: "whitespace-nowrap", children: [
|
|
2086
|
-
/* @__PURE__ */ a("span", { className: "text-slate-500 dark:text-muted-foreground", children: x.label ??
|
|
2095
|
+
/* @__PURE__ */ a("span", { className: "text-slate-500 dark:text-muted-foreground", children: x.label ?? G(x.field.split(".")[0]) }),
|
|
2087
2096
|
" ",
|
|
2088
2097
|
/* @__PURE__ */ a("span", { className: "font-medium tabular-nums text-slate-700 dark:text-slate-200", children: l(Tt(Ue(c.key), x.field), x.format) })
|
|
2089
2098
|
] }, x.field)),
|
|
2090
|
-
|
|
2091
|
-
/* @__PURE__ */ a("span", { className: "text-slate-500 dark:text-muted-foreground", children: x.label ??
|
|
2099
|
+
Vn.map((x) => /* @__PURE__ */ u("span", { className: "whitespace-nowrap", children: [
|
|
2100
|
+
/* @__PURE__ */ a("span", { className: "text-slate-500 dark:text-muted-foreground", children: x.label ?? G(x.key) }),
|
|
2092
2101
|
" ",
|
|
2093
2102
|
/* @__PURE__ */ a("span", { className: "font-medium tabular-nums text-slate-700 dark:text-slate-200", children: l(lt(x.key, c.key), x.format) })
|
|
2094
2103
|
] }, x.key)),
|
|
2095
|
-
|
|
2096
|
-
|
|
2104
|
+
Br(c.row),
|
|
2105
|
+
Ar(c.row).map((x) => /* @__PURE__ */ u(
|
|
2097
2106
|
"span",
|
|
2098
2107
|
{
|
|
2099
2108
|
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",
|
|
@@ -2106,9 +2115,9 @@ ${J}`,
|
|
|
2106
2115
|
x
|
|
2107
2116
|
)),
|
|
2108
2117
|
jt.map((x) => {
|
|
2109
|
-
const I =
|
|
2118
|
+
const I = Vr(x, c);
|
|
2110
2119
|
return /* @__PURE__ */ u("span", { className: "whitespace-nowrap", children: [
|
|
2111
|
-
/* @__PURE__ */ a("span", { className: "text-slate-500 dark:text-muted-foreground", children: x.label ??
|
|
2120
|
+
/* @__PURE__ */ a("span", { className: "text-slate-500 dark:text-muted-foreground", children: x.label ?? G(x.field) }),
|
|
2112
2121
|
" ",
|
|
2113
2122
|
/* @__PURE__ */ a("span", { className: "font-medium text-slate-700 dark:text-slate-200", children: l(I, x.format) })
|
|
2114
2123
|
] }, x.field);
|
|
@@ -2132,17 +2141,17 @@ ${J}`,
|
|
|
2132
2141
|
className: "mt-1 flex items-start gap-1 pl-0.5 text-[11px] font-medium text-amber-600 dark:text-amber-400",
|
|
2133
2142
|
children: [
|
|
2134
2143
|
/* @__PURE__ */ a(Ke, { className: "mt-px h-3 w-3 shrink-0" }),
|
|
2135
|
-
|
|
2144
|
+
Es(
|
|
2136
2145
|
$.available,
|
|
2137
2146
|
$.qty,
|
|
2138
|
-
|
|
2147
|
+
ts,
|
|
2139
2148
|
(x) => ve(x, "number")
|
|
2140
2149
|
)
|
|
2141
2150
|
]
|
|
2142
2151
|
}
|
|
2143
2152
|
)
|
|
2144
2153
|
)),
|
|
2145
|
-
!k && b != null && !q &&
|
|
2154
|
+
!k && b != null && !q && es(c.row, c.key).map(({ field: x, change: I }) => (
|
|
2146
2155
|
// The icon leads the first line; "Use new price" travels with its
|
|
2147
2156
|
// sentence (a phone wrapped it to a third line behind a lone dot).
|
|
2148
2157
|
/* @__PURE__ */ u(
|
|
@@ -2153,8 +2162,8 @@ ${J}`,
|
|
|
2153
2162
|
children: [
|
|
2154
2163
|
/* @__PURE__ */ a(Ke, { className: "mt-px h-3 w-3 shrink-0" }),
|
|
2155
2164
|
/* @__PURE__ */ u("span", { className: "min-w-0", children: [
|
|
2156
|
-
|
|
2157
|
-
fn.length > 1 ? ` · ${
|
|
2165
|
+
Cs(I, ($e) => ve($e, "currency")),
|
|
2166
|
+
fn.length > 1 ? ` · ${G(x)}` : "",
|
|
2158
2167
|
" ",
|
|
2159
2168
|
/* @__PURE__ */ a(
|
|
2160
2169
|
"button",
|
|
@@ -2162,7 +2171,7 @@ ${J}`,
|
|
|
2162
2171
|
type: "button",
|
|
2163
2172
|
"data-catalog-use-new-price": x,
|
|
2164
2173
|
className: "whitespace-nowrap rounded font-semibold text-[#0e7490] underline underline-offset-2 hover:no-underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan/60 dark:text-nvr-cyan",
|
|
2165
|
-
onClick: () => void
|
|
2174
|
+
onClick: () => void er(c.key, x, String(I.now)),
|
|
2166
2175
|
children: "Use new price"
|
|
2167
2176
|
}
|
|
2168
2177
|
)
|
|
@@ -2172,7 +2181,7 @@ ${J}`,
|
|
|
2172
2181
|
x
|
|
2173
2182
|
)
|
|
2174
2183
|
)),
|
|
2175
|
-
!q &&
|
|
2184
|
+
!q && sa(
|
|
2176
2185
|
{
|
|
2177
2186
|
...c.row,
|
|
2178
2187
|
...Object.fromEntries(
|
|
@@ -2208,7 +2217,7 @@ ${J}`,
|
|
|
2208
2217
|
const c = Ne.filter(($) => {
|
|
2209
2218
|
const J = $.row.id != null ? String($.row.id) : null;
|
|
2210
2219
|
return !(J != null && kt.has(J));
|
|
2211
|
-
}), h = ($) =>
|
|
2220
|
+
}), h = ($) => Zs(
|
|
2212
2221
|
c.map((J) => J.row),
|
|
2213
2222
|
$,
|
|
2214
2223
|
s.compute_fields
|
|
@@ -2230,7 +2239,7 @@ ${J}`,
|
|
|
2230
2239
|
return /* @__PURE__ */ u("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: [
|
|
2231
2240
|
/* @__PURE__ */ a("span", { className: "flex-1 text-[11px] font-semibold uppercase tracking-wide text-slate-500 dark:text-slate-400", children: "Total" }),
|
|
2232
2241
|
Et.map(($) => {
|
|
2233
|
-
const J =
|
|
2242
|
+
const J = p($);
|
|
2234
2243
|
return J ? /* @__PURE__ */ a("span", { ...Oe.box(J, "w-20 shrink-0") }, $) : /* @__PURE__ */ a("span", { className: "w-20 shrink-0" }, $);
|
|
2235
2244
|
}),
|
|
2236
2245
|
/* @__PURE__ */ a("span", { className: "w-20 shrink-0 text-right text-[12px] font-semibold tabular-nums text-slate-800 dark:text-slate-100", children: ve(h(z), "number") }),
|
|
@@ -2241,8 +2250,8 @@ ${J}`,
|
|
|
2241
2250
|
] });
|
|
2242
2251
|
})()
|
|
2243
2252
|
] }),
|
|
2244
|
-
|
|
2245
|
-
|
|
2253
|
+
jr && y && /* @__PURE__ */ a(
|
|
2254
|
+
oa,
|
|
2246
2255
|
{
|
|
2247
2256
|
catalogCol: y,
|
|
2248
2257
|
tmpl: C,
|
|
@@ -2253,9 +2262,9 @@ ${J}`,
|
|
|
2253
2262
|
savingIds: vt,
|
|
2254
2263
|
relatedCols: (s.favorites_manager_columns ?? []).map((e) => (s.related_columns ?? []).find((t) => t.key === e)).filter((e) => !!e),
|
|
2255
2264
|
parentDraft: S,
|
|
2256
|
-
onToggle: (e) => void
|
|
2257
|
-
onClose: () =>
|
|
2258
|
-
anchor:
|
|
2265
|
+
onToggle: (e) => void jn(e),
|
|
2266
|
+
onClose: () => Fn(!1),
|
|
2267
|
+
anchor: Tn.current
|
|
2259
2268
|
}
|
|
2260
2269
|
)
|
|
2261
2270
|
] }) : /* @__PURE__ */ u("p", { className: "py-1 text-[12px] text-slate-400", children: [
|
|
@@ -2266,10 +2275,10 @@ ${J}`,
|
|
|
2266
2275
|
i
|
|
2267
2276
|
] });
|
|
2268
2277
|
}
|
|
2269
|
-
function
|
|
2278
|
+
function aa({
|
|
2270
2279
|
builder: i,
|
|
2271
2280
|
defaultItemField: m,
|
|
2272
|
-
catalogCol:
|
|
2281
|
+
catalogCol: f,
|
|
2273
2282
|
catalogFields: g,
|
|
2274
2283
|
tmpl: _,
|
|
2275
2284
|
currentQty: s,
|
|
@@ -2277,14 +2286,14 @@ function ta({
|
|
|
2277
2286
|
qtyStep: w,
|
|
2278
2287
|
readOnly: O
|
|
2279
2288
|
}) {
|
|
2280
|
-
const v = ht(), L = i.item_field ?? m,
|
|
2289
|
+
const v = ht(), L = i.item_field ?? m, Y = i.attributes ?? [], [M, me] = H(!1), [fe, T] = H({}), [be, z] = H("1"), [pe, ge] = H(!1), ke = R(
|
|
2281
2290
|
() => [
|
|
2282
2291
|
"id",
|
|
2283
2292
|
L,
|
|
2284
|
-
...
|
|
2293
|
+
...Y.flatMap((F) => [`${F.field}.id`, `${F.field}.${F.label_field}`])
|
|
2285
2294
|
].join(","),
|
|
2286
|
-
[L,
|
|
2287
|
-
), { data:
|
|
2295
|
+
[L, Y]
|
|
2296
|
+
), { data: W = [], isLoading: Te } = Q({
|
|
2288
2297
|
queryKey: [
|
|
2289
2298
|
"catalog-builder",
|
|
2290
2299
|
i.collection,
|
|
@@ -2305,23 +2314,23 @@ function ta({
|
|
|
2305
2314
|
const N = F[y];
|
|
2306
2315
|
if (N == null) return null;
|
|
2307
2316
|
if (typeof N == "object") {
|
|
2308
|
-
const P = N, j = ((E =
|
|
2317
|
+
const P = N, j = ((E = Y.find((C) => C.field === y)) == null ? void 0 : E.label_field) ?? "id";
|
|
2309
2318
|
return { id: String(P.id ?? ""), label: String(P[j] ?? P.id ?? "") };
|
|
2310
2319
|
}
|
|
2311
2320
|
return { id: String(N), label: String(N) };
|
|
2312
|
-
}, re = (F) =>
|
|
2313
|
-
(y) =>
|
|
2321
|
+
}, re = (F) => W.filter(
|
|
2322
|
+
(y) => Y.slice(0, F).every((N) => {
|
|
2314
2323
|
var P;
|
|
2315
2324
|
const E = fe[N.field];
|
|
2316
2325
|
return E ? ((P = he(y, N.field)) == null ? void 0 : P.id) === E : !0;
|
|
2317
2326
|
})
|
|
2318
|
-
), ee =
|
|
2327
|
+
), ee = Y.every((F) => fe[F.field]), X = ee ? W.find((F) => Y.every((y) => {
|
|
2319
2328
|
var N;
|
|
2320
2329
|
return ((N = he(F, y.field)) == null ? void 0 : N.id) === fe[y.field];
|
|
2321
|
-
})) : void 0, B = (
|
|
2322
|
-
queryKey: ["catalog-builder-item",
|
|
2330
|
+
})) : void 0, B = (X == null ? void 0 : X[L]) != null ? String(X[L]) : null, { data: se } = Q({
|
|
2331
|
+
queryKey: ["catalog-builder-item", f, g, B],
|
|
2323
2332
|
queryFn: () => v.request(
|
|
2324
|
-
A(`/items/${
|
|
2333
|
+
A(`/items/${f}`, {
|
|
2325
2334
|
filter: JSON.stringify({ id: { _eq: B } }),
|
|
2326
2335
|
fields: g,
|
|
2327
2336
|
limit: 1
|
|
@@ -2354,7 +2363,7 @@ function ta({
|
|
|
2354
2363
|
/* @__PURE__ */ a(
|
|
2355
2364
|
Jt,
|
|
2356
2365
|
{
|
|
2357
|
-
className:
|
|
2366
|
+
className: V(
|
|
2358
2367
|
"h-3 w-3 shrink-0 text-slate-400 transition-transform",
|
|
2359
2368
|
M && "rotate-90"
|
|
2360
2369
|
)
|
|
@@ -2368,7 +2377,7 @@ function ta({
|
|
|
2368
2377
|
/* @__PURE__ */ a(ue, { className: "h-4 w-4 animate-spin" }),
|
|
2369
2378
|
" Loading options…"
|
|
2370
2379
|
] }) : /* @__PURE__ */ u("div", { className: "flex flex-wrap items-end gap-3", children: [
|
|
2371
|
-
|
|
2380
|
+
Y.map((F, y) => {
|
|
2372
2381
|
const N = /* @__PURE__ */ new Map();
|
|
2373
2382
|
for (const P of re(y)) {
|
|
2374
2383
|
const j = he(P, F.field);
|
|
@@ -2378,17 +2387,17 @@ function ta({
|
|
|
2378
2387
|
([, P], [, j]) => P.localeCompare(j, void 0, { numeric: !0 })
|
|
2379
2388
|
);
|
|
2380
2389
|
return /* @__PURE__ */ a(
|
|
2381
|
-
|
|
2390
|
+
vr,
|
|
2382
2391
|
{
|
|
2383
|
-
label:
|
|
2392
|
+
label: G(F.field),
|
|
2384
2393
|
value: fe[F.field] ?? null,
|
|
2385
2394
|
valueLabel: fe[F.field] ? N.get(fe[F.field]) ?? fe[F.field] : null,
|
|
2386
2395
|
options: E,
|
|
2387
|
-
disabled: y > 0 && !fe[
|
|
2396
|
+
disabled: y > 0 && !fe[Y[y - 1].field],
|
|
2388
2397
|
onChange: (P) => T((j) => {
|
|
2389
2398
|
const C = {};
|
|
2390
2399
|
for (let K = 0; K < y; K++) {
|
|
2391
|
-
const te =
|
|
2400
|
+
const te = Y[K].field;
|
|
2392
2401
|
j[te] && (C[te] = j[te]);
|
|
2393
2402
|
}
|
|
2394
2403
|
return P && (C[F.field] = P), C;
|
|
@@ -2427,7 +2436,7 @@ function ta({
|
|
|
2427
2436
|
disabled: !_e,
|
|
2428
2437
|
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",
|
|
2429
2438
|
children: [
|
|
2430
|
-
pe ? /* @__PURE__ */ a(ue, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ a(
|
|
2439
|
+
pe ? /* @__PURE__ */ a(ue, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ a(yr, { className: "h-3.5 w-3.5" }),
|
|
2431
2440
|
"Add"
|
|
2432
2441
|
]
|
|
2433
2442
|
}
|
|
@@ -2437,10 +2446,10 @@ function ta({
|
|
|
2437
2446
|
] }) })
|
|
2438
2447
|
] });
|
|
2439
2448
|
}
|
|
2440
|
-
function
|
|
2449
|
+
function ia({
|
|
2441
2450
|
builder: i,
|
|
2442
2451
|
catalogCol: m,
|
|
2443
|
-
catalogFields:
|
|
2452
|
+
catalogFields: f,
|
|
2444
2453
|
tmpl: g,
|
|
2445
2454
|
currentQty: _,
|
|
2446
2455
|
addQty: s,
|
|
@@ -2448,8 +2457,8 @@ function na({
|
|
|
2448
2457
|
readOnly: w
|
|
2449
2458
|
}) {
|
|
2450
2459
|
var _e, xe, F, y;
|
|
2451
|
-
const O = ht(), v = i.facets ?? [], L = i.item_key ?? "item",
|
|
2452
|
-
data:
|
|
2460
|
+
const O = ht(), v = i.facets ?? [], L = i.item_key ?? "item", Y = ((_e = i.result) == null ? void 0 : _e.key) ?? "label", M = i.symmetric ?? null, [me, fe] = H(!1), [T, be] = H({}), [z, pe] = H({}), [ge, ke] = H(null), {
|
|
2461
|
+
data: W = [],
|
|
2453
2462
|
isLoading: Te,
|
|
2454
2463
|
isError: he
|
|
2455
2464
|
} = Q({
|
|
@@ -2457,26 +2466,26 @@ function na({
|
|
|
2457
2466
|
queryFn: () => O.request(A(String(i.source))).then((N) => Array.isArray(N.data) ? N.data : []),
|
|
2458
2467
|
enabled: me && !!i.source,
|
|
2459
2468
|
staleTime: 5 * 6e4
|
|
2460
|
-
}), re =
|
|
2469
|
+
}), re = Fs(T, v), ee = R(
|
|
2461
2470
|
() => {
|
|
2462
2471
|
var N;
|
|
2463
|
-
return re ?
|
|
2472
|
+
return re ? Ts(W, T, v, {
|
|
2464
2473
|
itemKey: L,
|
|
2465
|
-
labelKey:
|
|
2474
|
+
labelKey: Y,
|
|
2466
2475
|
sortKey: (N = i.result) == null ? void 0 : N.sort,
|
|
2467
2476
|
symmetric: M
|
|
2468
2477
|
}) : [];
|
|
2469
2478
|
},
|
|
2470
|
-
[re,
|
|
2471
|
-
),
|
|
2472
|
-
queryKey: ["catalog-facet-items", m,
|
|
2479
|
+
[re, W, T, v, L, Y, (xe = i.result) == null ? void 0 : xe.sort, M]
|
|
2480
|
+
), X = R(() => ee.map((N) => String(N[L])), [ee, L]), { data: B = /* @__PURE__ */ new Map() } = Q({
|
|
2481
|
+
queryKey: ["catalog-facet-items", m, f, X.join(",")],
|
|
2473
2482
|
queryFn: async () => {
|
|
2474
2483
|
const N = /* @__PURE__ */ new Map();
|
|
2475
|
-
for (let E = 0; E <
|
|
2476
|
-
const P =
|
|
2484
|
+
for (let E = 0; E < X.length; E += 200) {
|
|
2485
|
+
const P = X.slice(E, E + 200), j = await O.request(
|
|
2477
2486
|
A(`/items/${m}`, {
|
|
2478
2487
|
filter: JSON.stringify({ id: { _in: P } }),
|
|
2479
|
-
fields:
|
|
2488
|
+
fields: f,
|
|
2480
2489
|
limit: P.length
|
|
2481
2490
|
})
|
|
2482
2491
|
);
|
|
@@ -2484,7 +2493,7 @@ function na({
|
|
|
2484
2493
|
}
|
|
2485
2494
|
return N;
|
|
2486
2495
|
},
|
|
2487
|
-
enabled:
|
|
2496
|
+
enabled: X.length > 0,
|
|
2488
2497
|
staleTime: 6e4
|
|
2489
2498
|
}), se = v.filter((N) => T[N.key]).length;
|
|
2490
2499
|
async function ie(N) {
|
|
@@ -2515,7 +2524,7 @@ function na({
|
|
|
2515
2524
|
/* @__PURE__ */ a(
|
|
2516
2525
|
Jt,
|
|
2517
2526
|
{
|
|
2518
|
-
className:
|
|
2527
|
+
className: V(
|
|
2519
2528
|
"h-3 w-3 shrink-0 text-slate-400 transition-transform",
|
|
2520
2529
|
me && "rotate-90"
|
|
2521
2530
|
)
|
|
@@ -2531,15 +2540,15 @@ function na({
|
|
|
2531
2540
|
] }) : he ? /* @__PURE__ */ a("p", { className: "text-slate-500 dark:text-slate-400", children: "The options could not be loaded. Close and open this section to try again." }) : /* @__PURE__ */ u(Se, { children: [
|
|
2532
2541
|
/* @__PURE__ */ u("div", { className: "flex flex-wrap items-end gap-3", children: [
|
|
2533
2542
|
v.map((N) => {
|
|
2534
|
-
const E =
|
|
2543
|
+
const E = Rs(W, T, v, N.key, M);
|
|
2535
2544
|
return /* @__PURE__ */ a(
|
|
2536
|
-
|
|
2545
|
+
vr,
|
|
2537
2546
|
{
|
|
2538
2547
|
label: N.label,
|
|
2539
2548
|
value: T[N.key] ?? null,
|
|
2540
2549
|
valueLabel: T[N.key] ?? null,
|
|
2541
2550
|
options: E.map((P) => [P, P]),
|
|
2542
|
-
onChange: (P) => be((j) =>
|
|
2551
|
+
onChange: (P) => be((j) => Os(W, j, v, N.key, P, M))
|
|
2543
2552
|
},
|
|
2544
2553
|
N.key
|
|
2545
2554
|
);
|
|
@@ -2572,7 +2581,7 @@ function na({
|
|
|
2572
2581
|
"data-facet-result": E,
|
|
2573
2582
|
children: [
|
|
2574
2583
|
/* @__PURE__ */ u("div", { className: "min-w-0 flex-1", children: [
|
|
2575
|
-
/* @__PURE__ */ a("p", { className: "truncate font-medium tabular-nums text-slate-700 dark:text-slate-200", children: String(N[
|
|
2584
|
+
/* @__PURE__ */ a("p", { className: "truncate font-medium tabular-nums text-slate-700 dark:text-slate-200", children: String(N[Y] ?? "") }),
|
|
2576
2585
|
/* @__PURE__ */ a("p", { className: "truncate text-[11px] text-slate-400", children: C || (P ? Ae(g, P) : "") })
|
|
2577
2586
|
] }),
|
|
2578
2587
|
j > 0 && /* @__PURE__ */ u("span", { className: "shrink-0 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: [
|
|
@@ -2587,7 +2596,7 @@ function na({
|
|
|
2587
2596
|
min: 0,
|
|
2588
2597
|
step: k,
|
|
2589
2598
|
value: z[E] ?? "1",
|
|
2590
|
-
"aria-label": `Quantity of ${String(N[
|
|
2599
|
+
"aria-label": `Quantity of ${String(N[Y] ?? "")}`,
|
|
2591
2600
|
onChange: (te) => pe((Je) => ({ ...Je, [E]: te.target.value })),
|
|
2592
2601
|
onKeyDown: (te) => {
|
|
2593
2602
|
te.key === "Enter" && (te.preventDefault(), ie(E));
|
|
@@ -2603,7 +2612,7 @@ function na({
|
|
|
2603
2612
|
disabled: !P || ge !== null,
|
|
2604
2613
|
className: "flex h-7 w-[52px] shrink-0 items-center justify-center gap-1 rounded bg-nvr-cyan px-2 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",
|
|
2605
2614
|
children: [
|
|
2606
|
-
ge === E ? /* @__PURE__ */ a(ue, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ a(
|
|
2615
|
+
ge === E ? /* @__PURE__ */ a(ue, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ a(yr, { className: "h-3.5 w-3.5" }),
|
|
2607
2616
|
"Add"
|
|
2608
2617
|
]
|
|
2609
2618
|
}
|
|
@@ -2628,15 +2637,15 @@ function na({
|
|
|
2628
2637
|
}
|
|
2629
2638
|
);
|
|
2630
2639
|
}
|
|
2631
|
-
function
|
|
2640
|
+
function la({
|
|
2632
2641
|
parentCollection: i,
|
|
2633
2642
|
field: m,
|
|
2634
|
-
id:
|
|
2643
|
+
id: f
|
|
2635
2644
|
}) {
|
|
2636
2645
|
var w;
|
|
2637
2646
|
const g = ht(), { data: _ = [] } = Q({
|
|
2638
2647
|
queryKey: Kt.collectionRelations(i),
|
|
2639
|
-
queryFn: () =>
|
|
2648
|
+
queryFn: () => gn(g, i),
|
|
2640
2649
|
enabled: !!i,
|
|
2641
2650
|
staleTime: 10 * 6e4
|
|
2642
2651
|
}), s = ((w = _.find(
|
|
@@ -2647,29 +2656,29 @@ function ra({
|
|
|
2647
2656
|
enabled: !!s,
|
|
2648
2657
|
staleTime: 3e5
|
|
2649
2658
|
});
|
|
2650
|
-
return s ? /* @__PURE__ */ a(
|
|
2659
|
+
return s ? /* @__PURE__ */ a(Bs, { collection: s, id: f, displayTemplate: k == null ? void 0 : k.display_template }) : /* @__PURE__ */ u(Se, { children: [
|
|
2651
2660
|
"this ",
|
|
2652
|
-
|
|
2661
|
+
G(m)
|
|
2653
2662
|
] });
|
|
2654
2663
|
}
|
|
2655
|
-
function
|
|
2664
|
+
function xr({
|
|
2656
2665
|
text: i,
|
|
2657
2666
|
highlight: m,
|
|
2658
|
-
className:
|
|
2667
|
+
className: f,
|
|
2659
2668
|
...g
|
|
2660
2669
|
}) {
|
|
2661
|
-
const _ =
|
|
2662
|
-
return /* @__PURE__ */ a("span", { ref: _, className:
|
|
2670
|
+
const _ = qs(i);
|
|
2671
|
+
return /* @__PURE__ */ a("span", { ref: _, className: V("truncate", f), ...g, children: m ? /* @__PURE__ */ a(kn, { text: i, query: m }) : i });
|
|
2663
2672
|
}
|
|
2664
|
-
function
|
|
2673
|
+
function vr({
|
|
2665
2674
|
label: i,
|
|
2666
2675
|
value: m,
|
|
2667
|
-
valueLabel:
|
|
2676
|
+
valueLabel: f,
|
|
2668
2677
|
options: g,
|
|
2669
2678
|
disabled: _,
|
|
2670
2679
|
onChange: s
|
|
2671
2680
|
}) {
|
|
2672
|
-
const [k, w] =
|
|
2681
|
+
const [k, w] = H(!1), O = je(null);
|
|
2673
2682
|
return Fe(() => {
|
|
2674
2683
|
if (!k) return;
|
|
2675
2684
|
const v = (L) => {
|
|
@@ -2686,8 +2695,8 @@ function wr({
|
|
|
2686
2695
|
onClick: () => w((v) => !v),
|
|
2687
2696
|
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",
|
|
2688
2697
|
children: [
|
|
2689
|
-
/* @__PURE__ */ a("span", { className:
|
|
2690
|
-
/* @__PURE__ */ a(
|
|
2698
|
+
/* @__PURE__ */ a("span", { className: V("truncate", !f && "text-slate-400"), children: f ?? "Select…" }),
|
|
2699
|
+
/* @__PURE__ */ a(cs, { className: "h-3.5 w-3.5 shrink-0 text-slate-400" })
|
|
2691
2700
|
]
|
|
2692
2701
|
}
|
|
2693
2702
|
),
|
|
@@ -2713,7 +2722,7 @@ function wr({
|
|
|
2713
2722
|
onClick: () => {
|
|
2714
2723
|
s(v), w(!1);
|
|
2715
2724
|
},
|
|
2716
|
-
className:
|
|
2725
|
+
className: V(
|
|
2717
2726
|
"block w-full truncate px-2 py-1 text-left text-[12px] hover:bg-muted",
|
|
2718
2727
|
v === m ? "font-medium text-nvr-cyan" : "text-slate-700 dark:text-slate-200"
|
|
2719
2728
|
),
|
|
@@ -2724,10 +2733,10 @@ function wr({
|
|
|
2724
2733
|
] })
|
|
2725
2734
|
] });
|
|
2726
2735
|
}
|
|
2727
|
-
function
|
|
2736
|
+
function oa({
|
|
2728
2737
|
catalogCol: i,
|
|
2729
2738
|
tmpl: m,
|
|
2730
|
-
sectionBy:
|
|
2739
|
+
sectionBy: f,
|
|
2731
2740
|
sectionM2M: g,
|
|
2732
2741
|
pinnedSet: _,
|
|
2733
2742
|
pinnedIds: s,
|
|
@@ -2736,9 +2745,9 @@ function sa({
|
|
|
2736
2745
|
parentDraft: O,
|
|
2737
2746
|
onToggle: v,
|
|
2738
2747
|
onClose: L,
|
|
2739
|
-
anchor:
|
|
2748
|
+
anchor: Y
|
|
2740
2749
|
}) {
|
|
2741
|
-
const M = ht(), [me, fe] =
|
|
2750
|
+
const M = ht(), [me, fe] = H(""), [T, be] = H(""), [z, pe] = H(1), ge = je(null);
|
|
2742
2751
|
Fe(() => {
|
|
2743
2752
|
const d = setTimeout(() => be(me), 300);
|
|
2744
2753
|
return () => clearTimeout(d);
|
|
@@ -2755,11 +2764,11 @@ function sa({
|
|
|
2755
2764
|
var S;
|
|
2756
2765
|
const d = (S = [...(m ?? "").matchAll(/\{\{([\w.]+)\}\}/g)][0]) == null ? void 0 : S[1];
|
|
2757
2766
|
return d && !d.includes(".") ? d : "id";
|
|
2758
|
-
}, [m]),
|
|
2767
|
+
}, [m]), W = !g && f.includes(".") ? `*,${f}` : "*", Te = 50, { data: he, isFetching: re } = Q({
|
|
2759
2768
|
queryKey: ["favorites-manager-list", i, T, ke, z],
|
|
2760
2769
|
queryFn: () => M.request(
|
|
2761
2770
|
A(`/items/${i}`, {
|
|
2762
|
-
fields:
|
|
2771
|
+
fields: W,
|
|
2763
2772
|
limit: Te,
|
|
2764
2773
|
page: z,
|
|
2765
2774
|
sort: ke,
|
|
@@ -2768,12 +2777,12 @@ function sa({
|
|
|
2768
2777
|
),
|
|
2769
2778
|
staleTime: 3e4,
|
|
2770
2779
|
placeholderData: (d) => d
|
|
2771
|
-
}), ee = ((he == null ? void 0 : he.data) ?? []).filter((d) => !_.has(String(d.id))),
|
|
2772
|
-
queryKey: ["favorites-manager-pinned", i,
|
|
2780
|
+
}), ee = ((he == null ? void 0 : he.data) ?? []).filter((d) => !_.has(String(d.id))), X = (he == null ? void 0 : he.total) ?? ee.length, B = Math.max(1, Math.ceil(X / Te)), { data: se = [] } = Q({
|
|
2781
|
+
queryKey: ["favorites-manager-pinned", i, W, s.join(",")],
|
|
2773
2782
|
queryFn: () => M.request(
|
|
2774
2783
|
A(`/items/${i}`, {
|
|
2775
2784
|
filter: JSON.stringify({ id: { _in: s } }),
|
|
2776
|
-
fields:
|
|
2785
|
+
fields: W,
|
|
2777
2786
|
limit: s.length,
|
|
2778
2787
|
sort: ke
|
|
2779
2788
|
})
|
|
@@ -2791,14 +2800,14 @@ function sa({
|
|
|
2791
2800
|
const d = g, S = await It(M, `/items/${d.junction}`, {
|
|
2792
2801
|
fields: `${d.fkToItem},${d.fkToSection}`,
|
|
2793
2802
|
filter: JSON.stringify({ [d.fkToItem]: { _in: ie } })
|
|
2794
|
-
}),
|
|
2803
|
+
}), le = [...new Set(S.map((ne) => String(ne[d.fkToSection])))], Z = le.length ? await It(M, `/items/${d.target}`, {
|
|
2795
2804
|
fields: `id,${d.labelPath}`,
|
|
2796
|
-
filter: JSON.stringify({ id: { _in:
|
|
2797
|
-
}) : [],
|
|
2798
|
-
|
|
2805
|
+
filter: JSON.stringify({ id: { _in: le } })
|
|
2806
|
+
}) : [], D = new Map(
|
|
2807
|
+
Z.map((ne) => [String(ne.id), String(wr(ne, d.labelPath) ?? "")])
|
|
2799
2808
|
), ae = /* @__PURE__ */ new Map();
|
|
2800
2809
|
for (const ne of S) {
|
|
2801
|
-
const U =
|
|
2810
|
+
const U = D.get(String(ne[d.fkToSection]));
|
|
2802
2811
|
if (!U) continue;
|
|
2803
2812
|
const Ie = String(ne[d.fkToItem]), oe = ae.get(Ie) ?? [];
|
|
2804
2813
|
oe.includes(U) || oe.push(U), ae.set(Ie, oe);
|
|
@@ -2812,16 +2821,16 @@ function sa({
|
|
|
2812
2821
|
return typeof S == "string" && S.trim() && S.trim() !== xe(d) ? S : "";
|
|
2813
2822
|
}, y = (d) => {
|
|
2814
2823
|
if (g) return (_e.get(String(d.id)) ?? []).join(", ");
|
|
2815
|
-
if (!
|
|
2816
|
-
const S = Ae(`{{${
|
|
2817
|
-
return S === `{{${
|
|
2818
|
-
}, N = (d, S) => {
|
|
2824
|
+
if (!f) return "";
|
|
2825
|
+
const S = Ae(`{{${f}}}`, d);
|
|
2826
|
+
return S === `{{${f}}}` ? "" : S;
|
|
2827
|
+
}, N = (d, S, le) => {
|
|
2819
2828
|
if (S === "presence")
|
|
2820
2829
|
return d == null || d === "" || Number(d) === 0 ? "No" : "Yes";
|
|
2821
2830
|
if (d == null || d === "") return "—";
|
|
2822
|
-
const
|
|
2823
|
-
return S === "currency" && Number.isFinite(
|
|
2824
|
-
}, E =
|
|
2831
|
+
const Z = Number(d);
|
|
2832
|
+
return S === "currency" && Number.isFinite(Z) ? Z.toLocaleString("en-US", { style: "currency", currency: "USD" }) : S === "number" && Number.isFinite(Z) ? Z.toLocaleString() : Nr(d, le);
|
|
2833
|
+
}, E = yn({
|
|
2825
2834
|
queries: w.map((d) => {
|
|
2826
2835
|
const S = Ge(d.match, O);
|
|
2827
2836
|
return {
|
|
@@ -2833,18 +2842,18 @@ function sa({
|
|
|
2833
2842
|
ie.join(",")
|
|
2834
2843
|
],
|
|
2835
2844
|
queryFn: async () => {
|
|
2836
|
-
const
|
|
2845
|
+
const le = await M.request(
|
|
2837
2846
|
A(`/items/${d.collection}`, {
|
|
2838
2847
|
filter: JSON.stringify({ [d.item_field]: { _in: ie }, ...S ?? {} }),
|
|
2839
2848
|
fields: `${d.item_field},${d.value_field}`,
|
|
2840
2849
|
limit: 1e3
|
|
2841
2850
|
})
|
|
2842
|
-
).then((
|
|
2843
|
-
for (const
|
|
2844
|
-
const ae = String(
|
|
2845
|
-
U === void 0 ?
|
|
2851
|
+
).then((D) => D.data ?? []), Z = /* @__PURE__ */ new Map();
|
|
2852
|
+
for (const D of le) {
|
|
2853
|
+
const ae = String(D[d.item_field]), ne = D[d.value_field], U = Z.get(ae);
|
|
2854
|
+
U === void 0 ? Z.set(ae, ne) : Number.isFinite(Number(U)) && Number.isFinite(Number(ne)) && Z.set(ae, Number(U) + Number(ne));
|
|
2846
2855
|
}
|
|
2847
|
-
return
|
|
2856
|
+
return Z;
|
|
2848
2857
|
},
|
|
2849
2858
|
enabled: ie.length > 0 && (d.match === void 0 || S !== null),
|
|
2850
2859
|
staleTime: 3e4
|
|
@@ -2865,7 +2874,7 @@ function sa({
|
|
|
2865
2874
|
children: k.has(d) ? /* @__PURE__ */ a(ue, { className: "h-4 w-4 animate-spin text-amber-400" }) : /* @__PURE__ */ a(
|
|
2866
2875
|
ft,
|
|
2867
2876
|
{
|
|
2868
|
-
className:
|
|
2877
|
+
className: V(
|
|
2869
2878
|
"h-4 w-4",
|
|
2870
2879
|
S ? "fill-amber-400 text-amber-400" : "text-slate-300 hover:text-amber-400"
|
|
2871
2880
|
)
|
|
@@ -2873,47 +2882,47 @@ function sa({
|
|
|
2873
2882
|
)
|
|
2874
2883
|
}
|
|
2875
2884
|
);
|
|
2876
|
-
}, C = (d, S) => /* @__PURE__ */ a("tr", { children: /* @__PURE__ */ a("td", { colSpan: 4 + w.length, className:
|
|
2877
|
-
const
|
|
2885
|
+
}, C = (d, S) => /* @__PURE__ */ a("tr", { children: /* @__PURE__ */ a("td", { colSpan: 4 + w.length, className: V("border-b px-3 py-1.5", S), children: d }) }), K = (d, S) => {
|
|
2886
|
+
const le = String(d.id), Z = F(d);
|
|
2878
2887
|
return /* @__PURE__ */ u(
|
|
2879
2888
|
"tr",
|
|
2880
2889
|
{
|
|
2881
|
-
className:
|
|
2890
|
+
className: V(
|
|
2882
2891
|
"border-b border-slate-100 dark:border-border/50",
|
|
2883
2892
|
S % 2 === 0 ? "bg-white dark:bg-background" : "bg-slate-50/50 dark:bg-muted/30"
|
|
2884
2893
|
),
|
|
2885
2894
|
children: [
|
|
2886
|
-
/* @__PURE__ */ a("td", { className: "px-2 py-1", children: j(
|
|
2887
|
-
/* @__PURE__ */ a("td", { className: "px-2 py-1 font-medium tabular-nums text-slate-700 dark:text-slate-200", children:
|
|
2895
|
+
/* @__PURE__ */ a("td", { className: "px-2 py-1", children: j(le) }),
|
|
2896
|
+
/* @__PURE__ */ a("td", { className: "px-2 py-1 font-medium tabular-nums text-slate-700 dark:text-slate-200", children: gr(i) ? /* @__PURE__ */ a(
|
|
2888
2897
|
"button",
|
|
2889
2898
|
{
|
|
2890
2899
|
type: "button",
|
|
2891
|
-
onClick: () =>
|
|
2900
|
+
onClick: () => kr(i, le, O),
|
|
2892
2901
|
title: "View stock & planning detail",
|
|
2893
2902
|
className: "text-left underline decoration-slate-300 decoration-1 underline-offset-2 hover:text-[#009abe] hover:decoration-[#009abe] dark:decoration-slate-600",
|
|
2894
2903
|
children: xe(d)
|
|
2895
2904
|
}
|
|
2896
2905
|
) : xe(d) }),
|
|
2897
|
-
/* @__PURE__ */ a("td", { className: "max-w-0 px-2 py-1", children: /* @__PURE__ */ a("p", { className: "truncate text-slate-600 dark:text-slate-300", "data-tip":
|
|
2906
|
+
/* @__PURE__ */ a("td", { className: "max-w-0 px-2 py-1", children: /* @__PURE__ */ a("p", { className: "truncate text-slate-600 dark:text-slate-300", "data-tip": Z || void 0, children: Z || "—" }) }),
|
|
2898
2907
|
/* @__PURE__ */ a("td", { className: "px-2 py-1", children: /* @__PURE__ */ a("p", { className: "truncate text-slate-500 dark:text-slate-400", children: y(d) || "—" }) }),
|
|
2899
|
-
w.map((
|
|
2908
|
+
w.map((D, ae) => {
|
|
2900
2909
|
var Ie, oe;
|
|
2901
|
-
const ne =
|
|
2910
|
+
const ne = D.match !== void 0 && Ge(D.match, O) === null, U = ne || (oe = (Ie = E[ae]) == null ? void 0 : Ie.data) == null ? void 0 : oe.get(le);
|
|
2902
2911
|
return /* @__PURE__ */ a(
|
|
2903
2912
|
"td",
|
|
2904
2913
|
{
|
|
2905
2914
|
className: "whitespace-nowrap px-2 py-1 text-right tabular-nums text-slate-600 dark:text-slate-300",
|
|
2906
|
-
children: ne ? "—" : N(U,
|
|
2915
|
+
children: ne ? "—" : N(U, D.format, D.key)
|
|
2907
2916
|
},
|
|
2908
|
-
|
|
2917
|
+
D.key
|
|
2909
2918
|
);
|
|
2910
2919
|
})
|
|
2911
2920
|
]
|
|
2912
2921
|
},
|
|
2913
|
-
|
|
2922
|
+
le
|
|
2914
2923
|
);
|
|
2915
|
-
}, te = (
|
|
2916
|
-
return
|
|
2924
|
+
}, te = (Y == null ? void 0 : Y.closest('[role="dialog"]')) ?? document.body, Je = me.trim() ? se.filter((d) => Ss(`${xe(d)} ${F(d)} ${y(d)}`, me)) : se;
|
|
2925
|
+
return us(
|
|
2917
2926
|
/* @__PURE__ */ u("div", { className: "fixed inset-0 z-[125]", role: "presentation", children: [
|
|
2918
2927
|
/* @__PURE__ */ a(
|
|
2919
2928
|
"div",
|
|
@@ -2973,7 +2982,7 @@ function sa({
|
|
|
2973
2982
|
] }),
|
|
2974
2983
|
P.length > 0 && /* @__PURE__ */ u("p", { className: "mt-1.5 flex items-center gap-1 text-[10px] text-amber-600 dark:text-amber-400", children: [
|
|
2975
2984
|
/* @__PURE__ */ a(Ke, { className: "h-3 w-3 shrink-0" }),
|
|
2976
|
-
P.map((d) => d.label ??
|
|
2985
|
+
P.map((d) => d.label ?? G(d.key)).join(", "),
|
|
2977
2986
|
" fill in once the form's warehouse selection is made."
|
|
2978
2987
|
] })
|
|
2979
2988
|
] }),
|
|
@@ -2990,9 +2999,9 @@ function sa({
|
|
|
2990
2999
|
/* @__PURE__ */ a("th", { className: "px-2 py-1.5", children: "CIFA #" }),
|
|
2991
3000
|
/* @__PURE__ */ a("th", { className: "px-2 py-1.5", children: "Description" }),
|
|
2992
3001
|
/* @__PURE__ */ a("th", { className: "px-2 py-1.5", children: "Category" }),
|
|
2993
|
-
w.map((d) => /* @__PURE__ */ a("th", { className: "px-2 py-1.5 text-right", children: d.label ??
|
|
3002
|
+
w.map((d) => /* @__PURE__ */ a("th", { className: "px-2 py-1.5 text-right", children: d.label ?? G(d.key) }, d.key))
|
|
2994
3003
|
] }) }),
|
|
2995
|
-
/* @__PURE__ */ u("tbody", { className:
|
|
3004
|
+
/* @__PURE__ */ u("tbody", { className: V(re && "opacity-50 transition-opacity"), children: [
|
|
2996
3005
|
C(
|
|
2997
3006
|
/* @__PURE__ */ u("span", { className: "flex items-center gap-1.5", children: [
|
|
2998
3007
|
/* @__PURE__ */ a(ft, { className: "h-3 w-3 shrink-0 fill-amber-400 text-amber-400" }),
|
|
@@ -3014,7 +3023,7 @@ function sa({
|
|
|
3014
3023
|
/* @__PURE__ */ u("span", { className: "flex items-center gap-1.5", children: [
|
|
3015
3024
|
/* @__PURE__ */ a(At, { className: "h-3 w-3 shrink-0 text-slate-400" }),
|
|
3016
3025
|
/* @__PURE__ */ a("span", { className: "text-[11px] font-semibold text-slate-600 dark:text-slate-300", children: "All CIFAs" }),
|
|
3017
|
-
/* @__PURE__ */ a("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:
|
|
3026
|
+
/* @__PURE__ */ a("span", { className: "rounded border border-slate-200 bg-white px-1.5 py-0.5 text-[10px] font-medium tabular-nums text-slate-500 dark:border-border dark:bg-background dark:text-slate-400", children: X.toLocaleString() }),
|
|
3018
3027
|
re && /* @__PURE__ */ a(ue, { className: "h-3 w-3 animate-spin text-slate-400" })
|
|
3019
3028
|
] }),
|
|
3020
3029
|
"border-t border-slate-200 bg-slate-50 dark:border-border dark:bg-muted/40"
|
|
@@ -3034,10 +3043,10 @@ function sa({
|
|
|
3034
3043
|
/* @__PURE__ */ u("span", { className: "flex items-center gap-2 text-[10px] tabular-nums text-slate-400", children: [
|
|
3035
3044
|
(z - 1) * Te + 1,
|
|
3036
3045
|
"–",
|
|
3037
|
-
Math.min(z * Te,
|
|
3046
|
+
Math.min(z * Te, X),
|
|
3038
3047
|
" of",
|
|
3039
3048
|
" ",
|
|
3040
|
-
|
|
3049
|
+
X.toLocaleString(),
|
|
3041
3050
|
re && /* @__PURE__ */ u("span", { className: "flex items-center gap-1 text-slate-500", children: [
|
|
3042
3051
|
/* @__PURE__ */ a(ue, { className: "h-3 w-3 animate-spin" }),
|
|
3043
3052
|
" Loading…"
|
|
@@ -3078,26 +3087,26 @@ function sa({
|
|
|
3078
3087
|
te
|
|
3079
3088
|
);
|
|
3080
3089
|
}
|
|
3081
|
-
function
|
|
3090
|
+
function da(i, m) {
|
|
3082
3091
|
var g;
|
|
3083
3092
|
if (!i) return null;
|
|
3084
|
-
const
|
|
3085
|
-
return !
|
|
3093
|
+
const f = (g = (m ?? []).find((_) => !_.format && !_.sections_only)) == null ? void 0 : g.field;
|
|
3094
|
+
return !f || i.includes(`{{${f}}}`) ? i : `${i} · {{${f}}}`;
|
|
3086
3095
|
}
|
|
3087
3096
|
export {
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
|
|
3097
|
+
Ja as CatalogPickerField,
|
|
3098
|
+
ia as FacetBuilderCard,
|
|
3099
|
+
Us as MAX_LINE_MONEY,
|
|
3100
|
+
da as catalogOptionTemplate,
|
|
3101
|
+
Zs as footerSum,
|
|
3102
|
+
ta as gridPriceValue,
|
|
3103
|
+
sa as isUnpricedLine,
|
|
3104
|
+
ra as issuesAfterLinesChanged,
|
|
3105
|
+
ea as lineComputeError,
|
|
3106
|
+
br as matchesShowWhen,
|
|
3107
|
+
Ys as qtyEntryProblem,
|
|
3108
|
+
Xs as refusedQtyNote,
|
|
3109
|
+
Nn as relatedParentTokens,
|
|
3110
|
+
na as savedLinesSignature,
|
|
3111
|
+
Ds as stagedCatalogFill
|
|
3103
3112
|
};
|