@feedmepos/mf-inventory-portal 1.7.9-dev.4 → 1.7.10

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