@feedmepos/mf-inventory-portal 1.8.0-dev.2 → 1.8.0-dev.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/App-BxpqrT2x.js +1445 -0
- package/dist/{ApprovalView-RaXuWWSu.js → ApprovalView-DZBM9n1Y.js} +26 -25
- package/dist/{BindingsDialog-DomvXijP.js → BindingsDialog-jjHrmqY_.js} +2 -2
- package/dist/{BindingsPicker-DGnzxEs7.js → BindingsPicker-Dv1KwHIQ.js} +2 -2
- package/dist/{BindingsTable-DfG9kWrv.js → BindingsTable-Ch_TlrZu.js} +10 -10
- package/dist/BulkReceiveRequestPage-BVB3PNxF.js +2839 -0
- package/dist/{ChangeLocationComponent.vue_vue_type_script_setup_true_lang-CVekIoiN.js → ChangeLocationComponent.vue_vue_type_script_setup_true_lang-DpHYhOmI.js} +1 -1
- package/dist/{ClosingDraftView-C3n66bbh.js → ClosingDraftView-DQQkWYOh.js} +748 -746
- package/dist/ClosingHistoryView-CXXd0Csp.js +769 -0
- package/dist/{ClosingTemplateView-DwGloYxn.js → ClosingTemplateView-Bf5Ivxjw.js} +22 -21
- package/dist/{CustomPrintTemplatePreview.vue_vue_type_script_setup_true_lang-9eY_r8LF.js → CustomPrintTemplatePreview.vue_vue_type_script_setup_true_lang-C3Y_rwNE.js} +1 -1
- package/dist/{DefaultView-JC_e4xgC.js → DefaultView-Bt8ZFV10.js} +2 -2
- package/dist/{DeliveryOrderPrintPreview-BBCvI67S.js → DeliveryOrderPrintPreview-BS5ZKe1f.js} +15 -15
- package/dist/{EmailDialog.vue_vue_type_script_setup_true_lang-H4FWc9ga.js → EmailDialog.vue_vue_type_script_setup_true_lang-BvDFKrFF.js} +10077 -9950
- package/dist/FeatureCapabilityBadge.vue_vue_type_script_setup_true_lang-B389iY-f.js +48 -0
- package/dist/FeatureCapabilityGate-BAOroN-j.js +82 -0
- package/dist/FeaturePageGate.vue_vue_type_script_setup_true_lang-Xapa8xyy.js +189 -0
- package/dist/{FmDateRangePickerChip.vue_vue_type_script_setup_true_lang-Q8Mptiv3.js → FmDateRangePickerChip.vue_vue_type_script_setup_true_lang-CgbvPK8u.js} +1 -1
- package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-CE1_yyHe.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-DnCj1qv6.js} +2 -2
- package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-CGJi3f86.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-CUb4VGOc.js} +2 -2
- package/dist/{FmMultiselectDialog-DCaRlBIy.js → FmMultiselectDialog-Bz8bNuK2.js} +2 -2
- package/dist/FmMultiselectDialog-CosTDuNE.js +123 -0
- package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-ClaLVtpK.js → FmUnitInput.vue_vue_type_script_setup_true_lang-3OrHiybe.js} +105 -99
- package/dist/ImportView-BoTmcCyn.js +1540 -0
- package/dist/{IngredientsView-DPj9lBTK.js → IngredientsView-VED94pGW.js} +691 -689
- package/dist/{IntegrationExplorerView-CO2wpUR_.js → IntegrationExplorerView-B9ZY9hG1.js} +1537 -1620
- package/dist/IntegrationPlatformView-Bar1zj3R.js +13385 -0
- package/dist/{IntegrationView-DIeZoey0.js → IntegrationView-BvzBDBGp.js} +2604 -2565
- package/dist/{InventoryBindingForm-Cj4_Chue.js → InventoryBindingForm-DWhXHIaL.js} +1 -1
- package/dist/InventoryBindingForm.vue_vue_type_script_setup_true_lang-mZRrPywY.js +472 -0
- package/dist/{InventoryBindingSummary-yzGzd7jJ.js → InventoryBindingSummary-Imo2J8O2.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-CChCnKxa.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-KFKeWhhY.js +2317 -0
- package/dist/{ProductionRunLifecycleDialogs.vue_vue_type_script_setup_true_lang-BYyiiAWb.js → ProductionRunLifecycleDialogs.vue_vue_type_script_setup_true_lang-CobaPkUr.js} +3053 -3163
- package/dist/ProductionRunPage-BrXsPo-A.js +954 -0
- package/dist/{PublishView-CPK9NeVF.js → PublishView-_k3N44Pl.js} +3 -3
- package/dist/{PurchaseOrderPrintPreview-DosqWQeN.js → PurchaseOrderPrintPreview-DXVEhy-G.js} +17 -17
- package/dist/{ReceiveRequestView-BxSkpK2t.js → ReceiveRequestView-ByWddqiL.js} +17 -16
- package/dist/RecipeView-C29uNZxj.js +3272 -0
- package/dist/SettingsView-CyE6ZM8x.js +1005 -0
- package/dist/StockView-BBR404Ie.js +3003 -0
- package/dist/{SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-GdGJCuc0.js → SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-Cmnk66T9.js} +1 -1
- package/dist/{SupplierView-BKxKoi_0.js → SupplierView-CIB5GCwp.js} +304 -301
- package/dist/{SurchargeView-Db4cwhZv.js → SurchargeView-DNtEbO7I.js} +7 -7
- package/dist/{SystemTrailDialog.vue_vue_type_script_setup_true_lang-CpkF77Ow.js → SystemTrailDialog.vue_vue_type_script_setup_true_lang-ClCi5rLI.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-C19KOLrQ.js +332 -0
- package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-DD5nMsrn.js +4953 -0
- package/dist/TransferTemplateView-BftwH1_W.js +2347 -0
- package/dist/{UnitCostHistoryView-CqcyjCCd.js → UnitCostHistoryView-CE-1joTV.js} +4 -4
- package/dist/{UnitDisplayControl.vue_vue_type_script_setup_true_lang-DO80_8SZ.js → UnitDisplayControl.vue_vue_type_script_setup_true_lang-reJFavQF.js} +4 -4
- package/dist/{UnitView-BqdK1AM_.js → UnitView-T-Vo8IpV.js} +111 -106
- package/dist/{WarehouseView-COJM9IXM.js → WarehouseView-CzQcj5VY.js} +12 -11
- package/dist/{WastageTemplateView-DW3viTHN.js → WastageTemplateView-Cm5_V2zN.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-DnOtng5V.js} +10177 -10126
- package/dist/app.d.ts +151 -164
- package/dist/app.js +1 -1
- package/dist/bulk-edit-simulation.helper-BZRyNbpM.js +178 -0
- package/dist/{closing-template-DezidSM0.js → closing-template-BiJRchG9.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-Bzlk0lSj.js} +1 -1
- package/dist/{dayjs.min-CNp5DLBB.js → dayjs.min-B8gqMYa7.js} +1 -1
- package/dist/{decimal-Z7oJdGk8.js → decimal-utE08Cjv.js} +2 -2
- package/dist/{defineDeepModel-CMxJn_H2.js → defineDeepModel-D_tKNP-n.js} +5 -5
- package/dist/{duplicate-template-BetV5oy_.js → duplicate-template-lCi99jVD.js} +1 -1
- package/dist/{feature-CkWaZ-5K.js → feature-Zeyz4pJe.js} +2089 -2854
- package/dist/feature-flags/core.d.ts +4 -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-v_KvI4jM.js} +1 -1
- package/dist/{format-unit-display-DM5We5cx.js → format-unit-display-C8oexlpM.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-Doi1vn9Q.js} +1 -1
- package/dist/{import-export.helper-BOmADwUw.js → import-export.helper-DyRPa4wa.js} +17 -17
- package/dist/{index-CIH9NCvs.js → index-B-SVjo8N.js} +1 -1
- package/dist/{index-ClYgfwW7.js → index-Bl8qrC1m.js} +2234 -2163
- package/dist/{JsonViewer.vue_vue_type_script_setup_true_lang-ig2zSXAB.js → index-C25C1Dg7.js} +1074 -1066
- package/dist/{index-7fz5sGDO.js → index-DZ9i-1uy.js} +3 -3
- package/dist/index-eGvSlWMU.js +1892 -0
- package/dist/layout/SingleColumnLayout.vue.d.ts +1 -1
- package/dist/{lz-string-CCsc2X7t.js → lz-string-pPNhTzCj.js} +1 -1
- package/dist/menu-usage-module-Bq_KLsO4.js +74 -0
- package/dist/{netsuite-COumFXC2.js → netsuite-C5s0JXRA.js} +254 -263
- package/dist/netsuite-explorer-BF-bujxD.js +79 -0
- package/dist/{predefined-templates-Bw9A9LNA.js → predefined-templates-C6hmqqhm.js} +1 -1
- package/dist/production-run-list-DR1WsaBR.js +61 -0
- package/dist/{purchase-order-template-BaZjdGq8.js → purchase-order-template-C0XlITpK.js} +1 -1
- package/dist/{recalculationUtils-t32wAurN.js → recalculationUtils-CnzCEyIJ.js} +1 -1
- package/dist/router/name.d.ts +2 -2
- package/dist/{row-action.enum-BDeudY4d.js → row-action.enum-Ci5mHFdS.js} +1 -1
- package/dist/rules-rAD4INHX.js +243 -0
- package/dist/{stock-B59sfN28.js → stock-CukGlv0u.js} +1 -1
- package/dist/stock-DUQYl3xe.js +78 -0
- package/dist/stores/feature.d.ts +41 -11
- 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-CDPdi2B5.js} +2 -2
- package/dist/{surcharge-C1uE3uQa.js → surcharge-XABFccMt.js} +1 -1
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/{uom-rules-DjfyrFHJ.js → uom-rules-BbNTM-Xw.js} +1 -1
- package/dist/{use-ingredient-select-dialog-7A7fWyEH.js → use-ingredient-select-dialog-CxrFXfoM.js} +2 -2
- package/dist/use-inventory-binding-dialog-BZpguHE1.js +113 -0
- package/dist/{use-template-enabled-locations-C-Hqqgzt.js → use-template-enabled-locations-B9n-uc36.js} +2 -2
- package/dist/{use-transfer-locations-CqsXvOI2.js → use-transfer-locations-z78M6XgR.js} +14 -14
- package/dist/{useHrmPermission-BzwD3Ctc.js → useHrmPermission-CfMWeFGZ.js} +1 -1
- package/dist/{useNavigationMenu-PrZg9HS7.js → useNavigationMenu-B6dCSflb.js} +111 -117
- package/dist/{useSseClient-FCyLWq8k.js → useSseClient-ICUObHUB.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-DBxqzbt5.js +295 -0
- package/dist/{vue-i18n-C34f-Tph.js → vue-i18n-CdbY8MsR.js} +539 -539
- package/dist/{xlsx.util-X4amwe_k.js → xlsx.util-CD5NablT.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
|
@@ -1,2614 +0,0 @@
|
|
|
1
|
-
import { defineComponent as pe, createElementBlock as q, openBlock as j, createElementVNode as e, createVNode as y, toDisplayString as f, unref as s, ref as Y, h as be, computed as T, watch as Fe, resolveComponent as D, createBlock as ne, isRef as Pe, withCtx as M, Fragment as ue, renderList as ve, createCommentVNode as se, normalizeClass as He, reactive as _t, mergeModels as st, useModel as jt, onMounted as Xe, createTextVNode as me, normalizeStyle as kt, watchEffect as Vt, renderSlot as at, onUnmounted as Ct, Teleport as Bt, normalizeProps as rt, mergeProps as ze } from "vue";
|
|
2
|
-
import { u as Dt, _ as Mt } from "./SingleColumnLayout.vue_vue_type_script_setup_true_lang-DpwneGOV.js";
|
|
3
|
-
import { u as Se, c as Re, a as Ne, F as lt, t as It, E as ie, s as Ht, d as Tt, B as Et, w as oe, h as Ce, i as it, e as ut, L as ge, M as Be } from "./app-yvK__CBL.js";
|
|
4
|
-
import { u as Oe } from "./stock-BF86TMW0.js";
|
|
5
|
-
import { c as Ut } from "./component-BmLAdDiY.js";
|
|
6
|
-
import { _ as ht, o as Pt } from "./UnitDisplayControl.vue_vue_type_script_setup_true_lang-DO80_8SZ.js";
|
|
7
|
-
import { _ as Ke, S as Ge, g as bt, a as Rt } from "./SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-GdGJCuc0.js";
|
|
8
|
-
import { a as qe } from "./FeatureCapabilityBadge.vue_vue_type_script_setup_true_lang-C1C8aDA6.js";
|
|
9
|
-
import { useI18n as ye, useCoreStore as Je } from "@feedmepos/mf-common";
|
|
10
|
-
import { u as gt, i as Te } from "./id-to-date-Dxw2jKhy.js";
|
|
11
|
-
import { useSnackbar as we, useDialog as Le, useProxiedModel as Ye, useBreakpoints as Nt } from "@feedmepos/ui-library";
|
|
12
|
-
import { defineStore as Ot } from "pinia";
|
|
13
|
-
import { F as Qe } from "./FmAdminBadge-DlplQOHb.js";
|
|
14
|
-
import { g as $e, a as he, e as Lt, t as Ee, c as xe, f as Yt, h as ct, i as xt, j as Ze, d as Me, k as zt } from "./number-gSLvxNqA.js";
|
|
15
|
-
import { u as Ae } from "./stock-B59sfN28.js";
|
|
16
|
-
import { c as Ue, A as Gt, M as Wt, R as Kt } from "./rules-C1btu0Md.js";
|
|
17
|
-
import { u as qt } from "./use-inventory-binding-dialog-Cc1tjTfV.js";
|
|
18
|
-
import { a as St } from "./FmMultiselectDialog-DCaRlBIy.js";
|
|
19
|
-
import { d as ke } from "./dayjs.min-CNp5DLBB.js";
|
|
20
|
-
import { _ as Xt } from "./NumberPrecisionInput.vue_vue_type_script_setup_true_lang-DzzTPdyF.js";
|
|
21
|
-
import { g as Jt } from "./decimal-Z7oJdGk8.js";
|
|
22
|
-
import { b as Qt, d as Zt, f as wt, t as dt, a as mt, p as eo, n as to, c as oo } from "./date2-2XjepIqc.js";
|
|
23
|
-
import { i as no } from "./FmDateRangePickerChip.vue_vue_type_script_setup_true_lang-Q8Mptiv3.js";
|
|
24
|
-
import { _ as so } from "./empty-placeholder-B0QU467o.js";
|
|
25
|
-
import { F as _e, u as ao } from "./feature-CkWaZ-5K.js";
|
|
26
|
-
import { u as At } from "./useHrmPermission-BzwD3Ctc.js";
|
|
27
|
-
import { _ as ro, F as ft } from "./TableActionableRow.vue_vue_type_script_setup_true_lang-DAMpuZ1X.js";
|
|
28
|
-
import { _ as lo } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-CGJi3f86.js";
|
|
29
|
-
import { u as io } from "./useSseClient-FCyLWq8k.js";
|
|
30
|
-
import { u as uo } from "./netsuite-COumFXC2.js";
|
|
31
|
-
import { P as co, J as mo } from "./app-C39bYJmq.js";
|
|
32
|
-
var Ie = /* @__PURE__ */ ((A) => (A.History = "History", A.Convert = "Convert", A.Adjust = "Adjust", A))(Ie || {});
|
|
33
|
-
const fo = [
|
|
34
|
-
{
|
|
35
|
-
translationKey: "inventory.stock.action.history",
|
|
36
|
-
color: "text-neutral-700",
|
|
37
|
-
value: "History"
|
|
38
|
-
/* History */
|
|
39
|
-
}
|
|
40
|
-
], vo = [
|
|
41
|
-
{
|
|
42
|
-
translationKey: "inventory.stock.action.history",
|
|
43
|
-
color: "text-neutral-700",
|
|
44
|
-
value: "History"
|
|
45
|
-
/* History */
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
translationKey: "inventory.stock.action.convert",
|
|
49
|
-
color: "text-neutral-700",
|
|
50
|
-
value: "Convert"
|
|
51
|
-
/* Convert */
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
translationKey: "inventory.stock.action.adjust",
|
|
55
|
-
color: "text-neutral-700",
|
|
56
|
-
value: "Adjust"
|
|
57
|
-
/* Adjust */
|
|
58
|
-
}
|
|
59
|
-
], po = { class: "flex items-center gap-8" }, yo = { class: "whitespace-nowrap" }, _o = /* @__PURE__ */ pe({
|
|
60
|
-
__name: "StockHeaderPreview",
|
|
61
|
-
setup(A) {
|
|
62
|
-
const { t: c } = ye();
|
|
63
|
-
return (k, _) => (j(), q("div", po, [
|
|
64
|
-
e("div", yo, f(s(c)("inventory.stock.prediction.daysRemaining")), 1),
|
|
65
|
-
y(qe, {
|
|
66
|
-
tier: "standard",
|
|
67
|
-
category: "beta"
|
|
68
|
-
})
|
|
69
|
-
]));
|
|
70
|
-
}
|
|
71
|
-
}), Ft = Ot("stockActions", () => {
|
|
72
|
-
const A = Y(!1), c = Se(), k = Oe(), _ = gt(), w = we(), V = Le(), { t: d } = ye();
|
|
73
|
-
async function r() {
|
|
74
|
-
if (c._currentLocation) {
|
|
75
|
-
A.value = !0;
|
|
76
|
-
try {
|
|
77
|
-
await k.readStockBalance(), await k.readProductBalance(), await _.readStockEstimateBalance();
|
|
78
|
-
} catch {
|
|
79
|
-
w.open({
|
|
80
|
-
title: d("inventory.stock.error.title"),
|
|
81
|
-
message: d("inventory.stock.error.message"),
|
|
82
|
-
type: "error"
|
|
83
|
-
});
|
|
84
|
-
} finally {
|
|
85
|
-
A.value = !1;
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
const b = Y();
|
|
90
|
-
async function R(g) {
|
|
91
|
-
var $, E, N;
|
|
92
|
-
if (!!!((E = ($ = g.convert) == null ? void 0 : $.inventoryBindings) != null && E.length)) {
|
|
93
|
-
V.open({
|
|
94
|
-
title: d("inventory.stock.error.convert.title"),
|
|
95
|
-
message: d("inventory.stock.error.convert.message")
|
|
96
|
-
});
|
|
97
|
-
return;
|
|
98
|
-
}
|
|
99
|
-
const n = {
|
|
100
|
-
maxCount: ((N = k.productBalance.find(({ id: O }) => O === g._id)) == null ? void 0 : N.count) || 0,
|
|
101
|
-
sku: g,
|
|
102
|
-
show: !0,
|
|
103
|
-
"onUpdate:show"(O) {
|
|
104
|
-
b.value.show = O;
|
|
105
|
-
},
|
|
106
|
-
onSubmitted() {
|
|
107
|
-
r();
|
|
108
|
-
}
|
|
109
|
-
};
|
|
110
|
-
b.value = n;
|
|
111
|
-
}
|
|
112
|
-
const C = Y();
|
|
113
|
-
async function l(g) {
|
|
114
|
-
const o = {
|
|
115
|
-
stock: g,
|
|
116
|
-
show: !0,
|
|
117
|
-
"onUpdate:show"(t) {
|
|
118
|
-
C.value.show = t;
|
|
119
|
-
},
|
|
120
|
-
onSubmitted() {
|
|
121
|
-
r();
|
|
122
|
-
}
|
|
123
|
-
};
|
|
124
|
-
C.value = o;
|
|
125
|
-
}
|
|
126
|
-
const a = Y();
|
|
127
|
-
async function B(g) {
|
|
128
|
-
const o = {
|
|
129
|
-
sku: g,
|
|
130
|
-
show: !0,
|
|
131
|
-
"onUpdate:show"(t) {
|
|
132
|
-
a.value.show = t;
|
|
133
|
-
}
|
|
134
|
-
};
|
|
135
|
-
a.value = o;
|
|
136
|
-
}
|
|
137
|
-
function v(g, o) {
|
|
138
|
-
const t = Re(o);
|
|
139
|
-
switch (g) {
|
|
140
|
-
case Ie.History:
|
|
141
|
-
B(t);
|
|
142
|
-
return;
|
|
143
|
-
case Ie.Convert:
|
|
144
|
-
R(t);
|
|
145
|
-
return;
|
|
146
|
-
case Ie.Adjust:
|
|
147
|
-
l(t);
|
|
148
|
-
return;
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
return {
|
|
152
|
-
fetchStockBalance: r,
|
|
153
|
-
onActionMenu: v,
|
|
154
|
-
stockHistoryProps: a,
|
|
155
|
-
showSkuHistory: B,
|
|
156
|
-
convertSkuDialogProps: b,
|
|
157
|
-
adjustSkuDialogProps: C
|
|
158
|
-
};
|
|
159
|
-
});
|
|
160
|
-
function ko() {
|
|
161
|
-
var V;
|
|
162
|
-
const A = Se(), c = Ft(), k = Je(), { t: _ } = ye();
|
|
163
|
-
return {
|
|
164
|
-
columnDefs: [
|
|
165
|
-
{
|
|
166
|
-
accessorKey: "code",
|
|
167
|
-
header: () => _("inventory.stock.code"),
|
|
168
|
-
enableSorting: !0,
|
|
169
|
-
size: 300
|
|
170
|
-
},
|
|
171
|
-
{
|
|
172
|
-
accessorKey: "name",
|
|
173
|
-
header: () => _("inventory.stock.product"),
|
|
174
|
-
enableSorting: !0,
|
|
175
|
-
size: "auto"
|
|
176
|
-
},
|
|
177
|
-
{
|
|
178
|
-
id: "UOM",
|
|
179
|
-
header: () => _("inventory.stock.balance"),
|
|
180
|
-
cell(d) {
|
|
181
|
-
const r = d.row.original, b = {
|
|
182
|
-
unit: r.unit,
|
|
183
|
-
sku: r,
|
|
184
|
-
amount: r.balance,
|
|
185
|
-
defaultTrackingMeasurement: r.trackingMeasurement ?? void 0
|
|
186
|
-
};
|
|
187
|
-
return be(ht, b);
|
|
188
|
-
},
|
|
189
|
-
size: 180
|
|
190
|
-
},
|
|
191
|
-
...(V = k.sessionUser.value) != null && V.role.isAdmin ? [
|
|
192
|
-
{
|
|
193
|
-
accessorKey: "isInactive",
|
|
194
|
-
header: () => be(Qe, {}, () => `${_("inventory.ingredient.status.title")}`),
|
|
195
|
-
cell(d) {
|
|
196
|
-
const r = d.row.original.isInactive;
|
|
197
|
-
return be(
|
|
198
|
-
"span",
|
|
199
|
-
{
|
|
200
|
-
class: [
|
|
201
|
-
"inline-block px-3 py-1 rounded-full text-xs font-semibold",
|
|
202
|
-
r ? "bg-red-100 text-red-700" : "bg-green-100 text-green-700"
|
|
203
|
-
].join(" ")
|
|
204
|
-
},
|
|
205
|
-
_(r ? "inventory.ingredient.status.inactive" : "inventory.ingredient.status.active")
|
|
206
|
-
);
|
|
207
|
-
},
|
|
208
|
-
enableSorting: !0
|
|
209
|
-
}
|
|
210
|
-
] : [],
|
|
211
|
-
{
|
|
212
|
-
accessorKey: "day",
|
|
213
|
-
id: "expireDate",
|
|
214
|
-
header: () => be(_o),
|
|
215
|
-
enableSorting: !0,
|
|
216
|
-
sortUndefined: "last",
|
|
217
|
-
cell(d) {
|
|
218
|
-
var B, v;
|
|
219
|
-
const r = d.row.original.day, b = d.row.original.operator, R = (B = d.row.original.thresholds) == null ? void 0 : B.low, C = (v = d.row.original.thresholds) == null ? void 0 : v.mid;
|
|
220
|
-
if (typeof r != "number" || typeof R != "number" || typeof C != "number")
|
|
221
|
-
return be(Ke, {
|
|
222
|
-
days: r,
|
|
223
|
-
operator: b
|
|
224
|
-
});
|
|
225
|
-
const l = r <= R ? Ge.low : r <= C ? Ge.mid : Ge.high;
|
|
226
|
-
return be(Ke, {
|
|
227
|
-
days: r,
|
|
228
|
-
level: l
|
|
229
|
-
});
|
|
230
|
-
},
|
|
231
|
-
size: 200
|
|
232
|
-
},
|
|
233
|
-
{
|
|
234
|
-
id: "action",
|
|
235
|
-
cell(d) {
|
|
236
|
-
var r;
|
|
237
|
-
return Ut(
|
|
238
|
-
((r = A._currentLocation) == null ? void 0 : r.type) === "restaurant" ? fo : vo,
|
|
239
|
-
(b) => c.onActionMenu(b, d.row.original)
|
|
240
|
-
);
|
|
241
|
-
},
|
|
242
|
-
enableSorting: !1,
|
|
243
|
-
size: 40,
|
|
244
|
-
meta: {
|
|
245
|
-
cellClass: "",
|
|
246
|
-
headerClass: ""
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
]
|
|
250
|
-
};
|
|
251
|
-
}
|
|
252
|
-
const ho = {
|
|
253
|
-
context: null,
|
|
254
|
-
error: null,
|
|
255
|
-
isRequired(A = "This field is required") {
|
|
256
|
-
return `${this.context ?? ""}`.length === 0 && (this.error = A), this;
|
|
257
|
-
},
|
|
258
|
-
isString(A = "Must be a valid string") {
|
|
259
|
-
return this.error ? this : (typeof this.context != "string" && (this.error ?? (this.error = A)), this);
|
|
260
|
-
},
|
|
261
|
-
toInt() {
|
|
262
|
-
return this.error ? this : (this.context = +this.context, this);
|
|
263
|
-
},
|
|
264
|
-
isInteger(A = "Must be an integer") {
|
|
265
|
-
return this.error ? this : (this.toInt(), isNaN(this.context) && (this.error = A), this);
|
|
266
|
-
},
|
|
267
|
-
min(A, c) {
|
|
268
|
-
if (this.error) return this;
|
|
269
|
-
try {
|
|
270
|
-
typeof this.context == "number" ? +this.context < A && (this.error = c ?? `Must be at least ${A}`) : Object.prototype.hasOwnProperty.call(this.context, "length") ? +this.context.length < A && (this.error = c ?? `Must be at least ${A}`) : this.error = "Length cannot be determined";
|
|
271
|
-
} catch {
|
|
272
|
-
this.error = "Length cannot be determined";
|
|
273
|
-
}
|
|
274
|
-
return this;
|
|
275
|
-
},
|
|
276
|
-
max(A, c) {
|
|
277
|
-
if (this.error) return this;
|
|
278
|
-
try {
|
|
279
|
-
typeof this.context == "number" ? +this.context > A && (this.error = c ?? `Must be at most ${A}`) : "length" in this.context ? +this.context.length > A && (this.error = c ?? `Must be at most ${A}`) : this.error = "Length cannot be determined";
|
|
280
|
-
} catch {
|
|
281
|
-
this.error = "Length cannot be determined";
|
|
282
|
-
}
|
|
283
|
-
return this;
|
|
284
|
-
}
|
|
285
|
-
};
|
|
286
|
-
function vt(A) {
|
|
287
|
-
return { ...ho, context: A };
|
|
288
|
-
}
|
|
289
|
-
const bo = { class: "flex items-center" }, go = { class: "fm-typo-en-title-md-800" }, xo = { class: "flex flex-col gap-24 w-full" }, So = { class: "flex flex-col gap-8" }, wo = { class: "fm-typo-en-body-lg-600" }, Ao = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary flex-grow" }, Fo = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-error" }, $o = { class: "flex flex-col p-16 gap-8" }, jo = { class: "flex flex-col gap-4" }, Vo = { class: "fm-typo-en-body-md-600 text-fm-color-typo-secondary bg-fm-color-neutral-gray-100 border-b py-12 px-16" }, Co = { class: "grid grid-cols-[auto_100px_100px_48px] xs:grid-cols-[auto_80px_120px_48px] gap-8 px-8 items-center" }, Bo = { class: "xs:col-span-3" }, Do = { class: "flex gap-8" }, Mo = /* @__PURE__ */ pe({
|
|
290
|
-
__name: "ConvertSkuDialog",
|
|
291
|
-
props: {
|
|
292
|
-
sku: {},
|
|
293
|
-
maxCount: {},
|
|
294
|
-
show: { type: Boolean }
|
|
295
|
-
},
|
|
296
|
-
emits: ["update:show", "submitted"],
|
|
297
|
-
setup(A, { expose: c, emit: k }) {
|
|
298
|
-
const _ = A, w = k, V = qt(), d = Ne(), r = Ae(), b = we(), { t: R } = ye(), C = Y(0), l = Y(null), a = T(() => d.skus), B = T(
|
|
299
|
-
() => {
|
|
300
|
-
var x, F;
|
|
301
|
-
return (((F = (x = _.sku) == null ? void 0 : x.convert) == null ? void 0 : F.inventoryBindings) ?? []).filter(
|
|
302
|
-
(G) => G.type === lt.enum.SKU
|
|
303
|
-
);
|
|
304
|
-
}
|
|
305
|
-
), v = T({
|
|
306
|
-
get() {
|
|
307
|
-
return !!l.value;
|
|
308
|
-
},
|
|
309
|
-
set(x) {
|
|
310
|
-
x ? l.value = Re(B.value) : (l.value = null, C.value = Math.min(C.value, _.maxCount ?? 0));
|
|
311
|
-
}
|
|
312
|
-
}), g = Y(!1);
|
|
313
|
-
Fe([() => _.show], ([x]) => {
|
|
314
|
-
x && (C.value = 0);
|
|
315
|
-
});
|
|
316
|
-
function o() {
|
|
317
|
-
L(_.sku, Ee(C.value), l.value);
|
|
318
|
-
}
|
|
319
|
-
function t(x) {
|
|
320
|
-
if (l.value)
|
|
321
|
-
return !0;
|
|
322
|
-
const F = vt(x).isInteger().max(_.maxCount ?? 0).error ?? "";
|
|
323
|
-
return F || !0;
|
|
324
|
-
}
|
|
325
|
-
function n(x) {
|
|
326
|
-
var I;
|
|
327
|
-
const F = (I = _.sku.convert) != null && I.measurement ? _.sku.unit.measurements.find((u) => {
|
|
328
|
-
var h;
|
|
329
|
-
return u.id === ((h = _.sku.convert) == null ? void 0 : h.measurement);
|
|
330
|
-
}) ?? null : null, G = $e(_.sku.unit, F), H = Yt(+x);
|
|
331
|
-
return vt(H).isInteger().max(G).error ? "Precision cannot be more than " + G : !0;
|
|
332
|
-
}
|
|
333
|
-
const $ = T(
|
|
334
|
-
() => {
|
|
335
|
-
var x, F;
|
|
336
|
-
return (x = _.sku.convert) != null && x.measurement ? (F = _.sku.unit.measurements.find((G) => {
|
|
337
|
-
var H;
|
|
338
|
-
return G.id === ((H = _.sku.convert) == null ? void 0 : H.measurement);
|
|
339
|
-
})) == null ? void 0 : F.abbrev : _.sku.unit.abbrev;
|
|
340
|
-
}
|
|
341
|
-
), E = T(() => {
|
|
342
|
-
var H, J;
|
|
343
|
-
const F = It({
|
|
344
|
-
bindings: ((H = _.sku.convert) == null ? void 0 : H.inventoryBindings) ?? [],
|
|
345
|
-
skus: d.skus,
|
|
346
|
-
skuGroups: d.skuGroups,
|
|
347
|
-
recipes: d.recipes
|
|
348
|
-
}).inventoryBindings.filter((I) => "success" in I && I.success).map((I) => I).map((I) => I.binding);
|
|
349
|
-
return (J = l.value ?? F) == null ? void 0 : J.map((I) => {
|
|
350
|
-
var ee, ae, Q, W, te;
|
|
351
|
-
const u = d.skus.find((le) => le._id === I.id), h = ((ee = I.measurement) == null ? void 0 : ee.abbrev) ?? ((ae = u == null ? void 0 : u.unit) == null ? void 0 : ae.abbrev), p = (Q = _.sku.convert) != null && Q.measurement ? _.sku.unit.measurements.find((le) => {
|
|
352
|
-
var ce;
|
|
353
|
-
return le.id === ((ce = _.sku.convert) == null ? void 0 : ce.measurement);
|
|
354
|
-
}) ?? null : null, m = $e(_.sku.unit, p), i = n(`${C.value}`) === !0 ? he(
|
|
355
|
-
Lt(
|
|
356
|
-
I.amount,
|
|
357
|
-
Ee(+C.value, m)
|
|
358
|
-
),
|
|
359
|
-
!1
|
|
360
|
-
) : "0", S = (te = (W = l.value) == null ? void 0 : W.find((le) => le.id === (u == null ? void 0 : u._id))) == null ? void 0 : te.amount, P = S ? he(S, !1) : null;
|
|
361
|
-
return {
|
|
362
|
-
sku: u,
|
|
363
|
-
convertAmount: P ?? i,
|
|
364
|
-
abbrev: h
|
|
365
|
-
};
|
|
366
|
-
});
|
|
367
|
-
}), N = Y();
|
|
368
|
-
c({
|
|
369
|
-
validateInputs: () => {
|
|
370
|
-
var x, F;
|
|
371
|
-
(F = (x = N.value) == null ? void 0 : x.validateInputs) == null || F.call(x);
|
|
372
|
-
},
|
|
373
|
-
resetInputsValidation: () => {
|
|
374
|
-
var x, F;
|
|
375
|
-
(F = (x = N.value) == null ? void 0 : x.resetInputsValidation) == null || F.call(x);
|
|
376
|
-
},
|
|
377
|
-
resetInputs: () => {
|
|
378
|
-
var x, F;
|
|
379
|
-
(F = (x = N.value) == null ? void 0 : x.resetInputs) == null || F.call(x);
|
|
380
|
-
}
|
|
381
|
-
});
|
|
382
|
-
const O = Ye(_, "show");
|
|
383
|
-
async function L(x, F, G) {
|
|
384
|
-
g.value = !0;
|
|
385
|
-
try {
|
|
386
|
-
await r.convertSku({
|
|
387
|
-
conversions: [
|
|
388
|
-
{
|
|
389
|
-
doc: x,
|
|
390
|
-
amount: F,
|
|
391
|
-
overrides: G == null ? void 0 : G.map((H) => ({
|
|
392
|
-
...H,
|
|
393
|
-
amount: {
|
|
394
|
-
...H.amount,
|
|
395
|
-
amount: -1 * Math.abs(H.amount.amount)
|
|
396
|
-
// ensure truly negative
|
|
397
|
-
}
|
|
398
|
-
}))
|
|
399
|
-
}
|
|
400
|
-
]
|
|
401
|
-
}), w("update:show", !1), w("submitted");
|
|
402
|
-
} catch (H) {
|
|
403
|
-
b.open({
|
|
404
|
-
title: "Something went wrong",
|
|
405
|
-
message: `Cannot convert ${x.name}. Please try again.`,
|
|
406
|
-
type: "error"
|
|
407
|
-
}), console.error("error at converting stock amount", x, F, H);
|
|
408
|
-
} finally {
|
|
409
|
-
g.value = !1;
|
|
410
|
-
}
|
|
411
|
-
}
|
|
412
|
-
function X(x, F, G) {
|
|
413
|
-
const H = +F;
|
|
414
|
-
let J = G;
|
|
415
|
-
F.length > 0 && isFinite(H) ? J = G.map((I) => (I.id !== x || (I.amount = xe(H)), I)) : J = G.map((I) => (I.id !== x || (I.amount = { amount: 0, precision: 0 }), I)), l.value = J;
|
|
416
|
-
}
|
|
417
|
-
function z(x) {
|
|
418
|
-
const F = a.value.find((G) => G._id === x);
|
|
419
|
-
return F ? bt(F.unit, !0) : [];
|
|
420
|
-
}
|
|
421
|
-
function K(x, F) {
|
|
422
|
-
const G = z(x), H = G.find((J) => J.value === F) ?? G.find((J) => J.value === null);
|
|
423
|
-
return H ? {
|
|
424
|
-
...H,
|
|
425
|
-
label: H.abbrev
|
|
426
|
-
} : null;
|
|
427
|
-
}
|
|
428
|
-
function U(x, F, G) {
|
|
429
|
-
let H;
|
|
430
|
-
if (F === null)
|
|
431
|
-
H = G.map((J) => (J.id !== x || (J.measurement = null), J)) ?? [];
|
|
432
|
-
else {
|
|
433
|
-
const J = a.value.find((I) => I._id === x);
|
|
434
|
-
H = G.map((I) => {
|
|
435
|
-
var u, h;
|
|
436
|
-
return I.id !== x || (I.measurement = (h = (u = J == null ? void 0 : J.unit) == null ? void 0 : u.measurements) == null ? void 0 : h.find((p) => p.id === F)), I;
|
|
437
|
-
}) ?? [];
|
|
438
|
-
}
|
|
439
|
-
l.value = H;
|
|
440
|
-
}
|
|
441
|
-
function Z(x, F) {
|
|
442
|
-
const G = F.filter((H) => H.id !== x);
|
|
443
|
-
l.value = G;
|
|
444
|
-
}
|
|
445
|
-
function re() {
|
|
446
|
-
const x = (l.value ?? []).map((F) => ({
|
|
447
|
-
...F,
|
|
448
|
-
type: lt.enum.SKU
|
|
449
|
-
}));
|
|
450
|
-
V.promptIngredientsBinding(
|
|
451
|
-
x,
|
|
452
|
-
(F) => l.value = F,
|
|
453
|
-
_.sku._id
|
|
454
|
-
);
|
|
455
|
-
}
|
|
456
|
-
return Fe(
|
|
457
|
-
() => _.show,
|
|
458
|
-
(x) => {
|
|
459
|
-
x || (l.value = null, C.value = 0);
|
|
460
|
-
}
|
|
461
|
-
), (x, F) => {
|
|
462
|
-
const G = D("FmTextField"), H = D("FmForm"), J = D("FmCard"), I = D("FmSwitch"), u = D("FmFormGroup"), h = D("FmSelect"), p = D("FmButton"), m = D("FmSideSheet");
|
|
463
|
-
return j(), ne(m, {
|
|
464
|
-
"dismiss-away": "",
|
|
465
|
-
modelValue: s(O),
|
|
466
|
-
"onUpdate:modelValue": F[3] || (F[3] = (i) => Pe(O) ? O.value = i : null),
|
|
467
|
-
"max-width": 500
|
|
468
|
-
}, {
|
|
469
|
-
"side-sheet-header": M(() => [
|
|
470
|
-
e("div", bo, [
|
|
471
|
-
e("div", go, f(s(R)("inventory.stock.convert.title", { name: x.sku.name })), 1)
|
|
472
|
-
])
|
|
473
|
-
]),
|
|
474
|
-
default: M(() => [
|
|
475
|
-
e("div", xo, [
|
|
476
|
-
y(H, {
|
|
477
|
-
ref_key: "formRef",
|
|
478
|
-
ref: N,
|
|
479
|
-
onValidationSuccess: o
|
|
480
|
-
}, {
|
|
481
|
-
default: M(() => [
|
|
482
|
-
y(G, {
|
|
483
|
-
disabled: g.value,
|
|
484
|
-
"model-value": C.value,
|
|
485
|
-
"onUpdate:modelValue": F[0] || (F[0] = (i) => C.value = i),
|
|
486
|
-
label: s(R)("inventory.stock.convert.amount"),
|
|
487
|
-
rules: [t, n, s(Ue)(0)],
|
|
488
|
-
"append-text": $.value,
|
|
489
|
-
"helper-text": l.value ? void 0 : `Max ${x.maxCount} ${$.value}`
|
|
490
|
-
}, null, 8, ["disabled", "model-value", "label", "rules", "append-text", "helper-text"])
|
|
491
|
-
]),
|
|
492
|
-
_: 1
|
|
493
|
-
}, 512),
|
|
494
|
-
y(J, {
|
|
495
|
-
variant: "outlined",
|
|
496
|
-
class: "p-16"
|
|
497
|
-
}, {
|
|
498
|
-
default: M(() => [
|
|
499
|
-
e("div", So, [
|
|
500
|
-
e("div", wo, f(s(R)("inventory.stock.convert.deductionSummary")), 1),
|
|
501
|
-
(j(!0), q(ue, null, ve(E.value, (i) => {
|
|
502
|
-
var S, P;
|
|
503
|
-
return j(), q("div", {
|
|
504
|
-
key: (S = i.sku) == null ? void 0 : S._id,
|
|
505
|
-
class: "flex items-center"
|
|
506
|
-
}, [
|
|
507
|
-
e("div", Ao, f((P = i.sku) == null ? void 0 : P.name), 1),
|
|
508
|
-
e("div", Fo, " -" + f(i.convertAmount) + " " + f(i.abbrev), 1)
|
|
509
|
-
]);
|
|
510
|
-
}), 128))
|
|
511
|
-
])
|
|
512
|
-
]),
|
|
513
|
-
_: 1
|
|
514
|
-
}),
|
|
515
|
-
y(J, { variant: "outlined" }, {
|
|
516
|
-
default: M(() => [
|
|
517
|
-
e("div", $o, [
|
|
518
|
-
y(I, {
|
|
519
|
-
value: "",
|
|
520
|
-
modelValue: v.value,
|
|
521
|
-
"onUpdate:modelValue": F[1] || (F[1] = (i) => v.value = i),
|
|
522
|
-
label: s(R)("inventory.stock.convert.overrideDeduction"),
|
|
523
|
-
"label-placement": "right"
|
|
524
|
-
}, null, 8, ["modelValue", "label"]),
|
|
525
|
-
v.value ? (j(), q(ue, { key: 0 }, [
|
|
526
|
-
y(u, {
|
|
527
|
-
modelValue: l.value,
|
|
528
|
-
rules: [s(Gt)(1, "Must have at least one ingredient binding")]
|
|
529
|
-
}, null, 8, ["modelValue", "rules"]),
|
|
530
|
-
e("div", jo, [
|
|
531
|
-
e("div", Vo, f(s(R)("inventory.stock.convert.ingredients")), 1),
|
|
532
|
-
(j(!0), q(ue, null, ve(l.value, (i) => (j(), ne(u, {
|
|
533
|
-
key: i.id,
|
|
534
|
-
disabled: g.value,
|
|
535
|
-
modelValue: +s(he)(i.amount ?? { amount: 1, precision: 0 }),
|
|
536
|
-
rules: [
|
|
537
|
-
s(Wt)(
|
|
538
|
-
a.value.find((S) => S._id === i.id).unit,
|
|
539
|
-
i.measurement
|
|
540
|
-
),
|
|
541
|
-
s(Ue)(0)
|
|
542
|
-
]
|
|
543
|
-
}, {
|
|
544
|
-
default: M(({ invalid: S }) => {
|
|
545
|
-
var P, ee, ae;
|
|
546
|
-
return [
|
|
547
|
-
e("div", Co, [
|
|
548
|
-
e("div", Bo, f((P = a.value.find((Q) => Q._id === i.id)) == null ? void 0 : P.name), 1),
|
|
549
|
-
y(G, {
|
|
550
|
-
class: "xs:col-span-2",
|
|
551
|
-
disabled: g.value,
|
|
552
|
-
modelValue: +s(he)(
|
|
553
|
-
i.amount ?? { amount: 1, precision: 0 }
|
|
554
|
-
),
|
|
555
|
-
"onUpdate:modelValue": (Q) => X(i.id, Q, l.value ?? []),
|
|
556
|
-
invalid: S
|
|
557
|
-
}, null, 8, ["disabled", "modelValue", "onUpdate:modelValue", "invalid"]),
|
|
558
|
-
y(h, {
|
|
559
|
-
disabled: g.value,
|
|
560
|
-
class: "translate-y-[2px]",
|
|
561
|
-
items: z(i.id),
|
|
562
|
-
"model-value": (ae = K(i.id, (ee = i.measurement) == null ? void 0 : ee.id)) == null ? void 0 : ae.value,
|
|
563
|
-
"onUpdate:modelValue": (Q) => U(i.id, Q, l.value ?? []),
|
|
564
|
-
invalid: S
|
|
565
|
-
}, {
|
|
566
|
-
"helper-text": M(() => F[4] || (F[4] = [])),
|
|
567
|
-
_: 2
|
|
568
|
-
}, 1032, ["disabled", "items", "model-value", "onUpdate:modelValue", "invalid"]),
|
|
569
|
-
y(p, {
|
|
570
|
-
disabled: g.value,
|
|
571
|
-
type: "button",
|
|
572
|
-
variant: "tertiary",
|
|
573
|
-
icon: "delete",
|
|
574
|
-
onClick: (Q) => Z(i.id, l.value ?? [])
|
|
575
|
-
}, null, 8, ["disabled", "onClick"])
|
|
576
|
-
])
|
|
577
|
-
];
|
|
578
|
-
}),
|
|
579
|
-
_: 2
|
|
580
|
-
}, 1032, ["disabled", "modelValue", "rules"]))), 128))
|
|
581
|
-
]),
|
|
582
|
-
e("div", null, [
|
|
583
|
-
y(p, {
|
|
584
|
-
icon: "link",
|
|
585
|
-
label: s(R)("inventory.stock.convert.linkIngredient"),
|
|
586
|
-
variant: "plain",
|
|
587
|
-
onClick: re
|
|
588
|
-
}, null, 8, ["label"])
|
|
589
|
-
])
|
|
590
|
-
], 64)) : se("", !0)
|
|
591
|
-
])
|
|
592
|
-
]),
|
|
593
|
-
_: 1
|
|
594
|
-
})
|
|
595
|
-
])
|
|
596
|
-
]),
|
|
597
|
-
"side-sheet-footer": M(() => [
|
|
598
|
-
e("div", Do, [
|
|
599
|
-
y(p, {
|
|
600
|
-
loading: g.value,
|
|
601
|
-
label: s(R)("inventory.stock.convert.convertButton"),
|
|
602
|
-
onClick: F[2] || (F[2] = (i) => {
|
|
603
|
-
var S, P;
|
|
604
|
-
return (P = (S = N.value) == null ? void 0 : S.validateInputs) == null ? void 0 : P.call(S);
|
|
605
|
-
})
|
|
606
|
-
}, null, 8, ["loading", "label"])
|
|
607
|
-
])
|
|
608
|
-
]),
|
|
609
|
-
_: 1
|
|
610
|
-
}, 8, ["modelValue"]);
|
|
611
|
-
};
|
|
612
|
-
}
|
|
613
|
-
});
|
|
614
|
-
function De(A, c) {
|
|
615
|
-
const k = Ee(A, c);
|
|
616
|
-
return { ...k, amount: -k.amount };
|
|
617
|
-
}
|
|
618
|
-
function pt(A, c) {
|
|
619
|
-
return Ee(Math.abs(A), c);
|
|
620
|
-
}
|
|
621
|
-
const We = {
|
|
622
|
-
[ie.enum.DAMAGE]: {
|
|
623
|
-
label: "Damage",
|
|
624
|
-
toAdjustmentAmount: De
|
|
625
|
-
},
|
|
626
|
-
[ie.enum.WASTAGE]: {
|
|
627
|
-
label: "Wastage",
|
|
628
|
-
toAdjustmentAmount: De
|
|
629
|
-
},
|
|
630
|
-
[ie.enum.THEFT]: {
|
|
631
|
-
label: "Theft",
|
|
632
|
-
toAdjustmentAmount: De
|
|
633
|
-
},
|
|
634
|
-
[ie.enum.LOSE]: {
|
|
635
|
-
label: "Lose",
|
|
636
|
-
toAdjustmentAmount: De
|
|
637
|
-
},
|
|
638
|
-
[ie.enum.EXTRA]: {
|
|
639
|
-
label: "Extra",
|
|
640
|
-
toAdjustmentAmount: pt
|
|
641
|
-
},
|
|
642
|
-
[ie.enum.PURCHASE]: {
|
|
643
|
-
label: "Purchase",
|
|
644
|
-
toAdjustmentAmount: pt
|
|
645
|
-
}
|
|
646
|
-
}, Io = { class: "col-span-2 flex" }, Ho = { class: "flex-1" }, To = { class: "fm-typo-en-body-lg-600" }, Eo = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Uo = { class: "col-span-2 flex flex-col gap-4" }, Po = { class: "flex gap-4 text-fm-color-typo-primary fm-typo-en-body-lg-600" }, Ro = {
|
|
647
|
-
key: 0,
|
|
648
|
-
class: "fm-typo-en-body-md-400 text-fm-color-typo-warning"
|
|
649
|
-
}, $t = /* @__PURE__ */ pe({
|
|
650
|
-
__name: "AdjustedItemForm",
|
|
651
|
-
props: {
|
|
652
|
-
modelValue: {},
|
|
653
|
-
disabled: { type: Boolean },
|
|
654
|
-
isBackdate: { type: Boolean }
|
|
655
|
-
},
|
|
656
|
-
emits: ["update:modelValue", "click:delete"],
|
|
657
|
-
setup(A, { emit: c }) {
|
|
658
|
-
const k = A, _ = c, { t: w } = ye(), V = Oe(), d = T(
|
|
659
|
-
() => Object.keys(We).map((t) => ({
|
|
660
|
-
label: Ht(t),
|
|
661
|
-
value: t
|
|
662
|
-
}))
|
|
663
|
-
), r = T(() => bt(k.modelValue.doc.unit, !0)), b = T({
|
|
664
|
-
get() {
|
|
665
|
-
return k.modelValue.type ?? ie.enum.PURCHASE;
|
|
666
|
-
},
|
|
667
|
-
set(t) {
|
|
668
|
-
const n = {
|
|
669
|
-
...k.modelValue
|
|
670
|
-
};
|
|
671
|
-
n.type = t;
|
|
672
|
-
const $ = ct(k.modelValue.amount);
|
|
673
|
-
n.amount = We[n.type].toAdjustmentAmount(
|
|
674
|
-
+he($),
|
|
675
|
-
$.precision
|
|
676
|
-
), _("update:modelValue", n);
|
|
677
|
-
}
|
|
678
|
-
}), R = T({
|
|
679
|
-
get() {
|
|
680
|
-
const t = ct(k.modelValue.amount);
|
|
681
|
-
return +he(t);
|
|
682
|
-
},
|
|
683
|
-
set(t) {
|
|
684
|
-
const n = {
|
|
685
|
-
...k.modelValue
|
|
686
|
-
}, $ = xe(t);
|
|
687
|
-
n.amount = We[b.value].toAdjustmentAmount(
|
|
688
|
-
t,
|
|
689
|
-
$.precision
|
|
690
|
-
), _("update:modelValue", n);
|
|
691
|
-
}
|
|
692
|
-
}), C = T({
|
|
693
|
-
get() {
|
|
694
|
-
var t;
|
|
695
|
-
return ((t = k.modelValue.measurement) == null ? void 0 : t.id) ?? null;
|
|
696
|
-
},
|
|
697
|
-
set(t) {
|
|
698
|
-
var $, E;
|
|
699
|
-
const n = {
|
|
700
|
-
...k.modelValue
|
|
701
|
-
};
|
|
702
|
-
n.measurement = ((E = ($ = k.modelValue.doc.unit) == null ? void 0 : $.measurements) == null ? void 0 : E.find((N) => N.id === t)) ?? null, _("update:modelValue", n);
|
|
703
|
-
}
|
|
704
|
-
}), l = T({
|
|
705
|
-
get() {
|
|
706
|
-
return k.modelValue.remark ?? "";
|
|
707
|
-
},
|
|
708
|
-
set(t) {
|
|
709
|
-
const n = {
|
|
710
|
-
...k.modelValue
|
|
711
|
-
};
|
|
712
|
-
n.remark = t, _("update:modelValue", n);
|
|
713
|
-
}
|
|
714
|
-
}), a = T(() => {
|
|
715
|
-
var n;
|
|
716
|
-
const t = (n = V.stockBalance.skus) == null ? void 0 : n.find(($) => $.id === k.modelValue.doc._id);
|
|
717
|
-
return (t == null ? void 0 : t.balance) ?? { amount: 0, precision: 0 };
|
|
718
|
-
}), B = T(() => {
|
|
719
|
-
const t = k.modelValue.amount, n = k.modelValue.measurement;
|
|
720
|
-
return n ? xt(t, n.conversion) : t;
|
|
721
|
-
}), v = T(
|
|
722
|
-
() => k.isBackdate ? a.value : Ze(a.value, B.value)
|
|
723
|
-
), g = T(
|
|
724
|
-
() => Jt(v.value, k.modelValue.doc.unit)
|
|
725
|
-
), o = T(
|
|
726
|
-
() => !k.isBackdate && B.value.amount < 0
|
|
727
|
-
);
|
|
728
|
-
return (t, n) => {
|
|
729
|
-
const $ = D("FmButton"), E = D("FmSelect"), N = D("FmTextarea"), O = D("FmCard");
|
|
730
|
-
return j(), ne(O, {
|
|
731
|
-
variant: "outlined",
|
|
732
|
-
class: "grid grid-cols-2 gap-8 p-16"
|
|
733
|
-
}, {
|
|
734
|
-
default: M(() => [
|
|
735
|
-
e("div", Io, [
|
|
736
|
-
e("div", Ho, [
|
|
737
|
-
e("div", To, f(t.modelValue.doc.name), 1),
|
|
738
|
-
e("div", Eo, f(t.modelValue.doc.code), 1)
|
|
739
|
-
]),
|
|
740
|
-
y($, {
|
|
741
|
-
variant: "tertiary",
|
|
742
|
-
"prepend-icon": "delete",
|
|
743
|
-
onClick: n[0] || (n[0] = (L) => _("click:delete"))
|
|
744
|
-
})
|
|
745
|
-
]),
|
|
746
|
-
y(E, {
|
|
747
|
-
disabled: t.disabled,
|
|
748
|
-
class: "col-span-2",
|
|
749
|
-
label: "Type",
|
|
750
|
-
items: d.value,
|
|
751
|
-
modelValue: b.value,
|
|
752
|
-
"onUpdate:modelValue": n[1] || (n[1] = (L) => b.value = L),
|
|
753
|
-
rules: [s(Kt)()],
|
|
754
|
-
"label-mark": "required"
|
|
755
|
-
}, null, 8, ["disabled", "items", "modelValue", "rules"]),
|
|
756
|
-
y(Xt, {
|
|
757
|
-
disabled: t.disabled,
|
|
758
|
-
label: "Amount",
|
|
759
|
-
step: +s(he)({
|
|
760
|
-
amount: 1,
|
|
761
|
-
precision: s($e)(t.modelValue.doc.unit, t.modelValue.measurement)
|
|
762
|
-
}),
|
|
763
|
-
modelValue: R.value,
|
|
764
|
-
"onUpdate:modelValue": n[2] || (n[2] = (L) => R.value = L),
|
|
765
|
-
rules: [s(Ue)(0)]
|
|
766
|
-
}, null, 8, ["disabled", "step", "modelValue", "rules"]),
|
|
767
|
-
y(E, {
|
|
768
|
-
disabled: t.disabled,
|
|
769
|
-
label: "Unit",
|
|
770
|
-
items: r.value,
|
|
771
|
-
modelValue: C.value,
|
|
772
|
-
"onUpdate:modelValue": n[3] || (n[3] = (L) => C.value = L)
|
|
773
|
-
}, null, 8, ["disabled", "items", "modelValue"]),
|
|
774
|
-
y(N, {
|
|
775
|
-
class: "col-span-2",
|
|
776
|
-
disabled: t.disabled,
|
|
777
|
-
label: "Remark",
|
|
778
|
-
modelValue: l.value,
|
|
779
|
-
"onUpdate:modelValue": n[4] || (n[4] = (L) => l.value = L),
|
|
780
|
-
"label-mark": "optional"
|
|
781
|
-
}, null, 8, ["disabled", "modelValue"]),
|
|
782
|
-
e("div", Uo, [
|
|
783
|
-
e("div", Po, f(s(w)("inventory.stock.stock_adjustment.stockAfter")), 1),
|
|
784
|
-
e("div", {
|
|
785
|
-
class: He(["fm-typo-en-body-lg-600", o.value ? "text-red-700" : "text-green-700"])
|
|
786
|
-
}, f(g.value), 3),
|
|
787
|
-
t.isBackdate ? (j(), q("div", Ro, f(s(w)("inventory.stock.stock_adjustment.backdatePreviewWarning")), 1)) : se("", !0)
|
|
788
|
-
])
|
|
789
|
-
]),
|
|
790
|
-
_: 1
|
|
791
|
-
});
|
|
792
|
-
};
|
|
793
|
-
}
|
|
794
|
-
}), No = { class: "flex items-center" }, Oo = { class: "fm-typo-en-title-md-800" }, Lo = { class: "flex items-center" }, Yo = { class: "fm-typo-en-title-sm-800 flex-1" }, zo = { class: "flex gap-8" }, Go = /* @__PURE__ */ pe({
|
|
795
|
-
__name: "AdjustSkuDialog",
|
|
796
|
-
props: {
|
|
797
|
-
stock: {},
|
|
798
|
-
show: { type: Boolean }
|
|
799
|
-
},
|
|
800
|
-
emits: ["update:show", "submitted"],
|
|
801
|
-
setup(A, { expose: c, emit: k }) {
|
|
802
|
-
const _ = A, w = k, V = Ne(), d = Le(), r = Ae(), b = we(), R = Y(!1), { t: C } = ye();
|
|
803
|
-
function l() {
|
|
804
|
-
g(Re(v));
|
|
805
|
-
}
|
|
806
|
-
const a = Y();
|
|
807
|
-
c({
|
|
808
|
-
validateInputs: () => {
|
|
809
|
-
var n, $;
|
|
810
|
-
($ = (n = a.value) == null ? void 0 : n.validateInputs) == null || $.call(n);
|
|
811
|
-
},
|
|
812
|
-
resetInputsValidation: () => {
|
|
813
|
-
var n, $;
|
|
814
|
-
($ = (n = a.value) == null ? void 0 : n.resetInputsValidation) == null || $.call(n);
|
|
815
|
-
},
|
|
816
|
-
resetInputs: () => {
|
|
817
|
-
var n, $;
|
|
818
|
-
($ = (n = a.value) == null ? void 0 : n.resetInputs) == null || $.call(n);
|
|
819
|
-
}
|
|
820
|
-
});
|
|
821
|
-
const B = Ye(_, "show"), v = _t({
|
|
822
|
-
remark: "",
|
|
823
|
-
adjustments: [
|
|
824
|
-
{
|
|
825
|
-
id: `sku_${(/* @__PURE__ */ new Date()).toISOString()}_${Math.random().toString(16).slice(2, 8)}`,
|
|
826
|
-
type: ie.enum.PURCHASE,
|
|
827
|
-
doc: _.stock,
|
|
828
|
-
measurement: null,
|
|
829
|
-
remark: "",
|
|
830
|
-
amount: xe(1)
|
|
831
|
-
}
|
|
832
|
-
]
|
|
833
|
-
});
|
|
834
|
-
Fe([() => _.show], ([n]) => {
|
|
835
|
-
n && (v.remark = "", v.adjustments = [
|
|
836
|
-
{
|
|
837
|
-
id: `sku_${(/* @__PURE__ */ new Date()).toISOString()}_${Math.random().toString(16).slice(2, 8)}`,
|
|
838
|
-
type: ie.enum.PURCHASE,
|
|
839
|
-
doc: _.stock,
|
|
840
|
-
measurement: null,
|
|
841
|
-
remark: "",
|
|
842
|
-
amount: xe(1)
|
|
843
|
-
}
|
|
844
|
-
]);
|
|
845
|
-
});
|
|
846
|
-
async function g(n) {
|
|
847
|
-
R.value = !0;
|
|
848
|
-
try {
|
|
849
|
-
await r.adjustSku({
|
|
850
|
-
remark: n.remark,
|
|
851
|
-
adjustments: n.adjustments.map(({ doc: $, remark: E, type: N, amount: O, measurement: L }) => ({
|
|
852
|
-
id: $._id,
|
|
853
|
-
amount: O,
|
|
854
|
-
measurement: L,
|
|
855
|
-
remark: E,
|
|
856
|
-
doc: $,
|
|
857
|
-
type: N
|
|
858
|
-
}))
|
|
859
|
-
}), w("update:show", !1), w("submitted");
|
|
860
|
-
} catch ($) {
|
|
861
|
-
b.open({
|
|
862
|
-
title: C("inventory.stock.adjust.error.title"),
|
|
863
|
-
message: C("inventory.stock.adjust.error.message"),
|
|
864
|
-
type: "error"
|
|
865
|
-
}), console.log("error on adjust ingredients", n, $);
|
|
866
|
-
} finally {
|
|
867
|
-
R.value = !1;
|
|
868
|
-
}
|
|
869
|
-
}
|
|
870
|
-
function o() {
|
|
871
|
-
const n = V.skus.map((E) => ({
|
|
872
|
-
label: E.name,
|
|
873
|
-
sublabel: E.code,
|
|
874
|
-
value: E._id
|
|
875
|
-
})), $ = n.filter((E) => v.adjustments.find((N) => N.doc._id === E.value)).map((E) => E.value);
|
|
876
|
-
d.open({
|
|
877
|
-
title: "Select ingredients",
|
|
878
|
-
contentComponent: St,
|
|
879
|
-
contentComponentProps: {
|
|
880
|
-
items: n,
|
|
881
|
-
modelValue: $
|
|
882
|
-
},
|
|
883
|
-
overlay: !0,
|
|
884
|
-
closeButton: !0,
|
|
885
|
-
dismissAway: !0,
|
|
886
|
-
primaryActions: {
|
|
887
|
-
text: "Confirm",
|
|
888
|
-
close: !0
|
|
889
|
-
},
|
|
890
|
-
secondaryActions: {
|
|
891
|
-
text: "Close",
|
|
892
|
-
close: !0,
|
|
893
|
-
variant: "tertiary"
|
|
894
|
-
}
|
|
895
|
-
}).onPrimary((E) => {
|
|
896
|
-
v.adjustments = E.map(
|
|
897
|
-
(N) => v.adjustments.find((O) => O.doc._id === N) ?? {
|
|
898
|
-
id: `sku_${(/* @__PURE__ */ new Date()).toISOString()}_${Math.random().toString(16).slice(2, 8)}`,
|
|
899
|
-
type: ie.enum.PURCHASE,
|
|
900
|
-
doc: V.skus.find((O) => O._id === N),
|
|
901
|
-
measurement: null,
|
|
902
|
-
remark: "",
|
|
903
|
-
amount: xe(1)
|
|
904
|
-
}
|
|
905
|
-
);
|
|
906
|
-
});
|
|
907
|
-
}
|
|
908
|
-
function t(n) {
|
|
909
|
-
v.adjustments.splice(n, 1);
|
|
910
|
-
}
|
|
911
|
-
return (n, $) => {
|
|
912
|
-
const E = D("FmTextarea"), N = D("FmButton"), O = D("FmForm"), L = D("FmSideSheet");
|
|
913
|
-
return j(), ne(L, {
|
|
914
|
-
modelValue: s(B),
|
|
915
|
-
"onUpdate:modelValue": $[2] || ($[2] = (X) => Pe(B) ? B.value = X : null),
|
|
916
|
-
"dismiss-away": "",
|
|
917
|
-
"max-width": 500
|
|
918
|
-
}, {
|
|
919
|
-
"side-sheet-header": M(() => [
|
|
920
|
-
e("div", No, [
|
|
921
|
-
e("div", Oo, f(s(C)("inventory.stock.adjust.title")), 1)
|
|
922
|
-
])
|
|
923
|
-
]),
|
|
924
|
-
default: M(() => [
|
|
925
|
-
y(O, {
|
|
926
|
-
class: "w-full flex flex-col gap-12",
|
|
927
|
-
ref_key: "formRef",
|
|
928
|
-
ref: a,
|
|
929
|
-
onValidationSuccess: l
|
|
930
|
-
}, {
|
|
931
|
-
default: M(() => [
|
|
932
|
-
y(E, {
|
|
933
|
-
label: s(C)("inventory.stock.adjust.remark"),
|
|
934
|
-
modelValue: v.remark,
|
|
935
|
-
"onUpdate:modelValue": $[0] || ($[0] = (X) => v.remark = X)
|
|
936
|
-
}, null, 8, ["label", "modelValue"]),
|
|
937
|
-
e("div", Lo, [
|
|
938
|
-
e("div", Yo, f(s(C)("inventory.stock.adjust.adjustedItems")), 1),
|
|
939
|
-
y(N, {
|
|
940
|
-
"prepend-icon": "add",
|
|
941
|
-
variant: "tertiary",
|
|
942
|
-
size: "md",
|
|
943
|
-
onClick: o
|
|
944
|
-
})
|
|
945
|
-
]),
|
|
946
|
-
(j(!0), q(ue, null, ve(v.adjustments, (X, z) => (j(), ne($t, {
|
|
947
|
-
key: X.id,
|
|
948
|
-
modelValue: v.adjustments[z],
|
|
949
|
-
"onUpdate:modelValue": (K) => v.adjustments[z] = K,
|
|
950
|
-
"onClick:delete": (K) => t(z)
|
|
951
|
-
}, null, 8, ["modelValue", "onUpdate:modelValue", "onClick:delete"]))), 128))
|
|
952
|
-
]),
|
|
953
|
-
_: 1
|
|
954
|
-
}, 512)
|
|
955
|
-
]),
|
|
956
|
-
"side-sheet-footer": M(() => [
|
|
957
|
-
e("div", zo, [
|
|
958
|
-
y(N, {
|
|
959
|
-
label: s(C)("inventory.stock.adjust.adjustButton"),
|
|
960
|
-
loading: R.value,
|
|
961
|
-
onClick: $[1] || ($[1] = (X) => {
|
|
962
|
-
var z, K;
|
|
963
|
-
return (K = (z = a.value) == null ? void 0 : z.validateInputs) == null ? void 0 : K.call(z);
|
|
964
|
-
})
|
|
965
|
-
}, null, 8, ["label", "loading"])
|
|
966
|
-
])
|
|
967
|
-
]),
|
|
968
|
-
_: 1
|
|
969
|
-
}, 8, ["modelValue"]);
|
|
970
|
-
};
|
|
971
|
-
}
|
|
972
|
-
}), Wo = { class: "flex items-center w-full gap-8" }, Ko = { class: "fm-typo-en-title-md-800 flex-1" }, qo = {
|
|
973
|
-
key: 0,
|
|
974
|
-
class: "flex flex-col gap-4"
|
|
975
|
-
}, Xo = { class: "fm-typo-en-body-md-600" }, Jo = { class: "flex gap-8 items-start" }, Qo = { class: "flex-1 min-w-0" }, Zo = { class: "flex-1 min-w-0" }, en = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, tn = { class: "flex items-center" }, on = { class: "fm-typo-en-title-sm-800 flex-1" }, nn = { class: "flex gap-8" }, yt = 14, sn = /* @__PURE__ */ pe({
|
|
976
|
-
__name: "StockAdjustmentSideSheet",
|
|
977
|
-
props: {
|
|
978
|
-
show: { type: Boolean }
|
|
979
|
-
},
|
|
980
|
-
emits: ["update:show", "submitted"],
|
|
981
|
-
setup(A, { emit: c }) {
|
|
982
|
-
const k = A, _ = c, { t: w } = ye(), V = Ne(), d = Ae(), r = Le(), b = we(), R = Ye(k, "show"), C = Y(!1), l = _t({
|
|
983
|
-
remark: "",
|
|
984
|
-
effectiveAt: /* @__PURE__ */ new Date(),
|
|
985
|
-
adjustments: []
|
|
986
|
-
}), a = Y(!1), B = Y(ke().format("YYYY-MM-DD")), v = Y(ke().format("HH:mm")), g = Y();
|
|
987
|
-
Fe([B, v], () => {
|
|
988
|
-
if (B.value && v.value) {
|
|
989
|
-
const K = ke(`${B.value} ${v.value}`, "YYYY-MM-DD HH:mm");
|
|
990
|
-
K.isValid() && (l.effectiveAt = K.toDate());
|
|
991
|
-
}
|
|
992
|
-
});
|
|
993
|
-
const o = T(() => `${B.value} ${v.value}`);
|
|
994
|
-
function t() {
|
|
995
|
-
if (!a.value) return !0;
|
|
996
|
-
const K = ke(`${B.value} ${v.value}`, "YYYY-MM-DD HH:mm");
|
|
997
|
-
if (!K.isValid()) return w("inventory.stock.stock_adjustment.invalidDateTime");
|
|
998
|
-
const U = ke();
|
|
999
|
-
if (K.isAfter(U))
|
|
1000
|
-
return w("inventory.stock.stock_adjustment.futureDateNotAllowed");
|
|
1001
|
-
const Z = U.subtract(yt, "day");
|
|
1002
|
-
return K.isBefore(Z) ? w("inventory.stock.stock_adjustment.backdateLimitError", { days: yt }) : !0;
|
|
1003
|
-
}
|
|
1004
|
-
const n = T(() => [() => t()]), $ = T(() => l.adjustments.length === 0 || t() !== !0);
|
|
1005
|
-
function E() {
|
|
1006
|
-
l.remark = "", l.effectiveAt = /* @__PURE__ */ new Date(), l.adjustments = [], a.value = !1, B.value = ke(l.effectiveAt).format("YYYY-MM-DD"), v.value = ke(l.effectiveAt).format("HH:mm");
|
|
1007
|
-
}
|
|
1008
|
-
function N() {
|
|
1009
|
-
E();
|
|
1010
|
-
}
|
|
1011
|
-
const O = T(() => {
|
|
1012
|
-
const K = {};
|
|
1013
|
-
return V.skus.forEach((U) => {
|
|
1014
|
-
K[U._id] = U;
|
|
1015
|
-
}), K;
|
|
1016
|
-
});
|
|
1017
|
-
function L() {
|
|
1018
|
-
const K = V.skus.map((Z) => ({
|
|
1019
|
-
label: Z.name,
|
|
1020
|
-
sublabel: Z.code,
|
|
1021
|
-
value: Z._id
|
|
1022
|
-
})), U = l.adjustments.map((Z) => Z.doc._id);
|
|
1023
|
-
r.open({
|
|
1024
|
-
title: w("inventory.stock.adjust.selectIngredients"),
|
|
1025
|
-
contentComponent: St,
|
|
1026
|
-
contentComponentProps: {
|
|
1027
|
-
items: K,
|
|
1028
|
-
modelValue: U,
|
|
1029
|
-
virtualScroll: !0
|
|
1030
|
-
},
|
|
1031
|
-
overlay: !0,
|
|
1032
|
-
closeButton: !0,
|
|
1033
|
-
dismissAway: !0,
|
|
1034
|
-
primaryActions: {
|
|
1035
|
-
text: w("common.confirm"),
|
|
1036
|
-
close: !0
|
|
1037
|
-
},
|
|
1038
|
-
secondaryActions: {
|
|
1039
|
-
text: w("common.close"),
|
|
1040
|
-
close: !0,
|
|
1041
|
-
variant: "tertiary"
|
|
1042
|
-
}
|
|
1043
|
-
}).onPrimary((Z) => {
|
|
1044
|
-
l.adjustments = Z.map(
|
|
1045
|
-
(re) => l.adjustments.find((x) => x.doc._id === re) ?? {
|
|
1046
|
-
id: "",
|
|
1047
|
-
type: ie.enum.PURCHASE,
|
|
1048
|
-
doc: O.value[re],
|
|
1049
|
-
measurement: null,
|
|
1050
|
-
remark: "",
|
|
1051
|
-
amount: xe(1)
|
|
1052
|
-
}
|
|
1053
|
-
);
|
|
1054
|
-
});
|
|
1055
|
-
}
|
|
1056
|
-
function X(K) {
|
|
1057
|
-
l.adjustments.splice(K, 1);
|
|
1058
|
-
}
|
|
1059
|
-
async function z() {
|
|
1060
|
-
if (l.adjustments.length === 0) {
|
|
1061
|
-
b.open({
|
|
1062
|
-
title: w("inventory.stock.error.title"),
|
|
1063
|
-
message: w("inventory.stock.stock_adjustment.noAdjustments"),
|
|
1064
|
-
type: "warning"
|
|
1065
|
-
});
|
|
1066
|
-
return;
|
|
1067
|
-
}
|
|
1068
|
-
C.value = !0;
|
|
1069
|
-
try {
|
|
1070
|
-
const K = l.adjustments.map(
|
|
1071
|
-
({ doc: Z, remark: re, type: x, amount: F, measurement: G }) => ({
|
|
1072
|
-
id: Z._id,
|
|
1073
|
-
amount: F,
|
|
1074
|
-
measurement: G,
|
|
1075
|
-
remark: re,
|
|
1076
|
-
doc: Z,
|
|
1077
|
-
type: x
|
|
1078
|
-
})
|
|
1079
|
-
), U = {
|
|
1080
|
-
remark: l.remark,
|
|
1081
|
-
adjustments: K,
|
|
1082
|
-
...a.value ? { effectiveAt: l.effectiveAt.toISOString() } : {}
|
|
1083
|
-
};
|
|
1084
|
-
await d.adjustSku(Re(U)), _("submitted"), _("update:show", !1);
|
|
1085
|
-
} catch (K) {
|
|
1086
|
-
b.open({
|
|
1087
|
-
title: w("inventory.stock.adjust.error.title"),
|
|
1088
|
-
message: w("inventory.stock.adjust.error.message"),
|
|
1089
|
-
type: "error"
|
|
1090
|
-
}), console.error("error on stock adjustment", K);
|
|
1091
|
-
} finally {
|
|
1092
|
-
C.value = !1;
|
|
1093
|
-
}
|
|
1094
|
-
}
|
|
1095
|
-
return (K, U) => {
|
|
1096
|
-
const Z = D("FmTextarea"), re = D("FmSwitch"), x = D("FmDatePicker"), F = D("FmTimePicker"), G = D("FmFormGroup"), H = D("FmButton"), J = D("FmForm"), I = D("FmSideSheet");
|
|
1097
|
-
return j(), ne(I, {
|
|
1098
|
-
modelValue: s(R),
|
|
1099
|
-
"onUpdate:modelValue": U[6] || (U[6] = (u) => Pe(R) ? R.value = u : null),
|
|
1100
|
-
"dismiss-away": "",
|
|
1101
|
-
"max-width": 560,
|
|
1102
|
-
onAfterEnter: N
|
|
1103
|
-
}, {
|
|
1104
|
-
"side-sheet-header": M(() => [
|
|
1105
|
-
e("div", Wo, [
|
|
1106
|
-
e("div", Ko, f(s(w)("inventory.stock.stock_adjustment.title")), 1)
|
|
1107
|
-
])
|
|
1108
|
-
]),
|
|
1109
|
-
default: M(() => [
|
|
1110
|
-
y(J, {
|
|
1111
|
-
class: "flex flex-col gap-16",
|
|
1112
|
-
ref_key: "formRef",
|
|
1113
|
-
ref: g,
|
|
1114
|
-
onValidationSuccess: z
|
|
1115
|
-
}, {
|
|
1116
|
-
default: M(() => [
|
|
1117
|
-
y(Z, {
|
|
1118
|
-
label: s(w)("inventory.stock.adjust.remark"),
|
|
1119
|
-
modelValue: l.remark,
|
|
1120
|
-
"onUpdate:modelValue": U[0] || (U[0] = (u) => l.remark = u),
|
|
1121
|
-
"label-mark": "optional"
|
|
1122
|
-
}, null, 8, ["label", "modelValue"]),
|
|
1123
|
-
y(re, {
|
|
1124
|
-
value: "",
|
|
1125
|
-
"model-value": a.value,
|
|
1126
|
-
"onUpdate:modelValue": U[1] || (U[1] = (u) => a.value = u),
|
|
1127
|
-
label: s(w)("inventory.stock.stock_adjustment.backdateLabel"),
|
|
1128
|
-
sublabel: s(w)("inventory.stock.stock_adjustment.backdateSublabel"),
|
|
1129
|
-
labelPlacement: "right"
|
|
1130
|
-
}, null, 8, ["model-value", "label", "sublabel"]),
|
|
1131
|
-
a.value ? (j(), q("div", qo, [
|
|
1132
|
-
e("label", Xo, f(s(w)("inventory.stock.stock_adjustment.effectiveAt")), 1),
|
|
1133
|
-
e("div", Jo, [
|
|
1134
|
-
e("div", Qo, [
|
|
1135
|
-
y(x, {
|
|
1136
|
-
class: "w-full",
|
|
1137
|
-
modelValue: B.value,
|
|
1138
|
-
"onUpdate:modelValue": U[2] || (U[2] = (u) => B.value = u),
|
|
1139
|
-
clearable: !1
|
|
1140
|
-
}, null, 8, ["modelValue"])
|
|
1141
|
-
]),
|
|
1142
|
-
e("div", Zo, [
|
|
1143
|
-
y(F, {
|
|
1144
|
-
class: "w-full",
|
|
1145
|
-
modelValue: v.value,
|
|
1146
|
-
"onUpdate:modelValue": U[3] || (U[3] = (u) => v.value = u),
|
|
1147
|
-
format: "HH:mm"
|
|
1148
|
-
}, null, 8, ["modelValue"])
|
|
1149
|
-
])
|
|
1150
|
-
]),
|
|
1151
|
-
y(G, {
|
|
1152
|
-
"model-value": o.value,
|
|
1153
|
-
rules: n.value
|
|
1154
|
-
}, null, 8, ["model-value", "rules"]),
|
|
1155
|
-
e("div", en, f(s(w)("inventory.stock.stock_adjustment.immediateHint")), 1)
|
|
1156
|
-
])) : se("", !0),
|
|
1157
|
-
e("div", tn, [
|
|
1158
|
-
e("div", on, f(s(w)("inventory.stock.adjust.adjustedItems")), 1),
|
|
1159
|
-
y(H, {
|
|
1160
|
-
"prepend-icon": "add",
|
|
1161
|
-
variant: "tertiary",
|
|
1162
|
-
size: "md",
|
|
1163
|
-
onClick: L
|
|
1164
|
-
})
|
|
1165
|
-
]),
|
|
1166
|
-
(j(!0), q(ue, null, ve(l.adjustments, (u, h) => (j(), ne($t, {
|
|
1167
|
-
key: u.doc._id,
|
|
1168
|
-
modelValue: l.adjustments[h],
|
|
1169
|
-
"onUpdate:modelValue": (p) => l.adjustments[h] = p,
|
|
1170
|
-
"is-backdate": a.value,
|
|
1171
|
-
"onClick:delete": (p) => X(h)
|
|
1172
|
-
}, null, 8, ["modelValue", "onUpdate:modelValue", "is-backdate", "onClick:delete"]))), 128))
|
|
1173
|
-
]),
|
|
1174
|
-
_: 1
|
|
1175
|
-
}, 512)
|
|
1176
|
-
]),
|
|
1177
|
-
"side-sheet-footer": M(() => [
|
|
1178
|
-
e("div", nn, [
|
|
1179
|
-
y(H, {
|
|
1180
|
-
label: s(w)("common.confirm"),
|
|
1181
|
-
loading: C.value,
|
|
1182
|
-
disabled: $.value,
|
|
1183
|
-
onClick: U[4] || (U[4] = (u) => {
|
|
1184
|
-
var h, p;
|
|
1185
|
-
return (p = (h = g.value) == null ? void 0 : h.validateInputs) == null ? void 0 : p.call(h);
|
|
1186
|
-
})
|
|
1187
|
-
}, null, 8, ["label", "loading", "disabled"]),
|
|
1188
|
-
y(H, {
|
|
1189
|
-
label: s(w)("common.close"),
|
|
1190
|
-
variant: "tertiary",
|
|
1191
|
-
onClick: U[5] || (U[5] = (u) => _("update:show", !1))
|
|
1192
|
-
}, null, 8, ["label"])
|
|
1193
|
-
])
|
|
1194
|
-
]),
|
|
1195
|
-
_: 1
|
|
1196
|
-
}, 8, ["modelValue"]);
|
|
1197
|
-
};
|
|
1198
|
-
}
|
|
1199
|
-
}), an = Tt((A, c) => ({
|
|
1200
|
-
// TODO: remove once latest inventory backend has been push
|
|
1201
|
-
async findBillsByBusinessId(k, _, w) {
|
|
1202
|
-
const V = `${A.businessesBackendUrl}/${k}/reports/find-many`, d = {
|
|
1203
|
-
// type: TYPE.bill,
|
|
1204
|
-
type: "bill",
|
|
1205
|
-
restaurantIds: _,
|
|
1206
|
-
ids: w
|
|
1207
|
-
};
|
|
1208
|
-
return await c.post(V, d);
|
|
1209
|
-
},
|
|
1210
|
-
async findBillsById(k) {
|
|
1211
|
-
const w = Se().currentLocationDBName, V = `${A.inventoryBackendUrl}/${w}/bill/search`, d = {
|
|
1212
|
-
ids: k
|
|
1213
|
-
};
|
|
1214
|
-
return await c.post(V, d);
|
|
1215
|
-
}
|
|
1216
|
-
})), rn = {
|
|
1217
|
-
key: 0,
|
|
1218
|
-
class: "flex justify-center items-center h-32"
|
|
1219
|
-
}, ln = { class: "mb-3" }, un = { class: "flex flex-col gap-8" }, cn = { class: "flex flex-col text-fm-color-typo-primary mb-3 text-center" }, dn = { class: "text-fm-color-neutral-gray-400 fm-typo-en-body-sm-600" }, mn = { class: "flex flex-col gap-4 text-fm-color-typo-primary mb-3" }, fn = { class: "flex flex-col gap-4 text-fm-color-typo-primary mb-3" }, vn = { class: "flex flex-col gap-4 text-fm-color-typo-primary mb-3" }, pn = { class: "flex flex-col w-full px-2" }, yn = { class: "flex gap-2" }, _n = /* @__PURE__ */ pe({
|
|
1220
|
-
__name: "AmendAdjustmentForm",
|
|
1221
|
-
props: /* @__PURE__ */ st({
|
|
1222
|
-
adjustmentId: {}
|
|
1223
|
-
}, {
|
|
1224
|
-
modelValue: {},
|
|
1225
|
-
modelModifiers: {}
|
|
1226
|
-
}),
|
|
1227
|
-
emits: /* @__PURE__ */ st(["refreshHistory"], ["update:modelValue"]),
|
|
1228
|
-
setup(A, { emit: c }) {
|
|
1229
|
-
const k = A, _ = c, w = Ae(), V = jt(A, "modelValue"), d = Y(!1), r = Y(!1), b = Y(!1), R = Y({
|
|
1230
|
-
_id: `inventoryAdjustment_${(/* @__PURE__ */ new Date()).toISOString()}_XXXXX`,
|
|
1231
|
-
skus: []
|
|
1232
|
-
}), C = Y();
|
|
1233
|
-
Xe(async () => {
|
|
1234
|
-
d.value = !0;
|
|
1235
|
-
const o = await w.readSingleAdjustment(k.adjustmentId);
|
|
1236
|
-
if (!o) throw new Error("Adjustment not found");
|
|
1237
|
-
R.value = o, d.value = !1;
|
|
1238
|
-
});
|
|
1239
|
-
async function l() {
|
|
1240
|
-
var t, n;
|
|
1241
|
-
if ((n = (t = C == null ? void 0 : C.value) == null ? void 0 : t.validateInputs) == null || n.call(t), !r.value) return;
|
|
1242
|
-
const o = {};
|
|
1243
|
-
Object.keys(V.value || {}).forEach(($) => {
|
|
1244
|
-
var E;
|
|
1245
|
-
Object.keys(((E = V.value) == null ? void 0 : E[$]) || {}).forEach((N) => {
|
|
1246
|
-
var L, X;
|
|
1247
|
-
const O = (X = (L = V.value) == null ? void 0 : L[$]) == null ? void 0 : X[Number(N)];
|
|
1248
|
-
O && B(O.amount) > 0 && (o[$] || (o[$] = []), o[$].push(O));
|
|
1249
|
-
});
|
|
1250
|
-
}), await w.revertWastageAdjustment({
|
|
1251
|
-
targetWastageAdjustmentId: k.adjustmentId,
|
|
1252
|
-
amountsGoingToAdjust: o
|
|
1253
|
-
}), _("refreshHistory"), b.value = !1, V.value = {};
|
|
1254
|
-
}
|
|
1255
|
-
function a(o) {
|
|
1256
|
-
const { skuId: t, idx: n, unit: $, measurement: E } = o;
|
|
1257
|
-
return T({
|
|
1258
|
-
get: () => {
|
|
1259
|
-
var L, X, z;
|
|
1260
|
-
const N = (z = (X = (L = V.value) == null ? void 0 : L[t]) == null ? void 0 : X[n]) == null ? void 0 : z.amount;
|
|
1261
|
-
return N ? Number(_e.toFormatString({ value: N })) : 0;
|
|
1262
|
-
},
|
|
1263
|
-
set: (N) => {
|
|
1264
|
-
V.value || (V.value = {});
|
|
1265
|
-
const O = { ...V.value };
|
|
1266
|
-
O[t] || (O[t] = {}), O[t][n] = {
|
|
1267
|
-
amount: _e.convertPrecision({
|
|
1268
|
-
value: _e.fromNumber(N),
|
|
1269
|
-
precision: $e($)
|
|
1270
|
-
}),
|
|
1271
|
-
type: ie.Enum.WASTAGE,
|
|
1272
|
-
measurement: E
|
|
1273
|
-
}, V.value = O;
|
|
1274
|
-
}
|
|
1275
|
-
});
|
|
1276
|
-
}
|
|
1277
|
-
function B(o, t = !0) {
|
|
1278
|
-
const n = Number(_e.toFormatString({ value: o }));
|
|
1279
|
-
return t ? Math.abs(n) : n;
|
|
1280
|
-
}
|
|
1281
|
-
function v(o, t) {
|
|
1282
|
-
return t.measurement ? t.measurement.abbrev : o.sku.unit.abbrev;
|
|
1283
|
-
}
|
|
1284
|
-
function g(o, t) {
|
|
1285
|
-
if (t.amount === 0) return "N/A";
|
|
1286
|
-
const n = _e.add([o, t]);
|
|
1287
|
-
return n ? _e.toFormatString({ value: n }) : "N/A";
|
|
1288
|
-
}
|
|
1289
|
-
return (o, t) => {
|
|
1290
|
-
const n = D("FmIcon"), $ = D("FmStepperField"), E = D("FmCard"), N = D("FmForm"), O = D("FmSpacer"), L = D("FmButton"), X = D("FmDialog");
|
|
1291
|
-
return j(), ne(X, {
|
|
1292
|
-
modelValue: b.value,
|
|
1293
|
-
"onUpdate:modelValue": t[4] || (t[4] = (z) => b.value = z),
|
|
1294
|
-
overlay: !0
|
|
1295
|
-
}, {
|
|
1296
|
-
"dialog-button": M(() => [
|
|
1297
|
-
y(Qe, null, {
|
|
1298
|
-
default: M(() => [
|
|
1299
|
-
e("button", {
|
|
1300
|
-
onClick: t[0] || (t[0] = (z) => b.value = !0),
|
|
1301
|
-
class: "rounded-md hover:bg-gray-100 transition-colors"
|
|
1302
|
-
}, [
|
|
1303
|
-
y(n, {
|
|
1304
|
-
name: "edit",
|
|
1305
|
-
size: "sm"
|
|
1306
|
-
})
|
|
1307
|
-
])
|
|
1308
|
-
]),
|
|
1309
|
-
_: 1
|
|
1310
|
-
})
|
|
1311
|
-
]),
|
|
1312
|
-
"dialog-header": M(() => t[5] || (t[5] = [
|
|
1313
|
-
e("div", null, "Amend Adjustment", -1)
|
|
1314
|
-
])),
|
|
1315
|
-
"dialog-footer": M(() => [
|
|
1316
|
-
e("div", pn, [
|
|
1317
|
-
t[13] || (t[13] = e("span", { class: "text-fm-color-system-warning-400 fm-typo-en-body-sm-400" }, "1. New adjustment EXTRA will be created for each reversal", -1)),
|
|
1318
|
-
e("div", yn, [
|
|
1319
|
-
y(O),
|
|
1320
|
-
y(L, {
|
|
1321
|
-
class: "sm:w-full xs:w-full",
|
|
1322
|
-
label: "Close",
|
|
1323
|
-
size: "md",
|
|
1324
|
-
variant: "tertiary",
|
|
1325
|
-
onClick: t[3] || (t[3] = (z) => b.value = !1)
|
|
1326
|
-
}),
|
|
1327
|
-
y(L, {
|
|
1328
|
-
class: "sm:w-full xs:w-full",
|
|
1329
|
-
label: "Submit",
|
|
1330
|
-
size: "md",
|
|
1331
|
-
variant: "primary",
|
|
1332
|
-
onClick: l
|
|
1333
|
-
})
|
|
1334
|
-
])
|
|
1335
|
-
])
|
|
1336
|
-
]),
|
|
1337
|
-
default: M(() => [
|
|
1338
|
-
d.value ? (j(), q("div", rn)) : (j(), ne(N, {
|
|
1339
|
-
key: 1,
|
|
1340
|
-
ref_key: "formRef",
|
|
1341
|
-
ref: C,
|
|
1342
|
-
onValidationFailed: t[1] || (t[1] = () => {
|
|
1343
|
-
r.value = !1;
|
|
1344
|
-
}),
|
|
1345
|
-
onValidationSuccess: t[2] || (t[2] = () => {
|
|
1346
|
-
r.value = !0;
|
|
1347
|
-
}),
|
|
1348
|
-
blameFormChildOnValidationFailed: ""
|
|
1349
|
-
}, {
|
|
1350
|
-
default: M(() => [
|
|
1351
|
-
e("p", ln, [
|
|
1352
|
-
t[6] || (t[6] = e("b", null, "Date:", -1)),
|
|
1353
|
-
t[7] || (t[7] = e("br", null, null, -1)),
|
|
1354
|
-
me(" " + f(s(Qt)(s(Et)(R.value._id))), 1)
|
|
1355
|
-
]),
|
|
1356
|
-
e("div", un, [
|
|
1357
|
-
(j(!0), q(ue, null, ve(R.value.skus, (z, K) => (j(), q(ue, { key: K }, [
|
|
1358
|
-
(j(!0), q(ue, null, ve(z.amounts, (U, Z) => (j(), ne(E, {
|
|
1359
|
-
key: Z,
|
|
1360
|
-
variant: "outlined",
|
|
1361
|
-
class: "p-2"
|
|
1362
|
-
}, {
|
|
1363
|
-
default: M(() => [
|
|
1364
|
-
e("div", cn, [
|
|
1365
|
-
e("span", dn, f(z.sku.code), 1),
|
|
1366
|
-
e("span", null, f(z.sku.name), 1)
|
|
1367
|
-
]),
|
|
1368
|
-
t[12] || (t[12] = e("hr", { class: "m-2" }, null, -1)),
|
|
1369
|
-
e("div", mn, [
|
|
1370
|
-
t[8] || (t[8] = e("span", { class: "fm-typo-en-body-lg-600" }, "Adjustment type:", -1)),
|
|
1371
|
-
e("span", null, f(U.type), 1)
|
|
1372
|
-
]),
|
|
1373
|
-
e("div", fn, [
|
|
1374
|
-
t[9] || (t[9] = e("span", { class: "fm-typo-en-body-lg-600" }, "Current amount:", -1)),
|
|
1375
|
-
e("span", null, f(s(_e).toFormatString({ value: U.amount })) + " " + f(v(z, U)), 1)
|
|
1376
|
-
]),
|
|
1377
|
-
y($, {
|
|
1378
|
-
"max-fraction-digits": s($e)(z.sku.unit),
|
|
1379
|
-
"model-value": a({
|
|
1380
|
-
skuId: z.sku._id,
|
|
1381
|
-
idx: Z,
|
|
1382
|
-
unit: z.sku.unit
|
|
1383
|
-
}).value,
|
|
1384
|
-
"onUpdate:modelValue": (re) => a({
|
|
1385
|
-
skuId: z.sku._id,
|
|
1386
|
-
idx: Z,
|
|
1387
|
-
unit: z.sku.unit
|
|
1388
|
-
}).value = re,
|
|
1389
|
-
class: "mb-3",
|
|
1390
|
-
label: "Adjust Amount (Leave 0 to skip)",
|
|
1391
|
-
"helper-text": `Max: ${B(U.amount)}`,
|
|
1392
|
-
"append-text": v(z, U),
|
|
1393
|
-
rules: [
|
|
1394
|
-
(re) => re <= B(U.amount) || `Cannot be more than ${B(U.amount)}`,
|
|
1395
|
-
s(Ue)(-1)
|
|
1396
|
-
]
|
|
1397
|
-
}, null, 8, ["max-fraction-digits", "model-value", "onUpdate:modelValue", "helper-text", "append-text", "rules"]),
|
|
1398
|
-
e("div", vn, [
|
|
1399
|
-
t[10] || (t[10] = e("span", { class: "fm-typo-en-body-lg-600" }, "Amount after amend:", -1)),
|
|
1400
|
-
t[11] || (t[11] = e("span", { class: "text-fm-color-system-warning-400 fm-typo-en-body-sm-400" }, "* It's an estimate for your reference, as it didn't include all the reversals related to this adjustment", -1)),
|
|
1401
|
-
me(" " + f(g(
|
|
1402
|
-
U.amount,
|
|
1403
|
-
s(_e).fromNumber(
|
|
1404
|
-
a({
|
|
1405
|
-
skuId: z.sku._id,
|
|
1406
|
-
idx: Z,
|
|
1407
|
-
unit: z.sku.unit
|
|
1408
|
-
}).value
|
|
1409
|
-
)
|
|
1410
|
-
)) + " " + f(v(z, U)), 1)
|
|
1411
|
-
])
|
|
1412
|
-
]),
|
|
1413
|
-
_: 2
|
|
1414
|
-
}, 1024))), 128))
|
|
1415
|
-
], 64))), 128))
|
|
1416
|
-
])
|
|
1417
|
-
]),
|
|
1418
|
-
_: 1
|
|
1419
|
-
}, 512))
|
|
1420
|
-
]),
|
|
1421
|
-
_: 1
|
|
1422
|
-
}, 8, ["modelValue"]);
|
|
1423
|
-
};
|
|
1424
|
-
}
|
|
1425
|
-
}), kn = { class: "p-16" }, hn = { class: "fm-typo-en-body-md-600 flex-grow" }, bn = { class: "flex-grow text-fm-color-typo-secondary" }, gn = {
|
|
1426
|
-
key: 0,
|
|
1427
|
-
class: "my-5"
|
|
1428
|
-
}, xn = { class: "text-neutral-400" }, Sn = { class: "flex-grow" }, wn = { class: "flex gap-1" }, An = { class: "flex flex-col gap-1" }, Fn = {
|
|
1429
|
-
key: 1,
|
|
1430
|
-
class: "t-system text-fsecondary"
|
|
1431
|
-
}, $n = {
|
|
1432
|
-
key: 2,
|
|
1433
|
-
class: "text-xs text-gray-400"
|
|
1434
|
-
}, jn = { key: 3 }, Vn = { key: 4 }, Cn = { class: "inline-flex items-center gap-0.5 text-fm-color-typo-secondary" }, Bn = {
|
|
1435
|
-
key: 6,
|
|
1436
|
-
class: "inline-flex items-center rounded-md bg-yellow-400/10 px-2 text-xs font-medium text-yellow-500 inset-ring inset-ring-yellow-400/20"
|
|
1437
|
-
}, Dn = {
|
|
1438
|
-
key: 1,
|
|
1439
|
-
class: "shrink-0 text-fm-color-typo-secondary"
|
|
1440
|
-
}, Mn = /* @__PURE__ */ pe({
|
|
1441
|
-
__name: "StockRecordCard",
|
|
1442
|
-
props: {
|
|
1443
|
-
record: {},
|
|
1444
|
-
sku: {},
|
|
1445
|
-
bills: { default: () => [] },
|
|
1446
|
-
unitCostHistory: { default: () => [] },
|
|
1447
|
-
costMechanism: { default: "adjustment" }
|
|
1448
|
-
},
|
|
1449
|
-
setup(A) {
|
|
1450
|
-
const c = A;
|
|
1451
|
-
function k(C, l) {
|
|
1452
|
-
if (c.costMechanism === "adjustment")
|
|
1453
|
-
return null;
|
|
1454
|
-
const a = c.unitCostHistory.filter(
|
|
1455
|
-
(g) => g.mechanism === c.costMechanism && g.skuId === c.sku._id
|
|
1456
|
-
);
|
|
1457
|
-
if (a.length === 0) return null;
|
|
1458
|
-
const B = a.find((g) => {
|
|
1459
|
-
const o = g.meta;
|
|
1460
|
-
return (o == null ? void 0 : o.adjustmentId) === C;
|
|
1461
|
-
});
|
|
1462
|
-
if (B) return B.cost;
|
|
1463
|
-
const v = [...a].filter((g) => new Date(g.snapshotAt) <= new Date(l)).sort((g, o) => new Date(o.snapshotAt).getTime() - new Date(g.snapshotAt).getTime());
|
|
1464
|
-
return v.length > 0 ? v[0].cost : null;
|
|
1465
|
-
}
|
|
1466
|
-
const _ = Y(!1), w = Y(), V = Y(null), d = T(() => V.value === null ? "unset" : _.value ? `${V.value}px` : "0px");
|
|
1467
|
-
Xe(() => {
|
|
1468
|
-
var C;
|
|
1469
|
-
V.value = ((C = w.value) == null ? void 0 : C.scrollHeight) || 0;
|
|
1470
|
-
});
|
|
1471
|
-
const r = T(() => {
|
|
1472
|
-
var g;
|
|
1473
|
-
const C = c.record.adjustments, l = c.sku, a = {}, v = C.flatMap((o) => {
|
|
1474
|
-
var t;
|
|
1475
|
-
return ((t = o.skus) == null ? void 0 : t.filter((n) => n.sku._id === l._id)) ?? [];
|
|
1476
|
-
}).flatMap((o) => o.amounts);
|
|
1477
|
-
for (const o of v) {
|
|
1478
|
-
const t = o.measurement ? xt(o.measurement.conversion, o.amount) : o.amount;
|
|
1479
|
-
a[g = o.type] ?? (a[g] = { amount: 0, precision: 0 }), a[o.type] = Ze(t, a[o.type]);
|
|
1480
|
-
}
|
|
1481
|
-
return Object.entries(a).reduce(
|
|
1482
|
-
(o, [t, n]) => (o[t] = /// comment, because without it formatter makes code uglier
|
|
1483
|
-
`${oe.toFormatString({
|
|
1484
|
-
value: n,
|
|
1485
|
-
precision: 4
|
|
1486
|
-
})} ${l.unit.abbrev}`, o),
|
|
1487
|
-
{}
|
|
1488
|
-
);
|
|
1489
|
-
}), { t: b } = ye(), R = T(() => c.record.adjustmentsByTime.map(({ date: C, adjustments: l }) => ({
|
|
1490
|
-
time: Zt(new Date(C)),
|
|
1491
|
-
adjustments: l.flatMap(
|
|
1492
|
-
(a) => {
|
|
1493
|
-
var B, v;
|
|
1494
|
-
return ((v = (B = a.skus) == null ? void 0 : B.map) == null ? void 0 : v.call(B, (g) => {
|
|
1495
|
-
var o, t;
|
|
1496
|
-
return {
|
|
1497
|
-
...g,
|
|
1498
|
-
ref: a.ref,
|
|
1499
|
-
reason: a.reason,
|
|
1500
|
-
adjustmentRemark: a.remark,
|
|
1501
|
-
backdateFrom: a.effectiveAt != null ? Te(a._id) : null,
|
|
1502
|
-
toBalance: (t = (o = a.skus) == null ? void 0 : o[0]) == null ? void 0 : t.toBalance,
|
|
1503
|
-
adjustmentId: a._id,
|
|
1504
|
-
adjustmentTime: a.effectiveAt ?? Te(a._id),
|
|
1505
|
-
createdBy: a.createdBy
|
|
1506
|
-
};
|
|
1507
|
-
})) ?? [];
|
|
1508
|
-
}
|
|
1509
|
-
).flatMap((a) => {
|
|
1510
|
-
var t;
|
|
1511
|
-
const B = (t = c.bills.find((n) => n._id === a.ref)) == null ? void 0 : t.seqNumber, v = B ? b("inventory.stock.record.bill", [B]) : "", g = a.adjustmentTime ?? (/* @__PURE__ */ new Date()).toISOString(), o = k(a.adjustmentId, g);
|
|
1512
|
-
return (a.amounts || []).filter((n) => n != null).map((n) => {
|
|
1513
|
-
var N;
|
|
1514
|
-
let $ = n.cost;
|
|
1515
|
-
if (o) {
|
|
1516
|
-
const O = oe.fromDinero(o), L = n.amount, X = n.measurement ? oe.multiply([L, n.measurement.conversion]) : L;
|
|
1517
|
-
$ = {
|
|
1518
|
-
...oe.multiply([
|
|
1519
|
-
O,
|
|
1520
|
-
X
|
|
1521
|
-
]),
|
|
1522
|
-
currency: o.currency
|
|
1523
|
-
};
|
|
1524
|
-
}
|
|
1525
|
-
let E = "";
|
|
1526
|
-
return v ? E = n.remark || "" : E = [a.adjustmentRemark, n.remark].filter((L) => L).join("/"), {
|
|
1527
|
-
amount: `${oe.toFormatString({ value: n.amount, precision: 4 })} ${((N = n.measurement) == null ? void 0 : N.abbrev) ?? a.sku.unit.abbrev}`,
|
|
1528
|
-
backdateFrom: a.backdateFrom,
|
|
1529
|
-
name: n.type,
|
|
1530
|
-
billRemark: v,
|
|
1531
|
-
remark: E,
|
|
1532
|
-
reason: a.reason || "",
|
|
1533
|
-
cost: $,
|
|
1534
|
-
toBalance: oe.toFormatString({
|
|
1535
|
-
value: a.toBalance ?? oe.fromNumber(0),
|
|
1536
|
-
precision: 4
|
|
1537
|
-
}),
|
|
1538
|
-
baseUnit: a.sku.unit.abbrev,
|
|
1539
|
-
adjustmentId: a.adjustmentId,
|
|
1540
|
-
createdBy: a.createdBy
|
|
1541
|
-
};
|
|
1542
|
-
});
|
|
1543
|
-
})
|
|
1544
|
-
})));
|
|
1545
|
-
return (C, l) => {
|
|
1546
|
-
const a = D("FmIcon"), B = D("FmTooltip"), v = D("FmCard");
|
|
1547
|
-
return j(), ne(v, { variant: "outlined" }, {
|
|
1548
|
-
default: M(() => [
|
|
1549
|
-
e("div", kn, [
|
|
1550
|
-
e("div", {
|
|
1551
|
-
class: "flex items-center cursor-pointer mb-1",
|
|
1552
|
-
onClick: l[0] || (l[0] = (g) => _.value = !_.value)
|
|
1553
|
-
}, [
|
|
1554
|
-
e("div", hn, f(C.record.date), 1),
|
|
1555
|
-
y(a, {
|
|
1556
|
-
name: _.value ? "expand_more" : "expand_less",
|
|
1557
|
-
color: "#777777",
|
|
1558
|
-
size: "md"
|
|
1559
|
-
}, null, 8, ["name"])
|
|
1560
|
-
]),
|
|
1561
|
-
(j(!0), q(ue, null, ve(r.value, (g, o) => (j(), q("div", {
|
|
1562
|
-
key: o,
|
|
1563
|
-
class: "flex flex-row py-1",
|
|
1564
|
-
style: { "font-size": "0.8rem" }
|
|
1565
|
-
}, [
|
|
1566
|
-
e("div", bn, f(s(b)(`inventory.inventoryAdjustment.type.${o}`)), 1),
|
|
1567
|
-
e("div", {
|
|
1568
|
-
class: He({
|
|
1569
|
-
"text-fm-color-typo-error": g.startsWith("-"),
|
|
1570
|
-
"text-fm-color-typo-success": !g.startsWith("-"),
|
|
1571
|
-
"ml-auto": !0
|
|
1572
|
-
})
|
|
1573
|
-
}, f(g), 3)
|
|
1574
|
-
]))), 128)),
|
|
1575
|
-
e("div", {
|
|
1576
|
-
ref_key: "detailRef",
|
|
1577
|
-
ref: w,
|
|
1578
|
-
style: kt({
|
|
1579
|
-
fontSize: "0.8rem",
|
|
1580
|
-
maxHeight: d.value,
|
|
1581
|
-
overflow: "hidden",
|
|
1582
|
-
transition: "max-height 0.2s ease-out"
|
|
1583
|
-
})
|
|
1584
|
-
}, [
|
|
1585
|
-
R.value.length ? (j(), q("hr", gn)) : se("", !0),
|
|
1586
|
-
(j(!0), q(ue, null, ve(R.value, (g) => (j(), q("div", {
|
|
1587
|
-
key: g.time,
|
|
1588
|
-
class: "flex gap-1 w-full"
|
|
1589
|
-
}, [
|
|
1590
|
-
e("div", xn, f(g.time), 1),
|
|
1591
|
-
e("div", Sn, [
|
|
1592
|
-
(j(!0), q(ue, null, ve(g.adjustments, (o) => {
|
|
1593
|
-
var t;
|
|
1594
|
-
return j(), q("div", {
|
|
1595
|
-
key: o.name,
|
|
1596
|
-
class: "flex gap-1"
|
|
1597
|
-
}, [
|
|
1598
|
-
e("div", wn, [
|
|
1599
|
-
me(f(s(b)(`inventory.inventoryAdjustment.type.${o.name}`)) + " ", 1),
|
|
1600
|
-
o.backdateFrom ? (j(), ne(B, {
|
|
1601
|
-
key: 0,
|
|
1602
|
-
variant: "plain",
|
|
1603
|
-
placement: "top",
|
|
1604
|
-
"z-index": 50
|
|
1605
|
-
}, {
|
|
1606
|
-
content: M(() => [
|
|
1607
|
-
e("div", An, f(s(b)("inventory.stock.record.backdate", [
|
|
1608
|
-
s(wt)(new Date(o.backdateFrom))
|
|
1609
|
-
])), 1)
|
|
1610
|
-
]),
|
|
1611
|
-
default: M(() => [
|
|
1612
|
-
y(a, {
|
|
1613
|
-
name: "info",
|
|
1614
|
-
size: "sm",
|
|
1615
|
-
color: "primary"
|
|
1616
|
-
})
|
|
1617
|
-
]),
|
|
1618
|
-
_: 2
|
|
1619
|
-
}, 1024)) : se("", !0),
|
|
1620
|
-
o.billRemark ? (j(), q("span", Fn, " # " + f(o.billRemark), 1)) : se("", !0),
|
|
1621
|
-
o.billRemark && o.remark ? (j(), q("span", $n, " (" + f(o.remark) + ") ", 1)) : se("", !0),
|
|
1622
|
-
!o.billRemark && o.reason ? (j(), q("span", jn, " (" + f(o.reason) + ") ", 1)) : se("", !0),
|
|
1623
|
-
!o.billRemark && o.remark ? (j(), q("span", Vn, " # " + f(o.remark), 1)) : se("", !0),
|
|
1624
|
-
(t = o.createdBy) != null && t.name ? (j(), ne(B, {
|
|
1625
|
-
key: 5,
|
|
1626
|
-
variant: "plain",
|
|
1627
|
-
placement: "top",
|
|
1628
|
-
"z-index": 50
|
|
1629
|
-
}, {
|
|
1630
|
-
content: M(() => [
|
|
1631
|
-
me(f(s(b)("inventory.stock.record.createdBy", [o.createdBy.name])), 1)
|
|
1632
|
-
]),
|
|
1633
|
-
default: M(() => [
|
|
1634
|
-
e("span", Cn, [
|
|
1635
|
-
y(a, {
|
|
1636
|
-
name: "person",
|
|
1637
|
-
size: "sm",
|
|
1638
|
-
color: "primary"
|
|
1639
|
-
}),
|
|
1640
|
-
me(" " + f(o.createdBy.name), 1)
|
|
1641
|
-
])
|
|
1642
|
-
]),
|
|
1643
|
-
_: 2
|
|
1644
|
-
}, 1024)) : se("", !0),
|
|
1645
|
-
o.name === s(ie).Enum.CLOSING ? (j(), q("span", Bn, " Actual Balance: " + f(o.toBalance) + " " + f(o.baseUnit), 1)) : se("", !0)
|
|
1646
|
-
]),
|
|
1647
|
-
e("div", {
|
|
1648
|
-
class: He({
|
|
1649
|
-
"text-fm-color-typo-error": o.amount.startsWith("-"),
|
|
1650
|
-
"text-fm-color-typo-success": !o.amount.startsWith("-"),
|
|
1651
|
-
"ml-auto": !0
|
|
1652
|
-
})
|
|
1653
|
-
}, f(o.amount), 3),
|
|
1654
|
-
o.name === s(ie).Enum.WASTAGE ? (j(), ne(_n, {
|
|
1655
|
-
key: 0,
|
|
1656
|
-
adjustmentId: o.adjustmentId,
|
|
1657
|
-
onRefreshHistory: l[1] || (l[1] = (n) => C.$emit("refreshHistory"))
|
|
1658
|
-
}, null, 8, ["adjustmentId"])) : se("", !0),
|
|
1659
|
-
o.cost ? (j(), q("div", Dn, " (" + f(s(Me)(o.cost, !1, o.cost.precision)) + ") ", 1)) : se("", !0)
|
|
1660
|
-
]);
|
|
1661
|
-
}), 128))
|
|
1662
|
-
])
|
|
1663
|
-
]))), 128))
|
|
1664
|
-
], 4)
|
|
1665
|
-
])
|
|
1666
|
-
]),
|
|
1667
|
-
_: 1
|
|
1668
|
-
});
|
|
1669
|
-
};
|
|
1670
|
-
}
|
|
1671
|
-
});
|
|
1672
|
-
function In(A, c) {
|
|
1673
|
-
var V;
|
|
1674
|
-
const k = Object.keys(ie.enum).reduce(
|
|
1675
|
-
(d, r) => (d[r] = { amount: 0, precision: 0 }, d),
|
|
1676
|
-
{}
|
|
1677
|
-
);
|
|
1678
|
-
if (!c)
|
|
1679
|
-
return Object.entries(k).reduce(
|
|
1680
|
-
(d, [r]) => (d[r] = oe.fromNumber(0), d),
|
|
1681
|
-
{}
|
|
1682
|
-
);
|
|
1683
|
-
const w = A.flatMap((d) => {
|
|
1684
|
-
var r;
|
|
1685
|
-
return ((r = d.skus) == null ? void 0 : r.filter((b) => b.sku._id === c._id)) ?? [];
|
|
1686
|
-
}).flatMap((d) => d.amounts);
|
|
1687
|
-
for (const d of w) {
|
|
1688
|
-
const r = d.measurement ? oe.multiply([d.measurement.conversion, d.amount]) : d.amount;
|
|
1689
|
-
k[V = d.type] ?? (k[V] = { amount: 0, precision: 0 }), k[d.type] = oe.add([r, k[d.type]]);
|
|
1690
|
-
}
|
|
1691
|
-
return Object.entries(k).reduce(
|
|
1692
|
-
(d, [r, b]) => {
|
|
1693
|
-
const R = {
|
|
1694
|
-
...b,
|
|
1695
|
-
amount: Math.abs(b.amount)
|
|
1696
|
-
};
|
|
1697
|
-
return d[r] = /// comment, because without it formatter makes code uglier
|
|
1698
|
-
`${oe.toFormatString({
|
|
1699
|
-
value: R,
|
|
1700
|
-
precision: 4
|
|
1701
|
-
})} ${c.unit.abbrev}`, d;
|
|
1702
|
-
},
|
|
1703
|
-
{}
|
|
1704
|
-
);
|
|
1705
|
-
}
|
|
1706
|
-
function Hn(A, c) {
|
|
1707
|
-
if (!c)
|
|
1708
|
-
return null;
|
|
1709
|
-
let k = null;
|
|
1710
|
-
const w = A.flatMap((V) => {
|
|
1711
|
-
var d;
|
|
1712
|
-
return ((d = V.skus) == null ? void 0 : d.filter((r) => r.sku._id === c._id)) ?? [];
|
|
1713
|
-
}).flatMap((V) => {
|
|
1714
|
-
var d;
|
|
1715
|
-
return !V.history || ((d = V.history) == null ? void 0 : d.length) === 0 ? [] : V.history[0];
|
|
1716
|
-
});
|
|
1717
|
-
for (const V of w) {
|
|
1718
|
-
const d = V.amounts;
|
|
1719
|
-
for (const r of d) {
|
|
1720
|
-
if (r.type !== ie.Enum.SALES)
|
|
1721
|
-
continue;
|
|
1722
|
-
const b = r.measurement ? oe.multiply([r.measurement.conversion, r.amount]) : r.amount;
|
|
1723
|
-
k ?? (k = oe.fromNumber(0)), k = oe.add([k, b]);
|
|
1724
|
-
}
|
|
1725
|
-
}
|
|
1726
|
-
return k != null ? (k.amount = Math.abs(k.amount), `${oe.toFormatString({
|
|
1727
|
-
value: k,
|
|
1728
|
-
precision: 4
|
|
1729
|
-
})} ${c.unit.abbrev}`) : null;
|
|
1730
|
-
}
|
|
1731
|
-
const Tn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, En = { class: "flex-1 line-clamp-2" }, Un = { class: "flex flex-col gap-32 w-full h-full" }, Pn = { class: "flex items-center relative gap-4" }, Rn = { class: "flex-1" }, Nn = {
|
|
1732
|
-
key: 0,
|
|
1733
|
-
class: "flex-1 flex flex-col items-center gap-16"
|
|
1734
|
-
}, On = { class: "fm-typo-en-body-lg-400 translate-x-4" }, Ln = {
|
|
1735
|
-
key: 1,
|
|
1736
|
-
class: "flex flex-col gap-12"
|
|
1737
|
-
}, Yn = { class: "pb-16" }, zn = { class: "fm-typo-cn-body-lg-600" }, Gn = {
|
|
1738
|
-
class: "grid gap-12 fm-typo-en-body-md-400",
|
|
1739
|
-
style: { "grid-template-columns": "auto auto auto", "grid-auto-rows": "1fr" }
|
|
1740
|
-
}, Wn = { class: "flex flex-col gap-1" }, Kn = { class: "text-fm-color-typo-secondary" }, qn = { class: "font-bold" }, Xn = { class: "flex flex-col gap-1" }, Jn = { class: "text-fm-color-typo-secondary flex" }, Qn = { class: "font-bold" }, Zn = { class: "flex flex-col gap-1" }, es = { class: "text-fm-color-typo-secondary" }, ts = { class: "font-bold" }, os = { class: "flex flex-col gap-1" }, ns = { class: "text-fm-color-typo-secondary" }, ss = { class: "font-bold" }, as = { class: "flex flex-col gap-1" }, rs = { class: "text-fm-color-typo-secondary" }, ls = { class: "font-bold" }, is = { class: "flex flex-col gap-1" }, us = { class: "text-fm-color-typo-secondary" }, cs = { class: "font-bold" }, ds = { class: "flex flex-col gap-1" }, ms = { class: "text-fm-color-typo-secondary" }, fs = { class: "font-bold" }, vs = { class: "flex flex-col gap-1" }, ps = { class: "text-fm-color-typo-secondary" }, ys = { class: "font-bold" }, _s = { class: "flex flex-col gap-1" }, ks = { class: "text-fm-color-typo-secondary" }, hs = { class: "font-bold" }, bs = {
|
|
1741
|
-
key: 0,
|
|
1742
|
-
class: "flex flex-col gap-8"
|
|
1743
|
-
}, gs = { class: "flex" }, xs = { class: "flex-1 flex flex-col gap-1" }, Ss = { class: "flex items-center gap-8" }, ws = { class: "flex gap-1 items-center text-fm-color-typo-secondary" }, As = { class: "font-bold" }, Fs = { class: "flex-1 flex flex-col gap-1" }, $s = { class: "flex items-center gap-8" }, js = { class: "flex gap-1 items-center text-fm-color-typo-secondary" }, Vs = { class: "flex flex-col gap-1" }, Cs = { class: "font-bold" }, Bs = {
|
|
1744
|
-
key: 2,
|
|
1745
|
-
class: "flex-1 flex flex-col items-center gap-8"
|
|
1746
|
-
}, Ds = ["src"], Ms = { class: "font-bold text-lg" }, Is = { class: "text-xs text-neutral-400 text-center" }, Hs = /* @__PURE__ */ pe({
|
|
1747
|
-
__name: "StockHistory",
|
|
1748
|
-
props: {
|
|
1749
|
-
sku: {},
|
|
1750
|
-
show: { type: Boolean }
|
|
1751
|
-
},
|
|
1752
|
-
emits: ["update:show"],
|
|
1753
|
-
setup(A) {
|
|
1754
|
-
const c = Je(), k = Oe(), _ = Ae(), w = an(), V = Se(), d = ao(), { t: r } = ye(), b = A, R = Y(!1), C = we(), l = Y("adjustment"), a = Y([
|
|
1755
|
-
{ label: "Adjustment (Default)", value: "adjustment" }
|
|
1756
|
-
]), B = Y([]), v = Y(no(0));
|
|
1757
|
-
async function g() {
|
|
1758
|
-
R.value = !0;
|
|
1759
|
-
try {
|
|
1760
|
-
await N(), await k.readStockBalance();
|
|
1761
|
-
} catch (u) {
|
|
1762
|
-
C.open({
|
|
1763
|
-
title: "Something went wrong",
|
|
1764
|
-
message: "Cannot fetch stock history. Please try again.",
|
|
1765
|
-
type: "error"
|
|
1766
|
-
}), console.log("failed at fetching item adjustment history", b.sku, v, u);
|
|
1767
|
-
} finally {
|
|
1768
|
-
R.value = !1;
|
|
1769
|
-
}
|
|
1770
|
-
}
|
|
1771
|
-
Xe(() => {
|
|
1772
|
-
g();
|
|
1773
|
-
}), Fe([() => v.value, () => b.sku], () => {
|
|
1774
|
-
g();
|
|
1775
|
-
});
|
|
1776
|
-
const o = Y([]), t = Y([]), n = Y(new Array());
|
|
1777
|
-
function $(u, h) {
|
|
1778
|
-
return h === "day" ? oo(u) : wt(u);
|
|
1779
|
-
}
|
|
1780
|
-
function E(u, h) {
|
|
1781
|
-
const p = u.reduce(
|
|
1782
|
-
(m, i) => {
|
|
1783
|
-
const S = i.effectiveAt ?? Te(i._id);
|
|
1784
|
-
if (!S)
|
|
1785
|
-
return m;
|
|
1786
|
-
const P = $(new Date(S), h);
|
|
1787
|
-
return m[P] ?? (m[P] = []), m[P].push(i), m;
|
|
1788
|
-
},
|
|
1789
|
-
{}
|
|
1790
|
-
);
|
|
1791
|
-
return Object.keys(p).map((m) => ({
|
|
1792
|
-
date: m,
|
|
1793
|
-
adjustments: p[m]
|
|
1794
|
-
}));
|
|
1795
|
-
}
|
|
1796
|
-
async function N() {
|
|
1797
|
-
let u = await _.readStockAdjustment(
|
|
1798
|
-
b.sku._id,
|
|
1799
|
-
dt(new Date(v.value.startDate)).toISOString(),
|
|
1800
|
-
mt(new Date(v.value.endDate)).toISOString()
|
|
1801
|
-
);
|
|
1802
|
-
o.value = u;
|
|
1803
|
-
const h = u.filter(({ ref: p }) => p == null ? void 0 : p.startsWith("bill_")).map(({ ref: p }) => p);
|
|
1804
|
-
await O(h), t.value = E(u, "day").map(({ date: p, adjustments: m }) => ({
|
|
1805
|
-
date: p,
|
|
1806
|
-
adjustments: m,
|
|
1807
|
-
adjustmentsByTime: E(m, "minute")
|
|
1808
|
-
}));
|
|
1809
|
-
try {
|
|
1810
|
-
const p = await _.readUnitCostHistory(
|
|
1811
|
-
b.sku._id,
|
|
1812
|
-
dt(new Date(v.value.startDate)).toISOString(),
|
|
1813
|
-
mt(new Date(v.value.endDate)).toISOString()
|
|
1814
|
-
);
|
|
1815
|
-
B.value = p;
|
|
1816
|
-
const m = /* @__PURE__ */ new Set();
|
|
1817
|
-
p.forEach((S) => {
|
|
1818
|
-
m.add(S.mechanism);
|
|
1819
|
-
});
|
|
1820
|
-
const i = [{ label: "Default", value: "adjustment" }];
|
|
1821
|
-
m.has(ge.Enum.weightedAverage) && i.push({
|
|
1822
|
-
label: "Weighted Average (Beta)",
|
|
1823
|
-
value: ge.Enum.weightedAverage
|
|
1824
|
-
}), m.has(ge.Enum.netsuite) && i.push({ label: "NetSuite (Beta)", value: ge.Enum.netsuite }), m.has(ge.Enum["netsuite-average"]) && i.push({
|
|
1825
|
-
label: "NetSuite Average (Beta)",
|
|
1826
|
-
value: ge.Enum["netsuite-average"]
|
|
1827
|
-
}), a.value = i, !m.has(l.value) && l.value !== "adjustment" && (l.value = "adjustment");
|
|
1828
|
-
} catch (p) {
|
|
1829
|
-
console.error("Failed to fetch unit cost history:", p);
|
|
1830
|
-
}
|
|
1831
|
-
}
|
|
1832
|
-
async function O(u) {
|
|
1833
|
-
u.length && (n.value = await w.findBillsById(u).catch((h) => {
|
|
1834
|
-
var i;
|
|
1835
|
-
console.error("Error on using latest bill API, retrying using legacy api", h);
|
|
1836
|
-
const p = ((i = c.currentBusiness.value) == null ? void 0 : i._id) ?? "", m = V.currentLocation.doc._id;
|
|
1837
|
-
return w.findBillsByBusinessId(p, [m], u);
|
|
1838
|
-
}));
|
|
1839
|
-
}
|
|
1840
|
-
const L = T(() => {
|
|
1841
|
-
const u = o.value, h = b.sku;
|
|
1842
|
-
return In(u, h);
|
|
1843
|
-
}), X = T(() => {
|
|
1844
|
-
const u = o.value, h = b.sku;
|
|
1845
|
-
return Hn(u, h);
|
|
1846
|
-
}), z = T(() => {
|
|
1847
|
-
const u = [...o.value].computeFirst((p) => {
|
|
1848
|
-
var i, S;
|
|
1849
|
-
const m = (S = (i = p.skus) == null ? void 0 : i.find) == null ? void 0 : S.call(i, (P) => P.sku._id === b.sku._id);
|
|
1850
|
-
return m == null ? void 0 : m.fromBalance;
|
|
1851
|
-
}) ?? {
|
|
1852
|
-
amount: 0,
|
|
1853
|
-
precision: 0
|
|
1854
|
-
}, h = b.sku;
|
|
1855
|
-
return h ? `${oe.toFormatString({
|
|
1856
|
-
value: u,
|
|
1857
|
-
precision: 4
|
|
1858
|
-
})} ${h.unit.abbrev}` : "";
|
|
1859
|
-
}), K = T(() => {
|
|
1860
|
-
const u = [...o.value].reverse().computeFirst((p) => {
|
|
1861
|
-
var i, S;
|
|
1862
|
-
const m = (S = (i = p.skus) == null ? void 0 : i.find) == null ? void 0 : S.call(i, (P) => P.sku._id === b.sku._id);
|
|
1863
|
-
return m == null ? void 0 : m.toBalance;
|
|
1864
|
-
}) ?? {
|
|
1865
|
-
amount: 0,
|
|
1866
|
-
precision: 0
|
|
1867
|
-
}, h = b.sku;
|
|
1868
|
-
return h ? `${oe.toFormatString({ value: u, precision: 4 })} ${h.unit.abbrev}` : "";
|
|
1869
|
-
}), U = T(() => {
|
|
1870
|
-
var p;
|
|
1871
|
-
const h = o.value.flatMap((m) => {
|
|
1872
|
-
var i;
|
|
1873
|
-
return ((i = m.skus) == null ? void 0 : i.flatMap((S) => S.amounts)) ?? [];
|
|
1874
|
-
}).filter((m) => m.amount.amount < 0).reduce(
|
|
1875
|
-
(m, i) => {
|
|
1876
|
-
const S = i.cost;
|
|
1877
|
-
if (!S) return m;
|
|
1878
|
-
const P = {
|
|
1879
|
-
...zt(m, Math.max(m.precision, S.precision)),
|
|
1880
|
-
currency: S.currency
|
|
1881
|
-
};
|
|
1882
|
-
return {
|
|
1883
|
-
...Ze(P, S),
|
|
1884
|
-
currency: m.currency
|
|
1885
|
-
};
|
|
1886
|
-
},
|
|
1887
|
-
{
|
|
1888
|
-
amount: 0,
|
|
1889
|
-
precision: 0,
|
|
1890
|
-
currency: Ce((p = c.currentCountry) == null ? void 0 : p.value)
|
|
1891
|
-
}
|
|
1892
|
-
);
|
|
1893
|
-
return Me(h, !1, h.precision);
|
|
1894
|
-
});
|
|
1895
|
-
function Z() {
|
|
1896
|
-
const { startDate: u, endDate: h } = eo(v.value);
|
|
1897
|
-
u !== null && h !== null && (v.value = {
|
|
1898
|
-
startDate: u,
|
|
1899
|
-
endDate: h
|
|
1900
|
-
});
|
|
1901
|
-
}
|
|
1902
|
-
const re = T(() => r("inventory.ingredient.valuationMethod.WAVG"));
|
|
1903
|
-
function x(u, h) {
|
|
1904
|
-
if (l.value === "adjustment")
|
|
1905
|
-
return null;
|
|
1906
|
-
const p = B.value.filter(
|
|
1907
|
-
(S) => S.mechanism === l.value && S.skuId === b.sku._id
|
|
1908
|
-
);
|
|
1909
|
-
if (p.length === 0) return null;
|
|
1910
|
-
const m = p.find((S) => {
|
|
1911
|
-
const P = S.meta;
|
|
1912
|
-
return (P == null ? void 0 : P.adjustmentId) === u;
|
|
1913
|
-
});
|
|
1914
|
-
if (m) return m.cost;
|
|
1915
|
-
const i = [...p].filter((S) => new Date(S.snapshotAt) <= new Date(h)).sort((S, P) => new Date(P.snapshotAt).getTime() - new Date(S.snapshotAt).getTime());
|
|
1916
|
-
return i.length > 0 ? i[0].cost : null;
|
|
1917
|
-
}
|
|
1918
|
-
const F = T(() => {
|
|
1919
|
-
var m, i, S, P, ee, ae;
|
|
1920
|
-
const u = [...o.value].reverse().find((Q) => {
|
|
1921
|
-
var W, te;
|
|
1922
|
-
return (te = (W = Q.skus) == null ? void 0 : W.find) == null ? void 0 : te.call(W, (le) => le.sku._id === b.sku._id);
|
|
1923
|
-
});
|
|
1924
|
-
if (!u) return "No data";
|
|
1925
|
-
const h = (m = u.skus) == null ? void 0 : m.find((Q) => Q.sku._id === b.sku._id);
|
|
1926
|
-
if (!h) return "No data";
|
|
1927
|
-
const p = h.toBalance;
|
|
1928
|
-
if (l.value === "adjustment") {
|
|
1929
|
-
const Q = [...h.amounts].reverse()[0], W = {
|
|
1930
|
-
amount: ((i = Q.cost) == null ? void 0 : i.amount) ?? 0,
|
|
1931
|
-
precision: ((S = Q.cost) == null ? void 0 : S.precision) ?? 0
|
|
1932
|
-
}, te = Q.amount, le = te.amount == 0 ? oe.fromNumber(0) : oe.divide([W, te]);
|
|
1933
|
-
return {
|
|
1934
|
-
...oe.multiply([le, p]),
|
|
1935
|
-
currency: ((P = Q.cost) == null ? void 0 : P.currency) || Ce(((ee = c.currentCountry) == null ? void 0 : ee.value) ?? it)
|
|
1936
|
-
};
|
|
1937
|
-
} else {
|
|
1938
|
-
const Q = u.effectiveAt ?? Te(u._id), W = x(
|
|
1939
|
-
u._id,
|
|
1940
|
-
Q ?? (/* @__PURE__ */ new Date()).toISOString()
|
|
1941
|
-
);
|
|
1942
|
-
if (!W) return "No data";
|
|
1943
|
-
const te = oe.fromDinero(W);
|
|
1944
|
-
return {
|
|
1945
|
-
...oe.multiply([te, p]),
|
|
1946
|
-
currency: W.currency || Ce(((ae = c.currentCountry) == null ? void 0 : ae.value) ?? it)
|
|
1947
|
-
};
|
|
1948
|
-
}
|
|
1949
|
-
}), G = T(() => {
|
|
1950
|
-
var p;
|
|
1951
|
-
const u = [...o.value].reverse().computeFirst((m) => {
|
|
1952
|
-
var S, P;
|
|
1953
|
-
const i = (P = (S = m.skus) == null ? void 0 : S.find) == null ? void 0 : P.call(S, (ee) => ee.sku._id === b.sku._id);
|
|
1954
|
-
return i == null ? void 0 : i.toCostBalances;
|
|
1955
|
-
});
|
|
1956
|
-
return !u || u.some((m) => m.cost == null) ? "No data" : {
|
|
1957
|
-
...u.reduce((m, i) => oe.add([m, oe.fromDinero(i.cost)]), {
|
|
1958
|
-
amount: 0,
|
|
1959
|
-
precision: 0
|
|
1960
|
-
}),
|
|
1961
|
-
currency: Ce((p = c.currentCountry) == null ? void 0 : p.value)
|
|
1962
|
-
};
|
|
1963
|
-
}), H = T(() => b.sku.valuation === ut.Enum.FIFO ? G.value : F.value);
|
|
1964
|
-
function J() {
|
|
1965
|
-
const { startDate: u, endDate: h } = to(v.value);
|
|
1966
|
-
u !== null && h !== null && (v.value = {
|
|
1967
|
-
startDate: u,
|
|
1968
|
-
endDate: h
|
|
1969
|
-
});
|
|
1970
|
-
}
|
|
1971
|
-
const I = Ye(b, "show");
|
|
1972
|
-
return (u, h) => {
|
|
1973
|
-
const p = D("FmButton"), m = D("FmField"), i = D("FmDateRangePicker"), S = D("FmSpacer"), P = D("FmCircularProgress"), ee = D("FmIcon"), ae = D("FmTooltip"), Q = D("FmMenuDivider"), W = D("FmChip"), te = D("FmSelect"), le = D("FmCardSection"), ce = D("FmCard"), je = D("FmSideSheet");
|
|
1974
|
-
return j(), ne(je, {
|
|
1975
|
-
"dismiss-away": "",
|
|
1976
|
-
modelValue: s(I),
|
|
1977
|
-
"onUpdate:modelValue": h[5] || (h[5] = (fe) => Pe(I) ? I.value = fe : null),
|
|
1978
|
-
"close-button": !1,
|
|
1979
|
-
"max-width": 560
|
|
1980
|
-
}, {
|
|
1981
|
-
"side-sheet-header": M(() => [
|
|
1982
|
-
e("div", Tn, [
|
|
1983
|
-
e("div", En, f(s(r)("inventory.stock.history.title", [u.sku.name])), 1),
|
|
1984
|
-
y(p, {
|
|
1985
|
-
variant: "tertiary",
|
|
1986
|
-
"prepend-icon": "close",
|
|
1987
|
-
onClick: h[0] || (h[0] = (fe) => I.value = !1)
|
|
1988
|
-
})
|
|
1989
|
-
])
|
|
1990
|
-
]),
|
|
1991
|
-
default: M(() => {
|
|
1992
|
-
var fe;
|
|
1993
|
-
return [
|
|
1994
|
-
e("div", Un, [
|
|
1995
|
-
e("div", Pn, [
|
|
1996
|
-
e("div", Rn, [
|
|
1997
|
-
y(i, {
|
|
1998
|
-
modelValue: v.value,
|
|
1999
|
-
"onUpdate:modelValue": h[1] || (h[1] = (de) => v.value = de),
|
|
2000
|
-
"show-predefined-range": "",
|
|
2001
|
-
"start-label": "",
|
|
2002
|
-
"end-label": "",
|
|
2003
|
-
"z-index": 50
|
|
2004
|
-
}, {
|
|
2005
|
-
"trigger-button": M(({ opened: de }) => [
|
|
2006
|
-
y(m, {
|
|
2007
|
-
"prepend-icon": "calendar_month",
|
|
2008
|
-
focused: de
|
|
2009
|
-
}, {
|
|
2010
|
-
default: M(() => [
|
|
2011
|
-
me(f(v.value.startDate) + " - " + f(v.value.endDate), 1)
|
|
2012
|
-
]),
|
|
2013
|
-
_: 2
|
|
2014
|
-
}, 1032, ["focused"])
|
|
2015
|
-
]),
|
|
2016
|
-
_: 1
|
|
2017
|
-
}, 8, ["modelValue"])
|
|
2018
|
-
]),
|
|
2019
|
-
y(p, {
|
|
2020
|
-
variant: "tertiary",
|
|
2021
|
-
onClick: h[2] || (h[2] = (de) => Z()),
|
|
2022
|
-
"prepend-icon": "navigate_before"
|
|
2023
|
-
}),
|
|
2024
|
-
y(p, {
|
|
2025
|
-
variant: "tertiary",
|
|
2026
|
-
onClick: h[3] || (h[3] = (de) => J()),
|
|
2027
|
-
"prepend-icon": "navigate_next"
|
|
2028
|
-
})
|
|
2029
|
-
]),
|
|
2030
|
-
R.value ? (j(), q("div", Nn, [
|
|
2031
|
-
y(S),
|
|
2032
|
-
y(P, { size: "xl" }),
|
|
2033
|
-
e("div", On, f(s(r)("inventory.stock.history.loading")), 1),
|
|
2034
|
-
y(S),
|
|
2035
|
-
y(S)
|
|
2036
|
-
])) : t.value && ((fe = t.value) == null ? void 0 : fe.length) > 0 ? (j(), q("div", Ln, [
|
|
2037
|
-
y(ce, { variant: "outlined" }, {
|
|
2038
|
-
default: M(() => [
|
|
2039
|
-
y(le, { class: "flex flex-col gap-4" }, {
|
|
2040
|
-
default: M(() => [
|
|
2041
|
-
e("div", Yn, [
|
|
2042
|
-
e("div", zn, f(s(r)("inventory.stock.history.summary.title")), 1)
|
|
2043
|
-
]),
|
|
2044
|
-
e("div", Gn, [
|
|
2045
|
-
e("div", Wn, [
|
|
2046
|
-
e("div", Kn, f(s(r)("inventory.stock.history.summary.totalPurchase")), 1),
|
|
2047
|
-
e("div", qn, f(L.value.PURCHASE), 1)
|
|
2048
|
-
]),
|
|
2049
|
-
e("div", Xn, [
|
|
2050
|
-
e("div", Jn, [
|
|
2051
|
-
me(f(s(r)("inventory.stock.history.summary.totalSales")) + " ", 1),
|
|
2052
|
-
X.value != null ? (j(), ne(ae, {
|
|
2053
|
-
key: 0,
|
|
2054
|
-
variant: "plain",
|
|
2055
|
-
placement: "top",
|
|
2056
|
-
content: `Before: ${X.value}`,
|
|
2057
|
-
"z-index": 50
|
|
2058
|
-
}, {
|
|
2059
|
-
default: M(() => [
|
|
2060
|
-
y(ee, {
|
|
2061
|
-
name: "warning",
|
|
2062
|
-
size: "sm"
|
|
2063
|
-
})
|
|
2064
|
-
]),
|
|
2065
|
-
_: 1
|
|
2066
|
-
}, 8, ["content"])) : se("", !0)
|
|
2067
|
-
]),
|
|
2068
|
-
e("div", Qn, f(L.value.SALES), 1)
|
|
2069
|
-
]),
|
|
2070
|
-
e("div", Zn, [
|
|
2071
|
-
e("div", es, f(s(r)("inventory.stock.history.summary.totalLose")), 1),
|
|
2072
|
-
e("div", ts, f(L.value.LOSE), 1)
|
|
2073
|
-
]),
|
|
2074
|
-
e("div", os, [
|
|
2075
|
-
e("div", ns, f(s(r)("inventory.stock.history.summary.totalRequest")), 1),
|
|
2076
|
-
e("div", ss, f(L.value.REQUEST), 1)
|
|
2077
|
-
]),
|
|
2078
|
-
e("div", as, [
|
|
2079
|
-
e("div", rs, f(s(r)("inventory.stock.history.summary.totalReceive")), 1),
|
|
2080
|
-
e("div", ls, f(L.value.RECEIVE), 1)
|
|
2081
|
-
]),
|
|
2082
|
-
e("div", is, [
|
|
2083
|
-
e("div", us, f(s(r)("inventory.stock.history.summary.totalConvert")), 1),
|
|
2084
|
-
e("div", cs, f(L.value.CONVERT), 1)
|
|
2085
|
-
]),
|
|
2086
|
-
e("div", ds, [
|
|
2087
|
-
e("div", ms, f(s(r)("inventory.stock.history.summary.totalDamage")), 1),
|
|
2088
|
-
e("div", fs, f(L.value.DAMAGE), 1)
|
|
2089
|
-
]),
|
|
2090
|
-
e("div", vs, [
|
|
2091
|
-
e("div", ps, f(s(r)("inventory.stock.history.summary.openingBalance")), 1),
|
|
2092
|
-
e("div", ys, f(z.value), 1)
|
|
2093
|
-
]),
|
|
2094
|
-
e("div", _s, [
|
|
2095
|
-
e("div", ks, f(s(r)("inventory.stock.history.summary.lastStockBalance")), 1),
|
|
2096
|
-
e("div", hs, f(K.value), 1)
|
|
2097
|
-
])
|
|
2098
|
-
]),
|
|
2099
|
-
s(d).enableTotalCost ? (j(), q("div", bs, [
|
|
2100
|
-
y(Q, { class: "w-full" }),
|
|
2101
|
-
e("div", gs, [
|
|
2102
|
-
e("div", xs, [
|
|
2103
|
-
e("div", Ss, [
|
|
2104
|
-
e("div", ws, [
|
|
2105
|
-
me(f(s(r)("inventory.stock.history.estimatedValue")) + " ", 1),
|
|
2106
|
-
y(ae, {
|
|
2107
|
-
variant: "plain",
|
|
2108
|
-
placement: "top",
|
|
2109
|
-
content: `[${re.value}] ${s(r)("inventory.stock.history.estimatedValueTooltip")}`,
|
|
2110
|
-
"z-index": 50
|
|
2111
|
-
}, {
|
|
2112
|
-
default: M(() => [
|
|
2113
|
-
y(ee, {
|
|
2114
|
-
name: "help",
|
|
2115
|
-
size: "sm"
|
|
2116
|
-
})
|
|
2117
|
-
]),
|
|
2118
|
-
_: 1
|
|
2119
|
-
}, 8, ["content"])
|
|
2120
|
-
]),
|
|
2121
|
-
y(qe, {
|
|
2122
|
-
tier: "premium",
|
|
2123
|
-
category: "premium"
|
|
2124
|
-
})
|
|
2125
|
-
]),
|
|
2126
|
-
e("div", As, [
|
|
2127
|
-
u.sku.valuation === s(ut).Enum.FIFO ? (j(), q(ue, { key: 0 }, [
|
|
2128
|
-
y(W, {
|
|
2129
|
-
label: "FIFO",
|
|
2130
|
-
compact: ""
|
|
2131
|
-
}),
|
|
2132
|
-
me(" " + f(typeof H.value != "string" ? s(Me)(
|
|
2133
|
-
H.value,
|
|
2134
|
-
!1,
|
|
2135
|
-
H.value.precision
|
|
2136
|
-
) : H.value), 1)
|
|
2137
|
-
], 64)) : (j(), q(ue, { key: 1 }, [
|
|
2138
|
-
me(f(typeof H.value != "string" ? s(Me)(
|
|
2139
|
-
H.value,
|
|
2140
|
-
!1,
|
|
2141
|
-
H.value.precision
|
|
2142
|
-
) : H.value), 1)
|
|
2143
|
-
], 64))
|
|
2144
|
-
]),
|
|
2145
|
-
y(te, {
|
|
2146
|
-
modelValue: l.value,
|
|
2147
|
-
"onUpdate:modelValue": h[4] || (h[4] = (de) => l.value = de),
|
|
2148
|
-
items: a.value,
|
|
2149
|
-
compact: "",
|
|
2150
|
-
size: "sm",
|
|
2151
|
-
style: { width: "200px" }
|
|
2152
|
-
}, null, 8, ["modelValue", "items"])
|
|
2153
|
-
]),
|
|
2154
|
-
e("div", Fs, [
|
|
2155
|
-
e("div", $s, [
|
|
2156
|
-
e("div", js, [
|
|
2157
|
-
me(f(s(r)("inventory.stock.history.costSold")) + " ", 1),
|
|
2158
|
-
y(ae, {
|
|
2159
|
-
variant: "plain",
|
|
2160
|
-
placement: "top",
|
|
2161
|
-
"z-index": 50
|
|
2162
|
-
}, {
|
|
2163
|
-
content: M(() => [
|
|
2164
|
-
e("div", Vs, f(s(r)("inventory.stock.history.costSoldTooltip")), 1)
|
|
2165
|
-
]),
|
|
2166
|
-
default: M(() => [
|
|
2167
|
-
y(ee, {
|
|
2168
|
-
name: "help",
|
|
2169
|
-
size: "sm"
|
|
2170
|
-
})
|
|
2171
|
-
]),
|
|
2172
|
-
_: 1
|
|
2173
|
-
})
|
|
2174
|
-
]),
|
|
2175
|
-
y(qe, {
|
|
2176
|
-
tier: "premium",
|
|
2177
|
-
category: "premium"
|
|
2178
|
-
})
|
|
2179
|
-
]),
|
|
2180
|
-
e("div", Cs, f(U.value), 1)
|
|
2181
|
-
])
|
|
2182
|
-
])
|
|
2183
|
-
])) : se("", !0)
|
|
2184
|
-
]),
|
|
2185
|
-
_: 1
|
|
2186
|
-
})
|
|
2187
|
-
]),
|
|
2188
|
-
_: 1
|
|
2189
|
-
}),
|
|
2190
|
-
h[6] || (h[6] = e("div", null, null, -1)),
|
|
2191
|
-
(j(!0), q(ue, null, ve(t.value, (de) => (j(), q(ue, {
|
|
2192
|
-
key: de.date
|
|
2193
|
-
}, [
|
|
2194
|
-
u.sku ? (j(), ne(Mn, {
|
|
2195
|
-
key: 0,
|
|
2196
|
-
record: de,
|
|
2197
|
-
sku: u.sku,
|
|
2198
|
-
bills: n.value,
|
|
2199
|
-
"unit-cost-history": B.value,
|
|
2200
|
-
"cost-mechanism": l.value,
|
|
2201
|
-
onRefreshHistory: g
|
|
2202
|
-
}, null, 8, ["record", "sku", "bills", "unit-cost-history", "cost-mechanism"])) : se("", !0)
|
|
2203
|
-
], 64))), 128))
|
|
2204
|
-
])) : (j(), q("div", Bs, [
|
|
2205
|
-
y(S),
|
|
2206
|
-
e("div", null, [
|
|
2207
|
-
e("img", {
|
|
2208
|
-
src: s(so),
|
|
2209
|
-
alt: "List is empty"
|
|
2210
|
-
}, null, 8, Ds)
|
|
2211
|
-
]),
|
|
2212
|
-
e("div", Ms, f(s(r)("inventory.stock.history.noRecords")), 1),
|
|
2213
|
-
e("div", Is, f(s(r)("inventory.stock.history.changeDateRange")), 1),
|
|
2214
|
-
y(S),
|
|
2215
|
-
y(S)
|
|
2216
|
-
]))
|
|
2217
|
-
])
|
|
2218
|
-
];
|
|
2219
|
-
}),
|
|
2220
|
-
_: 1
|
|
2221
|
-
}, 8, ["modelValue"]);
|
|
2222
|
-
};
|
|
2223
|
-
}
|
|
2224
|
-
}), Ts = /* @__PURE__ */ pe({
|
|
2225
|
-
__name: "HrmPermissionGuard",
|
|
2226
|
-
props: {
|
|
2227
|
-
permission: { default: void 0 },
|
|
2228
|
-
permissions: { default: void 0 },
|
|
2229
|
-
mode: { default: "all" }
|
|
2230
|
-
},
|
|
2231
|
-
setup(A) {
|
|
2232
|
-
const c = A, k = T(() => {
|
|
2233
|
-
const w = [];
|
|
2234
|
-
return c.permission && w.push(c.permission), c.permissions && w.push(...c.permissions), w;
|
|
2235
|
-
});
|
|
2236
|
-
Vt(() => {
|
|
2237
|
-
});
|
|
2238
|
-
const { hasPermission: _ } = At(k, () => c.mode);
|
|
2239
|
-
return (w, V) => s(_) ? at(w.$slots, "default", { key: 0 }) : at(w.$slots, "fallback", { key: 1 });
|
|
2240
|
-
}
|
|
2241
|
-
});
|
|
2242
|
-
function Es(A) {
|
|
2243
|
-
const c = io(), k = Se(), _ = Y(!1), w = Y(null), V = Y(null);
|
|
2244
|
-
let d = null, r = !1, b = !1;
|
|
2245
|
-
function R() {
|
|
2246
|
-
if (b) return;
|
|
2247
|
-
const a = k.currentLocationDBName;
|
|
2248
|
-
if (!a) return;
|
|
2249
|
-
b = !0;
|
|
2250
|
-
const B = {
|
|
2251
|
-
type: "refresh-balance",
|
|
2252
|
-
params: { locationId: a }
|
|
2253
|
-
}, { unsubscribe: v, initialState: g } = c.subscribe(
|
|
2254
|
-
B,
|
|
2255
|
-
C
|
|
2256
|
-
);
|
|
2257
|
-
d = v, g.then((o) => {
|
|
2258
|
-
o != null && o.initialState && C(o.initialState);
|
|
2259
|
-
}).catch((o) => {
|
|
2260
|
-
console.error("Failed to fetch refresh-balance initial state", o);
|
|
2261
|
-
});
|
|
2262
|
-
}
|
|
2263
|
-
async function C(a) {
|
|
2264
|
-
var B, v, g;
|
|
2265
|
-
if (!(!b || !a)) {
|
|
2266
|
-
if (w.value = a, a.completedAt && (V.value = a.completedAt), a.message === "processing" || !a.completedAt && !a.message) {
|
|
2267
|
-
r = !0, _.value = !0;
|
|
2268
|
-
return;
|
|
2269
|
-
}
|
|
2270
|
-
if (a.message === "completed" || a.completedAt) {
|
|
2271
|
-
if (!r) return;
|
|
2272
|
-
l();
|
|
2273
|
-
try {
|
|
2274
|
-
await A.onCompleted();
|
|
2275
|
-
} catch (o) {
|
|
2276
|
-
console.error("Failed to reload after refresh", o);
|
|
2277
|
-
}
|
|
2278
|
-
return;
|
|
2279
|
-
}
|
|
2280
|
-
if (a.message === "error" || (B = a.message) != null && B.startsWith("error:")) {
|
|
2281
|
-
console.log("Stock balance refresh error:", a.message);
|
|
2282
|
-
const o = (v = a.message) != null && v.startsWith("error:") ? a.message.slice(6).trim() : "Failed to refresh stock balance.";
|
|
2283
|
-
l(), await ((g = A.onError) == null ? void 0 : g.call(A, o));
|
|
2284
|
-
}
|
|
2285
|
-
}
|
|
2286
|
-
}
|
|
2287
|
-
function l() {
|
|
2288
|
-
d && (d(), d = null), b = !1, r = !1, _.value = !1, w.value = null;
|
|
2289
|
-
}
|
|
2290
|
-
return Ct(() => {
|
|
2291
|
-
l();
|
|
2292
|
-
}), {
|
|
2293
|
-
refreshing: _,
|
|
2294
|
-
refreshStatus: w,
|
|
2295
|
-
lastCompletedAt: V,
|
|
2296
|
-
startListening: R,
|
|
2297
|
-
stopListening: l
|
|
2298
|
-
};
|
|
2299
|
-
}
|
|
2300
|
-
const Us = {
|
|
2301
|
-
key: 0,
|
|
2302
|
-
class: "flex items-center gap-1"
|
|
2303
|
-
}, Ps = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Rs = { class: "flex flex-col gap-8" }, Ns = { class: "flex flex-col" }, Os = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Ls = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary line-clamp-1" }, ga = /* @__PURE__ */ pe({
|
|
2304
|
-
__name: "StockView",
|
|
2305
|
-
setup(A) {
|
|
2306
|
-
const { t: c } = ye(), k = Ne(), _ = Se(), w = Oe(), V = Ft(), d = Ae(), r = gt(), b = uo(), { columnDefs: R } = ko(), C = Je(), { hasPermission: l } = At(
|
|
2307
|
-
T(() => [
|
|
2308
|
-
{
|
|
2309
|
-
action: Be.Action.manage,
|
|
2310
|
-
subject: Be.Subject.Business.inventory_stockAdjustment
|
|
2311
|
-
}
|
|
2312
|
-
])
|
|
2313
|
-
), a = T(
|
|
2314
|
-
() => {
|
|
2315
|
-
var p;
|
|
2316
|
-
return l.value || ((p = C.sessionUser.value) == null ? void 0 : p.role.isAdmin);
|
|
2317
|
-
}
|
|
2318
|
-
), B = Le(), v = we();
|
|
2319
|
-
_.watchLocation(X);
|
|
2320
|
-
const g = T(
|
|
2321
|
-
() => new Set(b.getAvailableItems(b.businessSubsidiaryId))
|
|
2322
|
-
), o = Y(!1), t = Y(!1), { refreshing: n, lastCompletedAt: $, startListening: E, stopListening: N } = Es({
|
|
2323
|
-
onCompleted: async () => {
|
|
2324
|
-
await X(), t.value = !1, v.open({
|
|
2325
|
-
title: "Balance refreshed",
|
|
2326
|
-
message: "Stock balance has been recalculated.",
|
|
2327
|
-
type: "success"
|
|
2328
|
-
});
|
|
2329
|
-
},
|
|
2330
|
-
onError: (p) => {
|
|
2331
|
-
t.value = !1, console.log("Error refreshing stock balance", p), v.open({
|
|
2332
|
-
title: c("inventory.common.refreshFailed"),
|
|
2333
|
-
message: p || c("inventory.stock.stock_balance.refreshBalanceError"),
|
|
2334
|
-
type: "error"
|
|
2335
|
-
});
|
|
2336
|
-
}
|
|
2337
|
-
}), O = T(() => n.value || t.value);
|
|
2338
|
-
async function L() {
|
|
2339
|
-
E();
|
|
2340
|
-
const p = c("inventory.stock.stock_balance.refreshBalanceDescription"), m = $.value ? `${p}
|
|
2341
|
-
|
|
2342
|
-
Last refreshed: ${new Date($.value).toLocaleString()}` : p;
|
|
2343
|
-
B.open({
|
|
2344
|
-
title: c("inventory.stock.stock_balance.refreshBalance"),
|
|
2345
|
-
message: m,
|
|
2346
|
-
closeButton: !0,
|
|
2347
|
-
primaryActions: {
|
|
2348
|
-
text: c("common.confirm"),
|
|
2349
|
-
close: !1,
|
|
2350
|
-
isLoading: O,
|
|
2351
|
-
disabled: O
|
|
2352
|
-
},
|
|
2353
|
-
secondaryActions: {
|
|
2354
|
-
text: c("common.close"),
|
|
2355
|
-
close: !0,
|
|
2356
|
-
variant: "tertiary",
|
|
2357
|
-
disabled: O
|
|
2358
|
-
}
|
|
2359
|
-
}).onPrimary(async () => {
|
|
2360
|
-
if (!t.value) {
|
|
2361
|
-
t.value = !0;
|
|
2362
|
-
try {
|
|
2363
|
-
await d.recalculation.refreshCurrentBalances();
|
|
2364
|
-
} catch (i) {
|
|
2365
|
-
console.log("Failed to queue refresh balan22ce", typeof i);
|
|
2366
|
-
const S = typeof i == "object" ? JSON.stringify(i) : String(i);
|
|
2367
|
-
console.log("Error details:", S), t.value = !1, v.open({
|
|
2368
|
-
title: c("inventory.common.refreshFailed"),
|
|
2369
|
-
message: (i instanceof Error ? i.message : null) ?? c("inventory.stock.stock_balance.refreshBalanceError"),
|
|
2370
|
-
type: "error"
|
|
2371
|
-
});
|
|
2372
|
-
}
|
|
2373
|
-
}
|
|
2374
|
-
}).onClose(() => {
|
|
2375
|
-
t.value = !1, N();
|
|
2376
|
-
});
|
|
2377
|
-
}
|
|
2378
|
-
async function X() {
|
|
2379
|
-
if (_._currentLocation) {
|
|
2380
|
-
o.value = !0;
|
|
2381
|
-
try {
|
|
2382
|
-
await w.readStockBalance(), await w.readProductBalance(), await r.readStockEstimateBalance();
|
|
2383
|
-
} catch (p) {
|
|
2384
|
-
v.open({
|
|
2385
|
-
title: c("inventory.stock.error.title"),
|
|
2386
|
-
message: c("inventory.stock.error.message"),
|
|
2387
|
-
type: "error"
|
|
2388
|
-
}), console.error("error on fetch stock balance", p);
|
|
2389
|
-
} finally {
|
|
2390
|
-
o.value = !1;
|
|
2391
|
-
}
|
|
2392
|
-
}
|
|
2393
|
-
}
|
|
2394
|
-
const z = T(() => [
|
|
2395
|
-
{
|
|
2396
|
-
type: "string",
|
|
2397
|
-
key: "status",
|
|
2398
|
-
entity: "sku",
|
|
2399
|
-
values: ["Active", "Inactive"]
|
|
2400
|
-
}
|
|
2401
|
-
]), K = Y({
|
|
2402
|
-
logic: "AND",
|
|
2403
|
-
rules: [
|
|
2404
|
-
{
|
|
2405
|
-
property: "status",
|
|
2406
|
-
operator: "$in",
|
|
2407
|
-
value: ["Active"],
|
|
2408
|
-
type: "string"
|
|
2409
|
-
}
|
|
2410
|
-
]
|
|
2411
|
-
}), U = T(() => {
|
|
2412
|
-
var i, S, P;
|
|
2413
|
-
const p = K.value ? co.build(K.value) : null, m = [];
|
|
2414
|
-
for (const ee of k.skus) {
|
|
2415
|
-
let ae = !0;
|
|
2416
|
-
if (b.isEnabled && re.value && g.value && ae && (ae = g.value.has(ee._id)), p && ae && (ae = mo(
|
|
2417
|
-
{
|
|
2418
|
-
status: ee.isInactive ? "Inactive" : "Active"
|
|
2419
|
-
},
|
|
2420
|
-
p
|
|
2421
|
-
)), ae) {
|
|
2422
|
-
const Q = ee.trackingMeasurement;
|
|
2423
|
-
let W = (S = (i = w.stockBalance.skus) == null ? void 0 : i.find(
|
|
2424
|
-
(ce) => ce.id === ee._id
|
|
2425
|
-
)) == null ? void 0 : S.balance, te = r.inventoryForecast.skus.find(
|
|
2426
|
-
(ce) => ce.id === ee._id
|
|
2427
|
-
);
|
|
2428
|
-
const le = {
|
|
2429
|
-
...ee,
|
|
2430
|
-
balance: W ?? {
|
|
2431
|
-
amount: 0,
|
|
2432
|
-
precision: 0
|
|
2433
|
-
},
|
|
2434
|
-
operator: te == null ? void 0 : te.operator,
|
|
2435
|
-
day: (te == null ? void 0 : te.depletionDays) ?? void 0,
|
|
2436
|
-
trackingUnitAbbrev: Q ? ((P = ee.unit.measurements.find((ce) => ce.id === Q)) == null ? void 0 : P.abbrev) ?? "" : ee.unit.abbrev
|
|
2437
|
-
};
|
|
2438
|
-
m.push(le);
|
|
2439
|
-
}
|
|
2440
|
-
}
|
|
2441
|
-
return m;
|
|
2442
|
-
}), Z = Y(""), re = Y(!0), { breakpoints: x } = Nt(), F = T(() => x.value.xs || x.value.sm), G = T(() => F.value ? 10 : 20), H = Dt(), J = T(() => {
|
|
2443
|
-
const p = [
|
|
2444
|
-
{
|
|
2445
|
-
label: c("inventory.stock.stock_balance.refreshBalance"),
|
|
2446
|
-
value: "refresh-balance",
|
|
2447
|
-
isPrimary: !0,
|
|
2448
|
-
prependIcon: "calculate"
|
|
2449
|
-
},
|
|
2450
|
-
{
|
|
2451
|
-
label: c("inventory.common.refresh"),
|
|
2452
|
-
value: "refresh"
|
|
2453
|
-
},
|
|
2454
|
-
{
|
|
2455
|
-
label: c("inventory.common.export"),
|
|
2456
|
-
value: "export"
|
|
2457
|
-
}
|
|
2458
|
-
];
|
|
2459
|
-
return a.value && p.push({
|
|
2460
|
-
label: c("inventory.stock.stock_adjustment.title"),
|
|
2461
|
-
value: "stockAdjustment"
|
|
2462
|
-
}), p;
|
|
2463
|
-
}), I = Y(!1);
|
|
2464
|
-
function u() {
|
|
2465
|
-
I.value = !0;
|
|
2466
|
-
}
|
|
2467
|
-
function h(p) {
|
|
2468
|
-
switch (p) {
|
|
2469
|
-
case "refresh-balance":
|
|
2470
|
-
return L();
|
|
2471
|
-
case "refresh":
|
|
2472
|
-
return X();
|
|
2473
|
-
case "export":
|
|
2474
|
-
return Pt(U.value);
|
|
2475
|
-
case "stockAdjustment":
|
|
2476
|
-
return u();
|
|
2477
|
-
}
|
|
2478
|
-
}
|
|
2479
|
-
return (p, m) => {
|
|
2480
|
-
const i = D("FmSwitch"), S = D("FmTable");
|
|
2481
|
-
return j(), ne(Mt, {
|
|
2482
|
-
title: s(c)("inventory.stock.title"),
|
|
2483
|
-
actions: J.value,
|
|
2484
|
-
"onClick:action": h
|
|
2485
|
-
}, {
|
|
2486
|
-
default: M(() => {
|
|
2487
|
-
var P, ee, ae, Q;
|
|
2488
|
-
return [
|
|
2489
|
-
e("div", {
|
|
2490
|
-
class: He([
|
|
2491
|
-
"flex flex-col gap-8 max-h-full",
|
|
2492
|
-
{
|
|
2493
|
-
"p-0": F.value,
|
|
2494
|
-
"px-24 ": !F.value
|
|
2495
|
-
}
|
|
2496
|
-
])
|
|
2497
|
-
}, [
|
|
2498
|
-
y(lo, {
|
|
2499
|
-
searchable: "",
|
|
2500
|
-
"change-location": "",
|
|
2501
|
-
search: Z.value,
|
|
2502
|
-
"onUpdate:search": m[1] || (m[1] = (W) => Z.value = W),
|
|
2503
|
-
"hide-filter-options": !0,
|
|
2504
|
-
filterable: "",
|
|
2505
|
-
"filter-attributes": z.value,
|
|
2506
|
-
filter: K.value,
|
|
2507
|
-
"onUpdate:filter": m[2] || (m[2] = (W) => K.value = W)
|
|
2508
|
-
}, {
|
|
2509
|
-
default: M(() => [
|
|
2510
|
-
s(b).isEnabled ? (j(), q("div", Us, [
|
|
2511
|
-
e("span", Ps, f(s(c)("inventory.integration.netsuite.subsidiaryHierarchy.filtering")), 1),
|
|
2512
|
-
y(Rt),
|
|
2513
|
-
y(Qe, null, {
|
|
2514
|
-
default: M(() => [
|
|
2515
|
-
y(i, {
|
|
2516
|
-
modelValue: re.value,
|
|
2517
|
-
"onUpdate:modelValue": m[0] || (m[0] = (W) => re.value = W)
|
|
2518
|
-
}, null, 8, ["modelValue"])
|
|
2519
|
-
]),
|
|
2520
|
-
_: 1
|
|
2521
|
-
})
|
|
2522
|
-
])) : se("", !0)
|
|
2523
|
-
]),
|
|
2524
|
-
_: 1
|
|
2525
|
-
}, 8, ["search", "filter-attributes", "filter"]),
|
|
2526
|
-
(j(), ne(S, {
|
|
2527
|
-
style: kt(s(H).tableHeight),
|
|
2528
|
-
"column-defs": s(R),
|
|
2529
|
-
"row-data": U.value,
|
|
2530
|
-
"search-value": Z.value,
|
|
2531
|
-
loading: o.value || s(n) || !s(_)._currentLocation,
|
|
2532
|
-
key: (P = s(_)._currentLocation) == null ? void 0 : P.dbName,
|
|
2533
|
-
onRowClick: m[3] || (m[3] = (W) => s(V).showSkuHistory(W.original)),
|
|
2534
|
-
"page-size": G.value
|
|
2535
|
-
}, {
|
|
2536
|
-
"list-row": M((W) => [
|
|
2537
|
-
y(ro, {
|
|
2538
|
-
row: W,
|
|
2539
|
-
onRowClick: s(V).showSkuHistory
|
|
2540
|
-
}, {
|
|
2541
|
-
default: M((te) => {
|
|
2542
|
-
var le, ce, je, fe, de, et, tt, ot, Ve, nt;
|
|
2543
|
-
return [
|
|
2544
|
-
e("div", Rs, [
|
|
2545
|
-
e("div", Ns, [
|
|
2546
|
-
e("div", Os, [
|
|
2547
|
-
y(s(ft), {
|
|
2548
|
-
render: (je = (ce = (le = te.code) == null ? void 0 : le.column) == null ? void 0 : ce.columnDef) == null ? void 0 : je.cell,
|
|
2549
|
-
props: (de = (fe = te.code) == null ? void 0 : fe.getContext) == null ? void 0 : de.call(fe)
|
|
2550
|
-
}, null, 8, ["render", "props"])
|
|
2551
|
-
]),
|
|
2552
|
-
e("div", Ls, [
|
|
2553
|
-
y(s(ft), {
|
|
2554
|
-
render: (ot = (tt = (et = te.name) == null ? void 0 : et.column) == null ? void 0 : tt.columnDef) == null ? void 0 : ot.cell,
|
|
2555
|
-
props: (nt = (Ve = te.name) == null ? void 0 : Ve.getContext) == null ? void 0 : nt.call(Ve)
|
|
2556
|
-
}, null, 8, ["render", "props"])
|
|
2557
|
-
])
|
|
2558
|
-
]),
|
|
2559
|
-
e("div", null, [
|
|
2560
|
-
y(Ke, {
|
|
2561
|
-
days: W.original.day
|
|
2562
|
-
}, null, 8, ["days"])
|
|
2563
|
-
]),
|
|
2564
|
-
e("div", null, [
|
|
2565
|
-
y(ht, {
|
|
2566
|
-
class: "xs:w-[160px]",
|
|
2567
|
-
unit: W.original.unit,
|
|
2568
|
-
sku: W.original,
|
|
2569
|
-
amount: W.original.balance,
|
|
2570
|
-
"default-tracking-measurement": W.original.trackingMeasurement ?? void 0
|
|
2571
|
-
}, null, 8, ["unit", "sku", "amount", "default-tracking-measurement"])
|
|
2572
|
-
])
|
|
2573
|
-
])
|
|
2574
|
-
];
|
|
2575
|
-
}),
|
|
2576
|
-
_: 2
|
|
2577
|
-
}, 1032, ["row", "onRowClick"])
|
|
2578
|
-
]),
|
|
2579
|
-
_: 1
|
|
2580
|
-
}, 8, ["style", "column-defs", "row-data", "search-value", "loading", "page-size"]))
|
|
2581
|
-
], 2),
|
|
2582
|
-
(j(), ne(Bt, { to: "body" }, [
|
|
2583
|
-
(ee = s(V).stockHistoryProps) != null && ee.sku ? (j(), ne(Hs, rt(ze({ key: 0 }, s(V).stockHistoryProps)), null, 16)) : se("", !0),
|
|
2584
|
-
(ae = s(V).convertSkuDialogProps) != null && ae.sku ? (j(), ne(Mo, rt(ze({ key: 1 }, s(V).convertSkuDialogProps)), null, 16)) : se("", !0),
|
|
2585
|
-
(Q = s(V).adjustSkuDialogProps) != null && Q.stock ? (j(), ne(Go, ze({ key: 2 }, s(V).adjustSkuDialogProps, {
|
|
2586
|
-
onSubmitted: m[4] || (m[4] = (W) => X())
|
|
2587
|
-
}), null, 16)) : se("", !0),
|
|
2588
|
-
y(Ts, {
|
|
2589
|
-
permission: {
|
|
2590
|
-
action: s(Be).Action.manage,
|
|
2591
|
-
subject: s(Be).Subject.Business.inventory_stockAdjustment
|
|
2592
|
-
}
|
|
2593
|
-
}, {
|
|
2594
|
-
default: M(() => [
|
|
2595
|
-
I.value ? (j(), ne(sn, {
|
|
2596
|
-
key: 0,
|
|
2597
|
-
show: I.value,
|
|
2598
|
-
"onUpdate:show": m[5] || (m[5] = (W) => I.value = W),
|
|
2599
|
-
onSubmitted: m[6] || (m[6] = (W) => X())
|
|
2600
|
-
}, null, 8, ["show"])) : se("", !0)
|
|
2601
|
-
]),
|
|
2602
|
-
_: 1
|
|
2603
|
-
}, 8, ["permission"])
|
|
2604
|
-
]))
|
|
2605
|
-
];
|
|
2606
|
-
}),
|
|
2607
|
-
_: 1
|
|
2608
|
-
}, 8, ["title", "actions"]);
|
|
2609
|
-
};
|
|
2610
|
-
}
|
|
2611
|
-
});
|
|
2612
|
-
export {
|
|
2613
|
-
ga as default
|
|
2614
|
-
};
|