@feedmepos/mf-inventory-portal 1.0.8-dev.2 → 1.0.8-dev.4

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 (46) hide show
  1. package/dist/{App-VjopKXRf.js → App-CeVmkQub.js} +2 -2
  2. package/dist/{ApprovalView-Bc8OqfVg.js → ApprovalView-CASY5MAF.js} +2 -2
  3. package/dist/{BindingsDialog-zWAOfSXc.js → BindingsDialog-BTygQkdQ.js} +2 -2
  4. package/dist/{BindingsPicker-Bf5LuJiL.js → BindingsPicker-BKyKTKy2.js} +1 -1
  5. package/dist/{BindingsTable-D2N-3mnJ.js → BindingsTable-BY47Av1O.js} +1 -1
  6. package/dist/{ClosingDraftView-BwbzajJY.js → ClosingDraftView-BoTNo2o1.js} +2 -2
  7. package/dist/{ClosingTemplateView-CsAIbfui.js → ClosingTemplateView-Dy7syRYG.js} +2 -2
  8. package/dist/{DeliveryOrderPrintPreview-CjylpaJj.js → DeliveryOrderPrintPreview-BAGcBbNB.js} +1 -1
  9. package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-C_xdzdLD.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-C0w-mISZ.js} +3 -3
  10. package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-DhgHX4S_.js → FmUnitInput.vue_vue_type_script_setup_true_lang-DGtLNHyj.js} +1 -1
  11. package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-DPa8Pto8.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-lzFEj6Hf.js} +1 -1
  12. package/dist/{IngredientGroupView-D6YzbWdd.js → IngredientGroupView-Ci2sOcs3.js} +1 -1
  13. package/dist/{IngredientsView-g-73afqm.js → IngredientsView-JlljiUBe.js} +611 -588
  14. package/dist/{IntegrationView-CEML0dP4.js → IntegrationView-BDiVMLAt.js} +4 -4
  15. package/dist/{InventoryBindingForm-E0wJOA8L.js → InventoryBindingForm-CMhHePo4.js} +1 -1
  16. package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-DFXmypAs.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-DIUo8f8P.js} +3 -3
  17. package/dist/{InventoryBindingSummary-sBQvAPBw.js → InventoryBindingSummary-BsVghrpM.js} +1 -1
  18. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-DOeDgymo.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-DluLPOlY.js} +1 -1
  19. package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-DIqYY1-C.js → PremiumBadge.vue_vue_type_script_setup_true_lang-Dc2GwX4b.js} +1 -1
  20. package/dist/{PublishView-D_psCmiQ.js → PublishView-DLIN2_IX.js} +2 -2
  21. package/dist/{PurchaseOrderPrintPreview-5QqjPwWN.js → PurchaseOrderPrintPreview-Cgtdvsbj.js} +1 -1
  22. package/dist/{ReceiveRequestView-CBGxqac6.js → ReceiveRequestView-DwV5jYBB.js} +9 -9
  23. package/dist/RecipeView-C461dqDh.js +616 -0
  24. package/dist/{StockView-Bc62jbCV.js → StockView-byktfw-3.js} +7 -7
  25. package/dist/{SupplierView-Cyucz_US.js → SupplierView-B5VzYr8I.js} +4 -4
  26. package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-CljJoB4v.js → TransferDetails.vue_vue_type_script_setup_true_lang-BURACj2S.js} +6 -6
  27. package/dist/{TransferTemplateView-BWURlmou.js → TransferTemplateView-sThwk6bC.js} +7 -7
  28. package/dist/{UnitView-cjLpKfoN.js → UnitView-Bq58Ygjw.js} +3 -3
  29. package/dist/{WarehouseView-CUtg5Aiw.js → WarehouseView-DlsvVNBw.js} +1 -1
  30. package/dist/{app-Dgg5mqsW.js → app-DDc0tej1.js} +59 -59
  31. package/dist/app.js +1 -1
  32. package/dist/{decimal-DcqP_fAm.js → decimal-BsCmjFyV.js} +1 -1
  33. package/dist/{feature-C4mZ_d2m.js → feature-cV88rK2J.js} +2 -2
  34. package/dist/{format-unit-display-D2Uk9Ze_.js → format-unit-display-DQtG4HGq.js} +2 -2
  35. package/dist/{index-peSGn9vg.js → index-CZyDK6iO.js} +2 -2
  36. package/dist/{index-YuTB_T1B.js → index-DserUGdJ.js} +1 -1
  37. package/dist/{stock-CDP8ZqBZ.js → stock-hGbvkFzv.js} +1 -1
  38. package/dist/{supplier-C5GbDMxT.js → supplier-_fcbiDV1.js} +1 -1
  39. package/dist/tsconfig.app.tsbuildinfo +1 -1
  40. package/dist/{use-ingredient-select-dialog-nH01sayt.js → use-ingredient-select-dialog-BRYUJiIK.js} +1 -1
  41. package/dist/{use-inventory-binding-dialog-CJe6QdGb.js → use-inventory-binding-dialog-BT6sz89F.js} +1 -1
  42. package/dist/views/ingredients/helper/import-export.helper.d.ts +3 -0
  43. package/dist/views/ingredients/helper/import-export.helper.spec.d.ts +1 -0
  44. package/dist/{vue-i18n-NNRWZURD.js → vue-i18n-BaSy3P7T.js} +158 -158
  45. package/package.json +4 -4
  46. package/dist/RecipeView-BAjHNWST.js +0 -610
@@ -1,72 +1,72 @@
1
- import { ref as q, defineComponent as te, computed as S, resolveComponent as C, openBlock as f, createBlock as B, withCtx as V, createVNode as c, unref as d, createElementBlock as T, Fragment as X, createElementVNode as m, createCommentVNode as j, renderSlot as ce, createTextVNode as Me, toDisplayString as A, normalizeClass as ee, onMounted as at, watch as Ye, renderList as re, isRef as De, createSlots as Ge, normalizeStyle as rt, Teleport as Pe, normalizeProps as st, guardReactiveProps as it } from "vue";
2
- import { a as ne, d as K, e as We, S as dt, f as ut, D as Be, h as be, A as _e, b as Ie, i as Ke, j as xe, t as Ze, k as ve, l as Ve, U as mt, m as ct, M as pt, n as Ne, o as ze, p as Le, q as Je, r as vt, s as Qe, v as ft, w as yt, I as gt, x as bt, y as ht, u as _t, z as xt, _ as kt, B as Vt, C as St, E as He } from "./app-Dgg5mqsW.js";
3
- import { useDialog as Xe, useSnackbar as ke, useProxiedModel as Oe, useDialogChild as Ct, useBreakpoints as wt } from "@feedmepos/ui-library";
4
- import { i as Ft, _ as Mt } from "./is-linked-ingredient-error-fJ2TJb3z.js";
1
+ import { ref as q, defineComponent as te, computed as S, resolveComponent as w, openBlock as f, createBlock as B, withCtx as V, createVNode as c, unref as d, createElementBlock as A, Fragment as X, createElementVNode as m, createCommentVNode as j, renderSlot as ce, createTextVNode as Me, toDisplayString as T, normalizeClass as ee, onMounted as st, watch as Ye, renderList as se, isRef as De, createSlots as Ge, normalizeStyle as rt, Teleport as Pe, normalizeProps as it, guardReactiveProps as ut } from "vue";
2
+ import { a as ne, d as K, e as We, S as dt, f as mt, D as Be, h as be, A as _e, b as Ie, i as Ke, j as xe, t as Ze, k as ve, l as Ve, U as ct, m as pt, M as vt, n as Ne, o as ze, p as Le, q as Je, r as ft, s as Qe, v as yt, w as gt, I as bt, x as ht, y as _t, u as xt, z as kt, _ as Vt, B as St, C as Ct, E as He } from "./app-DDc0tej1.js";
3
+ import { useDialog as Xe, useSnackbar as ke, useProxiedModel as Oe, useDialogChild as wt, useBreakpoints as Ft } from "@feedmepos/ui-library";
4
+ import { i as Mt, _ as It } from "./is-linked-ingredient-error-fJ2TJb3z.js";
5
5
  import { useI18n as oe, useCoreStore as fe } from "@feedmepos/mf-common";
6
- import { defineStore as It, storeToRefs as $t } from "pinia";
7
- import { g as Et, _ as Se, S as Ce } from "./StockForecast.vue_vue_type_style_index_0_lang-KLXSWvo5.js";
8
- import { _ as Ut } from "./InventoryBindingForm.vue_vue_type_script_setup_true_lang-DFXmypAs.js";
9
- import { _ as we } from "./IngredientBindedItem.vue_vue_type_script_setup_true_lang-DPa8Pto8.js";
10
- import { u as et } from "./feature-C4mZ_d2m.js";
6
+ import { defineStore as $t, storeToRefs as Et } from "pinia";
7
+ import { g as Ut, _ as Se, S as Ce } from "./StockForecast.vue_vue_type_style_index_0_lang-KLXSWvo5.js";
8
+ import { _ as Rt } from "./InventoryBindingForm.vue_vue_type_script_setup_true_lang-DIUo8f8P.js";
9
+ import { _ as we } from "./IngredientBindedItem.vue_vue_type_script_setup_true_lang-lzFEj6Hf.js";
10
+ import { u as et } from "./feature-cV88rK2J.js";
11
11
  import { _ as he } from "./PreviewBadge.vue_vue_type_script_setup_true_lang-CRZiQHjx.js";
12
- import { _ as Rt } from "./FmCustomAttribute.vue_vue_type_script_setup_true_lang-D-IWRjRD.js";
12
+ import { _ as At } from "./FmCustomAttribute.vue_vue_type_script_setup_true_lang-D-IWRjRD.js";
13
13
  import "./array-hChJVZLE.js";
14
- const Fe = It("ingredientForm", function() {
15
- const o = Xe(), y = ke(), r = ne(), n = q(!1), { t: l } = oe(), i = q();
16
- function a() {
17
- const b = {
14
+ const Fe = $t("ingredientForm", function() {
15
+ const o = Xe(), v = ke(), a = ne(), n = q(!1), { t: l } = oe(), u = q();
16
+ function r() {
17
+ const g = {
18
18
  unit: {},
19
19
  mode: K.CREATE,
20
20
  show: !0,
21
- "onUpdate:show"(s) {
22
- i.value.show = s;
21
+ "onUpdate:show"(i) {
22
+ u.value.show = i;
23
23
  }
24
24
  };
25
- i.value = b;
25
+ u.value = g;
26
26
  }
27
- async function h(b) {
28
- const s = {
29
- unit: We(b),
27
+ async function b(g) {
28
+ const i = {
29
+ unit: We(g),
30
30
  mode: K.UPDATE,
31
31
  show: !0,
32
- "onUpdate:show"(x) {
33
- i.value.show = x;
32
+ "onUpdate:show"(_) {
33
+ u.value.show = _;
34
34
  }
35
35
  };
36
- i.value = s;
36
+ u.value = i;
37
37
  }
38
- async function k(b) {
38
+ async function h(g) {
39
39
  n.value = !0;
40
40
  try {
41
- await r.deleteSku(b), y.open({
41
+ await a.deleteSku(g), v.open({
42
42
  title: "Success",
43
- message: `Deleted ${b.name}`,
43
+ message: `Deleted ${g.name}`,
44
44
  type: "success"
45
45
  });
46
- } catch (s) {
47
- s instanceof dt && Ft(s) ? o.open({
46
+ } catch (i) {
47
+ i instanceof dt && Mt(i) ? o.open({
48
48
  title: "Cannot delete ingredient",
49
- contentComponent: Mt,
49
+ contentComponent: It,
50
50
  contentComponentProps: {
51
- subject: (b == null ? void 0 : b.name) ?? "",
52
- items: s.errorResponse.message
51
+ subject: (g == null ? void 0 : g.name) ?? "",
52
+ items: i.errorResponse.message
53
53
  },
54
54
  secondaryActions: {
55
55
  text: "Close",
56
56
  close: !0
57
57
  }
58
- }) : console.log("unable to delete ingredient", s), y.open({
59
- title: `Cannot delete ${b.name}`,
58
+ }) : console.log("unable to delete ingredient", i), v.open({
59
+ title: `Cannot delete ${g.name}`,
60
60
  message: "Please try again.",
61
61
  type: "error"
62
- }), console.error("failed to delete ingredient", s);
62
+ }), console.error("failed to delete ingredient", i);
63
63
  } finally {
64
64
  n.value = !1;
65
65
  }
66
66
  }
67
- function g(b) {
67
+ function y(g) {
68
68
  o.open({
69
- title: l("inventory.ingredient.delete.title", [(b == null ? void 0 : b.name) ?? ""]),
69
+ title: l("inventory.ingredient.delete.title", [(g == null ? void 0 : g.name) ?? ""]),
70
70
  closeButton: !1,
71
71
  message: l("inventory.ingredient.delete.message"),
72
72
  primaryActions: {
@@ -78,56 +78,56 @@ const Fe = It("ingredientForm", function() {
78
78
  text: l("common.cancel"),
79
79
  close: !0
80
80
  }
81
- }).onPrimary(() => k(b));
81
+ }).onPrimary(() => h(g));
82
82
  }
83
83
  return {
84
- createIngredient: a,
85
- updateIngredient: h,
86
- deleteIngredient: g,
87
- ingredientDialogProps: i,
84
+ createIngredient: r,
85
+ updateIngredient: b,
86
+ deleteIngredient: y,
87
+ ingredientDialogProps: u,
88
88
  ingredientViewLoading: n
89
89
  };
90
90
  });
91
91
  function Tt() {
92
- const { updateIngredient: u, deleteIngredient: o } = Fe(), { t: y } = oe();
93
- async function r(l, i) {
94
- const a = We(i);
92
+ const { updateIngredient: s, deleteIngredient: o } = Fe(), { t: v } = oe();
93
+ async function a(l, u) {
94
+ const r = We(u);
95
95
  if (l === be.Edit) {
96
- await u(a);
96
+ await s(r);
97
97
  return;
98
98
  }
99
99
  if (l === be.Delete) {
100
- await o(a);
100
+ await o(r);
101
101
  return;
102
102
  }
103
103
  }
104
104
  return { columnDefs: [
105
105
  {
106
106
  accessorKey: "code",
107
- header: () => y("inventory.ingredient.code"),
107
+ header: () => v("inventory.ingredient.code"),
108
108
  enableSorting: !0,
109
109
  size: 300
110
110
  },
111
111
  {
112
112
  accessorKey: "name",
113
- header: () => y("inventory.ingredient.name"),
113
+ header: () => v("inventory.ingredient.name"),
114
114
  enableSorting: !0,
115
115
  size: 300
116
116
  },
117
117
  {
118
118
  id: "unit",
119
- header: () => y("inventory.ingredient.unit"),
119
+ header: () => v("inventory.ingredient.unit"),
120
120
  cell(l) {
121
- var a;
122
- const i = l.row.original;
123
- if (i.trackingMeasurement) {
124
- const h = (a = i.unit.measurements) == null ? void 0 : a.find(
125
- (k) => k.id === i.trackingMeasurement
121
+ var r;
122
+ const u = l.row.original;
123
+ if (u.trackingMeasurement) {
124
+ const b = (r = u.unit.measurements) == null ? void 0 : r.find(
125
+ (h) => h.id === u.trackingMeasurement
126
126
  );
127
- if (h)
128
- return `${h.name} (${h.abbrev})`;
127
+ if (b)
128
+ return `${b.name} (${b.abbrev})`;
129
129
  }
130
- return `${i.unit.name} (${i.unit.abbrev})`;
130
+ return `${u.unit.name} (${u.unit.abbrev})`;
131
131
  },
132
132
  enableSorting: !1,
133
133
  size: "auto"
@@ -136,10 +136,10 @@ function Tt() {
136
136
  id: "action",
137
137
  header: "",
138
138
  cell(l) {
139
- return ut(
139
+ return mt(
140
140
  [Be[be.Edit], Be[be.Delete]],
141
- (i) => {
142
- r(i, l.row.original);
141
+ (u) => {
142
+ a(u, l.row.original);
143
143
  }
144
144
  );
145
145
  },
@@ -152,7 +152,7 @@ function Tt() {
152
152
  }
153
153
  ] };
154
154
  }
155
- const At = /* @__PURE__ */ te({
155
+ const Dt = /* @__PURE__ */ te({
156
156
  __name: "ConvertForm",
157
157
  props: {
158
158
  modelValue: {},
@@ -161,72 +161,72 @@ const At = /* @__PURE__ */ te({
161
161
  readonly: { type: Boolean }
162
162
  },
163
163
  emits: ["update:modelValue"],
164
- setup(u, { emit: o }) {
165
- const y = u, r = S(() => {
166
- var s;
167
- return (s = y.rootValue) == null ? void 0 : s.unit;
164
+ setup(s, { emit: o }) {
165
+ const v = s, a = S(() => {
166
+ var i;
167
+ return (i = v.rootValue) == null ? void 0 : i.unit;
168
168
  }), n = S(() => {
169
- var s;
170
- return (s = y.rootValue) == null ? void 0 : s._id;
171
- }), l = o, { t: i } = oe(), a = S({
169
+ var i;
170
+ return (i = v.rootValue) == null ? void 0 : i._id;
171
+ }), l = o, { t: u } = oe(), r = S({
172
172
  get() {
173
- return !!y.modelValue;
173
+ return !!v.modelValue;
174
174
  },
175
- set(s) {
176
- s ? l("update:modelValue", {
175
+ set(i) {
176
+ i ? l("update:modelValue", {
177
177
  measurement: null,
178
178
  inventoryBindings: []
179
179
  }) : l("update:modelValue", null);
180
180
  }
181
- }), h = S(() => Et(r.value));
182
- function k(s) {
183
- const x = y.modelValue ?? {};
184
- x.measurement = s ? `${s}` : null, l("update:modelValue", x);
181
+ }), b = S(() => Ut(a.value));
182
+ function h(i) {
183
+ const _ = v.modelValue ?? {};
184
+ _.measurement = i ? `${i}` : null, l("update:modelValue", _);
185
185
  }
186
- function g(s) {
187
- const x = y.modelValue ?? {};
188
- x.inventoryBindings = s, l("update:modelValue", x);
186
+ function y(i) {
187
+ const _ = v.modelValue ?? {};
188
+ _.inventoryBindings = i, l("update:modelValue", _);
189
189
  }
190
- const b = S(() => {
191
- if (!y.modelValue) return null;
192
- const s = y.modelValue;
193
- return s.measurement ? h.value.find((x) => x.value === s.measurement) ?? null : h.value.find((x) => x.value === null) ?? null;
190
+ const g = S(() => {
191
+ if (!v.modelValue) return null;
192
+ const i = v.modelValue;
193
+ return i.measurement ? b.value.find((_) => _.value === i.measurement) ?? null : b.value.find((_) => _.value === null) ?? null;
194
194
  });
195
- return (s, x) => {
196
- const U = C("FmSwitch"), I = C("FmSelect"), N = C("FmCard");
195
+ return (i, _) => {
196
+ const R = w("FmSwitch"), F = w("FmSelect"), N = w("FmCard");
197
197
  return f(), B(N, {
198
198
  variant: "outlined",
199
199
  class: "p-16 flex flex-col gap-16"
200
200
  }, {
201
201
  default: V(() => {
202
- var w, v;
202
+ var $, C;
203
203
  return [
204
- c(U, {
204
+ c(R, {
205
205
  value: "",
206
- "model-value": a.value,
207
- "onUpdate:modelValue": x[0] || (x[0] = (R) => a.value = R),
208
- label: d(i)("inventory.ingredient.convertible.title"),
209
- sublabel: d(i)("inventory.ingredient.convertible.subtitle"),
206
+ "model-value": r.value,
207
+ "onUpdate:modelValue": _[0] || (_[0] = (x) => r.value = x),
208
+ label: d(u)("inventory.ingredient.convertible.title"),
209
+ sublabel: d(u)("inventory.ingredient.convertible.subtitle"),
210
210
  labelPlacement: "right",
211
- disabled: s.readonly
211
+ disabled: i.readonly
212
212
  }, null, 8, ["model-value", "label", "sublabel", "disabled"]),
213
- a.value ? (f(), T(X, { key: 0 }, [
213
+ r.value ? (f(), A(X, { key: 0 }, [
214
214
  m("div", null, [
215
- c(I, {
216
- label: d(i)("inventory.ingredient.convertible.convertTo"),
217
- modelValue: (w = b.value) == null ? void 0 : w.value,
218
- "onUpdate:modelValue": k,
219
- items: h.value,
220
- disabled: s.readonly
215
+ c(F, {
216
+ label: d(u)("inventory.ingredient.convertible.convertTo"),
217
+ modelValue: ($ = g.value) == null ? void 0 : $.value,
218
+ "onUpdate:modelValue": h,
219
+ items: b.value,
220
+ disabled: i.readonly
221
221
  }, null, 8, ["label", "modelValue", "items", "disabled"])
222
222
  ]),
223
- c(Ut, {
223
+ c(Rt, {
224
224
  id: n.value,
225
- "model-value": ((v = s.modelValue) == null ? void 0 : v.inventoryBindings) ?? [],
226
- "onUpdate:modelValue": g,
225
+ "model-value": ((C = i.modelValue) == null ? void 0 : C.inventoryBindings) ?? [],
226
+ "onUpdate:modelValue": y,
227
227
  "exclude-binding-id": n.value,
228
228
  rules: [d(_e)(1)],
229
- readonly: s.readonly
229
+ readonly: i.readonly
230
230
  }, null, 8, ["id", "model-value", "exclude-binding-id", "rules", "readonly"])
231
231
  ], 64)) : j("", !0)
232
232
  ];
@@ -242,7 +242,7 @@ function ae() {
242
242
  mid: 14
243
243
  };
244
244
  }
245
- const Dt = {
245
+ const Pt = {
246
246
  key: 0,
247
247
  class: "flex flex-col gap-4"
248
248
  }, pe = /* @__PURE__ */ te({
@@ -257,18 +257,18 @@ const Dt = {
257
257
  tooltipPlacement: {},
258
258
  tooltipZIndex: {}
259
259
  },
260
- setup(u) {
261
- return (o, y) => {
262
- const r = C("FmLabel"), n = C("FmIcon"), l = C("FmTooltip"), i = C("FmField");
263
- return o.locked ? (f(), T("div", Dt, [
260
+ setup(s) {
261
+ return (o, v) => {
262
+ const a = w("FmLabel"), n = w("FmIcon"), l = w("FmTooltip"), u = w("FmField");
263
+ return o.locked ? (f(), A("div", Pt, [
264
264
  ce(o.$slots, "label", {}, () => [
265
- c(r, {
265
+ c(a, {
266
266
  label: o.label,
267
267
  disabled: o.disabled
268
268
  }, null, 8, ["label", "disabled"])
269
269
  ]),
270
270
  ce(o.$slots, "field", {}, () => [
271
- c(i, { disabled: o.disabled }, {
271
+ c(u, { disabled: o.disabled }, {
272
272
  prepend: V(() => [
273
273
  o.tooltipMessage ? (f(), B(l, {
274
274
  key: 0,
@@ -276,7 +276,7 @@ const Dt = {
276
276
  "z-index": o.tooltipZIndex
277
277
  }, {
278
278
  content: V(() => [
279
- Me(A(o.tooltipMessage), 1)
279
+ Me(T(o.tooltipMessage), 1)
280
280
  ]),
281
281
  default: V(() => [
282
282
  c(n, {
@@ -298,7 +298,7 @@ const Dt = {
298
298
  o.disabled ? "text-fm-color-typo-disabled" : "text-fm-color-typo-primary",
299
299
  "line-clamp-1 text-ellipsis break-all"
300
300
  ])
301
- }, A(o.modelValue), 3)
301
+ }, T(o.modelValue), 3)
302
302
  ])
303
303
  ]),
304
304
  _: 3
@@ -310,15 +310,15 @@ const Dt = {
310
310
  "fm-typo-en-body-sm-400 line-clamp-1",
311
311
  o.disabled ? "text-fm-color-typo-disabled" : "text-fm-color-typo-secondary"
312
312
  ])
313
- }, A(o.helperText), 3)
313
+ }, T(o.helperText), 3)
314
314
  ])
315
315
  ])) : ce(o.$slots, "default", { key: 1 });
316
316
  };
317
317
  }
318
- }), Pt = { class: "flex gap-8" }, Bt = { class: "flex-1" }, Nt = { class: "flex-1" }, zt = { class: "text-fm-color-typo-secondary" }, Lt = { class: "text-fm-color-typo-secondary whitespace-nowrap" }, Ht = {
318
+ }), Bt = { class: "flex gap-8" }, Nt = { class: "flex-1" }, zt = { class: "flex-1" }, Lt = { class: "text-fm-color-typo-secondary" }, Ht = { class: "text-fm-color-typo-secondary whitespace-nowrap" }, Ot = {
319
319
  key: 3,
320
320
  class: "border-1 border-fm-color-neutral-gray-200 fm-corner-radius-lg flex flex-col p-16 gap-16"
321
- }, Ot = { class: "flex flex-col gap-12" }, jt = { class: "flex flex-col gap-4" }, qt = { class: "fm-typo-en-title-sm-600" }, Yt = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Gt = { class: "flex flex-col gap-4" }, Wt = { class: "flex fm-corner-radius-md border-1 border-fm-color-neutral-gray-200" }, Kt = { class: "flex-1 p-12 flex flex-col gap-8" }, Zt = { class: "mx-auto" }, Jt = { class: "flex flex-col" }, Qt = { class: "fm-typo-en-body-sm-600 translate-y-4" }, Xt = { class: "flex-1 p-12 flex flex-col gap-8" }, en = { class: "mx-auto" }, tn = { class: "flex flex-col" }, nn = { class: "fm-typo-en-body-sm-600 translate-y-4" }, on = { class: "flex-1 p-12 flex flex-col gap-8" }, ln = { class: "mx-auto" }, an = { class: "flex flex-col" }, rn = { class: "fm-typo-en-body-sm-600 translate-y-4" }, sn = /* @__PURE__ */ te({
321
+ }, jt = { class: "flex flex-col gap-12" }, qt = { class: "flex flex-col gap-4" }, Yt = { class: "fm-typo-en-title-sm-600" }, Gt = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Wt = { class: "flex flex-col gap-4" }, Kt = { class: "flex fm-corner-radius-md border-1 border-fm-color-neutral-gray-200" }, Zt = { class: "flex-1 p-12 flex flex-col gap-8" }, Jt = { class: "mx-auto" }, Qt = { class: "flex flex-col" }, Xt = { class: "fm-typo-en-body-sm-600 translate-y-4" }, en = { class: "flex-1 p-12 flex flex-col gap-8" }, tn = { class: "mx-auto" }, nn = { class: "flex flex-col" }, on = { class: "fm-typo-en-body-sm-600 translate-y-4" }, ln = { class: "flex-1 p-12 flex flex-col gap-8" }, an = { class: "mx-auto" }, sn = { class: "flex flex-col" }, rn = { class: "fm-typo-en-body-sm-600 translate-y-4" }, un = /* @__PURE__ */ te({
322
322
  __name: "IngredientForm",
323
323
  props: {
324
324
  mode: {},
@@ -326,25 +326,25 @@ const Dt = {
326
326
  disabled: { type: Boolean }
327
327
  },
328
328
  emits: ["update:modelValue", "click:submit"],
329
- setup(u, { expose: o, emit: y }) {
330
- var ue;
331
- const { t: r } = oe(), n = u, l = y, i = ne(), a = fe(), h = et(), k = Ie(), g = S(() => k.isEnabled);
332
- function b(t) {
329
+ setup(s, { expose: o, emit: v }) {
330
+ var de;
331
+ const { t: a } = oe(), n = s, l = v, u = ne(), r = fe(), b = et(), h = Ie(), y = S(() => h.isEnabled);
332
+ function g(t) {
333
333
  if (t.length === 0) return;
334
334
  const e = t[0], p = n.modelValue ?? {
335
- unit: i.units.find((_) => _)
335
+ unit: u.units.find((k) => k)
336
336
  };
337
337
  p.unit || (p.unit = e, l("update:modelValue", p));
338
338
  }
339
- at(() => {
340
- b(i.units);
341
- }), Ye([() => i.units], ([t]) => {
342
- b(t);
339
+ st(() => {
340
+ g(u.units);
341
+ }), Ye([() => u.units], ([t]) => {
342
+ g(t);
343
343
  });
344
- function s() {
344
+ function i() {
345
345
  l("click:submit");
346
346
  }
347
- const x = S({
347
+ const _ = S({
348
348
  get() {
349
349
  var t;
350
350
  return ((t = n.modelValue) == null ? void 0 : t.code) ?? "";
@@ -355,7 +355,7 @@ const Dt = {
355
355
  } : {};
356
356
  e.code = t, l("update:modelValue", e);
357
357
  }
358
- }), U = S({
358
+ }), R = S({
359
359
  get() {
360
360
  var t;
361
361
  return ((t = n.modelValue) == null ? void 0 : t.name) ?? "";
@@ -366,14 +366,14 @@ const Dt = {
366
366
  } : {};
367
367
  e.name = t, l("update:modelValue", e);
368
368
  }
369
- }), I = S({
369
+ }), F = S({
370
370
  get() {
371
371
  var e, p;
372
372
  const t = (p = (e = n.modelValue) == null ? void 0 : e.defaultCost) == null ? void 0 : p.costPerUnit;
373
373
  return t ? +Ke(t) : 0;
374
374
  },
375
375
  set(t) {
376
- var p, _, E, F;
376
+ var p, k, U, M;
377
377
  const e = n.modelValue ? {
378
378
  ...n.modelValue
379
379
  } : {};
@@ -381,9 +381,9 @@ const Dt = {
381
381
  costPerUnit: {
382
382
  amount: 0,
383
383
  precision: 2,
384
- currency: ((p = xe(a.currentCountry.value)) == null ? void 0 : p.currency) ?? "MYR"
384
+ currency: ((p = xe(r.currentCountry.value)) == null ? void 0 : p.currency) ?? "MYR"
385
385
  },
386
- measurement: (F = (E = (_ = n.modelValue) == null ? void 0 : _.unit) == null ? void 0 : E.measurements) == null ? void 0 : F.find(
386
+ measurement: (M = (U = (k = n.modelValue) == null ? void 0 : k.unit) == null ? void 0 : U.measurements) == null ? void 0 : M.find(
387
387
  (O) => {
388
388
  var G;
389
389
  return O.id === ((G = n.modelValue) == null ? void 0 : G.trackingMeasurement);
@@ -395,18 +395,18 @@ const Dt = {
395
395
  }, l("update:modelValue", e);
396
396
  }
397
397
  }), N = S(() => {
398
- var e, p, _;
399
- const t = ((e = n.modelValue) == null ? void 0 : e.unit) ?? i.units.find((E) => E);
398
+ var e, p, k;
399
+ const t = ((e = n.modelValue) == null ? void 0 : e.unit) ?? u.units.find((U) => U);
400
400
  return t ? {
401
401
  _id: t._id,
402
402
  measurement: (p = n.modelValue) == null ? void 0 : p.trackingMeasurement,
403
- name: ((_ = t.measurements.find((E) => {
404
- var F;
405
- return E.id === ((F = n.modelValue) == null ? void 0 : F.trackingMeasurement);
406
- })) == null ? void 0 : _.name) ?? t.name
403
+ name: ((k = t.measurements.find((U) => {
404
+ var M;
405
+ return U.id === ((M = n.modelValue) == null ? void 0 : M.trackingMeasurement);
406
+ })) == null ? void 0 : k.name) ?? t.name
407
407
  } : null;
408
- }), w = S(
409
- () => i.units.flatMap(({ name: t, _id: e, abbrev: p, measurements: _ }) => [
408
+ }), $ = S(
409
+ () => u.units.flatMap(({ name: t, _id: e, abbrev: p, measurements: k }) => [
410
410
  {
411
411
  label: `${t}`,
412
412
  value: null,
@@ -417,34 +417,34 @@ const Dt = {
417
417
  value: { _id: e },
418
418
  displayAsSection: !1
419
419
  },
420
- ..._.map(({ id: E, name: F, abbrev: O }) => ({
421
- label: `${F} (${O})`,
422
- value: { _id: e, measurement: E },
420
+ ...k.map(({ id: U, name: M, abbrev: O }) => ({
421
+ label: `${M} (${O})`,
422
+ value: { _id: e, measurement: U },
423
423
  displayAsSection: !1
424
424
  }))
425
425
  ])
426
426
  );
427
- function v(t) {
428
- var e, p, _, E, F;
429
- return ((p = (e = n.modelValue) == null ? void 0 : e.unit) == null ? void 0 : p._id) === ((_ = t.value) == null ? void 0 : _._id) && ((E = n.modelValue) == null ? void 0 : E.trackingMeasurement) === ((F = t.value) == null ? void 0 : F.measurement);
427
+ function C(t) {
428
+ var e, p, k, U, M;
429
+ return ((p = (e = n.modelValue) == null ? void 0 : e.unit) == null ? void 0 : p._id) === ((k = t.value) == null ? void 0 : k._id) && ((U = n.modelValue) == null ? void 0 : U.trackingMeasurement) === ((M = t.value) == null ? void 0 : M.measurement);
430
430
  }
431
- function R(t) {
431
+ function x(t) {
432
432
  var O, G;
433
433
  if (!t) return;
434
- const { _id: e, measurement: p } = t, _ = p || void 0, E = i.units.find((me) => me._id === e);
435
- if (!E)
434
+ const { _id: e, measurement: p } = t, k = p || void 0, U = u.units.find((me) => me._id === e);
435
+ if (!U)
436
436
  return;
437
- const F = n.modelValue ?? {};
438
- F.unit = E, F.trackingMeasurement = _, F.convert && (F.convert.measurement = _ || null), h.enableTotalCost && (F.defaultCost = {
439
- measurement: E.measurements.find((me) => me.id === _),
437
+ const M = n.modelValue ?? {};
438
+ M.unit = U, M.trackingMeasurement = k, M.convert && (M.convert.measurement = k || null), b.enableTotalCost && (M.defaultCost = {
439
+ measurement: U.measurements.find((me) => me.id === k),
440
440
  costPerUnit: {
441
- ...((O = F.defaultCost) == null ? void 0 : O.costPerUnit) ?? {
441
+ ...((O = M.defaultCost) == null ? void 0 : O.costPerUnit) ?? {
442
442
  amount: 0,
443
443
  precision: 2,
444
- currency: ((G = xe(a.currentCountry.value)) == null ? void 0 : G.currency) ?? "MYR"
444
+ currency: ((G = xe(r.currentCountry.value)) == null ? void 0 : G.currency) ?? "MYR"
445
445
  }
446
446
  }
447
- }), l("update:modelValue", F);
447
+ }), l("update:modelValue", M);
448
448
  }
449
449
  const J = S({
450
450
  get() {
@@ -460,7 +460,7 @@ const Dt = {
460
460
  }), Z = S(() => ve.options.filter(
461
461
  (t) => t === ve.enum.FIFO || t === ve.enum.WAVG
462
462
  ).map((t) => ({
463
- label: r(`inventory.ingredient.valuationMethod.${t}`),
463
+ label: a(`inventory.ingredient.valuationMethod.${t}`),
464
464
  value: t
465
465
  }))), L = S({
466
466
  get() {
@@ -499,42 +499,42 @@ const Dt = {
499
499
  (e = (t = H.value) == null ? void 0 : t.resetInputs) == null || e.call(t);
500
500
  }
501
501
  });
502
- const Q = q(!1), se = S(
502
+ const Q = q(!1), re = S(
503
503
  () => {
504
504
  var t, e, p;
505
- return (t = n.modelValue) != null && t._id ? ((p = i.menu.bindedBySkuId[(e = n.modelValue) == null ? void 0 : e._id]) == null ? void 0 : p.filter(
506
- (_) => _.from === "INGREDIENT"
505
+ return (t = n.modelValue) != null && t._id ? ((p = u.menu.bindedBySkuId[(e = n.modelValue) == null ? void 0 : e._id]) == null ? void 0 : p.filter(
506
+ (k) => k.from === "INGREDIENT"
507
507
  )) ?? [] : [];
508
508
  }
509
509
  ), ye = S(
510
510
  () => {
511
511
  var t, e, p;
512
- return (t = n.modelValue) != null && t._id ? ((p = i.menu.bindedBySkuId[(e = n.modelValue) == null ? void 0 : e._id]) == null ? void 0 : p.filter(
513
- (_) => _.from === "RECIPE"
512
+ return (t = n.modelValue) != null && t._id ? ((p = u.menu.bindedBySkuId[(e = n.modelValue) == null ? void 0 : e._id]) == null ? void 0 : p.filter(
513
+ (k) => k.from === "RECIPE"
514
514
  )) ?? [] : [];
515
515
  }
516
516
  ), D = S(
517
517
  () => {
518
518
  var t, e, p;
519
- return (t = n.modelValue) != null && t._id ? ((p = i.menu.bindedBySkuId[(e = n.modelValue) == null ? void 0 : e._id]) == null ? void 0 : p.filter((_) => _.from === "MENU")) ?? [] : [];
519
+ return (t = n.modelValue) != null && t._id ? ((p = u.menu.bindedBySkuId[(e = n.modelValue) == null ? void 0 : e._id]) == null ? void 0 : p.filter((k) => k.from === "MENU")) ?? [] : [];
520
520
  }
521
- ), $ = S(
522
- () => i.skus.map((t) => ({ label: t.name, value: t.code }))
523
- ), ie = q((ue = n.modelValue) == null ? void 0 : ue.code);
521
+ ), E = S(
522
+ () => u.skus.map((t) => ({ label: t.name, value: t.code }))
523
+ ), ie = q((de = n.modelValue) == null ? void 0 : de.code);
524
524
  function le(t) {
525
525
  var p;
526
526
  const e = t.el;
527
527
  e && ((p = e.querySelector("[x-should-scroll-into=true]")) == null || p.scrollIntoView());
528
528
  }
529
- const de = S(
529
+ const ue = S(
530
530
  () => {
531
- var t, e, p, _, E, F;
532
- return ((_ = (p = (e = (t = n.modelValue) == null ? void 0 : t.unit) == null ? void 0 : e.measurements) == null ? void 0 : p.find(
531
+ var t, e, p, k, U, M;
532
+ return ((k = (p = (e = (t = n.modelValue) == null ? void 0 : t.unit) == null ? void 0 : e.measurements) == null ? void 0 : p.find(
533
533
  (O) => {
534
534
  var G;
535
535
  return O.id === ((G = n.modelValue) == null ? void 0 : G.trackingMeasurement);
536
536
  }
537
- )) == null ? void 0 : _.abbrev) ?? ((F = (E = n.modelValue) == null ? void 0 : E.unit) == null ? void 0 : F.abbrev);
537
+ )) == null ? void 0 : k.abbrev) ?? ((M = (U = n.modelValue) == null ? void 0 : U.unit) == null ? void 0 : M.abbrev);
538
538
  }
539
539
  ), P = S({
540
540
  get() {
@@ -542,8 +542,8 @@ const Dt = {
542
542
  return ((e = (t = n.modelValue) == null ? void 0 : t.thresholds) == null ? void 0 : e.low) ?? ae().low;
543
543
  },
544
544
  set(t) {
545
- var _;
546
- const e = ((_ = n.modelValue) == null ? void 0 : _.thresholds) ?? ae();
545
+ var k;
546
+ const e = ((k = n.modelValue) == null ? void 0 : k.thresholds) ?? ae();
547
547
  e.low = t;
548
548
  const p = n.modelValue ? {
549
549
  ...n.modelValue
@@ -556,8 +556,8 @@ const Dt = {
556
556
  return ((e = (t = n.modelValue) == null ? void 0 : t.thresholds) == null ? void 0 : e.mid) ?? ae().mid;
557
557
  },
558
558
  set(t) {
559
- var _;
560
- const e = ((_ = n.modelValue) == null ? void 0 : _.thresholds) ?? ae();
559
+ var k;
560
+ const e = ((k = n.modelValue) == null ? void 0 : k.thresholds) ?? ae();
561
561
  e.mid = t;
562
562
  const p = n.modelValue ? {
563
563
  ...n.modelValue
@@ -571,55 +571,55 @@ const Dt = {
571
571
  };
572
572
  }
573
573
  return (t, e) => {
574
- const p = C("FmTextField"), _ = C("FmLabel"), E = C("FmField"), F = C("FmMenuHeader"), O = C("FmMenuDivider"), G = C("FmMenuItem"), me = C("FmMenu"), $e = C("FmFormGroup"), nt = C("FmSelect"), ot = C("FmSwitch"), Ee = C("FmStepperField"), lt = C("FmForm");
575
- return f(), B(lt, {
574
+ const p = w("FmTextField"), k = w("FmLabel"), U = w("FmField"), M = w("FmMenuHeader"), O = w("FmMenuDivider"), G = w("FmMenuItem"), me = w("FmMenu"), $e = w("FmFormGroup"), ot = w("FmSelect"), lt = w("FmSwitch"), Ee = w("FmStepperField"), at = w("FmForm");
575
+ return f(), B(at, {
576
576
  disabled: t.disabled,
577
577
  ref_key: "formRef",
578
578
  ref: H,
579
579
  class: "flex flex-col gap-32",
580
- onValidationSuccess: s
580
+ onValidationSuccess: i
581
581
  }, {
582
582
  default: V(() => {
583
- var Ue, Re, Te, Ae;
583
+ var Ue, Re, Ae, Te;
584
584
  return [
585
- m("div", Pt, [
586
- m("div", Bt, [
585
+ m("div", Bt, [
586
+ m("div", Nt, [
587
587
  c(pe, {
588
588
  "tooltip-message": "This field is managed by NetSuite",
589
589
  "tooltip-z-index": 50,
590
- label: d(r)("inventory.ingredient.code"),
591
- "model-value": x.value,
592
- "onUpdate:modelValue": e[1] || (e[1] = (M) => x.value = M),
593
- locked: g.value,
590
+ label: d(a)("inventory.ingredient.code"),
591
+ "model-value": _.value,
592
+ "onUpdate:modelValue": e[1] || (e[1] = (I) => _.value = I),
593
+ locked: y.value,
594
594
  disabled: t.disabled
595
595
  }, {
596
596
  default: V(() => [
597
597
  c(p, {
598
- label: d(r)("inventory.ingredient.code"),
599
- "model-value": x.value,
600
- "onUpdate:modelValue": e[0] || (e[0] = (M) => x.value = M),
601
- rules: [d(Ve)(), d(mt)($.value, ie.value)],
598
+ label: d(a)("inventory.ingredient.code"),
599
+ "model-value": _.value,
600
+ "onUpdate:modelValue": e[0] || (e[0] = (I) => _.value = I),
601
+ rules: [d(Ve)(), d(ct)(E.value, ie.value)],
602
602
  "label-mark": "required"
603
603
  }, null, 8, ["label", "model-value", "rules"])
604
604
  ]),
605
605
  _: 1
606
606
  }, 8, ["label", "model-value", "locked", "disabled"])
607
607
  ]),
608
- m("div", Nt, [
608
+ m("div", zt, [
609
609
  c(pe, {
610
610
  "tooltip-message": "This field is managed by NetSuite",
611
611
  "tooltip-z-index": 50,
612
- label: d(r)("inventory.ingredient.name"),
613
- "model-value": U.value,
614
- "onUpdate:modelValue": e[3] || (e[3] = (M) => U.value = M),
615
- locked: g.value,
612
+ label: d(a)("inventory.ingredient.name"),
613
+ "model-value": R.value,
614
+ "onUpdate:modelValue": e[3] || (e[3] = (I) => R.value = I),
615
+ locked: y.value,
616
616
  disabled: t.disabled
617
617
  }, {
618
618
  default: V(() => [
619
619
  c(p, {
620
- label: d(r)("inventory.ingredient.name"),
621
- "model-value": U.value,
622
- "onUpdate:modelValue": e[2] || (e[2] = (M) => U.value = M),
620
+ label: d(a)("inventory.ingredient.name"),
621
+ "model-value": R.value,
622
+ "onUpdate:modelValue": e[2] || (e[2] = (I) => R.value = I),
623
623
  rules: [d(Ve)()],
624
624
  "label-mark": "required"
625
625
  }, null, 8, ["label", "model-value", "rules"])
@@ -631,10 +631,10 @@ const Dt = {
631
631
  c(pe, {
632
632
  "tooltip-message": "This field is managed by NetSuite",
633
633
  "tooltip-z-index": 50,
634
- label: d(r)("inventory.ingredient.unit"),
635
- "helper-text": (Ue = t.modelValue) != null && Ue.trackingMeasurement ? `Base unit: ${(Te = (Re = t.modelValue) == null ? void 0 : Re.unit) == null ? void 0 : Te.name}` : void 0,
636
- "model-value": (Ae = N.value) == null ? void 0 : Ae.name,
637
- locked: g.value,
634
+ label: d(a)("inventory.ingredient.unit"),
635
+ "helper-text": (Ue = t.modelValue) != null && Ue.trackingMeasurement ? `Base unit: ${(Ae = (Re = t.modelValue) == null ? void 0 : Re.unit) == null ? void 0 : Ae.name}` : void 0,
636
+ "model-value": (Te = N.value) == null ? void 0 : Te.name,
637
+ locked: y.value,
638
638
  disabled: t.disabled
639
639
  }, {
640
640
  default: V(() => [
@@ -644,14 +644,14 @@ const Dt = {
644
644
  "label-mark": "required"
645
645
  }, {
646
646
  label: V(() => [
647
- c(_, {
648
- label: d(r)("inventory.ingredient.unit")
647
+ c(k, {
648
+ label: d(a)("inventory.ingredient.unit")
649
649
  }, null, 8, ["label"])
650
650
  ]),
651
- default: V(({ invalid: M }) => [
651
+ default: V(({ invalid: I }) => [
652
652
  c(me, null, {
653
653
  "menu-button": V(() => [
654
- c(E, {
654
+ c(U, {
655
655
  class: ee([
656
656
  "fm-typo-en-body-lg-400",
657
657
  {
@@ -659,13 +659,13 @@ const Dt = {
659
659
  "text-fm-color-typo-disabled": t.disabled
660
660
  }
661
661
  ]),
662
- invalid: M,
662
+ invalid: I,
663
663
  "append-icon": "expand_more"
664
664
  }, {
665
665
  default: V(() => {
666
666
  var W;
667
667
  return [
668
- Me(A((W = N.value) == null ? void 0 : W.name), 1)
668
+ Me(T((W = N.value) == null ? void 0 : W.name), 1)
669
669
  ];
670
670
  }),
671
671
  _: 2
@@ -676,20 +676,20 @@ const Dt = {
676
676
  class: "overflow-x-hidden overflow-y-auto max-h-[300px]",
677
677
  onVnodeMounted: le
678
678
  }, [
679
- (f(!0), T(X, null, re(w.value, (W) => (f(), T(X, {
679
+ (f(!0), A(X, null, se($.value, (W) => (f(), A(X, {
680
680
  key: W.label
681
681
  }, [
682
- W.displayAsSection ? (f(), T(X, { key: 0 }, [
683
- c(F, {
682
+ W.displayAsSection ? (f(), A(X, { key: 0 }, [
683
+ c(M, {
684
684
  label: W.label
685
685
  }, null, 8, ["label"]),
686
686
  c(O)
687
687
  ], 64)) : (f(), B(G, {
688
688
  key: 1,
689
689
  label: W.label,
690
- "model-value": v(W),
691
- onClick: (On) => R(W.value),
692
- "x-should-scroll-into": `${v(W)}`
690
+ "model-value": C(W),
691
+ onClick: (qn) => x(W.value),
692
+ "x-should-scroll-into": `${C(W)}`
693
693
  }, null, 8, ["label", "model-value", "onClick", "x-should-scroll-into"]))
694
694
  ], 64))), 128))
695
695
  ], 512)
@@ -702,48 +702,48 @@ const Dt = {
702
702
  ]),
703
703
  _: 1
704
704
  }, 8, ["label", "helper-text", "model-value", "locked", "disabled"]),
705
- d(h).enableTotalCost ? (f(), B(pe, {
705
+ d(b).enableTotalCost ? (f(), B(pe, {
706
706
  key: 0,
707
707
  "tooltip-message": "This field is managed by NetSuite",
708
708
  "tooltip-z-index": 50,
709
- label: d(r)("inventory.ingredient.valuationMethod.title"),
710
- "model-value": d(r)("inventory.ingredient.valuationMethod." + L.value),
711
- locked: g.value,
709
+ label: d(a)("inventory.ingredient.valuationMethod.title"),
710
+ "model-value": d(a)("inventory.ingredient.valuationMethod." + L.value),
711
+ locked: y.value,
712
712
  disabled: t.disabled
713
713
  }, {
714
714
  label: V(() => [
715
715
  c(he, { "z-index": 50 }, {
716
716
  default: V(() => [
717
- c(_, {
718
- label: d(r)("inventory.ingredient.valuationMethod.title")
717
+ c(k, {
718
+ label: d(a)("inventory.ingredient.valuationMethod.title")
719
719
  }, null, 8, ["label"])
720
720
  ]),
721
721
  _: 1
722
722
  })
723
723
  ]),
724
724
  default: V(() => [
725
- c(nt, {
725
+ c(ot, {
726
726
  class: "col-span-2",
727
727
  "model-value": L.value,
728
- "onUpdate:modelValue": e[4] || (e[4] = (M) => L.value = M),
728
+ "onUpdate:modelValue": e[4] || (e[4] = (I) => L.value = I),
729
729
  items: Z.value
730
730
  }, null, 8, ["model-value", "items"])
731
731
  ]),
732
732
  _: 1
733
733
  }, 8, ["label", "model-value", "locked", "disabled"])) : j("", !0),
734
- d(h).enableTotalCost ? (f(), B(pe, {
734
+ d(b).enableTotalCost ? (f(), B(pe, {
735
735
  key: 1,
736
736
  "tooltip-message": "This field is managed by NetSuite",
737
737
  "tooltip-z-index": 50,
738
- "model-value": `${d(ct)()} ${I.value}`,
739
- locked: g.value,
738
+ "model-value": `${d(pt)()} ${F.value}`,
739
+ locked: y.value,
740
740
  disabled: t.disabled
741
741
  }, {
742
742
  label: V(() => [
743
743
  c(he, { "z-index": 50 }, {
744
744
  default: V(() => [
745
- c(_, {
746
- label: d(r)("inventory.ingredient.pricePerUnit")
745
+ c(k, {
746
+ label: d(a)("inventory.ingredient.pricePerUnit")
747
747
  }, null, 8, ["label"])
748
748
  ]),
749
749
  _: 1
@@ -751,94 +751,94 @@ const Dt = {
751
751
  ]),
752
752
  default: V(() => [
753
753
  c(p, {
754
- "model-value": I.value,
755
- "onUpdate:modelValue": e[5] || (e[5] = (M) => I.value = M),
756
- rules: [d(_e)(0), d(pt)(4)]
754
+ "model-value": F.value,
755
+ "onUpdate:modelValue": e[5] || (e[5] = (I) => F.value = I),
756
+ rules: [d(_e)(0), d(vt)(4)]
757
757
  }, {
758
758
  label: V(() => [
759
759
  c(he, { "z-index": 50 }, {
760
760
  default: V(() => [
761
- c(_, {
762
- label: d(r)("inventory.ingredient.pricePerUnit")
761
+ c(k, {
762
+ label: d(a)("inventory.ingredient.pricePerUnit")
763
763
  }, null, 8, ["label"])
764
764
  ]),
765
765
  _: 1
766
766
  })
767
767
  ]),
768
768
  prepend: V(() => {
769
- var M, W;
769
+ var I, W;
770
770
  return [
771
- m("div", zt, A(d(Ne)(((M = d(a).currentCountry) == null ? void 0 : M.value) ?? d(ze)) === "MYR" ? "RM" : d(Ne)(((W = d(a).currentCountry) == null ? void 0 : W.value) ?? d(ze))), 1)
771
+ m("div", Lt, T(d(Ne)(((I = d(r).currentCountry) == null ? void 0 : I.value) ?? d(ze)) === "MYR" ? "RM" : d(Ne)(((W = d(r).currentCountry) == null ? void 0 : W.value) ?? d(ze))), 1)
772
772
  ];
773
773
  }),
774
774
  append: V(() => [
775
- m("div", Lt, " / " + A(de.value), 1)
775
+ m("div", Ht, " / " + T(ue.value), 1)
776
776
  ]),
777
777
  _: 1
778
778
  }, 8, ["model-value", "rules"])
779
779
  ]),
780
780
  _: 1
781
781
  }, 8, ["model-value", "locked", "disabled"])) : j("", !0),
782
- !g.value || J.value ? (f(), B(At, {
782
+ !y.value || J.value ? (f(), B(Dt, {
783
783
  key: 2,
784
784
  "model-value": J.value,
785
- "onUpdate:modelValue": e[6] || (e[6] = (M) => J.value = M),
785
+ "onUpdate:modelValue": e[6] || (e[6] = (I) => J.value = I),
786
786
  "root-value": t.modelValue,
787
- readonly: g.value
787
+ readonly: y.value
788
788
  }, null, 8, ["model-value", "root-value", "readonly"])) : j("", !0),
789
- t.mode !== d(K).CREATE ? (f(), T("div", Ht, [
789
+ t.mode !== d(K).CREATE ? (f(), A("div", Ot, [
790
790
  m("div", null, [
791
- c(ot, {
792
- label: d(r)("inventory.ingredient.bindedItems.title"),
791
+ c(lt, {
792
+ label: d(a)("inventory.ingredient.bindedItems.title"),
793
793
  modelValue: Q.value,
794
- "onUpdate:modelValue": e[7] || (e[7] = (M) => Q.value = M),
794
+ "onUpdate:modelValue": e[7] || (e[7] = (I) => Q.value = I),
795
795
  "label-placement": "right"
796
796
  }, null, 8, ["label", "modelValue"])
797
797
  ]),
798
- Q.value && se.value.length ? (f(), B(we, {
798
+ Q.value && re.value.length ? (f(), B(we, {
799
799
  key: 0,
800
- name: d(r)("inventory.ingredient.bindedItems.ingredient"),
801
- bindings: se.value
800
+ name: d(a)("inventory.ingredient.bindedItems.ingredient"),
801
+ bindings: re.value
802
802
  }, null, 8, ["name", "bindings"])) : j("", !0),
803
803
  Q.value && ye.value.length ? (f(), B(we, {
804
804
  key: 1,
805
- name: d(r)("inventory.ingredient.bindedItems.recipe"),
805
+ name: d(a)("inventory.ingredient.bindedItems.recipe"),
806
806
  bindings: ye.value
807
807
  }, null, 8, ["name", "bindings"])) : j("", !0),
808
808
  Q.value && D.value.length ? (f(), B(we, {
809
809
  key: 2,
810
- name: d(r)("inventory.ingredient.bindedItems.menu"),
810
+ name: d(a)("inventory.ingredient.bindedItems.menu"),
811
811
  bindings: D.value
812
812
  }, null, 8, ["name", "bindings"])) : j("", !0)
813
813
  ])) : j("", !0),
814
- m("div", Ot, [
815
- m("div", jt, [
814
+ m("div", jt, [
815
+ m("div", qt, [
816
816
  c(he, null, {
817
817
  default: V(() => [
818
- m("div", qt, A(d(r)("inventory.ingredient.threshold.title")), 1)
818
+ m("div", Yt, T(d(a)("inventory.ingredient.threshold.title")), 1)
819
819
  ]),
820
820
  _: 1
821
821
  }),
822
- m("div", Yt, A(d(r)("inventory.ingredient.threshold.subtitle")), 1)
822
+ m("div", Gt, T(d(a)("inventory.ingredient.threshold.subtitle")), 1)
823
823
  ]),
824
- m("div", Gt, [
824
+ m("div", Wt, [
825
825
  c($e, {
826
826
  "model-value": { low: P.value, mid: z.value },
827
827
  rules: [ge()]
828
828
  }, null, 8, ["model-value", "rules"]),
829
- m("div", Wt, [
830
- m("div", Kt, [
831
- m("div", Zt, [
829
+ m("div", Kt, [
830
+ m("div", Zt, [
831
+ m("div", Jt, [
832
832
  c(Se, {
833
833
  days: P.value,
834
834
  level: d(Ce).low
835
835
  }, null, 8, ["days", "level"])
836
836
  ]),
837
- m("div", Jt, [
838
- m("div", Qt, A(d(r)("inventory.ingredient.threshold.whenRemaining")), 1),
837
+ m("div", Qt, [
838
+ m("div", Xt, T(d(a)("inventory.ingredient.threshold.whenRemaining")), 1),
839
839
  c(Ee, {
840
840
  modelValue: P.value,
841
- "onUpdate:modelValue": e[8] || (e[8] = (M) => P.value = M),
841
+ "onUpdate:modelValue": e[8] || (e[8] = (I) => P.value = I),
842
842
  rules: [d(_e)(0)]
843
843
  }, {
844
844
  append: V(() => e[11] || (e[11] = [
@@ -860,18 +860,18 @@ const Dt = {
860
860
  style: { transform: "translate(-50%, -50%)", left: "50%", top: "24px" }
861
861
  }, " < ")
862
862
  ], -1)),
863
- m("div", Xt, [
864
- m("div", en, [
863
+ m("div", en, [
864
+ m("div", tn, [
865
865
  c(Se, {
866
866
  days: z.value,
867
867
  level: d(Ce).mid
868
868
  }, null, 8, ["days", "level"])
869
869
  ]),
870
- m("div", tn, [
871
- m("div", nn, A(d(r)("inventory.ingredient.threshold.whenRemaining")), 1),
870
+ m("div", nn, [
871
+ m("div", on, T(d(a)("inventory.ingredient.threshold.whenRemaining")), 1),
872
872
  c(Ee, {
873
873
  modelValue: z.value,
874
- "onUpdate:modelValue": e[9] || (e[9] = (M) => z.value = M),
874
+ "onUpdate:modelValue": e[9] || (e[9] = (I) => z.value = I),
875
875
  rules: [d(_e)(0)]
876
876
  }, {
877
877
  append: V(() => e[12] || (e[12] = [
@@ -893,25 +893,25 @@ const Dt = {
893
893
  style: { transform: "translate(-50%, -50%)", left: "50%", top: "24px" }
894
894
  }, " < ")
895
895
  ], -1)),
896
- m("div", on, [
897
- m("div", ln, [
896
+ m("div", ln, [
897
+ m("div", an, [
898
898
  c(Se, {
899
899
  days: z.value + 1,
900
900
  level: d(Ce).high
901
901
  }, null, 8, ["days", "level"])
902
902
  ]),
903
- m("div", an, [
904
- m("div", rn, A(d(r)("inventory.ingredient.threshold.stockIsStaple")), 1)
903
+ m("div", sn, [
904
+ m("div", rn, T(d(a)("inventory.ingredient.threshold.stockIsStaple")), 1)
905
905
  ])
906
906
  ])
907
907
  ])
908
908
  ])
909
909
  ]),
910
910
  m("div", null, [
911
- c(Rt, {
911
+ c(At, {
912
912
  entity: "inventorySku",
913
913
  modelValue: Y.value,
914
- "onUpdate:modelValue": e[10] || (e[10] = (M) => Y.value = M)
914
+ "onUpdate:modelValue": e[10] || (e[10] = (I) => Y.value = I)
915
915
  }, null, 8, ["modelValue"])
916
916
  ])
917
917
  ];
@@ -920,10 +920,10 @@ const Dt = {
920
920
  }, 8, ["disabled"]);
921
921
  };
922
922
  }
923
- }), dn = { class: "flex flex-col gap-32" }, un = {
923
+ }), dn = { class: "flex flex-col gap-32" }, mn = {
924
924
  key: 0,
925
925
  class: "flex flex-col gap-12"
926
- }, mn = { class: "flex flex-col gap-4" }, cn = { class: "flex-1 fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, pn = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, vn = { class: "flex gap-4" }, fn = /* @__PURE__ */ te({
926
+ }, cn = { class: "flex flex-col gap-4" }, pn = { class: "flex-1 fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, vn = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, fn = { class: "flex gap-4" }, yn = /* @__PURE__ */ te({
927
927
  __name: "IngredientDialog",
928
928
  props: {
929
929
  show: { type: Boolean },
@@ -931,13 +931,13 @@ const Dt = {
931
931
  mode: { default: K.READ }
932
932
  },
933
933
  emits: ["update:show"],
934
- setup(u) {
935
- const o = u, y = ne(), r = Ie(), n = ke(), { t: l } = oe(), i = Oe(o, "show"), a = Oe(o, "unit"), h = S(
934
+ setup(s) {
935
+ const o = s, v = ne(), a = Ie(), n = ke(), { t: l } = oe(), u = Oe(o, "show"), r = Oe(o, "unit"), b = S(
936
936
  () => {
937
- var v;
938
- return r.isEnabled && r.netSuiteItemBySkuId.has((v = o.unit) == null ? void 0 : v._id);
937
+ var C;
938
+ return a.isEnabled && a.netSuiteItemBySkuId.has((C = o.unit) == null ? void 0 : C._id);
939
939
  }
940
- ), k = S(() => {
940
+ ), h = S(() => {
941
941
  switch (o.mode) {
942
942
  case K.READ:
943
943
  return "";
@@ -947,7 +947,7 @@ const Dt = {
947
947
  return l("inventory.ingredient.create.title");
948
948
  }
949
949
  return "";
950
- }), g = S(() => {
950
+ }), y = S(() => {
951
951
  switch (o.mode) {
952
952
  case K.READ:
953
953
  return "";
@@ -957,94 +957,94 @@ const Dt = {
957
957
  return l("common.add");
958
958
  }
959
959
  return "";
960
- }), b = q(), s = q(!1);
961
- async function x() {
962
- s.value = !0;
960
+ }), g = q(), i = q(!1);
961
+ async function _() {
962
+ i.value = !0;
963
963
  try {
964
- await y.createSku(a.value), i.value = !1, n.open({
964
+ await v.createSku(r.value), u.value = !1, n.open({
965
965
  title: l("inventory.common.success"),
966
- message: l("inventory.ingredient.create.success", { name: a.value.name }),
966
+ message: l("inventory.ingredient.create.success", { name: r.value.name }),
967
967
  type: "success"
968
968
  });
969
- } catch (v) {
970
- v instanceof Le || n.open({
969
+ } catch (C) {
970
+ C instanceof Le || n.open({
971
971
  title: l("inventory.ingredient.create.error.title"),
972
972
  message: l("inventory.ingredient.create.error.message"),
973
973
  type: "error"
974
974
  });
975
975
  } finally {
976
- s.value = !1;
976
+ i.value = !1;
977
977
  }
978
978
  }
979
- async function U() {
980
- s.value = !0;
979
+ async function R() {
980
+ i.value = !0;
981
981
  try {
982
- await y.updateSku(a.value), s.value = !1, i.value = !1, n.open({
982
+ await v.updateSku(r.value), i.value = !1, u.value = !1, n.open({
983
983
  title: l("inventory.common.success"),
984
- message: l("inventory.ingredient.update.success", { name: a.value.name }),
984
+ message: l("inventory.ingredient.update.success", { name: r.value.name }),
985
985
  type: "success"
986
986
  });
987
- } catch (v) {
988
- v instanceof Le || n.open({
987
+ } catch (C) {
988
+ C instanceof Le || n.open({
989
989
  title: l("inventory.ingredient.update.error.title"),
990
990
  message: l("inventory.ingredient.update.error.message"),
991
991
  type: "error"
992
992
  });
993
993
  } finally {
994
- s.value = !1;
994
+ i.value = !1;
995
995
  }
996
996
  }
997
- function I() {
998
- var v, R;
999
- (R = (v = b.value) == null ? void 0 : v.validateInputs) == null || R.call(v);
997
+ function F() {
998
+ var C, x;
999
+ (x = (C = g.value) == null ? void 0 : C.validateInputs) == null || x.call(C);
1000
1000
  }
1001
1001
  function N() {
1002
1002
  switch (o.mode) {
1003
1003
  case K.READ:
1004
1004
  return;
1005
1005
  case K.UPDATE:
1006
- return U();
1006
+ return R();
1007
1007
  case K.CREATE:
1008
- return x();
1008
+ return _();
1009
1009
  }
1010
1010
  }
1011
- const w = S(() => {
1011
+ const $ = S(() => {
1012
1012
  var J, Z;
1013
- if (!r.isEnabled || !((J = o.unit) != null && J._id)) return null;
1014
- const v = (Z = r.netSuiteItemBySkuId.get(o.unit._id)) == null ? void 0 : Z[0];
1015
- return v ? r.state.setting.childItems.filter(
1016
- (L) => L.parentNetSuiteId === v.netSuiteId
1013
+ if (!a.isEnabled || !((J = o.unit) != null && J._id)) return null;
1014
+ const C = (Z = a.netSuiteItemBySkuId.get(o.unit._id)) == null ? void 0 : Z[0];
1015
+ return C ? a.state.setting.childItems.filter(
1016
+ (L) => L.parentNetSuiteId === C.netSuiteId
1017
1017
  ).map((L) => {
1018
1018
  var H;
1019
- const Y = (H = r.measurementByNetsuiteId.get(L.unitOfMeasureId)) == null ? void 0 : H[0];
1019
+ const Y = (H = a.measurementByNetsuiteId.get(L.unitOfMeasureId)) == null ? void 0 : H[0];
1020
1020
  return Y ? {
1021
1021
  externalId: L.externalId,
1022
1022
  ...Y
1023
1023
  } : null;
1024
1024
  }).filter((L) => L).map((L) => L) : null;
1025
1025
  });
1026
- return (v, R) => {
1027
- const J = C("FmChip"), Z = C("FmButton"), L = C("FmSideSheet");
1026
+ return (C, x) => {
1027
+ const J = w("FmChip"), Z = w("FmButton"), L = w("FmSideSheet");
1028
1028
  return f(), B(L, {
1029
- "model-value": d(i),
1030
- "onUpdate:modelValue": R[3] || (R[3] = (Y) => De(i) ? i.value = Y : null),
1031
- header: k.value,
1029
+ "model-value": d(u),
1030
+ "onUpdate:modelValue": x[3] || (x[3] = (Y) => De(u) ? u.value = Y : null),
1031
+ header: h.value,
1032
1032
  "close-button": "",
1033
1033
  "dismiss-away": "",
1034
1034
  "max-width": 500
1035
1035
  }, {
1036
1036
  "side-sheet-footer": V(() => [
1037
- m("div", vn, [
1037
+ m("div", fn, [
1038
1038
  c(Z, {
1039
- loading: s.value,
1040
- label: g.value,
1041
- onClick: I
1039
+ loading: i.value,
1040
+ label: y.value,
1041
+ onClick: F
1042
1042
  }, null, 8, ["loading", "label"]),
1043
1043
  c(Z, {
1044
- disabled: s.value,
1044
+ disabled: i.value,
1045
1045
  label: d(l)("common.close"),
1046
1046
  variant: "tertiary",
1047
- onClick: R[2] || (R[2] = (Y) => i.value = !1)
1047
+ onClick: x[2] || (x[2] = (Y) => u.value = !1)
1048
1048
  }, null, 8, ["disabled", "label"])
1049
1049
  ])
1050
1050
  ]),
@@ -1053,31 +1053,31 @@ const Dt = {
1053
1053
  return [
1054
1054
  m("div", dn, [
1055
1055
  m("div", null, [
1056
- h.value ? (f(), B(J, {
1056
+ b.value ? (f(), B(J, {
1057
1057
  key: 0,
1058
1058
  label: "Netsuite",
1059
1059
  compact: ""
1060
1060
  })) : j("", !0)
1061
1061
  ]),
1062
- c(sn, {
1062
+ c(un, {
1063
1063
  class: "w-full",
1064
1064
  ref_key: "hasValidationExpose",
1065
- ref: b,
1066
- modelValue: d(a),
1067
- "onUpdate:modelValue": R[0] || (R[0] = (H) => De(a) ? a.value = H : null),
1068
- mode: v.mode,
1069
- disabled: s.value,
1070
- "onClick:submit": R[1] || (R[1] = (H) => N())
1065
+ ref: g,
1066
+ modelValue: d(r),
1067
+ "onUpdate:modelValue": x[0] || (x[0] = (H) => De(r) ? r.value = H : null),
1068
+ mode: C.mode,
1069
+ disabled: i.value,
1070
+ "onClick:submit": x[1] || (x[1] = (H) => N())
1071
1071
  }, null, 8, ["modelValue", "mode", "disabled"]),
1072
- (Y = w.value) != null && Y.length ? (f(), T("div", un, [
1073
- R[4] || (R[4] = m("div", { class: "fm-typo-en-title-sm-600" }, A("NetSuite info"), -1)),
1074
- m("div", mn, [
1075
- (f(!0), T(X, null, re(w.value, (H, Q) => (f(), T("div", {
1072
+ (Y = $.value) != null && Y.length ? (f(), A("div", mn, [
1073
+ x[4] || (x[4] = m("div", { class: "fm-typo-en-title-sm-600" }, T("NetSuite info"), -1)),
1074
+ m("div", cn, [
1075
+ (f(!0), A(X, null, se($.value, (H, Q) => (f(), A("div", {
1076
1076
  key: Q,
1077
1077
  class: "flex items-center"
1078
1078
  }, [
1079
- m("div", cn, A(H.externalId), 1),
1080
- m("div", pn, A(H.abbrev), 1)
1079
+ m("div", pn, T(H.externalId), 1),
1080
+ m("div", vn, T(H.abbrev), 1)
1081
1081
  ]))), 128))
1082
1082
  ])
1083
1083
  ])) : j("", !0)
@@ -1089,39 +1089,56 @@ const Dt = {
1089
1089
  };
1090
1090
  }
1091
1091
  });
1092
- function* yn(u) {
1092
+ function* gn(s) {
1093
1093
  for (; ; )
1094
- yield u[Math.floor(Math.random() * u.length)];
1094
+ yield s[Math.floor(Math.random() * s.length)];
1095
1095
  }
1096
- function gn(u = 4, o = yn("qwertyuiopasdfghjklzxcvbnm".split(""))) {
1097
- return Array.from({ length: u }).map(() => o.next().value).join("");
1096
+ function bn(s = 4, o = gn("qwertyuiopasdfghjklzxcvbnm".split(""))) {
1097
+ return Array.from({ length: s }).map(() => o.next().value).join("");
1098
1098
  }
1099
- function bn() {
1100
- return `sku_${(/* @__PURE__ */ new Date()).toISOString()}_${gn()}`;
1099
+ function hn() {
1100
+ return `sku_${(/* @__PURE__ */ new Date()).toISOString()}_${bn()}`;
1101
1101
  }
1102
- const hn = {
1102
+ const _n = {
1103
1103
  _id: "",
1104
1104
  name: "",
1105
1105
  abbrev: "",
1106
1106
  precision: 0,
1107
1107
  measurements: []
1108
1108
  };
1109
- function _n(u) {
1110
- var y, r, n, l, i;
1109
+ function xn(s) {
1110
+ return !s || Object.keys(s).length === 0 ? "" : Object.entries(s).map(([o, v]) => `${o}: ${v}`).join(", ");
1111
+ }
1112
+ function tt(s) {
1113
+ if (!s || s.trim() === "")
1114
+ return;
1115
+ const o = {}, v = s.split(",").map((a) => a.trim());
1116
+ for (const a of v) {
1117
+ const n = a.indexOf(":");
1118
+ if (n > 0) {
1119
+ const l = a.substring(0, n).trim(), u = a.substring(n + 1).trim();
1120
+ l && u && (o[l] = u);
1121
+ }
1122
+ }
1123
+ return Object.keys(o).length > 0 ? o : void 0;
1124
+ }
1125
+ function kn(s) {
1126
+ var v, a, n, l, u;
1111
1127
  return {
1112
- code: u.code,
1113
- name: u.name,
1114
- unit: ((y = u.unit.measurements.find((a) => a.id === u.trackingMeasurement)) == null ? void 0 : y.abbrev) ?? u.unit.abbrev,
1115
- baseUnit: u.unit.abbrev,
1116
- valuationMethod: u.valuation ?? "WAVG",
1117
- pricePerUnit: (r = u.defaultCost) != null && r.costPerUnit ? +Ke((n = u.defaultCost) == null ? void 0 : n.costPerUnit) : 0,
1118
- thresholdLow: ((l = u.thresholds) == null ? void 0 : l.low) ?? ae().low,
1119
- thresholdMid: ((i = u.thresholds) == null ? void 0 : i.mid) ?? ae().mid
1128
+ code: s.code,
1129
+ name: s.name,
1130
+ unit: ((v = s.unit.measurements.find((r) => r.id === s.trackingMeasurement)) == null ? void 0 : v.abbrev) ?? s.unit.abbrev,
1131
+ baseUnit: s.unit.abbrev,
1132
+ valuationMethod: s.valuation ?? "WAVG",
1133
+ pricePerUnit: (a = s.defaultCost) != null && a.costPerUnit ? +Ke((n = s.defaultCost) == null ? void 0 : n.costPerUnit) : 0,
1134
+ thresholdLow: ((l = s.thresholds) == null ? void 0 : l.low) ?? ae().low,
1135
+ thresholdMid: ((u = s.thresholds) == null ? void 0 : u.mid) ?? ae().mid,
1136
+ customAttributes: xn(s.customAttributes)
1120
1137
  };
1121
1138
  }
1122
- function tt() {
1139
+ function nt() {
1123
1140
  var n;
1124
- const u = [
1141
+ const s = [
1125
1142
  {
1126
1143
  id: "code",
1127
1144
  name: "Code"
@@ -1138,17 +1155,17 @@ function tt() {
1138
1155
  id: "baseUnit",
1139
1156
  name: "Base unit"
1140
1157
  }
1141
- ], o = et(), y = fe(), r = xe(y.currentCountry.value);
1142
- return o.enableTotalCost && u.push(
1158
+ ], o = et(), v = fe(), a = xe(v.currentCountry.value);
1159
+ return o.enableTotalCost && s.push(
1143
1160
  {
1144
1161
  id: "valuationMethod",
1145
1162
  name: "Valuation method"
1146
1163
  },
1147
1164
  {
1148
1165
  id: "pricePerUnit",
1149
- name: `Price per unit (${r == null ? void 0 : r.currency})`
1166
+ name: `Price per unit (${a == null ? void 0 : a.currency})`
1150
1167
  }
1151
- ), ((n = y.currentBusiness.value) == null ? void 0 : n.menuVersion) === "v4" && u.push(
1168
+ ), ((n = v.currentBusiness.value) == null ? void 0 : n.menuVersion) === "v4" && s.push(
1152
1169
  {
1153
1170
  id: "thresholdLow",
1154
1171
  name: "Show RED when remaining"
@@ -1157,130 +1174,136 @@ function tt() {
1157
1174
  id: "thresholdMid",
1158
1175
  name: "Show YELLOW when remaining"
1159
1176
  }
1160
- ), u;
1177
+ ), s.push({
1178
+ id: "customAttributes",
1179
+ name: "Custom Attributes"
1180
+ }), s;
1161
1181
  }
1162
- function xn() {
1163
- const o = ne().skus.map(_n), r = fe().currentBusiness.value, n = tt(), l = [
1164
- ["Business name:", r == null ? void 0 : r.name],
1165
- ["Business ID:", r == null ? void 0 : r._id],
1166
- ["Menu version", r == null ? void 0 : r.menuVersion],
1182
+ function Vn() {
1183
+ const o = ne().skus.map(kn), a = fe().currentBusiness.value, n = nt(), l = [
1184
+ ["Business name:", a == null ? void 0 : a.name],
1185
+ ["Business ID:", a == null ? void 0 : a._id],
1186
+ ["Menu version", a == null ? void 0 : a.menuVersion],
1167
1187
  [],
1168
- n.map((k) => k.name),
1169
- ...o.map((k) => n.map((g) => k[g.id]))
1170
- ], i = n.map((k) => `system:${k.id}`), a = Je(l, i), h = `${r == null ? void 0 : r.name} ingredients (${vt(/* @__PURE__ */ new Date())}).xlsx`;
1171
- return Qe(a, h), h;
1188
+ n.map((h) => h.name),
1189
+ ...o.map((h) => n.map((y) => h[y.id]))
1190
+ ], u = n.map((h) => `system:${h.id}`), r = Je(l, u), b = `${a == null ? void 0 : a.name} ingredients (${ft(/* @__PURE__ */ new Date())}).xlsx`;
1191
+ return Qe(r, b), b;
1172
1192
  }
1173
- function kn() {
1174
- const o = fe().currentBusiness.value, y = tt(), r = [
1193
+ function Sn() {
1194
+ const o = fe().currentBusiness.value, v = nt(), a = [
1175
1195
  ["Business name:", o == null ? void 0 : o.name],
1176
1196
  ["Business ID:", o == null ? void 0 : o._id],
1177
1197
  ["Menu version", o == null ? void 0 : o.menuVersion],
1178
1198
  [],
1179
- y.map((a) => a.name)
1180
- ], n = y.map((a) => `system:${a.id}`), l = Je(r, n), i = "FeedMe ingredients template.xlsx";
1181
- return Qe(l, i), i;
1199
+ v.map((r) => r.name)
1200
+ ], n = v.map((r) => `system:${r.id}`), l = Je(a, n), u = "FeedMe ingredients template.xlsx";
1201
+ return Qe(l, u), u;
1182
1202
  }
1183
- function Vn(u) {
1203
+ function Cn(s) {
1184
1204
  const [
1185
1205
  o,
1186
- y,
1187
- r,
1206
+ v,
1207
+ a,
1188
1208
  n,
1189
1209
  l,
1190
- i,
1191
- ...a
1192
- ] = yt(u);
1193
- if (!o || !o.length || o.some((s) => s.length && !s.startsWith("system:")))
1210
+ u,
1211
+ ...r
1212
+ ] = gt(s);
1213
+ if (!o || !o.length || o.some((i) => i.length && !i.startsWith("system:")))
1194
1214
  throw new Error("Missing meta header. Excel file does not come from the template.");
1195
- const h = o.map((s) => s.split(":")[1]), g = ["code", "name", "unit", "baseUnit"].filter((s) => !h.includes(s));
1196
- if (g.length)
1215
+ const b = o.map((i) => i.split(":")[1]), y = ["code", "name", "unit", "baseUnit"].filter((i) => !b.includes(i));
1216
+ if (y.length)
1197
1217
  throw new Error(
1198
- `Missing meta headers (${g.join()}). Excel file does not come from the template.`
1218
+ `Missing meta headers (${y.join()}). Excel file does not come from the template.`
1199
1219
  );
1200
- return a.map((s, x) => {
1201
- const U = {};
1202
- for (const I in h) {
1203
- const N = h[I];
1204
- Object.assign(U, { [N]: s[I] });
1220
+ return r.map((i, _) => {
1221
+ const R = {};
1222
+ for (const F in b) {
1223
+ const N = b[F];
1224
+ Object.assign(R, { [N]: i[F] });
1205
1225
  }
1206
1226
  return {
1207
- index: x,
1208
- data: U
1227
+ index: _,
1228
+ data: R
1209
1229
  };
1210
1230
  });
1211
1231
  }
1212
- function je(u, o, y) {
1213
- var w;
1214
- const n = ne().units, l = new Array(), i = y.filter((v) => v.data.code === u.code);
1215
- i.length > 1 && l.push(
1216
- `Code ${u.code} is already used in row ${i.map((v) => v.index + 6).join()}.`
1232
+ function je(s, o, v) {
1233
+ var C;
1234
+ const n = ne().units, l = new Array(), u = v.filter((x) => x.data.code === s.code);
1235
+ u.length > 1 && l.push(
1236
+ `Code ${s.code} is already used in row ${u.map((x) => x.index + 6).join()}.`
1217
1237
  );
1218
- const a = n.find((v) => v.abbrev === u.baseUnit), h = a == null ? void 0 : a.measurements.find((v) => v.abbrev === u.unit);
1219
- if (!a)
1220
- l.push(`Cannot find base unit of symbol ${u.baseUnit}.`);
1221
- else if (u.baseUnit !== u.unit && !h) {
1222
- const v = `Cannot find unit conversion for ${u.baseUnit} with symbol ${u.unit || "[empty]"}.`;
1223
- l.push(v);
1238
+ const r = n.find((x) => x.abbrev === s.baseUnit), b = r == null ? void 0 : r.measurements.find((x) => x.abbrev === s.unit);
1239
+ if (!r)
1240
+ l.push(`Cannot find base unit of symbol ${s.baseUnit}.`);
1241
+ else if (s.baseUnit !== s.unit && !b) {
1242
+ const x = `Cannot find unit conversion for ${s.baseUnit} with symbol ${s.unit || "[empty]"}.`;
1243
+ l.push(x);
1224
1244
  }
1225
- const k = ve.options.find(
1226
- (v) => v === u.valuationMethod
1245
+ const h = ve.options.find(
1246
+ (x) => x === s.valuationMethod
1227
1247
  );
1228
- u.valuationMethod && !k && l.push(
1229
- `Expected valuation method to be one of ${ve.options.join()} but got ${u.valuationMethod} instead.`
1248
+ s.valuationMethod && !h && l.push(
1249
+ `Expected valuation method to be one of ${ve.options.join()} but got ${s.valuationMethod} instead.`
1230
1250
  );
1231
- const b = fe().currentCountry.value, s = (v) => `${v}`.length && gt()(v) === !0, x = s(`${u.pricePerUnit}`) === !0 ? {
1251
+ const g = fe().currentCountry.value, i = (x) => `${x}`.length && bt()(x) === !0, _ = i(`${s.pricePerUnit}`) === !0 ? {
1232
1252
  costPerUnit: {
1233
- ...Ze(Number(u.pricePerUnit) || 0),
1234
- currency: ((w = xe(b)) == null ? void 0 : w.currency) ?? "MYR"
1253
+ ...Ze(Number(s.pricePerUnit) || 0),
1254
+ currency: ((C = xe(g)) == null ? void 0 : C.currency) ?? "MYR"
1235
1255
  },
1236
- measurement: h
1237
- } : void 0, U = s(`${u.thresholdLow}`) && s(`${u.thresholdMid}`) ? {
1238
- low: Number(u.thresholdLow) || 0,
1239
- mid: Number(u.thresholdMid) || 0
1240
- } : void 0;
1256
+ measurement: b
1257
+ } : void 0, R = i(`${s.thresholdLow}`) && i(`${s.thresholdMid}`) ? {
1258
+ low: Number(s.thresholdLow) || 0,
1259
+ mid: Number(s.thresholdMid) || 0
1260
+ } : void 0, F = "customAttributes" in s ? tt(s.customAttributes) : null;
1241
1261
  return {
1242
1262
  type: "create",
1243
1263
  sku: {
1244
- _id: bn(),
1245
- code: u.code,
1246
- name: u.name,
1247
- unit: a ?? n.find((v) => v) ?? hn,
1248
- trackingMeasurement: h == null ? void 0 : h.id,
1249
- valuation: k,
1250
- defaultCost: x,
1251
- thresholds: U
1264
+ _id: hn(),
1265
+ code: s.code,
1266
+ name: s.name,
1267
+ unit: r ?? n.find((x) => x) ?? _n,
1268
+ trackingMeasurement: b == null ? void 0 : b.id,
1269
+ valuation: h,
1270
+ defaultCost: _,
1271
+ thresholds: R,
1272
+ ...F !== null && { customAttributes: F }
1252
1273
  },
1253
1274
  errors: l,
1254
1275
  excelRowNumber: o + 6
1255
1276
  };
1256
1277
  }
1257
- function Sn(u) {
1278
+ function wn(s) {
1258
1279
  try {
1259
- const o = Vn(u).filter((k) => k.data.code), r = ne().skus, n = ft(r, "code"), l = o.filter((k) => !n[k.data.code]), i = o.filter((k) => n[k.data.code]), a = l.map(
1260
- (k) => je(k.data, k.index, o)
1261
- ), h = i.map((k) => {
1262
- const g = je(k.data, k.index, o), b = n[k.data.code];
1263
- return {
1264
- ...g,
1280
+ const o = Cn(s).filter((h) => h.data.code), a = ne().skus, n = yt(a, "code"), l = o.filter((h) => !n[h.data.code]), u = o.filter((h) => n[h.data.code]), r = l.map(
1281
+ (h) => je(h.data, h.index, o)
1282
+ ), b = u.map((h) => {
1283
+ const y = je(h.data, h.index, o), g = n[h.data.code];
1284
+ let i = g.customAttributes;
1285
+ return "customAttributes" in h.data && (i = tt(h.data.customAttributes)), {
1286
+ ...y,
1265
1287
  type: "update",
1266
- original: b,
1288
+ original: g,
1267
1289
  sku: {
1268
1290
  // to maintain original props not in the import excel, e.g. inventory binding, etc...
1269
- ...b,
1270
- code: g.sku.code || b.code,
1271
- name: g.sku.name || b.name,
1272
- unit: g.sku.unit || b.unit,
1273
- trackingMeasurement: g.sku.trackingMeasurement || b.trackingMeasurement,
1274
- valuation: g.sku.valuation || b.valuation,
1275
- defaultCost: g.sku.defaultCost || b.defaultCost,
1276
- thresholds: g.sku.thresholds || b.thresholds
1291
+ ...g,
1292
+ code: y.sku.code || g.code,
1293
+ name: y.sku.name || g.name,
1294
+ unit: y.sku.unit || g.unit,
1295
+ trackingMeasurement: y.sku.trackingMeasurement || g.trackingMeasurement,
1296
+ valuation: y.sku.valuation || g.valuation,
1297
+ defaultCost: y.sku.defaultCost || g.defaultCost,
1298
+ thresholds: y.sku.thresholds || g.thresholds,
1299
+ customAttributes: i
1277
1300
  }
1278
1301
  };
1279
1302
  });
1280
1303
  return {
1281
1304
  invalidExcel: !1,
1282
- importCreateResult: a,
1283
- importUpdateResult: h
1305
+ importCreateResult: r,
1306
+ importUpdateResult: b
1284
1307
  };
1285
1308
  } catch (o) {
1286
1309
  return {
@@ -1291,10 +1314,10 @@ function Sn(u) {
1291
1314
  };
1292
1315
  }
1293
1316
  }
1294
- const Cn = { class: "flex items-center gap-12 pl-8" }, wn = { class: "flex flex-col" }, Fn = { class: "fm-typo-en-body-md-400 text-fm-color-typo-primary flex items-center gap-4" }, Mn = {
1317
+ const Fn = { class: "flex items-center gap-12 pl-8" }, Mn = { class: "flex flex-col" }, In = { class: "fm-typo-en-body-md-400 text-fm-color-typo-primary flex items-center gap-4" }, $n = {
1295
1318
  key: 0,
1296
1319
  class: "text-fm-color-typo-secondary fm-typo-en-body-sm-400"
1297
- }, In = { key: 0 }, qe = /* @__PURE__ */ te({
1320
+ }, En = { key: 0 }, qe = /* @__PURE__ */ te({
1298
1321
  __name: "ImportIngredientItem",
1299
1322
  props: {
1300
1323
  type: {},
@@ -1302,30 +1325,30 @@ const Cn = { class: "flex items-center gap-12 pl-8" }, wn = { class: "flex flex-
1302
1325
  name: {},
1303
1326
  errors: {}
1304
1327
  },
1305
- setup(u) {
1306
- return (o, y) => {
1307
- const r = C("FmIcon"), n = C("FmTooltip");
1308
- return f(), T("div", Cn, [
1309
- y[0] || (y[0] = m("div", null, "•", -1)),
1310
- m("div", wn, [
1311
- m("div", Fn, [
1328
+ setup(s) {
1329
+ return (o, v) => {
1330
+ const a = w("FmIcon"), n = w("FmTooltip");
1331
+ return f(), A("div", Fn, [
1332
+ v[0] || (v[0] = m("div", null, "•", -1)),
1333
+ m("div", Mn, [
1334
+ m("div", In, [
1312
1335
  m("div", {
1313
1336
  class: ee({
1314
1337
  "text-fm-color-system-error-300": o.errors.length
1315
1338
  })
1316
1339
  }, [
1317
- Me(A(o.name) + " ", 1),
1318
- o.type === "create" ? (f(), T("span", Mn, "(new)")) : j("", !0)
1340
+ Me(T(o.name) + " ", 1),
1341
+ o.type === "create" ? (f(), A("span", $n, "(new)")) : j("", !0)
1319
1342
  ], 2),
1320
- o.errors.length ? (f(), T("div", In, [
1343
+ o.errors.length ? (f(), A("div", En, [
1321
1344
  c(n, { "z-index": 50 }, {
1322
1345
  content: V(() => [
1323
1346
  m("ol", null, [
1324
- (f(!0), T(X, null, re(o.errors, (l, i) => (f(), T("li", { key: i }, A(l), 1))), 128))
1347
+ (f(!0), A(X, null, se(o.errors, (l, u) => (f(), A("li", { key: u }, T(l), 1))), 128))
1325
1348
  ])
1326
1349
  ]),
1327
1350
  default: V(() => [
1328
- c(r, {
1351
+ c(a, {
1329
1352
  name: "error",
1330
1353
  size: "sm",
1331
1354
  color: "system-error-300"
@@ -1343,103 +1366,103 @@ const Cn = { class: "flex items-center gap-12 pl-8" }, wn = { class: "flex flex-
1343
1366
  "text-fm-color-typo-secondary": !o.errors.length
1344
1367
  }
1345
1368
  ])
1346
- }, A(o.code), 3)
1369
+ }, T(o.code), 3)
1347
1370
  ])
1348
1371
  ]);
1349
1372
  };
1350
1373
  }
1351
- }), $n = { class: "flex flex-col gap-24" }, En = { class: "fm-typo-en-body-md-400" }, Un = { class: "flex flex-col gap-8" }, Rn = { class: "line-clamp-2 text-ellipsis break-all" }, Tn = {
1374
+ }), Un = { class: "flex flex-col gap-24" }, Rn = { class: "fm-typo-en-body-md-400" }, An = { class: "flex flex-col gap-8" }, Tn = { class: "line-clamp-2 text-ellipsis break-all" }, Dn = {
1352
1375
  key: 2,
1353
1376
  class: "shrink-0"
1354
- }, An = {
1377
+ }, Pn = {
1355
1378
  key: 0,
1356
1379
  class: "flex flex-col"
1357
- }, Dn = { class: "text-fm-color-system-error-300 fm-typo-en-body-sm-400" }, Pn = {
1380
+ }, Bn = { class: "text-fm-color-system-error-300 fm-typo-en-body-sm-400" }, Nn = {
1358
1381
  key: 0,
1359
1382
  class: "max-h-[200px] overflow-y-auto flex flex-col gap-8"
1360
- }, Bn = { class: "fm-typo-en-body-lg-600" }, Nn = /* @__PURE__ */ te({
1383
+ }, zn = { class: "fm-typo-en-body-lg-600" }, Ln = /* @__PURE__ */ te({
1361
1384
  __name: "ImportIngredients",
1362
- setup(u) {
1363
- const o = q(null), y = Ct(), r = ke(), n = q(!1), l = q(new Array()), i = q([]), a = q([]), h = S(
1364
- () => !!l.value.length || i.value.some((s) => s.errors.length) || a.value.some((s) => s.errors.length)
1365
- ), k = S(
1366
- () => !!i.value.length || !!a.value.length
1367
- ), { t: g } = oe();
1368
- async function b(s) {
1369
- l.value = [], i.value = [], a.value = [];
1385
+ setup(s) {
1386
+ const o = q(null), v = wt(), a = ke(), n = q(!1), l = q(new Array()), u = q([]), r = q([]), b = S(
1387
+ () => !!l.value.length || u.value.some((i) => i.errors.length) || r.value.some((i) => i.errors.length)
1388
+ ), h = S(
1389
+ () => !!u.value.length || !!r.value.length
1390
+ ), { t: y } = oe();
1391
+ async function g(i) {
1392
+ l.value = [], u.value = [], r.value = [];
1370
1393
  try {
1371
1394
  n.value = !0;
1372
- const [x] = await Promise.all([
1373
- ht(s),
1395
+ const [_] = await Promise.all([
1396
+ _t(i),
1374
1397
  // fake buffer
1375
1398
  new Promise((N) => setTimeout(N, 1e3))
1376
- ]), U = x.SheetNames.find((N) => N);
1377
- if (!U) {
1378
- l.value.push(g("inventory.ingredient.import.fileError.noSheet"));
1399
+ ]), R = _.SheetNames.find((N) => N);
1400
+ if (!R) {
1401
+ l.value.push(y("inventory.ingredient.import.fileError.noSheet"));
1379
1402
  return;
1380
1403
  }
1381
- const I = Sn(x.Sheets[U]);
1382
- if (I.invalidExcel) {
1383
- l.value.push(I.invalidExcelMessage ?? g("inventory.ingredient.import.fileError.invalidExcel"));
1404
+ const F = wn(_.Sheets[R]);
1405
+ if (F.invalidExcel) {
1406
+ l.value.push(F.invalidExcelMessage ?? y("inventory.ingredient.import.fileError.invalidExcel"));
1384
1407
  return;
1385
1408
  }
1386
- if (i.value = I.importCreateResult, a.value = I.importUpdateResult, !i.value.length && !a.value.length) {
1387
- l.value.push(g("inventory.ingredient.import.fileError.noData"));
1409
+ if (u.value = F.importCreateResult, r.value = F.importUpdateResult, !u.value.length && !r.value.length) {
1410
+ l.value.push(y("inventory.ingredient.import.fileError.noData"));
1388
1411
  return;
1389
1412
  }
1390
- y.emitData(I);
1391
- } catch (x) {
1392
- r.open({
1393
- title: g("inventory.ingredient.import.fileError.unableToRead"),
1394
- message: x == null ? void 0 : x.message,
1413
+ v.emitData(F);
1414
+ } catch (_) {
1415
+ a.open({
1416
+ title: y("inventory.ingredient.import.fileError.unableToRead"),
1417
+ message: _ == null ? void 0 : _.message,
1395
1418
  type: "error"
1396
- }), console.error("Error in reading file", x);
1419
+ }), console.error("Error in reading file", _);
1397
1420
  } finally {
1398
- l.value.length && r.open({
1399
- title: g("inventory.ingredient.import.fileError.invalidExcel"),
1421
+ l.value.length && a.open({
1422
+ title: y("inventory.ingredient.import.fileError.invalidExcel"),
1400
1423
  type: "error"
1401
1424
  }), n.value = !1;
1402
1425
  }
1403
1426
  }
1404
- return Ye(o, (s) => {
1405
- s && b(s);
1406
- }), (s, x) => {
1407
- const U = C("FmCircularProgress"), I = C("FmIcon"), N = C("FmButton");
1408
- return f(), T("div", $n, [
1409
- m("div", En, A(d(g)("inventory.ingredient.import.uploadDescription")), 1),
1410
- c(bt, {
1427
+ return Ye(o, (i) => {
1428
+ i && g(i);
1429
+ }), (i, _) => {
1430
+ const R = w("FmCircularProgress"), F = w("FmIcon"), N = w("FmButton");
1431
+ return f(), A("div", Un, [
1432
+ m("div", Rn, T(d(y)("inventory.ingredient.import.uploadDescription")), 1),
1433
+ c(ht, {
1411
1434
  class: ee({
1412
1435
  "w-full": !0,
1413
1436
  "h-[200px]": !o.value
1414
1437
  }),
1415
1438
  accept: ".xlsx",
1416
- onFileUpload: x[0] || (x[0] = (w) => o.value = w),
1417
- label: d(g)("inventory.ingredient.import.uploadTemplate"),
1418
- "button-label": d(g)("inventory.ingredient.import.selectFile")
1439
+ onFileUpload: _[0] || (_[0] = ($) => o.value = $),
1440
+ label: d(y)("inventory.ingredient.import.uploadTemplate"),
1441
+ "button-label": d(y)("inventory.ingredient.import.selectFile")
1419
1442
  }, Ge({ _: 2 }, [
1420
1443
  o.value ? {
1421
1444
  name: "default",
1422
- fn: V(({ openFileDialog: w }) => [
1423
- m("div", Un, [
1445
+ fn: V(({ openFileDialog: $ }) => [
1446
+ m("div", An, [
1424
1447
  m("div", {
1425
1448
  class: ee([
1426
1449
  "fm-corner-radius-md p-16 flex items-center gap-16",
1427
1450
  {
1428
1451
  "border border-fm-color-neutral-gray-100": n.value,
1429
- "border border-fm-color-neutral-gray-200": !n.value && !h.value,
1430
- "border border-fm-color-system-error-200": h.value
1452
+ "border border-fm-color-neutral-gray-200": !n.value && !b.value,
1453
+ "border border-fm-color-system-error-200": b.value
1431
1454
  }
1432
1455
  ])
1433
1456
  }, [
1434
- n.value ? (f(), B(U, {
1457
+ n.value ? (f(), B(R, {
1435
1458
  key: 0,
1436
1459
  size: "md",
1437
1460
  color: "neutral-gray-200"
1438
- })) : (f(), B(I, {
1461
+ })) : (f(), B(F, {
1439
1462
  key: 1,
1440
- name: h.value ? "error" : "attach_file",
1463
+ name: b.value ? "error" : "attach_file",
1441
1464
  outline: "",
1442
- color: h.value ? "system-error-300" : void 0
1465
+ color: b.value ? "system-error-300" : void 0
1443
1466
  }, null, 8, ["name", "color"])),
1444
1467
  m("div", {
1445
1468
  class: ee([
@@ -1450,28 +1473,28 @@ const Cn = { class: "flex items-center gap-12 pl-8" }, wn = { class: "flex flex-
1450
1473
  }
1451
1474
  ])
1452
1475
  }, [
1453
- m("div", Rn, A(o.value.name), 1)
1476
+ m("div", Tn, T(o.value.name), 1)
1454
1477
  ], 2),
1455
- n.value ? j("", !0) : (f(), T("div", Tn, [
1478
+ n.value ? j("", !0) : (f(), A("div", Dn, [
1456
1479
  c(N, {
1457
- label: d(g)("inventory.ingredient.import.replaceFile"),
1458
- variant: h.value ? "destructive" : "secondary",
1459
- "prepend-icon": h.value ? void 0 : "autorenew",
1460
- onClick: w
1480
+ label: d(y)("inventory.ingredient.import.replaceFile"),
1481
+ variant: b.value ? "destructive" : "secondary",
1482
+ "prepend-icon": b.value ? void 0 : "autorenew",
1483
+ onClick: $
1461
1484
  }, null, 8, ["label", "variant", "prepend-icon", "onClick"])
1462
1485
  ]))
1463
1486
  ], 2),
1464
- l.value.length ? (f(), T("div", An, [
1465
- (f(!0), T(X, null, re(l.value, (v, R) => (f(), T("div", {
1466
- key: R,
1487
+ l.value.length ? (f(), A("div", Pn, [
1488
+ (f(!0), A(X, null, se(l.value, (C, x) => (f(), A("div", {
1489
+ key: x,
1467
1490
  class: "flex gap-8 items-center"
1468
1491
  }, [
1469
- c(I, {
1492
+ c(F, {
1470
1493
  name: "error",
1471
1494
  size: "sm",
1472
1495
  color: "system-error-300"
1473
1496
  }),
1474
- m("div", Dn, A(v), 1)
1497
+ m("div", Bn, T(C), 1)
1475
1498
  ]))), 128))
1476
1499
  ])) : j("", !0)
1477
1500
  ])
@@ -1479,209 +1502,209 @@ const Cn = { class: "flex items-center gap-12 pl-8" }, wn = { class: "flex flex-
1479
1502
  key: "0"
1480
1503
  } : void 0
1481
1504
  ]), 1032, ["class", "label", "button-label"]),
1482
- k.value ? (f(), T("div", Pn, [
1483
- m("div", Bn, A(d(g)("inventory.ingredient.import.summary")), 1),
1484
- (f(!0), T(X, null, re(i.value, (w) => (f(), B(qe, {
1485
- key: w.sku._id,
1486
- code: w.sku.code,
1487
- name: w.sku.name,
1488
- errors: w.errors,
1505
+ h.value ? (f(), A("div", Nn, [
1506
+ m("div", zn, T(d(y)("inventory.ingredient.import.summary")), 1),
1507
+ (f(!0), A(X, null, se(u.value, ($) => (f(), B(qe, {
1508
+ key: $.sku._id,
1509
+ code: $.sku.code,
1510
+ name: $.sku.name,
1511
+ errors: $.errors,
1489
1512
  type: "create"
1490
1513
  }, null, 8, ["code", "name", "errors"]))), 128)),
1491
- (f(!0), T(X, null, re(a.value, (w) => (f(), B(qe, {
1492
- key: w.sku._id,
1493
- code: w.sku.code,
1494
- name: w.sku.name,
1495
- errors: w.errors,
1514
+ (f(!0), A(X, null, se(r.value, ($) => (f(), B(qe, {
1515
+ key: $.sku._id,
1516
+ code: $.sku.code,
1517
+ name: $.sku.name,
1518
+ errors: $.errors,
1496
1519
  type: "update"
1497
1520
  }, null, 8, ["code", "name", "errors"]))), 128))
1498
1521
  ])) : j("", !0)
1499
1522
  ]);
1500
1523
  };
1501
1524
  }
1502
- }), zn = { class: "flex flex-col py-8" }, Ln = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Hn = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, oo = /* @__PURE__ */ te({
1525
+ }), Hn = { class: "flex flex-col py-8" }, On = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, jn = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, ao = /* @__PURE__ */ te({
1503
1526
  __name: "IngredientsView",
1504
- setup(u) {
1505
- const o = ne(), y = S(() => o.skus), r = _t(), n = Xe(), l = ke(), i = Ie(), { t: a } = oe(), { createIngredient: h, updateIngredient: k } = Fe(), { ingredientDialogProps: g, ingredientViewLoading: b } = $t(Fe()), { columnDefs: s } = Tt();
1506
- function x(D) {
1527
+ setup(s) {
1528
+ const o = ne(), v = S(() => o.skus), a = xt(), n = Xe(), l = ke(), u = Ie(), { t: r } = oe(), { createIngredient: b, updateIngredient: h } = Fe(), { ingredientDialogProps: y, ingredientViewLoading: g } = Et(Fe()), { columnDefs: i } = Tt();
1529
+ function _(D) {
1507
1530
  switch (D) {
1508
1531
  case "add":
1509
- return i.isEnabled ? void 0 : h();
1532
+ return u.isEnabled ? void 0 : b();
1510
1533
  case "import":
1511
- return se();
1534
+ return re();
1512
1535
  case "export":
1513
1536
  return Q();
1514
1537
  }
1515
1538
  }
1516
- const U = q(""), I = q(!1), N = S(() => I.value || b.value), { breakpoints: w } = wt(), v = S(() => w.value.xs || w.value.sm), R = S(() => v.value ? 10 : 20), J = xt(), Z = q(!1), L = [
1539
+ const R = q(""), F = q(!1), N = S(() => F.value || g.value), { breakpoints: $ } = Ft(), C = S(() => $.value.xs || $.value.sm), x = S(() => C.value ? 10 : 20), J = kt(), Z = q(!1), L = [
1517
1540
  {
1518
1541
  value: "import",
1519
- label: a("common.import")
1542
+ label: r("common.import")
1520
1543
  },
1521
1544
  {
1522
1545
  value: "export",
1523
- label: a("common.export")
1546
+ label: r("common.export")
1524
1547
  }
1525
1548
  ];
1526
1549
  function Y(D) {
1527
1550
  switch (Z.value = !1, D) {
1528
1551
  case "import":
1529
- return se();
1552
+ return re();
1530
1553
  case "export":
1531
1554
  return Q();
1532
1555
  }
1533
1556
  }
1534
1557
  const H = S(() => [
1535
- ...i.isEnabled ? [] : [
1558
+ ...u.isEnabled ? [] : [
1536
1559
  {
1537
- label: a("inventory.ingredient.create.title"),
1560
+ label: r("inventory.ingredient.create.title"),
1538
1561
  value: "add",
1539
1562
  isPrimary: !0,
1540
1563
  prependIcon: "add"
1541
1564
  },
1542
- { label: a("common.import"), value: "import" }
1565
+ { label: r("common.import"), value: "import" }
1543
1566
  ],
1544
- { label: a("common.export"), value: "export" }
1567
+ { label: r("common.export"), value: "export" }
1545
1568
  ]);
1546
1569
  function Q() {
1547
- const D = xn();
1570
+ const D = Vn();
1548
1571
  l.open({
1549
- title: a("inventory.ingredient.export.success"),
1550
- message: a("inventory.ingredient.export.filename", [D]),
1572
+ title: r("inventory.ingredient.export.success"),
1573
+ message: r("inventory.ingredient.export.filename", [D]),
1551
1574
  type: "success"
1552
1575
  });
1553
1576
  }
1554
- function se() {
1577
+ function re() {
1555
1578
  n.open({
1556
- title: a("inventory.ingredient.import.title"),
1557
- contentComponent: Nn,
1579
+ title: r("inventory.ingredient.import.title"),
1580
+ contentComponent: Ln,
1558
1581
  overlay: !0,
1559
1582
  closeButton: !0,
1560
1583
  primaryActions: {
1561
- text: a("common.import"),
1584
+ text: r("common.import"),
1562
1585
  close: !1
1563
1586
  },
1564
1587
  secondaryActions: {
1565
- text: a("common.close"),
1588
+ text: r("common.close"),
1566
1589
  close: !0
1567
1590
  },
1568
1591
  tertiaryActions: {
1569
- text: a("inventory.ingredient.import.actions.downloadTemplate"),
1592
+ text: r("inventory.ingredient.import.actions.downloadTemplate"),
1570
1593
  close: !1,
1571
1594
  variant: "plain"
1572
1595
  }
1573
1596
  }).onPrimary((D) => {
1574
1597
  if (!D) {
1575
1598
  l.open({
1576
- title: a("inventory.ingredient.import.error.noData"),
1599
+ title: r("inventory.ingredient.import.error.noData"),
1577
1600
  type: "error"
1578
1601
  });
1579
1602
  return;
1580
1603
  }
1581
1604
  if (!D.importCreateResult.length && !D.importUpdateResult.length) {
1582
1605
  l.open({
1583
- title: a("inventory.ingredient.import.error.invalidContent"),
1584
- message: a("inventory.ingredient.import.error.noImportData"),
1606
+ title: r("inventory.ingredient.import.error.invalidContent"),
1607
+ message: r("inventory.ingredient.import.error.noImportData"),
1585
1608
  type: "error"
1586
1609
  });
1587
1610
  return;
1588
1611
  }
1589
- if (D.importCreateResult.some(($) => $.errors.length) || D.importUpdateResult.some(($) => $.errors.length)) {
1612
+ if (D.importCreateResult.some((E) => E.errors.length) || D.importUpdateResult.some((E) => E.errors.length)) {
1590
1613
  l.open({
1591
- title: a("inventory.ingredient.import.error.invalidContent"),
1592
- message: a("inventory.ingredient.import.error.hasErrors"),
1614
+ title: r("inventory.ingredient.import.error.invalidContent"),
1615
+ message: r("inventory.ingredient.import.error.hasErrors"),
1593
1616
  type: "error"
1594
1617
  });
1595
1618
  return;
1596
1619
  }
1597
1620
  n.close(), ye(D);
1598
- }).onTertiary(kn);
1621
+ }).onTertiary(Sn);
1599
1622
  }
1600
1623
  async function ye(D) {
1601
- I.value = !0;
1624
+ F.value = !0;
1602
1625
  try {
1603
- const $ = [
1626
+ const E = [
1604
1627
  ...D.importCreateResult.map(({ sku: P }) => ({ type: "create", sku: P })),
1605
1628
  ...D.importUpdateResult.map(({ sku: P }) => ({ type: "update", sku: P }))
1606
1629
  ], ie = 100;
1607
1630
  let le = 0;
1608
- const de = () => {
1631
+ const ue = () => {
1609
1632
  le += ie, l.open({
1610
- title: a("inventory.ingredient.import.progress", [
1611
- Math.min(le, $.length),
1612
- $.length
1633
+ title: r("inventory.ingredient.import.progress", [
1634
+ Math.min(le, E.length),
1635
+ E.length
1613
1636
  ])
1614
1637
  });
1615
1638
  };
1616
- for (const P of $.chunk(100))
1617
- de(), await o.importSkus({
1639
+ for (const P of E.chunk(100))
1640
+ ue(), await o.importSkus({
1618
1641
  create: P.filter((z) => z.type === "create").map((z) => z.sku),
1619
1642
  update: P.filter((z) => z.type === "update").map((z) => z.sku)
1620
1643
  });
1621
1644
  l.open({
1622
- title: a("inventory.ingredient.import.success"),
1645
+ title: r("inventory.ingredient.import.success"),
1623
1646
  type: "success"
1624
1647
  });
1625
- } catch ($) {
1648
+ } catch (E) {
1626
1649
  l.open({
1627
- title: a("inventory.ingredient.import.error.failed"),
1628
- message: a("inventory.ingredient.import.error.systemMessage", [$ == null ? void 0 : $.message]),
1650
+ title: r("inventory.ingredient.import.error.failed"),
1651
+ message: r("inventory.ingredient.import.error.systemMessage", [E == null ? void 0 : E.message]),
1629
1652
  type: "error"
1630
- }), console.error("Error in importing skus", D, $);
1653
+ }), console.error("Error in importing skus", D, E);
1631
1654
  } finally {
1632
- I.value = !1;
1655
+ F.value = !1;
1633
1656
  }
1634
1657
  }
1635
- return (D, $) => {
1636
- const ie = C("FmTable"), le = C("FmCollapsibleTabs"), de = C("FmBottomSheet");
1637
- return f(), B(kt, {
1638
- title: d(a)("inventory.ingredient.title"),
1658
+ return (D, E) => {
1659
+ const ie = w("FmTable"), le = w("FmCollapsibleTabs"), ue = w("FmBottomSheet");
1660
+ return f(), B(Vt, {
1661
+ title: d(r)("inventory.ingredient.title"),
1639
1662
  actions: H.value,
1640
- "onClick:action": x
1663
+ "onClick:action": _
1641
1664
  }, {
1642
1665
  default: V(() => [
1643
1666
  m("div", {
1644
1667
  class: ee([
1645
1668
  "flex flex-col gap-8 max-h-full",
1646
1669
  {
1647
- "p-0": v.value,
1648
- "px-24 ": !v.value
1670
+ "p-0": C.value,
1671
+ "px-24 ": !C.value
1649
1672
  }
1650
1673
  ])
1651
1674
  }, [
1652
- c(Vt, {
1675
+ c(St, {
1653
1676
  searchable: "",
1654
- search: U.value,
1655
- "onUpdate:search": $[0] || ($[0] = (P) => U.value = P)
1677
+ search: R.value,
1678
+ "onUpdate:search": E[0] || (E[0] = (P) => R.value = P)
1656
1679
  }, null, 8, ["search"]),
1657
1680
  c(ie, {
1658
1681
  style: rt(d(J).tableHeight),
1659
- "column-defs": d(s),
1660
- "row-data": y.value,
1661
- "search-value": U.value,
1662
- loading: !d(r)._currentLocation || N.value,
1682
+ "column-defs": d(i),
1683
+ "row-data": v.value,
1684
+ "search-value": R.value,
1685
+ loading: !d(a)._currentLocation || N.value,
1663
1686
  "loading-text": "Loading",
1664
- onRowClick: $[1] || ($[1] = (P) => d(k)(P.original)),
1665
- "page-size": R.value
1687
+ onRowClick: E[1] || (E[1] = (P) => d(h)(P.original)),
1688
+ "page-size": x.value
1666
1689
  }, {
1667
1690
  "list-row": V((P) => [
1668
- c(St, {
1691
+ c(Ct, {
1669
1692
  row: P,
1670
- onRowClick: d(k)
1693
+ onRowClick: d(h)
1671
1694
  }, Ge({
1672
1695
  default: V((z) => {
1673
- var ge, ue, t, e, p, _, E, F, O, G;
1696
+ var ge, de, t, e, p, k, U, M, O, G;
1674
1697
  return [
1675
- m("div", zn, [
1676
- m("div", Ln, [
1698
+ m("div", Hn, [
1699
+ m("div", On, [
1677
1700
  c(d(He), {
1678
- render: (t = (ue = (ge = z.code) == null ? void 0 : ge.column) == null ? void 0 : ue.columnDef) == null ? void 0 : t.cell,
1701
+ render: (t = (de = (ge = z.code) == null ? void 0 : ge.column) == null ? void 0 : de.columnDef) == null ? void 0 : t.cell,
1679
1702
  props: (p = (e = z.code) == null ? void 0 : e.getContext) == null ? void 0 : p.call(e)
1680
1703
  }, null, 8, ["render", "props"])
1681
1704
  ]),
1682
- m("div", Hn, [
1705
+ m("div", jn, [
1683
1706
  c(d(He), {
1684
- render: (F = (E = (_ = z.name) == null ? void 0 : _.column) == null ? void 0 : E.columnDef) == null ? void 0 : F.cell,
1707
+ render: (M = (U = (k = z.name) == null ? void 0 : k.column) == null ? void 0 : U.columnDef) == null ? void 0 : M.cell,
1685
1708
  props: (G = (O = z.name) == null ? void 0 : O.getContext) == null ? void 0 : G.call(O)
1686
1709
  }, null, 8, ["render", "props"])
1687
1710
  ])
@@ -1690,10 +1713,10 @@ const Cn = { class: "flex items-center gap-12 pl-8" }, wn = { class: "flex flex-
1690
1713
  }),
1691
1714
  _: 2
1692
1715
  }, [
1693
- I.value ? {
1716
+ F.value ? {
1694
1717
  name: "loading-text",
1695
1718
  fn: V(() => [
1696
- m("div", null, A(d(a)("inventory.ingredient.table.importing")), 1)
1719
+ m("div", null, T(d(r)("inventory.ingredient.table.importing")), 1)
1697
1720
  ]),
1698
1721
  key: "0"
1699
1722
  } : void 0
@@ -1703,19 +1726,19 @@ const Cn = { class: "flex items-center gap-12 pl-8" }, wn = { class: "flex flex-
1703
1726
  }, 8, ["style", "column-defs", "row-data", "search-value", "loading", "page-size"])
1704
1727
  ], 2),
1705
1728
  (f(), B(Pe, { to: "body" }, [
1706
- c(fn, st(it(d(g))), null, 16)
1729
+ c(yn, it(ut(d(y))), null, 16)
1707
1730
  ])),
1708
1731
  (f(), B(Pe, { to: "body" }, [
1709
- c(de, {
1732
+ c(ue, {
1710
1733
  "dismiss-away": "",
1711
1734
  modelValue: Z.value,
1712
- "onUpdate:modelValue": $[3] || ($[3] = (P) => Z.value = P)
1735
+ "onUpdate:modelValue": E[3] || (E[3] = (P) => Z.value = P)
1713
1736
  }, {
1714
1737
  default: V(() => [
1715
1738
  c(le, {
1716
1739
  class: "pb-8",
1717
1740
  items: L,
1718
- "onUpdate:modelValue": $[2] || ($[2] = (P) => Y(P))
1741
+ "onUpdate:modelValue": E[2] || (E[2] = (P) => Y(P))
1719
1742
  })
1720
1743
  ]),
1721
1744
  _: 1
@@ -1728,5 +1751,5 @@ const Cn = { class: "flex items-center gap-12 pl-8" }, wn = { class: "flex flex-
1728
1751
  }
1729
1752
  });
1730
1753
  export {
1731
- oo as default
1754
+ ao as default
1732
1755
  };