@feedmepos/mf-inventory-portal 1.7.12-dev.4 → 1.7.12

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