@feedmepos/mf-inventory-portal 1.8.0-dev.1 → 1.8.0-dev.11
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-BTUjyQbn.js +1466 -0
- package/dist/{ApprovalView-C8_ax05b.js → ApprovalView-CTOTedxc.js} +26 -25
- package/dist/{BindingsDialog-t0ZY9eh5.js → BindingsDialog-C9v4TTzJ.js} +2 -2
- package/dist/{BindingsPicker-C0Qblmml.js → BindingsPicker-B5b0lavg.js} +8 -8
- package/dist/{BindingsTable-CsqUBbRA.js → BindingsTable-CQPan4pU.js} +4 -4
- package/dist/{BulkReceiveRequestView-DAG-TMox.js → BulkReceiveRequestView-BVrrjoYW.js} +21 -21
- package/dist/ChangeLocationComponent.vue_vue_type_script_setup_true_lang-D4Z56y7h.js +151 -0
- package/dist/{ClosingDraftView-CdKp4Ny6.js → ClosingDraftView-5ETKikfT.js} +748 -746
- package/dist/ClosingHistoryView-GM0DRWhq.js +769 -0
- package/dist/{ClosingTemplateView-C326DL4q.js → ClosingTemplateView-Czz--dWq.js} +303 -291
- package/dist/{CustomPrintTemplatePreview.vue_vue_type_script_setup_true_lang-CXjubRbj.js → CustomPrintTemplatePreview.vue_vue_type_script_setup_true_lang-Bjs8hW_q.js} +1 -1
- package/dist/{DefaultView-CsIMmQAY.js → DefaultView-Baksd_Lk.js} +2 -2
- package/dist/{DeliveryOrderPrintPreview-eTrMvJzA.js → DeliveryOrderPrintPreview-CUdMQmLf.js} +9 -9
- package/dist/{EmailDialog.vue_vue_type_script_setup_true_lang-B7nBbxMo.js → EmailDialog.vue_vue_type_script_setup_true_lang-CDta65pB.js} +6228 -6216
- package/dist/FeatureCapabilityBadge.vue_vue_type_script_setup_true_lang-CrCdJfOf.js +47 -0
- package/dist/FeatureCapabilityGate-C34Z4k5D.js +74 -0
- package/dist/{FmDateRangePickerChip.vue_vue_type_script_setup_true_lang-CI2KTzDs.js → FmDateRangePickerChip.vue_vue_type_script_setup_true_lang-C43lHbmc.js} +1 -1
- package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-Db_FiSRe.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-CIMCZnY9.js} +2 -2
- package/dist/FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-UbMV3dKh.js +120 -0
- package/dist/{FmMultiselectDialog-CYUxtxnS.js → FmMultiselectDialog-DYM4qyMH.js} +2 -2
- package/dist/FmMultiselectDialog-tbS01AI7.js +123 -0
- package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-DOkV11NN.js → FmUnitInput.vue_vue_type_script_setup_true_lang-DaOKC6RQ.js} +72 -73
- package/dist/ImportView-CPf8zj0t.js +1290 -0
- package/dist/{IngredientsView-CZ6E7cXf.js → IngredientsView-N4CH6zdo.js} +656 -649
- package/dist/{IntegrationExplorerView-B15ND4Fg.js → IntegrationExplorerView-Ds5fTNi3.js} +602 -614
- package/dist/IntegrationPlatformView-wuOLFIQR.js +13073 -0
- package/dist/{IntegrationView-hkNhsqx2.js → IntegrationView-Bhxwz6Ha.js} +2956 -2922
- package/dist/{InventoryBindingForm-SfuUF0_O.js → InventoryBindingForm-DWm9pOH_.js} +1 -1
- package/dist/InventoryBindingForm.vue_vue_type_script_setup_true_lang-TvwD5HcR.js +472 -0
- package/dist/{InventoryBindingSummary-DUcukkyJ.js → InventoryBindingSummary-DI6H0ehi.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-ngeYJhtg.js +79 -0
- package/dist/PlanTierBadge.vue_vue_type_script_setup_true_lang-Cr1LFRUd.js +274 -0
- package/dist/PlanUpgradeDialog.vue_vue_type_script_setup_true_lang-CtoPkGo2.js +79 -0
- package/dist/{ProductionRunDetailView-BwgRX-14.js → ProductionRunDetailView-rGGuDANE.js} +4 -4
- package/dist/{ProductionRunLifecycleDialogs.vue_vue_type_script_setup_true_lang-BbNXNhpr.js → ProductionRunLifecycleDialogs.vue_vue_type_script_setup_true_lang-CTseB9Sn.js} +9 -9
- package/dist/{ProductionRunView-CZU7LY9-.js → ProductionRunView-BLBIYhKd.js} +16 -15
- package/dist/{PublishView-DS2FZ66p.js → PublishView-D_H_LAq2.js} +3 -3
- package/dist/{PurchaseOrderPrintPreview-CZa0MVAs.js → PurchaseOrderPrintPreview-DZy57dQ6.js} +7 -7
- package/dist/{ReceiveRequestView-Bk5b3nVB.js → ReceiveRequestView-qFQPah64.js} +15 -15
- package/dist/RecipeView-BPQ_MlxJ.js +3440 -0
- package/dist/SettingsView-DF_HGtkr.js +1032 -0
- package/dist/StockView-De_R8pxv.js +2651 -0
- package/dist/{SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-DdZg9T4n.js → SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-B3tBgcH7.js} +1 -1
- package/dist/{SupplierView-D8q6siZW.js → SupplierView-DvvB_Nn0.js} +577 -571
- package/dist/{SurchargeView-Db_5YFoR.js → SurchargeView-6gQPyGqi.js} +7 -7
- package/dist/{SystemTrailDialog.vue_vue_type_script_setup_true_lang-WOVs4Fr1.js → SystemTrailDialog.vue_vue_type_script_setup_true_lang-D6gnQpe-.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-BtoP4XgE.js → TemplatePublishDialog.vue_vue_type_script_setup_true_lang-CiuRBHBL.js} +1 -1
- package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-Bljc4Vuy.js → TransferDetails.vue_vue_type_script_setup_true_lang-B-1-jtmF.js} +1707 -1657
- package/dist/TransferTemplateView-Dcc9K-AJ.js +2343 -0
- package/dist/{UnitCostHistoryView-BqDiQ4IE.js → UnitCostHistoryView-e1MYu0_N.js} +4 -4
- package/dist/{UnitDisplayControl.vue_vue_type_script_setup_true_lang-BjSmg5LX.js → UnitDisplayControl.vue_vue_type_script_setup_true_lang-DQWOi2ol.js} +4 -4
- package/dist/{UnitView-CM695-VI.js → UnitView-BaLqtGk3.js} +84 -84
- package/dist/{WarehouseView-BdidU4p6.js → WarehouseView-CKYdpZoP.js} +194 -189
- package/dist/{WastageTemplateView-DdhwdXT6.js → WastageTemplateView-DazO6lu1.js} +19 -18
- package/dist/api/feature-flags.d.ts +12 -0
- package/dist/api/integration-sync-log.d.ts +0 -13
- package/dist/api/inventory.d.ts +9 -9
- package/dist/api/license.d.ts +8 -0
- package/dist/{app-Cb5s4jMu.js → app-ZyQBMnlh.js} +6102 -6066
- package/dist/app.d.ts +36 -150
- package/dist/app.js +1 -1
- package/dist/{closing-template-DnqnpXxn.js → closing-template-BZfYcHAK.js} +1 -1
- package/dist/components/ChangeLocationComponent.vue.d.ts +21 -14
- package/dist/components/DeprecateSoonWarningDialog.vue.d.ts +22 -0
- package/dist/components/FeatureCapabilityBadge.vue.d.ts +29 -0
- package/dist/components/FeatureCapabilityGate.spec.d.ts +1 -0
- package/dist/components/FeatureCapabilityGate.vue.d.ts +29 -0
- package/dist/components/FmUnitInputRules.d.ts +1 -1
- package/dist/components/MultiLocationSelector.vue.d.ts +6 -6
- package/dist/components/NumberPrecisionInput.spec.d.ts +1 -0
- package/dist/components/{PremiumBadge.vue.d.ts → PlanTierBadge.vue.d.ts} +5 -13
- package/dist/components/PlanUpgradeDialog.vue.d.ts +30 -0
- package/dist/composable/useNavigationMenu.d.ts +2 -1
- package/dist/{date2-BPhD_1Of.js → date2-CtVXF-Pl.js} +1 -1
- package/dist/{dayjs.min-Zbd6-uVD.js → dayjs.min-BG2xA9Zk.js} +1 -1
- package/dist/{decimal-Df6a50Ld.js → decimal-C0ERI9wc.js} +2 -2
- package/dist/{defineDeepModel-Brbsikbi.js → defineDeepModel-CAK0Fghp.js} +6 -6
- package/dist/{duplicate-template-B9kuShaF.js → duplicate-template-DwAQVTH7.js} +1 -1
- package/dist/{inventory-core-dart.default-DDRxXXnt.js → feature-1IL43YWw.js} +766 -398
- package/dist/feature-flags/core.d.ts +28 -0
- package/dist/feature-flags/core.spec.d.ts +1 -0
- package/dist/feature-flags/navigation-capabilities.d.ts +23 -0
- package/dist/feature-flags/navigation-capabilities.spec.d.ts +1 -0
- package/dist/feature-flags/plan-tier.d.ts +6 -0
- package/dist/feature-flags/plan-tier.spec.d.ts +1 -0
- package/dist/feature-flags/portal-feature-catalog.d.ts +19 -0
- package/dist/feature-flags/portal-feature-catalog.spec.d.ts +1 -0
- package/dist/feature-flags/vue.d.ts +16 -0
- package/dist/feature-flags/vue.spec.d.ts +1 -0
- package/dist/{format-time-from-id-DmUjUcVj.js → format-time-from-id-QIs7t8ML.js} +1 -1
- package/dist/{format-unit-display-CsQA0SQd.js → format-unit-display-DiTPPgut.js} +118 -119
- package/dist/helper/menu-usage-module.d.ts +1 -1
- package/dist/helper/number.d.ts +5 -1
- package/dist/helper/rules.d.ts +1 -1
- package/dist/id-to-date-DcuC_yKQ.js +67 -0
- package/dist/{import-export.helper-DCQ6oX9s.js → import-export.helper-grsZqa63.js} +16 -17
- package/dist/{JsonViewer.vue_vue_type_script_setup_true_lang-ig2zSXAB.js → index-C25C1Dg7.js} +1074 -1066
- package/dist/{index-UmM6gHJ1.js → index-DN5mjbXr.js} +1 -1
- package/dist/{index-C-mazZwS.js → index-DdSQrnuw.js} +3 -3
- package/dist/index-eGvSlWMU.js +1892 -0
- package/dist/{index-BXaIMGnI.js → index-twVxfWIB.js} +190 -190
- package/dist/{lz-string-Bibw5D_6.js → lz-string-DrKhkO_Q.js} +1 -1
- package/dist/{netsuite-Bev0OtQT.js → netsuite-C_EH9MVy.js} +9 -3
- package/dist/{predefined-templates-BHvUnTk_.js → predefined-templates-mWX1M2Dn.js} +1 -1
- package/dist/{purchase-order-template-DgOKEzhS.js → purchase-order-template-DZ3DsIUr.js} +1 -1
- package/dist/{recalculationUtils-Dv__DzZh.js → recalculationUtils-BZ5ccSeX.js} +1 -1
- package/dist/router/name.d.ts +2 -2
- package/dist/{row-action.enum-ncgDYAjP.js → row-action.enum-B2z1DXD9.js} +2 -2
- package/dist/rules-BpTWt_Y_.js +238 -0
- package/dist/stock-BO2mbTLO.js +74 -0
- package/dist/{stock-CxCRZo_D.js → stock-D9dhzEKk.js} +1 -1
- package/dist/stores/feature.d.ts +20 -2
- package/dist/stores/integration/netsuite.d.ts +2 -2
- package/dist/stores/inventory.d.ts +0 -47
- package/dist/stores/inventory.no-location.spec.d.ts +1 -0
- package/dist/stores/location.d.ts +42 -42
- package/dist/stores/supplier.d.ts +49 -49
- package/dist/stores/warehouse.d.ts +1 -1
- package/dist/style.css +1 -1
- package/dist/{supplier-CkZdeMcl.js → supplier-C-Ra1omj.js} +2 -2
- package/dist/{surcharge-FRSFqjGl.js → surcharge-BFDrFP1T.js} +1 -1
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/{uom-rules-Cm1styDr.js → uom-rules-B8pou4DQ.js} +1 -1
- package/dist/{use-ingredient-select-dialog-ntAqHX04.js → use-ingredient-select-dialog-DJvcL3EP.js} +2 -2
- package/dist/use-inventory-binding-dialog-DQBcnw0G.js +113 -0
- package/dist/{use-template-enabled-locations-CIZqw-Z8.js → use-template-enabled-locations-CSgJma2Z.js} +2 -2
- package/dist/{use-transfer-locations-CM5vNttA.js → use-transfer-locations-CkeJ5Nng.js} +14 -14
- package/dist/{useHrmPermission-CslLuBoP.js → useHrmPermission-BDc1xULx.js} +1 -1
- package/dist/useNavigationMenu-B7jkRkTi.js +346 -0
- package/dist/{useSseClient-CCV4mPzD.js → useSseClient-Bxl6D4Xs.js} +1 -1
- package/dist/views/adjustment-template/wastage-template/actions.d.ts +36 -36
- package/dist/views/adjustment-template/wastage-template/table.d.ts +36 -36
- package/dist/views/closing-draft/components/closing-draft-dialog/ClosingDraftApprovalDialog.vue.d.ts +6 -6
- package/dist/views/closing-draft/components/closing-draft-dialog/ClosingDraftDialog.vue.d.ts +12 -12
- package/dist/views/closing-draft/components/closing-draft-groups/ClosingGroupDetailSideSheet.vue.d.ts +6 -6
- package/dist/views/closing-draft/composables/use-closing-draft-import.d.ts +3 -3
- package/dist/views/closing-draft/composables/use-closing-draft-table.d.ts +18 -18
- package/dist/views/closing-template/composables/use-closing-template-actions.d.ts +45 -45
- package/dist/views/closing-template/composables/use-closing-template-table.d.ts +36 -36
- 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 +1 -1
- package/dist/{components/PreviewBadge.vue.d.ts → views/integration/IntegrationPlatformView.vue.d.ts} +11 -13
- package/dist/views/integration/components/IntegrationCard.vue.d.ts +38 -0
- 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/components/netsuite/business/AddLocationDialog.vue.d.ts +36 -36
- package/dist/views/integration/components/netsuite/business/AddVendorDialog.vue.d.ts +24 -24
- 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/receive-request/components/transfer-form/TransferFormWithController.vue.d.ts +5 -5
- 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 +5 -5
- package/dist/views/receive-request/composables/use-receive-request-form.d.ts +39 -39
- package/dist/views/receive-request/composables/use-receive-request-table.d.ts +35 -35
- package/dist/views/receive-request/import/export.spec.d.ts +1 -0
- package/dist/views/receive-request-bulk/composables/use-bulk-receive-request-form.d.ts +34 -34
- package/dist/views/receive-request-bulk/composables/use-bulk-receive-request-table.d.ts +6 -6
- 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 +2 -2
- package/dist/views/recipe/helper/import-recipe.spec.d.ts +1 -0
- package/dist/views/{ingredient-group/IngredientGroupView.vue.d.ts → settings/FeatureFlagView.vue.d.ts} +0 -1
- package/dist/views/settings/PlanLicenseDisplay.spec.d.ts +1 -0
- package/dist/views/{integration/components/IntegrationSyncLogTab.vue.d.ts → settings/PlanLicenseDisplay.vue.d.ts} +2 -2
- package/dist/views/stock/components/dialog/AmendAdjustmentForm.spec.d.ts +1 -0
- package/dist/views/stock/components/dialog/ConvertSkuDialog.spec.d.ts +1 -0
- package/dist/views/supplier/components/SupplierForm.vue.d.ts +4 -4
- package/dist/views/supplier/composables/use-supplier-table.d.ts +2 -2
- package/dist/views/transfer-template/components/transfer-template-dialog/TransferTemplateDialog.vue.d.ts +8 -8
- package/dist/views/transfer-template/components/transfer-template-form/composables/use-transfer-locations.d.ts +4 -4
- package/dist/views/transfer-template/components/transfer-template-form/composables/use-transfer-template-items.spec.d.ts +1 -0
- package/dist/views/transfer-template/composables/use-template-item-bulk-editor.d.ts +24 -24
- package/dist/views/transfer-template/composables/use-transfer-template-actions.d.ts +48 -48
- package/dist/views/transfer-template/composables/use-transfer-template-table.d.ts +48 -48
- package/dist/views/warehouse/components/WarehouseForm.vue.d.ts +2 -2
- package/dist/{vue-i18n-C5j4EQhi.js → vue-i18n-gaCwgS41.js} +355 -355
- package/dist/{xlsx.util-B50OvX4z.js → xlsx.util-lW-27xp-.js} +2 -2
- package/package.json +71 -66
- package/dist/App-BXgpGzGR.js +0 -1476
- package/dist/ClosingHistoryView-Blyq9-BS.js +0 -761
- package/dist/FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-zcEv1Swg.js +0 -243
- package/dist/FmMultiselectDialog-BAw-gp5K.js +0 -77
- package/dist/ImportView-BmotFC-3.js +0 -1302
- package/dist/IngredientBindedItem.vue_vue_type_script_setup_true_lang-DVCCpvS4.js +0 -51
- package/dist/IngredientGroupView-qrR9ksEn.js +0 -985
- package/dist/InventoryBindingForm.vue_vue_type_script_setup_true_lang-Zq81p_MF.js +0 -563
- package/dist/NumberPrecisionInput.vue_vue_type_script_setup_true_lang-BmfROiLM.js +0 -72
- package/dist/PremiumBadge.vue_vue_type_script_setup_true_lang-3e3kDsbN.js +0 -93
- package/dist/PreviewBadge.vue_vue_type_script_setup_true_lang-DX2MJqL4.js +0 -29
- package/dist/RecipeView-DvI6X-uN.js +0 -3625
- package/dist/SettingsView-sThYErMz.js +0 -698
- package/dist/StockView-Z9wGihT7.js +0 -2612
- package/dist/TableActionableRow.vue_vue_type_script_setup_true_lang-DAMpuZ1X.js +0 -84
- package/dist/TransferTemplateView-DtsJzmUr.js +0 -2327
- package/dist/feature-Ckn5ra3z.js +0 -1136
- package/dist/number-y_W4pn_d.js +0 -138
- package/dist/random-CSbEbElR.js +0 -10
- package/dist/rules-CZTBvenw.js +0 -98
- package/dist/stock-XINW8JOM.js +0 -75
- package/dist/use-inventory-binding-dialog-DVIJO8Cl.js +0 -152
- package/dist/useNavigationMenu-CSinmNCY.js +0 -172
- 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/components/ingredient-group-rule-field/IngredientGroupRuleField.vue.d.ts +0 -37
- 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
- /package/dist/components/{FmFeatureFlagDialog.vue.d.ts → DeprecateSoonPill.vue.d.ts} +0 -0
|
@@ -0,0 +1,769 @@
|
|
|
1
|
+
import { defineComponent as se, ref as p, computed as S, watch as ue, resolveComponent as w, createElementBlock as f, openBlock as u, createVNode as _, withCtx as $, createElementVNode as a, createCommentVNode as F, toDisplayString as l, unref as d, Fragment as G, createBlock as j, createTextVNode as ne, renderList as re, normalizeClass as fe, h as P, Teleport as ge } from "vue";
|
|
2
|
+
import { _ as ve } from "./SingleColumnLayout.vue_vue_type_script_setup_true_lang-DpwneGOV.js";
|
|
3
|
+
import { useI18n as le, useCoreStore as he } from "@feedmepos/mf-common";
|
|
4
|
+
import { G as me, B as M, a as _e, u as be } from "./app-ZyQBMnlh.js";
|
|
5
|
+
import { F as ce } from "./FmAdminBadge-DlplQOHb.js";
|
|
6
|
+
import { _ as ke } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-UbMV3dKh.js";
|
|
7
|
+
import { _ as de } from "./CursorPaginatedTable.vue_vue_type_script_setup_true_lang-BCUhtL_B.js";
|
|
8
|
+
import { useSnackbar as pe, useDialog as De } from "@feedmepos/ui-library";
|
|
9
|
+
import { u as xe } from "./stock-D9dhzEKk.js";
|
|
10
|
+
import { g as Se, f as we } from "./recalculationUtils-BZ5ccSeX.js";
|
|
11
|
+
import { u as Ve } from "./feature-1IL43YWw.js";
|
|
12
|
+
import { F as Ce } from "./FeatureCapabilityGate-C34Z4k5D.js";
|
|
13
|
+
import { _ as Fe } from "./UnitDisplayControl.vue_vue_type_script_setup_true_lang-DQWOi2ol.js";
|
|
14
|
+
const Ae = { class: "fm-typo-en-heading-lg-600" }, Ie = { class: "flex flex-col gap-16" }, $e = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Te = { class: "flex flex-col gap-8" }, Be = { class: "fm-typo-en-body-md-600" }, Le = { class: "flex flex-col gap-8" }, Re = { class: "fm-typo-en-body-md-600" }, Ne = {
|
|
15
|
+
key: 0,
|
|
16
|
+
class: "text-red-500 text-sm mt-2"
|
|
17
|
+
}, Oe = { class: "fm-typo-en-body-sm-400" }, Pe = {
|
|
18
|
+
key: 1,
|
|
19
|
+
class: "p-12 border border-fm-color-border-primary rounded-8 bg-fm-color-background-secondary"
|
|
20
|
+
}, Me = {
|
|
21
|
+
key: 0,
|
|
22
|
+
class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary"
|
|
23
|
+
}, Ke = {
|
|
24
|
+
key: 1,
|
|
25
|
+
class: "flex flex-col gap-8"
|
|
26
|
+
}, Ue = { class: "fm-typo-en-body-sm-600" }, Ee = { class: "flex flex-col gap-4" }, He = { key: 0 }, We = { key: 1 }, ze = { key: 2 }, Ge = {
|
|
27
|
+
key: 1,
|
|
28
|
+
class: "flex flex-col gap-8"
|
|
29
|
+
}, je = { class: "fm-typo-en-body-md-600" }, Ye = { class: "flex flex-col gap-8 max-h-[300px] overflow-y-auto" }, Je = { class: "flex items-center justify-between" }, Qe = { class: "fm-typo-en-body-sm-600" }, Xe = { class: "flex items-center gap-8" }, Ze = {
|
|
30
|
+
key: 0,
|
|
31
|
+
class: "fm-typo-en-body-xs-600 px-8 py-4 rounded-4 bg-fm-color-neutral-100 text-fm-color-typo-secondary"
|
|
32
|
+
}, qe = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, et = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, tt = {
|
|
33
|
+
key: 0,
|
|
34
|
+
class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary"
|
|
35
|
+
}, ot = {
|
|
36
|
+
key: 1,
|
|
37
|
+
class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary"
|
|
38
|
+
}, at = {
|
|
39
|
+
key: 2,
|
|
40
|
+
class: "fm-typo-en-body-xs-400 text-fm-color-system-error-500"
|
|
41
|
+
}, nt = {
|
|
42
|
+
key: 0,
|
|
43
|
+
class: "flex gap-8 ml-auto"
|
|
44
|
+
}, st = {
|
|
45
|
+
key: 1,
|
|
46
|
+
class: "flex gap-8 ml-auto"
|
|
47
|
+
}, lt = 15 * 60 * 1e3, it = /* @__PURE__ */ se({
|
|
48
|
+
__name: "RecalculationDialog",
|
|
49
|
+
emits: ["submitted"],
|
|
50
|
+
setup(Z, { expose: g, emit: h }) {
|
|
51
|
+
const A = h, { t: c } = le(), V = xe(), L = me(), x = pe(), C = p(!1), y = p(""), v = p(""), N = p([]), K = p([]), D = p(!1), i = p([]), n = p(!1), m = p([]), b = p(!1), T = S(
|
|
52
|
+
() => Se(N.value, K.value)
|
|
53
|
+
), B = S(() => we(
|
|
54
|
+
m.value.filter((t) => !!t.closingId).map((t) => ({ closingId: t.closingId, draftCreatedAt: new Date(M(t._id)) }))
|
|
55
|
+
)), I = S(() => {
|
|
56
|
+
if (y.value)
|
|
57
|
+
try {
|
|
58
|
+
const t = M(y.value);
|
|
59
|
+
if (t)
|
|
60
|
+
return t;
|
|
61
|
+
} catch (t) {
|
|
62
|
+
console.error("Error parsing date from opening ID:", t);
|
|
63
|
+
}
|
|
64
|
+
}), R = S(() => {
|
|
65
|
+
if (!y.value || !v.value) return "";
|
|
66
|
+
const t = M(y.value);
|
|
67
|
+
if (t && v.value) {
|
|
68
|
+
const r = new Date(t).getTime();
|
|
69
|
+
if (new Date(v.value).getTime() <= r)
|
|
70
|
+
return c("inventory.stock.recalculation.error.endDateBeforeOpening");
|
|
71
|
+
}
|
|
72
|
+
return "";
|
|
73
|
+
}), z = S(() => {
|
|
74
|
+
if (!v.value) return !1;
|
|
75
|
+
const t = new Date(v.value), r = /* @__PURE__ */ new Date();
|
|
76
|
+
return r.setHours(0, 0, 0, 0), t.setHours(0, 0, 0, 0), t >= r;
|
|
77
|
+
}), U = S(() => !!y.value && !!v.value && !R.value), Y = S(() => i.value.some(
|
|
78
|
+
(t) => !t.completedAt && !t.failedReason && Date.now() - new Date(t.createdAt).getTime() < lt
|
|
79
|
+
));
|
|
80
|
+
async function J() {
|
|
81
|
+
C.value = !0, await Promise.all([q(), E(), H()]), y.value = "", v.value = "";
|
|
82
|
+
}
|
|
83
|
+
g({
|
|
84
|
+
open: J
|
|
85
|
+
});
|
|
86
|
+
async function q() {
|
|
87
|
+
D.value = !0;
|
|
88
|
+
try {
|
|
89
|
+
const t = await L.getLastNClosings(30);
|
|
90
|
+
N.value = t;
|
|
91
|
+
} catch (t) {
|
|
92
|
+
console.error("Error fetching recent closings:", t), x.open({
|
|
93
|
+
title: c("common.error"),
|
|
94
|
+
message: "Failed to fetch recent closings",
|
|
95
|
+
type: "error"
|
|
96
|
+
});
|
|
97
|
+
} finally {
|
|
98
|
+
D.value = !1;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
async function E() {
|
|
102
|
+
try {
|
|
103
|
+
const t = await L.getLastNStockSnapshots(30);
|
|
104
|
+
K.value = t;
|
|
105
|
+
} catch (t) {
|
|
106
|
+
console.error("Error fetching recent snapshots:", t);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
async function H() {
|
|
110
|
+
n.value = !0;
|
|
111
|
+
try {
|
|
112
|
+
const t = await V.recalculation.recalculationRequests();
|
|
113
|
+
i.value = t;
|
|
114
|
+
} catch (t) {
|
|
115
|
+
console.error("Error fetching recalculation requests:", t);
|
|
116
|
+
} finally {
|
|
117
|
+
n.value = !1;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
async function ee() {
|
|
121
|
+
if (!y.value || !v.value) {
|
|
122
|
+
m.value = [];
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
b.value = !0;
|
|
126
|
+
try {
|
|
127
|
+
const t = new Date(v.value);
|
|
128
|
+
t.setHours(23, 59, 59, 999);
|
|
129
|
+
const r = await V.recalculation.getAffectedClosingDrafts(
|
|
130
|
+
y.value,
|
|
131
|
+
t.toISOString()
|
|
132
|
+
);
|
|
133
|
+
m.value = r;
|
|
134
|
+
} catch {
|
|
135
|
+
x.open({
|
|
136
|
+
title: c("common.error"),
|
|
137
|
+
message: "Failed to fetch affected closing drafts",
|
|
138
|
+
type: "error"
|
|
139
|
+
}), m.value = [];
|
|
140
|
+
} finally {
|
|
141
|
+
b.value = !1;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
ue(
|
|
145
|
+
[y, v],
|
|
146
|
+
() => {
|
|
147
|
+
y.value && v.value && !R.value ? ee() : m.value = [];
|
|
148
|
+
},
|
|
149
|
+
{ immediate: !1 }
|
|
150
|
+
);
|
|
151
|
+
async function te() {
|
|
152
|
+
if (!(!U.value || !v.value)) {
|
|
153
|
+
D.value = !0;
|
|
154
|
+
try {
|
|
155
|
+
const t = new Date(v.value);
|
|
156
|
+
if (t.setHours(23, 59, 59, 999), await V.recalculation.scheduleRecalculation({
|
|
157
|
+
openingId: y.value,
|
|
158
|
+
untilDate: t.toISOString(),
|
|
159
|
+
recalculateBySnapshot: !0
|
|
160
|
+
}), m.value.length > 0) {
|
|
161
|
+
const r = m.value.map((W) => W._id);
|
|
162
|
+
await V.recalculation.scheduleInvalidateClosingDraftCache(r);
|
|
163
|
+
}
|
|
164
|
+
x.open({
|
|
165
|
+
title: c("common.success"),
|
|
166
|
+
message: "Stock recalculation has been scheduled successfully",
|
|
167
|
+
type: "success"
|
|
168
|
+
}), await H(), C.value = !1, A("submitted");
|
|
169
|
+
} catch (t) {
|
|
170
|
+
console.error("Error scheduling recalculation:", t), x.open({
|
|
171
|
+
title: c("common.error"),
|
|
172
|
+
message: "Failed to schedule stock recalculation",
|
|
173
|
+
type: "error"
|
|
174
|
+
});
|
|
175
|
+
} finally {
|
|
176
|
+
D.value = !1;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
return (t, r) => {
|
|
181
|
+
const W = w("FmSelect"), oe = w("FmDatePicker"), Q = w("FmSnackbar"), X = w("FmAlert"), o = w("FmButton"), s = w("FmDialog");
|
|
182
|
+
return u(), f("div", null, [
|
|
183
|
+
_(s, {
|
|
184
|
+
modelValue: C.value,
|
|
185
|
+
"onUpdate:modelValue": r[4] || (r[4] = (e) => C.value = e),
|
|
186
|
+
"close-button": "",
|
|
187
|
+
dismissAway: "",
|
|
188
|
+
"max-width": "600px"
|
|
189
|
+
}, {
|
|
190
|
+
"dialog-header": $(() => [
|
|
191
|
+
a("div", Ae, l(d(c)("inventory.stock.recalculation.title")), 1)
|
|
192
|
+
]),
|
|
193
|
+
"dialog-footer": $(() => [
|
|
194
|
+
Y.value ? (u(), f("div", st, [
|
|
195
|
+
_(o, {
|
|
196
|
+
variant: "tertiary",
|
|
197
|
+
onClick: r[3] || (r[3] = (e) => C.value = !1),
|
|
198
|
+
label: d(c)("common.close")
|
|
199
|
+
}, null, 8, ["label"])
|
|
200
|
+
])) : (u(), f("div", nt, [
|
|
201
|
+
_(o, {
|
|
202
|
+
variant: "tertiary",
|
|
203
|
+
onClick: r[2] || (r[2] = (e) => C.value = !1),
|
|
204
|
+
disabled: D.value,
|
|
205
|
+
label: d(c)("common.cancel")
|
|
206
|
+
}, null, 8, ["disabled", "label"]),
|
|
207
|
+
_(o, {
|
|
208
|
+
variant: "primary",
|
|
209
|
+
onClick: te,
|
|
210
|
+
disabled: !U.value || D.value,
|
|
211
|
+
loading: D.value,
|
|
212
|
+
label: d(c)("inventory.stock.recalculation.schedule")
|
|
213
|
+
}, null, 8, ["disabled", "loading", "label"])
|
|
214
|
+
]))
|
|
215
|
+
]),
|
|
216
|
+
default: $(() => [
|
|
217
|
+
a("div", Ie, [
|
|
218
|
+
a("div", $e, l(d(c)("inventory.stock.recalculation.description")), 1),
|
|
219
|
+
Y.value ? F("", !0) : (u(), f(G, { key: 0 }, [
|
|
220
|
+
a("div", Te, [
|
|
221
|
+
a("p", Be, [
|
|
222
|
+
ne(l(d(c)("inventory.stock.recalculation.openingDate")) + " ", 1),
|
|
223
|
+
r[5] || (r[5] = a("span", { class: "text-fm-color-system-error-300" }, "*", -1))
|
|
224
|
+
]),
|
|
225
|
+
r[6] || (r[6] = a("div", { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary mb-4" }, " Select from the last 30 closing or snapshot records as the opening date for recalculation. ", -1)),
|
|
226
|
+
_(W, {
|
|
227
|
+
modelValue: y.value,
|
|
228
|
+
"onUpdate:modelValue": r[0] || (r[0] = (e) => y.value = e),
|
|
229
|
+
items: T.value,
|
|
230
|
+
placeholder: d(c)("inventory.stock.recalculation.selectOpening"),
|
|
231
|
+
loading: D.value,
|
|
232
|
+
disabled: D.value
|
|
233
|
+
}, null, 8, ["modelValue", "items", "placeholder", "loading", "disabled"])
|
|
234
|
+
]),
|
|
235
|
+
a("div", Le, [
|
|
236
|
+
a("p", Re, [
|
|
237
|
+
ne(l(d(c)("inventory.stock.recalculation.untilDate")) + " ", 1),
|
|
238
|
+
r[7] || (r[7] = a("span", { class: "text-fm-color-system-error-300" }, "*", -1))
|
|
239
|
+
]),
|
|
240
|
+
r[8] || (r[8] = a("div", { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary mb-4" }, " Select the end date for recalculation. Must be after the selected opening date. ", -1)),
|
|
241
|
+
_(oe, {
|
|
242
|
+
modelValue: v.value,
|
|
243
|
+
"onUpdate:modelValue": r[1] || (r[1] = (e) => v.value = e),
|
|
244
|
+
placeholder: d(c)("inventory.stock.recalculation.selectDate"),
|
|
245
|
+
min: I.value,
|
|
246
|
+
disabled: !y.value || D.value
|
|
247
|
+
}, null, 8, ["modelValue", "placeholder", "min", "disabled"]),
|
|
248
|
+
R.value ? (u(), f("div", Ne, l(R.value), 1)) : F("", !0),
|
|
249
|
+
z.value ? (u(), j(Q, {
|
|
250
|
+
key: 1,
|
|
251
|
+
title: "Warning",
|
|
252
|
+
variant: "warning",
|
|
253
|
+
description: "You have selected today or a future date. The stock balance will be refreshed accordingly."
|
|
254
|
+
})) : F("", !0)
|
|
255
|
+
]),
|
|
256
|
+
y.value && v.value && !R.value ? (u(), j(X, {
|
|
257
|
+
key: 0,
|
|
258
|
+
type: "info"
|
|
259
|
+
}, {
|
|
260
|
+
default: $(() => [
|
|
261
|
+
a("div", Oe, l(d(c)("inventory.stock.recalculation.info")), 1)
|
|
262
|
+
]),
|
|
263
|
+
_: 1
|
|
264
|
+
})) : F("", !0),
|
|
265
|
+
m.value.length > 0 ? (u(), f("div", Pe, [
|
|
266
|
+
b.value ? (u(), f("div", Me, " Loading affected closing drafts... ")) : (u(), f("div", Ke, [
|
|
267
|
+
a("div", Ue, " Affected closing draft(s): " + l(m.value.length), 1),
|
|
268
|
+
a("div", Ee, [
|
|
269
|
+
(u(!0), f(G, null, re(m.value, (e) => (u(), f("div", {
|
|
270
|
+
key: e._id,
|
|
271
|
+
class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary"
|
|
272
|
+
}, [
|
|
273
|
+
r[9] || (r[9] = ne(" • ")),
|
|
274
|
+
e.closingId && B.value.get(e.closingId) ? (u(), f("span", He, l(B.value.get(e.closingId)), 1)) : (u(), f("span", We, l(e._id), 1)),
|
|
275
|
+
e.effectiveAt ? (u(), f("span", ze, " (" + l(new Date(e.effectiveAt).toLocaleString()) + ") ", 1)) : F("", !0)
|
|
276
|
+
]))), 128))
|
|
277
|
+
])
|
|
278
|
+
]))
|
|
279
|
+
])) : F("", !0)
|
|
280
|
+
], 64)),
|
|
281
|
+
i.value.length > 0 ? (u(), f("div", Ge, [
|
|
282
|
+
a("p", je, l(d(c)("inventory.stock.recalculation.recentRequests")), 1),
|
|
283
|
+
a("div", Ye, [
|
|
284
|
+
(u(!0), f(G, null, re(i.value, (e) => {
|
|
285
|
+
var O;
|
|
286
|
+
return u(), f("div", {
|
|
287
|
+
key: e._id,
|
|
288
|
+
class: "p-12 border border-fm-color-border-primary rounded-8 flex flex-col gap-4"
|
|
289
|
+
}, [
|
|
290
|
+
a("div", Je, [
|
|
291
|
+
a("div", Qe, l(d(c)("inventory.stock.recalculation.requestedAt")) + ": " + l(new Date(e.createdAt).toLocaleString()), 1),
|
|
292
|
+
a("div", Xe, [
|
|
293
|
+
(O = e.meta) != null && O.openingType ? (u(), f("div", Ze, l(e.meta.openingType === "stockSnapshot" ? "Snapshot" : "Closing"), 1)) : F("", !0),
|
|
294
|
+
a("div", {
|
|
295
|
+
class: fe(["fm-typo-en-body-xs-600 px-8 py-4 rounded-4", {
|
|
296
|
+
"bg-fm-color-system-error-100 text-fm-color-system-error-500": e.failedReason,
|
|
297
|
+
"bg-fm-color-system-success-100 text-fm-color-system-success-500": e.completedAt,
|
|
298
|
+
"bg-fm-color-system-info-100 text-fm-color-system-info-500": !e.failedReason && !e.completedAt
|
|
299
|
+
}])
|
|
300
|
+
}, l(e.failedReason ? d(c)("inventory.stock.recalculation.status.failed") : e.completedAt ? d(c)("inventory.stock.recalculation.status.completed") : d(c)("inventory.stock.recalculation.status.inProgress")), 3)
|
|
301
|
+
])
|
|
302
|
+
]),
|
|
303
|
+
a("div", qe, l(d(c)("inventory.stock.recalculation.from")) + ": " + l(new Date(e.recalculateStartDate).toLocaleDateString()), 1),
|
|
304
|
+
a("div", et, l(d(c)("inventory.stock.recalculation.to")) + ": " + l(new Date(e.recalculateEndDate).toLocaleDateString()), 1),
|
|
305
|
+
e.createdBy ? (u(), f("div", tt, l(d(c)("inventory.stock.recalculation.requestedBy")) + ": " + l(e.createdBy.name || e.createdBy.id), 1)) : F("", !0),
|
|
306
|
+
e.completedAt ? (u(), f("div", ot, l(d(c)("inventory.stock.recalculation.completedAt")) + ": " + l(new Date(e.completedAt).toLocaleString()), 1)) : F("", !0),
|
|
307
|
+
e.failedReason ? (u(), f("div", at, l(e.failedReason), 1)) : F("", !0)
|
|
308
|
+
]);
|
|
309
|
+
}), 128))
|
|
310
|
+
])
|
|
311
|
+
])) : F("", !0)
|
|
312
|
+
])
|
|
313
|
+
]),
|
|
314
|
+
_: 1
|
|
315
|
+
}, 8, ["modelValue"])
|
|
316
|
+
]);
|
|
317
|
+
};
|
|
318
|
+
}
|
|
319
|
+
}), rt = { class: "fm-typo-en-heading-lg-600" }, ct = { class: "flex flex-col gap-16" }, dt = { class: "flex flex-col gap-4" }, ut = { class: "fm-typo-en-label-md-400 text-fm-color-typo-secondary" }, mt = { class: "fm-typo-en-body-md-400" }, pt = { class: "flex flex-col gap-4" }, yt = { class: "fm-typo-en-label-md-400 text-fm-color-typo-secondary" }, ft = { class: "fm-typo-en-body-md-400" }, gt = { class: "flex flex-col gap-4" }, vt = { class: "fm-typo-en-label-md-400 text-fm-color-typo-secondary" }, ht = { class: "flex gap-8 ml-auto" }, _t = /* @__PURE__ */ se({
|
|
320
|
+
__name: "ClosingDetailDialog",
|
|
321
|
+
props: {
|
|
322
|
+
modelValue: { type: Boolean },
|
|
323
|
+
type: {},
|
|
324
|
+
data: {}
|
|
325
|
+
},
|
|
326
|
+
emits: ["update:modelValue"],
|
|
327
|
+
setup(Z, { emit: g }) {
|
|
328
|
+
const { t: h } = le(), A = _e(), c = Ve(), V = Z, L = g, x = S({
|
|
329
|
+
get: () => V.modelValue,
|
|
330
|
+
set: (i) => L("update:modelValue", i)
|
|
331
|
+
}), C = p("");
|
|
332
|
+
ue(x, (i) => {
|
|
333
|
+
i || (C.value = "");
|
|
334
|
+
});
|
|
335
|
+
const y = S(() => {
|
|
336
|
+
var i;
|
|
337
|
+
return ((i = V.data) == null ? void 0 : i.skus) ?? [];
|
|
338
|
+
}), v = S(() => {
|
|
339
|
+
var b;
|
|
340
|
+
const i = (b = V.data) == null ? void 0 : b._id;
|
|
341
|
+
if (!i) return "-";
|
|
342
|
+
const n = M(i);
|
|
343
|
+
return new Date(n).toLocaleString();
|
|
344
|
+
}), N = S(() => V.type === "closing" ? h("inventory.closing.history.closingDetail", "Closing Detail") : h("inventory.closing.history.snapshotDetail", "Snapshot Detail")), K = S(() => y.value.map((i) => {
|
|
345
|
+
const n = A.skuById[i.id] ?? null, m = !n;
|
|
346
|
+
return {
|
|
347
|
+
id: i.id,
|
|
348
|
+
sku: n,
|
|
349
|
+
skuName: (n == null ? void 0 : n.name) ?? i.id,
|
|
350
|
+
skuCode: (n == null ? void 0 : n.code) ?? "-",
|
|
351
|
+
balance: i.balance ?? { amount: 0, precision: 0 },
|
|
352
|
+
isMissing: m,
|
|
353
|
+
costs: i.costs,
|
|
354
|
+
weightedAverage: i.weightedAverage
|
|
355
|
+
};
|
|
356
|
+
})), D = S(() => [
|
|
357
|
+
{
|
|
358
|
+
accessorKey: "skuName",
|
|
359
|
+
header: () => h("inventory.ingredient.name", "Ingredient Name"),
|
|
360
|
+
cell: (i) => {
|
|
361
|
+
const n = i.row.original;
|
|
362
|
+
return n.isMissing ? P("div", { class: "flex items-center gap-8" }, [
|
|
363
|
+
P("span", {}, n.id),
|
|
364
|
+
P(
|
|
365
|
+
"span",
|
|
366
|
+
{
|
|
367
|
+
class: "px-8 py-2 rounded-4 bg-fm-color-danger-weak text-fm-color-danger-default fm-typo-en-label-sm-400"
|
|
368
|
+
},
|
|
369
|
+
"Missing"
|
|
370
|
+
)
|
|
371
|
+
]) : i.getValue();
|
|
372
|
+
}
|
|
373
|
+
},
|
|
374
|
+
{
|
|
375
|
+
accessorKey: "skuCode",
|
|
376
|
+
header: () => h("inventory.ingredient.code", "Code")
|
|
377
|
+
},
|
|
378
|
+
{
|
|
379
|
+
id: "balance",
|
|
380
|
+
header: () => h("inventory.closing.history.balance", "Balance"),
|
|
381
|
+
cell: (i) => {
|
|
382
|
+
var b;
|
|
383
|
+
const n = i.row.original;
|
|
384
|
+
if (n.isMissing || !((b = n.sku) != null && b.unit))
|
|
385
|
+
return `${n.balance.amount / Math.pow(10, n.balance.precision)}`;
|
|
386
|
+
const m = {
|
|
387
|
+
unit: n.sku.unit,
|
|
388
|
+
sku: n.sku,
|
|
389
|
+
amount: n.balance,
|
|
390
|
+
defaultTrackingMeasurement: n.sku.trackingMeasurement ?? void 0
|
|
391
|
+
};
|
|
392
|
+
return P(Fe, m);
|
|
393
|
+
},
|
|
394
|
+
size: 180
|
|
395
|
+
},
|
|
396
|
+
{
|
|
397
|
+
accessorKey: "weightedAverage",
|
|
398
|
+
header: () => h("inventory.closing.history.weightedAvgCost", "Weighted Avg Cost"),
|
|
399
|
+
cell: (i) => {
|
|
400
|
+
if (!c.enableTotalCost)
|
|
401
|
+
return P(
|
|
402
|
+
Ce,
|
|
403
|
+
{ featureKey: "total-cost", compact: !0 },
|
|
404
|
+
() => P("span", "0.00")
|
|
405
|
+
);
|
|
406
|
+
const n = i.getValue();
|
|
407
|
+
if (!n) return "-";
|
|
408
|
+
const m = n.amount ?? 0, b = n.precision ?? 0, T = n.currency ?? "", B = m / Math.pow(10, b);
|
|
409
|
+
return `${T} ${B.toFixed(2)}`;
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
]);
|
|
413
|
+
return (i, n) => {
|
|
414
|
+
const m = w("FmTextField"), b = w("FmTable"), T = w("FmButton"), B = w("FmDialog");
|
|
415
|
+
return u(), j(B, {
|
|
416
|
+
modelValue: x.value,
|
|
417
|
+
"onUpdate:modelValue": n[2] || (n[2] = (I) => x.value = I),
|
|
418
|
+
"close-button": "",
|
|
419
|
+
dismissAway: "",
|
|
420
|
+
"max-width": "900px"
|
|
421
|
+
}, {
|
|
422
|
+
"dialog-header": $(() => [
|
|
423
|
+
a("div", rt, l(N.value), 1)
|
|
424
|
+
]),
|
|
425
|
+
default: $(() => {
|
|
426
|
+
var I;
|
|
427
|
+
return [
|
|
428
|
+
a("div", ct, [
|
|
429
|
+
a("div", dt, [
|
|
430
|
+
a("div", ut, l(V.type === "closing" ? d(h)("inventory.closing.history.closingId") : d(h)("inventory.closing.history.snapshotId", "Snapshot ID")), 1),
|
|
431
|
+
a("div", mt, l(((I = V.data) == null ? void 0 : I._id) ?? "-"), 1)
|
|
432
|
+
]),
|
|
433
|
+
a("div", pt, [
|
|
434
|
+
a("div", yt, l(d(h)("inventory.closing.history.date")), 1),
|
|
435
|
+
a("div", ft, l(v.value), 1)
|
|
436
|
+
]),
|
|
437
|
+
a("div", gt, [
|
|
438
|
+
a("div", vt, l(d(h)("inventory.closing.history.ingredientBalances", "Ingredient Balances")) + " (" + l(y.value.length) + ") ", 1),
|
|
439
|
+
_(m, {
|
|
440
|
+
modelValue: C.value,
|
|
441
|
+
"onUpdate:modelValue": n[0] || (n[0] = (R) => C.value = R),
|
|
442
|
+
placeholder: "Filter by code or name"
|
|
443
|
+
}, null, 8, ["modelValue"]),
|
|
444
|
+
_(b, {
|
|
445
|
+
"row-data": K.value,
|
|
446
|
+
"column-defs": D.value,
|
|
447
|
+
pagination: { pageSize: 10 },
|
|
448
|
+
"search-value": C.value
|
|
449
|
+
}, null, 8, ["row-data", "column-defs", "search-value"])
|
|
450
|
+
])
|
|
451
|
+
])
|
|
452
|
+
];
|
|
453
|
+
}),
|
|
454
|
+
"dialog-footer": $(() => [
|
|
455
|
+
a("div", ht, [
|
|
456
|
+
_(T, {
|
|
457
|
+
variant: "tertiary",
|
|
458
|
+
onClick: n[1] || (n[1] = (I) => x.value = !1),
|
|
459
|
+
label: "Close"
|
|
460
|
+
})
|
|
461
|
+
])
|
|
462
|
+
]),
|
|
463
|
+
_: 1
|
|
464
|
+
}, 8, ["modelValue"]);
|
|
465
|
+
};
|
|
466
|
+
}
|
|
467
|
+
}), bt = { class: "flex flex-col gap-16 p-16" }, kt = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Dt = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, xt = { class: "flex flex-col gap-16" }, St = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, wt = { class: "flex gap-8 ml-auto" }, Mt = /* @__PURE__ */ se({
|
|
468
|
+
__name: "ClosingHistoryView",
|
|
469
|
+
setup(Z) {
|
|
470
|
+
var Q, X;
|
|
471
|
+
const { t: g } = le(), h = me(), A = be(), c = he(), V = De(), L = pe(), x = p("closings"), C = S(() => [
|
|
472
|
+
{ label: g("inventory.closing.history.closingsTab"), value: "closings" },
|
|
473
|
+
{ label: g("inventory.closing.history.snapshotsTab"), value: "snapshots" }
|
|
474
|
+
]), y = p([]), v = p(0), N = p([]), K = p(0);
|
|
475
|
+
let D = A.currentLocationDBName;
|
|
476
|
+
async function i(o) {
|
|
477
|
+
return A.currentLocationDBName ? (D = A.currentLocationDBName, h.listClosingsPage(o)) : { docs: [], nextStartkey: null, hasMore: !1 };
|
|
478
|
+
}
|
|
479
|
+
async function n(o) {
|
|
480
|
+
return A.currentLocationDBName ? (D = A.currentLocationDBName, h.listStockSnapshotsPage(o)) : { docs: [], nextStartkey: null, hasMore: !1 };
|
|
481
|
+
}
|
|
482
|
+
function m() {
|
|
483
|
+
y.value = [], v.value++;
|
|
484
|
+
}
|
|
485
|
+
function b() {
|
|
486
|
+
N.value = [], K.value++;
|
|
487
|
+
}
|
|
488
|
+
const T = p(!1), B = p("closing"), I = p(null);
|
|
489
|
+
function R(o) {
|
|
490
|
+
return [
|
|
491
|
+
o.getFullYear(),
|
|
492
|
+
String(o.getMonth() + 1).padStart(2, "0"),
|
|
493
|
+
String(o.getDate()).padStart(2, "0")
|
|
494
|
+
].join("-");
|
|
495
|
+
}
|
|
496
|
+
const z = () => R(new Date(Date.now() - 864e5)), U = p(z()), Y = S(() => {
|
|
497
|
+
const o = [
|
|
498
|
+
{
|
|
499
|
+
label: g("inventory.stock.recalculation.title"),
|
|
500
|
+
value: "recalculation",
|
|
501
|
+
prependIcon: "history",
|
|
502
|
+
isAdminOnly: !0
|
|
503
|
+
}
|
|
504
|
+
];
|
|
505
|
+
return x.value === "closings" ? o.push(
|
|
506
|
+
{
|
|
507
|
+
label: g("inventory.closing.history.initiate_opening"),
|
|
508
|
+
value: "initiateOpening",
|
|
509
|
+
prependIcon: "add_box",
|
|
510
|
+
isAdminOnly: !0
|
|
511
|
+
},
|
|
512
|
+
{
|
|
513
|
+
label: "Refresh",
|
|
514
|
+
value: "refreshOpening",
|
|
515
|
+
prependIcon: "refresh"
|
|
516
|
+
}
|
|
517
|
+
) : o.push(
|
|
518
|
+
{
|
|
519
|
+
label: g("inventory.closing.history.initiate_snapshot"),
|
|
520
|
+
value: "initiateStockSnapshot",
|
|
521
|
+
prependIcon: "camera",
|
|
522
|
+
isAdminOnly: !0
|
|
523
|
+
},
|
|
524
|
+
{
|
|
525
|
+
label: "Refresh",
|
|
526
|
+
value: "refreshStockSnapshot",
|
|
527
|
+
prependIcon: "refresh"
|
|
528
|
+
}
|
|
529
|
+
), o;
|
|
530
|
+
}), J = p();
|
|
531
|
+
function q(o) {
|
|
532
|
+
var s;
|
|
533
|
+
switch (o) {
|
|
534
|
+
case "recalculation":
|
|
535
|
+
return (s = J.value) == null ? void 0 : s.open();
|
|
536
|
+
case "initiateOpening": {
|
|
537
|
+
V.open({
|
|
538
|
+
title: "Initiate Opening Balance",
|
|
539
|
+
message: "Initiate opening balance if no opening balance exists for the current location.",
|
|
540
|
+
primaryActions: { text: "Confirm", close: !0 }
|
|
541
|
+
}).onPrimary(async () => {
|
|
542
|
+
try {
|
|
543
|
+
await h.initiateClosing(), L.open({
|
|
544
|
+
message: "Opening balance initiated successfully.",
|
|
545
|
+
type: "success"
|
|
546
|
+
}), await m();
|
|
547
|
+
} catch (e) {
|
|
548
|
+
L.open({
|
|
549
|
+
message: e.message || "Failed to initiate opening balance. Please try again.",
|
|
550
|
+
type: "error"
|
|
551
|
+
});
|
|
552
|
+
}
|
|
553
|
+
});
|
|
554
|
+
break;
|
|
555
|
+
}
|
|
556
|
+
case "initiateStockSnapshot": {
|
|
557
|
+
U.value = z(), E.value = !0;
|
|
558
|
+
break;
|
|
559
|
+
}
|
|
560
|
+
case "refreshOpening": {
|
|
561
|
+
m();
|
|
562
|
+
break;
|
|
563
|
+
}
|
|
564
|
+
case "refreshStockSnapshot": {
|
|
565
|
+
b();
|
|
566
|
+
break;
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
const E = p(!1), H = p(!1), ee = z();
|
|
571
|
+
async function te() {
|
|
572
|
+
H.value = !0;
|
|
573
|
+
try {
|
|
574
|
+
await h.initiateStockSnapshot(U.value), L.open({
|
|
575
|
+
message: "Stock snapshot created successfully.",
|
|
576
|
+
type: "success"
|
|
577
|
+
}), E.value = !1, await b();
|
|
578
|
+
} catch (o) {
|
|
579
|
+
L.open({
|
|
580
|
+
message: o.message || "Failed to create stock snapshot. Please try again.",
|
|
581
|
+
type: "error"
|
|
582
|
+
});
|
|
583
|
+
} finally {
|
|
584
|
+
H.value = !1;
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
const t = [
|
|
588
|
+
...(Q = c.sessionUser.value) != null && Q.role.isAdmin ? [
|
|
589
|
+
{
|
|
590
|
+
accessorKey: "_id",
|
|
591
|
+
header: () => P(ce, {}, () => `${g("inventory.closing.history.closingId")}`),
|
|
592
|
+
cell: (o) => o.getValue()
|
|
593
|
+
}
|
|
594
|
+
] : [],
|
|
595
|
+
{
|
|
596
|
+
accessorKey: "_id",
|
|
597
|
+
id: "date",
|
|
598
|
+
header: () => g("inventory.closing.history.date"),
|
|
599
|
+
cell: (o) => {
|
|
600
|
+
const s = o.getValue(), e = M(s);
|
|
601
|
+
return new Date(e).toLocaleDateString();
|
|
602
|
+
}
|
|
603
|
+
},
|
|
604
|
+
{
|
|
605
|
+
accessorKey: "_id",
|
|
606
|
+
id: "time",
|
|
607
|
+
header: () => g("inventory.closing.history.time"),
|
|
608
|
+
cell: (o) => {
|
|
609
|
+
const s = o.getValue(), e = M(s);
|
|
610
|
+
return new Date(e).toLocaleTimeString();
|
|
611
|
+
}
|
|
612
|
+
},
|
|
613
|
+
{
|
|
614
|
+
accessorKey: "ref",
|
|
615
|
+
header: () => g("inventory.closing.history.createdFrom"),
|
|
616
|
+
cell: (o) => o.getValue() || "-"
|
|
617
|
+
}
|
|
618
|
+
], r = [
|
|
619
|
+
...(X = c.sessionUser.value) != null && X.role.isAdmin ? [
|
|
620
|
+
{
|
|
621
|
+
accessorKey: "_id",
|
|
622
|
+
header: () => P(
|
|
623
|
+
ce,
|
|
624
|
+
{},
|
|
625
|
+
() => `${g("inventory.closing.history.snapshotId", "Snapshot ID")}`
|
|
626
|
+
),
|
|
627
|
+
cell: (o) => o.getValue()
|
|
628
|
+
}
|
|
629
|
+
] : [],
|
|
630
|
+
{
|
|
631
|
+
accessorKey: "_id",
|
|
632
|
+
id: "date",
|
|
633
|
+
header: () => g("inventory.closing.history.date"),
|
|
634
|
+
cell: (o) => {
|
|
635
|
+
const s = o.getValue(), e = M(s);
|
|
636
|
+
return new Date(e).toLocaleDateString();
|
|
637
|
+
}
|
|
638
|
+
},
|
|
639
|
+
{
|
|
640
|
+
accessorKey: "_id",
|
|
641
|
+
id: "time",
|
|
642
|
+
header: () => g("inventory.closing.history.time"),
|
|
643
|
+
cell: (o) => {
|
|
644
|
+
const s = o.getValue(), e = M(s);
|
|
645
|
+
return new Date(e).toLocaleTimeString();
|
|
646
|
+
}
|
|
647
|
+
},
|
|
648
|
+
{
|
|
649
|
+
accessorKey: "remark",
|
|
650
|
+
header: () => g("inventory.closing.history.createdFrom"),
|
|
651
|
+
cell: (o) => o.getValue() || "-"
|
|
652
|
+
}
|
|
653
|
+
];
|
|
654
|
+
async function W(o, s) {
|
|
655
|
+
const e = await h.getClosingById(o, s);
|
|
656
|
+
if (!e) throw new Error(`Closing ${o} not found`);
|
|
657
|
+
return B.value = "closing", I.value = e, T.value = !0, e;
|
|
658
|
+
}
|
|
659
|
+
async function oe(o, s) {
|
|
660
|
+
const e = await h.getStockSnapshotById(o, s);
|
|
661
|
+
if (!e) throw new Error(`Stock snapshot ${o} not found`);
|
|
662
|
+
return B.value = "snapshot", I.value = e, T.value = !0, e;
|
|
663
|
+
}
|
|
664
|
+
return A.watchLocation(async () => {
|
|
665
|
+
(A.currentLocationDBName || void 0) !== D && (m(), b());
|
|
666
|
+
}), (o, s) => {
|
|
667
|
+
const e = w("FmTabs"), O = w("FmDatePicker"), ie = w("FmButton"), ye = w("FmDialog");
|
|
668
|
+
return u(), j(ve, {
|
|
669
|
+
actions: Y.value,
|
|
670
|
+
title: d(g)("inventory.closing.history.title"),
|
|
671
|
+
"onClick:action": q
|
|
672
|
+
}, {
|
|
673
|
+
default: $(() => [
|
|
674
|
+
a("div", bt, [
|
|
675
|
+
_(ke, {
|
|
676
|
+
"change-location": "",
|
|
677
|
+
"hide-filter-options": !0
|
|
678
|
+
}),
|
|
679
|
+
_(e, {
|
|
680
|
+
"model-value": x.value,
|
|
681
|
+
"onUpdate:modelValue": s[0] || (s[0] = (k) => x.value = k),
|
|
682
|
+
items: C.value
|
|
683
|
+
}, null, 8, ["model-value", "items"]),
|
|
684
|
+
x.value === "closings" ? (u(), f(G, { key: 0 }, [
|
|
685
|
+
a("div", kt, l(d(g)("inventory.closing.history.closingsDescription")), 1),
|
|
686
|
+
_(de, {
|
|
687
|
+
rows: y.value,
|
|
688
|
+
"onUpdate:rows": s[1] || (s[1] = (k) => y.value = k),
|
|
689
|
+
"fetch-page": i,
|
|
690
|
+
"refresh-key": v.value,
|
|
691
|
+
"column-defs": t,
|
|
692
|
+
"fetch-detail": (k, ae) => W(k._id, ae)
|
|
693
|
+
}, null, 8, ["rows", "refresh-key", "fetch-detail"])
|
|
694
|
+
], 64)) : F("", !0),
|
|
695
|
+
x.value === "snapshots" ? (u(), f(G, { key: 1 }, [
|
|
696
|
+
a("div", Dt, l(d(g)("inventory.closing.history.snapshotsDescription")), 1),
|
|
697
|
+
_(de, {
|
|
698
|
+
rows: N.value,
|
|
699
|
+
"onUpdate:rows": s[2] || (s[2] = (k) => N.value = k),
|
|
700
|
+
"fetch-page": n,
|
|
701
|
+
"refresh-key": K.value,
|
|
702
|
+
"column-defs": r,
|
|
703
|
+
"fetch-detail": (k, ae) => oe(k._id, ae)
|
|
704
|
+
}, null, 8, ["rows", "refresh-key", "fetch-detail"])
|
|
705
|
+
], 64)) : F("", !0)
|
|
706
|
+
]),
|
|
707
|
+
(u(), j(ge, { to: "body" }, [
|
|
708
|
+
_(it, {
|
|
709
|
+
ref_key: "recalculationDialogRef",
|
|
710
|
+
ref: J,
|
|
711
|
+
onSubmitted: s[3] || (s[3] = (k) => {
|
|
712
|
+
m(), b();
|
|
713
|
+
})
|
|
714
|
+
}, null, 512),
|
|
715
|
+
_(_t, {
|
|
716
|
+
modelValue: T.value,
|
|
717
|
+
"onUpdate:modelValue": s[4] || (s[4] = (k) => T.value = k),
|
|
718
|
+
type: B.value,
|
|
719
|
+
data: I.value
|
|
720
|
+
}, null, 8, ["modelValue", "type", "data"]),
|
|
721
|
+
_(ye, {
|
|
722
|
+
modelValue: E.value,
|
|
723
|
+
"onUpdate:modelValue": s[7] || (s[7] = (k) => E.value = k),
|
|
724
|
+
"close-button": "",
|
|
725
|
+
dismissAway: "",
|
|
726
|
+
"max-width": "400px"
|
|
727
|
+
}, {
|
|
728
|
+
"dialog-header": $(() => s[8] || (s[8] = [
|
|
729
|
+
a("div", { class: "fm-typo-en-heading-lg-600" }, "Initiate Stock Snapshot", -1)
|
|
730
|
+
])),
|
|
731
|
+
default: $(() => [
|
|
732
|
+
a("div", xt, [
|
|
733
|
+
a("div", St, l(d(g)("inventory.closing.history.snapshotsDescription")), 1),
|
|
734
|
+
_(O, {
|
|
735
|
+
modelValue: U.value,
|
|
736
|
+
"onUpdate:modelValue": s[5] || (s[5] = (k) => U.value = k),
|
|
737
|
+
label: "Snapshot Date",
|
|
738
|
+
max: d(ee)
|
|
739
|
+
}, null, 8, ["modelValue", "max"])
|
|
740
|
+
])
|
|
741
|
+
]),
|
|
742
|
+
"dialog-footer": $(() => [
|
|
743
|
+
a("div", wt, [
|
|
744
|
+
_(ie, {
|
|
745
|
+
variant: "tertiary",
|
|
746
|
+
onClick: s[6] || (s[6] = (k) => E.value = !1),
|
|
747
|
+
label: "Cancel",
|
|
748
|
+
disabled: H.value
|
|
749
|
+
}, null, 8, ["disabled"]),
|
|
750
|
+
_(ie, {
|
|
751
|
+
variant: "primary",
|
|
752
|
+
onClick: te,
|
|
753
|
+
label: "Confirm",
|
|
754
|
+
loading: H.value
|
|
755
|
+
}, null, 8, ["loading"])
|
|
756
|
+
])
|
|
757
|
+
]),
|
|
758
|
+
_: 1
|
|
759
|
+
}, 8, ["modelValue"])
|
|
760
|
+
]))
|
|
761
|
+
]),
|
|
762
|
+
_: 1
|
|
763
|
+
}, 8, ["actions", "title"]);
|
|
764
|
+
};
|
|
765
|
+
}
|
|
766
|
+
});
|
|
767
|
+
export {
|
|
768
|
+
Mt as default
|
|
769
|
+
};
|