@feedmepos/mf-inventory-portal 0.0.17-dev.2 → 0.0.17-dev.3
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-DuDqkTeC.js → ApprovalView-Cro8o8Th.js} +6 -6
- package/dist/{BindingsDialog-0Q6o47Up.js → BindingsDialog-C_6Sc7QV.js} +2 -2
- package/dist/{BindingsPicker-k4drpC9m.js → BindingsPicker-97PCPC7b.js} +2 -2
- package/dist/{BindingsTable-B5hZHvuD.js → BindingsTable-Hneu1zEK.js} +3 -3
- package/dist/{ChangeLocationComponent.vue_vue_type_script_setup_true_lang-CoiUbqV-.js → ChangeLocationComponent.vue_vue_type_script_setup_true_lang-euQmNhYq.js} +1 -1
- package/dist/{FmMultiselectDialog.vue_vue_type_script_setup_true_lang-C1TGiM-x.js → FmMultiselectDialog.vue_vue_type_script_setup_true_lang-B1dIpiBE.js} +2 -2
- package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-DsjnPaTj.js → FmUnitInput.vue_vue_type_script_setup_true_lang-RrTqtrzn.js} +3 -3
- package/dist/{IngredientsView-D3uTxXqO.js → IngredientsView-Chl_Nwza.js} +341 -345
- package/dist/{IntegrationView-B1iYpADR.js → IntegrationView-B1FJBf5V.js} +3 -3
- package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-GinKxaoG.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-B1O2tP3s.js} +6 -6
- package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-BDznyTkG.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-C7p4N-ql.js} +1 -1
- package/dist/{PurchaseOrderPrintPreview-BJ4uktza.js → PurchaseOrderPrintPreview-Q6w-mECy.js} +1 -1
- package/dist/{ReceiveRequestView-BOvNswDa.js → ReceiveRequestView-DT5pFuLm.js} +12 -12
- package/dist/{RecipeView-4I-OWCb6.js → RecipeView-B0B9AjMs.js} +6 -6
- package/dist/{StockView-D2cS56Qi.js → StockView-Dnz7Q5u_.js} +12 -12
- package/dist/{SupplierView-CZPwQkMt.js → SupplierView-DYUSnY0W.js} +7 -7
- package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-CqKi2NMD.js → TransferDetails.vue_vue_type_script_setup_true_lang-DG7IgsfE.js} +5 -5
- package/dist/{UnitView-CV7Od1Jw.js → UnitView-CdAqOSI4.js} +6 -6
- package/dist/{WarehouseView-BtQJYBl0.js → WarehouseView-AJTCViDZ.js} +3 -3
- package/dist/{app-B4nF7QvC.js → app-De0b6M_S.js} +1856 -1848
- package/dist/app.js +1 -1
- package/dist/{date2-BwR5G9qy.js → date2-DsZfEweX.js} +1 -1
- package/dist/{dayjs.min-DGsqRPL2.js → dayjs.min-C3MlIeO6.js} +2 -2
- package/dist/{decimal-DGwTROX2.js → decimal-CIfto74W.js} +1 -1
- package/dist/{fuzzy-D903uHSq.js → fuzzy-DfJ2CA7_.js} +1 -1
- package/dist/{init-date-range-CWbgpQ8e.js → init-date-range-DVsJ_QSu.js} +1 -1
- package/dist/{layout-8DgajRcn.js → layout-BrQ7Xgxg.js} +1 -1
- package/dist/{rules-Dq4Ee_PT.js → rules-B32JlLGo.js} +1 -1
- package/dist/{stock-estimate-4jgl53Nk.js → stock-estimate-CWilasb_.js} +2 -2
- package/dist/stores/inventory.d.ts +1 -1
- package/dist/{supplier-Bv4RiUno.js → supplier-BGVPsv_7.js} +1 -1
- package/dist/{use-inventory-binding-dialog-h8HlGzcz.js → use-inventory-binding-dialog-iyYqvDqU.js} +2 -2
- package/dist/{xlsx-wBLs03H5.js → xlsx-CRnWVsKF.js} +1 -1
- package/dist/{xlsx.util-DxDZloWT.js → xlsx.util-BSemF6vC.js} +2 -2
- package/package.json +3 -3
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { ref as
|
|
2
|
-
import { u as ne, c as Be, S as
|
|
3
|
-
import { useDialog as
|
|
1
|
+
import { ref as T, defineComponent as oe, computed as k, resolveComponent as S, openBlock as g, createBlock as B, withCtx as I, createVNode as y, createElementBlock as D, Fragment as Z, createElementVNode as u, createCommentVNode as W, onMounted as Ge, watch as Te, unref as C, normalizeClass as G, createTextVNode as Pe, toDisplayString as q, renderList as ce, isRef as we, renderSlot as ve, createSlots as qe, normalizeStyle as Ke, Teleport as Me, normalizeProps as Je, guardReactiveProps as Qe } from "vue";
|
|
2
|
+
import { u as ne, c as Be, S as Xe, g as ge, F as J, d as $e, a as Le, C as he, b as Ie, e as Ze, _ as et, f as tt } from "./app-De0b6M_S.js";
|
|
3
|
+
import { useDialog as ze, useSnackbar as be, useProxiedModel as Re, useDialogChild as ot, useBreakpoints as nt } from "@feedmepos/ui-library";
|
|
4
4
|
import { i as lt, _ as at } from "./is-linked-ingredient-error-C6AghEwR.js";
|
|
5
|
-
import { F as
|
|
6
|
-
import { c as st, _ as rt, F as Ae, u as it } from "./layout-
|
|
5
|
+
import { F as Y, D as Ue, R as ye } from "./row-action.enum-BwQbURNh.js";
|
|
6
|
+
import { c as st, _ as rt, F as Ae, u as it } from "./layout-BrQ7Xgxg.js";
|
|
7
7
|
import { _ as ut } from "./SingleColumnLayout.vue_vue_type_script_setup_true_lang-Dov3Uq2z.js";
|
|
8
|
-
import { R as xe, U as dt, A as Ve, M as ct, I as mt } from "./rules-
|
|
8
|
+
import { R as xe, U as dt, A as Ve, M as ct, I as mt } from "./rules-B32JlLGo.js";
|
|
9
9
|
import { g as pt, _ as ke, S as Fe } from "./StockForecast.vue_vue_type_style_index_0_lang-B5EK101t.js";
|
|
10
|
-
import { _ as ft } from "./InventoryBindingForm.vue_vue_type_script_setup_true_lang-
|
|
11
|
-
import { _ as Ce, t as
|
|
12
|
-
import { a as
|
|
10
|
+
import { _ as ft } from "./InventoryBindingForm.vue_vue_type_script_setup_true_lang-B1O2tP3s.js";
|
|
11
|
+
import { _ as Ce, t as Ne, d as Oe, s as vt, r as yt } from "./xlsx.util-BSemF6vC.js";
|
|
12
|
+
import { a as je, t as He, f as gt } from "./date2-DsZfEweX.js";
|
|
13
13
|
import { useCoreStore as me } from "@feedmepos/mf-common";
|
|
14
14
|
import { _ as Se } from "./PreviewBadge.vue_vue_type_script_setup_true_lang-BvadeWUz.js";
|
|
15
15
|
function bt() {
|
|
16
|
-
const s =
|
|
16
|
+
const s = ze(), r = be(), p = ne(), o = T(!1), n = T();
|
|
17
17
|
function l() {
|
|
18
18
|
const i = {
|
|
19
19
|
unit: {},
|
|
20
|
-
mode:
|
|
20
|
+
mode: Y.CREATE,
|
|
21
21
|
show: !0,
|
|
22
22
|
"onUpdate:show"(b) {
|
|
23
23
|
n.value.show = b;
|
|
@@ -28,7 +28,7 @@ function bt() {
|
|
|
28
28
|
async function c(i) {
|
|
29
29
|
const b = {
|
|
30
30
|
unit: Be(i),
|
|
31
|
-
mode:
|
|
31
|
+
mode: Y.UPDATE,
|
|
32
32
|
show: !0,
|
|
33
33
|
"onUpdate:show"(d) {
|
|
34
34
|
n.value.show = d;
|
|
@@ -45,7 +45,7 @@ function bt() {
|
|
|
45
45
|
type: "success"
|
|
46
46
|
});
|
|
47
47
|
} catch (b) {
|
|
48
|
-
b instanceof
|
|
48
|
+
b instanceof Xe && lt(b) ? s.open({
|
|
49
49
|
title: "Cannot delete ingredient",
|
|
50
50
|
contentComponent: at,
|
|
51
51
|
contentComponentProps: {
|
|
@@ -65,7 +65,7 @@ function bt() {
|
|
|
65
65
|
o.value = !1;
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
|
-
function
|
|
68
|
+
function x(i) {
|
|
69
69
|
s.open({
|
|
70
70
|
title: `Delete ${(i == null ? void 0 : i.name) ?? "ingredient"}?`,
|
|
71
71
|
closeButton: !1,
|
|
@@ -84,7 +84,7 @@ function bt() {
|
|
|
84
84
|
return {
|
|
85
85
|
createIngredient: l,
|
|
86
86
|
updateIngredient: c,
|
|
87
|
-
deleteIngredient:
|
|
87
|
+
deleteIngredient: x,
|
|
88
88
|
ingredientDialogProps: n,
|
|
89
89
|
ingredientViewLoading: o
|
|
90
90
|
};
|
|
@@ -162,13 +162,13 @@ const ht = /* @__PURE__ */ oe({
|
|
|
162
162
|
},
|
|
163
163
|
emits: ["update:modelValue"],
|
|
164
164
|
setup(s, { emit: r }) {
|
|
165
|
-
const p = s, o =
|
|
165
|
+
const p = s, o = k(() => {
|
|
166
166
|
var d;
|
|
167
167
|
return (d = p.rootValue) == null ? void 0 : d.unit;
|
|
168
|
-
}), n =
|
|
168
|
+
}), n = k(() => {
|
|
169
169
|
var d;
|
|
170
170
|
return (d = p.rootValue) == null ? void 0 : d._id;
|
|
171
|
-
}), l = r, c =
|
|
171
|
+
}), l = r, c = k({
|
|
172
172
|
get() {
|
|
173
173
|
return !!p.modelValue;
|
|
174
174
|
},
|
|
@@ -178,8 +178,8 @@ const ht = /* @__PURE__ */ oe({
|
|
|
178
178
|
inventoryBindings: []
|
|
179
179
|
}) : l("update:modelValue", null);
|
|
180
180
|
}
|
|
181
|
-
}), f =
|
|
182
|
-
function
|
|
181
|
+
}), f = k(() => pt(o.value));
|
|
182
|
+
function x(d) {
|
|
183
183
|
const v = p.modelValue ?? {};
|
|
184
184
|
v.measurement = d ? `${d}` : null, l("update:modelValue", v);
|
|
185
185
|
}
|
|
@@ -187,44 +187,44 @@ const ht = /* @__PURE__ */ oe({
|
|
|
187
187
|
const v = p.modelValue ?? {};
|
|
188
188
|
v.inventoryBindings = d, l("update:modelValue", v);
|
|
189
189
|
}
|
|
190
|
-
const b =
|
|
190
|
+
const b = k(() => {
|
|
191
191
|
if (!p.modelValue) return null;
|
|
192
192
|
const d = p.modelValue;
|
|
193
193
|
return d.measurement ? f.value.find((v) => v.value === d.measurement) ?? null : f.value.find((v) => v.value === null) ?? null;
|
|
194
194
|
});
|
|
195
195
|
return (d, v) => {
|
|
196
|
-
const A =
|
|
197
|
-
return g(),
|
|
196
|
+
const A = S("FmSwitch"), F = S("FmSelect"), w = S("FmCard");
|
|
197
|
+
return g(), B(w, {
|
|
198
198
|
variant: "outlined",
|
|
199
199
|
class: "p-16 flex flex-col gap-16"
|
|
200
200
|
}, {
|
|
201
201
|
default: I(() => {
|
|
202
|
-
var
|
|
202
|
+
var M, P;
|
|
203
203
|
return [
|
|
204
204
|
y(A, {
|
|
205
205
|
value: "",
|
|
206
206
|
"model-value": c.value,
|
|
207
|
-
"onUpdate:modelValue": v[0] || (v[0] = (
|
|
207
|
+
"onUpdate:modelValue": v[0] || (v[0] = (V) => c.value = V),
|
|
208
208
|
label: "Convertible",
|
|
209
209
|
sublabel: "Convertible from other recipe or ingredients",
|
|
210
210
|
labelPlacement: "right"
|
|
211
211
|
}, null, 8, ["model-value"]),
|
|
212
|
-
c.value ? (g(), D(
|
|
212
|
+
c.value ? (g(), D(Z, { key: 0 }, [
|
|
213
213
|
u("div", null, [
|
|
214
|
-
y(
|
|
214
|
+
y(F, {
|
|
215
215
|
label: "Recipes and ingredients convert to",
|
|
216
|
-
modelValue: (
|
|
217
|
-
"onUpdate:modelValue":
|
|
216
|
+
modelValue: (M = b.value) == null ? void 0 : M.value,
|
|
217
|
+
"onUpdate:modelValue": x,
|
|
218
218
|
items: f.value
|
|
219
219
|
}, null, 8, ["modelValue", "items"])
|
|
220
220
|
]),
|
|
221
221
|
y(ft, {
|
|
222
222
|
id: n.value,
|
|
223
|
-
"model-value": ((
|
|
223
|
+
"model-value": ((P = d.modelValue) == null ? void 0 : P.inventoryBindings) ?? [],
|
|
224
224
|
"onUpdate:modelValue": i,
|
|
225
225
|
"exclude-binding-id": n.value
|
|
226
226
|
}, null, 8, ["id", "model-value", "exclude-binding-id"])
|
|
227
|
-
], 64)) :
|
|
227
|
+
], 64)) : W("", !0)
|
|
228
228
|
];
|
|
229
229
|
}),
|
|
230
230
|
_: 1
|
|
@@ -276,22 +276,22 @@ const xt = { class: "text-fm-color-typo-secondary" }, Vt = { class: "text-fm-col
|
|
|
276
276
|
setup(s, { expose: r, emit: p }) {
|
|
277
277
|
var pe;
|
|
278
278
|
const o = s, n = p, l = ne(), c = me(), f = Le();
|
|
279
|
-
function
|
|
279
|
+
function x(t) {
|
|
280
280
|
if (t.length === 0) return;
|
|
281
281
|
const e = t[0], m = o.modelValue ?? {
|
|
282
282
|
unit: l.units.find((_) => _)
|
|
283
283
|
};
|
|
284
284
|
m.unit || (m.unit = e, n("update:modelValue", m));
|
|
285
285
|
}
|
|
286
|
-
|
|
287
|
-
|
|
286
|
+
Ge(() => {
|
|
287
|
+
x(l.units);
|
|
288
288
|
}), Te([() => l.units], ([t]) => {
|
|
289
|
-
|
|
289
|
+
x(t);
|
|
290
290
|
});
|
|
291
291
|
function i() {
|
|
292
292
|
n("click:submit");
|
|
293
293
|
}
|
|
294
|
-
const b =
|
|
294
|
+
const b = k({
|
|
295
295
|
get() {
|
|
296
296
|
var t;
|
|
297
297
|
return ((t = o.modelValue) == null ? void 0 : t.code) ?? "";
|
|
@@ -302,7 +302,7 @@ const xt = { class: "text-fm-color-typo-secondary" }, Vt = { class: "text-fm-col
|
|
|
302
302
|
} : {};
|
|
303
303
|
e.code = t, n("update:modelValue", e);
|
|
304
304
|
}
|
|
305
|
-
}), d =
|
|
305
|
+
}), d = k({
|
|
306
306
|
get() {
|
|
307
307
|
var t;
|
|
308
308
|
return ((t = o.modelValue) == null ? void 0 : t.name) ?? "";
|
|
@@ -313,11 +313,11 @@ const xt = { class: "text-fm-color-typo-secondary" }, Vt = { class: "text-fm-col
|
|
|
313
313
|
} : {};
|
|
314
314
|
e.name = t, n("update:modelValue", e);
|
|
315
315
|
}
|
|
316
|
-
}), v =
|
|
316
|
+
}), v = k({
|
|
317
317
|
get() {
|
|
318
318
|
var e, m;
|
|
319
319
|
const t = (m = (e = o.modelValue) == null ? void 0 : e.defaultCost) == null ? void 0 : m.costPerUnit;
|
|
320
|
-
return t ? +
|
|
320
|
+
return t ? +je(t) : 0;
|
|
321
321
|
},
|
|
322
322
|
set(t) {
|
|
323
323
|
var m, _, U, $;
|
|
@@ -331,17 +331,17 @@ const xt = { class: "text-fm-color-typo-secondary" }, Vt = { class: "text-fm-col
|
|
|
331
331
|
currency: ((m = ge(c.currentCountry.value)) == null ? void 0 : m.currency) ?? "MYR"
|
|
332
332
|
},
|
|
333
333
|
measurement: ($ = (U = (_ = o.modelValue) == null ? void 0 : _.unit) == null ? void 0 : U.measurements) == null ? void 0 : $.find(
|
|
334
|
-
(
|
|
335
|
-
var
|
|
336
|
-
return
|
|
334
|
+
(L) => {
|
|
335
|
+
var j;
|
|
336
|
+
return L.id === ((j = o.modelValue) == null ? void 0 : j.trackingMeasurement);
|
|
337
337
|
}
|
|
338
338
|
)
|
|
339
339
|
}), e.defaultCost.costPerUnit = {
|
|
340
340
|
...e.defaultCost.costPerUnit,
|
|
341
|
-
...
|
|
341
|
+
...He(+t, 4)
|
|
342
342
|
}, n("update:modelValue", e);
|
|
343
343
|
}
|
|
344
|
-
}), A =
|
|
344
|
+
}), A = k(() => {
|
|
345
345
|
var e, m, _;
|
|
346
346
|
const t = ((e = o.modelValue) == null ? void 0 : e.unit) ?? l.units.find((U) => U);
|
|
347
347
|
return t ? {
|
|
@@ -352,7 +352,7 @@ const xt = { class: "text-fm-color-typo-secondary" }, Vt = { class: "text-fm-col
|
|
|
352
352
|
return U.id === (($ = o.modelValue) == null ? void 0 : $.trackingMeasurement);
|
|
353
353
|
})) == null ? void 0 : _.name) ?? t.name
|
|
354
354
|
} : null;
|
|
355
|
-
}),
|
|
355
|
+
}), F = k(
|
|
356
356
|
() => l.units.flatMap(({ name: t, _id: e, abbrev: m, measurements: _ }) => [
|
|
357
357
|
{
|
|
358
358
|
label: `${t}`,
|
|
@@ -364,36 +364,36 @@ const xt = { class: "text-fm-color-typo-secondary" }, Vt = { class: "text-fm-col
|
|
|
364
364
|
value: { _id: e },
|
|
365
365
|
displayAsSection: !1
|
|
366
366
|
},
|
|
367
|
-
..._.map(({ id: U, name: $, abbrev:
|
|
368
|
-
label: `${$} (${
|
|
367
|
+
..._.map(({ id: U, name: $, abbrev: L }) => ({
|
|
368
|
+
label: `${$} (${L})`,
|
|
369
369
|
value: { _id: e, measurement: U },
|
|
370
370
|
displayAsSection: !1
|
|
371
371
|
}))
|
|
372
372
|
])
|
|
373
373
|
);
|
|
374
|
-
function
|
|
374
|
+
function w(t) {
|
|
375
375
|
var e, m, _, U, $;
|
|
376
376
|
return ((m = (e = o.modelValue) == null ? void 0 : e.unit) == null ? void 0 : m._id) === ((_ = t.value) == null ? void 0 : _._id) && ((U = o.modelValue) == null ? void 0 : U.trackingMeasurement) === (($ = t.value) == null ? void 0 : $.measurement);
|
|
377
377
|
}
|
|
378
|
-
function
|
|
379
|
-
var
|
|
378
|
+
function M(t) {
|
|
379
|
+
var L, j;
|
|
380
380
|
if (!t) return;
|
|
381
|
-
const { _id: e, measurement: m } = t, _ = m || void 0, U = l.units.find((
|
|
381
|
+
const { _id: e, measurement: m } = t, _ = m || void 0, U = l.units.find((X) => X._id === e);
|
|
382
382
|
if (!U)
|
|
383
383
|
return;
|
|
384
384
|
const $ = o.modelValue ?? {};
|
|
385
385
|
$.unit = U, $.trackingMeasurement = _, $.convert && ($.convert.measurement = _ || null), f.enableTotalCost && ($.defaultCost = {
|
|
386
|
-
measurement: U.measurements.find((
|
|
386
|
+
measurement: U.measurements.find((X) => X.id === _),
|
|
387
387
|
costPerUnit: {
|
|
388
|
-
...((
|
|
388
|
+
...((L = $.defaultCost) == null ? void 0 : L.costPerUnit) ?? {
|
|
389
389
|
amount: 0,
|
|
390
390
|
precision: 2,
|
|
391
|
-
currency: ((
|
|
391
|
+
currency: ((j = ge(c.currentCountry.value)) == null ? void 0 : j.currency) ?? "MYR"
|
|
392
392
|
}
|
|
393
393
|
}
|
|
394
394
|
}), n("update:modelValue", $);
|
|
395
395
|
}
|
|
396
|
-
const
|
|
396
|
+
const P = k({
|
|
397
397
|
get() {
|
|
398
398
|
var t;
|
|
399
399
|
return ((t = o.modelValue) == null ? void 0 : t.convert) ?? null;
|
|
@@ -404,18 +404,18 @@ const xt = { class: "text-fm-color-typo-secondary" }, Vt = { class: "text-fm-col
|
|
|
404
404
|
} : {};
|
|
405
405
|
t ? e.convert = t : e.convert = null, n("update:modelValue", e);
|
|
406
406
|
}
|
|
407
|
-
}),
|
|
408
|
-
(t) => t ===
|
|
407
|
+
}), V = k(() => J.options.filter(
|
|
408
|
+
(t) => t === J.enum.FIFO || t === J.enum.WAVG
|
|
409
409
|
).map((t) => {
|
|
410
410
|
function e(m) {
|
|
411
411
|
switch (m) {
|
|
412
|
-
case
|
|
412
|
+
case J.enum.WAVG:
|
|
413
413
|
return "Weighted Average (WAVG)";
|
|
414
|
-
case
|
|
414
|
+
case J.enum.FIFO:
|
|
415
415
|
return "First In First Out (FIFO)";
|
|
416
|
-
case
|
|
416
|
+
case J.enum.LIFO:
|
|
417
417
|
return "Last In First Out (LIFO)";
|
|
418
|
-
case
|
|
418
|
+
case J.enum.FEFO:
|
|
419
419
|
return "First Expired First Out (FEFO)";
|
|
420
420
|
}
|
|
421
421
|
return "";
|
|
@@ -424,7 +424,7 @@ const xt = { class: "text-fm-color-typo-secondary" }, Vt = { class: "text-fm-col
|
|
|
424
424
|
label: e(t),
|
|
425
425
|
value: t
|
|
426
426
|
};
|
|
427
|
-
})), le =
|
|
427
|
+
})), le = k({
|
|
428
428
|
get() {
|
|
429
429
|
var t;
|
|
430
430
|
return ((t = o.modelValue) == null ? void 0 : t.valuation) ?? "WAVG";
|
|
@@ -435,49 +435,49 @@ const xt = { class: "text-fm-color-typo-secondary" }, Vt = { class: "text-fm-col
|
|
|
435
435
|
} : {};
|
|
436
436
|
e.valuation = t, n("update:modelValue", e);
|
|
437
437
|
}
|
|
438
|
-
}),
|
|
438
|
+
}), O = T();
|
|
439
439
|
r({
|
|
440
440
|
validateInputs: () => {
|
|
441
441
|
var t, e;
|
|
442
|
-
(e = (t =
|
|
442
|
+
(e = (t = O.value) == null ? void 0 : t.validateInputs) == null || e.call(t);
|
|
443
443
|
},
|
|
444
444
|
resetInputsValidation: () => {
|
|
445
445
|
var t, e;
|
|
446
|
-
(e = (t =
|
|
446
|
+
(e = (t = O.value) == null ? void 0 : t.resetInputsValidation) == null || e.call(t);
|
|
447
447
|
},
|
|
448
448
|
resetInputs: () => {
|
|
449
449
|
var t, e;
|
|
450
|
-
(e = (t =
|
|
450
|
+
(e = (t = O.value) == null ? void 0 : t.resetInputs) == null || e.call(t);
|
|
451
451
|
}
|
|
452
452
|
});
|
|
453
|
-
const
|
|
453
|
+
const K = T(!1), ae = k(
|
|
454
454
|
() => {
|
|
455
455
|
var t, e, m;
|
|
456
456
|
return (t = o.modelValue) != null && t._id ? ((m = l.menu.bindedBySkuId[(e = o.modelValue) == null ? void 0 : e._id]) == null ? void 0 : m.filter(
|
|
457
457
|
(_) => _.from === "INGREDIENT"
|
|
458
458
|
)) ?? [] : [];
|
|
459
459
|
}
|
|
460
|
-
),
|
|
460
|
+
), Q = k(
|
|
461
461
|
() => {
|
|
462
462
|
var t, e, m;
|
|
463
463
|
return (t = o.modelValue) != null && t._id ? ((m = l.menu.bindedBySkuId[(e = o.modelValue) == null ? void 0 : e._id]) == null ? void 0 : m.filter(
|
|
464
464
|
(_) => _.from === "RECIPE"
|
|
465
465
|
)) ?? [] : [];
|
|
466
466
|
}
|
|
467
|
-
), a =
|
|
467
|
+
), a = k(
|
|
468
468
|
() => {
|
|
469
469
|
var t, e, m;
|
|
470
470
|
return (t = o.modelValue) != null && t._id ? ((m = l.menu.bindedBySkuId[(e = o.modelValue) == null ? void 0 : e._id]) == null ? void 0 : m.filter((_) => _.from === "MENU")) ?? [] : [];
|
|
471
471
|
}
|
|
472
|
-
),
|
|
472
|
+
), z = k(
|
|
473
473
|
() => l.skus.map((t) => ({ label: t.name, value: t.code }))
|
|
474
|
-
),
|
|
474
|
+
), N = T((pe = o.modelValue) == null ? void 0 : pe.code);
|
|
475
475
|
function ie(t) {
|
|
476
476
|
var m;
|
|
477
477
|
const e = t.el;
|
|
478
478
|
e && ((m = e.querySelector("[x-should-scroll-into=true]")) == null || m.scrollIntoView());
|
|
479
479
|
}
|
|
480
|
-
function
|
|
480
|
+
function ee(t) {
|
|
481
481
|
switch (t) {
|
|
482
482
|
case he.MY:
|
|
483
483
|
return "MYR";
|
|
@@ -489,17 +489,17 @@ const xt = { class: "text-fm-color-typo-secondary" }, Vt = { class: "text-fm-col
|
|
|
489
489
|
return "MYR";
|
|
490
490
|
}
|
|
491
491
|
}
|
|
492
|
-
const R =
|
|
492
|
+
const R = k(
|
|
493
493
|
() => {
|
|
494
494
|
var t, e, m, _, U, $;
|
|
495
495
|
return ((_ = (m = (e = (t = o.modelValue) == null ? void 0 : t.unit) == null ? void 0 : e.measurements) == null ? void 0 : m.find(
|
|
496
|
-
(
|
|
497
|
-
var
|
|
498
|
-
return
|
|
496
|
+
(L) => {
|
|
497
|
+
var j;
|
|
498
|
+
return L.id === ((j = o.modelValue) == null ? void 0 : j.trackingMeasurement);
|
|
499
499
|
}
|
|
500
500
|
)) == null ? void 0 : _.abbrev) ?? (($ = (U = o.modelValue) == null ? void 0 : U.unit) == null ? void 0 : $.abbrev);
|
|
501
501
|
}
|
|
502
|
-
),
|
|
502
|
+
), h = k({
|
|
503
503
|
get() {
|
|
504
504
|
var t, e;
|
|
505
505
|
return ((e = (t = o.modelValue) == null ? void 0 : t.thresholds) == null ? void 0 : e.low) ?? re().low;
|
|
@@ -513,7 +513,7 @@ const xt = { class: "text-fm-color-typo-secondary" }, Vt = { class: "text-fm-col
|
|
|
513
513
|
} : {};
|
|
514
514
|
m.thresholds = e, n("update:modelValue", m);
|
|
515
515
|
}
|
|
516
|
-
}),
|
|
516
|
+
}), te = k({
|
|
517
517
|
get() {
|
|
518
518
|
var t, e;
|
|
519
519
|
return ((e = (t = o.modelValue) == null ? void 0 : t.thresholds) == null ? void 0 : e.mid) ?? re().mid;
|
|
@@ -534,11 +534,11 @@ const xt = { class: "text-fm-color-typo-secondary" }, Vt = { class: "text-fm-col
|
|
|
534
534
|
};
|
|
535
535
|
}
|
|
536
536
|
return (t, e) => {
|
|
537
|
-
const m =
|
|
538
|
-
return g(),
|
|
537
|
+
const m = S("FmTextField"), _ = S("FmLabel"), U = S("FmSelect"), $ = S("FmField"), L = S("FmMenuHeader"), j = S("FmMenuDivider"), X = S("FmMenuItem"), fe = S("FmMenu"), ue = S("FmFormGroup"), se = S("FmSwitch"), de = S("FmStepperField"), We = S("FmForm");
|
|
538
|
+
return g(), B(We, {
|
|
539
539
|
disabled: t.disabled,
|
|
540
540
|
ref_key: "formRef",
|
|
541
|
-
ref:
|
|
541
|
+
ref: O,
|
|
542
542
|
class: "grid grid-cols-2 gap-24",
|
|
543
543
|
onValidationSuccess: i
|
|
544
544
|
}, {
|
|
@@ -546,22 +546,22 @@ const xt = { class: "text-fm-color-typo-secondary" }, Vt = { class: "text-fm-col
|
|
|
546
546
|
y(m, {
|
|
547
547
|
label: "Code",
|
|
548
548
|
"model-value": b.value,
|
|
549
|
-
"onUpdate:modelValue": e[0] || (e[0] = (
|
|
550
|
-
rules: [
|
|
549
|
+
"onUpdate:modelValue": e[0] || (e[0] = (E) => b.value = E),
|
|
550
|
+
rules: [C(xe)(), C(dt)(z.value, N.value)],
|
|
551
551
|
"label-mark": "required"
|
|
552
552
|
}, null, 8, ["model-value", "rules"]),
|
|
553
553
|
y(m, {
|
|
554
554
|
label: "Name",
|
|
555
555
|
"model-value": d.value,
|
|
556
|
-
"onUpdate:modelValue": e[1] || (e[1] = (
|
|
557
|
-
rules: [
|
|
556
|
+
"onUpdate:modelValue": e[1] || (e[1] = (E) => d.value = E),
|
|
557
|
+
rules: [C(xe)()],
|
|
558
558
|
"label-mark": "required"
|
|
559
559
|
}, null, 8, ["model-value", "rules"]),
|
|
560
560
|
y(U, {
|
|
561
561
|
class: "col-span-2",
|
|
562
562
|
"model-value": le.value,
|
|
563
|
-
"onUpdate:modelValue": e[2] || (e[2] = (
|
|
564
|
-
items:
|
|
563
|
+
"onUpdate:modelValue": e[2] || (e[2] = (E) => le.value = E),
|
|
564
|
+
items: V.value
|
|
565
565
|
}, {
|
|
566
566
|
label: I(() => [
|
|
567
567
|
y(Se, { "z-index": 50 }, {
|
|
@@ -574,32 +574,32 @@ const xt = { class: "text-fm-color-typo-secondary" }, Vt = { class: "text-fm-col
|
|
|
574
574
|
_: 1
|
|
575
575
|
}, 8, ["model-value", "items"]),
|
|
576
576
|
y(ue, {
|
|
577
|
-
class:
|
|
577
|
+
class: G([C(f).enableTotalCost ? "col-span-1" : "col-span-2"]),
|
|
578
578
|
"model-value": A.value,
|
|
579
|
-
rules: [
|
|
579
|
+
rules: [C(xe)()],
|
|
580
580
|
"label-mark": "required"
|
|
581
581
|
}, {
|
|
582
582
|
label: I(() => [
|
|
583
583
|
y(_, { label: "Unit" })
|
|
584
584
|
]),
|
|
585
|
-
default: I(({ invalid:
|
|
585
|
+
default: I(({ invalid: E }) => [
|
|
586
586
|
y(fe, null, {
|
|
587
587
|
"menu-button": I(() => [
|
|
588
588
|
y($, {
|
|
589
|
-
class:
|
|
589
|
+
class: G([
|
|
590
590
|
"fm-typo-en-body-lg-400",
|
|
591
591
|
{
|
|
592
592
|
"text-fm-color-typo-primary": !t.disabled,
|
|
593
593
|
"text-fm-color-typo-disabled": t.disabled
|
|
594
594
|
}
|
|
595
595
|
]),
|
|
596
|
-
invalid:
|
|
596
|
+
invalid: E,
|
|
597
597
|
"append-icon": "expand_more"
|
|
598
598
|
}, {
|
|
599
599
|
default: I(() => {
|
|
600
|
-
var
|
|
600
|
+
var H;
|
|
601
601
|
return [
|
|
602
|
-
Pe(
|
|
602
|
+
Pe(q((H = A.value) == null ? void 0 : H.name), 1)
|
|
603
603
|
];
|
|
604
604
|
}),
|
|
605
605
|
_: 2
|
|
@@ -610,20 +610,20 @@ const xt = { class: "text-fm-color-typo-secondary" }, Vt = { class: "text-fm-col
|
|
|
610
610
|
class: "overflow-x-hidden overflow-y-auto max-h-[300px]",
|
|
611
611
|
onVnodeMounted: ie
|
|
612
612
|
}, [
|
|
613
|
-
(g(!0), D(
|
|
614
|
-
key:
|
|
613
|
+
(g(!0), D(Z, null, ce(F.value, (H) => (g(), D(Z, {
|
|
614
|
+
key: H.label
|
|
615
615
|
}, [
|
|
616
|
-
|
|
617
|
-
y(
|
|
618
|
-
label:
|
|
616
|
+
H.displayAsSection ? (g(), D(Z, { key: 0 }, [
|
|
617
|
+
y(L, {
|
|
618
|
+
label: H.label
|
|
619
619
|
}, null, 8, ["label"]),
|
|
620
|
-
y(
|
|
621
|
-
], 64)) : (g(),
|
|
620
|
+
y(j)
|
|
621
|
+
], 64)) : (g(), B(X, {
|
|
622
622
|
key: 1,
|
|
623
|
-
label:
|
|
624
|
-
"model-value":
|
|
625
|
-
onClick: (Ao) =>
|
|
626
|
-
"x-should-scroll-into": `${
|
|
623
|
+
label: H.label,
|
|
624
|
+
"model-value": w(H),
|
|
625
|
+
onClick: (Ao) => M(H.value),
|
|
626
|
+
"x-should-scroll-into": `${w(H)}`
|
|
627
627
|
}, null, 8, ["label", "model-value", "onClick", "x-should-scroll-into"]))
|
|
628
628
|
], 64))), 128))
|
|
629
629
|
], 512)
|
|
@@ -633,11 +633,11 @@ const xt = { class: "text-fm-color-typo-secondary" }, Vt = { class: "text-fm-col
|
|
|
633
633
|
]),
|
|
634
634
|
_: 1
|
|
635
635
|
}, 8, ["class", "model-value", "rules"]),
|
|
636
|
-
|
|
636
|
+
C(f).enableTotalCost ? (g(), B(m, {
|
|
637
637
|
key: 0,
|
|
638
638
|
"model-value": v.value,
|
|
639
|
-
"onUpdate:modelValue": e[3] || (e[3] = (
|
|
640
|
-
rules: [
|
|
639
|
+
"onUpdate:modelValue": e[3] || (e[3] = (E) => v.value = E),
|
|
640
|
+
rules: [C(Ve)(0), C(ct)(2)]
|
|
641
641
|
}, {
|
|
642
642
|
label: I(() => [
|
|
643
643
|
y(Se, { "z-index": 50 }, {
|
|
@@ -648,48 +648,48 @@ const xt = { class: "text-fm-color-typo-secondary" }, Vt = { class: "text-fm-col
|
|
|
648
648
|
})
|
|
649
649
|
]),
|
|
650
650
|
prepend: I(() => {
|
|
651
|
-
var
|
|
651
|
+
var E, H;
|
|
652
652
|
return [
|
|
653
|
-
u("div", xt,
|
|
653
|
+
u("div", xt, q(ee(((E = C(c).currentCountry) == null ? void 0 : E.value) ?? C($e)) === "MYR" ? "RM" : ee(((H = C(c).currentCountry) == null ? void 0 : H.value) ?? C($e))), 1)
|
|
654
654
|
];
|
|
655
655
|
}),
|
|
656
656
|
append: I(() => [
|
|
657
|
-
u("div", Vt, " / " +
|
|
657
|
+
u("div", Vt, " / " + q(R.value), 1)
|
|
658
658
|
]),
|
|
659
659
|
_: 1
|
|
660
|
-
}, 8, ["model-value", "rules"])) :
|
|
660
|
+
}, 8, ["model-value", "rules"])) : W("", !0),
|
|
661
661
|
u("div", kt, [
|
|
662
662
|
y(ht, {
|
|
663
|
-
"model-value":
|
|
664
|
-
"onUpdate:modelValue": e[4] || (e[4] = (
|
|
663
|
+
"model-value": P.value,
|
|
664
|
+
"onUpdate:modelValue": e[4] || (e[4] = (E) => P.value = E),
|
|
665
665
|
"root-value": t.modelValue
|
|
666
666
|
}, null, 8, ["model-value", "root-value"])
|
|
667
667
|
]),
|
|
668
|
-
t.mode !==
|
|
668
|
+
t.mode !== C(Y).CREATE ? (g(), D("div", Ft, [
|
|
669
669
|
u("div", null, [
|
|
670
670
|
y(se, {
|
|
671
671
|
label: "Show binded items",
|
|
672
|
-
modelValue:
|
|
673
|
-
"onUpdate:modelValue": e[5] || (e[5] = (
|
|
672
|
+
modelValue: K.value,
|
|
673
|
+
"onUpdate:modelValue": e[5] || (e[5] = (E) => K.value = E),
|
|
674
674
|
"label-placement": "right"
|
|
675
675
|
}, null, 8, ["modelValue"])
|
|
676
676
|
]),
|
|
677
|
-
|
|
677
|
+
K.value && ae.value.length ? (g(), B(Ce, {
|
|
678
678
|
key: 0,
|
|
679
679
|
name: "Ingredient",
|
|
680
680
|
bindings: ae.value
|
|
681
|
-
}, null, 8, ["bindings"])) :
|
|
682
|
-
|
|
681
|
+
}, null, 8, ["bindings"])) : W("", !0),
|
|
682
|
+
K.value && Q.value.length ? (g(), B(Ce, {
|
|
683
683
|
key: 1,
|
|
684
684
|
name: "Recipe",
|
|
685
|
-
bindings:
|
|
686
|
-
}, null, 8, ["bindings"])) :
|
|
687
|
-
|
|
685
|
+
bindings: Q.value
|
|
686
|
+
}, null, 8, ["bindings"])) : W("", !0),
|
|
687
|
+
K.value && a.value.length ? (g(), B(Ce, {
|
|
688
688
|
key: 2,
|
|
689
689
|
name: "Menu",
|
|
690
690
|
bindings: a.value
|
|
691
|
-
}, null, 8, ["bindings"])) :
|
|
692
|
-
])) :
|
|
691
|
+
}, null, 8, ["bindings"])) : W("", !0)
|
|
692
|
+
])) : W("", !0),
|
|
693
693
|
u("div", Ct, [
|
|
694
694
|
u("div", St, [
|
|
695
695
|
y(Se, null, {
|
|
@@ -702,23 +702,23 @@ const xt = { class: "text-fm-color-typo-secondary" }, Vt = { class: "text-fm-col
|
|
|
702
702
|
]),
|
|
703
703
|
u("div", $t, [
|
|
704
704
|
y(ue, {
|
|
705
|
-
"model-value": { low:
|
|
705
|
+
"model-value": { low: h.value, mid: te.value },
|
|
706
706
|
rules: [_e()]
|
|
707
707
|
}, null, 8, ["model-value", "rules"]),
|
|
708
708
|
u("div", It, [
|
|
709
709
|
u("div", Rt, [
|
|
710
710
|
u("div", Ut, [
|
|
711
711
|
y(ke, {
|
|
712
|
-
days:
|
|
713
|
-
level:
|
|
712
|
+
days: h.value,
|
|
713
|
+
level: C(Fe).low
|
|
714
714
|
}, null, 8, ["days", "level"])
|
|
715
715
|
]),
|
|
716
716
|
u("div", At, [
|
|
717
717
|
Dt,
|
|
718
718
|
y(de, {
|
|
719
|
-
modelValue:
|
|
720
|
-
"onUpdate:modelValue": e[6] || (e[6] = (
|
|
721
|
-
rules: [
|
|
719
|
+
modelValue: h.value,
|
|
720
|
+
"onUpdate:modelValue": e[6] || (e[6] = (E) => h.value = E),
|
|
721
|
+
rules: [C(Ve)(0)]
|
|
722
722
|
}, {
|
|
723
723
|
append: I(() => [
|
|
724
724
|
Et
|
|
@@ -731,16 +731,16 @@ const xt = { class: "text-fm-color-typo-secondary" }, Vt = { class: "text-fm-col
|
|
|
731
731
|
u("div", Pt, [
|
|
732
732
|
u("div", Bt, [
|
|
733
733
|
y(ke, {
|
|
734
|
-
days:
|
|
735
|
-
level:
|
|
734
|
+
days: te.value,
|
|
735
|
+
level: C(Fe).mid
|
|
736
736
|
}, null, 8, ["days", "level"])
|
|
737
737
|
]),
|
|
738
738
|
u("div", Lt, [
|
|
739
739
|
zt,
|
|
740
740
|
y(de, {
|
|
741
|
-
modelValue:
|
|
742
|
-
"onUpdate:modelValue": e[7] || (e[7] = (
|
|
743
|
-
rules: [
|
|
741
|
+
modelValue: te.value,
|
|
742
|
+
"onUpdate:modelValue": e[7] || (e[7] = (E) => te.value = E),
|
|
743
|
+
rules: [C(Ve)(0)]
|
|
744
744
|
}, {
|
|
745
745
|
append: I(() => [
|
|
746
746
|
Nt
|
|
@@ -753,8 +753,8 @@ const xt = { class: "text-fm-color-typo-secondary" }, Vt = { class: "text-fm-col
|
|
|
753
753
|
u("div", jt, [
|
|
754
754
|
u("div", Ht, [
|
|
755
755
|
y(ke, {
|
|
756
|
-
days:
|
|
757
|
-
level:
|
|
756
|
+
days: te.value + 1,
|
|
757
|
+
level: C(Fe).high
|
|
758
758
|
}, null, 8, ["days", "level"])
|
|
759
759
|
]),
|
|
760
760
|
Yt
|
|
@@ -772,31 +772,31 @@ const xt = { class: "text-fm-color-typo-secondary" }, Vt = { class: "text-fm-col
|
|
|
772
772
|
props: {
|
|
773
773
|
show: { type: Boolean },
|
|
774
774
|
unit: {},
|
|
775
|
-
mode: { default:
|
|
775
|
+
mode: { default: Y.READ }
|
|
776
776
|
},
|
|
777
777
|
emits: ["update:show"],
|
|
778
778
|
setup(s) {
|
|
779
|
-
const r = s, p = ne(), o = be(), n = Re(r, "show"), l = Re(r, "unit"), c =
|
|
779
|
+
const r = s, p = ne(), o = be(), n = Re(r, "show"), l = Re(r, "unit"), c = k(() => {
|
|
780
780
|
switch (r.mode) {
|
|
781
|
-
case
|
|
781
|
+
case Y.READ:
|
|
782
782
|
return "View ingredient";
|
|
783
|
-
case
|
|
783
|
+
case Y.UPDATE:
|
|
784
784
|
return "Edit ingredient";
|
|
785
|
-
case
|
|
785
|
+
case Y.CREATE:
|
|
786
786
|
return "Add ingredient";
|
|
787
787
|
}
|
|
788
788
|
return "";
|
|
789
|
-
}), f =
|
|
789
|
+
}), f = k(() => {
|
|
790
790
|
switch (r.mode) {
|
|
791
|
-
case
|
|
791
|
+
case Y.READ:
|
|
792
792
|
return "";
|
|
793
|
-
case
|
|
793
|
+
case Y.UPDATE:
|
|
794
794
|
return "Save";
|
|
795
|
-
case
|
|
795
|
+
case Y.CREATE:
|
|
796
796
|
return "Add";
|
|
797
797
|
}
|
|
798
798
|
return "";
|
|
799
|
-
}),
|
|
799
|
+
}), x = T(), i = T(!1);
|
|
800
800
|
async function b() {
|
|
801
801
|
i.value = !0;
|
|
802
802
|
try {
|
|
@@ -805,8 +805,8 @@ const xt = { class: "text-fm-color-typo-secondary" }, Vt = { class: "text-fm-col
|
|
|
805
805
|
message: "Created " + l.value.name,
|
|
806
806
|
type: "success"
|
|
807
807
|
});
|
|
808
|
-
} catch (
|
|
809
|
-
|
|
808
|
+
} catch (F) {
|
|
809
|
+
F instanceof Ie || o.open({
|
|
810
810
|
title: "Failed to create ingredient",
|
|
811
811
|
message: "Please try again",
|
|
812
812
|
type: "error"
|
|
@@ -823,8 +823,8 @@ const xt = { class: "text-fm-color-typo-secondary" }, Vt = { class: "text-fm-col
|
|
|
823
823
|
message: "Updated " + l.value.name,
|
|
824
824
|
type: "success"
|
|
825
825
|
});
|
|
826
|
-
} catch (
|
|
827
|
-
|
|
826
|
+
} catch (F) {
|
|
827
|
+
F instanceof Ie || o.open({
|
|
828
828
|
title: "Failed to update ingredient",
|
|
829
829
|
message: "Please try again",
|
|
830
830
|
type: "error"
|
|
@@ -834,24 +834,24 @@ const xt = { class: "text-fm-color-typo-secondary" }, Vt = { class: "text-fm-col
|
|
|
834
834
|
}
|
|
835
835
|
}
|
|
836
836
|
function v() {
|
|
837
|
-
var
|
|
838
|
-
(
|
|
837
|
+
var F, w;
|
|
838
|
+
(w = (F = x.value) == null ? void 0 : F.validateInputs) == null || w.call(F);
|
|
839
839
|
}
|
|
840
840
|
function A() {
|
|
841
841
|
switch (r.mode) {
|
|
842
|
-
case
|
|
842
|
+
case Y.READ:
|
|
843
843
|
return;
|
|
844
|
-
case
|
|
844
|
+
case Y.UPDATE:
|
|
845
845
|
return d();
|
|
846
|
-
case
|
|
846
|
+
case Y.CREATE:
|
|
847
847
|
return b();
|
|
848
848
|
}
|
|
849
849
|
}
|
|
850
|
-
return (
|
|
851
|
-
const
|
|
852
|
-
return g(),
|
|
853
|
-
"model-value":
|
|
854
|
-
"onUpdate:modelValue":
|
|
850
|
+
return (F, w) => {
|
|
851
|
+
const M = S("FmButton"), P = S("FmSideSheet");
|
|
852
|
+
return g(), B(P, {
|
|
853
|
+
"model-value": C(n),
|
|
854
|
+
"onUpdate:modelValue": w[3] || (w[3] = (V) => we(n) ? n.value = V : null),
|
|
855
855
|
header: c.value,
|
|
856
856
|
"close-button": "",
|
|
857
857
|
"dismiss-away": "",
|
|
@@ -859,16 +859,16 @@ const xt = { class: "text-fm-color-typo-secondary" }, Vt = { class: "text-fm-col
|
|
|
859
859
|
}, {
|
|
860
860
|
"side-sheet-footer": I(() => [
|
|
861
861
|
u("div", Gt, [
|
|
862
|
-
y(
|
|
862
|
+
y(M, {
|
|
863
863
|
loading: i.value,
|
|
864
864
|
label: f.value,
|
|
865
865
|
onClick: v
|
|
866
866
|
}, null, 8, ["loading", "label"]),
|
|
867
|
-
y(
|
|
867
|
+
y(M, {
|
|
868
868
|
disabled: i.value,
|
|
869
869
|
label: "Close",
|
|
870
870
|
variant: "tertiary",
|
|
871
|
-
onClick:
|
|
871
|
+
onClick: w[2] || (w[2] = (V) => n.value = !1)
|
|
872
872
|
}, null, 8, ["disabled"])
|
|
873
873
|
])
|
|
874
874
|
]),
|
|
@@ -876,12 +876,12 @@ const xt = { class: "text-fm-color-typo-secondary" }, Vt = { class: "text-fm-col
|
|
|
876
876
|
y(Wt, {
|
|
877
877
|
class: "w-full",
|
|
878
878
|
ref_key: "hasValidationExpose",
|
|
879
|
-
ref:
|
|
880
|
-
modelValue:
|
|
881
|
-
"onUpdate:modelValue":
|
|
882
|
-
mode:
|
|
879
|
+
ref: x,
|
|
880
|
+
modelValue: C(l),
|
|
881
|
+
"onUpdate:modelValue": w[0] || (w[0] = (V) => we(l) ? l.value = V : null),
|
|
882
|
+
mode: F.mode,
|
|
883
883
|
disabled: i.value,
|
|
884
|
-
"onClick:submit":
|
|
884
|
+
"onClick:submit": w[1] || (w[1] = (V) => A())
|
|
885
885
|
}, null, 8, ["modelValue", "mode", "disabled"])
|
|
886
886
|
]),
|
|
887
887
|
_: 1
|
|
@@ -914,12 +914,12 @@ function Zt(s) {
|
|
|
914
914
|
unit: ((p = s.unit.measurements.find((f) => f.id === s.trackingMeasurement)) == null ? void 0 : p.abbrev) ?? s.unit.abbrev,
|
|
915
915
|
baseUnit: s.unit.abbrev,
|
|
916
916
|
valuationMethod: s.valuation ?? "WAVG",
|
|
917
|
-
pricePerUnit: (o = s.defaultCost) != null && o.costPerUnit ? +
|
|
917
|
+
pricePerUnit: (o = s.defaultCost) != null && o.costPerUnit ? +je((n = s.defaultCost) == null ? void 0 : n.costPerUnit) : 0,
|
|
918
918
|
thresholdLow: ((l = s.thresholds) == null ? void 0 : l.low) ?? re().low,
|
|
919
919
|
thresholdMid: ((c = s.thresholds) == null ? void 0 : c.mid) ?? re().mid
|
|
920
920
|
};
|
|
921
921
|
}
|
|
922
|
-
function
|
|
922
|
+
function Ye() {
|
|
923
923
|
var n;
|
|
924
924
|
const s = [
|
|
925
925
|
{
|
|
@@ -960,25 +960,25 @@ function We() {
|
|
|
960
960
|
), s;
|
|
961
961
|
}
|
|
962
962
|
function eo() {
|
|
963
|
-
const r = ne().skus.map(Zt), o = me().currentBusiness.value, n =
|
|
963
|
+
const r = ne().skus.map(Zt), o = me().currentBusiness.value, n = Ye(), l = [
|
|
964
964
|
["Business name:", o == null ? void 0 : o.name],
|
|
965
965
|
["Business ID:", o == null ? void 0 : o._id],
|
|
966
966
|
["Menu version", o == null ? void 0 : o.menuVersion],
|
|
967
967
|
[],
|
|
968
968
|
n.map((i) => i.name),
|
|
969
969
|
...r.map((i) => n.map((b) => i[b.id]))
|
|
970
|
-
], c = n.map((i) => `system:${i.id}`), f =
|
|
971
|
-
return
|
|
970
|
+
], c = n.map((i) => `system:${i.id}`), f = Ne(l, c), x = `${o == null ? void 0 : o.name} ingredients (${gt(/* @__PURE__ */ new Date())}).xlsx`;
|
|
971
|
+
return Oe(f, x), x;
|
|
972
972
|
}
|
|
973
973
|
function to() {
|
|
974
|
-
const r = me().currentBusiness.value, p =
|
|
974
|
+
const r = me().currentBusiness.value, p = Ye(), o = [
|
|
975
975
|
["Business name:", r == null ? void 0 : r.name],
|
|
976
976
|
["Business ID:", r == null ? void 0 : r._id],
|
|
977
977
|
["Menu version", r == null ? void 0 : r.menuVersion],
|
|
978
978
|
[],
|
|
979
979
|
p.map((f) => f.name)
|
|
980
|
-
], n = p.map((f) => `system:${f.id}`), l =
|
|
981
|
-
return
|
|
980
|
+
], n = p.map((f) => `system:${f.id}`), l = Ne(o, n), c = "FeedMe ingredients template.xlsx";
|
|
981
|
+
return Oe(l, c), c;
|
|
982
982
|
}
|
|
983
983
|
function oo(s) {
|
|
984
984
|
const [
|
|
@@ -989,12 +989,12 @@ function oo(s) {
|
|
|
989
989
|
l,
|
|
990
990
|
c,
|
|
991
991
|
...f
|
|
992
|
-
] = vt(s),
|
|
992
|
+
] = vt(s), x = r.map((b) => b.split(":")[1]);
|
|
993
993
|
return f.map((b, d) => {
|
|
994
994
|
const v = {};
|
|
995
|
-
for (const A in
|
|
996
|
-
const
|
|
997
|
-
Object.assign(v, { [
|
|
995
|
+
for (const A in x) {
|
|
996
|
+
const F = x[A];
|
|
997
|
+
Object.assign(v, { [F]: b[A] });
|
|
998
998
|
}
|
|
999
999
|
return {
|
|
1000
1000
|
index: d,
|
|
@@ -1003,31 +1003,31 @@ function oo(s) {
|
|
|
1003
1003
|
});
|
|
1004
1004
|
}
|
|
1005
1005
|
function De(s, r, p) {
|
|
1006
|
-
var
|
|
1007
|
-
const n = ne().units, l = new Array(), c = p.filter((
|
|
1006
|
+
var P;
|
|
1007
|
+
const n = ne().units, l = new Array(), c = p.filter((V) => V.data.code === s.code);
|
|
1008
1008
|
c.length > 1 && l.push(
|
|
1009
|
-
`Code ${s.code} is already used in row ${c.map((
|
|
1009
|
+
`Code ${s.code} is already used in row ${c.map((V) => V.index + 6).join()}.`
|
|
1010
1010
|
);
|
|
1011
|
-
const f = n.find((
|
|
1011
|
+
const f = n.find((V) => V.abbrev === s.baseUnit), x = f == null ? void 0 : f.measurements.find((V) => V.abbrev === s.unit);
|
|
1012
1012
|
if (!f)
|
|
1013
1013
|
l.push(`Cannot find base unit of symbol ${s.baseUnit}.`);
|
|
1014
|
-
else if (s.baseUnit !== s.unit && !
|
|
1015
|
-
const
|
|
1016
|
-
l.push(
|
|
1014
|
+
else if (s.baseUnit !== s.unit && !x) {
|
|
1015
|
+
const V = `Cannot find unit conversion for ${s.baseUnit} with symbol ${s.unit || "[empty]"}.`;
|
|
1016
|
+
l.push(V);
|
|
1017
1017
|
}
|
|
1018
|
-
const i =
|
|
1019
|
-
(
|
|
1018
|
+
const i = J.options.find(
|
|
1019
|
+
(V) => V === s.valuationMethod
|
|
1020
1020
|
);
|
|
1021
1021
|
s.valuationMethod && !i && l.push(
|
|
1022
|
-
`Expected valuation method to be one of ${
|
|
1022
|
+
`Expected valuation method to be one of ${J.options.join()} but got ${s.valuationMethod} instead.`
|
|
1023
1023
|
);
|
|
1024
|
-
const d = me().currentCountry.value, v = (
|
|
1024
|
+
const d = me().currentCountry.value, v = (V) => `${V}`.length && mt()(V) === !0, A = v(`${s.pricePerUnit}`) === !0 ? {
|
|
1025
1025
|
costPerUnit: {
|
|
1026
|
-
...
|
|
1027
|
-
currency: ((
|
|
1026
|
+
...He(Number(s.pricePerUnit) || 0),
|
|
1027
|
+
currency: ((P = ge(d)) == null ? void 0 : P.currency) ?? "MYR"
|
|
1028
1028
|
},
|
|
1029
|
-
measurement:
|
|
1030
|
-
} : void 0,
|
|
1029
|
+
measurement: x
|
|
1030
|
+
} : void 0, F = v(`${s.thresholdLow}`) && v(`${s.thresholdMid}`) ? {
|
|
1031
1031
|
low: Number(s.thresholdLow) || 0,
|
|
1032
1032
|
mid: Number(s.thresholdMid) || 0
|
|
1033
1033
|
} : void 0;
|
|
@@ -1037,20 +1037,20 @@ function De(s, r, p) {
|
|
|
1037
1037
|
_id: Qt(),
|
|
1038
1038
|
code: s.code,
|
|
1039
1039
|
name: s.name,
|
|
1040
|
-
unit: f ?? n.find((
|
|
1041
|
-
trackingMeasurement:
|
|
1040
|
+
unit: f ?? n.find((V) => V) ?? Xt,
|
|
1041
|
+
trackingMeasurement: x == null ? void 0 : x.id,
|
|
1042
1042
|
valuation: i,
|
|
1043
1043
|
defaultCost: A,
|
|
1044
|
-
thresholds:
|
|
1044
|
+
thresholds: F
|
|
1045
1045
|
},
|
|
1046
1046
|
errors: l,
|
|
1047
1047
|
excelRowNumber: r + 6
|
|
1048
1048
|
};
|
|
1049
1049
|
}
|
|
1050
1050
|
function no(s) {
|
|
1051
|
-
const r = oo(s).filter((i) => i.data.code), o = ne().skus, n =
|
|
1051
|
+
const r = oo(s).filter((i) => i.data.code), o = ne().skus, n = Ze(o, "code"), l = r.filter((i) => !n[i.data.code]), c = r.filter((i) => n[i.data.code]), f = l.map(
|
|
1052
1052
|
(i) => De(i.data, i.index, r)
|
|
1053
|
-
),
|
|
1053
|
+
), x = c.map((i) => {
|
|
1054
1054
|
const b = De(i.data, i.index, r), d = n[i.data.code];
|
|
1055
1055
|
return {
|
|
1056
1056
|
...b,
|
|
@@ -1071,7 +1071,7 @@ function no(s) {
|
|
|
1071
1071
|
});
|
|
1072
1072
|
return {
|
|
1073
1073
|
importCreateResult: f,
|
|
1074
|
-
importUpdateResult:
|
|
1074
|
+
importUpdateResult: x
|
|
1075
1075
|
};
|
|
1076
1076
|
}
|
|
1077
1077
|
const lo = {
|
|
@@ -1089,26 +1089,26 @@ const lo = {
|
|
|
1089
1089
|
},
|
|
1090
1090
|
emits: ["file-upload", "file-rejected"],
|
|
1091
1091
|
setup(s, { emit: r }) {
|
|
1092
|
-
const p = s, o = r, n =
|
|
1092
|
+
const p = s, o = r, n = T(!1), l = T(null), c = T(null), f = T(), x = (a) => {
|
|
1093
1093
|
p.disabled || (a.stopPropagation(), a.preventDefault());
|
|
1094
1094
|
}, i = (a) => {
|
|
1095
1095
|
p.disabled || (a.stopPropagation(), a.preventDefault(), n.value = !0);
|
|
1096
1096
|
}, b = (a) => {
|
|
1097
1097
|
p.disabled || (a.stopPropagation(), a.preventDefault(), n.value = !1);
|
|
1098
1098
|
}, d = (a) => {
|
|
1099
|
-
var
|
|
1100
|
-
p.disabled || (a.stopPropagation(), a.preventDefault(), n.value = !1, v((
|
|
1099
|
+
var z;
|
|
1100
|
+
p.disabled || (a.stopPropagation(), a.preventDefault(), n.value = !1, v((z = a.dataTransfer) == null ? void 0 : z.files));
|
|
1101
1101
|
};
|
|
1102
1102
|
function v(a) {
|
|
1103
1103
|
if (a)
|
|
1104
|
-
if (f.value = a, l.value =
|
|
1104
|
+
if (f.value = a, l.value = F(a[0]), c.value = w(a[0]), l.value && c.value)
|
|
1105
1105
|
o("file-upload", a[0]);
|
|
1106
1106
|
else {
|
|
1107
|
-
const
|
|
1107
|
+
const z = A();
|
|
1108
1108
|
o("file-rejected", [
|
|
1109
1109
|
{
|
|
1110
1110
|
file: a[0],
|
|
1111
|
-
reason:
|
|
1111
|
+
reason: z
|
|
1112
1112
|
}
|
|
1113
1113
|
]);
|
|
1114
1114
|
}
|
|
@@ -1116,33 +1116,33 @@ const lo = {
|
|
|
1116
1116
|
const A = () => {
|
|
1117
1117
|
const a = new Array();
|
|
1118
1118
|
return l.value || a.push("invalid-type"), c.value || a.push("invalid-size"), a;
|
|
1119
|
-
},
|
|
1119
|
+
}, F = (a) => {
|
|
1120
1120
|
if (!p.accept) return !0;
|
|
1121
|
-
const
|
|
1122
|
-
for (const
|
|
1123
|
-
if (
|
|
1124
|
-
if (
|
|
1125
|
-
} else if (
|
|
1121
|
+
const z = p.accept.split(",").map((N) => N.trim());
|
|
1122
|
+
for (const N of z)
|
|
1123
|
+
if (M(N)) {
|
|
1124
|
+
if (V(N) === V(a.type)) return !0;
|
|
1125
|
+
} else if (P(a) === N || a.type === N) return !0;
|
|
1126
1126
|
return !1;
|
|
1127
|
-
},
|
|
1127
|
+
}, w = (a) => a.size <= p.maxFileSize, M = (a) => a.indexOf("*") !== -1, P = (a) => "." + a.name.split(".").pop(), V = (a) => a.substring(0, a.indexOf("/")), le = k(() => {
|
|
1128
1128
|
if (n.value) return "Drop file to upload";
|
|
1129
1129
|
if (l.value) {
|
|
1130
1130
|
if (!c.value) return `File size exceeds ${p.maxFileSize * 1e-6}mb`;
|
|
1131
1131
|
} else return "File type is not valid";
|
|
1132
1132
|
return "";
|
|
1133
|
-
}),
|
|
1134
|
-
const
|
|
1135
|
-
v(
|
|
1136
|
-
}, ae =
|
|
1133
|
+
}), O = k(() => f.value ? !l.value || !c.value : !1), K = (a) => {
|
|
1134
|
+
const z = a.target;
|
|
1135
|
+
v(z.files);
|
|
1136
|
+
}, ae = k(() => {
|
|
1137
1137
|
var a;
|
|
1138
1138
|
return (a = f.value) == null ? void 0 : a.item(0);
|
|
1139
|
-
}),
|
|
1140
|
-
return (a,
|
|
1141
|
-
const
|
|
1139
|
+
}), Q = T();
|
|
1140
|
+
return (a, z) => {
|
|
1141
|
+
const N = S("FmLabel"), ie = S("FmButton");
|
|
1142
1142
|
return g(), D("label", {
|
|
1143
1143
|
class: "fm-droppable-field",
|
|
1144
1144
|
ref_key: "fmButtonRef",
|
|
1145
|
-
ref:
|
|
1145
|
+
ref: Q
|
|
1146
1146
|
}, [
|
|
1147
1147
|
a.$slots.default ? (g(), D("div", lo, [
|
|
1148
1148
|
u("input", {
|
|
@@ -1150,47 +1150,47 @@ const lo = {
|
|
|
1150
1150
|
disabled: a.disabled,
|
|
1151
1151
|
class: "fm-droppable-field__input",
|
|
1152
1152
|
type: "file",
|
|
1153
|
-
onChange:
|
|
1153
|
+
onChange: K
|
|
1154
1154
|
}, null, 40, ao)
|
|
1155
|
-
])) :
|
|
1155
|
+
])) : W("", !0),
|
|
1156
1156
|
ve(a.$slots, "default", {
|
|
1157
1157
|
isDragging: n.value,
|
|
1158
1158
|
isValidFileType: l.value,
|
|
1159
1159
|
isValidFileSize: c.value,
|
|
1160
1160
|
singleValidFile: ae.value,
|
|
1161
1161
|
openFileDialog: () => {
|
|
1162
|
-
var
|
|
1163
|
-
return console.log("click",
|
|
1162
|
+
var ee;
|
|
1163
|
+
return console.log("click", Q.value), (ee = Q.value) == null ? void 0 : ee.click();
|
|
1164
1164
|
}
|
|
1165
1165
|
}, () => [
|
|
1166
1166
|
u("div", so, [
|
|
1167
|
-
a.$slots.label ? ve(a.$slots, "label", { key: 0 }, void 0, !0) : (g(),
|
|
1167
|
+
a.$slots.label ? ve(a.$slots, "label", { key: 0 }, void 0, !0) : (g(), B(N, {
|
|
1168
1168
|
key: 1,
|
|
1169
1169
|
label: a.label
|
|
1170
1170
|
}, null, 8, ["label"]))
|
|
1171
1171
|
]),
|
|
1172
1172
|
u("div", {
|
|
1173
|
-
class:
|
|
1173
|
+
class: G([[
|
|
1174
1174
|
a.contentClass ? a.contentClass : "w-full h-full",
|
|
1175
1175
|
{
|
|
1176
1176
|
"fm-droppable-field__container--dragging": n.value,
|
|
1177
|
-
"fm-droppable-field__container--invalid":
|
|
1177
|
+
"fm-droppable-field__container--invalid": O.value && !a.disabled,
|
|
1178
1178
|
"fm-droppable-field__container--disabled": a.disabled
|
|
1179
1179
|
}
|
|
1180
1180
|
], "fm-droppable-field__container"]),
|
|
1181
|
-
onDragenter:
|
|
1181
|
+
onDragenter: x,
|
|
1182
1182
|
onDragleave: b,
|
|
1183
1183
|
onDragover: i,
|
|
1184
1184
|
onDrop: d
|
|
1185
1185
|
}, [
|
|
1186
|
-
(n.value ||
|
|
1186
|
+
(n.value || O.value) && !a.disabled ? (g(), D("div", {
|
|
1187
1187
|
key: 0,
|
|
1188
|
-
class:
|
|
1188
|
+
class: G({
|
|
1189
1189
|
"fm-typo-en-body-lg-600": !0,
|
|
1190
1190
|
"text-fm-color-primary": n.value,
|
|
1191
|
-
"text-fm-color-typo-error":
|
|
1191
|
+
"text-fm-color-typo-error": O.value
|
|
1192
1192
|
})
|
|
1193
|
-
},
|
|
1193
|
+
}, q(le.value), 3)) : (g(), B(ie, {
|
|
1194
1194
|
key: 1,
|
|
1195
1195
|
disabled: a.disabled,
|
|
1196
1196
|
label: a.buttonLabel ?? "Add files",
|
|
@@ -1200,21 +1200,21 @@ const lo = {
|
|
|
1200
1200
|
ve(a.$slots, "accept-text", {}, () => [
|
|
1201
1201
|
p.accept ? (g(), D("div", {
|
|
1202
1202
|
key: 0,
|
|
1203
|
-
class:
|
|
1204
|
-
},
|
|
1203
|
+
class: G([[a.disabled ? "text-fm-color-typo-disabled" : "text-fm-color-typo-secondary"], "fm-typo-en-body-md-400"])
|
|
1204
|
+
}, q(`Accepts ${p.accept}`), 3)) : W("", !0)
|
|
1205
1205
|
], !0),
|
|
1206
1206
|
u("input", {
|
|
1207
1207
|
accept: a.accept,
|
|
1208
1208
|
disabled: a.disabled,
|
|
1209
1209
|
class: "fm-droppable-field__input",
|
|
1210
1210
|
type: "file",
|
|
1211
|
-
onChange:
|
|
1211
|
+
onChange: K
|
|
1212
1212
|
}, null, 40, ro)
|
|
1213
1213
|
], 34),
|
|
1214
1214
|
ve(a.$slots, "helper-text", {}, () => [
|
|
1215
1215
|
u("div", {
|
|
1216
|
-
class:
|
|
1217
|
-
},
|
|
1216
|
+
class: G([[a.disabled ? "text-fm-color-typo-disabled" : "text-fm-color-typo-secondary"], "fm-typo-en-body-sm-400"])
|
|
1217
|
+
}, q(`Max size ${p.maxFileSize * 1e-6}mb`), 3)
|
|
1218
1218
|
], !0)
|
|
1219
1219
|
], !0)
|
|
1220
1220
|
], 512);
|
|
@@ -1233,24 +1233,24 @@ const lo = {
|
|
|
1233
1233
|
},
|
|
1234
1234
|
setup(s) {
|
|
1235
1235
|
return (r, p) => {
|
|
1236
|
-
const o =
|
|
1236
|
+
const o = S("FmIcon"), n = S("FmTooltip");
|
|
1237
1237
|
return g(), D("div", co, [
|
|
1238
1238
|
mo,
|
|
1239
1239
|
u("div", po, [
|
|
1240
1240
|
u("div", fo, [
|
|
1241
1241
|
u("div", {
|
|
1242
|
-
class:
|
|
1242
|
+
class: G({
|
|
1243
1243
|
"text-fm-color-system-error-300": r.errors.length
|
|
1244
1244
|
})
|
|
1245
1245
|
}, [
|
|
1246
|
-
Pe(
|
|
1247
|
-
r.type === "create" ? (g(), D("span", vo, "(new)")) :
|
|
1246
|
+
Pe(q(r.name) + " ", 1),
|
|
1247
|
+
r.type === "create" ? (g(), D("span", vo, "(new)")) : W("", !0)
|
|
1248
1248
|
], 2),
|
|
1249
1249
|
r.errors.length ? (g(), D("div", yo, [
|
|
1250
1250
|
y(n, { "z-index": 50 }, {
|
|
1251
1251
|
content: I(() => [
|
|
1252
1252
|
u("ol", null, [
|
|
1253
|
-
(g(!0), D(
|
|
1253
|
+
(g(!0), D(Z, null, ce(r.errors, (l, c) => (g(), D("li", { key: c }, q(l), 1))), 128))
|
|
1254
1254
|
])
|
|
1255
1255
|
]),
|
|
1256
1256
|
default: I(() => [
|
|
@@ -1262,17 +1262,17 @@ const lo = {
|
|
|
1262
1262
|
]),
|
|
1263
1263
|
_: 1
|
|
1264
1264
|
})
|
|
1265
|
-
])) :
|
|
1265
|
+
])) : W("", !0)
|
|
1266
1266
|
]),
|
|
1267
1267
|
u("div", {
|
|
1268
|
-
class:
|
|
1268
|
+
class: G([
|
|
1269
1269
|
"fm-typo-en-body-sm-400",
|
|
1270
1270
|
{
|
|
1271
1271
|
"text-fm-color-system-error-200": r.errors.length,
|
|
1272
1272
|
"text-fm-color-typo-secondary": !r.errors.length
|
|
1273
1273
|
}
|
|
1274
1274
|
])
|
|
1275
|
-
},
|
|
1275
|
+
}, q(r.code), 3)
|
|
1276
1276
|
])
|
|
1277
1277
|
]);
|
|
1278
1278
|
};
|
|
@@ -1286,9 +1286,9 @@ const lo = {
|
|
|
1286
1286
|
}, Co = /* @__PURE__ */ u("div", { class: "fm-typo-en-body-lg-600" }, "Summary", -1), So = /* @__PURE__ */ oe({
|
|
1287
1287
|
__name: "ImportIngredients",
|
|
1288
1288
|
setup(s) {
|
|
1289
|
-
const r =
|
|
1289
|
+
const r = T(null), p = ot(), o = be(), n = T(!1), l = T(new Array()), c = T([]), f = T([]), x = k(
|
|
1290
1290
|
() => !!l.value.length || c.value.some((d) => d.errors.length) || f.value.some((d) => d.errors.length)
|
|
1291
|
-
), i =
|
|
1291
|
+
), i = k(
|
|
1292
1292
|
() => !!c.value.length || !!f.value.length
|
|
1293
1293
|
);
|
|
1294
1294
|
async function b(d) {
|
|
@@ -1298,16 +1298,16 @@ const lo = {
|
|
|
1298
1298
|
const [v] = await Promise.all([
|
|
1299
1299
|
yt(d),
|
|
1300
1300
|
// fake buffer
|
|
1301
|
-
new Promise((
|
|
1302
|
-
]), A = v.SheetNames.find((
|
|
1301
|
+
new Promise((w) => setTimeout(w, 2e3))
|
|
1302
|
+
]), A = v.SheetNames.find((w) => w);
|
|
1303
1303
|
if (!A) {
|
|
1304
1304
|
l.value = ["No sheet is found in the excel file."], o.open({
|
|
1305
1305
|
title: "No sheet is found in the excel file."
|
|
1306
1306
|
});
|
|
1307
1307
|
return;
|
|
1308
1308
|
}
|
|
1309
|
-
const
|
|
1310
|
-
c.value =
|
|
1309
|
+
const F = no(v.Sheets[A]);
|
|
1310
|
+
c.value = F.importCreateResult, f.value = F.importUpdateResult, !c.value.length && !f.value.length && l.value.push("No import data is available in the excel file."), p.emitData(F);
|
|
1311
1311
|
} catch (v) {
|
|
1312
1312
|
o.open({
|
|
1313
1313
|
title: "Unable to read file",
|
|
@@ -1321,45 +1321,45 @@ const lo = {
|
|
|
1321
1321
|
return Te(r, (d) => {
|
|
1322
1322
|
d && b(d);
|
|
1323
1323
|
}), (d, v) => {
|
|
1324
|
-
const A =
|
|
1324
|
+
const A = S("FmCircularProgress"), F = S("FmIcon"), w = S("FmButton");
|
|
1325
1325
|
return g(), D("div", go, [
|
|
1326
1326
|
bo,
|
|
1327
1327
|
y(uo, {
|
|
1328
|
-
class:
|
|
1328
|
+
class: G({
|
|
1329
1329
|
"w-full": !0,
|
|
1330
1330
|
"h-[200px]": !r.value
|
|
1331
1331
|
}),
|
|
1332
1332
|
accept: ".xlsx",
|
|
1333
|
-
onFileUpload: v[0] || (v[0] = (
|
|
1333
|
+
onFileUpload: v[0] || (v[0] = (M) => r.value = M),
|
|
1334
1334
|
label: "Upload template",
|
|
1335
1335
|
"button-label": "Select file"
|
|
1336
|
-
},
|
|
1336
|
+
}, qe({ _: 2 }, [
|
|
1337
1337
|
r.value ? {
|
|
1338
1338
|
name: "default",
|
|
1339
|
-
fn: I(({ openFileDialog:
|
|
1339
|
+
fn: I(({ openFileDialog: M }) => [
|
|
1340
1340
|
u("div", _o, [
|
|
1341
1341
|
u("div", {
|
|
1342
|
-
class:
|
|
1342
|
+
class: G([
|
|
1343
1343
|
"fm-corner-radius-md p-16 flex items-center gap-16",
|
|
1344
1344
|
{
|
|
1345
1345
|
"border border-fm-color-neutral-gray-100": n.value,
|
|
1346
|
-
"border border-fm-color-neutral-gray-200": !n.value && !
|
|
1347
|
-
"border border-fm-color-system-error-200":
|
|
1346
|
+
"border border-fm-color-neutral-gray-200": !n.value && !x.value,
|
|
1347
|
+
"border border-fm-color-system-error-200": x.value
|
|
1348
1348
|
}
|
|
1349
1349
|
])
|
|
1350
1350
|
}, [
|
|
1351
|
-
n.value ? (g(),
|
|
1351
|
+
n.value ? (g(), B(A, {
|
|
1352
1352
|
key: 0,
|
|
1353
1353
|
size: "md",
|
|
1354
1354
|
color: "neutral-gray-200"
|
|
1355
|
-
})) : (g(),
|
|
1355
|
+
})) : (g(), B(F, {
|
|
1356
1356
|
key: 1,
|
|
1357
|
-
name:
|
|
1357
|
+
name: x.value ? "error" : "attach_file",
|
|
1358
1358
|
outline: "",
|
|
1359
|
-
color:
|
|
1359
|
+
color: x.value ? "system-error-300" : void 0
|
|
1360
1360
|
}, null, 8, ["name", "color"])),
|
|
1361
1361
|
u("div", {
|
|
1362
|
-
class:
|
|
1362
|
+
class: G([
|
|
1363
1363
|
"fm-typo-en-body-md-400 flex-1 h-[36px] flex items-center",
|
|
1364
1364
|
{
|
|
1365
1365
|
"text-fm-color-typo-disabled": n.value,
|
|
@@ -1367,30 +1367,30 @@ const lo = {
|
|
|
1367
1367
|
}
|
|
1368
1368
|
])
|
|
1369
1369
|
}, [
|
|
1370
|
-
u("div", ho,
|
|
1370
|
+
u("div", ho, q(r.value.name), 1)
|
|
1371
1371
|
], 2),
|
|
1372
|
-
n.value ?
|
|
1373
|
-
y(
|
|
1372
|
+
n.value ? W("", !0) : (g(), D("div", xo, [
|
|
1373
|
+
y(w, {
|
|
1374
1374
|
label: "Replace file",
|
|
1375
|
-
variant:
|
|
1376
|
-
"prepend-icon":
|
|
1377
|
-
onClick:
|
|
1375
|
+
variant: x.value ? "destructive" : "secondary",
|
|
1376
|
+
"prepend-icon": x.value ? void 0 : "autorenew",
|
|
1377
|
+
onClick: M
|
|
1378
1378
|
}, null, 8, ["variant", "prepend-icon", "onClick"])
|
|
1379
1379
|
]))
|
|
1380
1380
|
], 2),
|
|
1381
1381
|
l.value.length ? (g(), D("div", Vo, [
|
|
1382
|
-
(g(!0), D(
|
|
1383
|
-
key:
|
|
1382
|
+
(g(!0), D(Z, null, ce(l.value, (P, V) => (g(), D("div", {
|
|
1383
|
+
key: V,
|
|
1384
1384
|
class: "flex gap-8 items-center"
|
|
1385
1385
|
}, [
|
|
1386
|
-
y(
|
|
1386
|
+
y(F, {
|
|
1387
1387
|
name: "error",
|
|
1388
1388
|
size: "sm",
|
|
1389
1389
|
color: "system-error-300"
|
|
1390
1390
|
}),
|
|
1391
|
-
u("div", ko,
|
|
1391
|
+
u("div", ko, q(P), 1)
|
|
1392
1392
|
]))), 128))
|
|
1393
|
-
])) :
|
|
1393
|
+
])) : W("", !0)
|
|
1394
1394
|
])
|
|
1395
1395
|
]),
|
|
1396
1396
|
key: "0"
|
|
@@ -1398,43 +1398,43 @@ const lo = {
|
|
|
1398
1398
|
]), 1032, ["class"]),
|
|
1399
1399
|
i.value ? (g(), D("div", Fo, [
|
|
1400
1400
|
Co,
|
|
1401
|
-
(g(!0), D(
|
|
1402
|
-
key:
|
|
1403
|
-
code:
|
|
1404
|
-
name:
|
|
1405
|
-
errors:
|
|
1401
|
+
(g(!0), D(Z, null, ce(c.value, (M) => (g(), B(Ee, {
|
|
1402
|
+
key: M.sku._id,
|
|
1403
|
+
code: M.sku.code,
|
|
1404
|
+
name: M.sku.name,
|
|
1405
|
+
errors: M.errors,
|
|
1406
1406
|
type: "create"
|
|
1407
1407
|
}, null, 8, ["code", "name", "errors"]))), 128)),
|
|
1408
|
-
(g(!0), D(
|
|
1409
|
-
key:
|
|
1410
|
-
code:
|
|
1411
|
-
name:
|
|
1412
|
-
errors:
|
|
1408
|
+
(g(!0), D(Z, null, ce(f.value, (M) => (g(), B(Ee, {
|
|
1409
|
+
key: M.sku._id,
|
|
1410
|
+
code: M.sku.code,
|
|
1411
|
+
name: M.sku.name,
|
|
1412
|
+
errors: M.errors,
|
|
1413
1413
|
type: "update"
|
|
1414
1414
|
}, null, 8, ["code", "name", "errors"]))), 128))
|
|
1415
|
-
])) :
|
|
1415
|
+
])) : W("", !0)
|
|
1416
1416
|
]);
|
|
1417
1417
|
};
|
|
1418
1418
|
}
|
|
1419
1419
|
}), wo = { class: "px-24 xs:p-0 sm:p-0 flex flex-col gap-8 max-h-full" }, Mo = { class: "px-8 flex items-center xs:gap-0 xs:flex-col-reverse sm:gap-0 sm:flex-col-reverse" }, $o = { class: "flex-1 w-full" }, Io = { class: "flex flex-col py-8" }, Ro = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Uo = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, qo = /* @__PURE__ */ oe({
|
|
1420
1420
|
__name: "IngredientsView",
|
|
1421
1421
|
setup(s) {
|
|
1422
|
-
const r = ne(), p =
|
|
1422
|
+
const r = ne(), p = k(() => r.skus), o = tt(), n = ze(), l = be(), {
|
|
1423
1423
|
createIngredient: c,
|
|
1424
1424
|
updateIngredient: f,
|
|
1425
|
-
deleteIngredient:
|
|
1425
|
+
deleteIngredient: x,
|
|
1426
1426
|
ingredientDialogProps: i,
|
|
1427
1427
|
ingredientViewLoading: b
|
|
1428
|
-
} = bt(), { columnDefs: d } = _t({ updateIngredient: f, deleteIngredient:
|
|
1428
|
+
} = bt(), { columnDefs: d } = _t({ updateIngredient: f, deleteIngredient: x });
|
|
1429
1429
|
function v(R) {
|
|
1430
1430
|
switch (R) {
|
|
1431
1431
|
case "add":
|
|
1432
1432
|
return c();
|
|
1433
1433
|
case "import":
|
|
1434
|
-
return
|
|
1434
|
+
return N();
|
|
1435
1435
|
}
|
|
1436
1436
|
}
|
|
1437
|
-
const A =
|
|
1437
|
+
const A = T(""), F = T(!1), w = k(() => F.value || b.value), { breakpoints: M } = nt(), P = k(() => M.value.xs || M.value.sm), V = k(() => P.value ? 10 : 20), le = it(), O = T(!1), K = [
|
|
1438
1438
|
{
|
|
1439
1439
|
value: "import",
|
|
1440
1440
|
label: "Import"
|
|
@@ -1445,24 +1445,24 @@ const lo = {
|
|
|
1445
1445
|
}
|
|
1446
1446
|
];
|
|
1447
1447
|
function ae(R) {
|
|
1448
|
-
switch (
|
|
1448
|
+
switch (O.value = !1, R) {
|
|
1449
1449
|
case "import":
|
|
1450
|
-
return O();
|
|
1451
|
-
case "export":
|
|
1452
1450
|
return N();
|
|
1451
|
+
case "export":
|
|
1452
|
+
return z();
|
|
1453
1453
|
}
|
|
1454
1454
|
}
|
|
1455
|
-
const
|
|
1455
|
+
const Q = k(() => P.value ? [
|
|
1456
1456
|
{ label: "More", icon: "more_vert", key: "more" }
|
|
1457
1457
|
] : [
|
|
1458
1458
|
{ label: "Export", icon: "ios_share", key: "export" }
|
|
1459
|
-
]), a =
|
|
1459
|
+
]), a = k(() => {
|
|
1460
1460
|
const R = [
|
|
1461
1461
|
{ label: "Add ingredient", value: "add", isPrimary: !0, prependIcon: "add" }
|
|
1462
1462
|
];
|
|
1463
|
-
return
|
|
1463
|
+
return P.value ? R : [...R, { label: "Import", value: "import" }];
|
|
1464
1464
|
});
|
|
1465
|
-
function
|
|
1465
|
+
function z() {
|
|
1466
1466
|
const R = eo();
|
|
1467
1467
|
l.open({
|
|
1468
1468
|
title: "Ingredients exported",
|
|
@@ -1470,7 +1470,7 @@ const lo = {
|
|
|
1470
1470
|
type: "success"
|
|
1471
1471
|
});
|
|
1472
1472
|
}
|
|
1473
|
-
function
|
|
1473
|
+
function N() {
|
|
1474
1474
|
n.open({
|
|
1475
1475
|
title: "Import ingredients",
|
|
1476
1476
|
contentComponent: So,
|
|
@@ -1505,7 +1505,7 @@ const lo = {
|
|
|
1505
1505
|
});
|
|
1506
1506
|
return;
|
|
1507
1507
|
}
|
|
1508
|
-
if (R.importCreateResult.some((
|
|
1508
|
+
if (R.importCreateResult.some((h) => h.errors.length) || R.importUpdateResult.some((h) => h.errors.length)) {
|
|
1509
1509
|
l.open({
|
|
1510
1510
|
title: "Invalid content",
|
|
1511
1511
|
message: "There is error in the import data.",
|
|
@@ -1517,38 +1517,34 @@ const lo = {
|
|
|
1517
1517
|
}).onTertiary(to);
|
|
1518
1518
|
}
|
|
1519
1519
|
async function ie(R) {
|
|
1520
|
-
|
|
1521
|
-
R.importUpdateResult.map((E) => E.sku),
|
|
1522
|
-
"code"
|
|
1523
|
-
);
|
|
1524
|
-
k.value = !0;
|
|
1520
|
+
F.value = !0;
|
|
1525
1521
|
try {
|
|
1526
1522
|
await Promise.all([
|
|
1527
1523
|
r.importSkus({
|
|
1528
|
-
create: R.importCreateResult.map((
|
|
1529
|
-
update:
|
|
1524
|
+
create: R.importCreateResult.map((h) => h.sku),
|
|
1525
|
+
update: R.importUpdateResult.map((h) => h.sku)
|
|
1530
1526
|
}),
|
|
1531
|
-
new Promise((
|
|
1527
|
+
new Promise((h) => setTimeout(h, 2e3))
|
|
1532
1528
|
]), l.open({
|
|
1533
1529
|
title: "Ingredients successfully imported",
|
|
1534
1530
|
type: "success"
|
|
1535
1531
|
});
|
|
1536
|
-
} catch (
|
|
1532
|
+
} catch (h) {
|
|
1537
1533
|
l.open({
|
|
1538
1534
|
title: "Failed to import ingredients",
|
|
1539
|
-
message: `System message: ${
|
|
1535
|
+
message: `System message: ${h == null ? void 0 : h.message}`,
|
|
1540
1536
|
type: "error"
|
|
1541
|
-
}), console.error("Error in importing skus", R,
|
|
1537
|
+
}), console.error("Error in importing skus", R, h);
|
|
1542
1538
|
} finally {
|
|
1543
|
-
|
|
1539
|
+
F.value = !1;
|
|
1544
1540
|
}
|
|
1545
1541
|
}
|
|
1546
|
-
function
|
|
1547
|
-
|
|
1542
|
+
function ee() {
|
|
1543
|
+
O.value = !0;
|
|
1548
1544
|
}
|
|
1549
|
-
return (R,
|
|
1550
|
-
const
|
|
1551
|
-
return g(),
|
|
1545
|
+
return (R, h) => {
|
|
1546
|
+
const te = S("FmTableToolbar"), _e = S("FmTable"), pe = S("FmCollapsibleTabs"), t = S("FmBottomSheet");
|
|
1547
|
+
return g(), B(ut, {
|
|
1552
1548
|
title: "Ingredient",
|
|
1553
1549
|
actions: a.value,
|
|
1554
1550
|
"onClick:action": v
|
|
@@ -1557,44 +1553,44 @@ const lo = {
|
|
|
1557
1553
|
u("div", wo, [
|
|
1558
1554
|
u("div", Mo, [
|
|
1559
1555
|
u("div", $o, [
|
|
1560
|
-
y(
|
|
1556
|
+
y(te, {
|
|
1561
1557
|
searchable: "",
|
|
1562
1558
|
"search-model": A.value,
|
|
1563
|
-
"onUpdate:searchModel":
|
|
1564
|
-
actions:
|
|
1565
|
-
"onClick:actionExport":
|
|
1566
|
-
"onClick:actionImport":
|
|
1567
|
-
"onClick:actionMore":
|
|
1559
|
+
"onUpdate:searchModel": h[0] || (h[0] = (e) => A.value = e),
|
|
1560
|
+
actions: Q.value,
|
|
1561
|
+
"onClick:actionExport": h[1] || (h[1] = () => z()),
|
|
1562
|
+
"onClick:actionImport": h[2] || (h[2] = () => N()),
|
|
1563
|
+
"onClick:actionMore": h[3] || (h[3] = () => ee())
|
|
1568
1564
|
}, null, 8, ["search-model", "actions"])
|
|
1569
1565
|
])
|
|
1570
1566
|
]),
|
|
1571
1567
|
y(_e, {
|
|
1572
|
-
style:
|
|
1573
|
-
"column-defs":
|
|
1568
|
+
style: Ke(C(le).tableHeight),
|
|
1569
|
+
"column-defs": C(d),
|
|
1574
1570
|
"row-data": p.value,
|
|
1575
1571
|
"search-value": A.value,
|
|
1576
|
-
loading: !
|
|
1577
|
-
onRowClick:
|
|
1578
|
-
"page-size":
|
|
1572
|
+
loading: !C(o)._currentLocation || w.value,
|
|
1573
|
+
onRowClick: h[4] || (h[4] = (e) => C(f)(e.original)),
|
|
1574
|
+
"page-size": V.value
|
|
1579
1575
|
}, {
|
|
1580
1576
|
"list-row": I((e) => [
|
|
1581
1577
|
y(rt, {
|
|
1582
1578
|
row: e,
|
|
1583
|
-
onRowClick:
|
|
1579
|
+
onRowClick: C(f)
|
|
1584
1580
|
}, {
|
|
1585
1581
|
default: I((m) => {
|
|
1586
|
-
var _, U, $,
|
|
1582
|
+
var _, U, $, L, j, X, fe, ue, se, de;
|
|
1587
1583
|
return [
|
|
1588
1584
|
u("div", Io, [
|
|
1589
1585
|
u("div", Ro, [
|
|
1590
|
-
y(
|
|
1586
|
+
y(C(Ae), {
|
|
1591
1587
|
render: ($ = (U = (_ = m.code) == null ? void 0 : _.column) == null ? void 0 : U.columnDef) == null ? void 0 : $.cell,
|
|
1592
|
-
props: (
|
|
1588
|
+
props: (j = (L = m.code) == null ? void 0 : L.getContext) == null ? void 0 : j.call(L)
|
|
1593
1589
|
}, null, 8, ["render", "props"])
|
|
1594
1590
|
]),
|
|
1595
1591
|
u("div", Uo, [
|
|
1596
|
-
y(
|
|
1597
|
-
render: (ue = (fe = (
|
|
1592
|
+
y(C(Ae), {
|
|
1593
|
+
render: (ue = (fe = (X = m.name) == null ? void 0 : X.column) == null ? void 0 : fe.columnDef) == null ? void 0 : ue.cell,
|
|
1598
1594
|
props: (de = (se = m.name) == null ? void 0 : se.getContext) == null ? void 0 : de.call(se)
|
|
1599
1595
|
}, null, 8, ["render", "props"])
|
|
1600
1596
|
])
|
|
@@ -1607,20 +1603,20 @@ const lo = {
|
|
|
1607
1603
|
_: 1
|
|
1608
1604
|
}, 8, ["style", "column-defs", "row-data", "search-value", "loading", "page-size"])
|
|
1609
1605
|
]),
|
|
1610
|
-
(g(),
|
|
1611
|
-
y(qt, Qe(
|
|
1606
|
+
(g(), B(Me, { to: "body" }, [
|
|
1607
|
+
y(qt, Je(Qe(C(i))), null, 16)
|
|
1612
1608
|
])),
|
|
1613
|
-
(g(),
|
|
1609
|
+
(g(), B(Me, { to: "body" }, [
|
|
1614
1610
|
y(t, {
|
|
1615
1611
|
"dismiss-away": "",
|
|
1616
|
-
modelValue:
|
|
1617
|
-
"onUpdate:modelValue":
|
|
1612
|
+
modelValue: O.value,
|
|
1613
|
+
"onUpdate:modelValue": h[6] || (h[6] = (e) => O.value = e)
|
|
1618
1614
|
}, {
|
|
1619
1615
|
default: I(() => [
|
|
1620
1616
|
y(pe, {
|
|
1621
1617
|
class: "pb-8",
|
|
1622
|
-
items:
|
|
1623
|
-
"onUpdate:modelValue":
|
|
1618
|
+
items: K,
|
|
1619
|
+
"onUpdate:modelValue": h[5] || (h[5] = (e) => ae(e))
|
|
1624
1620
|
})
|
|
1625
1621
|
]),
|
|
1626
1622
|
_: 1
|