@feedmepos/mf-inventory-portal 1.8.0-dev.2 → 1.8.0-dev.21

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