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