@feedmepos/mf-inventory-portal 1.2.18 → 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.
- package/dist/{App-C7bnTGbg.js → App-Bq3VbOg4.js} +1 -1
- package/dist/{ApprovalView-WhdGpygb.js → ApprovalView-0rdBk4Ga.js} +2 -2
- package/dist/{BindingsDialog-CHKnpitE.js → BindingsDialog-D9dfQy9F.js} +2 -2
- package/dist/{BindingsPicker-BXUv8H0c.js → BindingsPicker-C5qh7Kjp.js} +1 -1
- package/dist/{BindingsTable-4Ndm5r7H.js → BindingsTable-CMEWGAmH.js} +1 -1
- package/dist/{ClosingDraftView-C0XTMbHo.js → ClosingDraftView-D5dgVQLQ.js} +2 -2
- package/dist/{ClosingTemplateView-C17StrHT.js → ClosingTemplateView-BCrbXt1O.js} +3 -3
- package/dist/{DeliveryOrderPrintPreview-C7t3WZV1.js → DeliveryOrderPrintPreview-DzP9MsW6.js} +1 -1
- package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-DRSUXz--.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-lL_Je_aP.js} +3 -3
- package/dist/{FmMultiselectDialog-BnAHRAAM.js → FmMultiselectDialog-B39wWYKL.js} +1 -1
- package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-DbaD9qUk.js → FmUnitInput.vue_vue_type_script_setup_true_lang-DTLkc1KI.js} +1 -1
- package/dist/{ImportView-BJyqR26k.js → ImportView-DSlXRo6h.js} +554 -560
- package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-DYskeNa8.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-EUSjFuu0.js} +1 -1
- package/dist/{IngredientGroupView-CmTrE28Q.js → IngredientGroupView-N1SA4h33.js} +2 -2
- package/dist/{IngredientsView-CZSd4iI2.js → IngredientsView-CXk0pFuq.js} +122 -119
- package/dist/{IntegrationView-BcdRocma.js → IntegrationView-D0-VCjXw.js} +3 -3
- package/dist/{InventoryBindingForm-hsjpKGlq.js → InventoryBindingForm-DqQKgRFD.js} +1 -1
- package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-5yGfFt02.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-CxsiIFB7.js} +3 -3
- package/dist/{InventoryBindingSummary-AE1tIBZX.js → InventoryBindingSummary-4kCjgPon.js} +1 -1
- package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-qhWKUytO.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-CapjT1PG.js} +1 -1
- package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-BN07OE3j.js → PremiumBadge.vue_vue_type_script_setup_true_lang-BTr8giUF.js} +1 -1
- package/dist/{PublishView-CPWKoKv4.js → PublishView-cxD30ANP.js} +1 -1
- package/dist/{PurchaseOrderPrintPreview-CkiHTmgC.js → PurchaseOrderPrintPreview-C25EwRvq.js} +1 -1
- package/dist/{ReceiveRequestView-B-Q5LDit.js → ReceiveRequestView-DG79qu-Q.js} +193 -185
- package/dist/{RecipeView-DEd2uP8R.js → RecipeView-Dd3Gzx_7.js} +3 -3
- package/dist/{StockView-DGL_EghN.js → StockView-DUPQoRbk.js} +283 -283
- package/dist/{SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-D6-lImIW.js → SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-yBT7sh32.js} +1 -1
- package/dist/{SupplierView-uY0HvMr-.js → SupplierView-CftbqjSM.js} +4 -4
- package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-C0LNY9CK.js → TransferDetails.vue_vue_type_script_setup_true_lang-CsG99iyc.js} +5 -5
- package/dist/{TransferTemplateView-DjI7px12.js → TransferTemplateView-Bg3WZG4x.js} +7 -7
- package/dist/{UnitView-CANjtjhH.js → UnitView-DDOjic5i.js} +3 -3
- package/dist/{WarehouseView-BzGxfJI-.js → WarehouseView-xXj5gNkv.js} +1 -1
- package/dist/{app-ZxL49u29.js → app-C5xhmSdT.js} +14815 -14762
- package/dist/app.js +1 -1
- package/dist/{closing-template-BA7jw5Ib.js → closing-template-CTnmZmwR.js} +1 -1
- package/dist/{decimal-YUVJ1ppE.js → decimal-ByvJmvuR.js} +1 -1
- package/dist/{format-unit-display-B8-ONx5f.js → format-unit-display-Y9dmvD9H.js} +3 -3
- package/dist/{import-export.helper-B0RkcNAy.js → import-export.helper-BNdJmogm.js} +1 -1
- package/dist/{index-BOLpjtRD.js → index-B-8jCooy.js} +1 -1
- package/dist/{index-By0SWtFG.js → index-BN9dlUFp.js} +2 -2
- package/dist/{purchase-order-template-CppyMHCz.js → purchase-order-template-B8d4uElQ.js} +1 -1
- package/dist/{stock-8M_JUjPp.js → stock-nuJyCyEZ.js} +1 -1
- package/dist/style.css +1 -1
- package/dist/{supplier-BkEYL5KY.js → supplier-1Y0Es3Q1.js} +1 -1
- package/dist/{use-ingredient-select-dialog-BNr7wDV-.js → use-ingredient-select-dialog-D4xzg9Cj.js} +1 -1
- package/dist/{use-inventory-binding-dialog-C3r06vdY.js → use-inventory-binding-dialog-BCEJrcXb.js} +1 -1
- package/dist/views/receive-request/components/transfer-form/TransferForm.vue.d.ts +2 -2
- package/dist/views/receive-request/composables/use-receive-request-form.d.ts +3 -3
- package/dist/views/receive-request/composables/use-receive-request-table.d.ts +3 -3
- package/package.json +1 -1
|
@@ -1,104 +1,104 @@
|
|
|
1
|
-
import { defineComponent as De, ref as
|
|
2
|
-
import { a as
|
|
3
|
-
import { useCoreStore as
|
|
4
|
-
import { useDialogChild as Qe, useSnackbar as
|
|
5
|
-
import { s as et, g as tt, b as nt, d as
|
|
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
|
|
7
|
+
function Ee() {
|
|
8
8
|
return `measurement_${(/* @__PURE__ */ new Date()).toISOString()}_${ot()}`;
|
|
9
9
|
}
|
|
10
|
-
function rt(
|
|
10
|
+
function rt(U) {
|
|
11
11
|
const [
|
|
12
12
|
e,
|
|
13
|
-
|
|
13
|
+
R,
|
|
14
|
+
g,
|
|
14
15
|
h,
|
|
16
|
+
E,
|
|
15
17
|
x,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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((
|
|
23
|
-
if (
|
|
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 (${
|
|
25
|
+
`Missing meta headers (${u.join()}). Excel file does not come from the template.`
|
|
26
26
|
);
|
|
27
|
-
return
|
|
28
|
-
const
|
|
29
|
-
for (const
|
|
30
|
-
const
|
|
31
|
-
Object.assign(
|
|
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:
|
|
35
|
-
data:
|
|
34
|
+
index: b,
|
|
35
|
+
data: f
|
|
36
36
|
};
|
|
37
37
|
});
|
|
38
38
|
}
|
|
39
|
-
function st(
|
|
39
|
+
function st(U) {
|
|
40
40
|
try {
|
|
41
|
-
const e = rt(
|
|
42
|
-
const { name: l, symbol: s, precision:
|
|
43
|
-
return l || s ||
|
|
44
|
-
}),
|
|
45
|
-
let
|
|
46
|
-
for (const
|
|
47
|
-
if (
|
|
48
|
-
|
|
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:
|
|
51
|
-
abbrev:
|
|
52
|
-
precision: Math.max(0, Math.min(10, Math.floor(
|
|
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:
|
|
56
|
-
},
|
|
57
|
-
id:
|
|
58
|
-
name:
|
|
59
|
-
abbrev:
|
|
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(
|
|
62
|
-
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(
|
|
67
|
-
l &&
|
|
68
|
-
id:
|
|
69
|
-
name:
|
|
70
|
-
abbrev:
|
|
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(
|
|
73
|
-
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 [
|
|
78
|
-
const
|
|
79
|
-
var
|
|
80
|
-
return
|
|
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
|
-
|
|
82
|
+
u ? E.push({
|
|
83
83
|
type: "update",
|
|
84
|
-
original:
|
|
84
|
+
original: u,
|
|
85
85
|
unit: {
|
|
86
|
-
...
|
|
87
|
-
name: l.name ||
|
|
88
|
-
abbrev: l.abbrev ||
|
|
89
|
-
precision: l.precision !== void 0 ? l.precision :
|
|
90
|
-
measurements: l.measurements.map((
|
|
91
|
-
const
|
|
92
|
-
return
|
|
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
|
-
}) :
|
|
97
|
+
}) : h.push({
|
|
98
98
|
type: "create",
|
|
99
99
|
unit: {
|
|
100
100
|
...l,
|
|
101
|
-
measurements: l.measurements.map((
|
|
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:
|
|
110
|
-
importUpdateResult:
|
|
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(
|
|
122
|
-
var
|
|
121
|
+
function it(U, { ignoreErrors: e = !1 } = {}) {
|
|
122
|
+
var R;
|
|
123
123
|
try {
|
|
124
|
-
const
|
|
125
|
-
let
|
|
126
|
-
for (const
|
|
127
|
-
const
|
|
128
|
-
let
|
|
129
|
-
if (
|
|
130
|
-
const
|
|
131
|
-
|
|
132
|
-
} else if (
|
|
133
|
-
const
|
|
134
|
-
|
|
135
|
-
} else if (
|
|
136
|
-
const
|
|
137
|
-
|
|
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
|
-
|
|
140
|
-
|
|
141
|
-
let
|
|
142
|
-
if ((
|
|
143
|
-
var
|
|
144
|
-
return
|
|
145
|
-
}),
|
|
146
|
-
let
|
|
147
|
-
if (
|
|
148
|
-
|
|
149
|
-
name:
|
|
150
|
-
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:
|
|
153
|
-
id:
|
|
154
|
-
amount:
|
|
155
|
-
|
|
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
|
-
},
|
|
157
|
+
}, s[o.data.recipeName] = y.length > 0 ? `Row ${o.index + 6}: ${y.join(", ")}` : [];
|
|
161
158
|
else {
|
|
162
|
-
const
|
|
163
|
-
|
|
164
|
-
...
|
|
159
|
+
const I = Object.keys(u)[Object.keys(u).length - 1];
|
|
160
|
+
I && u[I] && (u[I] = {
|
|
161
|
+
...u[I],
|
|
165
162
|
contains: [
|
|
166
|
-
...
|
|
163
|
+
...u[I].contains,
|
|
167
164
|
{
|
|
168
|
-
type:
|
|
169
|
-
id:
|
|
170
|
-
amount:
|
|
171
|
-
|
|
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
|
-
},
|
|
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
|
|
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:
|
|
177
|
+
recipe: o,
|
|
184
178
|
// Type assertion - _id will be assigned by backend
|
|
185
|
-
errors:
|
|
186
|
-
excelRowNumber:
|
|
179
|
+
errors: s[o.name],
|
|
180
|
+
excelRowNumber: y + 6
|
|
187
181
|
// Assuming header rows
|
|
188
|
-
})),
|
|
189
|
-
const
|
|
182
|
+
})), d = b.map((o, y) => {
|
|
183
|
+
const _ = E[o.name];
|
|
190
184
|
return {
|
|
191
185
|
type: "update",
|
|
192
|
-
original:
|
|
186
|
+
original: _,
|
|
193
187
|
recipe: {
|
|
194
|
-
...
|
|
195
|
-
name:
|
|
196
|
-
contains:
|
|
197
|
-
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:
|
|
200
|
-
excelRowNumber:
|
|
193
|
+
errors: s[o.name],
|
|
194
|
+
excelRowNumber: y + 6
|
|
201
195
|
};
|
|
202
196
|
});
|
|
203
197
|
return {
|
|
204
|
-
invalidExcel:
|
|
205
|
-
invalidExcelMessage:
|
|
206
|
-
importCreateResult:
|
|
207
|
-
importUpdateResult:
|
|
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 (
|
|
203
|
+
} catch (g) {
|
|
210
204
|
return {
|
|
211
205
|
invalidExcel: !0,
|
|
212
|
-
invalidExcelMessage:
|
|
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(
|
|
212
|
+
function at(U) {
|
|
219
213
|
const [
|
|
220
214
|
e,
|
|
221
|
-
|
|
215
|
+
R,
|
|
216
|
+
g,
|
|
222
217
|
h,
|
|
218
|
+
E,
|
|
223
219
|
x,
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
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((
|
|
231
|
-
if (
|
|
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 (${
|
|
227
|
+
`Missing meta headers (${u.join()}). Excel file does not come from the template.`
|
|
234
228
|
);
|
|
235
|
-
return
|
|
236
|
-
const
|
|
237
|
-
for (const
|
|
238
|
-
const
|
|
239
|
-
Object.assign(
|
|
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:
|
|
243
|
-
data:
|
|
236
|
+
index: b,
|
|
237
|
+
data: f
|
|
244
238
|
};
|
|
245
|
-
}).filter((
|
|
246
|
-
const { recipeName:
|
|
247
|
-
return
|
|
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 =
|
|
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
|
|
260
|
-
|
|
261
|
-
if (
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
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
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
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 <
|
|
280
|
-
|
|
273
|
+
for (let l = 1; l < r.measurements.length; l++)
|
|
274
|
+
h.push([
|
|
281
275
|
"",
|
|
282
276
|
"",
|
|
283
277
|
"",
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
278
|
+
r.measurements[l].name,
|
|
279
|
+
r.measurements[l].abbrev,
|
|
280
|
+
+pe(r.measurements[l].conversion)
|
|
287
281
|
]);
|
|
288
282
|
}
|
|
289
|
-
}) :
|
|
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
|
|
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
|
-
|
|
303
|
-
...
|
|
304
|
-
],
|
|
305
|
-
return
|
|
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 =
|
|
309
|
-
let
|
|
310
|
-
|
|
311
|
-
var l, s,
|
|
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
|
-
|
|
314
|
-
|
|
315
|
-
((l =
|
|
316
|
-
((s =
|
|
317
|
-
((
|
|
318
|
-
|
|
319
|
-
(
|
|
320
|
-
((
|
|
321
|
-
((
|
|
322
|
-
|
|
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
|
-
}) :
|
|
318
|
+
}) : h = [
|
|
325
319
|
["EXAMPLE_CODE", "Example Ingredient", "kg", "kg", "Unit Name", "WAVG", 10.5, 5, 10, ""]
|
|
326
320
|
];
|
|
327
|
-
const
|
|
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
|
-
|
|
333
|
-
...
|
|
334
|
-
],
|
|
335
|
-
return
|
|
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 =
|
|
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
|
|
350
|
-
if (
|
|
351
|
-
const
|
|
352
|
-
|
|
353
|
-
var
|
|
354
|
-
const
|
|
355
|
-
if ((
|
|
356
|
-
const
|
|
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
|
-
...
|
|
359
|
-
var
|
|
352
|
+
...b.map((o, y) => {
|
|
353
|
+
var _;
|
|
360
354
|
return [
|
|
361
|
-
|
|
355
|
+
y === 0 ? u.name : "",
|
|
362
356
|
"RECIPE",
|
|
363
357
|
"",
|
|
364
|
-
((
|
|
365
|
-
|
|
358
|
+
((_ = r[o.id]) == null ? void 0 : _.name) || "",
|
|
359
|
+
o.amount.amount,
|
|
366
360
|
"",
|
|
367
361
|
"unit",
|
|
368
362
|
"Unit",
|
|
369
|
-
|
|
363
|
+
y === 0 ? v : ""
|
|
370
364
|
];
|
|
371
365
|
}),
|
|
372
|
-
...
|
|
373
|
-
var
|
|
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
|
-
!
|
|
369
|
+
!b.length && y === 0 ? u.name : "",
|
|
376
370
|
"INGREDIENT",
|
|
377
|
-
((
|
|
378
|
-
((
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
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
|
|
385
|
-
})) == null ? void 0 :
|
|
386
|
-
!
|
|
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
|
-
...
|
|
390
|
-
var
|
|
383
|
+
...d.map((o, y) => {
|
|
384
|
+
var _, G;
|
|
391
385
|
return [
|
|
392
|
-
|
|
386
|
+
b.length === 0 && f.length === 0 && y === 0 ? u.name : "",
|
|
393
387
|
"SKU_GROUP",
|
|
394
|
-
((
|
|
395
|
-
((
|
|
396
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
419
|
-
...
|
|
420
|
-
],
|
|
421
|
-
return
|
|
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
|
|
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
|
|
423
|
+
return Ve(U, e), e;
|
|
430
424
|
}
|
|
431
|
-
async function ct(
|
|
432
|
-
if (!
|
|
425
|
+
async function ct(U) {
|
|
426
|
+
if (!U) return null;
|
|
433
427
|
try {
|
|
434
|
-
return st(
|
|
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(
|
|
440
|
-
if (!
|
|
433
|
+
async function pt(U) {
|
|
434
|
+
if (!U) return null;
|
|
441
435
|
try {
|
|
442
|
-
return tt(
|
|
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(
|
|
448
|
-
if (!
|
|
441
|
+
async function vt(U) {
|
|
442
|
+
if (!U) return null;
|
|
449
443
|
try {
|
|
450
|
-
const e = at(
|
|
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(
|
|
468
|
-
const e =
|
|
469
|
-
|
|
470
|
-
const
|
|
471
|
-
async function
|
|
472
|
-
|
|
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
|
-
|
|
475
|
-
const [
|
|
476
|
-
Je(
|
|
468
|
+
g.value = !0;
|
|
469
|
+
const [d] = await Promise.all([
|
|
470
|
+
Je(f),
|
|
477
471
|
// fake buffer for UX
|
|
478
|
-
new Promise((
|
|
472
|
+
new Promise((o) => setTimeout(o, 1e3))
|
|
479
473
|
]);
|
|
480
|
-
|
|
481
|
-
} catch (
|
|
482
|
-
console.error("Error parsing Excel file:",
|
|
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
|
-
|
|
478
|
+
g.value = !1;
|
|
485
479
|
}
|
|
486
480
|
}
|
|
487
|
-
function
|
|
488
|
-
if (
|
|
489
|
-
const
|
|
490
|
-
if (
|
|
491
|
-
|
|
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
|
-
|
|
488
|
+
x.value = d, R.emitData({ availableSheets: d, workbook: E.value });
|
|
495
489
|
}
|
|
496
|
-
|
|
497
|
-
|
|
490
|
+
ze(e, (f) => {
|
|
491
|
+
f && v(f);
|
|
498
492
|
});
|
|
499
|
-
function
|
|
500
|
-
if (!
|
|
501
|
-
const
|
|
502
|
-
return
|
|
503
|
-
switch (
|
|
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
|
-
|
|
499
|
+
f.push("Units sheet found");
|
|
506
500
|
break;
|
|
507
501
|
case "ingredient":
|
|
508
|
-
|
|
502
|
+
f.push("Ingredients sheet found");
|
|
509
503
|
break;
|
|
510
504
|
case "recipe":
|
|
511
|
-
|
|
505
|
+
f.push("Recipes sheet found");
|
|
512
506
|
break;
|
|
513
507
|
}
|
|
514
|
-
}),
|
|
508
|
+
}), f.length > 0 ? `Ready to process: ${f.join(", ")}. Processing will follow dependency order.` : "No valid sheets found";
|
|
515
509
|
}
|
|
516
|
-
return (
|
|
517
|
-
const
|
|
518
|
-
return N(),
|
|
519
|
-
|
|
520
|
-
class:
|
|
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:
|
|
526
|
-
label: i(
|
|
527
|
-
"button-label": i(
|
|
528
|
-
},
|
|
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:
|
|
525
|
+
fn: Q(({ openFileDialog: G }) => [
|
|
532
526
|
n("div", gt, [
|
|
533
527
|
n("div", {
|
|
534
|
-
class:
|
|
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":
|
|
538
|
-
"border border-fm-color-neutral-gray-200": !
|
|
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
|
-
|
|
537
|
+
g.value ? (N(), se(o, {
|
|
544
538
|
key: 0,
|
|
545
539
|
size: "md",
|
|
546
540
|
color: "neutral-gray-200"
|
|
547
|
-
})) : (N(),
|
|
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:
|
|
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(
|
|
557
|
+
}, a(l.value ? i(u)("inventory.ingredient.import.error.invalidContent") : "File valid"), 3)
|
|
564
558
|
]),
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
label: i(
|
|
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:
|
|
564
|
+
onClick: G
|
|
571
565
|
}, null, 8, ["label", "variant", "prepend-icon", "onClick"])
|
|
572
566
|
]))
|
|
573
567
|
], 2),
|
|
574
|
-
|
|
575
|
-
(N(!0),
|
|
576
|
-
key:
|
|
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
|
-
|
|
573
|
+
A(y, {
|
|
580
574
|
name: "error",
|
|
581
575
|
size: "sm",
|
|
582
576
|
color: "system-error-300"
|
|
583
577
|
}),
|
|
584
|
-
n("div", _t, a(
|
|
578
|
+
n("div", _t, a(w), 1)
|
|
585
579
|
]))), 128))
|
|
586
|
-
])) :
|
|
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(),
|
|
593
|
-
n("div", It, a(i(
|
|
594
|
-
n("div", Et, a(
|
|
595
|
-
])) :
|
|
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" },
|
|
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" },
|
|
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(
|
|
623
|
-
const { t: e } =
|
|
616
|
+
setup(U) {
|
|
617
|
+
const { t: e } = Oe(), R = Ye(), g = He();
|
|
624
618
|
Xe();
|
|
625
|
-
const
|
|
626
|
-
|
|
627
|
-
const l =
|
|
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:
|
|
631
|
-
var
|
|
632
|
-
return ((
|
|
633
|
-
},
|
|
634
|
-
if (
|
|
635
|
-
for (const
|
|
636
|
-
const
|
|
637
|
-
if (
|
|
638
|
-
for (const
|
|
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:
|
|
641
|
-
type:
|
|
642
|
-
operation: e(
|
|
643
|
-
status:
|
|
644
|
-
errors:
|
|
645
|
-
details:
|
|
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
|
|
650
|
-
}),
|
|
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
|
-
)),
|
|
646
|
+
)), I = J(() => G.value.some(
|
|
653
647
|
(m) => m.status && m.status.includes("Invalid Excel")
|
|
654
|
-
)),
|
|
655
|
-
const m =
|
|
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
|
-
}),
|
|
660
|
-
var
|
|
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: ((
|
|
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: ((
|
|
659
|
+
message: ((B = m.error) == null ? void 0 : B.message) || JSON.stringify(m.error)
|
|
666
660
|
};
|
|
667
661
|
}));
|
|
668
|
-
function
|
|
662
|
+
function ye(m) {
|
|
669
663
|
switch (m) {
|
|
670
664
|
case "import":
|
|
671
|
-
return
|
|
665
|
+
return ge();
|
|
672
666
|
}
|
|
673
667
|
}
|
|
674
|
-
function
|
|
675
|
-
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
713
|
-
|
|
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
|
|
716
|
-
var t,
|
|
717
|
-
if (!
|
|
718
|
-
|
|
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 =
|
|
715
|
+
const m = b.value[0];
|
|
722
716
|
try {
|
|
723
717
|
switch (m) {
|
|
724
718
|
case "unit": {
|
|
725
|
-
const
|
|
726
|
-
|
|
719
|
+
const L = f.value.Sheets.unit, S = await ct(L);
|
|
720
|
+
S && (s.value = {
|
|
727
721
|
...s.value,
|
|
728
|
-
_invalidExcel:
|
|
729
|
-
_invalidExcelMessage:
|
|
730
|
-
units:
|
|
731
|
-
create: ((
|
|
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: ((
|
|
729
|
+
update: ((V = S.importUpdateResult) == null ? void 0 : V.map(($) => ({
|
|
736
730
|
...$.unit,
|
|
737
731
|
errors: $.errors
|
|
738
732
|
}))) || []
|
|
739
|
-
} : (
|
|
733
|
+
} : (z = s.value) == null ? void 0 : z.units
|
|
740
734
|
});
|
|
741
735
|
break;
|
|
742
736
|
}
|
|
743
737
|
case "ingredient": {
|
|
744
|
-
const
|
|
745
|
-
|
|
738
|
+
const L = f.value.Sheets.ingredient, S = await pt(L);
|
|
739
|
+
S && (s.value = {
|
|
746
740
|
...s.value,
|
|
747
|
-
_invalidExcel:
|
|
748
|
-
_invalidExcelMessage:
|
|
749
|
-
skus:
|
|
750
|
-
create: ((
|
|
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: ((
|
|
748
|
+
update: ((M = S.importUpdateResult) == null ? void 0 : M.map(($) => ({
|
|
755
749
|
...$.sku,
|
|
756
750
|
errors: $.errors
|
|
757
751
|
}))) || []
|
|
758
|
-
} : (
|
|
752
|
+
} : (O = s.value) == null ? void 0 : O.skus
|
|
759
753
|
});
|
|
760
754
|
break;
|
|
761
755
|
}
|
|
762
756
|
case "recipe": {
|
|
763
|
-
const
|
|
764
|
-
|
|
757
|
+
const L = f.value.Sheets.recipe, S = await vt(L);
|
|
758
|
+
S && (s.value = {
|
|
765
759
|
...s.value,
|
|
766
|
-
_invalidExcel:
|
|
767
|
-
_invalidExcelMessage:
|
|
768
|
-
recipes:
|
|
769
|
-
create: ((
|
|
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: ((
|
|
767
|
+
update: ((me = S.importUpdateResult) == null ? void 0 : me.map(($) => ({
|
|
774
768
|
...$.recipe,
|
|
775
769
|
errors: $.errors
|
|
776
770
|
}))) || []
|
|
777
|
-
} : (
|
|
771
|
+
} : (ue = s.value) == null ? void 0 : ue.recipes
|
|
778
772
|
});
|
|
779
773
|
break;
|
|
780
774
|
}
|
|
781
775
|
}
|
|
782
|
-
|
|
783
|
-
} catch (
|
|
784
|
-
console.error(`Error processing ${m} sheet:`,
|
|
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
|
|
792
|
-
var m, t,
|
|
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 (
|
|
795
|
-
|
|
788
|
+
if (I.value) {
|
|
789
|
+
g.open({
|
|
796
790
|
title: e("inventory.common.invalidExcelFormatTitle"),
|
|
797
|
-
message:
|
|
791
|
+
message: ee.value,
|
|
798
792
|
type: "error"
|
|
799
793
|
});
|
|
800
794
|
return;
|
|
801
795
|
}
|
|
802
|
-
if (
|
|
803
|
-
|
|
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
|
|
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
|
|
815
|
-
create: ((
|
|
816
|
-
update: ((
|
|
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 (
|
|
819
|
-
const
|
|
820
|
-
((
|
|
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:
|
|
816
|
+
error: re
|
|
823
817
|
})));
|
|
824
|
-
const
|
|
825
|
-
|
|
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 && ((
|
|
831
|
-
const
|
|
832
|
-
create: ((
|
|
833
|
-
update: ((
|
|
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 (
|
|
836
|
-
const
|
|
837
|
-
((
|
|
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:
|
|
833
|
+
error: re
|
|
840
834
|
})));
|
|
841
|
-
const
|
|
842
|
-
|
|
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 && ((
|
|
848
|
-
const
|
|
849
|
-
create: ((
|
|
850
|
-
update: ((
|
|
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 (
|
|
853
|
-
const
|
|
854
|
-
((
|
|
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:
|
|
850
|
+
error: re
|
|
857
851
|
})));
|
|
858
|
-
const
|
|
859
|
-
|
|
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 (
|
|
866
|
-
const
|
|
867
|
-
|
|
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", [
|
|
863
|
+
message: e("inventory.common.successfullyImported", [W, oe, T.length, oe]),
|
|
870
864
|
type: "warning"
|
|
871
|
-
}) :
|
|
865
|
+
}) : g.open({
|
|
872
866
|
title: e("inventory.ingredient.import.success"),
|
|
873
|
-
message: e("inventory.common.successfullyImported", [
|
|
867
|
+
message: e("inventory.common.successfullyImported", [W, oe, "0", ""]),
|
|
874
868
|
type: "success"
|
|
875
869
|
});
|
|
876
870
|
}
|
|
877
|
-
if (
|
|
878
|
-
await
|
|
879
|
-
else if (!(s.value.units && ((($ = s.value.units.create) == null ? void 0 : $.length) || ((
|
|
880
|
-
if (
|
|
881
|
-
const
|
|
882
|
-
|
|
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", [
|
|
878
|
+
message: e("inventory.common.importFinishedWithFailedItems", [re, c, te, ne]),
|
|
885
879
|
type: "warning"
|
|
886
|
-
}), console.error("Import errors:",
|
|
880
|
+
}), console.error("Import errors:", d.value);
|
|
887
881
|
} else
|
|
888
|
-
|
|
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 (
|
|
894
|
-
|
|
887
|
+
} catch (W) {
|
|
888
|
+
g.open({
|
|
895
889
|
title: e("inventory.ingredient.import.error.failed"),
|
|
896
|
-
message: (
|
|
890
|
+
message: (W == null ? void 0 : W.message) || e("inventory.common.unknownErrorOccurred"),
|
|
897
891
|
type: "error"
|
|
898
|
-
}), console.error("Error during import:",
|
|
892
|
+
}), console.error("Error during import:", W);
|
|
899
893
|
} finally {
|
|
900
894
|
l.value = !1;
|
|
901
895
|
}
|
|
902
896
|
}
|
|
903
897
|
}
|
|
904
|
-
function
|
|
905
|
-
|
|
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
|
-
|
|
902
|
+
o.value = !1, d.value = [];
|
|
903
|
+
}
|
|
904
|
+
function xe() {
|
|
905
|
+
p.value = !1, v.value = null;
|
|
912
906
|
}
|
|
913
|
-
const
|
|
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
|
-
]),
|
|
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
|
|
947
|
-
return t === e("inventory.common.readyToImport") ?
|
|
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
|
-
]),
|
|
944
|
+
]), Se = $e([
|
|
951
945
|
{
|
|
952
946
|
id: "name",
|
|
953
947
|
accessorKey: "name",
|
|
954
948
|
header: () => e("inventory.common.name"),
|
|
955
|
-
cell: (m) =>
|
|
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,
|
|
963
|
-
return
|
|
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) =>
|
|
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
|
|
979
|
-
return i(
|
|
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:
|
|
983
|
-
"onClick:action":
|
|
976
|
+
actions: _e.value,
|
|
977
|
+
"onClick:action": ye
|
|
984
978
|
}, {
|
|
985
|
-
default:
|
|
986
|
-
var
|
|
979
|
+
default: Q(() => {
|
|
980
|
+
var H;
|
|
987
981
|
return [
|
|
988
982
|
n("div", {
|
|
989
|
-
class:
|
|
983
|
+
class: ce([
|
|
990
984
|
"flex flex-col gap-8 max-h-full",
|
|
991
985
|
{
|
|
992
|
-
"p-0":
|
|
993
|
-
"px-24": !
|
|
986
|
+
"p-0": y.value,
|
|
987
|
+
"px-24": !y.value
|
|
994
988
|
}
|
|
995
989
|
])
|
|
996
990
|
}, [
|
|
997
|
-
|
|
991
|
+
u.value ? Z("", !0) : (N(), D("div", kt, [
|
|
998
992
|
n("div", Rt, [
|
|
999
|
-
|
|
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",
|
|
1006
|
-
n("div",
|
|
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] =
|
|
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] =
|
|
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
|
-
|
|
1013
|
+
k(" 3. " + a(i(e)("inventory.ingredient.import.importInstructions.step3")), 1),
|
|
1020
1014
|
t[43] || (t[43] = n("br", null, null, -1)),
|
|
1021
|
-
|
|
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",
|
|
1018
|
+
n("div", $t, [
|
|
1025
1019
|
n("strong", null, a(i(e)("inventory.ingredient.import.importInstructions.detailedGuide.title")), 1)
|
|
1026
1020
|
]),
|
|
1027
|
-
n("div",
|
|
1021
|
+
n("div", Ft, [
|
|
1028
1022
|
n("strong", null, a(i(e)("inventory.ingredient.import.importInstructions.detailedGuide.unitsSheet.title")), 1),
|
|
1029
|
-
|
|
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] =
|
|
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] =
|
|
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] =
|
|
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] =
|
|
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] =
|
|
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] =
|
|
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",
|
|
1043
|
+
n("div", At, [
|
|
1050
1044
|
n("strong", null, a(i(e)("inventory.ingredient.import.importInstructions.detailedGuide.ingredientsSheet.title")), 1),
|
|
1051
|
-
|
|
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] =
|
|
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] =
|
|
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] =
|
|
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] =
|
|
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] =
|
|
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",
|
|
1062
|
+
n("div", Dt, [
|
|
1069
1063
|
n("strong", null, a(i(e)("inventory.ingredient.import.importInstructions.detailedGuide.recipesSheet.title")), 1),
|
|
1070
|
-
|
|
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] =
|
|
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] =
|
|
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] =
|
|
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] =
|
|
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] =
|
|
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] =
|
|
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] =
|
|
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] =
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
1106
|
+
A(B, {
|
|
1113
1107
|
variant: "secondary",
|
|
1114
|
-
onClick:
|
|
1108
|
+
onClick: le,
|
|
1115
1109
|
label: i(e)("inventory.common.cancel")
|
|
1116
1110
|
}, null, 8, ["label"]),
|
|
1117
|
-
B
|
|
1111
|
+
A(B, {
|
|
1118
1112
|
variant: "primary",
|
|
1119
|
-
onClick:
|
|
1113
|
+
onClick: be,
|
|
1120
1114
|
loading: l.value,
|
|
1121
|
-
disabled: l.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
|
-
|
|
1128
|
-
"column-defs":
|
|
1129
|
-
"row-data":
|
|
1130
|
-
"page-size":
|
|
1131
|
-
"search-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
|
-
])) :
|
|
1137
|
-
|
|
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(
|
|
1135
|
+
n("div", Qt, a(d.value.length) + " " + a(i(e)("inventory.common.itemsFailedImport")), 1)
|
|
1142
1136
|
]),
|
|
1143
1137
|
n("div", Yt, [
|
|
1144
|
-
B
|
|
1138
|
+
A(B, {
|
|
1145
1139
|
variant: "secondary",
|
|
1146
|
-
onClick:
|
|
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
|
-
|
|
1153
|
-
"column-defs":
|
|
1154
|
-
"row-data":
|
|
1155
|
-
"page-size":
|
|
1156
|
-
"search-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
|
-
])) :
|
|
1155
|
+
])) : Z("", !0)
|
|
1162
1156
|
], 2),
|
|
1163
|
-
|
|
1164
|
-
"model-value":
|
|
1165
|
-
"onUpdate:modelValue": t[0] || (t[0] = (
|
|
1166
|
-
header: `${(
|
|
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":
|
|
1164
|
+
"side-sheet-footer": Q(() => [
|
|
1171
1165
|
n("div", xn, [
|
|
1172
|
-
B
|
|
1166
|
+
A(B, {
|
|
1173
1167
|
label: i(e)("inventory.common.close"),
|
|
1174
1168
|
variant: "tertiary",
|
|
1175
|
-
onClick:
|
|
1169
|
+
onClick: xe
|
|
1176
1170
|
}, null, 8, ["label"])
|
|
1177
1171
|
])
|
|
1178
1172
|
]),
|
|
1179
|
-
default:
|
|
1180
|
-
|
|
1181
|
-
|
|
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:
|
|
1186
|
-
var
|
|
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(((
|
|
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
|
-
(
|
|
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(
|
|
1197
|
-
])) :
|
|
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(
|
|
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(
|
|
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:
|
|
1203
|
+
class: ce([
|
|
1210
1204
|
"inline-block px-8 py-4 rounded text-sm",
|
|
1211
|
-
|
|
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(
|
|
1207
|
+
}, a(v.value.status), 3)
|
|
1214
1208
|
])
|
|
1215
1209
|
])
|
|
1216
1210
|
];
|
|
1217
1211
|
}),
|
|
1218
1212
|
_: 1
|
|
1219
1213
|
}),
|
|
1220
|
-
|
|
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:
|
|
1219
|
+
default: Q(() => [
|
|
1226
1220
|
n("div", vn, a(i(e)("inventory.common.validationErrors")), 1),
|
|
1227
1221
|
n("div", yn, [
|
|
1228
|
-
(N(!0),
|
|
1229
|
-
key:
|
|
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
|
-
|
|
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(
|
|
1231
|
+
n("div", gn, a(M), 1)
|
|
1238
1232
|
]))), 128))
|
|
1239
1233
|
])
|
|
1240
1234
|
]),
|
|
1241
1235
|
_: 1
|
|
1242
|
-
})) :
|
|
1243
|
-
|
|
1236
|
+
})) : Z("", !0),
|
|
1237
|
+
A(z, {
|
|
1244
1238
|
variant: "outlined",
|
|
1245
1239
|
class: "p-16"
|
|
1246
1240
|
}, {
|
|
1247
|
-
default:
|
|
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(
|
|
1244
|
+
n("pre", hn, a(JSON.stringify(v.value.details, null, 2)), 1)
|
|
1251
1245
|
])
|
|
1252
1246
|
]),
|
|
1253
1247
|
_: 1
|
|
1254
1248
|
})
|
|
1255
|
-
])) :
|
|
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(
|
|
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:
|
|
1260
|
+
default: Q(() => [
|
|
1267
1261
|
n("div", En, [
|
|
1268
|
-
|
|
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(),
|
|
1274
|
+
}, 8, ["title"])) : (N(), se(ke, {
|
|
1281
1275
|
key: 1,
|
|
1282
1276
|
title: i(e)("inventory.common.import")
|
|
1283
1277
|
}, {
|
|
1284
|
-
default:
|
|
1278
|
+
default: Q(() => [
|
|
1285
1279
|
n("div", _n, [
|
|
1286
|
-
|
|
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
|
-
|
|
1292
|
+
$n as default
|
|
1299
1293
|
};
|