@feedmepos/mf-inventory-portal 1.2.19-dev.1 → 1.2.19-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 (49) hide show
  1. package/dist/{App-Bom1bcak.js → App-Bq3VbOg4.js} +1 -1
  2. package/dist/{ApprovalView-D_orSDU0.js → ApprovalView-0rdBk4Ga.js} +2 -2
  3. package/dist/{BindingsDialog-2eJElRIa.js → BindingsDialog-D9dfQy9F.js} +2 -2
  4. package/dist/{BindingsPicker-CfsRK8B-.js → BindingsPicker-C5qh7Kjp.js} +1 -1
  5. package/dist/{BindingsTable-BR6Lxc53.js → BindingsTable-CMEWGAmH.js} +1 -1
  6. package/dist/{ClosingDraftView-DGF3zNvA.js → ClosingDraftView-D5dgVQLQ.js} +2 -2
  7. package/dist/{ClosingTemplateView-u5yiwUff.js → ClosingTemplateView-BCrbXt1O.js} +3 -3
  8. package/dist/{DeliveryOrderPrintPreview-Bb2_1YXd.js → DeliveryOrderPrintPreview-DzP9MsW6.js} +1 -1
  9. package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-B8pQnBNv.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-lL_Je_aP.js} +3 -3
  10. package/dist/{FmMultiselectDialog-BFlAHDjc.js → FmMultiselectDialog-B39wWYKL.js} +1 -1
  11. package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-U1ndsTwb.js → FmUnitInput.vue_vue_type_script_setup_true_lang-DTLkc1KI.js} +1 -1
  12. package/dist/{ImportView-CdheoPEB.js → ImportView-DSlXRo6h.js} +554 -560
  13. package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-qIuxgD7a.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-EUSjFuu0.js} +1 -1
  14. package/dist/{IngredientGroupView-BZ6GNod-.js → IngredientGroupView-N1SA4h33.js} +2 -2
  15. package/dist/{IngredientsView-CpJf3xr9.js → IngredientsView-CXk0pFuq.js} +8 -8
  16. package/dist/{IntegrationView-DN6MCSef.js → IntegrationView-D0-VCjXw.js} +3 -3
  17. package/dist/{InventoryBindingForm-JS_ot3qj.js → InventoryBindingForm-DqQKgRFD.js} +1 -1
  18. package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-YZW-mYSn.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-CxsiIFB7.js} +3 -3
  19. package/dist/{InventoryBindingSummary-Cp0qbqV3.js → InventoryBindingSummary-4kCjgPon.js} +1 -1
  20. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-BlW7SGya.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-CapjT1PG.js} +1 -1
  21. package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-Bv4dMutg.js → PremiumBadge.vue_vue_type_script_setup_true_lang-BTr8giUF.js} +1 -1
  22. package/dist/{PublishView-D8jDsyTH.js → PublishView-cxD30ANP.js} +1 -1
  23. package/dist/{PurchaseOrderPrintPreview-De9UTgQH.js → PurchaseOrderPrintPreview-C25EwRvq.js} +1 -1
  24. package/dist/{ReceiveRequestView-D6B0nkYT.js → ReceiveRequestView-DG79qu-Q.js} +8 -8
  25. package/dist/{RecipeView-DDJWyAMn.js → RecipeView-Dd3Gzx_7.js} +3 -3
  26. package/dist/{StockView-Dlf5yAGG.js → StockView-DUPQoRbk.js} +7 -7
  27. package/dist/{SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-BJCoys-I.js → SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-yBT7sh32.js} +1 -1
  28. package/dist/{SupplierView-BXxZ_vs7.js → SupplierView-CftbqjSM.js} +4 -4
  29. package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-Cdyx0vJi.js → TransferDetails.vue_vue_type_script_setup_true_lang-CsG99iyc.js} +5 -5
  30. package/dist/{TransferTemplateView-DCqrkjub.js → TransferTemplateView-Bg3WZG4x.js} +7 -7
  31. package/dist/{UnitView-j0DalCwr.js → UnitView-DDOjic5i.js} +3 -3
  32. package/dist/{WarehouseView-C7z31F0k.js → WarehouseView-xXj5gNkv.js} +1 -1
  33. package/dist/{app-sbPEAhrh.js → app-C5xhmSdT.js} +14810 -14760
  34. package/dist/app.js +1 -1
  35. package/dist/{closing-template-SfWAt0Vr.js → closing-template-CTnmZmwR.js} +1 -1
  36. package/dist/{decimal-Cp3c2-pu.js → decimal-ByvJmvuR.js} +1 -1
  37. package/dist/{format-unit-display-rXn-PWV3.js → format-unit-display-Y9dmvD9H.js} +3 -3
  38. package/dist/{import-export.helper-DXkbqYff.js → import-export.helper-BNdJmogm.js} +1 -1
  39. package/dist/{index-Dya2hgd7.js → index-B-8jCooy.js} +1 -1
  40. package/dist/{index-m6897Cv5.js → index-BN9dlUFp.js} +2 -2
  41. package/dist/{purchase-order-template-D2dudZ5w.js → purchase-order-template-B8d4uElQ.js} +1 -1
  42. package/dist/{stock-7u0L0_a-.js → stock-nuJyCyEZ.js} +1 -1
  43. package/dist/{supplier-uRZ4nMEI.js → supplier-1Y0Es3Q1.js} +1 -1
  44. package/dist/{use-ingredient-select-dialog-Ca9Vr9oE.js → use-ingredient-select-dialog-D4xzg9Cj.js} +1 -1
  45. package/dist/{use-inventory-binding-dialog-Dxd9gg90.js → use-inventory-binding-dialog-BCEJrcXb.js} +1 -1
  46. package/dist/views/receive-request/components/transfer-form/TransferForm.vue.d.ts +2 -2
  47. package/dist/views/receive-request/composables/use-receive-request-form.d.ts +3 -3
  48. package/dist/views/receive-request/composables/use-receive-request-table.d.ts +3 -3
  49. package/package.json +1 -1
@@ -1,104 +1,104 @@
1
- import { defineComponent as De, ref as D, computed as q, watch as He, resolveComponent as ee, openBlock as N, createElementBlock as P, createVNode as B, normalizeClass as ve, unref as i, createSlots as ze, withCtx as Z, createElementVNode as n, createBlock as ae, toDisplayString as a, createCommentVNode as te, Fragment as Ae, renderList as Be, shallowRef as Me, h as we, createTextVNode as E } from "vue";
2
- import { a as le, ar as Pe, b5 as Fe, ap as Ke, W as We, ao as ke, l as Ve, B as Le, C as Je, E as Xe, G as Se, c as qe } from "./app-sbPEAhrh.js";
3
- import { useCoreStore as Re, useI18n as je } from "@feedmepos/mf-common";
4
- import { useDialogChild as Qe, useSnackbar as Oe, useDialog as Ye, useBreakpoints as Ze } from "@feedmepos/ui-library";
5
- import { s as et, g as tt, b as nt, d as $e } from "./import-export.helper-DXkbqYff.js";
1
+ import { defineComponent as De, ref as F, computed as J, watch as ze, resolveComponent as Y, openBlock as N, createElementBlock as D, createVNode as A, normalizeClass as ce, unref as i, createSlots as Ke, withCtx as Q, createElementVNode as n, createBlock as se, toDisplayString as a, createCommentVNode as Z, Fragment as Be, renderList as Pe, shallowRef as $e, h as Ie, createTextVNode as k } from "vue";
2
+ import { a as ie, ar as je, $ as Fe, ap as We, W as Ve, l as pe, ao as Re, B as Le, C as Je, E as Xe, G as ke, c as qe } from "./app-C5xhmSdT.js";
3
+ import { useCoreStore as Ce, useI18n as Oe } from "@feedmepos/mf-common";
4
+ import { useDialogChild as Qe, useSnackbar as He, useDialog as Ye, useBreakpoints as Ze } from "@feedmepos/ui-library";
5
+ import { s as et, g as tt, b as nt, d as Ae } from "./import-export.helper-BNdJmogm.js";
6
6
  import { r as ot } from "./random-CSbEbElR.js";
7
- function Ie() {
7
+ function Ee() {
8
8
  return `measurement_${(/* @__PURE__ */ new Date()).toISOString()}_${ot()}`;
9
9
  }
10
- function rt(R) {
10
+ function rt(U) {
11
11
  const [
12
12
  e,
13
- S,
13
+ R,
14
+ g,
14
15
  h,
16
+ E,
15
17
  x,
16
- w,
17
- _,
18
- ...o
19
- ] = Pe(R);
20
- if (!e || !e.length || e.some((c) => c.length && !c.startsWith("system:")))
18
+ ...r
19
+ ] = je(U);
20
+ if (!e || !e.length || e.some((p) => p.length && !p.startsWith("system:")))
21
21
  throw new Error("Missing meta header. Excel file does not come from the template.");
22
- const l = e.map((c) => c.split(":")[1]), y = ["name", "symbol", "precision"].filter((c) => !l.includes(c));
23
- if (y.length)
22
+ const l = e.map((p) => p.split(":")[1]), u = ["name", "symbol", "precision"].filter((p) => !l.includes(p));
23
+ if (u.length)
24
24
  throw new Error(
25
- `Missing meta headers (${y.join()}). Excel file does not come from the template.`
25
+ `Missing meta headers (${u.join()}). Excel file does not come from the template.`
26
26
  );
27
- return o.map((c, f) => {
28
- const g = {};
29
- for (const p in l) {
30
- const d = l[p];
31
- Object.assign(g, { [d]: c[p] });
27
+ return r.map((p, b) => {
28
+ const f = {};
29
+ for (const d in l) {
30
+ const o = l[d];
31
+ Object.assign(f, { [o]: p[d] });
32
32
  }
33
33
  return {
34
- index: f,
35
- data: g
34
+ index: b,
35
+ data: f
36
36
  };
37
37
  });
38
38
  }
39
- function st(R) {
39
+ function st(U) {
40
40
  try {
41
- const e = rt(R).filter((o) => {
42
- const { name: l, symbol: s, precision: y, measurement_name: u, measurement_symbol: c, measurement_conversion: f } = o.data;
43
- return l || s || y || u || c || f;
44
- }), h = le().units, x = [], w = [];
45
- let _ = {};
46
- for (const o of e)
47
- if (o.data.name && o.data.symbol)
48
- _[o.data.name] = {
41
+ const e = rt(U).filter((r) => {
42
+ const { name: l, symbol: s, precision: u, measurement_name: v, measurement_symbol: p, measurement_conversion: b } = r.data;
43
+ return l || s || u || v || p || b;
44
+ }), g = ie().units, h = [], E = [];
45
+ let x = {};
46
+ for (const r of e)
47
+ if (r.data.name && r.data.symbol)
48
+ x[r.data.name] = {
49
49
  unit: {
50
- name: o.data.name,
51
- abbrev: o.data.symbol,
52
- precision: Math.max(0, Math.min(10, Math.floor(o.data.precision || 2))),
50
+ name: r.data.name,
51
+ abbrev: r.data.symbol,
52
+ precision: Math.max(0, Math.min(10, Math.floor(r.data.precision || 2))),
53
53
  measurements: []
54
54
  },
55
- rowNumber: o.index
56
- }, o.data.measurement_name && o.data.measurement_symbol && o.data.measurement_conversion && _[o.data.name].unit.measurements.push({
57
- id: Ie(),
58
- name: o.data.measurement_name,
59
- abbrev: o.data.measurement_symbol,
55
+ rowNumber: r.index
56
+ }, r.data.measurement_name && r.data.measurement_symbol && r.data.measurement_conversion && x[r.data.name].unit.measurements.push({
57
+ id: Ee(),
58
+ name: r.data.measurement_name,
59
+ abbrev: r.data.measurement_symbol,
60
60
  conversion: {
61
- amount: Math.round(o.data.measurement_conversion * Math.pow(10, _[o.data.name].unit.precision)),
62
- precision: _[o.data.name].unit.precision
61
+ amount: Math.round(r.data.measurement_conversion * Math.pow(10, x[r.data.name].unit.precision)),
62
+ precision: x[r.data.name].unit.precision
63
63
  }
64
64
  });
65
65
  else {
66
- const l = Object.keys(_)[Object.keys(_).length - 1];
67
- l && _[l] && o.data.measurement_name && o.data.measurement_symbol && o.data.measurement_conversion && _[l].unit.measurements.push({
68
- id: Ie(),
69
- name: o.data.measurement_name,
70
- abbrev: o.data.measurement_symbol,
66
+ const l = Object.keys(x)[Object.keys(x).length - 1];
67
+ l && x[l] && r.data.measurement_name && r.data.measurement_symbol && r.data.measurement_conversion && x[l].unit.measurements.push({
68
+ id: Ee(),
69
+ name: r.data.measurement_name,
70
+ abbrev: r.data.measurement_symbol,
71
71
  conversion: {
72
- amount: Math.round(o.data.measurement_conversion * Math.pow(10, _[l].unit.precision)),
73
- precision: _[l].unit.precision
72
+ amount: Math.round(r.data.measurement_conversion * Math.pow(10, x[l].unit.precision)),
73
+ precision: x[l].unit.precision
74
74
  }
75
75
  });
76
76
  }
77
- for (const [o, { unit: l, rowNumber: s }] of Object.entries(_)) {
78
- const y = h.find((u) => {
79
- var c, f;
80
- return u.abbrev === l.abbrev && ((c = u.name) == null ? void 0 : c.trim()) === ((f = l.name) == null ? void 0 : f.trim());
77
+ for (const [r, { unit: l, rowNumber: s }] of Object.entries(x)) {
78
+ const u = g.find((v) => {
79
+ var p, b;
80
+ return v.abbrev === l.abbrev && ((p = v.name) == null ? void 0 : p.trim()) === ((b = l.name) == null ? void 0 : b.trim());
81
81
  });
82
- y ? w.push({
82
+ u ? E.push({
83
83
  type: "update",
84
- original: y,
84
+ original: u,
85
85
  unit: {
86
- ...y,
87
- name: l.name || y.name,
88
- abbrev: l.abbrev || y.abbrev,
89
- precision: l.precision !== void 0 ? l.precision : y.precision,
90
- measurements: l.measurements.map((u) => {
91
- const c = y.measurements.find((f) => f.name === u.name && f.abbrev === u.abbrev);
92
- return c ? { ...c, ...u, id: c.id } : { ...u, id: Ie() };
86
+ ...u,
87
+ name: l.name || u.name,
88
+ abbrev: l.abbrev || u.abbrev,
89
+ precision: l.precision !== void 0 ? l.precision : u.precision,
90
+ measurements: l.measurements.map((v) => {
91
+ const p = u.measurements.find((b) => b.name === v.name && b.abbrev === v.abbrev);
92
+ return p ? { ...p, ...v, id: p.id } : { ...v, id: Ee() };
93
93
  })
94
94
  },
95
95
  errors: [],
96
96
  excelRowNumber: s
97
- }) : x.push({
97
+ }) : h.push({
98
98
  type: "create",
99
99
  unit: {
100
100
  ...l,
101
- measurements: l.measurements.map((u) => ({ ...u, id: Ie() }))
101
+ measurements: l.measurements.map((v) => ({ ...v, id: Ee() }))
102
102
  },
103
103
  errors: [],
104
104
  excelRowNumber: s
@@ -106,8 +106,8 @@ function st(R) {
106
106
  }
107
107
  return {
108
108
  invalidExcel: !1,
109
- importCreateResult: x,
110
- importUpdateResult: w
109
+ importCreateResult: h,
110
+ importUpdateResult: E
111
111
  };
112
112
  } catch (e) {
113
113
  return {
@@ -118,137 +118,131 @@ function st(R) {
118
118
  };
119
119
  }
120
120
  }
121
- function it(R, { ignoreErrors: e = !1 } = {}) {
122
- var S, h, x;
121
+ function it(U, { ignoreErrors: e = !1 } = {}) {
122
+ var R;
123
123
  try {
124
- const w = le(), _ = w.skuByCode, o = w.recipeByName, l = w.skuGroupById, s = w.skuGroups, y = w.units, u = [];
125
- let c = {};
126
- for (const r of R) {
127
- const b = [];
128
- let C = "";
129
- if (r.data.type === "INGREDIENT") {
130
- const U = _[r.data.code];
131
- U ? C = U._id : b.push(`Ingredient with code '${r.data.code}' not found`);
132
- } else if (r.data.type === "RECIPE") {
133
- const U = o[r.data.name];
134
- U ? C = U._id : b.push(`Recipe with name '${r.data.name}' not found`);
135
- } else if (r.data.type === "SKU_GROUP") {
136
- const U = s.find((T) => T.ref === r.data.code || T.name === r.data.name);
137
- U ? C = U._id : b.push(`SKU Group with ref '${r.data.code}' or name '${r.data.name}' not found`);
124
+ const g = ie(), h = g.skuByCode, E = g.recipeByName, x = g.skuGroupById, r = g.skuGroups, l = g.units, s = [];
125
+ let u = {};
126
+ for (const o of U) {
127
+ const y = [];
128
+ let _ = "";
129
+ if (o.data.type === "INGREDIENT") {
130
+ const w = h[o.data.code];
131
+ w ? _ = w._id : y.push(`Ingredient with code '${o.data.code}' not found`);
132
+ } else if (o.data.type === "RECIPE") {
133
+ const w = E[o.data.name];
134
+ w ? _ = w._id : y.push(`Recipe with name '${o.data.name}' not found`);
135
+ } else if (o.data.type === "SKU_GROUP") {
136
+ const w = r.find((I) => I.ref === o.data.code || I.name === o.data.name);
137
+ w ? _ = w._id : y.push(`SKU Group with ref '${o.data.code}' or name '${o.data.name}' not found`);
138
138
  } else
139
- b.push(`Invalid type '${r.data.type}'. Must be 'INGREDIENT', 'RECIPE', or 'SKU_GROUP'`);
140
- (!r.data.amount || isNaN(parseFloat(r.data.amount))) && b.push(`Invalid amount '${r.data.amount}'. Must be a valid number`);
141
- let A;
142
- if ((r.data.unit || r.data.baseUnit) && r.data.type !== "RECIPE" && r.data.type !== "SKU_GROUP" && (A = y.find((U) => {
143
- var T, re;
144
- return U.abbrev === r.data.baseUnit && ((T = U.name) == null ? void 0 : T.trim()) === ((re = r.data.unit) == null ? void 0 : re.trim());
145
- }), A || (r.data.baseUnit && r.data.unit ? b.push(`Cannot find unit with symbol '${r.data.baseUnit}' and name '${r.data.unit}'`) : r.data.baseUnit ? b.push(`Cannot find unit with symbol '${r.data.baseUnit}'`) : r.data.unit && b.push(`Cannot find unit with name '${r.data.unit}'`))), b.length > 0 && u.push(`Row ${r.index + 6}: ${b.join(", ")}`), e || b.length === 0) {
146
- let U;
147
- if (r.data.type === "RECIPE" || r.data.type === "SKU_GROUP" ? U = void 0 : U = (S = A == null ? void 0 : A.measurements) == null ? void 0 : S.find((T) => T.abbrev === r.data.measurementName), r.data.recipeName)
148
- c[r.data.recipeName] = {
149
- name: r.data.recipeName,
150
- customAttributes: r.data.customAttributes ? et(r.data.customAttributes) : {},
139
+ y.push(`Invalid type '${o.data.type}'. Must be 'INGREDIENT', 'RECIPE', or 'SKU_GROUP'`);
140
+ o.data.amount || y.push(`Invalid amount '${o.data.amount}'. Must be a valid number`);
141
+ let G;
142
+ if ((o.data.unit || o.data.baseUnit) && o.data.type !== "RECIPE" && o.data.type !== "SKU_GROUP" && (G = l.find((w) => {
143
+ var I, ee;
144
+ return w.abbrev === o.data.baseUnit && ((I = w.name) == null ? void 0 : I.trim()) === ((ee = o.data.unit) == null ? void 0 : ee.trim());
145
+ }), G || (o.data.baseUnit && o.data.unit ? y.push(`Cannot find unit with symbol '${o.data.baseUnit}' and name '${o.data.unit}'`) : o.data.baseUnit ? y.push(`Cannot find unit with symbol '${o.data.baseUnit}'`) : o.data.unit && y.push(`Cannot find unit with name '${o.data.unit}'`))), y.length > 0 && s.push(`Row ${o.index + 6}: ${y.join(", ")}`), e || y.length === 0) {
146
+ let w;
147
+ if (o.data.type === "RECIPE" || o.data.type === "SKU_GROUP" ? w = void 0 : w = (R = G == null ? void 0 : G.measurements) == null ? void 0 : R.find((I) => I.abbrev === o.data.measurementName), o.data.recipeName)
148
+ u[o.data.recipeName] = {
149
+ name: o.data.recipeName,
150
+ customAttributes: o.data.customAttributes ? et(o.data.customAttributes) : {},
151
151
  contains: [{
152
- type: r.data.type === "INGREDIENT" ? "SKU" : r.data.type,
153
- id: C,
154
- amount: {
155
- amount: parseFloat(r.data.amount) || 0,
156
- precision: Fe(r.data.amount) === !0 && ((h = r.data.amount.split(".")[1]) == null ? void 0 : h.length) || 0
157
- },
158
- measurement: U || void 0
152
+ type: o.data.type === "INGREDIENT" ? "SKU" : o.data.type,
153
+ id: _,
154
+ amount: Fe(parseFloat(o.data.amount) || 0),
155
+ measurement: w || void 0
159
156
  }]
160
- }, u[r.data.recipeName] = b.length > 0 ? `Row ${r.index + 6}: ${b.join(", ")}` : [];
157
+ }, s[o.data.recipeName] = y.length > 0 ? `Row ${o.index + 6}: ${y.join(", ")}` : [];
161
158
  else {
162
- const T = Object.keys(c)[Object.keys(c).length - 1];
163
- T && c[T] && (c[T] = {
164
- ...c[T],
159
+ const I = Object.keys(u)[Object.keys(u).length - 1];
160
+ I && u[I] && (u[I] = {
161
+ ...u[I],
165
162
  contains: [
166
- ...c[T].contains,
163
+ ...u[I].contains,
167
164
  {
168
- type: r.data.type === "INGREDIENT" ? "SKU" : r.data.type,
169
- id: C,
170
- amount: {
171
- amount: parseFloat(r.data.amount) || 0,
172
- precision: Fe(r.data.amount) === !0 && ((x = r.data.amount.split(".")[1]) == null ? void 0 : x.length) || 0
173
- },
174
- measurement: U || void 0
165
+ type: o.data.type === "INGREDIENT" ? "SKU" : o.data.type,
166
+ id: _,
167
+ amount: Fe(parseFloat(o.data.amount) || 0),
168
+ measurement: w || void 0
175
169
  }
176
170
  ]
177
- }, u[T] = b.length > 0 ? u[T] ? `${u[T]}, Row ${r.index + 6}: ${b.join(", ")}` : `Row ${r.index + 6}: ${b.join(", ")}` : []);
171
+ }, s[I] = y.length > 0 ? s[I] ? `${s[I]}, Row ${o.index + 6}: ${y.join(", ")}` : `Row ${o.index + 6}: ${y.join(", ")}` : []);
178
172
  }
179
173
  }
180
174
  }
181
- const f = Object.values(c), g = f.filter((r) => !o[r.name]), p = f.filter((r) => o[r.name]), d = g.map((r, b) => ({
175
+ const v = Object.values(u), p = v.filter((o) => !E[o.name]), b = v.filter((o) => E[o.name]), f = p.map((o, y) => ({
182
176
  type: "create",
183
- recipe: r,
177
+ recipe: o,
184
178
  // Type assertion - _id will be assigned by backend
185
- errors: u[r.name],
186
- excelRowNumber: b + 6
179
+ errors: s[o.name],
180
+ excelRowNumber: y + 6
187
181
  // Assuming header rows
188
- })), G = p.map((r, b) => {
189
- const C = o[r.name];
182
+ })), d = b.map((o, y) => {
183
+ const _ = E[o.name];
190
184
  return {
191
185
  type: "update",
192
- original: C,
186
+ original: _,
193
187
  recipe: {
194
- ...C,
195
- name: r.name || C.name,
196
- contains: r.contains.length > 0 ? r.contains : C.contains,
197
- customAttributes: r.customAttributes || C.customAttributes
188
+ ..._,
189
+ name: o.name || _.name,
190
+ contains: o.contains.length > 0 ? o.contains : _.contains,
191
+ customAttributes: o.customAttributes || _.customAttributes
198
192
  },
199
- errors: u[r.name],
200
- excelRowNumber: b + 6
193
+ errors: s[o.name],
194
+ excelRowNumber: y + 6
201
195
  };
202
196
  });
203
197
  return {
204
- invalidExcel: u.length > 0,
205
- invalidExcelMessage: u.length > 0 ? `Import completed with ${u.length} error(s): ${u.join("; ")}` : void 0,
206
- importCreateResult: d,
207
- importUpdateResult: G
198
+ invalidExcel: s.length > 0,
199
+ invalidExcelMessage: s.length > 0 ? `Import completed with ${s.length} error(s): ${s.join("; ")}` : void 0,
200
+ importCreateResult: f,
201
+ importUpdateResult: d
208
202
  };
209
- } catch (w) {
203
+ } catch (g) {
210
204
  return {
211
205
  invalidExcel: !0,
212
- invalidExcelMessage: w instanceof Error ? w.message : "Unknown error occurred",
206
+ invalidExcelMessage: g instanceof Error ? g.message : "Unknown error occurred",
213
207
  importCreateResult: [],
214
208
  importUpdateResult: []
215
209
  };
216
210
  }
217
211
  }
218
- function at(R) {
212
+ function at(U) {
219
213
  const [
220
214
  e,
221
- S,
215
+ R,
216
+ g,
222
217
  h,
218
+ E,
223
219
  x,
224
- w,
225
- _,
226
- ...o
227
- ] = Pe(R);
228
- if (!e || !e.length || e.some((c) => c.length && !c.startsWith("system:")))
220
+ ...r
221
+ ] = je(U);
222
+ if (!e || !e.length || e.some((p) => p.length && !p.startsWith("system:")))
229
223
  throw new Error("Missing meta header. Excel file does not come from the template.");
230
- const l = e.map((c) => c.split(":")[1]), y = ["code", "recipeName", "unit", "baseUnit", "type", "amount"].filter((c) => !l.includes(c));
231
- if (y.length)
224
+ const l = e.map((p) => p.split(":")[1]), u = ["code", "recipeName", "unit", "baseUnit", "type", "amount"].filter((p) => !l.includes(p));
225
+ if (u.length)
232
226
  throw new Error(
233
- `Missing meta headers (${y.join()}). Excel file does not come from the template.`
227
+ `Missing meta headers (${u.join()}). Excel file does not come from the template.`
234
228
  );
235
- return o.map((c, f) => {
236
- const g = {};
237
- for (const p in l) {
238
- const d = l[p];
239
- Object.assign(g, { [d]: c[p] });
229
+ return r.map((p, b) => {
230
+ const f = {};
231
+ for (const d in l) {
232
+ const o = l[d];
233
+ Object.assign(f, { [o]: p[d] });
240
234
  }
241
235
  return {
242
- index: f,
243
- data: g
236
+ index: b,
237
+ data: f
244
238
  };
245
- }).filter((c) => {
246
- const { recipeName: f, type: g, code: p, name: d, amount: G, unit: r, baseUnit: b, measurementName: C, customAttributes: A } = c.data;
247
- return f || g || p || d || G || r || b || C || A;
239
+ }).filter((p) => {
240
+ const { recipeName: b, type: f, code: d, name: o, amount: y, unit: _, baseUnit: G, measurementName: w, customAttributes: I } = p.data;
241
+ return b || f || d || o || y || _ || G || w || I;
248
242
  });
249
243
  }
250
244
  function lt() {
251
- const e = Re().currentBusiness.value, S = le(), h = [
245
+ const e = Ce().currentBusiness.value, R = ie(), g = [
252
246
  { id: "name", name: "Unit Name" },
253
247
  { id: "symbol", name: "Symbol" },
254
248
  { id: "precision", name: "Precision" },
@@ -256,37 +250,37 @@ function lt() {
256
250
  { id: "measurement_symbol", name: "Measurement Symbol" },
257
251
  { id: "measurement_conversion", name: "Measurement Conversion" }
258
252
  ];
259
- let x = [];
260
- S.units.length > 0 ? S.units.forEach((o) => {
261
- if (o.measurements.length === 0)
262
- x.push([
263
- o.name,
264
- o.abbrev,
265
- o.precision,
253
+ let h = [];
254
+ R.units.length > 0 ? R.units.forEach((r) => {
255
+ if (r.measurements.length === 0)
256
+ h.push([
257
+ r.name,
258
+ r.abbrev,
259
+ r.precision,
266
260
  "",
267
261
  "",
268
262
  ""
269
263
  ]);
270
264
  else {
271
- x.push([
272
- o.name,
273
- o.abbrev,
274
- o.precision,
275
- o.measurements[0].name,
276
- o.measurements[0].abbrev,
277
- o.measurements[0].conversion.amount
265
+ h.push([
266
+ r.name,
267
+ r.abbrev,
268
+ r.precision,
269
+ r.measurements[0].name,
270
+ r.measurements[0].abbrev,
271
+ +pe(r.measurements[0].conversion)
278
272
  ]);
279
- for (let l = 1; l < o.measurements.length; l++)
280
- x.push([
273
+ for (let l = 1; l < r.measurements.length; l++)
274
+ h.push([
281
275
  "",
282
276
  "",
283
277
  "",
284
- o.measurements[l].name,
285
- o.measurements[l].abbrev,
286
- o.measurements[l].conversion.amount
278
+ r.measurements[l].name,
279
+ r.measurements[l].abbrev,
280
+ +pe(r.measurements[l].conversion)
287
281
  ]);
288
282
  }
289
- }) : x = [
283
+ }) : h = [
290
284
  ["Length", "m", 2, "Meter", "m", 1],
291
285
  ["", "", "", "Centimeter", "cm", 0.01],
292
286
  ["", "", "", "Millimeter", "mm", 1e-3],
@@ -294,48 +288,48 @@ function lt() {
294
288
  ["", "", "", "Gram", "g", 1e-3],
295
289
  ["", "", "", "Pound", "lb", 0.453592]
296
290
  ];
297
- const w = [
291
+ const E = [
298
292
  ["Business name:", e == null ? void 0 : e.name],
299
293
  ["Business ID:", e == null ? void 0 : e._id],
300
294
  ["Menu version", e == null ? void 0 : e.menuVersion],
301
295
  [],
302
- h.map((o) => o.name),
303
- ...x
304
- ], _ = h.map((o) => `system:${o.id}`);
305
- return ke(w, _);
296
+ g.map((r) => r.name),
297
+ ...h
298
+ ], x = g.map((r) => `system:${r.id}`);
299
+ return Re(E, x);
306
300
  }
307
301
  function mt() {
308
- const e = Re().currentBusiness.value, S = le(), h = nt();
309
- let x = [];
310
- S.skus.length > 0 ? x = S.skus.map((o) => {
311
- var l, s, y, u, c, f, g, p;
302
+ const e = Ce().currentBusiness.value, R = ie(), g = nt();
303
+ let h = [];
304
+ R.skus.length > 0 ? h = R.skus.map((r) => {
305
+ var l, s, u, v, p, b, f, d;
312
306
  return [
313
- o.code,
314
- o.name,
315
- ((l = o.unit) == null ? void 0 : l.name) || "",
316
- ((s = o.unit) == null ? void 0 : s.abbrev) || "",
317
- ((u = (y = o.unit) == null ? void 0 : y.measurements.find((d) => d.id === o.trackingMeasurement)) == null ? void 0 : u.abbrev) ?? o.unit.abbrev,
318
- o.valuation || "WAVG",
319
- (c = o.defaultCost) != null && c.costPerUnit ? +Ve((f = o.defaultCost) == null ? void 0 : f.costPerUnit) : 0,
320
- ((g = o.thresholds) == null ? void 0 : g.low) ?? $e().low,
321
- ((p = o.thresholds) == null ? void 0 : p.mid) ?? $e().mid,
322
- o.customAttributes ? Object.entries(o.customAttributes).map(([d, G]) => `${d}:${G}`).join("|") : ""
307
+ r.code,
308
+ r.name,
309
+ ((l = r.unit) == null ? void 0 : l.name) || "",
310
+ ((s = r.unit) == null ? void 0 : s.abbrev) || "",
311
+ ((v = (u = r.unit) == null ? void 0 : u.measurements.find((o) => o.id === r.trackingMeasurement)) == null ? void 0 : v.abbrev) ?? r.unit.abbrev,
312
+ r.valuation || "WAVG",
313
+ (p = r.defaultCost) != null && p.costPerUnit ? +pe((b = r.defaultCost) == null ? void 0 : b.costPerUnit) : 0,
314
+ ((f = r.thresholds) == null ? void 0 : f.low) ?? Ae().low,
315
+ ((d = r.thresholds) == null ? void 0 : d.mid) ?? Ae().mid,
316
+ r.customAttributes ? Object.entries(r.customAttributes).map(([o, y]) => `${o}:${y}`).join("|") : ""
323
317
  ];
324
- }) : x = [
318
+ }) : h = [
325
319
  ["EXAMPLE_CODE", "Example Ingredient", "kg", "kg", "Unit Name", "WAVG", 10.5, 5, 10, ""]
326
320
  ];
327
- const w = [
321
+ const E = [
328
322
  ["Business name:", e == null ? void 0 : e.name],
329
323
  ["Business ID:", e == null ? void 0 : e._id],
330
324
  ["Menu version", e == null ? void 0 : e.menuVersion],
331
325
  [],
332
- h.map((o) => o.name),
333
- ...x
334
- ], _ = h.map((o) => `system:${o.id}`);
335
- return ke(w, _);
326
+ g.map((r) => r.name),
327
+ ...h
328
+ ], x = g.map((r) => `system:${r.id}`);
329
+ return Re(E, x);
336
330
  }
337
331
  function ut() {
338
- const e = Re().currentBusiness.value, S = le(), h = [
332
+ const e = Ce().currentBusiness.value, R = ie(), g = [
339
333
  { id: "recipeName", name: "Recipe Name" },
340
334
  { id: "type", name: "Type" },
341
335
  { id: "code", name: "Code" },
@@ -346,58 +340,58 @@ function ut() {
346
340
  { id: "measurementName", name: "Measurement Name" },
347
341
  { id: "customAttributes", name: "Custom Attributes" }
348
342
  ];
349
- let x = [];
350
- if (S.recipes.length > 0) {
351
- const o = S.recipeById, l = S.skuById, s = S.skuGroupById;
352
- x = S.recipes.flatMap((y) => {
353
- var c;
354
- const u = y.customAttributes ? Object.entries(y.customAttributes).map(([f, g]) => `${f}:${g}`).join("|") : "";
355
- if ((c = y.contains) != null && c.length) {
356
- const f = y.contains.filter((d) => d.type === "RECIPE"), g = y.contains.filter((d) => d.type === "SKU"), p = y.contains.filter((d) => d.type === "SKU_GROUP");
343
+ let h = [];
344
+ if (R.recipes.length > 0) {
345
+ const r = R.recipeById, l = R.skuById, s = R.skuGroupById;
346
+ h = R.recipes.flatMap((u) => {
347
+ var p;
348
+ const v = u.customAttributes ? Object.entries(u.customAttributes).map(([b, f]) => `${b}:${f}`).join("|") : "";
349
+ if ((p = u.contains) != null && p.length) {
350
+ const b = u.contains.filter((o) => o.type === "RECIPE"), f = u.contains.filter((o) => o.type === "SKU"), d = u.contains.filter((o) => o.type === "SKU_GROUP");
357
351
  return [
358
- ...f.map((d, G) => {
359
- var r;
352
+ ...b.map((o, y) => {
353
+ var _;
360
354
  return [
361
- G === 0 ? y.name : "",
355
+ y === 0 ? u.name : "",
362
356
  "RECIPE",
363
357
  "",
364
- ((r = o[d.id]) == null ? void 0 : r.name) || "",
365
- d.amount.amount,
358
+ ((_ = r[o.id]) == null ? void 0 : _.name) || "",
359
+ o.amount.amount,
366
360
  "",
367
361
  "unit",
368
362
  "Unit",
369
- G === 0 ? u : ""
363
+ y === 0 ? v : ""
370
364
  ];
371
365
  }),
372
- ...g.map((d, G) => {
373
- var r, b, C, A, U, T, re, ye, ge, me, fe, ue, be, he, xe, _e;
366
+ ...f.map((o, y) => {
367
+ var _, G, w, I, ee, ve, ye, ge, fe, ae, be, le, he, xe, _e, we;
374
368
  return [
375
- !f.length && G === 0 ? y.name : "",
369
+ !b.length && y === 0 ? u.name : "",
376
370
  "INGREDIENT",
377
- ((r = l[d.id]) == null ? void 0 : r.code) || "",
378
- ((b = l[d.id]) == null ? void 0 : b.name) || "",
379
- d.amount.amount,
380
- d.measurement ? ((A = (C = l[d.id]) == null ? void 0 : C.unit) == null ? void 0 : A.name) || "" : ((T = (U = l[d.id]) == null ? void 0 : U.unit) == null ? void 0 : T.name) || "",
381
- d.measurement ? ((ye = (re = l[d.id]) == null ? void 0 : re.unit) == null ? void 0 : ye.abbrev) || "" : ((me = (ge = l[d.id]) == null ? void 0 : ge.unit) == null ? void 0 : me.abbrev) || "",
382
- d.measurement ? d.measurement.abbrev : ((he = (be = (ue = (fe = l[d.id]) == null ? void 0 : fe.unit) == null ? void 0 : ue.measurements) == null ? void 0 : be.find((Ee) => {
371
+ ((_ = l[o.id]) == null ? void 0 : _.code) || "",
372
+ ((G = l[o.id]) == null ? void 0 : G.name) || "",
373
+ pe(o.amount),
374
+ o.measurement ? ((I = (w = l[o.id]) == null ? void 0 : w.unit) == null ? void 0 : I.name) || "" : ((ve = (ee = l[o.id]) == null ? void 0 : ee.unit) == null ? void 0 : ve.name) || "",
375
+ o.measurement ? ((ge = (ye = l[o.id]) == null ? void 0 : ye.unit) == null ? void 0 : ge.abbrev) || "" : ((ae = (fe = l[o.id]) == null ? void 0 : fe.unit) == null ? void 0 : ae.abbrev) || "",
376
+ o.measurement ? o.measurement.abbrev : ((xe = (he = (le = (be = l[o.id]) == null ? void 0 : be.unit) == null ? void 0 : le.measurements) == null ? void 0 : he.find((Se) => {
383
377
  var m;
384
- return Ee.id === ((m = l[d.id]) == null ? void 0 : m.trackingMeasurement);
385
- })) == null ? void 0 : he.abbrev) || ((_e = (xe = l[d.id]) == null ? void 0 : xe.unit) == null ? void 0 : _e.abbrev) || "",
386
- !f.length && G === 0 ? u : ""
378
+ return Se.id === ((m = l[o.id]) == null ? void 0 : m.trackingMeasurement);
379
+ })) == null ? void 0 : xe.abbrev) || ((we = (_e = l[o.id]) == null ? void 0 : _e.unit) == null ? void 0 : we.abbrev) || "",
380
+ !b.length && y === 0 ? v : ""
387
381
  ];
388
382
  }),
389
- ...p.map((d, G) => {
390
- var r, b;
383
+ ...d.map((o, y) => {
384
+ var _, G;
391
385
  return [
392
- f.length === 0 && g.length === 0 && G === 0 ? y.name : "",
386
+ b.length === 0 && f.length === 0 && y === 0 ? u.name : "",
393
387
  "SKU_GROUP",
394
- ((r = s[d.id]) == null ? void 0 : r.ref) || "",
395
- ((b = s[d.id]) == null ? void 0 : b.name) || "",
396
- d.amount.amount,
388
+ ((_ = s[o.id]) == null ? void 0 : _.ref) || "",
389
+ ((G = s[o.id]) == null ? void 0 : G.name) || "",
390
+ pe(o.amount),
397
391
  "",
398
392
  "unit",
399
393
  "Unit",
400
- f.length === 0 && g.length === 0 && G === 0 ? u : ""
394
+ b.length === 0 && f.length === 0 && y === 0 ? v : ""
401
395
  ];
402
396
  })
403
397
  ];
@@ -405,49 +399,49 @@ function ut() {
405
399
  return [];
406
400
  });
407
401
  } else
408
- x = [
402
+ h = [
409
403
  ["Pizza Dough", "INGREDIENT", "FLOUR001", "Flour", "500", "Weight", "g", "Gram", "difficulty:easy, category:italian"],
410
404
  ["", "INGREDIENT", "WATER001", "Water", "300", "Volume", "ml", "Milliliter", ""],
411
405
  ["", "INGREDIENT", "SALT001", "Salt", "10", "Weight", "g", "Gram", ""]
412
406
  ];
413
- const w = [
407
+ const E = [
414
408
  ["Business name:", e == null ? void 0 : e.name],
415
409
  ["Business ID:", e == null ? void 0 : e._id],
416
410
  ["Menu version", e == null ? void 0 : e.menuVersion],
417
411
  [],
418
- h.map((o) => o.name),
419
- ...x
420
- ], _ = h.map((o) => `system:${o.id}`);
421
- return ke(w, _);
412
+ g.map((r) => r.name),
413
+ ...h
414
+ ], x = g.map((r) => `system:${r.id}`);
415
+ return Re(E, x);
422
416
  }
423
417
  function dt() {
424
- const R = Ke({
418
+ const U = We({
425
419
  unit: lt(),
426
420
  ingredient: mt(),
427
421
  recipe: ut()
428
422
  }), e = "FeedMe comprehensive template.xlsx";
429
- return We(R, e), e;
423
+ return Ve(U, e), e;
430
424
  }
431
- async function ct(R) {
432
- if (!R) return null;
425
+ async function ct(U) {
426
+ if (!U) return null;
433
427
  try {
434
- return st(R);
428
+ return st(U);
435
429
  } catch (e) {
436
430
  throw console.error("Error in processUnitsSheet:", e), e;
437
431
  }
438
432
  }
439
- async function pt(R) {
440
- if (!R) return null;
433
+ async function pt(U) {
434
+ if (!U) return null;
441
435
  try {
442
- return tt(R);
436
+ return tt(U);
443
437
  } catch (e) {
444
438
  throw console.error("Error in processIngredientsSheet:", e), e;
445
439
  }
446
440
  }
447
- async function vt(R) {
448
- if (!R) return null;
441
+ async function vt(U) {
442
+ if (!U) return null;
449
443
  try {
450
- const e = at(R);
444
+ const e = at(U);
451
445
  return it(e, { ignoreErrors: !0 });
452
446
  } catch (e) {
453
447
  throw console.error("Error in processRecipesSheet:", e), e;
@@ -464,87 +458,87 @@ const yt = { class: "flex flex-col gap-24" }, gt = { class: "flex flex-col gap-8
464
458
  class: "max-h-[200px] overflow-y-auto flex flex-col gap-8"
465
459
  }, It = { class: "fm-typo-en-body-lg-600" }, Et = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, St = /* @__PURE__ */ De({
466
460
  __name: "ImportDialog",
467
- setup(R) {
468
- const e = D(null), S = Qe();
469
- Oe();
470
- const h = D(!1), x = D(new Array()), w = D(null), _ = D([]), o = D([]), l = q(() => !!x.value.length), s = q(() => !!w.value && _.value.length > 0), { t: y } = je();
471
- async function u(g) {
472
- x.value = [], w.value = null, _.value = [], o.value = [];
461
+ setup(U) {
462
+ const e = F(null), R = Qe();
463
+ He();
464
+ const g = F(!1), h = F(new Array()), E = F(null), x = F([]), r = F([]), l = J(() => !!h.value.length), s = J(() => !!E.value && x.value.length > 0), { t: u } = Oe();
465
+ async function v(f) {
466
+ h.value = [], E.value = null, x.value = [], r.value = [];
473
467
  try {
474
- h.value = !0;
475
- const [p] = await Promise.all([
476
- Je(g),
468
+ g.value = !0;
469
+ const [d] = await Promise.all([
470
+ Je(f),
477
471
  // fake buffer for UX
478
- new Promise((d) => setTimeout(d, 1e3))
472
+ new Promise((o) => setTimeout(o, 1e3))
479
473
  ]);
480
- w.value = p, c();
481
- } catch (p) {
482
- console.error("Error parsing Excel file:", p), x.value.push((p == null ? void 0 : p.message) || "Unknown error occurred");
474
+ E.value = d, p();
475
+ } catch (d) {
476
+ console.error("Error parsing Excel file:", d), h.value.push((d == null ? void 0 : d.message) || "Unknown error occurred");
483
477
  } finally {
484
- h.value = !1;
478
+ g.value = !1;
485
479
  }
486
480
  }
487
- function c() {
488
- if (x.value = [], !w.value) return;
489
- const p = ["unit", "ingredient", "recipe"].filter((d) => w.value.Sheets[d]);
490
- if (p.length === 0) {
491
- x.value.push("No valid sheets found. Expected sheets: unit, ingredient, or recipe");
481
+ function p() {
482
+ if (h.value = [], !E.value) return;
483
+ const d = ["unit", "ingredient", "recipe"].filter((o) => E.value.Sheets[o]);
484
+ if (d.length === 0) {
485
+ h.value.push("No valid sheets found. Expected sheets: unit, ingredient, or recipe");
492
486
  return;
493
487
  }
494
- _.value = p, S.emitData({ availableSheets: p, workbook: w.value });
488
+ x.value = d, R.emitData({ availableSheets: d, workbook: E.value });
495
489
  }
496
- He(e, (g) => {
497
- g && u(g);
490
+ ze(e, (f) => {
491
+ f && v(f);
498
492
  });
499
- function f() {
500
- if (!w.value || _.value.length === 0) return "";
501
- const g = [];
502
- return _.value.forEach((p) => {
503
- switch (p) {
493
+ function b() {
494
+ if (!E.value || x.value.length === 0) return "";
495
+ const f = [];
496
+ return x.value.forEach((d) => {
497
+ switch (d) {
504
498
  case "unit":
505
- g.push("Units sheet found");
499
+ f.push("Units sheet found");
506
500
  break;
507
501
  case "ingredient":
508
- g.push("Ingredients sheet found");
502
+ f.push("Ingredients sheet found");
509
503
  break;
510
504
  case "recipe":
511
- g.push("Recipes sheet found");
505
+ f.push("Recipes sheet found");
512
506
  break;
513
507
  }
514
- }), g.length > 0 ? `Ready to process: ${g.join(", ")}. Processing will follow dependency order.` : "No valid sheets found";
508
+ }), f.length > 0 ? `Ready to process: ${f.join(", ")}. Processing will follow dependency order.` : "No valid sheets found";
515
509
  }
516
- return (g, p) => {
517
- const d = ee("FmCircularProgress"), G = ee("FmIcon"), r = ee("FmButton");
518
- return N(), P("div", yt, [
519
- B(Le, {
520
- class: ve({
510
+ return (f, d) => {
511
+ const o = Y("FmCircularProgress"), y = Y("FmIcon"), _ = Y("FmButton");
512
+ return N(), D("div", yt, [
513
+ A(Le, {
514
+ class: ce({
521
515
  "w-full": !0,
522
516
  "h-[200px]": !e.value
523
517
  }),
524
518
  accept: ".xlsx,.xls",
525
- onFileUpload: p[0] || (p[0] = (b) => e.value = b),
526
- label: i(y)("inventory.ingredient.import.uploadTemplate"),
527
- "button-label": i(y)("inventory.ingredient.import.selectFile")
528
- }, ze({ _: 2 }, [
519
+ onFileUpload: d[0] || (d[0] = (G) => e.value = G),
520
+ label: i(u)("inventory.ingredient.import.uploadTemplate"),
521
+ "button-label": i(u)("inventory.ingredient.import.selectFile")
522
+ }, Ke({ _: 2 }, [
529
523
  e.value ? {
530
524
  name: "default",
531
- fn: Z(({ openFileDialog: b }) => [
525
+ fn: Q(({ openFileDialog: G }) => [
532
526
  n("div", gt, [
533
527
  n("div", {
534
- class: ve([
528
+ class: ce([
535
529
  "fm-corner-radius-md p-16 flex items-center gap-16",
536
530
  {
537
- "border border-fm-color-neutral-gray-100": h.value,
538
- "border border-fm-color-neutral-gray-200": !h.value && !l.value,
531
+ "border border-fm-color-neutral-gray-100": g.value,
532
+ "border border-fm-color-neutral-gray-200": !g.value && !l.value,
539
533
  "border border-fm-color-system-error-200": l.value
540
534
  }
541
535
  ])
542
536
  }, [
543
- h.value ? (N(), ae(d, {
537
+ g.value ? (N(), se(o, {
544
538
  key: 0,
545
539
  size: "md",
546
540
  color: "neutral-gray-200"
547
- })) : (N(), ae(G, {
541
+ })) : (N(), se(y, {
548
542
  key: 1,
549
543
  name: l.value ? "error" : "check_circle",
550
544
  color: l.value ? "system-error-300" : "system-success-400",
@@ -553,53 +547,53 @@ const yt = { class: "flex flex-col gap-24" }, gt = { class: "flex flex-col gap-8
553
547
  n("div", ft, [
554
548
  n("div", bt, a(e.value.name), 1),
555
549
  n("div", {
556
- class: ve([
550
+ class: ce([
557
551
  "fm-typo-en-body-sm-400",
558
552
  {
559
553
  "text-fm-color-system-error-300": l.value,
560
554
  "text-fm-color-typo-secondary": !l.value
561
555
  }
562
556
  ])
563
- }, a(l.value ? i(y)("inventory.ingredient.import.error.invalidContent") : "File valid"), 3)
557
+ }, a(l.value ? i(u)("inventory.ingredient.import.error.invalidContent") : "File valid"), 3)
564
558
  ]),
565
- h.value ? te("", !0) : (N(), P("div", ht, [
566
- B(r, {
567
- label: i(y)("inventory.ingredient.import.replaceFile"),
559
+ g.value ? Z("", !0) : (N(), D("div", ht, [
560
+ A(_, {
561
+ label: i(u)("inventory.ingredient.import.replaceFile"),
568
562
  variant: l.value ? "destructive" : "secondary",
569
563
  "prepend-icon": l.value ? void 0 : "autorenew",
570
- onClick: b
564
+ onClick: G
571
565
  }, null, 8, ["label", "variant", "prepend-icon", "onClick"])
572
566
  ]))
573
567
  ], 2),
574
- x.value.length ? (N(), P("div", xt, [
575
- (N(!0), P(Ae, null, Be(x.value, (C, A) => (N(), P("div", {
576
- key: A,
568
+ h.value.length ? (N(), D("div", xt, [
569
+ (N(!0), D(Be, null, Pe(h.value, (w, I) => (N(), D("div", {
570
+ key: I,
577
571
  class: "flex gap-8 items-center"
578
572
  }, [
579
- B(G, {
573
+ A(y, {
580
574
  name: "error",
581
575
  size: "sm",
582
576
  color: "system-error-300"
583
577
  }),
584
- n("div", _t, a(C), 1)
578
+ n("div", _t, a(w), 1)
585
579
  ]))), 128))
586
- ])) : te("", !0)
580
+ ])) : Z("", !0)
587
581
  ])
588
582
  ]),
589
583
  key: "0"
590
584
  } : void 0
591
585
  ]), 1032, ["class", "label", "button-label"]),
592
- s.value ? (N(), P("div", wt, [
593
- n("div", It, a(i(y)("inventory.ingredient.import.summary")), 1),
594
- n("div", Et, a(f()), 1)
595
- ])) : te("", !0)
586
+ s.value ? (N(), D("div", wt, [
587
+ n("div", It, a(i(u)("inventory.ingredient.import.summary")), 1),
588
+ n("div", Et, a(b()), 1)
589
+ ])) : Z("", !0)
596
590
  ]);
597
591
  };
598
592
  }
599
593
  }), kt = {
600
594
  key: 0,
601
595
  class: "bg-blue-50 border border-blue-200 rounded-lg p-16"
602
- }, Rt = { class: "flex items-start gap-12" }, Ct = { class: "flex flex-col gap-8" }, Ut = { class: "fm-typo-en-body-md-400 text-blue-800" }, Nt = { class: "fm-typo-en-body-sm-400 text-blue-700" }, Gt = { class: "mb-8" }, Tt = ["innerHTML"], Mt = ["innerHTML"], Ft = { class: "mb-8" }, $t = { class: "mb-12" }, Dt = { class: "mb-12" }, At = { class: "mb-8" }, Bt = { class: "text-orange-600" }, Pt = {
596
+ }, Rt = { class: "flex items-start gap-12" }, Ct = { class: "flex flex-col gap-8" }, Ut = { class: "fm-typo-en-body-md-400 text-blue-800" }, Gt = { class: "fm-typo-en-body-sm-400 text-blue-700" }, Nt = { class: "mb-8" }, Tt = ["innerHTML"], Mt = ["innerHTML"], $t = { class: "mb-8" }, Ft = { class: "mb-12" }, At = { class: "mb-12" }, Dt = { class: "mb-8" }, Bt = { class: "text-orange-600" }, Pt = {
603
597
  key: 1,
604
598
  class: "bg-white rounded-lg shadow"
605
599
  }, jt = { class: "flex items-center justify-between p-16 border-b" }, Ot = { class: "fm-typo-en-title-md-600" }, Ht = { class: "fm-typo-en-body-sm-400 text-gray-600 mt-4" }, zt = {
@@ -617,62 +611,62 @@ const yt = { class: "flex flex-col gap-24" }, gt = { class: "flex flex-col gap-8
617
611
  }, Xt = { class: "flex items-center justify-between p-16 border-b" }, qt = { class: "fm-typo-en-title-md-600 text-red-800" }, Qt = { class: "fm-typo-en-body-sm-400 text-gray-600 mt-4" }, Yt = { class: "flex gap-8" }, Zt = { class: "p-16" }, en = {
618
612
  key: 0,
619
613
  class: "flex flex-col gap-16 p-16"
620
- }, tn = { class: "fm-typo-en-title-sm-600 mb-12" }, nn = { class: "grid grid-cols-2 gap-12" }, on = { class: "fm-typo-en-body-sm-400 text-gray-600" }, rn = { class: "fm-typo-en-body-md-600" }, sn = { key: 0 }, an = { class: "fm-typo-en-body-sm-400 text-gray-600" }, ln = { class: "fm-typo-en-body-md-600" }, mn = { class: "fm-typo-en-body-sm-400 text-gray-600" }, un = { class: "fm-typo-en-body-md-600" }, dn = { class: "fm-typo-en-body-sm-400 text-gray-600" }, cn = { class: "fm-typo-en-body-md-600" }, pn = { class: "fm-typo-en-body-sm-400 text-gray-600" }, vn = { class: "fm-typo-en-title-sm-600 mb-12 text-red-800" }, yn = { class: "space-y-8" }, gn = { class: "fm-typo-en-body-md-400 text-red-800" }, fn = { class: "fm-typo-en-title-sm-600 mb-12" }, bn = { class: "bg-gray-50 p-12 rounded border overflow-auto" }, hn = { class: "text-sm" }, xn = { class: "flex gap-8" }, _n = { class: "flex flex-col items-center justify-center h-64 gap-16" }, wn = { class: "text-center" }, In = { class: "fm-typo-en-title-md-600 text-gray-600 mb-8" }, En = { class: "flex flex-col items-center justify-center h-64 gap-16" }, Sn = { class: "text-center" }, kn = { class: "fm-typo-en-title-md-600 text-gray-600 mb-8" }, Rn = { class: "fm-typo-en-body-md-400 text-gray-500" }, Fn = /* @__PURE__ */ De({
614
+ }, tn = { class: "fm-typo-en-title-sm-600 mb-12" }, nn = { class: "grid grid-cols-2 gap-12" }, on = { class: "fm-typo-en-body-sm-400 text-gray-600" }, rn = { class: "fm-typo-en-body-md-600" }, sn = { key: 0 }, an = { class: "fm-typo-en-body-sm-400 text-gray-600" }, ln = { class: "fm-typo-en-body-md-600" }, mn = { class: "fm-typo-en-body-sm-400 text-gray-600" }, un = { class: "fm-typo-en-body-md-600" }, dn = { class: "fm-typo-en-body-sm-400 text-gray-600" }, cn = { class: "fm-typo-en-body-md-600" }, pn = { class: "fm-typo-en-body-sm-400 text-gray-600" }, vn = { class: "fm-typo-en-title-sm-600 mb-12 text-red-800" }, yn = { class: "space-y-8" }, gn = { class: "fm-typo-en-body-md-400 text-red-800" }, fn = { class: "fm-typo-en-title-sm-600 mb-12" }, bn = { class: "bg-gray-50 p-12 rounded border overflow-auto" }, hn = { class: "text-sm" }, xn = { class: "flex gap-8" }, _n = { class: "flex flex-col items-center justify-center h-64 gap-16" }, wn = { class: "text-center" }, In = { class: "fm-typo-en-title-md-600 text-gray-600 mb-8" }, En = { class: "flex flex-col items-center justify-center h-64 gap-16" }, Sn = { class: "text-center" }, kn = { class: "fm-typo-en-title-md-600 text-gray-600 mb-8" }, Rn = { class: "fm-typo-en-body-md-400 text-gray-500" }, $n = /* @__PURE__ */ De({
621
615
  __name: "ImportView",
622
- setup(R) {
623
- const { t: e } = je(), S = Ye(), h = Oe();
616
+ setup(U) {
617
+ const { t: e } = Oe(), R = Ye(), g = He();
624
618
  Xe();
625
- const x = qe(), { breakpoints: w } = Ze(), _ = le(), o = D("");
626
- D(!1);
627
- const l = D(!1), s = D(null), y = D(!1), u = D(null), c = D(!1), f = D([]), g = D(null), p = D([]), d = D(!1), G = q(() => w.value.xs || w.value.sm), r = q(() => G.value ? 10 : 20), b = q(() => {
619
+ const h = qe(), { breakpoints: E } = Ze(), x = ie(), r = F("");
620
+ F(!1);
621
+ const l = F(!1), s = F(null), u = F(!1), v = F(null), p = F(!1), b = F([]), f = F(null), d = F([]), o = F(!1), y = J(() => E.value.xs || E.value.sm), _ = J(() => y.value ? 10 : 20), G = J(() => {
628
622
  const m = s.value;
629
623
  if (!m) return [];
630
- const t = [], { units: k, skus: j, recipes: J, _invalidExcel: W, _invalidExcelMessage: Q } = m, Y = (F) => {
631
- var H;
632
- return ((H = F.errors) == null ? void 0 : H.length) > 0 ? Array.isArray(F.errors) ? F.errors.join(", ") : F.errors || e("inventory.common.validationFailed") : W ? Q || e("inventory.common.invalidExcelFormat") : e("inventory.common.readyToImport");
633
- }, K = (F, z) => {
634
- if (F)
635
- for (const H of ["create", "update"]) {
636
- const V = F[H];
637
- if (V)
638
- for (const O of V)
624
+ const t = [], { units: C, skus: B, recipes: V, _invalidExcel: z, _invalidExcelMessage: X } = m, q = (M) => {
625
+ var j;
626
+ return ((j = M.errors) == null ? void 0 : j.length) > 0 ? Array.isArray(M.errors) ? M.errors.join(", ") : M.errors || e("inventory.common.validationFailed") : z ? X || e("inventory.common.invalidExcelFormat") : e("inventory.common.readyToImport");
627
+ }, H = (M, O) => {
628
+ if (M)
629
+ for (const j of ["create", "update"]) {
630
+ const K = M[j];
631
+ if (K)
632
+ for (const P of K)
639
633
  t.push({
640
- name: O.name || O.abbrev || O.code || e("inventory.common.unknown"),
641
- type: z,
642
- operation: e(H === "create" ? "inventory.common.create" : "inventory.common.update"),
643
- status: Y(O),
644
- errors: O.errors || [],
645
- details: O
634
+ name: P.name || P.abbrev || P.code || e("inventory.common.unknown"),
635
+ type: O,
636
+ operation: e(j === "create" ? "inventory.common.create" : "inventory.common.update"),
637
+ status: q(P),
638
+ errors: P.errors || [],
639
+ details: P
646
640
  });
647
641
  }
648
642
  };
649
- return K(k, e("inventory.common.unit")), K(j, e("inventory.common.ingredient")), K(J, e("inventory.common.recipe")), t;
650
- }), C = q(() => b.value.some(
643
+ return H(C, e("inventory.common.unit")), H(B, e("inventory.common.ingredient")), H(V, e("inventory.common.recipe")), t;
644
+ }), w = J(() => G.value.some(
651
645
  (m) => m.errors && m.errors.length > 0
652
- )), A = q(() => b.value.some(
646
+ )), I = J(() => G.value.some(
653
647
  (m) => m.status && m.status.includes("Invalid Excel")
654
- )), U = q(() => {
655
- const m = b.value.find(
648
+ )), ee = J(() => {
649
+ const m = G.value.find(
656
650
  (t) => t.status && t.status.includes("Invalid Excel")
657
651
  );
658
652
  return (m == null ? void 0 : m.status) || e("inventory.common.invalidExcelFormatDetected");
659
- }), T = q(() => !p.value || p.value.length === 0 ? [] : p.value.map((m, t) => {
660
- var k, j;
653
+ }), ve = J(() => !d.value || d.value.length === 0 ? [] : d.value.map((m, t) => {
654
+ var C, B;
661
655
  return {
662
656
  id: t + 1,
663
- name: ((k = m.error.data) == null ? void 0 : k.name) || e("inventory.common.unknown"),
657
+ name: ((C = m.error.data) == null ? void 0 : C.name) || e("inventory.common.unknown"),
664
658
  type: m.type || e("inventory.common.general"),
665
- message: ((j = m.error) == null ? void 0 : j.message) || JSON.stringify(m.error)
659
+ message: ((B = m.error) == null ? void 0 : B.message) || JSON.stringify(m.error)
666
660
  };
667
661
  }));
668
- function re(m) {
662
+ function ye(m) {
669
663
  switch (m) {
670
664
  case "import":
671
- return ye();
665
+ return ge();
672
666
  }
673
667
  }
674
- function ye() {
675
- S.open({
668
+ function ge() {
669
+ R.open({
676
670
  title: e("inventory.common.import"),
677
671
  contentComponent: St,
678
672
  overlay: !0,
@@ -691,17 +685,17 @@ const yt = { class: "flex flex-col gap-24" }, gt = { class: "flex flex-col gap-8
691
685
  variant: "plain"
692
686
  }
693
687
  }).onPrimary(async (m) => {
694
- m && m.workbook && m.availableSheets && (await ge(m), S.close()), f.value.length === 0 && S.close();
688
+ m && m.workbook && m.availableSheets && (await fe(m), R.close()), b.value.length === 0 && R.close();
695
689
  }).onTertiary(() => {
696
690
  try {
697
691
  const m = dt();
698
- h.open({
692
+ g.open({
699
693
  title: e("inventory.common.export") + " " + e("inventory.ingredient.import.actions.downloadTemplate"),
700
694
  message: e("inventory.common.templateDownloaded", [m]),
701
695
  type: "success"
702
696
  });
703
697
  } catch (m) {
704
- h.open({
698
+ g.open({
705
699
  title: e("inventory.common.downloadFailed"),
706
700
  message: e("inventory.common.failedDownloadTemplate"),
707
701
  type: "error"
@@ -709,98 +703,98 @@ const yt = { class: "flex flex-col gap-24" }, gt = { class: "flex flex-col gap-8
709
703
  }
710
704
  });
711
705
  }
712
- async function ge(m) {
713
- g.value = m.workbook, f.value = [...m.availableSheets], s.value = {}, p.value = [], await me();
706
+ async function fe(m) {
707
+ f.value = m.workbook, b.value = [...m.availableSheets], s.value = {}, d.value = [], await ae();
714
708
  }
715
- async function me() {
716
- var t, k, j, J, W, Q, Y, K, F, z, H, V, O, de, ce;
717
- if (!g.value || f.value.length === 0) {
718
- y.value = !0;
709
+ async function ae() {
710
+ var t, C, B, V, z, X, q, H, M, O, j, K, P, me, ue;
711
+ if (!f.value || b.value.length === 0) {
712
+ u.value = !0;
719
713
  return;
720
714
  }
721
- const m = f.value[0];
715
+ const m = b.value[0];
722
716
  try {
723
717
  switch (m) {
724
718
  case "unit": {
725
- const X = g.value.Sheets.unit, I = await ct(X);
726
- I && (s.value = {
719
+ const L = f.value.Sheets.unit, S = await ct(L);
720
+ S && (s.value = {
727
721
  ...s.value,
728
- _invalidExcel: I.invalidExcel || ((t = s.value) == null ? void 0 : t._invalidExcel),
729
- _invalidExcelMessage: I.invalidExcelMessage || ((k = s.value) == null ? void 0 : k._invalidExcelMessage) || e("inventory.common.invalidExcelFormat") + " for Units sheet",
730
- units: I.importCreateResult || I.importUpdateResult ? {
731
- create: ((j = I.importCreateResult) == null ? void 0 : j.map(($) => ({
722
+ _invalidExcel: S.invalidExcel || ((t = s.value) == null ? void 0 : t._invalidExcel),
723
+ _invalidExcelMessage: S.invalidExcelMessage || ((C = s.value) == null ? void 0 : C._invalidExcelMessage) || e("inventory.common.invalidExcelFormat") + " for Units sheet",
724
+ units: S.importCreateResult || S.importUpdateResult ? {
725
+ create: ((B = S.importCreateResult) == null ? void 0 : B.map(($) => ({
732
726
  ...$.unit,
733
727
  errors: $.errors
734
728
  }))) || [],
735
- update: ((J = I.importUpdateResult) == null ? void 0 : J.map(($) => ({
729
+ update: ((V = S.importUpdateResult) == null ? void 0 : V.map(($) => ({
736
730
  ...$.unit,
737
731
  errors: $.errors
738
732
  }))) || []
739
- } : (W = s.value) == null ? void 0 : W.units
733
+ } : (z = s.value) == null ? void 0 : z.units
740
734
  });
741
735
  break;
742
736
  }
743
737
  case "ingredient": {
744
- const X = g.value.Sheets.ingredient, I = await pt(X);
745
- I && (s.value = {
738
+ const L = f.value.Sheets.ingredient, S = await pt(L);
739
+ S && (s.value = {
746
740
  ...s.value,
747
- _invalidExcel: I.invalidExcel || ((Q = s.value) == null ? void 0 : Q._invalidExcel),
748
- _invalidExcelMessage: I.invalidExcelMessage || ((Y = s.value) == null ? void 0 : Y._invalidExcelMessage) || e("inventory.common.invalidExcelFormat") + " for Ingredients sheet",
749
- skus: I.importCreateResult || I.importUpdateResult ? {
750
- create: ((K = I.importCreateResult) == null ? void 0 : K.map(($) => ({
741
+ _invalidExcel: S.invalidExcel || ((X = s.value) == null ? void 0 : X._invalidExcel),
742
+ _invalidExcelMessage: S.invalidExcelMessage || ((q = s.value) == null ? void 0 : q._invalidExcelMessage) || e("inventory.common.invalidExcelFormat") + " for Ingredients sheet",
743
+ skus: S.importCreateResult || S.importUpdateResult ? {
744
+ create: ((H = S.importCreateResult) == null ? void 0 : H.map(($) => ({
751
745
  ...$.sku,
752
746
  errors: $.errors
753
747
  }))) || [],
754
- update: ((F = I.importUpdateResult) == null ? void 0 : F.map(($) => ({
748
+ update: ((M = S.importUpdateResult) == null ? void 0 : M.map(($) => ({
755
749
  ...$.sku,
756
750
  errors: $.errors
757
751
  }))) || []
758
- } : (z = s.value) == null ? void 0 : z.skus
752
+ } : (O = s.value) == null ? void 0 : O.skus
759
753
  });
760
754
  break;
761
755
  }
762
756
  case "recipe": {
763
- const X = g.value.Sheets.recipe, I = await vt(X);
764
- I && (s.value = {
757
+ const L = f.value.Sheets.recipe, S = await vt(L);
758
+ S && (s.value = {
765
759
  ...s.value,
766
- _invalidExcel: I.invalidExcel || ((H = s.value) == null ? void 0 : H._invalidExcel),
767
- _invalidExcelMessage: I.invalidExcelMessage || ((V = s.value) == null ? void 0 : V._invalidExcelMessage) || e("inventory.common.invalidExcelFormat") + " for Recipes sheet",
768
- recipes: I.importCreateResult || I.importUpdateResult ? {
769
- create: ((O = I.importCreateResult) == null ? void 0 : O.map(($) => ({
760
+ _invalidExcel: S.invalidExcel || ((j = s.value) == null ? void 0 : j._invalidExcel),
761
+ _invalidExcelMessage: S.invalidExcelMessage || ((K = s.value) == null ? void 0 : K._invalidExcelMessage) || e("inventory.common.invalidExcelFormat") + " for Recipes sheet",
762
+ recipes: S.importCreateResult || S.importUpdateResult ? {
763
+ create: ((P = S.importCreateResult) == null ? void 0 : P.map(($) => ({
770
764
  ...$.recipe,
771
765
  errors: $.errors
772
766
  }))) || [],
773
- update: ((de = I.importUpdateResult) == null ? void 0 : de.map(($) => ({
767
+ update: ((me = S.importUpdateResult) == null ? void 0 : me.map(($) => ({
774
768
  ...$.recipe,
775
769
  errors: $.errors
776
770
  }))) || []
777
- } : (ce = s.value) == null ? void 0 : ce.recipes
771
+ } : (ue = s.value) == null ? void 0 : ue.recipes
778
772
  });
779
773
  break;
780
774
  }
781
775
  }
782
- f.value.shift(), y.value = !0;
783
- } catch (X) {
784
- console.error(`Error processing ${m} sheet:`, X), h.open({
776
+ b.value.shift(), u.value = !0;
777
+ } catch (L) {
778
+ console.error(`Error processing ${m} sheet:`, L), g.open({
785
779
  title: e("inventory.common.processingError"),
786
780
  message: e("inventory.common.failedToProcessSheet", [m]),
787
781
  type: "error"
788
782
  });
789
783
  }
790
784
  }
791
- async function fe() {
792
- var m, t, k, j, J, W, Q, Y, K, F, z, H, V, O, de, ce, X, I, $, Ce, Ue, Ne, Ge, Te;
785
+ async function be() {
786
+ var m, t, C, B, V, z, X, q, H, M, O, j, K, P, me, ue, L, S, $, Ue, Ge, Ne, Te, Me;
793
787
  if (s.value) {
794
- if (A.value) {
795
- h.open({
788
+ if (I.value) {
789
+ g.open({
796
790
  title: e("inventory.common.invalidExcelFormatTitle"),
797
- message: U.value,
791
+ message: ee.value,
798
792
  type: "error"
799
793
  });
800
794
  return;
801
795
  }
802
- if (C.value) {
803
- h.open({
796
+ if (w.value) {
797
+ g.open({
804
798
  title: e("inventory.ingredient.import.error.invalidContent"),
805
799
  message: e("inventory.ingredient.import.error.hasErrors"),
806
800
  type: "error"
@@ -809,115 +803,115 @@ const yt = { class: "flex flex-col gap-24" }, gt = { class: "flex flex-col gap-8
809
803
  }
810
804
  l.value = !0;
811
805
  try {
812
- let L = 0, se = "";
806
+ let W = 0, oe = "";
813
807
  if (s.value.units && ((m = s.value.units.create) != null && m.length || (t = s.value.units.update) != null && t.length)) {
814
- const M = {
815
- create: ((k = s.value.units.create) == null ? void 0 : k.filter((v) => !v.errors || v.errors.length === 0)) || [],
816
- update: ((j = s.value.units.update) == null ? void 0 : j.filter((v) => !v.errors || v.errors.length === 0)) || []
808
+ const T = {
809
+ create: ((C = s.value.units.create) == null ? void 0 : C.filter((c) => !c.errors || c.errors.length === 0)) || [],
810
+ update: ((B = s.value.units.update) == null ? void 0 : B.filter((c) => !c.errors || c.errors.length === 0)) || []
817
811
  };
818
- if (M.create.length || M.update.length) {
819
- const v = await _.importUnits(M);
820
- ((J = v == null ? void 0 : v.errors) == null ? void 0 : J.length) > 0 && p.value.push(...v.errors.map((ie) => ({
812
+ if (T.create.length || T.update.length) {
813
+ const c = await x.importUnits(T);
814
+ ((V = c == null ? void 0 : c.errors) == null ? void 0 : V.length) > 0 && d.value.push(...c.errors.map((re) => ({
821
815
  type: "units",
822
- error: ie
816
+ error: re
823
817
  })));
824
- const ne = M.create.length + M.update.length, oe = ((W = v == null ? void 0 : v.errors) == null ? void 0 : W.length) || 0;
825
- L = ne - oe, se = "units", s.value = {
818
+ const te = T.create.length + T.update.length, ne = ((z = c == null ? void 0 : c.errors) == null ? void 0 : z.length) || 0;
819
+ W = te - ne, oe = "units", s.value = {
826
820
  ...s.value,
827
821
  units: null
828
822
  };
829
823
  }
830
- } else if (s.value.skus && ((Q = s.value.skus.create) != null && Q.length || (Y = s.value.skus.update) != null && Y.length)) {
831
- const M = {
832
- create: ((K = s.value.skus.create) == null ? void 0 : K.filter((v) => !v.errors || v.errors.length === 0)) || [],
833
- update: ((F = s.value.skus.update) == null ? void 0 : F.filter((v) => !v.errors || v.errors.length === 0)) || []
824
+ } else if (s.value.skus && ((X = s.value.skus.create) != null && X.length || (q = s.value.skus.update) != null && q.length)) {
825
+ const T = {
826
+ create: ((H = s.value.skus.create) == null ? void 0 : H.filter((c) => !c.errors || c.errors.length === 0)) || [],
827
+ update: ((M = s.value.skus.update) == null ? void 0 : M.filter((c) => !c.errors || c.errors.length === 0)) || []
834
828
  };
835
- if (M.create.length || M.update.length) {
836
- const v = await _.importSkus(M);
837
- ((z = v == null ? void 0 : v.errors) == null ? void 0 : z.length) > 0 && p.value.push(...v.errors.map((ie) => ({
829
+ if (T.create.length || T.update.length) {
830
+ const c = await x.importSkus(T);
831
+ ((O = c == null ? void 0 : c.errors) == null ? void 0 : O.length) > 0 && d.value.push(...c.errors.map((re) => ({
838
832
  type: "ingredients",
839
- error: ie
833
+ error: re
840
834
  })));
841
- const ne = M.create.length + M.update.length, oe = ((H = v == null ? void 0 : v.errors) == null ? void 0 : H.length) || 0;
842
- L = ne - oe, se = "ingredients", s.value = {
835
+ const te = T.create.length + T.update.length, ne = ((j = c == null ? void 0 : c.errors) == null ? void 0 : j.length) || 0;
836
+ W = te - ne, oe = "ingredients", s.value = {
843
837
  ...s.value,
844
838
  skus: null
845
839
  };
846
840
  }
847
- } else if (s.value.recipes && ((V = s.value.recipes.create) != null && V.length || (O = s.value.recipes.update) != null && O.length)) {
848
- const M = {
849
- create: ((de = s.value.recipes.create) == null ? void 0 : de.filter((v) => !v.errors || v.errors.length === 0)) || [],
850
- update: ((ce = s.value.recipes.update) == null ? void 0 : ce.filter((v) => !v.errors || v.errors.length === 0)) || []
841
+ } else if (s.value.recipes && ((K = s.value.recipes.create) != null && K.length || (P = s.value.recipes.update) != null && P.length)) {
842
+ const T = {
843
+ create: ((me = s.value.recipes.create) == null ? void 0 : me.filter((c) => !c.errors || c.errors.length === 0)) || [],
844
+ update: ((ue = s.value.recipes.update) == null ? void 0 : ue.filter((c) => !c.errors || c.errors.length === 0)) || []
851
845
  };
852
- if (M.create.length || M.update.length) {
853
- const v = await _.importRecipes(M);
854
- ((X = v == null ? void 0 : v.errors) == null ? void 0 : X.length) > 0 && p.value.push(...v.errors.map((ie) => ({
846
+ if (T.create.length || T.update.length) {
847
+ const c = await x.importRecipes(T);
848
+ ((L = c == null ? void 0 : c.errors) == null ? void 0 : L.length) > 0 && d.value.push(...c.errors.map((re) => ({
855
849
  type: "recipes",
856
- error: ie
850
+ error: re
857
851
  })));
858
- const ne = M.create.length + M.update.length, oe = ((I = v == null ? void 0 : v.errors) == null ? void 0 : I.length) || 0;
859
- L = ne - oe, se = "recipes", s.value = {
852
+ const te = T.create.length + T.update.length, ne = ((S = c == null ? void 0 : c.errors) == null ? void 0 : S.length) || 0;
853
+ W = te - ne, oe = "recipes", s.value = {
860
854
  ...s.value,
861
855
  recipes: null
862
856
  };
863
857
  }
864
858
  }
865
- if (L > 0) {
866
- const M = p.value.filter((v) => v.type === se);
867
- M.length > 0 ? h.open({
859
+ if (W > 0) {
860
+ const T = d.value.filter((c) => c.type === oe);
861
+ T.length > 0 ? g.open({
868
862
  title: e("inventory.common.importCompletedWithIssues"),
869
- message: e("inventory.common.successfullyImported", [L, se, M.length, se]),
863
+ message: e("inventory.common.successfullyImported", [W, oe, T.length, oe]),
870
864
  type: "warning"
871
- }) : h.open({
865
+ }) : g.open({
872
866
  title: e("inventory.ingredient.import.success"),
873
- message: e("inventory.common.successfullyImported", [L, se, "0", ""]),
867
+ message: e("inventory.common.successfullyImported", [W, oe, "0", ""]),
874
868
  type: "success"
875
869
  });
876
870
  }
877
- if (f.value.length > 0)
878
- await me();
879
- else if (!(s.value.units && ((($ = s.value.units.create) == null ? void 0 : $.length) || ((Ce = s.value.units.update) == null ? void 0 : Ce.length)) || s.value.skus && (((Ue = s.value.skus.create) == null ? void 0 : Ue.length) || ((Ne = s.value.skus.update) == null ? void 0 : Ne.length)) || s.value.recipes && (((Ge = s.value.recipes.create) == null ? void 0 : Ge.length) || ((Te = s.value.recipes.update) == null ? void 0 : Te.length))))
880
- if (ue(), p.value.length > 0) {
881
- const v = p.value.filter((pe) => pe.type === "units").length, ne = p.value.filter((pe) => pe.type === "ingredients").length, oe = p.value.filter((pe) => pe.type === "recipes").length, ie = v + ne + oe;
882
- d.value = !0, h.open({
871
+ if (b.value.length > 0)
872
+ await ae();
873
+ else if (!(s.value.units && ((($ = s.value.units.create) == null ? void 0 : $.length) || ((Ue = s.value.units.update) == null ? void 0 : Ue.length)) || s.value.skus && (((Ge = s.value.skus.create) == null ? void 0 : Ge.length) || ((Ne = s.value.skus.update) == null ? void 0 : Ne.length)) || s.value.recipes && (((Te = s.value.recipes.create) == null ? void 0 : Te.length) || ((Me = s.value.recipes.update) == null ? void 0 : Me.length))))
874
+ if (le(), d.value.length > 0) {
875
+ const c = d.value.filter((de) => de.type === "units").length, te = d.value.filter((de) => de.type === "ingredients").length, ne = d.value.filter((de) => de.type === "recipes").length, re = c + te + ne;
876
+ o.value = !0, g.open({
883
877
  title: e("inventory.common.importCompletedWithIssues"),
884
- message: e("inventory.common.importFinishedWithFailedItems", [ie, v, ne, oe]),
878
+ message: e("inventory.common.importFinishedWithFailedItems", [re, c, te, ne]),
885
879
  type: "warning"
886
- }), console.error("Import errors:", p.value);
880
+ }), console.error("Import errors:", d.value);
887
881
  } else
888
- h.open({
882
+ g.open({
889
883
  title: e("inventory.common.importComplete"),
890
884
  message: e("inventory.common.allDataSuccessfullyImported"),
891
885
  type: "success"
892
886
  });
893
- } catch (L) {
894
- h.open({
887
+ } catch (W) {
888
+ g.open({
895
889
  title: e("inventory.ingredient.import.error.failed"),
896
- message: (L == null ? void 0 : L.message) || e("inventory.common.unknownErrorOccurred"),
890
+ message: (W == null ? void 0 : W.message) || e("inventory.common.unknownErrorOccurred"),
897
891
  type: "error"
898
- }), console.error("Error during import:", L);
892
+ }), console.error("Error during import:", W);
899
893
  } finally {
900
894
  l.value = !1;
901
895
  }
902
896
  }
903
897
  }
904
- function ue() {
905
- y.value = !1, d.value = !1, s.value = null, f.value = [], g.value = null;
906
- }
907
- function be() {
908
- d.value = !1, p.value = [];
898
+ function le() {
899
+ u.value = !1, o.value = !1, s.value = null, b.value = [], f.value = null;
909
900
  }
910
901
  function he() {
911
- c.value = !1, u.value = null;
902
+ o.value = !1, d.value = [];
903
+ }
904
+ function xe() {
905
+ p.value = !1, v.value = null;
912
906
  }
913
- const xe = q(() => [
907
+ const _e = J(() => [
914
908
  {
915
909
  label: e("inventory.common.import"),
916
910
  value: "import",
917
911
  isPrimary: !1,
918
912
  prependIcon: "upload"
919
913
  }
920
- ]), _e = Me([
914
+ ]), we = $e([
921
915
  {
922
916
  id: "name",
923
917
  accessorKey: "name",
@@ -943,31 +937,31 @@ const yt = { class: "flex flex-col gap-24" }, gt = { class: "flex flex-col gap-8
943
937
  size: 120,
944
938
  cell: (m) => {
945
939
  const t = m.row.original.status;
946
- let k = "px-8 py-4 rounded";
947
- return t === e("inventory.common.readyToImport") ? k += " bg-blue-100 text-blue-800 border border-blue-200" : t === "Imported" || t === "Successfully Imported" ? k += " bg-green-100 text-green-800 border border-green-200" : t === "Failed" ? k += " bg-red-100 text-red-800 border border-red-200" : t === e("inventory.common.validationFailed") ? k += " bg-orange-100 text-orange-800 border border-orange-200" : (t.includes("Invalid Excel"), k += " bg-red-100 text-red-800 border border-red-200"), we("div", { class: k, title: t }, t);
940
+ let C = "px-8 py-4 rounded";
941
+ return t === e("inventory.common.readyToImport") ? C += " bg-blue-100 text-blue-800 border border-blue-200" : t === "Imported" || t === "Successfully Imported" ? C += " bg-green-100 text-green-800 border border-green-200" : t === "Failed" ? C += " bg-red-100 text-red-800 border border-red-200" : t === e("inventory.common.validationFailed") ? C += " bg-orange-100 text-orange-800 border border-orange-200" : (t.includes("Invalid Excel"), C += " bg-red-100 text-red-800 border border-red-200"), Ie("div", { class: C, title: t }, t);
948
942
  }
949
943
  }
950
- ]), Ee = Me([
944
+ ]), Se = $e([
951
945
  {
952
946
  id: "name",
953
947
  accessorKey: "name",
954
948
  header: () => e("inventory.common.name"),
955
- cell: (m) => we("div", { class: "text-gray-800 text-sm py-2" }, m.row.original.name || e("inventory.common.unknown"))
949
+ cell: (m) => Ie("div", { class: "text-gray-800 text-sm py-2" }, m.row.original.name || e("inventory.common.unknown"))
956
950
  },
957
951
  {
958
952
  id: "type",
959
953
  accessorKey: "type",
960
954
  header: () => e("inventory.common.errorType"),
961
955
  cell: (m) => {
962
- const t = m.row.original.type, k = e(t === "units" ? "inventory.common.unit" : t === "ingredients" ? "inventory.common.ingredient" : t === "recipes" ? "inventory.common.recipe" : "inventory.common.unknown");
963
- return we("div", { class: "text-gray-800 text-sm py-2" }, k);
956
+ const t = m.row.original.type, C = e(t === "units" ? "inventory.common.unit" : t === "ingredients" ? "inventory.common.ingredient" : t === "recipes" ? "inventory.common.recipe" : "inventory.common.unknown");
957
+ return Ie("div", { class: "text-gray-800 text-sm py-2" }, C);
964
958
  }
965
959
  },
966
960
  {
967
961
  id: "message",
968
962
  accessorKey: "message",
969
963
  header: () => e("inventory.common.errorMessage"),
970
- cell: (m) => we(
964
+ cell: (m) => Ie(
971
965
  "div",
972
966
  { class: "text-red-800 text-sm py-2", title: m.row.original.message },
973
967
  m.row.original.message
@@ -975,122 +969,122 @@ const yt = { class: "flex flex-col gap-24" }, gt = { class: "flex flex-col gap-8
975
969
  }
976
970
  ]);
977
971
  return (m, t) => {
978
- const k = ee("FmIcon"), j = ee("FmButton"), J = ee("FmTable"), W = ee("FmCard"), Q = ee("FmSideSheet"), Y = ee("FmSpinner");
979
- return i(x).isLoaded && i(x).enableBulkImport ? (N(), ae(Se, {
972
+ const C = Y("FmIcon"), B = Y("FmButton"), V = Y("FmTable"), z = Y("FmCard"), X = Y("FmSideSheet"), q = Y("FmSpinner");
973
+ return i(h).isLoaded && i(h).enableBulkImport ? (N(), se(ke, {
980
974
  key: 0,
981
975
  title: i(e)("inventory.common.import"),
982
- actions: xe.value,
983
- "onClick:action": re
976
+ actions: _e.value,
977
+ "onClick:action": ye
984
978
  }, {
985
- default: Z(() => {
986
- var K;
979
+ default: Q(() => {
980
+ var H;
987
981
  return [
988
982
  n("div", {
989
- class: ve([
983
+ class: ce([
990
984
  "flex flex-col gap-8 max-h-full",
991
985
  {
992
- "p-0": G.value,
993
- "px-24": !G.value
986
+ "p-0": y.value,
987
+ "px-24": !y.value
994
988
  }
995
989
  ])
996
990
  }, [
997
- y.value ? te("", !0) : (N(), P("div", kt, [
991
+ u.value ? Z("", !0) : (N(), D("div", kt, [
998
992
  n("div", Rt, [
999
- B(k, {
993
+ A(C, {
1000
994
  name: "info",
1001
995
  class: "text-blue-600 mt-2"
1002
996
  }),
1003
997
  n("div", Ct, [
1004
998
  n("div", Ut, a(i(e)("inventory.ingredient.import.multiUploadTemplateInstruction")), 1),
1005
- n("div", Nt, [
1006
- n("div", Gt, [
999
+ n("div", Gt, [
1000
+ n("div", Nt, [
1007
1001
  n("strong", null, a(i(e)("inventory.ingredient.import.importInstructions.detailedGuide.title")), 1)
1008
1002
  ]),
1009
- t[39] || (t[39] = E(" 1. ")),
1003
+ t[39] || (t[39] = k(" 1. ")),
1010
1004
  n("span", {
1011
1005
  innerHTML: i(e)("inventory.ingredient.import.importInstructions.step1")
1012
1006
  }, null, 8, Tt),
1013
1007
  t[40] || (t[40] = n("br", null, null, -1)),
1014
- t[41] || (t[41] = E(" 2. ")),
1008
+ t[41] || (t[41] = k(" 2. ")),
1015
1009
  n("span", {
1016
1010
  innerHTML: i(e)("inventory.ingredient.import.importInstructions.step2")
1017
1011
  }, null, 8, Mt),
1018
1012
  t[42] || (t[42] = n("br", null, null, -1)),
1019
- E(" 3. " + a(i(e)("inventory.ingredient.import.importInstructions.step3")), 1),
1013
+ k(" 3. " + a(i(e)("inventory.ingredient.import.importInstructions.step3")), 1),
1020
1014
  t[43] || (t[43] = n("br", null, null, -1)),
1021
- E(" 4. " + a(i(e)("inventory.ingredient.import.importInstructions.step4")), 1),
1015
+ k(" 4. " + a(i(e)("inventory.ingredient.import.importInstructions.step4")), 1),
1022
1016
  t[44] || (t[44] = n("br", null, null, -1)),
1023
1017
  t[45] || (t[45] = n("br", null, null, -1)),
1024
- n("div", Ft, [
1018
+ n("div", $t, [
1025
1019
  n("strong", null, a(i(e)("inventory.ingredient.import.importInstructions.detailedGuide.title")), 1)
1026
1020
  ]),
1027
- n("div", $t, [
1021
+ n("div", Ft, [
1028
1022
  n("strong", null, a(i(e)("inventory.ingredient.import.importInstructions.detailedGuide.unitsSheet.title")), 1),
1029
- E(" " + a(i(e)("inventory.ingredient.import.importInstructions.detailedGuide.unitsSheet.description")), 1),
1023
+ k(" " + a(i(e)("inventory.ingredient.import.importInstructions.detailedGuide.unitsSheet.description")), 1),
1030
1024
  t[1] || (t[1] = n("br", null, null, -1)),
1031
- t[2] || (t[2] = E(" • ")),
1025
+ t[2] || (t[2] = k(" • ")),
1032
1026
  n("em", null, a(i(e)("inventory.ingredient.import.importInstructions.detailedGuide.unitsSheet.col1")), 1),
1033
1027
  t[3] || (t[3] = n("br", null, null, -1)),
1034
- t[4] || (t[4] = E(" • ")),
1028
+ t[4] || (t[4] = k(" • ")),
1035
1029
  n("em", null, a(i(e)("inventory.ingredient.import.importInstructions.detailedGuide.unitsSheet.col2")), 1),
1036
1030
  t[5] || (t[5] = n("br", null, null, -1)),
1037
- t[6] || (t[6] = E(" • ")),
1031
+ t[6] || (t[6] = k(" • ")),
1038
1032
  n("em", null, a(i(e)("inventory.ingredient.import.importInstructions.detailedGuide.unitsSheet.col3")), 1),
1039
1033
  t[7] || (t[7] = n("br", null, null, -1)),
1040
- t[8] || (t[8] = E(" • ")),
1034
+ t[8] || (t[8] = k(" • ")),
1041
1035
  n("em", null, a(i(e)("inventory.ingredient.import.importInstructions.detailedGuide.unitsSheet.col4")), 1),
1042
1036
  t[9] || (t[9] = n("br", null, null, -1)),
1043
- t[10] || (t[10] = E(" • ")),
1037
+ t[10] || (t[10] = k(" • ")),
1044
1038
  n("em", null, a(i(e)("inventory.ingredient.import.importInstructions.detailedGuide.unitsSheet.col5")), 1),
1045
1039
  t[11] || (t[11] = n("br", null, null, -1)),
1046
- t[12] || (t[12] = E(" • ")),
1040
+ t[12] || (t[12] = k(" • ")),
1047
1041
  n("em", null, a(i(e)("inventory.ingredient.import.importInstructions.detailedGuide.unitsSheet.col6")), 1)
1048
1042
  ]),
1049
- n("div", Dt, [
1043
+ n("div", At, [
1050
1044
  n("strong", null, a(i(e)("inventory.ingredient.import.importInstructions.detailedGuide.ingredientsSheet.title")), 1),
1051
- E(" " + a(i(e)("inventory.ingredient.import.importInstructions.detailedGuide.ingredientsSheet.description")), 1),
1045
+ k(" " + a(i(e)("inventory.ingredient.import.importInstructions.detailedGuide.ingredientsSheet.description")), 1),
1052
1046
  t[13] || (t[13] = n("br", null, null, -1)),
1053
- t[14] || (t[14] = E(" • ")),
1047
+ t[14] || (t[14] = k(" • ")),
1054
1048
  n("em", null, a(i(e)("inventory.ingredient.import.importInstructions.detailedGuide.ingredientsSheet.col1")), 1),
1055
1049
  t[15] || (t[15] = n("br", null, null, -1)),
1056
- t[16] || (t[16] = E(" • ")),
1050
+ t[16] || (t[16] = k(" • ")),
1057
1051
  n("em", null, a(i(e)("inventory.ingredient.import.importInstructions.detailedGuide.ingredientsSheet.col2")), 1),
1058
1052
  t[17] || (t[17] = n("br", null, null, -1)),
1059
- t[18] || (t[18] = E(" • ")),
1053
+ t[18] || (t[18] = k(" • ")),
1060
1054
  n("em", null, a(i(e)("inventory.ingredient.import.importInstructions.detailedGuide.ingredientsSheet.col3")), 1),
1061
1055
  t[19] || (t[19] = n("br", null, null, -1)),
1062
- t[20] || (t[20] = E(" • ")),
1056
+ t[20] || (t[20] = k(" • ")),
1063
1057
  n("em", null, a(i(e)("inventory.ingredient.import.importInstructions.detailedGuide.ingredientsSheet.col4")), 1),
1064
1058
  t[21] || (t[21] = n("br", null, null, -1)),
1065
- t[22] || (t[22] = E(" • ")),
1059
+ t[22] || (t[22] = k(" • ")),
1066
1060
  n("em", null, a(i(e)("inventory.ingredient.import.importInstructions.detailedGuide.ingredientsSheet.col5")), 1)
1067
1061
  ]),
1068
- n("div", At, [
1062
+ n("div", Dt, [
1069
1063
  n("strong", null, a(i(e)("inventory.ingredient.import.importInstructions.detailedGuide.recipesSheet.title")), 1),
1070
- E(" " + a(i(e)("inventory.ingredient.import.importInstructions.detailedGuide.recipesSheet.description")), 1),
1064
+ k(" " + a(i(e)("inventory.ingredient.import.importInstructions.detailedGuide.recipesSheet.description")), 1),
1071
1065
  t[23] || (t[23] = n("br", null, null, -1)),
1072
- t[24] || (t[24] = E(" • ")),
1066
+ t[24] || (t[24] = k(" • ")),
1073
1067
  n("em", null, a(i(e)("inventory.ingredient.import.importInstructions.detailedGuide.recipesSheet.col1")), 1),
1074
1068
  t[25] || (t[25] = n("br", null, null, -1)),
1075
- t[26] || (t[26] = E(" • ")),
1069
+ t[26] || (t[26] = k(" • ")),
1076
1070
  n("em", null, a(i(e)("inventory.ingredient.import.importInstructions.detailedGuide.recipesSheet.col2")), 1),
1077
1071
  t[27] || (t[27] = n("br", null, null, -1)),
1078
- t[28] || (t[28] = E(" • ")),
1072
+ t[28] || (t[28] = k(" • ")),
1079
1073
  n("em", null, a(i(e)("inventory.ingredient.import.importInstructions.detailedGuide.recipesSheet.col3")), 1),
1080
1074
  t[29] || (t[29] = n("br", null, null, -1)),
1081
- t[30] || (t[30] = E(" • ")),
1075
+ t[30] || (t[30] = k(" • ")),
1082
1076
  n("em", null, a(i(e)("inventory.ingredient.import.importInstructions.detailedGuide.recipesSheet.col4")), 1),
1083
1077
  t[31] || (t[31] = n("br", null, null, -1)),
1084
- t[32] || (t[32] = E(" • ")),
1078
+ t[32] || (t[32] = k(" • ")),
1085
1079
  n("em", null, a(i(e)("inventory.ingredient.import.importInstructions.detailedGuide.recipesSheet.col5")), 1),
1086
1080
  t[33] || (t[33] = n("br", null, null, -1)),
1087
- t[34] || (t[34] = E(" • ")),
1081
+ t[34] || (t[34] = k(" • ")),
1088
1082
  n("em", null, a(i(e)("inventory.ingredient.import.importInstructions.detailedGuide.recipesSheet.col6")), 1),
1089
1083
  t[35] || (t[35] = n("br", null, null, -1)),
1090
- t[36] || (t[36] = E(" • ")),
1084
+ t[36] || (t[36] = k(" • ")),
1091
1085
  n("em", null, a(i(e)("inventory.ingredient.import.importInstructions.detailedGuide.recipesSheet.col7")), 1),
1092
1086
  t[37] || (t[37] = n("br", null, null, -1)),
1093
- t[38] || (t[38] = E(" • ")),
1087
+ t[38] || (t[38] = k(" • ")),
1094
1088
  n("em", null, a(i(e)("inventory.ingredient.import.importInstructions.detailedGuide.recipesSheet.col8")), 1)
1095
1089
  ]),
1096
1090
  n("div", Bt, [
@@ -1100,172 +1094,172 @@ const yt = { class: "flex flex-col gap-24" }, gt = { class: "flex flex-col gap-8
1100
1094
  ])
1101
1095
  ])
1102
1096
  ])),
1103
- y.value ? (N(), P("div", Pt, [
1097
+ u.value ? (N(), D("div", Pt, [
1104
1098
  n("div", jt, [
1105
1099
  n("div", null, [
1106
1100
  n("div", Ot, a(i(e)("inventory.common.importPreview")), 1),
1107
1101
  n("div", Ht, [
1108
- A.value ? (N(), P("span", zt, a(i(e)("inventory.common.errorExist")) + ": " + a(U.value), 1)) : C.value ? (N(), P("span", Kt, a(i(e)("inventory.common.someItemsValidationErrors")), 1)) : (N(), P("span", Wt, a(i(e)("inventory.common.allItemsValidReadyImport")), 1))
1102
+ I.value ? (N(), D("span", zt, a(i(e)("inventory.common.errorExist")) + ": " + a(ee.value), 1)) : w.value ? (N(), D("span", Kt, a(i(e)("inventory.common.someItemsValidationErrors")), 1)) : (N(), D("span", Wt, a(i(e)("inventory.common.allItemsValidReadyImport")), 1))
1109
1103
  ])
1110
1104
  ]),
1111
1105
  n("div", Vt, [
1112
- B(j, {
1106
+ A(B, {
1113
1107
  variant: "secondary",
1114
- onClick: ue,
1108
+ onClick: le,
1115
1109
  label: i(e)("inventory.common.cancel")
1116
1110
  }, null, 8, ["label"]),
1117
- B(j, {
1111
+ A(B, {
1118
1112
  variant: "primary",
1119
- onClick: fe,
1113
+ onClick: be,
1120
1114
  loading: l.value,
1121
- disabled: l.value || C.value || A.value,
1115
+ disabled: l.value || w.value || I.value,
1122
1116
  label: i(e)("inventory.common.import")
1123
1117
  }, null, 8, ["loading", "disabled", "label"])
1124
1118
  ])
1125
1119
  ]),
1126
1120
  n("div", Lt, [
1127
- B(J, {
1128
- "column-defs": _e.value,
1129
- "row-data": b.value,
1130
- "page-size": r.value,
1131
- "search-value": o.value,
1121
+ A(V, {
1122
+ "column-defs": we.value,
1123
+ "row-data": G.value,
1124
+ "page-size": _.value,
1125
+ "search-value": r.value,
1132
1126
  loading: !1,
1133
1127
  "row-hover": ""
1134
1128
  }, null, 8, ["column-defs", "row-data", "page-size", "search-value"])
1135
1129
  ])
1136
- ])) : te("", !0),
1137
- d.value && p.value.length > 0 ? (N(), P("div", Jt, [
1130
+ ])) : Z("", !0),
1131
+ o.value && d.value.length > 0 ? (N(), D("div", Jt, [
1138
1132
  n("div", Xt, [
1139
1133
  n("div", null, [
1140
1134
  n("div", qt, a(i(e)("inventory.common.importErrors")), 1),
1141
- n("div", Qt, a(p.value.length) + " " + a(i(e)("inventory.common.itemsFailedImport")), 1)
1135
+ n("div", Qt, a(d.value.length) + " " + a(i(e)("inventory.common.itemsFailedImport")), 1)
1142
1136
  ]),
1143
1137
  n("div", Yt, [
1144
- B(j, {
1138
+ A(B, {
1145
1139
  variant: "secondary",
1146
- onClick: be,
1140
+ onClick: he,
1147
1141
  label: i(e)("inventory.common.close")
1148
1142
  }, null, 8, ["label"])
1149
1143
  ])
1150
1144
  ]),
1151
1145
  n("div", Zt, [
1152
- B(J, {
1153
- "column-defs": Ee.value,
1154
- "row-data": T.value,
1155
- "page-size": r.value,
1156
- "search-value": o.value,
1146
+ A(V, {
1147
+ "column-defs": Se.value,
1148
+ "row-data": ve.value,
1149
+ "page-size": _.value,
1150
+ "search-value": r.value,
1157
1151
  loading: !1,
1158
1152
  "row-hover": ""
1159
1153
  }, null, 8, ["column-defs", "row-data", "page-size", "search-value"])
1160
1154
  ])
1161
- ])) : te("", !0)
1155
+ ])) : Z("", !0)
1162
1156
  ], 2),
1163
- B(Q, {
1164
- "model-value": c.value,
1165
- "onUpdate:modelValue": t[0] || (t[0] = (F) => c.value = F),
1166
- header: `${(K = u.value) == null ? void 0 : K.type} Details`,
1157
+ A(X, {
1158
+ "model-value": p.value,
1159
+ "onUpdate:modelValue": t[0] || (t[0] = (M) => p.value = M),
1160
+ header: `${(H = v.value) == null ? void 0 : H.type} Details`,
1167
1161
  "max-width": 600,
1168
1162
  "dismiss-away": ""
1169
1163
  }, {
1170
- "side-sheet-footer": Z(() => [
1164
+ "side-sheet-footer": Q(() => [
1171
1165
  n("div", xn, [
1172
- B(j, {
1166
+ A(B, {
1173
1167
  label: i(e)("inventory.common.close"),
1174
1168
  variant: "tertiary",
1175
- onClick: he
1169
+ onClick: xe
1176
1170
  }, null, 8, ["label"])
1177
1171
  ])
1178
1172
  ]),
1179
- default: Z(() => [
1180
- u.value != null ? (N(), P("div", en, [
1181
- B(W, {
1173
+ default: Q(() => [
1174
+ v.value != null ? (N(), D("div", en, [
1175
+ A(z, {
1182
1176
  variant: "outlined",
1183
1177
  class: "p-16"
1184
1178
  }, {
1185
- default: Z(() => {
1186
- var F, z, H, V, O;
1179
+ default: Q(() => {
1180
+ var M, O, j, K, P;
1187
1181
  return [
1188
1182
  n("div", tn, a(i(e)("inventory.common.basicInformation")), 1),
1189
1183
  n("div", nn, [
1190
1184
  n("div", null, [
1191
1185
  n("div", on, a(i(e)("inventory.common.name")), 1),
1192
- n("div", rn, a(((z = (F = u.value) == null ? void 0 : F.details) == null ? void 0 : z.name) || ((H = u.value) == null ? void 0 : H.name)), 1)
1186
+ n("div", rn, a(((O = (M = v.value) == null ? void 0 : M.details) == null ? void 0 : O.name) || ((j = v.value) == null ? void 0 : j.name)), 1)
1193
1187
  ]),
1194
- (O = (V = u.value) == null ? void 0 : V.details) != null && O.code ? (N(), P("div", sn, [
1188
+ (P = (K = v.value) == null ? void 0 : K.details) != null && P.code ? (N(), D("div", sn, [
1195
1189
  n("div", an, a(i(e)("inventory.common.code")), 1),
1196
- n("div", ln, a(u.value.details.code), 1)
1197
- ])) : te("", !0),
1190
+ n("div", ln, a(v.value.details.code), 1)
1191
+ ])) : Z("", !0),
1198
1192
  n("div", null, [
1199
1193
  n("div", mn, a(i(e)("inventory.common.type")), 1),
1200
- n("div", un, a(u.value.type), 1)
1194
+ n("div", un, a(v.value.type), 1)
1201
1195
  ]),
1202
1196
  n("div", null, [
1203
1197
  n("div", dn, a(i(e)("inventory.common.operation")), 1),
1204
- n("div", cn, a(u.value.operation), 1)
1198
+ n("div", cn, a(v.value.operation), 1)
1205
1199
  ]),
1206
1200
  n("div", null, [
1207
1201
  n("div", pn, a(i(e)("inventory.common.status")), 1),
1208
1202
  n("div", {
1209
- class: ve([
1203
+ class: ce([
1210
1204
  "inline-block px-8 py-4 rounded text-sm",
1211
- u.value.status !== i(e)("inventory.common.readyToImport") ? "bg-red-100 text-red-800 border border-red-200" : "bg-green-100 text-green-800 border border-green-200"
1205
+ v.value.status !== i(e)("inventory.common.readyToImport") ? "bg-red-100 text-red-800 border border-red-200" : "bg-green-100 text-green-800 border border-green-200"
1212
1206
  ])
1213
- }, a(u.value.status), 3)
1207
+ }, a(v.value.status), 3)
1214
1208
  ])
1215
1209
  ])
1216
1210
  ];
1217
1211
  }),
1218
1212
  _: 1
1219
1213
  }),
1220
- u.value.errors && u.value.errors.length > 0 ? (N(), ae(W, {
1214
+ v.value.errors && v.value.errors.length > 0 ? (N(), se(z, {
1221
1215
  key: 0,
1222
1216
  variant: "outlined",
1223
1217
  class: "p-16"
1224
1218
  }, {
1225
- default: Z(() => [
1219
+ default: Q(() => [
1226
1220
  n("div", vn, a(i(e)("inventory.common.validationErrors")), 1),
1227
1221
  n("div", yn, [
1228
- (N(!0), P(Ae, null, Be(u.value.errors, (F, z) => (N(), P("div", {
1229
- key: z,
1222
+ (N(!0), D(Be, null, Pe(v.value.errors, (M, O) => (N(), D("div", {
1223
+ key: O,
1230
1224
  class: "flex items-start gap-8 p-12 bg-red-50 border border-red-200 rounded"
1231
1225
  }, [
1232
- B(k, {
1226
+ A(C, {
1233
1227
  name: "error",
1234
1228
  class: "text-red-600 mt-2",
1235
1229
  size: "sm"
1236
1230
  }),
1237
- n("div", gn, a(F), 1)
1231
+ n("div", gn, a(M), 1)
1238
1232
  ]))), 128))
1239
1233
  ])
1240
1234
  ]),
1241
1235
  _: 1
1242
- })) : te("", !0),
1243
- B(W, {
1236
+ })) : Z("", !0),
1237
+ A(z, {
1244
1238
  variant: "outlined",
1245
1239
  class: "p-16"
1246
1240
  }, {
1247
- default: Z(() => [
1241
+ default: Q(() => [
1248
1242
  n("div", fn, a(i(e)("inventory.common.rawData")), 1),
1249
1243
  n("div", bn, [
1250
- n("pre", hn, a(JSON.stringify(u.value.details, null, 2)), 1)
1244
+ n("pre", hn, a(JSON.stringify(v.value.details, null, 2)), 1)
1251
1245
  ])
1252
1246
  ]),
1253
1247
  _: 1
1254
1248
  })
1255
- ])) : te("", !0)
1249
+ ])) : Z("", !0)
1256
1250
  ]),
1257
1251
  _: 1
1258
1252
  }, 8, ["model-value", "header"])
1259
1253
  ];
1260
1254
  }),
1261
1255
  _: 1
1262
- }, 8, ["title", "actions"])) : i(x).isLoaded ? (N(), ae(Se, {
1256
+ }, 8, ["title", "actions"])) : i(h).isLoaded ? (N(), se(ke, {
1263
1257
  key: 2,
1264
1258
  title: i(e)("inventory.common.import")
1265
1259
  }, {
1266
- default: Z(() => [
1260
+ default: Q(() => [
1267
1261
  n("div", En, [
1268
- B(k, {
1262
+ A(C, {
1269
1263
  name: "block",
1270
1264
  class: "text-gray-400",
1271
1265
  size: "xl"
@@ -1277,13 +1271,13 @@ const yt = { class: "flex flex-col gap-24" }, gt = { class: "flex flex-col gap-8
1277
1271
  ])
1278
1272
  ]),
1279
1273
  _: 1
1280
- }, 8, ["title"])) : (N(), ae(Se, {
1274
+ }, 8, ["title"])) : (N(), se(ke, {
1281
1275
  key: 1,
1282
1276
  title: i(e)("inventory.common.import")
1283
1277
  }, {
1284
- default: Z(() => [
1278
+ default: Q(() => [
1285
1279
  n("div", _n, [
1286
- B(Y, { size: "lg" }),
1280
+ A(q, { size: "lg" }),
1287
1281
  n("div", wn, [
1288
1282
  n("div", In, a(i(e)("inventory.common.loading")), 1)
1289
1283
  ])
@@ -1295,5 +1289,5 @@ const yt = { class: "flex flex-col gap-24" }, gt = { class: "flex flex-col gap-8
1295
1289
  }
1296
1290
  });
1297
1291
  export {
1298
- Fn as default
1292
+ $n as default
1299
1293
  };