@feedmepos/mf-inventory-portal 0.0.17-dev.8 → 0.0.18-dev.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ApprovalView-DyazMoIY.js +118 -0
- package/dist/{BindingsDialog-DS7lMkEA.js → BindingsDialog-D-p9eOMP.js} +2 -2
- package/dist/{BindingsPicker-Cy9WuCSS.js → BindingsPicker-C_kuxqQI.js} +2 -2
- package/dist/BindingsTable-jgL5-FZc.js +147 -0
- package/dist/FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-DLc1nCIY.js +268 -0
- package/dist/{FmMultiselectDialog.vue_vue_type_script_setup_true_lang-BtovUKzb.js → FmMultiselectDialog.vue_vue_type_script_setup_true_lang-D2Cg0s16.js} +2 -2
- package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-Bjc23m-U.js → FmUnitInput.vue_vue_type_script_setup_true_lang-FMI-Bp6y.js} +12 -12
- package/dist/{IngredientsView-D8xhcF7w.js → IngredientsView-DnIHe3Gj.js} +639 -629
- package/dist/{IntegrationView-C3zmrMpE.js → IntegrationView-CgYnK7JB.js} +260 -266
- package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-svRwQNr1.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-BObjqgU-.js} +6 -6
- package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-NtrraPyQ.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-DClJGGeY.js} +1 -1
- package/dist/{PurchaseOrderPrintPreview-WSetqLLT.js → PurchaseOrderPrintPreview-Vbmche3y.js} +1 -1
- package/dist/ReceiveRequestView-CpRdJQuN.js +1394 -0
- package/dist/{RecipeView-95YCqNqL.js → RecipeView-Do3LgdfI.js} +182 -190
- package/dist/StockView-C16AHdmT.js +1862 -0
- package/dist/SupplierView-DGQXU4Ha.js +796 -0
- package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-Dw94RCtz.js → TransferDetails.vue_vue_type_script_setup_true_lang-DK5gzjwS.js} +21 -20
- package/dist/{UnitView-BsqSIZug.js → UnitView-AfEMV9Qr.js} +129 -133
- package/dist/{WarehouseView-Op_5Qk3F.js → WarehouseView-Cph8wrcF.js} +260 -264
- package/dist/api/inventory.d.ts +3 -0
- package/dist/app-UpgZo4xX.js +66113 -0
- package/dist/app.js +1 -1
- package/dist/array-AvWd53LI.js +30 -0
- package/dist/components/FmInventoryTableToolbar.vue.d.ts +53 -0
- package/dist/components/inventory-binding/InventoryBinding.vue.d.ts +1 -0
- package/dist/components/shell/inventory/binding-ui.vue.d.ts +1 -0
- package/dist/date2-BfOl_Gio.js +95 -0
- package/dist/dayjs.min-r5rPIQFX.js +282 -0
- package/dist/{decimal-Db6V5YuK.js → decimal-CTa5OWKK.js} +1 -1
- package/dist/extensions/array.d.ts +1 -0
- package/dist/{fuzzy-W0aq7cB9.js → fuzzy-0FMA9raY.js} +1 -1
- package/dist/{dayjs.min-uQtxxLfb.js → index-D9a9wXgJ.js} +3627 -3377
- package/dist/{layout-DJ9o2NRD.js → layout-DxcK0DGS.js} +1 -1
- package/dist/number-BSqhQaRy.js +97 -0
- package/dist/{rules-CkxtFlBm.js → rules-7WxBNkDE.js} +16 -15
- package/dist/stock-estimate-hfECAKZK.js +122 -0
- package/dist/stores/inventory.d.ts +4 -0
- package/dist/{supplier-CCKg4iLI.js → supplier-Dg3f6Ybw.js} +1 -1
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/{use-inventory-binding-dialog-CMw2fESH.js → use-inventory-binding-dialog-NLy01qAo.js} +2 -2
- package/dist/views/ingredients/IngredientsView.vue.d.ts +1 -0
- package/dist/views/ingredients/components/ingredient-form/IngredientForm.vue.d.ts +2 -0
- package/dist/views/ingredients/composables/use-ingredient-table.d.ts +1 -0
- package/dist/views/receive-request/components/transfer-form/TransferForm.vue.d.ts +5 -0
- package/dist/views/receive-request/composables/use-receive-request-form.d.ts +4 -0
- package/dist/views/receive-request/composables/use-receive-request-table.d.ts +12 -0
- package/dist/views/stock/components/dialog/AdjustedItemForm.vue.d.ts +4 -2
- package/dist/views/stock/helper/compute-summary-total.d.ts +2 -2
- package/dist/{xlsx-DZh41VsU.js → xlsx-qSY56eID.js} +1 -1
- package/dist/{xlsx.util-CiVxc4oN.js → xlsx.util-DL8p0Kzi.js} +2 -2
- package/package.json +5 -4
- package/dist/ApprovalView-aWF8FbAj.js +0 -134
- package/dist/BindingsTable-Dp5U_jYF.js +0 -121
- package/dist/ChangeLocationComponent.vue_vue_type_script_setup_true_lang-BY83bHSG.js +0 -97
- package/dist/ReceiveRequestView-VEZl69h8.js +0 -1435
- package/dist/SingleColumnLayout.vue_vue_type_script_setup_true_lang-Dov3Uq2z.js +0 -64
- package/dist/StockView-Ca9rtp7i.js +0 -1960
- package/dist/SupplierView-CHW93HW1.js +0 -804
- package/dist/app-BShd7PJF.js +0 -42889
- package/dist/components/FmTableToolbar.vue.d.ts +0 -49
- package/dist/date2-Cj6ya-vU.js +0 -189
- package/dist/init-date-range-D4tmP_jf.js +0 -21
- package/dist/stock-estimate-kcRPsgG_.js +0 -145
|
@@ -1,40 +1,42 @@
|
|
|
1
|
-
import { ref as
|
|
2
|
-
import { u as ne, c as
|
|
3
|
-
import { useDialog as
|
|
1
|
+
import { ref as P, defineComponent as oe, computed as k, resolveComponent as $, openBlock as g, createBlock as B, withCtx as I, createVNode as y, createElementBlock as E, Fragment as ee, createElementVNode as u, createCommentVNode as z, onMounted as qe, watch as Pe, unref as w, normalizeClass as K, createTextVNode as Te, toDisplayString as G, renderList as me, isRef as we, renderSlot as ve, createSlots as Be, normalizeStyle as Ke, Teleport as Me, normalizeProps as Je, guardReactiveProps as Qe } from "vue";
|
|
2
|
+
import { u as ne, c as Le, S as Xe, g as ge, F as Q, d as $e, a as ze, C as be, b as Ie, e as Ze, _ as et, f as tt } from "./app-UpgZo4xX.js";
|
|
3
|
+
import { useDialog as Ne, useSnackbar as he, useProxiedModel as Ue, 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 Ee, u as it } from "./layout-
|
|
7
|
-
import { _ as ut } from "./
|
|
8
|
-
import { R as
|
|
9
|
-
import { g as
|
|
10
|
-
import { _ as
|
|
11
|
-
import { _ as
|
|
12
|
-
import { a as
|
|
13
|
-
import { useCoreStore as
|
|
14
|
-
import { _ as
|
|
5
|
+
import { F as W, D as Re, R as ye } from "./row-action.enum-BwQbURNh.js";
|
|
6
|
+
import { c as st, _ as rt, F as Ee, u as it } from "./layout-DxcK0DGS.js";
|
|
7
|
+
import { _ as ut, a as dt } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-DLc1nCIY.js";
|
|
8
|
+
import { R as _e, U as ct, A as xe, M as mt, I as pt } from "./rules-7WxBNkDE.js";
|
|
9
|
+
import { g as ft, _ as Ve, S as ke } from "./StockForecast.vue_vue_type_style_index_0_lang-B5EK101t.js";
|
|
10
|
+
import { _ as vt } from "./InventoryBindingForm.vue_vue_type_script_setup_true_lang-BObjqgU-.js";
|
|
11
|
+
import { _ as Fe, t as Oe, d as He, s as yt, r as gt } from "./xlsx.util-DL8p0Kzi.js";
|
|
12
|
+
import { a as je, t as Ye } from "./number-BSqhQaRy.js";
|
|
13
|
+
import { useCoreStore as pe } from "@feedmepos/mf-common";
|
|
14
|
+
import { _ as Ce } from "./PreviewBadge.vue_vue_type_script_setup_true_lang-BvadeWUz.js";
|
|
15
|
+
import { f as ht } from "./date2-BfOl_Gio.js";
|
|
16
|
+
import "./array-AvWd53LI.js";
|
|
15
17
|
function bt() {
|
|
16
|
-
const r =
|
|
18
|
+
const r = Ne(), a = he(), p = ne(), o = P(!1), n = P();
|
|
17
19
|
function l() {
|
|
18
20
|
const i = {
|
|
19
21
|
unit: {},
|
|
20
|
-
mode:
|
|
22
|
+
mode: W.CREATE,
|
|
21
23
|
show: !0,
|
|
22
|
-
"onUpdate:show"(
|
|
23
|
-
n.value.show =
|
|
24
|
+
"onUpdate:show"(b) {
|
|
25
|
+
n.value.show = b;
|
|
24
26
|
}
|
|
25
27
|
};
|
|
26
28
|
n.value = i;
|
|
27
29
|
}
|
|
28
30
|
async function d(i) {
|
|
29
|
-
const
|
|
30
|
-
unit:
|
|
31
|
-
mode:
|
|
31
|
+
const b = {
|
|
32
|
+
unit: Le(i),
|
|
33
|
+
mode: W.UPDATE,
|
|
32
34
|
show: !0,
|
|
33
35
|
"onUpdate:show"(c) {
|
|
34
36
|
n.value.show = c;
|
|
35
37
|
}
|
|
36
38
|
};
|
|
37
|
-
n.value =
|
|
39
|
+
n.value = b;
|
|
38
40
|
}
|
|
39
41
|
async function v(i) {
|
|
40
42
|
o.value = !0;
|
|
@@ -44,23 +46,23 @@ function bt() {
|
|
|
44
46
|
message: `Deleted ${i.name}`,
|
|
45
47
|
type: "success"
|
|
46
48
|
});
|
|
47
|
-
} catch (
|
|
48
|
-
|
|
49
|
+
} catch (b) {
|
|
50
|
+
b instanceof Xe && lt(b) ? r.open({
|
|
49
51
|
title: "Cannot delete ingredient",
|
|
50
52
|
contentComponent: at,
|
|
51
53
|
contentComponentProps: {
|
|
52
54
|
subject: (i == null ? void 0 : i.name) ?? "",
|
|
53
|
-
items:
|
|
55
|
+
items: b.errorResponse.message
|
|
54
56
|
},
|
|
55
57
|
secondaryActions: {
|
|
56
58
|
text: "Close",
|
|
57
59
|
close: !0
|
|
58
60
|
}
|
|
59
|
-
}) : console.log("unable to delete ingredient",
|
|
61
|
+
}) : console.log("unable to delete ingredient", b), a.open({
|
|
60
62
|
title: `Cannot delete ${i.name}`,
|
|
61
63
|
message: "Please try again.",
|
|
62
64
|
type: "error"
|
|
63
|
-
}), console.error("failed to delete ingredient",
|
|
65
|
+
}), console.error("failed to delete ingredient", b);
|
|
64
66
|
} finally {
|
|
65
67
|
o.value = !1;
|
|
66
68
|
}
|
|
@@ -89,12 +91,12 @@ function bt() {
|
|
|
89
91
|
ingredientViewLoading: o
|
|
90
92
|
};
|
|
91
93
|
}
|
|
92
|
-
function
|
|
94
|
+
function _t({
|
|
93
95
|
updateIngredient: r,
|
|
94
96
|
deleteIngredient: a
|
|
95
97
|
}) {
|
|
96
98
|
async function p(n, l) {
|
|
97
|
-
const d =
|
|
99
|
+
const d = Le(l);
|
|
98
100
|
if (n === ye.Edit) {
|
|
99
101
|
await r(d);
|
|
100
102
|
return;
|
|
@@ -138,7 +140,7 @@ function ht({
|
|
|
138
140
|
header: "",
|
|
139
141
|
cell(n) {
|
|
140
142
|
return st(
|
|
141
|
-
[
|
|
143
|
+
[Re[ye.Edit], Re[ye.Delete]],
|
|
142
144
|
(l) => {
|
|
143
145
|
p(l, n.row.original);
|
|
144
146
|
}
|
|
@@ -153,7 +155,7 @@ function ht({
|
|
|
153
155
|
}
|
|
154
156
|
] };
|
|
155
157
|
}
|
|
156
|
-
const
|
|
158
|
+
const xt = /* @__PURE__ */ oe({
|
|
157
159
|
__name: "ConvertForm",
|
|
158
160
|
props: {
|
|
159
161
|
modelValue: {},
|
|
@@ -162,13 +164,13 @@ const _t = /* @__PURE__ */ oe({
|
|
|
162
164
|
},
|
|
163
165
|
emits: ["update:modelValue"],
|
|
164
166
|
setup(r, { emit: a }) {
|
|
165
|
-
const p = r, o =
|
|
167
|
+
const p = r, o = k(() => {
|
|
166
168
|
var c;
|
|
167
169
|
return (c = p.rootValue) == null ? void 0 : c.unit;
|
|
168
|
-
}), n =
|
|
170
|
+
}), n = k(() => {
|
|
169
171
|
var c;
|
|
170
172
|
return (c = p.rootValue) == null ? void 0 : c._id;
|
|
171
|
-
}), l = a, d =
|
|
173
|
+
}), l = a, d = k({
|
|
172
174
|
get() {
|
|
173
175
|
return !!p.modelValue;
|
|
174
176
|
},
|
|
@@ -178,7 +180,7 @@ const _t = /* @__PURE__ */ oe({
|
|
|
178
180
|
inventoryBindings: []
|
|
179
181
|
}) : l("update:modelValue", null);
|
|
180
182
|
}
|
|
181
|
-
}), v =
|
|
183
|
+
}), v = k(() => ft(o.value));
|
|
182
184
|
function _(c) {
|
|
183
185
|
const f = p.modelValue ?? {};
|
|
184
186
|
f.measurement = c ? `${c}` : null, l("update:modelValue", f);
|
|
@@ -187,44 +189,44 @@ const _t = /* @__PURE__ */ oe({
|
|
|
187
189
|
const f = p.modelValue ?? {};
|
|
188
190
|
f.inventoryBindings = c, l("update:modelValue", f);
|
|
189
191
|
}
|
|
190
|
-
const
|
|
192
|
+
const b = k(() => {
|
|
191
193
|
if (!p.modelValue) return null;
|
|
192
194
|
const c = p.modelValue;
|
|
193
195
|
return c.measurement ? v.value.find((f) => f.value === c.measurement) ?? null : v.value.find((f) => f.value === null) ?? null;
|
|
194
196
|
});
|
|
195
197
|
return (c, f) => {
|
|
196
|
-
const
|
|
197
|
-
return g(), B(
|
|
198
|
+
const D = $("FmSwitch"), x = $("FmSelect"), F = $("FmCard");
|
|
199
|
+
return g(), B(F, {
|
|
198
200
|
variant: "outlined",
|
|
199
201
|
class: "p-16 flex flex-col gap-16"
|
|
200
202
|
}, {
|
|
201
|
-
default:
|
|
202
|
-
var
|
|
203
|
+
default: I(() => {
|
|
204
|
+
var C, T;
|
|
203
205
|
return [
|
|
204
|
-
y(
|
|
206
|
+
y(D, {
|
|
205
207
|
value: "",
|
|
206
208
|
"model-value": d.value,
|
|
207
|
-
"onUpdate:modelValue": f[0] || (f[0] = (
|
|
209
|
+
"onUpdate:modelValue": f[0] || (f[0] = (V) => d.value = V),
|
|
208
210
|
label: "Convertible",
|
|
209
211
|
sublabel: "Convertible from other recipe or ingredients",
|
|
210
212
|
labelPlacement: "right"
|
|
211
213
|
}, null, 8, ["model-value"]),
|
|
212
|
-
d.value ? (g(), E(
|
|
214
|
+
d.value ? (g(), E(ee, { key: 0 }, [
|
|
213
215
|
u("div", null, [
|
|
214
|
-
y(
|
|
216
|
+
y(x, {
|
|
215
217
|
label: "Recipes and ingredients convert to",
|
|
216
|
-
modelValue: (
|
|
218
|
+
modelValue: (C = b.value) == null ? void 0 : C.value,
|
|
217
219
|
"onUpdate:modelValue": _,
|
|
218
220
|
items: v.value
|
|
219
221
|
}, null, 8, ["modelValue", "items"])
|
|
220
222
|
]),
|
|
221
|
-
y(
|
|
223
|
+
y(vt, {
|
|
222
224
|
id: n.value,
|
|
223
|
-
"model-value": ((
|
|
225
|
+
"model-value": ((T = c.modelValue) == null ? void 0 : T.inventoryBindings) ?? [],
|
|
224
226
|
"onUpdate:modelValue": i,
|
|
225
227
|
"exclude-binding-id": n.value
|
|
226
228
|
}, null, 8, ["id", "model-value", "exclude-binding-id"])
|
|
227
|
-
], 64)) :
|
|
229
|
+
], 64)) : z("", !0)
|
|
228
230
|
];
|
|
229
231
|
}),
|
|
230
232
|
_: 1
|
|
@@ -232,16 +234,16 @@ const _t = /* @__PURE__ */ oe({
|
|
|
232
234
|
};
|
|
233
235
|
}
|
|
234
236
|
});
|
|
235
|
-
function
|
|
237
|
+
function ue() {
|
|
236
238
|
return {
|
|
237
239
|
low: 6,
|
|
238
240
|
mid: 14
|
|
239
241
|
};
|
|
240
242
|
}
|
|
241
|
-
const
|
|
242
|
-
key:
|
|
243
|
+
const Vt = { class: "text-fm-color-typo-secondary" }, kt = { class: "text-fm-color-typo-secondary whitespace-nowrap" }, Ft = { class: "col-span-2 mt-16" }, Ct = {
|
|
244
|
+
key: 2,
|
|
243
245
|
class: "col-span-2 mt-16 border-1 border-fm-color-neutral-gray-200 fm-corner-radius-lg flex flex-col p-16 gap-16"
|
|
244
|
-
},
|
|
246
|
+
}, St = { class: "col-span-2 flex flex-col gap-12" }, wt = { class: "flex flex-col gap-4" }, Mt = /* @__PURE__ */ u("div", { class: "fm-typo-en-title-sm-800" }, "Alert threshold", -1), $t = /* @__PURE__ */ u("div", { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, " Configure threshold for days remaining indicator in the stock balance page. ", -1), It = { class: "col-span-2 flex flex-col gap-4" }, Ut = { class: "flex fm-corner-radius-md border-1 border-fm-color-neutral-gray-200" }, Rt = { class: "flex-1 p-12 flex flex-col gap-8" }, Et = { class: "mx-auto" }, Dt = { class: "flex flex-col" }, At = /* @__PURE__ */ u("div", { class: "fm-typo-en-body-sm-600 translate-y-4" }, "When remaining", -1), Pt = /* @__PURE__ */ u("div", {
|
|
245
247
|
class: "text-fm-color-typo-secondary",
|
|
246
248
|
style: { "padding-right": "32px" }
|
|
247
249
|
}, "days", -1), Tt = /* @__PURE__ */ u("div", {
|
|
@@ -252,10 +254,10 @@ const xt = { class: "text-fm-color-typo-secondary" }, Vt = { class: "text-fm-col
|
|
|
252
254
|
class: "absolute bg-white",
|
|
253
255
|
style: { transform: "translate(-50%, -50%)", left: "50%", top: "20%" }
|
|
254
256
|
}, " < ")
|
|
255
|
-
], -1),
|
|
257
|
+
], -1), Bt = { class: "flex-1 p-12 flex flex-col gap-8" }, Lt = { class: "mx-auto" }, zt = { class: "flex flex-col" }, Nt = /* @__PURE__ */ u("div", { class: "fm-typo-en-body-sm-600 translate-y-4" }, "When remaining", -1), Ot = /* @__PURE__ */ u("div", {
|
|
256
258
|
class: "text-fm-color-typo-secondary",
|
|
257
259
|
style: { "padding-right": "32px" }
|
|
258
|
-
}, "days", -1),
|
|
260
|
+
}, "days", -1), Ht = /* @__PURE__ */ u("div", {
|
|
259
261
|
class: "h-full bg-fm-color-neutral-gray-200 relative",
|
|
260
262
|
style: { width: "1px" }
|
|
261
263
|
}, [
|
|
@@ -263,9 +265,9 @@ const xt = { class: "text-fm-color-typo-secondary" }, Vt = { class: "text-fm-col
|
|
|
263
265
|
class: "absolute bg-white",
|
|
264
266
|
style: { transform: "translate(-50%, -50%)", left: "50%", top: "20%" }
|
|
265
267
|
}, " < ")
|
|
266
|
-
], -1),
|
|
268
|
+
], -1), jt = { class: "flex-1 p-12 flex flex-col gap-8" }, Yt = { class: "mx-auto" }, Wt = /* @__PURE__ */ u("div", { class: "flex flex-col" }, [
|
|
267
269
|
/* @__PURE__ */ u("div", { class: "fm-typo-en-body-sm-600 translate-y-4" }, "Stock is staple")
|
|
268
|
-
], -1),
|
|
270
|
+
], -1), Gt = /* @__PURE__ */ oe({
|
|
269
271
|
__name: "IngredientForm",
|
|
270
272
|
props: {
|
|
271
273
|
mode: {},
|
|
@@ -274,356 +276,340 @@ const xt = { class: "text-fm-color-typo-secondary" }, Vt = { class: "text-fm-col
|
|
|
274
276
|
},
|
|
275
277
|
emits: ["update:modelValue", "click:submit"],
|
|
276
278
|
setup(r, { expose: a, emit: p }) {
|
|
277
|
-
var
|
|
278
|
-
const o = r, n = p, l = ne(), d =
|
|
279
|
-
function _(
|
|
280
|
-
if (
|
|
281
|
-
const
|
|
282
|
-
unit: l.units.find((
|
|
279
|
+
var re;
|
|
280
|
+
const o = r, n = p, l = ne(), d = pe(), v = ze();
|
|
281
|
+
function _(e) {
|
|
282
|
+
if (e.length === 0) return;
|
|
283
|
+
const t = e[0], m = o.modelValue ?? {
|
|
284
|
+
unit: l.units.find((h) => h)
|
|
283
285
|
};
|
|
284
|
-
m.unit || (m.unit =
|
|
286
|
+
m.unit || (m.unit = t, n("update:modelValue", m));
|
|
285
287
|
}
|
|
286
|
-
|
|
288
|
+
qe(() => {
|
|
287
289
|
_(l.units);
|
|
288
|
-
}),
|
|
289
|
-
_(
|
|
290
|
+
}), Pe([() => l.units], ([e]) => {
|
|
291
|
+
_(e);
|
|
290
292
|
});
|
|
291
293
|
function i() {
|
|
292
294
|
n("click:submit");
|
|
293
295
|
}
|
|
294
|
-
const
|
|
296
|
+
const b = k({
|
|
295
297
|
get() {
|
|
296
|
-
var
|
|
297
|
-
return ((
|
|
298
|
+
var e;
|
|
299
|
+
return ((e = o.modelValue) == null ? void 0 : e.code) ?? "";
|
|
298
300
|
},
|
|
299
|
-
set(
|
|
300
|
-
const
|
|
301
|
+
set(e) {
|
|
302
|
+
const t = o.modelValue ? {
|
|
301
303
|
...o.modelValue
|
|
302
304
|
} : {};
|
|
303
|
-
|
|
305
|
+
t.code = e, n("update:modelValue", t);
|
|
304
306
|
}
|
|
305
|
-
}), c =
|
|
307
|
+
}), c = k({
|
|
306
308
|
get() {
|
|
307
|
-
var
|
|
308
|
-
return ((
|
|
309
|
+
var e;
|
|
310
|
+
return ((e = o.modelValue) == null ? void 0 : e.name) ?? "";
|
|
309
311
|
},
|
|
310
|
-
set(
|
|
311
|
-
const
|
|
312
|
+
set(e) {
|
|
313
|
+
const t = o.modelValue ? {
|
|
312
314
|
...o.modelValue
|
|
313
315
|
} : {};
|
|
314
|
-
|
|
316
|
+
t.name = e, n("update:modelValue", t);
|
|
315
317
|
}
|
|
316
|
-
}), f =
|
|
318
|
+
}), f = k({
|
|
317
319
|
get() {
|
|
318
|
-
var
|
|
319
|
-
const
|
|
320
|
-
return
|
|
320
|
+
var t, m;
|
|
321
|
+
const e = (m = (t = o.modelValue) == null ? void 0 : t.defaultCost) == null ? void 0 : m.costPerUnit;
|
|
322
|
+
return e ? +je(e) : 0;
|
|
321
323
|
},
|
|
322
|
-
set(
|
|
323
|
-
var m,
|
|
324
|
-
const
|
|
324
|
+
set(e) {
|
|
325
|
+
var m, h, R, S;
|
|
326
|
+
const t = o.modelValue ? {
|
|
325
327
|
...o.modelValue
|
|
326
328
|
} : {};
|
|
327
|
-
|
|
329
|
+
t.defaultCost ?? (t.defaultCost = {
|
|
328
330
|
costPerUnit: {
|
|
329
331
|
amount: 0,
|
|
330
332
|
precision: 2,
|
|
331
333
|
currency: ((m = ge(d.currentCountry.value)) == null ? void 0 : m.currency) ?? "MYR"
|
|
332
334
|
},
|
|
333
|
-
measurement: (
|
|
334
|
-
(
|
|
335
|
-
var
|
|
336
|
-
return
|
|
335
|
+
measurement: (S = (R = (h = o.modelValue) == null ? void 0 : h.unit) == null ? void 0 : R.measurements) == null ? void 0 : S.find(
|
|
336
|
+
(H) => {
|
|
337
|
+
var j;
|
|
338
|
+
return H.id === ((j = o.modelValue) == null ? void 0 : j.trackingMeasurement);
|
|
337
339
|
}
|
|
338
340
|
)
|
|
339
|
-
}),
|
|
340
|
-
...
|
|
341
|
-
...
|
|
342
|
-
}, n("update:modelValue",
|
|
341
|
+
}), t.defaultCost.costPerUnit = {
|
|
342
|
+
...t.defaultCost.costPerUnit,
|
|
343
|
+
...Ye(+e, 4)
|
|
344
|
+
}, n("update:modelValue", t);
|
|
343
345
|
}
|
|
344
|
-
}),
|
|
345
|
-
var
|
|
346
|
-
const
|
|
347
|
-
return
|
|
348
|
-
_id:
|
|
346
|
+
}), D = k(() => {
|
|
347
|
+
var t, m, h;
|
|
348
|
+
const e = ((t = o.modelValue) == null ? void 0 : t.unit) ?? l.units.find((R) => R);
|
|
349
|
+
return e ? {
|
|
350
|
+
_id: e._id,
|
|
349
351
|
measurement: (m = o.modelValue) == null ? void 0 : m.trackingMeasurement,
|
|
350
|
-
name: ((
|
|
351
|
-
var
|
|
352
|
-
return
|
|
353
|
-
})) == null ? void 0 :
|
|
352
|
+
name: ((h = e.measurements.find((R) => {
|
|
353
|
+
var S;
|
|
354
|
+
return R.id === ((S = o.modelValue) == null ? void 0 : S.trackingMeasurement);
|
|
355
|
+
})) == null ? void 0 : h.name) ?? e.name
|
|
354
356
|
} : null;
|
|
355
|
-
}),
|
|
356
|
-
() => l.units.flatMap(({ name:
|
|
357
|
+
}), x = k(
|
|
358
|
+
() => l.units.flatMap(({ name: e, _id: t, abbrev: m, measurements: h }) => [
|
|
357
359
|
{
|
|
358
|
-
label: `${
|
|
360
|
+
label: `${e}`,
|
|
359
361
|
value: null,
|
|
360
362
|
displayAsSection: !0
|
|
361
363
|
},
|
|
362
364
|
{
|
|
363
|
-
label: `${
|
|
364
|
-
value: { _id:
|
|
365
|
+
label: `${e} (${m})`,
|
|
366
|
+
value: { _id: t },
|
|
365
367
|
displayAsSection: !1
|
|
366
368
|
},
|
|
367
|
-
...
|
|
368
|
-
label: `${
|
|
369
|
-
value: { _id:
|
|
369
|
+
...h.map(({ id: R, name: S, abbrev: H }) => ({
|
|
370
|
+
label: `${S} (${H})`,
|
|
371
|
+
value: { _id: t, measurement: R },
|
|
370
372
|
displayAsSection: !1
|
|
371
373
|
}))
|
|
372
374
|
])
|
|
373
375
|
);
|
|
374
|
-
function
|
|
375
|
-
var
|
|
376
|
-
return ((m = (
|
|
376
|
+
function F(e) {
|
|
377
|
+
var t, m, h, R, S;
|
|
378
|
+
return ((m = (t = o.modelValue) == null ? void 0 : t.unit) == null ? void 0 : m._id) === ((h = e.value) == null ? void 0 : h._id) && ((R = o.modelValue) == null ? void 0 : R.trackingMeasurement) === ((S = e.value) == null ? void 0 : S.measurement);
|
|
377
379
|
}
|
|
378
|
-
function
|
|
379
|
-
var
|
|
380
|
-
if (!
|
|
381
|
-
const { _id:
|
|
382
|
-
if (!
|
|
380
|
+
function C(e) {
|
|
381
|
+
var H, j;
|
|
382
|
+
if (!e) return;
|
|
383
|
+
const { _id: t, measurement: m } = e, h = m || void 0, R = l.units.find((Z) => Z._id === t);
|
|
384
|
+
if (!R)
|
|
383
385
|
return;
|
|
384
|
-
const
|
|
385
|
-
|
|
386
|
-
measurement:
|
|
386
|
+
const S = o.modelValue ?? {};
|
|
387
|
+
S.unit = R, S.trackingMeasurement = h, S.convert && (S.convert.measurement = h || null), v.enableTotalCost && (S.defaultCost = {
|
|
388
|
+
measurement: R.measurements.find((Z) => Z.id === h),
|
|
387
389
|
costPerUnit: {
|
|
388
|
-
...((
|
|
390
|
+
...((H = S.defaultCost) == null ? void 0 : H.costPerUnit) ?? {
|
|
389
391
|
amount: 0,
|
|
390
392
|
precision: 2,
|
|
391
|
-
currency: ((
|
|
393
|
+
currency: ((j = ge(d.currentCountry.value)) == null ? void 0 : j.currency) ?? "MYR"
|
|
392
394
|
}
|
|
393
395
|
}
|
|
394
|
-
}), n("update:modelValue",
|
|
396
|
+
}), n("update:modelValue", S);
|
|
395
397
|
}
|
|
396
|
-
const
|
|
398
|
+
const T = k({
|
|
397
399
|
get() {
|
|
398
|
-
var
|
|
399
|
-
return ((
|
|
400
|
+
var e;
|
|
401
|
+
return ((e = o.modelValue) == null ? void 0 : e.convert) ?? null;
|
|
400
402
|
},
|
|
401
|
-
set(
|
|
402
|
-
const
|
|
403
|
+
set(e) {
|
|
404
|
+
const t = o.modelValue ? {
|
|
403
405
|
...o.modelValue
|
|
404
406
|
} : {};
|
|
405
|
-
|
|
407
|
+
e ? t.convert = e : t.convert = null, n("update:modelValue", t);
|
|
406
408
|
}
|
|
407
|
-
}),
|
|
408
|
-
(
|
|
409
|
-
).map((
|
|
410
|
-
function
|
|
409
|
+
}), V = k(() => Q.options.filter(
|
|
410
|
+
(e) => e === Q.enum.FIFO || e === Q.enum.WAVG
|
|
411
|
+
).map((e) => {
|
|
412
|
+
function t(m) {
|
|
411
413
|
switch (m) {
|
|
412
|
-
case
|
|
414
|
+
case Q.enum.WAVG:
|
|
413
415
|
return "Weighted Average (WAVG)";
|
|
414
|
-
case
|
|
416
|
+
case Q.enum.FIFO:
|
|
415
417
|
return "First In First Out (FIFO)";
|
|
416
|
-
case
|
|
418
|
+
case Q.enum.LIFO:
|
|
417
419
|
return "Last In First Out (LIFO)";
|
|
418
|
-
case
|
|
420
|
+
case Q.enum.FEFO:
|
|
419
421
|
return "First Expired First Out (FEFO)";
|
|
420
422
|
}
|
|
421
423
|
return "";
|
|
422
424
|
}
|
|
423
425
|
return {
|
|
424
|
-
label: e
|
|
425
|
-
value:
|
|
426
|
+
label: t(e),
|
|
427
|
+
value: e
|
|
426
428
|
};
|
|
427
|
-
})), le =
|
|
429
|
+
})), le = k({
|
|
428
430
|
get() {
|
|
429
|
-
var
|
|
430
|
-
return ((
|
|
431
|
+
var e;
|
|
432
|
+
return ((e = o.modelValue) == null ? void 0 : e.valuation) ?? "WAVG";
|
|
431
433
|
},
|
|
432
|
-
set(
|
|
433
|
-
const
|
|
434
|
+
set(e) {
|
|
435
|
+
const t = o.modelValue ? {
|
|
434
436
|
...o.modelValue
|
|
435
437
|
} : {};
|
|
436
|
-
|
|
438
|
+
t.valuation = e, n("update:modelValue", t);
|
|
437
439
|
}
|
|
438
|
-
}),
|
|
440
|
+
}), N = P();
|
|
439
441
|
a({
|
|
440
442
|
validateInputs: () => {
|
|
441
|
-
var
|
|
442
|
-
(
|
|
443
|
+
var e, t;
|
|
444
|
+
(t = (e = N.value) == null ? void 0 : e.validateInputs) == null || t.call(e);
|
|
443
445
|
},
|
|
444
446
|
resetInputsValidation: () => {
|
|
445
|
-
var
|
|
446
|
-
(
|
|
447
|
+
var e, t;
|
|
448
|
+
(t = (e = N.value) == null ? void 0 : e.resetInputsValidation) == null || t.call(e);
|
|
447
449
|
},
|
|
448
450
|
resetInputs: () => {
|
|
449
|
-
var
|
|
450
|
-
(
|
|
451
|
+
var e, t;
|
|
452
|
+
(t = (e = N.value) == null ? void 0 : e.resetInputs) == null || t.call(e);
|
|
451
453
|
}
|
|
452
454
|
});
|
|
453
|
-
const
|
|
455
|
+
const q = P(!1), ae = k(
|
|
454
456
|
() => {
|
|
455
|
-
var
|
|
456
|
-
return (
|
|
457
|
-
(
|
|
457
|
+
var e, t, m;
|
|
458
|
+
return (e = o.modelValue) != null && e._id ? ((m = l.menu.bindedBySkuId[(t = o.modelValue) == null ? void 0 : t._id]) == null ? void 0 : m.filter(
|
|
459
|
+
(h) => h.from === "INGREDIENT"
|
|
458
460
|
)) ?? [] : [];
|
|
459
461
|
}
|
|
460
|
-
),
|
|
462
|
+
), X = k(
|
|
461
463
|
() => {
|
|
462
|
-
var
|
|
463
|
-
return (
|
|
464
|
-
(
|
|
464
|
+
var e, t, m;
|
|
465
|
+
return (e = o.modelValue) != null && e._id ? ((m = l.menu.bindedBySkuId[(t = o.modelValue) == null ? void 0 : t._id]) == null ? void 0 : m.filter(
|
|
466
|
+
(h) => h.from === "RECIPE"
|
|
465
467
|
)) ?? [] : [];
|
|
466
468
|
}
|
|
467
|
-
), s =
|
|
469
|
+
), s = k(
|
|
468
470
|
() => {
|
|
469
|
-
var
|
|
470
|
-
return (
|
|
471
|
+
var e, t, m;
|
|
472
|
+
return (e = o.modelValue) != null && e._id ? ((m = l.menu.bindedBySkuId[(t = o.modelValue) == null ? void 0 : t._id]) == null ? void 0 : m.filter((h) => h.from === "MENU")) ?? [] : [];
|
|
471
473
|
}
|
|
472
|
-
),
|
|
473
|
-
() => l.skus.map((
|
|
474
|
-
),
|
|
475
|
-
function
|
|
474
|
+
), L = k(
|
|
475
|
+
() => l.skus.map((e) => ({ label: e.name, value: e.code }))
|
|
476
|
+
), O = P((re = o.modelValue) == null ? void 0 : re.code);
|
|
477
|
+
function de(e) {
|
|
476
478
|
var m;
|
|
477
|
-
const
|
|
478
|
-
|
|
479
|
+
const t = e.el;
|
|
480
|
+
t && ((m = t.querySelector("[x-should-scroll-into=true]")) == null || m.scrollIntoView());
|
|
479
481
|
}
|
|
480
|
-
function
|
|
481
|
-
switch (
|
|
482
|
-
case
|
|
482
|
+
function te(e) {
|
|
483
|
+
switch (e) {
|
|
484
|
+
case be.MY:
|
|
483
485
|
return "MYR";
|
|
484
|
-
case
|
|
486
|
+
case be.SG:
|
|
485
487
|
return "SGD";
|
|
486
|
-
case
|
|
488
|
+
case be.ID:
|
|
487
489
|
return "IDR";
|
|
488
490
|
default:
|
|
489
491
|
return "MYR";
|
|
490
492
|
}
|
|
491
493
|
}
|
|
492
|
-
const
|
|
494
|
+
const U = k(
|
|
493
495
|
() => {
|
|
494
|
-
var
|
|
495
|
-
return ((
|
|
496
|
-
(
|
|
497
|
-
var
|
|
498
|
-
return
|
|
496
|
+
var e, t, m, h, R, S;
|
|
497
|
+
return ((h = (m = (t = (e = o.modelValue) == null ? void 0 : e.unit) == null ? void 0 : t.measurements) == null ? void 0 : m.find(
|
|
498
|
+
(H) => {
|
|
499
|
+
var j;
|
|
500
|
+
return H.id === ((j = o.modelValue) == null ? void 0 : j.trackingMeasurement);
|
|
499
501
|
}
|
|
500
|
-
)) == null ? void 0 :
|
|
502
|
+
)) == null ? void 0 : h.abbrev) ?? ((S = (R = o.modelValue) == null ? void 0 : R.unit) == null ? void 0 : S.abbrev);
|
|
501
503
|
}
|
|
502
|
-
),
|
|
504
|
+
), M = k({
|
|
503
505
|
get() {
|
|
504
|
-
var
|
|
505
|
-
return ((
|
|
506
|
+
var e, t;
|
|
507
|
+
return ((t = (e = o.modelValue) == null ? void 0 : e.thresholds) == null ? void 0 : t.low) ?? ue().low;
|
|
506
508
|
},
|
|
507
|
-
set(
|
|
508
|
-
var
|
|
509
|
-
const
|
|
510
|
-
|
|
509
|
+
set(e) {
|
|
510
|
+
var h;
|
|
511
|
+
const t = ((h = o.modelValue) == null ? void 0 : h.thresholds) ?? ue();
|
|
512
|
+
t.low = e;
|
|
511
513
|
const m = o.modelValue ? {
|
|
512
514
|
...o.modelValue
|
|
513
515
|
} : {};
|
|
514
|
-
m.thresholds =
|
|
516
|
+
m.thresholds = t, n("update:modelValue", m);
|
|
515
517
|
}
|
|
516
|
-
}),
|
|
518
|
+
}), J = k({
|
|
517
519
|
get() {
|
|
518
|
-
var
|
|
519
|
-
return ((
|
|
520
|
+
var e, t;
|
|
521
|
+
return ((t = (e = o.modelValue) == null ? void 0 : e.thresholds) == null ? void 0 : t.mid) ?? ue().mid;
|
|
520
522
|
},
|
|
521
|
-
set(
|
|
522
|
-
var
|
|
523
|
-
const
|
|
524
|
-
|
|
523
|
+
set(e) {
|
|
524
|
+
var h;
|
|
525
|
+
const t = ((h = o.modelValue) == null ? void 0 : h.thresholds) ?? ue();
|
|
526
|
+
t.mid = e;
|
|
525
527
|
const m = o.modelValue ? {
|
|
526
528
|
...o.modelValue
|
|
527
529
|
} : {};
|
|
528
|
-
m.thresholds =
|
|
530
|
+
m.thresholds = t, n("update:modelValue", m);
|
|
529
531
|
}
|
|
530
532
|
});
|
|
531
|
-
function
|
|
532
|
-
return function(
|
|
533
|
-
return typeof (
|
|
533
|
+
function se() {
|
|
534
|
+
return function(t) {
|
|
535
|
+
return typeof (t == null ? void 0 : t.low) != "number" || typeof (t == null ? void 0 : t.mid) != "number" ? "Required" : t.low >= t.mid ? "Days for red indicator should be less than yellow indicator." : !0;
|
|
534
536
|
};
|
|
535
537
|
}
|
|
536
|
-
return (
|
|
537
|
-
const m =
|
|
538
|
-
return g(), B(
|
|
539
|
-
disabled:
|
|
538
|
+
return (e, t) => {
|
|
539
|
+
const m = $("FmTextField"), h = $("FmLabel"), R = $("FmField"), S = $("FmMenuHeader"), H = $("FmMenuDivider"), j = $("FmMenuItem"), Z = $("FmMenu"), ce = $("FmFormGroup"), ie = $("FmSelect"), fe = $("FmSwitch"), Se = $("FmStepperField"), Ge = $("FmForm");
|
|
540
|
+
return g(), B(Ge, {
|
|
541
|
+
disabled: e.disabled,
|
|
540
542
|
ref_key: "formRef",
|
|
541
|
-
ref:
|
|
543
|
+
ref: N,
|
|
542
544
|
class: "grid grid-cols-2 gap-24",
|
|
543
545
|
onValidationSuccess: i
|
|
544
546
|
}, {
|
|
545
|
-
default:
|
|
547
|
+
default: I(() => [
|
|
546
548
|
y(m, {
|
|
547
549
|
label: "Code",
|
|
548
|
-
"model-value":
|
|
549
|
-
"onUpdate:modelValue":
|
|
550
|
-
rules: [w(
|
|
550
|
+
"model-value": b.value,
|
|
551
|
+
"onUpdate:modelValue": t[0] || (t[0] = (A) => b.value = A),
|
|
552
|
+
rules: [w(_e)(), w(ct)(L.value, O.value)],
|
|
551
553
|
"label-mark": "required"
|
|
552
554
|
}, null, 8, ["model-value", "rules"]),
|
|
553
555
|
y(m, {
|
|
554
556
|
label: "Name",
|
|
555
557
|
"model-value": c.value,
|
|
556
|
-
"onUpdate:modelValue":
|
|
557
|
-
rules: [w(
|
|
558
|
+
"onUpdate:modelValue": t[1] || (t[1] = (A) => c.value = A),
|
|
559
|
+
rules: [w(_e)()],
|
|
558
560
|
"label-mark": "required"
|
|
559
561
|
}, null, 8, ["model-value", "rules"]),
|
|
560
|
-
y(
|
|
562
|
+
y(ce, {
|
|
561
563
|
class: "col-span-2",
|
|
562
|
-
"model-value":
|
|
563
|
-
|
|
564
|
-
items: k.value
|
|
565
|
-
}, {
|
|
566
|
-
label: $(() => [
|
|
567
|
-
y(Se, { "z-index": 50 }, {
|
|
568
|
-
default: $(() => [
|
|
569
|
-
y(b, { label: "Valuation Method" })
|
|
570
|
-
]),
|
|
571
|
-
_: 1
|
|
572
|
-
})
|
|
573
|
-
]),
|
|
574
|
-
_: 1
|
|
575
|
-
}, 8, ["model-value", "items"]),
|
|
576
|
-
y(ue, {
|
|
577
|
-
class: G([w(v).enableTotalCost ? "col-span-1" : "col-span-2"]),
|
|
578
|
-
"model-value": A.value,
|
|
579
|
-
rules: [w(xe)()],
|
|
564
|
+
"model-value": D.value,
|
|
565
|
+
rules: [w(_e)()],
|
|
580
566
|
"label-mark": "required"
|
|
581
567
|
}, {
|
|
582
|
-
label:
|
|
583
|
-
y(
|
|
568
|
+
label: I(() => [
|
|
569
|
+
y(h, { label: "Unit" })
|
|
584
570
|
]),
|
|
585
|
-
default:
|
|
586
|
-
y(
|
|
587
|
-
"menu-button":
|
|
588
|
-
y(
|
|
589
|
-
class:
|
|
571
|
+
default: I(({ invalid: A }) => [
|
|
572
|
+
y(Z, null, {
|
|
573
|
+
"menu-button": I(() => [
|
|
574
|
+
y(R, {
|
|
575
|
+
class: K([
|
|
590
576
|
"fm-typo-en-body-lg-400",
|
|
591
577
|
{
|
|
592
|
-
"text-fm-color-typo-primary": !
|
|
593
|
-
"text-fm-color-typo-disabled":
|
|
578
|
+
"text-fm-color-typo-primary": !e.disabled,
|
|
579
|
+
"text-fm-color-typo-disabled": e.disabled
|
|
594
580
|
}
|
|
595
581
|
]),
|
|
596
|
-
invalid:
|
|
582
|
+
invalid: A,
|
|
597
583
|
"append-icon": "expand_more"
|
|
598
584
|
}, {
|
|
599
|
-
default:
|
|
600
|
-
var
|
|
585
|
+
default: I(() => {
|
|
586
|
+
var Y;
|
|
601
587
|
return [
|
|
602
|
-
|
|
588
|
+
Te(G((Y = D.value) == null ? void 0 : Y.name), 1)
|
|
603
589
|
];
|
|
604
590
|
}),
|
|
605
591
|
_: 2
|
|
606
592
|
}, 1032, ["class", "invalid"])
|
|
607
593
|
]),
|
|
608
|
-
default:
|
|
594
|
+
default: I(() => [
|
|
609
595
|
u("div", {
|
|
610
596
|
class: "overflow-x-hidden overflow-y-auto max-h-[300px]",
|
|
611
|
-
onVnodeMounted:
|
|
597
|
+
onVnodeMounted: de
|
|
612
598
|
}, [
|
|
613
|
-
(g(!0), E(
|
|
614
|
-
key:
|
|
599
|
+
(g(!0), E(ee, null, me(x.value, (Y) => (g(), E(ee, {
|
|
600
|
+
key: Y.label
|
|
615
601
|
}, [
|
|
616
|
-
|
|
617
|
-
y(
|
|
618
|
-
label:
|
|
602
|
+
Y.displayAsSection ? (g(), E(ee, { key: 0 }, [
|
|
603
|
+
y(S, {
|
|
604
|
+
label: Y.label
|
|
619
605
|
}, null, 8, ["label"]),
|
|
620
606
|
y(H)
|
|
621
|
-
], 64)) : (g(), B(
|
|
607
|
+
], 64)) : (g(), B(j, {
|
|
622
608
|
key: 1,
|
|
623
|
-
label:
|
|
624
|
-
"model-value":
|
|
625
|
-
onClick: (Eo) =>
|
|
626
|
-
"x-should-scroll-into": `${
|
|
609
|
+
label: Y.label,
|
|
610
|
+
"model-value": F(Y),
|
|
611
|
+
onClick: (Eo) => C(Y.value),
|
|
612
|
+
"x-should-scroll-into": `${F(Y)}`
|
|
627
613
|
}, null, 8, ["label", "model-value", "onClick", "x-should-scroll-into"]))
|
|
628
614
|
], 64))), 128))
|
|
629
615
|
], 512)
|
|
@@ -632,132 +618,149 @@ const xt = { class: "text-fm-color-typo-secondary" }, Vt = { class: "text-fm-col
|
|
|
632
618
|
}, 1024)
|
|
633
619
|
]),
|
|
634
620
|
_: 1
|
|
635
|
-
}, 8, ["
|
|
636
|
-
w(v).enableTotalCost ? (g(), B(
|
|
621
|
+
}, 8, ["model-value", "rules"]),
|
|
622
|
+
w(v).enableTotalCost ? (g(), B(ie, {
|
|
637
623
|
key: 0,
|
|
624
|
+
class: "col-span-1",
|
|
625
|
+
"model-value": le.value,
|
|
626
|
+
"onUpdate:modelValue": t[2] || (t[2] = (A) => le.value = A),
|
|
627
|
+
items: V.value
|
|
628
|
+
}, {
|
|
629
|
+
label: I(() => [
|
|
630
|
+
y(Ce, { "z-index": 50 }, {
|
|
631
|
+
default: I(() => [
|
|
632
|
+
y(h, { label: "Valuation Method" })
|
|
633
|
+
]),
|
|
634
|
+
_: 1
|
|
635
|
+
})
|
|
636
|
+
]),
|
|
637
|
+
_: 1
|
|
638
|
+
}, 8, ["model-value", "items"])) : z("", !0),
|
|
639
|
+
w(v).enableTotalCost ? (g(), B(m, {
|
|
640
|
+
key: 1,
|
|
638
641
|
"model-value": f.value,
|
|
639
|
-
"onUpdate:modelValue":
|
|
640
|
-
rules: [w(
|
|
642
|
+
"onUpdate:modelValue": t[3] || (t[3] = (A) => f.value = A),
|
|
643
|
+
rules: [w(xe)(0), w(mt)(2)]
|
|
641
644
|
}, {
|
|
642
|
-
label:
|
|
643
|
-
y(
|
|
644
|
-
default:
|
|
645
|
-
y(
|
|
645
|
+
label: I(() => [
|
|
646
|
+
y(Ce, { "z-index": 50 }, {
|
|
647
|
+
default: I(() => [
|
|
648
|
+
y(h, { label: "Price per unit" })
|
|
646
649
|
]),
|
|
647
650
|
_: 1
|
|
648
651
|
})
|
|
649
652
|
]),
|
|
650
|
-
prepend:
|
|
651
|
-
var
|
|
653
|
+
prepend: I(() => {
|
|
654
|
+
var A, Y;
|
|
652
655
|
return [
|
|
653
|
-
u("div",
|
|
656
|
+
u("div", Vt, G(te(((A = w(d).currentCountry) == null ? void 0 : A.value) ?? w($e)) === "MYR" ? "RM" : te(((Y = w(d).currentCountry) == null ? void 0 : Y.value) ?? w($e))), 1)
|
|
654
657
|
];
|
|
655
658
|
}),
|
|
656
|
-
append:
|
|
657
|
-
u("div",
|
|
659
|
+
append: I(() => [
|
|
660
|
+
u("div", kt, " / " + G(U.value), 1)
|
|
658
661
|
]),
|
|
659
662
|
_: 1
|
|
660
|
-
}, 8, ["model-value", "rules"])) :
|
|
661
|
-
u("div",
|
|
662
|
-
y(
|
|
663
|
-
"model-value":
|
|
664
|
-
"onUpdate:modelValue":
|
|
665
|
-
"root-value":
|
|
663
|
+
}, 8, ["model-value", "rules"])) : z("", !0),
|
|
664
|
+
u("div", Ft, [
|
|
665
|
+
y(xt, {
|
|
666
|
+
"model-value": T.value,
|
|
667
|
+
"onUpdate:modelValue": t[4] || (t[4] = (A) => T.value = A),
|
|
668
|
+
"root-value": e.modelValue
|
|
666
669
|
}, null, 8, ["model-value", "root-value"])
|
|
667
670
|
]),
|
|
668
|
-
|
|
671
|
+
e.mode !== w(W).CREATE ? (g(), E("div", Ct, [
|
|
669
672
|
u("div", null, [
|
|
670
|
-
y(
|
|
673
|
+
y(fe, {
|
|
671
674
|
label: "Show binded items",
|
|
672
|
-
modelValue:
|
|
673
|
-
"onUpdate:modelValue":
|
|
675
|
+
modelValue: q.value,
|
|
676
|
+
"onUpdate:modelValue": t[5] || (t[5] = (A) => q.value = A),
|
|
674
677
|
"label-placement": "right"
|
|
675
678
|
}, null, 8, ["modelValue"])
|
|
676
679
|
]),
|
|
677
|
-
|
|
680
|
+
q.value && ae.value.length ? (g(), B(Fe, {
|
|
678
681
|
key: 0,
|
|
679
682
|
name: "Ingredient",
|
|
680
683
|
bindings: ae.value
|
|
681
|
-
}, null, 8, ["bindings"])) :
|
|
682
|
-
|
|
684
|
+
}, null, 8, ["bindings"])) : z("", !0),
|
|
685
|
+
q.value && X.value.length ? (g(), B(Fe, {
|
|
683
686
|
key: 1,
|
|
684
687
|
name: "Recipe",
|
|
685
|
-
bindings:
|
|
686
|
-
}, null, 8, ["bindings"])) :
|
|
687
|
-
|
|
688
|
+
bindings: X.value
|
|
689
|
+
}, null, 8, ["bindings"])) : z("", !0),
|
|
690
|
+
q.value && s.value.length ? (g(), B(Fe, {
|
|
688
691
|
key: 2,
|
|
689
692
|
name: "Menu",
|
|
690
693
|
bindings: s.value
|
|
691
|
-
}, null, 8, ["bindings"])) :
|
|
692
|
-
])) :
|
|
693
|
-
u("div",
|
|
694
|
-
u("div",
|
|
695
|
-
y(
|
|
696
|
-
default:
|
|
697
|
-
|
|
694
|
+
}, null, 8, ["bindings"])) : z("", !0)
|
|
695
|
+
])) : z("", !0),
|
|
696
|
+
u("div", St, [
|
|
697
|
+
u("div", wt, [
|
|
698
|
+
y(Ce, null, {
|
|
699
|
+
default: I(() => [
|
|
700
|
+
Mt
|
|
698
701
|
]),
|
|
699
702
|
_: 1
|
|
700
703
|
}),
|
|
701
|
-
|
|
704
|
+
$t
|
|
702
705
|
]),
|
|
703
706
|
u("div", It, [
|
|
704
|
-
y(
|
|
705
|
-
"model-value": { low:
|
|
706
|
-
rules: [
|
|
707
|
+
y(ce, {
|
|
708
|
+
"model-value": { low: M.value, mid: J.value },
|
|
709
|
+
rules: [se()]
|
|
707
710
|
}, null, 8, ["model-value", "rules"]),
|
|
708
|
-
u("div",
|
|
711
|
+
u("div", Ut, [
|
|
709
712
|
u("div", Rt, [
|
|
710
|
-
u("div",
|
|
711
|
-
y(
|
|
712
|
-
days:
|
|
713
|
-
level: w(
|
|
713
|
+
u("div", Et, [
|
|
714
|
+
y(Ve, {
|
|
715
|
+
days: M.value,
|
|
716
|
+
level: w(ke).low
|
|
714
717
|
}, null, 8, ["days", "level"])
|
|
715
718
|
]),
|
|
716
|
-
u("div",
|
|
719
|
+
u("div", Dt, [
|
|
717
720
|
At,
|
|
718
|
-
y(
|
|
719
|
-
modelValue:
|
|
720
|
-
"onUpdate:modelValue":
|
|
721
|
-
rules: [w(
|
|
721
|
+
y(Se, {
|
|
722
|
+
modelValue: M.value,
|
|
723
|
+
"onUpdate:modelValue": t[6] || (t[6] = (A) => M.value = A),
|
|
724
|
+
rules: [w(xe)(0)]
|
|
722
725
|
}, {
|
|
723
|
-
append:
|
|
724
|
-
|
|
726
|
+
append: I(() => [
|
|
727
|
+
Pt
|
|
725
728
|
]),
|
|
726
729
|
_: 1
|
|
727
730
|
}, 8, ["modelValue", "rules"])
|
|
728
731
|
])
|
|
729
732
|
]),
|
|
730
733
|
Tt,
|
|
731
|
-
u("div",
|
|
732
|
-
u("div",
|
|
733
|
-
y(
|
|
734
|
-
days:
|
|
735
|
-
level: w(
|
|
734
|
+
u("div", Bt, [
|
|
735
|
+
u("div", Lt, [
|
|
736
|
+
y(Ve, {
|
|
737
|
+
days: J.value,
|
|
738
|
+
level: w(ke).mid
|
|
736
739
|
}, null, 8, ["days", "level"])
|
|
737
740
|
]),
|
|
738
|
-
u("div",
|
|
739
|
-
|
|
740
|
-
y(
|
|
741
|
-
modelValue:
|
|
742
|
-
"onUpdate:modelValue":
|
|
743
|
-
rules: [w(
|
|
741
|
+
u("div", zt, [
|
|
742
|
+
Nt,
|
|
743
|
+
y(Se, {
|
|
744
|
+
modelValue: J.value,
|
|
745
|
+
"onUpdate:modelValue": t[7] || (t[7] = (A) => J.value = A),
|
|
746
|
+
rules: [w(xe)(0)]
|
|
744
747
|
}, {
|
|
745
|
-
append:
|
|
746
|
-
|
|
748
|
+
append: I(() => [
|
|
749
|
+
Ot
|
|
747
750
|
]),
|
|
748
751
|
_: 1
|
|
749
752
|
}, 8, ["modelValue", "rules"])
|
|
750
753
|
])
|
|
751
754
|
]),
|
|
752
|
-
|
|
753
|
-
u("div",
|
|
754
|
-
u("div",
|
|
755
|
-
y(
|
|
756
|
-
days:
|
|
757
|
-
level: w(
|
|
755
|
+
Ht,
|
|
756
|
+
u("div", jt, [
|
|
757
|
+
u("div", Yt, [
|
|
758
|
+
y(Ve, {
|
|
759
|
+
days: J.value + 1,
|
|
760
|
+
level: w(ke).high
|
|
758
761
|
}, null, 8, ["days", "level"])
|
|
759
762
|
]),
|
|
760
|
-
|
|
763
|
+
Wt
|
|
761
764
|
])
|
|
762
765
|
])
|
|
763
766
|
])
|
|
@@ -767,37 +770,37 @@ const xt = { class: "text-fm-color-typo-secondary" }, Vt = { class: "text-fm-col
|
|
|
767
770
|
}, 8, ["disabled"]);
|
|
768
771
|
};
|
|
769
772
|
}
|
|
770
|
-
}),
|
|
773
|
+
}), qt = { class: "flex gap-4" }, Kt = /* @__PURE__ */ oe({
|
|
771
774
|
__name: "IngredientDialog",
|
|
772
775
|
props: {
|
|
773
776
|
show: { type: Boolean },
|
|
774
777
|
unit: {},
|
|
775
|
-
mode: { default:
|
|
778
|
+
mode: { default: W.READ }
|
|
776
779
|
},
|
|
777
780
|
emits: ["update:show"],
|
|
778
781
|
setup(r) {
|
|
779
|
-
const a = r, p = ne(), o =
|
|
782
|
+
const a = r, p = ne(), o = he(), n = Ue(a, "show"), l = Ue(a, "unit"), d = k(() => {
|
|
780
783
|
switch (a.mode) {
|
|
781
|
-
case
|
|
784
|
+
case W.READ:
|
|
782
785
|
return "View ingredient";
|
|
783
|
-
case
|
|
786
|
+
case W.UPDATE:
|
|
784
787
|
return "Edit ingredient";
|
|
785
|
-
case
|
|
788
|
+
case W.CREATE:
|
|
786
789
|
return "Add ingredient";
|
|
787
790
|
}
|
|
788
791
|
return "";
|
|
789
|
-
}), v =
|
|
792
|
+
}), v = k(() => {
|
|
790
793
|
switch (a.mode) {
|
|
791
|
-
case
|
|
794
|
+
case W.READ:
|
|
792
795
|
return "";
|
|
793
|
-
case
|
|
796
|
+
case W.UPDATE:
|
|
794
797
|
return "Save";
|
|
795
|
-
case
|
|
798
|
+
case W.CREATE:
|
|
796
799
|
return "Add";
|
|
797
800
|
}
|
|
798
801
|
return "";
|
|
799
|
-
}), _ =
|
|
800
|
-
async function
|
|
802
|
+
}), _ = P(), i = P(!1);
|
|
803
|
+
async function b() {
|
|
801
804
|
i.value = !0;
|
|
802
805
|
try {
|
|
803
806
|
await p.createSku(l.value), n.value = !1, o.open({
|
|
@@ -805,8 +808,8 @@ const xt = { class: "text-fm-color-typo-secondary" }, Vt = { class: "text-fm-col
|
|
|
805
808
|
message: "Created " + l.value.name,
|
|
806
809
|
type: "success"
|
|
807
810
|
});
|
|
808
|
-
} catch (
|
|
809
|
-
|
|
811
|
+
} catch (x) {
|
|
812
|
+
x instanceof Ie || o.open({
|
|
810
813
|
title: "Failed to create ingredient",
|
|
811
814
|
message: "Please try again",
|
|
812
815
|
type: "error"
|
|
@@ -823,8 +826,8 @@ const xt = { class: "text-fm-color-typo-secondary" }, Vt = { class: "text-fm-col
|
|
|
823
826
|
message: "Updated " + l.value.name,
|
|
824
827
|
type: "success"
|
|
825
828
|
});
|
|
826
|
-
} catch (
|
|
827
|
-
|
|
829
|
+
} catch (x) {
|
|
830
|
+
x instanceof Ie || o.open({
|
|
828
831
|
title: "Failed to update ingredient",
|
|
829
832
|
message: "Please try again",
|
|
830
833
|
type: "error"
|
|
@@ -834,54 +837,54 @@ const xt = { class: "text-fm-color-typo-secondary" }, Vt = { class: "text-fm-col
|
|
|
834
837
|
}
|
|
835
838
|
}
|
|
836
839
|
function f() {
|
|
837
|
-
var
|
|
838
|
-
(
|
|
840
|
+
var x, F;
|
|
841
|
+
(F = (x = _.value) == null ? void 0 : x.validateInputs) == null || F.call(x);
|
|
839
842
|
}
|
|
840
|
-
function
|
|
843
|
+
function D() {
|
|
841
844
|
switch (a.mode) {
|
|
842
|
-
case
|
|
845
|
+
case W.READ:
|
|
843
846
|
return;
|
|
844
|
-
case
|
|
847
|
+
case W.UPDATE:
|
|
845
848
|
return c();
|
|
846
|
-
case
|
|
847
|
-
return
|
|
849
|
+
case W.CREATE:
|
|
850
|
+
return b();
|
|
848
851
|
}
|
|
849
852
|
}
|
|
850
|
-
return (
|
|
851
|
-
const
|
|
852
|
-
return g(), B(
|
|
853
|
+
return (x, F) => {
|
|
854
|
+
const C = $("FmButton"), T = $("FmSideSheet");
|
|
855
|
+
return g(), B(T, {
|
|
853
856
|
"model-value": w(n),
|
|
854
|
-
"onUpdate:modelValue":
|
|
857
|
+
"onUpdate:modelValue": F[3] || (F[3] = (V) => we(n) ? n.value = V : null),
|
|
855
858
|
header: d.value,
|
|
856
859
|
"close-button": "",
|
|
857
860
|
"dismiss-away": "",
|
|
858
861
|
"max-width": 500
|
|
859
862
|
}, {
|
|
860
|
-
"side-sheet-footer":
|
|
861
|
-
u("div",
|
|
862
|
-
y(
|
|
863
|
+
"side-sheet-footer": I(() => [
|
|
864
|
+
u("div", qt, [
|
|
865
|
+
y(C, {
|
|
863
866
|
loading: i.value,
|
|
864
867
|
label: v.value,
|
|
865
868
|
onClick: f
|
|
866
869
|
}, null, 8, ["loading", "label"]),
|
|
867
|
-
y(
|
|
870
|
+
y(C, {
|
|
868
871
|
disabled: i.value,
|
|
869
872
|
label: "Close",
|
|
870
873
|
variant: "tertiary",
|
|
871
|
-
onClick:
|
|
874
|
+
onClick: F[2] || (F[2] = (V) => n.value = !1)
|
|
872
875
|
}, null, 8, ["disabled"])
|
|
873
876
|
])
|
|
874
877
|
]),
|
|
875
|
-
default:
|
|
876
|
-
y(
|
|
878
|
+
default: I(() => [
|
|
879
|
+
y(Gt, {
|
|
877
880
|
class: "w-full",
|
|
878
881
|
ref_key: "hasValidationExpose",
|
|
879
882
|
ref: _,
|
|
880
883
|
modelValue: w(l),
|
|
881
|
-
"onUpdate:modelValue":
|
|
882
|
-
mode:
|
|
884
|
+
"onUpdate:modelValue": F[0] || (F[0] = (V) => we(l) ? l.value = V : null),
|
|
885
|
+
mode: x.mode,
|
|
883
886
|
disabled: i.value,
|
|
884
|
-
"onClick:submit":
|
|
887
|
+
"onClick:submit": F[1] || (F[1] = (V) => D())
|
|
885
888
|
}, null, 8, ["modelValue", "mode", "disabled"])
|
|
886
889
|
]),
|
|
887
890
|
_: 1
|
|
@@ -889,24 +892,24 @@ const xt = { class: "text-fm-color-typo-secondary" }, Vt = { class: "text-fm-col
|
|
|
889
892
|
};
|
|
890
893
|
}
|
|
891
894
|
});
|
|
892
|
-
function*
|
|
895
|
+
function* Jt(r) {
|
|
893
896
|
for (; ; )
|
|
894
897
|
yield r[Math.floor(Math.random() * r.length)];
|
|
895
898
|
}
|
|
896
|
-
function
|
|
899
|
+
function Qt(r = 4, a = Jt("qwertyuiopasdfghjklzxcvbnm".split(""))) {
|
|
897
900
|
return Array.from({ length: r }).map(() => a.next().value).join("");
|
|
898
901
|
}
|
|
899
|
-
function
|
|
900
|
-
return `sku_${(/* @__PURE__ */ new Date()).toISOString()}_${
|
|
902
|
+
function Xt() {
|
|
903
|
+
return `sku_${(/* @__PURE__ */ new Date()).toISOString()}_${Qt()}`;
|
|
901
904
|
}
|
|
902
|
-
const
|
|
905
|
+
const Zt = {
|
|
903
906
|
_id: "",
|
|
904
907
|
name: "",
|
|
905
908
|
abbrev: "",
|
|
906
909
|
precision: 0,
|
|
907
910
|
measurements: []
|
|
908
911
|
};
|
|
909
|
-
function
|
|
912
|
+
function eo(r) {
|
|
910
913
|
var p, o, n, l, d;
|
|
911
914
|
return {
|
|
912
915
|
code: r.code,
|
|
@@ -914,12 +917,12 @@ function Zt(r) {
|
|
|
914
917
|
unit: ((p = r.unit.measurements.find((v) => v.id === r.trackingMeasurement)) == null ? void 0 : p.abbrev) ?? r.unit.abbrev,
|
|
915
918
|
baseUnit: r.unit.abbrev,
|
|
916
919
|
valuationMethod: r.valuation ?? "WAVG",
|
|
917
|
-
pricePerUnit: (o = r.defaultCost) != null && o.costPerUnit ? +
|
|
918
|
-
thresholdLow: ((l = r.thresholds) == null ? void 0 : l.low) ??
|
|
919
|
-
thresholdMid: ((d = r.thresholds) == null ? void 0 : d.mid) ??
|
|
920
|
+
pricePerUnit: (o = r.defaultCost) != null && o.costPerUnit ? +je((n = r.defaultCost) == null ? void 0 : n.costPerUnit) : 0,
|
|
921
|
+
thresholdLow: ((l = r.thresholds) == null ? void 0 : l.low) ?? ue().low,
|
|
922
|
+
thresholdMid: ((d = r.thresholds) == null ? void 0 : d.mid) ?? ue().mid
|
|
920
923
|
};
|
|
921
924
|
}
|
|
922
|
-
function
|
|
925
|
+
function We() {
|
|
923
926
|
var n;
|
|
924
927
|
const r = [
|
|
925
928
|
{
|
|
@@ -938,7 +941,7 @@ function Ye() {
|
|
|
938
941
|
id: "baseUnit",
|
|
939
942
|
name: "Base unit"
|
|
940
943
|
}
|
|
941
|
-
], a =
|
|
944
|
+
], a = ze(), p = pe(), o = ge(p.currentCountry.value);
|
|
942
945
|
return a.enableTotalCost && r.push(
|
|
943
946
|
{
|
|
944
947
|
id: "valuationMethod",
|
|
@@ -959,28 +962,28 @@ function Ye() {
|
|
|
959
962
|
}
|
|
960
963
|
), r;
|
|
961
964
|
}
|
|
962
|
-
function
|
|
963
|
-
const a = ne().skus.map(
|
|
965
|
+
function to() {
|
|
966
|
+
const a = ne().skus.map(eo), o = pe().currentBusiness.value, n = We(), l = [
|
|
964
967
|
["Business name:", o == null ? void 0 : o.name],
|
|
965
968
|
["Business ID:", o == null ? void 0 : o._id],
|
|
966
969
|
["Menu version", o == null ? void 0 : o.menuVersion],
|
|
967
970
|
[],
|
|
968
971
|
n.map((i) => i.name),
|
|
969
|
-
...a.map((i) => n.map((
|
|
970
|
-
], d = n.map((i) => `system:${i.id}`), v =
|
|
971
|
-
return
|
|
972
|
+
...a.map((i) => n.map((b) => i[b.id]))
|
|
973
|
+
], d = n.map((i) => `system:${i.id}`), v = Oe(l, d), _ = `${o == null ? void 0 : o.name} ingredients (${ht(/* @__PURE__ */ new Date())}).xlsx`;
|
|
974
|
+
return He(v, _), _;
|
|
972
975
|
}
|
|
973
|
-
function
|
|
974
|
-
const a =
|
|
976
|
+
function oo() {
|
|
977
|
+
const a = pe().currentBusiness.value, p = We(), o = [
|
|
975
978
|
["Business name:", a == null ? void 0 : a.name],
|
|
976
979
|
["Business ID:", a == null ? void 0 : a._id],
|
|
977
980
|
["Menu version", a == null ? void 0 : a.menuVersion],
|
|
978
981
|
[],
|
|
979
982
|
p.map((v) => v.name)
|
|
980
|
-
], n = p.map((v) => `system:${v.id}`), l =
|
|
981
|
-
return
|
|
983
|
+
], n = p.map((v) => `system:${v.id}`), l = Oe(o, n), d = "FeedMe ingredients template.xlsx";
|
|
984
|
+
return He(l, d), d;
|
|
982
985
|
}
|
|
983
|
-
function
|
|
986
|
+
function no(r) {
|
|
984
987
|
const [
|
|
985
988
|
a,
|
|
986
989
|
p,
|
|
@@ -989,91 +992,91 @@ function oo(r) {
|
|
|
989
992
|
l,
|
|
990
993
|
d,
|
|
991
994
|
...v
|
|
992
|
-
] =
|
|
995
|
+
] = yt(r);
|
|
993
996
|
if (!a || !a.length || a.some((f) => f.length && !f.startsWith("system:")))
|
|
994
997
|
throw new Error("Missing meta header. Excel file does not come from the template.");
|
|
995
|
-
const _ = a.map((f) => f.split(":")[1]),
|
|
996
|
-
if (
|
|
998
|
+
const _ = a.map((f) => f.split(":")[1]), b = ["code", "name", "unit", "baseUnit"].filter((f) => !_.includes(f));
|
|
999
|
+
if (b.length)
|
|
997
1000
|
throw new Error(
|
|
998
|
-
`Missing meta headers (${
|
|
1001
|
+
`Missing meta headers (${b.join()}). Excel file does not come from the template.`
|
|
999
1002
|
);
|
|
1000
|
-
return v.map((f,
|
|
1001
|
-
const
|
|
1002
|
-
for (const
|
|
1003
|
-
const
|
|
1004
|
-
Object.assign(
|
|
1003
|
+
return v.map((f, D) => {
|
|
1004
|
+
const x = {};
|
|
1005
|
+
for (const F in _) {
|
|
1006
|
+
const C = _[F];
|
|
1007
|
+
Object.assign(x, { [C]: f[F] });
|
|
1005
1008
|
}
|
|
1006
1009
|
return {
|
|
1007
|
-
index:
|
|
1008
|
-
data:
|
|
1010
|
+
index: D,
|
|
1011
|
+
data: x
|
|
1009
1012
|
};
|
|
1010
1013
|
});
|
|
1011
1014
|
}
|
|
1012
|
-
function
|
|
1013
|
-
var
|
|
1014
|
-
const n = ne().units, l = new Array(), d = p.filter((
|
|
1015
|
+
function De(r, a, p) {
|
|
1016
|
+
var T;
|
|
1017
|
+
const n = ne().units, l = new Array(), d = p.filter((V) => V.data.code === r.code);
|
|
1015
1018
|
d.length > 1 && l.push(
|
|
1016
|
-
`Code ${r.code} is already used in row ${d.map((
|
|
1019
|
+
`Code ${r.code} is already used in row ${d.map((V) => V.index + 6).join()}.`
|
|
1017
1020
|
);
|
|
1018
|
-
const v = n.find((
|
|
1021
|
+
const v = n.find((V) => V.abbrev === r.baseUnit), _ = v == null ? void 0 : v.measurements.find((V) => V.abbrev === r.unit);
|
|
1019
1022
|
if (!v)
|
|
1020
1023
|
l.push(`Cannot find base unit of symbol ${r.baseUnit}.`);
|
|
1021
1024
|
else if (r.baseUnit !== r.unit && !_) {
|
|
1022
|
-
const
|
|
1023
|
-
l.push(
|
|
1025
|
+
const V = `Cannot find unit conversion for ${r.baseUnit} with symbol ${r.unit || "[empty]"}.`;
|
|
1026
|
+
l.push(V);
|
|
1024
1027
|
}
|
|
1025
|
-
const i =
|
|
1026
|
-
(
|
|
1028
|
+
const i = Q.options.find(
|
|
1029
|
+
(V) => V === r.valuationMethod
|
|
1027
1030
|
);
|
|
1028
1031
|
r.valuationMethod && !i && l.push(
|
|
1029
|
-
`Expected valuation method to be one of ${
|
|
1032
|
+
`Expected valuation method to be one of ${Q.options.join()} but got ${r.valuationMethod} instead.`
|
|
1030
1033
|
);
|
|
1031
|
-
const c =
|
|
1034
|
+
const c = pe().currentCountry.value, f = (V) => `${V}`.length && pt()(V) === !0, D = f(`${r.pricePerUnit}`) === !0 ? {
|
|
1032
1035
|
costPerUnit: {
|
|
1033
|
-
...
|
|
1034
|
-
currency: ((
|
|
1036
|
+
...Ye(Number(r.pricePerUnit) || 0),
|
|
1037
|
+
currency: ((T = ge(c)) == null ? void 0 : T.currency) ?? "MYR"
|
|
1035
1038
|
},
|
|
1036
1039
|
measurement: _
|
|
1037
|
-
} : void 0,
|
|
1040
|
+
} : void 0, x = f(`${r.thresholdLow}`) && f(`${r.thresholdMid}`) ? {
|
|
1038
1041
|
low: Number(r.thresholdLow) || 0,
|
|
1039
1042
|
mid: Number(r.thresholdMid) || 0
|
|
1040
1043
|
} : void 0;
|
|
1041
1044
|
return {
|
|
1042
1045
|
type: "create",
|
|
1043
1046
|
sku: {
|
|
1044
|
-
_id:
|
|
1047
|
+
_id: Xt(),
|
|
1045
1048
|
code: r.code,
|
|
1046
1049
|
name: r.name,
|
|
1047
|
-
unit: v ?? n.find((
|
|
1050
|
+
unit: v ?? n.find((V) => V) ?? Zt,
|
|
1048
1051
|
trackingMeasurement: _ == null ? void 0 : _.id,
|
|
1049
1052
|
valuation: i,
|
|
1050
|
-
defaultCost:
|
|
1051
|
-
thresholds:
|
|
1053
|
+
defaultCost: D,
|
|
1054
|
+
thresholds: x
|
|
1052
1055
|
},
|
|
1053
1056
|
errors: l,
|
|
1054
1057
|
excelRowNumber: a + 6
|
|
1055
1058
|
};
|
|
1056
1059
|
}
|
|
1057
|
-
function
|
|
1060
|
+
function lo(r) {
|
|
1058
1061
|
try {
|
|
1059
|
-
const a =
|
|
1060
|
-
(i) =>
|
|
1062
|
+
const a = no(r).filter((i) => i.data.code), o = ne().skus, n = Ze(o, "code"), l = a.filter((i) => !n[i.data.code]), d = a.filter((i) => n[i.data.code]), v = l.map(
|
|
1063
|
+
(i) => De(i.data, i.index, a)
|
|
1061
1064
|
), _ = d.map((i) => {
|
|
1062
|
-
const
|
|
1065
|
+
const b = De(i.data, i.index, a), c = n[i.data.code];
|
|
1063
1066
|
return {
|
|
1064
|
-
...
|
|
1067
|
+
...b,
|
|
1065
1068
|
type: "update",
|
|
1066
1069
|
original: c,
|
|
1067
1070
|
sku: {
|
|
1068
1071
|
// to maintain original props not in the import excel, e.g. inventory binding, etc...
|
|
1069
1072
|
...c,
|
|
1070
|
-
code:
|
|
1071
|
-
name:
|
|
1072
|
-
unit:
|
|
1073
|
-
trackingMeasurement:
|
|
1074
|
-
valuation:
|
|
1075
|
-
defaultCost:
|
|
1076
|
-
thresholds:
|
|
1073
|
+
code: b.sku.code || c.code,
|
|
1074
|
+
name: b.sku.name || c.name,
|
|
1075
|
+
unit: b.sku.unit || c.unit,
|
|
1076
|
+
trackingMeasurement: b.sku.trackingMeasurement || c.trackingMeasurement,
|
|
1077
|
+
valuation: b.sku.valuation || c.valuation,
|
|
1078
|
+
defaultCost: b.sku.defaultCost || c.defaultCost,
|
|
1079
|
+
thresholds: b.sku.thresholds || c.thresholds
|
|
1077
1080
|
}
|
|
1078
1081
|
};
|
|
1079
1082
|
});
|
|
@@ -1091,10 +1094,10 @@ function no(r) {
|
|
|
1091
1094
|
};
|
|
1092
1095
|
}
|
|
1093
1096
|
}
|
|
1094
|
-
const
|
|
1097
|
+
const ao = {
|
|
1095
1098
|
key: 0,
|
|
1096
1099
|
class: "relative"
|
|
1097
|
-
},
|
|
1100
|
+
}, so = ["accept", "disabled"], ro = { class: "flex flex-col gap-8" }, io = ["accept", "disabled"], uo = /* @__PURE__ */ oe({
|
|
1098
1101
|
__name: "FmDroppableField",
|
|
1099
1102
|
props: {
|
|
1100
1103
|
buttonLabel: {},
|
|
@@ -1106,108 +1109,108 @@ const lo = {
|
|
|
1106
1109
|
},
|
|
1107
1110
|
emits: ["file-upload", "file-rejected"],
|
|
1108
1111
|
setup(r, { emit: a }) {
|
|
1109
|
-
const p = r, o = a, n =
|
|
1112
|
+
const p = r, o = a, n = P(!1), l = P(null), d = P(null), v = P(), _ = (s) => {
|
|
1110
1113
|
p.disabled || (s.stopPropagation(), s.preventDefault());
|
|
1111
1114
|
}, i = (s) => {
|
|
1112
1115
|
p.disabled || (s.stopPropagation(), s.preventDefault(), n.value = !0);
|
|
1113
|
-
},
|
|
1116
|
+
}, b = (s) => {
|
|
1114
1117
|
p.disabled || (s.stopPropagation(), s.preventDefault(), n.value = !1);
|
|
1115
1118
|
}, c = (s) => {
|
|
1116
|
-
var
|
|
1117
|
-
p.disabled || (s.stopPropagation(), s.preventDefault(), n.value = !1, f((
|
|
1119
|
+
var L;
|
|
1120
|
+
p.disabled || (s.stopPropagation(), s.preventDefault(), n.value = !1, f((L = s.dataTransfer) == null ? void 0 : L.files));
|
|
1118
1121
|
};
|
|
1119
1122
|
function f(s) {
|
|
1120
1123
|
if (s)
|
|
1121
|
-
if (v.value = s, l.value =
|
|
1124
|
+
if (v.value = s, l.value = x(s[0]), d.value = F(s[0]), l.value && d.value)
|
|
1122
1125
|
o("file-upload", s[0]);
|
|
1123
1126
|
else {
|
|
1124
|
-
const
|
|
1127
|
+
const L = D();
|
|
1125
1128
|
o("file-rejected", [
|
|
1126
1129
|
{
|
|
1127
1130
|
file: s[0],
|
|
1128
|
-
reason:
|
|
1131
|
+
reason: L
|
|
1129
1132
|
}
|
|
1130
1133
|
]);
|
|
1131
1134
|
}
|
|
1132
1135
|
}
|
|
1133
|
-
const
|
|
1136
|
+
const D = () => {
|
|
1134
1137
|
const s = new Array();
|
|
1135
1138
|
return l.value || s.push("invalid-type"), d.value || s.push("invalid-size"), s;
|
|
1136
|
-
},
|
|
1139
|
+
}, x = (s) => {
|
|
1137
1140
|
if (!p.accept) return !0;
|
|
1138
|
-
const
|
|
1139
|
-
for (const
|
|
1140
|
-
if (
|
|
1141
|
-
if (
|
|
1142
|
-
} else if (
|
|
1141
|
+
const L = p.accept.split(",").map((O) => O.trim());
|
|
1142
|
+
for (const O of L)
|
|
1143
|
+
if (C(O)) {
|
|
1144
|
+
if (V(O) === V(s.type)) return !0;
|
|
1145
|
+
} else if (T(s) === O || s.type === O) return !0;
|
|
1143
1146
|
return !1;
|
|
1144
|
-
},
|
|
1147
|
+
}, F = (s) => s.size <= p.maxFileSize, C = (s) => s.indexOf("*") !== -1, T = (s) => "." + s.name.split(".").pop(), V = (s) => s.substring(0, s.indexOf("/")), le = k(() => {
|
|
1145
1148
|
if (n.value) return "Drop file to upload";
|
|
1146
1149
|
if (l.value) {
|
|
1147
1150
|
if (!d.value) return `File size exceeds ${p.maxFileSize * 1e-6}mb`;
|
|
1148
1151
|
} else return "File type is not valid";
|
|
1149
1152
|
return "";
|
|
1150
|
-
}),
|
|
1151
|
-
const
|
|
1152
|
-
f(
|
|
1153
|
-
}, ae =
|
|
1153
|
+
}), N = k(() => v.value ? !l.value || !d.value : !1), q = (s) => {
|
|
1154
|
+
const L = s.target;
|
|
1155
|
+
f(L.files);
|
|
1156
|
+
}, ae = k(() => {
|
|
1154
1157
|
var s;
|
|
1155
1158
|
return (s = v.value) == null ? void 0 : s.item(0);
|
|
1156
|
-
}),
|
|
1157
|
-
return (s,
|
|
1158
|
-
const
|
|
1159
|
+
}), X = P();
|
|
1160
|
+
return (s, L) => {
|
|
1161
|
+
const O = $("FmLabel"), de = $("FmButton");
|
|
1159
1162
|
return g(), E("label", {
|
|
1160
1163
|
class: "fm-droppable-field",
|
|
1161
1164
|
ref_key: "fmButtonRef",
|
|
1162
|
-
ref:
|
|
1165
|
+
ref: X
|
|
1163
1166
|
}, [
|
|
1164
|
-
s.$slots.default ? (g(), E("div",
|
|
1167
|
+
s.$slots.default ? (g(), E("div", ao, [
|
|
1165
1168
|
u("input", {
|
|
1166
1169
|
accept: s.accept,
|
|
1167
1170
|
disabled: s.disabled,
|
|
1168
1171
|
class: "fm-droppable-field__input",
|
|
1169
1172
|
type: "file",
|
|
1170
|
-
onChange:
|
|
1171
|
-
}, null, 40,
|
|
1172
|
-
])) :
|
|
1173
|
+
onChange: q
|
|
1174
|
+
}, null, 40, so)
|
|
1175
|
+
])) : z("", !0),
|
|
1173
1176
|
ve(s.$slots, "default", {
|
|
1174
1177
|
isDragging: n.value,
|
|
1175
1178
|
isValidFileType: l.value,
|
|
1176
1179
|
isValidFileSize: d.value,
|
|
1177
1180
|
singleValidFile: ae.value,
|
|
1178
1181
|
openFileDialog: () => {
|
|
1179
|
-
var
|
|
1180
|
-
return console.log("click",
|
|
1182
|
+
var te;
|
|
1183
|
+
return console.log("click", X.value), (te = X.value) == null ? void 0 : te.click();
|
|
1181
1184
|
}
|
|
1182
1185
|
}, () => [
|
|
1183
|
-
u("div",
|
|
1184
|
-
s.$slots.label ? ve(s.$slots, "label", { key: 0 }, void 0, !0) : (g(), B(
|
|
1186
|
+
u("div", ro, [
|
|
1187
|
+
s.$slots.label ? ve(s.$slots, "label", { key: 0 }, void 0, !0) : (g(), B(O, {
|
|
1185
1188
|
key: 1,
|
|
1186
1189
|
label: s.label
|
|
1187
1190
|
}, null, 8, ["label"]))
|
|
1188
1191
|
]),
|
|
1189
1192
|
u("div", {
|
|
1190
|
-
class:
|
|
1193
|
+
class: K([[
|
|
1191
1194
|
s.contentClass ? s.contentClass : "w-full h-full",
|
|
1192
1195
|
{
|
|
1193
1196
|
"fm-droppable-field__container--dragging": n.value,
|
|
1194
|
-
"fm-droppable-field__container--invalid":
|
|
1197
|
+
"fm-droppable-field__container--invalid": N.value && !s.disabled,
|
|
1195
1198
|
"fm-droppable-field__container--disabled": s.disabled
|
|
1196
1199
|
}
|
|
1197
1200
|
], "fm-droppable-field__container"]),
|
|
1198
1201
|
onDragenter: _,
|
|
1199
|
-
onDragleave:
|
|
1202
|
+
onDragleave: b,
|
|
1200
1203
|
onDragover: i,
|
|
1201
1204
|
onDrop: c
|
|
1202
1205
|
}, [
|
|
1203
|
-
(n.value ||
|
|
1206
|
+
(n.value || N.value) && !s.disabled ? (g(), E("div", {
|
|
1204
1207
|
key: 0,
|
|
1205
|
-
class:
|
|
1208
|
+
class: K({
|
|
1206
1209
|
"fm-typo-en-body-lg-600": !0,
|
|
1207
1210
|
"text-fm-color-primary": n.value,
|
|
1208
|
-
"text-fm-color-typo-error":
|
|
1211
|
+
"text-fm-color-typo-error": N.value
|
|
1209
1212
|
})
|
|
1210
|
-
},
|
|
1213
|
+
}, G(le.value), 3)) : (g(), B(de, {
|
|
1211
1214
|
key: 1,
|
|
1212
1215
|
disabled: s.disabled,
|
|
1213
1216
|
label: s.buttonLabel ?? "Add files",
|
|
@@ -1217,30 +1220,30 @@ const lo = {
|
|
|
1217
1220
|
ve(s.$slots, "accept-text", {}, () => [
|
|
1218
1221
|
p.accept ? (g(), E("div", {
|
|
1219
1222
|
key: 0,
|
|
1220
|
-
class:
|
|
1221
|
-
},
|
|
1223
|
+
class: K([[s.disabled ? "text-fm-color-typo-disabled" : "text-fm-color-typo-secondary"], "fm-typo-en-body-md-400"])
|
|
1224
|
+
}, G(`Accepts ${p.accept}`), 3)) : z("", !0)
|
|
1222
1225
|
], !0),
|
|
1223
1226
|
u("input", {
|
|
1224
1227
|
accept: s.accept,
|
|
1225
1228
|
disabled: s.disabled,
|
|
1226
1229
|
class: "fm-droppable-field__input",
|
|
1227
1230
|
type: "file",
|
|
1228
|
-
onChange:
|
|
1229
|
-
}, null, 40,
|
|
1231
|
+
onChange: q
|
|
1232
|
+
}, null, 40, io)
|
|
1230
1233
|
], 34),
|
|
1231
1234
|
ve(s.$slots, "helper-text", {}, () => [
|
|
1232
1235
|
u("div", {
|
|
1233
|
-
class:
|
|
1234
|
-
},
|
|
1236
|
+
class: K([[s.disabled ? "text-fm-color-typo-disabled" : "text-fm-color-typo-secondary"], "fm-typo-en-body-sm-400"])
|
|
1237
|
+
}, G(`Max size ${p.maxFileSize * 1e-6}mb`), 3)
|
|
1235
1238
|
], !0)
|
|
1236
1239
|
], !0)
|
|
1237
1240
|
], 512);
|
|
1238
1241
|
};
|
|
1239
1242
|
}
|
|
1240
|
-
}),
|
|
1243
|
+
}), co = /* @__PURE__ */ et(uo, [["__scopeId", "data-v-311b22a0"]]), mo = { class: "flex items-center gap-12 pl-8" }, po = /* @__PURE__ */ u("div", null, "•", -1), fo = { class: "flex flex-col" }, vo = { class: "fm-typo-en-body-md-400 text-fm-color-typo-primary flex items-center gap-4" }, yo = {
|
|
1241
1244
|
key: 0,
|
|
1242
1245
|
class: "text-fm-color-typo-secondary fm-typo-en-body-sm-400"
|
|
1243
|
-
},
|
|
1246
|
+
}, go = { key: 0 }, Ae = /* @__PURE__ */ oe({
|
|
1244
1247
|
__name: "ImportIngredientItem",
|
|
1245
1248
|
props: {
|
|
1246
1249
|
type: {},
|
|
@@ -1250,27 +1253,27 @@ const lo = {
|
|
|
1250
1253
|
},
|
|
1251
1254
|
setup(r) {
|
|
1252
1255
|
return (a, p) => {
|
|
1253
|
-
const o =
|
|
1254
|
-
return g(), E("div",
|
|
1255
|
-
|
|
1256
|
-
u("div",
|
|
1257
|
-
u("div",
|
|
1256
|
+
const o = $("FmIcon"), n = $("FmTooltip");
|
|
1257
|
+
return g(), E("div", mo, [
|
|
1258
|
+
po,
|
|
1259
|
+
u("div", fo, [
|
|
1260
|
+
u("div", vo, [
|
|
1258
1261
|
u("div", {
|
|
1259
|
-
class:
|
|
1262
|
+
class: K({
|
|
1260
1263
|
"text-fm-color-system-error-300": a.errors.length
|
|
1261
1264
|
})
|
|
1262
1265
|
}, [
|
|
1263
|
-
|
|
1264
|
-
a.type === "create" ? (g(), E("span",
|
|
1266
|
+
Te(G(a.name) + " ", 1),
|
|
1267
|
+
a.type === "create" ? (g(), E("span", yo, "(new)")) : z("", !0)
|
|
1265
1268
|
], 2),
|
|
1266
|
-
a.errors.length ? (g(), E("div",
|
|
1269
|
+
a.errors.length ? (g(), E("div", go, [
|
|
1267
1270
|
y(n, { "z-index": 50 }, {
|
|
1268
|
-
content:
|
|
1271
|
+
content: I(() => [
|
|
1269
1272
|
u("ol", null, [
|
|
1270
|
-
(g(!0), E(
|
|
1273
|
+
(g(!0), E(ee, null, me(a.errors, (l, d) => (g(), E("li", { key: d }, G(l), 1))), 128))
|
|
1271
1274
|
])
|
|
1272
1275
|
]),
|
|
1273
|
-
default:
|
|
1276
|
+
default: I(() => [
|
|
1274
1277
|
y(o, {
|
|
1275
1278
|
name: "error",
|
|
1276
1279
|
size: "sm",
|
|
@@ -1279,61 +1282,61 @@ const lo = {
|
|
|
1279
1282
|
]),
|
|
1280
1283
|
_: 1
|
|
1281
1284
|
})
|
|
1282
|
-
])) :
|
|
1285
|
+
])) : z("", !0)
|
|
1283
1286
|
]),
|
|
1284
1287
|
u("div", {
|
|
1285
|
-
class:
|
|
1288
|
+
class: K([
|
|
1286
1289
|
"fm-typo-en-body-sm-400",
|
|
1287
1290
|
{
|
|
1288
1291
|
"text-fm-color-system-error-200": a.errors.length,
|
|
1289
1292
|
"text-fm-color-typo-secondary": !a.errors.length
|
|
1290
1293
|
}
|
|
1291
1294
|
])
|
|
1292
|
-
},
|
|
1295
|
+
}, G(a.code), 3)
|
|
1293
1296
|
])
|
|
1294
1297
|
]);
|
|
1295
1298
|
};
|
|
1296
1299
|
}
|
|
1297
|
-
}),
|
|
1300
|
+
}), ho = { class: "flex flex-col gap-24" }, bo = /* @__PURE__ */ u("div", { class: "fm-typo-en-body-md-400" }, " Import ingredients from your Excel file and apply changes to your business. ", -1), _o = { class: "flex flex-col gap-8" }, xo = { class: "line-clamp-2 text-ellipsis break-all" }, Vo = {
|
|
1298
1301
|
key: 2,
|
|
1299
1302
|
class: "shrink-0"
|
|
1300
|
-
},
|
|
1303
|
+
}, ko = {
|
|
1301
1304
|
key: 0,
|
|
1302
1305
|
class: "flex flex-col"
|
|
1303
|
-
},
|
|
1306
|
+
}, Fo = { class: "text-fm-color-system-error-300 fm-typo-en-body-sm-400" }, Co = {
|
|
1304
1307
|
key: 0,
|
|
1305
1308
|
class: "max-h-[200px] overflow-y-auto flex flex-col gap-8"
|
|
1306
|
-
},
|
|
1309
|
+
}, So = /* @__PURE__ */ u("div", { class: "fm-typo-en-body-lg-600" }, "Summary", -1), wo = /* @__PURE__ */ oe({
|
|
1307
1310
|
__name: "ImportIngredients",
|
|
1308
1311
|
setup(r) {
|
|
1309
|
-
const a =
|
|
1312
|
+
const a = P(null), p = ot(), o = he(), n = P(!1), l = P(new Array()), d = P([]), v = P([]), _ = k(
|
|
1310
1313
|
() => !!l.value.length || d.value.some((c) => c.errors.length) || v.value.some((c) => c.errors.length)
|
|
1311
|
-
), i =
|
|
1314
|
+
), i = k(
|
|
1312
1315
|
() => !!d.value.length || !!v.value.length
|
|
1313
1316
|
);
|
|
1314
|
-
async function
|
|
1317
|
+
async function b(c) {
|
|
1315
1318
|
l.value = [], d.value = [], v.value = [];
|
|
1316
1319
|
try {
|
|
1317
1320
|
n.value = !0;
|
|
1318
1321
|
const [f] = await Promise.all([
|
|
1319
|
-
|
|
1322
|
+
gt(c),
|
|
1320
1323
|
// fake buffer
|
|
1321
|
-
new Promise((
|
|
1322
|
-
]),
|
|
1323
|
-
if (!
|
|
1324
|
+
new Promise((F) => setTimeout(F, 1e3))
|
|
1325
|
+
]), D = f.SheetNames.find((F) => F);
|
|
1326
|
+
if (!D) {
|
|
1324
1327
|
l.value.push("No sheet is found in the excel file.");
|
|
1325
1328
|
return;
|
|
1326
1329
|
}
|
|
1327
|
-
const
|
|
1328
|
-
if (
|
|
1329
|
-
l.value.push(
|
|
1330
|
+
const x = lo(f.Sheets[D]);
|
|
1331
|
+
if (x.invalidExcel) {
|
|
1332
|
+
l.value.push(x.invalidExcelMessage ?? "Invalid excel");
|
|
1330
1333
|
return;
|
|
1331
1334
|
}
|
|
1332
|
-
if (d.value =
|
|
1335
|
+
if (d.value = x.importCreateResult, v.value = x.importUpdateResult, !d.value.length && !v.value.length) {
|
|
1333
1336
|
l.value.push("No import data is available in the excel file.");
|
|
1334
1337
|
return;
|
|
1335
1338
|
}
|
|
1336
|
-
p.emitData(
|
|
1339
|
+
p.emitData(x);
|
|
1337
1340
|
} catch (f) {
|
|
1338
1341
|
o.open({
|
|
1339
1342
|
title: "Unable to read file",
|
|
@@ -1347,28 +1350,28 @@ const lo = {
|
|
|
1347
1350
|
}), n.value = !1;
|
|
1348
1351
|
}
|
|
1349
1352
|
}
|
|
1350
|
-
return
|
|
1351
|
-
c &&
|
|
1353
|
+
return Pe(a, (c) => {
|
|
1354
|
+
c && b(c);
|
|
1352
1355
|
}), (c, f) => {
|
|
1353
|
-
const
|
|
1354
|
-
return g(), E("div",
|
|
1356
|
+
const D = $("FmCircularProgress"), x = $("FmIcon"), F = $("FmButton");
|
|
1357
|
+
return g(), E("div", ho, [
|
|
1355
1358
|
bo,
|
|
1356
|
-
y(
|
|
1357
|
-
class:
|
|
1359
|
+
y(co, {
|
|
1360
|
+
class: K({
|
|
1358
1361
|
"w-full": !0,
|
|
1359
1362
|
"h-[200px]": !a.value
|
|
1360
1363
|
}),
|
|
1361
1364
|
accept: ".xlsx",
|
|
1362
|
-
onFileUpload: f[0] || (f[0] = (
|
|
1365
|
+
onFileUpload: f[0] || (f[0] = (C) => a.value = C),
|
|
1363
1366
|
label: "Upload template",
|
|
1364
1367
|
"button-label": "Select file"
|
|
1365
|
-
},
|
|
1368
|
+
}, Be({ _: 2 }, [
|
|
1366
1369
|
a.value ? {
|
|
1367
1370
|
name: "default",
|
|
1368
|
-
fn:
|
|
1369
|
-
u("div",
|
|
1371
|
+
fn: I(({ openFileDialog: C }) => [
|
|
1372
|
+
u("div", _o, [
|
|
1370
1373
|
u("div", {
|
|
1371
|
-
class:
|
|
1374
|
+
class: K([
|
|
1372
1375
|
"fm-corner-radius-md p-16 flex items-center gap-16",
|
|
1373
1376
|
{
|
|
1374
1377
|
"border border-fm-color-neutral-gray-100": n.value,
|
|
@@ -1377,18 +1380,18 @@ const lo = {
|
|
|
1377
1380
|
}
|
|
1378
1381
|
])
|
|
1379
1382
|
}, [
|
|
1380
|
-
n.value ? (g(), B(
|
|
1383
|
+
n.value ? (g(), B(D, {
|
|
1381
1384
|
key: 0,
|
|
1382
1385
|
size: "md",
|
|
1383
1386
|
color: "neutral-gray-200"
|
|
1384
|
-
})) : (g(), B(
|
|
1387
|
+
})) : (g(), B(x, {
|
|
1385
1388
|
key: 1,
|
|
1386
1389
|
name: _.value ? "error" : "attach_file",
|
|
1387
1390
|
outline: "",
|
|
1388
1391
|
color: _.value ? "system-error-300" : void 0
|
|
1389
1392
|
}, null, 8, ["name", "color"])),
|
|
1390
1393
|
u("div", {
|
|
1391
|
-
class:
|
|
1394
|
+
class: K([
|
|
1392
1395
|
"fm-typo-en-body-md-400 flex-1 h-[36px] flex items-center",
|
|
1393
1396
|
{
|
|
1394
1397
|
"text-fm-color-typo-disabled": n.value,
|
|
@@ -1396,74 +1399,74 @@ const lo = {
|
|
|
1396
1399
|
}
|
|
1397
1400
|
])
|
|
1398
1401
|
}, [
|
|
1399
|
-
u("div",
|
|
1402
|
+
u("div", xo, G(a.value.name), 1)
|
|
1400
1403
|
], 2),
|
|
1401
|
-
n.value ?
|
|
1402
|
-
y(
|
|
1404
|
+
n.value ? z("", !0) : (g(), E("div", Vo, [
|
|
1405
|
+
y(F, {
|
|
1403
1406
|
label: "Replace file",
|
|
1404
1407
|
variant: _.value ? "destructive" : "secondary",
|
|
1405
1408
|
"prepend-icon": _.value ? void 0 : "autorenew",
|
|
1406
|
-
onClick:
|
|
1409
|
+
onClick: C
|
|
1407
1410
|
}, null, 8, ["variant", "prepend-icon", "onClick"])
|
|
1408
1411
|
]))
|
|
1409
1412
|
], 2),
|
|
1410
|
-
l.value.length ? (g(), E("div",
|
|
1411
|
-
(g(!0), E(
|
|
1412
|
-
key:
|
|
1413
|
+
l.value.length ? (g(), E("div", ko, [
|
|
1414
|
+
(g(!0), E(ee, null, me(l.value, (T, V) => (g(), E("div", {
|
|
1415
|
+
key: V,
|
|
1413
1416
|
class: "flex gap-8 items-center"
|
|
1414
1417
|
}, [
|
|
1415
|
-
y(
|
|
1418
|
+
y(x, {
|
|
1416
1419
|
name: "error",
|
|
1417
1420
|
size: "sm",
|
|
1418
1421
|
color: "system-error-300"
|
|
1419
1422
|
}),
|
|
1420
|
-
u("div",
|
|
1423
|
+
u("div", Fo, G(T), 1)
|
|
1421
1424
|
]))), 128))
|
|
1422
|
-
])) :
|
|
1425
|
+
])) : z("", !0)
|
|
1423
1426
|
])
|
|
1424
1427
|
]),
|
|
1425
1428
|
key: "0"
|
|
1426
1429
|
} : void 0
|
|
1427
1430
|
]), 1032, ["class"]),
|
|
1428
|
-
i.value ? (g(), E("div",
|
|
1429
|
-
|
|
1430
|
-
(g(!0), E(
|
|
1431
|
-
key:
|
|
1432
|
-
code:
|
|
1433
|
-
name:
|
|
1434
|
-
errors:
|
|
1431
|
+
i.value ? (g(), E("div", Co, [
|
|
1432
|
+
So,
|
|
1433
|
+
(g(!0), E(ee, null, me(d.value, (C) => (g(), B(Ae, {
|
|
1434
|
+
key: C.sku._id,
|
|
1435
|
+
code: C.sku.code,
|
|
1436
|
+
name: C.sku.name,
|
|
1437
|
+
errors: C.errors,
|
|
1435
1438
|
type: "create"
|
|
1436
1439
|
}, null, 8, ["code", "name", "errors"]))), 128)),
|
|
1437
|
-
(g(!0), E(
|
|
1438
|
-
key:
|
|
1439
|
-
code:
|
|
1440
|
-
name:
|
|
1441
|
-
errors:
|
|
1440
|
+
(g(!0), E(ee, null, me(v.value, (C) => (g(), B(Ae, {
|
|
1441
|
+
key: C.sku._id,
|
|
1442
|
+
code: C.sku.code,
|
|
1443
|
+
name: C.sku.name,
|
|
1444
|
+
errors: C.errors,
|
|
1442
1445
|
type: "update"
|
|
1443
1446
|
}, null, 8, ["code", "name", "errors"]))), 128))
|
|
1444
|
-
])) :
|
|
1447
|
+
])) : z("", !0)
|
|
1445
1448
|
]);
|
|
1446
1449
|
};
|
|
1447
1450
|
}
|
|
1448
|
-
}),
|
|
1451
|
+
}), Mo = { class: "px-24 xs:p-0 sm:p-0 flex flex-col gap-8 max-h-full" }, $o = { class: "flex flex-col py-8" }, Io = { 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" }, Ro = /* @__PURE__ */ u("div", null, "Importing...", -1), Jo = /* @__PURE__ */ oe({
|
|
1449
1452
|
__name: "IngredientsView",
|
|
1450
1453
|
setup(r) {
|
|
1451
|
-
const a = ne(), p =
|
|
1454
|
+
const a = ne(), p = k(() => a.skus), o = tt(), n = Ne(), l = he(), {
|
|
1452
1455
|
createIngredient: d,
|
|
1453
1456
|
updateIngredient: v,
|
|
1454
1457
|
deleteIngredient: _,
|
|
1455
1458
|
ingredientDialogProps: i,
|
|
1456
|
-
ingredientViewLoading:
|
|
1457
|
-
} = bt(), { columnDefs: c } =
|
|
1458
|
-
function f(
|
|
1459
|
-
switch (
|
|
1459
|
+
ingredientViewLoading: b
|
|
1460
|
+
} = bt(), { columnDefs: c } = _t({ updateIngredient: v, deleteIngredient: _ });
|
|
1461
|
+
function f(U) {
|
|
1462
|
+
switch (U) {
|
|
1460
1463
|
case "add":
|
|
1461
1464
|
return d();
|
|
1462
1465
|
case "import":
|
|
1463
|
-
return
|
|
1466
|
+
return O();
|
|
1464
1467
|
}
|
|
1465
1468
|
}
|
|
1466
|
-
const
|
|
1469
|
+
const D = P(""), x = P(!1), F = k(() => x.value || b.value), { breakpoints: C } = nt(), T = k(() => C.value.xs || C.value.sm), V = k(() => T.value ? 10 : 20), le = it(), N = P(!1), q = [
|
|
1467
1470
|
{
|
|
1468
1471
|
value: "import",
|
|
1469
1472
|
label: "Import"
|
|
@@ -1473,36 +1476,32 @@ const lo = {
|
|
|
1473
1476
|
label: "Export"
|
|
1474
1477
|
}
|
|
1475
1478
|
];
|
|
1476
|
-
function ae(
|
|
1477
|
-
switch (
|
|
1479
|
+
function ae(U) {
|
|
1480
|
+
switch (N.value = !1, U) {
|
|
1478
1481
|
case "import":
|
|
1479
|
-
return
|
|
1482
|
+
return O();
|
|
1480
1483
|
case "export":
|
|
1481
|
-
return
|
|
1484
|
+
return L();
|
|
1482
1485
|
}
|
|
1483
1486
|
}
|
|
1484
|
-
const
|
|
1485
|
-
|
|
1486
|
-
] : [
|
|
1487
|
-
{ label: "Export", icon: "ios_share", key: "export" }
|
|
1488
|
-
]), s = F(() => {
|
|
1489
|
-
const R = [
|
|
1487
|
+
const X = k(() => T.value ? [{ icon: "more_vert", onClick: te }] : [{ icon: "ios_share", onClick: L }]), s = k(() => {
|
|
1488
|
+
const U = [
|
|
1490
1489
|
{ label: "Add ingredient", value: "add", isPrimary: !0, prependIcon: "add" }
|
|
1491
1490
|
];
|
|
1492
|
-
return
|
|
1491
|
+
return T.value ? U : [...U, { label: "Import", value: "import" }];
|
|
1493
1492
|
});
|
|
1494
|
-
function
|
|
1495
|
-
const
|
|
1493
|
+
function L() {
|
|
1494
|
+
const U = to();
|
|
1496
1495
|
l.open({
|
|
1497
1496
|
title: "Ingredients exported",
|
|
1498
|
-
message: `Filename: ${
|
|
1497
|
+
message: `Filename: ${U}`,
|
|
1499
1498
|
type: "success"
|
|
1500
1499
|
});
|
|
1501
1500
|
}
|
|
1502
|
-
function
|
|
1501
|
+
function O() {
|
|
1503
1502
|
n.open({
|
|
1504
1503
|
title: "Import ingredients",
|
|
1505
|
-
contentComponent:
|
|
1504
|
+
contentComponent: wo,
|
|
1506
1505
|
overlay: !0,
|
|
1507
1506
|
closeButton: !0,
|
|
1508
1507
|
primaryActions: {
|
|
@@ -1518,15 +1517,15 @@ const lo = {
|
|
|
1518
1517
|
close: !1,
|
|
1519
1518
|
variant: "plain"
|
|
1520
1519
|
}
|
|
1521
|
-
}).onPrimary((
|
|
1522
|
-
if (!
|
|
1520
|
+
}).onPrimary((U) => {
|
|
1521
|
+
if (!U) {
|
|
1523
1522
|
l.open({
|
|
1524
1523
|
title: "No import data received",
|
|
1525
1524
|
type: "error"
|
|
1526
1525
|
});
|
|
1527
1526
|
return;
|
|
1528
1527
|
}
|
|
1529
|
-
if (!
|
|
1528
|
+
if (!U.importCreateResult.length && !U.importUpdateResult.length) {
|
|
1530
1529
|
l.open({
|
|
1531
1530
|
title: "Invalid content",
|
|
1532
1531
|
message: "No import data in the excel file",
|
|
@@ -1534,7 +1533,7 @@ const lo = {
|
|
|
1534
1533
|
});
|
|
1535
1534
|
return;
|
|
1536
1535
|
}
|
|
1537
|
-
if (
|
|
1536
|
+
if (U.importCreateResult.some((M) => M.errors.length) || U.importUpdateResult.some((M) => M.errors.length)) {
|
|
1538
1537
|
l.open({
|
|
1539
1538
|
title: "Invalid content",
|
|
1540
1539
|
message: "There is error in the import data.",
|
|
@@ -1542,110 +1541,121 @@ const lo = {
|
|
|
1542
1541
|
});
|
|
1543
1542
|
return;
|
|
1544
1543
|
}
|
|
1545
|
-
n.close(),
|
|
1546
|
-
}).onTertiary(
|
|
1544
|
+
n.close(), de(U);
|
|
1545
|
+
}).onTertiary(oo);
|
|
1547
1546
|
}
|
|
1548
|
-
async function
|
|
1549
|
-
|
|
1547
|
+
async function de(U) {
|
|
1548
|
+
x.value = !0;
|
|
1550
1549
|
try {
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1550
|
+
const M = [
|
|
1551
|
+
...U.importCreateResult.map(({ sku: e }) => ({ type: "create", sku: e })),
|
|
1552
|
+
...U.importUpdateResult.map(({ sku: e }) => ({ type: "update", sku: e }))
|
|
1553
|
+
], J = 100;
|
|
1554
|
+
let se = 0;
|
|
1555
|
+
const re = () => {
|
|
1556
|
+
se += J, l.open({
|
|
1557
|
+
title: `Uploading ${Math.min(se, M.length)}/${M.length} ingredients`
|
|
1558
|
+
});
|
|
1559
|
+
};
|
|
1560
|
+
for (const e of M.chunk(100))
|
|
1561
|
+
re(), await a.importSkus({
|
|
1562
|
+
create: e.filter((t) => t.type === "create").map((t) => t.sku),
|
|
1563
|
+
update: e.filter((t) => t.type === "update").map((t) => t.sku)
|
|
1564
|
+
});
|
|
1565
|
+
l.open({
|
|
1558
1566
|
title: "Ingredients successfully imported",
|
|
1559
1567
|
type: "success"
|
|
1560
1568
|
});
|
|
1561
|
-
} catch (
|
|
1569
|
+
} catch (M) {
|
|
1562
1570
|
l.open({
|
|
1563
1571
|
title: "Failed to import ingredients",
|
|
1564
|
-
message: `System message: ${
|
|
1572
|
+
message: `System message: ${M == null ? void 0 : M.message}`,
|
|
1565
1573
|
type: "error"
|
|
1566
|
-
}), console.error("Error in importing skus",
|
|
1574
|
+
}), console.error("Error in importing skus", U, M);
|
|
1567
1575
|
} finally {
|
|
1568
|
-
|
|
1576
|
+
x.value = !1;
|
|
1569
1577
|
}
|
|
1570
1578
|
}
|
|
1571
|
-
function
|
|
1572
|
-
|
|
1579
|
+
function te() {
|
|
1580
|
+
N.value = !0;
|
|
1573
1581
|
}
|
|
1574
|
-
return (
|
|
1575
|
-
const
|
|
1582
|
+
return (U, M) => {
|
|
1583
|
+
const J = $("FmTable"), se = $("FmCollapsibleTabs"), re = $("FmBottomSheet");
|
|
1576
1584
|
return g(), B(ut, {
|
|
1577
1585
|
title: "Ingredient",
|
|
1578
1586
|
actions: s.value,
|
|
1579
1587
|
"onClick:action": f
|
|
1580
1588
|
}, {
|
|
1581
|
-
default:
|
|
1582
|
-
u("div",
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
"onClick:actionExport": x[1] || (x[1] = () => z()),
|
|
1591
|
-
"onClick:actionImport": x[2] || (x[2] = () => N()),
|
|
1592
|
-
"onClick:actionMore": x[3] || (x[3] = () => ee())
|
|
1593
|
-
}, null, 8, ["search-model", "actions"])
|
|
1594
|
-
])
|
|
1595
|
-
]),
|
|
1596
|
-
y(he, {
|
|
1589
|
+
default: I(() => [
|
|
1590
|
+
u("div", Mo, [
|
|
1591
|
+
y(dt, {
|
|
1592
|
+
searchable: "",
|
|
1593
|
+
search: D.value,
|
|
1594
|
+
"onUpdate:search": M[0] || (M[0] = (e) => D.value = e),
|
|
1595
|
+
actions: X.value
|
|
1596
|
+
}, null, 8, ["search", "actions"]),
|
|
1597
|
+
y(J, {
|
|
1597
1598
|
style: Ke(w(le).tableHeight),
|
|
1598
1599
|
"column-defs": w(c),
|
|
1599
1600
|
"row-data": p.value,
|
|
1600
|
-
"search-value":
|
|
1601
|
-
loading: !w(o)._currentLocation ||
|
|
1602
|
-
|
|
1603
|
-
|
|
1601
|
+
"search-value": D.value,
|
|
1602
|
+
loading: !w(o)._currentLocation || F.value,
|
|
1603
|
+
"loading-text": "Loading",
|
|
1604
|
+
onRowClick: M[1] || (M[1] = (e) => w(v)(e.original)),
|
|
1605
|
+
"page-size": V.value
|
|
1604
1606
|
}, {
|
|
1605
|
-
"list-row":
|
|
1607
|
+
"list-row": I((e) => [
|
|
1606
1608
|
y(rt, {
|
|
1607
1609
|
row: e,
|
|
1608
1610
|
onRowClick: w(v)
|
|
1609
|
-
}, {
|
|
1610
|
-
default:
|
|
1611
|
-
var
|
|
1611
|
+
}, Be({
|
|
1612
|
+
default: I((t) => {
|
|
1613
|
+
var m, h, R, S, H, j, Z, ce, ie, fe;
|
|
1612
1614
|
return [
|
|
1613
1615
|
u("div", $o, [
|
|
1614
|
-
u("div",
|
|
1616
|
+
u("div", Io, [
|
|
1615
1617
|
y(w(Ee), {
|
|
1616
|
-
render: (
|
|
1617
|
-
props: (H = (
|
|
1618
|
+
render: (R = (h = (m = t.code) == null ? void 0 : m.column) == null ? void 0 : h.columnDef) == null ? void 0 : R.cell,
|
|
1619
|
+
props: (H = (S = t.code) == null ? void 0 : S.getContext) == null ? void 0 : H.call(S)
|
|
1618
1620
|
}, null, 8, ["render", "props"])
|
|
1619
1621
|
]),
|
|
1620
1622
|
u("div", Uo, [
|
|
1621
1623
|
y(w(Ee), {
|
|
1622
|
-
render: (
|
|
1623
|
-
props: (
|
|
1624
|
+
render: (ce = (Z = (j = t.name) == null ? void 0 : j.column) == null ? void 0 : Z.columnDef) == null ? void 0 : ce.cell,
|
|
1625
|
+
props: (fe = (ie = t.name) == null ? void 0 : ie.getContext) == null ? void 0 : fe.call(ie)
|
|
1624
1626
|
}, null, 8, ["render", "props"])
|
|
1625
1627
|
])
|
|
1626
1628
|
])
|
|
1627
1629
|
];
|
|
1628
1630
|
}),
|
|
1629
1631
|
_: 2
|
|
1630
|
-
},
|
|
1632
|
+
}, [
|
|
1633
|
+
x.value ? {
|
|
1634
|
+
name: "loading-text",
|
|
1635
|
+
fn: I(() => [
|
|
1636
|
+
Ro
|
|
1637
|
+
]),
|
|
1638
|
+
key: "0"
|
|
1639
|
+
} : void 0
|
|
1640
|
+
]), 1032, ["row", "onRowClick"])
|
|
1631
1641
|
]),
|
|
1632
1642
|
_: 1
|
|
1633
1643
|
}, 8, ["style", "column-defs", "row-data", "search-value", "loading", "page-size"])
|
|
1634
1644
|
]),
|
|
1635
1645
|
(g(), B(Me, { to: "body" }, [
|
|
1636
|
-
y(
|
|
1646
|
+
y(Kt, Je(Qe(w(i))), null, 16)
|
|
1637
1647
|
])),
|
|
1638
1648
|
(g(), B(Me, { to: "body" }, [
|
|
1639
|
-
y(
|
|
1649
|
+
y(re, {
|
|
1640
1650
|
"dismiss-away": "",
|
|
1641
|
-
modelValue:
|
|
1642
|
-
"onUpdate:modelValue":
|
|
1651
|
+
modelValue: N.value,
|
|
1652
|
+
"onUpdate:modelValue": M[3] || (M[3] = (e) => N.value = e)
|
|
1643
1653
|
}, {
|
|
1644
|
-
default:
|
|
1645
|
-
y(
|
|
1654
|
+
default: I(() => [
|
|
1655
|
+
y(se, {
|
|
1646
1656
|
class: "pb-8",
|
|
1647
|
-
items:
|
|
1648
|
-
"onUpdate:modelValue":
|
|
1657
|
+
items: q,
|
|
1658
|
+
"onUpdate:modelValue": M[2] || (M[2] = (e) => ae(e))
|
|
1649
1659
|
})
|
|
1650
1660
|
]),
|
|
1651
1661
|
_: 1
|
|
@@ -1658,5 +1668,5 @@ const lo = {
|
|
|
1658
1668
|
}
|
|
1659
1669
|
});
|
|
1660
1670
|
export {
|
|
1661
|
-
|
|
1671
|
+
Jo as default
|
|
1662
1672
|
};
|