@nivaro/react 0.3.114 → 0.3.115
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/ScreenShareHost.js +24 -0
- package/dist/full.css +50 -2
- package/dist/hooks/useSessionRecorder.js +61 -60
- package/dist/index.d.ts +1717 -21
- package/dist/index.js +1091 -950
- package/dist/shared/components/ActivityEntry.js +209 -97
- package/dist/shared/components/AgentPresenceChip.js +51 -0
- package/dist/shared/components/AnnouncementBanner.js +56 -41
- package/dist/shared/components/AutolinkedText.js +98 -85
- package/dist/shared/components/BroadcastView.js +149 -141
- package/dist/shared/components/CacheStamp.js +78 -30
- package/dist/shared/components/CollectionBrowserView.js +4088 -3592
- package/dist/shared/components/ConfigChangeStrip.js +63 -0
- package/dist/shared/components/ConfigReachNote.js +107 -0
- package/dist/shared/components/ConformanceView.js +389 -319
- package/dist/shared/components/DataTable.js +1 -0
- package/dist/shared/components/DelegateCoverLine.js +164 -0
- package/dist/shared/components/EnvironmentNotice.js +56 -65
- package/dist/shared/components/FilePreviewLightbox.js +89 -43
- package/dist/shared/components/FindingFixedMark.js +23 -0
- package/dist/shared/components/GridPresenceLine.js +100 -0
- package/dist/shared/components/IdleReloadWatcher.js +82 -43
- package/dist/shared/components/InStep.js +46 -0
- package/dist/shared/components/ItemEditForm.js +5504 -4889
- package/dist/shared/components/LiveAnnouncer.js +62 -0
- package/dist/shared/components/LiveCount.js +54 -0
- package/dist/shared/components/LiveFigure.js +28 -0
- package/dist/shared/components/LiveListControls.js +114 -0
- package/dist/shared/components/LiveNewMatchesPill.js +25 -0
- package/dist/shared/components/LiveOffNote.js +44 -0
- package/dist/shared/components/LivePreferenceHost.js +42 -0
- package/dist/shared/components/LiveRowMark.js +25 -20
- package/dist/shared/components/LiveTraceView.js +257 -0
- package/dist/shared/components/MapView.js +30 -29
- package/dist/shared/components/MatrixEditor.js +497 -462
- package/dist/shared/components/MyWorkView.js +346 -272
- package/dist/shared/components/NotificationBell.js +215 -201
- package/dist/shared/components/PageRenderer.js +636 -599
- package/dist/shared/components/PresenceDot.js +21 -0
- package/dist/shared/components/ProfileView.js +656 -536
- package/dist/shared/components/RealtimeStatusBanner.js +25 -25
- package/dist/shared/components/RecentRecordsRail.js +51 -48
- package/dist/shared/components/RecordCompare.js +241 -150
- package/dist/shared/components/RecordDrilldownSheet.js +66 -64
- package/dist/shared/components/RecordGridEditor.js +350 -311
- package/dist/shared/components/RecordHoverCard.js +147 -0
- package/dist/shared/components/RecordPeekHost.js +111 -0
- package/dist/shared/components/RecordReadView.js +414 -412
- package/dist/shared/components/RelativeTime.js +16 -0
- package/dist/shared/components/ReportView.js +1396 -1304
- package/dist/shared/components/ScreenRefreshButton.js +77 -0
- package/dist/shared/components/TabCountHost.js +10 -0
- package/dist/shared/components/TickerNumber.js +19 -18
- package/dist/shared/components/TipLayer.js +70 -58
- package/dist/shared/components/WidgetImageMenu.js +59 -0
- package/dist/shared/components/WidgetSlot.js +571 -524
- package/dist/shared/components/activity/RecordActivityStream.js +317 -0
- package/dist/shared/components/bulk/BulkSelectionNotices.js +220 -0
- package/dist/shared/components/cbv/approval-changed.js +20 -0
- package/dist/shared/components/cbv/changed-by-others.js +251 -0
- package/dist/shared/components/change-proposals/ChangeProposalsPanel.js +320 -0
- package/dist/shared/components/change-proposals/ProposalValue.js +28 -0
- package/dist/shared/components/change-proposals/ProposeChangeButton.js +44 -0
- package/dist/shared/components/change-proposals/ProposeChangeDialog.js +359 -0
- package/dist/shared/components/change-proposals/types.js +4 -0
- package/dist/shared/components/chat/ChatPanel.js +1571 -1528
- package/dist/shared/components/chat/Composer.js +276 -298
- package/dist/shared/components/chat/room-due.js +13 -0
- package/dist/shared/components/collections-directory/CollectionRow.js +76 -75
- package/dist/shared/components/collections-directory/CollectionsDirectory.js +415 -395
- package/dist/shared/components/collections-directory/directory-data.js +75 -63
- package/dist/shared/components/imports/ImportConsole.js +159 -155
- package/dist/shared/components/imports/ImportDuplicatesNotice.js +46 -31
- package/dist/shared/components/integrations/SendStatus.js +202 -0
- package/dist/shared/components/integrations/console/IntegrationsConsole.js +45 -36
- package/dist/shared/components/integrations/console/ReadyToSendView.js +453 -0
- package/dist/shared/components/integrations/console/api.js +161 -117
- package/dist/shared/components/integrations/console/tone.js +15 -12
- package/dist/shared/components/item-edit/CatalogPickerField.js +1353 -1245
- package/dist/shared/components/item-edit/ChangedAfterApprovalBadge.js +162 -0
- package/dist/shared/components/item-edit/CloneDialog.js +208 -206
- package/dist/shared/components/item-edit/DerivedCauseNote.js +57 -0
- package/dist/shared/components/item-edit/DraftRecoveryBanner.js +81 -70
- package/dist/shared/components/item-edit/DuplicateNotice.js +169 -101
- package/dist/shared/components/item-edit/FieldAffordances.js +294 -385
- package/dist/shared/components/item-edit/FieldComments.js +159 -116
- package/dist/shared/components/item-edit/FieldPointer.js +132 -0
- package/dist/shared/components/item-edit/FieldRenderer.js +277 -273
- package/dist/shared/components/item-edit/FieldRow.js +519 -439
- package/dist/shared/components/item-edit/FieldSourceBadge.js +88 -0
- package/dist/shared/components/item-edit/FilePickerField.js +454 -369
- package/dist/shared/components/item-edit/GroupSection.js +618 -567
- package/dist/shared/components/item-edit/HeldEditsChip.js +113 -0
- package/dist/shared/components/item-edit/InlineTableField.js +2891 -2723
- package/dist/shared/components/item-edit/ListNeighborNav.js +79 -0
- package/dist/shared/components/item-edit/LiveTraceSheet.js +26 -0
- package/dist/shared/components/item-edit/M2MCombobox.js +284 -273
- package/dist/shared/components/item-edit/OutboxReviewTray.js +313 -0
- package/dist/shared/components/item-edit/PickerBadges.js +52 -0
- package/dist/shared/components/item-edit/PlanGrid.js +434 -439
- package/dist/shared/components/item-edit/RecalcValue.js +55 -0
- package/dist/shared/components/item-edit/RecordChatActions.js +76 -64
- package/dist/shared/components/item-edit/RecordChatMentionsChip.js +103 -0
- package/dist/shared/components/item-edit/RecordGrantTools.js +87 -86
- package/dist/shared/components/item-edit/RecordHelpChip.js +70 -0
- package/dist/shared/components/item-edit/RecordLiveSync.js +230 -217
- package/dist/shared/components/item-edit/RecordOutbox.js +53 -52
- package/dist/shared/components/item-edit/RecordRecapStrip.js +109 -36
- package/dist/shared/components/item-edit/RelationCombobox.js +229 -217
- package/dist/shared/components/item-edit/RelationGroupedCombobox.js +105 -100
- package/dist/shared/components/item-edit/RemoteChangeUi.js +454 -0
- package/dist/shared/components/item-edit/RemoteUploads.js +55 -0
- package/dist/shared/components/item-edit/RemovedLineNote.js +92 -0
- package/dist/shared/components/item-edit/RichTextEditorImpl.js +298 -223
- package/dist/shared/components/item-edit/ScheduledChangeChip.js +244 -0
- package/dist/shared/components/item-edit/SectionPresence.js +78 -0
- package/dist/shared/components/item-edit/SplitLinesButton.js +166 -0
- package/dist/shared/components/item-edit/catalog-line-watch.js +94 -0
- package/dist/shared/components/item-edit/coedit/collab.js +84 -0
- package/dist/shared/components/item-edit/coedit/context.js +24 -0
- package/dist/shared/components/item-edit/coedit/cursors.js +103 -0
- package/dist/shared/components/item-edit/coedit/safe-link.js +15 -0
- package/dist/shared/components/item-edit/coedit/session.js +382 -0
- package/dist/shared/components/item-edit/coedit/useCoedit.js +49 -0
- package/dist/shared/components/item-edit/file-live.js +77 -0
- package/dist/shared/components/item-edit/file-processing.js +87 -0
- package/dist/shared/components/item-edit/layout-switch.js +148 -0
- package/dist/shared/components/item-edit/live-related.js +23 -0
- package/dist/shared/components/item-edit/live-title.js +66 -0
- package/dist/shared/components/item-edit/partner-needs.js +142 -0
- package/dist/shared/components/item-edit/removed-line.js +58 -0
- package/dist/shared/components/item-edit/render-stability.js +70 -59
- package/dist/shared/components/layout-editor/ChangeNote.js +36 -34
- package/dist/shared/components/layout-editor/CollabParts.js +72 -70
- package/dist/shared/components/layout-editor/LayoutEditor.js +306 -303
- package/dist/shared/components/list/InlineEdit.js +504 -208
- package/dist/shared/components/list/ListViewers.js +81 -0
- package/dist/shared/components/merge/MergeRecordsDialog.js +1227 -0
- package/dist/shared/components/merge/MergeWithFlow.js +290 -0
- package/dist/shared/components/merge/merge-values.js +110 -0
- package/dist/shared/components/monitoring/InactiveUserLinksView.js +285 -258
- package/dist/shared/components/notifications/NotificationCenterView.js +388 -321
- package/dist/shared/components/notifications/NotificationDetailBits.js +205 -130
- package/dist/shared/components/notifications/NotificationRulesEditor.js +72 -52
- package/dist/shared/components/notifications/bundles.js +21 -19
- package/dist/shared/components/notifications/resolved-line.js +25 -0
- package/dist/shared/components/ops/OpsTasksView.js +45 -44
- package/dist/shared/components/panels/AccessGrantedNote.js +85 -0
- package/dist/shared/components/panels/AlertBanners.js +132 -0
- package/dist/shared/components/panels/AsyncUserPicker.js +54 -45
- package/dist/shared/components/panels/BranchLanes.js +82 -54
- package/dist/shared/components/panels/CommentAwareness.js +332 -0
- package/dist/shared/components/panels/CommentImages.js +219 -0
- package/dist/shared/components/panels/CommentPanel.js +649 -530
- package/dist/shared/components/panels/ExternalRequestsChip.js +98 -80
- package/dist/shared/components/panels/NewSinceChip.js +16 -0
- package/dist/shared/components/panels/OwnerOpenedLine.js +85 -0
- package/dist/shared/components/panels/PipelinePanel.js +1644 -1494
- package/dist/shared/components/panels/ResubmissionDiff.js +293 -0
- package/dist/shared/components/panels/SlaBreachBanner.js +30 -29
- package/dist/shared/components/panels/SlaClock.js +130 -99
- package/dist/shared/components/panels/TaskPanel.js +308 -287
- package/dist/shared/components/panels/unseen-move-check.js +101 -0
- package/dist/shared/components/pipeline/OwnerMatrix.js +80 -71
- package/dist/shared/components/pipeline/OwnerMatrixSheet.js +495 -0
- package/dist/shared/components/pipeline/PipelineEditorView.js +1855 -1771
- package/dist/shared/components/profile/AgentNameField.js +141 -0
- package/dist/shared/components/profile/AgentsPanel.js +55 -46
- package/dist/shared/components/profile/PersonAccess.js +398 -330
- package/dist/shared/components/profile/PersonAdminTools.js +127 -113
- package/dist/shared/components/profile/PersonProfile.js +81 -73
- package/dist/shared/components/profile/SignInTroubleshooter.js +361 -0
- package/dist/shared/components/queue/QueueBulkBar.js +101 -84
- package/dist/shared/components/queue/QueueItemSheet.js +66 -66
- package/dist/shared/components/queue/QueueTeamStrip.js +279 -0
- package/dist/shared/components/queue/QueueWorklist.js +1927 -1635
- package/dist/shared/components/send-view/SendViewButton.js +136 -0
- package/dist/shared/components/send-view/SentViewCards.js +147 -0
- package/dist/shared/components/support/ReportProblem.js +1 -0
- package/dist/shared/components/support/ScreenShare.js +554 -0
- package/dist/shared/components/support/SupportView.js +160 -129
- package/dist/shared/components/support/TicketDetailSheet.js +101 -89
- package/dist/shared/components/watch-list/WatchDock.js +1044 -0
- package/dist/shared/components/watch-list/WatchExtras.js +723 -0
- package/dist/shared/components/watch-list/WatchListButton.js +46 -0
- package/dist/shared/components/watch-list/WatchPinButton.js +67 -0
- package/dist/shared/components/watch-list/WatchRows.js +348 -0
- package/dist/shared/lib/activity-sentence.js +87 -75
- package/dist/shared/lib/agent-presence.js +46 -0
- package/dist/shared/lib/approval-progress.js +49 -0
- package/dist/shared/lib/attention-prefs.js +27 -0
- package/dist/shared/lib/cell-locks.js +56 -0
- package/dist/shared/lib/co-edit.js +166 -0
- package/dist/shared/lib/coedit-registry.js +44 -0
- package/dist/shared/lib/comment-awareness.js +124 -0
- package/dist/shared/lib/comment-images.js +45 -0
- package/dist/shared/lib/config-watch.js +94 -0
- package/dist/shared/lib/copy-rules.js +65 -0
- package/dist/shared/lib/count-step.js +30 -0
- package/dist/shared/lib/deadline-ticker.js +68 -0
- package/dist/shared/lib/derived-causes.js +115 -0
- package/dist/shared/lib/draft-store.js +114 -85
- package/dist/shared/lib/error-hints.js +1 -0
- package/dist/shared/lib/field-merge.js +126 -0
- package/dist/shared/lib/filter-sentence.js +10 -10
- package/dist/shared/lib/focus-mode.js +16 -12
- package/dist/shared/lib/grid-cursors.js +77 -0
- package/dist/shared/lib/grid-presence.js +182 -0
- package/dist/shared/lib/idle-reload.js +100 -73
- package/dist/shared/lib/in-step.js +45 -0
- package/dist/shared/lib/integration-chip.js +19 -18
- package/dist/shared/lib/line-locks.js +141 -0
- package/dist/shared/lib/line-split.js +41 -0
- package/dist/shared/lib/linked-changes.js +150 -0
- package/dist/shared/lib/list-return.js +231 -0
- package/dist/shared/lib/list-viewers.js +52 -0
- package/dist/shared/lib/live-announcer.js +86 -0
- package/dist/shared/lib/live-counts.js +85 -0
- package/dist/shared/lib/live-data-changed.js +108 -0
- package/dist/shared/lib/live-deltas.js +81 -0
- package/dist/shared/lib/live-findings.js +113 -0
- package/dist/shared/lib/live-groups.js +122 -0
- package/dist/shared/lib/live-link-labels.js +162 -0
- package/dist/shared/lib/live-list-flow.js +334 -0
- package/dist/shared/lib/live-list.js +143 -129
- package/dist/shared/lib/live-moves.js +51 -0
- package/dist/shared/lib/live-ops.js +26 -26
- package/dist/shared/lib/live-pickers.js +7 -0
- package/dist/shared/lib/live-preference.js +184 -0
- package/dist/shared/lib/live-queries.js +226 -181
- package/dist/shared/lib/live-screen.js +333 -0
- package/dist/shared/lib/live-search.js +108 -0
- package/dist/shared/lib/live-seen.js +35 -0
- package/dist/shared/lib/live-views.js +100 -0
- package/dist/shared/lib/live.js +159 -133
- package/dist/shared/lib/missed-updates.js +198 -0
- package/dist/shared/lib/newer-file.js +56 -0
- package/dist/shared/lib/notification-sound.js +42 -20
- package/dist/shared/lib/own-writes.js +59 -41
- package/dist/shared/lib/picker-badges.js +94 -0
- package/dist/shared/lib/presence-signals.js +131 -84
- package/dist/shared/lib/realtime.js +49 -24
- package/dist/shared/lib/record-gaps.js +85 -0
- package/dist/shared/lib/record-outbox.js +369 -222
- package/dist/shared/lib/record-peek.js +75 -0
- package/dist/shared/lib/record-tabs.js +92 -72
- package/dist/shared/lib/relative-ticker.js +42 -0
- package/dist/shared/lib/request-gate.js +119 -119
- package/dist/shared/lib/rollup-recalc.js +107 -0
- package/dist/shared/lib/room-gaps.js +40 -36
- package/dist/shared/lib/rum.js +137 -87
- package/dist/shared/lib/save-progress.js +20 -0
- package/dist/shared/lib/scheduled-countdown.js +67 -0
- package/dist/shared/lib/screen-refresh.js +160 -0
- package/dist/shared/lib/screen-share.js +234 -0
- package/dist/shared/lib/seen-since.js +74 -0
- package/dist/shared/lib/selection-watch.js +205 -0
- package/dist/shared/lib/send-status.js +132 -0
- package/dist/shared/lib/send-view.js +23 -0
- package/dist/shared/lib/socket-liveness.js +155 -0
- package/dist/shared/lib/socket-realtime.js +168 -140
- package/dist/shared/lib/state-census.js +53 -0
- package/dist/shared/lib/summary-mode.js +61 -39
- package/dist/shared/lib/tab-attention.js +143 -32
- package/dist/shared/lib/table-density.js +64 -0
- package/dist/shared/lib/track-travel.js +40 -0
- package/dist/shared/lib/unseen-changes.js +68 -0
- package/dist/shared/lib/upload-file.js +33 -0
- package/dist/shared/lib/upload-presence.js +127 -0
- package/dist/shared/lib/urgent-chime.js +65 -0
- package/dist/shared/lib/use-online-users.js +32 -11
- package/dist/shared/lib/user-sync.js +155 -39
- package/dist/shared/lib/waiting-count.js +44 -0
- package/dist/shared/lib/watch-desktop.js +83 -0
- package/dist/shared/lib/watch-list.js +447 -0
- package/dist/shared/lib/widget-image-render.js +64 -0
- package/dist/shared/lib/widget-image.js +111 -0
- package/dist/shared/lib/worker-socket.js +130 -104
- package/dist/shared/lib/write-to-screen.js +133 -0
- package/package.json +1 -1
- package/styles.css +49 -1
|
@@ -1,107 +1,108 @@
|
|
|
1
|
-
import { jsxs as u, jsx as
|
|
2
|
-
import { useQueryClient as
|
|
3
|
-
import { Search as
|
|
4
|
-
import { useState as D, useRef as
|
|
5
|
-
import { createPortal as
|
|
6
|
-
import { useNivaroClient as
|
|
7
|
-
import { canOpenCatalogItem as
|
|
8
|
-
import { get as
|
|
9
|
-
import { evaluateBoolean as
|
|
10
|
-
import { useLiveRefetchInterval as
|
|
11
|
-
import { fetchCollectionRelations as
|
|
12
|
-
import { tokenize as
|
|
13
|
-
import { registerStagedRowLabel as
|
|
14
|
-
import { submissionLineErrors as
|
|
15
|
-
import { titleCase as
|
|
16
|
-
import { ImportFromFileButton as
|
|
17
|
-
import { SearchHighlight as
|
|
18
|
-
import { useOverflowTip as
|
|
19
|
-
import { useColumnWidths as
|
|
20
|
-
import { facetsComplete as
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
1
|
+
import { jsxs as u, jsx as a, Fragment as Se } from "react/jsx-runtime";
|
|
2
|
+
import { useQueryClient as is, useQuery as Q, useQueries as xn } from "@tanstack/react-query";
|
|
3
|
+
import { Search as Ct, Loader2 as ue, PackageCheck as ls, ChevronRight as Jt, Star as ft, AlertTriangle as Ae, AlertCircle as hn, X as pt, Plus as xr, ChevronDown as os } from "lucide-react";
|
|
4
|
+
import { useState as D, useRef as je, useMemo as R, useEffect as Fe, Fragment as ut } from "react";
|
|
5
|
+
import { createPortal as ds } from "react-dom";
|
|
6
|
+
import { useNivaroClient as ht, useParentDraft as cs, useReimportHandler as us, useItemEditAuth as ur } from "../../context.js";
|
|
7
|
+
import { canOpenCatalogItem as yr, openCatalogItem as gr } from "../../lib/catalog-item-open.js";
|
|
8
|
+
import { get as C, del as ms, patch as mr, post as fr } from "../../lib/commands.js";
|
|
9
|
+
import { evaluateBoolean as fs } from "../../lib/expression.js";
|
|
10
|
+
import { useLiveRefetchInterval as ps } from "../../lib/live-queries.js";
|
|
11
|
+
import { fetchCollectionRelations as yn, queryKeys as At } from "../../lib/query-keys.js";
|
|
12
|
+
import { tokenize as hs, matchesSearch as bs } from "../../lib/search-text.js";
|
|
13
|
+
import { registerStagedRowLabel as xs } from "../../lib/staged-row-labels.js";
|
|
14
|
+
import { submissionLineErrors as ys, normalizeIdent as gs } from "../../lib/submission-errors.js";
|
|
15
|
+
import { titleCase as Z, cn as W, matchesAllTokens as ks } from "../../lib/utils.js";
|
|
16
|
+
import { ImportFromFileButton as ws } from "../import/ImportFromFileButton.js";
|
|
17
|
+
import { SearchHighlight as gn } from "../SearchHighlight.js";
|
|
18
|
+
import { useOverflowTip as Ns } from "../TipLayer.js";
|
|
19
|
+
import { useColumnWidths as pr, ResetColumnsButton as bn, ColResizeHandle as vs, fitWidth as Ss } from "./catalog-columns.js";
|
|
20
|
+
import { facetsComplete as _s, facetResults as qs, facetOptions as $s, setFacetPick as js } from "./catalog-facets.js";
|
|
21
|
+
import { usePlaceName as Fs, useCatalogLineLive as Ts, stockShortText as Rs, catalogPriceText as Os, linePriceChange as Ps } from "./catalog-line-watch.js";
|
|
22
|
+
import { orderCatalogMatches as Ls, rowMatchesFields as Es } from "./catalog-search.js";
|
|
23
|
+
import { applyDisplayTemplate as Ce } from "./helpers.js";
|
|
23
24
|
import { evalClientFormula as Ee } from "./InlineTableField.js";
|
|
24
|
-
import { isIntegerFieldType as
|
|
25
|
-
import { resolveM2MRelatedCollection as
|
|
26
|
-
import { useO2MStaging as
|
|
27
|
-
import { RelationCombobox as
|
|
28
|
-
const
|
|
29
|
-
let
|
|
30
|
-
for (const
|
|
31
|
-
if (
|
|
32
|
-
|
|
25
|
+
import { isIntegerFieldType as mt, checkNumberEntry as kn, mergePendingQtyRow as Ks, decimalPlacesProblem as As, lineRuleErrors as Cs, MAX_LINE_MONEY as Js } from "./line-qty.js";
|
|
26
|
+
import { resolveM2MRelatedCollection as Is } from "./M2MCombobox.js";
|
|
27
|
+
import { useO2MStaging as Qs } from "./O2MStagingContext.js";
|
|
28
|
+
import { RelationCombobox as zs, RelatedItemLabel as Us } from "./RelationCombobox.js";
|
|
29
|
+
const kr = (i, m) => {
|
|
30
|
+
let p = i;
|
|
31
|
+
for (const g of m.split(".")) {
|
|
32
|
+
if (p == null || typeof p != "object") return;
|
|
33
|
+
p = p[g];
|
|
33
34
|
}
|
|
34
|
-
return
|
|
35
|
+
return p;
|
|
35
36
|
};
|
|
36
|
-
async function
|
|
37
|
-
const
|
|
37
|
+
async function It(i, m, p) {
|
|
38
|
+
const g = [];
|
|
38
39
|
for (let _ = 1; _ <= 50; _++) {
|
|
39
|
-
const
|
|
40
|
-
if (
|
|
40
|
+
const s = await i.request(C(m, { ...p, limit: 1e3, page: _ })).then((k) => k.data ?? []);
|
|
41
|
+
if (g.push(...s), s.length < 1e3) break;
|
|
41
42
|
}
|
|
42
|
-
return
|
|
43
|
+
return g;
|
|
43
44
|
}
|
|
44
|
-
function
|
|
45
|
-
const _ = {},
|
|
46
|
-
for (const
|
|
47
|
-
const
|
|
48
|
-
if (!
|
|
49
|
-
const
|
|
50
|
-
|
|
45
|
+
function Ms(i, m, p, g) {
|
|
46
|
+
const _ = {}, s = { ...g ?? {} };
|
|
47
|
+
for (const k of m) {
|
|
48
|
+
const w = i[k], O = w == null || w === "", v = !O && (g == null ? void 0 : g[k]) !== void 0 && g[k] === String(w);
|
|
49
|
+
if (!O && !v) continue;
|
|
50
|
+
const L = p(k);
|
|
51
|
+
L == null || L === "" || !O && String(L) === String(w) || (_[k] = L, s[k] = String(L));
|
|
51
52
|
}
|
|
52
|
-
return Object.keys(_).length > 0 ? { updates: _, auto:
|
|
53
|
+
return Object.keys(_).length > 0 ? { updates: _, auto: s } : null;
|
|
53
54
|
}
|
|
54
|
-
function
|
|
55
|
+
function wn(i, m = /* @__PURE__ */ new Set()) {
|
|
55
56
|
if (typeof i == "string" && i.startsWith("$parent.")) m.add(i.slice(8));
|
|
56
|
-
else if (Array.isArray(i)) for (const
|
|
57
|
+
else if (Array.isArray(i)) for (const p of i) wn(p, m);
|
|
57
58
|
else if (i && typeof i == "object")
|
|
58
|
-
for (const
|
|
59
|
+
for (const p of Object.values(i)) wn(p, m);
|
|
59
60
|
return m;
|
|
60
61
|
}
|
|
61
|
-
function
|
|
62
|
-
const
|
|
63
|
-
let
|
|
64
|
-
const _ = (
|
|
65
|
-
if (typeof
|
|
66
|
-
const
|
|
67
|
-
return
|
|
62
|
+
function Ge(i, m) {
|
|
63
|
+
const p = {};
|
|
64
|
+
let g = !1;
|
|
65
|
+
const _ = (s) => {
|
|
66
|
+
if (typeof s == "string" && s.startsWith("$parent.")) {
|
|
67
|
+
const k = m == null ? void 0 : m[s.slice(8)];
|
|
68
|
+
return k == null || k === "" ? (g = !0, s) : k;
|
|
68
69
|
}
|
|
69
|
-
return Array.isArray(
|
|
70
|
+
return Array.isArray(s) ? s.map(_) : s && typeof s == "object" ? Object.fromEntries(Object.entries(s).map(([k, w]) => [k, _(w)])) : s;
|
|
70
71
|
};
|
|
71
|
-
for (const [
|
|
72
|
-
if (typeof
|
|
73
|
-
const
|
|
74
|
-
if (
|
|
75
|
-
|
|
72
|
+
for (const [s, k] of Object.entries(i ?? {}))
|
|
73
|
+
if (typeof k == "string" && k.startsWith("$parent.")) {
|
|
74
|
+
const w = m == null ? void 0 : m[k.slice(8)];
|
|
75
|
+
if (w == null || w === "") {
|
|
76
|
+
g = !0;
|
|
76
77
|
continue;
|
|
77
78
|
}
|
|
78
|
-
|
|
79
|
-
} else
|
|
80
|
-
return
|
|
79
|
+
p[s] = { _eq: w };
|
|
80
|
+
} else k && typeof k == "object" ? p[s] = _(k) : p[s] = { _eq: k };
|
|
81
|
+
return g ? null : p;
|
|
81
82
|
}
|
|
82
|
-
function
|
|
83
|
+
function hr(i, m) {
|
|
83
84
|
if (!i) return !0;
|
|
84
|
-
for (const [
|
|
85
|
-
const _ = m == null ? void 0 : m[
|
|
86
|
-
for (const [
|
|
87
|
-
switch (
|
|
85
|
+
for (const [p, g] of Object.entries(i)) {
|
|
86
|
+
const _ = m == null ? void 0 : m[p], s = _ == null ? null : String(_), k = g && typeof g == "object" ? g : { _eq: g };
|
|
87
|
+
for (const [w, O] of Object.entries(k))
|
|
88
|
+
switch (w) {
|
|
88
89
|
case "_eq":
|
|
89
|
-
if (
|
|
90
|
+
if (s !== String(O)) return !1;
|
|
90
91
|
break;
|
|
91
92
|
case "_neq":
|
|
92
|
-
if (
|
|
93
|
+
if (s === String(O)) return !1;
|
|
93
94
|
break;
|
|
94
95
|
case "_in":
|
|
95
|
-
if (!Array.isArray(
|
|
96
|
+
if (!Array.isArray(O) || !O.map(String).includes(s ?? "")) return !1;
|
|
96
97
|
break;
|
|
97
98
|
case "_nin":
|
|
98
|
-
if (Array.isArray(
|
|
99
|
+
if (Array.isArray(O) && O.map(String).includes(s ?? "")) return !1;
|
|
99
100
|
break;
|
|
100
101
|
case "_null":
|
|
101
|
-
if (
|
|
102
|
+
if (s !== null) return !1;
|
|
102
103
|
break;
|
|
103
104
|
case "_nnull":
|
|
104
|
-
if (
|
|
105
|
+
if (s === null) return !1;
|
|
105
106
|
break;
|
|
106
107
|
default:
|
|
107
108
|
return !1;
|
|
@@ -109,200 +110,200 @@ function or(i, m) {
|
|
|
109
110
|
}
|
|
110
111
|
return !0;
|
|
111
112
|
}
|
|
112
|
-
const
|
|
113
|
-
function
|
|
113
|
+
const Ws = 2e3;
|
|
114
|
+
function Vs(i, m) {
|
|
114
115
|
if (/e/i.test(i.trim())) return "Type the quantity in full digits";
|
|
115
|
-
const
|
|
116
|
-
if (
|
|
116
|
+
const p = Number(i);
|
|
117
|
+
if (mt(m) && i.trim() !== "" && !Number.isNaN(p) && !Number.isInteger(p))
|
|
117
118
|
return "Whole numbers only";
|
|
118
|
-
const
|
|
119
|
-
return
|
|
119
|
+
const g = kn(i, { type: m, min: 0, label: "Quantity" });
|
|
120
|
+
return g.ok ? null : g.message;
|
|
120
121
|
}
|
|
121
|
-
function
|
|
122
|
-
const
|
|
123
|
-
const
|
|
124
|
-
return _ + (
|
|
122
|
+
function Bs(i, m, p) {
|
|
123
|
+
const g = i.reduce((_, s) => {
|
|
124
|
+
const k = s[m], w = k != null && k !== "" ? k : p != null && p[m] ? Ee(p[m], s) : null, O = Number(w);
|
|
125
|
+
return _ + (w != null && Number.isFinite(O) ? O : 0);
|
|
125
126
|
}, 0);
|
|
126
|
-
return Math.round(
|
|
127
|
+
return Math.round(g * 1e6) / 1e6;
|
|
127
128
|
}
|
|
128
|
-
function
|
|
129
|
-
const
|
|
130
|
-
return
|
|
129
|
+
function Ds(i, m) {
|
|
130
|
+
const p = m.trim();
|
|
131
|
+
return p ? `${i} — ${p} not used` : i;
|
|
131
132
|
}
|
|
132
|
-
function
|
|
133
|
+
function Hs(i) {
|
|
133
134
|
const m = { ...i.probe };
|
|
134
|
-
for (const [
|
|
135
|
-
const _ = Ee(
|
|
135
|
+
for (const [p, g] of Object.entries(i.compute)) {
|
|
136
|
+
const _ = Ee(g, m);
|
|
136
137
|
if (_ === null) continue;
|
|
137
|
-
m[
|
|
138
|
-
const
|
|
139
|
-
if (
|
|
140
|
-
if (Math.abs(_) >
|
|
141
|
-
return `${i.labelOf(
|
|
138
|
+
m[p] = _;
|
|
139
|
+
const s = i.ruleError(p, _, m);
|
|
140
|
+
if (s) return s;
|
|
141
|
+
if (Math.abs(_) > Js)
|
|
142
|
+
return `${i.labelOf(p)} would be ${_.toLocaleString(void 0, { maximumFractionDigits: 2 })} — too large to save`;
|
|
142
143
|
}
|
|
143
144
|
return null;
|
|
144
145
|
}
|
|
145
|
-
function
|
|
146
|
-
const m = Object.entries(i.copyFields ?? {}).filter(([,
|
|
147
|
-
for (const
|
|
148
|
-
for (const
|
|
149
|
-
if (
|
|
150
|
-
const _ = i.lookup(
|
|
146
|
+
function Ys(i) {
|
|
147
|
+
const m = Object.entries(i.copyFields ?? {}).filter(([, p]) => p === i.field).map(([p]) => p);
|
|
148
|
+
for (const p of m)
|
|
149
|
+
for (const g of i.related ?? []) {
|
|
150
|
+
if (g.copy_to !== p) continue;
|
|
151
|
+
const _ = i.lookup(g.key);
|
|
151
152
|
if (_ != null && _ !== "") return _;
|
|
152
153
|
}
|
|
153
154
|
return i.catalogValue;
|
|
154
155
|
}
|
|
155
|
-
function
|
|
156
|
-
return i.map((
|
|
156
|
+
function Zs(i, m) {
|
|
157
|
+
return i.map((p) => [p.id, ...m.map((g) => p[g])].map((g) => String(g ?? "")).join("")).join("");
|
|
157
158
|
}
|
|
158
|
-
function
|
|
159
|
-
const m = Object.keys(i).filter((
|
|
159
|
+
function Gs(i) {
|
|
160
|
+
const m = Object.keys(i).filter((g) => i[g].kind === "error");
|
|
160
161
|
if (m.length === 0) return i;
|
|
161
|
-
const
|
|
162
|
-
for (const
|
|
163
|
-
return
|
|
162
|
+
const p = { ...i };
|
|
163
|
+
for (const g of m) delete p[g];
|
|
164
|
+
return p;
|
|
164
165
|
}
|
|
165
|
-
function
|
|
166
|
-
const
|
|
167
|
-
if (!Number.isFinite(
|
|
168
|
-
const _ =
|
|
166
|
+
function Xs(i, m, p) {
|
|
167
|
+
const g = Number(i[m]);
|
|
168
|
+
if (!Number.isFinite(g) || g <= 0) return !1;
|
|
169
|
+
const _ = p.find((k) => k in i);
|
|
169
170
|
if (!_) return !1;
|
|
170
|
-
const
|
|
171
|
-
return
|
|
171
|
+
const s = i[_];
|
|
172
|
+
return s == null || s === "" || Number(s) === 0;
|
|
172
173
|
}
|
|
173
|
-
function
|
|
174
|
+
function Pa({
|
|
174
175
|
relatedCollection: i,
|
|
175
176
|
manyField: m,
|
|
176
|
-
parentId:
|
|
177
|
-
parentCollection:
|
|
177
|
+
parentId: p,
|
|
178
|
+
parentCollection: g,
|
|
178
179
|
field: _,
|
|
179
|
-
config:
|
|
180
|
-
readOnly:
|
|
180
|
+
config: s,
|
|
181
|
+
readOnly: k = !1
|
|
181
182
|
}) {
|
|
182
|
-
var
|
|
183
|
-
const
|
|
183
|
+
var er, tr, nr, rr, sr, ar, ir, lr, or;
|
|
184
|
+
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({
|
|
184
185
|
queryKey: At.collectionRelations(i),
|
|
185
|
-
queryFn: () =>
|
|
186
|
+
queryFn: () => yn(w, i),
|
|
186
187
|
staleTime: 10 * 6e4
|
|
187
|
-
}), y =
|
|
188
|
+
}), y = R(
|
|
188
189
|
() => {
|
|
189
190
|
var e;
|
|
190
191
|
return ((e = xe.find(
|
|
191
|
-
(t) => t.many_collection === i && t.many_field ===
|
|
192
|
+
(t) => t.many_collection === i && t.many_field === s.item_field && !t.junction_field
|
|
192
193
|
)) == null ? void 0 : e.one_collection) ?? null;
|
|
193
194
|
},
|
|
194
|
-
[xe, i,
|
|
195
|
+
[xe, i, s.item_field]
|
|
195
196
|
), { data: N = [] } = Q({
|
|
196
197
|
queryKey: At.fieldConfig(i, null),
|
|
197
|
-
queryFn: () =>
|
|
198
|
+
queryFn: () => w.request(C(`/field-config/${i}`)).then((e) => e.data ?? []),
|
|
198
199
|
staleTime: 6e4
|
|
199
|
-
}),
|
|
200
|
+
}), E = ((er = N.find((e) => e.field === z)) == null ? void 0 : er.type) ?? null, P = (e, t, n) => {
|
|
200
201
|
var r;
|
|
201
|
-
return ((r =
|
|
202
|
+
return ((r = Cs(
|
|
202
203
|
N.filter((l) => l.field === e).map((l) => ({
|
|
203
204
|
field: l.field,
|
|
204
|
-
label: l.label ||
|
|
205
|
+
label: l.label || Z(l.field),
|
|
205
206
|
type: l.type,
|
|
206
207
|
validation_rules: l.validation_rules
|
|
207
208
|
})),
|
|
208
209
|
{ [e]: t },
|
|
209
210
|
{ ...n, [e]: t }
|
|
210
211
|
)[0]) == null ? void 0 : r.message) ?? null;
|
|
211
|
-
}, { data:
|
|
212
|
+
}, { data: j } = Q({
|
|
212
213
|
queryKey: ["col-meta", y],
|
|
213
|
-
queryFn: () =>
|
|
214
|
+
queryFn: () => w.request(C(`/collections/${y}`)).then((e) => e.data),
|
|
214
215
|
enabled: !!y,
|
|
215
216
|
staleTime: 3e5
|
|
216
|
-
}),
|
|
217
|
-
const e =
|
|
218
|
-
return ((
|
|
217
|
+
}), K = j == null ? void 0 : j.display_template, A = R(() => {
|
|
218
|
+
const e = s.section_by.split(".")[0];
|
|
219
|
+
return ((j == null ? void 0 : j.relations) ?? []).find(
|
|
219
220
|
(t) => t.one_collection === y && t.one_field === e && !!t.junction_field
|
|
220
221
|
) ?? null;
|
|
221
|
-
}, [
|
|
222
|
+
}, [j, y, s.section_by]), te = (A == null ? void 0 : A.many_collection) ?? null, { data: Je = [] } = Q({
|
|
222
223
|
queryKey: At.collectionRelations(te),
|
|
223
|
-
queryFn: () =>
|
|
224
|
+
queryFn: () => yn(w, te),
|
|
224
225
|
enabled: !!te,
|
|
225
226
|
staleTime: 10 * 6e4
|
|
226
|
-
}), d =
|
|
227
|
-
if (!(
|
|
228
|
-
const e = String(
|
|
227
|
+
}), d = R(() => {
|
|
228
|
+
if (!(A != null && A.many_field) || !te) return null;
|
|
229
|
+
const e = String(A.junction_field), t = Je.find(
|
|
229
230
|
(r) => r.many_collection === te && r.many_field === e
|
|
230
|
-
), n =
|
|
231
|
+
), n = Is(t);
|
|
231
232
|
return n ? {
|
|
232
233
|
junction: te,
|
|
233
|
-
fkToItem:
|
|
234
|
+
fkToItem: A.many_field,
|
|
234
235
|
fkToSection: e,
|
|
235
236
|
target: n,
|
|
236
|
-
labelPath:
|
|
237
|
+
labelPath: s.section_by.split(".").slice(1).join(".") || "id"
|
|
237
238
|
} : null;
|
|
238
|
-
}, [
|
|
239
|
+
}, [A, te, Je, s.section_by]), S = L == null ? void 0 : L.draft, { resolvedFilter: X, resolvedSectionFilter: le, resolvedLinkFilter: Y, missingParents: ae } = R(() => {
|
|
239
240
|
const e = [], t = (o) => {
|
|
240
241
|
if (typeof o == "string" && o.startsWith("$parent.")) {
|
|
241
|
-
const
|
|
242
|
-
return c == null || c === "" ? (e.push(
|
|
242
|
+
const f = o.slice(8), c = S == null ? void 0 : S[f];
|
|
243
|
+
return c == null || c === "" ? (e.push(f), o) : c;
|
|
243
244
|
}
|
|
244
|
-
return Array.isArray(o) ? o.map(t) : o && typeof o == "object" ? Object.fromEntries(Object.entries(o).map(([
|
|
245
|
-
}, n =
|
|
245
|
+
return Array.isArray(o) ? o.map(t) : o && typeof o == "object" ? Object.fromEntries(Object.entries(o).map(([f, c]) => [f, t(c)])) : o;
|
|
246
|
+
}, 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;
|
|
246
247
|
return {
|
|
247
248
|
resolvedFilter: n,
|
|
248
249
|
resolvedSectionFilter: r,
|
|
249
250
|
resolvedLinkFilter: l,
|
|
250
251
|
missingParents: [...new Set(e)]
|
|
251
252
|
};
|
|
252
|
-
}, [
|
|
253
|
-
if (!
|
|
253
|
+
}, [s.filter, s.section_filter, s.link_filter, S]), ne = R(() => {
|
|
254
|
+
if (!A || !le && !Y) return X;
|
|
254
255
|
const e = {
|
|
255
256
|
...le ?? {},
|
|
256
257
|
...Y ? { _link: Y } : {}
|
|
257
|
-
}, t = { [
|
|
258
|
-
return
|
|
259
|
-
}, [
|
|
258
|
+
}, t = { [A.one_field]: { _some: e } };
|
|
259
|
+
return X ? { _and: [X, t] } : t;
|
|
260
|
+
}, [A, le, Y, X]), U = R(() => {
|
|
260
261
|
const e = /* @__PURE__ */ new Set(["id"]);
|
|
261
|
-
|
|
262
|
-
for (const t of [...(
|
|
263
|
-
for (const t of Object.values(
|
|
264
|
-
for (const t of
|
|
262
|
+
j && !A && e.add(s.section_by);
|
|
263
|
+
for (const t of [...(K ?? "").matchAll(/\{\{([\w.]+)\}\}/g)]) e.add(t[1]);
|
|
264
|
+
for (const t of Object.values(s.copy_fields ?? {})) e.add(t);
|
|
265
|
+
for (const t of s.columns ?? []) e.add(t.field);
|
|
265
266
|
return [...e].join(",");
|
|
266
|
-
}, [
|
|
267
|
+
}, [K, j, A, s.section_by, s.copy_fields, s.columns]), Ie = JSON.stringify(ne ?? null), { data: oe = [], isLoading: Nn } = Q(
|
|
267
268
|
{
|
|
268
|
-
queryKey: ["catalog-picker", y,
|
|
269
|
-
queryFn: () =>
|
|
270
|
-
|
|
271
|
-
limit:
|
|
272
|
-
fields:
|
|
269
|
+
queryKey: ["catalog-picker", y, U, Ie],
|
|
270
|
+
queryFn: () => w.request(
|
|
271
|
+
C(`/items/${y}`, {
|
|
272
|
+
limit: Ws,
|
|
273
|
+
fields: U,
|
|
273
274
|
...ne ? { filter: JSON.stringify(ne) } : {}
|
|
274
275
|
})
|
|
275
276
|
).then((e) => e.data ?? []),
|
|
276
277
|
// Wait for the catalog meta: a to-many section path both narrows this
|
|
277
278
|
// read and must stay out of its `fields=`.
|
|
278
|
-
enabled: !!y &&
|
|
279
|
+
enabled: !!y && !!j && ae.length === 0 && (!A || !!d),
|
|
279
280
|
staleTime: 6e4
|
|
280
281
|
}
|
|
281
|
-
),
|
|
282
|
-
queryKey: ["catalog-sections", d == null ? void 0 : d.target, d == null ? void 0 : d.labelPath,
|
|
282
|
+
), Nr = JSON.stringify(le ?? null), { data: bt = [], isLoading: vr } = Q({
|
|
283
|
+
queryKey: ["catalog-sections", d == null ? void 0 : d.target, d == null ? void 0 : d.labelPath, Nr],
|
|
283
284
|
queryFn: async () => {
|
|
284
285
|
const e = d;
|
|
285
|
-
return (await
|
|
286
|
+
return (await It(w, `/items/${e.target}`, {
|
|
286
287
|
fields: `id,${e.labelPath}`,
|
|
287
288
|
...le ? { filter: JSON.stringify(le) } : {}
|
|
288
289
|
})).map((n) => ({
|
|
289
290
|
id: String(n.id),
|
|
290
|
-
name: String(
|
|
291
|
+
name: String(kr(n, e.labelPath) ?? "").trim()
|
|
291
292
|
}));
|
|
292
293
|
},
|
|
293
294
|
enabled: !!d && ae.length === 0,
|
|
294
295
|
staleTime: 6e4
|
|
295
|
-
}),
|
|
296
|
+
}), Xe = R(() => bt.map((e) => e.id), [bt]), { data: vn = [], isLoading: Sr } = Q({
|
|
296
297
|
queryKey: [
|
|
297
298
|
"catalog-section-links",
|
|
298
299
|
d == null ? void 0 : d.junction,
|
|
299
|
-
|
|
300
|
+
Xe.join(","),
|
|
300
301
|
JSON.stringify(Y ?? null)
|
|
301
302
|
],
|
|
302
303
|
queryFn: async () => {
|
|
303
304
|
const e = d, t = [];
|
|
304
|
-
for (let n = 0; n <
|
|
305
|
-
const r =
|
|
305
|
+
for (let n = 0; n < Xe.length; n += 200) {
|
|
306
|
+
const r = Xe.slice(n, n + 200), l = await It(w, `/items/${e.junction}`, {
|
|
306
307
|
fields: `${e.fkToItem},${e.fkToSection}`,
|
|
307
308
|
filter: JSON.stringify(
|
|
308
309
|
Y ? { _and: [{ [e.fkToSection]: { _in: r } }, Y] } : { [e.fkToSection]: { _in: r } }
|
|
@@ -313,134 +314,134 @@ function ya({
|
|
|
313
314
|
}
|
|
314
315
|
return t;
|
|
315
316
|
},
|
|
316
|
-
enabled: !!d &&
|
|
317
|
+
enabled: !!d && Xe.length > 0,
|
|
317
318
|
staleTime: 6e4
|
|
318
|
-
}),
|
|
319
|
-
const e = new Map(
|
|
320
|
-
for (const n of
|
|
319
|
+
}), Sn = R(() => {
|
|
320
|
+
const e = new Map(bt.map((n) => [n.id, n.name])), t = /* @__PURE__ */ new Map();
|
|
321
|
+
for (const n of vn) {
|
|
321
322
|
const r = e.get(n.section);
|
|
322
323
|
if (!r) continue;
|
|
323
324
|
const l = t.get(n.item) ?? [];
|
|
324
325
|
l.includes(r) || l.push(r), t.set(n.item, l);
|
|
325
326
|
}
|
|
326
327
|
return t;
|
|
327
|
-
}, [
|
|
328
|
+
}, [bt, vn]), xt = !!A && (!d || vr || Xe.length > 0 && Sr), yt = R(() => {
|
|
328
329
|
const e = /* @__PURE__ */ new Map();
|
|
329
330
|
for (const t of oe) e.set(String(t.id), t);
|
|
330
331
|
return e;
|
|
331
332
|
}, [oe]), { data: we = [] } = Q({
|
|
332
|
-
queryKey: ["o2m-rows", i, m,
|
|
333
|
-
queryFn: () =>
|
|
334
|
-
|
|
335
|
-
filter: JSON.stringify({ [m]: { _eq:
|
|
333
|
+
queryKey: ["o2m-rows", i, m, p],
|
|
334
|
+
queryFn: () => w.request(
|
|
335
|
+
C(`/items/${i}`, {
|
|
336
|
+
filter: JSON.stringify({ [m]: { _eq: p } }),
|
|
336
337
|
limit: 1e3
|
|
337
338
|
})
|
|
338
339
|
).then((e) => e.data ?? []),
|
|
339
|
-
enabled: !
|
|
340
|
+
enabled: !T,
|
|
340
341
|
staleTime: 15e3
|
|
341
|
-
}),
|
|
342
|
-
() =>
|
|
343
|
-
|
|
344
|
-
|
|
342
|
+
}), Qt = R(
|
|
343
|
+
() => Zs(we, [
|
|
344
|
+
s.item_field,
|
|
345
|
+
z,
|
|
345
346
|
...M,
|
|
346
|
-
...Object.keys(
|
|
347
|
+
...Object.keys(s.compute_fields ?? {})
|
|
347
348
|
]),
|
|
348
|
-
[we,
|
|
349
|
-
),
|
|
350
|
-
|
|
351
|
-
const e =
|
|
352
|
-
if (
|
|
353
|
-
const t = Object.keys(
|
|
354
|
-
(n) =>
|
|
349
|
+
[we, s.item_field, z, M, s.compute_fields]
|
|
350
|
+
), _n = je(null), zt = je(B);
|
|
351
|
+
zt.current = B, Fe(() => {
|
|
352
|
+
const e = _n.current;
|
|
353
|
+
if (_n.current = Qt, e === null || e === Qt) return;
|
|
354
|
+
const t = Object.keys(zt.current).filter(
|
|
355
|
+
(n) => zt.current[n].kind === "error"
|
|
355
356
|
);
|
|
356
|
-
se((n) =>
|
|
357
|
+
se((n) => Gs(n)), _e((n) => Object.keys(n).length === 0 ? n : {}), t.length > 0 && re((n) => {
|
|
357
358
|
if (!t.some((l) => l in n)) return n;
|
|
358
359
|
const r = { ...n };
|
|
359
360
|
for (const l of t) delete r[l];
|
|
360
361
|
return r;
|
|
361
362
|
});
|
|
362
|
-
}, [
|
|
363
|
-
const
|
|
364
|
-
() =>
|
|
365
|
-
const t =
|
|
363
|
+
}, [Qt]);
|
|
364
|
+
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(
|
|
365
|
+
() => gt.size === 0 ? we : we.map((e) => {
|
|
366
|
+
const t = gt.get(String(e.id));
|
|
366
367
|
return t ? { ...e, ...t } : e;
|
|
367
368
|
}),
|
|
368
|
-
[we,
|
|
369
|
-
),
|
|
369
|
+
[we, _r]
|
|
370
|
+
), kt = !T && v ? v.getPendingDeletes(i, m) : /* @__PURE__ */ new Set(), tt = R(() => {
|
|
370
371
|
const e = /* @__PURE__ */ new Map();
|
|
371
|
-
for (const t of
|
|
372
|
-
const n = t[
|
|
372
|
+
for (const t of Me) {
|
|
373
|
+
const n = t[s.item_field];
|
|
373
374
|
n != null && e.set(String(n), t);
|
|
374
375
|
}
|
|
375
376
|
return e;
|
|
376
|
-
}, [
|
|
377
|
+
}, [Me, s.item_field]), wt = R(() => {
|
|
377
378
|
const e = /* @__PURE__ */ new Map();
|
|
378
|
-
return
|
|
379
|
-
const r = t[
|
|
379
|
+
return Re.forEach((t, n) => {
|
|
380
|
+
const r = t[s.item_field];
|
|
380
381
|
r != null && e.set(String(r), n);
|
|
381
382
|
}), e;
|
|
382
|
-
}, [
|
|
383
|
-
const e =
|
|
384
|
-
if (
|
|
385
|
-
const t =
|
|
383
|
+
}, [Re, s.item_field]), Ne = R(() => {
|
|
384
|
+
const e = Re.filter((r) => r[s.item_field] != null).map((r) => ({ key: String(r[s.item_field]), row: r }));
|
|
385
|
+
if (T) return e;
|
|
386
|
+
const t = Me.filter((r) => r[s.item_field] != null).map((r) => ({ key: String(r[s.item_field]), row: r })), n = new Set(t.map((r) => r.key));
|
|
386
387
|
return [...t, ...e.filter((r) => !n.has(r.key))];
|
|
387
|
-
}, [
|
|
388
|
-
() =>
|
|
389
|
-
[
|
|
390
|
-
), { data:
|
|
391
|
-
queryKey: ["catalog-picker-labels", y,
|
|
392
|
-
queryFn: () =>
|
|
393
|
-
|
|
394
|
-
filter: JSON.stringify({ id: { _in:
|
|
395
|
-
fields:
|
|
396
|
-
limit:
|
|
388
|
+
}, [T, Re, Me, s.item_field]), Nt = R(
|
|
389
|
+
() => Ne.filter((e) => !yt.has(e.key)).map((e) => e.key),
|
|
390
|
+
[Ne, yt]
|
|
391
|
+
), { data: Ut = [] } = Q({
|
|
392
|
+
queryKey: ["catalog-picker-labels", y, U, Nt.join(",")],
|
|
393
|
+
queryFn: () => w.request(
|
|
394
|
+
C(`/items/${y}`, {
|
|
395
|
+
filter: JSON.stringify({ id: { _in: Nt } }),
|
|
396
|
+
fields: U,
|
|
397
|
+
limit: Nt.length
|
|
397
398
|
})
|
|
398
399
|
).then((e) => e.data ?? []),
|
|
399
|
-
enabled: !!y &&
|
|
400
|
+
enabled: !!y && Nt.length > 0,
|
|
400
401
|
staleTime: 6e4
|
|
401
|
-
}), { data:
|
|
402
|
+
}), { data: Pe = [] } = Q({
|
|
402
403
|
queryKey: ["pinned-items", y],
|
|
403
|
-
queryFn: () =>
|
|
404
|
-
enabled: !!y && !!
|
|
404
|
+
queryFn: () => w.request(C(`/pinned/${y}`)).then((e) => e.data ?? []),
|
|
405
|
+
enabled: !!y && !!s.favorites,
|
|
405
406
|
staleTime: 6e4
|
|
406
|
-
}), Mt =
|
|
407
|
-
queryKey: ["pinned-item-rows", y,
|
|
408
|
-
queryFn: () =>
|
|
409
|
-
|
|
410
|
-
filter: JSON.stringify({ id: { _in:
|
|
411
|
-
fields:
|
|
412
|
-
limit:
|
|
407
|
+
}), Mt = R(() => new Set(Pe), [Pe]), { data: nt = [] } = Q({
|
|
408
|
+
queryKey: ["pinned-item-rows", y, U, Pe.join(",")],
|
|
409
|
+
queryFn: () => w.request(
|
|
410
|
+
C(`/items/${y}`, {
|
|
411
|
+
filter: JSON.stringify({ id: { _in: Pe } }),
|
|
412
|
+
fields: U,
|
|
413
|
+
limit: Pe.length
|
|
413
414
|
})
|
|
414
415
|
).then((e) => e.data ?? []),
|
|
415
|
-
enabled: !!y && !!
|
|
416
|
+
enabled: !!y && !!s.favorites && Pe.length > 0,
|
|
416
417
|
staleTime: 6e4
|
|
417
|
-
}), [
|
|
418
|
-
async function
|
|
419
|
-
if (!(!y ||
|
|
420
|
-
|
|
418
|
+
}), [vt, qn] = D(/* @__PURE__ */ new Set());
|
|
419
|
+
async function $n(e) {
|
|
420
|
+
if (!(!y || vt.has(e))) {
|
|
421
|
+
qn((t) => new Set(t).add(e));
|
|
421
422
|
try {
|
|
422
|
-
await
|
|
423
|
-
}), await
|
|
423
|
+
await w.request(fr(`/pinned/${y}/${e}/toggle`)).catch(() => {
|
|
424
|
+
}), await O.invalidateQueries({ queryKey: ["pinned-items", y] });
|
|
424
425
|
} finally {
|
|
425
|
-
|
|
426
|
+
qn((t) => {
|
|
426
427
|
const n = new Set(t);
|
|
427
428
|
return n.delete(e), n;
|
|
428
429
|
});
|
|
429
430
|
}
|
|
430
431
|
}
|
|
431
432
|
}
|
|
432
|
-
const [
|
|
433
|
+
const [qr, jn] = D(!1), Fn = je(null), Wt = (e) => s.favorites ? /* @__PURE__ */ a(
|
|
433
434
|
"button",
|
|
434
435
|
{
|
|
435
436
|
type: "button",
|
|
436
437
|
title: Mt.has(e) ? "Remove from favorites" : "Add to favorites",
|
|
437
|
-
disabled:
|
|
438
|
+
disabled: vt.has(e),
|
|
438
439
|
onClick: (t) => {
|
|
439
|
-
t.stopPropagation(),
|
|
440
|
+
t.stopPropagation(), $n(e);
|
|
440
441
|
},
|
|
441
442
|
className: "shrink-0 rounded p-0.5 transition-colors",
|
|
442
|
-
children:
|
|
443
|
-
|
|
443
|
+
children: vt.has(e) ? /* @__PURE__ */ a(ue, { className: "h-3.5 w-3.5 animate-spin text-amber-400" }) : /* @__PURE__ */ a(
|
|
444
|
+
ft,
|
|
444
445
|
{
|
|
445
446
|
className: W(
|
|
446
447
|
"h-3.5 w-3.5",
|
|
@@ -449,379 +450,406 @@ function ya({
|
|
|
449
450
|
}
|
|
450
451
|
)
|
|
451
452
|
}
|
|
452
|
-
) : null, [ye,
|
|
453
|
-
|
|
454
|
-
const e = setTimeout(() =>
|
|
453
|
+
) : null, [ye, $r] = D("");
|
|
454
|
+
Fe(() => {
|
|
455
|
+
const e = setTimeout(() => $r(V), 300);
|
|
455
456
|
return () => clearTimeout(e);
|
|
456
|
-
}, [
|
|
457
|
-
const
|
|
457
|
+
}, [V]);
|
|
458
|
+
const Tn = R(() => {
|
|
458
459
|
var t;
|
|
459
|
-
const e = (t = [...(
|
|
460
|
+
const e = (t = [...(K ?? "").matchAll(/\{\{([\w.]+)\}\}/g)][0]) == null ? void 0 : t[1];
|
|
460
461
|
return e && !e.includes(".") ? e : "id";
|
|
461
|
-
}, [
|
|
462
|
+
}, [K]), { shownSearchFields: Qe, otherSearchFields: Rn } = R(() => {
|
|
462
463
|
const e = new Set(
|
|
463
|
-
((
|
|
464
|
+
((j == null ? void 0 : j.relations) ?? []).filter((r) => r.one_collection === y && r.one_field).map((r) => r.one_field)
|
|
464
465
|
), t = new Set(
|
|
465
|
-
((
|
|
466
|
+
((j == null ? void 0 : j.fields) ?? []).filter((r) => (r.type === "string" || r.type === "text") && !e.has(r.field)).map((r) => r.field)
|
|
466
467
|
), n = /* @__PURE__ */ new Set();
|
|
467
|
-
for (const r of (
|
|
468
|
-
for (const r of
|
|
468
|
+
for (const r of (K ?? "").matchAll(/\{\{([\w.]+)\}\}/g)) t.has(r[1]) && n.add(r[1]);
|
|
469
|
+
for (const r of s.columns ?? []) t.has(r.field) && n.add(r.field);
|
|
469
470
|
return {
|
|
470
471
|
shownSearchFields: [...n],
|
|
471
472
|
otherSearchFields: [...t].filter((r) => !n.has(r))
|
|
472
473
|
};
|
|
473
|
-
}, [
|
|
474
|
-
const e =
|
|
474
|
+
}, [j, y, K, s.columns]), We = R(() => {
|
|
475
|
+
const e = s.related_columns ?? [], t = e.findIndex((n) => n.stock === !0);
|
|
475
476
|
return t !== -1 ? t : e.findIndex((n) => n.key === "on_hand" && n.stock !== !1);
|
|
476
|
-
}, [
|
|
477
|
+
}, [s.related_columns]), de = We === -1 ? null : (s.related_columns ?? [])[We] ?? null, Le = de ? Ge(de.match, S) : null, ze = R(() => {
|
|
477
478
|
for (const e of Object.values((de == null ? void 0 : de.match) ?? {}))
|
|
478
479
|
if (typeof e == "string" && e.startsWith("$parent.")) return e.slice(8);
|
|
479
480
|
return null;
|
|
480
|
-
}, [de]),
|
|
481
|
-
|
|
482
|
-
if (
|
|
481
|
+
}, [de]), On = ze ? S == null ? void 0 : S[ze] : null, jr = ze ? ((tr = L == null ? void 0 : L.fieldLabels) == null ? void 0 : tr[ze]) ?? Z(ze) : null, Ve = y ? `nvr:catalog-in-stock:${y}:${i}.${m}` : null, [Pn, Ln] = D(!1);
|
|
482
|
+
Fe(() => {
|
|
483
|
+
if (Ve)
|
|
483
484
|
try {
|
|
484
|
-
|
|
485
|
+
Ln(localStorage.getItem(Ve) === "1");
|
|
485
486
|
} catch {
|
|
486
487
|
}
|
|
487
|
-
}, [
|
|
488
|
-
const
|
|
489
|
-
if (
|
|
488
|
+
}, [Ve]);
|
|
489
|
+
const Vt = (e) => {
|
|
490
|
+
if (Ln(e), !!Ve)
|
|
490
491
|
try {
|
|
491
|
-
e ? localStorage.setItem(
|
|
492
|
+
e ? localStorage.setItem(Ve, "1") : localStorage.removeItem(Ve);
|
|
492
493
|
} catch {
|
|
493
494
|
}
|
|
494
|
-
}, ce = !!de &&
|
|
495
|
+
}, ce = !!de && Pn && Le !== null, Bt = R(() => {
|
|
495
496
|
if (!de) return null;
|
|
496
|
-
const e = ((
|
|
497
|
+
const e = ((j == null ? void 0 : j.relations) ?? []).find(
|
|
497
498
|
(t) => t.many_collection === de.collection && t.many_field === de.item_field && t.one_collection === y && !!t.one_field && !t.junction_field
|
|
498
499
|
);
|
|
499
500
|
return (e == null ? void 0 : e.one_field) ?? null;
|
|
500
|
-
}, [de,
|
|
501
|
-
() => ce &&
|
|
502
|
-
[ce,
|
|
503
|
-
),
|
|
504
|
-
const n = [t,
|
|
501
|
+
}, [de, j, y]), Dt = R(
|
|
502
|
+
() => ce && Bt && de && Le ? { [Bt]: { _some: { ...Le, [de.value_field]: { _gt: 0 } } } } : null,
|
|
503
|
+
[ce, Bt, de, Le]
|
|
504
|
+
), Ht = JSON.stringify(Dt), St = ce && !Dt ? 100 : 25, Yt = (e, t) => {
|
|
505
|
+
const n = [t, Dt].filter(Boolean);
|
|
505
506
|
return n.length === 0 ? e : { ...e, filter: JSON.stringify(n.length === 1 ? n[0] : { _and: n }) };
|
|
506
|
-
},
|
|
507
|
+
}, Zt = ur().userId, _t = s.recent === !1 ? 0 : typeof s.recent == "object" && Number((nr = s.recent) == null ? void 0 : nr.days) || 30, Gt = ["user_created", "created_by", "creator"].find(
|
|
507
508
|
(e) => N.some((t) => t.field === e)
|
|
508
|
-
),
|
|
509
|
+
), rt = ["date_created", "created_at"].find(
|
|
509
510
|
(e) => N.some((t) => t.field === e)
|
|
510
|
-
), { data:
|
|
511
|
+
), { data: st = [] } = Q({
|
|
511
512
|
queryKey: [
|
|
512
513
|
"catalog-recent-picks",
|
|
513
514
|
i,
|
|
514
|
-
|
|
515
|
-
Yt,
|
|
515
|
+
s.item_field,
|
|
516
516
|
Zt,
|
|
517
|
-
|
|
518
|
-
|
|
517
|
+
Gt,
|
|
518
|
+
rt,
|
|
519
|
+
_t
|
|
519
520
|
],
|
|
520
521
|
queryFn: async () => {
|
|
521
|
-
const e = new Date(Date.now() -
|
|
522
|
-
|
|
523
|
-
const n = await
|
|
524
|
-
|
|
525
|
-
fields:
|
|
522
|
+
const e = new Date(Date.now() - _t * 864e5).toISOString(), t = { [Gt]: { _eq: Zt } };
|
|
523
|
+
rt && (t[rt] = { _gte: e });
|
|
524
|
+
const n = await w.request(
|
|
525
|
+
C(`/items/${i}`, {
|
|
526
|
+
fields: s.item_field,
|
|
526
527
|
filter: JSON.stringify(t),
|
|
527
528
|
limit: 500,
|
|
528
529
|
count: "false",
|
|
529
|
-
...
|
|
530
|
+
...rt ? { sort: `-${rt}` } : {}
|
|
530
531
|
})
|
|
531
532
|
).then((l) => l.data ?? []).catch(() => []), r = [];
|
|
532
533
|
for (const l of n) {
|
|
533
|
-
const o = l[
|
|
534
|
-
if (
|
|
534
|
+
const o = l[s.item_field], f = o != null && typeof o == "object" ? o.id : o;
|
|
535
|
+
if (f != null && f !== "" && !r.includes(String(f)) && r.push(String(f)), r.length >= 150) break;
|
|
535
536
|
}
|
|
536
537
|
return r;
|
|
537
538
|
},
|
|
538
|
-
enabled:
|
|
539
|
+
enabled: _t > 0 && !!Zt && !!Gt && !k,
|
|
539
540
|
staleTime: 5 * 6e4
|
|
540
|
-
}),
|
|
541
|
+
}), Fr = R(() => new Set(st), [st]), Xt = !!y && ye.trim().length > 0, { data: en = [], isFetching: Tr } = Q({
|
|
541
542
|
queryKey: [
|
|
542
543
|
"catalog-shown-search",
|
|
543
544
|
y,
|
|
544
|
-
|
|
545
|
+
U,
|
|
545
546
|
ye,
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
547
|
+
Qe,
|
|
548
|
+
Ht,
|
|
549
|
+
St
|
|
549
550
|
],
|
|
550
|
-
queryFn: () =>
|
|
551
|
-
|
|
551
|
+
queryFn: () => w.request(
|
|
552
|
+
C(
|
|
552
553
|
`/items/${y}`,
|
|
553
|
-
|
|
554
|
+
Yt({
|
|
554
555
|
search: ye,
|
|
555
|
-
search_fields:
|
|
556
|
+
search_fields: Qe.join(","),
|
|
556
557
|
search_rank: "1",
|
|
557
|
-
fields:
|
|
558
|
-
limit:
|
|
559
|
-
sort:
|
|
558
|
+
fields: U,
|
|
559
|
+
limit: St,
|
|
560
|
+
sort: Tn
|
|
560
561
|
})
|
|
561
562
|
)
|
|
562
563
|
).then((e) => e.data ?? []),
|
|
563
|
-
enabled:
|
|
564
|
+
enabled: Xt && Qe.length > 0,
|
|
564
565
|
staleTime: 3e4,
|
|
565
566
|
placeholderData: (e) => e
|
|
566
|
-
}),
|
|
567
|
+
}), qt = Rn.join(","), { data: En = [], isFetching: Rr } = Q({
|
|
567
568
|
queryKey: [
|
|
568
569
|
"catalog-full-search",
|
|
569
570
|
y,
|
|
570
|
-
|
|
571
|
+
U,
|
|
571
572
|
ye,
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
573
|
+
qt,
|
|
574
|
+
Ht,
|
|
575
|
+
St
|
|
575
576
|
],
|
|
576
|
-
queryFn: () =>
|
|
577
|
-
|
|
577
|
+
queryFn: () => w.request(
|
|
578
|
+
C(
|
|
578
579
|
`/items/${y}`,
|
|
579
|
-
|
|
580
|
+
Yt({
|
|
580
581
|
search: ye,
|
|
581
|
-
fields: [
|
|
582
|
-
limit:
|
|
583
|
-
sort:
|
|
582
|
+
fields: [U, qt].filter(Boolean).join(","),
|
|
583
|
+
limit: St,
|
|
584
|
+
sort: Tn
|
|
584
585
|
})
|
|
585
586
|
)
|
|
586
587
|
).then((e) => e.data ?? []),
|
|
587
|
-
enabled:
|
|
588
|
+
enabled: Xt,
|
|
588
589
|
staleTime: 3e4,
|
|
589
590
|
placeholderData: (e) => e
|
|
590
|
-
}),
|
|
591
|
+
}), Or = st.join(","), { data: Kn = [] } = Q({
|
|
591
592
|
queryKey: [
|
|
592
593
|
"catalog-recent-search",
|
|
593
594
|
y,
|
|
594
|
-
|
|
595
|
+
U,
|
|
595
596
|
ye,
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
597
|
+
qt,
|
|
598
|
+
Or,
|
|
599
|
+
Ht
|
|
599
600
|
],
|
|
600
|
-
queryFn: () =>
|
|
601
|
-
|
|
601
|
+
queryFn: () => w.request(
|
|
602
|
+
C(
|
|
602
603
|
`/items/${y}`,
|
|
603
|
-
|
|
604
|
+
Yt(
|
|
604
605
|
{
|
|
605
606
|
search: ye,
|
|
606
|
-
fields: [
|
|
607
|
+
fields: [U, qt].filter(Boolean).join(","),
|
|
607
608
|
limit: 10,
|
|
608
609
|
count: "false"
|
|
609
610
|
},
|
|
610
|
-
{ id: { _in:
|
|
611
|
+
{ id: { _in: st } }
|
|
611
612
|
)
|
|
612
613
|
)
|
|
613
614
|
).then((e) => e.data ?? []).catch(() => []),
|
|
614
|
-
enabled:
|
|
615
|
+
enabled: Xt && st.length > 0,
|
|
615
616
|
staleTime: 3e4,
|
|
616
617
|
placeholderData: (e) => e
|
|
617
|
-
}),
|
|
618
|
-
() =>
|
|
619
|
-
shown:
|
|
620
|
-
other:
|
|
621
|
-
recent:
|
|
622
|
-
shownFields:
|
|
618
|
+
}), tn = Tr || Rr, Be = R(
|
|
619
|
+
() => Ls({
|
|
620
|
+
shown: en,
|
|
621
|
+
other: En,
|
|
622
|
+
recent: Kn,
|
|
623
|
+
shownFields: Qe,
|
|
623
624
|
q: ye
|
|
624
625
|
}),
|
|
625
|
-
[
|
|
626
|
-
),
|
|
627
|
-
if (
|
|
628
|
-
const t =
|
|
629
|
-
for (const n of
|
|
626
|
+
[en, En, Kn, Qe, ye]
|
|
627
|
+
), Pr = (e) => {
|
|
628
|
+
if (Qe.length === 0 || en.some((n) => String(n.id) === String(e.id)) || Es(e, Qe, ye)) return null;
|
|
629
|
+
const t = hs(ye);
|
|
630
|
+
for (const n of Rn) {
|
|
630
631
|
const r = e[n];
|
|
631
632
|
if (r == null || typeof r == "object") continue;
|
|
632
633
|
const l = String(r);
|
|
633
|
-
if (t.some((o) =>
|
|
634
|
-
return `${
|
|
634
|
+
if (t.some((o) => bs(l, o)))
|
|
635
|
+
return `${Z(n)}: ${l.length > 40 ? `${l.slice(0, 40)}…` : l}`;
|
|
635
636
|
}
|
|
636
637
|
return null;
|
|
637
|
-
},
|
|
638
|
+
}, An = R(
|
|
639
|
+
() => [.../* @__PURE__ */ new Set(["id", ...Object.values(s.copy_fields ?? {})])].join(","),
|
|
640
|
+
[s.copy_fields]
|
|
641
|
+
), at = R(
|
|
642
|
+
() => T ? [] : Me.map((e) => e[s.item_field]).filter((e) => e != null && e !== "").map(String),
|
|
643
|
+
[T, Me, s.item_field]
|
|
644
|
+
), { data: Cn = [] } = Q({
|
|
645
|
+
queryKey: ["catalog-line-sources", y, An, at.join(",")],
|
|
646
|
+
queryFn: async () => {
|
|
647
|
+
const e = [];
|
|
648
|
+
for (let t = 0; t < at.length; t += 200) {
|
|
649
|
+
const n = at.slice(t, t + 200), r = await w.request(
|
|
650
|
+
C(`/items/${y}`, {
|
|
651
|
+
filter: JSON.stringify({ id: { _in: n } }),
|
|
652
|
+
fields: An,
|
|
653
|
+
limit: n.length
|
|
654
|
+
})
|
|
655
|
+
).then((l) => l.data ?? []);
|
|
656
|
+
e.push(...r);
|
|
657
|
+
}
|
|
658
|
+
return e;
|
|
659
|
+
},
|
|
660
|
+
enabled: !k && !!y && at.length > 0 && Object.keys(s.copy_fields ?? {}).length > 0,
|
|
661
|
+
staleTime: 6e4
|
|
662
|
+
}), Lr = R(
|
|
663
|
+
() => new Map(Cn.map((e) => [String(e.id).toUpperCase(), e])),
|
|
664
|
+
[Cn]
|
|
665
|
+
), De = R(() => {
|
|
638
666
|
const e = /* @__PURE__ */ new Set();
|
|
639
667
|
for (const t of oe) e.add(String(t.id));
|
|
640
|
-
for (const t of
|
|
641
|
-
for (const t of
|
|
642
|
-
for (const t of
|
|
668
|
+
for (const t of Ne) e.add(t.key);
|
|
669
|
+
for (const t of Pe) e.add(t);
|
|
670
|
+
for (const t of Be) e.add(String(t.id));
|
|
643
671
|
return [...e];
|
|
644
|
-
}, [oe,
|
|
645
|
-
queries: (
|
|
646
|
-
const t =
|
|
672
|
+
}, [oe, Ne, Pe, Be]), it = xn({
|
|
673
|
+
queries: (s.related_columns ?? []).map((e) => {
|
|
674
|
+
const t = Ge(e.match, S);
|
|
647
675
|
return {
|
|
648
676
|
queryKey: [
|
|
649
677
|
"catalog-related",
|
|
650
678
|
e.key,
|
|
651
679
|
e.collection,
|
|
652
680
|
JSON.stringify(t),
|
|
653
|
-
|
|
681
|
+
De.join(",")
|
|
654
682
|
],
|
|
655
683
|
queryFn: async () => {
|
|
656
684
|
const n = {};
|
|
657
|
-
if (e.count_all && e.aggregate === "sum" &&
|
|
685
|
+
if (e.count_all && e.aggregate === "sum" && g && _) {
|
|
658
686
|
const o = {};
|
|
659
|
-
if (
|
|
660
|
-
for (const
|
|
661
|
-
o[
|
|
662
|
-
for (let
|
|
663
|
-
const c =
|
|
664
|
-
|
|
665
|
-
collection:
|
|
687
|
+
if (T)
|
|
688
|
+
for (const f of wn(e.match))
|
|
689
|
+
o[f] = (S == null ? void 0 : S[f]) ?? null;
|
|
690
|
+
for (let f = 0; f < De.length; f += 200) {
|
|
691
|
+
const c = De.slice(f, f + 200), h = await w.request(
|
|
692
|
+
C("/catalog-related/count-all", {
|
|
693
|
+
collection: g,
|
|
666
694
|
field: _,
|
|
667
695
|
key: e.key,
|
|
668
|
-
record:
|
|
669
|
-
...
|
|
696
|
+
record: T ? "new" : p,
|
|
697
|
+
...T ? { parent: JSON.stringify(o) } : {},
|
|
670
698
|
ids: c.join(",")
|
|
671
699
|
})
|
|
672
700
|
);
|
|
673
|
-
Object.assign(n,
|
|
701
|
+
Object.assign(n, h.data ?? {});
|
|
674
702
|
}
|
|
675
703
|
return n;
|
|
676
704
|
}
|
|
677
705
|
const r = e.aggregate === "sum", l = r ? 150 : 400;
|
|
678
|
-
for (let o = 0; o <
|
|
679
|
-
const
|
|
706
|
+
for (let o = 0; o < De.length; o += l) {
|
|
707
|
+
const f = De.slice(o, o + l);
|
|
680
708
|
let c = 1;
|
|
681
709
|
for (; ; ) {
|
|
682
|
-
const
|
|
683
|
-
|
|
684
|
-
limit: r ? 1e3 :
|
|
710
|
+
const h = await w.request(
|
|
711
|
+
C(`/items/${e.collection}`, {
|
|
712
|
+
limit: r ? 1e3 : f.length,
|
|
685
713
|
...r ? { page: c } : {},
|
|
686
714
|
fields: `${e.item_field},${e.value_field}`,
|
|
687
|
-
filter: JSON.stringify({ ...t, [e.item_field]: { _in:
|
|
715
|
+
filter: JSON.stringify({ ...t, [e.item_field]: { _in: f } })
|
|
688
716
|
})
|
|
689
717
|
).then((b) => b.data ?? []);
|
|
690
|
-
for (const b of
|
|
718
|
+
for (const b of h) {
|
|
691
719
|
const q = b[e.item_field];
|
|
692
720
|
if (q != null)
|
|
693
721
|
if (r) {
|
|
694
|
-
const
|
|
695
|
-
n[String(q)] = (Number(n[String(q)]) || 0) + (Number.isNaN(
|
|
722
|
+
const $ = Number(b[e.value_field]);
|
|
723
|
+
n[String(q)] = (Number(n[String(q)]) || 0) + (Number.isNaN($) ? 0 : $);
|
|
696
724
|
} else
|
|
697
725
|
n[String(q)] = b[e.value_field];
|
|
698
726
|
}
|
|
699
|
-
if (!r ||
|
|
727
|
+
if (!r || h.length < 1e3) break;
|
|
700
728
|
c += 1;
|
|
701
729
|
}
|
|
702
730
|
}
|
|
703
731
|
return n;
|
|
704
732
|
},
|
|
705
|
-
enabled: !!y && t !== null &&
|
|
733
|
+
enabled: !!y && t !== null && De.length > 0,
|
|
706
734
|
staleTime: 3e4
|
|
707
735
|
};
|
|
708
736
|
})
|
|
709
|
-
}),
|
|
737
|
+
}), lt = (e, t) => {
|
|
710
738
|
var r, l;
|
|
711
|
-
const n = (
|
|
739
|
+
const n = (s.related_columns ?? []).findIndex((o) => o.key === e);
|
|
712
740
|
if (n !== -1)
|
|
713
|
-
return (l = (r =
|
|
714
|
-
},
|
|
715
|
-
if (!ce ||
|
|
716
|
-
const t = Number(
|
|
741
|
+
return (l = (r = it[n]) == null ? void 0 : r.data) == null ? void 0 : l[t];
|
|
742
|
+
}, ot = We === -1 || (rr = it[We]) == null ? void 0 : rr.data, Er = ce && !!((sr = it[We]) != null && sr.isFetching), Jn = (e) => {
|
|
743
|
+
if (!ce || ot === void 0) return !0;
|
|
744
|
+
const t = Number(ot[e]);
|
|
717
745
|
return Number.isFinite(t) && t > 0;
|
|
718
|
-
},
|
|
746
|
+
}, dt = ce ? Be.filter((e) => Jn(String(e.id))) : Be, nn = ce ? nt.filter((e) => Jn(String(e.id))) : nt, rn = (e) => {
|
|
719
747
|
var c;
|
|
720
|
-
const t =
|
|
748
|
+
const t = s.qty_warning;
|
|
721
749
|
if (!t) return null;
|
|
722
|
-
const n =
|
|
750
|
+
const n = qe(e) ?? 0;
|
|
723
751
|
if (n <= 0) return null;
|
|
724
|
-
const r = (
|
|
752
|
+
const r = (s.related_columns ?? []).findIndex((h) => h.key === t.column);
|
|
725
753
|
if (r === -1) return null;
|
|
726
|
-
const l = (c =
|
|
754
|
+
const l = (c = it[r]) == null ? void 0 : c.data;
|
|
727
755
|
if (l === void 0) return null;
|
|
728
|
-
const o = l[e],
|
|
729
|
-
return Number.isNaN(
|
|
730
|
-
},
|
|
731
|
-
const t =
|
|
756
|
+
const o = l[e], f = o == null || o === "" ? 0 : Number(o);
|
|
757
|
+
return Number.isNaN(f) ? null : n > f ? { available: f, qty: n } : null;
|
|
758
|
+
}, Kr = (e) => {
|
|
759
|
+
const t = s.row_flags ?? [];
|
|
732
760
|
if (t.length === 0) return [];
|
|
733
761
|
const n = [];
|
|
734
762
|
for (const r of t)
|
|
735
763
|
if (!(!(r != null && r.when) || !r.label))
|
|
736
764
|
try {
|
|
737
765
|
const l = r.when.replace(/\{\{\s*([A-Za-z_][A-Za-z0-9_.]*)\s*\}\}/g, "$1");
|
|
738
|
-
|
|
766
|
+
fs(l, e) && n.push(r.label);
|
|
739
767
|
} catch {
|
|
740
768
|
}
|
|
741
769
|
return n;
|
|
742
|
-
},
|
|
770
|
+
}, sn = s.qty_warning ? s.qty_warning.label ?? ((ar = (s.related_columns ?? []).find((e) => {
|
|
743
771
|
var t;
|
|
744
|
-
return e.key === ((t =
|
|
745
|
-
})) == null ? void 0 :
|
|
772
|
+
return e.key === ((t = s.qty_warning) == null ? void 0 : t.column);
|
|
773
|
+
})) == null ? void 0 : ar.label) ?? Z(s.qty_warning.column) : "", Ar = !!s.submission_errors, $t = R(
|
|
746
774
|
() => {
|
|
747
775
|
var e;
|
|
748
|
-
return typeof
|
|
776
|
+
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)) : [];
|
|
749
777
|
},
|
|
750
|
-
[
|
|
751
|
-
),
|
|
752
|
-
queryKey: ["erp-submissions",
|
|
753
|
-
queryFn: () =>
|
|
754
|
-
enabled:
|
|
778
|
+
[s.submission_errors]
|
|
779
|
+
), Cr = ps(6e4), { data: In } = Q({
|
|
780
|
+
queryKey: ["erp-submissions", g ?? "", String(p)],
|
|
781
|
+
queryFn: () => w.request(C(`/erp-submissions/${g}/${encodeURIComponent(p)}`)).then((e) => e.data ?? []),
|
|
782
|
+
enabled: Ar && !T && !!g,
|
|
755
783
|
staleTime: 15e3,
|
|
756
|
-
refetchInterval:
|
|
757
|
-
}),
|
|
758
|
-
const e = (
|
|
759
|
-
return !e || e.status !== "failed" ? null :
|
|
760
|
-
}, [
|
|
761
|
-
queryKey: ["catalog-suberr-idents", y,
|
|
784
|
+
refetchInterval: Cr
|
|
785
|
+
}), an = R(() => {
|
|
786
|
+
const e = (In ?? [])[0];
|
|
787
|
+
return !e || e.status !== "failed" ? null : ys(e.payload, e.last_error);
|
|
788
|
+
}, [In]), Jr = Ne.map((e) => e.key).join(","), { data: ln } = Q({
|
|
789
|
+
queryKey: ["catalog-suberr-idents", y, $t.join(","), Jr],
|
|
762
790
|
queryFn: async () => {
|
|
763
|
-
const e =
|
|
791
|
+
const e = Ne.map((n) => n.key);
|
|
764
792
|
if (e.length === 0) return {};
|
|
765
|
-
const t = await
|
|
766
|
-
|
|
793
|
+
const t = await w.request(
|
|
794
|
+
C(`/items/${y}`, {
|
|
767
795
|
limit: e.length,
|
|
768
|
-
fields: ["id",
|
|
796
|
+
fields: ["id", ...$t].join(","),
|
|
769
797
|
filter: JSON.stringify({ id: { _in: e } })
|
|
770
798
|
})
|
|
771
799
|
).then((n) => n.data ?? []);
|
|
772
800
|
return Object.fromEntries(t.map((n) => [String(n.id), n]));
|
|
773
801
|
},
|
|
774
|
-
enabled: !!y && !!
|
|
802
|
+
enabled: !!y && !!an && $t.length > 0 && Ne.length > 0,
|
|
775
803
|
staleTime: 6e4
|
|
776
|
-
}),
|
|
777
|
-
if (!
|
|
778
|
-
const t =
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
const l = (t == null ? void 0 : t[r]) ??
|
|
804
|
+
}), Ir = (e) => {
|
|
805
|
+
if (!an) return null;
|
|
806
|
+
const t = ln == null ? void 0 : ln[e], n = [
|
|
807
|
+
Pt(e),
|
|
808
|
+
...$t.map((r) => {
|
|
809
|
+
const l = (t == null ? void 0 : t[r]) ?? Ue(e)[r];
|
|
782
810
|
return l != null && l !== "" ? String(l) : null;
|
|
783
811
|
})
|
|
784
|
-
].filter((r) => !!r).map(
|
|
785
|
-
return
|
|
786
|
-
},
|
|
787
|
-
queries:
|
|
788
|
-
queryKey: ["catalog-summary-m2m", e.field, e.m2m.junction,
|
|
812
|
+
].filter((r) => !!r).map(gs);
|
|
813
|
+
return an.reasonFor(n);
|
|
814
|
+
}, jt = s.summary_fields ?? [], Qr = we.map((e) => String(e.id)).join(","), zr = xn({
|
|
815
|
+
queries: jt.filter((e) => e.m2m).map((e) => ({
|
|
816
|
+
queryKey: ["catalog-summary-m2m", e.field, e.m2m.junction, Qr],
|
|
789
817
|
queryFn: async () => {
|
|
790
818
|
const t = we.map((b) => String(b.id));
|
|
791
819
|
if (t.length === 0) return {};
|
|
792
|
-
const n = e.m2m, r = await
|
|
793
|
-
|
|
820
|
+
const n = e.m2m, r = await w.request(
|
|
821
|
+
C(`/items/${n.junction}`, {
|
|
794
822
|
limit: 1e3,
|
|
795
823
|
fields: `${n.fk_to_child},${n.related_field}`,
|
|
796
824
|
filter: JSON.stringify({ [n.fk_to_child]: { _in: t } })
|
|
797
825
|
})
|
|
798
|
-
).then((b) => b.data ?? []).catch(() => []), l = [...new Set(r.map((b) => String(b[n.related_field])))], o = n.label_field ?? "name",
|
|
799
|
-
|
|
826
|
+
).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
|
+
C(`/items/${n.related_collection}`, {
|
|
800
828
|
limit: 500,
|
|
801
829
|
fields: `id,${o}`,
|
|
802
830
|
filter: JSON.stringify({ id: { _in: l } })
|
|
803
831
|
})
|
|
804
|
-
).then((b) => b.data ?? []).catch(() => []) : [], c = new Map(
|
|
832
|
+
).then((b) => b.data ?? []).catch(() => []) : [], c = new Map(f.map((b) => [String(b.id), String(b[o] ?? b.id)])), h = {};
|
|
805
833
|
for (const b of r) {
|
|
806
|
-
const q = String(b[n.fk_to_child]),
|
|
807
|
-
|
|
834
|
+
const q = String(b[n.fk_to_child]), $ = c.get(String(b[n.related_field]));
|
|
835
|
+
$ && (h[q] = h[q] ? `${h[q]}, ${$}` : $);
|
|
808
836
|
}
|
|
809
|
-
return
|
|
837
|
+
return h;
|
|
810
838
|
},
|
|
811
|
-
enabled: !
|
|
839
|
+
enabled: !T && we.length > 0,
|
|
812
840
|
staleTime: 15e3
|
|
813
841
|
}))
|
|
814
|
-
}),
|
|
842
|
+
}), Ur = (e, t) => {
|
|
815
843
|
var l, o;
|
|
816
844
|
if (!e.m2m) return t.row[e.field];
|
|
817
|
-
const n =
|
|
845
|
+
const n = jt.filter((f) => f.m2m).findIndex((f) => f.field === e.field);
|
|
818
846
|
if (n === -1) return;
|
|
819
847
|
const r = t.row.id;
|
|
820
848
|
if (r != null)
|
|
821
|
-
return (o = (l =
|
|
822
|
-
},
|
|
823
|
-
if (!
|
|
824
|
-
const t = Number(e[
|
|
849
|
+
return (o = (l = zr[n]) == null ? void 0 : l.data) == null ? void 0 : o[String(r)];
|
|
850
|
+
}, Mr = !!((ir = s.fulfilment) != null && ir.shipped_field) && (s.fulfilment.show_when ? hr(s.fulfilment.show_when, S) : !0), Wr = (e) => {
|
|
851
|
+
if (!Mr || !s.fulfilment) return null;
|
|
852
|
+
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 ? {
|
|
825
853
|
dot: "bg-emerald-500",
|
|
826
854
|
text: "text-emerald-700 dark:text-emerald-400",
|
|
827
855
|
label: "Shipped"
|
|
@@ -833,7 +861,7 @@ function ya({
|
|
|
833
861
|
dot: "bg-slate-300 dark:bg-slate-600",
|
|
834
862
|
text: "text-slate-500 dark:text-slate-400",
|
|
835
863
|
// The header's ORDER STATUS word for the same order (army 11 a2 F8).
|
|
836
|
-
label:
|
|
864
|
+
label: s.fulfilment.pending_label ?? "Order Sent",
|
|
837
865
|
key: "requested"
|
|
838
866
|
};
|
|
839
867
|
return /* @__PURE__ */ u(
|
|
@@ -841,14 +869,14 @@ function ya({
|
|
|
841
869
|
{
|
|
842
870
|
className: "inline-flex items-center gap-1.5 whitespace-nowrap",
|
|
843
871
|
"data-catalog-fulfilment": "key" in r ? r.key : r.label.split(" ")[0].toLowerCase(),
|
|
844
|
-
title: `${
|
|
872
|
+
title: `${s.fulfilment.label ?? "Warehouse"} · ${n} of ${t} shipped`,
|
|
845
873
|
children: [
|
|
846
|
-
/* @__PURE__ */
|
|
847
|
-
/* @__PURE__ */
|
|
874
|
+
/* @__PURE__ */ a("span", { "aria-hidden": !0, className: `h-1.5 w-1.5 rounded-full ${r.dot}` }),
|
|
875
|
+
/* @__PURE__ */ a("span", { className: `text-[11px] font-medium ${r.text}`, children: r.label })
|
|
848
876
|
]
|
|
849
877
|
}
|
|
850
878
|
);
|
|
851
|
-
},
|
|
879
|
+
}, Qn = s.columns ?? [], zn = s.related_columns ?? [], Ft = Qn.filter((e) => !e.summary_only), on = zn.filter((e) => !e.summary_only), Un = Qn.filter((e) => !e.sections_only), Mn = zn.filter((e) => !e.sections_only), Wn = Ft.length > 0 || on.length > 0, dn = je(null), Vn = (e) => {
|
|
852
880
|
let t = e.parentElement;
|
|
853
881
|
for (; t; ) {
|
|
854
882
|
const n = getComputedStyle(t);
|
|
@@ -858,101 +886,101 @@ function ya({
|
|
|
858
886
|
}
|
|
859
887
|
t = t.parentElement;
|
|
860
888
|
}
|
|
861
|
-
},
|
|
862
|
-
|
|
889
|
+
}, Vr = (e) => {
|
|
890
|
+
dn.current = e, e && Vn(e);
|
|
863
891
|
};
|
|
864
|
-
|
|
892
|
+
Fe(() => {
|
|
865
893
|
let e = 0;
|
|
866
894
|
const t = () => {
|
|
867
895
|
e || (e = requestAnimationFrame(() => {
|
|
868
|
-
e = 0,
|
|
896
|
+
e = 0, dn.current && Vn(dn.current);
|
|
869
897
|
}));
|
|
870
898
|
};
|
|
871
899
|
return window.addEventListener("scroll", t, !0), () => {
|
|
872
900
|
e && cancelAnimationFrame(e), window.removeEventListener("scroll", t, !0);
|
|
873
901
|
};
|
|
874
902
|
}, []);
|
|
875
|
-
const
|
|
903
|
+
const Tt = (e, t) => {
|
|
876
904
|
let n = e;
|
|
877
905
|
for (const r of t.split(".")) {
|
|
878
906
|
if (n == null || typeof n != "object") return;
|
|
879
907
|
n = n[r];
|
|
880
908
|
}
|
|
881
909
|
return n;
|
|
882
|
-
},
|
|
910
|
+
}, ve = (e, t) => {
|
|
883
911
|
if (t === "presence")
|
|
884
912
|
return e == null || e === "" || Number(e) === 0 ? "No" : "Yes";
|
|
885
913
|
if (e == null || e === "") return "—";
|
|
886
914
|
const n = Number(e);
|
|
887
915
|
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);
|
|
888
|
-
},
|
|
889
|
-
const n =
|
|
916
|
+
}, Rt = y ? `${y}:${i}.${m}` : null, Ke = pr(Rt && `${Rt}:catalog`), Oe = pr(Rt && `${Rt}:summary`), Bn = je(null), Br = (e, t) => {
|
|
917
|
+
const n = Ss(Bn.current, t);
|
|
890
918
|
n != null && e.setWidth(t, n);
|
|
891
|
-
},
|
|
919
|
+
}, Ot = (e, t, n, r, l) => {
|
|
892
920
|
const o = e.box(t, r, l);
|
|
893
921
|
return /* @__PURE__ */ u("span", { ...o, className: W("relative", o.className), children: [
|
|
894
|
-
/* @__PURE__ */
|
|
895
|
-
/* @__PURE__ */
|
|
896
|
-
|
|
922
|
+
/* @__PURE__ */ a("span", { "data-cpf-fit": !0, className: "block truncate", children: n }),
|
|
923
|
+
/* @__PURE__ */ a(
|
|
924
|
+
vs,
|
|
897
925
|
{
|
|
898
926
|
label: n,
|
|
899
|
-
onResize: (
|
|
900
|
-
onFit: () =>
|
|
927
|
+
onResize: (f) => e.setWidth(t, f),
|
|
928
|
+
onFit: () => Br(e, t)
|
|
901
929
|
}
|
|
902
930
|
)
|
|
903
931
|
] }, t);
|
|
904
|
-
},
|
|
905
|
-
|
|
906
|
-
const [l, o] =
|
|
907
|
-
return /* @__PURE__ */
|
|
908
|
-
|
|
932
|
+
}, Dr = (lr = Ft.find((e) => !e.format)) == null ? void 0 : lr.field, Dn = (e) => e.format ? ["w-20 shrink-0", "text-right"] : e.field === Dr ? ["min-w-0 flex-[3]", ""] : ["w-36 shrink-0", ""], cn = (e, t, n) => /* @__PURE__ */ u(Se, { children: [
|
|
933
|
+
Ft.map((r) => {
|
|
934
|
+
const [l, o] = Dn(r);
|
|
935
|
+
return /* @__PURE__ */ a(
|
|
936
|
+
br,
|
|
909
937
|
{
|
|
910
|
-
text:
|
|
911
|
-
|
|
938
|
+
text: ve(
|
|
939
|
+
Ys({
|
|
912
940
|
field: r.field,
|
|
913
|
-
catalogValue:
|
|
914
|
-
copyFields:
|
|
915
|
-
related:
|
|
916
|
-
lookup: (
|
|
941
|
+
catalogValue: Tt(t, r.field),
|
|
942
|
+
copyFields: s.copy_fields,
|
|
943
|
+
related: s.related_columns,
|
|
944
|
+
lookup: (f) => lt(f, e)
|
|
917
945
|
}),
|
|
918
946
|
r.format
|
|
919
947
|
),
|
|
920
948
|
highlight: r.format ? void 0 : n,
|
|
921
|
-
...
|
|
949
|
+
...Ke.box(r.field, l, W("text-slate-500 dark:text-slate-400", o))
|
|
922
950
|
},
|
|
923
951
|
r.field
|
|
924
952
|
);
|
|
925
953
|
}),
|
|
926
|
-
|
|
954
|
+
on.map((r) => /* @__PURE__ */ a(
|
|
927
955
|
"span",
|
|
928
956
|
{
|
|
929
|
-
...
|
|
957
|
+
...Ke.box(
|
|
930
958
|
`rel:${r.key}`,
|
|
931
959
|
"w-20 shrink-0",
|
|
932
960
|
"truncate text-right text-slate-500 dark:text-slate-400"
|
|
933
961
|
),
|
|
934
|
-
children:
|
|
962
|
+
children: ve(lt(r.key, e), r.format)
|
|
935
963
|
},
|
|
936
964
|
r.key
|
|
937
965
|
)),
|
|
938
|
-
/* @__PURE__ */
|
|
939
|
-
] }),
|
|
966
|
+
/* @__PURE__ */ a("span", { "aria-hidden": !0, className: "ml-auto" })
|
|
967
|
+
] }), Hr = yr(y), Hn = (e, t, n, r, l) => Hr ? /* @__PURE__ */ a(
|
|
940
968
|
"button",
|
|
941
969
|
{
|
|
942
970
|
type: "button",
|
|
943
971
|
"data-cpf-fit": r || void 0,
|
|
944
|
-
onClick: () => y &&
|
|
972
|
+
onClick: () => y && gr(y, e, S),
|
|
945
973
|
title: "View stock & planning detail",
|
|
946
974
|
className: W(
|
|
947
975
|
n,
|
|
948
976
|
"text-left underline decoration-slate-300 decoration-1 underline-offset-2 hover:text-[#009abe] hover:decoration-[#009abe] dark:decoration-slate-600"
|
|
949
977
|
),
|
|
950
|
-
children: l ? /* @__PURE__ */
|
|
978
|
+
children: l ? /* @__PURE__ */ a(gn, { text: t, query: l }) : t
|
|
951
979
|
}
|
|
952
|
-
) : /* @__PURE__ */
|
|
953
|
-
const l =
|
|
980
|
+
) : /* @__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 = Ke.box("item", Wn ? "w-36 shrink-0" : "min-w-0 flex-1");
|
|
954
982
|
return /* @__PURE__ */ u("span", { ...l, className: W("flex min-w-0 items-center gap-1.5", l.className), children: [
|
|
955
|
-
|
|
983
|
+
Hn(
|
|
956
984
|
e,
|
|
957
985
|
t,
|
|
958
986
|
"min-w-0 truncate text-slate-700 dark:text-slate-200",
|
|
@@ -961,42 +989,42 @@ function ya({
|
|
|
961
989
|
),
|
|
962
990
|
n
|
|
963
991
|
] });
|
|
964
|
-
},
|
|
965
|
-
const t =
|
|
966
|
-
return t ?
|
|
967
|
-
},
|
|
968
|
-
|
|
969
|
-
const
|
|
970
|
-
|
|
971
|
-
() =>
|
|
972
|
-
const t =
|
|
992
|
+
}, Pt = (e) => {
|
|
993
|
+
const t = yt.get(e) ?? Ut.find((n) => String(n.id) === e) ?? nt.find((n) => String(n.id) === e);
|
|
994
|
+
return t ? Ce(K, t) : `#${e}`;
|
|
995
|
+
}, Yn = je(Pt);
|
|
996
|
+
Yn.current = Pt;
|
|
997
|
+
const Zn = je(we);
|
|
998
|
+
Zn.current = we, Fe(
|
|
999
|
+
() => xs(i, (e) => {
|
|
1000
|
+
const t = Zn.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;
|
|
973
1001
|
if (r == null || r === "") return null;
|
|
974
|
-
const l =
|
|
1002
|
+
const l = Yn.current(String(r));
|
|
975
1003
|
return l.startsWith("#") ? null : l;
|
|
976
1004
|
}),
|
|
977
|
-
[i,
|
|
1005
|
+
[i, s.item_field]
|
|
978
1006
|
);
|
|
979
|
-
const
|
|
1007
|
+
const Ue = (e) => yt.get(e) ?? Ut.find((t) => String(t.id) === e) ?? nt.find((t) => String(t.id) === e) ?? { id: e }, qe = (e) => {
|
|
980
1008
|
var r;
|
|
981
|
-
const t =
|
|
982
|
-
if (t) return
|
|
983
|
-
const n =
|
|
984
|
-
return n === void 0 ? null : Number(((r =
|
|
985
|
-
},
|
|
1009
|
+
const t = T ? void 0 : tt.get(e);
|
|
1010
|
+
if (t) return kt.has(String(t.id)) ? null : Number(t[z] ?? 0);
|
|
1011
|
+
const n = wt.get(e);
|
|
1012
|
+
return n === void 0 ? null : Number(((r = Re[n]) == null ? void 0 : r[z]) ?? 0);
|
|
1013
|
+
}, Yr = (e) => {
|
|
986
1014
|
let t = e;
|
|
987
|
-
for (const n of
|
|
1015
|
+
for (const n of s.section_by.split(".")) {
|
|
988
1016
|
if (t == null || typeof t != "object") return "";
|
|
989
1017
|
t = t[n];
|
|
990
1018
|
}
|
|
991
1019
|
return String(t ?? "").trim();
|
|
992
|
-
},
|
|
993
|
-
if (
|
|
994
|
-
|
|
1020
|
+
}, Lt = R(() => {
|
|
1021
|
+
if (xt) return [];
|
|
1022
|
+
V.trim().toLowerCase();
|
|
995
1023
|
const e = /* @__PURE__ */ new Map();
|
|
996
1024
|
for (const t of oe) {
|
|
997
|
-
if (ce &&
|
|
998
|
-
const n =
|
|
999
|
-
if (!(
|
|
1025
|
+
if (ce && ot !== void 0 && !(Number(ot[String(t.id)]) > 0)) continue;
|
|
1026
|
+
const n = Ce(K, t), r = A ? Sn.get(String(t.id)) ?? [] : [Yr(t)];
|
|
1027
|
+
if (!(A && Y && r.length === 0))
|
|
1000
1028
|
for (const l of r.length ? r : [""]) {
|
|
1001
1029
|
const o = l || "Uncategorized";
|
|
1002
1030
|
e.has(o) || e.set(o, []), e.get(o).push({ id: String(t.id), label: n, row: t });
|
|
@@ -1010,40 +1038,40 @@ function ya({
|
|
|
1010
1038
|
}));
|
|
1011
1039
|
}, [
|
|
1012
1040
|
oe,
|
|
1013
|
-
A,
|
|
1014
|
-
U,
|
|
1015
|
-
a.section_by,
|
|
1016
1041
|
K,
|
|
1017
|
-
|
|
1018
|
-
|
|
1042
|
+
V,
|
|
1043
|
+
s.section_by,
|
|
1044
|
+
A,
|
|
1045
|
+
Sn,
|
|
1046
|
+
xt,
|
|
1019
1047
|
Y,
|
|
1020
1048
|
ce,
|
|
1021
|
-
|
|
1049
|
+
ot
|
|
1022
1050
|
]);
|
|
1023
|
-
if (!ke.current &&
|
|
1051
|
+
if (!ke.current && Lt.length > 0) {
|
|
1024
1052
|
ke.current = !0;
|
|
1025
1053
|
const e = /* @__PURE__ */ new Set();
|
|
1026
|
-
for (const t of
|
|
1027
|
-
t.items.some((r) => (
|
|
1054
|
+
for (const t of Lt)
|
|
1055
|
+
t.items.some((r) => (qe(r.id) ?? 0) > 0) || e.add(t.name);
|
|
1028
1056
|
ge(e);
|
|
1029
1057
|
}
|
|
1030
|
-
async function
|
|
1058
|
+
async function Zr(e) {
|
|
1031
1059
|
const t = {};
|
|
1032
|
-
for (const n of
|
|
1060
|
+
for (const n of s.related_columns ?? []) {
|
|
1033
1061
|
if (!n.copy_to) continue;
|
|
1034
|
-
let r =
|
|
1062
|
+
let r = lt(n.key, e);
|
|
1035
1063
|
if (r === void 0) {
|
|
1036
|
-
const l =
|
|
1064
|
+
const l = Ge(n.match, S);
|
|
1037
1065
|
if (l === null) continue;
|
|
1038
|
-
r = await
|
|
1039
|
-
|
|
1066
|
+
r = await w.request(
|
|
1067
|
+
C(`/items/${n.collection}`, {
|
|
1040
1068
|
limit: 1,
|
|
1041
1069
|
fields: `${n.item_field},${n.value_field}`,
|
|
1042
1070
|
filter: JSON.stringify({ ...l, [n.item_field]: { _eq: e } })
|
|
1043
1071
|
})
|
|
1044
1072
|
).then((o) => {
|
|
1045
|
-
var
|
|
1046
|
-
return (c = (
|
|
1073
|
+
var f, c;
|
|
1074
|
+
return (c = (f = o.data) == null ? void 0 : f[0]) == null ? void 0 : c[n.value_field];
|
|
1047
1075
|
}).catch(() => {
|
|
1048
1076
|
});
|
|
1049
1077
|
}
|
|
@@ -1051,263 +1079,299 @@ function ya({
|
|
|
1051
1079
|
}
|
|
1052
1080
|
return t;
|
|
1053
1081
|
}
|
|
1054
|
-
const
|
|
1055
|
-
var
|
|
1056
|
-
for (const
|
|
1057
|
-
if (
|
|
1058
|
-
const
|
|
1059
|
-
if (
|
|
1082
|
+
const mn = (e, t) => {
|
|
1083
|
+
var l;
|
|
1084
|
+
for (const o of s.related_columns ?? []) {
|
|
1085
|
+
if (o.copy_to !== t) continue;
|
|
1086
|
+
const f = lt(o.key, e);
|
|
1087
|
+
if (f != null && f !== "") return f;
|
|
1060
1088
|
}
|
|
1061
|
-
const n = (
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1089
|
+
const n = (l = s.copy_fields) == null ? void 0 : l[t];
|
|
1090
|
+
if (!n) return;
|
|
1091
|
+
const r = Lr.get(e.toUpperCase());
|
|
1092
|
+
return r && n in r ? r[n] : Ue(e)[n];
|
|
1093
|
+
}, Gn = je(/* @__PURE__ */ new Map()), ct = R(() => {
|
|
1094
|
+
const e = new Set(Object.keys(s.copy_fields ?? {}));
|
|
1095
|
+
for (const t of s.related_columns ?? []) t.copy_to && e.add(t.copy_to);
|
|
1066
1096
|
return [...e];
|
|
1067
|
-
}, [
|
|
1068
|
-
|
|
1069
|
-
|
|
1097
|
+
}, [s.copy_fields, s.related_columns]), fn = ct.filter(
|
|
1098
|
+
(e) => {
|
|
1099
|
+
var t;
|
|
1100
|
+
return !(e in (s.compute_fields ?? {})) && (((t = s.field_formats) == null ? void 0 : t[e]) === "currency" || /(^|_)price$/i.test(e));
|
|
1101
|
+
}
|
|
1102
|
+
), Gr = (e, t) => fn.map((n) => {
|
|
1103
|
+
const r = Ps(e[n], mn(t, n));
|
|
1104
|
+
return r ? { field: n, change: r } : null;
|
|
1105
|
+
}).filter((n) => !!n), pn = R(() => {
|
|
1106
|
+
const e = (s.related_columns ?? []).find((t) => {
|
|
1107
|
+
var n;
|
|
1108
|
+
return t.key === ((n = s.qty_warning) == null ? void 0 : n.column);
|
|
1109
|
+
});
|
|
1110
|
+
for (const t of Object.values((e == null ? void 0 : e.match) ?? {})) {
|
|
1111
|
+
const n = t && typeof t == "object" ? t._eq : t;
|
|
1112
|
+
if (typeof n == "string" && n.startsWith("$parent.")) return n.slice(8);
|
|
1113
|
+
}
|
|
1114
|
+
return null;
|
|
1115
|
+
}, [s.related_columns, (or = s.qty_warning) == null ? void 0 : or.column]), Xr = Fs(
|
|
1116
|
+
k ? null : g,
|
|
1117
|
+
pn,
|
|
1118
|
+
pn ? S == null ? void 0 : S[pn] : null
|
|
1119
|
+
);
|
|
1120
|
+
Ts({
|
|
1121
|
+
enabled: !k && Ne.length > 0,
|
|
1122
|
+
catalogCol: y,
|
|
1123
|
+
pickedIds: at,
|
|
1124
|
+
related: (s.related_columns ?? []).filter(
|
|
1125
|
+
(e, t) => {
|
|
1126
|
+
var n;
|
|
1127
|
+
return t === We || e.key === ((n = s.qty_warning) == null ? void 0 : n.column) || !!e.copy_to && fn.includes(e.copy_to);
|
|
1128
|
+
}
|
|
1129
|
+
).map((e) => ({ key: e.key, collection: e.collection }))
|
|
1130
|
+
});
|
|
1131
|
+
const es = JSON.stringify([
|
|
1132
|
+
Re.map((e) => [e[s.item_field], ...ct.map((t) => e[t] ?? null)]),
|
|
1133
|
+
it.map((e) => e.dataUpdatedAt),
|
|
1070
1134
|
oe.length,
|
|
1071
|
-
|
|
1135
|
+
Ut.length
|
|
1072
1136
|
]);
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
const n = e[
|
|
1137
|
+
Fe(() => {
|
|
1138
|
+
k || !v || ct.length === 0 || Re.forEach((e, t) => {
|
|
1139
|
+
const n = e[s.item_field];
|
|
1076
1140
|
if (n == null) return;
|
|
1077
|
-
const r =
|
|
1141
|
+
const r = Ms(
|
|
1078
1142
|
e,
|
|
1079
|
-
|
|
1080
|
-
(o) =>
|
|
1081
|
-
|
|
1143
|
+
ct,
|
|
1144
|
+
(o) => mn(String(n), o),
|
|
1145
|
+
Gn.current.get(String(n))
|
|
1082
1146
|
);
|
|
1083
1147
|
if (!r) return;
|
|
1084
|
-
|
|
1148
|
+
Gn.current.set(String(n), r.auto);
|
|
1085
1149
|
const l = { ...e, ...r.updates };
|
|
1086
|
-
for (const [o,
|
|
1087
|
-
const c = Ee(
|
|
1150
|
+
for (const [o, f] of Object.entries(s.compute_fields ?? {})) {
|
|
1151
|
+
const c = Ee(f, l);
|
|
1088
1152
|
c !== null && (l[o] = c);
|
|
1089
1153
|
}
|
|
1090
1154
|
v.updateRow(i, m, t, l);
|
|
1091
1155
|
});
|
|
1092
|
-
}, [
|
|
1093
|
-
const
|
|
1094
|
-
if (
|
|
1156
|
+
}, [es, k, ct]);
|
|
1157
|
+
const ts = (e, t) => {
|
|
1158
|
+
if (k || !M.includes(t)) return !1;
|
|
1095
1159
|
if (fe || !me.includes(t)) return !0;
|
|
1096
|
-
const n =
|
|
1160
|
+
const n = mn(e, t);
|
|
1097
1161
|
return n == null || n === "" || !(Number(n) > 0);
|
|
1098
1162
|
};
|
|
1099
|
-
function
|
|
1163
|
+
function He(e, t, n, r = {}) {
|
|
1100
1164
|
const l = {
|
|
1101
|
-
[
|
|
1102
|
-
[
|
|
1165
|
+
[s.item_field]: n.id ?? e,
|
|
1166
|
+
[z]: t
|
|
1103
1167
|
};
|
|
1104
|
-
for (const [o,
|
|
1105
|
-
n[
|
|
1168
|
+
for (const [o, f] of Object.entries(s.copy_fields ?? {}))
|
|
1169
|
+
n[f] !== void 0 && (l[o] = n[f]);
|
|
1106
1170
|
Object.assign(l, r);
|
|
1107
|
-
for (const [o,
|
|
1108
|
-
const c = Ee(
|
|
1171
|
+
for (const [o, f] of Object.entries(s.compute_fields ?? {})) {
|
|
1172
|
+
const c = Ee(f, l);
|
|
1109
1173
|
c !== null && (l[o] = c);
|
|
1110
1174
|
}
|
|
1111
1175
|
return l;
|
|
1112
1176
|
}
|
|
1113
|
-
function
|
|
1114
|
-
return
|
|
1115
|
-
compute:
|
|
1116
|
-
probe: { ...
|
|
1117
|
-
ruleError:
|
|
1177
|
+
function ns(e, t, n, r) {
|
|
1178
|
+
return Hs({
|
|
1179
|
+
compute: s.compute_fields ?? {},
|
|
1180
|
+
probe: { ...He(e, t, n), ...r, [z]: t },
|
|
1181
|
+
ruleError: P,
|
|
1118
1182
|
labelOf: (l) => {
|
|
1119
1183
|
var o;
|
|
1120
|
-
return ((o = N.find((
|
|
1184
|
+
return ((o = N.find((f) => f.field === l)) == null ? void 0 : o.label) || Z(l);
|
|
1121
1185
|
}
|
|
1122
1186
|
});
|
|
1123
1187
|
}
|
|
1124
|
-
async function
|
|
1125
|
-
const l =
|
|
1188
|
+
async function Ye(e, t, n, r = {}) {
|
|
1189
|
+
const l = kn(t, { type: E, min: 0, label: "Quantity" });
|
|
1126
1190
|
if (!l.ok) {
|
|
1127
|
-
se((
|
|
1191
|
+
se((h) => ({ ...h, [e]: { kind: "error", message: l.message } }));
|
|
1128
1192
|
return;
|
|
1129
1193
|
}
|
|
1130
1194
|
const o = l.value ?? 0;
|
|
1131
|
-
if ((
|
|
1195
|
+
if ((qe(e) ?? 0) === o) return;
|
|
1132
1196
|
if (o === 0 && !r.confirmedRemove) {
|
|
1133
|
-
se((
|
|
1197
|
+
se((h) => ({ ...h, [e]: { kind: "remove", row: n } }));
|
|
1134
1198
|
return;
|
|
1135
1199
|
}
|
|
1136
1200
|
if (o > 0) {
|
|
1137
|
-
const
|
|
1201
|
+
const h = wt.get(e), b = (T ? void 0 : tt.get(e)) ?? (h !== void 0 ? Re[h] : void 0) ?? {}, q = P(z, o, b) ?? ns(e, o, n, b);
|
|
1138
1202
|
if (q) {
|
|
1139
|
-
se((
|
|
1203
|
+
se(($) => ({ ...$, [e]: { kind: "error", message: q } }));
|
|
1140
1204
|
return;
|
|
1141
1205
|
}
|
|
1142
1206
|
}
|
|
1143
|
-
const c = o > 0 ? await
|
|
1144
|
-
if (
|
|
1145
|
-
const
|
|
1146
|
-
if ((
|
|
1147
|
-
const b = String(
|
|
1207
|
+
const c = o > 0 ? await Zr(e) : {};
|
|
1208
|
+
if (et && v) {
|
|
1209
|
+
const h = tt.get(e);
|
|
1210
|
+
if ((h == null ? void 0 : h.id) != null) {
|
|
1211
|
+
const b = String(h.id);
|
|
1148
1212
|
if (o === 0) {
|
|
1149
1213
|
v.cancelPendingEdit(i, m, b), v.queueDelete(i, m, b);
|
|
1150
1214
|
return;
|
|
1151
1215
|
}
|
|
1152
|
-
|
|
1153
|
-
const q =
|
|
1154
|
-
for (const
|
|
1155
|
-
|
|
1156
|
-
for (const [
|
|
1157
|
-
const
|
|
1158
|
-
|
|
1216
|
+
kt.has(b) && v.cancelPendingDelete(i, m, b);
|
|
1217
|
+
const q = He(e, o, n, c);
|
|
1218
|
+
for (const x of M)
|
|
1219
|
+
h[x] != null && h[x] !== "" && (q[x] = h[x]);
|
|
1220
|
+
for (const [x, I] of Object.entries(s.compute_fields ?? {})) {
|
|
1221
|
+
const $e = Ee(I, { ...h, ...q });
|
|
1222
|
+
$e !== null && (q[x] = $e);
|
|
1159
1223
|
}
|
|
1160
|
-
const
|
|
1161
|
-
Object.entries(q).filter(([
|
|
1224
|
+
const $ = we.find((x) => String(x.id) === b) ?? {}, J = Object.fromEntries(
|
|
1225
|
+
Object.entries(q).filter(([x, I]) => String(I ?? "") !== String($[x] ?? ""))
|
|
1162
1226
|
);
|
|
1163
|
-
Object.keys(
|
|
1227
|
+
Object.keys(J).length === 0 ? v.cancelPendingEdit(i, m, b) : (v.cancelPendingEdit(i, m, b), v.queueEdit(i, m, b, J));
|
|
1164
1228
|
return;
|
|
1165
1229
|
}
|
|
1166
1230
|
}
|
|
1167
|
-
if (
|
|
1168
|
-
const
|
|
1169
|
-
o === 0 ?
|
|
1231
|
+
if (T || et) {
|
|
1232
|
+
const h = wt.get(e);
|
|
1233
|
+
o === 0 ? h !== void 0 && (v == null || v.removeRow(i, m, h)) : h !== void 0 ? v == null || v.updateRow(
|
|
1170
1234
|
i,
|
|
1171
1235
|
m,
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1236
|
+
h,
|
|
1237
|
+
Ks(
|
|
1238
|
+
Re[h],
|
|
1239
|
+
He(e, o, n, c),
|
|
1176
1240
|
M,
|
|
1177
|
-
|
|
1241
|
+
s.compute_fields
|
|
1178
1242
|
)
|
|
1179
1243
|
) : v == null || v.queueRow(
|
|
1180
1244
|
i,
|
|
1181
1245
|
m,
|
|
1182
|
-
|
|
1246
|
+
He(e, o, n, c)
|
|
1183
1247
|
);
|
|
1184
1248
|
return;
|
|
1185
1249
|
}
|
|
1186
|
-
|
|
1250
|
+
G((h) => new Set(h).add(e));
|
|
1187
1251
|
try {
|
|
1188
|
-
const
|
|
1252
|
+
const h = tt.get(e);
|
|
1189
1253
|
if (o === 0)
|
|
1190
|
-
(
|
|
1191
|
-
else if ((
|
|
1192
|
-
const b =
|
|
1193
|
-
for (const
|
|
1194
|
-
|
|
1195
|
-
for (const [
|
|
1196
|
-
const
|
|
1197
|
-
|
|
1254
|
+
(h == null ? void 0 : h.id) != null && await w.request(ms(`/items/${i}/${h.id}${be}`));
|
|
1255
|
+
else if ((h == null ? void 0 : h.id) != null) {
|
|
1256
|
+
const b = He(e, o, n, c);
|
|
1257
|
+
for (const x of M)
|
|
1258
|
+
h[x] != null && h[x] !== "" && (b[x] = h[x]);
|
|
1259
|
+
for (const [x, I] of Object.entries(s.compute_fields ?? {})) {
|
|
1260
|
+
const $e = Ee(I, { ...h, ...b });
|
|
1261
|
+
$e !== null && (b[x] = $e);
|
|
1198
1262
|
}
|
|
1199
|
-
const q = { ...
|
|
1200
|
-
await
|
|
1263
|
+
const q = { ...h, ...b }, { id: $, ...J } = q;
|
|
1264
|
+
await w.request(mr(`/items/${i}/${h.id}${be}`, J));
|
|
1201
1265
|
} else
|
|
1202
|
-
await
|
|
1203
|
-
|
|
1204
|
-
[m]:
|
|
1205
|
-
...
|
|
1266
|
+
await w.request(
|
|
1267
|
+
fr(`/items/${i}${be}`, {
|
|
1268
|
+
[m]: p,
|
|
1269
|
+
...He(e, o, n, c)
|
|
1206
1270
|
})
|
|
1207
1271
|
);
|
|
1208
|
-
|
|
1272
|
+
O.invalidateQueries({ queryKey: ["o2m-rows", i, m, p] });
|
|
1209
1273
|
} catch {
|
|
1210
1274
|
} finally {
|
|
1211
|
-
|
|
1212
|
-
const b = new Set(
|
|
1275
|
+
G((h) => {
|
|
1276
|
+
const b = new Set(h);
|
|
1213
1277
|
return b.delete(e), b;
|
|
1214
1278
|
});
|
|
1215
1279
|
}
|
|
1216
1280
|
}
|
|
1217
|
-
async function
|
|
1281
|
+
async function Xn(e, t, n) {
|
|
1218
1282
|
const r = n.trim() === "" ? null : Number(n);
|
|
1219
1283
|
if (n.trim() !== "" && Number.isNaN(r)) return;
|
|
1220
|
-
const l = (
|
|
1221
|
-
const c = { ...
|
|
1222
|
-
for (const [
|
|
1284
|
+
const l = (f) => {
|
|
1285
|
+
const c = { ...f, [t]: r };
|
|
1286
|
+
for (const [h, b] of Object.entries(s.compute_fields ?? {})) {
|
|
1223
1287
|
const q = Ee(b, c);
|
|
1224
|
-
q !== null && (c[
|
|
1288
|
+
q !== null && (c[h] = q);
|
|
1225
1289
|
}
|
|
1226
1290
|
return c;
|
|
1227
|
-
}, o =
|
|
1291
|
+
}, o = T ? void 0 : tt.get(e);
|
|
1228
1292
|
if ((o == null ? void 0 : o.id) == null) {
|
|
1229
|
-
const
|
|
1230
|
-
if (
|
|
1231
|
-
v == null || v.updateRow(i, m,
|
|
1293
|
+
const f = wt.get(e);
|
|
1294
|
+
if (f === void 0) return;
|
|
1295
|
+
v == null || v.updateRow(i, m, f, l(Re[f]));
|
|
1232
1296
|
return;
|
|
1233
1297
|
}
|
|
1234
|
-
if (
|
|
1235
|
-
const
|
|
1236
|
-
Object.entries(
|
|
1298
|
+
if (et && v) {
|
|
1299
|
+
const f = l(o), c = we.find((b) => String(b.id) === String(o.id)) ?? {}, h = Object.fromEntries(
|
|
1300
|
+
Object.entries(f).filter(
|
|
1237
1301
|
([b, q]) => b !== "id" && String(q ?? "") !== String(c[b] ?? "")
|
|
1238
1302
|
)
|
|
1239
1303
|
);
|
|
1240
|
-
v.cancelPendingEdit(i, m, String(o.id)), Object.keys(
|
|
1304
|
+
v.cancelPendingEdit(i, m, String(o.id)), Object.keys(h).length > 0 && v.queueEdit(i, m, String(o.id), h);
|
|
1241
1305
|
return;
|
|
1242
1306
|
}
|
|
1243
|
-
|
|
1307
|
+
G((f) => new Set(f).add(e));
|
|
1244
1308
|
try {
|
|
1245
|
-
const { id:
|
|
1246
|
-
await
|
|
1309
|
+
const { id: f, ...c } = l(o);
|
|
1310
|
+
await w.request(mr(`/items/${i}/${o.id}${be}`, c)), O.invalidateQueries({ queryKey: ["o2m-rows", i, m, p] });
|
|
1247
1311
|
} catch {
|
|
1248
1312
|
} finally {
|
|
1249
|
-
|
|
1250
|
-
const c = new Set(
|
|
1313
|
+
G((f) => {
|
|
1314
|
+
const c = new Set(f);
|
|
1251
1315
|
return c.delete(e), c;
|
|
1252
1316
|
});
|
|
1253
1317
|
}
|
|
1254
1318
|
}
|
|
1255
|
-
async function
|
|
1319
|
+
async function rs(e) {
|
|
1256
1320
|
if (e == null || e === "" || !y) return;
|
|
1257
|
-
const t = String(e), n =
|
|
1321
|
+
const t = String(e), n = Ue(t);
|
|
1258
1322
|
let r = n;
|
|
1259
|
-
Object.keys(n).length <= 1 && (r = await
|
|
1260
|
-
|
|
1323
|
+
Object.keys(n).length <= 1 && (r = await w.request(
|
|
1324
|
+
C(`/items/${y}`, {
|
|
1261
1325
|
filter: JSON.stringify({ id: { _eq: e } }),
|
|
1262
|
-
fields:
|
|
1326
|
+
fields: U,
|
|
1263
1327
|
limit: 1
|
|
1264
1328
|
})
|
|
1265
1329
|
).then((o) => {
|
|
1266
|
-
var
|
|
1267
|
-
return ((
|
|
1330
|
+
var f;
|
|
1331
|
+
return ((f = o.data) == null ? void 0 : f[0]) ?? { id: e };
|
|
1268
1332
|
}).catch(() => ({ id: e })));
|
|
1269
|
-
const l = (
|
|
1270
|
-
await
|
|
1333
|
+
const l = (qe(t) ?? 0) + 1;
|
|
1334
|
+
await Ye(t, String(l), r);
|
|
1271
1335
|
}
|
|
1272
|
-
const
|
|
1273
|
-
const n =
|
|
1274
|
-
if (
|
|
1275
|
-
return /* @__PURE__ */
|
|
1276
|
-
const r = he[e], l = r !== void 0 ? r : n && n > 0 ? String(n) : "", o = B[e],
|
|
1277
|
-
if (!(e in
|
|
1278
|
-
const b = { ...
|
|
1336
|
+
const ss = Ne.length, Et = Object.keys(s.copy_fields ?? {}), Ze = Object.keys(s.compute_fields ?? {}), Kt = (e, t) => {
|
|
1337
|
+
const n = qe(e);
|
|
1338
|
+
if (k)
|
|
1339
|
+
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") : "—" });
|
|
1340
|
+
const r = he[e], l = r !== void 0 ? r : n && n > 0 ? String(n) : "", o = B[e], f = () => se((h) => {
|
|
1341
|
+
if (!(e in h)) return h;
|
|
1342
|
+
const b = { ...h };
|
|
1279
1343
|
return delete b[e], b;
|
|
1280
|
-
}), c = /* @__PURE__ */
|
|
1344
|
+
}), c = /* @__PURE__ */ a(
|
|
1281
1345
|
"input",
|
|
1282
1346
|
{
|
|
1283
1347
|
type: "number",
|
|
1284
1348
|
min: 0,
|
|
1285
|
-
step:
|
|
1286
|
-
disabled:
|
|
1349
|
+
step: mt(E) ? 1 : "any",
|
|
1350
|
+
disabled: k,
|
|
1287
1351
|
value: l,
|
|
1288
1352
|
placeholder: "0",
|
|
1289
1353
|
"aria-invalid": (o == null ? void 0 : o.kind) === "error" || void 0,
|
|
1290
|
-
onFocus:
|
|
1291
|
-
onChange: (
|
|
1292
|
-
onBlur: (
|
|
1293
|
-
const b =
|
|
1354
|
+
onFocus: f,
|
|
1355
|
+
onChange: (h) => re((b) => ({ ...b, [e]: h.target.value })),
|
|
1356
|
+
onBlur: (h) => {
|
|
1357
|
+
const b = h.target.value, q = Vs(b, E);
|
|
1294
1358
|
if (q) {
|
|
1295
|
-
re((
|
|
1296
|
-
const
|
|
1297
|
-
return delete
|
|
1298
|
-
}), se((
|
|
1299
|
-
|
|
1300
|
-
[e]: { kind: "error", message:
|
|
1359
|
+
re(($) => {
|
|
1360
|
+
const J = { ...$ };
|
|
1361
|
+
return delete J[e], J;
|
|
1362
|
+
}), se(($) => ({
|
|
1363
|
+
...$,
|
|
1364
|
+
[e]: { kind: "error", message: Ds(q, b) }
|
|
1301
1365
|
}));
|
|
1302
1366
|
return;
|
|
1303
1367
|
}
|
|
1304
|
-
re((
|
|
1305
|
-
const
|
|
1306
|
-
return delete
|
|
1307
|
-
}),
|
|
1368
|
+
re(($) => {
|
|
1369
|
+
const J = { ...$ };
|
|
1370
|
+
return delete J[e], J;
|
|
1371
|
+
}), Ye(e, b, t);
|
|
1308
1372
|
},
|
|
1309
|
-
onKeyDown: (
|
|
1310
|
-
|
|
1373
|
+
onKeyDown: (h) => {
|
|
1374
|
+
h.key === "Enter" && h.currentTarget.blur();
|
|
1311
1375
|
},
|
|
1312
1376
|
className: W(
|
|
1313
1377
|
"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",
|
|
@@ -1324,7 +1388,7 @@ function ya({
|
|
|
1324
1388
|
className: "mt-0.5 flex max-w-[220px] items-start gap-1 text-right text-[11px] leading-snug text-red-600 dark:text-red-400",
|
|
1325
1389
|
"data-catalog-qty-error": !0,
|
|
1326
1390
|
children: [
|
|
1327
|
-
/* @__PURE__ */
|
|
1391
|
+
/* @__PURE__ */ a(hn, { className: "mt-px h-3 w-3 shrink-0" }),
|
|
1328
1392
|
o.message,
|
|
1329
1393
|
n && n > 0 ? ` — still ${n.toLocaleString("en-US")}` : ""
|
|
1330
1394
|
]
|
|
@@ -1337,23 +1401,23 @@ function ya({
|
|
|
1337
1401
|
"data-catalog-qty-remove": !0,
|
|
1338
1402
|
className: "mt-1 flex max-w-[240px] flex-wrap items-center justify-end gap-1.5 text-right text-[11px] leading-snug text-slate-700 dark:text-slate-200",
|
|
1339
1403
|
children: [
|
|
1340
|
-
/* @__PURE__ */
|
|
1341
|
-
/* @__PURE__ */
|
|
1404
|
+
/* @__PURE__ */ a("span", { children: "Remove this line?" }),
|
|
1405
|
+
/* @__PURE__ */ a(
|
|
1342
1406
|
"button",
|
|
1343
1407
|
{
|
|
1344
1408
|
type: "button",
|
|
1345
|
-
onClick:
|
|
1409
|
+
onClick: f,
|
|
1346
1410
|
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",
|
|
1347
1411
|
children: "Keep"
|
|
1348
1412
|
}
|
|
1349
1413
|
),
|
|
1350
|
-
/* @__PURE__ */
|
|
1414
|
+
/* @__PURE__ */ a(
|
|
1351
1415
|
"button",
|
|
1352
1416
|
{
|
|
1353
1417
|
type: "button",
|
|
1354
1418
|
onClick: () => {
|
|
1355
|
-
const
|
|
1356
|
-
|
|
1419
|
+
const h = o.row;
|
|
1420
|
+
f(), Ye(e, "0", h, { confirmedRemove: !0 });
|
|
1357
1421
|
},
|
|
1358
1422
|
className: "h-6 rounded bg-red-600 px-2 text-[11px] font-medium text-white hover:bg-red-700",
|
|
1359
1423
|
children: "Remove"
|
|
@@ -1363,32 +1427,32 @@ function ya({
|
|
|
1363
1427
|
}
|
|
1364
1428
|
)
|
|
1365
1429
|
] });
|
|
1366
|
-
},
|
|
1367
|
-
const r = `${e}:${t}`, l = ie[r], o = () =>
|
|
1430
|
+
}, as = (e, t, n) => {
|
|
1431
|
+
const r = `${e}:${t}`, l = ie[r], o = () => _e((b) => {
|
|
1368
1432
|
if (!(r in b)) return b;
|
|
1369
1433
|
const q = { ...b };
|
|
1370
1434
|
return delete q[r], q;
|
|
1371
|
-
}),
|
|
1435
|
+
}), f = n[t] == null ? "" : String(n[t]), c = N.find((b) => b.field === t), h = !mt(c == null ? void 0 : c.type);
|
|
1372
1436
|
return /* @__PURE__ */ u("span", { className: "inline-flex shrink-0 flex-col items-end", children: [
|
|
1373
|
-
/* @__PURE__ */
|
|
1437
|
+
/* @__PURE__ */ a(
|
|
1374
1438
|
"input",
|
|
1375
1439
|
{
|
|
1376
1440
|
type: "number",
|
|
1377
1441
|
min: 0,
|
|
1378
|
-
step:
|
|
1379
|
-
defaultValue:
|
|
1442
|
+
step: h ? "0.01" : "any",
|
|
1443
|
+
defaultValue: f,
|
|
1380
1444
|
"aria-invalid": !!l || void 0,
|
|
1381
1445
|
onFocus: o,
|
|
1382
1446
|
onBlur: (b) => {
|
|
1383
1447
|
const q = b.target.value;
|
|
1384
|
-
if (q !==
|
|
1385
|
-
const
|
|
1386
|
-
if (
|
|
1387
|
-
b.target.value =
|
|
1448
|
+
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 ? As(q, J) : null) ?? P(t, x.value, n) : x.message;
|
|
1450
|
+
if (I) {
|
|
1451
|
+
b.target.value = f, _e(($e) => ({ ...$e, [r]: I }));
|
|
1388
1452
|
return;
|
|
1389
1453
|
}
|
|
1390
1454
|
}
|
|
1391
|
-
|
|
1455
|
+
Xn(e, t, q);
|
|
1392
1456
|
},
|
|
1393
1457
|
onKeyDown: (b) => {
|
|
1394
1458
|
b.key === "Enter" && b.currentTarget.blur();
|
|
@@ -1398,7 +1462,7 @@ function ya({
|
|
|
1398
1462
|
l && "border-red-400 dark:border-red-600"
|
|
1399
1463
|
)
|
|
1400
1464
|
},
|
|
1401
|
-
`${r}:${
|
|
1465
|
+
`${r}:${f}`
|
|
1402
1466
|
),
|
|
1403
1467
|
l && /* @__PURE__ */ u(
|
|
1404
1468
|
"span",
|
|
@@ -1407,27 +1471,27 @@ function ya({
|
|
|
1407
1471
|
className: "mt-0.5 flex max-w-[220px] items-start gap-1 text-right text-[11px] leading-snug text-red-600 dark:text-red-400",
|
|
1408
1472
|
"data-catalog-cell-error": !0,
|
|
1409
1473
|
children: [
|
|
1410
|
-
/* @__PURE__ */
|
|
1474
|
+
/* @__PURE__ */ a(hn, { className: "mt-px h-3 w-3 shrink-0" }),
|
|
1411
1475
|
l,
|
|
1412
|
-
|
|
1476
|
+
f !== "" ? ` — still ${f}` : ""
|
|
1413
1477
|
]
|
|
1414
1478
|
}
|
|
1415
1479
|
)
|
|
1416
1480
|
] }, r);
|
|
1417
1481
|
};
|
|
1418
1482
|
return !y && F ? /* @__PURE__ */ u("div", { className: "space-y-2 py-1", "aria-busy": "true", children: [
|
|
1419
|
-
/* @__PURE__ */
|
|
1420
|
-
/* @__PURE__ */
|
|
1421
|
-
] }) : y ? /* @__PURE__ */ u("div", { ref:
|
|
1422
|
-
!
|
|
1483
|
+
/* @__PURE__ */ a("div", { className: "h-8 w-full animate-pulse rounded bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" }),
|
|
1484
|
+
/* @__PURE__ */ a("div", { className: "h-8 w-2/3 animate-pulse rounded bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" })
|
|
1485
|
+
] }) : y ? /* @__PURE__ */ u("div", { ref: Bn, className: "space-y-3", children: [
|
|
1486
|
+
!k && /* @__PURE__ */ u(Se, { children: [
|
|
1423
1487
|
/* @__PURE__ */ u("div", { className: "rounded-lg border border-slate-200 text-[12px] dark:border-border", children: [
|
|
1424
1488
|
/* @__PURE__ */ u("div", { className: "flex items-center gap-2 border-b border-slate-200 px-3 py-2 dark:border-border", children: [
|
|
1425
|
-
/* @__PURE__ */
|
|
1426
|
-
/* @__PURE__ */
|
|
1489
|
+
/* @__PURE__ */ a(Ct, { className: "h-3.5 w-3.5 shrink-0 text-slate-400" }),
|
|
1490
|
+
/* @__PURE__ */ a(
|
|
1427
1491
|
"input",
|
|
1428
1492
|
{
|
|
1429
|
-
value:
|
|
1430
|
-
onChange: (e) =>
|
|
1493
|
+
value: V,
|
|
1494
|
+
onChange: (e) => Te(e.target.value),
|
|
1431
1495
|
placeholder: "Search catalog…",
|
|
1432
1496
|
className: "w-full bg-transparent text-[12px] outline-none placeholder:text-slate-400"
|
|
1433
1497
|
}
|
|
@@ -1437,28 +1501,28 @@ function ya({
|
|
|
1437
1501
|
{
|
|
1438
1502
|
type: "button",
|
|
1439
1503
|
"aria-pressed": ce,
|
|
1440
|
-
"aria-disabled":
|
|
1504
|
+
"aria-disabled": Le === null ? "true" : void 0,
|
|
1441
1505
|
onClick: () => {
|
|
1442
|
-
|
|
1506
|
+
Le !== null && Vt(!Pn);
|
|
1443
1507
|
},
|
|
1444
1508
|
"data-catalog-in-stock": ce ? "on" : "off",
|
|
1445
|
-
"data-tip":
|
|
1509
|
+
"data-tip": Le === null ? `Choose ${jr ?? "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",
|
|
1446
1510
|
className: W(
|
|
1447
1511
|
"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",
|
|
1448
1512
|
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"
|
|
1449
1513
|
),
|
|
1450
1514
|
children: [
|
|
1451
|
-
|
|
1515
|
+
Er ? /* @__PURE__ */ a(ue, { className: "h-3 w-3 shrink-0 animate-spin" }) : /* @__PURE__ */ a(ls, { className: "h-3 w-3 shrink-0" }),
|
|
1452
1516
|
/* @__PURE__ */ u("span", { className: "truncate", children: [
|
|
1453
1517
|
"In stock",
|
|
1454
|
-
|
|
1518
|
+
Le !== null && ze && On != null && /* @__PURE__ */ u(Se, { children: [
|
|
1455
1519
|
" at ",
|
|
1456
|
-
/* @__PURE__ */
|
|
1457
|
-
|
|
1520
|
+
/* @__PURE__ */ a(
|
|
1521
|
+
na,
|
|
1458
1522
|
{
|
|
1459
|
-
parentCollection:
|
|
1460
|
-
field:
|
|
1461
|
-
id:
|
|
1523
|
+
parentCollection: g,
|
|
1524
|
+
field: ze,
|
|
1525
|
+
id: On
|
|
1462
1526
|
}
|
|
1463
1527
|
)
|
|
1464
1528
|
] })
|
|
@@ -1466,91 +1530,91 @@ function ya({
|
|
|
1466
1530
|
]
|
|
1467
1531
|
}
|
|
1468
1532
|
),
|
|
1469
|
-
de &&
|
|
1533
|
+
de && Le === null && /* @__PURE__ */ a("span", { className: "shrink-0 text-[11px] text-slate-500 dark:text-slate-400", children: "Pick a place first" }),
|
|
1470
1534
|
/* @__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: [
|
|
1471
|
-
|
|
1535
|
+
ss,
|
|
1472
1536
|
" picked"
|
|
1473
1537
|
] }),
|
|
1474
|
-
/* @__PURE__ */
|
|
1538
|
+
/* @__PURE__ */ a(bn, { show: Ke.customized, onReset: Ke.reset })
|
|
1475
1539
|
] }),
|
|
1476
|
-
|
|
1540
|
+
Wn && // Sticky: the catalog list is tall and the page scroller carries it —
|
|
1477
1541
|
// without this the labels scroll away and favorites/section rows
|
|
1478
1542
|
// read as headerless columns. Opaque bg (not the /60 tint) so rows
|
|
1479
1543
|
// never bleed through while pinned.
|
|
1480
1544
|
/* @__PURE__ */ u(
|
|
1481
1545
|
"div",
|
|
1482
1546
|
{
|
|
1483
|
-
ref:
|
|
1547
|
+
ref: Vr,
|
|
1484
1548
|
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",
|
|
1485
1549
|
children: [
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
const [t, n] =
|
|
1490
|
-
return
|
|
1491
|
-
|
|
1550
|
+
s.favorites && /* @__PURE__ */ a("span", { className: "w-[18px] shrink-0" }),
|
|
1551
|
+
Ot(Ke, "item", "Item", "w-36 shrink-0"),
|
|
1552
|
+
Ft.map((e) => {
|
|
1553
|
+
const [t, n] = Dn(e);
|
|
1554
|
+
return Ot(
|
|
1555
|
+
Ke,
|
|
1492
1556
|
e.field,
|
|
1493
|
-
e.label ??
|
|
1557
|
+
e.label ?? Z(e.field.split(".")[0]),
|
|
1494
1558
|
t,
|
|
1495
1559
|
n
|
|
1496
1560
|
);
|
|
1497
1561
|
}),
|
|
1498
|
-
|
|
1499
|
-
(e) =>
|
|
1500
|
-
|
|
1562
|
+
on.map(
|
|
1563
|
+
(e) => Ot(
|
|
1564
|
+
Ke,
|
|
1501
1565
|
`rel:${e.key}`,
|
|
1502
|
-
e.label ??
|
|
1566
|
+
e.label ?? Z(e.key),
|
|
1503
1567
|
"w-20 shrink-0",
|
|
1504
1568
|
"text-right"
|
|
1505
1569
|
)
|
|
1506
1570
|
),
|
|
1507
|
-
/* @__PURE__ */
|
|
1508
|
-
/* @__PURE__ */
|
|
1509
|
-
/* @__PURE__ */
|
|
1571
|
+
/* @__PURE__ */ a("span", { "aria-hidden": !0, className: "ml-auto" }),
|
|
1572
|
+
/* @__PURE__ */ a("span", { "aria-hidden": !0, className: "w-3.5 shrink-0" }),
|
|
1573
|
+
/* @__PURE__ */ a("span", { className: "w-20 shrink-0 text-right", children: "Qty" })
|
|
1510
1574
|
]
|
|
1511
1575
|
}
|
|
1512
1576
|
),
|
|
1513
|
-
|
|
1514
|
-
/* @__PURE__ */
|
|
1577
|
+
V.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: [
|
|
1578
|
+
/* @__PURE__ */ a(ue, { className: "h-3.5 w-3.5 animate-spin" }),
|
|
1515
1579
|
" Searching the catalog…"
|
|
1516
1580
|
] }),
|
|
1517
|
-
|
|
1581
|
+
V.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: [
|
|
1518
1582
|
'Nothing in stock matches "',
|
|
1519
|
-
|
|
1583
|
+
V.trim(),
|
|
1520
1584
|
'" —',
|
|
1521
1585
|
" ",
|
|
1522
1586
|
/* @__PURE__ */ u(
|
|
1523
1587
|
"button",
|
|
1524
1588
|
{
|
|
1525
1589
|
type: "button",
|
|
1526
|
-
onClick: () =>
|
|
1590
|
+
onClick: () => Vt(!1),
|
|
1527
1591
|
className: "font-medium text-[#00728d] underline-offset-2 hover:underline dark:text-nvr-cyan",
|
|
1528
1592
|
children: [
|
|
1529
1593
|
"show ",
|
|
1530
|
-
|
|
1594
|
+
Be.length,
|
|
1531
1595
|
" out of stock"
|
|
1532
1596
|
]
|
|
1533
1597
|
}
|
|
1534
1598
|
)
|
|
1535
|
-
] }) : /* @__PURE__ */ u(
|
|
1599
|
+
] }) : /* @__PURE__ */ u(Se, { children: [
|
|
1536
1600
|
'No items match "',
|
|
1537
|
-
|
|
1601
|
+
V.trim(),
|
|
1538
1602
|
'"'
|
|
1539
1603
|
] }) }),
|
|
1540
|
-
|
|
1604
|
+
V.trim().length > 0 && dt.length > 0 && /* @__PURE__ */ u(ut, { children: [
|
|
1541
1605
|
/* @__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: [
|
|
1542
|
-
/* @__PURE__ */
|
|
1543
|
-
/* @__PURE__ */
|
|
1544
|
-
/* @__PURE__ */
|
|
1606
|
+
/* @__PURE__ */ a(Ct, { className: "h-3 w-3 shrink-0 text-sky-500" }),
|
|
1607
|
+
/* @__PURE__ */ a("span", { className: "text-[11px] font-semibold text-slate-600 dark:text-slate-300", children: "Search results" }),
|
|
1608
|
+
/* @__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 }),
|
|
1545
1609
|
/* @__PURE__ */ u("span", { className: "text-[11px] text-slate-500 dark:text-slate-400", children: [
|
|
1546
1610
|
"across the entire catalog",
|
|
1547
1611
|
ce ? ", in stock only" : "",
|
|
1548
1612
|
" — enter a quantity to add"
|
|
1549
1613
|
] }),
|
|
1550
|
-
|
|
1614
|
+
tn && /* @__PURE__ */ a(ue, { className: "h-3 w-3 shrink-0 animate-spin text-slate-400" })
|
|
1551
1615
|
] }),
|
|
1552
|
-
|
|
1553
|
-
const n = String(e.id), r =
|
|
1616
|
+
dt.map((e, t) => {
|
|
1617
|
+
const n = String(e.id), r = qe(n);
|
|
1554
1618
|
return /* @__PURE__ */ u(
|
|
1555
1619
|
"div",
|
|
1556
1620
|
{
|
|
@@ -1560,23 +1624,23 @@ function ya({
|
|
|
1560
1624
|
(r ?? 0) > 0 && "bg-nvr-cyan/5"
|
|
1561
1625
|
),
|
|
1562
1626
|
children: [
|
|
1563
|
-
|
|
1564
|
-
|
|
1627
|
+
Wt(n),
|
|
1628
|
+
un(
|
|
1565
1629
|
n,
|
|
1566
|
-
|
|
1630
|
+
Ce(K, e),
|
|
1567
1631
|
(() => {
|
|
1568
|
-
const l =
|
|
1569
|
-
return !l && !o ? null : /* @__PURE__ */ u(
|
|
1570
|
-
o && /* @__PURE__ */
|
|
1632
|
+
const l = Pr(e), o = Fr.has(n);
|
|
1633
|
+
return !l && !o ? null : /* @__PURE__ */ u(Se, { children: [
|
|
1634
|
+
o && /* @__PURE__ */ a(
|
|
1571
1635
|
"span",
|
|
1572
1636
|
{
|
|
1573
1637
|
"data-catalog-recent": !0,
|
|
1574
|
-
"data-tip": `You added this in the last ${
|
|
1638
|
+
"data-tip": `You added this in the last ${_t} days`,
|
|
1575
1639
|
className: "shrink-0 rounded bg-slate-100 px-1.5 py-0.5 text-[10px] font-medium text-slate-600 dark:bg-muted dark:text-slate-400",
|
|
1576
1640
|
children: "Recent"
|
|
1577
1641
|
}
|
|
1578
1642
|
),
|
|
1579
|
-
l && /* @__PURE__ */
|
|
1643
|
+
l && /* @__PURE__ */ a(
|
|
1580
1644
|
"span",
|
|
1581
1645
|
{
|
|
1582
1646
|
"data-catalog-match-why": !0,
|
|
@@ -1590,37 +1654,37 @@ function ya({
|
|
|
1590
1654
|
})(),
|
|
1591
1655
|
ye
|
|
1592
1656
|
),
|
|
1593
|
-
|
|
1594
|
-
/* @__PURE__ */
|
|
1595
|
-
|
|
1657
|
+
cn(n, e, ye),
|
|
1658
|
+
/* @__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
|
+
Kt(n, e)
|
|
1596
1660
|
]
|
|
1597
1661
|
},
|
|
1598
1662
|
n
|
|
1599
1663
|
);
|
|
1600
1664
|
})
|
|
1601
1665
|
] }),
|
|
1602
|
-
ae.length > 0 && !
|
|
1666
|
+
ae.length > 0 && !V.trim() && /* @__PURE__ */ u("p", { className: "px-3 py-6 text-center text-slate-400", children: [
|
|
1603
1667
|
"Search the full catalog above, or select",
|
|
1604
1668
|
" ",
|
|
1605
1669
|
ae.map((e) => {
|
|
1606
1670
|
var t;
|
|
1607
|
-
return ((t =
|
|
1671
|
+
return ((t = L == null ? void 0 : L.fieldLabels) == null ? void 0 : t[e]) ?? Z(e);
|
|
1608
1672
|
}).join(", "),
|
|
1609
1673
|
" ",
|
|
1610
1674
|
"to browse by category"
|
|
1611
1675
|
] }),
|
|
1612
|
-
ae.length === 0 && (
|
|
1613
|
-
/* @__PURE__ */
|
|
1676
|
+
ae.length === 0 && (Nn || xt) && /* @__PURE__ */ u("div", { className: "flex items-center justify-center gap-2 py-6 text-slate-500 dark:text-slate-400", children: [
|
|
1677
|
+
/* @__PURE__ */ a(ue, { className: "h-4 w-4 animate-spin" }),
|
|
1614
1678
|
" Loading catalog…"
|
|
1615
1679
|
] }),
|
|
1616
|
-
ae.length === 0 && !
|
|
1680
|
+
ae.length === 0 && !Nn && !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: [
|
|
1617
1681
|
"Nothing in this catalog is in stock here —",
|
|
1618
1682
|
" ",
|
|
1619
1683
|
/* @__PURE__ */ u(
|
|
1620
1684
|
"button",
|
|
1621
1685
|
{
|
|
1622
1686
|
type: "button",
|
|
1623
|
-
onClick: () =>
|
|
1687
|
+
onClick: () => Vt(!1),
|
|
1624
1688
|
className: "font-medium text-[#00728d] underline-offset-2 hover:underline dark:text-nvr-cyan",
|
|
1625
1689
|
children: [
|
|
1626
1690
|
"show all ",
|
|
@@ -1629,7 +1693,7 @@ function ya({
|
|
|
1629
1693
|
}
|
|
1630
1694
|
)
|
|
1631
1695
|
] }) : "No catalog items" }),
|
|
1632
|
-
|
|
1696
|
+
s.favorites && /* @__PURE__ */ u(ut, { children: [
|
|
1633
1697
|
/* @__PURE__ */ u("div", { className: "flex w-full items-center gap-1.5 border-b border-slate-200 bg-amber-50/70 px-2 py-1 dark:border-border dark:bg-amber-900/10", children: [
|
|
1634
1698
|
/* @__PURE__ */ u(
|
|
1635
1699
|
"button",
|
|
@@ -1641,8 +1705,8 @@ function ya({
|
|
|
1641
1705
|
}),
|
|
1642
1706
|
className: "flex min-w-0 flex-1 items-center gap-1.5 py-0.5 text-left",
|
|
1643
1707
|
children: [
|
|
1644
|
-
/* @__PURE__ */
|
|
1645
|
-
|
|
1708
|
+
/* @__PURE__ */ a(
|
|
1709
|
+
Jt,
|
|
1646
1710
|
{
|
|
1647
1711
|
className: W(
|
|
1648
1712
|
"h-3 w-3 shrink-0 text-slate-400 transition-transform",
|
|
@@ -1650,26 +1714,26 @@ function ya({
|
|
|
1650
1714
|
)
|
|
1651
1715
|
}
|
|
1652
1716
|
),
|
|
1653
|
-
/* @__PURE__ */
|
|
1654
|
-
/* @__PURE__ */
|
|
1655
|
-
/* @__PURE__ */
|
|
1717
|
+
/* @__PURE__ */ a(ft, { className: "h-3 w-3 shrink-0 fill-amber-400 text-amber-400" }),
|
|
1718
|
+
/* @__PURE__ */ a("span", { className: "text-[11px] font-semibold text-slate-600 dark:text-slate-300", children: "Favorites" }),
|
|
1719
|
+
/* @__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 })
|
|
1656
1720
|
]
|
|
1657
1721
|
}
|
|
1658
1722
|
),
|
|
1659
|
-
/* @__PURE__ */
|
|
1723
|
+
/* @__PURE__ */ a(
|
|
1660
1724
|
"button",
|
|
1661
1725
|
{
|
|
1662
|
-
ref:
|
|
1726
|
+
ref: Fn,
|
|
1663
1727
|
type: "button",
|
|
1664
|
-
onClick: () =>
|
|
1728
|
+
onClick: () => jn(!0),
|
|
1665
1729
|
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",
|
|
1666
1730
|
children: "Manage"
|
|
1667
1731
|
}
|
|
1668
1732
|
)
|
|
1669
1733
|
] }),
|
|
1670
|
-
!pe.has("__favorites__") &&
|
|
1671
|
-
!pe.has("__favorites__") &&
|
|
1672
|
-
const n = String(e.id), r =
|
|
1734
|
+
!pe.has("__favorites__") && nn.length === 0 && /* @__PURE__ */ a("p", { className: "border-b border-slate-100 px-3 py-2 text-center text-[11px] text-slate-400 dark:border-border/50", children: nt.length > 0 ? "None of your favorites are in stock here." : "No favorites yet — Manage lets you search the full catalog and star items." }),
|
|
1735
|
+
!pe.has("__favorites__") && nn.map((e, t) => {
|
|
1736
|
+
const n = String(e.id), r = qe(n), l = rn(n);
|
|
1673
1737
|
return /* @__PURE__ */ u(
|
|
1674
1738
|
"div",
|
|
1675
1739
|
{
|
|
@@ -1680,29 +1744,29 @@ function ya({
|
|
|
1680
1744
|
l && "bg-amber-50 dark:bg-amber-900/15"
|
|
1681
1745
|
),
|
|
1682
1746
|
children: [
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
/* @__PURE__ */
|
|
1687
|
-
|
|
1747
|
+
Wt(n),
|
|
1748
|
+
un(n, Ce(K, e)),
|
|
1749
|
+
cn(n, e),
|
|
1750
|
+
/* @__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
|
+
Ae,
|
|
1688
1752
|
{
|
|
1689
1753
|
className: "h-3.5 w-3.5 text-amber-500",
|
|
1690
|
-
"aria-label": `${
|
|
1754
|
+
"aria-label": `${sn} ${l.available} — ${l.qty} requested`
|
|
1691
1755
|
}
|
|
1692
1756
|
) }),
|
|
1693
|
-
|
|
1757
|
+
Kt(n, e)
|
|
1694
1758
|
]
|
|
1695
1759
|
},
|
|
1696
1760
|
n
|
|
1697
1761
|
);
|
|
1698
1762
|
})
|
|
1699
1763
|
] }),
|
|
1700
|
-
ae.length === 0 &&
|
|
1764
|
+
ae.length === 0 && Lt.map((e) => {
|
|
1701
1765
|
const t = pe.has(e.name), n = e.items.reduce(
|
|
1702
|
-
(r, l) => r + ((
|
|
1766
|
+
(r, l) => r + ((qe(l.id) ?? 0) > 0 ? 1 : 0),
|
|
1703
1767
|
0
|
|
1704
1768
|
);
|
|
1705
|
-
return /* @__PURE__ */ u(
|
|
1769
|
+
return /* @__PURE__ */ u(ut, { children: [
|
|
1706
1770
|
/* @__PURE__ */ u(
|
|
1707
1771
|
"button",
|
|
1708
1772
|
{
|
|
@@ -1713,8 +1777,8 @@ function ya({
|
|
|
1713
1777
|
}),
|
|
1714
1778
|
className: "flex w-full items-center gap-1.5 border-b border-slate-200 bg-slate-100/80 px-2 py-1.5 text-left dark:border-border dark:bg-muted",
|
|
1715
1779
|
children: [
|
|
1716
|
-
/* @__PURE__ */
|
|
1717
|
-
|
|
1780
|
+
/* @__PURE__ */ a(
|
|
1781
|
+
Jt,
|
|
1718
1782
|
{
|
|
1719
1783
|
className: W(
|
|
1720
1784
|
"h-3 w-3 shrink-0 text-slate-400 transition-transform",
|
|
@@ -1722,8 +1786,8 @@ function ya({
|
|
|
1722
1786
|
)
|
|
1723
1787
|
}
|
|
1724
1788
|
),
|
|
1725
|
-
/* @__PURE__ */
|
|
1726
|
-
/* @__PURE__ */
|
|
1789
|
+
/* @__PURE__ */ a("span", { className: "text-[11px] font-semibold text-slate-600 dark:text-slate-300", children: e.name }),
|
|
1790
|
+
/* @__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: e.items.length }),
|
|
1727
1791
|
n > 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: [
|
|
1728
1792
|
n,
|
|
1729
1793
|
" picked"
|
|
@@ -1732,7 +1796,7 @@ function ya({
|
|
|
1732
1796
|
}
|
|
1733
1797
|
),
|
|
1734
1798
|
!t && e.items.map((r, l) => {
|
|
1735
|
-
const o =
|
|
1799
|
+
const o = qe(r.id), f = rn(r.id);
|
|
1736
1800
|
return /* @__PURE__ */ u(
|
|
1737
1801
|
"div",
|
|
1738
1802
|
{
|
|
@@ -1740,20 +1804,20 @@ function ya({
|
|
|
1740
1804
|
"flex items-center gap-4 border-b border-slate-100 px-3 py-1 dark:border-border/50",
|
|
1741
1805
|
l % 2 === 0 ? "bg-white dark:bg-background" : "bg-slate-50/50 dark:bg-muted/30",
|
|
1742
1806
|
(o ?? 0) > 0 && "bg-nvr-cyan/5",
|
|
1743
|
-
|
|
1807
|
+
f && "bg-amber-50 dark:bg-amber-900/15"
|
|
1744
1808
|
),
|
|
1745
1809
|
children: [
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
/* @__PURE__ */
|
|
1750
|
-
|
|
1810
|
+
Wt(r.id),
|
|
1811
|
+
un(r.id, r.label),
|
|
1812
|
+
cn(r.id, r.row),
|
|
1813
|
+
/* @__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
|
+
Ae,
|
|
1751
1815
|
{
|
|
1752
1816
|
className: "h-3.5 w-3.5 text-amber-500",
|
|
1753
|
-
"aria-label": `${
|
|
1817
|
+
"aria-label": `${sn} ${f.available} — ${f.qty} requested`
|
|
1754
1818
|
}
|
|
1755
1819
|
) }),
|
|
1756
|
-
|
|
1820
|
+
Kt(r.id, r.row)
|
|
1757
1821
|
]
|
|
1758
1822
|
},
|
|
1759
1823
|
r.id
|
|
@@ -1762,34 +1826,34 @@ function ya({
|
|
|
1762
1826
|
] }, e.name);
|
|
1763
1827
|
})
|
|
1764
1828
|
] }),
|
|
1765
|
-
(
|
|
1829
|
+
(s.builders ?? []).filter((e) => hr(e.show_when, S)).map(
|
|
1766
1830
|
(e) => {
|
|
1767
1831
|
var t;
|
|
1768
|
-
return (t = e.facets) != null && t.length && e.source ? /* @__PURE__ */
|
|
1769
|
-
|
|
1832
|
+
return (t = e.facets) != null && t.length && e.source ? /* @__PURE__ */ a(
|
|
1833
|
+
ta,
|
|
1770
1834
|
{
|
|
1771
1835
|
builder: e,
|
|
1772
1836
|
catalogCol: y,
|
|
1773
|
-
catalogFields:
|
|
1774
|
-
tmpl:
|
|
1775
|
-
currentQty:
|
|
1776
|
-
addQty: (n, r, l) =>
|
|
1777
|
-
qtyStep:
|
|
1778
|
-
readOnly:
|
|
1837
|
+
catalogFields: U,
|
|
1838
|
+
tmpl: K,
|
|
1839
|
+
currentQty: qe,
|
|
1840
|
+
addQty: (n, r, l) => Ye(n, String(r), l),
|
|
1841
|
+
qtyStep: mt(E) ? 1 : "any",
|
|
1842
|
+
readOnly: k
|
|
1779
1843
|
},
|
|
1780
1844
|
e.label
|
|
1781
|
-
) : /* @__PURE__ */
|
|
1782
|
-
|
|
1845
|
+
) : /* @__PURE__ */ a(
|
|
1846
|
+
ea,
|
|
1783
1847
|
{
|
|
1784
1848
|
builder: e,
|
|
1785
|
-
defaultItemField:
|
|
1849
|
+
defaultItemField: s.item_field,
|
|
1786
1850
|
catalogCol: y,
|
|
1787
|
-
catalogFields:
|
|
1788
|
-
tmpl:
|
|
1789
|
-
currentQty:
|
|
1790
|
-
addQty: (n, r, l) =>
|
|
1791
|
-
qtyStep:
|
|
1792
|
-
readOnly:
|
|
1851
|
+
catalogFields: U,
|
|
1852
|
+
tmpl: K,
|
|
1853
|
+
currentQty: qe,
|
|
1854
|
+
addQty: (n, r, l) => Ye(n, String(r), l),
|
|
1855
|
+
qtyStep: mt(E) ? 1 : "any",
|
|
1856
|
+
readOnly: k
|
|
1793
1857
|
},
|
|
1794
1858
|
e.label
|
|
1795
1859
|
);
|
|
@@ -1798,15 +1862,15 @@ function ya({
|
|
|
1798
1862
|
] }),
|
|
1799
1863
|
/* @__PURE__ */ u("div", { className: "rounded-lg border border-slate-200 text-[12px] dark:border-border", children: [
|
|
1800
1864
|
/* @__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: [
|
|
1801
|
-
/* @__PURE__ */
|
|
1802
|
-
!
|
|
1803
|
-
|
|
1804
|
-
|
|
1865
|
+
/* @__PURE__ */ a("span", { className: "text-[11px] font-semibold text-slate-600 dark:text-slate-300", children: "Summary" }),
|
|
1866
|
+
!k && /* @__PURE__ */ u("div", { className: "flex items-center gap-2", onClick: (e) => e.stopPropagation(), children: [
|
|
1867
|
+
s.upload_template && !T && H && g && /* @__PURE__ */ a(
|
|
1868
|
+
ws,
|
|
1805
1869
|
{
|
|
1806
|
-
collection:
|
|
1870
|
+
collection: g,
|
|
1807
1871
|
templateFilter: (e) => {
|
|
1808
1872
|
var t;
|
|
1809
|
-
return e.name ===
|
|
1873
|
+
return e.name === s.upload_template && ((t = e.reimport) == null ? void 0 : t.enabled) === !0;
|
|
1810
1874
|
},
|
|
1811
1875
|
getLabel: (e) => {
|
|
1812
1876
|
var t;
|
|
@@ -1816,32 +1880,32 @@ function ya({
|
|
|
1816
1880
|
compact: !0
|
|
1817
1881
|
}
|
|
1818
1882
|
),
|
|
1819
|
-
/* @__PURE__ */
|
|
1820
|
-
|
|
1883
|
+
/* @__PURE__ */ a("div", { className: "w-64", children: /* @__PURE__ */ a(
|
|
1884
|
+
zs,
|
|
1821
1885
|
{
|
|
1822
1886
|
collection: y,
|
|
1823
1887
|
value: null,
|
|
1824
|
-
onChange: (e) => void
|
|
1888
|
+
onChange: (e) => void rs(e),
|
|
1825
1889
|
placeholder: "+ Add any item…",
|
|
1826
|
-
displayTemplate:
|
|
1890
|
+
displayTemplate: sa(K, s.columns)
|
|
1827
1891
|
}
|
|
1828
1892
|
) })
|
|
1829
1893
|
] })
|
|
1830
1894
|
] }),
|
|
1831
|
-
|
|
1832
|
-
const e =
|
|
1895
|
+
Ne.length === 0 ? /* @__PURE__ */ a("p", { className: "px-3 py-4 text-center text-slate-400", children: "Nothing picked yet" }) : (() => {
|
|
1896
|
+
const e = Un.filter((c) => !c.format), t = e[0], n = e.slice(1), r = Un.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(
|
|
1833
1897
|
Oe,
|
|
1834
|
-
|
|
1898
|
+
h,
|
|
1835
1899
|
c,
|
|
1836
1900
|
"w-20 shrink-0",
|
|
1837
1901
|
"text-right text-[11px] font-medium text-slate-500 dark:text-slate-400"
|
|
1838
|
-
) : /* @__PURE__ */
|
|
1902
|
+
) : /* @__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}`;
|
|
1839
1903
|
return /* @__PURE__ */ u("div", { children: [
|
|
1840
1904
|
/* @__PURE__ */ u("div", { className: "flex items-center gap-4 border-b border-slate-200 px-3 py-1.5 dark:border-border", children: [
|
|
1841
1905
|
/* @__PURE__ */ u("span", { className: "flex flex-1 items-center gap-1 text-[11px] font-medium text-slate-500 dark:text-slate-400", children: [
|
|
1842
1906
|
"Item",
|
|
1843
|
-
|
|
1844
|
-
|
|
1907
|
+
k && /* @__PURE__ */ a(
|
|
1908
|
+
bn,
|
|
1845
1909
|
{
|
|
1846
1910
|
show: Oe.customized,
|
|
1847
1911
|
onReset: Oe.reset,
|
|
@@ -1849,21 +1913,21 @@ function ya({
|
|
|
1849
1913
|
}
|
|
1850
1914
|
)
|
|
1851
1915
|
] }),
|
|
1852
|
-
|
|
1853
|
-
o(
|
|
1854
|
-
|
|
1855
|
-
!
|
|
1916
|
+
Et.map((c) => /* @__PURE__ */ a(ut, { children: o(Z(c), f(c)) }, c)),
|
|
1917
|
+
o(Z(z)),
|
|
1918
|
+
Ze.map((c) => /* @__PURE__ */ a(ut, { children: o(Z(c), `s:${c}`) }, c)),
|
|
1919
|
+
!k && /* @__PURE__ */ a("span", { className: "-my-1 flex w-6 shrink-0 justify-end", children: /* @__PURE__ */ a(bn, { show: Oe.customized, onReset: Oe.reset }) })
|
|
1856
1920
|
] }),
|
|
1857
|
-
|
|
1858
|
-
const b = c.row.id != null ? String(c.row.id) : null, q = b != null &&
|
|
1921
|
+
Ne.map((c, h) => {
|
|
1922
|
+
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);
|
|
1859
1923
|
return /* @__PURE__ */ u(
|
|
1860
1924
|
"div",
|
|
1861
1925
|
{
|
|
1862
1926
|
className: W(
|
|
1863
1927
|
"border-b border-slate-100 px-3 py-2 last:border-b-0 dark:border-border/50",
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1928
|
+
h % 2 === 0 ? "bg-white dark:bg-background" : "bg-slate-50/50 dark:bg-muted/30",
|
|
1929
|
+
$ && "bg-amber-50 dark:bg-amber-900/15",
|
|
1930
|
+
J && "bg-red-50/70 dark:bg-red-900/15",
|
|
1867
1931
|
q && "opacity-60"
|
|
1868
1932
|
),
|
|
1869
1933
|
children: [
|
|
@@ -1875,12 +1939,12 @@ function ya({
|
|
|
1875
1939
|
q && "line-through decoration-slate-400"
|
|
1876
1940
|
),
|
|
1877
1941
|
children: [
|
|
1878
|
-
|
|
1942
|
+
Hn(
|
|
1879
1943
|
c.key,
|
|
1880
|
-
|
|
1944
|
+
Pt(c.key),
|
|
1881
1945
|
"shrink-0 font-semibold text-slate-800 dark:text-slate-100"
|
|
1882
1946
|
),
|
|
1883
|
-
|
|
1947
|
+
et && !q && (b == null || gt.has(b)) && /* @__PURE__ */ a(
|
|
1884
1948
|
"span",
|
|
1885
1949
|
{
|
|
1886
1950
|
"data-catalog-staged": b == null ? "new" : "edited",
|
|
@@ -1889,89 +1953,89 @@ function ya({
|
|
|
1889
1953
|
children: b == null ? "New" : "Edited"
|
|
1890
1954
|
}
|
|
1891
1955
|
),
|
|
1892
|
-
|
|
1956
|
+
J && /* @__PURE__ */ a(
|
|
1893
1957
|
"span",
|
|
1894
1958
|
{
|
|
1895
1959
|
className: "shrink-0",
|
|
1896
1960
|
"data-tip": `This line was in the failed submission
|
|
1897
|
-
${
|
|
1961
|
+
${J}`,
|
|
1898
1962
|
"data-submission-error": !0,
|
|
1899
|
-
children: /* @__PURE__ */
|
|
1963
|
+
children: /* @__PURE__ */ a(hn, { className: "h-3.5 w-3.5 text-red-500", strokeWidth: 2 })
|
|
1900
1964
|
}
|
|
1901
1965
|
),
|
|
1902
|
-
t && /* @__PURE__ */
|
|
1903
|
-
|
|
1966
|
+
t && /* @__PURE__ */ a(
|
|
1967
|
+
br,
|
|
1904
1968
|
{
|
|
1905
|
-
text:
|
|
1969
|
+
text: ve(Tt(Ue(c.key), t.field), void 0),
|
|
1906
1970
|
className: "min-w-0 flex-1 text-slate-600 dark:text-slate-300"
|
|
1907
1971
|
}
|
|
1908
1972
|
),
|
|
1909
|
-
!t && /* @__PURE__ */
|
|
1910
|
-
n.map((
|
|
1911
|
-
const
|
|
1912
|
-
return
|
|
1973
|
+
!t && /* @__PURE__ */ a("span", { className: "flex-1" }),
|
|
1974
|
+
n.map((x) => {
|
|
1975
|
+
const I = Tt(Ue(c.key), x.field);
|
|
1976
|
+
return I == null || I === "" ? null : /* @__PURE__ */ a(
|
|
1913
1977
|
"span",
|
|
1914
1978
|
{
|
|
1915
1979
|
className: "shrink-0 rounded bg-slate-100 px-1.5 py-0.5 text-[10.5px] font-medium text-slate-600 dark:bg-muted dark:text-slate-300",
|
|
1916
|
-
children: String(
|
|
1980
|
+
children: String(I)
|
|
1917
1981
|
},
|
|
1918
|
-
|
|
1982
|
+
x.field
|
|
1919
1983
|
);
|
|
1920
1984
|
}),
|
|
1921
|
-
|
|
1922
|
-
(
|
|
1923
|
-
var
|
|
1924
|
-
return
|
|
1985
|
+
Et.map(
|
|
1986
|
+
(x) => {
|
|
1987
|
+
var I;
|
|
1988
|
+
return ts(c.key, x) ? as(c.key, x, c.row) : /* @__PURE__ */ a(
|
|
1925
1989
|
"span",
|
|
1926
1990
|
{
|
|
1927
|
-
"data-catalog-locked": !
|
|
1928
|
-
"data-tip": !
|
|
1991
|
+
"data-catalog-locked": !k && M.includes(x) ? x : void 0,
|
|
1992
|
+
"data-tip": !k && M.includes(x) ? "Set by the catalog — only an administrator can change it" : void 0,
|
|
1929
1993
|
...Oe.box(
|
|
1930
|
-
`s:${
|
|
1994
|
+
`s:${x}`,
|
|
1931
1995
|
"w-20 shrink-0",
|
|
1932
1996
|
"truncate text-right tabular-nums text-slate-600 dark:text-slate-300"
|
|
1933
1997
|
),
|
|
1934
|
-
children:
|
|
1998
|
+
children: ve(c.row[x], (I = s.field_formats) == null ? void 0 : I[x])
|
|
1935
1999
|
},
|
|
1936
|
-
|
|
2000
|
+
x
|
|
1937
2001
|
);
|
|
1938
2002
|
}
|
|
1939
2003
|
),
|
|
1940
2004
|
/* @__PURE__ */ u("span", { className: "inline-flex w-20 shrink-0 items-center justify-end gap-1", children: [
|
|
1941
|
-
ee.has(c.key) && /* @__PURE__ */
|
|
1942
|
-
|
|
2005
|
+
ee.has(c.key) && /* @__PURE__ */ a(ue, { className: "h-3 w-3 animate-spin text-slate-400" }),
|
|
2006
|
+
Kt(c.key, Ue(c.key))
|
|
1943
2007
|
] }),
|
|
1944
|
-
|
|
1945
|
-
var
|
|
2008
|
+
Ze.map((x) => {
|
|
2009
|
+
var dr, cr;
|
|
1946
2010
|
if (q)
|
|
1947
|
-
return /* @__PURE__ */
|
|
2011
|
+
return /* @__PURE__ */ a(
|
|
1948
2012
|
"span",
|
|
1949
2013
|
{
|
|
1950
2014
|
"data-tip": "Not counted — this line is removed when you save",
|
|
1951
2015
|
...Oe.box(
|
|
1952
|
-
`s:${
|
|
2016
|
+
`s:${x}`,
|
|
1953
2017
|
"w-20 shrink-0",
|
|
1954
2018
|
"text-right tabular-nums text-slate-400 dark:text-slate-500"
|
|
1955
2019
|
),
|
|
1956
2020
|
children: "—"
|
|
1957
2021
|
},
|
|
1958
|
-
|
|
2022
|
+
x
|
|
1959
2023
|
);
|
|
1960
|
-
const
|
|
1961
|
-
return /* @__PURE__ */
|
|
2024
|
+
const I = c.row[x], $e = I != null && I !== "" ? I : Ee(((dr = s.compute_fields) == null ? void 0 : dr[x]) ?? "", c.row);
|
|
2025
|
+
return /* @__PURE__ */ a(
|
|
1962
2026
|
"span",
|
|
1963
2027
|
{
|
|
1964
2028
|
...Oe.box(
|
|
1965
|
-
`s:${
|
|
2029
|
+
`s:${x}`,
|
|
1966
2030
|
"w-20 shrink-0",
|
|
1967
2031
|
"truncate text-right tabular-nums text-slate-600 dark:text-slate-300"
|
|
1968
2032
|
),
|
|
1969
|
-
children:
|
|
2033
|
+
children: ve($e, (cr = s.field_formats) == null ? void 0 : cr[x])
|
|
1970
2034
|
},
|
|
1971
|
-
|
|
2035
|
+
x
|
|
1972
2036
|
);
|
|
1973
2037
|
}),
|
|
1974
|
-
!
|
|
2038
|
+
!k && q && /* @__PURE__ */ a(
|
|
1975
2039
|
"button",
|
|
1976
2040
|
{
|
|
1977
2041
|
type: "button",
|
|
@@ -1980,181 +2044,225 @@ ${C}`,
|
|
|
1980
2044
|
children: "Undo"
|
|
1981
2045
|
}
|
|
1982
2046
|
),
|
|
1983
|
-
!
|
|
2047
|
+
!k && !q && /* @__PURE__ */ a(
|
|
1984
2048
|
"button",
|
|
1985
2049
|
{
|
|
1986
2050
|
type: "button",
|
|
1987
2051
|
title: "Remove (applies on Save)",
|
|
1988
2052
|
onClick: () => {
|
|
1989
|
-
if (!
|
|
2053
|
+
if (!T && v && b != null) {
|
|
1990
2054
|
v.queueDelete(i, m, b);
|
|
1991
2055
|
return;
|
|
1992
2056
|
}
|
|
1993
|
-
|
|
2057
|
+
Ye(c.key, "0", {}, { confirmedRemove: !0 });
|
|
1994
2058
|
},
|
|
1995
2059
|
className: "w-6 shrink-0 rounded p-0.5 text-slate-300 transition-colors hover:text-red-500",
|
|
1996
|
-
children: /* @__PURE__ */
|
|
2060
|
+
children: /* @__PURE__ */ a(pt, { className: "mx-auto h-3.5 w-3.5" })
|
|
1997
2061
|
}
|
|
1998
2062
|
)
|
|
1999
2063
|
]
|
|
2000
2064
|
}
|
|
2001
2065
|
),
|
|
2002
|
-
(r.length > 0 ||
|
|
2003
|
-
r.map((
|
|
2004
|
-
/* @__PURE__ */
|
|
2066
|
+
(r.length > 0 || Mn.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: [
|
|
2067
|
+
r.map((x) => /* @__PURE__ */ u("span", { className: "whitespace-nowrap", children: [
|
|
2068
|
+
/* @__PURE__ */ a("span", { className: "text-slate-500 dark:text-muted-foreground", children: x.label ?? Z(x.field.split(".")[0]) }),
|
|
2005
2069
|
" ",
|
|
2006
|
-
/* @__PURE__ */
|
|
2007
|
-
] },
|
|
2008
|
-
|
|
2009
|
-
/* @__PURE__ */
|
|
2070
|
+
/* @__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) })
|
|
2071
|
+
] }, x.field)),
|
|
2072
|
+
Mn.map((x) => /* @__PURE__ */ u("span", { className: "whitespace-nowrap", children: [
|
|
2073
|
+
/* @__PURE__ */ a("span", { className: "text-slate-500 dark:text-muted-foreground", children: x.label ?? Z(x.key) }),
|
|
2010
2074
|
" ",
|
|
2011
|
-
/* @__PURE__ */
|
|
2012
|
-
] },
|
|
2013
|
-
|
|
2014
|
-
|
|
2075
|
+
/* @__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
|
+
] }, x.key)),
|
|
2077
|
+
Wr(c.row),
|
|
2078
|
+
Kr(c.row).map((x) => /* @__PURE__ */ u(
|
|
2015
2079
|
"span",
|
|
2016
2080
|
{
|
|
2017
2081
|
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",
|
|
2018
|
-
"data-catalog-row-flag":
|
|
2082
|
+
"data-catalog-row-flag": x,
|
|
2019
2083
|
children: [
|
|
2020
|
-
/* @__PURE__ */
|
|
2021
|
-
|
|
2084
|
+
/* @__PURE__ */ a(Ae, { className: "h-3 w-3" }),
|
|
2085
|
+
x
|
|
2022
2086
|
]
|
|
2023
2087
|
},
|
|
2024
|
-
|
|
2088
|
+
x
|
|
2025
2089
|
)),
|
|
2026
|
-
|
|
2027
|
-
const
|
|
2090
|
+
jt.map((x) => {
|
|
2091
|
+
const I = Ur(x, c);
|
|
2028
2092
|
return /* @__PURE__ */ u("span", { className: "whitespace-nowrap", children: [
|
|
2029
|
-
/* @__PURE__ */
|
|
2093
|
+
/* @__PURE__ */ a("span", { className: "text-slate-500 dark:text-muted-foreground", children: x.label ?? Z(x.field) }),
|
|
2030
2094
|
" ",
|
|
2031
|
-
/* @__PURE__ */
|
|
2032
|
-
] },
|
|
2095
|
+
/* @__PURE__ */ a("span", { className: "font-medium text-slate-700 dark:text-slate-200", children: l(I, x.format) })
|
|
2096
|
+
] }, x.field);
|
|
2033
2097
|
})
|
|
2034
2098
|
] }),
|
|
2035
|
-
|
|
2036
|
-
/* @__PURE__ */
|
|
2037
|
-
|
|
2099
|
+
$ && (k ? /* @__PURE__ */ u("p", { className: "mt-1 flex items-center gap-1 pl-0.5 text-[11px] font-medium text-amber-600 dark:text-amber-400", children: [
|
|
2100
|
+
/* @__PURE__ */ a(Ae, { className: "h-3 w-3 shrink-0" }),
|
|
2101
|
+
sn,
|
|
2038
2102
|
" is ",
|
|
2039
|
-
|
|
2103
|
+
ve($.available, "number"),
|
|
2040
2104
|
" —",
|
|
2041
2105
|
" ",
|
|
2042
|
-
|
|
2106
|
+
ve($.qty, "number"),
|
|
2043
2107
|
" requested"
|
|
2044
|
-
] })
|
|
2045
|
-
|
|
2108
|
+
] }) : (
|
|
2109
|
+
// rt4 #7 — what the line is short of, where.
|
|
2110
|
+
/* @__PURE__ */ u(
|
|
2111
|
+
"p",
|
|
2112
|
+
{
|
|
2113
|
+
"data-catalog-stock-short": !0,
|
|
2114
|
+
className: "mt-1 flex items-center gap-1 pl-0.5 text-[11px] font-medium text-amber-600 dark:text-amber-400",
|
|
2115
|
+
children: [
|
|
2116
|
+
/* @__PURE__ */ a(Ae, { className: "h-3 w-3 shrink-0" }),
|
|
2117
|
+
Rs(
|
|
2118
|
+
$.available,
|
|
2119
|
+
$.qty,
|
|
2120
|
+
Xr,
|
|
2121
|
+
(x) => ve(x, "number")
|
|
2122
|
+
)
|
|
2123
|
+
]
|
|
2124
|
+
}
|
|
2125
|
+
)
|
|
2126
|
+
)),
|
|
2127
|
+
!k && b != null && !q && Gr(c.row, c.key).map(({ field: x, change: I }) => /* @__PURE__ */ u(
|
|
2128
|
+
"p",
|
|
2129
|
+
{
|
|
2130
|
+
"data-catalog-price-changed": x,
|
|
2131
|
+
className: "mt-1 flex flex-wrap items-center gap-x-1 pl-0.5 text-[11px] font-medium text-amber-700 dark:text-amber-300",
|
|
2132
|
+
children: [
|
|
2133
|
+
/* @__PURE__ */ a(Ae, { className: "h-3 w-3 shrink-0" }),
|
|
2134
|
+
/* @__PURE__ */ u("span", { children: [
|
|
2135
|
+
Os(I, ($e) => ve($e, "currency")),
|
|
2136
|
+
fn.length > 1 ? ` · ${Z(x)}` : ""
|
|
2137
|
+
] }),
|
|
2138
|
+
/* @__PURE__ */ a("span", { "aria-hidden": !0, className: "text-amber-500/70", children: "·" }),
|
|
2139
|
+
/* @__PURE__ */ a(
|
|
2140
|
+
"button",
|
|
2141
|
+
{
|
|
2142
|
+
type: "button",
|
|
2143
|
+
"data-catalog-use-new-price": x,
|
|
2144
|
+
className: "rounded font-semibold text-nvr-cyan underline-offset-2 hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan/60",
|
|
2145
|
+
onClick: () => void Xn(c.key, x, String(I.now)),
|
|
2146
|
+
children: "Use new price"
|
|
2147
|
+
}
|
|
2148
|
+
)
|
|
2149
|
+
]
|
|
2150
|
+
},
|
|
2151
|
+
x
|
|
2152
|
+
)),
|
|
2153
|
+
!q && Xs(
|
|
2046
2154
|
{
|
|
2047
2155
|
...c.row,
|
|
2048
2156
|
...Object.fromEntries(
|
|
2049
|
-
|
|
2050
|
-
var
|
|
2157
|
+
Ze.filter((x) => c.row[x] == null || c.row[x] === "").map((x) => {
|
|
2158
|
+
var I;
|
|
2051
2159
|
return [
|
|
2052
|
-
|
|
2053
|
-
Ee(((
|
|
2160
|
+
x,
|
|
2161
|
+
Ee(((I = s.compute_fields) == null ? void 0 : I[x]) ?? "", c.row)
|
|
2054
2162
|
];
|
|
2055
2163
|
})
|
|
2056
2164
|
)
|
|
2057
2165
|
},
|
|
2058
|
-
|
|
2059
|
-
|
|
2166
|
+
z,
|
|
2167
|
+
Ze.length > 0 ? Ze : Et
|
|
2060
2168
|
) && /* @__PURE__ */ u(
|
|
2061
2169
|
"p",
|
|
2062
2170
|
{
|
|
2063
2171
|
"data-catalog-unpriced": !0,
|
|
2064
2172
|
className: "mt-1 flex items-center gap-1 pl-0.5 text-[11px] font-medium text-amber-600 dark:text-amber-400",
|
|
2065
2173
|
children: [
|
|
2066
|
-
/* @__PURE__ */
|
|
2174
|
+
/* @__PURE__ */ a(Ae, { className: "h-3 w-3 shrink-0" }),
|
|
2067
2175
|
"No catalog price: check the price or hand-price it"
|
|
2068
2176
|
]
|
|
2069
2177
|
}
|
|
2070
2178
|
),
|
|
2071
|
-
q && /* @__PURE__ */
|
|
2179
|
+
q && /* @__PURE__ */ a("p", { className: "mt-1 pl-0.5 text-[11px] text-red-500", children: "Removed — applies when you save" })
|
|
2072
2180
|
]
|
|
2073
2181
|
},
|
|
2074
2182
|
c.key
|
|
2075
2183
|
);
|
|
2076
2184
|
}),
|
|
2077
2185
|
(() => {
|
|
2078
|
-
const c =
|
|
2079
|
-
const
|
|
2080
|
-
return !(
|
|
2081
|
-
}),
|
|
2082
|
-
c.map((
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
), b = (
|
|
2086
|
-
var
|
|
2087
|
-
return ((
|
|
2088
|
-
}, q = (
|
|
2186
|
+
const c = Ne.filter(($) => {
|
|
2187
|
+
const J = $.row.id != null ? String($.row.id) : null;
|
|
2188
|
+
return !(J != null && kt.has(J));
|
|
2189
|
+
}), h = ($) => Bs(
|
|
2190
|
+
c.map((J) => J.row),
|
|
2191
|
+
$,
|
|
2192
|
+
s.compute_fields
|
|
2193
|
+
), b = ($) => {
|
|
2194
|
+
var J;
|
|
2195
|
+
return ((J = s.field_formats) == null ? void 0 : J[$]) ?? "number";
|
|
2196
|
+
}, q = ($) => /* @__PURE__ */ a(
|
|
2089
2197
|
"span",
|
|
2090
2198
|
{
|
|
2091
2199
|
...Oe.box(
|
|
2092
|
-
`s:${
|
|
2200
|
+
`s:${$}`,
|
|
2093
2201
|
"w-20 shrink-0",
|
|
2094
2202
|
"truncate text-right text-[12px] font-semibold tabular-nums text-slate-800 dark:text-slate-100"
|
|
2095
2203
|
),
|
|
2096
|
-
children:
|
|
2204
|
+
children: ve(h($), b($))
|
|
2097
2205
|
},
|
|
2098
|
-
|
|
2206
|
+
$
|
|
2099
2207
|
);
|
|
2100
2208
|
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: [
|
|
2101
|
-
/* @__PURE__ */
|
|
2102
|
-
|
|
2103
|
-
const
|
|
2104
|
-
return
|
|
2209
|
+
/* @__PURE__ */ a("span", { className: "flex-1 text-[11px] font-semibold uppercase tracking-wide text-slate-500 dark:text-slate-400", children: "Total" }),
|
|
2210
|
+
Et.map(($) => {
|
|
2211
|
+
const J = f($);
|
|
2212
|
+
return J ? /* @__PURE__ */ a("span", { ...Oe.box(J, "w-20 shrink-0") }, $) : /* @__PURE__ */ a("span", { className: "w-20 shrink-0" }, $);
|
|
2105
2213
|
}),
|
|
2106
|
-
/* @__PURE__ */
|
|
2107
|
-
|
|
2108
|
-
!
|
|
2214
|
+
/* @__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") }),
|
|
2215
|
+
Ze.map(q),
|
|
2216
|
+
!k && /* @__PURE__ */ a("span", { className: "w-6 shrink-0" })
|
|
2109
2217
|
] });
|
|
2110
2218
|
})()
|
|
2111
2219
|
] });
|
|
2112
2220
|
})()
|
|
2113
2221
|
] }),
|
|
2114
|
-
|
|
2115
|
-
|
|
2222
|
+
qr && y && /* @__PURE__ */ a(
|
|
2223
|
+
ra,
|
|
2116
2224
|
{
|
|
2117
2225
|
catalogCol: y,
|
|
2118
|
-
tmpl:
|
|
2119
|
-
sectionBy:
|
|
2226
|
+
tmpl: K,
|
|
2227
|
+
sectionBy: s.section_by,
|
|
2120
2228
|
sectionM2M: d,
|
|
2121
2229
|
pinnedSet: Mt,
|
|
2122
|
-
pinnedIds:
|
|
2123
|
-
savingIds:
|
|
2124
|
-
relatedCols: (
|
|
2230
|
+
pinnedIds: Pe,
|
|
2231
|
+
savingIds: vt,
|
|
2232
|
+
relatedCols: (s.favorites_manager_columns ?? []).map((e) => (s.related_columns ?? []).find((t) => t.key === e)).filter((e) => !!e),
|
|
2125
2233
|
parentDraft: S,
|
|
2126
|
-
onToggle: (e) => void
|
|
2127
|
-
onClose: () =>
|
|
2128
|
-
anchor:
|
|
2234
|
+
onToggle: (e) => void $n(e),
|
|
2235
|
+
onClose: () => jn(!1),
|
|
2236
|
+
anchor: Fn.current
|
|
2129
2237
|
}
|
|
2130
2238
|
)
|
|
2131
2239
|
] }) : /* @__PURE__ */ u("p", { className: "py-1 text-[12px] text-slate-400", children: [
|
|
2132
2240
|
'Catalog picker: field "',
|
|
2133
|
-
|
|
2241
|
+
s.item_field,
|
|
2134
2242
|
'" does not resolve to an M2O relation on',
|
|
2135
2243
|
" ",
|
|
2136
2244
|
i
|
|
2137
2245
|
] });
|
|
2138
2246
|
}
|
|
2139
|
-
function
|
|
2247
|
+
function ea({
|
|
2140
2248
|
builder: i,
|
|
2141
2249
|
defaultItemField: m,
|
|
2142
|
-
catalogCol:
|
|
2143
|
-
catalogFields:
|
|
2250
|
+
catalogCol: p,
|
|
2251
|
+
catalogFields: g,
|
|
2144
2252
|
tmpl: _,
|
|
2145
|
-
currentQty:
|
|
2146
|
-
addQty:
|
|
2147
|
-
qtyStep:
|
|
2148
|
-
readOnly:
|
|
2253
|
+
currentQty: s,
|
|
2254
|
+
addQty: k,
|
|
2255
|
+
qtyStep: w,
|
|
2256
|
+
readOnly: O
|
|
2149
2257
|
}) {
|
|
2150
|
-
const v =
|
|
2258
|
+
const v = ht(), L = i.item_field ?? m, H = i.attributes ?? [], [M, me] = D(!1), [fe, T] = D({}), [be, z] = D("1"), [pe, ge] = D(!1), ke = R(
|
|
2151
2259
|
() => [
|
|
2152
2260
|
"id",
|
|
2153
|
-
|
|
2261
|
+
L,
|
|
2154
2262
|
...H.flatMap((F) => [`${F.field}.id`, `${F.field}.${F.label_field}`])
|
|
2155
2263
|
].join(","),
|
|
2156
|
-
[
|
|
2157
|
-
), { data:
|
|
2264
|
+
[L, H]
|
|
2265
|
+
), { data: V = [], isLoading: Te } = Q({
|
|
2158
2266
|
queryKey: [
|
|
2159
2267
|
"catalog-builder",
|
|
2160
2268
|
i.collection,
|
|
@@ -2162,7 +2270,7 @@ function Is({
|
|
|
2162
2270
|
JSON.stringify(i.filter ?? null)
|
|
2163
2271
|
],
|
|
2164
2272
|
queryFn: () => v.request(
|
|
2165
|
-
|
|
2273
|
+
C(`/items/${i.collection}`, {
|
|
2166
2274
|
limit: 2e3,
|
|
2167
2275
|
fields: ke,
|
|
2168
2276
|
...i.filter ? { filter: JSON.stringify(i.filter) } : {}
|
|
@@ -2171,29 +2279,29 @@ function Is({
|
|
|
2171
2279
|
enabled: M,
|
|
2172
2280
|
staleTime: 6e4
|
|
2173
2281
|
}), he = (F, y) => {
|
|
2174
|
-
var
|
|
2282
|
+
var E;
|
|
2175
2283
|
const N = F[y];
|
|
2176
2284
|
if (N == null) return null;
|
|
2177
2285
|
if (typeof N == "object") {
|
|
2178
|
-
const
|
|
2179
|
-
return { id: String(
|
|
2286
|
+
const P = N, j = ((E = H.find((K) => K.field === y)) == null ? void 0 : E.label_field) ?? "id";
|
|
2287
|
+
return { id: String(P.id ?? ""), label: String(P[j] ?? P.id ?? "") };
|
|
2180
2288
|
}
|
|
2181
2289
|
return { id: String(N), label: String(N) };
|
|
2182
|
-
}, re = (F) =>
|
|
2290
|
+
}, re = (F) => V.filter(
|
|
2183
2291
|
(y) => H.slice(0, F).every((N) => {
|
|
2184
|
-
var
|
|
2185
|
-
const
|
|
2186
|
-
return
|
|
2292
|
+
var P;
|
|
2293
|
+
const E = fe[N.field];
|
|
2294
|
+
return E ? ((P = he(y, N.field)) == null ? void 0 : P.id) === E : !0;
|
|
2187
2295
|
})
|
|
2188
|
-
), ee = H.every((F) => fe[F.field]),
|
|
2296
|
+
), ee = H.every((F) => fe[F.field]), G = ee ? V.find((F) => H.every((y) => {
|
|
2189
2297
|
var N;
|
|
2190
2298
|
return ((N = he(F, y.field)) == null ? void 0 : N.id) === fe[y.field];
|
|
2191
|
-
})) : void 0, B = (
|
|
2192
|
-
queryKey: ["catalog-builder-item",
|
|
2299
|
+
})) : void 0, B = (G == null ? void 0 : G[L]) != null ? String(G[L]) : null, { data: se } = Q({
|
|
2300
|
+
queryKey: ["catalog-builder-item", p, g, B],
|
|
2193
2301
|
queryFn: () => v.request(
|
|
2194
|
-
|
|
2302
|
+
C(`/items/${p}`, {
|
|
2195
2303
|
filter: JSON.stringify({ id: { _eq: B } }),
|
|
2196
|
-
fields:
|
|
2304
|
+
fields: g,
|
|
2197
2305
|
limit: 1
|
|
2198
2306
|
})
|
|
2199
2307
|
).then((F) => {
|
|
@@ -2202,12 +2310,12 @@ function Is({
|
|
|
2202
2310
|
}),
|
|
2203
2311
|
enabled: !!B,
|
|
2204
2312
|
staleTime: 6e4
|
|
2205
|
-
}), ie = Number(be),
|
|
2313
|
+
}), ie = Number(be), _e = !!B && !!se && !pe && be.trim() !== "" && Number.isFinite(ie) && ie > 0 && (w === "any" || Number.isInteger(ie));
|
|
2206
2314
|
async function xe() {
|
|
2207
|
-
if (!(!
|
|
2315
|
+
if (!(!_e || !B || !se)) {
|
|
2208
2316
|
ge(!0);
|
|
2209
2317
|
try {
|
|
2210
|
-
await
|
|
2318
|
+
await k(B, (s(B) ?? 0) + ie, se), T({}), z("1");
|
|
2211
2319
|
} finally {
|
|
2212
2320
|
ge(!1);
|
|
2213
2321
|
}
|
|
@@ -2221,8 +2329,8 @@ function Is({
|
|
|
2221
2329
|
onClick: () => me((F) => !F),
|
|
2222
2330
|
className: "flex w-full items-center gap-1.5 rounded-t-lg bg-slate-100/80 px-2 py-1.5 text-left dark:bg-muted",
|
|
2223
2331
|
children: [
|
|
2224
|
-
/* @__PURE__ */
|
|
2225
|
-
|
|
2332
|
+
/* @__PURE__ */ a(
|
|
2333
|
+
Jt,
|
|
2226
2334
|
{
|
|
2227
2335
|
className: W(
|
|
2228
2336
|
"h-3 w-3 shrink-0 text-slate-400 transition-transform",
|
|
@@ -2230,59 +2338,59 @@ function Is({
|
|
|
2230
2338
|
)
|
|
2231
2339
|
}
|
|
2232
2340
|
),
|
|
2233
|
-
/* @__PURE__ */
|
|
2341
|
+
/* @__PURE__ */ a("span", { className: "text-[11px] font-semibold text-slate-600 dark:text-slate-300", children: i.label })
|
|
2234
2342
|
]
|
|
2235
2343
|
}
|
|
2236
2344
|
),
|
|
2237
|
-
M && /* @__PURE__ */
|
|
2238
|
-
/* @__PURE__ */
|
|
2345
|
+
M && /* @__PURE__ */ a("div", { className: "space-y-2 border-t border-slate-200 p-3 dark:border-border", children: Te ? /* @__PURE__ */ u("div", { className: "flex items-center gap-2 py-2 text-slate-400", children: [
|
|
2346
|
+
/* @__PURE__ */ a(ue, { className: "h-4 w-4 animate-spin" }),
|
|
2239
2347
|
" Loading options…"
|
|
2240
2348
|
] }) : /* @__PURE__ */ u("div", { className: "flex flex-wrap items-end gap-3", children: [
|
|
2241
2349
|
H.map((F, y) => {
|
|
2242
2350
|
const N = /* @__PURE__ */ new Map();
|
|
2243
|
-
for (const
|
|
2244
|
-
const
|
|
2245
|
-
|
|
2351
|
+
for (const P of re(y)) {
|
|
2352
|
+
const j = he(P, F.field);
|
|
2353
|
+
j != null && j.id && N.set(j.id, j.label);
|
|
2246
2354
|
}
|
|
2247
|
-
const
|
|
2248
|
-
([,
|
|
2355
|
+
const E = [...N.entries()].sort(
|
|
2356
|
+
([, P], [, j]) => P.localeCompare(j, void 0, { numeric: !0 })
|
|
2249
2357
|
);
|
|
2250
|
-
return /* @__PURE__ */
|
|
2251
|
-
|
|
2358
|
+
return /* @__PURE__ */ a(
|
|
2359
|
+
wr,
|
|
2252
2360
|
{
|
|
2253
|
-
label:
|
|
2361
|
+
label: Z(F.field),
|
|
2254
2362
|
value: fe[F.field] ?? null,
|
|
2255
2363
|
valueLabel: fe[F.field] ? N.get(fe[F.field]) ?? fe[F.field] : null,
|
|
2256
|
-
options:
|
|
2364
|
+
options: E,
|
|
2257
2365
|
disabled: y > 0 && !fe[H[y - 1].field],
|
|
2258
|
-
onChange: (
|
|
2259
|
-
const
|
|
2260
|
-
for (let
|
|
2261
|
-
const te = H[
|
|
2262
|
-
|
|
2366
|
+
onChange: (P) => T((j) => {
|
|
2367
|
+
const K = {};
|
|
2368
|
+
for (let A = 0; A < y; A++) {
|
|
2369
|
+
const te = H[A].field;
|
|
2370
|
+
j[te] && (K[te] = j[te]);
|
|
2263
2371
|
}
|
|
2264
|
-
return
|
|
2372
|
+
return P && (K[F.field] = P), K;
|
|
2265
2373
|
})
|
|
2266
2374
|
},
|
|
2267
2375
|
F.field
|
|
2268
2376
|
);
|
|
2269
2377
|
}),
|
|
2270
|
-
/* @__PURE__ */
|
|
2271
|
-
/* @__PURE__ */
|
|
2272
|
-
(
|
|
2273
|
-
|
|
2378
|
+
/* @__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: Ce(_, se) }),
|
|
2380
|
+
(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
|
+
s(B),
|
|
2274
2382
|
" in summary"
|
|
2275
2383
|
] }),
|
|
2276
|
-
!
|
|
2277
|
-
/* @__PURE__ */
|
|
2384
|
+
!O && /* @__PURE__ */ u(Se, { children: [
|
|
2385
|
+
/* @__PURE__ */ a(
|
|
2278
2386
|
"input",
|
|
2279
2387
|
{
|
|
2280
2388
|
type: "number",
|
|
2281
2389
|
min: 0,
|
|
2282
|
-
step:
|
|
2390
|
+
step: w,
|
|
2283
2391
|
value: be,
|
|
2284
2392
|
"aria-label": "Quantity to add",
|
|
2285
|
-
onChange: (F) =>
|
|
2393
|
+
onChange: (F) => z(F.target.value),
|
|
2286
2394
|
onKeyDown: (F) => {
|
|
2287
2395
|
F.key === "Enter" && (F.preventDefault(), xe());
|
|
2288
2396
|
},
|
|
@@ -2294,75 +2402,75 @@ function Is({
|
|
|
2294
2402
|
{
|
|
2295
2403
|
type: "button",
|
|
2296
2404
|
onClick: () => void xe(),
|
|
2297
|
-
disabled: !
|
|
2405
|
+
disabled: !_e,
|
|
2298
2406
|
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",
|
|
2299
2407
|
children: [
|
|
2300
|
-
pe ? /* @__PURE__ */
|
|
2408
|
+
pe ? /* @__PURE__ */ a(ue, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ a(xr, { className: "h-3.5 w-3.5" }),
|
|
2301
2409
|
"Add"
|
|
2302
2410
|
]
|
|
2303
2411
|
}
|
|
2304
2412
|
)
|
|
2305
2413
|
] })
|
|
2306
|
-
] }) : ee ? /* @__PURE__ */
|
|
2414
|
+
] }) : ee ? /* @__PURE__ */ a("span", { className: "text-slate-400", children: "No matching item for this combination" }) : /* @__PURE__ */ a("span", { className: "text-slate-400", children: "Pick each attribute to resolve an item" }) })
|
|
2307
2415
|
] }) })
|
|
2308
2416
|
] });
|
|
2309
2417
|
}
|
|
2310
|
-
function
|
|
2418
|
+
function ta({
|
|
2311
2419
|
builder: i,
|
|
2312
2420
|
catalogCol: m,
|
|
2313
|
-
catalogFields:
|
|
2314
|
-
tmpl:
|
|
2421
|
+
catalogFields: p,
|
|
2422
|
+
tmpl: g,
|
|
2315
2423
|
currentQty: _,
|
|
2316
|
-
addQty:
|
|
2317
|
-
qtyStep:
|
|
2318
|
-
readOnly:
|
|
2424
|
+
addQty: s,
|
|
2425
|
+
qtyStep: k,
|
|
2426
|
+
readOnly: w
|
|
2319
2427
|
}) {
|
|
2320
|
-
var
|
|
2321
|
-
const
|
|
2322
|
-
data:
|
|
2323
|
-
isLoading:
|
|
2428
|
+
var _e, xe, F, y;
|
|
2429
|
+
const O = ht(), v = i.facets ?? [], L = i.item_key ?? "item", H = ((_e = i.result) == null ? void 0 : _e.key) ?? "label", M = i.symmetric ?? null, [me, fe] = D(!1), [T, be] = D({}), [z, pe] = D({}), [ge, ke] = D(null), {
|
|
2430
|
+
data: V = [],
|
|
2431
|
+
isLoading: Te,
|
|
2324
2432
|
isError: he
|
|
2325
2433
|
} = Q({
|
|
2326
2434
|
queryKey: ["catalog-facet-builder", i.source],
|
|
2327
|
-
queryFn: () =>
|
|
2435
|
+
queryFn: () => O.request(C(String(i.source))).then((N) => Array.isArray(N.data) ? N.data : []),
|
|
2328
2436
|
enabled: me && !!i.source,
|
|
2329
2437
|
staleTime: 5 * 6e4
|
|
2330
|
-
}), re =
|
|
2438
|
+
}), re = _s(T, v), ee = R(
|
|
2331
2439
|
() => {
|
|
2332
2440
|
var N;
|
|
2333
|
-
return re ?
|
|
2334
|
-
itemKey:
|
|
2441
|
+
return re ? qs(V, T, v, {
|
|
2442
|
+
itemKey: L,
|
|
2335
2443
|
labelKey: H,
|
|
2336
2444
|
sortKey: (N = i.result) == null ? void 0 : N.sort,
|
|
2337
2445
|
symmetric: M
|
|
2338
2446
|
}) : [];
|
|
2339
2447
|
},
|
|
2340
|
-
[re,
|
|
2341
|
-
),
|
|
2342
|
-
queryKey: ["catalog-facet-items", m,
|
|
2448
|
+
[re, V, T, v, L, H, (xe = i.result) == null ? void 0 : xe.sort, M]
|
|
2449
|
+
), G = R(() => ee.map((N) => String(N[L])), [ee, L]), { data: B = /* @__PURE__ */ new Map() } = Q({
|
|
2450
|
+
queryKey: ["catalog-facet-items", m, p, G.join(",")],
|
|
2343
2451
|
queryFn: async () => {
|
|
2344
2452
|
const N = /* @__PURE__ */ new Map();
|
|
2345
|
-
for (let
|
|
2346
|
-
const
|
|
2347
|
-
|
|
2348
|
-
filter: JSON.stringify({ id: { _in:
|
|
2349
|
-
fields:
|
|
2350
|
-
limit:
|
|
2453
|
+
for (let E = 0; E < G.length; E += 200) {
|
|
2454
|
+
const P = G.slice(E, E + 200), j = await O.request(
|
|
2455
|
+
C(`/items/${m}`, {
|
|
2456
|
+
filter: JSON.stringify({ id: { _in: P } }),
|
|
2457
|
+
fields: p,
|
|
2458
|
+
limit: P.length
|
|
2351
2459
|
})
|
|
2352
2460
|
);
|
|
2353
|
-
for (const
|
|
2461
|
+
for (const K of j.data ?? []) N.set(String(K.id), K);
|
|
2354
2462
|
}
|
|
2355
2463
|
return N;
|
|
2356
2464
|
},
|
|
2357
|
-
enabled:
|
|
2465
|
+
enabled: G.length > 0,
|
|
2358
2466
|
staleTime: 6e4
|
|
2359
|
-
}), se = v.filter((N) =>
|
|
2467
|
+
}), se = v.filter((N) => T[N.key]).length;
|
|
2360
2468
|
async function ie(N) {
|
|
2361
|
-
const
|
|
2362
|
-
if (!(
|
|
2469
|
+
const E = z[N] ?? "1", P = Number(E), j = B.get(N);
|
|
2470
|
+
if (!(!j || !Number.isFinite(P) || P <= 0 || k !== "any" && !Number.isInteger(P))) {
|
|
2363
2471
|
ke(N);
|
|
2364
2472
|
try {
|
|
2365
|
-
await
|
|
2473
|
+
await s(N, (_(N) ?? 0) + P, j), pe((K) => ({ ...K, [N]: "1" }));
|
|
2366
2474
|
} finally {
|
|
2367
2475
|
ke(null);
|
|
2368
2476
|
}
|
|
@@ -2382,8 +2490,8 @@ function Qs({
|
|
|
2382
2490
|
"aria-expanded": me,
|
|
2383
2491
|
className: "flex w-full items-center gap-1.5 rounded-t-lg bg-slate-100/80 px-2 py-1.5 text-left dark:bg-muted",
|
|
2384
2492
|
children: [
|
|
2385
|
-
/* @__PURE__ */
|
|
2386
|
-
|
|
2493
|
+
/* @__PURE__ */ a(
|
|
2494
|
+
Jt,
|
|
2387
2495
|
{
|
|
2388
2496
|
className: W(
|
|
2389
2497
|
"h-3 w-3 shrink-0 text-slate-400 transition-transform",
|
|
@@ -2391,25 +2499,25 @@ function Qs({
|
|
|
2391
2499
|
)
|
|
2392
2500
|
}
|
|
2393
2501
|
),
|
|
2394
|
-
/* @__PURE__ */
|
|
2502
|
+
/* @__PURE__ */ a("span", { className: "text-[11px] font-semibold text-slate-600 dark:text-slate-300", children: i.label })
|
|
2395
2503
|
]
|
|
2396
2504
|
}
|
|
2397
2505
|
),
|
|
2398
|
-
me && /* @__PURE__ */
|
|
2399
|
-
/* @__PURE__ */
|
|
2506
|
+
me && /* @__PURE__ */ a("div", { className: "space-y-3 border-t border-slate-200 p-3 dark:border-border", children: Te ? /* @__PURE__ */ u("div", { className: "flex items-center gap-2 py-2 text-slate-400", children: [
|
|
2507
|
+
/* @__PURE__ */ a(ue, { className: "h-4 w-4 animate-spin" }),
|
|
2400
2508
|
" Loading options…"
|
|
2401
|
-
] }) : he ? /* @__PURE__ */
|
|
2509
|
+
] }) : 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: [
|
|
2402
2510
|
/* @__PURE__ */ u("div", { className: "flex flex-wrap items-end gap-3", children: [
|
|
2403
2511
|
v.map((N) => {
|
|
2404
|
-
const
|
|
2405
|
-
return /* @__PURE__ */
|
|
2406
|
-
|
|
2512
|
+
const E = $s(V, T, v, N.key, M);
|
|
2513
|
+
return /* @__PURE__ */ a(
|
|
2514
|
+
wr,
|
|
2407
2515
|
{
|
|
2408
2516
|
label: N.label,
|
|
2409
|
-
value:
|
|
2410
|
-
valueLabel:
|
|
2411
|
-
options:
|
|
2412
|
-
onChange: (
|
|
2517
|
+
value: T[N.key] ?? null,
|
|
2518
|
+
valueLabel: T[N.key] ?? null,
|
|
2519
|
+
options: E.map((P) => [P, P]),
|
|
2520
|
+
onChange: (P) => be((j) => js(V, j, v, N.key, P, M))
|
|
2413
2521
|
},
|
|
2414
2522
|
N.key
|
|
2415
2523
|
);
|
|
@@ -2421,46 +2529,46 @@ function Qs({
|
|
|
2421
2529
|
onClick: () => be({}),
|
|
2422
2530
|
className: "mb-0.5 flex h-7 items-center gap-1 rounded px-2 text-[12px] text-slate-500 hover:bg-muted hover:text-slate-700 dark:text-slate-400 dark:hover:text-slate-200",
|
|
2423
2531
|
children: [
|
|
2424
|
-
/* @__PURE__ */
|
|
2532
|
+
/* @__PURE__ */ a(pt, { className: "h-3 w-3" }),
|
|
2425
2533
|
" Clear"
|
|
2426
2534
|
]
|
|
2427
2535
|
}
|
|
2428
2536
|
)
|
|
2429
2537
|
] }),
|
|
2430
|
-
re ? ee.length === 0 ? /* @__PURE__ */
|
|
2538
|
+
re ? ee.length === 0 ? /* @__PURE__ */ a("p", { className: "text-slate-400", children: "Nothing matches this combination." }) : /* @__PURE__ */ u("div", { className: "divide-y divide-slate-100 rounded border border-slate-200 dark:divide-border dark:border-border", children: [
|
|
2431
2539
|
/* @__PURE__ */ u("div", { className: "flex items-center gap-2 bg-slate-50 px-2 py-1 text-[10px] font-medium uppercase tracking-wide text-slate-500 dark:bg-muted dark:text-slate-400", children: [
|
|
2432
|
-
/* @__PURE__ */
|
|
2433
|
-
!
|
|
2540
|
+
/* @__PURE__ */ a("span", { className: "flex-1", children: ((y = i.result) == null ? void 0 : y.label) ?? "Option" }),
|
|
2541
|
+
!w && /* @__PURE__ */ a("span", { className: "w-[124px] text-right", children: "Quantity" })
|
|
2434
2542
|
] }),
|
|
2435
2543
|
ee.map((N) => {
|
|
2436
|
-
var
|
|
2437
|
-
const
|
|
2544
|
+
var A;
|
|
2545
|
+
const E = String(N[L]), P = B.get(E), j = _(E) ?? 0, K = (A = i.result) != null && A.detail ? String(N[i.result.detail] ?? "") : "";
|
|
2438
2546
|
return /* @__PURE__ */ u(
|
|
2439
2547
|
"div",
|
|
2440
2548
|
{
|
|
2441
2549
|
className: "flex items-center gap-2 px-2 py-1.5",
|
|
2442
|
-
"data-facet-result":
|
|
2550
|
+
"data-facet-result": E,
|
|
2443
2551
|
children: [
|
|
2444
2552
|
/* @__PURE__ */ u("div", { className: "min-w-0 flex-1", children: [
|
|
2445
|
-
/* @__PURE__ */
|
|
2446
|
-
/* @__PURE__ */
|
|
2553
|
+
/* @__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: K || (P ? Ce(g, P) : "") })
|
|
2447
2555
|
] }),
|
|
2448
|
-
|
|
2449
|
-
|
|
2556
|
+
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
|
+
j,
|
|
2450
2558
|
" in summary"
|
|
2451
2559
|
] }),
|
|
2452
|
-
!
|
|
2453
|
-
/* @__PURE__ */
|
|
2560
|
+
!w && /* @__PURE__ */ u(Se, { children: [
|
|
2561
|
+
/* @__PURE__ */ a(
|
|
2454
2562
|
"input",
|
|
2455
2563
|
{
|
|
2456
2564
|
type: "number",
|
|
2457
2565
|
min: 0,
|
|
2458
|
-
step:
|
|
2459
|
-
value:
|
|
2566
|
+
step: k,
|
|
2567
|
+
value: z[E] ?? "1",
|
|
2460
2568
|
"aria-label": `Quantity of ${String(N[H] ?? "")}`,
|
|
2461
|
-
onChange: (te) => pe((
|
|
2569
|
+
onChange: (te) => pe((Je) => ({ ...Je, [E]: te.target.value })),
|
|
2462
2570
|
onKeyDown: (te) => {
|
|
2463
|
-
te.key === "Enter" && (te.preventDefault(), ie(
|
|
2571
|
+
te.key === "Enter" && (te.preventDefault(), ie(E));
|
|
2464
2572
|
},
|
|
2465
2573
|
className: "h-7 w-16 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"
|
|
2466
2574
|
}
|
|
@@ -2469,11 +2577,11 @@ function Qs({
|
|
|
2469
2577
|
"button",
|
|
2470
2578
|
{
|
|
2471
2579
|
type: "button",
|
|
2472
|
-
onClick: () => void ie(
|
|
2473
|
-
disabled: !
|
|
2580
|
+
onClick: () => void ie(E),
|
|
2581
|
+
disabled: !P || ge !== null,
|
|
2474
2582
|
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",
|
|
2475
2583
|
children: [
|
|
2476
|
-
ge ===
|
|
2584
|
+
ge === E ? /* @__PURE__ */ a(ue, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ a(xr, { className: "h-3.5 w-3.5" }),
|
|
2477
2585
|
"Add"
|
|
2478
2586
|
]
|
|
2479
2587
|
}
|
|
@@ -2481,13 +2589,13 @@ function Qs({
|
|
|
2481
2589
|
] })
|
|
2482
2590
|
]
|
|
2483
2591
|
},
|
|
2484
|
-
|
|
2592
|
+
E
|
|
2485
2593
|
);
|
|
2486
2594
|
})
|
|
2487
2595
|
] }) : /* @__PURE__ */ u("p", { className: "text-slate-400", children: [
|
|
2488
2596
|
"Pick",
|
|
2489
2597
|
" ",
|
|
2490
|
-
v.filter((N) => !
|
|
2598
|
+
v.filter((N) => !T[N.key]).map((N) => N.label).join(", "),
|
|
2491
2599
|
" ",
|
|
2492
2600
|
"to see the ",
|
|
2493
2601
|
(((F = i.result) == null ? void 0 : F.label) ?? "options").toLowerCase(),
|
|
@@ -2498,202 +2606,202 @@ function Qs({
|
|
|
2498
2606
|
}
|
|
2499
2607
|
);
|
|
2500
2608
|
}
|
|
2501
|
-
function
|
|
2609
|
+
function na({
|
|
2502
2610
|
parentCollection: i,
|
|
2503
2611
|
field: m,
|
|
2504
|
-
id:
|
|
2612
|
+
id: p
|
|
2505
2613
|
}) {
|
|
2506
|
-
var
|
|
2507
|
-
const
|
|
2614
|
+
var w;
|
|
2615
|
+
const g = ht(), { data: _ = [] } = Q({
|
|
2508
2616
|
queryKey: At.collectionRelations(i),
|
|
2509
|
-
queryFn: () =>
|
|
2617
|
+
queryFn: () => yn(g, i),
|
|
2510
2618
|
enabled: !!i,
|
|
2511
2619
|
staleTime: 10 * 6e4
|
|
2512
|
-
}),
|
|
2513
|
-
(
|
|
2514
|
-
)) == null ? void 0 :
|
|
2515
|
-
queryKey: ["col-meta",
|
|
2516
|
-
queryFn: () =>
|
|
2517
|
-
enabled: !!
|
|
2620
|
+
}), s = ((w = _.find(
|
|
2621
|
+
(O) => O.many_collection === i && O.many_field === m && !O.junction_field
|
|
2622
|
+
)) == null ? void 0 : w.one_collection) ?? null, { data: k } = Q({
|
|
2623
|
+
queryKey: ["col-meta", s],
|
|
2624
|
+
queryFn: () => g.request(C(`/collections/${s}`)).then((O) => O.data),
|
|
2625
|
+
enabled: !!s,
|
|
2518
2626
|
staleTime: 3e5
|
|
2519
2627
|
});
|
|
2520
|
-
return
|
|
2628
|
+
return s ? /* @__PURE__ */ a(Us, { collection: s, id: p, displayTemplate: k == null ? void 0 : k.display_template }) : /* @__PURE__ */ u(Se, { children: [
|
|
2521
2629
|
"this ",
|
|
2522
|
-
|
|
2630
|
+
Z(m)
|
|
2523
2631
|
] });
|
|
2524
2632
|
}
|
|
2525
|
-
function
|
|
2633
|
+
function br({
|
|
2526
2634
|
text: i,
|
|
2527
2635
|
highlight: m,
|
|
2528
|
-
className:
|
|
2529
|
-
...
|
|
2636
|
+
className: p,
|
|
2637
|
+
...g
|
|
2530
2638
|
}) {
|
|
2531
|
-
const _ =
|
|
2532
|
-
return /* @__PURE__ */
|
|
2639
|
+
const _ = Ns(i);
|
|
2640
|
+
return /* @__PURE__ */ a("span", { ref: _, className: W("truncate", p), ...g, children: m ? /* @__PURE__ */ a(gn, { text: i, query: m }) : i });
|
|
2533
2641
|
}
|
|
2534
|
-
function
|
|
2642
|
+
function wr({
|
|
2535
2643
|
label: i,
|
|
2536
2644
|
value: m,
|
|
2537
|
-
valueLabel:
|
|
2538
|
-
options:
|
|
2645
|
+
valueLabel: p,
|
|
2646
|
+
options: g,
|
|
2539
2647
|
disabled: _,
|
|
2540
|
-
onChange:
|
|
2648
|
+
onChange: s
|
|
2541
2649
|
}) {
|
|
2542
|
-
const [
|
|
2543
|
-
return
|
|
2544
|
-
if (!
|
|
2545
|
-
const v = (
|
|
2546
|
-
|
|
2650
|
+
const [k, w] = D(!1), O = je(null);
|
|
2651
|
+
return Fe(() => {
|
|
2652
|
+
if (!k) return;
|
|
2653
|
+
const v = (L) => {
|
|
2654
|
+
O.current && !O.current.contains(L.target) && w(!1);
|
|
2547
2655
|
};
|
|
2548
2656
|
return document.addEventListener("mousedown", v), () => document.removeEventListener("mousedown", v);
|
|
2549
|
-
}, [
|
|
2550
|
-
/* @__PURE__ */
|
|
2657
|
+
}, [k]), /* @__PURE__ */ u("div", { ref: O, className: "relative", children: [
|
|
2658
|
+
/* @__PURE__ */ a("p", { className: "mb-1 text-[10px] font-medium text-slate-500 dark:text-slate-400", children: i }),
|
|
2551
2659
|
/* @__PURE__ */ u(
|
|
2552
2660
|
"button",
|
|
2553
2661
|
{
|
|
2554
2662
|
type: "button",
|
|
2555
2663
|
disabled: _,
|
|
2556
|
-
onClick: () =>
|
|
2664
|
+
onClick: () => w((v) => !v),
|
|
2557
2665
|
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",
|
|
2558
2666
|
children: [
|
|
2559
|
-
/* @__PURE__ */
|
|
2560
|
-
/* @__PURE__ */
|
|
2667
|
+
/* @__PURE__ */ a("span", { className: W("truncate", !p && "text-slate-400"), children: p ?? "Select…" }),
|
|
2668
|
+
/* @__PURE__ */ a(os, { className: "h-3.5 w-3.5 shrink-0 text-slate-400" })
|
|
2561
2669
|
]
|
|
2562
2670
|
}
|
|
2563
2671
|
),
|
|
2564
|
-
|
|
2672
|
+
k && /* @__PURE__ */ u("div", { className: "absolute z-50 mt-1 max-h-52 w-44 overflow-y-auto rounded-md border border-border bg-popover py-1 shadow-md", children: [
|
|
2565
2673
|
m && /* @__PURE__ */ u(
|
|
2566
2674
|
"button",
|
|
2567
2675
|
{
|
|
2568
2676
|
type: "button",
|
|
2569
2677
|
onClick: () => {
|
|
2570
|
-
|
|
2678
|
+
s(null), w(!1);
|
|
2571
2679
|
},
|
|
2572
2680
|
className: "flex w-full items-center gap-1.5 border-b border-slate-100 px-2 py-1 text-left text-[12px] text-slate-500 hover:bg-muted dark:border-border dark:text-slate-400",
|
|
2573
2681
|
children: [
|
|
2574
|
-
/* @__PURE__ */
|
|
2682
|
+
/* @__PURE__ */ a(pt, { className: "h-3 w-3 text-slate-400" }),
|
|
2575
2683
|
" Clear"
|
|
2576
2684
|
]
|
|
2577
2685
|
}
|
|
2578
2686
|
),
|
|
2579
|
-
|
|
2687
|
+
g.map(([v, L]) => /* @__PURE__ */ a(
|
|
2580
2688
|
"button",
|
|
2581
2689
|
{
|
|
2582
2690
|
type: "button",
|
|
2583
2691
|
onClick: () => {
|
|
2584
|
-
|
|
2692
|
+
s(v), w(!1);
|
|
2585
2693
|
},
|
|
2586
2694
|
className: W(
|
|
2587
2695
|
"block w-full truncate px-2 py-1 text-left text-[12px] hover:bg-muted",
|
|
2588
2696
|
v === m ? "font-medium text-nvr-cyan" : "text-slate-700 dark:text-slate-200"
|
|
2589
2697
|
),
|
|
2590
|
-
children:
|
|
2698
|
+
children: L
|
|
2591
2699
|
},
|
|
2592
2700
|
v
|
|
2593
2701
|
))
|
|
2594
2702
|
] })
|
|
2595
2703
|
] });
|
|
2596
2704
|
}
|
|
2597
|
-
function
|
|
2705
|
+
function ra({
|
|
2598
2706
|
catalogCol: i,
|
|
2599
2707
|
tmpl: m,
|
|
2600
|
-
sectionBy:
|
|
2601
|
-
sectionM2M:
|
|
2708
|
+
sectionBy: p,
|
|
2709
|
+
sectionM2M: g,
|
|
2602
2710
|
pinnedSet: _,
|
|
2603
|
-
pinnedIds:
|
|
2604
|
-
savingIds:
|
|
2605
|
-
relatedCols:
|
|
2606
|
-
parentDraft:
|
|
2711
|
+
pinnedIds: s,
|
|
2712
|
+
savingIds: k,
|
|
2713
|
+
relatedCols: w,
|
|
2714
|
+
parentDraft: O,
|
|
2607
2715
|
onToggle: v,
|
|
2608
|
-
onClose:
|
|
2716
|
+
onClose: L,
|
|
2609
2717
|
anchor: H
|
|
2610
2718
|
}) {
|
|
2611
|
-
const M =
|
|
2612
|
-
|
|
2719
|
+
const M = ht(), [me, fe] = D(""), [T, be] = D(""), [z, pe] = D(1), ge = je(null);
|
|
2720
|
+
Fe(() => {
|
|
2613
2721
|
const d = setTimeout(() => be(me), 300);
|
|
2614
2722
|
return () => clearTimeout(d);
|
|
2615
|
-
}, [me]),
|
|
2723
|
+
}, [me]), Fe(() => pe(1), [T]), Fe(() => {
|
|
2616
2724
|
var d;
|
|
2617
2725
|
(d = ge.current) == null || d.focus();
|
|
2618
|
-
}, []),
|
|
2726
|
+
}, []), Fe(() => {
|
|
2619
2727
|
const d = (S) => {
|
|
2620
|
-
S.key === "Escape" && (S.stopPropagation(),
|
|
2728
|
+
S.key === "Escape" && (S.stopPropagation(), L());
|
|
2621
2729
|
};
|
|
2622
2730
|
return window.addEventListener("keydown", d, !0), () => window.removeEventListener("keydown", d, !0);
|
|
2623
|
-
}, [
|
|
2624
|
-
const ke =
|
|
2731
|
+
}, [L]);
|
|
2732
|
+
const ke = R(() => {
|
|
2625
2733
|
var S;
|
|
2626
2734
|
const d = (S = [...(m ?? "").matchAll(/\{\{([\w.]+)\}\}/g)][0]) == null ? void 0 : S[1];
|
|
2627
2735
|
return d && !d.includes(".") ? d : "id";
|
|
2628
|
-
}, [m]),
|
|
2629
|
-
queryKey: ["favorites-manager-list", i,
|
|
2736
|
+
}, [m]), V = !g && p.includes(".") ? `*,${p}` : "*", Te = 50, { data: he, isFetching: re } = Q({
|
|
2737
|
+
queryKey: ["favorites-manager-list", i, T, ke, z],
|
|
2630
2738
|
queryFn: () => M.request(
|
|
2631
|
-
|
|
2632
|
-
fields:
|
|
2633
|
-
limit:
|
|
2634
|
-
page:
|
|
2739
|
+
C(`/items/${i}`, {
|
|
2740
|
+
fields: V,
|
|
2741
|
+
limit: Te,
|
|
2742
|
+
page: z,
|
|
2635
2743
|
sort: ke,
|
|
2636
|
-
...
|
|
2744
|
+
...T.trim() ? { search: T } : {}
|
|
2637
2745
|
})
|
|
2638
2746
|
),
|
|
2639
2747
|
staleTime: 3e4,
|
|
2640
2748
|
placeholderData: (d) => d
|
|
2641
|
-
}), ee = ((he == null ? void 0 : he.data) ?? []).filter((d) => !_.has(String(d.id))),
|
|
2642
|
-
queryKey: ["favorites-manager-pinned", i,
|
|
2749
|
+
}), 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
|
+
queryKey: ["favorites-manager-pinned", i, V, s.join(",")],
|
|
2643
2751
|
queryFn: () => M.request(
|
|
2644
|
-
|
|
2645
|
-
filter: JSON.stringify({ id: { _in:
|
|
2646
|
-
fields:
|
|
2647
|
-
limit:
|
|
2752
|
+
C(`/items/${i}`, {
|
|
2753
|
+
filter: JSON.stringify({ id: { _in: s } }),
|
|
2754
|
+
fields: V,
|
|
2755
|
+
limit: s.length,
|
|
2648
2756
|
sort: ke
|
|
2649
2757
|
})
|
|
2650
2758
|
).then((d) => d.data ?? []),
|
|
2651
|
-
enabled:
|
|
2759
|
+
enabled: s.length > 0,
|
|
2652
2760
|
staleTime: 3e4
|
|
2653
|
-
}), ie =
|
|
2761
|
+
}), ie = R(() => {
|
|
2654
2762
|
const d = /* @__PURE__ */ new Set();
|
|
2655
2763
|
for (const S of ee) d.add(String(S.id));
|
|
2656
|
-
for (const S of
|
|
2764
|
+
for (const S of s) d.add(S);
|
|
2657
2765
|
return [...d];
|
|
2658
|
-
}, [ee,
|
|
2659
|
-
queryKey: ["favorites-manager-sections",
|
|
2766
|
+
}, [ee, s]), { data: _e = /* @__PURE__ */ new Map() } = Q({
|
|
2767
|
+
queryKey: ["favorites-manager-sections", g == null ? void 0 : g.junction, ie.join(",")],
|
|
2660
2768
|
queryFn: async () => {
|
|
2661
|
-
const d =
|
|
2769
|
+
const d = g, S = await It(M, `/items/${d.junction}`, {
|
|
2662
2770
|
fields: `${d.fkToItem},${d.fkToSection}`,
|
|
2663
2771
|
filter: JSON.stringify({ [d.fkToItem]: { _in: ie } })
|
|
2664
|
-
}),
|
|
2772
|
+
}), X = [...new Set(S.map((ne) => String(ne[d.fkToSection])))], le = X.length ? await It(M, `/items/${d.target}`, {
|
|
2665
2773
|
fields: `id,${d.labelPath}`,
|
|
2666
|
-
filter: JSON.stringify({ id: { _in:
|
|
2774
|
+
filter: JSON.stringify({ id: { _in: X } })
|
|
2667
2775
|
}) : [], Y = new Map(
|
|
2668
|
-
le.map((ne) => [String(ne.id), String(
|
|
2776
|
+
le.map((ne) => [String(ne.id), String(kr(ne, d.labelPath) ?? "")])
|
|
2669
2777
|
), ae = /* @__PURE__ */ new Map();
|
|
2670
2778
|
for (const ne of S) {
|
|
2671
|
-
const
|
|
2672
|
-
if (!
|
|
2673
|
-
const
|
|
2674
|
-
oe.includes(
|
|
2779
|
+
const U = Y.get(String(ne[d.fkToSection]));
|
|
2780
|
+
if (!U) continue;
|
|
2781
|
+
const Ie = String(ne[d.fkToItem]), oe = ae.get(Ie) ?? [];
|
|
2782
|
+
oe.includes(U) || oe.push(U), ae.set(Ie, oe);
|
|
2675
2783
|
}
|
|
2676
2784
|
return ae;
|
|
2677
2785
|
},
|
|
2678
|
-
enabled: !!
|
|
2786
|
+
enabled: !!g && ie.length > 0,
|
|
2679
2787
|
staleTime: 6e4
|
|
2680
|
-
}), xe = (d) => m ?
|
|
2788
|
+
}), xe = (d) => m ? Ce(m, d) : String(d.cifa_number ?? d.name ?? `#${d.id}`), F = (d) => {
|
|
2681
2789
|
const S = d.description ?? d.long_description ?? d.name;
|
|
2682
2790
|
return typeof S == "string" && S.trim() && S.trim() !== xe(d) ? S : "";
|
|
2683
2791
|
}, y = (d) => {
|
|
2684
|
-
if (
|
|
2685
|
-
if (!
|
|
2686
|
-
const S =
|
|
2687
|
-
return S === `{{${
|
|
2792
|
+
if (g) return (_e.get(String(d.id)) ?? []).join(", ");
|
|
2793
|
+
if (!p) return "";
|
|
2794
|
+
const S = Ce(`{{${p}}}`, d);
|
|
2795
|
+
return S === `{{${p}}}` ? "" : S;
|
|
2688
2796
|
}, N = (d, S) => {
|
|
2689
2797
|
if (S === "presence")
|
|
2690
2798
|
return d == null || d === "" || Number(d) === 0 ? "No" : "Yes";
|
|
2691
2799
|
if (d == null || d === "") return "—";
|
|
2692
|
-
const
|
|
2693
|
-
return S === "currency" && Number.isFinite(
|
|
2694
|
-
},
|
|
2695
|
-
queries:
|
|
2696
|
-
const S =
|
|
2800
|
+
const X = Number(d);
|
|
2801
|
+
return S === "currency" && Number.isFinite(X) ? X.toLocaleString("en-US", { style: "currency", currency: "USD" }) : S === "number" && Number.isFinite(X) ? X.toLocaleString() : String(d);
|
|
2802
|
+
}, E = xn({
|
|
2803
|
+
queries: w.map((d) => {
|
|
2804
|
+
const S = Ge(d.match, O);
|
|
2697
2805
|
return {
|
|
2698
2806
|
queryKey: [
|
|
2699
2807
|
"favorites-manager-related",
|
|
@@ -2703,16 +2811,16 @@ function Ms({
|
|
|
2703
2811
|
ie.join(",")
|
|
2704
2812
|
],
|
|
2705
2813
|
queryFn: async () => {
|
|
2706
|
-
const
|
|
2707
|
-
|
|
2814
|
+
const X = await M.request(
|
|
2815
|
+
C(`/items/${d.collection}`, {
|
|
2708
2816
|
filter: JSON.stringify({ [d.item_field]: { _in: ie }, ...S ?? {} }),
|
|
2709
2817
|
fields: `${d.item_field},${d.value_field}`,
|
|
2710
2818
|
limit: 1e3
|
|
2711
2819
|
})
|
|
2712
2820
|
).then((Y) => Y.data ?? []), le = /* @__PURE__ */ new Map();
|
|
2713
|
-
for (const Y of
|
|
2714
|
-
const ae = String(Y[d.item_field]), ne = Y[d.value_field],
|
|
2715
|
-
|
|
2821
|
+
for (const Y of X) {
|
|
2822
|
+
const ae = String(Y[d.item_field]), ne = Y[d.value_field], U = le.get(ae);
|
|
2823
|
+
U === void 0 ? le.set(ae, ne) : Number.isFinite(Number(U)) && Number.isFinite(Number(ne)) && le.set(ae, Number(U) + Number(ne));
|
|
2716
2824
|
}
|
|
2717
2825
|
return le;
|
|
2718
2826
|
},
|
|
@@ -2720,20 +2828,20 @@ function Ms({
|
|
|
2720
2828
|
staleTime: 3e4
|
|
2721
2829
|
};
|
|
2722
2830
|
})
|
|
2723
|
-
}),
|
|
2724
|
-
(d) => d.match !== void 0 &&
|
|
2725
|
-
),
|
|
2831
|
+
}), P = w.filter(
|
|
2832
|
+
(d) => d.match !== void 0 && Ge(d.match, O) === null
|
|
2833
|
+
), j = (d) => {
|
|
2726
2834
|
const S = _.has(d);
|
|
2727
|
-
return /* @__PURE__ */
|
|
2835
|
+
return /* @__PURE__ */ a(
|
|
2728
2836
|
"button",
|
|
2729
2837
|
{
|
|
2730
2838
|
type: "button",
|
|
2731
2839
|
title: S ? "Remove from favorites" : "Add to favorites",
|
|
2732
|
-
disabled:
|
|
2840
|
+
disabled: k.has(d),
|
|
2733
2841
|
onClick: () => v(d),
|
|
2734
2842
|
className: "shrink-0 rounded p-1 transition-colors hover:bg-amber-100/60 dark:hover:bg-amber-400/10",
|
|
2735
|
-
children:
|
|
2736
|
-
|
|
2843
|
+
children: k.has(d) ? /* @__PURE__ */ a(ue, { className: "h-4 w-4 animate-spin text-amber-400" }) : /* @__PURE__ */ a(
|
|
2844
|
+
ft,
|
|
2737
2845
|
{
|
|
2738
2846
|
className: W(
|
|
2739
2847
|
"h-4 w-4",
|
|
@@ -2743,8 +2851,8 @@ function Ms({
|
|
|
2743
2851
|
)
|
|
2744
2852
|
}
|
|
2745
2853
|
);
|
|
2746
|
-
},
|
|
2747
|
-
const
|
|
2854
|
+
}, K = (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 }) }), A = (d, S) => {
|
|
2855
|
+
const X = String(d.id), le = F(d);
|
|
2748
2856
|
return /* @__PURE__ */ u(
|
|
2749
2857
|
"tr",
|
|
2750
2858
|
{
|
|
@@ -2753,43 +2861,43 @@ function Ms({
|
|
|
2753
2861
|
S % 2 === 0 ? "bg-white dark:bg-background" : "bg-slate-50/50 dark:bg-muted/30"
|
|
2754
2862
|
),
|
|
2755
2863
|
children: [
|
|
2756
|
-
/* @__PURE__ */
|
|
2757
|
-
/* @__PURE__ */
|
|
2864
|
+
/* @__PURE__ */ a("td", { className: "px-2 py-1", children: j(X) }),
|
|
2865
|
+
/* @__PURE__ */ a("td", { className: "px-2 py-1 font-medium tabular-nums text-slate-700 dark:text-slate-200", children: yr(i) ? /* @__PURE__ */ a(
|
|
2758
2866
|
"button",
|
|
2759
2867
|
{
|
|
2760
2868
|
type: "button",
|
|
2761
|
-
onClick: () =>
|
|
2869
|
+
onClick: () => gr(i, X, O),
|
|
2762
2870
|
title: "View stock & planning detail",
|
|
2763
2871
|
className: "text-left underline decoration-slate-300 decoration-1 underline-offset-2 hover:text-[#009abe] hover:decoration-[#009abe] dark:decoration-slate-600",
|
|
2764
2872
|
children: xe(d)
|
|
2765
2873
|
}
|
|
2766
2874
|
) : xe(d) }),
|
|
2767
|
-
/* @__PURE__ */
|
|
2768
|
-
/* @__PURE__ */
|
|
2769
|
-
|
|
2770
|
-
var
|
|
2771
|
-
const ne = Y.match !== void 0 &&
|
|
2772
|
-
return /* @__PURE__ */
|
|
2875
|
+
/* @__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": le || void 0, children: le || "—" }) }),
|
|
2876
|
+
/* @__PURE__ */ a("td", { className: "px-2 py-1", children: /* @__PURE__ */ a("p", { className: "truncate text-slate-500 dark:text-slate-400", children: y(d) || "—" }) }),
|
|
2877
|
+
w.map((Y, ae) => {
|
|
2878
|
+
var Ie, oe;
|
|
2879
|
+
const ne = Y.match !== void 0 && Ge(Y.match, O) === null, U = ne || (oe = (Ie = E[ae]) == null ? void 0 : Ie.data) == null ? void 0 : oe.get(X);
|
|
2880
|
+
return /* @__PURE__ */ a(
|
|
2773
2881
|
"td",
|
|
2774
2882
|
{
|
|
2775
2883
|
className: "whitespace-nowrap px-2 py-1 text-right tabular-nums text-slate-600 dark:text-slate-300",
|
|
2776
|
-
children: ne ? "—" : N(
|
|
2884
|
+
children: ne ? "—" : N(U, Y.format)
|
|
2777
2885
|
},
|
|
2778
2886
|
Y.key
|
|
2779
2887
|
);
|
|
2780
2888
|
})
|
|
2781
2889
|
]
|
|
2782
2890
|
},
|
|
2783
|
-
|
|
2891
|
+
X
|
|
2784
2892
|
);
|
|
2785
|
-
}, te = (H == null ? void 0 : H.closest('[role="dialog"]')) ?? document.body,
|
|
2786
|
-
return
|
|
2893
|
+
}, te = (H == null ? void 0 : H.closest('[role="dialog"]')) ?? document.body, Je = me.trim() ? se.filter((d) => ks(`${xe(d)} ${F(d)} ${y(d)}`, me)) : se;
|
|
2894
|
+
return ds(
|
|
2787
2895
|
/* @__PURE__ */ u("div", { className: "fixed inset-0 z-[125]", role: "presentation", children: [
|
|
2788
|
-
/* @__PURE__ */
|
|
2896
|
+
/* @__PURE__ */ a(
|
|
2789
2897
|
"div",
|
|
2790
2898
|
{
|
|
2791
2899
|
className: "absolute inset-0 bg-slate-900/30 motion-safe:animate-in motion-safe:fade-in",
|
|
2792
|
-
onClick:
|
|
2900
|
+
onClick: L
|
|
2793
2901
|
}
|
|
2794
2902
|
),
|
|
2795
2903
|
/* @__PURE__ */ u(
|
|
@@ -2801,26 +2909,26 @@ function Ms({
|
|
|
2801
2909
|
className: "absolute inset-y-0 right-0 flex flex-col border-l border-slate-200 bg-white shadow-2xl motion-safe:animate-in motion-safe:slide-in-from-right dark:border-border dark:bg-background",
|
|
2802
2910
|
children: [
|
|
2803
2911
|
/* @__PURE__ */ u("div", { className: "flex items-start gap-2.5 border-b border-slate-200 px-4 py-3 dark:border-border", children: [
|
|
2804
|
-
/* @__PURE__ */
|
|
2912
|
+
/* @__PURE__ */ a(ft, { className: "mt-0.5 h-4 w-4 shrink-0 fill-amber-400 text-amber-400" }),
|
|
2805
2913
|
/* @__PURE__ */ u("div", { className: "min-w-0 flex-1", children: [
|
|
2806
|
-
/* @__PURE__ */
|
|
2807
|
-
/* @__PURE__ */
|
|
2914
|
+
/* @__PURE__ */ a("p", { className: "text-[13px] font-semibold text-slate-800 dark:text-slate-100", children: "CIFA favorites" }),
|
|
2915
|
+
/* @__PURE__ */ a("p", { className: "text-[11px] leading-snug text-slate-500 dark:text-slate-400", children: "Browse the full catalog and star items — favorites appear at the top of every request's item list." })
|
|
2808
2916
|
] }),
|
|
2809
|
-
/* @__PURE__ */
|
|
2917
|
+
/* @__PURE__ */ a(
|
|
2810
2918
|
"button",
|
|
2811
2919
|
{
|
|
2812
2920
|
type: "button",
|
|
2813
|
-
onClick:
|
|
2921
|
+
onClick: L,
|
|
2814
2922
|
className: "shrink-0 rounded p-1 text-slate-400 transition-colors hover:bg-slate-100 hover:text-slate-600 dark:hover:bg-white/[0.06]",
|
|
2815
2923
|
"aria-label": "Close",
|
|
2816
|
-
children: /* @__PURE__ */
|
|
2924
|
+
children: /* @__PURE__ */ a(pt, { className: "h-4 w-4" })
|
|
2817
2925
|
}
|
|
2818
2926
|
)
|
|
2819
2927
|
] }),
|
|
2820
2928
|
/* @__PURE__ */ u("div", { className: "border-b border-slate-200 px-3 py-2 dark:border-border", children: [
|
|
2821
2929
|
/* @__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: [
|
|
2822
|
-
/* @__PURE__ */
|
|
2823
|
-
/* @__PURE__ */
|
|
2930
|
+
/* @__PURE__ */ a(Ct, { className: "h-3.5 w-3.5 shrink-0 text-slate-400" }),
|
|
2931
|
+
/* @__PURE__ */ a(
|
|
2824
2932
|
"input",
|
|
2825
2933
|
{
|
|
2826
2934
|
ref: ge,
|
|
@@ -2830,110 +2938,110 @@ function Ms({
|
|
|
2830
2938
|
className: "min-w-0 flex-1 bg-transparent text-[12px] text-slate-700 outline-none placeholder:text-slate-400 dark:text-slate-200"
|
|
2831
2939
|
}
|
|
2832
2940
|
),
|
|
2833
|
-
me && /* @__PURE__ */
|
|
2941
|
+
me && /* @__PURE__ */ a(
|
|
2834
2942
|
"button",
|
|
2835
2943
|
{
|
|
2836
2944
|
type: "button",
|
|
2837
2945
|
onClick: () => fe(""),
|
|
2838
2946
|
className: "shrink-0 text-slate-400 hover:text-slate-600",
|
|
2839
2947
|
"aria-label": "Clear search",
|
|
2840
|
-
children: /* @__PURE__ */
|
|
2948
|
+
children: /* @__PURE__ */ a(pt, { className: "h-3.5 w-3.5" })
|
|
2841
2949
|
}
|
|
2842
2950
|
)
|
|
2843
2951
|
] }),
|
|
2844
|
-
|
|
2845
|
-
/* @__PURE__ */
|
|
2846
|
-
|
|
2952
|
+
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(Ae, { className: "h-3 w-3 shrink-0" }),
|
|
2954
|
+
P.map((d) => d.label ?? Z(d.key)).join(", "),
|
|
2847
2955
|
" fill in once the form's warehouse selection is made."
|
|
2848
2956
|
] })
|
|
2849
2957
|
] }),
|
|
2850
|
-
/* @__PURE__ */
|
|
2958
|
+
/* @__PURE__ */ a("div", { className: "min-h-0 flex-1 overflow-y-auto", children: /* @__PURE__ */ u("table", { className: "w-full table-fixed border-collapse text-[11px]", children: [
|
|
2851
2959
|
/* @__PURE__ */ u("colgroup", { children: [
|
|
2852
|
-
/* @__PURE__ */
|
|
2853
|
-
/* @__PURE__ */
|
|
2854
|
-
/* @__PURE__ */
|
|
2855
|
-
/* @__PURE__ */
|
|
2856
|
-
|
|
2960
|
+
/* @__PURE__ */ a("col", { className: "w-9" }),
|
|
2961
|
+
/* @__PURE__ */ a("col", { className: "w-[88px]" }),
|
|
2962
|
+
/* @__PURE__ */ a("col", {}),
|
|
2963
|
+
/* @__PURE__ */ a("col", { className: "w-[130px]" }),
|
|
2964
|
+
w.map((d) => /* @__PURE__ */ a("col", { className: "w-[86px]" }, d.key))
|
|
2857
2965
|
] }),
|
|
2858
|
-
/* @__PURE__ */
|
|
2859
|
-
/* @__PURE__ */
|
|
2860
|
-
/* @__PURE__ */
|
|
2861
|
-
/* @__PURE__ */
|
|
2862
|
-
/* @__PURE__ */
|
|
2863
|
-
|
|
2966
|
+
/* @__PURE__ */ a("thead", { className: "sticky top-0 z-[1]", children: /* @__PURE__ */ u("tr", { className: "bg-slate-100 text-left text-[10px] font-semibold uppercase tracking-wide text-slate-500 dark:bg-muted dark:text-slate-400", children: [
|
|
2967
|
+
/* @__PURE__ */ a("th", { className: "px-2 py-1.5", "aria-label": "Favorite" }),
|
|
2968
|
+
/* @__PURE__ */ a("th", { className: "px-2 py-1.5", children: "CIFA #" }),
|
|
2969
|
+
/* @__PURE__ */ a("th", { className: "px-2 py-1.5", children: "Description" }),
|
|
2970
|
+
/* @__PURE__ */ a("th", { className: "px-2 py-1.5", children: "Category" }),
|
|
2971
|
+
w.map((d) => /* @__PURE__ */ a("th", { className: "px-2 py-1.5 text-right", children: d.label ?? Z(d.key) }, d.key))
|
|
2864
2972
|
] }) }),
|
|
2865
2973
|
/* @__PURE__ */ u("tbody", { className: W(re && "opacity-50 transition-opacity"), children: [
|
|
2866
|
-
|
|
2974
|
+
K(
|
|
2867
2975
|
/* @__PURE__ */ u("span", { className: "flex items-center gap-1.5", children: [
|
|
2868
|
-
/* @__PURE__ */
|
|
2869
|
-
/* @__PURE__ */
|
|
2870
|
-
/* @__PURE__ */
|
|
2976
|
+
/* @__PURE__ */ a(ft, { className: "h-3 w-3 shrink-0 fill-amber-400 text-amber-400" }),
|
|
2977
|
+
/* @__PURE__ */ a("span", { className: "text-[11px] font-semibold text-slate-600 dark:text-slate-300", children: "Your favorites" }),
|
|
2978
|
+
/* @__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: s.length })
|
|
2871
2979
|
] }),
|
|
2872
2980
|
"border-slate-200 bg-amber-50/70 dark:border-border dark:bg-amber-900/10"
|
|
2873
2981
|
),
|
|
2874
|
-
|
|
2982
|
+
Je.length === 0 && /* @__PURE__ */ a("tr", { children: /* @__PURE__ */ a(
|
|
2875
2983
|
"td",
|
|
2876
2984
|
{
|
|
2877
|
-
colSpan: 4 +
|
|
2985
|
+
colSpan: 4 + w.length,
|
|
2878
2986
|
className: "border-b border-slate-100 px-4 py-3 text-center text-[11px] text-slate-400 dark:border-border/50",
|
|
2879
|
-
children:
|
|
2987
|
+
children: s.length === 0 ? "No favorites yet — star the items you order most." : "No favorites match your search."
|
|
2880
2988
|
}
|
|
2881
2989
|
) }),
|
|
2882
|
-
|
|
2883
|
-
|
|
2990
|
+
Je.map((d, S) => A(d, S)),
|
|
2991
|
+
K(
|
|
2884
2992
|
/* @__PURE__ */ u("span", { className: "flex items-center gap-1.5", children: [
|
|
2885
|
-
/* @__PURE__ */
|
|
2886
|
-
/* @__PURE__ */
|
|
2887
|
-
/* @__PURE__ */
|
|
2888
|
-
re && /* @__PURE__ */
|
|
2993
|
+
/* @__PURE__ */ a(Ct, { className: "h-3 w-3 shrink-0 text-slate-400" }),
|
|
2994
|
+
/* @__PURE__ */ a("span", { className: "text-[11px] font-semibold text-slate-600 dark:text-slate-300", children: "All CIFAs" }),
|
|
2995
|
+
/* @__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
|
+
re && /* @__PURE__ */ a(ue, { className: "h-3 w-3 animate-spin text-slate-400" })
|
|
2889
2997
|
] }),
|
|
2890
2998
|
"border-t border-slate-200 bg-slate-50 dark:border-border dark:bg-muted/40"
|
|
2891
2999
|
),
|
|
2892
|
-
!re && ee.length === 0 && /* @__PURE__ */
|
|
3000
|
+
!re && ee.length === 0 && /* @__PURE__ */ a("tr", { children: /* @__PURE__ */ a(
|
|
2893
3001
|
"td",
|
|
2894
3002
|
{
|
|
2895
|
-
colSpan: 4 +
|
|
3003
|
+
colSpan: 4 + w.length,
|
|
2896
3004
|
className: "px-4 py-4 text-center text-[11px] text-slate-400",
|
|
2897
|
-
children:
|
|
3005
|
+
children: T.trim() ? `No CIFAs match "${T}".` : "No catalog items."
|
|
2898
3006
|
}
|
|
2899
3007
|
) }),
|
|
2900
|
-
ee.map((d, S) =>
|
|
3008
|
+
ee.map((d, S) => A(d, S))
|
|
2901
3009
|
] })
|
|
2902
3010
|
] }) }),
|
|
2903
3011
|
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: [
|
|
2904
3012
|
/* @__PURE__ */ u("span", { className: "flex items-center gap-2 text-[10px] tabular-nums text-slate-400", children: [
|
|
2905
|
-
(
|
|
3013
|
+
(z - 1) * Te + 1,
|
|
2906
3014
|
"–",
|
|
2907
|
-
Math.min(
|
|
3015
|
+
Math.min(z * Te, G),
|
|
2908
3016
|
" of",
|
|
2909
3017
|
" ",
|
|
2910
|
-
|
|
3018
|
+
G.toLocaleString(),
|
|
2911
3019
|
re && /* @__PURE__ */ u("span", { className: "flex items-center gap-1 text-slate-500", children: [
|
|
2912
|
-
/* @__PURE__ */
|
|
3020
|
+
/* @__PURE__ */ a(ue, { className: "h-3 w-3 animate-spin" }),
|
|
2913
3021
|
" Loading…"
|
|
2914
3022
|
] })
|
|
2915
3023
|
] }),
|
|
2916
3024
|
/* @__PURE__ */ u("div", { className: "flex items-center gap-1", children: [
|
|
2917
|
-
/* @__PURE__ */
|
|
3025
|
+
/* @__PURE__ */ a(
|
|
2918
3026
|
"button",
|
|
2919
3027
|
{
|
|
2920
3028
|
type: "button",
|
|
2921
|
-
disabled:
|
|
3029
|
+
disabled: z <= 1 || re,
|
|
2922
3030
|
onClick: () => pe((d) => Math.max(1, d - 1)),
|
|
2923
3031
|
className: "rounded border border-slate-200 px-2 py-0.5 text-[11px] text-slate-600 transition-colors hover:bg-slate-50 disabled:opacity-40 dark:border-border dark:text-slate-300 dark:hover:bg-white/[0.04]",
|
|
2924
3032
|
children: "‹ Prev"
|
|
2925
3033
|
}
|
|
2926
3034
|
),
|
|
2927
3035
|
/* @__PURE__ */ u("span", { className: "px-1 text-[10px] tabular-nums text-slate-400", children: [
|
|
2928
|
-
|
|
3036
|
+
z,
|
|
2929
3037
|
" / ",
|
|
2930
3038
|
B.toLocaleString()
|
|
2931
3039
|
] }),
|
|
2932
|
-
/* @__PURE__ */
|
|
3040
|
+
/* @__PURE__ */ a(
|
|
2933
3041
|
"button",
|
|
2934
3042
|
{
|
|
2935
3043
|
type: "button",
|
|
2936
|
-
disabled:
|
|
3044
|
+
disabled: z >= B || re,
|
|
2937
3045
|
onClick: () => pe((d) => Math.min(B, d + 1)),
|
|
2938
3046
|
className: "rounded border border-slate-200 px-2 py-0.5 text-[11px] text-slate-600 transition-colors hover:bg-slate-50 disabled:opacity-40 dark:border-border dark:text-slate-300 dark:hover:bg-white/[0.04]",
|
|
2939
3047
|
children: "Next ›"
|
|
@@ -2948,26 +3056,26 @@ function Ms({
|
|
|
2948
3056
|
te
|
|
2949
3057
|
);
|
|
2950
3058
|
}
|
|
2951
|
-
function
|
|
2952
|
-
var
|
|
3059
|
+
function sa(i, m) {
|
|
3060
|
+
var g;
|
|
2953
3061
|
if (!i) return null;
|
|
2954
|
-
const
|
|
2955
|
-
return !
|
|
3062
|
+
const p = (g = (m ?? []).find((_) => !_.format && !_.sections_only)) == null ? void 0 : g.field;
|
|
3063
|
+
return !p || i.includes(`{{${p}}}`) ? i : `${i} · {{${p}}}`;
|
|
2956
3064
|
}
|
|
2957
3065
|
export {
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
3066
|
+
Pa as CatalogPickerField,
|
|
3067
|
+
ta as FacetBuilderCard,
|
|
3068
|
+
Js as MAX_LINE_MONEY,
|
|
3069
|
+
sa as catalogOptionTemplate,
|
|
3070
|
+
Bs as footerSum,
|
|
3071
|
+
Ys as gridPriceValue,
|
|
3072
|
+
Xs as isUnpricedLine,
|
|
3073
|
+
Gs as issuesAfterLinesChanged,
|
|
3074
|
+
Hs as lineComputeError,
|
|
3075
|
+
hr as matchesShowWhen,
|
|
3076
|
+
Vs as qtyEntryProblem,
|
|
3077
|
+
Ds as refusedQtyNote,
|
|
3078
|
+
wn as relatedParentTokens,
|
|
3079
|
+
Zs as savedLinesSignature,
|
|
3080
|
+
Ms as stagedCatalogFill
|
|
2973
3081
|
};
|