@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.
Files changed (219) hide show
  1. package/dist/App-BTUjyQbn.js +1466 -0
  2. package/dist/{ApprovalView-C8_ax05b.js → ApprovalView-CTOTedxc.js} +26 -25
  3. package/dist/{BindingsDialog-t0ZY9eh5.js → BindingsDialog-C9v4TTzJ.js} +2 -2
  4. package/dist/{BindingsPicker-C0Qblmml.js → BindingsPicker-B5b0lavg.js} +8 -8
  5. package/dist/{BindingsTable-CsqUBbRA.js → BindingsTable-CQPan4pU.js} +4 -4
  6. package/dist/{BulkReceiveRequestView-DAG-TMox.js → BulkReceiveRequestView-BVrrjoYW.js} +21 -21
  7. package/dist/ChangeLocationComponent.vue_vue_type_script_setup_true_lang-D4Z56y7h.js +151 -0
  8. package/dist/{ClosingDraftView-CdKp4Ny6.js → ClosingDraftView-5ETKikfT.js} +748 -746
  9. package/dist/ClosingHistoryView-GM0DRWhq.js +769 -0
  10. package/dist/{ClosingTemplateView-C326DL4q.js → ClosingTemplateView-Czz--dWq.js} +303 -291
  11. 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
  12. package/dist/{DefaultView-CsIMmQAY.js → DefaultView-Baksd_Lk.js} +2 -2
  13. package/dist/{DeliveryOrderPrintPreview-eTrMvJzA.js → DeliveryOrderPrintPreview-CUdMQmLf.js} +9 -9
  14. package/dist/{EmailDialog.vue_vue_type_script_setup_true_lang-B7nBbxMo.js → EmailDialog.vue_vue_type_script_setup_true_lang-CDta65pB.js} +6228 -6216
  15. package/dist/FeatureCapabilityBadge.vue_vue_type_script_setup_true_lang-CrCdJfOf.js +47 -0
  16. package/dist/FeatureCapabilityGate-C34Z4k5D.js +74 -0
  17. package/dist/{FmDateRangePickerChip.vue_vue_type_script_setup_true_lang-CI2KTzDs.js → FmDateRangePickerChip.vue_vue_type_script_setup_true_lang-C43lHbmc.js} +1 -1
  18. 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
  19. package/dist/FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-UbMV3dKh.js +120 -0
  20. package/dist/{FmMultiselectDialog-CYUxtxnS.js → FmMultiselectDialog-DYM4qyMH.js} +2 -2
  21. package/dist/FmMultiselectDialog-tbS01AI7.js +123 -0
  22. package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-DOkV11NN.js → FmUnitInput.vue_vue_type_script_setup_true_lang-DaOKC6RQ.js} +72 -73
  23. package/dist/ImportView-CPf8zj0t.js +1290 -0
  24. package/dist/{IngredientsView-CZ6E7cXf.js → IngredientsView-N4CH6zdo.js} +656 -649
  25. package/dist/{IntegrationExplorerView-B15ND4Fg.js → IntegrationExplorerView-Ds5fTNi3.js} +602 -614
  26. package/dist/IntegrationPlatformView-wuOLFIQR.js +13073 -0
  27. package/dist/{IntegrationView-hkNhsqx2.js → IntegrationView-Bhxwz6Ha.js} +2956 -2922
  28. package/dist/{InventoryBindingForm-SfuUF0_O.js → InventoryBindingForm-DWm9pOH_.js} +1 -1
  29. package/dist/InventoryBindingForm.vue_vue_type_script_setup_true_lang-TvwD5HcR.js +472 -0
  30. package/dist/{InventoryBindingSummary-DUcukkyJ.js → InventoryBindingSummary-DI6H0ehi.js} +1 -1
  31. package/dist/JsonViewer.vue_vue_type_script_setup_true_lang-C_hg75l0.js +25 -0
  32. package/dist/NumberPrecisionInput.vue_vue_type_script_setup_true_lang-ngeYJhtg.js +79 -0
  33. package/dist/PlanTierBadge.vue_vue_type_script_setup_true_lang-Cr1LFRUd.js +274 -0
  34. package/dist/PlanUpgradeDialog.vue_vue_type_script_setup_true_lang-CtoPkGo2.js +79 -0
  35. package/dist/{ProductionRunDetailView-BwgRX-14.js → ProductionRunDetailView-rGGuDANE.js} +4 -4
  36. package/dist/{ProductionRunLifecycleDialogs.vue_vue_type_script_setup_true_lang-BbNXNhpr.js → ProductionRunLifecycleDialogs.vue_vue_type_script_setup_true_lang-CTseB9Sn.js} +9 -9
  37. package/dist/{ProductionRunView-CZU7LY9-.js → ProductionRunView-BLBIYhKd.js} +16 -15
  38. package/dist/{PublishView-DS2FZ66p.js → PublishView-D_H_LAq2.js} +3 -3
  39. package/dist/{PurchaseOrderPrintPreview-CZa0MVAs.js → PurchaseOrderPrintPreview-DZy57dQ6.js} +7 -7
  40. package/dist/{ReceiveRequestView-Bk5b3nVB.js → ReceiveRequestView-qFQPah64.js} +15 -15
  41. package/dist/RecipeView-BPQ_MlxJ.js +3440 -0
  42. package/dist/SettingsView-DF_HGtkr.js +1032 -0
  43. package/dist/StockView-De_R8pxv.js +2651 -0
  44. package/dist/{SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-DdZg9T4n.js → SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-B3tBgcH7.js} +1 -1
  45. package/dist/{SupplierView-D8q6siZW.js → SupplierView-DvvB_Nn0.js} +577 -571
  46. package/dist/{SurchargeView-Db_5YFoR.js → SurchargeView-6gQPyGqi.js} +7 -7
  47. package/dist/{SystemTrailDialog.vue_vue_type_script_setup_true_lang-WOVs4Fr1.js → SystemTrailDialog.vue_vue_type_script_setup_true_lang-D6gnQpe-.js} +2 -2
  48. package/dist/TableActionableRow.vue_vue_type_script_setup_true_lang-gJQQKKAC.js +71 -0
  49. package/dist/{TemplatePublishDialog.vue_vue_type_script_setup_true_lang-BtoP4XgE.js → TemplatePublishDialog.vue_vue_type_script_setup_true_lang-CiuRBHBL.js} +1 -1
  50. 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
  51. package/dist/TransferTemplateView-Dcc9K-AJ.js +2343 -0
  52. package/dist/{UnitCostHistoryView-BqDiQ4IE.js → UnitCostHistoryView-e1MYu0_N.js} +4 -4
  53. package/dist/{UnitDisplayControl.vue_vue_type_script_setup_true_lang-BjSmg5LX.js → UnitDisplayControl.vue_vue_type_script_setup_true_lang-DQWOi2ol.js} +4 -4
  54. package/dist/{UnitView-CM695-VI.js → UnitView-BaLqtGk3.js} +84 -84
  55. package/dist/{WarehouseView-BdidU4p6.js → WarehouseView-CKYdpZoP.js} +194 -189
  56. package/dist/{WastageTemplateView-DdhwdXT6.js → WastageTemplateView-DazO6lu1.js} +19 -18
  57. package/dist/api/feature-flags.d.ts +12 -0
  58. package/dist/api/integration-sync-log.d.ts +0 -13
  59. package/dist/api/inventory.d.ts +9 -9
  60. package/dist/api/license.d.ts +8 -0
  61. package/dist/{app-Cb5s4jMu.js → app-ZyQBMnlh.js} +6102 -6066
  62. package/dist/app.d.ts +36 -150
  63. package/dist/app.js +1 -1
  64. package/dist/{closing-template-DnqnpXxn.js → closing-template-BZfYcHAK.js} +1 -1
  65. package/dist/components/ChangeLocationComponent.vue.d.ts +21 -14
  66. package/dist/components/DeprecateSoonWarningDialog.vue.d.ts +22 -0
  67. package/dist/components/FeatureCapabilityBadge.vue.d.ts +29 -0
  68. package/dist/components/FeatureCapabilityGate.spec.d.ts +1 -0
  69. package/dist/components/FeatureCapabilityGate.vue.d.ts +29 -0
  70. package/dist/components/FmUnitInputRules.d.ts +1 -1
  71. package/dist/components/MultiLocationSelector.vue.d.ts +6 -6
  72. package/dist/components/NumberPrecisionInput.spec.d.ts +1 -0
  73. package/dist/components/{PremiumBadge.vue.d.ts → PlanTierBadge.vue.d.ts} +5 -13
  74. package/dist/components/PlanUpgradeDialog.vue.d.ts +30 -0
  75. package/dist/composable/useNavigationMenu.d.ts +2 -1
  76. package/dist/{date2-BPhD_1Of.js → date2-CtVXF-Pl.js} +1 -1
  77. package/dist/{dayjs.min-Zbd6-uVD.js → dayjs.min-BG2xA9Zk.js} +1 -1
  78. package/dist/{decimal-Df6a50Ld.js → decimal-C0ERI9wc.js} +2 -2
  79. package/dist/{defineDeepModel-Brbsikbi.js → defineDeepModel-CAK0Fghp.js} +6 -6
  80. package/dist/{duplicate-template-B9kuShaF.js → duplicate-template-DwAQVTH7.js} +1 -1
  81. package/dist/{inventory-core-dart.default-DDRxXXnt.js → feature-1IL43YWw.js} +766 -398
  82. package/dist/feature-flags/core.d.ts +28 -0
  83. package/dist/feature-flags/core.spec.d.ts +1 -0
  84. package/dist/feature-flags/navigation-capabilities.d.ts +23 -0
  85. package/dist/feature-flags/navigation-capabilities.spec.d.ts +1 -0
  86. package/dist/feature-flags/plan-tier.d.ts +6 -0
  87. package/dist/feature-flags/plan-tier.spec.d.ts +1 -0
  88. package/dist/feature-flags/portal-feature-catalog.d.ts +19 -0
  89. package/dist/feature-flags/portal-feature-catalog.spec.d.ts +1 -0
  90. package/dist/feature-flags/vue.d.ts +16 -0
  91. package/dist/feature-flags/vue.spec.d.ts +1 -0
  92. package/dist/{format-time-from-id-DmUjUcVj.js → format-time-from-id-QIs7t8ML.js} +1 -1
  93. package/dist/{format-unit-display-CsQA0SQd.js → format-unit-display-DiTPPgut.js} +118 -119
  94. package/dist/helper/menu-usage-module.d.ts +1 -1
  95. package/dist/helper/number.d.ts +5 -1
  96. package/dist/helper/rules.d.ts +1 -1
  97. package/dist/id-to-date-DcuC_yKQ.js +67 -0
  98. package/dist/{import-export.helper-DCQ6oX9s.js → import-export.helper-grsZqa63.js} +16 -17
  99. package/dist/{JsonViewer.vue_vue_type_script_setup_true_lang-ig2zSXAB.js → index-C25C1Dg7.js} +1074 -1066
  100. package/dist/{index-UmM6gHJ1.js → index-DN5mjbXr.js} +1 -1
  101. package/dist/{index-C-mazZwS.js → index-DdSQrnuw.js} +3 -3
  102. package/dist/index-eGvSlWMU.js +1892 -0
  103. package/dist/{index-BXaIMGnI.js → index-twVxfWIB.js} +190 -190
  104. package/dist/{lz-string-Bibw5D_6.js → lz-string-DrKhkO_Q.js} +1 -1
  105. package/dist/{netsuite-Bev0OtQT.js → netsuite-C_EH9MVy.js} +9 -3
  106. package/dist/{predefined-templates-BHvUnTk_.js → predefined-templates-mWX1M2Dn.js} +1 -1
  107. package/dist/{purchase-order-template-DgOKEzhS.js → purchase-order-template-DZ3DsIUr.js} +1 -1
  108. package/dist/{recalculationUtils-Dv__DzZh.js → recalculationUtils-BZ5ccSeX.js} +1 -1
  109. package/dist/router/name.d.ts +2 -2
  110. package/dist/{row-action.enum-ncgDYAjP.js → row-action.enum-B2z1DXD9.js} +2 -2
  111. package/dist/rules-BpTWt_Y_.js +238 -0
  112. package/dist/stock-BO2mbTLO.js +74 -0
  113. package/dist/{stock-CxCRZo_D.js → stock-D9dhzEKk.js} +1 -1
  114. package/dist/stores/feature.d.ts +20 -2
  115. package/dist/stores/integration/netsuite.d.ts +2 -2
  116. package/dist/stores/inventory.d.ts +0 -47
  117. package/dist/stores/inventory.no-location.spec.d.ts +1 -0
  118. package/dist/stores/location.d.ts +42 -42
  119. package/dist/stores/supplier.d.ts +49 -49
  120. package/dist/stores/warehouse.d.ts +1 -1
  121. package/dist/style.css +1 -1
  122. package/dist/{supplier-CkZdeMcl.js → supplier-C-Ra1omj.js} +2 -2
  123. package/dist/{surcharge-FRSFqjGl.js → surcharge-BFDrFP1T.js} +1 -1
  124. package/dist/tsconfig.app.tsbuildinfo +1 -1
  125. package/dist/{uom-rules-Cm1styDr.js → uom-rules-B8pou4DQ.js} +1 -1
  126. package/dist/{use-ingredient-select-dialog-ntAqHX04.js → use-ingredient-select-dialog-DJvcL3EP.js} +2 -2
  127. package/dist/use-inventory-binding-dialog-DQBcnw0G.js +113 -0
  128. package/dist/{use-template-enabled-locations-CIZqw-Z8.js → use-template-enabled-locations-CSgJma2Z.js} +2 -2
  129. package/dist/{use-transfer-locations-CM5vNttA.js → use-transfer-locations-CkeJ5Nng.js} +14 -14
  130. package/dist/{useHrmPermission-CslLuBoP.js → useHrmPermission-BDc1xULx.js} +1 -1
  131. package/dist/useNavigationMenu-B7jkRkTi.js +346 -0
  132. package/dist/{useSseClient-CCV4mPzD.js → useSseClient-Bxl6D4Xs.js} +1 -1
  133. package/dist/views/adjustment-template/wastage-template/actions.d.ts +36 -36
  134. package/dist/views/adjustment-template/wastage-template/table.d.ts +36 -36
  135. package/dist/views/closing-draft/components/closing-draft-dialog/ClosingDraftApprovalDialog.vue.d.ts +6 -6
  136. package/dist/views/closing-draft/components/closing-draft-dialog/ClosingDraftDialog.vue.d.ts +12 -12
  137. package/dist/views/closing-draft/components/closing-draft-groups/ClosingGroupDetailSideSheet.vue.d.ts +6 -6
  138. package/dist/views/closing-draft/composables/use-closing-draft-import.d.ts +3 -3
  139. package/dist/views/closing-draft/composables/use-closing-draft-table.d.ts +18 -18
  140. package/dist/views/closing-template/composables/use-closing-template-actions.d.ts +45 -45
  141. package/dist/views/closing-template/composables/use-closing-template-table.d.ts +36 -36
  142. package/dist/views/ingredients/components/inventory-binding/InventoryBindingForm.vue.d.ts +0 -1
  143. package/dist/views/ingredients/components/inventory-binding/composables/use-inventory-binding-dialog.d.ts +0 -1
  144. package/dist/views/ingredients/components/inventory-binding/recipe-amount-validation.spec.d.ts +1 -0
  145. package/dist/views/ingredients/components/inventory-binding/v2/InventoryBindingFormV2.vue.d.ts +0 -1
  146. package/dist/views/ingredients/components/inventory-binding/v2/composables/use-inventory-binding-dialog.d.ts +0 -1
  147. package/dist/views/ingredients/helper/is-linked-ingredient-error.d.ts +1 -1
  148. package/dist/{components/PreviewBadge.vue.d.ts → views/integration/IntegrationPlatformView.vue.d.ts} +11 -13
  149. package/dist/views/integration/components/IntegrationCard.vue.d.ts +38 -0
  150. package/dist/views/integration/components/Synergy/importFn.spec.d.ts +1 -0
  151. package/dist/views/integration/components/Xilnex/importFn.spec.d.ts +1 -0
  152. package/dist/views/integration/components/netsuite/business/AddLocationDialog.vue.d.ts +36 -36
  153. package/dist/views/integration/components/netsuite/business/AddVendorDialog.vue.d.ts +24 -24
  154. package/dist/views/integration/helper/opening-balance.d.ts +22 -0
  155. package/dist/views/integration/helper/opening-balance.spec.d.ts +1 -0
  156. package/dist/views/receive-request/components/transfer-form/TransferFormWithController.vue.d.ts +5 -5
  157. package/dist/views/receive-request/composables/netsuite-order-label.d.ts +11 -0
  158. package/dist/views/receive-request/composables/netsuite-order-label.spec.d.ts +1 -0
  159. package/dist/views/receive-request/composables/use-process-purchase-order.d.ts +5 -5
  160. package/dist/views/receive-request/composables/use-receive-request-form.d.ts +39 -39
  161. package/dist/views/receive-request/composables/use-receive-request-table.d.ts +35 -35
  162. package/dist/views/receive-request/import/export.spec.d.ts +1 -0
  163. package/dist/views/receive-request-bulk/composables/use-bulk-receive-request-form.d.ts +34 -34
  164. package/dist/views/receive-request-bulk/composables/use-bulk-receive-request-table.d.ts +6 -6
  165. package/dist/views/recipe/components/recipe-bulk-editor/components/ModificationCard.spec.d.ts +1 -0
  166. package/dist/views/recipe/helper/bulk-edit-simulation.helper.d.ts +0 -1
  167. package/dist/views/recipe/helper/import-recipe.d.ts +2 -2
  168. package/dist/views/recipe/helper/import-recipe.spec.d.ts +1 -0
  169. package/dist/views/{ingredient-group/IngredientGroupView.vue.d.ts → settings/FeatureFlagView.vue.d.ts} +0 -1
  170. package/dist/views/settings/PlanLicenseDisplay.spec.d.ts +1 -0
  171. package/dist/views/{integration/components/IntegrationSyncLogTab.vue.d.ts → settings/PlanLicenseDisplay.vue.d.ts} +2 -2
  172. package/dist/views/stock/components/dialog/AmendAdjustmentForm.spec.d.ts +1 -0
  173. package/dist/views/stock/components/dialog/ConvertSkuDialog.spec.d.ts +1 -0
  174. package/dist/views/supplier/components/SupplierForm.vue.d.ts +4 -4
  175. package/dist/views/supplier/composables/use-supplier-table.d.ts +2 -2
  176. package/dist/views/transfer-template/components/transfer-template-dialog/TransferTemplateDialog.vue.d.ts +8 -8
  177. package/dist/views/transfer-template/components/transfer-template-form/composables/use-transfer-locations.d.ts +4 -4
  178. package/dist/views/transfer-template/components/transfer-template-form/composables/use-transfer-template-items.spec.d.ts +1 -0
  179. package/dist/views/transfer-template/composables/use-template-item-bulk-editor.d.ts +24 -24
  180. package/dist/views/transfer-template/composables/use-transfer-template-actions.d.ts +48 -48
  181. package/dist/views/transfer-template/composables/use-transfer-template-table.d.ts +48 -48
  182. package/dist/views/warehouse/components/WarehouseForm.vue.d.ts +2 -2
  183. package/dist/{vue-i18n-C5j4EQhi.js → vue-i18n-gaCwgS41.js} +355 -355
  184. package/dist/{xlsx.util-B50OvX4z.js → xlsx.util-lW-27xp-.js} +2 -2
  185. package/package.json +71 -66
  186. package/dist/App-BXgpGzGR.js +0 -1476
  187. package/dist/ClosingHistoryView-Blyq9-BS.js +0 -761
  188. package/dist/FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-zcEv1Swg.js +0 -243
  189. package/dist/FmMultiselectDialog-BAw-gp5K.js +0 -77
  190. package/dist/ImportView-BmotFC-3.js +0 -1302
  191. package/dist/IngredientBindedItem.vue_vue_type_script_setup_true_lang-DVCCpvS4.js +0 -51
  192. package/dist/IngredientGroupView-qrR9ksEn.js +0 -985
  193. package/dist/InventoryBindingForm.vue_vue_type_script_setup_true_lang-Zq81p_MF.js +0 -563
  194. package/dist/NumberPrecisionInput.vue_vue_type_script_setup_true_lang-BmfROiLM.js +0 -72
  195. package/dist/PremiumBadge.vue_vue_type_script_setup_true_lang-3e3kDsbN.js +0 -93
  196. package/dist/PreviewBadge.vue_vue_type_script_setup_true_lang-DX2MJqL4.js +0 -29
  197. package/dist/RecipeView-DvI6X-uN.js +0 -3625
  198. package/dist/SettingsView-sThYErMz.js +0 -698
  199. package/dist/StockView-Z9wGihT7.js +0 -2612
  200. package/dist/TableActionableRow.vue_vue_type_script_setup_true_lang-DAMpuZ1X.js +0 -84
  201. package/dist/TransferTemplateView-DtsJzmUr.js +0 -2327
  202. package/dist/feature-Ckn5ra3z.js +0 -1136
  203. package/dist/number-y_W4pn_d.js +0 -138
  204. package/dist/random-CSbEbElR.js +0 -10
  205. package/dist/rules-CZTBvenw.js +0 -98
  206. package/dist/stock-XINW8JOM.js +0 -75
  207. package/dist/use-inventory-binding-dialog-DVIJO8Cl.js +0 -152
  208. package/dist/useNavigationMenu-CSinmNCY.js +0 -172
  209. package/dist/usePromise-CbVUCxhj.js +0 -29
  210. package/dist/views/ingredient-group/components/ingredient-group-dialog/IngredientGroupDialog.vue.d.ts +0 -31
  211. package/dist/views/ingredient-group/components/ingredient-group-dialog/IngredientGroupDialogProps.d.ts +0 -10
  212. package/dist/views/ingredient-group/components/ingredient-group-form/IngredientGroupForm.vue.d.ts +0 -21
  213. package/dist/views/ingredient-group/components/ingredient-group-form/IngredientGroupFormProps.d.ts +0 -12
  214. package/dist/views/ingredient-group/components/ingredient-group-rule-field/IngredientGroupRuleField.vue.d.ts +0 -37
  215. package/dist/views/ingredient-group/composables/use-ingredient-group-actions.d.ts +0 -24
  216. package/dist/views/ingredient-group/composables/use-ingredient-group-rule-item.d.ts +0 -31
  217. package/dist/views/ingredient-group/composables/use-ingredient-group-table.d.ts +0 -77
  218. package/dist/views/integration/composables/use-integration-sync-log.d.ts +0 -45
  219. /package/dist/components/{FmFeatureFlagDialog.vue.d.ts → DeprecateSoonPill.vue.d.ts} +0 -0
@@ -1,985 +0,0 @@
1
- import { ref as A, computed as G, h as C, defineComponent as j, watch as re, resolveComponent as R, createElementBlock as B, openBlock as F, createVNode as b, createElementVNode as c, unref as i, toDisplayString as $, createBlock as M, withCtx as T, Fragment as pe, renderList as ve, createTextVNode as ye, createCommentVNode as se, isRef as ge, normalizeClass as _e, normalizeStyle as be, createSlots as ke, Teleport as xe, normalizeProps as he, guardReactiveProps as we } from "vue";
2
- import { a as L, c as P, j as oe, u as Re } from "./app-Cb5s4jMu.js";
3
- import { useDialog as Ie, useSnackbar as Y, components as U, useProxiedModel as Se, useBreakpoints as Fe } from "@feedmepos/ui-library";
4
- import { F as S } from "./form-mode.enum-BKiNVH6A.js";
5
- import { useI18n as z, useCoreStore as Ge } from "@feedmepos/mf-common";
6
- import { defineStore as ue, storeToRefs as ae } from "pinia";
7
- import { D as ie, R as K } from "./row-action.enum-ncgDYAjP.js";
8
- import { c as Ve } from "./component-BmLAdDiY.js";
9
- import { u as Ce, _ as De } from "./SingleColumnLayout.vue_vue_type_script_setup_true_lang-DpwneGOV.js";
10
- import { _ as Ae, F as le } from "./TableActionableRow.vue_vue_type_script_setup_true_lang-DAMpuZ1X.js";
11
- import { _ as $e } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-zcEv1Swg.js";
12
- import { d as de } from "./defineDeepModel-Brbsikbi.js";
13
- import { I as Te, A as Ee, U as Me, R as ce } from "./rules-CZTBvenw.js";
14
- import { L as Ue, P as Be, D as Pe } from "./app-C39bYJmq.js";
15
- import { u as Le } from "./FmMultiselectDialog-BAw-gp5K.js";
16
- import { r as me } from "./random-CSbEbElR.js";
17
- import { u as ze, R as Ne } from "./usePromise-CbVUCxhj.js";
18
- const H = ue(
19
- "ingredientGroupactions",
20
- function() {
21
- const _ = Ie(), f = Y(), k = L(), { t: l } = z(), v = A();
22
- function e() {
23
- const u = {
24
- modelValue: {},
25
- mode: S.CREATE,
26
- show: !0,
27
- "onUpdate:show"(m) {
28
- v.value.show = m;
29
- }
30
- };
31
- v.value = u;
32
- }
33
- async function a(u) {
34
- const m = {
35
- modelValue: P(u),
36
- mode: S.UPDATE,
37
- show: !0,
38
- "onUpdate:show"(r) {
39
- v.value.show = r;
40
- }
41
- };
42
- v.value = m;
43
- }
44
- async function t(u, m, r) {
45
- m.value = !0;
46
- try {
47
- await k.deleteSkuGroup(u), f.open({
48
- title: "Success",
49
- message: `Deleted ${u.name}`,
50
- type: "success"
51
- });
52
- } catch (y) {
53
- f.open({
54
- title: `Cannot delete ${u.name}`,
55
- message: "Please try again.",
56
- type: "error"
57
- }), console.error("failed to delete ingredient", y);
58
- } finally {
59
- m.value = !1, r();
60
- }
61
- }
62
- function n(u, m, r) {
63
- _.open({
64
- title: l("inventory.ingredient.delete.title", [(u == null ? void 0 : u.name) ?? ""]),
65
- closeButton: !1,
66
- message: l("inventory.ingredient.delete.message"),
67
- primaryActions: {
68
- text: l("common.delete"),
69
- close: !0,
70
- variant: "destructive"
71
- },
72
- secondaryActions: {
73
- text: l("common.cancel"),
74
- close: !0
75
- }
76
- }).onPrimary(() => t(u, m, r));
77
- }
78
- function s() {
79
- }
80
- function g() {
81
- }
82
- return {
83
- createIngredientGroup: e,
84
- updateIngredientGroup: a,
85
- deleteIngredientGroup: n,
86
- importIngredientGroups: s,
87
- exportIngredientGroups: g,
88
- ingredientGroupDialogProps: v
89
- };
90
- }
91
- ), Oe = ue(
92
- "ingredientGroupTable",
93
- function() {
94
- const _ = A(!1), f = Y(), k = L(), l = H();
95
- async function v() {
96
- _.value = !0;
97
- try {
98
- await k.readInventory();
99
- } catch (t) {
100
- console.error("error on reading inventory", t), f.open({
101
- title: "Error",
102
- message: "Something went wrong, please try again.",
103
- type: "error"
104
- });
105
- } finally {
106
- _.value = !1;
107
- }
108
- }
109
- function e(t, n) {
110
- switch (n = P(n), t) {
111
- case K.Edit:
112
- return l.updateIngredientGroup(n);
113
- case K.Delete:
114
- return l.deleteIngredientGroup(
115
- n,
116
- _,
117
- () => v()
118
- );
119
- }
120
- }
121
- const a = G(() => [
122
- {
123
- accessorKey: "name",
124
- header: () => "Name"
125
- },
126
- {
127
- accessorKey: "skuRefs.length",
128
- header: () => "No. of items"
129
- },
130
- {
131
- accessorKey: "ref",
132
- header: () => "Reference"
133
- },
134
- {
135
- id: "action",
136
- header: "",
137
- cell(t) {
138
- return Ve(
139
- [ie[K.Edit], ie[K.Delete]],
140
- (n) => {
141
- e(n, t.row.original);
142
- }
143
- );
144
- },
145
- enableSorting: !1,
146
- size: 40,
147
- meta: {
148
- cellClass: "",
149
- headerClass: ""
150
- }
151
- }
152
- ]);
153
- return {
154
- fetchIngredientGroups: v,
155
- loading: _,
156
- columnDefs: a
157
- };
158
- }
159
- );
160
- function qe(o) {
161
- return {
162
- addItem: () => {
163
- const l = o.create();
164
- o.items = [...o.items, l];
165
- },
166
- updateItem: (l) => {
167
- l && (o.items = o.items.map(
168
- (v) => o.id(v) === o.id(l) ? l : v
169
- ));
170
- },
171
- removeItem: (l) => {
172
- o.items = o.items.filter((v) => o.id(v) !== o.id(l));
173
- }
174
- };
175
- }
176
- function fe(o) {
177
- const _ = Le(), f = L(), k = G(() => [
178
- {
179
- id: "delete",
180
- header: "",
181
- cell(e) {
182
- const a = e.row.original;
183
- return C(
184
- "div",
185
- { class: "w-full flex justify-end" },
186
- C(U.FmButton, {
187
- class: "delete-button",
188
- key: a._id,
189
- type: "button",
190
- icon: "delete",
191
- variant: "tertiary",
192
- size: "md",
193
- disabled: o.disabled ?? !1,
194
- onClick: () => {
195
- o.skuRefs = o.skuRefs.filter((t) => t._id !== a._id);
196
- }
197
- })
198
- );
199
- },
200
- enableSorting: !1,
201
- size: 40,
202
- meta: {
203
- cellClass: "",
204
- headerClass: ""
205
- }
206
- },
207
- {
208
- id: "skuRef",
209
- header: () => "Ingredient",
210
- accessorFn: (e) => {
211
- var a, t;
212
- return `${((a = f.skuById[e._id]) == null ? void 0 : a.name) ?? ""} (${((t = f.skuById[e._id]) == null ? void 0 : t.code) ?? ""})`;
213
- },
214
- cell: ({ row: e }) => {
215
- const a = f.skuById[e.original._id];
216
- return C(
217
- "div",
218
- {
219
- class: "w-full flex flex-col"
220
- },
221
- [
222
- C("div", { class: "fm-typo-en-body-lg-400 line-clamp-1" }, a.name),
223
- C(
224
- "div",
225
- { class: "fm-typo-en-body-md-400 line-clamp-1 text-fm-color-typo-secondary" },
226
- a.code
227
- )
228
- ]
229
- );
230
- },
231
- size: "auto",
232
- enableSorting: !1
233
- },
234
- {
235
- id: "unit",
236
- header: () => "Unit",
237
- accessorFn: (e) => {
238
- const a = f.skuById[e._id];
239
- return a.unit.measurements.computeFirst(
240
- (t) => t.id === e.trackingMeasurement ? t.name : null
241
- ) ?? a.unit.name;
242
- },
243
- enableSorting: !1
244
- },
245
- {
246
- id: "unitOption",
247
- header: () => "Unit",
248
- accessorKey: "trackingMeasurement",
249
- cell(e) {
250
- const a = f.skuById[e.row.original._id];
251
- if (!a) return null;
252
- const t = [
253
- {
254
- label: a.unit.name,
255
- sublabel: a.unit.abbrev,
256
- value: null
257
- },
258
- ...a.unit.measurements.map((n) => ({
259
- label: n.name,
260
- sublabel: n.abbrev,
261
- value: n.id
262
- }))
263
- ].filter((n) => !n.label.toLowerCase().includes("inactive"));
264
- return C(U.FmSelect, {
265
- modelValue: e.row.original.trackingMeasurement ?? null,
266
- items: t,
267
- disabled: o.disabled ?? !1,
268
- "onUpdate:modelValue": (n) => {
269
- o.skuRefs = o.skuRefs.map((s) => s._id === e.row.original._id ? { ...s, trackingMeasurement: n } : s);
270
- }
271
- });
272
- },
273
- enableSorting: !1
274
- },
275
- {
276
- id: "priority",
277
- header: () => "Priority",
278
- accessorKey: "priority",
279
- enableSorting: !0,
280
- cell(e) {
281
- const a = e.row.original;
282
- return C(U.FmTextField, {
283
- modelValue: a.priority ?? e.row.index + 1,
284
- rules: [
285
- Te(),
286
- Ee(1),
287
- Me(
288
- o.skuRefs.filter((t) => t._id !== a._id).map((t) => {
289
- const n = f.skuById[t._id];
290
- return {
291
- label: n == null ? void 0 : n.name,
292
- value: t.priority
293
- };
294
- })
295
- )
296
- ],
297
- "onUpdate:modelValue": (t) => {
298
- const n = Number(t);
299
- isNaN(n) || (o.skuRefs = o.skuRefs.map((s) => s._id === e.row.original._id ? { ...s, priority: n } : s));
300
- }
301
- });
302
- }
303
- },
304
- {
305
- id: "default",
306
- header: () => "",
307
- accessorKey: "default",
308
- cell(e) {
309
- const a = f.skuById[e.row.original._id];
310
- return a ? C(U.FmCheckbox, {
311
- modelValue: e.row.original.default ?? !1,
312
- value: a._id,
313
- disabled: o.disabled ?? !1,
314
- "onUpdate:modelValue": () => {
315
- o.skuRefs = o.skuRefs.map((t) => t._id === e.row.original._id ? { ...t, default: !0 } : { ...t, default: !1 });
316
- }
317
- }) : null;
318
- },
319
- enableSorting: !1,
320
- size: 40,
321
- meta: {
322
- cellClass: "",
323
- headerClass: ""
324
- }
325
- },
326
- {
327
- id: "move",
328
- header: "",
329
- cell(e) {
330
- const a = e.row.original;
331
- return C("div", { class: "w-full flex justify-end" }, [
332
- C(U.FmButton, {
333
- key: a._id,
334
- type: "button",
335
- icon: "keyboard_arrow_up",
336
- variant: "tertiary",
337
- size: "md",
338
- disabled: o.disabled ?? !1,
339
- onClick: () => {
340
- const t = [...o.skuRefs], n = t.findIndex((s) => s._id === a._id);
341
- if (n > 0) {
342
- const s = t[n - 1];
343
- t[n - 1] = a, t[n] = s;
344
- }
345
- o.skuRefs = [...t];
346
- }
347
- }),
348
- C(U.FmButton, {
349
- key: a._id,
350
- type: "button",
351
- icon: "keyboard_arrow_down",
352
- variant: "tertiary",
353
- size: "md",
354
- disabled: o.disabled ?? !1,
355
- onClick: () => {
356
- const t = [...o.skuRefs], n = t.findIndex((s) => s._id === a._id);
357
- if (n < t.length - 1) {
358
- const s = t[n + 1];
359
- t[n + 1] = a, t[n] = s;
360
- }
361
- o.skuRefs = [...t];
362
- }
363
- })
364
- ]);
365
- },
366
- enableSorting: !1,
367
- size: 40,
368
- meta: {
369
- cellClass: "",
370
- headerClass: ""
371
- }
372
- }
373
- ]);
374
- return {
375
- get columnDefs() {
376
- return k.value;
377
- },
378
- promptAddIngredient: async () => {
379
- if (!o.isDefaultList && !o.allowOverride)
380
- return _.alert("Not allowed", "You cannot add ingredients to this list.");
381
- const v = f.skus.map((t) => ({
382
- label: t.name,
383
- sublabel: t.code,
384
- value: t._id
385
- })), e = (o.skuRefs ?? []).map((t) => t._id), a = await _.multiSelect(v, e, (t) => {
386
- var s, g, u, m, r, y;
387
- const n = (s = o.skuRefs) == null ? void 0 : s.findIndex((w) => w._id === t);
388
- return {
389
- _id: t,
390
- trackingMeasurement: typeof n != "number" || n == -1 ? (g = f.skuById[t]) == null ? void 0 : g.trackingMeasurement : (m = (u = o.skuRefs) == null ? void 0 : u[n]) == null ? void 0 : m.trackingMeasurement,
391
- priority: ((y = (r = o.skuRefs) == null ? void 0 : r[n]) == null ? void 0 : y.priority) ?? o.skuRefs.length,
392
- default: !1
393
- };
394
- });
395
- o.skuRefs = a ?? o.skuRefs;
396
- },
397
- columnVisibility: {
398
- delete: o.isDefaultList || !!o.allowOverride,
399
- unit: !o.isDefaultList && !o.allowOverride,
400
- unitOption: o.isDefaultList || !!o.allowOverride,
401
- // previous demo: sort priority by moving sku element in the array,
402
- // new demo: sort priority using priority field.
403
- // can reenable if this use case is requested to be restored
404
- move: !1
405
- }
406
- };
407
- }
408
- const Ke = { class: "flex flex-col gap-16" }, je = { class: "flex flex-col" }, He = { class: "flex flex-col gap-4" }, Ye = { class: "flex flex-col gap-16" }, Je = { class: "flex flex-col" }, Qe = { class: "flex flex-col gap-4" }, We = { class: "flex-1 fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Xe = /* @__PURE__ */ j({
409
- __name: "IngredientGroupRuleField",
410
- props: {
411
- disabled: { type: Boolean },
412
- modelValue: {}
413
- },
414
- setup(o) {
415
- const _ = o, { t: f } = z(), k = Ge(), l = G(() => {
416
- var g;
417
- const n = /* @__PURE__ */ new Map(), s = k.restaurants.value.map((u) => u.customAttributes ?? {});
418
- for (const u of s)
419
- for (const [m, r] of Object.entries(u))
420
- n.has(m) || n.set(m, /* @__PURE__ */ new Set()), r && ((g = n.get(m)) == null || g.add(r));
421
- return n;
422
- }), v = G(() => [
423
- ...[...l.value.entries()].map(([s, g]) => ({
424
- type: "string",
425
- key: s,
426
- entity: "restaurant",
427
- values: [...g]
428
- }))
429
- ]), e = de("modelValue", {
430
- get default() {
431
- return {
432
- _id: `skuGroupRule_${(/* @__PURE__ */ new Date()).toISOString()}_${me(4)}`,
433
- name: "",
434
- rule: null,
435
- skuRefs: []
436
- };
437
- },
438
- watchProps: !0
439
- }), a = A(e.rule ? Ue.build(e.rule) : null);
440
- re(
441
- a,
442
- (n) => {
443
- e.rule = n ? Be.build(n) : null;
444
- },
445
- { deep: !0, immediate: !0 }
446
- );
447
- const t = fe({
448
- get disabled() {
449
- return _.disabled ?? !1;
450
- },
451
- get skuRefs() {
452
- return e.skuRefs ?? [];
453
- },
454
- set skuRefs(n) {
455
- e.skuRefs = n;
456
- },
457
- isDefaultList: !1,
458
- allowOverride: !1
459
- });
460
- return (n, s) => {
461
- const g = R("FmTextField"), u = R("FmLabel"), m = R("FmFormGroup"), r = R("FmTable");
462
- return F(), B("div", Ke, [
463
- b(g, {
464
- modelValue: i(e).name,
465
- "onUpdate:modelValue": s[0] || (s[0] = (y) => i(e).name = y),
466
- label: i(f)("inventory.ingredientGroup.form.rules.name"),
467
- "label-mark": "required",
468
- rules: [i(ce)()]
469
- }, null, 8, ["modelValue", "label", "rules"]),
470
- c("div", je, [
471
- c("div", He, [
472
- b(u, {
473
- label: i(f)("inventory.ingredientGroup.form.rules.title"),
474
- required: ""
475
- }, null, 8, ["label"]),
476
- b(i(Pe), {
477
- modelValue: a.value,
478
- "onUpdate:modelValue": s[1] || (s[1] = (y) => a.value = y),
479
- attributes: v.value
480
- }, null, 8, ["modelValue", "attributes"])
481
- ]),
482
- b(m, {
483
- "model-value": a.value,
484
- rules: [
485
- (y) => {
486
- var w;
487
- return !!((w = y == null ? void 0 : y.rules) != null && w.length) || "At least one rule is required";
488
- }
489
- ]
490
- }, null, 8, ["model-value", "rules"])
491
- ]),
492
- c("div", Ye, [
493
- c("div", Je, [
494
- c("div", Qe, [
495
- c("div", null, [
496
- b(u, {
497
- label: i(f)("inventory.ingredientGroup.form.rules.ingredients"),
498
- required: ""
499
- }, null, 8, ["label"])
500
- ])
501
- ]),
502
- b(m, {
503
- "model-value": i(e).skuRefs,
504
- rules: [
505
- (y) => !!(y != null && y.length) || "At least one ingredient is required"
506
- ]
507
- }, null, 8, ["model-value", "rules"])
508
- ]),
509
- b(r, {
510
- "row-data": i(e).skuRefs,
511
- "column-defs": i(t).columnDefs,
512
- "page-size": i(e).skuRefs.length,
513
- "shrink-at": 9999,
514
- "column-visibility": i(t).columnVisibility,
515
- "hide-footer": ""
516
- }, null, 8, ["row-data", "column-defs", "page-size", "column-visibility"])
517
- ]),
518
- c("div", We, $(i(f)("inventory.ingredientGroup.form.defaultRule.defaultCheckbox")), 1)
519
- ]);
520
- };
521
- }
522
- }), Ze = { class: "flex flex-col gap-16" }, et = { class: "flex flex-col gap-16" }, tt = { class: "flex flex-col" }, nt = { class: "flex items-center" }, st = { class: "flex-1" }, ot = { class: "flex flex-col gap-8" }, at = { class: "flex-1 fm-typo-en-title-sm-600" }, it = { class: "flex-1 fm-typo-en-body-md-400 text-fm-color-typo-secondary px-4" }, lt = { class: "flex flex-col gap-16" }, rt = { class: "flex flex-col gap-8" }, ut = { class: "flex-1 fm-typo-en-title-sm-600" }, dt = { class: "flex-1 fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, ct = { class: "flex flex-col gap-12" }, mt = { class: "flex items-center" }, ft = { class: "flex-1 fm-typo-en-body-lg-600 line-clamp-1" }, pt = { key: 0 }, vt = {
523
- key: 1,
524
- class: "fm-typo-en-body-lg-400"
525
- }, yt = /* @__PURE__ */ j({
526
- __name: "IngredientGroupForm",
527
- props: {
528
- mode: {},
529
- disabled: { type: Boolean },
530
- modelValue: {},
531
- menu: {}
532
- },
533
- emits: ["validation-success"],
534
- setup(o, { expose: _, emit: f }) {
535
- const k = o, l = de("modelValue", {
536
- watchProps: !0
537
- }), v = f, { t: e } = z(), a = qe({
538
- get items() {
539
- return l.rules ?? [];
540
- },
541
- set items(s) {
542
- l.rules = s;
543
- },
544
- create: function() {
545
- var s;
546
- return {
547
- _id: `skuGroupRule_${(/* @__PURE__ */ new Date()).toISOString()}_${me(4)}`,
548
- name: "",
549
- rule: null,
550
- skuRefs: ((s = k.modelValue) == null ? void 0 : s.defaultSkuRefs) ?? []
551
- };
552
- },
553
- id: function(s) {
554
- return s._id;
555
- }
556
- }), t = fe({
557
- get disabled() {
558
- return k.disabled;
559
- },
560
- get skuRefs() {
561
- return l.defaultSkuRefs ?? [];
562
- },
563
- set skuRefs(s) {
564
- l.defaultSkuRefs = s;
565
- const g = s.map((r) => r._id), u = l.rules;
566
- if (!u) return;
567
- const m = s.groupBy(
568
- (r) => r._id,
569
- (r) => r.trackingMeasurement
570
- );
571
- for (const r of u) {
572
- const y = r.skuRefs.filter((x) => g.includes(x._id)), w = s.filter(
573
- (x) => !y.some((I) => I._id === x._id)
574
- );
575
- r.skuRefs = [...y, ...w].map((x) => {
576
- var I;
577
- return {
578
- ...x,
579
- trackingMeasurement: ((I = m.get(x._id)) == null ? void 0 : I[0]) ?? null
580
- };
581
- });
582
- }
583
- l.rules = [...u];
584
- },
585
- isDefaultList: !0
586
- }), n = A();
587
- return _({
588
- validateInputs: () => {
589
- var s;
590
- return (s = n.value) == null ? void 0 : s.validateInputs();
591
- },
592
- resetInputsValidation: () => {
593
- var s;
594
- return (s = n.value) == null ? void 0 : s.resetInputsValidation();
595
- },
596
- resetInputs: () => {
597
- var s;
598
- return (s = n.value) == null ? void 0 : s.resetInputs();
599
- }
600
- }), (s, g) => {
601
- const u = R("FmTextField"), m = R("FmButton"), r = R("FmFormGroup"), y = R("FmTable"), w = R("FmCard"), x = R("FmForm");
602
- return F(), M(x, {
603
- onValidationSuccess: g[2] || (g[2] = (I) => v("validation-success")),
604
- ref_key: "formRef",
605
- ref: n,
606
- class: "flex flex-col gap-64"
607
- }, {
608
- default: T(() => {
609
- var I;
610
- return [
611
- c("div", Ze, [
612
- b(u, {
613
- label: i(e)("inventory.ingredientGroup.form.name"),
614
- "label-mark": "required",
615
- rules: [i(ce)()],
616
- modelValue: i(l).name,
617
- "onUpdate:modelValue": g[0] || (g[0] = (d) => i(l).name = d)
618
- }, null, 8, ["label", "rules", "modelValue"]),
619
- b(u, {
620
- label: i(e)("inventory.ingredientGroup.form.ref"),
621
- "label-mark": "optional",
622
- modelValue: i(l).ref,
623
- "onUpdate:modelValue": g[1] || (g[1] = (d) => i(l).ref = d)
624
- }, null, 8, ["label", "modelValue"])
625
- ]),
626
- c("div", et, [
627
- c("div", tt, [
628
- c("div", nt, [
629
- c("div", st, [
630
- c("div", ot, [
631
- c("div", at, $(i(e)("inventory.ingredientGroup.form.defaultRule.title")), 1)
632
- ])
633
- ]),
634
- c("div", null, [
635
- b(m, {
636
- disabled: s.disabled,
637
- label: "Add ingredient",
638
- "prepend-icon": "link",
639
- variant: "plain",
640
- class: "border-1 rounded-lg border-fm-color-primary",
641
- onClick: i(t).promptAddIngredient,
642
- size: "md"
643
- }, null, 8, ["disabled", "onClick"])
644
- ])
645
- ]),
646
- b(r, {
647
- "model-value": i(l).defaultSkuRefs,
648
- rules: [
649
- (d) => !!(d != null && d.length) || "At least one ingredient is required"
650
- ]
651
- }, null, 8, ["model-value", "rules"])
652
- ]),
653
- c("div", null, [
654
- b(y, {
655
- "row-data": i(l).defaultSkuRefs ?? [],
656
- "column-defs": i(t).columnDefs,
657
- "column-visibility": i(t).columnVisibility,
658
- "page-size": (I = i(l).defaultSkuRefs) == null ? void 0 : I.length,
659
- "shrink-at": 9999,
660
- "hide-footer": ""
661
- }, null, 8, ["row-data", "column-defs", "column-visibility", "page-size"])
662
- ]),
663
- c("div", it, $(i(e)("inventory.ingredientGroup.form.defaultRule.defaultCheckbox")), 1)
664
- ]),
665
- c("div", lt, [
666
- c("div", rt, [
667
- c("div", ut, $(i(e)("inventory.ingredientGroup.form.rules.title")), 1),
668
- c("div", dt, $(i(e)("inventory.ingredientGroup.form.rules.description")), 1)
669
- ]),
670
- (F(!0), B(pe, null, ve(i(l).rules, (d, p) => (F(), M(w, {
671
- key: d.id,
672
- variant: "outlined",
673
- class: "p-16"
674
- }, {
675
- default: T(() => [
676
- c("div", ct, [
677
- c("div", mt, [
678
- c("div", ft, [
679
- ye($(i(e)("inventory.ingredientGroup.form.rules.rule_N", [p + 1])), 1),
680
- d.name ? (F(), B("span", pt, ": ")) : se("", !0),
681
- d.name ? (F(), B("span", vt, $(d.name), 1)) : se("", !0)
682
- ]),
683
- b(m, {
684
- variant: "tertiary",
685
- icon: "delete",
686
- onClick: (h) => i(a).removeItem(d)
687
- }, null, 8, ["onClick"])
688
- ]),
689
- c("div", null, [
690
- (F(), M(Xe, {
691
- key: d._id,
692
- "model-value": d,
693
- "onUpdate:modelValue": i(a).updateItem,
694
- disabled: s.disabled,
695
- menu: s.menu
696
- }, null, 8, ["model-value", "onUpdate:modelValue", "disabled", "menu"]))
697
- ])
698
- ])
699
- ]),
700
- _: 2
701
- }, 1024))), 128)),
702
- c("div", null, [
703
- b(m, {
704
- variant: "plain",
705
- icon: "add",
706
- label: i(e)("inventory.ingredientGroup.form.rules.addRule"),
707
- onClick: i(a).addItem
708
- }, null, 8, ["label", "onClick"])
709
- ])
710
- ])
711
- ];
712
- }),
713
- _: 1
714
- }, 512);
715
- };
716
- }
717
- }), gt = {
718
- key: 0,
719
- class: "text-fm-color-typo-primary fm-typo-en-body-lg-400"
720
- }, _t = { class: "flex gap-4" }, bt = /* @__PURE__ */ j({
721
- __name: "IngredientGroupDialog",
722
- props: {
723
- show: { type: Boolean },
724
- mode: { default: S.READ },
725
- modelValue: {}
726
- },
727
- emits: ["update:show"],
728
- setup(o) {
729
- const _ = o, f = L(), k = ze(() => f.readCachedMenu()), l = G(
730
- () => k.result.value.state === Ne.success ? k.result.value.data : void 0
731
- ), v = Y(), { t: e } = z(), a = Se(_, "show");
732
- function t() {
733
- return {
734
- _id: "",
735
- name: "",
736
- rules: []
737
- };
738
- }
739
- const n = A(t()), s = A(`${Math.random()}`);
740
- re(
741
- () => _.show,
742
- (d) => {
743
- if (!d) return;
744
- let p = P(_.modelValue ?? t());
745
- p.defaultSkuRefs && (p.defaultSkuRefs = p.defaultSkuRefs.map((h, V) => ({
746
- ...h,
747
- priority: h.priority ?? V + 1
748
- })));
749
- for (let h = 0; p.rules && h < p.rules.length; h++) {
750
- const V = p.rules[h];
751
- V.skuRefs = V.skuRefs.map((D, E) => ({
752
- ...D,
753
- priority: D.priority ?? E + 1
754
- }));
755
- }
756
- n.value = p, s.value = p._id || `${Math.random()}`;
757
- }
758
- );
759
- const g = G(() => {
760
- switch (_.mode) {
761
- case S.READ:
762
- return "";
763
- case S.UPDATE:
764
- return e("inventory.ingredientGroup.update.title");
765
- case S.CREATE:
766
- return e("inventory.ingredientGroup.create.title");
767
- }
768
- return "";
769
- }), u = G(() => {
770
- switch (_.mode) {
771
- case S.READ:
772
- return "";
773
- case S.UPDATE:
774
- return e("common.save");
775
- case S.CREATE:
776
- return e("common.add");
777
- }
778
- return "";
779
- }), m = A(), r = A(!1);
780
- async function y() {
781
- r.value = !0;
782
- const d = P(n.value);
783
- try {
784
- await f.createSkuGroup(d), a.value = !1, v.open({
785
- title: e("inventory.common.success"),
786
- message: e("inventory.ingredientGroup.create.success", { name: d.name }),
787
- type: "success"
788
- });
789
- } catch (p) {
790
- p instanceof oe || v.open({
791
- title: e("inventory.ingredientGroup.create.error.title"),
792
- message: e("inventory.ingredientGroup.create.error.message"),
793
- type: "error"
794
- });
795
- } finally {
796
- r.value = !1;
797
- }
798
- }
799
- async function w() {
800
- r.value = !0;
801
- const d = P(n.value);
802
- try {
803
- await f.updateSkuGroup(d), r.value = !1, a.value = !1, v.open({
804
- title: e("inventory.common.success"),
805
- message: e("inventory.ingredientGroup.update.success", { name: d.name }),
806
- type: "success"
807
- });
808
- } catch (p) {
809
- p instanceof oe || v.open({
810
- title: e("inventory.ingredientGroup.update.error.title"),
811
- message: e("inventory.ingredientGroup.update.error.message"),
812
- type: "error"
813
- });
814
- } finally {
815
- r.value = !1;
816
- }
817
- }
818
- function x() {
819
- var d, p;
820
- (p = (d = m.value) == null ? void 0 : d.validateInputs) == null || p.call(d);
821
- }
822
- function I() {
823
- switch (_.mode) {
824
- case S.READ:
825
- return;
826
- case S.UPDATE:
827
- return w();
828
- case S.CREATE:
829
- return y();
830
- }
831
- }
832
- return (d, p) => {
833
- const h = R("FmButton"), V = R("FmSideSheet");
834
- return F(), M(V, {
835
- "model-value": i(a),
836
- "onUpdate:modelValue": p[3] || (p[3] = (D) => ge(a) ? a.value = D : null),
837
- header: g.value,
838
- "close-button": "",
839
- "dismiss-away": "",
840
- "max-width": 800
841
- }, {
842
- "side-sheet-footer": T(() => [
843
- c("div", _t, [
844
- b(h, {
845
- loading: r.value,
846
- label: u.value,
847
- onClick: x
848
- }, null, 8, ["loading", "label"]),
849
- b(h, {
850
- disabled: r.value,
851
- label: i(e)("common.close"),
852
- variant: "tertiary",
853
- onClick: p[2] || (p[2] = (D) => a.value = !1)
854
- }, null, 8, ["disabled", "label"])
855
- ])
856
- ]),
857
- default: T(() => [
858
- l.value ? (F(), M(yt, {
859
- menu: l.value,
860
- class: "w-full",
861
- ref_key: "hasValidationExpose",
862
- ref: m,
863
- key: s.value,
864
- "model-value": n.value,
865
- "onUpdate:modelValue": p[0] || (p[0] = (D) => n.value = D),
866
- mode: d.mode,
867
- disabled: r.value,
868
- onValidationSuccess: p[1] || (p[1] = (D) => I())
869
- }, null, 8, ["menu", "model-value", "mode", "disabled"])) : (F(), B("div", gt, "Loading.."))
870
- ]),
871
- _: 1
872
- }, 8, ["model-value", "header"]);
873
- };
874
- }
875
- }), kt = { class: "flex flex-col py-8" }, xt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, ht = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, Lt = /* @__PURE__ */ j({
876
- __name: "IngredientGroupView",
877
- setup(o) {
878
- const _ = L(), f = G(() => _.skuGroups), k = Re(), { t: l } = z(), {
879
- createIngredientGroup: v,
880
- updateIngredientGroup: e,
881
- importIngredientGroups: a,
882
- exportIngredientGroups: t
883
- } = H(), { columnDefs: n, loading: s } = ae(Oe()), { ingredientGroupDialogProps: g } = ae(H());
884
- function u(h) {
885
- switch (h) {
886
- case "add":
887
- return v();
888
- case "import":
889
- return a();
890
- case "export":
891
- return t();
892
- }
893
- }
894
- const m = A(""), r = A(!1), y = G(() => r.value || s.value), { breakpoints: w } = Fe(), x = G(() => w.value.xs || w.value.sm), I = G(() => x.value ? 10 : 20), d = Ce(), p = G(() => [
895
- {
896
- label: l("inventory.ingredient.create.title"),
897
- value: "add",
898
- isPrimary: !0,
899
- prependIcon: "add"
900
- },
901
- { label: l("common.import"), value: "import" },
902
- { label: l("common.export"), value: "export" }
903
- ]);
904
- return (h, V) => {
905
- const D = R("FmTable");
906
- return F(), M(De, {
907
- title: i(l)("inventory.ingredientGroup.title"),
908
- actions: p.value,
909
- "onClick:action": u
910
- }, {
911
- default: T(() => [
912
- c("div", {
913
- class: _e([
914
- "flex flex-col gap-8 max-h-full",
915
- {
916
- "p-0": x.value,
917
- "px-24 ": !x.value
918
- }
919
- ])
920
- }, [
921
- b($e, {
922
- searchable: "",
923
- search: m.value,
924
- "onUpdate:search": V[0] || (V[0] = (E) => m.value = E)
925
- }, null, 8, ["search"]),
926
- b(D, {
927
- style: be(i(d).tableHeight),
928
- "column-defs": i(n),
929
- "row-data": f.value,
930
- "search-value": m.value,
931
- loading: !i(k)._currentLocation || y.value,
932
- "loading-text": i(l)("inventory.common.loading"),
933
- onRowClick: V[1] || (V[1] = (E) => i(e)(E.original)),
934
- "page-size": I.value
935
- }, {
936
- "list-row": T((E) => [
937
- b(Ae, {
938
- row: E,
939
- onRowClick: i(e)
940
- }, ke({
941
- default: T((N) => {
942
- var J, Q, W, O, X, Z, ee, te, q, ne;
943
- return [
944
- c("div", kt, [
945
- c("div", xt, [
946
- b(i(le), {
947
- render: (W = (Q = (J = N.code) == null ? void 0 : J.column) == null ? void 0 : Q.columnDef) == null ? void 0 : W.cell,
948
- props: (X = (O = N.code) == null ? void 0 : O.getContext) == null ? void 0 : X.call(O)
949
- }, null, 8, ["render", "props"])
950
- ]),
951
- c("div", ht, [
952
- b(i(le), {
953
- render: (te = (ee = (Z = N.name) == null ? void 0 : Z.column) == null ? void 0 : ee.columnDef) == null ? void 0 : te.cell,
954
- props: (ne = (q = N.name) == null ? void 0 : q.getContext) == null ? void 0 : ne.call(q)
955
- }, null, 8, ["render", "props"])
956
- ])
957
- ])
958
- ];
959
- }),
960
- _: 2
961
- }, [
962
- r.value ? {
963
- name: "loading-text",
964
- fn: T(() => [
965
- c("div", null, $(i(l)("inventory.ingredient.table.importing")), 1)
966
- ]),
967
- key: "0"
968
- } : void 0
969
- ]), 1032, ["row", "onRowClick"])
970
- ]),
971
- _: 1
972
- }, 8, ["style", "column-defs", "row-data", "search-value", "loading", "loading-text", "page-size"])
973
- ], 2),
974
- (F(), M(xe, { to: "body" }, [
975
- b(bt, he(we(i(g))), null, 16)
976
- ]))
977
- ]),
978
- _: 1
979
- }, 8, ["title", "actions"]);
980
- };
981
- }
982
- });
983
- export {
984
- Lt as default
985
- };