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

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