@feedmepos/mf-menu 0.24.0-beta.10 → 0.24.0-beta.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 (99) hide show
  1. package/dist/{App-BL96BP5A.js → App-BpMHj_xh.js} +210 -229
  2. package/dist/{ApplyProduct.vue_vue_type_script_setup_true_lang-BHFEZaig.js → ApplyProduct.vue_vue_type_script_setup_true_lang-D7gMDWdx.js} +2 -2
  3. package/dist/{Catalog-DLrHA00c.js → Catalog-BDZTYx5J.js} +86 -81
  4. package/dist/{Category-DgqeE-gi.js → Category-DDxlAfyp.js} +6 -6
  5. package/dist/{CookingGuide-BDyTmsQt.js → CookingGuide-BmVD8Yi3.js} +4 -4
  6. package/dist/FormItem.vue_vue_type_script_setup_true_lang-BmPAVphe.js +26 -0
  7. package/dist/{Group-CRRjbaq7.js → Group-DBkjBnfW.js} +1 -1
  8. package/dist/{Group-Dhet0BU7.js → Group-DnDg9gIK.js} +3 -3
  9. package/dist/{Group.vue_vue_type_script_setup_true_lang-BsGMTQFk.js → Group.vue_vue_type_script_setup_true_lang-CJtvqEtZ.js} +8 -8
  10. package/dist/GroupMarkupPriceDialog.vue_vue_type_script_setup_true_lang-CBDpo2cM.js +211 -0
  11. package/dist/{ImportProductDialog.vue_vue_type_script_setup_true_lang-DtYE_kdV.js → ImportProductDialog.vue_vue_type_script_setup_true_lang-COzzQaSe.js} +18 -19
  12. package/dist/{Ingredient-gSH0Bjvo.js → Ingredient-CkJJoEcO.js} +4 -4
  13. package/dist/{InventoryBinding.vue_vue_type_script_setup_true_lang-vI0fS1iV.js → InventoryBinding.vue_vue_type_script_setup_true_lang-CU1eb8_k.js} +2 -2
  14. package/dist/{LinkProductSideSheet-G8gTQJFi.js → LinkProductSideSheet-DHNwDW2j.js} +2 -2
  15. package/dist/MenuSetting-DD3VevAL.js +184 -0
  16. package/dist/{PrintRoute-DuDcngQx.js → PrintRoute-DtVi7igz.js} +4 -4
  17. package/dist/{Product-CV9KDl0B.js → Product-CXCKlNkL.js} +1 -1
  18. package/dist/{Product.vue_vue_type_script_setup_true_lang-BdF8r0Kp.js → Product.vue_vue_type_script_setup_true_lang-4Q87ODx8.js} +11 -11
  19. package/dist/{Products-CQ0kpJAK.js → Products-BC9s-anP.js} +9 -9
  20. package/dist/{Publish-DPHZVh4T.js → Publish-D7V2hkK4.js} +4 -4
  21. package/dist/{Recipe-DEFjFvak.js → Recipe-DdBXjV1q.js} +5 -5
  22. package/dist/{Scheduler-0JuCg_oZ.js → Scheduler-Ct1ZYgbn.js} +3 -3
  23. package/dist/{SchedulerSelector.vue_vue_type_script_setup_true_lang-BJTuXISe.js → SchedulerSelector.vue_vue_type_script_setup_true_lang-CgEVE7d2.js} +1 -1
  24. package/dist/{ServingSequence-CXdCf3XK.js → ServingSequence-B5rlb0__.js} +3 -3
  25. package/dist/{Setting-BSUcwD-r.js → Setting-s_dBBG8K.js} +102 -98
  26. package/dist/{Takeaway-B5NSRMHp.js → Takeaway-Bl_cNnTZ.js} +1 -1
  27. package/dist/{Takeaway-BpouSUGh.js → Takeaway-DKl2mmrQ.js} +4 -4
  28. package/dist/{Takeaway.vue_vue_type_script_setup_true_lang-DVUuy1YQ.js → Takeaway.vue_vue_type_script_setup_true_lang-BtOkK_3Y.js} +5 -5
  29. package/dist/{Unit-BdFjK44y.js → Unit-Ci-Wk86Z.js} +2 -2
  30. package/dist/{Variant-Luh61Mbp.js → Variant-yKOHsczO.js} +3 -3
  31. package/dist/{_id_-BU2NGPt9.js → _id_-J89k239E.js} +8 -8
  32. package/dist/{app-JyRYnxuC.js → app-BaMuHAY7.js} +335 -335
  33. package/dist/{app-KMIdDnn3.js → app-CuwYErQc.js} +1 -1
  34. package/dist/app.js +1 -1
  35. package/dist/apps/mf-menu/src/api/menu.d.ts +2 -1
  36. package/dist/apps/mf-menu/src/app.d.ts +98 -0
  37. package/dist/apps/mf-menu/src/components/feature/ApplyProduct/ApplyProduct.vue.d.ts +92 -0
  38. package/dist/apps/mf-menu/src/components/feature/ApplyProduct/ApplyProductDialog.vue.d.ts +46 -0
  39. package/dist/apps/mf-menu/src/components/feature/ApplyProduct/index.d.ts +274 -4
  40. package/dist/apps/mf-menu/src/components/feature/GroupManager/OptionTable.vue.d.ts +66 -0
  41. package/dist/apps/mf-menu/src/components/feature/GroupManager/UpdateForm.vue.d.ts +46 -0
  42. package/dist/apps/mf-menu/src/components/feature/GroupManager/index.d.ts +184 -0
  43. package/dist/apps/mf-menu/src/components/feature/PriceTier/LinkPriceTier.vue.d.ts +12 -0
  44. package/dist/apps/mf-menu/src/components/feature/PriceTier/PriceTierButton.vue.d.ts +1590 -0
  45. package/dist/apps/mf-menu/src/components/feature/PriceTier/PriceTierForm.vue.d.ts +1606 -0
  46. package/dist/apps/mf-menu/src/components/feature/PriceTier/PriceTierSheet.vue.d.ts +24 -0
  47. package/dist/apps/mf-menu/src/components/feature/TreeEditor/composable/item.d.ts +68 -2
  48. package/dist/apps/mf-menu/src/components/feature/TreeEditor/composable/scheduler.d.ts +101 -2
  49. package/dist/apps/mf-menu/src/components/feature/TreeEditor/composable/useItemFormManagement.d.ts +68 -2
  50. package/dist/apps/mf-menu/src/components/feature/TreeEditor/form/GroupManager/OptionTable.vue.d.ts +66 -0
  51. package/dist/apps/mf-menu/src/components/feature/TreeEditor/form/GroupManager/UpdateForm.vue.d.ts +46 -0
  52. package/dist/apps/mf-menu/src/components/feature/TreeEditor/form/GroupManager/index.d.ts +184 -0
  53. package/dist/apps/mf-menu/src/components/feature/TreeEditor/item/ItemForm.vue.d.ts +204 -6
  54. package/dist/apps/mf-menu/src/components/feature/TreeEditor/menuUtils.d.ts +68 -2
  55. package/dist/apps/mf-menu/src/components/feature/TreeEditor/store/menuV2.d.ts +491 -7
  56. package/dist/apps/mf-menu/src/helper/import-export.d.ts +490 -6
  57. package/dist/apps/mf-menu/src/helper/menu.d.ts +68 -2
  58. package/dist/apps/mf-menu/src/helper/setting/catalogSetting.d.ts +1 -0
  59. package/dist/apps/mf-menu/src/manager/menu/item.d.ts +490 -6
  60. package/dist/apps/mf-menu/src/manager/menu/priceTier.d.ts +8 -0
  61. package/dist/apps/mf-menu/src/stores/manager/item.d.ts +204 -6
  62. package/dist/apps/mf-menu/src/stores/manager/scheduler.d.ts +101 -2
  63. package/dist/apps/mf-menu/src/stores/menu.d.ts +490 -6
  64. package/dist/apps/mf-menu/src/views/Catalog/Edit/AddProductPopup/Form.vue.d.ts +136 -4
  65. package/dist/apps/mf-menu/src/views/Catalog/Edit/AddProductPopup/index.d.ts +340 -10
  66. package/dist/apps/mf-menu/src/views/MenuSetting/AddPriceGroupDialog.vue.d.ts +2 -0
  67. package/dist/apps/mf-menu/src/views/Publish/UpdateCatalogDialog.vue.d.ts +284 -0
  68. package/dist/apps/mf-menu/src/views/Scheduler/FilterForm.vue.d.ts +66 -0
  69. package/dist/apps/mf-menu/src/views/Scheduler/SchedulerDialog.vue.d.ts +66 -0
  70. package/dist/apps/mf-menu/tsconfig.app.tsbuildinfo +1 -1
  71. package/dist/assets/linked-status-DcmE61N-.js +24 -0
  72. package/dist/assets/override-menu-3mTXzha8.js +24 -0
  73. package/dist/assets/validate-menu-BMtbMwaC.js +24 -0
  74. package/dist/{catalog-Czw60Djo.js → catalog-Dh1Y038d.js} +1 -1
  75. package/dist/{catalogSetting-Bjv1XmuP.js → catalogSetting-Cz_aVtny.js} +20 -17
  76. package/dist/{currency-hD4A5D_Y.js → currency-D363FNtV.js} +1 -1
  77. package/dist/{dayjs.min-BWZ4J1ds.js → dayjs.min-DDG8Wk7w.js} +1 -1
  78. package/dist/{discardConfirm-RZ7whgh7.js → discardConfirm-CCIkFux0.js} +1 -1
  79. package/dist/{index-DgnCevty.js → index-Bx8K4OIe.js} +4 -4
  80. package/dist/{index-QxgCD-Oq.js → index-DrXzgQuz.js} +4 -4
  81. package/dist/{item-D084U5Ae.js → item-e6mjd7uQ.js} +2812 -2545
  82. package/dist/{menu-Cf36nhdB.js → menu-BmEDGId_.js} +17620 -17449
  83. package/dist/{menu-DabOEZi8.js → menu-CKFSri2E.js} +1 -1
  84. package/dist/mf-menu.css +1 -1
  85. package/dist/object-OjvTRW-U.js +143 -0
  86. package/dist/packages/shared/src/components/layout/FormItem.vue.d.ts +2 -0
  87. package/dist/priceTier-DbGOeciM.js +83 -0
  88. package/dist/{scheduler-BWhmtZ6t.js → scheduler-Bsq-H9QE.js} +5 -5
  89. package/dist/{toExcel-DHMm8rpW.js → toExcel-DBbQVWZR.js} +2 -2
  90. package/dist/{unit-DAnoeWIT.js → unit-DAhOf-ct.js} +2 -2
  91. package/package.json +2 -2
  92. package/dist/FormItem.vue_vue_type_script_setup_true_lang-De38Lmng.js +0 -16
  93. package/dist/GroupMarkupPriceDialog.vue_vue_type_script_setup_true_lang-DimWKVtm.js +0 -179
  94. package/dist/MenuSetting-Bx_pyWE0.js +0 -144
  95. package/dist/assets/linked-status-D0_pmaKj.js +0 -24
  96. package/dist/assets/override-menu-BdCuN2iG.js +0 -24
  97. package/dist/assets/validate-menu-DIc6podL.js +0 -24
  98. package/dist/index-s1G7NRop.js +0 -130
  99. package/dist/object-DVUNCr7w.js +0 -16
@@ -1,30 +1,30 @@
1
- import { computed, shallowRef, ref, watch, nextTick, getCurrentInstance, onMounted, defineComponent, watchEffect, createElementBlock, openBlock, normalizeStyle, onBeforeUnmount, createBlock, unref, resolveComponent, withDirectives, createElementVNode, createVNode, vShow, markRaw, render, shallowReactive, normalizeClass, withCtx, toDisplayString, mergeModels, useModel, createCommentVNode, resolveDirective, createTextVNode, renderSlot, h as h$1, Fragment, renderList, withModifiers, createSlots, onUnmounted, mergeProps, normalizeProps, guardReactiveProps, Teleport, Transition, withKeys } from "vue";
2
- import { g as getDefaultExportFromCjs, m as managerExports, s as sort, c as coreDartExports, a as sortPosition, e as entityExports, b as categorizedItems, f as formatRecipes, d as formatSkus, h as coreExports, F as FdoDecimalToPercentage, i as menuExports, v as validateMenu, j as menuService, u as useLoading, k as generateItemThumbnailPath, l as firebaseStorage, n as generateItemThumbnailUrl, o as useMenuLoader, p as useMenuStore$1, q as orderFromOptions, r as clone, t as arrayToObject, w as mapVariant, I as ItemTax, x as updateBaseItemOverrider, y as registerVersion, z as getApp, _ as _getProvider, A as getExperimentalSetting, B as getDefaultEmulatorHost, C as _isFirebaseServerApp, D as deepEqual, E as getModularInstance, G as getUA, H as ErrorFactory, J as isIE, K as isEmpty, S as SDK_VERSION, L as querystring, M as FirebaseError, N as isMobileCordova, O as isReactNative, P as base64Decode, Q as Logger, R as LogLevel, T as isBrowserExtension, U as _registerComponent, V as Component, W as createSubscribe, X as getApps, Y as initializeApp, Z as getStorage } from "./menu-Cf36nhdB.js";
1
+ import { computed, shallowRef, ref, watch, nextTick, getCurrentInstance, onMounted, defineComponent, watchEffect, createElementBlock, openBlock, normalizeStyle, onBeforeUnmount, createBlock, unref, resolveComponent, withDirectives, createElementVNode, createVNode, vShow, shallowReactive, normalizeClass, withCtx, toDisplayString, mergeModels, useModel, createCommentVNode, resolveDirective, createTextVNode, renderSlot, h as h$1, Fragment, renderList, withModifiers, createSlots, onUnmounted, mergeProps, normalizeProps, guardReactiveProps, Teleport, Transition, withKeys } from "vue";
2
+ import { g as getDefaultExportFromCjs, m as managerExports, e as entityExports, s as sort, c as coreDartExports, a as sortPosition, b as categorizedItems, f as formatRecipes, d as formatSkus, h as coreExports, F as FdoDecimalToPercentage, i as menuExports, v as validateMenu, j as menuService, u as useLoading, k as generateItemThumbnailPath, l as firebaseStorage, n as generateItemThumbnailUrl, o as useMenuLoader, p as useMenuStore$1, q as orderFromOptions, r as clone, t as arrayToObject, w as mapVariant, I as ItemTax, x as updateBaseItemOverrider, y as registerVersion, z as getApp, _ as _getProvider, A as getExperimentalSetting, B as getDefaultEmulatorHost, C as _isFirebaseServerApp, D as deepEqual, E as getModularInstance, G as getUA, H as ErrorFactory, J as isIE, K as isEmpty, S as SDK_VERSION, L as querystring, M as FirebaseError, N as isMobileCordova, O as isReactNative, P as base64Decode, Q as Logger, R as LogLevel, T as isBrowserExtension, U as _registerComponent, V as Component, W as createSubscribe, X as getApps, Y as initializeApp, Z as getStorage } from "./menu-BmEDGId_.js";
3
3
  import { useCoreStore, useI18n, CustomAttributesForm, FeedMeAuth } from "@feedmepos/mf-common";
4
4
  import { FmButtonVariant, FmButtonColorThemeVariant, useSnackbar, useDialog, useDialogChild, components, useBreakpoints } from "@feedmepos/ui-library";
5
- import { R as Remy, o as overrideMenuWithWorker, g as getNewMenu, a as overriderToItem, _ as _sfc_main$w, f as fe, b as browserExports, n as normalizeEmpty, c as _sfc_main$z, I as Indent, d as _sfc_main$B, e as getVariantSelectionName, h as InventoryManagerForm, i as extractGroup, F as FormRow, M as MenuGroupManager, j as extractLinkItem, k as _sfc_main$E, l as getAddonGroupType, m as initDynamicGroupItem, p as MobileXScrollable, P as PrintDeptManagerForm, u as useItemManagerStore, T as ToggleCard, q as mapItemFallback, r as init } from "./item-D084U5Ae.js";
6
- import { _ as _export_sfc$1, L as LinkProductSideSheet } from "./LinkProductSideSheet-G8gTQJFi.js";
7
- import { _ as _sfc_main$H, T as TREE_EDITOR_OPEN_EVENT } from "./app-JyRYnxuC.js";
8
- import { l as lodashExports, u as useDiscardConfirm } from "./discardConfirm-RZ7whgh7.js";
5
+ import { R as Remy, g as getNewMenu, o as overriderToItem, a as overrideMenuWithWorker, _ as _sfc_main$w, f as fe, b as browserExports, n as normalizeEmpty, c as _sfc_main$z, I as Indent, d as _sfc_main$B, e as getVariantSelectionName, h as InventoryManagerForm, i as extractGroup, F as FormRow, M as MenuGroupManager, j as extractLinkItem, k as _sfc_main$E, l as getAddonGroupType, m as initDynamicGroupItem, p as MobileXScrollable, P as PrintDeptManagerForm, u as useSheet, q as useItemManagerStore, T as ToggleCard, r as mapItemFallback, s as init } from "./item-e6mjd7uQ.js";
6
+ import { _ as _export_sfc$1, L as LinkProductSideSheet } from "./LinkProductSideSheet-DHNwDW2j.js";
7
+ import { _ as _sfc_main$H, T as TREE_EDITOR_OPEN_EVENT } from "./app-BaMuHAY7.js";
8
+ import { l as lodashExports, u as useDiscardConfirm } from "./discardConfirm-CCIkFux0.js";
9
9
  import { defineStore } from "pinia";
10
10
  import { _ as _sfc_main$y, a as _sfc_main$D } from "./FormSection.vue_vue_type_script_setup_true_lang-CO4YGYLB.js";
11
- import { _ as _sfc_main$A } from "./FormItem.vue_vue_type_script_setup_true_lang-De38Lmng.js";
11
+ import { _ as _sfc_main$A } from "./FormItem.vue_vue_type_script_setup_true_lang-BmPAVphe.js";
12
12
  import { _ as _sfc_main$x } from "./Thumbnail.vue_vue_type_script_setup_true_lang-CvOTKNYT.js";
13
13
  import { _ as _t } from "./tooltip-B5BiPMx9.js";
14
- import { s as sentenceCase } from "./index-s1G7NRop.js";
15
- import { _ as _sfc_main$C, T as TakeawayManagerForm, l as link } from "./index-DgnCevty.js";
14
+ import { s as sentenceCase } from "./object-OjvTRW-U.js";
15
+ import { _ as _sfc_main$C, T as TakeawayManagerForm, l as link } from "./index-Bx8K4OIe.js";
16
16
  import { u as useSearch } from "./search-BAPEUu1R.js";
17
17
  import { c as check } from "./check-C9mY6LiX.js";
18
- import { f as formatCurrency } from "./currency-hD4A5D_Y.js";
18
+ import { f as formatCurrency } from "./currency-D363FNtV.js";
19
19
  import { c as capitalize } from "./string-DpfFixWH.js";
20
20
  import { useInventoryStore, InventoryBindingSummary } from "@feedmepos/mf-inventory-portal";
21
21
  import { d as draggableComponent } from "./vuedraggable-CK8z7qA8.js";
22
- import { _ as _sfc_main$F } from "./ApplyProduct.vue_vue_type_script_setup_true_lang-BHFEZaig.js";
22
+ import { _ as _sfc_main$F } from "./ApplyProduct.vue_vue_type_script_setup_true_lang-D7gMDWdx.js";
23
23
  /* empty css */
24
24
  import { i as isClient, t as toValue, w as watchPausable, a as tryOnMounted, b as tryOnScopeDispose, n as noop, c as isObject, u as useDebounceFn, r as refDebounced } from "./index-Ce4v8o7D.js";
25
- import { C as CatalogManager } from "./catalog-Czw60Djo.js";
25
+ import { C as CatalogManager } from "./catalog-Dh1Y038d.js";
26
26
  import { _ as _sfc_main$G } from "./TextChip.vue_vue_type_script_setup_true_lang-D-M_pE3L.js";
27
- import { u as useAppStore } from "./app-KMIdDnn3.js";
27
+ import { u as useAppStore } from "./app-CuwYErQc.js";
28
28
  function unrefElement(e) {
29
29
  var t;
30
30
  const r = toValue(e);
@@ -8475,40 +8475,160 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
8475
8475
  ]);
8476
8476
  };
8477
8477
  }
8478
- }), RemyDialog = /* @__PURE__ */ _export_sfc$1(_sfc_main$s, [["__scopeId", "data-v-9adba964"]]);
8479
- function useSheet() {
8480
- const e = getCurrentInstance();
8481
- function t({
8482
- component: r,
8483
- props: A
8484
- }) {
8485
- if (!e)
8486
- throw new Error("No currentInstance found. useSheet must be used within a component");
8487
- const i = document.createElement("div");
8488
- document.body.appendChild(i);
8489
- const n = markRaw(r), s = async () => {
8490
- await new Promise((u) => setTimeout(u, 500)), render(null, i), i.remove();
8491
- };
8492
- let a, o;
8493
- const l = (u) => {
8494
- a = u;
8495
- }, c = (u) => {
8496
- o = u;
8497
- }, _ = createVNode(n, {
8498
- ...A,
8499
- // close event from the component
8500
- "onUpdate:show": (u) => {
8501
- u || (s(), o == null || o());
8502
- },
8503
- // submit event from the component
8504
- onSubmit: (u) => {
8505
- a == null || a(u);
8506
- }
8478
+ }), RemyDialog = /* @__PURE__ */ _export_sfc$1(_sfc_main$s, [["__scopeId", "data-v-9adba964"]]), useTreeStore = defineStore("mf-menu-tree", () => {
8479
+ const e = ref(), t = ref([]), r = ref(null), A = ref([]);
8480
+ function i(c) {
8481
+ t.value = c;
8482
+ }
8483
+ function n(c) {
8484
+ r.value = c;
8485
+ }
8486
+ function s(c) {
8487
+ A.value = c;
8488
+ }
8489
+ function a(c) {
8490
+ if (c) {
8491
+ for (const _ of t.value)
8492
+ for (const u of _.children ?? [])
8493
+ if (u.id.includes(c)) {
8494
+ r.value = u.id;
8495
+ return;
8496
+ }
8497
+ }
8498
+ }
8499
+ async function o() {
8500
+ A.value = [];
8501
+ }
8502
+ function l() {
8503
+ const c = [];
8504
+ function _(u) {
8505
+ c.push(u.id);
8506
+ for (const g of u.children ?? [])
8507
+ _(g);
8508
+ }
8509
+ for (const u of t.value)
8510
+ _(u);
8511
+ A.value = c;
8512
+ }
8513
+ return {
8514
+ treeRef: e,
8515
+ treeNodes: t,
8516
+ selectedNodeId: r,
8517
+ expandedNodeIds: A,
8518
+ setTreeNodes: i,
8519
+ setSelectedNodeId: n,
8520
+ setSelectedNodeByItemId: a,
8521
+ setExpandedNodeIds: s,
8522
+ collapseAllNodes: o,
8523
+ expandAllNodes: l
8524
+ };
8525
+ });
8526
+ function useItemFormManagement(e, t) {
8527
+ function r(a) {
8528
+ if (!e.value)
8529
+ return !1;
8530
+ const o = e.value.validate();
8531
+ if (o != null && o.length && o.length > 0)
8532
+ return !1;
8533
+ const l = a;
8534
+ return A(l), i(l);
8535
+ }
8536
+ function A(a) {
8537
+ a.inventoryBindings ?? (a.inventoryBindings = []), a.inventoryBindings.length === 0 && (a.inventoryBindings = null);
8538
+ }
8539
+ function i(a) {
8540
+ return !t.state.currentCatalogId && !t.state.currentSchedulerId ? (n(a), !0) : s(a);
8541
+ }
8542
+ function n(a) {
8543
+ t.updateMenu({
8544
+ module: entityExports.F_MENU_MODULE_V4_KEY.enum.item,
8545
+ operation: managerExports.F_OPERATION_TYPE.update,
8546
+ data: a
8507
8547
  });
8508
- return _.appContext = e.appContext, render(_, i), { instance: _, close: s, onOk: l, onCancel: c };
8509
8548
  }
8549
+ function s(a) {
8550
+ const o = getNewMenu(
8551
+ [a],
8552
+ t.state.menu,
8553
+ t.state.currentCatalogId,
8554
+ t.state.currentSchedulerId
8555
+ );
8556
+ if (t.state.currentCatalogId) {
8557
+ const l = o.modules.catalog.find(
8558
+ (c) => c._id === t.state.currentCatalogId
8559
+ );
8560
+ return t.updateMenu({
8561
+ module: entityExports.F_MENU_MODULE_V4_KEY.enum.catalog,
8562
+ operation: managerExports.F_OPERATION_TYPE.update,
8563
+ data: l
8564
+ }), !0;
8565
+ }
8566
+ if (t.state.currentSchedulerId) {
8567
+ const l = o.modules.scheduler.find(
8568
+ (c) => c._id === t.state.currentSchedulerId
8569
+ );
8570
+ return t.updateMenu({
8571
+ module: entityExports.F_MENU_MODULE_V4_KEY.enum.scheduler,
8572
+ operation: managerExports.F_OPERATION_TYPE.update,
8573
+ data: l
8574
+ }), !0;
8575
+ }
8576
+ return !1;
8577
+ }
8578
+ return {
8579
+ saveItemFormEditingState: r
8580
+ };
8581
+ }
8582
+ function getVariantName(e, t) {
8583
+ if (!t)
8584
+ throw new Error("combinationKey is required");
8585
+ if (!e[t])
8586
+ throw new Error(`variant mapping for ${t} is not found`);
8587
+ return e[t];
8588
+ }
8589
+ function isMenuV4(e) {
8590
+ return e._id.startsWith("mMenuV4");
8591
+ }
8592
+ function getItemOverrider({
8593
+ menu: e,
8594
+ catalogId: t,
8595
+ schedulerId: r,
8596
+ itemId: A
8597
+ }) {
8598
+ var i, n, s;
8599
+ if (!t && !r)
8600
+ throw new Error("catalogId or schedulerId are required");
8601
+ if (t && !r)
8602
+ return (i = e.modules.catalog.find((a) => a._id === t)) == null ? void 0 : i.override.items[A][0];
8603
+ if (!t && r)
8604
+ return (n = e.modules.scheduler.find((a) => a._id === r)) == null ? void 0 : n.items.find((a) => a._id === A);
8605
+ {
8606
+ const a = e.modules.catalog.find((l) => l._id === t), o = a == null ? void 0 : a.override.scheduler[r];
8607
+ return (s = o == null ? void 0 : o.items) == null ? void 0 : s.find((l) => l._id === A);
8608
+ }
8609
+ }
8610
+ function generateInitialForm(e, t, r, A) {
8611
+ const i = getItemOverrider({ menu: e, catalogId: t, schedulerId: r, itemId: A });
8612
+ if (!i)
8613
+ throw new Error(`Item overrider ${A} not found`);
8614
+ const n = e.modules.item.find((s) => s._id === A);
8615
+ if (!n)
8616
+ throw new Error(`Item ${A} not found in merged menu`);
8617
+ return overriderToItem(n, [i]);
8618
+ }
8619
+ function useItemSelection(e) {
8620
+ const t = ref(null), r = computed(() => t.value ? !e.state.currentCatalogId && !e.state.currentSchedulerId ? e.state.menu.modules.item.find(
8621
+ (i) => i._id === t.value
8622
+ ) : generateInitialForm(
8623
+ e.state.menu,
8624
+ e.state.currentCatalogId,
8625
+ e.state.currentSchedulerId,
8626
+ t.value
8627
+ ) : null), A = computed(() => `${e.state.currentCatalogId}-${e.state.currentSchedulerId}-${t.value}`);
8510
8628
  return {
8511
- open: t
8629
+ currentItemId: t,
8630
+ initialForm: r,
8631
+ itemFormKey: A
8512
8632
  };
8513
8633
  }
8514
8634
  function useEditorHistory({
@@ -8893,162 +9013,7 @@ const useMenuStore = defineStore(
8893
9013
  }
8894
9014
  };
8895
9015
  }
8896
- ), useTreeStore = defineStore("mf-menu-tree", () => {
8897
- const e = ref(), t = ref([]), r = ref(null), A = ref([]);
8898
- function i(c) {
8899
- t.value = c;
8900
- }
8901
- function n(c) {
8902
- r.value = c;
8903
- }
8904
- function s(c) {
8905
- A.value = c;
8906
- }
8907
- function a(c) {
8908
- if (c) {
8909
- for (const _ of t.value)
8910
- for (const u of _.children ?? [])
8911
- if (u.id.includes(c)) {
8912
- r.value = u.id;
8913
- return;
8914
- }
8915
- }
8916
- }
8917
- async function o() {
8918
- A.value = [];
8919
- }
8920
- function l() {
8921
- const c = [];
8922
- function _(u) {
8923
- c.push(u.id);
8924
- for (const g of u.children ?? [])
8925
- _(g);
8926
- }
8927
- for (const u of t.value)
8928
- _(u);
8929
- A.value = c;
8930
- }
8931
- return {
8932
- treeRef: e,
8933
- treeNodes: t,
8934
- selectedNodeId: r,
8935
- expandedNodeIds: A,
8936
- setTreeNodes: i,
8937
- setSelectedNodeId: n,
8938
- setSelectedNodeByItemId: a,
8939
- setExpandedNodeIds: s,
8940
- collapseAllNodes: o,
8941
- expandAllNodes: l
8942
- };
8943
- });
8944
- function useItemFormManagement(e, t) {
8945
- function r(a) {
8946
- if (!e.value)
8947
- return !1;
8948
- const o = e.value.validate();
8949
- if (o != null && o.length && o.length > 0)
8950
- return !1;
8951
- const l = a;
8952
- return A(l), i(l);
8953
- }
8954
- function A(a) {
8955
- a.inventoryBindings ?? (a.inventoryBindings = []), a.inventoryBindings.length === 0 && (a.inventoryBindings = null);
8956
- }
8957
- function i(a) {
8958
- return !t.state.currentCatalogId && !t.state.currentSchedulerId ? (n(a), !0) : s(a);
8959
- }
8960
- function n(a) {
8961
- t.updateMenu({
8962
- module: entityExports.F_MENU_MODULE_V4_KEY.enum.item,
8963
- operation: managerExports.F_OPERATION_TYPE.update,
8964
- data: a
8965
- });
8966
- }
8967
- function s(a) {
8968
- const o = getNewMenu(
8969
- [a],
8970
- t.state.menu,
8971
- t.state.currentCatalogId,
8972
- t.state.currentSchedulerId
8973
- );
8974
- if (t.state.currentCatalogId) {
8975
- const l = o.modules.catalog.find(
8976
- (c) => c._id === t.state.currentCatalogId
8977
- );
8978
- return t.updateMenu({
8979
- module: entityExports.F_MENU_MODULE_V4_KEY.enum.catalog,
8980
- operation: managerExports.F_OPERATION_TYPE.update,
8981
- data: l
8982
- }), !0;
8983
- }
8984
- if (t.state.currentSchedulerId) {
8985
- const l = o.modules.scheduler.find(
8986
- (c) => c._id === t.state.currentSchedulerId
8987
- );
8988
- return t.updateMenu({
8989
- module: entityExports.F_MENU_MODULE_V4_KEY.enum.scheduler,
8990
- operation: managerExports.F_OPERATION_TYPE.update,
8991
- data: l
8992
- }), !0;
8993
- }
8994
- return !1;
8995
- }
8996
- return {
8997
- saveItemFormEditingState: r
8998
- };
8999
- }
9000
- function getVariantName(e, t) {
9001
- if (!t)
9002
- throw new Error("combinationKey is required");
9003
- if (!e[t])
9004
- throw new Error(`variant mapping for ${t} is not found`);
9005
- return e[t];
9006
- }
9007
- function isMenuV4(e) {
9008
- return e._id.startsWith("mMenuV4");
9009
- }
9010
- function getItemOverrider({
9011
- menu: e,
9012
- catalogId: t,
9013
- schedulerId: r,
9014
- itemId: A
9015
- }) {
9016
- var i, n, s;
9017
- if (!t && !r)
9018
- throw new Error("catalogId or schedulerId are required");
9019
- if (t && !r)
9020
- return (i = e.modules.catalog.find((a) => a._id === t)) == null ? void 0 : i.override.items[A][0];
9021
- if (!t && r)
9022
- return (n = e.modules.scheduler.find((a) => a._id === r)) == null ? void 0 : n.items.find((a) => a._id === A);
9023
- {
9024
- const a = e.modules.catalog.find((l) => l._id === t), o = a == null ? void 0 : a.override.scheduler[r];
9025
- return (s = o == null ? void 0 : o.items) == null ? void 0 : s.find((l) => l._id === A);
9026
- }
9027
- }
9028
- function generateInitialForm(e, t, r, A) {
9029
- const i = getItemOverrider({ menu: e, catalogId: t, schedulerId: r, itemId: A });
9030
- if (!i)
9031
- throw new Error(`Item overrider ${A} not found`);
9032
- const n = e.modules.item.find((s) => s._id === A);
9033
- if (!n)
9034
- throw new Error(`Item ${A} not found in merged menu`);
9035
- return overriderToItem(n, [i]);
9036
- }
9037
- function useItemSelection(e) {
9038
- const t = ref(null), r = computed(() => t.value ? !e.state.currentCatalogId && !e.state.currentSchedulerId ? e.state.menu.modules.item.find(
9039
- (i) => i._id === t.value
9040
- ) : generateInitialForm(
9041
- e.state.menu,
9042
- e.state.currentCatalogId,
9043
- e.state.currentSchedulerId,
9044
- t.value
9045
- ) : null), A = computed(() => `${e.state.currentCatalogId}-${e.state.currentSchedulerId}-${t.value}`);
9046
- return {
9047
- currentItemId: t,
9048
- initialForm: r,
9049
- itemFormKey: A
9050
- };
9051
- }
9016
+ );
9052
9017
  var AnchorType = /* @__PURE__ */ ((e) => (e.GENERAL = "anchor-general", e.PRICE = "anchor-price", e.VARIANT = "anchor-variant", e.INVENTORY = "anchor-inventory", e.TAKEAWAY = "anchor-takeaway", e.GROUP = "anchor-group", e))(AnchorType || {});
9053
9018
  function getAnchorId(e, t) {
9054
9019
  return t ? `${e}-${t}` : e;
@@ -14006,67 +13971,83 @@ const _hoisted_1$8 = {
14006
13971
  },
14007
13972
  emits: ["update:show", "submit"],
14008
13973
  setup(e, { emit: t }) {
14009
- const r = useSnackbar(), { minor: A } = useLoading(r), { t: i } = useI18n(), n = t, s = () => {
14010
- n("update:show", !1);
14011
- }, a = useMenuStore();
14012
- a.selectCatalog(null), a.selectScheduler(null);
14013
- const o = () => {
14014
- }, l = () => {
14015
- };
14016
- return (c, _) => {
14017
- const u = resolveComponent("fm-button"), g = resolveComponent("fm-form");
13974
+ const r = e, A = useSnackbar(), { minor: i } = useLoading(A), { t: n } = useI18n(), s = t, a = () => {
13975
+ s("update:show", !1);
13976
+ }, o = useMenuStore$1(), l = useMenuStore();
13977
+ l.selectCatalog(null), l.selectScheduler(null);
13978
+ const c = ref(!1), _ = () => {
13979
+ i(
13980
+ async () => {
13981
+ const g = l.state.menu;
13982
+ await o.updateMenuSetting(g), await o.importMenu(g), a();
13983
+ },
13984
+ {
13985
+ isLoading: c,
13986
+ message: "Updating menu...",
13987
+ successMessage: "Menu updated successfully"
13988
+ }
13989
+ );
13990
+ }, u = useDiscardConfirm(
13991
+ () => !lodashExports.isEqual(r.menu.modules, l.state.menu.modules),
13992
+ () => {
13993
+ a();
13994
+ }
13995
+ );
13996
+ return (g, y) => {
13997
+ const V = resolveComponent("fm-button"), E = resolveComponent("fm-form");
14018
13998
  return openBlock(), createBlock(Teleport, { to: "body" }, [
14019
13999
  createVNode(Transition, { name: "fade" }, {
14020
14000
  default: withCtx(() => [
14021
- createVNode(g, {
14001
+ createVNode(E, {
14022
14002
  "blame-form-child-on-validation-failed": "",
14023
14003
  class: normalizeClass(["fixed inset-0", "flex flex-col", "w-screen h-dvh", "bg-fm-color-neutral-white"]),
14024
- style: normalizeStyle({ zIndex: c.zIndex }),
14004
+ style: normalizeStyle({ zIndex: g.zIndex }),
14025
14005
  tabindex: "-1",
14026
- onValidationSuccess: o,
14027
- onKeyup: withKeys(l, ["esc"])
14006
+ onValidationSuccess: _,
14007
+ onKeyup: withKeys(unref(u), ["esc"])
14028
14008
  }, {
14029
14009
  default: withCtx(() => [
14030
14010
  createElementVNode("div", _hoisted_1$1, [
14031
- _[0] || (_[0] = createElementVNode("p", { class: "fm-typo-en-title-sm-600 mr-auto" }, toDisplayString("Advanced Menu Editor"), -1)),
14011
+ y[0] || (y[0] = createElementVNode("p", { class: "fm-typo-en-title-sm-600 mr-auto" }, toDisplayString("Advanced Menu Editor"), -1)),
14032
14012
  createElementVNode("div", _hoisted_2$1, [
14033
- createVNode(u, {
14013
+ createVNode(V, {
14034
14014
  icon: "undo",
14035
- disabled: !unref(a).canUndoHistory,
14015
+ disabled: !unref(l).canUndoHistory,
14036
14016
  variant: "tertiary",
14037
- onClick: unref(a).undoHistory
14017
+ onClick: unref(l).undoHistory
14038
14018
  }, null, 8, ["disabled", "onClick"]),
14039
- createVNode(u, {
14019
+ createVNode(V, {
14040
14020
  icon: "redo",
14041
- disabled: !unref(a).canRedoHistory,
14021
+ disabled: !unref(l).canRedoHistory,
14042
14022
  variant: "tertiary",
14043
- onClick: unref(a).redoHistory
14023
+ onClick: unref(l).redoHistory
14044
14024
  }, null, 8, ["disabled", "onClick"]),
14045
- createVNode(u, {
14025
+ createVNode(V, {
14046
14026
  label: "Cancel",
14047
14027
  variant: "tertiary",
14048
- onClick: s
14049
- }),
14050
- createVNode(u, {
14028
+ onClick: unref(u)
14029
+ }, null, 8, ["onClick"]),
14030
+ createVNode(V, {
14051
14031
  label: "Save",
14052
14032
  type: "submit",
14053
- variant: "primary"
14054
- })
14033
+ variant: "primary",
14034
+ loading: c.value
14035
+ }, null, 8, ["loading"])
14055
14036
  ])
14056
14037
  ]),
14057
14038
  createElementVNode("div", _hoisted_3, [
14058
- createVNode(_sfc_main$3, { menu: c.menu }, null, 8, ["menu"])
14039
+ createVNode(_sfc_main$3, { menu: g.menu }, null, 8, ["menu"])
14059
14040
  ])
14060
14041
  ]),
14061
14042
  _: 1
14062
- }, 8, ["style"])
14043
+ }, 8, ["style", "onKeyup"])
14063
14044
  ]),
14064
14045
  _: 1
14065
14046
  })
14066
14047
  ]);
14067
14048
  };
14068
14049
  }
14069
- }), TreeEditorForm = /* @__PURE__ */ _export_sfc$1(_sfc_main$2, [["__scopeId", "data-v-f4da2c16"]]), _sfc_main$1 = /* @__PURE__ */ defineComponent({
14050
+ }), TreeEditorForm = /* @__PURE__ */ _export_sfc$1(_sfc_main$2, [["__scopeId", "data-v-47e1fcfc"]]), _sfc_main$1 = /* @__PURE__ */ defineComponent({
14070
14051
  __name: "TreeEditorOpenner",
14071
14052
  setup(e) {
14072
14053
  const t = useMenuStore$1(), r = useSheet();
@@ -2,9 +2,9 @@ import { defineComponent as K, computed as i, h as u, ref as U, resolveComponent
2
2
  import { useI18n as M } from "@feedmepos/mf-common";
3
3
  import { components as B, FmButtonColorThemeVariant as h, FmButtonVariant as I } from "@feedmepos/ui-library";
4
4
  import { _ as O } from "./FormSection.vue_vue_type_script_setup_true_lang-CO4YGYLB.js";
5
- import { L as $ } from "./LinkProductSideSheet-G8gTQJFi.js";
5
+ import { L as $ } from "./LinkProductSideSheet-DHNwDW2j.js";
6
6
  import { u as q } from "./search-BAPEUu1R.js";
7
- import { p as J, af as Q } from "./menu-Cf36nhdB.js";
7
+ import { p as J, af as Q } from "./menu-BmEDGId_.js";
8
8
  const W = { class: "space-y-16" }, X = { class: "flex items-center space-x-24" }, Y = {
9
9
  key: 0,
10
10
  class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary"