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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (248) hide show
  1. package/dist/App-5GYyCfFq.js +1445 -0
  2. package/dist/{ApprovalView-RaXuWWSu.js → ApprovalView-DY1ayl1W.js} +26 -25
  3. package/dist/{BindingsDialog-DomvXijP.js → BindingsDialog-Dm7uKMfV.js} +2 -2
  4. package/dist/{BindingsPicker-DGnzxEs7.js → BindingsPicker-DhnMlj4x.js} +2 -2
  5. package/dist/{BindingsTable-DfG9kWrv.js → BindingsTable-Cxibcjka.js} +10 -10
  6. package/dist/BulkReceiveRequestPage-w4AA6BxB.js +2839 -0
  7. package/dist/{ChangeLocationComponent.vue_vue_type_script_setup_true_lang-CVekIoiN.js → ChangeLocationComponent.vue_vue_type_script_setup_true_lang-B3ESPbQp.js} +1 -1
  8. package/dist/{ClosingDraftView-C3n66bbh.js → ClosingDraftView-DMaONEZ7.js} +748 -746
  9. package/dist/ClosingHistoryView-BBYruOux.js +769 -0
  10. package/dist/{ClosingTemplateView-DwGloYxn.js → ClosingTemplateView-DcwgokRl.js} +22 -21
  11. package/dist/{CustomPrintTemplatePreview.vue_vue_type_script_setup_true_lang-9eY_r8LF.js → CustomPrintTemplatePreview.vue_vue_type_script_setup_true_lang-a72IldDO.js} +1 -1
  12. package/dist/{DefaultView-JC_e4xgC.js → DefaultView-BVr_7JDn.js} +2 -2
  13. package/dist/{DeliveryOrderPrintPreview-BBCvI67S.js → DeliveryOrderPrintPreview-BXZFD3D5.js} +15 -15
  14. package/dist/{EmailDialog.vue_vue_type_script_setup_true_lang-H4FWc9ga.js → EmailDialog.vue_vue_type_script_setup_true_lang-Dne_9P3j.js} +10077 -9950
  15. package/dist/FeatureCapabilityBadge.vue_vue_type_script_setup_true_lang-CYkPbFSA.js +48 -0
  16. package/dist/FeatureCapabilityGate-DK_rTVyJ.js +82 -0
  17. package/dist/FeaturePageGate.vue_vue_type_script_setup_true_lang-DIhV51l7.js +189 -0
  18. package/dist/{FmDateRangePickerChip.vue_vue_type_script_setup_true_lang-Q8Mptiv3.js → FmDateRangePickerChip.vue_vue_type_script_setup_true_lang-B80EHMBT.js} +1 -1
  19. package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-CE1_yyHe.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-C94IFGoH.js} +2 -2
  20. package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-CGJi3f86.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-COZPDuAM.js} +2 -2
  21. package/dist/{FmMultiselectDialog-DCaRlBIy.js → FmMultiselectDialog-C1P22sj2.js} +2 -2
  22. package/dist/FmMultiselectDialog-Kb3IftHf.js +123 -0
  23. package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-ClaLVtpK.js → FmUnitInput.vue_vue_type_script_setup_true_lang-BqB71yfu.js} +105 -99
  24. package/dist/ImportView-EJ4u8NHM.js +1540 -0
  25. package/dist/{IngredientsView-DPj9lBTK.js → IngredientsView-Bxsgm4E7.js} +691 -689
  26. package/dist/{IntegrationExplorerView-CO2wpUR_.js → IntegrationExplorerView-owEaOVeG.js} +1537 -1620
  27. package/dist/IntegrationPlatformView-BuptPyjg.js +13385 -0
  28. package/dist/{IntegrationView-DIeZoey0.js → IntegrationView-DAcdY_d_.js} +2604 -2565
  29. package/dist/{InventoryBindingForm-Cj4_Chue.js → InventoryBindingForm-BvjY4zrn.js} +1 -1
  30. package/dist/InventoryBindingForm.vue_vue_type_script_setup_true_lang-DhbF-jgN.js +472 -0
  31. package/dist/{InventoryBindingSummary-yzGzd7jJ.js → InventoryBindingSummary-DPqm94GX.js} +1 -1
  32. package/dist/JsonViewer.vue_vue_type_script_setup_true_lang-C_hg75l0.js +25 -0
  33. package/dist/NumberPrecisionInput.vue_vue_type_script_setup_true_lang-DDsigNJ4.js +79 -0
  34. package/dist/PlanTierBadge.vue_vue_type_script_setup_true_lang-CM3gtYZo.js +19 -0
  35. package/dist/PlanUpgradeDialog.vue_vue_type_script_setup_true_lang-0F-yOcPC.js +79 -0
  36. package/dist/PremiumUpgradePage.vue_vue_type_script_setup_true_lang-DGAxPOEh.js +58 -0
  37. package/dist/ProductionRunDetailPage-BaPCJUqT.js +2317 -0
  38. package/dist/{ProductionRunLifecycleDialogs.vue_vue_type_script_setup_true_lang-BYyiiAWb.js → ProductionRunLifecycleDialogs.vue_vue_type_script_setup_true_lang-CNRX3MYt.js} +3053 -3163
  39. package/dist/ProductionRunPage-B6Jsv9Hh.js +954 -0
  40. package/dist/{PublishView-CPK9NeVF.js → PublishView-DonUv6nP.js} +3 -3
  41. package/dist/{PurchaseOrderPrintPreview-DosqWQeN.js → PurchaseOrderPrintPreview-CK3Cqdwp.js} +17 -17
  42. package/dist/{ReceiveRequestView-BxSkpK2t.js → ReceiveRequestView-CMAnKxzm.js} +17 -16
  43. package/dist/RecipeView-Bx13Bckq.js +3272 -0
  44. package/dist/SettingsView-D1MiAkD8.js +1005 -0
  45. package/dist/StockView-CsxTjVEd.js +3003 -0
  46. package/dist/{SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-GdGJCuc0.js → SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-BT73j9SA.js} +1 -1
  47. package/dist/{SupplierView-BKxKoi_0.js → SupplierView-CFACoZya.js} +304 -301
  48. package/dist/{SurchargeView-Db4cwhZv.js → SurchargeView-CShhZa3x.js} +7 -7
  49. package/dist/{SystemTrailDialog.vue_vue_type_script_setup_true_lang-CpkF77Ow.js → SystemTrailDialog.vue_vue_type_script_setup_true_lang-B2OdmdI_.js} +2 -2
  50. package/dist/TableActionableRow.vue_vue_type_script_setup_true_lang-gJQQKKAC.js +71 -0
  51. package/dist/TemplatePublishDialog.vue_vue_type_script_setup_true_lang-x3N2Oypo.js +332 -0
  52. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-BISmGBJE.js +4953 -0
  53. package/dist/TransferTemplateView-kx2IPqEv.js +2347 -0
  54. package/dist/{UnitCostHistoryView-CqcyjCCd.js → UnitCostHistoryView-DgPWsXaB.js} +4 -4
  55. package/dist/{UnitDisplayControl.vue_vue_type_script_setup_true_lang-DO80_8SZ.js → UnitDisplayControl.vue_vue_type_script_setup_true_lang-BtfJJgIP.js} +4 -4
  56. package/dist/{UnitView-BqdK1AM_.js → UnitView-aupXLRMk.js} +111 -106
  57. package/dist/{WarehouseView-COJM9IXM.js → WarehouseView-MTvbY4n4.js} +12 -11
  58. package/dist/{WastageTemplateView-DW3viTHN.js → WastageTemplateView-Bs9HL-LK.js} +19 -18
  59. package/dist/api/bill.d.ts +4 -2
  60. package/dist/api/bill.spec.d.ts +1 -0
  61. package/dist/api/closing.d.ts +1 -0
  62. package/dist/api/feature-flags.d.ts +4 -0
  63. package/dist/api/integration-sync-log.d.ts +0 -13
  64. package/dist/api/license.d.ts +0 -2
  65. package/dist/api/netsuite-explorer.d.ts +1 -0
  66. package/dist/api/stock.d.ts +1 -1
  67. package/dist/{app-yvK__CBL.js → app-D38sV2ls.js} +10177 -10126
  68. package/dist/app.d.ts +151 -164
  69. package/dist/app.js +1 -1
  70. package/dist/bulk-edit-simulation.helper-DgniL8FN.js +178 -0
  71. package/dist/{closing-template-DezidSM0.js → closing-template-D_NAj_mU.js} +4 -4
  72. package/dist/components/FeatureCapabilityBadge.vue.d.ts +4 -0
  73. package/dist/components/FeatureCapabilityGate.spec.d.ts +1 -0
  74. package/dist/components/FeatureCapabilityGate.vue.d.ts +5 -0
  75. package/dist/components/FeatureGateLayout.vue.d.ts +11 -0
  76. package/dist/components/FeaturePageGate.spec.d.ts +1 -0
  77. package/dist/components/FeaturePageGate.vue.d.ts +34 -0
  78. package/dist/components/FmAdminCollapsiblePanel.vue.d.ts +1 -1
  79. package/dist/components/FmDroppableField.vue.d.ts +1 -1
  80. package/dist/components/FmInventoryTableToolbar.vue.d.ts +2 -2
  81. package/dist/components/FmUnitInputProps.d.ts +1 -0
  82. package/dist/components/FmUnitInputRules.d.ts +1 -1
  83. package/dist/components/HrmPermissionGuard.vue.d.ts +1 -1
  84. package/dist/components/NumberPrecisionInput.spec.d.ts +1 -0
  85. package/dist/{views/ingredient-group/IngredientGroupView.vue.d.ts → components/PremiumUpgradePage.vue.d.ts} +0 -1
  86. package/dist/components/TemplatePublishDialog.d.ts +2 -0
  87. package/dist/components/TemplatePublishDialog.spec.d.ts +1 -0
  88. package/dist/composable/defineApi.d.ts +1 -1
  89. package/dist/{date2-2XjepIqc.js → date2-CvgxwuM1.js} +1 -1
  90. package/dist/{dayjs.min-CNp5DLBB.js → dayjs.min-BOKV8T5Q.js} +1 -1
  91. package/dist/{decimal-Z7oJdGk8.js → decimal-5xyg1WLu.js} +2 -2
  92. package/dist/{defineDeepModel-CMxJn_H2.js → defineDeepModel-BwB9XcMu.js} +5 -5
  93. package/dist/{duplicate-template-BetV5oy_.js → duplicate-template-DvIgjm4K.js} +1 -1
  94. package/dist/{feature-CkWaZ-5K.js → feature-CsPbMoeJ.js} +2088 -2853
  95. package/dist/feature-flags/core.d.ts +3 -2
  96. package/dist/feature-flags/portal-feature-catalog.d.ts +1 -6
  97. package/dist/feature-flags/portal-feature-catalog.spec.d.ts +1 -0
  98. package/dist/feature-flags/vue.d.ts +24 -1
  99. package/dist/feature-flags/vue.spec.d.ts +1 -0
  100. package/dist/{format-time-from-id-DatSI9uD.js → format-time-from-id-DD6Ik9EK.js} +1 -1
  101. package/dist/{format-unit-display-DM5We5cx.js → format-unit-display-DG564AN3.js} +209 -208
  102. package/dist/helper/country.spec.d.ts +1 -0
  103. package/dist/helper/menu-usage-module.d.ts +2 -1
  104. package/dist/helper/number.d.ts +5 -1
  105. package/dist/helper/rules.d.ts +1 -1
  106. package/dist/{id-to-date-Dxw2jKhy.js → id-to-date-DoN7OM21.js} +1 -1
  107. package/dist/{import-export.helper-BOmADwUw.js → import-export.helper-CevBRFTZ.js} +17 -17
  108. package/dist/{index-7fz5sGDO.js → index-BIh1oTQH.js} +3 -3
  109. package/dist/{index-CIH9NCvs.js → index-BP3Avix6.js} +1 -1
  110. package/dist/{JsonViewer.vue_vue_type_script_setup_true_lang-ig2zSXAB.js → index-C25C1Dg7.js} +1074 -1066
  111. package/dist/index-eGvSlWMU.js +1892 -0
  112. package/dist/{index-ClYgfwW7.js → index-mzXhLwrZ.js} +2234 -2163
  113. package/dist/layout/SingleColumnLayout.vue.d.ts +1 -1
  114. package/dist/{lz-string-CCsc2X7t.js → lz-string-DMjWYCk6.js} +1 -1
  115. package/dist/menu-usage-module-Bq_KLsO4.js +74 -0
  116. package/dist/{netsuite-COumFXC2.js → netsuite-ZtoZBFBX.js} +254 -263
  117. package/dist/netsuite-explorer-h_vID_ao.js +79 -0
  118. package/dist/{predefined-templates-Bw9A9LNA.js → predefined-templates-CdurFRJ4.js} +1 -1
  119. package/dist/production-run-list-DR1WsaBR.js +61 -0
  120. package/dist/{purchase-order-template-BaZjdGq8.js → purchase-order-template-BVdCftEo.js} +1 -1
  121. package/dist/{recalculationUtils-t32wAurN.js → recalculationUtils-DBG8HGiJ.js} +1 -1
  122. package/dist/router/name.d.ts +2 -2
  123. package/dist/{row-action.enum-BDeudY4d.js → row-action.enum-CGyAg4dC.js} +1 -1
  124. package/dist/rules-DbFiOzUd.js +243 -0
  125. package/dist/{stock-B59sfN28.js → stock-BATH4SoA.js} +1 -1
  126. package/dist/stock-DXxsDPEO.js +78 -0
  127. package/dist/stores/feature.d.ts +40 -10
  128. package/dist/stores/feature.load-state.spec.d.ts +1 -0
  129. package/dist/stores/inventory.d.ts +0 -47
  130. package/dist/stores/inventory.no-location.spec.d.ts +1 -0
  131. package/dist/stores/supplier.d.ts +1 -1
  132. package/dist/stores/warehouse.d.ts +1 -1
  133. package/dist/style.css +1 -1
  134. package/dist/{supplier-DnbLJ_cS.js → supplier-CKXQmBZn.js} +2 -2
  135. package/dist/{surcharge-C1uE3uQa.js → surcharge-qupRJjjO.js} +1 -1
  136. package/dist/tsconfig.app.tsbuildinfo +1 -1
  137. package/dist/{uom-rules-DjfyrFHJ.js → uom-rules-ALtgjANX.js} +1 -1
  138. package/dist/{use-ingredient-select-dialog-7A7fWyEH.js → use-ingredient-select-dialog-C1sJpjfV.js} +2 -2
  139. package/dist/use-inventory-binding-dialog-tl7-epun.js +113 -0
  140. package/dist/{use-template-enabled-locations-C-Hqqgzt.js → use-template-enabled-locations-DWk2ndDC.js} +2 -2
  141. package/dist/{use-transfer-locations-CqsXvOI2.js → use-transfer-locations-CsdYY996.js} +14 -14
  142. package/dist/{useHrmPermission-BzwD3Ctc.js → useHrmPermission-BtuqUrwj.js} +1 -1
  143. package/dist/{useNavigationMenu-PrZg9HS7.js → useNavigationMenu-DKxKXykI.js} +111 -117
  144. package/dist/{useSseClient-FCyLWq8k.js → useSseClient-CRfpltKK.js} +1 -1
  145. package/dist/views/changelog/composables/use-snapshot-diff.d.ts +2 -2
  146. package/dist/views/closing-draft/composables/use-closing-draft-table.d.ts +1 -1
  147. package/dist/views/closing-draft/helpers/draft-status-to-class-name.helper.d.ts +1 -1
  148. package/dist/views/import/helper/submit-rows.d.ts +1 -1
  149. package/dist/views/ingredients/components/inventory-binding/InventoryBindingForm.vue.d.ts +0 -1
  150. package/dist/views/ingredients/components/inventory-binding/composables/use-inventory-binding-dialog.d.ts +0 -1
  151. package/dist/views/ingredients/components/inventory-binding/recipe-amount-validation.spec.d.ts +1 -0
  152. package/dist/views/ingredients/components/inventory-binding/v2/InventoryBindingFormV2.vue.d.ts +0 -1
  153. package/dist/views/ingredients/components/inventory-binding/v2/composables/use-inventory-binding-dialog.d.ts +0 -1
  154. package/dist/views/ingredients/helper/is-linked-ingredient-error.d.ts +3 -1
  155. package/dist/views/{ingredient-group/components/ingredient-group-rule-field/IngredientGroupRuleField.vue.d.ts → integration/IntegrationPlatformView.vue.d.ts} +11 -24
  156. package/dist/views/integration/components/Synergy/importFn.spec.d.ts +1 -0
  157. package/dist/views/integration/components/Xilnex/importFn.spec.d.ts +1 -0
  158. package/dist/views/integration/helper/opening-balance.d.ts +22 -0
  159. package/dist/views/integration/helper/opening-balance.spec.d.ts +1 -0
  160. package/dist/views/production-run/ProductionRunDetailPage.spec.d.ts +1 -0
  161. package/dist/views/{integration/components/IntegrationSyncLogTab.vue.d.ts → production-run/ProductionRunDetailPage.vue.d.ts} +2 -2
  162. package/dist/views/production-run/ProductionRunPage.vue.d.ts +2 -0
  163. package/dist/views/production-run/features/detail/ProductionRunItemsTable.vue.d.ts +2 -2
  164. package/dist/views/production-run/features/detail/ProductionRunOverviewTab.vue.d.ts +4 -4
  165. package/dist/views/production-run/features/detail/use-production-run-detail.d.ts +19 -9
  166. package/dist/views/production-run/features/lifecycle/CancelRunDialog.vue.d.ts +4 -4
  167. package/dist/views/production-run/features/lifecycle/CloseRunDialog.vue.d.ts +4 -4
  168. package/dist/views/production-run/features/lifecycle/ProductionRunLifecycleDialogs.vue.d.ts +14 -14
  169. package/dist/views/production-run/features/lifecycle/TargetReachedDialog.vue.d.ts +4 -4
  170. package/dist/views/production-run/features/planning/ProductionRunFormDialog.vue.d.ts +4 -4
  171. package/dist/views/production-run/features/planning/ProductionRunPlanner.vue.d.ts +1 -1
  172. package/dist/views/production-run/features/planning/use-production-run-duplicate-sources.d.ts +6 -6
  173. package/dist/views/production-run/shared/helpers/production-run-navigation.d.ts +0 -1
  174. package/dist/views/production-run/shared/model/production-run-list.d.ts +1 -1
  175. package/dist/views/production-run/shared/ui/ProductionRunInfoBadge.vue.d.ts +1 -1
  176. package/dist/views/production-run/shared/ui/ProductionRunInfoText.vue.d.ts +1 -1
  177. package/dist/views/production-run/shared/ui/ProductionRunScrollHint.vue.d.ts +2 -2
  178. package/dist/views/production-run/shared/ui/ProductionRunTextarea.vue.d.ts +3 -3
  179. package/dist/views/receive-request/composables/netsuite-order-label.d.ts +11 -0
  180. package/dist/views/receive-request/composables/netsuite-order-label.spec.d.ts +1 -0
  181. package/dist/views/receive-request/composables/use-process-purchase-order.d.ts +1 -1
  182. package/dist/views/receive-request/composables/use-receive-request-form.d.ts +9 -9
  183. package/dist/views/receive-request/composables/use-receive-request-form.spec.d.ts +1 -0
  184. package/dist/views/receive-request/composables/use-receive-request-table.d.ts +7 -7
  185. package/dist/views/receive-request/import/export.spec.d.ts +1 -0
  186. package/dist/views/receive-request-bulk/BulkReceiveRequestPage.vue.d.ts +2 -0
  187. package/dist/views/receive-request-bulk/components/CreateTransferWizard.spec.d.ts +1 -0
  188. package/dist/views/receive-request-bulk/composables/use-bulk-receive-request-form.d.ts +20 -20
  189. package/dist/views/receive-request-bulk/composables/use-bulk-receive-request-form.readiness.spec.d.ts +1 -0
  190. package/dist/views/receive-request-bulk/composables/use-bulk-receive-request-table.d.ts +2 -2
  191. package/dist/views/recipe/components/recipe-bulk-editor/components/ModificationCard.spec.d.ts +1 -0
  192. package/dist/views/recipe/helper/bulk-edit-simulation.helper.d.ts +0 -1
  193. package/dist/views/recipe/helper/import-recipe.d.ts +32 -2
  194. package/dist/views/recipe/helper/import-recipe.spec.d.ts +1 -0
  195. package/dist/views/settings/PlanLicenseDisplay.spec.d.ts +1 -0
  196. package/dist/views/settings/PlanLicenseDisplay.vue.d.ts +2 -0
  197. package/dist/views/stock/components/StockRecordCard.spec.d.ts +1 -0
  198. package/dist/views/stock/components/StockRecordCard.vue.d.ts +19 -865
  199. package/dist/views/stock/components/dialog/AmendAdjustmentForm.spec.d.ts +1 -0
  200. package/dist/views/stock/components/dialog/BillInventoryInfoDialog.spec.d.ts +1 -0
  201. package/dist/views/stock/components/dialog/BillInventoryInfoDialog.vue.d.ts +36 -0
  202. package/dist/views/stock/components/dialog/ConvertSkuDialog.spec.d.ts +1 -0
  203. package/dist/views/stock/composables/use-last-closing-summary.d.ts +4 -0
  204. package/dist/views/stock/composables/use-last-closing-summary.spec.d.ts +1 -0
  205. package/dist/views/transfer-template/components/transfer-template-form/composables/use-transfer-template-items.spec.d.ts +1 -0
  206. package/dist/views/transfer-template/helpers/template-item.error.helper.spec.d.ts +1 -0
  207. package/dist/views/unit/composables/use-unit-form.spec.d.ts +1 -0
  208. package/dist/views/warehouse/components/WarehouseForm.vue.d.ts +2 -2
  209. package/dist/vue-CVco8McV.js +290 -0
  210. package/dist/{vue-i18n-C34f-Tph.js → vue-i18n-C443zpcA.js} +450 -450
  211. package/dist/{xlsx.util-X4amwe_k.js → xlsx.util-5_47Kslf.js} +2 -2
  212. package/package.json +71 -66
  213. package/dist/App-DVHgBTHP.js +0 -1499
  214. package/dist/BulkReceiveRequestView-DxHWrfbi.js +0 -2656
  215. package/dist/ClosingHistoryView-kdpYGy1Y.js +0 -761
  216. package/dist/DeprecateSoonWarningDialog.vue_vue_type_script_setup_true_lang-5Cc08Svt.js +0 -58
  217. package/dist/FeatureCapabilityBadge.vue_vue_type_script_setup_true_lang-C1C8aDA6.js +0 -61
  218. package/dist/FmMultiselectDialog-yVPY5aBV.js +0 -77
  219. package/dist/ImportView-DQrVMzxN.js +0 -1302
  220. package/dist/IngredientBindedItem.vue_vue_type_script_setup_true_lang-7lT5UZc8.js +0 -51
  221. package/dist/IngredientGroupView-BMUnEaY7.js +0 -1000
  222. package/dist/InventoryBindingForm.vue_vue_type_script_setup_true_lang-CaBOK7NC.js +0 -563
  223. package/dist/NumberPrecisionInput.vue_vue_type_script_setup_true_lang-DzzTPdyF.js +0 -72
  224. package/dist/ProductionRunDetailView-Cw-ecaey.js +0 -2312
  225. package/dist/ProductionRunView-C11eseXQ.js +0 -930
  226. package/dist/RecipeView-oHDWsT0P.js +0 -3624
  227. package/dist/SettingsView-QlUNwFhM.js +0 -983
  228. package/dist/StockView-a8LbVZ_7.js +0 -2614
  229. package/dist/TableActionableRow.vue_vue_type_script_setup_true_lang-DAMpuZ1X.js +0 -84
  230. package/dist/TemplatePublishDialog.vue_vue_type_script_setup_true_lang-CCCj4WVF.js +0 -299
  231. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-CFNPXqt5.js +0 -4796
  232. package/dist/TransferTemplateView-CzwxOBMQ.js +0 -2326
  233. package/dist/menu-usage-module-BdjYEk3s.js +0 -57
  234. package/dist/number-gSLvxNqA.js +0 -138
  235. package/dist/portal-feature-catalog-yGIESKTc.js +0 -246
  236. package/dist/random-CSbEbElR.js +0 -10
  237. package/dist/rules-C1btu0Md.js +0 -98
  238. package/dist/stock-BF86TMW0.js +0 -75
  239. package/dist/use-inventory-binding-dialog-Cc1tjTfV.js +0 -152
  240. package/dist/usePromise-CbVUCxhj.js +0 -29
  241. package/dist/views/ingredient-group/components/ingredient-group-dialog/IngredientGroupDialog.vue.d.ts +0 -31
  242. package/dist/views/ingredient-group/components/ingredient-group-dialog/IngredientGroupDialogProps.d.ts +0 -10
  243. package/dist/views/ingredient-group/components/ingredient-group-form/IngredientGroupForm.vue.d.ts +0 -21
  244. package/dist/views/ingredient-group/components/ingredient-group-form/IngredientGroupFormProps.d.ts +0 -12
  245. package/dist/views/ingredient-group/composables/use-ingredient-group-actions.d.ts +0 -24
  246. package/dist/views/ingredient-group/composables/use-ingredient-group-rule-item.d.ts +0 -31
  247. package/dist/views/ingredient-group/composables/use-ingredient-group-table.d.ts +0 -77
  248. package/dist/views/integration/composables/use-integration-sync-log.d.ts +0 -45
@@ -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-D38sV2ls.js";
5
+ import { F as ce } from "./FmAdminBadge-DlplQOHb.js";
6
+ import { _ as ke } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-COZPDuAM.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-BATH4SoA.js";
10
+ import { g as Se, f as we } from "./recalculationUtils-DBG8HGiJ.js";
11
+ import { u as Ve } from "./feature-CsPbMoeJ.js";
12
+ import { F as Ce } from "./FeatureCapabilityGate-DK_rTVyJ.js";
13
+ import { _ as Fe } from "./UnitDisplayControl.vue_vue_type_script_setup_true_lang-BtfJJgIP.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
+ };