@feedmepos/mf-inventory-portal 1.7.2-dev.9 → 1.7.3-dev.1

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