@nivaro/react 0.3.117 → 0.3.119
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/full.css +1 -1
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +136 -14
- package/dist/index.js +488 -485
- package/dist/shared/components/ActivityEntry.js +130 -125
- package/dist/shared/components/AgentPresenceChip.js +36 -26
- package/dist/shared/components/CellCopyLayer.js +50 -45
- package/dist/shared/components/CollectionBrowserView.js +3757 -3695
- package/dist/shared/components/FilePreviewLightbox.js +96 -58
- package/dist/shared/components/InStep.js +18 -17
- package/dist/shared/components/ItemEditForm.js +4451 -4385
- package/dist/shared/components/JobsTray.js +8 -8
- package/dist/shared/components/LiveNewMatchesPill.js +21 -14
- package/dist/shared/components/LiveOffNote.js +3 -2
- package/dist/shared/components/LiveRowMark.js +53 -23
- package/dist/shared/components/LiveTraceView.js +162 -123
- package/dist/shared/components/MyWorkView.js +320 -299
- package/dist/shared/components/NotificationBell.js +14 -14
- package/dist/shared/components/OverflowRail.js +1 -1
- package/dist/shared/components/PageRenderer.js +120 -116
- package/dist/shared/components/ProfileView.js +203 -202
- package/dist/shared/components/RealtimeStatusBanner.js +31 -29
- package/dist/shared/components/RecordDrilldownSheet.js +7 -7
- package/dist/shared/components/RecordHoverCard.js +102 -84
- package/dist/shared/components/RecordReadView.js +146 -146
- package/dist/shared/components/ScreenRefreshButton.js +34 -32
- package/dist/shared/components/TipLayer.js +65 -58
- package/dist/shared/components/WidgetImageMenu.js +83 -43
- package/dist/shared/components/activity/RecordActivityStream.js +175 -173
- package/dist/shared/components/bulk/BulkSelectionNotices.js +142 -119
- package/dist/shared/components/change-proposals/ChangeProposalsPanel.js +158 -143
- package/dist/shared/components/change-proposals/ProposeChangeButton.js +17 -11
- package/dist/shared/components/change-proposals/ProposeChangeDialog.js +201 -173
- package/dist/shared/components/chat/ChatAnalyticsView.js +27 -27
- package/dist/shared/components/chat/HuddleAnalyticsTab.js +17 -17
- package/dist/shared/components/collections-directory/CollectionsToolbar.js +39 -41
- package/dist/shared/components/collections-directory/page-model.js +72 -67
- package/dist/shared/components/integrations/RecordIntegrationPreview.js +48 -56
- package/dist/shared/components/integrations/SendStatus.js +65 -59
- package/dist/shared/components/integrations/console/ReadyToSendView.js +275 -209
- package/dist/shared/components/integrations/console/SignalCard.js +237 -230
- package/dist/shared/components/item-edit/CatalogPickerField.js +227 -205
- package/dist/shared/components/item-edit/ChangedAfterApprovalBadge.js +135 -94
- package/dist/shared/components/item-edit/CloneDialog.js +191 -161
- package/dist/shared/components/item-edit/DerivedCauseNote.js +44 -30
- package/dist/shared/components/item-edit/DraftRecoveryBanner.js +153 -134
- package/dist/shared/components/item-edit/FieldComments.js +88 -85
- package/dist/shared/components/item-edit/FieldPointer.js +82 -67
- package/dist/shared/components/item-edit/FieldRow.js +106 -100
- package/dist/shared/components/item-edit/FieldSourceBadge.js +58 -56
- package/dist/shared/components/item-edit/FilePickerField.js +452 -387
- package/dist/shared/components/item-edit/HeaderSummaryChip.js +78 -56
- package/dist/shared/components/item-edit/HeaderTools.js +245 -141
- package/dist/shared/components/item-edit/InlineTableField.js +1242 -1218
- package/dist/shared/components/item-edit/ListNeighborNav.js +47 -50
- package/dist/shared/components/item-edit/LiveTraceSheet.js +15 -10
- package/dist/shared/components/item-edit/MembershipSetField.js +285 -254
- package/dist/shared/components/item-edit/OutboxReviewTray.js +155 -144
- package/dist/shared/components/item-edit/QueueReturnChip.js +15 -36
- package/dist/shared/components/item-edit/RecalcValue.js +57 -32
- package/dist/shared/components/item-edit/RecordHelpChip.js +15 -16
- package/dist/shared/components/item-edit/RecordLiveSync.js +283 -231
- package/dist/shared/components/item-edit/RelationCombobox.js +439 -393
- package/dist/shared/components/item-edit/RemoteChangeUi.js +292 -224
- package/dist/shared/components/item-edit/RemoteUploads.js +26 -20
- package/dist/shared/components/item-edit/RemovedLineNote.js +77 -67
- package/dist/shared/components/item-edit/RichTextEditorImpl.js +184 -179
- package/dist/shared/components/item-edit/ScheduledChangeChip.js +168 -134
- package/dist/shared/components/item-edit/SectionPresence.js +18 -10
- package/dist/shared/components/item-edit/SplitLinesButton.js +163 -139
- package/dist/shared/components/item-edit/UserChip.js +1 -1
- package/dist/shared/components/item-edit/addendum-view.js +6 -0
- package/dist/shared/components/item-edit/file-live.js +69 -54
- package/dist/shared/components/item-edit/layout-switch.js +98 -89
- package/dist/shared/components/item-edit/partner-needs.js +12 -12
- package/dist/shared/components/item-edit/removed-line.js +31 -25
- package/dist/shared/components/layout-editor/pickers/field-picker.js +151 -130
- package/dist/shared/components/list/ListViewers.js +46 -35
- package/dist/shared/components/notifications/NotificationCenterView.js +479 -437
- package/dist/shared/components/panels/AccessDeniedPanel.js +176 -101
- package/dist/shared/components/panels/AlertBanners.js +82 -72
- package/dist/shared/components/panels/BranchLanes.js +22 -22
- package/dist/shared/components/panels/CommentImages.js +123 -102
- package/dist/shared/components/panels/CommentPanel.js +186 -185
- package/dist/shared/components/panels/ExternalRequestsChip.js +111 -119
- package/dist/shared/components/panels/OwnerOpenedLine.js +31 -24
- package/dist/shared/components/panels/PipelinePanel.js +2037 -1885
- package/dist/shared/components/panels/ResubmissionDiff.js +163 -142
- package/dist/shared/components/pipeline/OwnerMatrixSheet.js +400 -288
- package/dist/shared/components/pipeline/PipelineEditorView.js +7 -2
- package/dist/shared/components/profile/AgentNameField.js +107 -81
- package/dist/shared/components/profile/AgentsPanel.js +184 -184
- package/dist/shared/components/profile/PersonAccess.js +599 -495
- package/dist/shared/components/profile/SignInTroubleshooter.js +160 -127
- package/dist/shared/components/profile/SignedInDevices.js +17 -17
- package/dist/shared/components/profile/primitives.js +1 -1
- package/dist/shared/components/queue/OwnerAvatars.js +91 -54
- package/dist/shared/components/queue/QueueTeamStrip.js +56 -46
- package/dist/shared/components/queue/QueueWorklist.js +1002 -983
- package/dist/shared/components/support/AssignRules.js +1733 -0
- package/dist/shared/components/support/PersonPick.js +88 -0
- package/dist/shared/components/support/RequestList.js +790 -0
- package/dist/shared/components/support/ScreenShare.js +158 -152
- package/dist/shared/components/support/SupportRequestDialog.js +50 -48
- package/dist/shared/components/support/SupportView.js +140 -246
- package/dist/shared/components/support/TicketDetailSheet.js +82 -75
- package/dist/shared/components/support/TicketSlowScreens.js +9 -9
- package/dist/shared/components/support/assign-rules-text.js +171 -0
- package/dist/shared/components/support/support-list.js +125 -0
- package/dist/shared/components/ui/SimpleSelect.js +28 -20
- package/dist/shared/components/ui/checkbox.js +6 -6
- package/dist/shared/components/ui/select.js +43 -39
- package/dist/shared/components/ui/sheet.js +9 -9
- package/dist/shared/components/ui/switch.js +12 -11
- package/dist/shared/components/watch-list/WatchDock.js +532 -459
- package/dist/shared/components/watch-list/WatchExtras.js +332 -286
- package/dist/shared/components/watch-list/WatchRows.js +164 -140
- package/dist/shared/lib/activity-sentence.js +103 -91
- package/dist/shared/lib/agent-presence.js +27 -21
- package/dist/shared/lib/approval-progress.js +2 -2
- package/dist/shared/lib/copy-rules.js +31 -24
- package/dist/shared/lib/derived-causes.js +113 -78
- package/dist/shared/lib/grid-cursors.js +26 -26
- package/dist/shared/lib/label-flash.js +27 -0
- package/dist/shared/lib/list-return.js +137 -125
- package/dist/shared/lib/live-deltas.js +40 -34
- package/dist/shared/lib/live-groups.js +56 -52
- package/dist/shared/lib/live-preference.js +64 -59
- package/dist/shared/lib/live-screen.js +223 -192
- package/dist/shared/lib/partner-failure.js +11 -11
- package/dist/shared/lib/rollup-recalc.js +68 -64
- package/dist/shared/lib/screen-refresh.js +74 -68
- package/dist/shared/lib/screen-share.js +108 -104
- package/dist/shared/lib/send-status.js +77 -61
- package/dist/shared/lib/text-diff-window.js +29 -0
- package/dist/shared/lib/watch-list.js +210 -209
- package/dist/shared/lib/widget-image-render.js +72 -49
- package/package.json +1 -1
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { jsxs as u, jsx as a, Fragment as Se } from "react/jsx-runtime";
|
|
2
2
|
import { useQueryClient as is, useQuery as Q, useQueries as xn } from "@tanstack/react-query";
|
|
3
|
-
import { Search as
|
|
3
|
+
import { Search as At, Loader2 as ue, PackageCheck as ls, ChevronRight as Jt, Star as ft, AlertTriangle as Ke, AlertCircle as hn, X as pt, Plus as xr, ChevronDown as os } from "lucide-react";
|
|
4
4
|
import { useState as D, useRef as je, useMemo as R, useEffect as Fe, Fragment as ut } from "react";
|
|
5
5
|
import { createPortal as ds } from "react-dom";
|
|
6
6
|
import { useNivaroClient as ht, useParentDraft as cs, useReimportHandler as us, useItemEditAuth as ur } from "../../context.js";
|
|
7
7
|
import { canOpenCatalogItem as yr, openCatalogItem as gr } from "../../lib/catalog-item-open.js";
|
|
8
|
-
import { get as
|
|
8
|
+
import { get as A, del as ms, patch as mr, post as fr } from "../../lib/commands.js";
|
|
9
9
|
import { evaluateBoolean as fs } from "../../lib/expression.js";
|
|
10
10
|
import { useLiveRefetchInterval as ps } from "../../lib/live-queries.js";
|
|
11
|
-
import { fetchCollectionRelations as yn, queryKeys as
|
|
11
|
+
import { fetchCollectionRelations as yn, queryKeys as Kt } from "../../lib/query-keys.js";
|
|
12
12
|
import { tokenize as hs, matchesSearch as bs } from "../../lib/search-text.js";
|
|
13
13
|
import { registerStagedRowLabel as xs } from "../../lib/staged-row-labels.js";
|
|
14
14
|
import { submissionLineErrors as ys, normalizeIdent as gs } from "../../lib/submission-errors.js";
|
|
@@ -20,9 +20,9 @@ import { useColumnWidths as pr, ResetColumnsButton as bn, ColResizeHandle as vs,
|
|
|
20
20
|
import { facetsComplete as _s, facetResults as qs, facetOptions as $s, setFacetPick as js } from "./catalog-facets.js";
|
|
21
21
|
import { usePlaceName as Fs, useCatalogLineLive as Ts, stockShortText as Rs, catalogPriceText as Os, linePriceChange as Ps } from "./catalog-line-watch.js";
|
|
22
22
|
import { orderCatalogMatches as Ls, rowMatchesFields as Es } from "./catalog-search.js";
|
|
23
|
-
import { applyDisplayTemplate as
|
|
23
|
+
import { applyDisplayTemplate as Ae } from "./helpers.js";
|
|
24
24
|
import { evalClientFormula as Ee } from "./InlineTableField.js";
|
|
25
|
-
import { isIntegerFieldType as mt, checkNumberEntry as kn, mergePendingQtyRow as
|
|
25
|
+
import { isIntegerFieldType as mt, checkNumberEntry as kn, mergePendingQtyRow as Cs, decimalPlacesProblem as Ks, lineRuleErrors as As, MAX_LINE_MONEY as Js } from "./line-qty.js";
|
|
26
26
|
import { resolveM2MRelatedCollection as Is } from "./M2MCombobox.js";
|
|
27
27
|
import { useO2MStaging as Qs } from "./O2MStagingContext.js";
|
|
28
28
|
import { RelationCombobox as zs, RelatedItemLabel as Us } from "./RelationCombobox.js";
|
|
@@ -37,7 +37,7 @@ const kr = (i, m) => {
|
|
|
37
37
|
async function It(i, m, p) {
|
|
38
38
|
const g = [];
|
|
39
39
|
for (let _ = 1; _ <= 50; _++) {
|
|
40
|
-
const s = await i.request(
|
|
40
|
+
const s = await i.request(A(m, { ...p, limit: 1e3, page: _ })).then((k) => k.data ?? []);
|
|
41
41
|
if (g.push(...s), s.length < 1e3) break;
|
|
42
42
|
}
|
|
43
43
|
return g;
|
|
@@ -126,11 +126,18 @@ function Bs(i, m, p) {
|
|
|
126
126
|
}, 0);
|
|
127
127
|
return Math.round(g * 1e6) / 1e6;
|
|
128
128
|
}
|
|
129
|
-
|
|
129
|
+
const Ds = `[data-cpf-lines]{container:cpflines/inline-size}
|
|
130
|
+
@container cpflines (max-width: 559px){
|
|
131
|
+
[data-cpf-lines] [data-cpf-line-main]{flex-wrap:wrap;column-gap:8px;row-gap:6px}
|
|
132
|
+
[data-cpf-lines] [data-cpf-line-break]{display:block!important;flex-basis:100%;height:0}
|
|
133
|
+
[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
|
+
[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
|
+
function Hs(i, m) {
|
|
130
137
|
const p = m.trim();
|
|
131
138
|
return p ? `${i} — ${p} not used` : i;
|
|
132
139
|
}
|
|
133
|
-
function
|
|
140
|
+
function Ys(i) {
|
|
134
141
|
const m = { ...i.probe };
|
|
135
142
|
for (const [p, g] of Object.entries(i.compute)) {
|
|
136
143
|
const _ = Ee(g, m);
|
|
@@ -143,7 +150,7 @@ function Hs(i) {
|
|
|
143
150
|
}
|
|
144
151
|
return null;
|
|
145
152
|
}
|
|
146
|
-
function
|
|
153
|
+
function Zs(i) {
|
|
147
154
|
const m = Object.entries(i.copyFields ?? {}).filter(([, p]) => p === i.field).map(([p]) => p);
|
|
148
155
|
for (const p of m)
|
|
149
156
|
for (const g of i.related ?? []) {
|
|
@@ -153,17 +160,17 @@ function Ys(i) {
|
|
|
153
160
|
}
|
|
154
161
|
return i.catalogValue;
|
|
155
162
|
}
|
|
156
|
-
function
|
|
163
|
+
function Gs(i, m) {
|
|
157
164
|
return i.map((p) => [p.id, ...m.map((g) => p[g])].map((g) => String(g ?? "")).join("")).join("");
|
|
158
165
|
}
|
|
159
|
-
function
|
|
166
|
+
function Xs(i) {
|
|
160
167
|
const m = Object.keys(i).filter((g) => i[g].kind === "error");
|
|
161
168
|
if (m.length === 0) return i;
|
|
162
169
|
const p = { ...i };
|
|
163
170
|
for (const g of m) delete p[g];
|
|
164
171
|
return p;
|
|
165
172
|
}
|
|
166
|
-
function
|
|
173
|
+
function ea(i, m, p) {
|
|
167
174
|
const g = Number(i[m]);
|
|
168
175
|
if (!Number.isFinite(g) || g <= 0) return !1;
|
|
169
176
|
const _ = p.find((k) => k in i);
|
|
@@ -171,7 +178,7 @@ function Xs(i, m, p) {
|
|
|
171
178
|
const s = i[_];
|
|
172
179
|
return s == null || s === "" || Number(s) === 0;
|
|
173
180
|
}
|
|
174
|
-
function
|
|
181
|
+
function La({
|
|
175
182
|
relatedCollection: i,
|
|
176
183
|
manyField: m,
|
|
177
184
|
parentId: p,
|
|
@@ -182,7 +189,7 @@ function Pa({
|
|
|
182
189
|
}) {
|
|
183
190
|
var er, tr, nr, rr, sr, ar, ir, lr, or;
|
|
184
191
|
const w = ht(), O = is(), v = Qs(), L = cs(), H = us(), M = s.editable_fields ?? [], me = s.catalog_locked_fields ?? [], { isAdmin: fe } = ur(), T = p === "new", be = g && !T ? `?parent_collection=${encodeURIComponent(g)}&parent_id=${encodeURIComponent(p)}` : "", z = s.qty_field ?? "quantity", [pe, ge] = D(/* @__PURE__ */ new Set()), ke = je(!1), [V, Te] = D(""), [he, re] = D({}), [ee, G] = D(/* @__PURE__ */ new Set()), [B, se] = D({}), [ie, _e] = D({}), { data: xe = [], isPending: F } = Q({
|
|
185
|
-
queryKey:
|
|
192
|
+
queryKey: Kt.collectionRelations(i),
|
|
186
193
|
queryFn: () => yn(w, i),
|
|
187
194
|
staleTime: 10 * 6e4
|
|
188
195
|
}), y = R(
|
|
@@ -194,12 +201,12 @@ function Pa({
|
|
|
194
201
|
},
|
|
195
202
|
[xe, i, s.item_field]
|
|
196
203
|
), { data: N = [] } = Q({
|
|
197
|
-
queryKey:
|
|
198
|
-
queryFn: () => w.request(
|
|
204
|
+
queryKey: Kt.fieldConfig(i, null),
|
|
205
|
+
queryFn: () => w.request(A(`/field-config/${i}`)).then((e) => e.data ?? []),
|
|
199
206
|
staleTime: 6e4
|
|
200
207
|
}), E = ((er = N.find((e) => e.field === z)) == null ? void 0 : er.type) ?? null, P = (e, t, n) => {
|
|
201
208
|
var r;
|
|
202
|
-
return ((r =
|
|
209
|
+
return ((r = As(
|
|
203
210
|
N.filter((l) => l.field === e).map((l) => ({
|
|
204
211
|
field: l.field,
|
|
205
212
|
label: l.label || Z(l.field),
|
|
@@ -211,32 +218,32 @@ function Pa({
|
|
|
211
218
|
)[0]) == null ? void 0 : r.message) ?? null;
|
|
212
219
|
}, { data: j } = Q({
|
|
213
220
|
queryKey: ["col-meta", y],
|
|
214
|
-
queryFn: () => w.request(
|
|
221
|
+
queryFn: () => w.request(A(`/collections/${y}`)).then((e) => e.data),
|
|
215
222
|
enabled: !!y,
|
|
216
223
|
staleTime: 3e5
|
|
217
|
-
}),
|
|
224
|
+
}), C = j == null ? void 0 : j.display_template, K = R(() => {
|
|
218
225
|
const e = s.section_by.split(".")[0];
|
|
219
226
|
return ((j == null ? void 0 : j.relations) ?? []).find(
|
|
220
227
|
(t) => t.one_collection === y && t.one_field === e && !!t.junction_field
|
|
221
228
|
) ?? null;
|
|
222
|
-
}, [j, y, s.section_by]), te = (
|
|
223
|
-
queryKey:
|
|
229
|
+
}, [j, y, s.section_by]), te = (K == null ? void 0 : K.many_collection) ?? null, { data: Je = [] } = Q({
|
|
230
|
+
queryKey: Kt.collectionRelations(te),
|
|
224
231
|
queryFn: () => yn(w, te),
|
|
225
232
|
enabled: !!te,
|
|
226
233
|
staleTime: 10 * 6e4
|
|
227
234
|
}), d = R(() => {
|
|
228
|
-
if (!(
|
|
229
|
-
const e = String(
|
|
235
|
+
if (!(K != null && K.many_field) || !te) return null;
|
|
236
|
+
const e = String(K.junction_field), t = Je.find(
|
|
230
237
|
(r) => r.many_collection === te && r.many_field === e
|
|
231
238
|
), n = Is(t);
|
|
232
239
|
return n ? {
|
|
233
240
|
junction: te,
|
|
234
|
-
fkToItem:
|
|
241
|
+
fkToItem: K.many_field,
|
|
235
242
|
fkToSection: e,
|
|
236
243
|
target: n,
|
|
237
244
|
labelPath: s.section_by.split(".").slice(1).join(".") || "id"
|
|
238
245
|
} : null;
|
|
239
|
-
}, [
|
|
246
|
+
}, [K, te, Je, s.section_by]), S = L == null ? void 0 : L.draft, { resolvedFilter: X, resolvedSectionFilter: le, resolvedLinkFilter: Y, missingParents: ae } = R(() => {
|
|
240
247
|
const e = [], t = (o) => {
|
|
241
248
|
if (typeof o == "string" && o.startsWith("$parent.")) {
|
|
242
249
|
const f = o.slice(8), c = S == null ? void 0 : S[f];
|
|
@@ -251,24 +258,24 @@ function Pa({
|
|
|
251
258
|
missingParents: [...new Set(e)]
|
|
252
259
|
};
|
|
253
260
|
}, [s.filter, s.section_filter, s.link_filter, S]), ne = R(() => {
|
|
254
|
-
if (!
|
|
261
|
+
if (!K || !le && !Y) return X;
|
|
255
262
|
const e = {
|
|
256
263
|
...le ?? {},
|
|
257
264
|
...Y ? { _link: Y } : {}
|
|
258
|
-
}, t = { [
|
|
265
|
+
}, t = { [K.one_field]: { _some: e } };
|
|
259
266
|
return X ? { _and: [X, t] } : t;
|
|
260
|
-
}, [
|
|
267
|
+
}, [K, le, Y, X]), U = R(() => {
|
|
261
268
|
const e = /* @__PURE__ */ new Set(["id"]);
|
|
262
|
-
j && !
|
|
263
|
-
for (const t of [...(
|
|
269
|
+
j && !K && e.add(s.section_by);
|
|
270
|
+
for (const t of [...(C ?? "").matchAll(/\{\{([\w.]+)\}\}/g)]) e.add(t[1]);
|
|
264
271
|
for (const t of Object.values(s.copy_fields ?? {})) e.add(t);
|
|
265
272
|
for (const t of s.columns ?? []) e.add(t.field);
|
|
266
273
|
return [...e].join(",");
|
|
267
|
-
}, [
|
|
274
|
+
}, [C, j, K, s.section_by, s.copy_fields, s.columns]), Ie = JSON.stringify(ne ?? null), { data: oe = [], isLoading: Nn } = Q(
|
|
268
275
|
{
|
|
269
276
|
queryKey: ["catalog-picker", y, U, Ie],
|
|
270
277
|
queryFn: () => w.request(
|
|
271
|
-
|
|
278
|
+
A(`/items/${y}`, {
|
|
272
279
|
limit: Ws,
|
|
273
280
|
fields: U,
|
|
274
281
|
...ne ? { filter: JSON.stringify(ne) } : {}
|
|
@@ -276,7 +283,7 @@ function Pa({
|
|
|
276
283
|
).then((e) => e.data ?? []),
|
|
277
284
|
// Wait for the catalog meta: a to-many section path both narrows this
|
|
278
285
|
// read and must stay out of its `fields=`.
|
|
279
|
-
enabled: !!y && !!j && ae.length === 0 && (!
|
|
286
|
+
enabled: !!y && !!j && ae.length === 0 && (!K || !!d),
|
|
280
287
|
staleTime: 6e4
|
|
281
288
|
}
|
|
282
289
|
), Nr = JSON.stringify(le ?? null), { data: bt = [], isLoading: vr } = Q({
|
|
@@ -325,14 +332,14 @@ function Pa({
|
|
|
325
332
|
l.includes(r) || l.push(r), t.set(n.item, l);
|
|
326
333
|
}
|
|
327
334
|
return t;
|
|
328
|
-
}, [bt, vn]), xt = !!
|
|
335
|
+
}, [bt, vn]), xt = !!K && (!d || vr || Xe.length > 0 && Sr), yt = R(() => {
|
|
329
336
|
const e = /* @__PURE__ */ new Map();
|
|
330
337
|
for (const t of oe) e.set(String(t.id), t);
|
|
331
338
|
return e;
|
|
332
339
|
}, [oe]), { data: we = [] } = Q({
|
|
333
340
|
queryKey: ["o2m-rows", i, m, p],
|
|
334
341
|
queryFn: () => w.request(
|
|
335
|
-
|
|
342
|
+
A(`/items/${i}`, {
|
|
336
343
|
filter: JSON.stringify({ [m]: { _eq: p } }),
|
|
337
344
|
limit: 1e3
|
|
338
345
|
})
|
|
@@ -340,7 +347,7 @@ function Pa({
|
|
|
340
347
|
enabled: !T,
|
|
341
348
|
staleTime: 15e3
|
|
342
349
|
}), Qt = R(
|
|
343
|
-
() =>
|
|
350
|
+
() => Gs(we, [
|
|
344
351
|
s.item_field,
|
|
345
352
|
z,
|
|
346
353
|
...M,
|
|
@@ -354,7 +361,7 @@ function Pa({
|
|
|
354
361
|
const t = Object.keys(zt.current).filter(
|
|
355
362
|
(n) => zt.current[n].kind === "error"
|
|
356
363
|
);
|
|
357
|
-
se((n) =>
|
|
364
|
+
se((n) => Xs(n)), _e((n) => Object.keys(n).length === 0 ? n : {}), t.length > 0 && re((n) => {
|
|
358
365
|
if (!t.some((l) => l in n)) return n;
|
|
359
366
|
const r = { ...n };
|
|
360
367
|
for (const l of t) delete r[l];
|
|
@@ -391,7 +398,7 @@ function Pa({
|
|
|
391
398
|
), { data: Ut = [] } = Q({
|
|
392
399
|
queryKey: ["catalog-picker-labels", y, U, Nt.join(",")],
|
|
393
400
|
queryFn: () => w.request(
|
|
394
|
-
|
|
401
|
+
A(`/items/${y}`, {
|
|
395
402
|
filter: JSON.stringify({ id: { _in: Nt } }),
|
|
396
403
|
fields: U,
|
|
397
404
|
limit: Nt.length
|
|
@@ -401,13 +408,13 @@ function Pa({
|
|
|
401
408
|
staleTime: 6e4
|
|
402
409
|
}), { data: Pe = [] } = Q({
|
|
403
410
|
queryKey: ["pinned-items", y],
|
|
404
|
-
queryFn: () => w.request(
|
|
411
|
+
queryFn: () => w.request(A(`/pinned/${y}`)).then((e) => e.data ?? []),
|
|
405
412
|
enabled: !!y && !!s.favorites,
|
|
406
413
|
staleTime: 6e4
|
|
407
414
|
}), Mt = R(() => new Set(Pe), [Pe]), { data: nt = [] } = Q({
|
|
408
415
|
queryKey: ["pinned-item-rows", y, U, Pe.join(",")],
|
|
409
416
|
queryFn: () => w.request(
|
|
410
|
-
|
|
417
|
+
A(`/items/${y}`, {
|
|
411
418
|
filter: JSON.stringify({ id: { _in: Pe } }),
|
|
412
419
|
fields: U,
|
|
413
420
|
limit: Pe.length
|
|
@@ -457,21 +464,21 @@ function Pa({
|
|
|
457
464
|
}, [V]);
|
|
458
465
|
const Tn = R(() => {
|
|
459
466
|
var t;
|
|
460
|
-
const e = (t = [...(
|
|
467
|
+
const e = (t = [...(C ?? "").matchAll(/\{\{([\w.]+)\}\}/g)][0]) == null ? void 0 : t[1];
|
|
461
468
|
return e && !e.includes(".") ? e : "id";
|
|
462
|
-
}, [
|
|
469
|
+
}, [C]), { shownSearchFields: Qe, otherSearchFields: Rn } = R(() => {
|
|
463
470
|
const e = new Set(
|
|
464
471
|
((j == null ? void 0 : j.relations) ?? []).filter((r) => r.one_collection === y && r.one_field).map((r) => r.one_field)
|
|
465
472
|
), t = new Set(
|
|
466
473
|
((j == null ? void 0 : j.fields) ?? []).filter((r) => (r.type === "string" || r.type === "text") && !e.has(r.field)).map((r) => r.field)
|
|
467
474
|
), n = /* @__PURE__ */ new Set();
|
|
468
|
-
for (const r of (
|
|
475
|
+
for (const r of (C ?? "").matchAll(/\{\{([\w.]+)\}\}/g)) t.has(r[1]) && n.add(r[1]);
|
|
469
476
|
for (const r of s.columns ?? []) t.has(r.field) && n.add(r.field);
|
|
470
477
|
return {
|
|
471
478
|
shownSearchFields: [...n],
|
|
472
479
|
otherSearchFields: [...t].filter((r) => !n.has(r))
|
|
473
480
|
};
|
|
474
|
-
}, [j, y,
|
|
481
|
+
}, [j, y, C, s.columns]), We = R(() => {
|
|
475
482
|
const e = s.related_columns ?? [], t = e.findIndex((n) => n.stock === !0);
|
|
476
483
|
return t !== -1 ? t : e.findIndex((n) => n.key === "on_hand" && n.stock !== !1);
|
|
477
484
|
}, [s.related_columns]), de = We === -1 ? null : (s.related_columns ?? [])[We] ?? null, Le = de ? Ge(de.match, S) : null, ze = R(() => {
|
|
@@ -522,7 +529,7 @@ function Pa({
|
|
|
522
529
|
const e = new Date(Date.now() - _t * 864e5).toISOString(), t = { [Gt]: { _eq: Zt } };
|
|
523
530
|
rt && (t[rt] = { _gte: e });
|
|
524
531
|
const n = await w.request(
|
|
525
|
-
|
|
532
|
+
A(`/items/${i}`, {
|
|
526
533
|
fields: s.item_field,
|
|
527
534
|
filter: JSON.stringify(t),
|
|
528
535
|
limit: 500,
|
|
@@ -549,7 +556,7 @@ function Pa({
|
|
|
549
556
|
St
|
|
550
557
|
],
|
|
551
558
|
queryFn: () => w.request(
|
|
552
|
-
|
|
559
|
+
A(
|
|
553
560
|
`/items/${y}`,
|
|
554
561
|
Yt({
|
|
555
562
|
search: ye,
|
|
@@ -575,7 +582,7 @@ function Pa({
|
|
|
575
582
|
St
|
|
576
583
|
],
|
|
577
584
|
queryFn: () => w.request(
|
|
578
|
-
|
|
585
|
+
A(
|
|
579
586
|
`/items/${y}`,
|
|
580
587
|
Yt({
|
|
581
588
|
search: ye,
|
|
@@ -588,7 +595,7 @@ function Pa({
|
|
|
588
595
|
enabled: Xt,
|
|
589
596
|
staleTime: 3e4,
|
|
590
597
|
placeholderData: (e) => e
|
|
591
|
-
}), Or = st.join(","), { data:
|
|
598
|
+
}), Or = st.join(","), { data: Cn = [] } = Q({
|
|
592
599
|
queryKey: [
|
|
593
600
|
"catalog-recent-search",
|
|
594
601
|
y,
|
|
@@ -599,7 +606,7 @@ function Pa({
|
|
|
599
606
|
Ht
|
|
600
607
|
],
|
|
601
608
|
queryFn: () => w.request(
|
|
602
|
-
|
|
609
|
+
A(
|
|
603
610
|
`/items/${y}`,
|
|
604
611
|
Yt(
|
|
605
612
|
{
|
|
@@ -619,11 +626,11 @@ function Pa({
|
|
|
619
626
|
() => Ls({
|
|
620
627
|
shown: en,
|
|
621
628
|
other: En,
|
|
622
|
-
recent:
|
|
629
|
+
recent: Cn,
|
|
623
630
|
shownFields: Qe,
|
|
624
631
|
q: ye
|
|
625
632
|
}),
|
|
626
|
-
[en, En,
|
|
633
|
+
[en, En, Cn, Qe, ye]
|
|
627
634
|
), Pr = (e) => {
|
|
628
635
|
if (Qe.length === 0 || en.some((n) => String(n.id) === String(e.id)) || Es(e, Qe, ye)) return null;
|
|
629
636
|
const t = hs(ye);
|
|
@@ -635,21 +642,21 @@ function Pa({
|
|
|
635
642
|
return `${Z(n)}: ${l.length > 40 ? `${l.slice(0, 40)}…` : l}`;
|
|
636
643
|
}
|
|
637
644
|
return null;
|
|
638
|
-
},
|
|
645
|
+
}, Kn = R(
|
|
639
646
|
() => [.../* @__PURE__ */ new Set(["id", ...Object.values(s.copy_fields ?? {})])].join(","),
|
|
640
647
|
[s.copy_fields]
|
|
641
648
|
), at = R(
|
|
642
649
|
() => T ? [] : Me.map((e) => e[s.item_field]).filter((e) => e != null && e !== "").map(String),
|
|
643
650
|
[T, Me, s.item_field]
|
|
644
|
-
), { data:
|
|
645
|
-
queryKey: ["catalog-line-sources", y,
|
|
651
|
+
), { data: An = [] } = Q({
|
|
652
|
+
queryKey: ["catalog-line-sources", y, Kn, at.join(",")],
|
|
646
653
|
queryFn: async () => {
|
|
647
654
|
const e = [];
|
|
648
655
|
for (let t = 0; t < at.length; t += 200) {
|
|
649
656
|
const n = at.slice(t, t + 200), r = await w.request(
|
|
650
|
-
|
|
657
|
+
A(`/items/${y}`, {
|
|
651
658
|
filter: JSON.stringify({ id: { _in: n } }),
|
|
652
|
-
fields:
|
|
659
|
+
fields: Kn,
|
|
653
660
|
limit: n.length
|
|
654
661
|
})
|
|
655
662
|
).then((l) => l.data ?? []);
|
|
@@ -660,8 +667,8 @@ function Pa({
|
|
|
660
667
|
enabled: !k && !!y && at.length > 0 && Object.keys(s.copy_fields ?? {}).length > 0,
|
|
661
668
|
staleTime: 6e4
|
|
662
669
|
}), Lr = R(
|
|
663
|
-
() => new Map(
|
|
664
|
-
[
|
|
670
|
+
() => new Map(An.map((e) => [String(e.id).toUpperCase(), e])),
|
|
671
|
+
[An]
|
|
665
672
|
), De = R(() => {
|
|
666
673
|
const e = /* @__PURE__ */ new Set();
|
|
667
674
|
for (const t of oe) e.add(String(t.id));
|
|
@@ -689,7 +696,7 @@ function Pa({
|
|
|
689
696
|
o[f] = (S == null ? void 0 : S[f]) ?? null;
|
|
690
697
|
for (let f = 0; f < De.length; f += 200) {
|
|
691
698
|
const c = De.slice(f, f + 200), h = await w.request(
|
|
692
|
-
|
|
699
|
+
A("/catalog-related/count-all", {
|
|
693
700
|
collection: g,
|
|
694
701
|
field: _,
|
|
695
702
|
key: e.key,
|
|
@@ -708,7 +715,7 @@ function Pa({
|
|
|
708
715
|
let c = 1;
|
|
709
716
|
for (; ; ) {
|
|
710
717
|
const h = await w.request(
|
|
711
|
-
|
|
718
|
+
A(`/items/${e.collection}`, {
|
|
712
719
|
limit: r ? 1e3 : f.length,
|
|
713
720
|
...r ? { page: c } : {},
|
|
714
721
|
fields: `${e.item_field},${e.value_field}`,
|
|
@@ -755,7 +762,7 @@ function Pa({
|
|
|
755
762
|
if (l === void 0) return null;
|
|
756
763
|
const o = l[e], f = o == null || o === "" ? 0 : Number(o);
|
|
757
764
|
return Number.isNaN(f) ? null : n > f ? { available: f, qty: n } : null;
|
|
758
|
-
},
|
|
765
|
+
}, Cr = (e) => {
|
|
759
766
|
const t = s.row_flags ?? [];
|
|
760
767
|
if (t.length === 0) return [];
|
|
761
768
|
const n = [];
|
|
@@ -770,18 +777,18 @@ function Pa({
|
|
|
770
777
|
}, sn = s.qty_warning ? s.qty_warning.label ?? ((ar = (s.related_columns ?? []).find((e) => {
|
|
771
778
|
var t;
|
|
772
779
|
return e.key === ((t = s.qty_warning) == null ? void 0 : t.column);
|
|
773
|
-
})) == null ? void 0 : ar.label) ?? Z(s.qty_warning.column) : "",
|
|
780
|
+
})) == null ? void 0 : ar.label) ?? Z(s.qty_warning.column) : "", Kr = !!s.submission_errors, $t = R(
|
|
774
781
|
() => {
|
|
775
782
|
var e;
|
|
776
783
|
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)) : [];
|
|
777
784
|
},
|
|
778
785
|
[s.submission_errors]
|
|
779
|
-
),
|
|
786
|
+
), Ar = ps(6e4), { data: In } = Q({
|
|
780
787
|
queryKey: ["erp-submissions", g ?? "", String(p)],
|
|
781
|
-
queryFn: () => w.request(
|
|
782
|
-
enabled:
|
|
788
|
+
queryFn: () => w.request(A(`/erp-submissions/${g}/${encodeURIComponent(p)}`)).then((e) => e.data ?? []),
|
|
789
|
+
enabled: Kr && !T && !!g,
|
|
783
790
|
staleTime: 15e3,
|
|
784
|
-
refetchInterval:
|
|
791
|
+
refetchInterval: Ar
|
|
785
792
|
}), an = R(() => {
|
|
786
793
|
const e = (In ?? [])[0];
|
|
787
794
|
return !e || e.status !== "failed" ? null : ys(e.payload, e.last_error);
|
|
@@ -791,7 +798,7 @@ function Pa({
|
|
|
791
798
|
const e = Ne.map((n) => n.key);
|
|
792
799
|
if (e.length === 0) return {};
|
|
793
800
|
const t = await w.request(
|
|
794
|
-
|
|
801
|
+
A(`/items/${y}`, {
|
|
795
802
|
limit: e.length,
|
|
796
803
|
fields: ["id", ...$t].join(","),
|
|
797
804
|
filter: JSON.stringify({ id: { _in: e } })
|
|
@@ -818,13 +825,13 @@ function Pa({
|
|
|
818
825
|
const t = we.map((b) => String(b.id));
|
|
819
826
|
if (t.length === 0) return {};
|
|
820
827
|
const n = e.m2m, r = await w.request(
|
|
821
|
-
|
|
828
|
+
A(`/items/${n.junction}`, {
|
|
822
829
|
limit: 1e3,
|
|
823
830
|
fields: `${n.fk_to_child},${n.related_field}`,
|
|
824
831
|
filter: JSON.stringify({ [n.fk_to_child]: { _in: t } })
|
|
825
832
|
})
|
|
826
833
|
).then((b) => b.data ?? []).catch(() => []), l = [...new Set(r.map((b) => String(b[n.related_field])))], o = n.label_field ?? "name", f = l.length ? await w.request(
|
|
827
|
-
|
|
834
|
+
A(`/items/${n.related_collection}`, {
|
|
828
835
|
limit: 500,
|
|
829
836
|
fields: `id,${o}`,
|
|
830
837
|
filter: JSON.stringify({ id: { _in: l } })
|
|
@@ -913,7 +920,7 @@ function Pa({
|
|
|
913
920
|
if (e == null || e === "") return "—";
|
|
914
921
|
const n = Number(e);
|
|
915
922
|
return t === "currency" ? Number.isNaN(n) ? String(e) : n.toLocaleString(void 0, { style: "currency", currency: "USD" }) : t === "number" ? Number.isNaN(n) ? String(e) : n.toLocaleString(void 0, { maximumFractionDigits: 2 }) : String(e);
|
|
916
|
-
}, Rt = y ? `${y}:${i}.${m}` : null,
|
|
923
|
+
}, Rt = y ? `${y}:${i}.${m}` : null, Ce = pr(Rt && `${Rt}:catalog`), Oe = pr(Rt && `${Rt}:summary`), Bn = je(null), Br = (e, t) => {
|
|
917
924
|
const n = Ss(Bn.current, t);
|
|
918
925
|
n != null && e.setWidth(t, n);
|
|
919
926
|
}, Ot = (e, t, n, r, l) => {
|
|
@@ -936,7 +943,7 @@ function Pa({
|
|
|
936
943
|
br,
|
|
937
944
|
{
|
|
938
945
|
text: ve(
|
|
939
|
-
|
|
946
|
+
Zs({
|
|
940
947
|
field: r.field,
|
|
941
948
|
catalogValue: Tt(t, r.field),
|
|
942
949
|
copyFields: s.copy_fields,
|
|
@@ -946,7 +953,7 @@ function Pa({
|
|
|
946
953
|
r.format
|
|
947
954
|
),
|
|
948
955
|
highlight: r.format ? void 0 : n,
|
|
949
|
-
...
|
|
956
|
+
...Ce.box(r.field, l, W("text-slate-500 dark:text-slate-400", o))
|
|
950
957
|
},
|
|
951
958
|
r.field
|
|
952
959
|
);
|
|
@@ -954,7 +961,7 @@ function Pa({
|
|
|
954
961
|
on.map((r) => /* @__PURE__ */ a(
|
|
955
962
|
"span",
|
|
956
963
|
{
|
|
957
|
-
...
|
|
964
|
+
...Ce.box(
|
|
958
965
|
`rel:${r.key}`,
|
|
959
966
|
"w-20 shrink-0",
|
|
960
967
|
"truncate text-right text-slate-500 dark:text-slate-400"
|
|
@@ -978,7 +985,7 @@ function Pa({
|
|
|
978
985
|
children: l ? /* @__PURE__ */ a(gn, { text: t, query: l }) : t
|
|
979
986
|
}
|
|
980
987
|
) : /* @__PURE__ */ a("span", { className: n, "data-cpf-fit": r || void 0, children: l ? /* @__PURE__ */ a(gn, { text: t, query: l }) : t }), un = (e, t, n, r) => {
|
|
981
|
-
const l =
|
|
988
|
+
const l = Ce.box("item", Wn ? "w-36 shrink-0" : "min-w-0 flex-1");
|
|
982
989
|
return /* @__PURE__ */ u("span", { ...l, className: W("flex min-w-0 items-center gap-1.5", l.className), children: [
|
|
983
990
|
Hn(
|
|
984
991
|
e,
|
|
@@ -991,7 +998,7 @@ function Pa({
|
|
|
991
998
|
] });
|
|
992
999
|
}, Pt = (e) => {
|
|
993
1000
|
const t = yt.get(e) ?? Ut.find((n) => String(n.id) === e) ?? nt.find((n) => String(n.id) === e);
|
|
994
|
-
return t ?
|
|
1001
|
+
return t ? Ae(C, t) : `#${e}`;
|
|
995
1002
|
}, Yn = je(Pt);
|
|
996
1003
|
Yn.current = Pt;
|
|
997
1004
|
const Zn = je(we);
|
|
@@ -1023,8 +1030,8 @@ function Pa({
|
|
|
1023
1030
|
const e = /* @__PURE__ */ new Map();
|
|
1024
1031
|
for (const t of oe) {
|
|
1025
1032
|
if (ce && ot !== void 0 && !(Number(ot[String(t.id)]) > 0)) continue;
|
|
1026
|
-
const n =
|
|
1027
|
-
if (!(
|
|
1033
|
+
const n = Ae(C, t), r = K ? Sn.get(String(t.id)) ?? [] : [Yr(t)];
|
|
1034
|
+
if (!(K && Y && r.length === 0))
|
|
1028
1035
|
for (const l of r.length ? r : [""]) {
|
|
1029
1036
|
const o = l || "Uncategorized";
|
|
1030
1037
|
e.has(o) || e.set(o, []), e.get(o).push({ id: String(t.id), label: n, row: t });
|
|
@@ -1038,10 +1045,10 @@ function Pa({
|
|
|
1038
1045
|
}));
|
|
1039
1046
|
}, [
|
|
1040
1047
|
oe,
|
|
1041
|
-
|
|
1048
|
+
C,
|
|
1042
1049
|
V,
|
|
1043
1050
|
s.section_by,
|
|
1044
|
-
|
|
1051
|
+
K,
|
|
1045
1052
|
Sn,
|
|
1046
1053
|
xt,
|
|
1047
1054
|
Y,
|
|
@@ -1064,7 +1071,7 @@ function Pa({
|
|
|
1064
1071
|
const l = Ge(n.match, S);
|
|
1065
1072
|
if (l === null) continue;
|
|
1066
1073
|
r = await w.request(
|
|
1067
|
-
|
|
1074
|
+
A(`/items/${n.collection}`, {
|
|
1068
1075
|
limit: 1,
|
|
1069
1076
|
fields: `${n.item_field},${n.value_field}`,
|
|
1070
1077
|
filter: JSON.stringify({ ...l, [n.item_field]: { _eq: e } })
|
|
@@ -1175,7 +1182,7 @@ function Pa({
|
|
|
1175
1182
|
return l;
|
|
1176
1183
|
}
|
|
1177
1184
|
function ns(e, t, n, r) {
|
|
1178
|
-
return
|
|
1185
|
+
return Ys({
|
|
1179
1186
|
compute: s.compute_fields ?? {},
|
|
1180
1187
|
probe: { ...He(e, t, n), ...r, [z]: t },
|
|
1181
1188
|
ruleError: P,
|
|
@@ -1234,7 +1241,7 @@ function Pa({
|
|
|
1234
1241
|
i,
|
|
1235
1242
|
m,
|
|
1236
1243
|
h,
|
|
1237
|
-
|
|
1244
|
+
Cs(
|
|
1238
1245
|
Re[h],
|
|
1239
1246
|
He(e, o, n, c),
|
|
1240
1247
|
M,
|
|
@@ -1321,7 +1328,7 @@ function Pa({
|
|
|
1321
1328
|
const t = String(e), n = Ue(t);
|
|
1322
1329
|
let r = n;
|
|
1323
1330
|
Object.keys(n).length <= 1 && (r = await w.request(
|
|
1324
|
-
|
|
1331
|
+
A(`/items/${y}`, {
|
|
1325
1332
|
filter: JSON.stringify({ id: { _eq: e } }),
|
|
1326
1333
|
fields: U,
|
|
1327
1334
|
limit: 1
|
|
@@ -1333,7 +1340,7 @@ function Pa({
|
|
|
1333
1340
|
const l = (qe(t) ?? 0) + 1;
|
|
1334
1341
|
await Ye(t, String(l), r);
|
|
1335
1342
|
}
|
|
1336
|
-
const ss = Ne.length, Et = Object.keys(s.copy_fields ?? {}), Ze = Object.keys(s.compute_fields ?? {}),
|
|
1343
|
+
const ss = Ne.length, Et = Object.keys(s.copy_fields ?? {}), Ze = Object.keys(s.compute_fields ?? {}), Ct = (e, t) => {
|
|
1337
1344
|
const n = qe(e);
|
|
1338
1345
|
if (k)
|
|
1339
1346
|
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") : "—" });
|
|
@@ -1361,7 +1368,7 @@ function Pa({
|
|
|
1361
1368
|
return delete J[e], J;
|
|
1362
1369
|
}), se(($) => ({
|
|
1363
1370
|
...$,
|
|
1364
|
-
[e]: { kind: "error", message:
|
|
1371
|
+
[e]: { kind: "error", message: Hs(q, b) }
|
|
1365
1372
|
}));
|
|
1366
1373
|
return;
|
|
1367
1374
|
}
|
|
@@ -1446,7 +1453,7 @@ function Pa({
|
|
|
1446
1453
|
onBlur: (b) => {
|
|
1447
1454
|
const q = b.target.value;
|
|
1448
1455
|
if (q !== f) {
|
|
1449
|
-
const $ = c, J = ($ == null ? void 0 : $.label) || Z(t), x = kn(q, { type: $ == null ? void 0 : $.type, label: J }), I = x.ok ? (h ?
|
|
1456
|
+
const $ = c, J = ($ == null ? void 0 : $.label) || Z(t), x = kn(q, { type: $ == null ? void 0 : $.type, label: J }), I = x.ok ? (h ? Ks(q, J) : null) ?? P(t, x.value, n) : x.message;
|
|
1450
1457
|
if (I) {
|
|
1451
1458
|
b.target.value = f, _e(($e) => ({ ...$e, [r]: I }));
|
|
1452
1459
|
return;
|
|
@@ -1486,7 +1493,7 @@ function Pa({
|
|
|
1486
1493
|
!k && /* @__PURE__ */ u(Se, { children: [
|
|
1487
1494
|
/* @__PURE__ */ u("div", { className: "rounded-lg border border-slate-200 text-[12px] dark:border-border", children: [
|
|
1488
1495
|
/* @__PURE__ */ u("div", { className: "flex items-center gap-2 border-b border-slate-200 px-3 py-2 dark:border-border", children: [
|
|
1489
|
-
/* @__PURE__ */ a(
|
|
1496
|
+
/* @__PURE__ */ a(At, { className: "h-3.5 w-3.5 shrink-0 text-slate-400" }),
|
|
1490
1497
|
/* @__PURE__ */ a(
|
|
1491
1498
|
"input",
|
|
1492
1499
|
{
|
|
@@ -1518,7 +1525,7 @@ function Pa({
|
|
|
1518
1525
|
Le !== null && ze && On != null && /* @__PURE__ */ u(Se, { children: [
|
|
1519
1526
|
" at ",
|
|
1520
1527
|
/* @__PURE__ */ a(
|
|
1521
|
-
|
|
1528
|
+
ra,
|
|
1522
1529
|
{
|
|
1523
1530
|
parentCollection: g,
|
|
1524
1531
|
field: ze,
|
|
@@ -1535,7 +1542,7 @@ function Pa({
|
|
|
1535
1542
|
ss,
|
|
1536
1543
|
" picked"
|
|
1537
1544
|
] }),
|
|
1538
|
-
/* @__PURE__ */ a(bn, { show:
|
|
1545
|
+
/* @__PURE__ */ a(bn, { show: Ce.customized, onReset: Ce.reset })
|
|
1539
1546
|
] }),
|
|
1540
1547
|
Wn && // Sticky: the catalog list is tall and the page scroller carries it —
|
|
1541
1548
|
// without this the labels scroll away and favorites/section rows
|
|
@@ -1548,11 +1555,11 @@ function Pa({
|
|
|
1548
1555
|
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",
|
|
1549
1556
|
children: [
|
|
1550
1557
|
s.favorites && /* @__PURE__ */ a("span", { className: "w-[18px] shrink-0" }),
|
|
1551
|
-
Ot(
|
|
1558
|
+
Ot(Ce, "item", "Item", "w-36 shrink-0"),
|
|
1552
1559
|
Ft.map((e) => {
|
|
1553
1560
|
const [t, n] = Dn(e);
|
|
1554
1561
|
return Ot(
|
|
1555
|
-
|
|
1562
|
+
Ce,
|
|
1556
1563
|
e.field,
|
|
1557
1564
|
e.label ?? Z(e.field.split(".")[0]),
|
|
1558
1565
|
t,
|
|
@@ -1561,7 +1568,7 @@ function Pa({
|
|
|
1561
1568
|
}),
|
|
1562
1569
|
on.map(
|
|
1563
1570
|
(e) => Ot(
|
|
1564
|
-
|
|
1571
|
+
Ce,
|
|
1565
1572
|
`rel:${e.key}`,
|
|
1566
1573
|
e.label ?? Z(e.key),
|
|
1567
1574
|
"w-20 shrink-0",
|
|
@@ -1603,7 +1610,7 @@ function Pa({
|
|
|
1603
1610
|
] }) }),
|
|
1604
1611
|
V.trim().length > 0 && dt.length > 0 && /* @__PURE__ */ u(ut, { children: [
|
|
1605
1612
|
/* @__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: [
|
|
1606
|
-
/* @__PURE__ */ a(
|
|
1613
|
+
/* @__PURE__ */ a(At, { className: "h-3 w-3 shrink-0 text-sky-500" }),
|
|
1607
1614
|
/* @__PURE__ */ a("span", { className: "text-[11px] font-semibold text-slate-600 dark:text-slate-300", children: "Search results" }),
|
|
1608
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 }),
|
|
1609
1616
|
/* @__PURE__ */ u("span", { className: "text-[11px] text-slate-500 dark:text-slate-400", children: [
|
|
@@ -1627,7 +1634,7 @@ function Pa({
|
|
|
1627
1634
|
Wt(n),
|
|
1628
1635
|
un(
|
|
1629
1636
|
n,
|
|
1630
|
-
|
|
1637
|
+
Ae(C, e),
|
|
1631
1638
|
(() => {
|
|
1632
1639
|
const l = Pr(e), o = Fr.has(n);
|
|
1633
1640
|
return !l && !o ? null : /* @__PURE__ */ u(Se, { children: [
|
|
@@ -1656,7 +1663,7 @@ function Pa({
|
|
|
1656
1663
|
),
|
|
1657
1664
|
cn(n, e, ye),
|
|
1658
1665
|
/* @__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" }) }),
|
|
1659
|
-
|
|
1666
|
+
Ct(n, e)
|
|
1660
1667
|
]
|
|
1661
1668
|
},
|
|
1662
1669
|
n
|
|
@@ -1745,16 +1752,16 @@ function Pa({
|
|
|
1745
1752
|
),
|
|
1746
1753
|
children: [
|
|
1747
1754
|
Wt(n),
|
|
1748
|
-
un(n,
|
|
1755
|
+
un(n, Ae(C, e)),
|
|
1749
1756
|
cn(n, e),
|
|
1750
1757
|
/* @__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(
|
|
1751
|
-
|
|
1758
|
+
Ke,
|
|
1752
1759
|
{
|
|
1753
1760
|
className: "h-3.5 w-3.5 text-amber-500",
|
|
1754
1761
|
"aria-label": `${sn} ${l.available} — ${l.qty} requested`
|
|
1755
1762
|
}
|
|
1756
1763
|
) }),
|
|
1757
|
-
|
|
1764
|
+
Ct(n, e)
|
|
1758
1765
|
]
|
|
1759
1766
|
},
|
|
1760
1767
|
n
|
|
@@ -1811,13 +1818,13 @@ function Pa({
|
|
|
1811
1818
|
un(r.id, r.label),
|
|
1812
1819
|
cn(r.id, r.row),
|
|
1813
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" }) : f && /* @__PURE__ */ a(
|
|
1814
|
-
|
|
1821
|
+
Ke,
|
|
1815
1822
|
{
|
|
1816
1823
|
className: "h-3.5 w-3.5 text-amber-500",
|
|
1817
1824
|
"aria-label": `${sn} ${f.available} — ${f.qty} requested`
|
|
1818
1825
|
}
|
|
1819
1826
|
) }),
|
|
1820
|
-
|
|
1827
|
+
Ct(r.id, r.row)
|
|
1821
1828
|
]
|
|
1822
1829
|
},
|
|
1823
1830
|
r.id
|
|
@@ -1830,12 +1837,12 @@ function Pa({
|
|
|
1830
1837
|
(e) => {
|
|
1831
1838
|
var t;
|
|
1832
1839
|
return (t = e.facets) != null && t.length && e.source ? /* @__PURE__ */ a(
|
|
1833
|
-
|
|
1840
|
+
na,
|
|
1834
1841
|
{
|
|
1835
1842
|
builder: e,
|
|
1836
1843
|
catalogCol: y,
|
|
1837
1844
|
catalogFields: U,
|
|
1838
|
-
tmpl:
|
|
1845
|
+
tmpl: C,
|
|
1839
1846
|
currentQty: qe,
|
|
1840
1847
|
addQty: (n, r, l) => Ye(n, String(r), l),
|
|
1841
1848
|
qtyStep: mt(E) ? 1 : "any",
|
|
@@ -1843,13 +1850,13 @@ function Pa({
|
|
|
1843
1850
|
},
|
|
1844
1851
|
e.label
|
|
1845
1852
|
) : /* @__PURE__ */ a(
|
|
1846
|
-
|
|
1853
|
+
ta,
|
|
1847
1854
|
{
|
|
1848
1855
|
builder: e,
|
|
1849
1856
|
defaultItemField: s.item_field,
|
|
1850
1857
|
catalogCol: y,
|
|
1851
1858
|
catalogFields: U,
|
|
1852
|
-
tmpl:
|
|
1859
|
+
tmpl: C,
|
|
1853
1860
|
currentQty: qe,
|
|
1854
1861
|
addQty: (n, r, l) => Ye(n, String(r), l),
|
|
1855
1862
|
qtyStep: mt(E) ? 1 : "any",
|
|
@@ -1887,7 +1894,7 @@ function Pa({
|
|
|
1887
1894
|
value: null,
|
|
1888
1895
|
onChange: (e) => void rs(e),
|
|
1889
1896
|
placeholder: "+ Add any item…",
|
|
1890
|
-
displayTemplate:
|
|
1897
|
+
displayTemplate: aa(C, s.columns)
|
|
1891
1898
|
}
|
|
1892
1899
|
) })
|
|
1893
1900
|
] })
|
|
@@ -1900,24 +1907,33 @@ function Pa({
|
|
|
1900
1907
|
"w-20 shrink-0",
|
|
1901
1908
|
"text-right text-[11px] font-medium text-slate-500 dark:text-slate-400"
|
|
1902
1909
|
) : /* @__PURE__ */ a("span", { className: "w-20 shrink-0 text-right text-[11px] font-medium text-slate-500 dark:text-slate-400", children: c }), f = (c) => M.includes(c) && !k ? void 0 : `s:${c}`;
|
|
1903
|
-
return /* @__PURE__ */ u("div", { children: [
|
|
1904
|
-
/* @__PURE__ */
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1910
|
+
return /* @__PURE__ */ u("div", { "data-cpf-lines": !0, children: [
|
|
1911
|
+
/* @__PURE__ */ a("style", { children: Ds }),
|
|
1912
|
+
/* @__PURE__ */ u(
|
|
1913
|
+
"div",
|
|
1914
|
+
{
|
|
1915
|
+
"data-cpf-line-main": !0,
|
|
1916
|
+
className: "flex items-center gap-4 border-b border-slate-200 px-3 py-1.5 dark:border-border",
|
|
1917
|
+
children: [
|
|
1918
|
+
/* @__PURE__ */ u("span", { className: "flex flex-1 items-center gap-1 text-[11px] font-medium text-slate-500 dark:text-slate-400", children: [
|
|
1919
|
+
"Item",
|
|
1920
|
+
k && /* @__PURE__ */ a(
|
|
1921
|
+
bn,
|
|
1922
|
+
{
|
|
1923
|
+
show: Oe.customized,
|
|
1924
|
+
onReset: Oe.reset,
|
|
1925
|
+
className: "-my-1"
|
|
1926
|
+
}
|
|
1927
|
+
)
|
|
1928
|
+
] }),
|
|
1929
|
+
/* @__PURE__ */ a("span", { "data-cpf-line-break": !0, "aria-hidden": !0, className: "hidden" }),
|
|
1930
|
+
Et.map((c) => /* @__PURE__ */ a(ut, { children: o(Z(c), f(c)) }, c)),
|
|
1931
|
+
o(Z(z)),
|
|
1932
|
+
Ze.map((c) => /* @__PURE__ */ a(ut, { children: o(Z(c), `s:${c}`) }, c)),
|
|
1933
|
+
!k && /* @__PURE__ */ a("span", { "data-cpf-fixed": !0, className: "-my-1 flex w-6 shrink-0 justify-end", children: /* @__PURE__ */ a(bn, { show: Oe.customized, onReset: Oe.reset }) })
|
|
1934
|
+
]
|
|
1935
|
+
}
|
|
1936
|
+
),
|
|
1921
1937
|
Ne.map((c, h) => {
|
|
1922
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 : Ir(c.key);
|
|
1923
1939
|
return /* @__PURE__ */ u(
|
|
@@ -1934,6 +1950,7 @@ function Pa({
|
|
|
1934
1950
|
/* @__PURE__ */ u(
|
|
1935
1951
|
"div",
|
|
1936
1952
|
{
|
|
1953
|
+
"data-cpf-line-main": !0,
|
|
1937
1954
|
className: W(
|
|
1938
1955
|
"flex items-center gap-4",
|
|
1939
1956
|
q && "line-through decoration-slate-400"
|
|
@@ -1982,6 +1999,7 @@ ${J}`,
|
|
|
1982
1999
|
x.field
|
|
1983
2000
|
);
|
|
1984
2001
|
}),
|
|
2002
|
+
/* @__PURE__ */ a("span", { "data-cpf-line-break": !0, "aria-hidden": !0, className: "hidden" }),
|
|
1985
2003
|
Et.map(
|
|
1986
2004
|
(x) => {
|
|
1987
2005
|
var I;
|
|
@@ -2003,7 +2021,7 @@ ${J}`,
|
|
|
2003
2021
|
),
|
|
2004
2022
|
/* @__PURE__ */ u("span", { className: "inline-flex w-20 shrink-0 items-center justify-end gap-1", children: [
|
|
2005
2023
|
ee.has(c.key) && /* @__PURE__ */ a(ue, { className: "h-3 w-3 animate-spin text-slate-400" }),
|
|
2006
|
-
|
|
2024
|
+
Ct(c.key, Ue(c.key))
|
|
2007
2025
|
] }),
|
|
2008
2026
|
Ze.map((x) => {
|
|
2009
2027
|
var dr, cr;
|
|
@@ -2075,13 +2093,13 @@ ${J}`,
|
|
|
2075
2093
|
/* @__PURE__ */ a("span", { className: "font-medium tabular-nums text-slate-700 dark:text-slate-200", children: l(lt(x.key, c.key), x.format) })
|
|
2076
2094
|
] }, x.key)),
|
|
2077
2095
|
Wr(c.row),
|
|
2078
|
-
|
|
2096
|
+
Cr(c.row).map((x) => /* @__PURE__ */ u(
|
|
2079
2097
|
"span",
|
|
2080
2098
|
{
|
|
2081
2099
|
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",
|
|
2082
2100
|
"data-catalog-row-flag": x,
|
|
2083
2101
|
children: [
|
|
2084
|
-
/* @__PURE__ */ a(
|
|
2102
|
+
/* @__PURE__ */ a(Ke, { className: "h-3 w-3" }),
|
|
2085
2103
|
x
|
|
2086
2104
|
]
|
|
2087
2105
|
},
|
|
@@ -2096,8 +2114,8 @@ ${J}`,
|
|
|
2096
2114
|
] }, x.field);
|
|
2097
2115
|
})
|
|
2098
2116
|
] }),
|
|
2099
|
-
$ && (k ? /* @__PURE__ */ u("p", { className: "mt-1 flex items-
|
|
2100
|
-
/* @__PURE__ */ a(
|
|
2117
|
+
$ && (k ? /* @__PURE__ */ u("p", { className: "mt-1 flex items-start gap-1 pl-0.5 text-[11px] font-medium text-amber-600 dark:text-amber-400", children: [
|
|
2118
|
+
/* @__PURE__ */ a(Ke, { className: "mt-px h-3 w-3 shrink-0" }),
|
|
2101
2119
|
sn,
|
|
2102
2120
|
" is ",
|
|
2103
2121
|
ve($.available, "number"),
|
|
@@ -2111,9 +2129,9 @@ ${J}`,
|
|
|
2111
2129
|
"p",
|
|
2112
2130
|
{
|
|
2113
2131
|
"data-catalog-stock-short": !0,
|
|
2114
|
-
className: "mt-1 flex items-
|
|
2132
|
+
className: "mt-1 flex items-start gap-1 pl-0.5 text-[11px] font-medium text-amber-600 dark:text-amber-400",
|
|
2115
2133
|
children: [
|
|
2116
|
-
/* @__PURE__ */ a(
|
|
2134
|
+
/* @__PURE__ */ a(Ke, { className: "mt-px h-3 w-3 shrink-0" }),
|
|
2117
2135
|
Rs(
|
|
2118
2136
|
$.available,
|
|
2119
2137
|
$.qty,
|
|
@@ -2124,33 +2142,37 @@ ${J}`,
|
|
|
2124
2142
|
}
|
|
2125
2143
|
)
|
|
2126
2144
|
)),
|
|
2127
|
-
!k && b != null && !q && Gr(c.row, c.key).map(({ field: x, change: I }) =>
|
|
2128
|
-
"
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2145
|
+
!k && b != null && !q && Gr(c.row, c.key).map(({ field: x, change: I }) => (
|
|
2146
|
+
// The icon leads the first line; "Use new price" travels with its
|
|
2147
|
+
// sentence (a phone wrapped it to a third line behind a lone dot).
|
|
2148
|
+
/* @__PURE__ */ u(
|
|
2149
|
+
"p",
|
|
2150
|
+
{
|
|
2151
|
+
"data-catalog-price-changed": x,
|
|
2152
|
+
className: "mt-1 flex items-start gap-1 pl-0.5 text-[11px] font-medium text-amber-700 dark:text-amber-300",
|
|
2153
|
+
children: [
|
|
2154
|
+
/* @__PURE__ */ a(Ke, { className: "mt-px h-3 w-3 shrink-0" }),
|
|
2155
|
+
/* @__PURE__ */ u("span", { className: "min-w-0", children: [
|
|
2156
|
+
Os(I, ($e) => ve($e, "currency")),
|
|
2157
|
+
fn.length > 1 ? ` · ${Z(x)}` : "",
|
|
2158
|
+
" ",
|
|
2159
|
+
/* @__PURE__ */ a(
|
|
2160
|
+
"button",
|
|
2161
|
+
{
|
|
2162
|
+
type: "button",
|
|
2163
|
+
"data-catalog-use-new-price": x,
|
|
2164
|
+
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 Xn(c.key, x, String(I.now)),
|
|
2166
|
+
children: "Use new price"
|
|
2167
|
+
}
|
|
2168
|
+
)
|
|
2169
|
+
] })
|
|
2170
|
+
]
|
|
2171
|
+
},
|
|
2172
|
+
x
|
|
2173
|
+
)
|
|
2152
2174
|
)),
|
|
2153
|
-
!q &&
|
|
2175
|
+
!q && ea(
|
|
2154
2176
|
{
|
|
2155
2177
|
...c.row,
|
|
2156
2178
|
...Object.fromEntries(
|
|
@@ -2169,9 +2191,9 @@ ${J}`,
|
|
|
2169
2191
|
"p",
|
|
2170
2192
|
{
|
|
2171
2193
|
"data-catalog-unpriced": !0,
|
|
2172
|
-
className: "mt-1 flex items-
|
|
2194
|
+
className: "mt-1 flex items-start gap-1 pl-0.5 text-[11px] font-medium text-amber-600 dark:text-amber-400",
|
|
2173
2195
|
children: [
|
|
2174
|
-
/* @__PURE__ */ a(
|
|
2196
|
+
/* @__PURE__ */ a(Ke, { className: "mt-px h-3 w-3 shrink-0" }),
|
|
2175
2197
|
"No catalog price: check the price or hand-price it"
|
|
2176
2198
|
]
|
|
2177
2199
|
}
|
|
@@ -2220,10 +2242,10 @@ ${J}`,
|
|
|
2220
2242
|
})()
|
|
2221
2243
|
] }),
|
|
2222
2244
|
qr && y && /* @__PURE__ */ a(
|
|
2223
|
-
|
|
2245
|
+
sa,
|
|
2224
2246
|
{
|
|
2225
2247
|
catalogCol: y,
|
|
2226
|
-
tmpl:
|
|
2248
|
+
tmpl: C,
|
|
2227
2249
|
sectionBy: s.section_by,
|
|
2228
2250
|
sectionM2M: d,
|
|
2229
2251
|
pinnedSet: Mt,
|
|
@@ -2244,7 +2266,7 @@ ${J}`,
|
|
|
2244
2266
|
i
|
|
2245
2267
|
] });
|
|
2246
2268
|
}
|
|
2247
|
-
function
|
|
2269
|
+
function ta({
|
|
2248
2270
|
builder: i,
|
|
2249
2271
|
defaultItemField: m,
|
|
2250
2272
|
catalogCol: p,
|
|
@@ -2270,7 +2292,7 @@ function ea({
|
|
|
2270
2292
|
JSON.stringify(i.filter ?? null)
|
|
2271
2293
|
],
|
|
2272
2294
|
queryFn: () => v.request(
|
|
2273
|
-
|
|
2295
|
+
A(`/items/${i.collection}`, {
|
|
2274
2296
|
limit: 2e3,
|
|
2275
2297
|
fields: ke,
|
|
2276
2298
|
...i.filter ? { filter: JSON.stringify(i.filter) } : {}
|
|
@@ -2283,7 +2305,7 @@ function ea({
|
|
|
2283
2305
|
const N = F[y];
|
|
2284
2306
|
if (N == null) return null;
|
|
2285
2307
|
if (typeof N == "object") {
|
|
2286
|
-
const P = N, j = ((E = H.find((
|
|
2308
|
+
const P = N, j = ((E = H.find((C) => C.field === y)) == null ? void 0 : E.label_field) ?? "id";
|
|
2287
2309
|
return { id: String(P.id ?? ""), label: String(P[j] ?? P.id ?? "") };
|
|
2288
2310
|
}
|
|
2289
2311
|
return { id: String(N), label: String(N) };
|
|
@@ -2299,7 +2321,7 @@ function ea({
|
|
|
2299
2321
|
})) : void 0, B = (G == null ? void 0 : G[L]) != null ? String(G[L]) : null, { data: se } = Q({
|
|
2300
2322
|
queryKey: ["catalog-builder-item", p, g, B],
|
|
2301
2323
|
queryFn: () => v.request(
|
|
2302
|
-
|
|
2324
|
+
A(`/items/${p}`, {
|
|
2303
2325
|
filter: JSON.stringify({ id: { _eq: B } }),
|
|
2304
2326
|
fields: g,
|
|
2305
2327
|
limit: 1
|
|
@@ -2364,19 +2386,19 @@ function ea({
|
|
|
2364
2386
|
options: E,
|
|
2365
2387
|
disabled: y > 0 && !fe[H[y - 1].field],
|
|
2366
2388
|
onChange: (P) => T((j) => {
|
|
2367
|
-
const
|
|
2368
|
-
for (let
|
|
2369
|
-
const te = H[
|
|
2370
|
-
j[te] && (
|
|
2389
|
+
const C = {};
|
|
2390
|
+
for (let K = 0; K < y; K++) {
|
|
2391
|
+
const te = H[K].field;
|
|
2392
|
+
j[te] && (C[te] = j[te]);
|
|
2371
2393
|
}
|
|
2372
|
-
return P && (
|
|
2394
|
+
return P && (C[F.field] = P), C;
|
|
2373
2395
|
})
|
|
2374
2396
|
},
|
|
2375
2397
|
F.field
|
|
2376
2398
|
);
|
|
2377
2399
|
}),
|
|
2378
2400
|
/* @__PURE__ */ a("div", { className: "flex min-h-[28px] flex-1 items-center gap-2", children: B && se ? /* @__PURE__ */ u(Se, { children: [
|
|
2379
|
-
/* @__PURE__ */ a("span", { className: "min-w-0 flex-1 truncate text-slate-700 dark:text-slate-200", children:
|
|
2401
|
+
/* @__PURE__ */ a("span", { className: "min-w-0 flex-1 truncate text-slate-700 dark:text-slate-200", children: Ae(_, se) }),
|
|
2380
2402
|
(s(B) ?? 0) > 0 && /* @__PURE__ */ u("span", { className: "rounded bg-nvr-cyan/10 px-1.5 py-0.5 text-[10px] font-semibold text-[#00728d] dark:bg-nvr-cyan/15 dark:text-nvr-cyan", children: [
|
|
2381
2403
|
s(B),
|
|
2382
2404
|
" in summary"
|
|
@@ -2415,7 +2437,7 @@ function ea({
|
|
|
2415
2437
|
] }) })
|
|
2416
2438
|
] });
|
|
2417
2439
|
}
|
|
2418
|
-
function
|
|
2440
|
+
function na({
|
|
2419
2441
|
builder: i,
|
|
2420
2442
|
catalogCol: m,
|
|
2421
2443
|
catalogFields: p,
|
|
@@ -2432,7 +2454,7 @@ function ta({
|
|
|
2432
2454
|
isError: he
|
|
2433
2455
|
} = Q({
|
|
2434
2456
|
queryKey: ["catalog-facet-builder", i.source],
|
|
2435
|
-
queryFn: () => O.request(
|
|
2457
|
+
queryFn: () => O.request(A(String(i.source))).then((N) => Array.isArray(N.data) ? N.data : []),
|
|
2436
2458
|
enabled: me && !!i.source,
|
|
2437
2459
|
staleTime: 5 * 6e4
|
|
2438
2460
|
}), re = _s(T, v), ee = R(
|
|
@@ -2452,13 +2474,13 @@ function ta({
|
|
|
2452
2474
|
const N = /* @__PURE__ */ new Map();
|
|
2453
2475
|
for (let E = 0; E < G.length; E += 200) {
|
|
2454
2476
|
const P = G.slice(E, E + 200), j = await O.request(
|
|
2455
|
-
|
|
2477
|
+
A(`/items/${m}`, {
|
|
2456
2478
|
filter: JSON.stringify({ id: { _in: P } }),
|
|
2457
2479
|
fields: p,
|
|
2458
2480
|
limit: P.length
|
|
2459
2481
|
})
|
|
2460
2482
|
);
|
|
2461
|
-
for (const
|
|
2483
|
+
for (const C of j.data ?? []) N.set(String(C.id), C);
|
|
2462
2484
|
}
|
|
2463
2485
|
return N;
|
|
2464
2486
|
},
|
|
@@ -2470,7 +2492,7 @@ function ta({
|
|
|
2470
2492
|
if (!(!j || !Number.isFinite(P) || P <= 0 || k !== "any" && !Number.isInteger(P))) {
|
|
2471
2493
|
ke(N);
|
|
2472
2494
|
try {
|
|
2473
|
-
await s(N, (_(N) ?? 0) + P, j), pe((
|
|
2495
|
+
await s(N, (_(N) ?? 0) + P, j), pe((C) => ({ ...C, [N]: "1" }));
|
|
2474
2496
|
} finally {
|
|
2475
2497
|
ke(null);
|
|
2476
2498
|
}
|
|
@@ -2541,8 +2563,8 @@ function ta({
|
|
|
2541
2563
|
!w && /* @__PURE__ */ a("span", { className: "w-[124px] text-right", children: "Quantity" })
|
|
2542
2564
|
] }),
|
|
2543
2565
|
ee.map((N) => {
|
|
2544
|
-
var
|
|
2545
|
-
const E = String(N[L]), P = B.get(E), j = _(E) ?? 0,
|
|
2566
|
+
var K;
|
|
2567
|
+
const E = String(N[L]), P = B.get(E), j = _(E) ?? 0, C = (K = i.result) != null && K.detail ? String(N[i.result.detail] ?? "") : "";
|
|
2546
2568
|
return /* @__PURE__ */ u(
|
|
2547
2569
|
"div",
|
|
2548
2570
|
{
|
|
@@ -2551,7 +2573,7 @@ function ta({
|
|
|
2551
2573
|
children: [
|
|
2552
2574
|
/* @__PURE__ */ u("div", { className: "min-w-0 flex-1", children: [
|
|
2553
2575
|
/* @__PURE__ */ a("p", { className: "truncate font-medium tabular-nums text-slate-700 dark:text-slate-200", children: String(N[H] ?? "") }),
|
|
2554
|
-
/* @__PURE__ */ a("p", { className: "truncate text-[11px] text-slate-400", children:
|
|
2576
|
+
/* @__PURE__ */ a("p", { className: "truncate text-[11px] text-slate-400", children: C || (P ? Ae(g, P) : "") })
|
|
2555
2577
|
] }),
|
|
2556
2578
|
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: [
|
|
2557
2579
|
j,
|
|
@@ -2606,14 +2628,14 @@ function ta({
|
|
|
2606
2628
|
}
|
|
2607
2629
|
);
|
|
2608
2630
|
}
|
|
2609
|
-
function
|
|
2631
|
+
function ra({
|
|
2610
2632
|
parentCollection: i,
|
|
2611
2633
|
field: m,
|
|
2612
2634
|
id: p
|
|
2613
2635
|
}) {
|
|
2614
2636
|
var w;
|
|
2615
2637
|
const g = ht(), { data: _ = [] } = Q({
|
|
2616
|
-
queryKey:
|
|
2638
|
+
queryKey: Kt.collectionRelations(i),
|
|
2617
2639
|
queryFn: () => yn(g, i),
|
|
2618
2640
|
enabled: !!i,
|
|
2619
2641
|
staleTime: 10 * 6e4
|
|
@@ -2621,7 +2643,7 @@ function na({
|
|
|
2621
2643
|
(O) => O.many_collection === i && O.many_field === m && !O.junction_field
|
|
2622
2644
|
)) == null ? void 0 : w.one_collection) ?? null, { data: k } = Q({
|
|
2623
2645
|
queryKey: ["col-meta", s],
|
|
2624
|
-
queryFn: () => g.request(
|
|
2646
|
+
queryFn: () => g.request(A(`/collections/${s}`)).then((O) => O.data),
|
|
2625
2647
|
enabled: !!s,
|
|
2626
2648
|
staleTime: 3e5
|
|
2627
2649
|
});
|
|
@@ -2702,7 +2724,7 @@ function wr({
|
|
|
2702
2724
|
] })
|
|
2703
2725
|
] });
|
|
2704
2726
|
}
|
|
2705
|
-
function
|
|
2727
|
+
function sa({
|
|
2706
2728
|
catalogCol: i,
|
|
2707
2729
|
tmpl: m,
|
|
2708
2730
|
sectionBy: p,
|
|
@@ -2736,7 +2758,7 @@ function ra({
|
|
|
2736
2758
|
}, [m]), V = !g && p.includes(".") ? `*,${p}` : "*", Te = 50, { data: he, isFetching: re } = Q({
|
|
2737
2759
|
queryKey: ["favorites-manager-list", i, T, ke, z],
|
|
2738
2760
|
queryFn: () => M.request(
|
|
2739
|
-
|
|
2761
|
+
A(`/items/${i}`, {
|
|
2740
2762
|
fields: V,
|
|
2741
2763
|
limit: Te,
|
|
2742
2764
|
page: z,
|
|
@@ -2749,7 +2771,7 @@ function ra({
|
|
|
2749
2771
|
}), ee = ((he == null ? void 0 : he.data) ?? []).filter((d) => !_.has(String(d.id))), G = (he == null ? void 0 : he.total) ?? ee.length, B = Math.max(1, Math.ceil(G / Te)), { data: se = [] } = Q({
|
|
2750
2772
|
queryKey: ["favorites-manager-pinned", i, V, s.join(",")],
|
|
2751
2773
|
queryFn: () => M.request(
|
|
2752
|
-
|
|
2774
|
+
A(`/items/${i}`, {
|
|
2753
2775
|
filter: JSON.stringify({ id: { _in: s } }),
|
|
2754
2776
|
fields: V,
|
|
2755
2777
|
limit: s.length,
|
|
@@ -2785,13 +2807,13 @@ function ra({
|
|
|
2785
2807
|
},
|
|
2786
2808
|
enabled: !!g && ie.length > 0,
|
|
2787
2809
|
staleTime: 6e4
|
|
2788
|
-
}), xe = (d) => m ?
|
|
2810
|
+
}), xe = (d) => m ? Ae(m, d) : String(d.cifa_number ?? d.name ?? `#${d.id}`), F = (d) => {
|
|
2789
2811
|
const S = d.description ?? d.long_description ?? d.name;
|
|
2790
2812
|
return typeof S == "string" && S.trim() && S.trim() !== xe(d) ? S : "";
|
|
2791
2813
|
}, y = (d) => {
|
|
2792
2814
|
if (g) return (_e.get(String(d.id)) ?? []).join(", ");
|
|
2793
2815
|
if (!p) return "";
|
|
2794
|
-
const S =
|
|
2816
|
+
const S = Ae(`{{${p}}}`, d);
|
|
2795
2817
|
return S === `{{${p}}}` ? "" : S;
|
|
2796
2818
|
}, N = (d, S) => {
|
|
2797
2819
|
if (S === "presence")
|
|
@@ -2812,7 +2834,7 @@ function ra({
|
|
|
2812
2834
|
],
|
|
2813
2835
|
queryFn: async () => {
|
|
2814
2836
|
const X = await M.request(
|
|
2815
|
-
|
|
2837
|
+
A(`/items/${d.collection}`, {
|
|
2816
2838
|
filter: JSON.stringify({ [d.item_field]: { _in: ie }, ...S ?? {} }),
|
|
2817
2839
|
fields: `${d.item_field},${d.value_field}`,
|
|
2818
2840
|
limit: 1e3
|
|
@@ -2851,7 +2873,7 @@ function ra({
|
|
|
2851
2873
|
)
|
|
2852
2874
|
}
|
|
2853
2875
|
);
|
|
2854
|
-
},
|
|
2876
|
+
}, C = (d, S) => /* @__PURE__ */ a("tr", { children: /* @__PURE__ */ a("td", { colSpan: 4 + w.length, className: W("border-b px-3 py-1.5", S), children: d }) }), K = (d, S) => {
|
|
2855
2877
|
const X = String(d.id), le = F(d);
|
|
2856
2878
|
return /* @__PURE__ */ u(
|
|
2857
2879
|
"tr",
|
|
@@ -2927,7 +2949,7 @@ function ra({
|
|
|
2927
2949
|
] }),
|
|
2928
2950
|
/* @__PURE__ */ u("div", { className: "border-b border-slate-200 px-3 py-2 dark:border-border", children: [
|
|
2929
2951
|
/* @__PURE__ */ u("div", { className: "flex items-center gap-2 rounded-md border border-slate-200 bg-slate-50 px-2.5 py-1.5 focus-within:border-nvr-cyan focus-within:bg-white dark:border-border dark:bg-muted/40 dark:focus-within:bg-background", children: [
|
|
2930
|
-
/* @__PURE__ */ a(
|
|
2952
|
+
/* @__PURE__ */ a(At, { className: "h-3.5 w-3.5 shrink-0 text-slate-400" }),
|
|
2931
2953
|
/* @__PURE__ */ a(
|
|
2932
2954
|
"input",
|
|
2933
2955
|
{
|
|
@@ -2950,7 +2972,7 @@ function ra({
|
|
|
2950
2972
|
)
|
|
2951
2973
|
] }),
|
|
2952
2974
|
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: [
|
|
2953
|
-
/* @__PURE__ */ a(
|
|
2975
|
+
/* @__PURE__ */ a(Ke, { className: "h-3 w-3 shrink-0" }),
|
|
2954
2976
|
P.map((d) => d.label ?? Z(d.key)).join(", "),
|
|
2955
2977
|
" fill in once the form's warehouse selection is made."
|
|
2956
2978
|
] })
|
|
@@ -2971,7 +2993,7 @@ function ra({
|
|
|
2971
2993
|
w.map((d) => /* @__PURE__ */ a("th", { className: "px-2 py-1.5 text-right", children: d.label ?? Z(d.key) }, d.key))
|
|
2972
2994
|
] }) }),
|
|
2973
2995
|
/* @__PURE__ */ u("tbody", { className: W(re && "opacity-50 transition-opacity"), children: [
|
|
2974
|
-
|
|
2996
|
+
C(
|
|
2975
2997
|
/* @__PURE__ */ u("span", { className: "flex items-center gap-1.5", children: [
|
|
2976
2998
|
/* @__PURE__ */ a(ft, { className: "h-3 w-3 shrink-0 fill-amber-400 text-amber-400" }),
|
|
2977
2999
|
/* @__PURE__ */ a("span", { className: "text-[11px] font-semibold text-slate-600 dark:text-slate-300", children: "Your favorites" }),
|
|
@@ -2987,10 +3009,10 @@ function ra({
|
|
|
2987
3009
|
children: s.length === 0 ? "No favorites yet — star the items you order most." : "No favorites match your search."
|
|
2988
3010
|
}
|
|
2989
3011
|
) }),
|
|
2990
|
-
Je.map((d, S) =>
|
|
2991
|
-
|
|
3012
|
+
Je.map((d, S) => K(d, S)),
|
|
3013
|
+
C(
|
|
2992
3014
|
/* @__PURE__ */ u("span", { className: "flex items-center gap-1.5", children: [
|
|
2993
|
-
/* @__PURE__ */ a(
|
|
3015
|
+
/* @__PURE__ */ a(At, { className: "h-3 w-3 shrink-0 text-slate-400" }),
|
|
2994
3016
|
/* @__PURE__ */ a("span", { className: "text-[11px] font-semibold text-slate-600 dark:text-slate-300", children: "All CIFAs" }),
|
|
2995
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: G.toLocaleString() }),
|
|
2996
3018
|
re && /* @__PURE__ */ a(ue, { className: "h-3 w-3 animate-spin text-slate-400" })
|
|
@@ -3005,7 +3027,7 @@ function ra({
|
|
|
3005
3027
|
children: T.trim() ? `No CIFAs match "${T}".` : "No catalog items."
|
|
3006
3028
|
}
|
|
3007
3029
|
) }),
|
|
3008
|
-
ee.map((d, S) =>
|
|
3030
|
+
ee.map((d, S) => K(d, S))
|
|
3009
3031
|
] })
|
|
3010
3032
|
] }) }),
|
|
3011
3033
|
B > 1 && /* @__PURE__ */ u("div", { className: "flex shrink-0 items-center justify-between border-t border-slate-200 px-3 py-2 dark:border-border", children: [
|
|
@@ -3056,26 +3078,26 @@ function ra({
|
|
|
3056
3078
|
te
|
|
3057
3079
|
);
|
|
3058
3080
|
}
|
|
3059
|
-
function
|
|
3081
|
+
function aa(i, m) {
|
|
3060
3082
|
var g;
|
|
3061
3083
|
if (!i) return null;
|
|
3062
3084
|
const p = (g = (m ?? []).find((_) => !_.format && !_.sections_only)) == null ? void 0 : g.field;
|
|
3063
3085
|
return !p || i.includes(`{{${p}}}`) ? i : `${i} · {{${p}}}`;
|
|
3064
3086
|
}
|
|
3065
3087
|
export {
|
|
3066
|
-
|
|
3067
|
-
|
|
3088
|
+
La as CatalogPickerField,
|
|
3089
|
+
na as FacetBuilderCard,
|
|
3068
3090
|
Js as MAX_LINE_MONEY,
|
|
3069
|
-
|
|
3091
|
+
aa as catalogOptionTemplate,
|
|
3070
3092
|
Bs as footerSum,
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
|
|
3093
|
+
Zs as gridPriceValue,
|
|
3094
|
+
ea as isUnpricedLine,
|
|
3095
|
+
Xs as issuesAfterLinesChanged,
|
|
3096
|
+
Ys as lineComputeError,
|
|
3075
3097
|
hr as matchesShowWhen,
|
|
3076
3098
|
Vs as qtyEntryProblem,
|
|
3077
|
-
|
|
3099
|
+
Hs as refusedQtyNote,
|
|
3078
3100
|
wn as relatedParentTokens,
|
|
3079
|
-
|
|
3101
|
+
Gs as savedLinesSignature,
|
|
3080
3102
|
Ms as stagedCatalogFill
|
|
3081
3103
|
};
|