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