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