@feedmepos/mf-inventory-portal 1.7.1-dev.0 → 1.7.2-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.
Files changed (136) hide show
  1. package/dist/{App-B_ja37tB.js → App-GsVnjJ5M.js} +5 -5
  2. package/dist/ApprovalView-DSPu2Gk5.js +242 -0
  3. package/dist/{BindingsDialog-0IRWCLTc.js → BindingsDialog-B9_lCD9R.js} +2 -2
  4. package/dist/{BindingsPicker-DCISa6Fx.js → BindingsPicker-ZKl53ZBk.js} +2 -2
  5. package/dist/{BindingsTable-B3CmHp97.js → BindingsTable-CLtS3u8f.js} +3 -3
  6. package/dist/BulkReceiveRequestView-BbHwEPzW.js +2011 -0
  7. package/dist/{ChangeLocationComponent.vue_vue_type_script_setup_true_lang-D4Nd89xp.js → ChangeLocationComponent.vue_vue_type_script_setup_true_lang-KgqYNGrB.js} +1 -1
  8. package/dist/ClosingDraftView-Ctc6-1-J.js +4496 -0
  9. package/dist/{ClosingHistoryView-KdmhszIO.js → ClosingHistoryView-CX9xtMvI.js} +7 -7
  10. package/dist/{ClosingTemplateView-CQRujMB9.js → ClosingTemplateView-BuoQegZF.js} +17 -17
  11. package/dist/{DefaultView-QAEDG6pS.js → DefaultView-BltV37jK.js} +2 -2
  12. package/dist/{DeliveryOrderPrintPreview-B08SSOCX.js → DeliveryOrderPrintPreview-CxzgxTJk.js} +2 -2
  13. package/dist/{EmailDialog.vue_vue_type_script_setup_true_lang-DdzV_fzq.js → EmailDialog.vue_vue_type_script_setup_true_lang-5Hhoj-yj.js} +10225 -10398
  14. package/dist/{FmAdminBadge-DH_2w13D.js → FmAdminBadge-DlplQOHb.js} +8 -8
  15. package/dist/{FmDateRangePickerChip.vue_vue_type_script_setup_true_lang-CmH3uhTZ.js → FmDateRangePickerChip.vue_vue_type_script_setup_true_lang-jTZNZIrW.js} +1 -1
  16. package/dist/FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-BYTn-hpQ.js +76 -0
  17. package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-Df-yCfRe.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-DLYrZfPo.js} +4 -4
  18. package/dist/{FmMultiselectDialog-QEs0yct_.js → FmMultiselectDialog-BxAfKkDh.js} +2 -2
  19. package/dist/{FmMultiselectDialog-DpPyNOpJ.js → FmMultiselectDialog-DF_inpi2.js} +1 -1
  20. package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-D8-IQUtA.js → FmUnitInput.vue_vue_type_script_setup_true_lang-BYhQBazV.js} +119 -121
  21. package/dist/{ImportView-8qlgZSTO.js → ImportView-C76r6and.js} +8 -8
  22. package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-CGWRbAF2.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-By-9uV57.js} +1 -1
  23. package/dist/{IngredientGroupView-BI9SlKfz.js → IngredientGroupView-vRbMzHBS.js} +6 -6
  24. package/dist/{IngredientsView-1naUkKAi.js → IngredientsView-GMSV1cL0.js} +17 -17
  25. package/dist/{IntegrationExplorerView-C6kyLz3y.js → IntegrationExplorerView-ClhCRTC-.js} +5 -5
  26. package/dist/{IntegrationView-DrmxLdlk.js → IntegrationView-DM-TvYjd.js} +15 -15
  27. package/dist/{InventoryBindingForm-CPNAgZkD.js → InventoryBindingForm-CpY3n5Ug.js} +1 -1
  28. package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-sz_VtHRr.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-CEF1D6bJ.js} +5 -5
  29. package/dist/{InventoryBindingSummary-Cu98L10w.js → InventoryBindingSummary-CYOt-E-3.js} +1 -1
  30. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-g2PDNQx-.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-jZHUuEoU.js} +1 -1
  31. package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-BZEa61go.js → PremiumBadge.vue_vue_type_script_setup_true_lang-Bw1xCASs.js} +1 -1
  32. package/dist/{ProductionView-D8dxypqA.js → ProductionView-D6UC_XqI.js} +8 -8
  33. package/dist/{PublishView-C82UwIoz.js → PublishView-CuDaby-H.js} +4 -4
  34. package/dist/{PurchaseOrderPrintPreview-CP40tEma.js → PurchaseOrderPrintPreview-DcSuomzT.js} +2 -2
  35. package/dist/ReceiveRequestView-CMywjm4H.js +345 -0
  36. package/dist/{RecipeView-DB1DJQp7.js → RecipeView-BAcLGUEw.js} +18 -18
  37. package/dist/{SettingsView-DsS62lxW.js → SettingsView-Dy3VaVP2.js} +6 -6
  38. package/dist/{SingleColumnLayout.vue_vue_type_script_setup_true_lang-DWsPvPE1.js → SingleColumnLayout.vue_vue_type_script_setup_true_lang-DwrLsWX_.js} +1 -1
  39. package/dist/{StockView-gcf7RCZz.js → StockView-BFSFWXEY.js} +23 -23
  40. package/dist/{SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-nXqFCKic.js → SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-B5qk8k2h.js} +1 -1
  41. package/dist/{SupplierView-BIANlKLE.js → SupplierView-BvZ4bdjb.js} +13 -13
  42. package/dist/{SurchargeView-kRzaixM5.js → SurchargeView-DEx1ncN0.js} +7 -7
  43. package/dist/SystemTrailDialog.vue_vue_type_script_setup_true_lang-DvjxSkiV.js +178 -0
  44. package/dist/{TemplatePublishDialog.vue_vue_type_script_setup_true_lang-BceIOuBq.js → TemplatePublishDialog.vue_vue_type_script_setup_true_lang-raGPvWWz.js} +2 -2
  45. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-Dqn_ArEw.js +4660 -0
  46. package/dist/{TransferTemplateView-Bq68Vh7t.js → TransferTemplateView-DqwLSixK.js} +21 -21
  47. package/dist/{UnitCostHistoryView-d0oLssyZ.js → UnitCostHistoryView-BwuW604u.js} +6 -6
  48. package/dist/{UnitDisplayControl.vue_vue_type_script_setup_true_lang-CLOotG6K.js → UnitDisplayControl.vue_vue_type_script_setup_true_lang-DI4MfA6h.js} +4 -4
  49. package/dist/{UnitView-BHfm2IE4.js → UnitView-DBSX7myc.js} +8 -8
  50. package/dist/{WarehouseView-CorSYwm6.js → WarehouseView-D9BLSUaw.js} +6 -6
  51. package/dist/{WastageTemplateView-CtYZwiRW.js → WastageTemplateView-BV98TGlI.js} +15 -15
  52. package/dist/api/closing-draft.d.ts +5 -1
  53. package/dist/api/purchase-order.d.ts +1 -35
  54. package/dist/{app-37NZKFUI.js → app-D_Ym25tG.js} +5262 -5566
  55. package/dist/app.d.ts +24 -88
  56. package/dist/app.js +1 -1
  57. package/dist/{closing-template-C0dl45x2.js → closing-template-CgZ_4k-K.js} +1 -1
  58. package/dist/components/FmFilterableMenuOptions.vue.d.ts +2 -11
  59. package/dist/{date2-r4KgBCs9.js → date2-BJDb1yuY.js} +1 -1
  60. package/dist/{dayjs.min-BKUldDi9.js → dayjs.min-DaQY5dXC.js} +1 -1
  61. package/dist/{decimal-Cgmw6HIY.js → decimal-D7kHeIBp.js} +2 -2
  62. package/dist/{defineDeepModel-DXLwZWst.js → defineDeepModel-C6b9BBLr.js} +1 -1
  63. package/dist/{duplicate-template-DDA4QWPl.js → duplicate-template-B3efBcsm.js} +1 -1
  64. package/dist/feature-8uw1BmnH.js +1136 -0
  65. package/dist/{format-time-from-id-Dhjn5QgH.js → format-time-from-id-DLNUrReR.js} +1 -1
  66. package/dist/{format-unit-display-g95-VuYJ.js → format-unit-display-dedOq7Rd.js} +12 -12
  67. package/dist/{import-export.helper-DsZFPPqj.js → import-export.helper-CLJoNMDx.js} +6 -6
  68. package/dist/{index-B9WjF3Ox.js → index-BzcCCKB7.js} +1 -1
  69. package/dist/{index-C207KsUh.js → index-D0IvVK8C.js} +3 -3
  70. package/dist/{index-D3Bmmx66.js → index-K8Z-b9IK.js} +1 -1
  71. package/dist/{inventory-core-dart.default-NpD15h63.js → inventory-core-dart.default-DD-U6dYG.js} +5550 -7099
  72. package/dist/{jszip.min-B52cHzHI.js → jszip.min-D6DuQ9eP.js} +2 -2
  73. package/dist/{lz-string-CItFpr5-.js → lz-string-DPtdOdTM.js} +1 -1
  74. package/dist/{netsuite-R_NkLn5t.js → netsuite-6tmjDviW.js} +2 -2
  75. package/dist/{number-BkC_lelq.js → number-CMVOg7m3.js} +3 -3
  76. package/dist/{predefined-templates-CVT54o4V.js → predefined-templates-DfSWTcww.js} +1 -1
  77. package/dist/{purchase-order-template-DvqAncB2.js → purchase-order-template-GCzUtb6y.js} +1 -1
  78. package/dist/{recalculationUtils-Cak1mo4o.js → recalculationUtils-CSBScoyF.js} +1 -1
  79. package/dist/router/name.d.ts +0 -1
  80. package/dist/{rules--cnFg-PI.js → rules-pC-W9ghI.js} +2 -2
  81. package/dist/{stock-BLYAJxMj.js → stock-C0lKfZnz.js} +1 -1
  82. package/dist/{stock-DvquSog3.js → stock-CIpjxe6A.js} +3 -3
  83. package/dist/stores/feature.d.ts +0 -2
  84. package/dist/style.css +1 -1
  85. package/dist/{supplier-C5X8p_vd.js → supplier-eYlqSO4X.js} +2 -2
  86. package/dist/{surcharge-CLkpleoW.js → surcharge-CX5M8xDS.js} +1 -1
  87. package/dist/tsconfig.app.tsbuildinfo +1 -1
  88. package/dist/{uom-rules-CykFo_pB.js → uom-rules-CfUOdeZ4.js} +1 -1
  89. package/dist/{use-ingredient-select-dialog-DlxWMkAI.js → use-ingredient-select-dialog-DYRHuZLi.js} +2 -2
  90. package/dist/{use-inventory-binding-dialog-DnWDyziu.js → use-inventory-binding-dialog-CQahb9Rn.js} +2 -2
  91. package/dist/{use-template-enabled-locations-SRgcWLO4.js → use-template-enabled-locations-BOO-eQch.js} +2 -2
  92. package/dist/{use-transfer-locations-D4f4Ib1r.js → use-transfer-locations-Ffdy6Z9C.js} +2 -2
  93. package/dist/{useHrmPermission-lAc6ZHVZ.js → useHrmPermission-CXSUDdlQ.js} +1 -1
  94. package/dist/{useNavigationMenu-CeN7TEwe.js → useNavigationMenu-DfW5RBKu.js} +49 -59
  95. package/dist/{useSseClient-C6ndlLpA.js → useSseClient-Bl-WWwFk.js} +1 -1
  96. package/dist/views/closing-draft/components/closing-draft-dialog/ClosingDraftApprovalDialog.vue.d.ts +6 -2
  97. package/dist/views/closing-draft/components/closing-draft-dialog/ClosingDraftDialog.vue.d.ts +4 -4
  98. package/dist/views/closing-draft/components/closing-draft-groups/ClosingGroupAction.vue.d.ts +2 -2
  99. package/dist/views/closing-draft/components/closing-draft-groups/ClosingGroupDetailSideSheet.vue.d.ts +2 -2
  100. package/dist/views/closing-draft/composables/use-closing-draft-actions.d.ts +6 -6
  101. package/dist/views/closing-draft/composables/use-closing-draft-import.d.ts +1 -1
  102. package/dist/views/closing-draft/composables/use-closing-draft-table.d.ts +12 -12
  103. package/dist/views/receive-request/components/transfer-dialog/TransferDialogProps.d.ts +0 -1
  104. package/dist/views/receive-request/components/transfer-form/TransferFormProps.d.ts +0 -1
  105. package/dist/views/receive-request/components/transfer-form/TransferFormWithController.vue.d.ts +2 -102
  106. package/dist/views/receive-request/composables/fn.d.ts +1 -2
  107. package/dist/views/receive-request/composables/use-process-purchase-order.d.ts +3 -119
  108. package/dist/views/receive-request/composables/use-receive-request-form.d.ts +14 -643
  109. package/dist/views/receive-request/composables/use-receive-request-table.d.ts +15 -721
  110. package/dist/views/receive-request-bulk/composables/use-bulk-receive-request-form.d.ts +10 -524
  111. package/dist/views/receive-request-bulk/composables/use-bulk-receive-request-table.d.ts +2 -102
  112. package/dist/views/transfer-template/components/transfer-template-dialog/TransferTemplateDialog.vue.d.ts +0 -4
  113. package/dist/views/transfer-template/components/transfer-template-form/composables/use-transfer-locations.d.ts +0 -8
  114. package/dist/views/transfer-template/composables/use-template-item-bulk-editor.d.ts +0 -12
  115. package/dist/views/transfer-template/composables/use-transfer-template-actions.d.ts +0 -24
  116. package/dist/views/transfer-template/composables/use-transfer-template-table.d.ts +0 -24
  117. package/dist/{vue-i18n-DDqVG60p.js → vue-i18n-BAu5G_RB.js} +152 -152
  118. package/dist/{xlsx.util-BzQcPwvM.js → xlsx.util-BgM338n0.js} +2 -2
  119. package/package.json +5 -5
  120. package/dist/ApprovalView-_wG6KeZl.js +0 -249
  121. package/dist/BulkReceiveRequestView-Dmqm65c9.js +0 -2025
  122. package/dist/ClosingDraftView-DDWU93p0.js +0 -4398
  123. package/dist/ConnectedBusinessView-Cu2QnRN9.js +0 -533
  124. package/dist/FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-Dzqh8pM9.js +0 -84
  125. package/dist/ReceiveRequestView-DDo0Pb0J.js +0 -514
  126. package/dist/SystemTrailDialog.vue_vue_type_script_setup_true_lang-QMUVuthC.js +0 -211
  127. package/dist/TransferDetailsV3.vue_vue_type_script_setup_true_lang-DYAzxoHE.js +0 -5991
  128. package/dist/api/connected-business-mapping.d.ts +0 -25
  129. package/dist/connected-business-mapping-ywgqqyMr.js +0 -37
  130. package/dist/feature-B4BoCy_k.js +0 -1548
  131. package/dist/views/connected-business/ConnectedBusinessMappingPanel.vue.d.ts +0 -25
  132. package/dist/views/connected-business/ConnectedBusinessView.vue.d.ts +0 -2
  133. package/dist/views/receive-request/components/CreateTransferChoice.vue.d.ts +0 -27
  134. package/dist/views/receive-request/components/transfer-details/TransferDetailsV3.vue.d.ts +0 -18
  135. package/dist/views/receive-request/helper/po-version.d.ts +0 -6
  136. /package/dist/views/{receive-request/composables/fn.spec.d.ts → closing-draft/components/closing-draft-dialog/ClosingDraftApprovalDialog.spec.d.ts} +0 -0
@@ -1,2025 +0,0 @@
1
- import { defineComponent as ut, ref as _, computed as S, watch as Me, createElementBlock as h, openBlock as d, Fragment as _e, createBlock as ae, createVNode as R, Teleport as Ct, Transition as Pt, withCtx as Se, createCommentVNode as I, createElementVNode as t, toDisplayString as p, unref as e, normalizeClass as O, renderList as We, createTextVNode as et, mergeModels as qt, useModel as Tt, resolveComponent as De, reactive as Bt, h as ve, nextTick as at, watchEffect as Ot, isRef as ft, normalizeStyle as vt, normalizeProps as yt, mergeProps as tt, guardReactiveProps as At } from "vue";
2
- import { u as nt, a as Nt, E as It, T as bt, U as ht, s as $t, V as Ne, q as zt, c as Mt, Q as st, x as Lt } from "./app-37NZKFUI.js";
3
- import { i as it, _ as Vt } from "./FmDateRangePickerChip.vue_vue_type_script_setup_true_lang-CmH3uhTZ.js";
4
- import { a as gt, d as Ut } from "./number-BkC_lelq.js";
5
- import { d as jt, e as ot, f as Ht, h as Yt, i as Qt, j as Wt, P as ct, k as Zt, a as Kt, _ as Jt, b as Xt, c as Gt, g as es } from "./TransferDetailsV3.vue_vue_type_script_setup_true_lang-DYAzxoHE.js";
6
- import { i as ts } from "./PremiumBadge.vue_vue_type_script_setup_true_lang-BZEa61go.js";
7
- import { d as Te } from "./dayjs.min-BKUldDi9.js";
8
- import { e as ss } from "./UnitDisplayControl.vue_vue_type_script_setup_true_lang-CLOotG6K.js";
9
- import { u as ns } from "./useTabStorage-BkIVScW_.js";
10
- import { u as as, _ as os } from "./SingleColumnLayout.vue_vue_type_script_setup_true_lang-DWsPvPE1.js";
11
- import { components as rs, useSnackbar as dt, useDialog as ls, useBreakpoints as is } from "@feedmepos/ui-library";
12
- import { c as us, u as cs, h as xt, _ as ds, a as ms, b as ps } from "./EmailDialog.vue_vue_type_script_setup_true_lang-DdzV_fzq.js";
13
- import { useI18n as Ze, useCoreStore as Ft } from "@feedmepos/mf-common";
14
- import { u as St, a as fs } from "./supplier-C5X8p_vd.js";
15
- import { u as vs } from "./stock-BLYAJxMj.js";
16
- import { u as Rt } from "./SystemTrailDialog.vue_vue_type_script_setup_true_lang-QMUVuthC.js";
17
- import { b as Dt, a as ys } from "./format-unit-display-g95-VuYJ.js";
18
- import { P as bs } from "./inventory-core-dart.default-NpD15h63.js";
19
- import { _ as hs, F as Ye } from "./TableActionableRow.vue_vue_type_script_setup_true_lang-DAMpuZ1X.js";
20
- import { u as Et } from "./feature-B4BoCy_k.js";
21
- import { P as gs, J as xs, D as _s } from "./app-C39bYJmq.js";
22
- import { u as ws } from "./netsuite-R_NkLn5t.js";
23
- import { s as _t, f as ks } from "./predefined-templates-CVT54o4V.js";
24
- import { d as Cs, t as Fs } from "./date2-r4KgBCs9.js";
25
- import { F as wt } from "./form-mode.enum-BKiNVH6A.js";
26
- import { p as Ss } from "./format-time-from-id-Dhjn5QgH.js";
27
- const Rs = {
28
- key: 0,
29
- class: "fixed inset-0 z-[200] bg-white flex flex-col overflow-hidden",
30
- style: { "font-family": "Inter, sans-serif" }
31
- }, Ds = {
32
- key: 0,
33
- class: "flex items-center justify-between px-24 h-[64px] border-b border-[#F0F0F0] shrink-0 bg-white"
34
- }, Es = { class: "fm-typo-en-title-md-800 text-[#1C1C1E]" }, Ps = { class: "flex items-center gap-8" }, qs = {
35
- key: 1,
36
- class: "flex items-center justify-center px-32 py-16 border-b border-[#F0F0F0] shrink-0 bg-white"
37
- }, Ts = { class: "flex items-center max-w-[600px] w-full" }, Bs = ["disabled"], Os = { key: 1 }, As = ["disabled"], Ns = { key: 1 }, Is = {
38
- class: "flex flex-col items-center gap-4 min-w-0",
39
- disabled: !0
40
- }, $s = { class: "flex flex-1 overflow-hidden" }, zs = { class: "flex-1 min-w-0 overflow-y-auto" }, Ms = {
41
- key: 0,
42
- class: "px-32 py-24"
43
- }, Ls = { class: "flex flex-col gap-4 mb-10" }, Vs = { class: "fm-typo-en-title-sm-700 text-[#1C1C1E]" }, Us = { class: "fm-typo-en-body-md-400 text-[#4B4B4B]" }, js = { class: "mb-12" }, Hs = { class: "border border-[#E0E0E0] rounded-sm overflow-hidden bg-white" }, Ys = ["onClick"], Qs = { class: "w-32 h-32 rounded-full bg-[#F0F0F0] flex items-center justify-center shrink-0" }, Ws = { class: "fm-typo-en-body-xs text-[#6B6C70]" }, Zs = { class: "flex-1 min-w-0" }, Ks = { class: "fm-typo-en-body-md-600 text-[#1C1C1E]" }, Js = { class: "fm-typo-en-body-sm-400 text-[#6B6C70] truncate" }, Xs = { class: "text-[10px] leading-[12px] font-semibold text-[#6B6C70] bg-[#F6F7F8] px-4 py-1 rounded-[4px] uppercase tracking-[0.08em] shrink-0" }, Gs = {
44
- key: 0,
45
- class: "w-[8px] h-[8px] rounded-full bg-[#FF7823]"
46
- }, en = {
47
- key: 0,
48
- class: "py-40 text-center text-[#B2B3B6] fm-typo-en-body-md-400"
49
- }, tn = {
50
- key: 1,
51
- class: "px-32 py-24"
52
- }, sn = { class: "flex flex-col gap-4 mb-12" }, nn = { class: "fm-typo-en-title-sm-700 text-[#1C1C1E]" }, an = { class: "fm-typo-en-body-md-400 text-[#4B4B4B]" }, on = { class: "grid grid-cols-2 gap-12 mb-12" }, rn = { class: "flex items-start justify-between mb-12" }, ln = { class: "fm-typo-en-body-md-700 text-[#1C1C1E] mb-4" }, un = { class: "fm-typo-en-body-sm-400 text-[#6B6C70]" }, cn = { class: "flex items-start justify-between mb-12" }, dn = { class: "fm-typo-en-body-md-700 text-[#1C1C1E] mb-4" }, mn = { class: "fm-typo-en-body-sm-400 text-[#6B6C70]" }, pn = { class: "fm-typo-en-body-md-700 text-[#1C1C1E] mb-12" }, fn = { class: "mb-12" }, vn = { class: "border border-[#E0E0E0] rounded-xl overflow-hidden bg-white" }, yn = ["onClick"], bn = { class: "w-32 h-32 rounded-full bg-[#F0F0F0] flex items-center justify-center shrink-0" }, hn = { class: "fm-typo-en-body-xs-600 text-[#6B6C70]" }, gn = { class: "flex-1 min-w-0" }, xn = { class: "fm-typo-en-body-md-600 text-[#1C1C1E]" }, _n = { class: "fm-typo-en-body-sm-400 text-[#6B6C70] truncate" }, wn = { class: "text-[10px] leading-[12px] font-semibold text-[#6B6C70] bg-[#F6F7F8] px-4 py-1 rounded-[4px] uppercase tracking-[0.08em] shrink-0" }, kn = {
53
- key: 0,
54
- class: "w-[8px] h-[8px] rounded-full bg-[#FF7823]"
55
- }, Cn = {
56
- key: 0,
57
- class: "py-32 text-center text-[#B2B3B6] fm-typo-en-body-md-400"
58
- }, Fn = { class: "fm-typo-en-body-md-700 text-[#1C1C1E] mb-12" }, Sn = { class: "mb-12" }, Rn = {
59
- key: 0,
60
- class: "py-32 flex justify-center"
61
- }, Dn = {
62
- key: 1,
63
- class: "py-32 text-center text-[#B2B3B6] fm-typo-en-body-md-400"
64
- }, En = {
65
- key: 2,
66
- class: "flex flex-col gap-8"
67
- }, Pn = ["onClick"], qn = { class: "flex-1 min-w-0" }, Tn = { class: "fm-typo-en-body-md-600 text-[#1C1C1E] mb-2" }, Bn = { class: "fm-typo-en-body-sm-400 text-[#6B6C70]" }, On = {
68
- key: 0,
69
- class: "w-[8px] h-[8px] rounded-full bg-[#FF7823]"
70
- }, An = {
71
- key: 2,
72
- class: "px-32 py-24"
73
- }, Nn = { class: "flex flex-col gap-4 mb-12" }, In = { class: "fm-typo-en-title-sm-700 text-[#1C1C1E]" }, $n = { class: "w-[332px] shrink-0 border-l border-[#F0F0F0] overflow-y-auto bg-white" }, zn = { class: "p-4" }, Mn = { class: "flex flex-col gap-0 border border-[#E9EAEC] rounded-2xl bg-white overflow-hidden" }, Ln = { class: "px-10 py-5 border-b border-[#F0F0F0]" }, Vn = { class: "fm-typo-en-body-md-700 text-[#1C1C1E]" }, Un = { class: "flex flex-col gap-0.5 px-10 py-4 border-b border-[#F0F0F0]" }, jn = { class: "text-[11px] leading-[14px] font-medium text-[#6B6C70]" }, Hn = {
74
- key: 0,
75
- class: "text-[11px] leading-[14px] text-[#6B6C70]"
76
- }, Yn = { class: "flex flex-col gap-0.5 px-10 py-4 border-b border-[#F0F0F0]" }, Qn = { class: "text-[11px] leading-[14px] font-medium text-[#6B6C70]" }, Wn = { class: "flex flex-col gap-0.5 px-10 py-4 border-b border-[#F0F0F0]" }, Zn = { class: "text-[11px] leading-[14px] font-medium text-[#6B6C70]" }, Kn = {
77
- key: 0,
78
- class: "text-[11px] leading-[14px] text-[#6B6C70]"
79
- }, Jn = { class: "flex items-center justify-between gap-8 px-10 py-4" }, Xn = { class: "text-[15px] leading-[20px] font-semibold text-[#1C1C1E]" }, Gn = { class: "fm-typo-en-title-md-600" }, ea = { class: "flex flex-col gap-16" }, ta = { class: "fm-typo-en-body-md-400" }, sa = { class: "max-h-[300px] overflow-y-auto" }, na = { class: "list-disc pl-16" }, aa = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, oa = { class: "flex w-full gap-8 justify-end" }, ra = /* @__PURE__ */ ut({
80
- __name: "CreateTransferWizard",
81
- props: {
82
- show: { type: Boolean },
83
- lastClosingDate: {},
84
- selectedOutletIds: {}
85
- },
86
- emits: ["update:show", "submitted"],
87
- setup(oe, { emit: w }) {
88
- const { FmButton: $, FmDialog: V, FmIcon: H, FmTextField: D } = rs, Z = oe, re = w, { t: i } = Ze(), C = dt(), o = nt(), te = St(), ee = Nt(), we = vs(), P = Rt(), q = Dt(), y = _(0), ce = _(!1), Y = _(null), se = _(""), g = _(null), u = _(null), B = _(null), pe = _(""), de = _(""), K = _(!1), ye = _(!1), be = _(!1), fe = _(!1), Be = _(!1), Oe = _(/* @__PURE__ */ new Map()), Re = _(), le = _([]), he = S(() => !!Y.value), Ie = S(() => g.value === "transfer" ? !!u.value : g.value === "template" ? !!B.value : !1), ke = S(() => (le.value.length ? le.value : F.value.items ?? []).some((a) => a.quantity.amount > 0)), m = S(() => K.value), f = S(
89
- () => ke.value && ye.value && be.value && !K.value
90
- ), k = S(() => y.value === 0 ? he.value : y.value === 1 ? Ie.value : y.value === 2 ? f.value : !1), E = S(
91
- () => y.value === 2 ? i("inventory.transfer.receiveRequest.bulk.wizard.createTransferBtn") : i("inventory.transfer.receiveRequest.bulk.wizard.continueBtn")
92
- ), l = S(
93
- () => L.value === "Purchase" ? "Purchase method" : "Transfer method"
94
- ), r = S(
95
- () => L.value === "Purchase" ? "Purchase details" : "Transfer details"
96
- ), c = S(() => {
97
- const s = se.value.trim().toLowerCase();
98
- let a = o.locations;
99
- return Z.selectedOutletIds && Z.selectedOutletIds.length > 0 && (a = a.filter((n) => Z.selectedOutletIds.includes(n.doc._id))), s ? a.filter(
100
- (n) => n.name.toLowerCase().includes(s) || (n.doc.profile.code ?? "").toLowerCase().includes(s)
101
- ) : a;
102
- }), b = S(() => {
103
- var ue;
104
- const s = (ue = Y.value) == null ? void 0 : ue.doc._id, a = te.suppliers.map((X) => ({
105
- doc: X,
106
- name: X.name,
107
- dbName: "",
108
- type: "supplier",
109
- acceptRequest: !0
110
- })), Q = [...o.allLocations ?? o.locations, ...a].filter((X) => X.doc._id !== s), W = pe.value.trim().toLowerCase();
111
- return W ? Q.filter((X) => {
112
- var He;
113
- const qe = X.type === "supplier" ? "" : ((He = X.doc.profile) == null ? void 0 : He.code) ?? "";
114
- return X.name.toLowerCase().includes(W) || qe.toLowerCase().includes(W);
115
- }) : Q;
116
- }), v = S(() => {
117
- const s = de.value.trim().toLowerCase(), a = q.templates;
118
- return s ? a.filter((n) => n.name.toLowerCase().includes(s)) : a;
119
- }), L = S(() => {
120
- var s;
121
- if (F.value.supplier)
122
- return typeof F.value.supplier.internal == "string" ? "Transfer" : "Purchase";
123
- if (g.value === "transfer" && u.value)
124
- return u.value.type === "supplier" ? "Purchase" : "Transfer";
125
- if (g.value === "template" && B.value) {
126
- const a = q.templates.find((n) => n._id === B.value);
127
- if ((s = a == null ? void 0 : a.purchaseOrder) != null && s.supplier)
128
- return typeof a.purchaseOrder.supplier.internal == "string" ? "Transfer" : "Purchase";
129
- }
130
- return "Transfer";
131
- }), A = S(() => Y.value ? Y.value.name : i("inventory.transfer.receiveRequest.bulk.wizard.notSelected")), z = S(() => g.value === "transfer" ? L.value === "Purchase" ? "Purchase from Supplier" : i("inventory.transfer.receiveRequest.bulk.wizard.outletToOutletMethod") : g.value === "template" ? i("inventory.transfer.receiveRequest.bulk.wizard.fromTemplateMethod") : i("inventory.transfer.receiveRequest.bulk.wizard.notChosen")), J = S(() => {
132
- var s;
133
- if (g.value === "transfer" && u.value)
134
- return u.value.name;
135
- if (g.value === "template" && B.value) {
136
- const a = q.templates.find((n) => n._id === B.value);
137
- return (s = a == null ? void 0 : a.purchaseOrder) != null && s.supplier ? a.purchaseOrder.supplier.name || B.value : (a == null ? void 0 : a.name) ?? B.value;
138
- }
139
- return i("inventory.transfer.receiveRequest.bulk.wizard.noneYet");
140
- });
141
- function me(s) {
142
- var Q, W, ue, X, qe;
143
- const a = (Q = s.doc.profile) != null && Q.code ? `#${s.doc.profile.code}` : "", n = [(ue = (W = s.doc.profile) == null ? void 0 : W.address) == null ? void 0 : ue.line1, (qe = (X = s.doc.profile) == null ? void 0 : X.address) == null ? void 0 : qe.city].filter(Boolean).join(" · ");
144
- return [a, n].filter(Boolean).join(" · ");
145
- }
146
- function T(s) {
147
- var n, Q;
148
- return [(n = s.doc.address) == null ? void 0 : n.line1, (Q = s.doc.address) == null ? void 0 : Q.city].filter(Boolean).join(" · ");
149
- }
150
- function U(s) {
151
- var a;
152
- return s.type === "supplier" ? "" : ((a = s.doc.profile) == null ? void 0 : a.code) ?? "";
153
- }
154
- function G(s) {
155
- var a, n, Q, W, ue, X;
156
- return s.type === "supplier" ? [(a = s.doc.address) == null ? void 0 : a.line1, (n = s.doc.address) == null ? void 0 : n.city].filter(Boolean).join(" · ") : [(W = (Q = s.doc.profile) == null ? void 0 : Q.address) == null ? void 0 : W.line1, (X = (ue = s.doc.profile) == null ? void 0 : ue.address) == null ? void 0 : X.city].filter(Boolean).join(" · ");
157
- }
158
- const ie = S(
159
- () => Y.value ? me(Y.value) : ""
160
- ), ge = S(
161
- () => g.value === "transfer" && u.value ? u.value.type === "supplier" ? T(u.value) : me(u.value) : ""
162
- ), Ce = S(() => {
163
- const a = (le.value.length ? le.value : F.value.items ?? []).filter((n) => n.quantity.amount > 0).length;
164
- return a === 0 ? i("inventory.transfer.receiveRequest.bulk.wizard.noneYet") : `${a} ${a === 1 ? "item" : "items"}`;
165
- });
166
- function x(s) {
167
- var n;
168
- const a = (n = s.purchaseOrder) == null ? void 0 : n.supplier;
169
- return a ? a.internal === "warehouse" ? `Transfer from ${a.name}` : a.internal === "restaurant" ? `Transfer from ${a.name}` : `Purchase from ${a.name}` : "";
170
- }
171
- function j(s) {
172
- return {
173
- _id: s.doc._id,
174
- internal: s.type,
175
- contactName: s.doc.profile.name,
176
- name: s.doc.profile.name ?? "",
177
- email: s.doc.profile.email,
178
- phoneNumber: s.doc.profile.phoneNo,
179
- registrationNumber: s.doc.profile.regNo ?? "",
180
- address: s.doc.profile.address ?? {
181
- line1: "",
182
- state: "",
183
- city: "",
184
- postcode: "",
185
- country: ""
186
- }
187
- };
188
- }
189
- function N(s) {
190
- return {
191
- _id: s._id,
192
- internal: void 0,
193
- contactName: s.contactName,
194
- name: s.name ?? "",
195
- email: s.email,
196
- phoneNumber: s.phoneNumber,
197
- registrationNumber: s.registrationNumber ?? "",
198
- supplyItems: s.supplyItems,
199
- _rev: s._rev,
200
- address: s.address ?? {
201
- line2: void 0,
202
- line1: "",
203
- state: "",
204
- city: "",
205
- postcode: "",
206
- country: ""
207
- }
208
- };
209
- }
210
- function M() {
211
- var Q;
212
- const s = B.value ? q.templates.find((W) => W._id === B.value) : void 0, a = {
213
- _rev: void 0,
214
- email: void 0,
215
- internal: void 0,
216
- contactName: void 0,
217
- phoneNumber: void 0,
218
- registrationNumber: "",
219
- supplyItems: void 0,
220
- _id: "",
221
- name: "",
222
- address: { line2: void 0, line1: "", state: "", city: "", postcode: "", country: "" }
223
- }, n = g.value === "transfer" && u.value ? u.value.type === "supplier" ? N(u.value.doc) : j(u.value) : g.value === "template" && (s != null && s.purchaseOrder.supplier) ? s.purchaseOrder.supplier : a;
224
- return {
225
- remark: void 0,
226
- ref: void 0,
227
- stockSnapshotId: void 0,
228
- effectiveAt: void 0,
229
- items: g.value === "template" && ((Q = s == null ? void 0 : s.purchaseOrder) != null && Q.items) ? s.purchaseOrder.items : [],
230
- supplier: n,
231
- status: "DRAFT",
232
- _id: "",
233
- seqNumber: 0,
234
- deliveryOrder: [],
235
- template: B.value ?? void 0,
236
- templateDoc: s
237
- };
238
- }
239
- const F = _(M()), ne = _(`${Math.random()}`), Fe = S(
240
- () => {
241
- var s;
242
- return ((s = F.value.items) == null ? void 0 : s.filter((a) => a.quantity.amount === 0)) ?? [];
243
- }
244
- );
245
- Me(
246
- () => Z.show,
247
- (s) => {
248
- if (s && (y.value = 0, ce.value = !1, Y.value = null, g.value = null, u.value = null, B.value = null, se.value = "", pe.value = "", de.value = "", ye.value = !1, be.value = !1, le.value = [], F.value = M(), ne.value = `${Math.random()}`, q.fetchTemplates(), Z.selectedOutletIds && Z.selectedOutletIds.length === 1)) {
249
- const a = o.locations.find(
250
- (n) => n.doc._id === Z.selectedOutletIds[0]
251
- );
252
- a && (Y.value = a, o._currentLocation = a, Ue(), Ae(), y.value = 1);
253
- }
254
- }
255
- );
256
- function $e() {
257
- if (y.value === 0) {
258
- if (!Y.value) return;
259
- o._currentLocation = Y.value, Ue(), Ae(), y.value = 1;
260
- } else if (y.value === 1) {
261
- if (!Ie.value) return;
262
- F.value = M(), ne.value = `${Math.random()}`, le.value = [], y.value = 2;
263
- } else y.value === 2 && Je();
264
- }
265
- function Le() {
266
- y.value > 0 && y.value--;
267
- }
268
- function xe(s) {
269
- s < y.value && (y.value = s);
270
- }
271
- function Ve() {
272
- re("update:show", !1);
273
- }
274
- function Ee(s) {
275
- g.value !== s && (g.value = s, u.value = null, B.value = null, le.value = [], F.value = {
276
- ...F.value,
277
- items: [],
278
- template: void 0,
279
- templateDoc: void 0
280
- });
281
- }
282
- function Pe(s) {
283
- le.value = s ?? [];
284
- }
285
- Me(B, (s) => {
286
- g.value === "template" && s && (F.value = M(), ne.value = `${Math.random()}`);
287
- });
288
- async function Ue() {
289
- ye.value = !1;
290
- try {
291
- await te.readSuppliers(), ye.value = !0;
292
- } catch {
293
- C.open({
294
- title: i("inventory.transfer.form.unableToFetchListOfSuppliers.title"),
295
- message: i("inventory.transfer.form.unableToFetchListOfSuppliers.message"),
296
- type: "error"
297
- });
298
- }
299
- }
300
- async function Ae() {
301
- Be.value = !0, Oe.value = /* @__PURE__ */ new Map();
302
- try {
303
- const s = await we.readStockBalance(), a = /* @__PURE__ */ new Map();
304
- for (const n of s.skus ?? [])
305
- a.set(n.id, n);
306
- Oe.value = a;
307
- } catch {
308
- } finally {
309
- Be.value = !1;
310
- }
311
- }
312
- function Ke() {
313
- var s;
314
- (s = Re.value) != null && s.getFormData && (F.value = { ...F.value, ...Re.value.getFormData() });
315
- }
316
- function Je() {
317
- if (Ke(), Fe.value.length > 0) {
318
- fe.value = !0;
319
- return;
320
- }
321
- je();
322
- }
323
- function Xe() {
324
- var s;
325
- F.value.items = ((s = F.value.items) == null ? void 0 : s.filter((a) => a.quantity.amount > 0)) ?? [], fe.value = !1, je();
326
- }
327
- function je() {
328
- var n, Q;
329
- const s = bs.validatePurchaseOrderItems({
330
- skusById: ee.skuById ?? {},
331
- items: F.value.items ?? []
332
- }), a = Object.values(s).flat();
333
- if (a.length > 0) {
334
- const W = a[0];
335
- C.open({
336
- title: `[Row ${W.index + 1}] "${W.poItem.sku.name}"`,
337
- message: `${W.message}`,
338
- type: "error"
339
- });
340
- return;
341
- }
342
- (Q = (n = Re.value) == null ? void 0 : n.validateInputs) == null || Q.call(n);
343
- }
344
- async function ze() {
345
- const s = F.value;
346
- if (K.value = !0, s.items = s.items.filter((a) => a.quantity.amount > 0), !s.items.length) {
347
- C.open({
348
- title: "Cannot create order",
349
- message: "There are no items with non-zero amount in your request.",
350
- type: "error"
351
- }), K.value = !1;
352
- return;
353
- }
354
- (s.supplier.internal === "warehouse" || s.supplier.internal === "restaurant") && (s.items = s.items.map(({ totalCost: a, ...n }) => n));
355
- try {
356
- await P.createPurchaseOrder(s), C.open({
357
- title: i("inventory.transfer.receiveRequest.create.success"),
358
- message: i("inventory.transfer.receiveRequest.create.successMessage"),
359
- type: "success"
360
- }), re("submitted"), re("update:show", !1), Ge();
361
- } catch (a) {
362
- C.open({
363
- title: i("inventory.transfer.receiveRequest.create.error.title"),
364
- message: i("inventory.transfer.receiveRequest.create.error.message"),
365
- type: "error"
366
- }), console.error("Error creating purchase order", a);
367
- } finally {
368
- K.value = !1;
369
- }
370
- }
371
- function Ge() {
372
- y.value = 0, ce.value = !1, Y.value = null, g.value = null, u.value = null, B.value = null, se.value = "", pe.value = "", de.value = "", ye.value = !1, be.value = !1, le.value = [], F.value = M(), ne.value = `${Math.random()}`;
373
- }
374
- return (s, a) => (d(), h(_e, null, [
375
- (d(), ae(Ct, { to: "body" }, [
376
- R(Pt, {
377
- "enter-active-class": "transition-opacity duration-150 ease-out",
378
- "enter-from-class": "opacity-0",
379
- "enter-to-class": "opacity-100",
380
- "leave-active-class": "transition-opacity duration-120 ease-in",
381
- "leave-from-class": "opacity-100",
382
- "leave-to-class": "opacity-0"
383
- }, {
384
- default: Se(() => [
385
- s.show ? (d(), h("div", Rs, [
386
- ce.value ? I("", !0) : (d(), h("div", Ds, [
387
- t("span", Es, p(e(i)("inventory.transfer.receiveRequest.bulk.wizard.title")), 1),
388
- t("div", Ps, [
389
- R(e($), {
390
- variant: "tertiary",
391
- size: "md",
392
- label: e(i)("inventory.transfer.receiveRequest.bulk.wizard.cancelBtn"),
393
- onClick: Ve
394
- }, null, 8, ["label"]),
395
- y.value > 0 ? (d(), ae(e($), {
396
- key: 0,
397
- variant: "secondary",
398
- size: "md",
399
- "prepend-icon": "arrow_back",
400
- label: e(i)("inventory.transfer.receiveRequest.bulk.wizard.backBtn"),
401
- onClick: Le
402
- }, null, 8, ["label"])) : I("", !0),
403
- R(e($), {
404
- size: "md",
405
- disabled: !k.value,
406
- loading: K.value,
407
- label: E.value,
408
- onClick: $e
409
- }, null, 8, ["disabled", "loading", "label"])
410
- ])
411
- ])),
412
- ce.value ? I("", !0) : (d(), h("div", qs, [
413
- t("div", Ts, [
414
- t("button", {
415
- class: "flex flex-col items-center gap-4 min-w-0 group",
416
- disabled: y.value <= 0,
417
- onClick: a[0] || (a[0] = (n) => xe(0))
418
- }, [
419
- t("div", {
420
- class: O([
421
- "w-32 h-32 rounded-full flex items-center justify-center text-sm font-semibold transition-colors duration-150",
422
- y.value > 0 || y.value === 0 ? "bg-[#FF7823] text-white" : "bg-[#F0F0F0] text-[#6B6C70]"
423
- ])
424
- }, [
425
- y.value > 0 ? (d(), ae(e(H), {
426
- key: 0,
427
- name: "check",
428
- size: "sm"
429
- })) : (d(), h("span", Os, "1"))
430
- ], 2),
431
- t("span", {
432
- class: O(["fm-typo-en-body-xs-500 whitespace-nowrap transition-colors duration-150", y.value >= 0 ? "text-[#1C1C1E]" : "text-[#B2B3B6]"])
433
- }, " Select destination ", 2)
434
- ], 8, Bs),
435
- t("div", {
436
- class: O(["flex-1 h-1 mx-8 transition-colors duration-200", y.value > 0 ? "bg-[#FF7823]" : "bg-[#E0E0E0]"])
437
- }, null, 2),
438
- t("button", {
439
- class: "flex flex-col items-center gap-4 min-w-0 group",
440
- disabled: y.value <= 1,
441
- onClick: a[1] || (a[1] = (n) => xe(1))
442
- }, [
443
- t("div", {
444
- class: O([
445
- "w-32 h-32 rounded-full flex items-center justify-center text-sm font-semibold transition-colors duration-150",
446
- y.value > 1 || y.value === 1 ? "bg-[#FF7823] text-white" : "bg-[#F0F0F0] text-[#6B6C70]"
447
- ])
448
- }, [
449
- y.value > 1 ? (d(), ae(e(H), {
450
- key: 0,
451
- name: "check",
452
- size: "sm"
453
- })) : (d(), h("span", Ns, "2"))
454
- ], 2),
455
- t("span", {
456
- class: O(["fm-typo-en-body-xs-500 whitespace-nowrap transition-colors duration-150", y.value >= 1 ? "text-[#1C1C1E]" : "text-[#B2B3B6]"])
457
- }, p(l.value), 3)
458
- ], 8, As),
459
- t("div", {
460
- class: O(["flex-1 h-1 mx-8 transition-colors duration-200", y.value > 1 ? "bg-[#FF7823]" : "bg-[#E0E0E0]"])
461
- }, null, 2),
462
- t("button", Is, [
463
- t("div", {
464
- class: O([
465
- "w-32 h-32 rounded-full flex items-center justify-center text-sm font-semibold transition-colors duration-150",
466
- y.value === 2 ? "bg-[#FF7823] text-white" : "bg-[#F0F0F0] text-[#6B6C70]"
467
- ])
468
- }, a[11] || (a[11] = [
469
- t("span", null, "3", -1)
470
- ]), 2),
471
- t("span", {
472
- class: O(["fm-typo-en-body-xs-500 whitespace-nowrap transition-colors duration-150", y.value >= 2 ? "text-[#1C1C1E]" : "text-[#B2B3B6]"])
473
- }, p(r.value), 3)
474
- ])
475
- ])
476
- ])),
477
- t("div", $s, [
478
- t("div", zs, [
479
- y.value === 0 ? (d(), h("div", Ms, [
480
- t("div", Ls, [
481
- t("h3", Vs, p(e(i)("inventory.transfer.receiveRequest.bulk.wizard.step1Heading")), 1),
482
- t("p", Us, p(e(i)("inventory.transfer.receiveRequest.bulk.wizard.step1Desc")), 1)
483
- ]),
484
- t("div", js, [
485
- R(e(D), {
486
- "model-value": se.value,
487
- "onUpdate:modelValue": a[2] || (a[2] = (n) => se.value = n),
488
- "prepend-icon": "search",
489
- placeholder: e(i)("inventory.transfer.receiveRequest.bulk.wizard.step1SearchPlaceholder")
490
- }, null, 8, ["model-value", "placeholder"])
491
- ]),
492
- t("div", Hs, [
493
- (d(!0), h(_e, null, We(c.value, (n, Q) => {
494
- var W, ue, X, qe, He, mt, pt;
495
- return d(), h("div", {
496
- key: n.dbName,
497
- class: O(["flex items-center gap-8 px-12 h-[67px] cursor-pointer transition-colors duration-150", [
498
- ((W = Y.value) == null ? void 0 : W.dbName) === n.dbName ? "bg-[#FFF5EE]" : "hover:bg-[#FAFAFA]",
499
- Q > 0 ? "border-t border-[#F0F0F0]" : ""
500
- ]]),
501
- onClick: (Ta) => Y.value = n
502
- }, [
503
- t("div", Qs, [
504
- t("span", Ws, p(n.name.slice(0, 2).toUpperCase()), 1)
505
- ]),
506
- t("div", Zs, [
507
- t("div", Ks, p(n.name), 1),
508
- t("div", Js, [
509
- et(p(n.doc.profile.code ? `#${n.doc.profile.code}` : e(i)("inventory.transfer.receiveRequest.bulk.wizard.noCode")) + " ", 1),
510
- (ue = n.doc.profile.address) != null && ue.line1 || (X = n.doc.profile.address) != null && X.city ? (d(), h(_e, { key: 0 }, [
511
- et(" · " + p([(qe = n.doc.profile.address) == null ? void 0 : qe.line1, (He = n.doc.profile.address) == null ? void 0 : He.city].filter(Boolean).join(" · ")), 1)
512
- ], 64)) : I("", !0)
513
- ])
514
- ]),
515
- t("span", Xs, p(n.type === "warehouse" ? "Warehouse" : "Restaurant"), 1),
516
- t("div", {
517
- class: O([
518
- "w-[18px] h-[18px] rounded-full border flex items-center justify-center shrink-0 transition-colors duration-150",
519
- ((mt = Y.value) == null ? void 0 : mt.dbName) === n.dbName ? "border-[#FF7823]" : "border-[#CCCCCC]"
520
- ])
521
- }, [
522
- ((pt = Y.value) == null ? void 0 : pt.dbName) === n.dbName ? (d(), h("div", Gs)) : I("", !0)
523
- ], 2)
524
- ], 10, Ys);
525
- }), 128)),
526
- c.value.length === 0 ? (d(), h("div", en, p(e(i)("inventory.transfer.receiveRequest.bulk.wizard.noOutletsAvailable")), 1)) : I("", !0)
527
- ])
528
- ])) : I("", !0),
529
- y.value === 1 ? (d(), h("div", tn, [
530
- t("div", sn, [
531
- t("h3", nn, p(e(i)("inventory.transfer.receiveRequest.bulk.wizard.step2Heading")), 1),
532
- t("p", an, p(e(i)("inventory.transfer.receiveRequest.bulk.wizard.step2Desc")), 1)
533
- ]),
534
- t("div", on, [
535
- t("div", {
536
- class: O([
537
- "border rounded-xl p-16 cursor-pointer transition-all duration-150 flex flex-col",
538
- g.value === "transfer" ? "border-[#FF7823] bg-[#FFF5EE]" : "border-[#E0E0E0] bg-white hover:bg-[#FAFAFA]"
539
- ]),
540
- onClick: a[3] || (a[3] = (n) => Ee("transfer"))
541
- }, [
542
- t("div", rn, [
543
- t("div", {
544
- class: O(["w-36 h-36 rounded-xl flex items-center justify-center shrink-0", g.value === "transfer" ? "bg-[#FF7823]" : "bg-[#F0F0F0]"])
545
- }, [
546
- R(e(H), {
547
- name: "swap_horiz",
548
- size: "md",
549
- class: O(g.value === "transfer" ? "text-white" : "text-[#6B6C70]")
550
- }, null, 8, ["class"])
551
- ], 2),
552
- t("div", {
553
- class: O(["w-16 h-16 rounded-full flex items-center justify-center shrink-0", g.value === "transfer" ? "bg-[#FF7823]" : "border border-[#CCCCCC]"])
554
- }, [
555
- g.value === "transfer" ? (d(), ae(e(H), {
556
- key: 0,
557
- name: "check",
558
- size: "sm",
559
- class: "text-white"
560
- })) : I("", !0)
561
- ], 2)
562
- ]),
563
- t("div", ln, p(e(i)("inventory.transfer.receiveRequest.bulk.wizard.outletToOutlet")), 1),
564
- t("div", un, p(e(i)("inventory.transfer.receiveRequest.bulk.wizard.outletToOutletDesc")), 1)
565
- ], 2),
566
- t("div", {
567
- class: O([
568
- "border rounded-xl p-16 cursor-pointer transition-all duration-150 flex flex-col",
569
- g.value === "template" ? "border-[#FF7823] bg-[#FFF5EE]" : "border-[#E0E0E0] bg-white hover:bg-[#FAFAFA]"
570
- ]),
571
- onClick: a[4] || (a[4] = (n) => Ee("template"))
572
- }, [
573
- t("div", cn, [
574
- t("div", {
575
- class: O(["w-36 h-36 rounded-xl flex items-center justify-center shrink-0", g.value === "template" ? "bg-[#FF7823]" : "bg-[#F0F0F0]"])
576
- }, [
577
- R(e(H), {
578
- name: "description",
579
- size: "md",
580
- class: O(g.value === "template" ? "text-white" : "text-[#6B6C70]")
581
- }, null, 8, ["class"])
582
- ], 2),
583
- t("div", {
584
- class: O(["w-16 h-16 rounded-full flex items-center justify-center shrink-0", g.value === "template" ? "bg-[#FF7823]" : "border border-[#CCCCCC]"])
585
- }, [
586
- g.value === "template" ? (d(), ae(e(H), {
587
- key: 0,
588
- name: "check",
589
- size: "sm",
590
- class: "text-white"
591
- })) : I("", !0)
592
- ], 2)
593
- ]),
594
- t("div", dn, p(e(i)("inventory.transfer.receiveRequest.bulk.wizard.fromTemplate")), 1),
595
- t("div", mn, p(e(i)("inventory.transfer.receiveRequest.bulk.wizard.fromTemplateDesc")), 1)
596
- ], 2)
597
- ]),
598
- g.value === "transfer" ? (d(), h(_e, { key: 0 }, [
599
- t("div", pn, p(e(i)("inventory.transfer.receiveRequest.bulk.wizard.step2SourceHeading")), 1),
600
- t("div", fn, [
601
- R(e(D), {
602
- "model-value": pe.value,
603
- "onUpdate:modelValue": a[5] || (a[5] = (n) => pe.value = n),
604
- "prepend-icon": "search",
605
- placeholder: e(i)(
606
- "inventory.transfer.receiveRequest.bulk.wizard.step2SearchSourcePlaceholder"
607
- )
608
- }, null, 8, ["model-value", "placeholder"])
609
- ]),
610
- t("div", vn, [
611
- (d(!0), h(_e, null, We(b.value, (n, Q) => {
612
- var W, ue, X;
613
- return d(), h("div", {
614
- key: n.dbName,
615
- class: O(["flex items-center gap-8 px-12 h-[67px] cursor-pointer transition-colors duration-150", [
616
- ((W = u.value) == null ? void 0 : W.doc._id) === n.doc._id ? "bg-[#FFF5EE]" : "hover:bg-[#FAFAFA]",
617
- Q > 0 ? "border-t border-[#F0F0F0]" : ""
618
- ]]),
619
- onClick: (qe) => u.value = n
620
- }, [
621
- t("div", bn, [
622
- t("span", hn, p(n.name.slice(0, 2).toUpperCase()), 1)
623
- ]),
624
- t("div", gn, [
625
- t("div", xn, p(n.name), 1),
626
- t("div", _n, [
627
- et(p(U(n) ? `#${U(n)}` : e(i)("inventory.transfer.receiveRequest.bulk.wizard.noCode")) + " ", 1),
628
- G(n) ? (d(), h(_e, { key: 0 }, [
629
- et(" · " + p(G(n)), 1)
630
- ], 64)) : I("", !0)
631
- ])
632
- ]),
633
- t("span", wn, p(n.type === "warehouse" ? "Warehouse" : n.type === "supplier" ? "Supplier" : "Restaurant"), 1),
634
- t("div", {
635
- class: O([
636
- "w-[18px] h-[18px] rounded-full border flex items-center justify-center shrink-0 transition-colors duration-150",
637
- ((ue = u.value) == null ? void 0 : ue.doc._id) === n.doc._id ? "border-[#FF7823]" : "border-[#CCCCCC]"
638
- ])
639
- }, [
640
- ((X = u.value) == null ? void 0 : X.doc._id) === n.doc._id ? (d(), h("div", kn)) : I("", !0)
641
- ], 2)
642
- ], 10, yn);
643
- }), 128)),
644
- b.value.length === 0 ? (d(), h("div", Cn, p(e(i)("inventory.transfer.receiveRequest.bulk.wizard.noOutletsAvailable")), 1)) : I("", !0)
645
- ])
646
- ], 64)) : I("", !0),
647
- g.value === "template" ? (d(), h(_e, { key: 1 }, [
648
- t("div", Fn, p(e(i)("inventory.transfer.receiveRequest.bulk.wizard.step2TemplateHeading")), 1),
649
- t("div", Sn, [
650
- R(e(D), {
651
- "model-value": de.value,
652
- "onUpdate:modelValue": a[6] || (a[6] = (n) => de.value = n),
653
- "prepend-icon": "search",
654
- placeholder: e(i)(
655
- "inventory.transfer.receiveRequest.bulk.wizard.step2SearchTemplatePlaceholder"
656
- )
657
- }, null, 8, ["model-value", "placeholder"])
658
- ]),
659
- e(q).loading ? (d(), h("div", Rn, [
660
- R(e(H), {
661
- name: "progress_activity",
662
- class: "text-[#FF7823] animate-spin"
663
- })
664
- ])) : v.value.length === 0 ? (d(), h("div", Dn, p(e(i)("inventory.transfer.receiveRequest.bulk.wizard.noTemplatesAvailable")), 1)) : (d(), h("div", En, [
665
- (d(!0), h(_e, null, We(v.value, (n) => (d(), h("div", {
666
- key: n._id,
667
- class: O([
668
- "border rounded-lg px-16 py-12 cursor-pointer transition-all duration-150 flex items-center gap-12",
669
- B.value === n._id ? "border-[#FF7823] bg-[#FFF5EE]" : "border-[#E0E0E0] bg-white hover:bg-[#FAFAFA]"
670
- ]),
671
- onClick: (Q) => B.value = n._id
672
- }, [
673
- t("div", qn, [
674
- t("div", Tn, p(n.name), 1),
675
- t("div", Bn, p(x(n)) + " · " + p(n.purchaseOrder.items.length) + " items ", 1)
676
- ]),
677
- t("div", {
678
- class: O([
679
- "w-[18px] h-[18px] rounded-full border flex items-center justify-center shrink-0 transition-colors duration-150",
680
- B.value === n._id ? "border-[#FF7823]" : "border-[#CCCCCC]"
681
- ])
682
- }, [
683
- B.value === n._id ? (d(), h("div", On)) : I("", !0)
684
- ], 2)
685
- ], 10, Pn))), 128))
686
- ]))
687
- ], 64)) : I("", !0)
688
- ])) : I("", !0),
689
- y.value === 2 ? (d(), h("div", An, [
690
- t("div", Nn, [
691
- t("h3", In, p(r.value), 1)
692
- ]),
693
- (d(), ae(us, {
694
- ref_key: "formRef",
695
- ref: Re,
696
- class: "w-full",
697
- "onForm:ready": a[7] || (a[7] = () => be.value = !0),
698
- "onForm:dataChange": Pe,
699
- onValidationSuccess: ze,
700
- modelValue: F.value,
701
- "onUpdate:modelValue": a[8] || (a[8] = (n) => F.value = n),
702
- disabled: m.value,
703
- "locked-supplier": F.value.supplier,
704
- suppliers: e(te).suppliers,
705
- skus: e(ee).skus,
706
- key: ne.value,
707
- "last-closing-date": s.lastClosingDate,
708
- "sku-balance-map": Oe.value,
709
- "is-balance-loading": Be.value
710
- }, null, 8, ["modelValue", "disabled", "locked-supplier", "suppliers", "skus", "last-closing-date", "sku-balance-map", "is-balance-loading"]))
711
- ])) : I("", !0)
712
- ]),
713
- t("div", $n, [
714
- t("div", zn, [
715
- t("div", Mn, [
716
- t("div", Ln, [
717
- t("div", Vn, p(e(i)("inventory.transfer.receiveRequest.bulk.wizard.summaryTitle")), 1)
718
- ]),
719
- t("div", Un, [
720
- t("span", jn, p(e(i)("inventory.transfer.receiveRequest.bulk.wizard.summaryDestination")), 1),
721
- t("span", {
722
- class: O(["text-[15px] leading-[20px] font-semibold transition-colors duration-200", Y.value ? "text-[#1C1C1E]" : "text-[#B2B3B6]"])
723
- }, p(A.value), 3),
724
- ie.value ? (d(), h("span", Hn, p(ie.value), 1)) : I("", !0)
725
- ]),
726
- t("div", Yn, [
727
- t("span", Qn, p(e(i)("inventory.transfer.receiveRequest.bulk.wizard.summaryMethod")), 1),
728
- t("span", {
729
- class: O(["text-[15px] leading-[20px] font-semibold transition-colors duration-200", g.value ? "text-[#1C1C1E]" : "text-[#B2B3B6]"])
730
- }, p(z.value), 3)
731
- ]),
732
- t("div", Wn, [
733
- t("span", Zn, p(e(i)("inventory.transfer.receiveRequest.bulk.wizard.summarySource")), 1),
734
- t("span", {
735
- class: O([
736
- "text-[15px] leading-[20px] font-semibold transition-colors duration-200",
737
- u.value || B.value ? "text-[#1C1C1E]" : "text-[#B2B3B6]"
738
- ])
739
- }, p(J.value), 3),
740
- ge.value ? (d(), h("span", Kn, p(ge.value), 1)) : I("", !0)
741
- ]),
742
- t("div", Jn, [
743
- t("span", Xn, p(e(i)("inventory.transfer.receiveRequest.bulk.wizard.summaryItems")), 1),
744
- t("span", {
745
- class: O(["text-[15px] leading-[20px] font-medium transition-colors duration-200", ke.value ? "text-[#1C1C1E]" : "text-[#6B6C70]"])
746
- }, p(Ce.value), 3)
747
- ])
748
- ])
749
- ])
750
- ])
751
- ])
752
- ])) : I("", !0)
753
- ]),
754
- _: 1
755
- })
756
- ])),
757
- R(e(V), {
758
- modelValue: fe.value,
759
- "onUpdate:modelValue": a[10] || (a[10] = (n) => fe.value = n),
760
- overlay: !0
761
- }, {
762
- "dialog-header": Se(() => [
763
- t("div", Gn, p(e(i)("inventory.transfer.template.zeroQuantity.title")), 1)
764
- ]),
765
- "dialog-footer": Se(() => [
766
- t("div", oa, [
767
- R(e($), {
768
- label: e(i)("common.cancel"),
769
- variant: "tertiary",
770
- size: "md",
771
- onClick: a[9] || (a[9] = (n) => fe.value = !1)
772
- }, null, 8, ["label"]),
773
- R(e($), {
774
- label: e(i)("inventory.transfer.template.zeroQuantity.removeAll"),
775
- variant: "primary",
776
- size: "md",
777
- "prepend-icon": "delete",
778
- onClick: Xe
779
- }, null, 8, ["label"])
780
- ])
781
- ]),
782
- default: Se(() => [
783
- t("div", ea, [
784
- t("div", ta, p(e(i)("inventory.transfer.template.zeroQuantity.message", {
785
- count: Fe.value.length
786
- })), 1),
787
- t("div", sa, [
788
- t("ul", na, [
789
- (d(!0), h(_e, null, We(Fe.value, (n) => (d(), h("li", {
790
- key: n.sku._id,
791
- class: "fm-typo-en-body-md-400"
792
- }, p(n.sku.name) + " (" + p(n.sku.code) + ") ", 1))), 128))
793
- ])
794
- ]),
795
- t("div", aa, p(e(i)("inventory.transfer.template.zeroQuantity.prompt")), 1)
796
- ])
797
- ]),
798
- _: 1
799
- }, 8, ["modelValue"])
800
- ], 64));
801
- }
802
- }), la = /* @__PURE__ */ ut({
803
- __name: "MultiLocationSelector",
804
- props: /* @__PURE__ */ qt({
805
- locations: {}
806
- }, {
807
- modelValue: { default: () => [] },
808
- modelModifiers: {}
809
- }),
810
- emits: ["update:modelValue"],
811
- setup(oe) {
812
- const { t: w } = Ze(), $ = oe, V = Tt(oe, "modelValue"), H = _(!1), D = _(""), Z = S(() => {
813
- const P = D.value.trim().toLowerCase();
814
- return P ? $.locations.filter(
815
- (q) => q.name.toLowerCase().includes(P) || (q.doc.profile.code ?? "").toLowerCase().includes(P)
816
- ) : $.locations;
817
- }), re = S(() => V.value.length), i = S(
818
- () => Z.value.length > 0 && Z.value.every((P) => V.value.includes(P.dbName))
819
- ), C = S(
820
- () => Z.value.some((P) => V.value.includes(P.dbName)) && !i.value
821
- ), o = S(() => {
822
- if (re.value === 0) return w("inventory.transfer.receiveRequest.bulk.noLocationsSelected");
823
- if (re.value === 1) {
824
- const P = $.locations.find((q) => q.dbName === V.value[0]);
825
- return P ? `${P.name} (${P.doc.profile.code ?? "--"})` : V.value[0];
826
- }
827
- return w("inventory.transfer.receiveRequest.bulk.locationsSelected", [re.value]);
828
- });
829
- function te() {
830
- const P = Z.value.map((q) => q.dbName);
831
- i.value ? V.value = V.value.filter((q) => !P.includes(q)) : V.value = [.../* @__PURE__ */ new Set([...V.value, ...P])];
832
- }
833
- function ee(P) {
834
- V.value.includes(P) ? V.value = V.value.filter((q) => q !== P) : V.value = [...V.value, P];
835
- }
836
- function we(P) {
837
- return V.value.includes(P);
838
- }
839
- return (P, q) => {
840
- const y = De("FmIcon"), ce = De("FmChip"), Y = De("FmTextField"), se = De("FmMenuItem"), g = De("FmMenu");
841
- return d(), ae(g, {
842
- "model-value": H.value,
843
- placement: "bottom-end",
844
- "close-on-click": !1,
845
- onMenuChanged: q[1] || (q[1] = (u) => {
846
- H.value = u, u || (D.value = "");
847
- })
848
- }, {
849
- "menu-button": Se(() => [
850
- R(ce, {
851
- label: o.value,
852
- class: "text-fm-color-neutral-gray-400 cursor-pointer"
853
- }, {
854
- default: Se(() => [
855
- R(y, {
856
- name: "storefront",
857
- outline: "",
858
- size: "sm"
859
- }),
860
- t("div", {
861
- class: O(["fm-typo-en-body-md-600 select-none text-ellipsis overflow-hidden whitespace-nowrap max-w-[200px]", { "text-fm-color-typo-primary": re.value > 0 }])
862
- }, p(o.value), 3),
863
- R(y, {
864
- name: H.value ? "keyboard_arrow_up" : "keyboard_arrow_down",
865
- outline: "",
866
- size: "sm"
867
- }, null, 8, ["name"])
868
- ]),
869
- _: 1
870
- }, 8, ["label"])
871
- ]),
872
- default: Se(() => [
873
- R(Y, {
874
- "model-value": D.value,
875
- "onUpdate:modelValue": q[0] || (q[0] = (u) => D.value = u),
876
- placeholder: e(w)("inventory.common.table.toolbar.filterItems"),
877
- class: "my-8"
878
- }, null, 8, ["model-value", "placeholder"]),
879
- R(se, {
880
- "model-value": i.value,
881
- label: e(w)("inventory.common.selectAll"),
882
- "has-checkbox": !0,
883
- indeterminate: C.value,
884
- onClick: te
885
- }, null, 8, ["model-value", "label", "indeterminate"]),
886
- (d(!0), h(_e, null, We(Z.value, (u) => (d(), ae(se, {
887
- key: u.dbName,
888
- "model-value": we(u.dbName),
889
- label: `${u.name} (${u.doc.profile.code ?? "--"})`,
890
- sublabel: u.type === "restaurant" ? e(w)("inventory.common.restaurant") : e(w)("inventory.common.warehouse"),
891
- "has-checkbox": !0,
892
- onClick: (B) => ee(u.dbName)
893
- }, null, 8, ["model-value", "label", "sublabel", "onClick"]))), 128)),
894
- Z.value.length === 0 ? (d(), ae(se, {
895
- key: 0,
896
- disabled: "",
897
- label: e(w)("inventory.common.noResultFound")
898
- }, null, 8, ["label"])) : I("", !0)
899
- ]),
900
- _: 1
901
- }, 8, ["model-value"]);
902
- };
903
- }
904
- }), Qe = _(), rt = _(), lt = _();
905
- function ia(oe) {
906
- const w = ls(), $ = nt(), V = Et(), H = St(), D = Ft(), Z = ys(), re = Dt(), i = _(!1), C = dt(), { t: o } = Ze(), te = Rt(), ee = jt(), we = _([]), P = _([]), q = _(new Array()), y = _(
907
- new Array()
908
- ), ce = _(
909
- oe != null && oe.startDate && (oe != null && oe.endDate) ? oe : it()
910
- ), Y = S(() => {
911
- const m = new Date(ce.value.startDate), f = new Date(ce.value.endDate);
912
- return {
913
- start: Fs(m).toISOString(),
914
- end: Cs(f).toISOString()
915
- };
916
- }), se = It(), g = _(null), u = Bt({
917
- visible: !1,
918
- title: "",
919
- current: 0,
920
- total: 0,
921
- done: !1,
922
- cancelled: !1
923
- });
924
- function B(m) {
925
- const f = $.locations.find((k) => k.dbName === m._locationDbName);
926
- if (!f) return null;
927
- if (f.type === "restaurant") {
928
- const k = $.locationRestaurantFromCore(f.doc._id);
929
- if (k !== null)
930
- return { ...f, doc: k };
931
- }
932
- return f;
933
- }
934
- function pe(m) {
935
- const f = $.locations.find((k) => k.dbName === m._locationDbName);
936
- f && ($._currentLocation = f);
937
- }
938
- async function de() {
939
- if (P.value = [], q.value = [], we.value.length !== 0) {
940
- i.value = !0;
941
- try {
942
- const f = ht(we.value, 5), k = [];
943
- for (const v of f) {
944
- const L = await Promise.allSettled(
945
- v.map(async (A) => (await te.getPurchaseOrders({
946
- ...Y.value,
947
- dbName: A
948
- })).map((J) => ({ ...J, _locationDbName: A })))
949
- );
950
- for (const A of L)
951
- A.status === "fulfilled" && k.push(...A.value);
952
- }
953
- P.value = k.sort((v, L) => L._id.localeCompare(v._id));
954
- const E = P.value.flatMap((v) => v.shipmentIds || []).filter(Boolean), l = E.length > 0 ? await ee.getShipmentsByIds(E) : [];
955
- q.value = l;
956
- const r = await se.readCurrentLocationLastClosing(!0), c = r == null ? void 0 : r._id;
957
- c && (g.value = Ss(c)), await V.awaitFeatureLoaded(() => V.mustUsePoTemplate) && await re.fetchTemplates();
958
- const b = P.value.map((v) => {
959
- var L;
960
- return ((L = v.request) == null ? void 0 : L.id) ?? "";
961
- }).filter((v) => v);
962
- b.length > 0 && (y.value = await te.readRequestByIds(b));
963
- } catch {
964
- C.open({
965
- title: "Something went wrong",
966
- message: "Error at fetching purchase orders",
967
- type: "error"
968
- });
969
- } finally {
970
- i.value = !1;
971
- }
972
- }
973
- }
974
- function K(m, f) {
975
- ce.value = { startDate: m, endDate: f }, de();
976
- }
977
- const ye = _();
978
- async function be(m) {
979
- const f = we.value[0];
980
- if (f) {
981
- const l = $.locations.find((r) => r.dbName === f);
982
- l && ($._currentLocation = l);
983
- }
984
- function k(l) {
985
- const r = {
986
- mode: wt.CREATE,
987
- modelValue: m || void 0,
988
- show: !0,
989
- "onUpdate:show"(c) {
990
- Qe.value.show = c;
991
- },
992
- templateId: l,
993
- lastClosingDate: g.value
994
- };
995
- Qe.value = r;
996
- }
997
- let E;
998
- V.mustUsePoTemplate && !(m != null && m.template) ? w.open({
999
- title: "Create transfer",
1000
- message: "",
1001
- primaryActions: { text: "Select a template", close: !0 },
1002
- secondaryActions: { text: "Outlet to Outlet", variant: "secondary", close: !0 }
1003
- }).onPrimary(async () => {
1004
- E = await Z.getTemplateId(), E && k(E);
1005
- }).onSecondary(() => {
1006
- k(void 0);
1007
- }) : k(E);
1008
- }
1009
- function fe(m) {
1010
- pe(m);
1011
- const f = {
1012
- mode: wt.UPDATE,
1013
- modelValue: Mt(m),
1014
- show: !0,
1015
- "onUpdate:show"(k) {
1016
- Qe.value.show = k;
1017
- },
1018
- lastClosingDate: g.value
1019
- };
1020
- Qe.value = f;
1021
- }
1022
- function Be(m) {
1023
- if (pe(m), !D.currentBusiness.value) return;
1024
- const f = B(m);
1025
- if (!f) return;
1026
- const k = ot({
1027
- po: m,
1028
- currentLocation: f,
1029
- business: D.currentBusiness.value,
1030
- fulfilling: !1,
1031
- por: m.request
1032
- });
1033
- if (!k) return;
1034
- const E = _t(k.html), l = H.supplierById[m.supplier._id], r = {
1035
- recipientName: l == null ? void 0 : l.name,
1036
- email: (l == null ? void 0 : l.email) ?? "",
1037
- business: D.currentBusiness.value,
1038
- modelValue: E,
1039
- show: !0,
1040
- "onUpdate:show"(c) {
1041
- rt.value.show = c;
1042
- }
1043
- };
1044
- rt.value = r;
1045
- }
1046
- async function Oe(m, f) {
1047
- pe(m), f ?? (f = y.value.find((r) => r.purchaseOrderId === m._id) ?? void 0);
1048
- const E = B(m), l = {
1049
- poRequest: f,
1050
- purchaseOrder: m,
1051
- transferTo: E == null ? void 0 : E.name,
1052
- transferToDbName: E == null ? void 0 : E.dbName,
1053
- show: !0,
1054
- canResubmit: !1,
1055
- canApprove: !1,
1056
- "onUpdate:show"(r) {
1057
- ye.value.show = r;
1058
- },
1059
- scope: ct.RECEIVE_REQUEST,
1060
- receivedMap: Wt(
1061
- m,
1062
- (r, c) => C.open({ type: "error", title: r, message: c })
1063
- ) ?? {},
1064
- shipments: q.value
1065
- };
1066
- ye.value = l;
1067
- }
1068
- async function Re(m, f, k, E, l) {
1069
- const r = Zt();
1070
- i.value = !0;
1071
- try {
1072
- await r({
1073
- // version 3 (connected-business) ops route through the v3 engine, matching
1074
- // the single-item receive form; without this a version-3 submit here
1075
- // falls to v1/v2 and no v3 POR is created.
1076
- poVersion: m.version,
1077
- operate: {
1078
- operation: f,
1079
- doc: m,
1080
- options: (f === Ne.enum.confirmDraft || f === Ne.enum.completeReceive) && V.autoReceiveWarehouse ? { autoReceive: !0 } : void 0
1081
- },
1082
- operateV2: {
1083
- _id: m._id,
1084
- _rev: m._rev ?? "",
1085
- action: f === Ne.enum.submitRequest ? Ne.enum.confirmDraft : f,
1086
- payloads: l ?? []
1087
- },
1088
- transferTo: E
1089
- }), await new Promise((c) => setTimeout(c, 1e3)), C.open({ title: "Success", message: k, type: "success" });
1090
- } catch (c) {
1091
- C.open({
1092
- title: "Something went wrong",
1093
- message: "Please try again.",
1094
- type: "error"
1095
- }), console.error("Error when submitting PO operation", f, m, c);
1096
- } finally {
1097
- i.value = !1, de();
1098
- }
1099
- }
1100
- async function le(m, f, k) {
1101
- pe(m);
1102
- const E = Ht[f];
1103
- if (!E) {
1104
- C.open({
1105
- title: "Something went wrong",
1106
- message: `Cannot process order: ${$t(f)}`,
1107
- type: "error"
1108
- });
1109
- return;
1110
- }
1111
- const { successMessage: l, ...r } = E;
1112
- if (f === Ne.enum.rejectDraft) {
1113
- let v = "";
1114
- w.open({
1115
- title: r.title,
1116
- message: r.message,
1117
- primaryActions: r.primaryActions,
1118
- contentComponent: Yt,
1119
- contentComponentProps: {
1120
- message: r.message,
1121
- onChange: (L) => v = L
1122
- }
1123
- }).onPrimary(() => {
1124
- Re(m, f, l, k, [
1125
- { action: "rejectDraft", payload: { rejectReason: v } }
1126
- ]);
1127
- });
1128
- return;
1129
- }
1130
- const c = [], b = Qt();
1131
- b.init(m), (f === Ne.enum.confirmDraft || f === Ne.enum.submitRequest) && c.push({
1132
- action: "confirmDraft",
1133
- payload: b.controller.value.toConfirmDraftData(zt())
1134
- }), w.open({
1135
- title: r.title,
1136
- message: r.message,
1137
- primaryActions: r.primaryActions
1138
- }).onPrimary(() => {
1139
- Re(
1140
- m,
1141
- f,
1142
- l,
1143
- k,
1144
- c
1145
- );
1146
- });
1147
- }
1148
- async function he() {
1149
- w.open({
1150
- title: "Upload Transfer",
1151
- primaryActions: { text: "Xilnex transfer note", close: !0 },
1152
- secondaryActions: { text: "Cancel", close: !0 }
1153
- }).onPrimary(() => {
1154
- const m = {
1155
- show: !0,
1156
- "onUpdate:show"(f) {
1157
- lt.value.show = f;
1158
- }
1159
- };
1160
- lt.value = m;
1161
- });
1162
- }
1163
- async function Ie(m) {
1164
- var c, b;
1165
- const { startDate: f, endDate: k } = ce.value;
1166
- if (Te(k).diff(Te(f), "month", !0) > 2) {
1167
- C.open({
1168
- title: o("inventory.transfer.receiveRequest.bulk.downloadError"),
1169
- message: o("inventory.transfer.receiveRequest.bulk.downloadLimitExceeded"),
1170
- type: "error"
1171
- });
1172
- return;
1173
- }
1174
- if (m.length === 0) {
1175
- C.open({
1176
- title: o("inventory.transfer.receiveRequest.bulk.downloadError"),
1177
- message: o("inventory.transfer.receiveRequest.bulk.noOrdersToDownload"),
1178
- type: "warning"
1179
- });
1180
- return;
1181
- }
1182
- const E = (await import("./jszip.min-B52cHzHI.js").then((v) => v.j)).default, l = new E();
1183
- let r = 0;
1184
- u.title = o("inventory.transfer.receiveRequest.bulk.downloadProgress"), u.current = 0, u.total = m.length, u.done = !1, u.cancelled = !1, u.visible = !0, await at(), await new Promise((v) => setTimeout(v, 150));
1185
- try {
1186
- for (const z of m) {
1187
- if (u.cancelled) break;
1188
- try {
1189
- const J = B(z);
1190
- if (!J) continue;
1191
- const me = ot({
1192
- po: z,
1193
- currentLocation: J,
1194
- business: D.currentBusiness.value,
1195
- fulfilling: !1,
1196
- por: y.value.find((j) => j.purchaseOrderId === z._id)
1197
- });
1198
- if (!me) continue;
1199
- const T = me.html, U = document.createElement("iframe");
1200
- U.style.cssText = "position:fixed;left:-9999px;top:0;width:210mm;border:none;opacity:0;pointer-events:none;", document.body.appendChild(U);
1201
- const G = U.contentDocument || ((c = U.contentWindow) == null ? void 0 : c.document);
1202
- if (!G) {
1203
- document.body.removeChild(U), console.error("Could not access iframe document for PO", z._id);
1204
- continue;
1205
- }
1206
- G.open(), G.write(T), G.close(), await new Promise((j) => setTimeout(j, 500));
1207
- const ie = G.body.scrollHeight;
1208
- U.style.height = `${ie}px`, await new Promise((j) => setTimeout(j, 100));
1209
- const ge = await xt().set({
1210
- margin: [15, 15, 15, 15],
1211
- // 15mm margins on all sides
1212
- filename: "temp.pdf",
1213
- image: { type: "jpeg", quality: 0.95 },
1214
- html2canvas: {
1215
- scale: 2,
1216
- useCORS: !0,
1217
- letterRendering: !0,
1218
- logging: !1,
1219
- scrollY: 0,
1220
- scrollX: 0,
1221
- windowHeight: ie,
1222
- height: ie
1223
- },
1224
- jsPDF: {
1225
- unit: "mm",
1226
- format: "a4",
1227
- orientation: "portrait"
1228
- }
1229
- }).from(G.body).toPdf().outputPdf("blob");
1230
- document.body.removeChild(U);
1231
- const x = `${((b = $.locations.find((j) => j.dbName === z._locationDbName)) == null ? void 0 : b.name) || z._locationDbName}_PO_${z.seqNumber || z._id}`.replace(/[/\\?%*:|"<>]/g, "-").slice(0, 100);
1232
- l.file(`${x}.pdf`, ge);
1233
- } catch (J) {
1234
- console.error("Failed to generate PDF for PO", z._id, J);
1235
- }
1236
- r++, u.current = r, await new Promise((J) => setTimeout(J, 80));
1237
- }
1238
- if (u.cancelled) return;
1239
- u.done = !0, await new Promise((z) => setTimeout(z, 500));
1240
- const v = await l.generateAsync({ type: "blob", compression: "DEFLATE" }), L = URL.createObjectURL(v), A = document.createElement("a");
1241
- A.href = L, A.download = `purchase-orders-${Te().format("YYYY-MM-DD")}.zip`, A.click(), URL.revokeObjectURL(L), C.open({
1242
- title: o("inventory.transfer.receiveRequest.bulk.downloadSuccess"),
1243
- message: o("inventory.transfer.receiveRequest.bulk.downloadSuccessMsg", [
1244
- m.length
1245
- ]),
1246
- type: "success"
1247
- });
1248
- } catch (v) {
1249
- console.error("Bulk download failed", v), C.open({
1250
- title: o("inventory.transfer.receiveRequest.bulk.downloadError"),
1251
- message: o("inventory.transfer.receiveRequest.bulk.downloadErrorMsg"),
1252
- type: "error"
1253
- });
1254
- } finally {
1255
- u.visible = !1;
1256
- }
1257
- }
1258
- async function ke(m) {
1259
- var Ce;
1260
- const f = [
1261
- bt.enum.RECEIVING,
1262
- bt.enum.PROCESSING
1263
- // PARTIAL_RECEIVED display status maps from PROCESSING
1264
- ], k = m.filter((x) => f.includes(x.status));
1265
- if (k.length === 0) {
1266
- C.open({
1267
- title: o("inventory.transfer.receiveRequest.bulk.emailSendError"),
1268
- message: o("inventory.transfer.receiveRequest.bulk.noOrdersToEmail"),
1269
- type: "warning"
1270
- });
1271
- return;
1272
- }
1273
- if (!((Ce = D.currentBusiness.value) != null && Ce._id)) return;
1274
- const E = cs(), l = fs(), r = /* @__PURE__ */ new Map(), c = $.locations.map((x) => x.dbName), b = `business_${D.currentBusiness.value._id}`, v = [.../* @__PURE__ */ new Set([...c, b])];
1275
- await Promise.allSettled(
1276
- v.map(async (x) => {
1277
- try {
1278
- (await l.readSuppliersByDbName(x)).forEach((N) => {
1279
- const M = r.get(N._id);
1280
- (!M || !M.email && N.email) && r.set(N._id, N);
1281
- });
1282
- } catch (j) {
1283
- console.warn("[emailAll] fetch failed for", x, j);
1284
- }
1285
- })
1286
- );
1287
- function L(x) {
1288
- var N;
1289
- const j = r.get(x.supplier._id);
1290
- return (j == null ? void 0 : j.email) || ((N = x.supplier) == null ? void 0 : N.email);
1291
- }
1292
- const A = [], z = [];
1293
- for (const x of k)
1294
- L(x) ? A.push(x) : z.push(x);
1295
- const J = ve(
1296
- "p",
1297
- { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" },
1298
- o("inventory.transfer.receiveRequest.bulk.emailAllowedStatusInfo")
1299
- );
1300
- if (z.length > 0) {
1301
- const x = /* @__PURE__ */ new Map();
1302
- for (const M of z) {
1303
- const F = M.supplier._id;
1304
- x.has(F) || x.set(F, { supplierName: M.supplier.name, pos: [] }), x.get(F).pos.push(M);
1305
- }
1306
- const j = ve("div", { class: "flex flex-col gap-12" }, [
1307
- J,
1308
- ve(
1309
- "p",
1310
- { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" },
1311
- o("inventory.transfer.receiveRequest.bulk.missingEmailMsg", [z.length])
1312
- ),
1313
- ve(
1314
- "div",
1315
- { class: "flex flex-col gap-4 max-h-[320px] overflow-y-auto rounded-md border border-fm-color-neutral-gray-100 p-8" },
1316
- [...x.values()].map(
1317
- ({ supplierName: M, pos: F }) => ve("div", { class: "flex flex-col gap-2 py-6 border-b border-fm-color-neutral-gray-100 last:border-0" }, [
1318
- ve("div", { class: "fm-typo-en-body-md-600 text-fm-color-typo-primary" }, M),
1319
- ve(
1320
- "div",
1321
- { class: "flex flex-wrap gap-4" },
1322
- F.map(
1323
- (ne) => ve("span", {
1324
- class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary bg-fm-color-neutral-gray-100 rounded px-6 py-2"
1325
- }, `PO #${ne.seqNumber ?? ne._id}`)
1326
- )
1327
- )
1328
- ])
1329
- )
1330
- ),
1331
- ve(
1332
- "p",
1333
- { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" },
1334
- o("inventory.transfer.receiveRequest.bulk.emailWillSendCount", [A.length, k.length])
1335
- ),
1336
- ve(
1337
- "p",
1338
- { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" },
1339
- o("inventory.transfer.receiveRequest.bulk.missingEmailConfirm")
1340
- )
1341
- ]);
1342
- if (!await new Promise((M) => {
1343
- w.open({
1344
- title: o("inventory.transfer.receiveRequest.bulk.missingEmailTitle"),
1345
- contentComponent: j,
1346
- contentComponentProps: {},
1347
- primaryActions: {
1348
- text: o("inventory.transfer.receiveRequest.bulk.skipAndContinue"),
1349
- close: !0
1350
- },
1351
- secondaryActions: { text: o("inventory.common.cancel"), close: !0 }
1352
- }).onPrimary(() => M(!0)).onSecondary(() => M(!1));
1353
- })) return;
1354
- } else {
1355
- const x = ve("div", { class: "flex flex-col gap-12" }, [
1356
- J,
1357
- ve(
1358
- "p",
1359
- { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" },
1360
- o("inventory.transfer.receiveRequest.bulk.emailAllConfirmMsg", [A.length])
1361
- )
1362
- ]);
1363
- if (!await new Promise((N) => {
1364
- w.open({
1365
- title: o("inventory.transfer.receiveRequest.bulk.missingEmailTitle"),
1366
- contentComponent: x,
1367
- contentComponentProps: {},
1368
- primaryActions: {
1369
- text: o("inventory.transfer.receiveRequest.bulk.emailConfirm"),
1370
- close: !0
1371
- },
1372
- secondaryActions: { text: o("inventory.common.cancel"), close: !0 }
1373
- }).onPrimary(() => N(!0)).onSecondary(() => N(!1));
1374
- })) return;
1375
- }
1376
- if (A.length === 0) {
1377
- C.open({
1378
- title: o("inventory.transfer.receiveRequest.bulk.emailSendError"),
1379
- message: o("inventory.transfer.receiveRequest.bulk.noEmailsToSend"),
1380
- type: "warning"
1381
- });
1382
- return;
1383
- }
1384
- let me = [];
1385
- try {
1386
- me = await E.getEmailList(D.currentBusiness.value._id);
1387
- } catch {
1388
- C.open({
1389
- title: o("inventory.transfer.receiveRequest.bulk.emailSendError"),
1390
- message: o("inventory.transfer.receiveRequest.bulk.noEmailSender"),
1391
- type: "error"
1392
- });
1393
- return;
1394
- }
1395
- const T = me.find((x) => x.verified);
1396
- if (!T) {
1397
- C.open({
1398
- title: o("inventory.transfer.receiveRequest.bulk.emailSendError"),
1399
- message: o("inventory.transfer.receiveRequest.bulk.noEmailSender"),
1400
- type: "error"
1401
- });
1402
- return;
1403
- }
1404
- const G = ht(A, 2);
1405
- let ie = 0;
1406
- const ge = [];
1407
- u.title = o("inventory.transfer.receiveRequest.bulk.emailProgress"), u.current = 0, u.total = A.length, u.done = !1, u.cancelled = !1, u.visible = !0, await at(), await new Promise((x) => setTimeout(x, 100));
1408
- try {
1409
- for (let x = 0; x < G.length; x++) {
1410
- const j = G[x];
1411
- await Promise.allSettled(
1412
- j.map(async (N) => {
1413
- var F;
1414
- const M = document.createElement("div");
1415
- M.style.cssText = "position:fixed;left:-99999px;top:0;width:210mm;background:white;z-index:-1;opacity:0;pointer-events:none;", document.body.appendChild(M);
1416
- try {
1417
- const ne = B(N);
1418
- if (!ne) return;
1419
- const Fe = ot({
1420
- po: N,
1421
- currentLocation: ne,
1422
- business: D.currentBusiness.value,
1423
- fulfilling: !1,
1424
- por: y.value.find((Pe) => Pe.purchaseOrderId === N._id)
1425
- });
1426
- if (!Fe) return;
1427
- const $e = _t(Fe.html), xe = new DOMParser().parseFromString(Fe.html, "text/html");
1428
- for (; xe.body.firstChild; )
1429
- M.appendChild(xe.body.firstChild);
1430
- xe.head.querySelectorAll("style").forEach((Pe) => M.prepend(Pe.cloneNode(!0)));
1431
- const Ee = await xt().set({
1432
- margin: 10,
1433
- html2canvas: { scale: 2, useCORS: !0, letterRendering: !0 },
1434
- jsPDF: { unit: "mm", format: "a4", orientation: "portrait" }
1435
- }).from(M).outputPdf("blob");
1436
- if (!Ee) return;
1437
- await E.sendMailFormData({
1438
- businessId: D.currentBusiness.value._id,
1439
- from: {
1440
- name: T.name || ((F = D.currentBusiness.value) == null ? void 0 : F.name) || "FeedMe Inventory",
1441
- address: T.emailAddress
1442
- },
1443
- to: [{ name: N.supplier.name, address: L(N) }],
1444
- subject: `Purchase Order #${N.seqNumber ?? N._id}`,
1445
- html: $e,
1446
- attachments: [Ee],
1447
- usage: "Operational",
1448
- forceSend: !0
1449
- });
1450
- } catch (ne) {
1451
- ge.push(`PO #${N.seqNumber ?? N._id}`), console.error("Failed to send email for PO", N._id, ne);
1452
- } finally {
1453
- document.body.removeChild(M), ie++, u.current = ie;
1454
- }
1455
- })
1456
- ), await at(), x < G.length - 1 && await new Promise((N) => setTimeout(N, 1500));
1457
- }
1458
- u.done = !0, ge.length > 0 ? C.open({
1459
- title: o("inventory.transfer.receiveRequest.bulk.emailPartialSuccess"),
1460
- message: o("inventory.transfer.receiveRequest.bulk.emailPartialSuccessMsg", [
1461
- A.length - ge.length,
1462
- A.length
1463
- ]),
1464
- type: "warning"
1465
- }) : C.open({
1466
- title: o("inventory.transfer.receiveRequest.bulk.emailSuccess"),
1467
- message: o("inventory.transfer.receiveRequest.bulk.emailSuccessMsg", [
1468
- A.length
1469
- ]),
1470
- type: "success"
1471
- });
1472
- } catch (x) {
1473
- console.error("Bulk email failed", x), C.open({
1474
- title: o("inventory.transfer.receiveRequest.bulk.emailSendError"),
1475
- message: o("inventory.transfer.receiveRequest.bulk.emailErrorMsg"),
1476
- type: "error"
1477
- });
1478
- } finally {
1479
- u.visible = !1;
1480
- }
1481
- }
1482
- return {
1483
- selectedLocationDbNames: we,
1484
- purchaseOrders: P,
1485
- shipments: q,
1486
- purchaseRequests: y,
1487
- updateDateRange: K,
1488
- fetchData: de,
1489
- loading: i,
1490
- bulkProgress: u,
1491
- transferDialogProps: Qe,
1492
- promptCreateTransferDialog: be,
1493
- promptUpdateTransferDialog: fe,
1494
- transferDetailsProps: ye,
1495
- promptShowTransferDetails: Oe,
1496
- submitAction: le,
1497
- xilnexImportDialogProps: lt,
1498
- promptUploadTransferDialog: he,
1499
- emailDialogProps: rt,
1500
- promptEmailDialog: Be,
1501
- downloadAll: Ie,
1502
- emailAll: ke,
1503
- lastClosingDate: g
1504
- };
1505
- }
1506
- function ua(oe, w) {
1507
- const $ = nt(), { t: V } = Ze(), H = Kt(
1508
- ct.RECEIVE_REQUEST,
1509
- oe,
1510
- w
1511
- );
1512
- return {
1513
- columnDefs: S(() => {
1514
- const Z = H.columnDefs.value, re = {
1515
- id: "location",
1516
- header: () => V("inventory.transfer.receiveRequest.bulk.locationColumn"),
1517
- cell(C) {
1518
- const o = C.row.original._locationDbName, te = $.locations.find((ee) => ee.dbName === o);
1519
- return te ? `${te.name} (${te.doc.profile.code ?? "--"})` : o;
1520
- },
1521
- enableSorting: !1,
1522
- size: 160
1523
- }, i = [...Z];
1524
- return i.splice(1, 0, re), i;
1525
- }),
1526
- showCustomPrintDialog: H.showCustomPrintDialog,
1527
- customPrintHtml: H.customPrintHtml,
1528
- customPrintTemplateName: H.customPrintTemplateName,
1529
- customPrintIsDefault: H.customPrintIsDefault
1530
- };
1531
- }
1532
- const ca = {
1533
- key: 0,
1534
- class: "flex flex-col items-center justify-center py-48 gap-8 text-fm-color-typo-secondary"
1535
- }, da = { class: "flex-1 w-full flex items-center gap-4 xs:flex-col-reverse sm:flex-col-reverse" }, ma = { class: "flex-1 xs:w-full sm:w-full" }, pa = {
1536
- key: 0,
1537
- class: "flex-1"
1538
- }, fa = { class: "w-full max-w-[343px] xs:max-w-[unset] sm:max-w-[unset]" }, va = {
1539
- key: 0,
1540
- class: "flex flex-col items-center justify-center py-48 gap-8 text-fm-color-typo-secondary"
1541
- }, ya = { class: "fm-typo-en-body-md-400" }, ba = { class: "flex flex-col py-8" }, ha = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, ga = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, xa = { 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" }, wa = {
1542
- key: 0,
1543
- class: "fm-typo-en-body-md-400 text-fm-color-typo-primary line-clamp-1"
1544
- }, ka = { class: "pt-8" }, Ca = {
1545
- key: 0,
1546
- class: "fixed inset-0 bg-black/40 z-[9999] flex items-center justify-center"
1547
- }, Fa = { class: "bg-white rounded-xl shadow-lg p-24 flex flex-col gap-12 min-w-[320px] max-w-[480px]" }, Sa = { class: "fm-typo-en-title-sm-600" }, Ra = { class: "flex flex-col gap-8" }, Da = { class: "flex justify-between fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Ea = { class: "w-full bg-fm-color-neutral-gray-200 rounded-full h-8" }, Pa = {
1548
- key: 0,
1549
- class: "fm-typo-en-body-sm-400 text-fm-color-semantic-success-500 text-center"
1550
- }, qa = {
1551
- key: 1,
1552
- class: "flex justify-end pt-4"
1553
- }, kt = "BulkReceiveRequestViewSearchCriteria", oo = /* @__PURE__ */ ut({
1554
- __name: "BulkReceiveRequestView",
1555
- setup(oe) {
1556
- const { t: w } = Ze(), $ = dt();
1557
- ks().fetchTemplates(), st.object({
1558
- name: st.string().optional().nullable(),
1559
- startDate: st.string().optional().nullable(),
1560
- endDate: st.string().optional().nullable()
1561
- });
1562
- const H = ns(), D = Et(), Z = ws();
1563
- function re() {
1564
- const l = {
1565
- name: "",
1566
- ...it()
1567
- }, r = H.getItem(kt);
1568
- if (!r) return l;
1569
- try {
1570
- return JSON.parse(r);
1571
- } catch {
1572
- return l;
1573
- }
1574
- }
1575
- function i() {
1576
- H.setItem(kt, JSON.stringify(C.value));
1577
- }
1578
- const C = _(re()), o = ia(C.value), te = _(!1), { selectedLocationDbNames: ee } = o, we = S(() => B.value.filter((l) => ee.value.includes(l.dbName)).map((l) => l.doc._id)), {
1579
- columnDefs: P,
1580
- showCustomPrintDialog: q,
1581
- customPrintHtml: y,
1582
- customPrintTemplateName: ce,
1583
- customPrintIsDefault: Y
1584
- } = ua(o, o.shipments), se = nt(), g = Lt(), u = Ft(), B = _([]);
1585
- Ot(() => {
1586
- const l = se.locations;
1587
- l.length > 0 && (B.value = l);
1588
- });
1589
- async function pe() {
1590
- var r;
1591
- if ((r = u.currentBusiness.value) != null && r._id)
1592
- try {
1593
- const c = await g.readAllInventoryLocations();
1594
- c.length > 0 && (B.value = c);
1595
- } catch {
1596
- }
1597
- }
1598
- Me(
1599
- [() => u.sessionUser.value, () => u.currentBusiness.value],
1600
- ([l, r]) => {
1601
- l && r && pe();
1602
- },
1603
- { immediate: !0 }
1604
- );
1605
- const de = S(() => o.loading.value), K = o.bulkProgress;
1606
- async function ye() {
1607
- const l = `inventory-record_${Te(C.value.startDate).format("DD-MM-YYYY_HH-mm")}-${Te(C.value.endDate).format("DD-MM-YYYY_HH-mm")}.xlsx`, r = o.purchaseOrders.value.flatMap(
1608
- (b) => b.items.map((v) => {
1609
- var U, G;
1610
- const L = new Date(ts(b._id) ?? ""), A = b.effectiveAt ? new Date(b.effectiveAt) : void 0, z = gt(
1611
- es(v.sku, b.deliveryOrder || [])
1612
- ), J = gt(v.quantity), me = ((U = v == null ? void 0 : v.measurement) == null ? void 0 : U.abbrev) || v.sku.unit.abbrev;
1613
- return {
1614
- Location: ((G = se.locations.find((ie) => ie.dbName === b._locationDbName)) == null ? void 0 : G.name) ?? "",
1615
- "SKU code": v.code,
1616
- "SKU name": v.name,
1617
- "PO #": b.seqNumber,
1618
- "Effective at": A,
1619
- Date: L,
1620
- Status: b.status,
1621
- Reference: b.ref ?? "",
1622
- "Received quantity": z,
1623
- "Ordered quantity": J,
1624
- Unit: me,
1625
- "Total cost": v.totalCost ? Ut(v.totalCost) : null
1626
- };
1627
- })
1628
- ), c = [
1629
- "Location",
1630
- "SKU code",
1631
- "SKU name",
1632
- "PO #",
1633
- "Date",
1634
- "Status",
1635
- "Reference",
1636
- "Received quantity",
1637
- "Ordered quantity",
1638
- "Unit"
1639
- ];
1640
- D.enableBackdatePo && c.insert("Effective at", 5), D.enableTotalCost && c.push("Total cost"), await ss([{ name: "purchases", data: r, columns: c }], l), $.open({
1641
- title: w("inventory.transfer.receiveRequest.export.success"),
1642
- message: w("inventory.transfer.receiveRequest.export.message", [l]),
1643
- type: "success"
1644
- });
1645
- }
1646
- const be = _(it()), fe = _("");
1647
- Me([() => be.value], ([l]) => {
1648
- if (!l.startDate || !l.endDate) return;
1649
- if (Te(l.endDate).diff(Te(l.startDate), "day") > 60) {
1650
- $.open({
1651
- title: w("inventory.transfer.receiveRequest.bulk.dateRangeLimitTitle"),
1652
- message: w("inventory.transfer.receiveRequest.bulk.dateRangeLimitMsg"),
1653
- type: "warning"
1654
- }), be.value = {
1655
- startDate: l.startDate,
1656
- endDate: Te(l.startDate).add(60, "day").format("YYYY-MM-DD")
1657
- };
1658
- return;
1659
- }
1660
- C.value.startDate = l.startDate, C.value.endDate = l.endDate, o.updateDateRange(C.value.startDate, C.value.endDate), i();
1661
- }), Me([() => fe.value], () => {
1662
- i();
1663
- }), Me(
1664
- () => ee.value,
1665
- () => {
1666
- o.fetchData();
1667
- }
1668
- );
1669
- function Be(l) {
1670
- if (l === "create") {
1671
- if (de.value) {
1672
- $.open({ title: "Loading data...", message: "Please wait.", type: "info" });
1673
- return;
1674
- }
1675
- if (ee.value.length === 0) {
1676
- $.open({
1677
- title: "No outlets selected",
1678
- message: "Please select at least one outlet to create a transfer.",
1679
- type: "warning"
1680
- });
1681
- return;
1682
- }
1683
- te.value = !0;
1684
- return;
1685
- }
1686
- if (l === "upload" && D.enableXilnexTransferNote)
1687
- return o.promptUploadTransferDialog();
1688
- if (l === "refresh") return o.fetchData();
1689
- if (l === "export") return ye();
1690
- if (l === "downloadAll") return Oe();
1691
- if (l === "emailAll") return Re();
1692
- }
1693
- async function Oe() {
1694
- if (ee.value.length === 0) {
1695
- $.open({
1696
- title: w("inventory.transfer.receiveRequest.bulk.noLocationsSelected"),
1697
- message: "",
1698
- type: "warning"
1699
- });
1700
- return;
1701
- }
1702
- await o.downloadAll(E.value);
1703
- }
1704
- async function Re() {
1705
- if (D.enablePurchaseOrderEmail) {
1706
- if (ee.value.length === 0) {
1707
- $.open({
1708
- title: w("inventory.transfer.receiveRequest.bulk.noLocationsSelected"),
1709
- message: "",
1710
- type: "warning"
1711
- });
1712
- return;
1713
- }
1714
- await o.emailAll(E.value);
1715
- }
1716
- }
1717
- const { breakpoints: le } = is(), he = S(() => le.value.xs || le.value.sm), Ie = S(() => he.value ? 10 : 20), ke = as(), m = S(() => D.enableReceiveRequestBeta ? [
1718
- {
1719
- label: w("inventory.transfer.receiveRequest.actions.create"),
1720
- value: "create",
1721
- isPrimary: !0,
1722
- prependIcon: "add"
1723
- },
1724
- ...D.enableXilnexTransferNote ? [{ label: w("inventory.common.upload"), value: "upload" }] : [],
1725
- { label: w("inventory.common.refresh"), value: "refresh" },
1726
- { label: w("inventory.common.export"), value: "export" },
1727
- ...D.enablePrintTemplate ? [
1728
- {
1729
- label: w("inventory.transfer.receiveRequest.bulk.downloadAll"),
1730
- value: "downloadAll",
1731
- prependIcon: "download"
1732
- }
1733
- ] : [],
1734
- ...D.enablePurchaseOrderEmail ? [
1735
- {
1736
- label: w("inventory.transfer.receiveRequest.bulk.emailAll"),
1737
- value: "emailAll",
1738
- prependIcon: "email"
1739
- }
1740
- ] : []
1741
- ] : []), f = S(() => {
1742
- const l = [
1743
- {
1744
- type: "string",
1745
- key: "status",
1746
- entity: "purchaseOrder",
1747
- values: Array.from(new Set(o.purchaseOrders.value.map((c) => c.status)))
1748
- },
1749
- {
1750
- type: "string",
1751
- key: "transferFrom",
1752
- entity: "purchaseOrder",
1753
- values: Array.from(new Set(o.purchaseOrders.value.map((c) => c.supplier.name)))
1754
- },
1755
- {
1756
- type: "string",
1757
- key: "location",
1758
- entity: "purchaseOrder",
1759
- values: Array.from(
1760
- new Set(
1761
- o.purchaseOrders.value.map((c) => {
1762
- const b = se.locations.find((v) => v.dbName === c._locationDbName);
1763
- return (b == null ? void 0 : b.name) ?? c._locationDbName;
1764
- })
1765
- )
1766
- )
1767
- }
1768
- ], r = [
1769
- {
1770
- type: "string",
1771
- key: "netsuiteTransactionNumber",
1772
- entity: "purchaseOrder",
1773
- values: o.purchaseOrders.value.map((c) => {
1774
- var b, v;
1775
- return (v = (b = c.netSuite) == null ? void 0 : b.additionalInfo) == null ? void 0 : v.transactionnumber;
1776
- }).filter((c) => c != null)
1777
- },
1778
- {
1779
- type: "string",
1780
- key: "netsuiteOrderNo",
1781
- entity: "purchaseOrder",
1782
- values: o.purchaseOrders.value.map((c) => {
1783
- var b;
1784
- return (b = c.netSuite) == null ? void 0 : b.refNo;
1785
- }).filter((c) => c != null)
1786
- },
1787
- {
1788
- type: "string",
1789
- key: "netsuiteOrderId",
1790
- entity: "purchaseOrder",
1791
- values: o.purchaseOrders.value.map((c) => {
1792
- var b;
1793
- return (b = c.netSuite) == null ? void 0 : b.id;
1794
- }).filter((c) => c != null)
1795
- }
1796
- ];
1797
- return [...l, ...Z.isEnabled ? r : []];
1798
- }), k = _(null), E = S(() => {
1799
- if (!k.value) return o.purchaseOrders.value;
1800
- const l = gs.build(k.value);
1801
- return o.purchaseOrders.value.filter((r) => {
1802
- var b, v, L, A, z;
1803
- const c = ((b = se.locations.find((J) => J.dbName === r._locationDbName)) == null ? void 0 : b.name) ?? r._locationDbName;
1804
- return xs(
1805
- {
1806
- netsuiteTransactionNumber: (L = (v = r.netSuite) == null ? void 0 : v.additionalInfo) == null ? void 0 : L.transactionnumber,
1807
- netsuiteOrderNo: (A = r.netSuite) == null ? void 0 : A.refNo,
1808
- netsuiteOrderId: (z = r.netSuite) == null ? void 0 : z.id,
1809
- status: r.status,
1810
- transferFrom: r.supplier.name,
1811
- location: c
1812
- },
1813
- l
1814
- );
1815
- });
1816
- });
1817
- return (l, r) => {
1818
- const c = De("FmIcon"), b = De("FmTextField"), v = De("FmTable"), L = De("FmButton");
1819
- return d(), ae(os, {
1820
- title: e(w)("inventory.transfer.receiveRequest.bulk.title"),
1821
- actions: m.value,
1822
- "onClick:action": Be
1823
- }, {
1824
- default: Se(() => {
1825
- var A, z, J, me;
1826
- return [
1827
- e(D).isLoaded && !e(D).enableReceiveRequestBeta ? (d(), h("div", ca, [
1828
- R(c, {
1829
- name: "block",
1830
- size: "xl"
1831
- }),
1832
- r[10] || (r[10] = t("p", { class: "fm-typo-en-body-md-400" }, "Not available", -1))
1833
- ])) : e(D).enableReceiveRequestBeta ? (d(), h(_e, { key: 1 }, [
1834
- t("div", {
1835
- class: O(["flex flex-col gap-8 max-h-full", { "p-0": he.value, "px-24": !he.value }])
1836
- }, [
1837
- t("div", {
1838
- class: "flex flex-col gap-8",
1839
- onVnodeMounted: r[4] || (r[4] = //@ts-ignore
1840
- (...T) => e(ke).onMounted && e(ke).onMounted(...T)),
1841
- onVnodeUnmounted: r[5] || (r[5] = //@ts-ignore
1842
- (...T) => e(ke).onUnmounted && e(ke).onUnmounted(...T))
1843
- }, [
1844
- t("div", {
1845
- class: O([
1846
- "flex gap-8 items-center",
1847
- { "px-8 flex-col-reverse h-[unset]": he.value, "h-48": !he.value }
1848
- ])
1849
- }, [
1850
- t("div", {
1851
- class: O(["flex gap-8 items-center", { "w-full overflow-x-auto": he.value }])
1852
- }, [
1853
- R(la, {
1854
- modelValue: e(ee),
1855
- "onUpdate:modelValue": r[0] || (r[0] = (T) => ft(ee) ? ee.value = T : null),
1856
- locations: B.value
1857
- }, null, 8, ["modelValue", "locations"]),
1858
- R(Vt, {
1859
- "model-value": be.value,
1860
- "onUpdate:modelValue": r[1] || (r[1] = (T) => be.value = T)
1861
- }, null, 8, ["model-value"])
1862
- ], 2),
1863
- t("div", da, [
1864
- t("div", ma, [
1865
- R(e(_s), {
1866
- modelValue: k.value,
1867
- "onUpdate:modelValue": r[2] || (r[2] = (T) => k.value = T),
1868
- attributes: f.value
1869
- }, null, 8, ["modelValue", "attributes"])
1870
- ]),
1871
- he.value ? I("", !0) : (d(), h("div", pa)),
1872
- t("div", fa, [
1873
- R(b, {
1874
- "model-value": fe.value,
1875
- "onUpdate:modelValue": r[3] || (r[3] = (T) => fe.value = T),
1876
- "prepend-icon": "search",
1877
- placeholder: e(w)("inventory.common.table.toolbar.filterItems"),
1878
- class: "w-full"
1879
- }, null, 8, ["model-value", "placeholder"])
1880
- ])
1881
- ])
1882
- ], 2)
1883
- ], 512),
1884
- e(ee).length === 0 && !de.value ? (d(), h("div", va, [
1885
- R(c, {
1886
- name: "storefront",
1887
- size: "xl"
1888
- }),
1889
- t("p", ya, p(e(w)("inventory.transfer.receiveRequest.bulk.selectLocationsHint")), 1)
1890
- ])) : (d(), ae(v, {
1891
- key: 1,
1892
- style: vt(e(ke).tableHeight),
1893
- "column-defs": e(P),
1894
- "row-data": E.value,
1895
- "search-value": fe.value,
1896
- loading: de.value,
1897
- onRowClick: r[6] || (r[6] = (T) => e(o).promptShowTransferDetails(T.original)),
1898
- "page-size": Ie.value
1899
- }, {
1900
- "list-row": Se((T) => [
1901
- R(hs, {
1902
- row: T,
1903
- onRowClick: e(o).promptShowTransferDetails
1904
- }, {
1905
- default: Se((U) => {
1906
- var G, ie, ge, Ce, x, j, N, M, F, ne, Fe, $e, Le, xe, Ve, Ee, Pe, Ue, Ae, Ke, Je, Xe, je, ze, Ge;
1907
- return [
1908
- t("div", ba, [
1909
- t("div", ha, [
1910
- R(e(Ye), {
1911
- render: (ge = (ie = (G = U._id) == null ? void 0 : G.column) == null ? void 0 : ie.columnDef) == null ? void 0 : ge.cell,
1912
- props: (x = (Ce = U._id) == null ? void 0 : Ce.getContext) == null ? void 0 : x.call(Ce)
1913
- }, null, 8, ["render", "props"])
1914
- ]),
1915
- t("div", ga, [
1916
- R(e(Ye), {
1917
- render: (M = (N = (j = U.location) == null ? void 0 : j.column) == null ? void 0 : N.columnDef) == null ? void 0 : M.cell,
1918
- props: (ne = (F = U.location) == null ? void 0 : F.getContext) == null ? void 0 : ne.call(F)
1919
- }, null, 8, ["render", "props"])
1920
- ]),
1921
- t("div", xa, [
1922
- R(e(Ye), {
1923
- render: (Le = ($e = (Fe = U.supplier_name) == null ? void 0 : Fe.column) == null ? void 0 : $e.columnDef) == null ? void 0 : Le.cell,
1924
- props: (Ve = (xe = U.supplier_name) == null ? void 0 : xe.getContext) == null ? void 0 : Ve.call(xe)
1925
- }, null, 8, ["render", "props"])
1926
- ]),
1927
- t("div", _a, p(T.original.items.map((s) => `${s.name}`).join(", ")), 1),
1928
- T.original.ref ? (d(), h("div", wa, [
1929
- R(e(Ye), {
1930
- render: (Ue = (Pe = (Ee = U.ref) == null ? void 0 : Ee.column) == null ? void 0 : Pe.columnDef) == null ? void 0 : Ue.cell,
1931
- props: (Ke = (Ae = U.ref) == null ? void 0 : Ae.getContext) == null ? void 0 : Ke.call(Ae)
1932
- }, null, 8, ["render", "props"])
1933
- ])) : I("", !0),
1934
- t("div", ka, [
1935
- R(e(Ye), {
1936
- render: (je = (Xe = (Je = U.status) == null ? void 0 : Je.column) == null ? void 0 : Xe.columnDef) == null ? void 0 : je.cell,
1937
- props: (Ge = (ze = U.status) == null ? void 0 : ze.getContext) == null ? void 0 : Ge.call(ze)
1938
- }, null, 8, ["render", "props"])
1939
- ])
1940
- ])
1941
- ];
1942
- }),
1943
- _: 2
1944
- }, 1032, ["row", "onRowClick"])
1945
- ]),
1946
- _: 1
1947
- }, 8, ["style", "column-defs", "row-data", "search-value", "loading", "page-size"]))
1948
- ], 2),
1949
- (d(), ae(Ct, { to: "body" }, [
1950
- e(K).visible ? (d(), h("div", Ca, [
1951
- t("div", Fa, [
1952
- t("div", Sa, p(e(K).title), 1),
1953
- t("div", Ra, [
1954
- t("div", Da, [
1955
- t("span", null, p(e(w)("inventory.transfer.receiveRequest.bulk.progressLabel")), 1),
1956
- t("span", null, p(e(K).current) + " / " + p(e(K).total), 1)
1957
- ]),
1958
- t("div", Ea, [
1959
- t("div", {
1960
- class: "bg-fm-color-primary h-8 rounded-full",
1961
- style: vt({
1962
- width: `${e(K).total > 0 ? e(K).current / e(K).total * 100 : 0}%`
1963
- })
1964
- }, null, 4)
1965
- ])
1966
- ]),
1967
- e(K).done ? (d(), h("div", Pa, p(e(w)("inventory.transfer.receiveRequest.bulk.progressDone")), 1)) : I("", !0),
1968
- e(K).done ? I("", !0) : (d(), h("div", qa, [
1969
- R(L, {
1970
- variant: "secondary",
1971
- size: "md",
1972
- label: e(w)("inventory.transfer.receiveRequest.bulk.progressCancel"),
1973
- disabled: e(K).cancelled,
1974
- onClick: r[7] || (r[7] = (T) => e(K).cancelled = !0)
1975
- }, null, 8, ["label", "disabled"])
1976
- ]))
1977
- ])
1978
- ])) : I("", !0),
1979
- e(D).enablePurchaseOrderEmail ? (d(), ae(ds, yt(tt({ key: 1 }, e(o).emailDialogProps.value)), null, 16)) : I("", !0),
1980
- R(ra, {
1981
- show: te.value,
1982
- "onUpdate:show": r[8] || (r[8] = (T) => te.value = T),
1983
- "last-closing-date": e(o).lastClosingDate.value,
1984
- "selected-outlet-ids": we.value,
1985
- onSubmitted: e(o).fetchData
1986
- }, null, 8, ["show", "last-closing-date", "selected-outlet-ids", "onSubmitted"]),
1987
- R(ms, tt(e(o).transferDialogProps.value, {
1988
- onSubmitted: e(o).fetchData
1989
- }), null, 16, ["onSubmitted"]),
1990
- ((z = (A = e(o).transferDetailsProps.value) == null ? void 0 : A.purchaseOrder) == null ? void 0 : z.version) === "3" ? (d(), ae(Jt, tt({ key: 2 }, {
1991
- ...e(o).transferDetailsProps.value,
1992
- receivedMap: ((J = e(o).transferDetailsProps.value) == null ? void 0 : J.receivedMap) ?? {},
1993
- shipments: e(o).shipments.value ?? []
1994
- }, {
1995
- onSubmitted: e(o).fetchData
1996
- }), null, 16, ["onSubmitted"])) : (d(), ae(Xt, tt({
1997
- key: 3,
1998
- scope: e(ct).RECEIVE_REQUEST
1999
- }, {
2000
- ...e(o).transferDetailsProps.value,
2001
- receivedMap: ((me = e(o).transferDetailsProps.value) == null ? void 0 : me.receivedMap) ?? {},
2002
- shipments: e(o).shipments.value ?? []
2003
- }, {
2004
- onSubmitted: e(o).fetchData
2005
- }), null, 16, ["scope", "onSubmitted"])),
2006
- R(ps, yt(At(e(o).xilnexImportDialogProps.value)), null, 16),
2007
- R(Gt, {
2008
- modelValue: e(q),
2009
- "onUpdate:modelValue": r[9] || (r[9] = (T) => ft(q) ? q.value = T : null),
2010
- html: e(y),
2011
- "template-name": e(ce),
2012
- "is-default": e(Y)
2013
- }, null, 8, ["modelValue", "html", "template-name", "is-default"])
2014
- ]))
2015
- ], 64)) : I("", !0)
2016
- ];
2017
- }),
2018
- _: 1
2019
- }, 8, ["title", "actions"]);
2020
- };
2021
- }
2022
- });
2023
- export {
2024
- oo as default
2025
- };