@feedmepos/mf-inventory-portal 1.7.5-dev.1 → 1.7.5-dev.2
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/{App-Cajcbi7C.js → App-D4pfsscT.js} +4 -4
- package/dist/{ApprovalView-pn-qHYIX.js → ApprovalView-CYnp3Gv5.js} +25 -24
- package/dist/{BindingsDialog-zcBevwFb.js → BindingsDialog-Dm0kKlg-.js} +2 -2
- package/dist/{BindingsPicker-DRWl6zQ4.js → BindingsPicker-CdGHTlqD.js} +2 -2
- package/dist/{BindingsTable-8m6QfTWo.js → BindingsTable-DEZHwIgw.js} +3 -3
- package/dist/BulkReceiveRequestView-ClvGD9vp.js +2584 -0
- package/dist/{ChangeLocationComponent.vue_vue_type_script_setup_true_lang-CJlb8KSr.js → ChangeLocationComponent.vue_vue_type_script_setup_true_lang-DVFOpysl.js} +1 -1
- package/dist/{ClosingDraftView-DSB7J84e.js → ClosingDraftView-CXTf30OO.js} +21 -21
- package/dist/{ClosingHistoryView-BmVm5PZ0.js → ClosingHistoryView-3yfjab3s.js} +5 -5
- package/dist/{ClosingTemplateView-D8epJry0.js → ClosingTemplateView-DhDRDJfg.js} +18 -18
- package/dist/CustomPrintTemplatePreview.vue_vue_type_script_setup_true_lang-C0DjydRr.js +145 -0
- package/dist/{DefaultView-5NqNxkyj.js → DefaultView-BQyve9e7.js} +2 -2
- package/dist/{DeliveryOrderPrintPreview-hUWHCkIg.js → DeliveryOrderPrintPreview-Cx85J915.js} +2 -2
- package/dist/{EmailDialog.vue_vue_type_script_setup_true_lang-D2Am8ZDJ.js → EmailDialog.vue_vue_type_script_setup_true_lang-BjSzg-to.js} +3612 -3575
- package/dist/{FmDateRangePickerChip.vue_vue_type_script_setup_true_lang-DB2tvpP6.js → FmDateRangePickerChip.vue_vue_type_script_setup_true_lang-DOY0FHF8.js} +1 -1
- package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-KCBmg5AJ.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-DRLRTNJn.js} +2 -2
- package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-B_0D62ne.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-CnQPXIkP.js} +2 -2
- package/dist/{FmMultiselectDialog-DU7IzWG_.js → FmMultiselectDialog-DK737zIz.js} +1 -1
- package/dist/{FmMultiselectDialog-Ds_f8gua.js → FmMultiselectDialog-IIFXWxUT.js} +2 -2
- package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-DSDqCW3P.js → FmUnitInput.vue_vue_type_script_setup_true_lang-Bonb9Hnk.js} +5 -5
- package/dist/{ImportView-0gnR-m1B.js → ImportView-D4xpncdw.js} +6 -6
- package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-BXsS60iO.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-CYjvjRhH.js} +1 -1
- package/dist/{IngredientGroupView-D3M3aA_H.js → IngredientGroupView-Bh7ShplN.js} +7 -7
- package/dist/{IngredientsView-BoJUcVQE.js → IngredientsView-B03s_wbT.js} +17 -17
- package/dist/{IntegrationExplorerView-CANrFCne.js → IntegrationExplorerView-DgsllLAF.js} +4 -4
- package/dist/{IntegrationView-CNA-8zrj.js → IntegrationView-9BCyzPdb.js} +14 -14
- package/dist/{InventoryBindingForm-DT-YXt4c.js → InventoryBindingForm-C8LY1sc4.js} +1 -1
- package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-CxNSflJ8.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang--mFdjT9b.js} +5 -5
- package/dist/{InventoryBindingSummary-BCnTxQhc.js → InventoryBindingSummary-BEvw0lWr.js} +1 -1
- package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-DyRx5MmF.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-CxgaZqAW.js} +1 -1
- package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-CJf9wT6o.js → PremiumBadge.vue_vue_type_script_setup_true_lang--sxV3FYV.js} +1 -1
- package/dist/{ProductionView-09wAcGA-.js → ProductionView-B86EyiCZ.js} +7 -7
- package/dist/{PublishView-glA2ipo1.js → PublishView-DlETEaGs.js} +3 -3
- package/dist/{PurchaseOrderPrintPreview-DpLO-1KW.js → PurchaseOrderPrintPreview-Be0U7Ler.js} +2 -2
- package/dist/{ReceiveRequestView-CzAVket3.js → ReceiveRequestView-DucbkxwJ.js} +80 -79
- package/dist/{RecipeView-LT5XJ6kA.js → RecipeView-BIlGYL8-.js} +19 -19
- package/dist/{SettingsView-BZfh4JMs.js → SettingsView-CUAHre50.js} +4 -4
- package/dist/{StockView-DFY1LgMH.js → StockView-kf_zhpO5.js} +22 -22
- package/dist/{SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-CK6SIQza.js → SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-Bpr7q8r9.js} +1 -1
- package/dist/{SupplierView-CL2IuwVZ.js → SupplierView-caFI7Yd6.js} +14 -14
- package/dist/{SurchargeView-BhfGyNu5.js → SurchargeView-DyO0ZOGa.js} +8 -8
- package/dist/SystemTrailDialog.vue_vue_type_script_setup_true_lang--QyVwKtB.js +263 -0
- package/dist/{TemplatePublishDialog.vue_vue_type_script_setup_true_lang-Bw8cubwk.js → TemplatePublishDialog.vue_vue_type_script_setup_true_lang-2JCHCRHp.js} +1 -1
- package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-Dhll972g.js +4717 -0
- package/dist/{TransferTemplateView-DLOjb7km.js → TransferTemplateView-DUlH8K4Y.js} +21 -21
- package/dist/{UnitCostHistoryView-BtPucyKW.js → UnitCostHistoryView-OXv6kJgE.js} +4 -4
- package/dist/{UnitDisplayControl.vue_vue_type_script_setup_true_lang-DJ6kRWhP.js → UnitDisplayControl.vue_vue_type_script_setup_true_lang-1ekj_uc6.js} +4 -4
- package/dist/{UnitView-BvfkCvbb.js → UnitView-iwIzfipw.js} +9 -9
- package/dist/{WarehouseView-DqQY_NXe.js → WarehouseView-C9rSeAaV.js} +7 -7
- package/dist/{WastageTemplateView--Wrq7ge5.js → WastageTemplateView-OvD51JSq.js} +16 -16
- package/dist/api/purchase-order.d.ts +46 -0
- package/dist/{app-D_hKuHEq.js → app-D-nwdsYm.js} +19305 -19130
- package/dist/app.d.ts +64 -36
- package/dist/app.js +1 -1
- package/dist/{closing-template-mf0Hz0sS.js → closing-template-jWeRa4dz.js} +1 -1
- package/dist/component-BmLAdDiY.js +79 -0
- package/dist/components/job-progress/BulkJobProgressPanel.vue.d.ts +2 -0
- package/dist/components/row-action.enum.d.ts +1 -0
- package/dist/{date2-C3dcj9fz.js → date2-B_xDuM7M.js} +1 -1
- package/dist/{dayjs.min-BI88EzTz.js → dayjs.min-B-AZ8_mI.js} +5 -5
- package/dist/{decimal-BxOL6Gld.js → decimal-0ev5Hr6J.js} +2 -2
- package/dist/{defineDeepModel-Cvl7eN3k.js → defineDeepModel-DvI75jvB.js} +1 -1
- package/dist/{duplicate-template-DgS5Tm9P.js → duplicate-template-CVOoyyS0.js} +1 -1
- package/dist/{feature-Dd8HiMBk.js → feature-Cb-HS1Qb.js} +2 -2
- package/dist/{format-time-from-id-Cp2E5196.js → format-time-from-id-BCqZq29n.js} +1 -1
- package/dist/{format-unit-display-MACP_q07.js → format-unit-display-kSYRHsdn.js} +16 -16
- package/dist/{import-export.helper-DWMCTOY0.js → import-export.helper-B3bnD5gf.js} +6 -6
- package/dist/{index-D3jWqvZX.js → index-BmjXNcEU.js} +1 -1
- package/dist/{index-B2RsNEfe.js → index-CDiyP2Ua.js} +3 -3
- package/dist/{index-DFK8bQ6j.js → index-G6SYSs1V.js} +1 -1
- package/dist/{inventory-core-dart.default-D942GWzb.js → inventory-core-dart.default-B0kHPJ3I.js} +1 -1
- package/dist/{lz-string-CBjMP9eH.js → lz-string-CUfkGubt.js} +1 -1
- package/dist/{netsuite-D2953JgL.js → netsuite-CYNhS6XV.js} +2 -2
- package/dist/{number-DPVL24ED.js → number-BZuHTNem.js} +3 -3
- package/dist/{predefined-templates-C-1kU49_.js → predefined-templates-D--Y4747.js} +1 -1
- package/dist/{purchase-order-template-Dr2otb_Q.js → purchase-order-template-DGzn629O.js} +1 -1
- package/dist/{recalculationUtils-DOLRXWIr.js → recalculationUtils-B2mxdDHX.js} +1 -1
- package/dist/{row-action.enum-DQ9bJ_uv.js → row-action.enum-ncgDYAjP.js} +7 -1
- package/dist/{rules-CgbPIL_A.js → rules-C9dDCNg3.js} +2 -2
- package/dist/{stock-Bqj8CPcA.js → stock-Bys68KZZ.js} +3 -3
- package/dist/{stock-No7BQLB4.js → stock-DL4oech9.js} +1 -1
- package/dist/stores/bulk-job.d.ts +192 -0
- package/dist/stores/bulk-job.spec.d.ts +1 -0
- package/dist/{supplier-DNlISdQo.js → supplier-DPVpEG2w.js} +2 -2
- package/dist/{surcharge-BGZGoC81.js → surcharge-SHYN1X8A.js} +1 -1
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/{uom-rules-B6ZB1FSB.js → uom-rules-nPqfI8Yz.js} +1 -1
- package/dist/{use-ingredient-select-dialog-CU5OTWPl.js → use-ingredient-select-dialog-BMvWiKB6.js} +2 -2
- package/dist/{use-inventory-binding-dialog-DhxC5qLq.js → use-inventory-binding-dialog-CNOe57bY.js} +2 -2
- package/dist/{use-template-enabled-locations-Bv5HpHAV.js → use-template-enabled-locations-B7JBvvZ4.js} +2 -2
- package/dist/{use-transfer-locations-CRR5I64l.js → use-transfer-locations-BCu9xHNr.js} +2 -2
- package/dist/{useHrmPermission-bZrxydnr.js → useHrmPermission-WM9TCd_D.js} +1 -1
- package/dist/{useNavigationMenu-CazRNUsz.js → useNavigationMenu-6DdsN1jP.js} +2 -2
- package/dist/{useSseClient-l9O1iPny.js → useSseClient-B9Z0kGeF.js} +1 -1
- package/dist/views/receive-request/components/email-dialog/EmailDialogProps.d.ts +11 -0
- package/dist/views/receive-request/composables/fn.spec.d.ts +1 -0
- package/dist/views/receive-request/composables/use-receive-request-form.d.ts +1 -0
- package/dist/views/receive-request/composables/use-receive-request-table.d.ts +13 -1
- package/dist/views/receive-request/helper/extra-items.d.ts +12 -2
- package/dist/views/receive-request/helper/format-unit-display.d.ts +1 -1
- package/dist/views/receive-request-bulk/components/PdfPreviewDialog.vue.d.ts +23 -0
- package/dist/views/receive-request-bulk/composables/use-bulk-receive-request-form.d.ts +6 -18
- package/dist/views/receive-request-bulk/composables/use-bulk-receive-request-form.spec.d.ts +1 -0
- package/dist/views/receive-request-bulk/composables/use-bulk-receive-request-table.d.ts +3 -4
- package/dist/{vue-i18n-eAaLOca6.js → vue-i18n-DWcHQ0rm.js} +51 -51
- package/dist/{xlsx.util-Dp7SqdrI.js → xlsx.util-DC2xGyFF.js} +2 -2
- package/package.json +4 -5
- package/dist/BulkReceiveRequestView-MxPx0Gio.js +0 -2208
- package/dist/SystemTrailDialog.vue_vue_type_script_setup_true_lang-Du8ygQNn.js +0 -209
- package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-Dy79I2YB.js +0 -4712
- package/dist/component-kqxARxvM.js +0 -91
- package/dist/jszip.min-Pl_JnG-H.js +0 -2322
|
@@ -0,0 +1,2584 @@
|
|
|
1
|
+
import { defineComponent as tt, ref as k, computed as L, watch as Ve, createElementBlock as y, openBlock as m, Fragment as ye, createBlock as le, createVNode as E, Teleport as lt, Transition as Dt, withCtx as Pe, createCommentVNode as D, createElementVNode as e, toDisplayString as p, unref as t, normalizeClass as J, renderList as Qe, createTextVNode as ot, withModifiers as Et, mergeModels as qt, useModel as Nt, resolveComponent as Ce, h as xe, onMounted as At, onUnmounted as $t, normalizeStyle as mt, watchEffect as Ot, isRef as bt, normalizeProps as ht, mergeProps as ct, guardReactiveProps as Bt } from "vue";
|
|
2
|
+
import { u as Tt, l as It } from "./netsuite-CYNhS6XV.js";
|
|
3
|
+
import { u as it, a as Lt, G as zt, T as gt, s as Mt, U as Ye, q as Ut, c as Vt, D as st, x as Jt } from "./app-D-nwdsYm.js";
|
|
4
|
+
import { i as ft, _ as jt } from "./FmDateRangePickerChip.vue_vue_type_script_setup_true_lang-DOY0FHF8.js";
|
|
5
|
+
import { a as xt, d as Wt } from "./number-BZuHTNem.js";
|
|
6
|
+
import { b as Yt, d as Ht, c as Qt, e as Kt, f as Gt, P as kt, h as Xt, a as Zt, _ as en, g as tn } from "./TransferDetails.vue_vue_type_script_setup_true_lang-Dhll972g.js";
|
|
7
|
+
import { i as nn } from "./PremiumBadge.vue_vue_type_script_setup_true_lang--sxV3FYV.js";
|
|
8
|
+
import { d as He } from "./dayjs.min-B-AZ8_mI.js";
|
|
9
|
+
import { e as on } from "./UnitDisplayControl.vue_vue_type_script_setup_true_lang-1ekj_uc6.js";
|
|
10
|
+
import { u as sn } from "./useTabStorage-BkIVScW_.js";
|
|
11
|
+
import { u as an, _ as rn } from "./SingleColumnLayout.vue_vue_type_script_setup_true_lang-DwrLsWX_.js";
|
|
12
|
+
import { components as ln, useSnackbar as ut, useDialog as un, useBreakpoints as cn } from "@feedmepos/ui-library";
|
|
13
|
+
import { c as dn, u as mn, _ as fn, a as pn, b as vn } from "./EmailDialog.vue_vue_type_script_setup_true_lang-BjSzg-to.js";
|
|
14
|
+
import { useI18n as nt, useCoreStore as Ct } from "@feedmepos/mf-common";
|
|
15
|
+
import { u as Ft, a as yn } from "./supplier-DPVpEG2w.js";
|
|
16
|
+
import { u as bn } from "./stock-DL4oech9.js";
|
|
17
|
+
import { u as Ke } from "./SystemTrailDialog.vue_vue_type_script_setup_true_lang--QyVwKtB.js";
|
|
18
|
+
import { b as St, a as hn } from "./format-unit-display-kSYRHsdn.js";
|
|
19
|
+
import { P as gn } from "./inventory-core-dart.default-B0kHPJ3I.js";
|
|
20
|
+
import { _ as xn, F as Ze } from "./TableActionableRow.vue_vue_type_script_setup_true_lang-DAMpuZ1X.js";
|
|
21
|
+
import { u as Rt } from "./feature-Cb-HS1Qb.js";
|
|
22
|
+
import { P as _n, J as wn, D as kn } from "./app-C39bYJmq.js";
|
|
23
|
+
import { d as Cn, t as Fn } from "./date2-B_xDuM7M.js";
|
|
24
|
+
import { F as _t } from "./form-mode.enum-BKiNVH6A.js";
|
|
25
|
+
import { p as Sn } from "./format-time-from-id-BCqZq29n.js";
|
|
26
|
+
import { defineStore as Rn } from "pinia";
|
|
27
|
+
import { u as Pn } from "./use-row-action-Cvq6VO38.js";
|
|
28
|
+
import { R as at, D as Dn } from "./row-action.enum-ncgDYAjP.js";
|
|
29
|
+
import { u as En } from "./vue-i18n-DWcHQ0rm.js";
|
|
30
|
+
const qn = {
|
|
31
|
+
key: 0,
|
|
32
|
+
class: "fixed inset-0 z-[200] bg-white flex flex-col overflow-hidden",
|
|
33
|
+
style: { "font-family": "Inter, sans-serif" }
|
|
34
|
+
}, Nn = {
|
|
35
|
+
key: 0,
|
|
36
|
+
class: "flex items-center justify-between px-24 h-[64px] border-b border-[#F0F0F0] shrink-0 bg-white"
|
|
37
|
+
}, An = { class: "fm-typo-en-title-md-800 text-[#1C1C1E]" }, $n = { class: "flex items-center gap-8" }, On = {
|
|
38
|
+
key: 1,
|
|
39
|
+
class: "flex items-center justify-center px-32 py-16 border-b border-[#F0F0F0] shrink-0 bg-white"
|
|
40
|
+
}, Bn = { class: "flex items-center max-w-[600px] w-full" }, Tn = ["disabled"], In = { key: 1 }, Ln = ["disabled"], zn = { key: 1 }, Mn = {
|
|
41
|
+
class: "flex flex-col items-center gap-4 min-w-0",
|
|
42
|
+
disabled: !0
|
|
43
|
+
}, Un = { class: "flex flex-1 overflow-hidden" }, Vn = { class: "flex-1 min-w-0 overflow-y-auto" }, Jn = {
|
|
44
|
+
key: 0,
|
|
45
|
+
class: "px-32 py-24"
|
|
46
|
+
}, jn = { class: "flex flex-col gap-4 mb-10" }, Wn = { class: "fm-typo-en-title-sm-700 text-[#1C1C1E]" }, Yn = { class: "fm-typo-en-body-md-400 text-[#4B4B4B]" }, Hn = { class: "mb-12" }, Qn = { class: "border border-[#E0E0E0] rounded-sm overflow-hidden bg-white" }, Kn = ["onClick"], Gn = { class: "w-32 h-32 rounded-full bg-[#F0F0F0] flex items-center justify-center shrink-0" }, Xn = { class: "fm-typo-en-body-xs text-[#6B6C70]" }, Zn = { class: "flex-1 min-w-0" }, eo = { class: "fm-typo-en-body-md-600 text-[#1C1C1E]" }, to = { class: "fm-typo-en-body-sm-400 text-[#6B6C70] truncate" }, no = { class: "text-[10px] leading-[12px] font-semibold text-[#6B6C70] bg-[#F6F7F8] px-4 py-1 rounded-[4px] uppercase tracking-[0.08em] shrink-0" }, oo = {
|
|
47
|
+
key: 0,
|
|
48
|
+
class: "w-[8px] h-[8px] rounded-full bg-[#FF7823]"
|
|
49
|
+
}, so = {
|
|
50
|
+
key: 0,
|
|
51
|
+
class: "py-40 text-center text-[#B2B3B6] fm-typo-en-body-md-400"
|
|
52
|
+
}, ao = {
|
|
53
|
+
key: 1,
|
|
54
|
+
class: "px-32 py-24"
|
|
55
|
+
}, ro = { class: "flex flex-col gap-4 mb-12" }, lo = { class: "fm-typo-en-title-sm-700 text-[#1C1C1E]" }, io = { class: "fm-typo-en-body-md-400 text-[#4B4B4B]" }, uo = { class: "grid grid-cols-2 gap-12 mb-12" }, co = { class: "flex items-start justify-between mb-12" }, mo = { class: "fm-typo-en-body-md-700 text-[#1C1C1E] mb-4" }, fo = { class: "fm-typo-en-body-sm-400 text-[#6B6C70]" }, po = { class: "flex items-start justify-between mb-12" }, vo = { class: "fm-typo-en-body-md-700 text-[#1C1C1E] mb-4" }, yo = { class: "fm-typo-en-body-sm-400 text-[#6B6C70]" }, bo = { class: "fm-typo-en-body-md-700 text-[#1C1C1E] mb-12" }, ho = { class: "mb-12" }, go = { class: "border border-[#E0E0E0] rounded-xl overflow-hidden bg-white" }, xo = ["onClick"], _o = { class: "w-32 h-32 rounded-full bg-[#F0F0F0] flex items-center justify-center shrink-0" }, wo = { class: "fm-typo-en-body-xs-600 text-[#6B6C70]" }, ko = { class: "flex-1 min-w-0" }, Co = { class: "fm-typo-en-body-md-600 text-[#1C1C1E]" }, Fo = { class: "fm-typo-en-body-sm-400 text-[#6B6C70] truncate" }, So = { class: "text-[10px] leading-[12px] font-semibold text-[#6B6C70] bg-[#F6F7F8] px-4 py-1 rounded-[4px] uppercase tracking-[0.08em] shrink-0" }, Ro = {
|
|
56
|
+
key: 0,
|
|
57
|
+
class: "w-[8px] h-[8px] rounded-full bg-[#FF7823]"
|
|
58
|
+
}, Po = {
|
|
59
|
+
key: 0,
|
|
60
|
+
class: "py-32 text-center text-[#B2B3B6] fm-typo-en-body-md-400"
|
|
61
|
+
}, Do = { class: "fm-typo-en-body-md-700 text-[#1C1C1E] mb-12" }, Eo = { class: "mb-12" }, qo = {
|
|
62
|
+
key: 0,
|
|
63
|
+
class: "py-32 flex justify-center"
|
|
64
|
+
}, No = {
|
|
65
|
+
key: 1,
|
|
66
|
+
class: "py-32 text-center text-[#B2B3B6] fm-typo-en-body-md-400"
|
|
67
|
+
}, Ao = {
|
|
68
|
+
key: 2,
|
|
69
|
+
class: "flex flex-col gap-8"
|
|
70
|
+
}, $o = ["onClick"], Oo = { class: "flex-1 min-w-0" }, Bo = { class: "fm-typo-en-body-md-600 text-[#1C1C1E] mb-2" }, To = { class: "fm-typo-en-body-sm-400 text-[#6B6C70]" }, Io = {
|
|
71
|
+
key: 0,
|
|
72
|
+
class: "w-[8px] h-[8px] rounded-full bg-[#FF7823]"
|
|
73
|
+
}, Lo = {
|
|
74
|
+
key: 2,
|
|
75
|
+
class: "px-32 py-24"
|
|
76
|
+
}, zo = { class: "flex flex-col gap-4 mb-12" }, Mo = { class: "fm-typo-en-title-sm-700 text-[#1C1C1E]" }, Uo = { class: "w-[332px] shrink-0 border-l border-[#F0F0F0] overflow-y-auto bg-white" }, Vo = { class: "p-4" }, Jo = { class: "flex flex-col gap-0 border border-[#E9EAEC] rounded-2xl bg-white overflow-hidden" }, jo = { class: "px-10 py-5 border-b border-[#F0F0F0]" }, Wo = { class: "fm-typo-en-body-md-700 text-[#1C1C1E]" }, Yo = { class: "flex flex-col gap-0.5 px-10 py-4 border-b border-[#F0F0F0]" }, Ho = { class: "text-[11px] leading-[14px] font-medium text-[#6B6C70]" }, Qo = {
|
|
77
|
+
key: 0,
|
|
78
|
+
class: "text-[11px] leading-[14px] text-[#6B6C70]"
|
|
79
|
+
}, Ko = { class: "flex flex-col gap-0.5 px-10 py-4 border-b border-[#F0F0F0]" }, Go = { class: "text-[11px] leading-[14px] font-medium text-[#6B6C70]" }, Xo = { class: "flex flex-col gap-0.5 px-10 py-4 border-b border-[#F0F0F0]" }, Zo = { class: "text-[11px] leading-[14px] font-medium text-[#6B6C70]" }, es = {
|
|
80
|
+
key: 0,
|
|
81
|
+
class: "text-[11px] leading-[14px] text-[#6B6C70]"
|
|
82
|
+
}, ts = { class: "flex items-center justify-between gap-8 px-10 py-4" }, ns = { class: "text-[15px] leading-[20px] font-semibold text-[#1C1C1E]" }, os = { class: "fm-typo-en-title-md-600" }, ss = { class: "flex flex-col gap-16" }, as = { class: "fm-typo-en-body-md-400" }, rs = { class: "max-h-[300px] overflow-y-auto" }, ls = { class: "list-disc pl-16" }, is = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, us = { class: "flex w-full gap-8 justify-end" }, cs = /* @__PURE__ */ tt({
|
|
83
|
+
__name: "CreateTransferWizard",
|
|
84
|
+
props: {
|
|
85
|
+
show: { type: Boolean },
|
|
86
|
+
lastClosingDate: {},
|
|
87
|
+
selectedOutletIds: {}
|
|
88
|
+
},
|
|
89
|
+
emits: ["update:show", "submitted"],
|
|
90
|
+
setup(_, { emit: h }) {
|
|
91
|
+
const { FmButton: w, FmDialog: O, FmIcon: S, FmTextField: z } = ln, Y = _, $ = h, { t: c } = nt(), l = ut(), g = it(), V = Ft(), de = Lt(), v = bn(), f = Ke(), d = St(), i = k(0), C = k(!1), o = k(null), H = k(""), R = k(null), N = k(null), M = k(null), be = k(""), he = k(""), ue = k(!1), ne = k(!1), ve = k(!1), De = k(!1), _e = k(!1), Ae = k(/* @__PURE__ */ new Map()), Ee = k(), me = k([]), ge = L(() => !!o.value), $e = L(() => R.value === "transfer" ? !!N.value : R.value === "template" ? !!M.value : !1), Fe = L(() => (me.value.length ? me.value : A.value.items ?? []).some((a) => a.quantity.amount > 0)), Ge = L(() => ue.value), qe = L(
|
|
92
|
+
() => Fe.value && ne.value && ve.value && !ue.value
|
|
93
|
+
), Oe = L(() => i.value === 0 ? ge.value : i.value === 1 ? $e.value : i.value === 2 ? qe.value : !1), Se = L(
|
|
94
|
+
() => i.value === 2 ? c("inventory.transfer.receiveRequest.bulk.wizard.createTransferBtn") : c("inventory.transfer.receiveRequest.bulk.wizard.continueBtn")
|
|
95
|
+
), P = L(
|
|
96
|
+
() => ee.value === "Purchase" ? "Purchase method" : "Transfer method"
|
|
97
|
+
), F = L(
|
|
98
|
+
() => ee.value === "Purchase" ? "Purchase details" : "Transfer details"
|
|
99
|
+
), B = L(() => {
|
|
100
|
+
const n = H.value.trim().toLowerCase();
|
|
101
|
+
let a = g.locations;
|
|
102
|
+
return Y.selectedOutletIds && Y.selectedOutletIds.length > 0 && (a = a.filter((s) => Y.selectedOutletIds.includes(s.doc._id))), n ? a.filter(
|
|
103
|
+
(s) => s.name.toLowerCase().includes(n) || (s.doc.profile.code ?? "").toLowerCase().includes(n)
|
|
104
|
+
) : a;
|
|
105
|
+
}), K = L(() => {
|
|
106
|
+
var fe;
|
|
107
|
+
const n = (fe = o.value) == null ? void 0 : fe.doc._id, a = V.suppliers.map((se) => ({
|
|
108
|
+
doc: se,
|
|
109
|
+
name: se.name,
|
|
110
|
+
dbName: "",
|
|
111
|
+
type: "supplier",
|
|
112
|
+
acceptRequest: !0
|
|
113
|
+
})), X = [
|
|
114
|
+
...g.allLocations ?? g.locations,
|
|
115
|
+
...a
|
|
116
|
+
].filter((se) => se.doc._id !== n), te = be.value.trim().toLowerCase();
|
|
117
|
+
return te ? X.filter((se) => {
|
|
118
|
+
var Xe;
|
|
119
|
+
const Ue = se.type === "supplier" ? "" : ((Xe = se.doc.profile) == null ? void 0 : Xe.code) ?? "";
|
|
120
|
+
return se.name.toLowerCase().includes(te) || Ue.toLowerCase().includes(te);
|
|
121
|
+
}) : X;
|
|
122
|
+
}), G = L(() => {
|
|
123
|
+
const n = he.value.trim().toLowerCase(), a = d.templates;
|
|
124
|
+
return n ? a.filter((s) => s.name.toLowerCase().includes(n)) : a;
|
|
125
|
+
}), ee = L(() => {
|
|
126
|
+
var n;
|
|
127
|
+
if (A.value.supplier)
|
|
128
|
+
return typeof A.value.supplier.internal == "string" ? "Transfer" : "Purchase";
|
|
129
|
+
if (R.value === "transfer" && N.value)
|
|
130
|
+
return N.value.type === "supplier" ? "Purchase" : "Transfer";
|
|
131
|
+
if (R.value === "template" && M.value) {
|
|
132
|
+
const a = d.templates.find(
|
|
133
|
+
(s) => s._id === M.value
|
|
134
|
+
);
|
|
135
|
+
if ((n = a == null ? void 0 : a.purchaseOrder) != null && n.supplier)
|
|
136
|
+
return typeof a.purchaseOrder.supplier.internal == "string" ? "Transfer" : "Purchase";
|
|
137
|
+
}
|
|
138
|
+
return "Transfer";
|
|
139
|
+
}), Re = L(() => o.value ? o.value.name : c("inventory.transfer.receiveRequest.bulk.wizard.notSelected")), we = L(() => R.value === "transfer" ? ee.value === "Purchase" ? "Purchase from Supplier" : c("inventory.transfer.receiveRequest.bulk.wizard.outletToOutletMethod") : R.value === "template" ? c("inventory.transfer.receiveRequest.bulk.wizard.fromTemplateMethod") : c("inventory.transfer.receiveRequest.bulk.wizard.notChosen")), j = L(() => {
|
|
140
|
+
var n;
|
|
141
|
+
if (R.value === "transfer" && N.value)
|
|
142
|
+
return N.value.name;
|
|
143
|
+
if (R.value === "template" && M.value) {
|
|
144
|
+
const a = d.templates.find((s) => s._id === M.value);
|
|
145
|
+
return (n = a == null ? void 0 : a.purchaseOrder) != null && n.supplier ? a.purchaseOrder.supplier.name || M.value : (a == null ? void 0 : a.name) ?? M.value;
|
|
146
|
+
}
|
|
147
|
+
return c("inventory.transfer.receiveRequest.bulk.wizard.noneYet");
|
|
148
|
+
});
|
|
149
|
+
function ae(n) {
|
|
150
|
+
var X, te, fe, se, Ue;
|
|
151
|
+
const a = (X = n.doc.profile) != null && X.code ? `#${n.doc.profile.code}` : "", s = [(fe = (te = n.doc.profile) == null ? void 0 : te.address) == null ? void 0 : fe.line1, (Ue = (se = n.doc.profile) == null ? void 0 : se.address) == null ? void 0 : Ue.city].filter(Boolean).join(" · ");
|
|
152
|
+
return [a, s].filter(Boolean).join(" · ");
|
|
153
|
+
}
|
|
154
|
+
function Be(n) {
|
|
155
|
+
var s, X;
|
|
156
|
+
return [(s = n.doc.address) == null ? void 0 : s.line1, (X = n.doc.address) == null ? void 0 : X.city].filter(Boolean).join(" · ");
|
|
157
|
+
}
|
|
158
|
+
function Te(n) {
|
|
159
|
+
var a;
|
|
160
|
+
return n.type === "supplier" ? "" : ((a = n.doc.profile) == null ? void 0 : a.code) ?? "";
|
|
161
|
+
}
|
|
162
|
+
function r(n) {
|
|
163
|
+
var a, s, X, te, fe, se;
|
|
164
|
+
return n.type === "supplier" ? [(a = n.doc.address) == null ? void 0 : a.line1, (s = n.doc.address) == null ? void 0 : s.city].filter(Boolean).join(" · ") : [(te = (X = n.doc.profile) == null ? void 0 : X.address) == null ? void 0 : te.line1, (se = (fe = n.doc.profile) == null ? void 0 : fe.address) == null ? void 0 : se.city].filter(Boolean).join(" · ");
|
|
165
|
+
}
|
|
166
|
+
const u = L(
|
|
167
|
+
() => o.value ? ae(o.value) : ""
|
|
168
|
+
), b = L(
|
|
169
|
+
() => R.value === "transfer" && N.value ? N.value.type === "supplier" ? Be(N.value) : ae(N.value) : ""
|
|
170
|
+
), T = L(() => {
|
|
171
|
+
const a = (me.value.length ? me.value : A.value.items ?? []).filter((s) => s.quantity.amount > 0).length;
|
|
172
|
+
return a === 0 ? c("inventory.transfer.receiveRequest.bulk.wizard.noneYet") : `${a} ${a === 1 ? "item" : "items"}`;
|
|
173
|
+
});
|
|
174
|
+
function I(n) {
|
|
175
|
+
var s;
|
|
176
|
+
const a = (s = n.purchaseOrder) == null ? void 0 : s.supplier;
|
|
177
|
+
return a ? a.internal === "warehouse" ? `Transfer from ${a.name}` : a.internal === "restaurant" ? `Transfer from ${a.name}` : `Purchase from ${a.name}` : "";
|
|
178
|
+
}
|
|
179
|
+
function q(n) {
|
|
180
|
+
return {
|
|
181
|
+
_id: n.doc._id,
|
|
182
|
+
internal: n.type,
|
|
183
|
+
contactName: n.doc.profile.name,
|
|
184
|
+
name: n.doc.profile.name ?? "",
|
|
185
|
+
email: n.doc.profile.email,
|
|
186
|
+
phoneNumber: n.doc.profile.phoneNo,
|
|
187
|
+
registrationNumber: n.doc.profile.regNo ?? "",
|
|
188
|
+
address: n.doc.profile.address ?? {
|
|
189
|
+
line1: "",
|
|
190
|
+
state: "",
|
|
191
|
+
city: "",
|
|
192
|
+
postcode: "",
|
|
193
|
+
country: ""
|
|
194
|
+
}
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
function W(n) {
|
|
198
|
+
return {
|
|
199
|
+
_id: n._id,
|
|
200
|
+
internal: void 0,
|
|
201
|
+
contactName: n.contactName,
|
|
202
|
+
name: n.name ?? "",
|
|
203
|
+
email: n.email,
|
|
204
|
+
phoneNumber: n.phoneNumber,
|
|
205
|
+
registrationNumber: n.registrationNumber ?? "",
|
|
206
|
+
supplyItems: n.supplyItems,
|
|
207
|
+
_rev: n._rev,
|
|
208
|
+
address: n.address ?? {
|
|
209
|
+
line2: void 0,
|
|
210
|
+
line1: "",
|
|
211
|
+
state: "",
|
|
212
|
+
city: "",
|
|
213
|
+
postcode: "",
|
|
214
|
+
country: ""
|
|
215
|
+
}
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
function Q() {
|
|
219
|
+
var X;
|
|
220
|
+
const n = M.value ? d.templates.find((te) => te._id === M.value) : void 0, a = {
|
|
221
|
+
_rev: void 0,
|
|
222
|
+
email: void 0,
|
|
223
|
+
internal: void 0,
|
|
224
|
+
contactName: void 0,
|
|
225
|
+
phoneNumber: void 0,
|
|
226
|
+
registrationNumber: "",
|
|
227
|
+
supplyItems: void 0,
|
|
228
|
+
_id: "",
|
|
229
|
+
name: "",
|
|
230
|
+
address: { line2: void 0, line1: "", state: "", city: "", postcode: "", country: "" }
|
|
231
|
+
}, s = R.value === "transfer" && N.value ? N.value.type === "supplier" ? W(N.value.doc) : q(N.value) : R.value === "template" && (n != null && n.purchaseOrder.supplier) ? n.purchaseOrder.supplier : a;
|
|
232
|
+
return {
|
|
233
|
+
remark: void 0,
|
|
234
|
+
ref: void 0,
|
|
235
|
+
stockSnapshotId: void 0,
|
|
236
|
+
effectiveAt: void 0,
|
|
237
|
+
items: R.value === "template" && ((X = n == null ? void 0 : n.purchaseOrder) != null && X.items) ? n.purchaseOrder.items : [],
|
|
238
|
+
supplier: s,
|
|
239
|
+
status: "DRAFT",
|
|
240
|
+
_id: "",
|
|
241
|
+
seqNumber: 0,
|
|
242
|
+
deliveryOrder: [],
|
|
243
|
+
template: M.value ?? void 0,
|
|
244
|
+
templateDoc: n
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
const A = k(Q()), Z = k(`${Math.random()}`), U = L(
|
|
248
|
+
() => {
|
|
249
|
+
var n;
|
|
250
|
+
return ((n = A.value.items) == null ? void 0 : n.filter((a) => a.quantity.amount === 0)) ?? [];
|
|
251
|
+
}
|
|
252
|
+
);
|
|
253
|
+
Ve(
|
|
254
|
+
() => Y.show,
|
|
255
|
+
(n) => {
|
|
256
|
+
if (n && (i.value = 0, C.value = !1, o.value = null, R.value = null, N.value = null, M.value = null, H.value = "", be.value = "", he.value = "", ne.value = !1, ve.value = !1, me.value = [], A.value = Q(), Z.value = `${Math.random()}`, d.fetchTemplates(), Y.selectedOutletIds && Y.selectedOutletIds.length === 1)) {
|
|
257
|
+
const a = g.locations.find(
|
|
258
|
+
(s) => s.doc._id === Y.selectedOutletIds[0]
|
|
259
|
+
);
|
|
260
|
+
a && (o.value = a, g._currentLocation = a, ze(), Me(), i.value = 1);
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
);
|
|
264
|
+
function re() {
|
|
265
|
+
if (i.value === 0) {
|
|
266
|
+
if (!o.value) return;
|
|
267
|
+
g._currentLocation = o.value, ze(), Me(), i.value = 1;
|
|
268
|
+
} else if (i.value === 1) {
|
|
269
|
+
if (!$e.value) return;
|
|
270
|
+
A.value = Q(), Z.value = `${Math.random()}`, me.value = [], i.value = 2;
|
|
271
|
+
} else i.value === 2 && We();
|
|
272
|
+
}
|
|
273
|
+
function Je() {
|
|
274
|
+
i.value > 0 && i.value--;
|
|
275
|
+
}
|
|
276
|
+
function Ie(n) {
|
|
277
|
+
n < i.value && (i.value = n);
|
|
278
|
+
}
|
|
279
|
+
function Le() {
|
|
280
|
+
$("update:show", !1);
|
|
281
|
+
}
|
|
282
|
+
function Ne(n) {
|
|
283
|
+
R.value !== n && (R.value = n, N.value = null, M.value = null, me.value = [], A.value = {
|
|
284
|
+
...A.value,
|
|
285
|
+
items: [],
|
|
286
|
+
template: void 0,
|
|
287
|
+
templateDoc: void 0
|
|
288
|
+
});
|
|
289
|
+
}
|
|
290
|
+
function ke(n) {
|
|
291
|
+
me.value = n ?? [];
|
|
292
|
+
}
|
|
293
|
+
Ve(M, (n) => {
|
|
294
|
+
R.value === "template" && n && (A.value = Q(), Z.value = `${Math.random()}`);
|
|
295
|
+
});
|
|
296
|
+
async function ze() {
|
|
297
|
+
ne.value = !1;
|
|
298
|
+
try {
|
|
299
|
+
await V.readSuppliers(), ne.value = !0;
|
|
300
|
+
} catch {
|
|
301
|
+
l.open({
|
|
302
|
+
title: c("inventory.transfer.form.unableToFetchListOfSuppliers.title"),
|
|
303
|
+
message: c("inventory.transfer.form.unableToFetchListOfSuppliers.message"),
|
|
304
|
+
type: "error"
|
|
305
|
+
});
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
async function Me() {
|
|
309
|
+
_e.value = !0, Ae.value = /* @__PURE__ */ new Map();
|
|
310
|
+
try {
|
|
311
|
+
const n = await v.readStockBalance(), a = /* @__PURE__ */ new Map();
|
|
312
|
+
for (const s of n.skus ?? [])
|
|
313
|
+
a.set(s.id, s);
|
|
314
|
+
Ae.value = a;
|
|
315
|
+
} catch {
|
|
316
|
+
} finally {
|
|
317
|
+
_e.value = !1;
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
function je() {
|
|
321
|
+
var n;
|
|
322
|
+
(n = Ee.value) != null && n.getFormData && (A.value = { ...A.value, ...Ee.value.getFormData() });
|
|
323
|
+
}
|
|
324
|
+
function We() {
|
|
325
|
+
if (je(), U.value.length > 0) {
|
|
326
|
+
De.value = !0;
|
|
327
|
+
return;
|
|
328
|
+
}
|
|
329
|
+
oe();
|
|
330
|
+
}
|
|
331
|
+
function x() {
|
|
332
|
+
var n;
|
|
333
|
+
A.value.items = ((n = A.value.items) == null ? void 0 : n.filter((a) => a.quantity.amount > 0)) ?? [], De.value = !1, oe();
|
|
334
|
+
}
|
|
335
|
+
function oe() {
|
|
336
|
+
var s, X;
|
|
337
|
+
const n = gn.validatePurchaseOrderItems({
|
|
338
|
+
skusById: de.skuById ?? {},
|
|
339
|
+
items: A.value.items ?? []
|
|
340
|
+
}), a = Object.values(n).flat();
|
|
341
|
+
if (a.length > 0) {
|
|
342
|
+
const te = a[0];
|
|
343
|
+
l.open({
|
|
344
|
+
title: `[Row ${te.index + 1}] "${te.poItem.sku.name}"`,
|
|
345
|
+
message: `${te.message}`,
|
|
346
|
+
type: "error"
|
|
347
|
+
});
|
|
348
|
+
return;
|
|
349
|
+
}
|
|
350
|
+
(X = (s = Ee.value) == null ? void 0 : s.validateInputs) == null || X.call(s);
|
|
351
|
+
}
|
|
352
|
+
async function ie() {
|
|
353
|
+
const n = A.value;
|
|
354
|
+
if (ue.value = !0, n.items = n.items.filter((a) => a.quantity.amount > 0), !n.items.length) {
|
|
355
|
+
l.open({
|
|
356
|
+
title: "Cannot create order",
|
|
357
|
+
message: "There are no items with non-zero amount in your request.",
|
|
358
|
+
type: "error"
|
|
359
|
+
}), ue.value = !1;
|
|
360
|
+
return;
|
|
361
|
+
}
|
|
362
|
+
(n.supplier.internal === "warehouse" || n.supplier.internal === "restaurant") && (n.items = n.items.map(({ totalCost: a, ...s }) => s));
|
|
363
|
+
try {
|
|
364
|
+
await f.createPurchaseOrder(n), l.open({
|
|
365
|
+
title: c("inventory.transfer.receiveRequest.create.success"),
|
|
366
|
+
message: c("inventory.transfer.receiveRequest.create.successMessage"),
|
|
367
|
+
type: "success"
|
|
368
|
+
}), $("submitted"), $("update:show", !1), ce();
|
|
369
|
+
} catch (a) {
|
|
370
|
+
l.open({
|
|
371
|
+
title: c("inventory.transfer.receiveRequest.create.error.title"),
|
|
372
|
+
message: c("inventory.transfer.receiveRequest.create.error.message"),
|
|
373
|
+
type: "error"
|
|
374
|
+
}), console.error("Error creating purchase order", a);
|
|
375
|
+
} finally {
|
|
376
|
+
ue.value = !1;
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
function ce() {
|
|
380
|
+
i.value = 0, C.value = !1, o.value = null, R.value = null, N.value = null, M.value = null, H.value = "", be.value = "", he.value = "", ne.value = !1, ve.value = !1, me.value = [], A.value = Q(), Z.value = `${Math.random()}`;
|
|
381
|
+
}
|
|
382
|
+
return (n, a) => (m(), y(ye, null, [
|
|
383
|
+
(m(), le(lt, { to: "body" }, [
|
|
384
|
+
E(Dt, {
|
|
385
|
+
"enter-active-class": "transition-opacity duration-150 ease-out",
|
|
386
|
+
"enter-from-class": "opacity-0",
|
|
387
|
+
"enter-to-class": "opacity-100",
|
|
388
|
+
"leave-active-class": "transition-opacity duration-120 ease-in",
|
|
389
|
+
"leave-from-class": "opacity-100",
|
|
390
|
+
"leave-to-class": "opacity-0"
|
|
391
|
+
}, {
|
|
392
|
+
default: Pe(() => [
|
|
393
|
+
n.show ? (m(), y("div", qn, [
|
|
394
|
+
C.value ? D("", !0) : (m(), y("div", Nn, [
|
|
395
|
+
e("span", An, p(t(c)("inventory.transfer.receiveRequest.bulk.wizard.title")), 1),
|
|
396
|
+
e("div", $n, [
|
|
397
|
+
E(t(w), {
|
|
398
|
+
variant: "tertiary",
|
|
399
|
+
size: "md",
|
|
400
|
+
label: t(c)("inventory.transfer.receiveRequest.bulk.wizard.cancelBtn"),
|
|
401
|
+
onClick: Le
|
|
402
|
+
}, null, 8, ["label"]),
|
|
403
|
+
i.value > 0 ? (m(), le(t(w), {
|
|
404
|
+
key: 0,
|
|
405
|
+
variant: "secondary",
|
|
406
|
+
size: "md",
|
|
407
|
+
"prepend-icon": "arrow_back",
|
|
408
|
+
label: t(c)("inventory.transfer.receiveRequest.bulk.wizard.backBtn"),
|
|
409
|
+
onClick: Je
|
|
410
|
+
}, null, 8, ["label"])) : D("", !0),
|
|
411
|
+
E(t(w), {
|
|
412
|
+
size: "md",
|
|
413
|
+
disabled: !Oe.value,
|
|
414
|
+
loading: ue.value,
|
|
415
|
+
label: Se.value,
|
|
416
|
+
onClick: re
|
|
417
|
+
}, null, 8, ["disabled", "loading", "label"])
|
|
418
|
+
])
|
|
419
|
+
])),
|
|
420
|
+
C.value ? D("", !0) : (m(), y("div", On, [
|
|
421
|
+
e("div", Bn, [
|
|
422
|
+
e("button", {
|
|
423
|
+
class: "flex flex-col items-center gap-4 min-w-0 group",
|
|
424
|
+
disabled: i.value <= 0,
|
|
425
|
+
onClick: a[0] || (a[0] = (s) => Ie(0))
|
|
426
|
+
}, [
|
|
427
|
+
e("div", {
|
|
428
|
+
class: J([
|
|
429
|
+
"w-32 h-32 rounded-full flex items-center justify-center text-sm font-semibold transition-colors duration-150",
|
|
430
|
+
i.value > 0 || i.value === 0 ? "bg-[#FF7823] text-white" : "bg-[#F0F0F0] text-[#6B6C70]"
|
|
431
|
+
])
|
|
432
|
+
}, [
|
|
433
|
+
i.value > 0 ? (m(), le(t(S), {
|
|
434
|
+
key: 0,
|
|
435
|
+
name: "check",
|
|
436
|
+
size: "sm"
|
|
437
|
+
})) : (m(), y("span", In, "1"))
|
|
438
|
+
], 2),
|
|
439
|
+
e("span", {
|
|
440
|
+
class: J(["fm-typo-en-body-xs-500 whitespace-nowrap transition-colors duration-150", i.value >= 0 ? "text-[#1C1C1E]" : "text-[#B2B3B6]"])
|
|
441
|
+
}, " Select destination ", 2)
|
|
442
|
+
], 8, Tn),
|
|
443
|
+
e("div", {
|
|
444
|
+
class: J(["flex-1 h-1 mx-8 transition-colors duration-200", i.value > 0 ? "bg-[#FF7823]" : "bg-[#E0E0E0]"])
|
|
445
|
+
}, null, 2),
|
|
446
|
+
e("button", {
|
|
447
|
+
class: "flex flex-col items-center gap-4 min-w-0 group",
|
|
448
|
+
disabled: i.value <= 1,
|
|
449
|
+
onClick: a[1] || (a[1] = (s) => Ie(1))
|
|
450
|
+
}, [
|
|
451
|
+
e("div", {
|
|
452
|
+
class: J([
|
|
453
|
+
"w-32 h-32 rounded-full flex items-center justify-center text-sm font-semibold transition-colors duration-150",
|
|
454
|
+
i.value > 1 || i.value === 1 ? "bg-[#FF7823] text-white" : "bg-[#F0F0F0] text-[#6B6C70]"
|
|
455
|
+
])
|
|
456
|
+
}, [
|
|
457
|
+
i.value > 1 ? (m(), le(t(S), {
|
|
458
|
+
key: 0,
|
|
459
|
+
name: "check",
|
|
460
|
+
size: "sm"
|
|
461
|
+
})) : (m(), y("span", zn, "2"))
|
|
462
|
+
], 2),
|
|
463
|
+
e("span", {
|
|
464
|
+
class: J(["fm-typo-en-body-xs-500 whitespace-nowrap transition-colors duration-150", i.value >= 1 ? "text-[#1C1C1E]" : "text-[#B2B3B6]"])
|
|
465
|
+
}, p(P.value), 3)
|
|
466
|
+
], 8, Ln),
|
|
467
|
+
e("div", {
|
|
468
|
+
class: J(["flex-1 h-1 mx-8 transition-colors duration-200", i.value > 1 ? "bg-[#FF7823]" : "bg-[#E0E0E0]"])
|
|
469
|
+
}, null, 2),
|
|
470
|
+
e("button", Mn, [
|
|
471
|
+
e("div", {
|
|
472
|
+
class: J([
|
|
473
|
+
"w-32 h-32 rounded-full flex items-center justify-center text-sm font-semibold transition-colors duration-150",
|
|
474
|
+
i.value === 2 ? "bg-[#FF7823] text-white" : "bg-[#F0F0F0] text-[#6B6C70]"
|
|
475
|
+
])
|
|
476
|
+
}, a[11] || (a[11] = [
|
|
477
|
+
e("span", null, "3", -1)
|
|
478
|
+
]), 2),
|
|
479
|
+
e("span", {
|
|
480
|
+
class: J(["fm-typo-en-body-xs-500 whitespace-nowrap transition-colors duration-150", i.value >= 2 ? "text-[#1C1C1E]" : "text-[#B2B3B6]"])
|
|
481
|
+
}, p(F.value), 3)
|
|
482
|
+
])
|
|
483
|
+
])
|
|
484
|
+
])),
|
|
485
|
+
e("div", Un, [
|
|
486
|
+
e("div", Vn, [
|
|
487
|
+
i.value === 0 ? (m(), y("div", Jn, [
|
|
488
|
+
e("div", jn, [
|
|
489
|
+
e("h3", Wn, p(t(c)("inventory.transfer.receiveRequest.bulk.wizard.step1Heading")), 1),
|
|
490
|
+
e("p", Yn, p(t(c)("inventory.transfer.receiveRequest.bulk.wizard.step1Desc")), 1)
|
|
491
|
+
]),
|
|
492
|
+
e("div", Hn, [
|
|
493
|
+
E(t(z), {
|
|
494
|
+
"model-value": H.value,
|
|
495
|
+
"onUpdate:modelValue": a[2] || (a[2] = (s) => H.value = s),
|
|
496
|
+
"prepend-icon": "search",
|
|
497
|
+
placeholder: t(c)("inventory.transfer.receiveRequest.bulk.wizard.step1SearchPlaceholder")
|
|
498
|
+
}, null, 8, ["model-value", "placeholder"])
|
|
499
|
+
]),
|
|
500
|
+
e("div", Qn, [
|
|
501
|
+
(m(!0), y(ye, null, Qe(B.value, (s, X) => {
|
|
502
|
+
var te, fe, se, Ue, Xe, vt, yt;
|
|
503
|
+
return m(), y("div", {
|
|
504
|
+
key: s.dbName,
|
|
505
|
+
class: J(["flex items-center gap-8 px-12 h-[67px] cursor-pointer transition-colors duration-150", [
|
|
506
|
+
((te = o.value) == null ? void 0 : te.dbName) === s.dbName ? "bg-[#FFF5EE]" : "hover:bg-[#FAFAFA]",
|
|
507
|
+
X > 0 ? "border-t border-[#F0F0F0]" : ""
|
|
508
|
+
]]),
|
|
509
|
+
onClick: (ka) => o.value = s
|
|
510
|
+
}, [
|
|
511
|
+
e("div", Gn, [
|
|
512
|
+
e("span", Xn, p(s.name.slice(0, 2).toUpperCase()), 1)
|
|
513
|
+
]),
|
|
514
|
+
e("div", Zn, [
|
|
515
|
+
e("div", eo, p(s.name), 1),
|
|
516
|
+
e("div", to, [
|
|
517
|
+
ot(p(s.doc.profile.code ? `#${s.doc.profile.code}` : t(c)("inventory.transfer.receiveRequest.bulk.wizard.noCode")) + " ", 1),
|
|
518
|
+
(fe = s.doc.profile.address) != null && fe.line1 || (se = s.doc.profile.address) != null && se.city ? (m(), y(ye, { key: 0 }, [
|
|
519
|
+
ot(" · " + p([(Ue = s.doc.profile.address) == null ? void 0 : Ue.line1, (Xe = s.doc.profile.address) == null ? void 0 : Xe.city].filter(Boolean).join(" · ")), 1)
|
|
520
|
+
], 64)) : D("", !0)
|
|
521
|
+
])
|
|
522
|
+
]),
|
|
523
|
+
e("span", no, p(s.type === "warehouse" ? "Warehouse" : "Restaurant"), 1),
|
|
524
|
+
e("div", {
|
|
525
|
+
class: J([
|
|
526
|
+
"w-[18px] h-[18px] rounded-full border flex items-center justify-center shrink-0 transition-colors duration-150",
|
|
527
|
+
((vt = o.value) == null ? void 0 : vt.dbName) === s.dbName ? "border-[#FF7823]" : "border-[#CCCCCC]"
|
|
528
|
+
])
|
|
529
|
+
}, [
|
|
530
|
+
((yt = o.value) == null ? void 0 : yt.dbName) === s.dbName ? (m(), y("div", oo)) : D("", !0)
|
|
531
|
+
], 2)
|
|
532
|
+
], 10, Kn);
|
|
533
|
+
}), 128)),
|
|
534
|
+
B.value.length === 0 ? (m(), y("div", so, p(t(c)("inventory.transfer.receiveRequest.bulk.wizard.noOutletsAvailable")), 1)) : D("", !0)
|
|
535
|
+
])
|
|
536
|
+
])) : D("", !0),
|
|
537
|
+
i.value === 1 ? (m(), y("div", ao, [
|
|
538
|
+
e("div", ro, [
|
|
539
|
+
e("h3", lo, p(t(c)("inventory.transfer.receiveRequest.bulk.wizard.step2Heading")), 1),
|
|
540
|
+
e("p", io, p(t(c)("inventory.transfer.receiveRequest.bulk.wizard.step2Desc")), 1)
|
|
541
|
+
]),
|
|
542
|
+
e("div", uo, [
|
|
543
|
+
e("div", {
|
|
544
|
+
class: J([
|
|
545
|
+
"border rounded-xl p-16 cursor-pointer transition-all duration-150 flex flex-col",
|
|
546
|
+
R.value === "transfer" ? "border-[#FF7823] bg-[#FFF5EE]" : "border-[#E0E0E0] bg-white hover:bg-[#FAFAFA]"
|
|
547
|
+
]),
|
|
548
|
+
onClick: a[3] || (a[3] = (s) => Ne("transfer"))
|
|
549
|
+
}, [
|
|
550
|
+
e("div", co, [
|
|
551
|
+
e("div", {
|
|
552
|
+
class: J(["w-36 h-36 rounded-xl flex items-center justify-center shrink-0", R.value === "transfer" ? "bg-[#FF7823]" : "bg-[#F0F0F0]"])
|
|
553
|
+
}, [
|
|
554
|
+
E(t(S), {
|
|
555
|
+
name: "swap_horiz",
|
|
556
|
+
size: "md",
|
|
557
|
+
class: J(R.value === "transfer" ? "text-white" : "text-[#6B6C70]")
|
|
558
|
+
}, null, 8, ["class"])
|
|
559
|
+
], 2),
|
|
560
|
+
e("div", {
|
|
561
|
+
class: J(["w-16 h-16 rounded-full flex items-center justify-center shrink-0", R.value === "transfer" ? "bg-[#FF7823]" : "border border-[#CCCCCC]"])
|
|
562
|
+
}, [
|
|
563
|
+
R.value === "transfer" ? (m(), le(t(S), {
|
|
564
|
+
key: 0,
|
|
565
|
+
name: "check",
|
|
566
|
+
size: "sm",
|
|
567
|
+
class: "text-white"
|
|
568
|
+
})) : D("", !0)
|
|
569
|
+
], 2)
|
|
570
|
+
]),
|
|
571
|
+
e("div", mo, p(t(c)("inventory.transfer.receiveRequest.bulk.wizard.outletToOutlet")), 1),
|
|
572
|
+
e("div", fo, p(t(c)("inventory.transfer.receiveRequest.bulk.wizard.outletToOutletDesc")), 1)
|
|
573
|
+
], 2),
|
|
574
|
+
e("div", {
|
|
575
|
+
class: J([
|
|
576
|
+
"border rounded-xl p-16 cursor-pointer transition-all duration-150 flex flex-col",
|
|
577
|
+
R.value === "template" ? "border-[#FF7823] bg-[#FFF5EE]" : "border-[#E0E0E0] bg-white hover:bg-[#FAFAFA]"
|
|
578
|
+
]),
|
|
579
|
+
onClick: a[4] || (a[4] = (s) => Ne("template"))
|
|
580
|
+
}, [
|
|
581
|
+
e("div", po, [
|
|
582
|
+
e("div", {
|
|
583
|
+
class: J(["w-36 h-36 rounded-xl flex items-center justify-center shrink-0", R.value === "template" ? "bg-[#FF7823]" : "bg-[#F0F0F0]"])
|
|
584
|
+
}, [
|
|
585
|
+
E(t(S), {
|
|
586
|
+
name: "description",
|
|
587
|
+
size: "md",
|
|
588
|
+
class: J(R.value === "template" ? "text-white" : "text-[#6B6C70]")
|
|
589
|
+
}, null, 8, ["class"])
|
|
590
|
+
], 2),
|
|
591
|
+
e("div", {
|
|
592
|
+
class: J(["w-16 h-16 rounded-full flex items-center justify-center shrink-0", R.value === "template" ? "bg-[#FF7823]" : "border border-[#CCCCCC]"])
|
|
593
|
+
}, [
|
|
594
|
+
R.value === "template" ? (m(), le(t(S), {
|
|
595
|
+
key: 0,
|
|
596
|
+
name: "check",
|
|
597
|
+
size: "sm",
|
|
598
|
+
class: "text-white"
|
|
599
|
+
})) : D("", !0)
|
|
600
|
+
], 2)
|
|
601
|
+
]),
|
|
602
|
+
e("div", vo, p(t(c)("inventory.transfer.receiveRequest.bulk.wizard.fromTemplate")), 1),
|
|
603
|
+
e("div", yo, p(t(c)("inventory.transfer.receiveRequest.bulk.wizard.fromTemplateDesc")), 1)
|
|
604
|
+
], 2)
|
|
605
|
+
]),
|
|
606
|
+
R.value === "transfer" ? (m(), y(ye, { key: 0 }, [
|
|
607
|
+
e("div", bo, p(t(c)("inventory.transfer.receiveRequest.bulk.wizard.step2SourceHeading")), 1),
|
|
608
|
+
e("div", ho, [
|
|
609
|
+
E(t(z), {
|
|
610
|
+
"model-value": be.value,
|
|
611
|
+
"onUpdate:modelValue": a[5] || (a[5] = (s) => be.value = s),
|
|
612
|
+
"prepend-icon": "search",
|
|
613
|
+
placeholder: t(c)(
|
|
614
|
+
"inventory.transfer.receiveRequest.bulk.wizard.step2SearchSourcePlaceholder"
|
|
615
|
+
)
|
|
616
|
+
}, null, 8, ["model-value", "placeholder"])
|
|
617
|
+
]),
|
|
618
|
+
e("div", go, [
|
|
619
|
+
(m(!0), y(ye, null, Qe(K.value, (s, X) => {
|
|
620
|
+
var te, fe, se;
|
|
621
|
+
return m(), y("div", {
|
|
622
|
+
key: s.dbName,
|
|
623
|
+
class: J(["flex items-center gap-8 px-12 h-[67px] cursor-pointer transition-colors duration-150", [
|
|
624
|
+
((te = N.value) == null ? void 0 : te.doc._id) === s.doc._id ? "bg-[#FFF5EE]" : "hover:bg-[#FAFAFA]",
|
|
625
|
+
X > 0 ? "border-t border-[#F0F0F0]" : ""
|
|
626
|
+
]]),
|
|
627
|
+
onClick: (Ue) => N.value = s
|
|
628
|
+
}, [
|
|
629
|
+
e("div", _o, [
|
|
630
|
+
e("span", wo, p(s.name.slice(0, 2).toUpperCase()), 1)
|
|
631
|
+
]),
|
|
632
|
+
e("div", ko, [
|
|
633
|
+
e("div", Co, p(s.name), 1),
|
|
634
|
+
e("div", Fo, [
|
|
635
|
+
ot(p(Te(s) ? `#${Te(s)}` : t(c)("inventory.transfer.receiveRequest.bulk.wizard.noCode")) + " ", 1),
|
|
636
|
+
r(s) ? (m(), y(ye, { key: 0 }, [
|
|
637
|
+
ot(" · " + p(r(s)), 1)
|
|
638
|
+
], 64)) : D("", !0)
|
|
639
|
+
])
|
|
640
|
+
]),
|
|
641
|
+
e("span", So, p(s.type === "warehouse" ? "Warehouse" : s.type === "supplier" ? "Supplier" : "Restaurant"), 1),
|
|
642
|
+
e("div", {
|
|
643
|
+
class: J([
|
|
644
|
+
"w-[18px] h-[18px] rounded-full border flex items-center justify-center shrink-0 transition-colors duration-150",
|
|
645
|
+
((fe = N.value) == null ? void 0 : fe.doc._id) === s.doc._id ? "border-[#FF7823]" : "border-[#CCCCCC]"
|
|
646
|
+
])
|
|
647
|
+
}, [
|
|
648
|
+
((se = N.value) == null ? void 0 : se.doc._id) === s.doc._id ? (m(), y("div", Ro)) : D("", !0)
|
|
649
|
+
], 2)
|
|
650
|
+
], 10, xo);
|
|
651
|
+
}), 128)),
|
|
652
|
+
K.value.length === 0 ? (m(), y("div", Po, p(t(c)("inventory.transfer.receiveRequest.bulk.wizard.noOutletsAvailable")), 1)) : D("", !0)
|
|
653
|
+
])
|
|
654
|
+
], 64)) : D("", !0),
|
|
655
|
+
R.value === "template" ? (m(), y(ye, { key: 1 }, [
|
|
656
|
+
e("div", Do, p(t(c)("inventory.transfer.receiveRequest.bulk.wizard.step2TemplateHeading")), 1),
|
|
657
|
+
e("div", Eo, [
|
|
658
|
+
E(t(z), {
|
|
659
|
+
"model-value": he.value,
|
|
660
|
+
"onUpdate:modelValue": a[6] || (a[6] = (s) => he.value = s),
|
|
661
|
+
"prepend-icon": "search",
|
|
662
|
+
placeholder: t(c)(
|
|
663
|
+
"inventory.transfer.receiveRequest.bulk.wizard.step2SearchTemplatePlaceholder"
|
|
664
|
+
)
|
|
665
|
+
}, null, 8, ["model-value", "placeholder"])
|
|
666
|
+
]),
|
|
667
|
+
t(d).loading ? (m(), y("div", qo, [
|
|
668
|
+
E(t(S), {
|
|
669
|
+
name: "progress_activity",
|
|
670
|
+
class: "text-[#FF7823] animate-spin"
|
|
671
|
+
})
|
|
672
|
+
])) : G.value.length === 0 ? (m(), y("div", No, p(t(c)("inventory.transfer.receiveRequest.bulk.wizard.noTemplatesAvailable")), 1)) : (m(), y("div", Ao, [
|
|
673
|
+
(m(!0), y(ye, null, Qe(G.value, (s) => (m(), y("div", {
|
|
674
|
+
key: s._id,
|
|
675
|
+
class: J([
|
|
676
|
+
"border rounded-lg px-16 py-12 cursor-pointer transition-all duration-150 flex items-center gap-12",
|
|
677
|
+
M.value === s._id ? "border-[#FF7823] bg-[#FFF5EE]" : "border-[#E0E0E0] bg-white hover:bg-[#FAFAFA]"
|
|
678
|
+
]),
|
|
679
|
+
onClick: (X) => M.value = s._id
|
|
680
|
+
}, [
|
|
681
|
+
e("div", Oo, [
|
|
682
|
+
e("div", Bo, p(s.name), 1),
|
|
683
|
+
e("div", To, p(I(s)) + " · " + p(s.purchaseOrder.items.length) + " items ", 1)
|
|
684
|
+
]),
|
|
685
|
+
e("div", {
|
|
686
|
+
class: J([
|
|
687
|
+
"w-[18px] h-[18px] rounded-full border flex items-center justify-center shrink-0 transition-colors duration-150",
|
|
688
|
+
M.value === s._id ? "border-[#FF7823]" : "border-[#CCCCCC]"
|
|
689
|
+
])
|
|
690
|
+
}, [
|
|
691
|
+
M.value === s._id ? (m(), y("div", Io)) : D("", !0)
|
|
692
|
+
], 2)
|
|
693
|
+
], 10, $o))), 128))
|
|
694
|
+
]))
|
|
695
|
+
], 64)) : D("", !0)
|
|
696
|
+
])) : D("", !0),
|
|
697
|
+
i.value === 2 ? (m(), y("div", Lo, [
|
|
698
|
+
e("div", zo, [
|
|
699
|
+
e("h3", Mo, p(F.value), 1)
|
|
700
|
+
]),
|
|
701
|
+
(m(), le(dn, {
|
|
702
|
+
ref_key: "formRef",
|
|
703
|
+
ref: Ee,
|
|
704
|
+
class: "w-full",
|
|
705
|
+
"onForm:ready": a[7] || (a[7] = () => ve.value = !0),
|
|
706
|
+
"onForm:dataChange": ke,
|
|
707
|
+
onValidationSuccess: ie,
|
|
708
|
+
modelValue: A.value,
|
|
709
|
+
"onUpdate:modelValue": a[8] || (a[8] = (s) => A.value = s),
|
|
710
|
+
disabled: Ge.value,
|
|
711
|
+
"locked-supplier": A.value.supplier,
|
|
712
|
+
suppliers: t(V).suppliers,
|
|
713
|
+
skus: t(de).skus,
|
|
714
|
+
key: Z.value,
|
|
715
|
+
"last-closing-date": n.lastClosingDate,
|
|
716
|
+
"sku-balance-map": Ae.value,
|
|
717
|
+
"is-balance-loading": _e.value
|
|
718
|
+
}, null, 8, ["modelValue", "disabled", "locked-supplier", "suppliers", "skus", "last-closing-date", "sku-balance-map", "is-balance-loading"]))
|
|
719
|
+
])) : D("", !0)
|
|
720
|
+
]),
|
|
721
|
+
e("div", Uo, [
|
|
722
|
+
e("div", Vo, [
|
|
723
|
+
e("div", Jo, [
|
|
724
|
+
e("div", jo, [
|
|
725
|
+
e("div", Wo, p(t(c)("inventory.transfer.receiveRequest.bulk.wizard.summaryTitle")), 1)
|
|
726
|
+
]),
|
|
727
|
+
e("div", Yo, [
|
|
728
|
+
e("span", Ho, p(t(c)("inventory.transfer.receiveRequest.bulk.wizard.summaryDestination")), 1),
|
|
729
|
+
e("span", {
|
|
730
|
+
class: J(["text-[15px] leading-[20px] font-semibold transition-colors duration-200", o.value ? "text-[#1C1C1E]" : "text-[#B2B3B6]"])
|
|
731
|
+
}, p(Re.value), 3),
|
|
732
|
+
u.value ? (m(), y("span", Qo, p(u.value), 1)) : D("", !0)
|
|
733
|
+
]),
|
|
734
|
+
e("div", Ko, [
|
|
735
|
+
e("span", Go, p(t(c)("inventory.transfer.receiveRequest.bulk.wizard.summaryMethod")), 1),
|
|
736
|
+
e("span", {
|
|
737
|
+
class: J(["text-[15px] leading-[20px] font-semibold transition-colors duration-200", R.value ? "text-[#1C1C1E]" : "text-[#B2B3B6]"])
|
|
738
|
+
}, p(we.value), 3)
|
|
739
|
+
]),
|
|
740
|
+
e("div", Xo, [
|
|
741
|
+
e("span", Zo, p(t(c)("inventory.transfer.receiveRequest.bulk.wizard.summarySource")), 1),
|
|
742
|
+
e("span", {
|
|
743
|
+
class: J([
|
|
744
|
+
"text-[15px] leading-[20px] font-semibold transition-colors duration-200",
|
|
745
|
+
N.value || M.value ? "text-[#1C1C1E]" : "text-[#B2B3B6]"
|
|
746
|
+
])
|
|
747
|
+
}, p(j.value), 3),
|
|
748
|
+
b.value ? (m(), y("span", es, p(b.value), 1)) : D("", !0)
|
|
749
|
+
]),
|
|
750
|
+
e("div", ts, [
|
|
751
|
+
e("span", ns, p(t(c)("inventory.transfer.receiveRequest.bulk.wizard.summaryItems")), 1),
|
|
752
|
+
e("span", {
|
|
753
|
+
class: J(["text-[15px] leading-[20px] font-medium transition-colors duration-200", Fe.value ? "text-[#1C1C1E]" : "text-[#6B6C70]"])
|
|
754
|
+
}, p(T.value), 3)
|
|
755
|
+
])
|
|
756
|
+
])
|
|
757
|
+
])
|
|
758
|
+
])
|
|
759
|
+
])
|
|
760
|
+
])) : D("", !0)
|
|
761
|
+
]),
|
|
762
|
+
_: 1
|
|
763
|
+
})
|
|
764
|
+
])),
|
|
765
|
+
E(t(O), {
|
|
766
|
+
modelValue: De.value,
|
|
767
|
+
"onUpdate:modelValue": a[10] || (a[10] = (s) => De.value = s),
|
|
768
|
+
overlay: !0
|
|
769
|
+
}, {
|
|
770
|
+
"dialog-header": Pe(() => [
|
|
771
|
+
e("div", os, p(t(c)("inventory.transfer.template.zeroQuantity.title")), 1)
|
|
772
|
+
]),
|
|
773
|
+
"dialog-footer": Pe(() => [
|
|
774
|
+
e("div", us, [
|
|
775
|
+
E(t(w), {
|
|
776
|
+
label: t(c)("common.cancel"),
|
|
777
|
+
variant: "tertiary",
|
|
778
|
+
size: "md",
|
|
779
|
+
onClick: a[9] || (a[9] = (s) => De.value = !1)
|
|
780
|
+
}, null, 8, ["label"]),
|
|
781
|
+
E(t(w), {
|
|
782
|
+
label: t(c)("inventory.transfer.template.zeroQuantity.removeAll"),
|
|
783
|
+
variant: "primary",
|
|
784
|
+
size: "md",
|
|
785
|
+
"prepend-icon": "delete",
|
|
786
|
+
onClick: x
|
|
787
|
+
}, null, 8, ["label"])
|
|
788
|
+
])
|
|
789
|
+
]),
|
|
790
|
+
default: Pe(() => [
|
|
791
|
+
e("div", ss, [
|
|
792
|
+
e("div", as, p(t(c)("inventory.transfer.template.zeroQuantity.message", {
|
|
793
|
+
count: U.value.length
|
|
794
|
+
})), 1),
|
|
795
|
+
e("div", rs, [
|
|
796
|
+
e("ul", ls, [
|
|
797
|
+
(m(!0), y(ye, null, Qe(U.value, (s) => (m(), y("li", {
|
|
798
|
+
key: s.sku._id,
|
|
799
|
+
class: "fm-typo-en-body-md-400"
|
|
800
|
+
}, p(s.sku.name) + " (" + p(s.sku.code) + ") ", 1))), 128))
|
|
801
|
+
])
|
|
802
|
+
]),
|
|
803
|
+
e("div", is, p(t(c)("inventory.transfer.template.zeroQuantity.prompt")), 1)
|
|
804
|
+
])
|
|
805
|
+
]),
|
|
806
|
+
_: 1
|
|
807
|
+
}, 8, ["modelValue"])
|
|
808
|
+
], 64));
|
|
809
|
+
}
|
|
810
|
+
}), ds = { class: "w-[95vw] h-[95vh] bg-white rounded-lg flex flex-col shadow-2xl overflow-hidden" }, ms = { class: "flex justify-between items-center px-16 py-3 border-b border-gray-200 bg-gray-50" }, fs = { class: "flex gap-2 items-center" }, ps = ["disabled"], vs = { class: "flex-1 overflow-auto bg-gray-100 flex items-center justify-center" }, ys = {
|
|
811
|
+
key: 0,
|
|
812
|
+
class: "flex flex-col items-center gap-3 text-gray-500"
|
|
813
|
+
}, bs = ["src"], hs = /* @__PURE__ */ tt({
|
|
814
|
+
__name: "PdfPreviewDialog",
|
|
815
|
+
props: {
|
|
816
|
+
modelValue: { type: Boolean },
|
|
817
|
+
loading: { type: Boolean },
|
|
818
|
+
blobUrl: {}
|
|
819
|
+
},
|
|
820
|
+
emits: ["update:modelValue"],
|
|
821
|
+
setup(_, { emit: h }) {
|
|
822
|
+
const w = _, O = h, S = k(null);
|
|
823
|
+
function z() {
|
|
824
|
+
O("update:modelValue", !1);
|
|
825
|
+
}
|
|
826
|
+
function Y() {
|
|
827
|
+
var $, c;
|
|
828
|
+
if (w.blobUrl)
|
|
829
|
+
try {
|
|
830
|
+
(c = ($ = S.value) == null ? void 0 : $.contentWindow) == null || c.print();
|
|
831
|
+
} catch {
|
|
832
|
+
const l = document.createElement("a");
|
|
833
|
+
l.href = w.blobUrl, l.download = "purchase-order.pdf", document.body.appendChild(l), l.click(), document.body.removeChild(l);
|
|
834
|
+
}
|
|
835
|
+
}
|
|
836
|
+
return ($, c) => (m(), le(lt, { to: "body" }, [
|
|
837
|
+
$.modelValue ? (m(), y("div", {
|
|
838
|
+
key: 0,
|
|
839
|
+
class: "fixed inset-0 z-[9999] bg-black/50 flex justify-center items-center",
|
|
840
|
+
onClick: Et(z, ["self"])
|
|
841
|
+
}, [
|
|
842
|
+
e("div", ds, [
|
|
843
|
+
e("div", ms, [
|
|
844
|
+
c[0] || (c[0] = e("span", { class: "text-base font-semibold text-gray-700" }, "Print Preview", -1)),
|
|
845
|
+
e("div", fs, [
|
|
846
|
+
e("button", {
|
|
847
|
+
disabled: $.loading || !$.blobUrl,
|
|
848
|
+
class: "px-8 py-1.5 bg-blue-500 text-white border-none rounded text-sm cursor-pointer hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed",
|
|
849
|
+
onClick: Y
|
|
850
|
+
}, " Print ", 8, ps),
|
|
851
|
+
e("button", {
|
|
852
|
+
class: "px-2.5 py-1 bg-transparent border border-gray-300 rounded text-xl leading-none cursor-pointer text-gray-500 hover:bg-gray-100",
|
|
853
|
+
onClick: z
|
|
854
|
+
}, " × ")
|
|
855
|
+
])
|
|
856
|
+
]),
|
|
857
|
+
e("div", vs, [
|
|
858
|
+
$.loading ? (m(), y("div", ys, c[1] || (c[1] = [
|
|
859
|
+
e("svg", {
|
|
860
|
+
class: "animate-spin h-10 w-10 text-blue-500",
|
|
861
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
862
|
+
fill: "none",
|
|
863
|
+
viewBox: "0 0 24 24"
|
|
864
|
+
}, [
|
|
865
|
+
e("circle", {
|
|
866
|
+
class: "opacity-25",
|
|
867
|
+
cx: "12",
|
|
868
|
+
cy: "12",
|
|
869
|
+
r: "10",
|
|
870
|
+
stroke: "currentColor",
|
|
871
|
+
"stroke-width": "4"
|
|
872
|
+
}),
|
|
873
|
+
e("path", {
|
|
874
|
+
class: "opacity-75",
|
|
875
|
+
fill: "currentColor",
|
|
876
|
+
d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"
|
|
877
|
+
})
|
|
878
|
+
], -1),
|
|
879
|
+
e("span", { class: "text-sm" }, "Generating PDF…", -1)
|
|
880
|
+
]))) : $.blobUrl ? (m(), y("iframe", {
|
|
881
|
+
key: 1,
|
|
882
|
+
ref_key: "iframeRef",
|
|
883
|
+
ref: S,
|
|
884
|
+
src: $.blobUrl,
|
|
885
|
+
class: "w-full h-full border-none"
|
|
886
|
+
}, null, 8, bs)) : D("", !0)
|
|
887
|
+
])
|
|
888
|
+
])
|
|
889
|
+
])) : D("", !0)
|
|
890
|
+
]));
|
|
891
|
+
}
|
|
892
|
+
}), gs = /* @__PURE__ */ tt({
|
|
893
|
+
__name: "MultiLocationSelector",
|
|
894
|
+
props: /* @__PURE__ */ qt({
|
|
895
|
+
locations: {}
|
|
896
|
+
}, {
|
|
897
|
+
modelValue: { default: () => [] },
|
|
898
|
+
modelModifiers: {}
|
|
899
|
+
}),
|
|
900
|
+
emits: ["update:modelValue"],
|
|
901
|
+
setup(_) {
|
|
902
|
+
const { t: h } = nt(), w = _, O = Nt(_, "modelValue"), S = k(!1), z = k(""), Y = L(() => {
|
|
903
|
+
const f = z.value.trim().toLowerCase();
|
|
904
|
+
return f ? w.locations.filter(
|
|
905
|
+
(d) => d.name.toLowerCase().includes(f) || (d.doc.profile.code ?? "").toLowerCase().includes(f)
|
|
906
|
+
) : w.locations;
|
|
907
|
+
}), $ = L(() => O.value.length), c = L(
|
|
908
|
+
() => Y.value.length > 0 && Y.value.every((f) => O.value.includes(f.dbName))
|
|
909
|
+
), l = L(
|
|
910
|
+
() => Y.value.some((f) => O.value.includes(f.dbName)) && !c.value
|
|
911
|
+
), g = L(() => {
|
|
912
|
+
if ($.value === 0) return h("inventory.transfer.receiveRequest.bulk.noLocationsSelected");
|
|
913
|
+
if ($.value === 1) {
|
|
914
|
+
const f = w.locations.find((d) => d.dbName === O.value[0]);
|
|
915
|
+
return f ? `${f.name} (${f.doc.profile.code ?? "--"})` : O.value[0];
|
|
916
|
+
}
|
|
917
|
+
return h("inventory.transfer.receiveRequest.bulk.locationsSelected", [$.value]);
|
|
918
|
+
});
|
|
919
|
+
function V() {
|
|
920
|
+
const f = Y.value.map((d) => d.dbName);
|
|
921
|
+
c.value ? O.value = O.value.filter((d) => !f.includes(d)) : O.value = [.../* @__PURE__ */ new Set([...O.value, ...f])];
|
|
922
|
+
}
|
|
923
|
+
function de(f) {
|
|
924
|
+
O.value.includes(f) ? O.value = O.value.filter((d) => d !== f) : O.value = [...O.value, f];
|
|
925
|
+
}
|
|
926
|
+
function v(f) {
|
|
927
|
+
return O.value.includes(f);
|
|
928
|
+
}
|
|
929
|
+
return (f, d) => {
|
|
930
|
+
const i = Ce("FmIcon"), C = Ce("FmChip"), o = Ce("FmTextField"), H = Ce("FmMenuItem"), R = Ce("FmMenu");
|
|
931
|
+
return m(), le(R, {
|
|
932
|
+
"model-value": S.value,
|
|
933
|
+
placement: "bottom-end",
|
|
934
|
+
"close-on-click": !1,
|
|
935
|
+
onMenuChanged: d[1] || (d[1] = (N) => {
|
|
936
|
+
S.value = N, N || (z.value = "");
|
|
937
|
+
})
|
|
938
|
+
}, {
|
|
939
|
+
"menu-button": Pe(() => [
|
|
940
|
+
E(C, {
|
|
941
|
+
label: g.value,
|
|
942
|
+
class: "text-fm-color-neutral-gray-400 cursor-pointer"
|
|
943
|
+
}, {
|
|
944
|
+
default: Pe(() => [
|
|
945
|
+
E(i, {
|
|
946
|
+
name: "storefront",
|
|
947
|
+
outline: "",
|
|
948
|
+
size: "sm"
|
|
949
|
+
}),
|
|
950
|
+
e("div", {
|
|
951
|
+
class: J(["fm-typo-en-body-md-600 select-none text-ellipsis overflow-hidden whitespace-nowrap max-w-[200px]", { "text-fm-color-typo-primary": $.value > 0 }])
|
|
952
|
+
}, p(g.value), 3),
|
|
953
|
+
E(i, {
|
|
954
|
+
name: S.value ? "keyboard_arrow_up" : "keyboard_arrow_down",
|
|
955
|
+
outline: "",
|
|
956
|
+
size: "sm"
|
|
957
|
+
}, null, 8, ["name"])
|
|
958
|
+
]),
|
|
959
|
+
_: 1
|
|
960
|
+
}, 8, ["label"])
|
|
961
|
+
]),
|
|
962
|
+
default: Pe(() => [
|
|
963
|
+
E(o, {
|
|
964
|
+
"model-value": z.value,
|
|
965
|
+
"onUpdate:modelValue": d[0] || (d[0] = (N) => z.value = N),
|
|
966
|
+
placeholder: t(h)("inventory.common.table.toolbar.filterItems"),
|
|
967
|
+
class: "my-8"
|
|
968
|
+
}, null, 8, ["model-value", "placeholder"]),
|
|
969
|
+
E(H, {
|
|
970
|
+
"model-value": c.value,
|
|
971
|
+
label: t(h)("inventory.common.selectAll"),
|
|
972
|
+
"has-checkbox": !0,
|
|
973
|
+
indeterminate: l.value,
|
|
974
|
+
onClick: V
|
|
975
|
+
}, null, 8, ["model-value", "label", "indeterminate"]),
|
|
976
|
+
(m(!0), y(ye, null, Qe(Y.value, (N) => (m(), le(H, {
|
|
977
|
+
key: N.dbName,
|
|
978
|
+
"model-value": v(N.dbName),
|
|
979
|
+
label: `${N.name} (${N.doc.profile.code ?? "--"})`,
|
|
980
|
+
sublabel: N.type === "restaurant" ? t(h)("inventory.common.restaurant") : t(h)("inventory.common.warehouse"),
|
|
981
|
+
"has-checkbox": !0,
|
|
982
|
+
onClick: (M) => de(N.dbName)
|
|
983
|
+
}, null, 8, ["model-value", "label", "sublabel", "onClick"]))), 128)),
|
|
984
|
+
Y.value.length === 0 ? (m(), le(H, {
|
|
985
|
+
key: 0,
|
|
986
|
+
disabled: "",
|
|
987
|
+
label: t(h)("inventory.common.noResultFound")
|
|
988
|
+
}, null, 8, ["label"])) : D("", !0)
|
|
989
|
+
]),
|
|
990
|
+
_: 1
|
|
991
|
+
}, 8, ["model-value"]);
|
|
992
|
+
};
|
|
993
|
+
}
|
|
994
|
+
}), Pt = "bulk-jobs-v1";
|
|
995
|
+
function xs() {
|
|
996
|
+
try {
|
|
997
|
+
const _ = localStorage.getItem(Pt);
|
|
998
|
+
return _ ? JSON.parse(_) : [];
|
|
999
|
+
} catch {
|
|
1000
|
+
return [];
|
|
1001
|
+
}
|
|
1002
|
+
}
|
|
1003
|
+
function _s(_) {
|
|
1004
|
+
try {
|
|
1005
|
+
localStorage.setItem(Pt, JSON.stringify(_));
|
|
1006
|
+
} catch {
|
|
1007
|
+
}
|
|
1008
|
+
}
|
|
1009
|
+
const ws = 300, rt = ["completed", "failed", "cancelled"];
|
|
1010
|
+
function ks(_, h) {
|
|
1011
|
+
var w;
|
|
1012
|
+
return _.cancelled ? "cancelled" : _.message === "completed" ? "completed" : _.message === "error" || (w = _.message) != null && w.startsWith("error:") ? "failed" : _.message === "processing" ? "active" : "waiting";
|
|
1013
|
+
}
|
|
1014
|
+
const pt = Rn("bulkJob", () => {
|
|
1015
|
+
const _ = k(xs()), h = /* @__PURE__ */ new Map();
|
|
1016
|
+
let w = null;
|
|
1017
|
+
Ve(_, (v) => {
|
|
1018
|
+
w && clearTimeout(w), w = setTimeout(() => _s(v), ws);
|
|
1019
|
+
}, { deep: !0 });
|
|
1020
|
+
function O(v, f) {
|
|
1021
|
+
var R;
|
|
1022
|
+
const d = _.value.find((N) => N.jobId === v);
|
|
1023
|
+
let i = ks(f, d == null ? void 0 : d.type);
|
|
1024
|
+
const C = f.errorCount ?? 0;
|
|
1025
|
+
i === "completed" && C > 0 && (d == null ? void 0 : d.type) === "download" && (i = "failed");
|
|
1026
|
+
const o = f.total ?? 0, H = f.current ?? 0;
|
|
1027
|
+
$(v, {
|
|
1028
|
+
status: i,
|
|
1029
|
+
progress: o > 0 ? Math.round(H / o * 100) : 0,
|
|
1030
|
+
current: H,
|
|
1031
|
+
total: o,
|
|
1032
|
+
currentItem: f.currentItem ?? void 0,
|
|
1033
|
+
errorCount: C,
|
|
1034
|
+
// Only expose the download button when the job fully succeeded.
|
|
1035
|
+
downloadReady: i === "completed" ? f.downloadReady : !1,
|
|
1036
|
+
zipSizeBytes: f.zipSizeBytes ?? void 0,
|
|
1037
|
+
stalePoIds: (R = f.stalePoIds) != null && R.length ? f.stalePoIds : void 0
|
|
1038
|
+
}), rt.includes(i) && z(v);
|
|
1039
|
+
}
|
|
1040
|
+
function S(v) {
|
|
1041
|
+
if (h.has(v)) return;
|
|
1042
|
+
const f = _.value.find((H) => H.jobId === v);
|
|
1043
|
+
if (!f) return;
|
|
1044
|
+
const d = 5;
|
|
1045
|
+
let i = 0;
|
|
1046
|
+
const C = async () => {
|
|
1047
|
+
const H = Ke();
|
|
1048
|
+
try {
|
|
1049
|
+
const R = await H.getBulkJobStatus(f.dbName, v);
|
|
1050
|
+
R ? (i = 0, O(v, R)) : (i++, i >= d && ($(v, { status: "failed" }), z(v)));
|
|
1051
|
+
} catch {
|
|
1052
|
+
}
|
|
1053
|
+
};
|
|
1054
|
+
C();
|
|
1055
|
+
const o = setInterval(C, 2e3);
|
|
1056
|
+
h.set(v, o);
|
|
1057
|
+
}
|
|
1058
|
+
function z(v) {
|
|
1059
|
+
const f = h.get(v);
|
|
1060
|
+
f !== void 0 && (clearInterval(f), h.delete(v));
|
|
1061
|
+
}
|
|
1062
|
+
function Y(v) {
|
|
1063
|
+
_.value = [v, ..._.value], S(v.jobId);
|
|
1064
|
+
}
|
|
1065
|
+
for (const v of _.value)
|
|
1066
|
+
rt.includes(v.status) || S(v.jobId);
|
|
1067
|
+
function $(v, f) {
|
|
1068
|
+
const d = _.value.findIndex((i) => i.jobId === v);
|
|
1069
|
+
if (d !== -1) {
|
|
1070
|
+
const i = _.value[d], C = f.status ?? i.status, o = rt.includes(C) && !rt.includes(i.status) && !i.completedAt;
|
|
1071
|
+
_.value[d] = {
|
|
1072
|
+
...i,
|
|
1073
|
+
...f,
|
|
1074
|
+
...o ? { completedAt: Date.now() } : {}
|
|
1075
|
+
};
|
|
1076
|
+
}
|
|
1077
|
+
}
|
|
1078
|
+
function c(v) {
|
|
1079
|
+
z(v), _.value = _.value.filter((f) => f.jobId !== v);
|
|
1080
|
+
}
|
|
1081
|
+
async function l(v) {
|
|
1082
|
+
const f = _.value.find((d) => d.jobId === v);
|
|
1083
|
+
if (f)
|
|
1084
|
+
try {
|
|
1085
|
+
await Ke().cancelBulkJob(f.dbName, v);
|
|
1086
|
+
} catch (d) {
|
|
1087
|
+
console.warn("[cancelJob] cancel API call failed for job", v, d);
|
|
1088
|
+
}
|
|
1089
|
+
}
|
|
1090
|
+
function g(v, f) {
|
|
1091
|
+
return _.value.find((d) => d.jobId === v) || Y({
|
|
1092
|
+
jobId: v,
|
|
1093
|
+
type: "download",
|
|
1094
|
+
dbName: f,
|
|
1095
|
+
title: "",
|
|
1096
|
+
status: "waiting",
|
|
1097
|
+
progress: 0,
|
|
1098
|
+
current: 0,
|
|
1099
|
+
total: 0,
|
|
1100
|
+
errorCount: 0,
|
|
1101
|
+
startedAt: Date.now()
|
|
1102
|
+
}), new Promise((d, i) => {
|
|
1103
|
+
const C = Ve(
|
|
1104
|
+
() => _.value.find((o) => o.jobId === v),
|
|
1105
|
+
(o) => {
|
|
1106
|
+
if (!o) {
|
|
1107
|
+
C(), i(new Error("PDF generation job not found"));
|
|
1108
|
+
return;
|
|
1109
|
+
}
|
|
1110
|
+
if (o.status === "failed") {
|
|
1111
|
+
C(), i(new Error("PDF generation failed"));
|
|
1112
|
+
return;
|
|
1113
|
+
}
|
|
1114
|
+
if (o.status === "cancelled") {
|
|
1115
|
+
C(), i(new Error("PDF generation cancelled"));
|
|
1116
|
+
return;
|
|
1117
|
+
}
|
|
1118
|
+
if (o.downloadReady) {
|
|
1119
|
+
C(), d();
|
|
1120
|
+
return;
|
|
1121
|
+
}
|
|
1122
|
+
},
|
|
1123
|
+
{ immediate: !0 }
|
|
1124
|
+
);
|
|
1125
|
+
});
|
|
1126
|
+
}
|
|
1127
|
+
const V = L(
|
|
1128
|
+
() => _.value.filter((v) => v.status === "waiting" || v.status === "active")
|
|
1129
|
+
), de = L(() => V.value.length > 0);
|
|
1130
|
+
return { jobs: _, addJob: Y, updateJob: $, removeJob: c, cancelJob: l, waitForPdfJob: g, activeJobs: V, hasActiveJobs: de };
|
|
1131
|
+
}), et = k(), pe = k(), dt = k();
|
|
1132
|
+
function Cs(_) {
|
|
1133
|
+
const h = un(), w = it(), O = Rt(), S = Ft(), z = Ct(), Y = hn(), $ = St(), c = k(!1), l = ut(), { t: g } = nt(), V = Ke(), de = Yt(), v = pt(), f = k([]), d = k([]), i = k(new Array()), C = k(
|
|
1134
|
+
new Array()
|
|
1135
|
+
), o = k(
|
|
1136
|
+
_ != null && _.startDate && (_ != null && _.endDate) ? _ : ft()
|
|
1137
|
+
), H = L(() => {
|
|
1138
|
+
const r = new Date(o.value.startDate), u = new Date(o.value.endDate);
|
|
1139
|
+
return {
|
|
1140
|
+
start: Fn(r).toISOString(),
|
|
1141
|
+
end: Cn(u).toISOString()
|
|
1142
|
+
};
|
|
1143
|
+
}), R = zt(), N = k(null), M = k([]), be = k(), he = k(!1), ue = k(null);
|
|
1144
|
+
let ne = null;
|
|
1145
|
+
function ve() {
|
|
1146
|
+
ne && (ne.abort(), ne = null, c.value = !1, he.value = !1, ue.value = null);
|
|
1147
|
+
}
|
|
1148
|
+
function De(r) {
|
|
1149
|
+
const u = w.locations.find((b) => b.dbName === r._locationDbName);
|
|
1150
|
+
if (!u) return null;
|
|
1151
|
+
if (u.type === "restaurant") {
|
|
1152
|
+
const b = w.locationRestaurantFromCore(u.doc._id);
|
|
1153
|
+
if (b !== null)
|
|
1154
|
+
return { ...u, doc: b };
|
|
1155
|
+
}
|
|
1156
|
+
return u;
|
|
1157
|
+
}
|
|
1158
|
+
function _e(r) {
|
|
1159
|
+
const u = w.locations.find((b) => b.dbName === r._locationDbName);
|
|
1160
|
+
u && (w._currentLocation = u);
|
|
1161
|
+
}
|
|
1162
|
+
async function Ae(r, u, b) {
|
|
1163
|
+
const T = f.value.map((A) => ({ dbName: A })), I = T.length;
|
|
1164
|
+
ue.value = { done: 0, total: I };
|
|
1165
|
+
let q = u.cursor, W = u.retryFailed, Q = !0;
|
|
1166
|
+
for (; Q && !b.aborted; ) {
|
|
1167
|
+
const A = await V.getBulkPaginatedPurchaseOrders(
|
|
1168
|
+
{
|
|
1169
|
+
locations: T,
|
|
1170
|
+
...H.value,
|
|
1171
|
+
pageSize: 100,
|
|
1172
|
+
cursor: q,
|
|
1173
|
+
retryFailed: W
|
|
1174
|
+
},
|
|
1175
|
+
b
|
|
1176
|
+
);
|
|
1177
|
+
if (b.aborted) return;
|
|
1178
|
+
W = void 0, ue.value = {
|
|
1179
|
+
done: Math.max(0, I - A.pendingLocations),
|
|
1180
|
+
total: I
|
|
1181
|
+
}, r.push(
|
|
1182
|
+
...A.data.map(
|
|
1183
|
+
({ locationDbName: Z, ...U }) => ({ ...U, _locationDbName: Z })
|
|
1184
|
+
)
|
|
1185
|
+
), d.value = [...r].sort((Z, U) => U._id.localeCompare(Z._id)), M.value = A.failed, be.value = A.cursor, Q = A.hasNext, q = A.cursor;
|
|
1186
|
+
}
|
|
1187
|
+
}
|
|
1188
|
+
async function Ee() {
|
|
1189
|
+
const r = d.value.flatMap((u) => u.shipmentIds || []).filter(Boolean);
|
|
1190
|
+
i.value = r.length > 0 ? await de.getShipmentsByIds(r) : [];
|
|
1191
|
+
}
|
|
1192
|
+
async function me(r) {
|
|
1193
|
+
const u = r.map((b) => {
|
|
1194
|
+
var T;
|
|
1195
|
+
return ((T = b.request) == null ? void 0 : T.id) ?? "";
|
|
1196
|
+
}).filter((b) => b);
|
|
1197
|
+
C.value = u.length > 0 ? await V.readRequestByIds(u) : [];
|
|
1198
|
+
}
|
|
1199
|
+
const ge = 25;
|
|
1200
|
+
async function $e() {
|
|
1201
|
+
if (d.value = [], i.value = [], M.value = [], be.value = void 0, f.value.length === 0)
|
|
1202
|
+
return;
|
|
1203
|
+
if (f.value.length > ge) {
|
|
1204
|
+
l.open({
|
|
1205
|
+
title: "Too many locations selected",
|
|
1206
|
+
message: `Select at most ${ge} locations`,
|
|
1207
|
+
type: "warning"
|
|
1208
|
+
});
|
|
1209
|
+
return;
|
|
1210
|
+
}
|
|
1211
|
+
ve();
|
|
1212
|
+
const r = new AbortController();
|
|
1213
|
+
ne = r, c.value = !0;
|
|
1214
|
+
try {
|
|
1215
|
+
await Ae([], {}, r.signal), M.value.length > 0 && l.open({
|
|
1216
|
+
title: "Some locations failed to load",
|
|
1217
|
+
message: `Purchase orders could not be loaded for ${M.value.length} location(s)`,
|
|
1218
|
+
type: "error"
|
|
1219
|
+
}), await Ee();
|
|
1220
|
+
const b = await R.readCurrentLocationLastClosing(!0), T = b == null ? void 0 : b._id;
|
|
1221
|
+
T && (N.value = Sn(T)), await O.awaitFeatureLoaded(() => O.mustUsePoTemplate) && await $.fetchTemplates();
|
|
1222
|
+
} catch (u) {
|
|
1223
|
+
if (r.signal.aborted) return;
|
|
1224
|
+
l.open({
|
|
1225
|
+
title: "Something went wrong",
|
|
1226
|
+
// the API client surfaces the server's message (e.g. the location cap)
|
|
1227
|
+
message: (u == null ? void 0 : u.message) || "Error at fetching purchase orders",
|
|
1228
|
+
type: "error"
|
|
1229
|
+
});
|
|
1230
|
+
} finally {
|
|
1231
|
+
ne === r && (ne = null, c.value = !1, ue.value = null);
|
|
1232
|
+
}
|
|
1233
|
+
}
|
|
1234
|
+
async function Fe() {
|
|
1235
|
+
if (!be.value || !M.value.some((u) => u.retryable)) return;
|
|
1236
|
+
ve();
|
|
1237
|
+
const r = new AbortController();
|
|
1238
|
+
ne = r, he.value = !0;
|
|
1239
|
+
try {
|
|
1240
|
+
const u = [...d.value];
|
|
1241
|
+
if (await Ae(u, { cursor: be.value, retryFailed: !0 }, r.signal), r.signal.aborted) return;
|
|
1242
|
+
await Ee();
|
|
1243
|
+
} catch (u) {
|
|
1244
|
+
if (r.signal.aborted) return;
|
|
1245
|
+
l.open({
|
|
1246
|
+
title: "Something went wrong",
|
|
1247
|
+
message: (u == null ? void 0 : u.message) || "Error at retrying failed locations",
|
|
1248
|
+
type: "error"
|
|
1249
|
+
});
|
|
1250
|
+
} finally {
|
|
1251
|
+
ne === r && (ne = null, he.value = !1, ue.value = null);
|
|
1252
|
+
}
|
|
1253
|
+
}
|
|
1254
|
+
function Ge(r, u) {
|
|
1255
|
+
o.value = { startDate: r, endDate: u }, $e();
|
|
1256
|
+
}
|
|
1257
|
+
const qe = k();
|
|
1258
|
+
async function Oe(r) {
|
|
1259
|
+
const u = f.value[0];
|
|
1260
|
+
if (u) {
|
|
1261
|
+
const I = w.locations.find((q) => q.dbName === u);
|
|
1262
|
+
I && (w._currentLocation = I);
|
|
1263
|
+
}
|
|
1264
|
+
function b(I) {
|
|
1265
|
+
const q = {
|
|
1266
|
+
mode: _t.CREATE,
|
|
1267
|
+
modelValue: r || void 0,
|
|
1268
|
+
show: !0,
|
|
1269
|
+
"onUpdate:show"(W) {
|
|
1270
|
+
et.value.show = W;
|
|
1271
|
+
},
|
|
1272
|
+
templateId: I,
|
|
1273
|
+
lastClosingDate: N.value
|
|
1274
|
+
};
|
|
1275
|
+
et.value = q;
|
|
1276
|
+
}
|
|
1277
|
+
let T;
|
|
1278
|
+
O.mustUsePoTemplate && !(r != null && r.template) ? h.open({
|
|
1279
|
+
title: "Create transfer",
|
|
1280
|
+
message: "",
|
|
1281
|
+
primaryActions: { text: "Select a template", close: !0 },
|
|
1282
|
+
secondaryActions: { text: "Outlet to Outlet", variant: "secondary", close: !0 }
|
|
1283
|
+
}).onPrimary(async () => {
|
|
1284
|
+
T = await Y.getTemplateId(), T && b(T);
|
|
1285
|
+
}).onSecondary(() => {
|
|
1286
|
+
b(void 0);
|
|
1287
|
+
}) : b(T);
|
|
1288
|
+
}
|
|
1289
|
+
const Se = Pn();
|
|
1290
|
+
async function P(r, u) {
|
|
1291
|
+
return r.items != null ? r : await V.getPurchaseOrderById(r._id, void 0, u);
|
|
1292
|
+
}
|
|
1293
|
+
async function F(r) {
|
|
1294
|
+
await Se.run(async (u) => {
|
|
1295
|
+
_e(r);
|
|
1296
|
+
const b = await P(r, u), T = {
|
|
1297
|
+
mode: _t.UPDATE,
|
|
1298
|
+
modelValue: Vt(b),
|
|
1299
|
+
show: !0,
|
|
1300
|
+
"onUpdate:show"(I) {
|
|
1301
|
+
et.value.show = I;
|
|
1302
|
+
},
|
|
1303
|
+
lastClosingDate: N.value
|
|
1304
|
+
};
|
|
1305
|
+
et.value = T;
|
|
1306
|
+
});
|
|
1307
|
+
}
|
|
1308
|
+
async function B(r) {
|
|
1309
|
+
var Q, A, Z;
|
|
1310
|
+
if (_e(r), !z.currentBusiness.value) return;
|
|
1311
|
+
const u = r, b = S.supplierById[r.supplier._id], T = (b == null ? void 0 : b.email) ?? ((Q = r.supplier) == null ? void 0 : Q.email) ?? "";
|
|
1312
|
+
let I = null;
|
|
1313
|
+
pe.value = {
|
|
1314
|
+
recipientName: b == null ? void 0 : b.name,
|
|
1315
|
+
email: T,
|
|
1316
|
+
business: z.currentBusiness.value,
|
|
1317
|
+
pdfLoading: !0,
|
|
1318
|
+
show: !0,
|
|
1319
|
+
"onUpdate:show"(U) {
|
|
1320
|
+
!U && I && (URL.revokeObjectURL(I), I = null), pe.value && (pe.value = { ...pe.value, show: U });
|
|
1321
|
+
}
|
|
1322
|
+
};
|
|
1323
|
+
const q = await Se.run((U) => P(u, U));
|
|
1324
|
+
if (!q) {
|
|
1325
|
+
pe.value && (pe.value = { ...pe.value, show: !1, pdfLoading: !1 });
|
|
1326
|
+
return;
|
|
1327
|
+
}
|
|
1328
|
+
const W = q._rev;
|
|
1329
|
+
try {
|
|
1330
|
+
let U = await V.getPurchaseOrderPdf(r._id, u._locationDbName, W);
|
|
1331
|
+
"pending" in U && (await v.waitForPdfJob(U.jobId, u._locationDbName), U = await V.getPurchaseOrderPdf(r._id, u._locationDbName, W));
|
|
1332
|
+
const re = URL.createObjectURL(U);
|
|
1333
|
+
(A = pe.value) != null && A.show ? (I = re, pe.value = {
|
|
1334
|
+
...pe.value,
|
|
1335
|
+
pdfBlobUrl: re,
|
|
1336
|
+
pdfLoading: !1
|
|
1337
|
+
}) : URL.revokeObjectURL(re);
|
|
1338
|
+
} catch (U) {
|
|
1339
|
+
console.error("[promptEmailDialog] PDF fetch failed:", U), (Z = pe.value) != null && Z.show && (pe.value = { ...pe.value, pdfLoading: !1 }, l.open({
|
|
1340
|
+
title: g("inventory.common.somethingWentWrong"),
|
|
1341
|
+
message: (U == null ? void 0 : U.message) || g("inventory.common.tryAgain"),
|
|
1342
|
+
type: "error"
|
|
1343
|
+
}));
|
|
1344
|
+
}
|
|
1345
|
+
}
|
|
1346
|
+
async function K(r) {
|
|
1347
|
+
if (_e(r), r.items != null)
|
|
1348
|
+
return r;
|
|
1349
|
+
try {
|
|
1350
|
+
return { ...await V.getPurchaseOrderById(r._id), _locationDbName: r._locationDbName };
|
|
1351
|
+
} catch (u) {
|
|
1352
|
+
throw console.error(`Failed to hydrate PO ${r._id} for action`, u), u;
|
|
1353
|
+
}
|
|
1354
|
+
}
|
|
1355
|
+
async function G(r, u) {
|
|
1356
|
+
var W;
|
|
1357
|
+
_e(r);
|
|
1358
|
+
const b = await Se.run((Q) => P(r, Q));
|
|
1359
|
+
if (!b) return;
|
|
1360
|
+
if (u === void 0 && ((W = r.request) != null && W.id))
|
|
1361
|
+
try {
|
|
1362
|
+
u = await V.getLatestPurchaseOrderRequest(r._id);
|
|
1363
|
+
} catch (Q) {
|
|
1364
|
+
console.warn("[transfer-details] POR fetch failed for", r._id, Q);
|
|
1365
|
+
}
|
|
1366
|
+
const I = De(r), q = {
|
|
1367
|
+
poRequest: u,
|
|
1368
|
+
purchaseOrder: b,
|
|
1369
|
+
transferTo: I == null ? void 0 : I.name,
|
|
1370
|
+
transferToDbName: I == null ? void 0 : I.dbName,
|
|
1371
|
+
show: !0,
|
|
1372
|
+
canResubmit: !1,
|
|
1373
|
+
canApprove: !1,
|
|
1374
|
+
"onUpdate:show"(Q) {
|
|
1375
|
+
qe.value && (qe.value = { ...qe.value, show: Q });
|
|
1376
|
+
},
|
|
1377
|
+
scope: kt.RECEIVE_REQUEST,
|
|
1378
|
+
receivedMap: Gt(b) ?? {},
|
|
1379
|
+
shipments: i.value
|
|
1380
|
+
};
|
|
1381
|
+
qe.value = q;
|
|
1382
|
+
}
|
|
1383
|
+
async function ee(r, u, b, T, I) {
|
|
1384
|
+
const q = Xt();
|
|
1385
|
+
c.value = !0;
|
|
1386
|
+
try {
|
|
1387
|
+
await q({
|
|
1388
|
+
operate: {
|
|
1389
|
+
operation: u,
|
|
1390
|
+
doc: r,
|
|
1391
|
+
options: (u === Ye.enum.confirmDraft || u === Ye.enum.completeReceive) && O.autoReceiveWarehouse ? { autoReceive: !0 } : void 0
|
|
1392
|
+
},
|
|
1393
|
+
operateV2: {
|
|
1394
|
+
_id: r._id,
|
|
1395
|
+
_rev: r._rev ?? "",
|
|
1396
|
+
action: u === Ye.enum.submitRequest ? Ye.enum.confirmDraft : u,
|
|
1397
|
+
payloads: I ?? []
|
|
1398
|
+
},
|
|
1399
|
+
transferTo: T
|
|
1400
|
+
}), await new Promise((W) => setTimeout(W, 1e3)), l.open({ title: "Success", message: b, type: "success" });
|
|
1401
|
+
} catch (W) {
|
|
1402
|
+
l.open({
|
|
1403
|
+
title: "Something went wrong",
|
|
1404
|
+
message: "Please try again.",
|
|
1405
|
+
type: "error"
|
|
1406
|
+
}), console.error("Error when submitting PO operation", u, r, W);
|
|
1407
|
+
} finally {
|
|
1408
|
+
c.value = !1, $e();
|
|
1409
|
+
}
|
|
1410
|
+
}
|
|
1411
|
+
async function Re(r, u, b) {
|
|
1412
|
+
_e(r);
|
|
1413
|
+
const T = Ht[u];
|
|
1414
|
+
if (!T) {
|
|
1415
|
+
l.open({
|
|
1416
|
+
title: "Something went wrong",
|
|
1417
|
+
message: `Cannot process order: ${Mt(u)}`,
|
|
1418
|
+
type: "error"
|
|
1419
|
+
});
|
|
1420
|
+
return;
|
|
1421
|
+
}
|
|
1422
|
+
const { successMessage: I, ...q } = T;
|
|
1423
|
+
if (u === Ye.enum.rejectDraft) {
|
|
1424
|
+
let A = "";
|
|
1425
|
+
h.open({
|
|
1426
|
+
title: q.title,
|
|
1427
|
+
message: q.message,
|
|
1428
|
+
primaryActions: q.primaryActions,
|
|
1429
|
+
contentComponent: Qt,
|
|
1430
|
+
contentComponentProps: {
|
|
1431
|
+
message: q.message,
|
|
1432
|
+
onChange: (Z) => A = Z
|
|
1433
|
+
}
|
|
1434
|
+
}).onPrimary(() => {
|
|
1435
|
+
ee(r, u, I, b, [
|
|
1436
|
+
{ action: "rejectDraft", payload: { rejectReason: A } }
|
|
1437
|
+
]);
|
|
1438
|
+
});
|
|
1439
|
+
return;
|
|
1440
|
+
}
|
|
1441
|
+
const W = [], Q = Kt();
|
|
1442
|
+
Q.init(r), (u === Ye.enum.confirmDraft || u === Ye.enum.submitRequest) && W.push({
|
|
1443
|
+
action: "confirmDraft",
|
|
1444
|
+
payload: Q.controller.value.toConfirmDraftData(Ut())
|
|
1445
|
+
}), h.open({
|
|
1446
|
+
title: q.title,
|
|
1447
|
+
message: q.message,
|
|
1448
|
+
primaryActions: q.primaryActions
|
|
1449
|
+
}).onPrimary(() => {
|
|
1450
|
+
ee(
|
|
1451
|
+
r,
|
|
1452
|
+
u,
|
|
1453
|
+
I,
|
|
1454
|
+
b,
|
|
1455
|
+
W
|
|
1456
|
+
);
|
|
1457
|
+
});
|
|
1458
|
+
}
|
|
1459
|
+
async function we() {
|
|
1460
|
+
h.open({
|
|
1461
|
+
title: "Upload Transfer",
|
|
1462
|
+
primaryActions: { text: "Xilnex transfer note", close: !0 },
|
|
1463
|
+
secondaryActions: { text: "Cancel", close: !0 }
|
|
1464
|
+
}).onPrimary(() => {
|
|
1465
|
+
const r = {
|
|
1466
|
+
show: !0,
|
|
1467
|
+
"onUpdate:show"(u) {
|
|
1468
|
+
dt.value.show = u;
|
|
1469
|
+
}
|
|
1470
|
+
};
|
|
1471
|
+
dt.value = r;
|
|
1472
|
+
});
|
|
1473
|
+
}
|
|
1474
|
+
async function j() {
|
|
1475
|
+
const { start: r, end: u } = H.value;
|
|
1476
|
+
return (await Promise.allSettled(
|
|
1477
|
+
f.value.map(async (T) => (await V.getPurchaseOrders({ start: r, end: u, dbName: T })).map((q) => ({ ...q, _locationDbName: T })))
|
|
1478
|
+
)).flatMap((T) => T.status === "fulfilled" ? T.value : []);
|
|
1479
|
+
}
|
|
1480
|
+
async function ae(r) {
|
|
1481
|
+
return v.activeJobs.find((b) => b.type === r) ? new Promise((b) => {
|
|
1482
|
+
h.open({
|
|
1483
|
+
title: g("inventory.transfer.receiveRequest.bulk.activeJobWarningTitle"),
|
|
1484
|
+
message: g("inventory.transfer.receiveRequest.bulk.activeJobWarningMsg", [r]),
|
|
1485
|
+
primaryActions: { text: g("inventory.transfer.receiveRequest.bulk.activeJobWarningConfirm"), close: !0 },
|
|
1486
|
+
secondaryActions: { text: g("inventory.common.cancel"), close: !0 }
|
|
1487
|
+
}).onPrimary(() => b(!0)).onSecondary(() => b(!1));
|
|
1488
|
+
}) : !0;
|
|
1489
|
+
}
|
|
1490
|
+
async function Be(r) {
|
|
1491
|
+
if (!await ae("download")) return;
|
|
1492
|
+
const { startDate: u, endDate: b } = o.value;
|
|
1493
|
+
if (He(b).diff(He(u), "month", !0) > 2) {
|
|
1494
|
+
l.open({
|
|
1495
|
+
title: g("inventory.transfer.receiveRequest.bulk.downloadError"),
|
|
1496
|
+
message: g("inventory.transfer.receiveRequest.bulk.downloadLimitExceeded"),
|
|
1497
|
+
type: "error"
|
|
1498
|
+
});
|
|
1499
|
+
return;
|
|
1500
|
+
}
|
|
1501
|
+
if (r.length === 0) {
|
|
1502
|
+
l.open({
|
|
1503
|
+
title: g("inventory.transfer.receiveRequest.bulk.downloadError"),
|
|
1504
|
+
message: g("inventory.transfer.receiveRequest.bulk.noOrdersToDownload"),
|
|
1505
|
+
type: "warning"
|
|
1506
|
+
});
|
|
1507
|
+
return;
|
|
1508
|
+
}
|
|
1509
|
+
const T = r.map((q) => {
|
|
1510
|
+
var U;
|
|
1511
|
+
const Q = (((U = w.locations.find((re) => re.dbName === q._locationDbName)) == null ? void 0 : U.name) || q._locationDbName).replace(/[/\\?%*:|"<>]/g, "-").trim().slice(0, 50), A = `PO_${q.seqNumber || q._id}`.replace(/[/\\?%*:|"<>]/g, "-").slice(0, 50), Z = `${Q}/${A}`;
|
|
1512
|
+
return { poId: q._id, dbName: q._locationDbName, filename: Z, rev: q._rev };
|
|
1513
|
+
}), I = f.value[0];
|
|
1514
|
+
try {
|
|
1515
|
+
const { jobId: q, fromCache: W } = await V.enqueueBulkDownload(I, { items: T });
|
|
1516
|
+
v.addJob({
|
|
1517
|
+
jobId: q,
|
|
1518
|
+
type: "download",
|
|
1519
|
+
dbName: I,
|
|
1520
|
+
title: `Download All (${r.length} POs)`,
|
|
1521
|
+
status: "waiting",
|
|
1522
|
+
progress: 0,
|
|
1523
|
+
current: 0,
|
|
1524
|
+
total: r.length,
|
|
1525
|
+
errorCount: 0,
|
|
1526
|
+
startedAt: Date.now()
|
|
1527
|
+
}), W ? l.open({
|
|
1528
|
+
title: g("inventory.transfer.receiveRequest.bulk.downloadCachedTitle"),
|
|
1529
|
+
message: g("inventory.transfer.receiveRequest.bulk.downloadCachedMsg"),
|
|
1530
|
+
type: "info"
|
|
1531
|
+
}) : l.open({
|
|
1532
|
+
title: g("inventory.transfer.receiveRequest.bulk.downloadSuccess"),
|
|
1533
|
+
message: g("inventory.transfer.receiveRequest.bulk.downloadQueued"),
|
|
1534
|
+
type: "success"
|
|
1535
|
+
});
|
|
1536
|
+
} catch (q) {
|
|
1537
|
+
console.error("Bulk download enqueue failed", q), l.open({
|
|
1538
|
+
title: g("inventory.transfer.receiveRequest.bulk.downloadError"),
|
|
1539
|
+
message: g("inventory.transfer.receiveRequest.bulk.downloadErrorMsg"),
|
|
1540
|
+
type: "error"
|
|
1541
|
+
});
|
|
1542
|
+
}
|
|
1543
|
+
}
|
|
1544
|
+
async function Te(r) {
|
|
1545
|
+
var Me, je, We;
|
|
1546
|
+
if (!await ae("email")) return;
|
|
1547
|
+
const u = [
|
|
1548
|
+
gt.enum.RECEIVING,
|
|
1549
|
+
gt.enum.PROCESSING
|
|
1550
|
+
// PARTIAL_RECEIVED display status maps from PROCESSING
|
|
1551
|
+
], b = r.filter((x) => u.includes(x.status));
|
|
1552
|
+
if (b.length === 0) {
|
|
1553
|
+
l.open({
|
|
1554
|
+
title: g("inventory.transfer.receiveRequest.bulk.emailSendError"),
|
|
1555
|
+
message: g("inventory.transfer.receiveRequest.bulk.noOrdersToEmail"),
|
|
1556
|
+
type: "warning"
|
|
1557
|
+
});
|
|
1558
|
+
return;
|
|
1559
|
+
}
|
|
1560
|
+
if (!((Me = z.currentBusiness.value) != null && Me._id)) return;
|
|
1561
|
+
await me(b);
|
|
1562
|
+
const T = mn(), I = yn(), q = /* @__PURE__ */ new Map(), W = w.locations.map((x) => x.dbName), Q = `business_${z.currentBusiness.value._id}`, A = [.../* @__PURE__ */ new Set([...W, Q])];
|
|
1563
|
+
await Promise.allSettled(
|
|
1564
|
+
A.map(async (x) => {
|
|
1565
|
+
try {
|
|
1566
|
+
(await I.readSuppliersByDbName(x)).forEach((ie) => {
|
|
1567
|
+
const ce = q.get(ie._id);
|
|
1568
|
+
(!ce || !ce.email && ie.email) && q.set(ie._id, ie);
|
|
1569
|
+
});
|
|
1570
|
+
} catch (oe) {
|
|
1571
|
+
console.warn("[emailAll] fetch failed for", x, oe);
|
|
1572
|
+
}
|
|
1573
|
+
})
|
|
1574
|
+
);
|
|
1575
|
+
function Z(x) {
|
|
1576
|
+
var ie;
|
|
1577
|
+
const oe = q.get(x.supplier._id);
|
|
1578
|
+
return (oe == null ? void 0 : oe.email) || ((ie = x.supplier) == null ? void 0 : ie.email);
|
|
1579
|
+
}
|
|
1580
|
+
const U = [], re = [];
|
|
1581
|
+
for (const x of b)
|
|
1582
|
+
Z(x) ? U.push(x) : re.push(x);
|
|
1583
|
+
const Je = xe(
|
|
1584
|
+
"p",
|
|
1585
|
+
{ class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" },
|
|
1586
|
+
g("inventory.transfer.receiveRequest.bulk.emailAllowedStatusInfo")
|
|
1587
|
+
);
|
|
1588
|
+
if (re.length > 0) {
|
|
1589
|
+
const x = /* @__PURE__ */ new Map();
|
|
1590
|
+
for (const ce of re) {
|
|
1591
|
+
const n = ce.supplier._id;
|
|
1592
|
+
x.has(n) || x.set(n, { supplierName: ce.supplier.name, pos: [] }), x.get(n).pos.push(ce);
|
|
1593
|
+
}
|
|
1594
|
+
const oe = xe("div", { class: "flex flex-col gap-12" }, [
|
|
1595
|
+
Je,
|
|
1596
|
+
xe(
|
|
1597
|
+
"p",
|
|
1598
|
+
{ class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" },
|
|
1599
|
+
g("inventory.transfer.receiveRequest.bulk.missingEmailMsg", [re.length])
|
|
1600
|
+
),
|
|
1601
|
+
xe(
|
|
1602
|
+
"div",
|
|
1603
|
+
{ class: "flex flex-col gap-4 max-h-[320px] overflow-y-auto rounded-md border border-fm-color-neutral-gray-100 p-8" },
|
|
1604
|
+
[...x.values()].map(
|
|
1605
|
+
({ supplierName: ce, pos: n }) => xe("div", { class: "flex flex-col gap-2 py-6 border-b border-fm-color-neutral-gray-100 last:border-0" }, [
|
|
1606
|
+
xe("div", { class: "fm-typo-en-body-md-600 text-fm-color-typo-primary" }, ce),
|
|
1607
|
+
xe(
|
|
1608
|
+
"div",
|
|
1609
|
+
{ class: "flex flex-wrap gap-4" },
|
|
1610
|
+
n.map(
|
|
1611
|
+
(a) => xe("span", {
|
|
1612
|
+
class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary bg-fm-color-neutral-gray-100 rounded px-6 py-2"
|
|
1613
|
+
}, `PO #${a.seqNumber ?? a._id}`)
|
|
1614
|
+
)
|
|
1615
|
+
)
|
|
1616
|
+
])
|
|
1617
|
+
)
|
|
1618
|
+
),
|
|
1619
|
+
xe(
|
|
1620
|
+
"p",
|
|
1621
|
+
{ class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" },
|
|
1622
|
+
g("inventory.transfer.receiveRequest.bulk.emailWillSendCount", [U.length, b.length])
|
|
1623
|
+
),
|
|
1624
|
+
xe(
|
|
1625
|
+
"p",
|
|
1626
|
+
{ class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" },
|
|
1627
|
+
g("inventory.transfer.receiveRequest.bulk.missingEmailConfirm")
|
|
1628
|
+
)
|
|
1629
|
+
]);
|
|
1630
|
+
if (!await new Promise((ce) => {
|
|
1631
|
+
h.open({
|
|
1632
|
+
title: g("inventory.transfer.receiveRequest.bulk.missingEmailTitle"),
|
|
1633
|
+
contentComponent: oe,
|
|
1634
|
+
contentComponentProps: {},
|
|
1635
|
+
primaryActions: {
|
|
1636
|
+
text: g("inventory.transfer.receiveRequest.bulk.skipAndContinue"),
|
|
1637
|
+
close: !0
|
|
1638
|
+
},
|
|
1639
|
+
secondaryActions: { text: g("inventory.common.cancel"), close: !0 }
|
|
1640
|
+
}).onPrimary(() => ce(!0)).onSecondary(() => ce(!1));
|
|
1641
|
+
})) return;
|
|
1642
|
+
} else {
|
|
1643
|
+
const x = xe("div", { class: "flex flex-col gap-12" }, [
|
|
1644
|
+
Je,
|
|
1645
|
+
xe(
|
|
1646
|
+
"p",
|
|
1647
|
+
{ class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" },
|
|
1648
|
+
g("inventory.transfer.receiveRequest.bulk.emailAllConfirmMsg", [U.length])
|
|
1649
|
+
)
|
|
1650
|
+
]);
|
|
1651
|
+
if (!await new Promise((ie) => {
|
|
1652
|
+
h.open({
|
|
1653
|
+
title: g("inventory.transfer.receiveRequest.bulk.missingEmailTitle"),
|
|
1654
|
+
contentComponent: x,
|
|
1655
|
+
contentComponentProps: {},
|
|
1656
|
+
primaryActions: {
|
|
1657
|
+
text: g("inventory.transfer.receiveRequest.bulk.emailConfirm"),
|
|
1658
|
+
close: !0
|
|
1659
|
+
},
|
|
1660
|
+
secondaryActions: { text: g("inventory.common.cancel"), close: !0 }
|
|
1661
|
+
}).onPrimary(() => ie(!0)).onSecondary(() => ie(!1));
|
|
1662
|
+
})) return;
|
|
1663
|
+
}
|
|
1664
|
+
if (U.length === 0) {
|
|
1665
|
+
l.open({
|
|
1666
|
+
title: g("inventory.transfer.receiveRequest.bulk.emailSendError"),
|
|
1667
|
+
message: g("inventory.transfer.receiveRequest.bulk.noEmailsToSend"),
|
|
1668
|
+
type: "warning"
|
|
1669
|
+
});
|
|
1670
|
+
return;
|
|
1671
|
+
}
|
|
1672
|
+
let Ie = [];
|
|
1673
|
+
try {
|
|
1674
|
+
Ie = await T.getEmailList(z.currentBusiness.value._id);
|
|
1675
|
+
} catch {
|
|
1676
|
+
l.open({
|
|
1677
|
+
title: g("inventory.transfer.receiveRequest.bulk.emailSendError"),
|
|
1678
|
+
message: g("inventory.transfer.receiveRequest.bulk.noEmailSender"),
|
|
1679
|
+
type: "error"
|
|
1680
|
+
});
|
|
1681
|
+
return;
|
|
1682
|
+
}
|
|
1683
|
+
const Le = Ie.find((x) => x.verified);
|
|
1684
|
+
if (!Le) {
|
|
1685
|
+
l.open({
|
|
1686
|
+
title: g("inventory.transfer.receiveRequest.bulk.emailSendError"),
|
|
1687
|
+
message: g("inventory.transfer.receiveRequest.bulk.noEmailSender"),
|
|
1688
|
+
type: "error"
|
|
1689
|
+
});
|
|
1690
|
+
return;
|
|
1691
|
+
}
|
|
1692
|
+
const Ne = /* @__PURE__ */ new Map();
|
|
1693
|
+
for (const x of U) {
|
|
1694
|
+
const oe = Z(x);
|
|
1695
|
+
if (!oe) continue;
|
|
1696
|
+
const ce = (((je = w.locations.find((X) => X.dbName === x._locationDbName)) == null ? void 0 : je.name) || x._locationDbName).replace(/[/\\?%*:|"<>]/g, "-").trim().slice(0, 50), n = `PO_${x.seqNumber || x._id}`.replace(/[/\\?%*:|"<>]/g, "-").slice(0, 50), a = { poId: x._id, dbName: x._locationDbName, filename: `${ce}/${n}` }, s = Ne.get(oe);
|
|
1697
|
+
s ? (s.pos.push(a), s.seqNumbers.push(x.seqNumber ?? x._id)) : Ne.set(oe, {
|
|
1698
|
+
recipientName: x.supplier.name,
|
|
1699
|
+
recipientEmail: oe,
|
|
1700
|
+
pos: [a],
|
|
1701
|
+
seqNumbers: [x.seqNumber ?? x._id]
|
|
1702
|
+
});
|
|
1703
|
+
}
|
|
1704
|
+
const ke = [...Ne.values()].map((x) => ({
|
|
1705
|
+
subject: x.pos.length > 1 ? `Purchase Orders (${x.pos.length})` : `Purchase Order #${x.seqNumbers[0]}`,
|
|
1706
|
+
recipientName: x.recipientName,
|
|
1707
|
+
recipientEmail: x.recipientEmail,
|
|
1708
|
+
pos: x.pos
|
|
1709
|
+
})), ze = f.value[0];
|
|
1710
|
+
try {
|
|
1711
|
+
const { jobId: x } = await V.enqueueBulkEmail(ze, {
|
|
1712
|
+
senderEmail: Le.emailAddress,
|
|
1713
|
+
senderName: Le.name || ((We = z.currentBusiness.value) == null ? void 0 : We.name) || "FeedMe Inventory",
|
|
1714
|
+
items: ke
|
|
1715
|
+
});
|
|
1716
|
+
v.addJob({
|
|
1717
|
+
jobId: x,
|
|
1718
|
+
type: "email",
|
|
1719
|
+
dbName: ze,
|
|
1720
|
+
title: `Email All (${ke.length} supplier${ke.length === 1 ? "" : "s"}, ${U.length} POs)`,
|
|
1721
|
+
status: "waiting",
|
|
1722
|
+
progress: 0,
|
|
1723
|
+
current: 0,
|
|
1724
|
+
total: ke.length,
|
|
1725
|
+
errorCount: 0,
|
|
1726
|
+
startedAt: Date.now()
|
|
1727
|
+
}), l.open({
|
|
1728
|
+
title: g("inventory.transfer.receiveRequest.bulk.emailSuccess"),
|
|
1729
|
+
message: g("inventory.transfer.receiveRequest.bulk.emailQueued"),
|
|
1730
|
+
type: "success"
|
|
1731
|
+
});
|
|
1732
|
+
} catch (x) {
|
|
1733
|
+
console.error("Bulk email enqueue failed", x), l.open({
|
|
1734
|
+
title: g("inventory.transfer.receiveRequest.bulk.emailSendError"),
|
|
1735
|
+
message: g("inventory.transfer.receiveRequest.bulk.emailErrorMsg"),
|
|
1736
|
+
type: "error"
|
|
1737
|
+
});
|
|
1738
|
+
}
|
|
1739
|
+
}
|
|
1740
|
+
return {
|
|
1741
|
+
selectedLocationDbNames: f,
|
|
1742
|
+
purchaseOrders: d,
|
|
1743
|
+
shipments: i,
|
|
1744
|
+
purchaseRequests: C,
|
|
1745
|
+
rowAction: Se,
|
|
1746
|
+
updateDateRange: Ge,
|
|
1747
|
+
fetchData: $e,
|
|
1748
|
+
failedLocations: M,
|
|
1749
|
+
retryFailedLocations: Fe,
|
|
1750
|
+
retryingFailed: he,
|
|
1751
|
+
fetchProgress: ue,
|
|
1752
|
+
abortOngoingBrowse: ve,
|
|
1753
|
+
fetchFullPurchaseOrders: j,
|
|
1754
|
+
loading: c,
|
|
1755
|
+
transferDialogProps: et,
|
|
1756
|
+
promptCreateTransferDialog: Oe,
|
|
1757
|
+
promptUpdateTransferDialog: F,
|
|
1758
|
+
transferDetailsProps: qe,
|
|
1759
|
+
promptShowTransferDetails: G,
|
|
1760
|
+
resolvePO: K,
|
|
1761
|
+
submitAction: Re,
|
|
1762
|
+
xilnexImportDialogProps: dt,
|
|
1763
|
+
promptUploadTransferDialog: we,
|
|
1764
|
+
emailDialogProps: pe,
|
|
1765
|
+
promptEmailDialog: B,
|
|
1766
|
+
downloadAll: Be,
|
|
1767
|
+
emailAll: Te,
|
|
1768
|
+
lastClosingDate: N
|
|
1769
|
+
};
|
|
1770
|
+
}
|
|
1771
|
+
function Fs(_, h, w) {
|
|
1772
|
+
const O = _._locationDbName;
|
|
1773
|
+
if (!O) return null;
|
|
1774
|
+
const S = h.find((z) => z.dbName === O);
|
|
1775
|
+
if (!S) return null;
|
|
1776
|
+
if (S.type === "restaurant") {
|
|
1777
|
+
const z = w(S.doc._id);
|
|
1778
|
+
if (z !== null) return { ...S, doc: z };
|
|
1779
|
+
}
|
|
1780
|
+
return S;
|
|
1781
|
+
}
|
|
1782
|
+
function Ss(_, h) {
|
|
1783
|
+
return h.find((w) => w.purchaseOrderId === _._id);
|
|
1784
|
+
}
|
|
1785
|
+
function Rs(_, h) {
|
|
1786
|
+
const w = it(), { t: O } = nt(), S = Ke(), z = ut(), Y = pt(), $ = k(!1), c = k(!1), l = k(null);
|
|
1787
|
+
async function g(v, f) {
|
|
1788
|
+
if (v !== at.PrintPdf) return !1;
|
|
1789
|
+
const i = f._locationDbName, C = f._rev;
|
|
1790
|
+
l.value && (URL.revokeObjectURL(l.value), l.value = null), c.value = !0, $.value = !0;
|
|
1791
|
+
try {
|
|
1792
|
+
let o = await S.getPurchaseOrderPdf(f._id, i, C);
|
|
1793
|
+
"pending" in o && (await Y.waitForPdfJob(o.jobId, i), o = await S.getPurchaseOrderPdf(f._id, i, C)), l.value = URL.createObjectURL(o);
|
|
1794
|
+
} catch (o) {
|
|
1795
|
+
$.value = !1, z.open({
|
|
1796
|
+
title: O("inventory.common.somethingWentWrong"),
|
|
1797
|
+
message: (o == null ? void 0 : o.message) || O("inventory.common.tryAgain"),
|
|
1798
|
+
type: "error"
|
|
1799
|
+
});
|
|
1800
|
+
} finally {
|
|
1801
|
+
c.value = !1;
|
|
1802
|
+
}
|
|
1803
|
+
return !0;
|
|
1804
|
+
}
|
|
1805
|
+
const V = Zt(
|
|
1806
|
+
kt.RECEIVE_REQUEST,
|
|
1807
|
+
_,
|
|
1808
|
+
h,
|
|
1809
|
+
{
|
|
1810
|
+
// Bulk rows are summaries (no items) — print needs the full doc from the
|
|
1811
|
+
// row's own location db, independent of the global current location.
|
|
1812
|
+
// Runs behind the shared cancellable loading state; undefined (failed or
|
|
1813
|
+
// cancelled) becomes null, which aborts the print.
|
|
1814
|
+
fetchFullPo: async (v) => {
|
|
1815
|
+
const f = v._locationDbName;
|
|
1816
|
+
return await _.rowAction.run(
|
|
1817
|
+
(i) => S.getPurchaseOrderById(v._id, f, i)
|
|
1818
|
+
) ?? null;
|
|
1819
|
+
},
|
|
1820
|
+
resolveLocation: (v) => Fs(
|
|
1821
|
+
v,
|
|
1822
|
+
w.locations,
|
|
1823
|
+
w.locationRestaurantFromCore
|
|
1824
|
+
),
|
|
1825
|
+
resolvePurchaseRequest: (v) => Ss(v, _.purchaseRequests.value),
|
|
1826
|
+
// Exclude both legacy Print and Print (Beta) — the bulk listing uses
|
|
1827
|
+
// Lambda-generated PDF via PrintPdf instead.
|
|
1828
|
+
excludeRowActions: [at.Print, at.PrintCustom],
|
|
1829
|
+
// Inject the Lambda PDF print action into every row's context menu.
|
|
1830
|
+
appendRowActions: () => [Dn[at.PrintPdf]],
|
|
1831
|
+
// Handle the PrintPdf action before the default handler runs.
|
|
1832
|
+
onCustomAction: (v, f) => g(v, f)
|
|
1833
|
+
}
|
|
1834
|
+
);
|
|
1835
|
+
return {
|
|
1836
|
+
columnDefs: L(() => {
|
|
1837
|
+
const v = V.columnDefs.value, f = {
|
|
1838
|
+
id: "location",
|
|
1839
|
+
header: () => O("inventory.transfer.receiveRequest.bulk.locationColumn"),
|
|
1840
|
+
cell(i) {
|
|
1841
|
+
const C = i.row.original._locationDbName, o = w.locations.find((H) => H.dbName === C);
|
|
1842
|
+
return o ? `${o.name} (${o.doc.profile.code ?? "--"})` : C;
|
|
1843
|
+
},
|
|
1844
|
+
enableSorting: !1,
|
|
1845
|
+
size: 160
|
|
1846
|
+
}, d = [...v];
|
|
1847
|
+
return d.splice(1, 0, f), d;
|
|
1848
|
+
}),
|
|
1849
|
+
showPdfDialog: $,
|
|
1850
|
+
pdfPreviewLoading: c,
|
|
1851
|
+
pdfPreviewBlobUrl: l
|
|
1852
|
+
};
|
|
1853
|
+
}
|
|
1854
|
+
const Ps = {
|
|
1855
|
+
key: 0,
|
|
1856
|
+
class: "inline-flex items-center justify-center bg-white/25 text-white rounded-full min-w-[18px] h-[18px] px-[4px] text-[10px] font-semibold leading-none"
|
|
1857
|
+
}, Ds = {
|
|
1858
|
+
key: 1,
|
|
1859
|
+
class: "bg-white rounded-lg shadow-xl border border-fm-color-neutral-gray-100 w-[360px] max-h-[480px] flex flex-col overflow-hidden"
|
|
1860
|
+
}, Es = { class: "flex items-center justify-between px-16 py-12 border-b border-fm-color-neutral-gray-100" }, qs = { class: "fm-typo-en-title-sm-600" }, Ns = { class: "overflow-y-auto flex-1 divide-y divide-fm-color-neutral-gray-100" }, As = { class: "flex items-start justify-between gap-8" }, $s = { class: "flex flex-col gap-2" }, Os = { class: "fm-typo-en-body-sm-600 text-fm-color-typo-primary line-clamp-1" }, Bs = { class: "fm-typo-en-body-xs-400 text-fm-color-typo-secondary capitalize" }, Ts = { class: "flex items-center gap-4" }, Is = ["disabled", "onClick"], Ls = ["disabled", "onClick"], zs = ["onClick"], Ms = {
|
|
1861
|
+
key: 0,
|
|
1862
|
+
class: "flex flex-col gap-4"
|
|
1863
|
+
}, Us = { class: "w-full bg-fm-color-neutral-gray-200 rounded-full h-[3px]" }, Vs = { class: "flex justify-between fm-typo-en-body-xs-400 text-fm-color-typo-secondary" }, Js = {
|
|
1864
|
+
key: 0,
|
|
1865
|
+
class: "truncate max-w-[200px]"
|
|
1866
|
+
}, js = { class: "ml-auto" }, Ws = {
|
|
1867
|
+
key: 1,
|
|
1868
|
+
class: "flex items-center gap-4 fm-typo-en-body-xs-400 text-fm-color-typo-success"
|
|
1869
|
+
}, Ys = {
|
|
1870
|
+
key: 2,
|
|
1871
|
+
class: "flex items-center gap-4 fm-typo-en-body-xs-400 text-fm-color-typo-warning"
|
|
1872
|
+
}, Hs = {
|
|
1873
|
+
key: 3,
|
|
1874
|
+
class: "flex items-center gap-4 fm-typo-en-body-xs-400 text-fm-color-typo-secondary"
|
|
1875
|
+
}, Qs = {
|
|
1876
|
+
key: 4,
|
|
1877
|
+
class: "flex items-center gap-4 fm-typo-en-body-xs-400 text-fm-color-typo-error"
|
|
1878
|
+
}, Ks = { key: 0 }, Gs = { key: 1 }, Xs = {
|
|
1879
|
+
key: 5,
|
|
1880
|
+
class: "flex items-center gap-[5px] text-[11px] leading-none text-fm-color-typo-secondary"
|
|
1881
|
+
}, Zs = /* @__PURE__ */ tt({
|
|
1882
|
+
__name: "BulkJobProgressPanel",
|
|
1883
|
+
setup(_) {
|
|
1884
|
+
const { t: h } = En(), w = pt(), O = Ke(), S = k(!1), z = k(null);
|
|
1885
|
+
function Y(d) {
|
|
1886
|
+
S.value && z.value && !z.value.contains(d.target) && (S.value = !1);
|
|
1887
|
+
}
|
|
1888
|
+
At(() => {
|
|
1889
|
+
document.addEventListener("click", Y, !0);
|
|
1890
|
+
}), $t(() => {
|
|
1891
|
+
document.removeEventListener("click", Y, !0);
|
|
1892
|
+
});
|
|
1893
|
+
const $ = k(/* @__PURE__ */ new Set()), c = k(/* @__PURE__ */ new Set());
|
|
1894
|
+
async function l(d) {
|
|
1895
|
+
if (!$.value.has(d.jobId)) {
|
|
1896
|
+
$.value = /* @__PURE__ */ new Set([...$.value, d.jobId]);
|
|
1897
|
+
try {
|
|
1898
|
+
const i = await O.downloadBulkJob(d.dbName, d.jobId), C = URL.createObjectURL(i), o = document.createElement("a");
|
|
1899
|
+
o.href = C, o.download = "purchase-orders.zip", document.body.appendChild(o), o.click(), document.body.removeChild(o), setTimeout(() => URL.revokeObjectURL(C), 1e3);
|
|
1900
|
+
} finally {
|
|
1901
|
+
const i = new Set($.value);
|
|
1902
|
+
i.delete(d.jobId), $.value = i;
|
|
1903
|
+
}
|
|
1904
|
+
}
|
|
1905
|
+
}
|
|
1906
|
+
async function g(d) {
|
|
1907
|
+
if (!c.value.has(d.jobId)) {
|
|
1908
|
+
c.value = /* @__PURE__ */ new Set([...c.value, d.jobId]);
|
|
1909
|
+
try {
|
|
1910
|
+
await w.cancelJob(d.jobId);
|
|
1911
|
+
} finally {
|
|
1912
|
+
const i = new Set(c.value);
|
|
1913
|
+
i.delete(d.jobId), c.value = i;
|
|
1914
|
+
}
|
|
1915
|
+
}
|
|
1916
|
+
}
|
|
1917
|
+
function V(d) {
|
|
1918
|
+
w.removeJob(d);
|
|
1919
|
+
}
|
|
1920
|
+
function de(d) {
|
|
1921
|
+
return d === "completed" || d === "failed" || d === "cancelled";
|
|
1922
|
+
}
|
|
1923
|
+
function v(d) {
|
|
1924
|
+
const i = Math.round(d / 1e3), C = Math.floor(i / 60), o = i % 60;
|
|
1925
|
+
return C > 0 ? `${C}m ${o}s` : `${o}s`;
|
|
1926
|
+
}
|
|
1927
|
+
function f(d) {
|
|
1928
|
+
return d < 1024 ? `${d} B` : d < 1024 * 1024 ? `${(d / 1024).toFixed(1)} KB` : `${(d / (1024 * 1024)).toFixed(1)} MB`;
|
|
1929
|
+
}
|
|
1930
|
+
return (d, i) => {
|
|
1931
|
+
const C = Ce("FmIcon");
|
|
1932
|
+
return m(), le(lt, { to: "body" }, [
|
|
1933
|
+
t(w).jobs.length > 0 ? (m(), y("div", {
|
|
1934
|
+
key: 0,
|
|
1935
|
+
ref_key: "panelRef",
|
|
1936
|
+
ref: z,
|
|
1937
|
+
class: "fixed bottom-24 right-24 z-[9998] flex flex-col items-end gap-8"
|
|
1938
|
+
}, [
|
|
1939
|
+
S.value ? D("", !0) : (m(), y("button", {
|
|
1940
|
+
key: 0,
|
|
1941
|
+
class: "flex items-center gap-8 bg-fm-color-primary text-white rounded-full px-16 py-[6px] shadow-lg fm-typo-en-body-sm-600 cursor-pointer",
|
|
1942
|
+
onClick: i[0] || (i[0] = (o) => S.value = !0)
|
|
1943
|
+
}, [
|
|
1944
|
+
E(C, {
|
|
1945
|
+
name: "cloud_upload",
|
|
1946
|
+
size: "sm"
|
|
1947
|
+
}),
|
|
1948
|
+
e("span", null, p(t(h)("inventory.transfer.receiveRequest.bulk.backgroundJobsTitle")), 1),
|
|
1949
|
+
t(w).activeJobs.length > 0 ? (m(), y("span", Ps, p(t(w).activeJobs.length), 1)) : D("", !0)
|
|
1950
|
+
])),
|
|
1951
|
+
S.value ? (m(), y("div", Ds, [
|
|
1952
|
+
e("div", Es, [
|
|
1953
|
+
e("span", qs, p(t(h)("inventory.transfer.receiveRequest.bulk.backgroundJobsTitle")), 1),
|
|
1954
|
+
e("button", {
|
|
1955
|
+
"aria-label": "Collapse",
|
|
1956
|
+
onClick: i[1] || (i[1] = (o) => S.value = !1),
|
|
1957
|
+
class: "text-fm-color-typo-secondary hover:text-fm-color-typo-primary"
|
|
1958
|
+
}, [
|
|
1959
|
+
E(C, {
|
|
1960
|
+
name: "close",
|
|
1961
|
+
size: "sm"
|
|
1962
|
+
})
|
|
1963
|
+
])
|
|
1964
|
+
]),
|
|
1965
|
+
e("div", Ns, [
|
|
1966
|
+
(m(!0), y(ye, null, Qe(t(w).jobs, (o) => {
|
|
1967
|
+
var H;
|
|
1968
|
+
return m(), y("div", {
|
|
1969
|
+
key: o.jobId,
|
|
1970
|
+
class: "px-16 py-12 flex flex-col gap-8"
|
|
1971
|
+
}, [
|
|
1972
|
+
e("div", As, [
|
|
1973
|
+
e("div", $s, [
|
|
1974
|
+
e("span", Os, p(o.title), 1),
|
|
1975
|
+
e("span", Bs, p(o.status), 1)
|
|
1976
|
+
]),
|
|
1977
|
+
e("div", Ts, [
|
|
1978
|
+
o.downloadReady ? (m(), y("button", {
|
|
1979
|
+
key: 0,
|
|
1980
|
+
class: "text-fm-color-primary hover:opacity-80 disabled:opacity-40",
|
|
1981
|
+
disabled: $.value.has(o.jobId),
|
|
1982
|
+
title: "Download",
|
|
1983
|
+
"aria-label": "Download",
|
|
1984
|
+
onClick: (R) => l(o)
|
|
1985
|
+
}, [
|
|
1986
|
+
E(C, {
|
|
1987
|
+
name: $.value.has(o.jobId) ? "progress_activity" : "download",
|
|
1988
|
+
size: "sm"
|
|
1989
|
+
}, null, 8, ["name"])
|
|
1990
|
+
], 8, Is)) : D("", !0),
|
|
1991
|
+
o.status === "waiting" || o.status === "active" ? (m(), y("button", {
|
|
1992
|
+
key: 1,
|
|
1993
|
+
class: "text-fm-color-semantic-error-500 hover:opacity-80 disabled:opacity-40",
|
|
1994
|
+
disabled: c.value.has(o.jobId),
|
|
1995
|
+
title: "Cancel",
|
|
1996
|
+
"aria-label": "Cancel",
|
|
1997
|
+
onClick: (R) => g(o)
|
|
1998
|
+
}, [
|
|
1999
|
+
E(C, {
|
|
2000
|
+
name: c.value.has(o.jobId) ? "progress_activity" : "cancel",
|
|
2001
|
+
size: "sm"
|
|
2002
|
+
}, null, 8, ["name"])
|
|
2003
|
+
], 8, Ls)) : D("", !0),
|
|
2004
|
+
de(o.status) ? (m(), y("button", {
|
|
2005
|
+
key: 2,
|
|
2006
|
+
class: "text-fm-color-typo-secondary hover:text-fm-color-typo-primary",
|
|
2007
|
+
title: "Dismiss",
|
|
2008
|
+
"aria-label": "Dismiss",
|
|
2009
|
+
onClick: (R) => V(o.jobId)
|
|
2010
|
+
}, [
|
|
2011
|
+
E(C, {
|
|
2012
|
+
name: "close",
|
|
2013
|
+
size: "sm"
|
|
2014
|
+
})
|
|
2015
|
+
], 8, zs)) : D("", !0)
|
|
2016
|
+
])
|
|
2017
|
+
]),
|
|
2018
|
+
o.status === "active" || o.status === "waiting" ? (m(), y("div", Ms, [
|
|
2019
|
+
e("div", Us, [
|
|
2020
|
+
e("div", {
|
|
2021
|
+
class: "bg-fm-color-primary h-[3px] rounded-full transition-all duration-300",
|
|
2022
|
+
style: mt({ width: `${o.progress}%` })
|
|
2023
|
+
}, null, 4)
|
|
2024
|
+
]),
|
|
2025
|
+
e("div", Vs, [
|
|
2026
|
+
o.currentItem ? (m(), y("span", Js, p(o.currentItem), 1)) : D("", !0),
|
|
2027
|
+
e("span", js, p(o.current) + " / " + p(o.total), 1)
|
|
2028
|
+
])
|
|
2029
|
+
])) : D("", !0),
|
|
2030
|
+
o.status === "completed" && o.errorCount === 0 ? (m(), y("div", Ws, [
|
|
2031
|
+
E(C, {
|
|
2032
|
+
name: "check_circle",
|
|
2033
|
+
size: "sm"
|
|
2034
|
+
}),
|
|
2035
|
+
e("span", null, p(t(h)("inventory.transfer.receiveRequest.bulk.jobDone")), 1)
|
|
2036
|
+
])) : D("", !0),
|
|
2037
|
+
o.status === "completed" && (((H = o.stalePoIds) == null ? void 0 : H.length) ?? 0) > 0 ? (m(), y("div", Ys, [
|
|
2038
|
+
E(C, {
|
|
2039
|
+
name: "warning",
|
|
2040
|
+
size: "sm"
|
|
2041
|
+
}),
|
|
2042
|
+
e("span", null, p(t(h)("inventory.transfer.receiveRequest.bulk.jobStalePos", [o.stalePoIds.length])), 1)
|
|
2043
|
+
])) : D("", !0),
|
|
2044
|
+
o.status === "cancelled" ? (m(), y("div", Hs, [
|
|
2045
|
+
E(C, {
|
|
2046
|
+
name: "do_not_disturb_on",
|
|
2047
|
+
size: "sm"
|
|
2048
|
+
}),
|
|
2049
|
+
e("span", null, p(t(h)("inventory.transfer.receiveRequest.bulk.jobCancelled")), 1)
|
|
2050
|
+
])) : D("", !0),
|
|
2051
|
+
o.status === "failed" ? (m(), y("div", Qs, [
|
|
2052
|
+
E(C, {
|
|
2053
|
+
name: "cancel",
|
|
2054
|
+
size: "sm"
|
|
2055
|
+
}),
|
|
2056
|
+
o.errorCount > 0 ? (m(), y("span", Ks, p(t(h)("inventory.transfer.receiveRequest.bulk.jobDoneWithErrors", [o.errorCount])), 1)) : (m(), y("span", Gs, p(t(h)("inventory.transfer.receiveRequest.bulk.jobFailed")), 1))
|
|
2057
|
+
])) : D("", !0),
|
|
2058
|
+
de(o.status) && o.completedAt ? (m(), y("div", Xs, [
|
|
2059
|
+
e("span", null, p(t(h)("inventory.transfer.receiveRequest.bulk.jobCompletedIn", [v(o.completedAt - o.startedAt)])), 1),
|
|
2060
|
+
o.zipSizeBytes ? (m(), y(ye, { key: 0 }, [
|
|
2061
|
+
i[2] || (i[2] = e("span", null, "·", -1)),
|
|
2062
|
+
e("span", null, p(f(o.zipSizeBytes)), 1)
|
|
2063
|
+
], 64)) : D("", !0)
|
|
2064
|
+
])) : D("", !0)
|
|
2065
|
+
]);
|
|
2066
|
+
}), 128))
|
|
2067
|
+
])
|
|
2068
|
+
])) : D("", !0)
|
|
2069
|
+
], 512)) : D("", !0)
|
|
2070
|
+
]);
|
|
2071
|
+
};
|
|
2072
|
+
}
|
|
2073
|
+
}), ea = {
|
|
2074
|
+
key: 0,
|
|
2075
|
+
class: "flex flex-col items-center justify-center py-48 gap-8 text-fm-color-typo-secondary"
|
|
2076
|
+
}, ta = { class: "flex-1 w-full flex items-center gap-4 xs:flex-col-reverse sm:flex-col-reverse" }, na = { class: "flex-1 xs:w-full sm:w-full" }, oa = {
|
|
2077
|
+
key: 0,
|
|
2078
|
+
class: "flex-1"
|
|
2079
|
+
}, sa = { class: "w-full max-w-[343px] xs:max-w-[unset] sm:max-w-[unset]" }, aa = {
|
|
2080
|
+
key: 0,
|
|
2081
|
+
class: "flex flex-col items-center justify-center py-48 gap-8 text-fm-color-typo-secondary"
|
|
2082
|
+
}, ra = { class: "fm-typo-en-body-md-400" }, la = {
|
|
2083
|
+
key: 1,
|
|
2084
|
+
class: "relative"
|
|
2085
|
+
}, ia = {
|
|
2086
|
+
key: 0,
|
|
2087
|
+
class: "flex items-center gap-12 mb-8"
|
|
2088
|
+
}, ua = { class: "flex-1 h-4 rounded-full bg-fm-color-neutral-gray-200 overflow-hidden" }, ca = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary whitespace-nowrap" }, da = {
|
|
2089
|
+
key: 1,
|
|
2090
|
+
class: "flex items-center justify-between gap-12 rounded-md border border-red-200 bg-red-50 px-16 py-8 mb-8"
|
|
2091
|
+
}, ma = { class: "fm-typo-en-body-md-400 text-red-800" }, fa = { class: "flex flex-col py-8" }, pa = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, va = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, ya = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary line-clamp-1" }, ba = { class: "fm-typo-en-body-md-400 text-fm-color-typo-primary line-clamp-1" }, ha = {
|
|
2092
|
+
key: 0,
|
|
2093
|
+
class: "fm-typo-en-body-md-400 text-fm-color-typo-primary line-clamp-1"
|
|
2094
|
+
}, ga = { class: "pt-8" }, xa = {
|
|
2095
|
+
key: 2,
|
|
2096
|
+
class: "absolute inset-0 z-10 flex items-center justify-center bg-fm-color-opacity-sm"
|
|
2097
|
+
}, _a = { class: "flex items-center gap-12 rounded-md bg-white px-16 py-8 shadow-lg" }, wa = { class: "fm-typo-en-body-md-400" }, wt = "BulkReceiveRequestViewSearchCriteria", Za = /* @__PURE__ */ tt({
|
|
2098
|
+
__name: "BulkReceiveRequestView",
|
|
2099
|
+
setup(_) {
|
|
2100
|
+
const { t: h } = nt(), w = ut();
|
|
2101
|
+
st.object({
|
|
2102
|
+
name: st.string().optional().nullable(),
|
|
2103
|
+
startDate: st.string().optional().nullable(),
|
|
2104
|
+
endDate: st.string().optional().nullable()
|
|
2105
|
+
});
|
|
2106
|
+
const O = sn(), S = Rt(), z = Tt();
|
|
2107
|
+
function Y() {
|
|
2108
|
+
const P = {
|
|
2109
|
+
name: "",
|
|
2110
|
+
...ft()
|
|
2111
|
+
}, F = O.getItem(wt);
|
|
2112
|
+
if (!F) return P;
|
|
2113
|
+
try {
|
|
2114
|
+
return JSON.parse(F);
|
|
2115
|
+
} catch {
|
|
2116
|
+
return P;
|
|
2117
|
+
}
|
|
2118
|
+
}
|
|
2119
|
+
function $() {
|
|
2120
|
+
O.setItem(wt, JSON.stringify(c.value));
|
|
2121
|
+
}
|
|
2122
|
+
const c = k(Y()), l = Cs(c.value), g = k(!1), { selectedLocationDbNames: V } = l, de = L(() => R.value.filter((P) => V.value.includes(P.dbName)).map((P) => P.doc._id)), {
|
|
2123
|
+
columnDefs: v,
|
|
2124
|
+
showPdfDialog: f,
|
|
2125
|
+
pdfPreviewLoading: d,
|
|
2126
|
+
pdfPreviewBlobUrl: i
|
|
2127
|
+
} = Rs(l, l.shipments), C = it(), o = Jt(), H = Ct(), R = k([]);
|
|
2128
|
+
Ot(() => {
|
|
2129
|
+
const P = C.locations;
|
|
2130
|
+
P.length > 0 && (R.value = P);
|
|
2131
|
+
});
|
|
2132
|
+
async function N() {
|
|
2133
|
+
var F;
|
|
2134
|
+
if ((F = H.currentBusiness.value) != null && F._id)
|
|
2135
|
+
try {
|
|
2136
|
+
const B = await o.readAllInventoryLocations();
|
|
2137
|
+
B.length > 0 && (R.value = B);
|
|
2138
|
+
} catch {
|
|
2139
|
+
}
|
|
2140
|
+
}
|
|
2141
|
+
Ve(
|
|
2142
|
+
[() => H.sessionUser.value, () => H.currentBusiness.value],
|
|
2143
|
+
([P, F]) => {
|
|
2144
|
+
P && F && N();
|
|
2145
|
+
},
|
|
2146
|
+
{ immediate: !0 }
|
|
2147
|
+
);
|
|
2148
|
+
const M = L(() => l.loading.value), be = L(
|
|
2149
|
+
() => l.failedLocations.value.map((P) => {
|
|
2150
|
+
var F;
|
|
2151
|
+
return ((F = C.locations.find((B) => B.dbName === P.dbName)) == null ? void 0 : F.name) ?? P.dbName;
|
|
2152
|
+
}).join(", ")
|
|
2153
|
+
), he = L(
|
|
2154
|
+
() => l.failedLocations.value.some((P) => P.retryable)
|
|
2155
|
+
);
|
|
2156
|
+
async function ue() {
|
|
2157
|
+
const P = `inventory-record_${He(c.value.startDate).format("DD-MM-YYYY_HH-mm")}-${He(c.value.endDate).format("DD-MM-YYYY_HH-mm")}.xlsx`;
|
|
2158
|
+
let F = [];
|
|
2159
|
+
try {
|
|
2160
|
+
F = await l.fetchFullPurchaseOrders();
|
|
2161
|
+
} catch {
|
|
2162
|
+
w.open({
|
|
2163
|
+
title: h("inventory.transfer.receiveRequest.export.error"),
|
|
2164
|
+
message: h("inventory.transfer.receiveRequest.export.fetchError"),
|
|
2165
|
+
type: "error"
|
|
2166
|
+
});
|
|
2167
|
+
return;
|
|
2168
|
+
}
|
|
2169
|
+
const B = F.flatMap(
|
|
2170
|
+
(G) => G.items.map((ee) => {
|
|
2171
|
+
var r, u;
|
|
2172
|
+
const Re = new Date(nn(G._id) ?? ""), we = G.effectiveAt ? new Date(G.effectiveAt) : void 0, j = xt(
|
|
2173
|
+
tn(ee.sku, G.deliveryOrder || [])
|
|
2174
|
+
), ae = xt(ee.quantity), Be = ((r = ee == null ? void 0 : ee.measurement) == null ? void 0 : r.abbrev) || ee.sku.unit.abbrev;
|
|
2175
|
+
return {
|
|
2176
|
+
Location: ((u = C.locations.find((b) => b.dbName === G._locationDbName)) == null ? void 0 : u.name) ?? "",
|
|
2177
|
+
"SKU code": ee.code,
|
|
2178
|
+
"SKU name": ee.name,
|
|
2179
|
+
"PO #": G.seqNumber,
|
|
2180
|
+
"Effective at": we,
|
|
2181
|
+
Date: Re,
|
|
2182
|
+
Status: G.status,
|
|
2183
|
+
Reference: G.ref ?? "",
|
|
2184
|
+
"Received quantity": j,
|
|
2185
|
+
"Ordered quantity": ae,
|
|
2186
|
+
Unit: Be,
|
|
2187
|
+
"Total cost": ee.totalCost ? Wt(ee.totalCost) : null
|
|
2188
|
+
};
|
|
2189
|
+
})
|
|
2190
|
+
), K = [
|
|
2191
|
+
"Location",
|
|
2192
|
+
"SKU code",
|
|
2193
|
+
"SKU name",
|
|
2194
|
+
"PO #",
|
|
2195
|
+
"Date",
|
|
2196
|
+
"Status",
|
|
2197
|
+
"Reference",
|
|
2198
|
+
"Received quantity",
|
|
2199
|
+
"Ordered quantity",
|
|
2200
|
+
"Unit"
|
|
2201
|
+
];
|
|
2202
|
+
S.enableBackdatePo && K.insert("Effective at", 5), S.enableTotalCost && K.push("Total cost"), await on([{ name: "purchases", data: B, columns: K }], P), w.open({
|
|
2203
|
+
title: h("inventory.transfer.receiveRequest.export.success"),
|
|
2204
|
+
message: h("inventory.transfer.receiveRequest.export.message", [P]),
|
|
2205
|
+
type: "success"
|
|
2206
|
+
});
|
|
2207
|
+
}
|
|
2208
|
+
const ne = k(ft()), ve = k("");
|
|
2209
|
+
Ve([() => ne.value], ([P]) => {
|
|
2210
|
+
if (!P.startDate || !P.endDate) return;
|
|
2211
|
+
if (He(P.endDate).diff(He(P.startDate), "day") > 60) {
|
|
2212
|
+
w.open({
|
|
2213
|
+
title: h("inventory.transfer.receiveRequest.bulk.dateRangeLimitTitle"),
|
|
2214
|
+
message: h("inventory.transfer.receiveRequest.bulk.dateRangeLimitMsg"),
|
|
2215
|
+
type: "warning"
|
|
2216
|
+
}), ne.value = {
|
|
2217
|
+
startDate: P.startDate,
|
|
2218
|
+
endDate: He(P.startDate).add(60, "day").format("YYYY-MM-DD")
|
|
2219
|
+
};
|
|
2220
|
+
return;
|
|
2221
|
+
}
|
|
2222
|
+
c.value.startDate = P.startDate, c.value.endDate = P.endDate, l.updateDateRange(c.value.startDate, c.value.endDate), $();
|
|
2223
|
+
}), Ve([() => ve.value], () => {
|
|
2224
|
+
$();
|
|
2225
|
+
});
|
|
2226
|
+
const De = It.debounce(() => l.fetchData(), 1500);
|
|
2227
|
+
Ve(
|
|
2228
|
+
() => V.value,
|
|
2229
|
+
() => {
|
|
2230
|
+
l.abortOngoingBrowse(), De();
|
|
2231
|
+
}
|
|
2232
|
+
);
|
|
2233
|
+
function _e(P) {
|
|
2234
|
+
if (P === "create") {
|
|
2235
|
+
if (M.value) {
|
|
2236
|
+
w.open({ title: "Loading data...", message: "Please wait.", type: "info" });
|
|
2237
|
+
return;
|
|
2238
|
+
}
|
|
2239
|
+
if (V.value.length === 0) {
|
|
2240
|
+
w.open({
|
|
2241
|
+
title: "No outlets selected",
|
|
2242
|
+
message: "Please select at least one outlet to create a transfer.",
|
|
2243
|
+
type: "warning"
|
|
2244
|
+
});
|
|
2245
|
+
return;
|
|
2246
|
+
}
|
|
2247
|
+
g.value = !0;
|
|
2248
|
+
return;
|
|
2249
|
+
}
|
|
2250
|
+
if (P === "upload" && S.enableXilnexTransferNote)
|
|
2251
|
+
return l.promptUploadTransferDialog();
|
|
2252
|
+
if (P === "refresh") return l.fetchData();
|
|
2253
|
+
if (P === "export") return ue();
|
|
2254
|
+
if (P === "downloadAll") return Ae();
|
|
2255
|
+
if (P === "emailAll") return Ee();
|
|
2256
|
+
}
|
|
2257
|
+
async function Ae() {
|
|
2258
|
+
if (V.value.length === 0) {
|
|
2259
|
+
w.open({
|
|
2260
|
+
title: h("inventory.transfer.receiveRequest.bulk.noLocationsSelected"),
|
|
2261
|
+
message: "",
|
|
2262
|
+
type: "warning"
|
|
2263
|
+
});
|
|
2264
|
+
return;
|
|
2265
|
+
}
|
|
2266
|
+
await l.downloadAll(Se.value);
|
|
2267
|
+
}
|
|
2268
|
+
async function Ee() {
|
|
2269
|
+
if (S.enablePurchaseOrderEmail) {
|
|
2270
|
+
if (V.value.length === 0) {
|
|
2271
|
+
w.open({
|
|
2272
|
+
title: h("inventory.transfer.receiveRequest.bulk.noLocationsSelected"),
|
|
2273
|
+
message: "",
|
|
2274
|
+
type: "warning"
|
|
2275
|
+
});
|
|
2276
|
+
return;
|
|
2277
|
+
}
|
|
2278
|
+
await l.emailAll(Se.value);
|
|
2279
|
+
}
|
|
2280
|
+
}
|
|
2281
|
+
const { breakpoints: me } = cn(), ge = L(() => me.value.xs || me.value.sm), $e = L(() => ge.value ? 10 : 20), Fe = an(), Ge = L(() => S.enableReceiveRequestBeta ? [
|
|
2282
|
+
{
|
|
2283
|
+
label: h("inventory.transfer.receiveRequest.actions.create"),
|
|
2284
|
+
value: "create",
|
|
2285
|
+
isPrimary: !0,
|
|
2286
|
+
prependIcon: "add"
|
|
2287
|
+
},
|
|
2288
|
+
...S.enableXilnexTransferNote ? [{ label: h("inventory.common.upload"), value: "upload" }] : [],
|
|
2289
|
+
{ label: h("inventory.common.refresh"), value: "refresh" },
|
|
2290
|
+
{ label: h("inventory.common.export"), value: "export" },
|
|
2291
|
+
...S.enablePrintTemplate && !M.value ? [
|
|
2292
|
+
{
|
|
2293
|
+
label: h("inventory.transfer.receiveRequest.bulk.downloadAll"),
|
|
2294
|
+
value: "downloadAll",
|
|
2295
|
+
prependIcon: "download"
|
|
2296
|
+
}
|
|
2297
|
+
] : [],
|
|
2298
|
+
...S.enablePurchaseOrderEmail && !M.value ? [
|
|
2299
|
+
{
|
|
2300
|
+
label: h("inventory.transfer.receiveRequest.bulk.emailAll"),
|
|
2301
|
+
value: "emailAll",
|
|
2302
|
+
prependIcon: "email"
|
|
2303
|
+
}
|
|
2304
|
+
] : []
|
|
2305
|
+
] : []), qe = L(() => {
|
|
2306
|
+
const P = [
|
|
2307
|
+
{
|
|
2308
|
+
type: "string",
|
|
2309
|
+
key: "status",
|
|
2310
|
+
entity: "purchaseOrder",
|
|
2311
|
+
values: Array.from(new Set(l.purchaseOrders.value.map((B) => B.status)))
|
|
2312
|
+
},
|
|
2313
|
+
{
|
|
2314
|
+
type: "string",
|
|
2315
|
+
key: "transferFrom",
|
|
2316
|
+
entity: "purchaseOrder",
|
|
2317
|
+
values: Array.from(new Set(l.purchaseOrders.value.map((B) => B.supplier.name)))
|
|
2318
|
+
},
|
|
2319
|
+
{
|
|
2320
|
+
type: "string",
|
|
2321
|
+
key: "location",
|
|
2322
|
+
entity: "purchaseOrder",
|
|
2323
|
+
values: Array.from(
|
|
2324
|
+
new Set(
|
|
2325
|
+
l.purchaseOrders.value.map((B) => {
|
|
2326
|
+
const K = C.locations.find((G) => G.dbName === B._locationDbName);
|
|
2327
|
+
return (K == null ? void 0 : K.name) ?? B._locationDbName;
|
|
2328
|
+
})
|
|
2329
|
+
)
|
|
2330
|
+
)
|
|
2331
|
+
}
|
|
2332
|
+
], F = [
|
|
2333
|
+
{
|
|
2334
|
+
type: "string",
|
|
2335
|
+
key: "netsuiteTransactionNumber",
|
|
2336
|
+
entity: "purchaseOrder",
|
|
2337
|
+
values: l.purchaseOrders.value.map((B) => {
|
|
2338
|
+
var K, G;
|
|
2339
|
+
return (G = (K = B.netSuite) == null ? void 0 : K.additionalInfo) == null ? void 0 : G.transactionnumber;
|
|
2340
|
+
}).filter((B) => B != null)
|
|
2341
|
+
},
|
|
2342
|
+
{
|
|
2343
|
+
type: "string",
|
|
2344
|
+
key: "netsuiteOrderNo",
|
|
2345
|
+
entity: "purchaseOrder",
|
|
2346
|
+
values: l.purchaseOrders.value.map((B) => {
|
|
2347
|
+
var K;
|
|
2348
|
+
return (K = B.netSuite) == null ? void 0 : K.refNo;
|
|
2349
|
+
}).filter((B) => B != null)
|
|
2350
|
+
},
|
|
2351
|
+
{
|
|
2352
|
+
type: "string",
|
|
2353
|
+
key: "netsuiteOrderId",
|
|
2354
|
+
entity: "purchaseOrder",
|
|
2355
|
+
values: l.purchaseOrders.value.map((B) => {
|
|
2356
|
+
var K;
|
|
2357
|
+
return (K = B.netSuite) == null ? void 0 : K.id;
|
|
2358
|
+
}).filter((B) => B != null)
|
|
2359
|
+
}
|
|
2360
|
+
];
|
|
2361
|
+
return [...P, ...z.isEnabled ? F : []];
|
|
2362
|
+
}), Oe = k(null), Se = L(() => {
|
|
2363
|
+
if (!Oe.value) return l.purchaseOrders.value;
|
|
2364
|
+
const P = _n.build(Oe.value);
|
|
2365
|
+
return l.purchaseOrders.value.filter((F) => {
|
|
2366
|
+
var K, G, ee, Re, we;
|
|
2367
|
+
const B = ((K = C.locations.find((j) => j.dbName === F._locationDbName)) == null ? void 0 : K.name) ?? F._locationDbName;
|
|
2368
|
+
return wn(
|
|
2369
|
+
{
|
|
2370
|
+
netsuiteTransactionNumber: (ee = (G = F.netSuite) == null ? void 0 : G.additionalInfo) == null ? void 0 : ee.transactionnumber,
|
|
2371
|
+
netsuiteOrderNo: (Re = F.netSuite) == null ? void 0 : Re.refNo,
|
|
2372
|
+
netsuiteOrderId: (we = F.netSuite) == null ? void 0 : we.id,
|
|
2373
|
+
status: F.status,
|
|
2374
|
+
transferFrom: F.supplier.name,
|
|
2375
|
+
location: B
|
|
2376
|
+
},
|
|
2377
|
+
P
|
|
2378
|
+
);
|
|
2379
|
+
});
|
|
2380
|
+
});
|
|
2381
|
+
return (P, F) => {
|
|
2382
|
+
const B = Ce("FmIcon"), K = Ce("FmTextField"), G = Ce("FmButton"), ee = Ce("FmTable"), Re = Ce("FmCircularProgress");
|
|
2383
|
+
return m(), le(rn, {
|
|
2384
|
+
title: t(h)("inventory.transfer.receiveRequest.bulk.title"),
|
|
2385
|
+
actions: Ge.value,
|
|
2386
|
+
"onClick:action": _e
|
|
2387
|
+
}, {
|
|
2388
|
+
default: Pe(() => {
|
|
2389
|
+
var we;
|
|
2390
|
+
return [
|
|
2391
|
+
t(S).isLoaded && !t(S).enableReceiveRequestBeta ? (m(), y("div", ea, [
|
|
2392
|
+
E(B, {
|
|
2393
|
+
name: "block",
|
|
2394
|
+
size: "xl"
|
|
2395
|
+
}),
|
|
2396
|
+
F[9] || (F[9] = e("p", { class: "fm-typo-en-body-md-400" }, "Not available", -1))
|
|
2397
|
+
])) : t(S).enableReceiveRequestBeta ? (m(), y(ye, { key: 1 }, [
|
|
2398
|
+
e("div", {
|
|
2399
|
+
class: J(["flex flex-col gap-8 max-h-full", { "p-0": ge.value, "px-24": !ge.value }])
|
|
2400
|
+
}, [
|
|
2401
|
+
e("div", {
|
|
2402
|
+
class: "flex flex-col gap-8",
|
|
2403
|
+
onVnodeMounted: F[4] || (F[4] = //@ts-ignore
|
|
2404
|
+
(...j) => t(Fe).onMounted && t(Fe).onMounted(...j)),
|
|
2405
|
+
onVnodeUnmounted: F[5] || (F[5] = //@ts-ignore
|
|
2406
|
+
(...j) => t(Fe).onUnmounted && t(Fe).onUnmounted(...j))
|
|
2407
|
+
}, [
|
|
2408
|
+
e("div", {
|
|
2409
|
+
class: J([
|
|
2410
|
+
"flex gap-8 items-center",
|
|
2411
|
+
{ "px-8 flex-col-reverse h-[unset]": ge.value, "h-48": !ge.value }
|
|
2412
|
+
])
|
|
2413
|
+
}, [
|
|
2414
|
+
e("div", {
|
|
2415
|
+
class: J(["flex gap-8 items-center", { "w-full overflow-x-auto": ge.value }])
|
|
2416
|
+
}, [
|
|
2417
|
+
E(gs, {
|
|
2418
|
+
modelValue: t(V),
|
|
2419
|
+
"onUpdate:modelValue": F[0] || (F[0] = (j) => bt(V) ? V.value = j : null),
|
|
2420
|
+
locations: R.value
|
|
2421
|
+
}, null, 8, ["modelValue", "locations"]),
|
|
2422
|
+
E(jt, {
|
|
2423
|
+
"model-value": ne.value,
|
|
2424
|
+
"onUpdate:modelValue": F[1] || (F[1] = (j) => ne.value = j)
|
|
2425
|
+
}, null, 8, ["model-value"])
|
|
2426
|
+
], 2),
|
|
2427
|
+
e("div", ta, [
|
|
2428
|
+
e("div", na, [
|
|
2429
|
+
E(t(kn), {
|
|
2430
|
+
modelValue: Oe.value,
|
|
2431
|
+
"onUpdate:modelValue": F[2] || (F[2] = (j) => Oe.value = j),
|
|
2432
|
+
attributes: qe.value
|
|
2433
|
+
}, null, 8, ["modelValue", "attributes"])
|
|
2434
|
+
]),
|
|
2435
|
+
ge.value ? D("", !0) : (m(), y("div", oa)),
|
|
2436
|
+
e("div", sa, [
|
|
2437
|
+
E(K, {
|
|
2438
|
+
"model-value": ve.value,
|
|
2439
|
+
"onUpdate:modelValue": F[3] || (F[3] = (j) => ve.value = j),
|
|
2440
|
+
"prepend-icon": "search",
|
|
2441
|
+
placeholder: t(h)("inventory.common.table.toolbar.filterItems"),
|
|
2442
|
+
class: "w-full"
|
|
2443
|
+
}, null, 8, ["model-value", "placeholder"])
|
|
2444
|
+
])
|
|
2445
|
+
])
|
|
2446
|
+
], 2)
|
|
2447
|
+
], 512),
|
|
2448
|
+
t(V).length === 0 && !M.value ? (m(), y("div", aa, [
|
|
2449
|
+
E(B, {
|
|
2450
|
+
name: "storefront",
|
|
2451
|
+
size: "xl"
|
|
2452
|
+
}),
|
|
2453
|
+
e("p", ra, p(t(h)("inventory.transfer.receiveRequest.bulk.selectLocationsHint")), 1)
|
|
2454
|
+
])) : (m(), y("div", la, [
|
|
2455
|
+
(M.value || t(l).retryingFailed.value) && t(l).fetchProgress.value ? (m(), y("div", ia, [
|
|
2456
|
+
e("div", ua, [
|
|
2457
|
+
e("div", {
|
|
2458
|
+
class: "h-full rounded-full bg-fm-color-primary transition-all duration-300",
|
|
2459
|
+
style: mt({
|
|
2460
|
+
width: `${t(l).fetchProgress.value.done / t(l).fetchProgress.value.total * 100}%`
|
|
2461
|
+
})
|
|
2462
|
+
}, null, 4)
|
|
2463
|
+
]),
|
|
2464
|
+
e("span", ca, p(t(l).fetchProgress.value.done) + "/" + p(t(l).fetchProgress.value.total) + " locations ", 1)
|
|
2465
|
+
])) : D("", !0),
|
|
2466
|
+
t(l).failedLocations.value.length > 0 ? (m(), y("div", da, [
|
|
2467
|
+
e("span", ma, " Failed to load: " + p(be.value), 1),
|
|
2468
|
+
he.value ? (m(), le(G, {
|
|
2469
|
+
key: 0,
|
|
2470
|
+
variant: "secondary",
|
|
2471
|
+
disabled: t(l).retryingFailed.value || M.value,
|
|
2472
|
+
label: t(l).retryingFailed.value ? "Retrying…" : "Retry failed locations",
|
|
2473
|
+
onClick: t(l).retryFailedLocations
|
|
2474
|
+
}, null, 8, ["disabled", "label", "onClick"])) : D("", !0)
|
|
2475
|
+
])) : D("", !0),
|
|
2476
|
+
E(ee, {
|
|
2477
|
+
style: mt(t(Fe).tableHeight),
|
|
2478
|
+
"column-defs": t(v),
|
|
2479
|
+
"row-data": Se.value,
|
|
2480
|
+
"search-value": ve.value,
|
|
2481
|
+
loading: M.value,
|
|
2482
|
+
onRowClick: F[6] || (F[6] = (j) => t(l).promptShowTransferDetails(j.original)),
|
|
2483
|
+
"page-size": $e.value
|
|
2484
|
+
}, {
|
|
2485
|
+
"list-row": Pe((j) => [
|
|
2486
|
+
E(xn, {
|
|
2487
|
+
row: j,
|
|
2488
|
+
onRowClick: t(l).promptShowTransferDetails
|
|
2489
|
+
}, {
|
|
2490
|
+
default: Pe((ae) => {
|
|
2491
|
+
var Be, Te, r, u, b, T, I, q, W, Q, A, Z, U, re, Je, Ie, Le, Ne, ke, ze, Me, je, We, x, oe;
|
|
2492
|
+
return [
|
|
2493
|
+
e("div", fa, [
|
|
2494
|
+
e("div", pa, [
|
|
2495
|
+
E(t(Ze), {
|
|
2496
|
+
render: (r = (Te = (Be = ae._id) == null ? void 0 : Be.column) == null ? void 0 : Te.columnDef) == null ? void 0 : r.cell,
|
|
2497
|
+
props: (b = (u = ae._id) == null ? void 0 : u.getContext) == null ? void 0 : b.call(u)
|
|
2498
|
+
}, null, 8, ["render", "props"])
|
|
2499
|
+
]),
|
|
2500
|
+
e("div", va, [
|
|
2501
|
+
E(t(Ze), {
|
|
2502
|
+
render: (q = (I = (T = ae.location) == null ? void 0 : T.column) == null ? void 0 : I.columnDef) == null ? void 0 : q.cell,
|
|
2503
|
+
props: (Q = (W = ae.location) == null ? void 0 : W.getContext) == null ? void 0 : Q.call(W)
|
|
2504
|
+
}, null, 8, ["render", "props"])
|
|
2505
|
+
]),
|
|
2506
|
+
e("div", ya, [
|
|
2507
|
+
E(t(Ze), {
|
|
2508
|
+
render: (U = (Z = (A = ae.supplier_name) == null ? void 0 : A.column) == null ? void 0 : Z.columnDef) == null ? void 0 : U.cell,
|
|
2509
|
+
props: (Je = (re = ae.supplier_name) == null ? void 0 : re.getContext) == null ? void 0 : Je.call(re)
|
|
2510
|
+
}, null, 8, ["render", "props"])
|
|
2511
|
+
]),
|
|
2512
|
+
e("div", ba, p(j.original.items.map((ie) => `${ie.name}`).join(", ")), 1),
|
|
2513
|
+
j.original.ref ? (m(), y("div", ha, [
|
|
2514
|
+
E(t(Ze), {
|
|
2515
|
+
render: (Ne = (Le = (Ie = ae.ref) == null ? void 0 : Ie.column) == null ? void 0 : Le.columnDef) == null ? void 0 : Ne.cell,
|
|
2516
|
+
props: (ze = (ke = ae.ref) == null ? void 0 : ke.getContext) == null ? void 0 : ze.call(ke)
|
|
2517
|
+
}, null, 8, ["render", "props"])
|
|
2518
|
+
])) : D("", !0),
|
|
2519
|
+
e("div", ga, [
|
|
2520
|
+
E(t(Ze), {
|
|
2521
|
+
render: (We = (je = (Me = ae.status) == null ? void 0 : Me.column) == null ? void 0 : je.columnDef) == null ? void 0 : We.cell,
|
|
2522
|
+
props: (oe = (x = ae.status) == null ? void 0 : x.getContext) == null ? void 0 : oe.call(x)
|
|
2523
|
+
}, null, 8, ["render", "props"])
|
|
2524
|
+
])
|
|
2525
|
+
])
|
|
2526
|
+
];
|
|
2527
|
+
}),
|
|
2528
|
+
_: 2
|
|
2529
|
+
}, 1032, ["row", "onRowClick"])
|
|
2530
|
+
]),
|
|
2531
|
+
_: 1
|
|
2532
|
+
}, 8, ["style", "column-defs", "row-data", "search-value", "loading", "page-size"]),
|
|
2533
|
+
t(l).rowAction.pending.value ? (m(), y("div", xa, [
|
|
2534
|
+
e("div", _a, [
|
|
2535
|
+
E(Re, { size: "md" }),
|
|
2536
|
+
e("span", wa, p(t(h)("inventory.common.loading")), 1),
|
|
2537
|
+
E(G, {
|
|
2538
|
+
variant: "secondary",
|
|
2539
|
+
label: t(h)("inventory.common.cancel"),
|
|
2540
|
+
onClick: t(l).rowAction.cancel
|
|
2541
|
+
}, null, 8, ["label", "onClick"])
|
|
2542
|
+
])
|
|
2543
|
+
])) : D("", !0)
|
|
2544
|
+
]))
|
|
2545
|
+
], 2),
|
|
2546
|
+
(m(), le(lt, { to: "body" }, [
|
|
2547
|
+
E(Zs),
|
|
2548
|
+
t(S).enablePurchaseOrderEmail ? (m(), le(fn, ht(ct({ key: 0 }, t(l).emailDialogProps.value)), null, 16)) : D("", !0),
|
|
2549
|
+
E(cs, {
|
|
2550
|
+
show: g.value,
|
|
2551
|
+
"onUpdate:show": F[7] || (F[7] = (j) => g.value = j),
|
|
2552
|
+
"last-closing-date": t(l).lastClosingDate.value,
|
|
2553
|
+
"selected-outlet-ids": de.value,
|
|
2554
|
+
onSubmitted: t(l).fetchData
|
|
2555
|
+
}, null, 8, ["show", "last-closing-date", "selected-outlet-ids", "onSubmitted"]),
|
|
2556
|
+
E(pn, ct(t(l).transferDialogProps.value, {
|
|
2557
|
+
onSubmitted: t(l).fetchData
|
|
2558
|
+
}), null, 16, ["onSubmitted"]),
|
|
2559
|
+
t(l).transferDetailsProps.value != null ? (m(), le(en, ct({ key: 1 }, {
|
|
2560
|
+
...t(l).transferDetailsProps.value,
|
|
2561
|
+
receivedMap: ((we = t(l).transferDetailsProps.value) == null ? void 0 : we.receivedMap) ?? {},
|
|
2562
|
+
shipments: t(l).shipments.value ?? []
|
|
2563
|
+
}, {
|
|
2564
|
+
onSubmitted: t(l).fetchData
|
|
2565
|
+
}), null, 16, ["onSubmitted"])) : D("", !0),
|
|
2566
|
+
E(vn, ht(Bt(t(l).xilnexImportDialogProps.value)), null, 16),
|
|
2567
|
+
E(hs, {
|
|
2568
|
+
modelValue: t(f),
|
|
2569
|
+
"onUpdate:modelValue": F[8] || (F[8] = (j) => bt(f) ? f.value = j : null),
|
|
2570
|
+
loading: t(d),
|
|
2571
|
+
"blob-url": t(i)
|
|
2572
|
+
}, null, 8, ["modelValue", "loading", "blob-url"])
|
|
2573
|
+
]))
|
|
2574
|
+
], 64)) : D("", !0)
|
|
2575
|
+
];
|
|
2576
|
+
}),
|
|
2577
|
+
_: 1
|
|
2578
|
+
}, 8, ["title", "actions"]);
|
|
2579
|
+
};
|
|
2580
|
+
}
|
|
2581
|
+
});
|
|
2582
|
+
export {
|
|
2583
|
+
Za as default
|
|
2584
|
+
};
|