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