@feedmepos/mf-inventory-portal 0.0.25-dev.41 → 0.0.25-dev.42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{App-BqAbcrCa.js → App-BgLyTa3Z.js} +2 -2
- package/dist/{ApprovalView-CstNyWuq.js → ApprovalView-UC31qsPD.js} +17 -17
- package/dist/{BindingsDialog-B2POgTvT.js → BindingsDialog-h9el4EvX.js} +2 -2
- package/dist/{BindingsPicker-Bp8wNAW0.js → BindingsPicker-Cw5AT6xO.js} +1 -1
- package/dist/{BindingsTable-C5ToIwJw.js → BindingsTable-Boj3hZup.js} +1 -1
- package/dist/{ClosingDraftView-B5KgTQOB.js → ClosingDraftView-DOH7FmkH.js} +2 -2
- package/dist/{ClosingTemplateView-B6gT5-A_.js → ClosingTemplateView-CG7qArA8.js} +2 -2
- package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-BcedQV1P.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-k1J8dWcK.js} +3 -3
- package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-Bc6eTKR-.js → FmUnitInput.vue_vue_type_script_setup_true_lang-C5qp_p1A.js} +1 -1
- package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-C76t4wed.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-DBYsiV9t.js} +1 -1
- package/dist/{IngredientGroupView-Bo18pDpd.js → IngredientGroupView-CWEw3I3i.js} +14 -14
- package/dist/{IngredientsView-D4Tx5h1N.js → IngredientsView-B6EDjPTe.js} +492 -504
- package/dist/{IntegrationView-5cTVErK7.js → IntegrationView-DiSoM1K8.js} +1 -1
- package/dist/{InventoryBindingForm-D_JUD2PF.js → InventoryBindingForm-nKWx-EUW.js} +1 -1
- package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-Co33Sz1A.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-BMMD4hwX.js} +3 -3
- package/dist/{InventoryBindingSummary-DsQqzLxI.js → InventoryBindingSummary-CQnCjIY4.js} +1 -1
- package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-CKCHqrFd.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-Cr8DwdOC.js} +1 -1
- package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-NhSXPpV1.js → PremiumBadge.vue_vue_type_script_setup_true_lang-DnZI3Gfj.js} +1 -1
- package/dist/{PublishView-CVReC-7J.js → PublishView-DvHW27pI.js} +7 -7
- package/dist/{PurchaseOrderPrintPreview-kHtSdc_I.js → PurchaseOrderPrintPreview-DSTbRKyh.js} +1 -1
- package/dist/{ReceiveRequestView-JJdBl6jR.js → ReceiveRequestView-BKRHqSU-.js} +9 -9
- package/dist/{RecipeView-BAZzsPdQ.js → RecipeView-CFTrf0YF.js} +21 -21
- package/dist/{StockView-Dwzf7ewT.js → StockView-CAPLd29m.js} +1526 -1539
- package/dist/{SupplierView-BoTsfsYX.js → SupplierView-C_CrS9FM.js} +441 -453
- package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-C2ZBmCNY.js → TransferDetails.vue_vue_type_script_setup_true_lang-BWuWB95v.js} +4 -4
- package/dist/{TransferTemplateView-BLO1uHet.js → TransferTemplateView-BaJaiaO9.js} +68 -68
- package/dist/{UnitView-DfJ-huaQ.js → UnitView-DY9nZs1y.js} +3 -3
- package/dist/{WarehouseView-h5_GDAYM.js → WarehouseView-CAFxl8K4.js} +1 -1
- package/dist/{app-CRWxxzQN.js → app-Jh5wwLsF.js} +3271 -3260
- package/dist/app.js +1 -1
- package/dist/{decimal-BDt03-KF.js → decimal-0_acpDRy.js} +1 -1
- package/dist/{feature-D_c7uzcV.js → feature-CqX_LtOl.js} +1 -1
- package/dist/{format-unit-display-CsfojMpU.js → format-unit-display-CYPC8_oX.js} +2 -2
- package/dist/helper/country.d.ts +1 -0
- package/dist/{index-BbwuhE-c.js → index-QcOk4LDU.js} +2 -2
- package/dist/{stock-DSyF_gBG.js → stock-BpWEKDoQ.js} +1 -1
- package/dist/stores/helper/generate-backend-urls.d.ts +0 -1
- package/dist/{supplier-BLqNIQG9.js → supplier-By3gzRHW.js} +1 -1
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/{use-ingredient-select-dialog-BSxFzWSk.js → use-ingredient-select-dialog-hkbfGnB9.js} +1 -1
- package/dist/{use-inventory-binding-dialog-DyIQsTTm.js → use-inventory-binding-dialog-BFG04MUx.js} +1 -1
- package/dist/{vue-i18n-ZO6qpjnw.js → vue-i18n-D57Xfcpf.js} +2 -2
- package/package.json +3 -3
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { ref as
|
|
2
|
-
import { a as
|
|
3
|
-
import { useDialog as
|
|
4
|
-
import { i as
|
|
5
|
-
import { useI18n as
|
|
6
|
-
import { defineStore as
|
|
7
|
-
import { g as
|
|
8
|
-
import { _ as
|
|
9
|
-
import { _ as
|
|
10
|
-
import { u as
|
|
11
|
-
import { _ as
|
|
12
|
-
import { _ as
|
|
1
|
+
import { ref as q, defineComponent as te, computed as S, resolveComponent as C, openBlock as f, createBlock as B, withCtx as V, createVNode as c, unref as d, createElementBlock as T, Fragment as X, createElementVNode as m, createCommentVNode as j, renderSlot as ce, createTextVNode as Me, toDisplayString as A, normalizeClass as ee, onMounted as at, watch as Ye, renderList as re, isRef as De, createSlots as Ge, normalizeStyle as rt, Teleport as Pe, normalizeProps as st, guardReactiveProps as it } from "vue";
|
|
2
|
+
import { a as ne, d as K, e as We, S as dt, f as ut, D as Be, h as be, A as _e, b as Ie, i as Ke, j as xe, t as Ze, k as ve, l as Ve, U as mt, m as ct, M as pt, n as Ne, o as ze, p as Le, q as Je, r as vt, s as Qe, v as ft, w as yt, I as gt, x as bt, y as ht, u as _t, z as xt, _ as kt, B as Vt, C as St, E as He } from "./app-Jh5wwLsF.js";
|
|
3
|
+
import { useDialog as Xe, useSnackbar as ke, useProxiedModel as Oe, useDialogChild as Ct, useBreakpoints as wt } from "@feedmepos/ui-library";
|
|
4
|
+
import { i as Ft, _ as Mt } from "./is-linked-ingredient-error-fJ2TJb3z.js";
|
|
5
|
+
import { useI18n as oe, useCoreStore as fe } from "@feedmepos/mf-common";
|
|
6
|
+
import { defineStore as It, storeToRefs as $t } from "pinia";
|
|
7
|
+
import { g as Et, _ as Se, S as Ce } from "./StockForecast.vue_vue_type_style_index_0_lang-KLXSWvo5.js";
|
|
8
|
+
import { _ as Ut } from "./InventoryBindingForm.vue_vue_type_script_setup_true_lang-BMMD4hwX.js";
|
|
9
|
+
import { _ as we } from "./IngredientBindedItem.vue_vue_type_script_setup_true_lang-DBYsiV9t.js";
|
|
10
|
+
import { u as et } from "./feature-CqX_LtOl.js";
|
|
11
|
+
import { _ as he } from "./PreviewBadge.vue_vue_type_script_setup_true_lang-CRZiQHjx.js";
|
|
12
|
+
import { _ as Rt } from "./FmCustomAttribute.vue_vue_type_script_setup_true_lang-D-IWRjRD.js";
|
|
13
13
|
import "./array-hChJVZLE.js";
|
|
14
|
-
const
|
|
15
|
-
const o =
|
|
14
|
+
const Fe = It("ingredientForm", function() {
|
|
15
|
+
const o = Xe(), y = ke(), r = ne(), n = q(!1), { t: l } = oe(), i = q();
|
|
16
16
|
function a() {
|
|
17
17
|
const b = {
|
|
18
18
|
unit: {},
|
|
19
|
-
mode:
|
|
19
|
+
mode: K.CREATE,
|
|
20
20
|
show: !0,
|
|
21
21
|
"onUpdate:show"(s) {
|
|
22
22
|
i.value.show = s;
|
|
@@ -26,8 +26,8 @@ const Ie = $t("ingredientForm", function() {
|
|
|
26
26
|
}
|
|
27
27
|
async function h(b) {
|
|
28
28
|
const s = {
|
|
29
|
-
unit:
|
|
30
|
-
mode:
|
|
29
|
+
unit: We(b),
|
|
30
|
+
mode: K.UPDATE,
|
|
31
31
|
show: !0,
|
|
32
32
|
"onUpdate:show"(x) {
|
|
33
33
|
i.value.show = x;
|
|
@@ -44,9 +44,9 @@ const Ie = $t("ingredientForm", function() {
|
|
|
44
44
|
type: "success"
|
|
45
45
|
});
|
|
46
46
|
} catch (s) {
|
|
47
|
-
s instanceof
|
|
47
|
+
s instanceof dt && Ft(s) ? o.open({
|
|
48
48
|
title: "Cannot delete ingredient",
|
|
49
|
-
contentComponent:
|
|
49
|
+
contentComponent: Mt,
|
|
50
50
|
contentComponentProps: {
|
|
51
51
|
subject: (b == null ? void 0 : b.name) ?? "",
|
|
52
52
|
items: s.errorResponse.message
|
|
@@ -88,15 +88,15 @@ const Ie = $t("ingredientForm", function() {
|
|
|
88
88
|
ingredientViewLoading: n
|
|
89
89
|
};
|
|
90
90
|
});
|
|
91
|
-
function
|
|
92
|
-
const { updateIngredient: u, deleteIngredient: o } =
|
|
91
|
+
function Tt() {
|
|
92
|
+
const { updateIngredient: u, deleteIngredient: o } = Fe(), { t: y } = oe();
|
|
93
93
|
async function r(l, i) {
|
|
94
|
-
const a =
|
|
95
|
-
if (l ===
|
|
94
|
+
const a = We(i);
|
|
95
|
+
if (l === be.Edit) {
|
|
96
96
|
await u(a);
|
|
97
97
|
return;
|
|
98
98
|
}
|
|
99
|
-
if (l ===
|
|
99
|
+
if (l === be.Delete) {
|
|
100
100
|
await o(a);
|
|
101
101
|
return;
|
|
102
102
|
}
|
|
@@ -136,8 +136,8 @@ function At() {
|
|
|
136
136
|
id: "action",
|
|
137
137
|
header: "",
|
|
138
138
|
cell(l) {
|
|
139
|
-
return
|
|
140
|
-
[
|
|
139
|
+
return ut(
|
|
140
|
+
[Be[be.Edit], Be[be.Delete]],
|
|
141
141
|
(i) => {
|
|
142
142
|
r(i, l.row.original);
|
|
143
143
|
}
|
|
@@ -152,7 +152,7 @@ function At() {
|
|
|
152
152
|
}
|
|
153
153
|
] };
|
|
154
154
|
}
|
|
155
|
-
const
|
|
155
|
+
const At = /* @__PURE__ */ te({
|
|
156
156
|
__name: "ConvertForm",
|
|
157
157
|
props: {
|
|
158
158
|
modelValue: {},
|
|
@@ -168,7 +168,7 @@ const Dt = /* @__PURE__ */ ne({
|
|
|
168
168
|
}), n = S(() => {
|
|
169
169
|
var s;
|
|
170
170
|
return (s = y.rootValue) == null ? void 0 : s._id;
|
|
171
|
-
}), l = o, { t: i } =
|
|
171
|
+
}), l = o, { t: i } = oe(), a = S({
|
|
172
172
|
get() {
|
|
173
173
|
return !!y.modelValue;
|
|
174
174
|
},
|
|
@@ -178,7 +178,7 @@ const Dt = /* @__PURE__ */ ne({
|
|
|
178
178
|
inventoryBindings: []
|
|
179
179
|
}) : l("update:modelValue", null);
|
|
180
180
|
}
|
|
181
|
-
}), h = S(() =>
|
|
181
|
+
}), h = S(() => Et(r.value));
|
|
182
182
|
function k(s) {
|
|
183
183
|
const x = y.modelValue ?? {};
|
|
184
184
|
x.measurement = s ? `${s}` : null, l("update:modelValue", x);
|
|
@@ -193,13 +193,13 @@ const Dt = /* @__PURE__ */ ne({
|
|
|
193
193
|
return s.measurement ? h.value.find((x) => x.value === s.measurement) ?? null : h.value.find((x) => x.value === null) ?? null;
|
|
194
194
|
});
|
|
195
195
|
return (s, x) => {
|
|
196
|
-
const U = C("FmSwitch"), I = C("FmSelect"),
|
|
197
|
-
return f(),
|
|
196
|
+
const U = C("FmSwitch"), I = C("FmSelect"), N = C("FmCard");
|
|
197
|
+
return f(), B(N, {
|
|
198
198
|
variant: "outlined",
|
|
199
199
|
class: "p-16 flex flex-col gap-16"
|
|
200
200
|
}, {
|
|
201
201
|
default: V(() => {
|
|
202
|
-
var
|
|
202
|
+
var w, v;
|
|
203
203
|
return [
|
|
204
204
|
c(U, {
|
|
205
205
|
value: "",
|
|
@@ -214,21 +214,21 @@ const Dt = /* @__PURE__ */ ne({
|
|
|
214
214
|
m("div", null, [
|
|
215
215
|
c(I, {
|
|
216
216
|
label: d(i)("inventory.ingredient.convertible.convertTo"),
|
|
217
|
-
modelValue: (
|
|
217
|
+
modelValue: (w = b.value) == null ? void 0 : w.value,
|
|
218
218
|
"onUpdate:modelValue": k,
|
|
219
219
|
items: h.value,
|
|
220
220
|
disabled: s.readonly
|
|
221
221
|
}, null, 8, ["label", "modelValue", "items", "disabled"])
|
|
222
222
|
]),
|
|
223
|
-
c(
|
|
223
|
+
c(Ut, {
|
|
224
224
|
id: n.value,
|
|
225
225
|
"model-value": ((v = s.modelValue) == null ? void 0 : v.inventoryBindings) ?? [],
|
|
226
226
|
"onUpdate:modelValue": g,
|
|
227
227
|
"exclude-binding-id": n.value,
|
|
228
|
-
rules: [d(
|
|
228
|
+
rules: [d(_e)(1)],
|
|
229
229
|
readonly: s.readonly
|
|
230
230
|
}, null, 8, ["id", "model-value", "exclude-binding-id", "rules", "readonly"])
|
|
231
|
-
], 64)) :
|
|
231
|
+
], 64)) : j("", !0)
|
|
232
232
|
];
|
|
233
233
|
}),
|
|
234
234
|
_: 1
|
|
@@ -236,16 +236,16 @@ const Dt = /* @__PURE__ */ ne({
|
|
|
236
236
|
};
|
|
237
237
|
}
|
|
238
238
|
});
|
|
239
|
-
function
|
|
239
|
+
function ae() {
|
|
240
240
|
return {
|
|
241
241
|
low: 6,
|
|
242
242
|
mid: 14
|
|
243
243
|
};
|
|
244
244
|
}
|
|
245
|
-
const
|
|
245
|
+
const Dt = {
|
|
246
246
|
key: 0,
|
|
247
247
|
class: "flex flex-col gap-4"
|
|
248
|
-
},
|
|
248
|
+
}, pe = /* @__PURE__ */ te({
|
|
249
249
|
__name: "FmLockableField",
|
|
250
250
|
props: {
|
|
251
251
|
locked: { type: Boolean },
|
|
@@ -260,23 +260,23 @@ const Pt = {
|
|
|
260
260
|
setup(u) {
|
|
261
261
|
return (o, y) => {
|
|
262
262
|
const r = C("FmLabel"), n = C("FmIcon"), l = C("FmTooltip"), i = C("FmField");
|
|
263
|
-
return o.locked ? (f(), T("div",
|
|
264
|
-
|
|
263
|
+
return o.locked ? (f(), T("div", Dt, [
|
|
264
|
+
ce(o.$slots, "label", {}, () => [
|
|
265
265
|
c(r, {
|
|
266
266
|
label: o.label,
|
|
267
267
|
disabled: o.disabled
|
|
268
268
|
}, null, 8, ["label", "disabled"])
|
|
269
269
|
]),
|
|
270
|
-
|
|
270
|
+
ce(o.$slots, "field", {}, () => [
|
|
271
271
|
c(i, { disabled: o.disabled }, {
|
|
272
272
|
prepend: V(() => [
|
|
273
|
-
o.tooltipMessage ? (f(),
|
|
273
|
+
o.tooltipMessage ? (f(), B(l, {
|
|
274
274
|
key: 0,
|
|
275
275
|
placement: o.tooltipPlacement,
|
|
276
276
|
"z-index": o.tooltipZIndex
|
|
277
277
|
}, {
|
|
278
278
|
content: V(() => [
|
|
279
|
-
|
|
279
|
+
Me(A(o.tooltipMessage), 1)
|
|
280
280
|
]),
|
|
281
281
|
default: V(() => [
|
|
282
282
|
c(n, {
|
|
@@ -285,14 +285,14 @@ const Pt = {
|
|
|
285
285
|
})
|
|
286
286
|
]),
|
|
287
287
|
_: 1
|
|
288
|
-
}, 8, ["placement", "z-index"])) : (f(),
|
|
288
|
+
}, 8, ["placement", "z-index"])) : (f(), B(n, {
|
|
289
289
|
key: 1,
|
|
290
290
|
name: "lock",
|
|
291
291
|
color: "neutral-gray-400"
|
|
292
292
|
}))
|
|
293
293
|
]),
|
|
294
294
|
default: V(() => [
|
|
295
|
-
|
|
295
|
+
ce(o.$slots, "modelValue", {}, () => [
|
|
296
296
|
m("div", {
|
|
297
297
|
class: ee([
|
|
298
298
|
o.disabled ? "text-fm-color-typo-disabled" : "text-fm-color-typo-primary",
|
|
@@ -304,7 +304,7 @@ const Pt = {
|
|
|
304
304
|
_: 3
|
|
305
305
|
}, 8, ["disabled"])
|
|
306
306
|
]),
|
|
307
|
-
|
|
307
|
+
ce(o.$slots, "helper-text", {}, () => [
|
|
308
308
|
m("div", {
|
|
309
309
|
class: ee([
|
|
310
310
|
"fm-typo-en-body-sm-400 line-clamp-1",
|
|
@@ -312,13 +312,13 @@ const Pt = {
|
|
|
312
312
|
])
|
|
313
313
|
}, A(o.helperText), 3)
|
|
314
314
|
])
|
|
315
|
-
])) :
|
|
315
|
+
])) : ce(o.$slots, "default", { key: 1 });
|
|
316
316
|
};
|
|
317
317
|
}
|
|
318
|
-
}),
|
|
318
|
+
}), Pt = { class: "flex gap-8" }, Bt = { class: "flex-1" }, Nt = { class: "flex-1" }, zt = { class: "text-fm-color-typo-secondary" }, Lt = { class: "text-fm-color-typo-secondary whitespace-nowrap" }, Ht = {
|
|
319
319
|
key: 3,
|
|
320
320
|
class: "border-1 border-fm-color-neutral-gray-200 fm-corner-radius-lg flex flex-col p-16 gap-16"
|
|
321
|
-
},
|
|
321
|
+
}, Ot = { class: "flex flex-col gap-12" }, jt = { class: "flex flex-col gap-4" }, qt = { class: "fm-typo-en-title-sm-600" }, Yt = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Gt = { class: "flex flex-col gap-4" }, Wt = { class: "flex fm-corner-radius-md border-1 border-fm-color-neutral-gray-200" }, Kt = { class: "flex-1 p-12 flex flex-col gap-8" }, Zt = { class: "mx-auto" }, Jt = { class: "flex flex-col" }, Qt = { class: "fm-typo-en-body-sm-600 translate-y-4" }, Xt = { class: "flex-1 p-12 flex flex-col gap-8" }, en = { class: "mx-auto" }, tn = { class: "flex flex-col" }, nn = { class: "fm-typo-en-body-sm-600 translate-y-4" }, on = { class: "flex-1 p-12 flex flex-col gap-8" }, ln = { class: "mx-auto" }, an = { class: "flex flex-col" }, rn = { class: "fm-typo-en-body-sm-600 translate-y-4" }, sn = /* @__PURE__ */ te({
|
|
322
322
|
__name: "IngredientForm",
|
|
323
323
|
props: {
|
|
324
324
|
mode: {},
|
|
@@ -327,312 +327,300 @@ const Pt = {
|
|
|
327
327
|
},
|
|
328
328
|
emits: ["update:modelValue", "click:submit"],
|
|
329
329
|
setup(u, { expose: o, emit: y }) {
|
|
330
|
-
var
|
|
331
|
-
const { t: r } =
|
|
332
|
-
function b(
|
|
333
|
-
if (
|
|
334
|
-
const
|
|
330
|
+
var ue;
|
|
331
|
+
const { t: r } = oe(), n = u, l = y, i = ne(), a = fe(), h = et(), k = Ie(), g = S(() => k.isEnabled);
|
|
332
|
+
function b(t) {
|
|
333
|
+
if (t.length === 0) return;
|
|
334
|
+
const e = t[0], p = n.modelValue ?? {
|
|
335
335
|
unit: i.units.find((_) => _)
|
|
336
336
|
};
|
|
337
|
-
p.unit || (p.unit =
|
|
337
|
+
p.unit || (p.unit = e, l("update:modelValue", p));
|
|
338
338
|
}
|
|
339
|
-
|
|
339
|
+
at(() => {
|
|
340
340
|
b(i.units);
|
|
341
|
-
}),
|
|
342
|
-
b(
|
|
341
|
+
}), Ye([() => i.units], ([t]) => {
|
|
342
|
+
b(t);
|
|
343
343
|
});
|
|
344
344
|
function s() {
|
|
345
345
|
l("click:submit");
|
|
346
346
|
}
|
|
347
347
|
const x = S({
|
|
348
348
|
get() {
|
|
349
|
-
var
|
|
350
|
-
return ((
|
|
349
|
+
var t;
|
|
350
|
+
return ((t = n.modelValue) == null ? void 0 : t.code) ?? "";
|
|
351
351
|
},
|
|
352
|
-
set(
|
|
353
|
-
const
|
|
352
|
+
set(t) {
|
|
353
|
+
const e = n.modelValue ? {
|
|
354
354
|
...n.modelValue
|
|
355
355
|
} : {};
|
|
356
|
-
|
|
356
|
+
e.code = t, l("update:modelValue", e);
|
|
357
357
|
}
|
|
358
358
|
}), U = S({
|
|
359
359
|
get() {
|
|
360
|
-
var
|
|
361
|
-
return ((
|
|
360
|
+
var t;
|
|
361
|
+
return ((t = n.modelValue) == null ? void 0 : t.name) ?? "";
|
|
362
362
|
},
|
|
363
|
-
set(
|
|
364
|
-
const
|
|
363
|
+
set(t) {
|
|
364
|
+
const e = n.modelValue ? {
|
|
365
365
|
...n.modelValue
|
|
366
366
|
} : {};
|
|
367
|
-
|
|
367
|
+
e.name = t, l("update:modelValue", e);
|
|
368
368
|
}
|
|
369
369
|
}), I = S({
|
|
370
370
|
get() {
|
|
371
|
-
var
|
|
372
|
-
const
|
|
373
|
-
return
|
|
371
|
+
var e, p;
|
|
372
|
+
const t = (p = (e = n.modelValue) == null ? void 0 : e.defaultCost) == null ? void 0 : p.costPerUnit;
|
|
373
|
+
return t ? +Ke(t) : 0;
|
|
374
374
|
},
|
|
375
|
-
set(
|
|
376
|
-
var p, _, E,
|
|
377
|
-
const
|
|
375
|
+
set(t) {
|
|
376
|
+
var p, _, E, F;
|
|
377
|
+
const e = n.modelValue ? {
|
|
378
378
|
...n.modelValue
|
|
379
379
|
} : {};
|
|
380
|
-
|
|
380
|
+
e.defaultCost ?? (e.defaultCost = {
|
|
381
381
|
costPerUnit: {
|
|
382
382
|
amount: 0,
|
|
383
383
|
precision: 2,
|
|
384
|
-
currency: ((p =
|
|
384
|
+
currency: ((p = xe(a.currentCountry.value)) == null ? void 0 : p.currency) ?? "MYR"
|
|
385
385
|
},
|
|
386
|
-
measurement: (
|
|
387
|
-
(
|
|
388
|
-
var
|
|
389
|
-
return
|
|
386
|
+
measurement: (F = (E = (_ = n.modelValue) == null ? void 0 : _.unit) == null ? void 0 : E.measurements) == null ? void 0 : F.find(
|
|
387
|
+
(O) => {
|
|
388
|
+
var G;
|
|
389
|
+
return O.id === ((G = n.modelValue) == null ? void 0 : G.trackingMeasurement);
|
|
390
390
|
}
|
|
391
391
|
)
|
|
392
|
-
}),
|
|
393
|
-
...
|
|
394
|
-
...
|
|
395
|
-
}, l("update:modelValue",
|
|
392
|
+
}), e.defaultCost.costPerUnit = {
|
|
393
|
+
...e.defaultCost.costPerUnit,
|
|
394
|
+
...Ze(+t, 4)
|
|
395
|
+
}, l("update:modelValue", e);
|
|
396
396
|
}
|
|
397
|
-
}),
|
|
398
|
-
var
|
|
399
|
-
const
|
|
400
|
-
return
|
|
401
|
-
_id:
|
|
397
|
+
}), N = S(() => {
|
|
398
|
+
var e, p, _;
|
|
399
|
+
const t = ((e = n.modelValue) == null ? void 0 : e.unit) ?? i.units.find((E) => E);
|
|
400
|
+
return t ? {
|
|
401
|
+
_id: t._id,
|
|
402
402
|
measurement: (p = n.modelValue) == null ? void 0 : p.trackingMeasurement,
|
|
403
|
-
name: ((_ =
|
|
404
|
-
var
|
|
405
|
-
return E.id === ((
|
|
406
|
-
})) == null ? void 0 : _.name) ??
|
|
403
|
+
name: ((_ = t.measurements.find((E) => {
|
|
404
|
+
var F;
|
|
405
|
+
return E.id === ((F = n.modelValue) == null ? void 0 : F.trackingMeasurement);
|
|
406
|
+
})) == null ? void 0 : _.name) ?? t.name
|
|
407
407
|
} : null;
|
|
408
|
-
}),
|
|
409
|
-
() => i.units.flatMap(({ name:
|
|
408
|
+
}), w = S(
|
|
409
|
+
() => i.units.flatMap(({ name: t, _id: e, abbrev: p, measurements: _ }) => [
|
|
410
410
|
{
|
|
411
|
-
label: `${
|
|
411
|
+
label: `${t}`,
|
|
412
412
|
value: null,
|
|
413
413
|
displayAsSection: !0
|
|
414
414
|
},
|
|
415
415
|
{
|
|
416
|
-
label: `${
|
|
417
|
-
value: { _id:
|
|
416
|
+
label: `${t} (${p})`,
|
|
417
|
+
value: { _id: e },
|
|
418
418
|
displayAsSection: !1
|
|
419
419
|
},
|
|
420
|
-
..._.map(({ id: E, name:
|
|
421
|
-
label: `${
|
|
422
|
-
value: { _id:
|
|
420
|
+
..._.map(({ id: E, name: F, abbrev: O }) => ({
|
|
421
|
+
label: `${F} (${O})`,
|
|
422
|
+
value: { _id: e, measurement: E },
|
|
423
423
|
displayAsSection: !1
|
|
424
424
|
}))
|
|
425
425
|
])
|
|
426
426
|
);
|
|
427
|
-
function v(
|
|
428
|
-
var
|
|
429
|
-
return ((p = (
|
|
427
|
+
function v(t) {
|
|
428
|
+
var e, p, _, E, F;
|
|
429
|
+
return ((p = (e = n.modelValue) == null ? void 0 : e.unit) == null ? void 0 : p._id) === ((_ = t.value) == null ? void 0 : _._id) && ((E = n.modelValue) == null ? void 0 : E.trackingMeasurement) === ((F = t.value) == null ? void 0 : F.measurement);
|
|
430
430
|
}
|
|
431
|
-
function R(
|
|
432
|
-
var
|
|
433
|
-
if (!
|
|
434
|
-
const { _id:
|
|
431
|
+
function R(t) {
|
|
432
|
+
var O, G;
|
|
433
|
+
if (!t) return;
|
|
434
|
+
const { _id: e, measurement: p } = t, _ = p || void 0, E = i.units.find((me) => me._id === e);
|
|
435
435
|
if (!E)
|
|
436
436
|
return;
|
|
437
|
-
const
|
|
438
|
-
|
|
439
|
-
measurement: E.measurements.find((
|
|
437
|
+
const F = n.modelValue ?? {};
|
|
438
|
+
F.unit = E, F.trackingMeasurement = _, F.convert && (F.convert.measurement = _ || null), h.enableTotalCost && (F.defaultCost = {
|
|
439
|
+
measurement: E.measurements.find((me) => me.id === _),
|
|
440
440
|
costPerUnit: {
|
|
441
|
-
...((
|
|
441
|
+
...((O = F.defaultCost) == null ? void 0 : O.costPerUnit) ?? {
|
|
442
442
|
amount: 0,
|
|
443
443
|
precision: 2,
|
|
444
|
-
currency: ((
|
|
444
|
+
currency: ((G = xe(a.currentCountry.value)) == null ? void 0 : G.currency) ?? "MYR"
|
|
445
445
|
}
|
|
446
446
|
}
|
|
447
|
-
}), l("update:modelValue",
|
|
447
|
+
}), l("update:modelValue", F);
|
|
448
448
|
}
|
|
449
|
-
const
|
|
449
|
+
const J = S({
|
|
450
450
|
get() {
|
|
451
|
-
var
|
|
452
|
-
return ((
|
|
451
|
+
var t;
|
|
452
|
+
return ((t = n.modelValue) == null ? void 0 : t.convert) ?? null;
|
|
453
453
|
},
|
|
454
|
-
set(
|
|
455
|
-
const
|
|
454
|
+
set(t) {
|
|
455
|
+
const e = n.modelValue ? {
|
|
456
456
|
...n.modelValue
|
|
457
457
|
} : {};
|
|
458
|
-
|
|
458
|
+
t ? e.convert = t : e.convert = null, l("update:modelValue", e);
|
|
459
459
|
}
|
|
460
|
-
}),
|
|
461
|
-
(
|
|
462
|
-
).map((
|
|
463
|
-
label: r(`inventory.ingredient.valuationMethod.${
|
|
464
|
-
value:
|
|
460
|
+
}), Z = S(() => ve.options.filter(
|
|
461
|
+
(t) => t === ve.enum.FIFO || t === ve.enum.WAVG
|
|
462
|
+
).map((t) => ({
|
|
463
|
+
label: r(`inventory.ingredient.valuationMethod.${t}`),
|
|
464
|
+
value: t
|
|
465
465
|
}))), L = S({
|
|
466
466
|
get() {
|
|
467
|
-
var
|
|
468
|
-
return ((
|
|
467
|
+
var t;
|
|
468
|
+
return ((t = n.modelValue) == null ? void 0 : t.valuation) ?? "WAVG";
|
|
469
469
|
},
|
|
470
|
-
set(
|
|
471
|
-
const
|
|
470
|
+
set(t) {
|
|
471
|
+
const e = n.modelValue ? {
|
|
472
472
|
...n.modelValue
|
|
473
473
|
} : {};
|
|
474
|
-
|
|
474
|
+
e.valuation = t, l("update:modelValue", e);
|
|
475
475
|
}
|
|
476
|
-
}),
|
|
476
|
+
}), Y = S({
|
|
477
477
|
get() {
|
|
478
|
-
var
|
|
479
|
-
return ((
|
|
478
|
+
var t;
|
|
479
|
+
return ((t = n.modelValue) == null ? void 0 : t.customAttributes) ?? {};
|
|
480
480
|
},
|
|
481
|
-
set(
|
|
482
|
-
const
|
|
481
|
+
set(t) {
|
|
482
|
+
const e = n.modelValue ? {
|
|
483
483
|
...n.modelValue
|
|
484
484
|
} : {};
|
|
485
|
-
|
|
485
|
+
e.customAttributes = t, l("update:modelValue", e);
|
|
486
486
|
}
|
|
487
|
-
}), H =
|
|
487
|
+
}), H = q();
|
|
488
488
|
o({
|
|
489
489
|
validateInputs: () => {
|
|
490
|
-
var
|
|
491
|
-
(
|
|
490
|
+
var t, e;
|
|
491
|
+
(e = (t = H.value) == null ? void 0 : t.validateInputs) == null || e.call(t);
|
|
492
492
|
},
|
|
493
493
|
resetInputsValidation: () => {
|
|
494
|
-
var
|
|
495
|
-
(
|
|
494
|
+
var t, e;
|
|
495
|
+
(e = (t = H.value) == null ? void 0 : t.resetInputsValidation) == null || e.call(t);
|
|
496
496
|
},
|
|
497
497
|
resetInputs: () => {
|
|
498
|
-
var
|
|
499
|
-
(
|
|
498
|
+
var t, e;
|
|
499
|
+
(e = (t = H.value) == null ? void 0 : t.resetInputs) == null || e.call(t);
|
|
500
500
|
}
|
|
501
501
|
});
|
|
502
|
-
const
|
|
502
|
+
const Q = q(!1), se = S(
|
|
503
503
|
() => {
|
|
504
|
-
var
|
|
505
|
-
return (
|
|
504
|
+
var t, e, p;
|
|
505
|
+
return (t = n.modelValue) != null && t._id ? ((p = i.menu.bindedBySkuId[(e = n.modelValue) == null ? void 0 : e._id]) == null ? void 0 : p.filter(
|
|
506
506
|
(_) => _.from === "INGREDIENT"
|
|
507
507
|
)) ?? [] : [];
|
|
508
508
|
}
|
|
509
|
-
),
|
|
509
|
+
), ye = S(
|
|
510
510
|
() => {
|
|
511
|
-
var
|
|
512
|
-
return (
|
|
511
|
+
var t, e, p;
|
|
512
|
+
return (t = n.modelValue) != null && t._id ? ((p = i.menu.bindedBySkuId[(e = n.modelValue) == null ? void 0 : e._id]) == null ? void 0 : p.filter(
|
|
513
513
|
(_) => _.from === "RECIPE"
|
|
514
514
|
)) ?? [] : [];
|
|
515
515
|
}
|
|
516
516
|
), D = S(
|
|
517
517
|
() => {
|
|
518
|
-
var
|
|
519
|
-
return (
|
|
518
|
+
var t, e, p;
|
|
519
|
+
return (t = n.modelValue) != null && t._id ? ((p = i.menu.bindedBySkuId[(e = n.modelValue) == null ? void 0 : e._id]) == null ? void 0 : p.filter((_) => _.from === "MENU")) ?? [] : [];
|
|
520
520
|
}
|
|
521
521
|
), $ = S(
|
|
522
|
-
() => i.skus.map((
|
|
523
|
-
),
|
|
524
|
-
function
|
|
522
|
+
() => i.skus.map((t) => ({ label: t.name, value: t.code }))
|
|
523
|
+
), ie = q((ue = n.modelValue) == null ? void 0 : ue.code);
|
|
524
|
+
function le(t) {
|
|
525
525
|
var p;
|
|
526
|
-
const
|
|
527
|
-
|
|
528
|
-
}
|
|
529
|
-
function re(e) {
|
|
530
|
-
switch (e) {
|
|
531
|
-
case Ce.MY:
|
|
532
|
-
return "MYR";
|
|
533
|
-
case Ce.SG:
|
|
534
|
-
return "SGD";
|
|
535
|
-
case Ce.ID:
|
|
536
|
-
return "IDR";
|
|
537
|
-
default:
|
|
538
|
-
return "MYR";
|
|
539
|
-
}
|
|
526
|
+
const e = t.el;
|
|
527
|
+
e && ((p = e.querySelector("[x-should-scroll-into=true]")) == null || p.scrollIntoView());
|
|
540
528
|
}
|
|
541
|
-
const
|
|
529
|
+
const de = S(
|
|
542
530
|
() => {
|
|
543
|
-
var
|
|
544
|
-
return ((_ = (p = (
|
|
545
|
-
(
|
|
546
|
-
var
|
|
547
|
-
return
|
|
531
|
+
var t, e, p, _, E, F;
|
|
532
|
+
return ((_ = (p = (e = (t = n.modelValue) == null ? void 0 : t.unit) == null ? void 0 : e.measurements) == null ? void 0 : p.find(
|
|
533
|
+
(O) => {
|
|
534
|
+
var G;
|
|
535
|
+
return O.id === ((G = n.modelValue) == null ? void 0 : G.trackingMeasurement);
|
|
548
536
|
}
|
|
549
|
-
)) == null ? void 0 : _.abbrev) ?? ((
|
|
537
|
+
)) == null ? void 0 : _.abbrev) ?? ((F = (E = n.modelValue) == null ? void 0 : E.unit) == null ? void 0 : F.abbrev);
|
|
550
538
|
}
|
|
551
|
-
),
|
|
539
|
+
), P = S({
|
|
552
540
|
get() {
|
|
553
|
-
var
|
|
554
|
-
return ((
|
|
541
|
+
var t, e;
|
|
542
|
+
return ((e = (t = n.modelValue) == null ? void 0 : t.thresholds) == null ? void 0 : e.low) ?? ae().low;
|
|
555
543
|
},
|
|
556
|
-
set(
|
|
544
|
+
set(t) {
|
|
557
545
|
var _;
|
|
558
|
-
const
|
|
559
|
-
|
|
546
|
+
const e = ((_ = n.modelValue) == null ? void 0 : _.thresholds) ?? ae();
|
|
547
|
+
e.low = t;
|
|
560
548
|
const p = n.modelValue ? {
|
|
561
549
|
...n.modelValue
|
|
562
550
|
} : {};
|
|
563
|
-
p.thresholds =
|
|
551
|
+
p.thresholds = e, l("update:modelValue", p);
|
|
564
552
|
}
|
|
565
|
-
}),
|
|
553
|
+
}), z = S({
|
|
566
554
|
get() {
|
|
567
|
-
var
|
|
568
|
-
return ((
|
|
555
|
+
var t, e;
|
|
556
|
+
return ((e = (t = n.modelValue) == null ? void 0 : t.thresholds) == null ? void 0 : e.mid) ?? ae().mid;
|
|
569
557
|
},
|
|
570
|
-
set(
|
|
558
|
+
set(t) {
|
|
571
559
|
var _;
|
|
572
|
-
const
|
|
573
|
-
|
|
560
|
+
const e = ((_ = n.modelValue) == null ? void 0 : _.thresholds) ?? ae();
|
|
561
|
+
e.mid = t;
|
|
574
562
|
const p = n.modelValue ? {
|
|
575
563
|
...n.modelValue
|
|
576
564
|
} : {};
|
|
577
|
-
p.thresholds =
|
|
565
|
+
p.thresholds = e, l("update:modelValue", p);
|
|
578
566
|
}
|
|
579
567
|
});
|
|
580
|
-
function
|
|
581
|
-
return function(
|
|
582
|
-
return typeof (
|
|
568
|
+
function ge() {
|
|
569
|
+
return function(e) {
|
|
570
|
+
return typeof (e == null ? void 0 : e.low) != "number" || typeof (e == null ? void 0 : e.mid) != "number" ? "Required" : e.low >= e.mid ? "Days for red indicator should be less than yellow indicator." : !0;
|
|
583
571
|
};
|
|
584
572
|
}
|
|
585
|
-
return (
|
|
586
|
-
const p = C("FmTextField"), _ = C("FmLabel"), E = C("FmField"),
|
|
587
|
-
return f(),
|
|
588
|
-
disabled:
|
|
573
|
+
return (t, e) => {
|
|
574
|
+
const p = C("FmTextField"), _ = C("FmLabel"), E = C("FmField"), F = C("FmMenuHeader"), O = C("FmMenuDivider"), G = C("FmMenuItem"), me = C("FmMenu"), $e = C("FmFormGroup"), nt = C("FmSelect"), ot = C("FmSwitch"), Ee = C("FmStepperField"), lt = C("FmForm");
|
|
575
|
+
return f(), B(lt, {
|
|
576
|
+
disabled: t.disabled,
|
|
589
577
|
ref_key: "formRef",
|
|
590
578
|
ref: H,
|
|
591
579
|
class: "flex flex-col gap-32",
|
|
592
580
|
onValidationSuccess: s
|
|
593
581
|
}, {
|
|
594
582
|
default: V(() => {
|
|
595
|
-
var
|
|
583
|
+
var Ue, Re, Te, Ae;
|
|
596
584
|
return [
|
|
597
|
-
m("div",
|
|
598
|
-
m("div",
|
|
599
|
-
c(
|
|
585
|
+
m("div", Pt, [
|
|
586
|
+
m("div", Bt, [
|
|
587
|
+
c(pe, {
|
|
600
588
|
"tooltip-message": "This field is managed by NetSuite",
|
|
601
589
|
"tooltip-z-index": 50,
|
|
602
590
|
label: d(r)("inventory.ingredient.code"),
|
|
603
591
|
"model-value": x.value,
|
|
604
|
-
"onUpdate:modelValue":
|
|
592
|
+
"onUpdate:modelValue": e[1] || (e[1] = (M) => x.value = M),
|
|
605
593
|
locked: g.value,
|
|
606
|
-
disabled:
|
|
594
|
+
disabled: t.disabled
|
|
607
595
|
}, {
|
|
608
596
|
default: V(() => [
|
|
609
597
|
c(p, {
|
|
610
598
|
label: d(r)("inventory.ingredient.code"),
|
|
611
599
|
"model-value": x.value,
|
|
612
|
-
"onUpdate:modelValue":
|
|
613
|
-
rules: [d(
|
|
600
|
+
"onUpdate:modelValue": e[0] || (e[0] = (M) => x.value = M),
|
|
601
|
+
rules: [d(Ve)(), d(mt)($.value, ie.value)],
|
|
614
602
|
"label-mark": "required"
|
|
615
603
|
}, null, 8, ["label", "model-value", "rules"])
|
|
616
604
|
]),
|
|
617
605
|
_: 1
|
|
618
606
|
}, 8, ["label", "model-value", "locked", "disabled"])
|
|
619
607
|
]),
|
|
620
|
-
m("div",
|
|
621
|
-
c(
|
|
608
|
+
m("div", Nt, [
|
|
609
|
+
c(pe, {
|
|
622
610
|
"tooltip-message": "This field is managed by NetSuite",
|
|
623
611
|
"tooltip-z-index": 50,
|
|
624
612
|
label: d(r)("inventory.ingredient.name"),
|
|
625
613
|
"model-value": U.value,
|
|
626
|
-
"onUpdate:modelValue":
|
|
614
|
+
"onUpdate:modelValue": e[3] || (e[3] = (M) => U.value = M),
|
|
627
615
|
locked: g.value,
|
|
628
|
-
disabled:
|
|
616
|
+
disabled: t.disabled
|
|
629
617
|
}, {
|
|
630
618
|
default: V(() => [
|
|
631
619
|
c(p, {
|
|
632
620
|
label: d(r)("inventory.ingredient.name"),
|
|
633
621
|
"model-value": U.value,
|
|
634
|
-
"onUpdate:modelValue":
|
|
635
|
-
rules: [d(
|
|
622
|
+
"onUpdate:modelValue": e[2] || (e[2] = (M) => U.value = M),
|
|
623
|
+
rules: [d(Ve)()],
|
|
636
624
|
"label-mark": "required"
|
|
637
625
|
}, null, 8, ["label", "model-value", "rules"])
|
|
638
626
|
]),
|
|
@@ -640,19 +628,19 @@ const Pt = {
|
|
|
640
628
|
}, 8, ["label", "model-value", "locked", "disabled"])
|
|
641
629
|
])
|
|
642
630
|
]),
|
|
643
|
-
c(
|
|
631
|
+
c(pe, {
|
|
644
632
|
"tooltip-message": "This field is managed by NetSuite",
|
|
645
633
|
"tooltip-z-index": 50,
|
|
646
634
|
label: d(r)("inventory.ingredient.unit"),
|
|
647
|
-
"helper-text": (
|
|
648
|
-
"model-value": (
|
|
635
|
+
"helper-text": (Ue = t.modelValue) != null && Ue.trackingMeasurement ? `Base unit: ${(Te = (Re = t.modelValue) == null ? void 0 : Re.unit) == null ? void 0 : Te.name}` : void 0,
|
|
636
|
+
"model-value": (Ae = N.value) == null ? void 0 : Ae.name,
|
|
649
637
|
locked: g.value,
|
|
650
|
-
disabled:
|
|
638
|
+
disabled: t.disabled
|
|
651
639
|
}, {
|
|
652
640
|
default: V(() => [
|
|
653
|
-
c(
|
|
654
|
-
"model-value":
|
|
655
|
-
rules: [d(
|
|
641
|
+
c($e, {
|
|
642
|
+
"model-value": N.value,
|
|
643
|
+
rules: [d(Ve)()],
|
|
656
644
|
"label-mark": "required"
|
|
657
645
|
}, {
|
|
658
646
|
label: V(() => [
|
|
@@ -661,23 +649,23 @@ const Pt = {
|
|
|
661
649
|
}, null, 8, ["label"])
|
|
662
650
|
]),
|
|
663
651
|
default: V(({ invalid: M }) => [
|
|
664
|
-
c(
|
|
652
|
+
c(me, null, {
|
|
665
653
|
"menu-button": V(() => [
|
|
666
654
|
c(E, {
|
|
667
655
|
class: ee([
|
|
668
656
|
"fm-typo-en-body-lg-400",
|
|
669
657
|
{
|
|
670
|
-
"text-fm-color-typo-primary": !
|
|
671
|
-
"text-fm-color-typo-disabled":
|
|
658
|
+
"text-fm-color-typo-primary": !t.disabled,
|
|
659
|
+
"text-fm-color-typo-disabled": t.disabled
|
|
672
660
|
}
|
|
673
661
|
]),
|
|
674
662
|
invalid: M,
|
|
675
663
|
"append-icon": "expand_more"
|
|
676
664
|
}, {
|
|
677
665
|
default: V(() => {
|
|
678
|
-
var
|
|
666
|
+
var W;
|
|
679
667
|
return [
|
|
680
|
-
|
|
668
|
+
Me(A((W = N.value) == null ? void 0 : W.name), 1)
|
|
681
669
|
];
|
|
682
670
|
}),
|
|
683
671
|
_: 2
|
|
@@ -686,22 +674,22 @@ const Pt = {
|
|
|
686
674
|
default: V(() => [
|
|
687
675
|
m("div", {
|
|
688
676
|
class: "overflow-x-hidden overflow-y-auto max-h-[300px]",
|
|
689
|
-
onVnodeMounted:
|
|
677
|
+
onVnodeMounted: le
|
|
690
678
|
}, [
|
|
691
|
-
(f(!0), T(X, null,
|
|
692
|
-
key:
|
|
679
|
+
(f(!0), T(X, null, re(w.value, (W) => (f(), T(X, {
|
|
680
|
+
key: W.label
|
|
693
681
|
}, [
|
|
694
|
-
|
|
695
|
-
c(
|
|
696
|
-
label:
|
|
682
|
+
W.displayAsSection ? (f(), T(X, { key: 0 }, [
|
|
683
|
+
c(F, {
|
|
684
|
+
label: W.label
|
|
697
685
|
}, null, 8, ["label"]),
|
|
698
|
-
c(
|
|
699
|
-
], 64)) : (f(),
|
|
686
|
+
c(O)
|
|
687
|
+
], 64)) : (f(), B(G, {
|
|
700
688
|
key: 1,
|
|
701
|
-
label:
|
|
702
|
-
"model-value": v(
|
|
703
|
-
onClick: (
|
|
704
|
-
"x-should-scroll-into": `${v(
|
|
689
|
+
label: W.label,
|
|
690
|
+
"model-value": v(W),
|
|
691
|
+
onClick: (On) => R(W.value),
|
|
692
|
+
"x-should-scroll-into": `${v(W)}`
|
|
705
693
|
}, null, 8, ["label", "model-value", "onClick", "x-should-scroll-into"]))
|
|
706
694
|
], 64))), 128))
|
|
707
695
|
], 512)
|
|
@@ -714,17 +702,17 @@ const Pt = {
|
|
|
714
702
|
]),
|
|
715
703
|
_: 1
|
|
716
704
|
}, 8, ["label", "helper-text", "model-value", "locked", "disabled"]),
|
|
717
|
-
d(h).enableTotalCost ? (f(),
|
|
705
|
+
d(h).enableTotalCost ? (f(), B(pe, {
|
|
718
706
|
key: 0,
|
|
719
707
|
"tooltip-message": "This field is managed by NetSuite",
|
|
720
708
|
"tooltip-z-index": 50,
|
|
721
709
|
label: d(r)("inventory.ingredient.valuationMethod.title"),
|
|
722
710
|
"model-value": d(r)("inventory.ingredient.valuationMethod." + L.value),
|
|
723
711
|
locked: g.value,
|
|
724
|
-
disabled:
|
|
712
|
+
disabled: t.disabled
|
|
725
713
|
}, {
|
|
726
714
|
label: V(() => [
|
|
727
|
-
c(
|
|
715
|
+
c(he, { "z-index": 50 }, {
|
|
728
716
|
default: V(() => [
|
|
729
717
|
c(_, {
|
|
730
718
|
label: d(r)("inventory.ingredient.valuationMethod.title")
|
|
@@ -734,25 +722,25 @@ const Pt = {
|
|
|
734
722
|
})
|
|
735
723
|
]),
|
|
736
724
|
default: V(() => [
|
|
737
|
-
c(
|
|
725
|
+
c(nt, {
|
|
738
726
|
class: "col-span-2",
|
|
739
727
|
"model-value": L.value,
|
|
740
|
-
"onUpdate:modelValue":
|
|
741
|
-
items:
|
|
728
|
+
"onUpdate:modelValue": e[4] || (e[4] = (M) => L.value = M),
|
|
729
|
+
items: Z.value
|
|
742
730
|
}, null, 8, ["model-value", "items"])
|
|
743
731
|
]),
|
|
744
732
|
_: 1
|
|
745
|
-
}, 8, ["label", "model-value", "locked", "disabled"])) :
|
|
746
|
-
d(h).enableTotalCost ? (f(),
|
|
733
|
+
}, 8, ["label", "model-value", "locked", "disabled"])) : j("", !0),
|
|
734
|
+
d(h).enableTotalCost ? (f(), B(pe, {
|
|
747
735
|
key: 1,
|
|
748
736
|
"tooltip-message": "This field is managed by NetSuite",
|
|
749
737
|
"tooltip-z-index": 50,
|
|
750
|
-
"model-value": `${d(
|
|
738
|
+
"model-value": `${d(ct)()} ${I.value}`,
|
|
751
739
|
locked: g.value,
|
|
752
|
-
disabled:
|
|
740
|
+
disabled: t.disabled
|
|
753
741
|
}, {
|
|
754
742
|
label: V(() => [
|
|
755
|
-
c(
|
|
743
|
+
c(he, { "z-index": 50 }, {
|
|
756
744
|
default: V(() => [
|
|
757
745
|
c(_, {
|
|
758
746
|
label: d(r)("inventory.ingredient.pricePerUnit")
|
|
@@ -764,11 +752,11 @@ const Pt = {
|
|
|
764
752
|
default: V(() => [
|
|
765
753
|
c(p, {
|
|
766
754
|
"model-value": I.value,
|
|
767
|
-
"onUpdate:modelValue":
|
|
768
|
-
rules: [d(
|
|
755
|
+
"onUpdate:modelValue": e[5] || (e[5] = (M) => I.value = M),
|
|
756
|
+
rules: [d(_e)(0), d(pt)(4)]
|
|
769
757
|
}, {
|
|
770
758
|
label: V(() => [
|
|
771
|
-
c(
|
|
759
|
+
c(he, { "z-index": 50 }, {
|
|
772
760
|
default: V(() => [
|
|
773
761
|
c(_, {
|
|
774
762
|
label: d(r)("inventory.ingredient.pricePerUnit")
|
|
@@ -778,82 +766,82 @@ const Pt = {
|
|
|
778
766
|
})
|
|
779
767
|
]),
|
|
780
768
|
prepend: V(() => {
|
|
781
|
-
var M,
|
|
769
|
+
var M, W;
|
|
782
770
|
return [
|
|
783
|
-
m("div",
|
|
771
|
+
m("div", zt, A(d(Ne)(((M = d(a).currentCountry) == null ? void 0 : M.value) ?? d(ze)) === "MYR" ? "RM" : d(Ne)(((W = d(a).currentCountry) == null ? void 0 : W.value) ?? d(ze))), 1)
|
|
784
772
|
];
|
|
785
773
|
}),
|
|
786
774
|
append: V(() => [
|
|
787
|
-
m("div",
|
|
775
|
+
m("div", Lt, " / " + A(de.value), 1)
|
|
788
776
|
]),
|
|
789
777
|
_: 1
|
|
790
778
|
}, 8, ["model-value", "rules"])
|
|
791
779
|
]),
|
|
792
780
|
_: 1
|
|
793
|
-
}, 8, ["model-value", "locked", "disabled"])) :
|
|
794
|
-
!g.value ||
|
|
781
|
+
}, 8, ["model-value", "locked", "disabled"])) : j("", !0),
|
|
782
|
+
!g.value || J.value ? (f(), B(At, {
|
|
795
783
|
key: 2,
|
|
796
|
-
"model-value":
|
|
797
|
-
"onUpdate:modelValue":
|
|
798
|
-
"root-value":
|
|
784
|
+
"model-value": J.value,
|
|
785
|
+
"onUpdate:modelValue": e[6] || (e[6] = (M) => J.value = M),
|
|
786
|
+
"root-value": t.modelValue,
|
|
799
787
|
readonly: g.value
|
|
800
|
-
}, null, 8, ["model-value", "root-value", "readonly"])) :
|
|
801
|
-
|
|
788
|
+
}, null, 8, ["model-value", "root-value", "readonly"])) : j("", !0),
|
|
789
|
+
t.mode !== d(K).CREATE ? (f(), T("div", Ht, [
|
|
802
790
|
m("div", null, [
|
|
803
|
-
c(
|
|
791
|
+
c(ot, {
|
|
804
792
|
label: d(r)("inventory.ingredient.bindedItems.title"),
|
|
805
|
-
modelValue:
|
|
806
|
-
"onUpdate:modelValue":
|
|
793
|
+
modelValue: Q.value,
|
|
794
|
+
"onUpdate:modelValue": e[7] || (e[7] = (M) => Q.value = M),
|
|
807
795
|
"label-placement": "right"
|
|
808
796
|
}, null, 8, ["label", "modelValue"])
|
|
809
797
|
]),
|
|
810
|
-
|
|
798
|
+
Q.value && se.value.length ? (f(), B(we, {
|
|
811
799
|
key: 0,
|
|
812
800
|
name: d(r)("inventory.ingredient.bindedItems.ingredient"),
|
|
813
|
-
bindings:
|
|
814
|
-
}, null, 8, ["name", "bindings"])) :
|
|
815
|
-
|
|
801
|
+
bindings: se.value
|
|
802
|
+
}, null, 8, ["name", "bindings"])) : j("", !0),
|
|
803
|
+
Q.value && ye.value.length ? (f(), B(we, {
|
|
816
804
|
key: 1,
|
|
817
805
|
name: d(r)("inventory.ingredient.bindedItems.recipe"),
|
|
818
|
-
bindings:
|
|
819
|
-
}, null, 8, ["name", "bindings"])) :
|
|
820
|
-
|
|
806
|
+
bindings: ye.value
|
|
807
|
+
}, null, 8, ["name", "bindings"])) : j("", !0),
|
|
808
|
+
Q.value && D.value.length ? (f(), B(we, {
|
|
821
809
|
key: 2,
|
|
822
810
|
name: d(r)("inventory.ingredient.bindedItems.menu"),
|
|
823
811
|
bindings: D.value
|
|
824
|
-
}, null, 8, ["name", "bindings"])) :
|
|
825
|
-
])) :
|
|
826
|
-
m("div",
|
|
812
|
+
}, null, 8, ["name", "bindings"])) : j("", !0)
|
|
813
|
+
])) : j("", !0),
|
|
814
|
+
m("div", Ot, [
|
|
827
815
|
m("div", jt, [
|
|
828
|
-
c(
|
|
816
|
+
c(he, null, {
|
|
829
817
|
default: V(() => [
|
|
830
818
|
m("div", qt, A(d(r)("inventory.ingredient.threshold.title")), 1)
|
|
831
819
|
]),
|
|
832
820
|
_: 1
|
|
833
821
|
}),
|
|
834
|
-
m("div",
|
|
822
|
+
m("div", Yt, A(d(r)("inventory.ingredient.threshold.subtitle")), 1)
|
|
835
823
|
]),
|
|
836
|
-
m("div",
|
|
837
|
-
c(
|
|
838
|
-
"model-value": { low:
|
|
839
|
-
rules: [
|
|
824
|
+
m("div", Gt, [
|
|
825
|
+
c($e, {
|
|
826
|
+
"model-value": { low: P.value, mid: z.value },
|
|
827
|
+
rules: [ge()]
|
|
840
828
|
}, null, 8, ["model-value", "rules"]),
|
|
841
|
-
m("div",
|
|
842
|
-
m("div",
|
|
843
|
-
m("div",
|
|
844
|
-
c(
|
|
845
|
-
days:
|
|
846
|
-
level: d(
|
|
829
|
+
m("div", Wt, [
|
|
830
|
+
m("div", Kt, [
|
|
831
|
+
m("div", Zt, [
|
|
832
|
+
c(Se, {
|
|
833
|
+
days: P.value,
|
|
834
|
+
level: d(Ce).low
|
|
847
835
|
}, null, 8, ["days", "level"])
|
|
848
836
|
]),
|
|
849
|
-
m("div",
|
|
850
|
-
m("div",
|
|
851
|
-
c(
|
|
852
|
-
modelValue:
|
|
853
|
-
"onUpdate:modelValue":
|
|
854
|
-
rules: [d(
|
|
837
|
+
m("div", Jt, [
|
|
838
|
+
m("div", Qt, A(d(r)("inventory.ingredient.threshold.whenRemaining")), 1),
|
|
839
|
+
c(Ee, {
|
|
840
|
+
modelValue: P.value,
|
|
841
|
+
"onUpdate:modelValue": e[8] || (e[8] = (M) => P.value = M),
|
|
842
|
+
rules: [d(_e)(0)]
|
|
855
843
|
}, {
|
|
856
|
-
append: V(() =>
|
|
844
|
+
append: V(() => e[11] || (e[11] = [
|
|
857
845
|
m("div", {
|
|
858
846
|
class: "text-fm-color-typo-secondary",
|
|
859
847
|
style: { "padding-right": "32px" }
|
|
@@ -863,7 +851,7 @@ const Pt = {
|
|
|
863
851
|
}, 8, ["modelValue", "rules"])
|
|
864
852
|
])
|
|
865
853
|
]),
|
|
866
|
-
|
|
854
|
+
e[13] || (e[13] = m("div", {
|
|
867
855
|
class: "h-full bg-fm-color-neutral-gray-200 relative",
|
|
868
856
|
style: { width: "1px" }
|
|
869
857
|
}, [
|
|
@@ -872,21 +860,21 @@ const Pt = {
|
|
|
872
860
|
style: { transform: "translate(-50%, -50%)", left: "50%", top: "24px" }
|
|
873
861
|
}, " < ")
|
|
874
862
|
], -1)),
|
|
875
|
-
m("div",
|
|
876
|
-
m("div",
|
|
877
|
-
c(
|
|
878
|
-
days:
|
|
879
|
-
level: d(
|
|
863
|
+
m("div", Xt, [
|
|
864
|
+
m("div", en, [
|
|
865
|
+
c(Se, {
|
|
866
|
+
days: z.value,
|
|
867
|
+
level: d(Ce).mid
|
|
880
868
|
}, null, 8, ["days", "level"])
|
|
881
869
|
]),
|
|
882
|
-
m("div",
|
|
883
|
-
m("div",
|
|
884
|
-
c(
|
|
885
|
-
modelValue:
|
|
886
|
-
"onUpdate:modelValue":
|
|
887
|
-
rules: [d(
|
|
870
|
+
m("div", tn, [
|
|
871
|
+
m("div", nn, A(d(r)("inventory.ingredient.threshold.whenRemaining")), 1),
|
|
872
|
+
c(Ee, {
|
|
873
|
+
modelValue: z.value,
|
|
874
|
+
"onUpdate:modelValue": e[9] || (e[9] = (M) => z.value = M),
|
|
875
|
+
rules: [d(_e)(0)]
|
|
888
876
|
}, {
|
|
889
|
-
append: V(() =>
|
|
877
|
+
append: V(() => e[12] || (e[12] = [
|
|
890
878
|
m("div", {
|
|
891
879
|
class: "text-fm-color-typo-secondary",
|
|
892
880
|
style: { "padding-right": "32px" }
|
|
@@ -896,7 +884,7 @@ const Pt = {
|
|
|
896
884
|
}, 8, ["modelValue", "rules"])
|
|
897
885
|
])
|
|
898
886
|
]),
|
|
899
|
-
|
|
887
|
+
e[14] || (e[14] = m("div", {
|
|
900
888
|
class: "h-full bg-fm-color-neutral-gray-200 relative",
|
|
901
889
|
style: { width: "1px" }
|
|
902
890
|
}, [
|
|
@@ -905,25 +893,25 @@ const Pt = {
|
|
|
905
893
|
style: { transform: "translate(-50%, -50%)", left: "50%", top: "24px" }
|
|
906
894
|
}, " < ")
|
|
907
895
|
], -1)),
|
|
908
|
-
m("div",
|
|
909
|
-
m("div",
|
|
910
|
-
c(
|
|
911
|
-
days:
|
|
912
|
-
level: d(
|
|
896
|
+
m("div", on, [
|
|
897
|
+
m("div", ln, [
|
|
898
|
+
c(Se, {
|
|
899
|
+
days: z.value + 1,
|
|
900
|
+
level: d(Ce).high
|
|
913
901
|
}, null, 8, ["days", "level"])
|
|
914
902
|
]),
|
|
915
|
-
m("div",
|
|
916
|
-
m("div",
|
|
903
|
+
m("div", an, [
|
|
904
|
+
m("div", rn, A(d(r)("inventory.ingredient.threshold.stockIsStaple")), 1)
|
|
917
905
|
])
|
|
918
906
|
])
|
|
919
907
|
])
|
|
920
908
|
])
|
|
921
909
|
]),
|
|
922
910
|
m("div", null, [
|
|
923
|
-
c(
|
|
911
|
+
c(Rt, {
|
|
924
912
|
entity: "inventorySku",
|
|
925
|
-
modelValue:
|
|
926
|
-
"onUpdate:modelValue":
|
|
913
|
+
modelValue: Y.value,
|
|
914
|
+
"onUpdate:modelValue": e[10] || (e[10] = (M) => Y.value = M)
|
|
927
915
|
}, null, 8, ["modelValue"])
|
|
928
916
|
])
|
|
929
917
|
];
|
|
@@ -932,44 +920,44 @@ const Pt = {
|
|
|
932
920
|
}, 8, ["disabled"]);
|
|
933
921
|
};
|
|
934
922
|
}
|
|
935
|
-
}),
|
|
923
|
+
}), dn = { class: "flex flex-col gap-32" }, un = {
|
|
936
924
|
key: 0,
|
|
937
925
|
class: "flex flex-col gap-12"
|
|
938
|
-
},
|
|
926
|
+
}, mn = { class: "flex flex-col gap-4" }, cn = { class: "flex-1 fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, pn = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, vn = { class: "flex gap-4" }, fn = /* @__PURE__ */ te({
|
|
939
927
|
__name: "IngredientDialog",
|
|
940
928
|
props: {
|
|
941
929
|
show: { type: Boolean },
|
|
942
930
|
unit: {},
|
|
943
|
-
mode: { default:
|
|
931
|
+
mode: { default: K.READ }
|
|
944
932
|
},
|
|
945
933
|
emits: ["update:show"],
|
|
946
934
|
setup(u) {
|
|
947
|
-
const o = u, y =
|
|
935
|
+
const o = u, y = ne(), r = Ie(), n = ke(), { t: l } = oe(), i = Oe(o, "show"), a = Oe(o, "unit"), h = S(
|
|
948
936
|
() => {
|
|
949
937
|
var v;
|
|
950
938
|
return r.isEnabled && r.netSuiteItemBySkuId.has((v = o.unit) == null ? void 0 : v._id);
|
|
951
939
|
}
|
|
952
940
|
), k = S(() => {
|
|
953
941
|
switch (o.mode) {
|
|
954
|
-
case
|
|
942
|
+
case K.READ:
|
|
955
943
|
return "";
|
|
956
|
-
case
|
|
944
|
+
case K.UPDATE:
|
|
957
945
|
return l("inventory.ingredient.update.title");
|
|
958
|
-
case
|
|
946
|
+
case K.CREATE:
|
|
959
947
|
return l("inventory.ingredient.create.title");
|
|
960
948
|
}
|
|
961
949
|
return "";
|
|
962
950
|
}), g = S(() => {
|
|
963
951
|
switch (o.mode) {
|
|
964
|
-
case
|
|
952
|
+
case K.READ:
|
|
965
953
|
return "";
|
|
966
|
-
case
|
|
954
|
+
case K.UPDATE:
|
|
967
955
|
return l("common.save");
|
|
968
|
-
case
|
|
956
|
+
case K.CREATE:
|
|
969
957
|
return l("common.add");
|
|
970
958
|
}
|
|
971
959
|
return "";
|
|
972
|
-
}), b =
|
|
960
|
+
}), b = q(), s = q(!1);
|
|
973
961
|
async function x() {
|
|
974
962
|
s.value = !0;
|
|
975
963
|
try {
|
|
@@ -979,7 +967,7 @@ const Pt = {
|
|
|
979
967
|
type: "success"
|
|
980
968
|
});
|
|
981
969
|
} catch (v) {
|
|
982
|
-
v instanceof
|
|
970
|
+
v instanceof Le || n.open({
|
|
983
971
|
title: l("inventory.ingredient.create.error.title"),
|
|
984
972
|
message: l("inventory.ingredient.create.error.message"),
|
|
985
973
|
type: "error"
|
|
@@ -997,7 +985,7 @@ const Pt = {
|
|
|
997
985
|
type: "success"
|
|
998
986
|
});
|
|
999
987
|
} catch (v) {
|
|
1000
|
-
v instanceof
|
|
988
|
+
v instanceof Le || n.open({
|
|
1001
989
|
title: l("inventory.ingredient.update.error.title"),
|
|
1002
990
|
message: l("inventory.ingredient.update.error.message"),
|
|
1003
991
|
type: "error"
|
|
@@ -1010,89 +998,89 @@ const Pt = {
|
|
|
1010
998
|
var v, R;
|
|
1011
999
|
(R = (v = b.value) == null ? void 0 : v.validateInputs) == null || R.call(v);
|
|
1012
1000
|
}
|
|
1013
|
-
function
|
|
1001
|
+
function N() {
|
|
1014
1002
|
switch (o.mode) {
|
|
1015
|
-
case
|
|
1003
|
+
case K.READ:
|
|
1016
1004
|
return;
|
|
1017
|
-
case
|
|
1005
|
+
case K.UPDATE:
|
|
1018
1006
|
return U();
|
|
1019
|
-
case
|
|
1007
|
+
case K.CREATE:
|
|
1020
1008
|
return x();
|
|
1021
1009
|
}
|
|
1022
1010
|
}
|
|
1023
|
-
const
|
|
1024
|
-
var
|
|
1025
|
-
if (!r.isEnabled || !((
|
|
1026
|
-
const v = (
|
|
1011
|
+
const w = S(() => {
|
|
1012
|
+
var J, Z;
|
|
1013
|
+
if (!r.isEnabled || !((J = o.unit) != null && J._id)) return null;
|
|
1014
|
+
const v = (Z = r.netSuiteItemBySkuId.get(o.unit._id)) == null ? void 0 : Z[0];
|
|
1027
1015
|
return v ? r.state.setting.childItems.filter(
|
|
1028
1016
|
(L) => L.parentNetSuiteId === v.netSuiteId
|
|
1029
1017
|
).map((L) => {
|
|
1030
1018
|
var H;
|
|
1031
|
-
const
|
|
1032
|
-
return
|
|
1019
|
+
const Y = (H = r.measurementByNetsuiteId.get(L.unitOfMeasureId)) == null ? void 0 : H[0];
|
|
1020
|
+
return Y ? {
|
|
1033
1021
|
externalId: L.externalId,
|
|
1034
|
-
...
|
|
1022
|
+
...Y
|
|
1035
1023
|
} : null;
|
|
1036
1024
|
}).filter((L) => L).map((L) => L) : null;
|
|
1037
1025
|
});
|
|
1038
1026
|
return (v, R) => {
|
|
1039
|
-
const
|
|
1040
|
-
return f(),
|
|
1027
|
+
const J = C("FmChip"), Z = C("FmButton"), L = C("FmSideSheet");
|
|
1028
|
+
return f(), B(L, {
|
|
1041
1029
|
"model-value": d(i),
|
|
1042
|
-
"onUpdate:modelValue": R[3] || (R[3] = (
|
|
1030
|
+
"onUpdate:modelValue": R[3] || (R[3] = (Y) => De(i) ? i.value = Y : null),
|
|
1043
1031
|
header: k.value,
|
|
1044
1032
|
"close-button": "",
|
|
1045
1033
|
"dismiss-away": "",
|
|
1046
1034
|
"max-width": 500
|
|
1047
1035
|
}, {
|
|
1048
1036
|
"side-sheet-footer": V(() => [
|
|
1049
|
-
m("div",
|
|
1050
|
-
c(
|
|
1037
|
+
m("div", vn, [
|
|
1038
|
+
c(Z, {
|
|
1051
1039
|
loading: s.value,
|
|
1052
1040
|
label: g.value,
|
|
1053
1041
|
onClick: I
|
|
1054
1042
|
}, null, 8, ["loading", "label"]),
|
|
1055
|
-
c(
|
|
1043
|
+
c(Z, {
|
|
1056
1044
|
disabled: s.value,
|
|
1057
1045
|
label: d(l)("common.close"),
|
|
1058
1046
|
variant: "tertiary",
|
|
1059
|
-
onClick: R[2] || (R[2] = (
|
|
1047
|
+
onClick: R[2] || (R[2] = (Y) => i.value = !1)
|
|
1060
1048
|
}, null, 8, ["disabled", "label"])
|
|
1061
1049
|
])
|
|
1062
1050
|
]),
|
|
1063
1051
|
default: V(() => {
|
|
1064
|
-
var
|
|
1052
|
+
var Y;
|
|
1065
1053
|
return [
|
|
1066
|
-
m("div",
|
|
1054
|
+
m("div", dn, [
|
|
1067
1055
|
m("div", null, [
|
|
1068
|
-
h.value ? (f(),
|
|
1056
|
+
h.value ? (f(), B(J, {
|
|
1069
1057
|
key: 0,
|
|
1070
1058
|
label: "Netsuite",
|
|
1071
1059
|
compact: ""
|
|
1072
|
-
})) :
|
|
1060
|
+
})) : j("", !0)
|
|
1073
1061
|
]),
|
|
1074
|
-
c(
|
|
1062
|
+
c(sn, {
|
|
1075
1063
|
class: "w-full",
|
|
1076
1064
|
ref_key: "hasValidationExpose",
|
|
1077
1065
|
ref: b,
|
|
1078
1066
|
modelValue: d(a),
|
|
1079
|
-
"onUpdate:modelValue": R[0] || (R[0] = (H) =>
|
|
1067
|
+
"onUpdate:modelValue": R[0] || (R[0] = (H) => De(a) ? a.value = H : null),
|
|
1080
1068
|
mode: v.mode,
|
|
1081
1069
|
disabled: s.value,
|
|
1082
|
-
"onClick:submit": R[1] || (R[1] = (H) =>
|
|
1070
|
+
"onClick:submit": R[1] || (R[1] = (H) => N())
|
|
1083
1071
|
}, null, 8, ["modelValue", "mode", "disabled"]),
|
|
1084
|
-
(
|
|
1072
|
+
(Y = w.value) != null && Y.length ? (f(), T("div", un, [
|
|
1085
1073
|
R[4] || (R[4] = m("div", { class: "fm-typo-en-title-sm-600" }, A("NetSuite info"), -1)),
|
|
1086
|
-
m("div",
|
|
1087
|
-
(f(!0), T(X, null,
|
|
1088
|
-
key:
|
|
1074
|
+
m("div", mn, [
|
|
1075
|
+
(f(!0), T(X, null, re(w.value, (H, Q) => (f(), T("div", {
|
|
1076
|
+
key: Q,
|
|
1089
1077
|
class: "flex items-center"
|
|
1090
1078
|
}, [
|
|
1091
|
-
m("div",
|
|
1092
|
-
m("div",
|
|
1079
|
+
m("div", cn, A(H.externalId), 1),
|
|
1080
|
+
m("div", pn, A(H.abbrev), 1)
|
|
1093
1081
|
]))), 128))
|
|
1094
1082
|
])
|
|
1095
|
-
])) :
|
|
1083
|
+
])) : j("", !0)
|
|
1096
1084
|
])
|
|
1097
1085
|
];
|
|
1098
1086
|
}),
|
|
@@ -1101,24 +1089,24 @@ const Pt = {
|
|
|
1101
1089
|
};
|
|
1102
1090
|
}
|
|
1103
1091
|
});
|
|
1104
|
-
function*
|
|
1092
|
+
function* yn(u) {
|
|
1105
1093
|
for (; ; )
|
|
1106
1094
|
yield u[Math.floor(Math.random() * u.length)];
|
|
1107
1095
|
}
|
|
1108
|
-
function
|
|
1096
|
+
function gn(u = 4, o = yn("qwertyuiopasdfghjklzxcvbnm".split(""))) {
|
|
1109
1097
|
return Array.from({ length: u }).map(() => o.next().value).join("");
|
|
1110
1098
|
}
|
|
1111
|
-
function
|
|
1112
|
-
return `sku_${(/* @__PURE__ */ new Date()).toISOString()}_${
|
|
1099
|
+
function bn() {
|
|
1100
|
+
return `sku_${(/* @__PURE__ */ new Date()).toISOString()}_${gn()}`;
|
|
1113
1101
|
}
|
|
1114
|
-
const
|
|
1102
|
+
const hn = {
|
|
1115
1103
|
_id: "",
|
|
1116
1104
|
name: "",
|
|
1117
1105
|
abbrev: "",
|
|
1118
1106
|
precision: 0,
|
|
1119
1107
|
measurements: []
|
|
1120
1108
|
};
|
|
1121
|
-
function
|
|
1109
|
+
function _n(u) {
|
|
1122
1110
|
var y, r, n, l, i;
|
|
1123
1111
|
return {
|
|
1124
1112
|
code: u.code,
|
|
@@ -1126,12 +1114,12 @@ function xn(u) {
|
|
|
1126
1114
|
unit: ((y = u.unit.measurements.find((a) => a.id === u.trackingMeasurement)) == null ? void 0 : y.abbrev) ?? u.unit.abbrev,
|
|
1127
1115
|
baseUnit: u.unit.abbrev,
|
|
1128
1116
|
valuationMethod: u.valuation ?? "WAVG",
|
|
1129
|
-
pricePerUnit: (r = u.defaultCost) != null && r.costPerUnit ? +
|
|
1130
|
-
thresholdLow: ((l = u.thresholds) == null ? void 0 : l.low) ??
|
|
1131
|
-
thresholdMid: ((i = u.thresholds) == null ? void 0 : i.mid) ??
|
|
1117
|
+
pricePerUnit: (r = u.defaultCost) != null && r.costPerUnit ? +Ke((n = u.defaultCost) == null ? void 0 : n.costPerUnit) : 0,
|
|
1118
|
+
thresholdLow: ((l = u.thresholds) == null ? void 0 : l.low) ?? ae().low,
|
|
1119
|
+
thresholdMid: ((i = u.thresholds) == null ? void 0 : i.mid) ?? ae().mid
|
|
1132
1120
|
};
|
|
1133
1121
|
}
|
|
1134
|
-
function
|
|
1122
|
+
function tt() {
|
|
1135
1123
|
var n;
|
|
1136
1124
|
const u = [
|
|
1137
1125
|
{
|
|
@@ -1150,7 +1138,7 @@ function nt() {
|
|
|
1150
1138
|
id: "baseUnit",
|
|
1151
1139
|
name: "Base unit"
|
|
1152
1140
|
}
|
|
1153
|
-
], o =
|
|
1141
|
+
], o = et(), y = fe(), r = xe(y.currentCountry.value);
|
|
1154
1142
|
return o.enableTotalCost && u.push(
|
|
1155
1143
|
{
|
|
1156
1144
|
id: "valuationMethod",
|
|
@@ -1171,28 +1159,28 @@ function nt() {
|
|
|
1171
1159
|
}
|
|
1172
1160
|
), u;
|
|
1173
1161
|
}
|
|
1174
|
-
function
|
|
1175
|
-
const o =
|
|
1162
|
+
function xn() {
|
|
1163
|
+
const o = ne().skus.map(_n), r = fe().currentBusiness.value, n = tt(), l = [
|
|
1176
1164
|
["Business name:", r == null ? void 0 : r.name],
|
|
1177
1165
|
["Business ID:", r == null ? void 0 : r._id],
|
|
1178
1166
|
["Menu version", r == null ? void 0 : r.menuVersion],
|
|
1179
1167
|
[],
|
|
1180
1168
|
n.map((k) => k.name),
|
|
1181
1169
|
...o.map((k) => n.map((g) => k[g.id]))
|
|
1182
|
-
], i = n.map((k) => `system:${k.id}`), a =
|
|
1183
|
-
return
|
|
1170
|
+
], i = n.map((k) => `system:${k.id}`), a = Je(l, i), h = `${r == null ? void 0 : r.name} ingredients (${vt(/* @__PURE__ */ new Date())}).xlsx`;
|
|
1171
|
+
return Qe(a, h), h;
|
|
1184
1172
|
}
|
|
1185
|
-
function
|
|
1186
|
-
const o =
|
|
1173
|
+
function kn() {
|
|
1174
|
+
const o = fe().currentBusiness.value, y = tt(), r = [
|
|
1187
1175
|
["Business name:", o == null ? void 0 : o.name],
|
|
1188
1176
|
["Business ID:", o == null ? void 0 : o._id],
|
|
1189
1177
|
["Menu version", o == null ? void 0 : o.menuVersion],
|
|
1190
1178
|
[],
|
|
1191
1179
|
y.map((a) => a.name)
|
|
1192
|
-
], n = y.map((a) => `system:${a.id}`), l =
|
|
1193
|
-
return
|
|
1180
|
+
], n = y.map((a) => `system:${a.id}`), l = Je(r, n), i = "FeedMe ingredients template.xlsx";
|
|
1181
|
+
return Qe(l, i), i;
|
|
1194
1182
|
}
|
|
1195
|
-
function
|
|
1183
|
+
function Vn(u) {
|
|
1196
1184
|
const [
|
|
1197
1185
|
o,
|
|
1198
1186
|
y,
|
|
@@ -1201,7 +1189,7 @@ function Sn(u) {
|
|
|
1201
1189
|
l,
|
|
1202
1190
|
i,
|
|
1203
1191
|
...a
|
|
1204
|
-
] =
|
|
1192
|
+
] = yt(u);
|
|
1205
1193
|
if (!o || !o.length || o.some((s) => s.length && !s.startsWith("system:")))
|
|
1206
1194
|
throw new Error("Missing meta header. Excel file does not come from the template.");
|
|
1207
1195
|
const h = o.map((s) => s.split(":")[1]), g = ["code", "name", "unit", "baseUnit"].filter((s) => !h.includes(s));
|
|
@@ -1212,8 +1200,8 @@ function Sn(u) {
|
|
|
1212
1200
|
return a.map((s, x) => {
|
|
1213
1201
|
const U = {};
|
|
1214
1202
|
for (const I in h) {
|
|
1215
|
-
const
|
|
1216
|
-
Object.assign(U, { [
|
|
1203
|
+
const N = h[I];
|
|
1204
|
+
Object.assign(U, { [N]: s[I] });
|
|
1217
1205
|
}
|
|
1218
1206
|
return {
|
|
1219
1207
|
index: x,
|
|
@@ -1222,8 +1210,8 @@ function Sn(u) {
|
|
|
1222
1210
|
});
|
|
1223
1211
|
}
|
|
1224
1212
|
function je(u, o, y) {
|
|
1225
|
-
var
|
|
1226
|
-
const n =
|
|
1213
|
+
var w;
|
|
1214
|
+
const n = ne().units, l = new Array(), i = y.filter((v) => v.data.code === u.code);
|
|
1227
1215
|
i.length > 1 && l.push(
|
|
1228
1216
|
`Code ${u.code} is already used in row ${i.map((v) => v.index + 6).join()}.`
|
|
1229
1217
|
);
|
|
@@ -1234,16 +1222,16 @@ function je(u, o, y) {
|
|
|
1234
1222
|
const v = `Cannot find unit conversion for ${u.baseUnit} with symbol ${u.unit || "[empty]"}.`;
|
|
1235
1223
|
l.push(v);
|
|
1236
1224
|
}
|
|
1237
|
-
const k =
|
|
1225
|
+
const k = ve.options.find(
|
|
1238
1226
|
(v) => v === u.valuationMethod
|
|
1239
1227
|
);
|
|
1240
1228
|
u.valuationMethod && !k && l.push(
|
|
1241
|
-
`Expected valuation method to be one of ${
|
|
1229
|
+
`Expected valuation method to be one of ${ve.options.join()} but got ${u.valuationMethod} instead.`
|
|
1242
1230
|
);
|
|
1243
|
-
const b =
|
|
1231
|
+
const b = fe().currentCountry.value, s = (v) => `${v}`.length && gt()(v) === !0, x = s(`${u.pricePerUnit}`) === !0 ? {
|
|
1244
1232
|
costPerUnit: {
|
|
1245
|
-
...
|
|
1246
|
-
currency: ((
|
|
1233
|
+
...Ze(Number(u.pricePerUnit) || 0),
|
|
1234
|
+
currency: ((w = xe(b)) == null ? void 0 : w.currency) ?? "MYR"
|
|
1247
1235
|
},
|
|
1248
1236
|
measurement: h
|
|
1249
1237
|
} : void 0, U = s(`${u.thresholdLow}`) && s(`${u.thresholdMid}`) ? {
|
|
@@ -1253,10 +1241,10 @@ function je(u, o, y) {
|
|
|
1253
1241
|
return {
|
|
1254
1242
|
type: "create",
|
|
1255
1243
|
sku: {
|
|
1256
|
-
_id:
|
|
1244
|
+
_id: bn(),
|
|
1257
1245
|
code: u.code,
|
|
1258
1246
|
name: u.name,
|
|
1259
|
-
unit: a ?? n.find((v) => v) ??
|
|
1247
|
+
unit: a ?? n.find((v) => v) ?? hn,
|
|
1260
1248
|
trackingMeasurement: h == null ? void 0 : h.id,
|
|
1261
1249
|
valuation: k,
|
|
1262
1250
|
defaultCost: x,
|
|
@@ -1266,9 +1254,9 @@ function je(u, o, y) {
|
|
|
1266
1254
|
excelRowNumber: o + 6
|
|
1267
1255
|
};
|
|
1268
1256
|
}
|
|
1269
|
-
function
|
|
1257
|
+
function Sn(u) {
|
|
1270
1258
|
try {
|
|
1271
|
-
const o =
|
|
1259
|
+
const o = Vn(u).filter((k) => k.data.code), r = ne().skus, n = ft(r, "code"), l = o.filter((k) => !n[k.data.code]), i = o.filter((k) => n[k.data.code]), a = l.map(
|
|
1272
1260
|
(k) => je(k.data, k.index, o)
|
|
1273
1261
|
), h = i.map((k) => {
|
|
1274
1262
|
const g = je(k.data, k.index, o), b = n[k.data.code];
|
|
@@ -1303,10 +1291,10 @@ function Cn(u) {
|
|
|
1303
1291
|
};
|
|
1304
1292
|
}
|
|
1305
1293
|
}
|
|
1306
|
-
const
|
|
1294
|
+
const Cn = { class: "flex items-center gap-12 pl-8" }, wn = { class: "flex flex-col" }, Fn = { class: "fm-typo-en-body-md-400 text-fm-color-typo-primary flex items-center gap-4" }, Mn = {
|
|
1307
1295
|
key: 0,
|
|
1308
1296
|
class: "text-fm-color-typo-secondary fm-typo-en-body-sm-400"
|
|
1309
|
-
},
|
|
1297
|
+
}, In = { key: 0 }, qe = /* @__PURE__ */ te({
|
|
1310
1298
|
__name: "ImportIngredientItem",
|
|
1311
1299
|
props: {
|
|
1312
1300
|
type: {},
|
|
@@ -1317,23 +1305,23 @@ const wn = { class: "flex items-center gap-12 pl-8" }, Fn = { class: "flex flex-
|
|
|
1317
1305
|
setup(u) {
|
|
1318
1306
|
return (o, y) => {
|
|
1319
1307
|
const r = C("FmIcon"), n = C("FmTooltip");
|
|
1320
|
-
return f(), T("div",
|
|
1308
|
+
return f(), T("div", Cn, [
|
|
1321
1309
|
y[0] || (y[0] = m("div", null, "•", -1)),
|
|
1322
|
-
m("div",
|
|
1323
|
-
m("div",
|
|
1310
|
+
m("div", wn, [
|
|
1311
|
+
m("div", Fn, [
|
|
1324
1312
|
m("div", {
|
|
1325
1313
|
class: ee({
|
|
1326
1314
|
"text-fm-color-system-error-300": o.errors.length
|
|
1327
1315
|
})
|
|
1328
1316
|
}, [
|
|
1329
|
-
|
|
1330
|
-
o.type === "create" ? (f(), T("span",
|
|
1317
|
+
Me(A(o.name) + " ", 1),
|
|
1318
|
+
o.type === "create" ? (f(), T("span", Mn, "(new)")) : j("", !0)
|
|
1331
1319
|
], 2),
|
|
1332
|
-
o.errors.length ? (f(), T("div",
|
|
1320
|
+
o.errors.length ? (f(), T("div", In, [
|
|
1333
1321
|
c(n, { "z-index": 50 }, {
|
|
1334
1322
|
content: V(() => [
|
|
1335
1323
|
m("ol", null, [
|
|
1336
|
-
(f(!0), T(X, null,
|
|
1324
|
+
(f(!0), T(X, null, re(o.errors, (l, i) => (f(), T("li", { key: i }, A(l), 1))), 128))
|
|
1337
1325
|
])
|
|
1338
1326
|
]),
|
|
1339
1327
|
default: V(() => [
|
|
@@ -1345,7 +1333,7 @@ const wn = { class: "flex items-center gap-12 pl-8" }, Fn = { class: "flex flex-
|
|
|
1345
1333
|
]),
|
|
1346
1334
|
_: 1
|
|
1347
1335
|
})
|
|
1348
|
-
])) :
|
|
1336
|
+
])) : j("", !0)
|
|
1349
1337
|
]),
|
|
1350
1338
|
m("div", {
|
|
1351
1339
|
class: ee([
|
|
@@ -1360,37 +1348,37 @@ const wn = { class: "flex items-center gap-12 pl-8" }, Fn = { class: "flex flex-
|
|
|
1360
1348
|
]);
|
|
1361
1349
|
};
|
|
1362
1350
|
}
|
|
1363
|
-
}),
|
|
1351
|
+
}), $n = { class: "flex flex-col gap-24" }, En = { class: "fm-typo-en-body-md-400" }, Un = { class: "flex flex-col gap-8" }, Rn = { class: "line-clamp-2 text-ellipsis break-all" }, Tn = {
|
|
1364
1352
|
key: 2,
|
|
1365
1353
|
class: "shrink-0"
|
|
1366
|
-
},
|
|
1354
|
+
}, An = {
|
|
1367
1355
|
key: 0,
|
|
1368
1356
|
class: "flex flex-col"
|
|
1369
|
-
},
|
|
1357
|
+
}, Dn = { class: "text-fm-color-system-error-300 fm-typo-en-body-sm-400" }, Pn = {
|
|
1370
1358
|
key: 0,
|
|
1371
1359
|
class: "max-h-[200px] overflow-y-auto flex flex-col gap-8"
|
|
1372
|
-
},
|
|
1360
|
+
}, Bn = { class: "fm-typo-en-body-lg-600" }, Nn = /* @__PURE__ */ te({
|
|
1373
1361
|
__name: "ImportIngredients",
|
|
1374
1362
|
setup(u) {
|
|
1375
|
-
const o =
|
|
1363
|
+
const o = q(null), y = Ct(), r = ke(), n = q(!1), l = q(new Array()), i = q([]), a = q([]), h = S(
|
|
1376
1364
|
() => !!l.value.length || i.value.some((s) => s.errors.length) || a.value.some((s) => s.errors.length)
|
|
1377
1365
|
), k = S(
|
|
1378
1366
|
() => !!i.value.length || !!a.value.length
|
|
1379
|
-
), { t: g } =
|
|
1367
|
+
), { t: g } = oe();
|
|
1380
1368
|
async function b(s) {
|
|
1381
1369
|
l.value = [], i.value = [], a.value = [];
|
|
1382
1370
|
try {
|
|
1383
1371
|
n.value = !0;
|
|
1384
1372
|
const [x] = await Promise.all([
|
|
1385
|
-
|
|
1373
|
+
ht(s),
|
|
1386
1374
|
// fake buffer
|
|
1387
|
-
new Promise((
|
|
1388
|
-
]), U = x.SheetNames.find((
|
|
1375
|
+
new Promise((N) => setTimeout(N, 1e3))
|
|
1376
|
+
]), U = x.SheetNames.find((N) => N);
|
|
1389
1377
|
if (!U) {
|
|
1390
1378
|
l.value.push(g("inventory.ingredient.import.fileError.noSheet"));
|
|
1391
1379
|
return;
|
|
1392
1380
|
}
|
|
1393
|
-
const I =
|
|
1381
|
+
const I = Sn(x.Sheets[U]);
|
|
1394
1382
|
if (I.invalidExcel) {
|
|
1395
1383
|
l.value.push(I.invalidExcelMessage ?? g("inventory.ingredient.import.fileError.invalidExcel"));
|
|
1396
1384
|
return;
|
|
@@ -1413,26 +1401,26 @@ const wn = { class: "flex items-center gap-12 pl-8" }, Fn = { class: "flex flex-
|
|
|
1413
1401
|
}), n.value = !1;
|
|
1414
1402
|
}
|
|
1415
1403
|
}
|
|
1416
|
-
return
|
|
1404
|
+
return Ye(o, (s) => {
|
|
1417
1405
|
s && b(s);
|
|
1418
1406
|
}), (s, x) => {
|
|
1419
|
-
const U = C("FmCircularProgress"), I = C("FmIcon"),
|
|
1420
|
-
return f(), T("div",
|
|
1421
|
-
m("div",
|
|
1422
|
-
c(
|
|
1407
|
+
const U = C("FmCircularProgress"), I = C("FmIcon"), N = C("FmButton");
|
|
1408
|
+
return f(), T("div", $n, [
|
|
1409
|
+
m("div", En, A(d(g)("inventory.ingredient.import.uploadDescription")), 1),
|
|
1410
|
+
c(bt, {
|
|
1423
1411
|
class: ee({
|
|
1424
1412
|
"w-full": !0,
|
|
1425
1413
|
"h-[200px]": !o.value
|
|
1426
1414
|
}),
|
|
1427
1415
|
accept: ".xlsx",
|
|
1428
|
-
onFileUpload: x[0] || (x[0] = (
|
|
1416
|
+
onFileUpload: x[0] || (x[0] = (w) => o.value = w),
|
|
1429
1417
|
label: d(g)("inventory.ingredient.import.uploadTemplate"),
|
|
1430
1418
|
"button-label": d(g)("inventory.ingredient.import.selectFile")
|
|
1431
|
-
},
|
|
1419
|
+
}, Ge({ _: 2 }, [
|
|
1432
1420
|
o.value ? {
|
|
1433
1421
|
name: "default",
|
|
1434
|
-
fn: V(({ openFileDialog:
|
|
1435
|
-
m("div",
|
|
1422
|
+
fn: V(({ openFileDialog: w }) => [
|
|
1423
|
+
m("div", Un, [
|
|
1436
1424
|
m("div", {
|
|
1437
1425
|
class: ee([
|
|
1438
1426
|
"fm-corner-radius-md p-16 flex items-center gap-16",
|
|
@@ -1443,11 +1431,11 @@ const wn = { class: "flex items-center gap-12 pl-8" }, Fn = { class: "flex flex-
|
|
|
1443
1431
|
}
|
|
1444
1432
|
])
|
|
1445
1433
|
}, [
|
|
1446
|
-
n.value ? (f(),
|
|
1434
|
+
n.value ? (f(), B(U, {
|
|
1447
1435
|
key: 0,
|
|
1448
1436
|
size: "md",
|
|
1449
1437
|
color: "neutral-gray-200"
|
|
1450
|
-
})) : (f(),
|
|
1438
|
+
})) : (f(), B(I, {
|
|
1451
1439
|
key: 1,
|
|
1452
1440
|
name: h.value ? "error" : "attach_file",
|
|
1453
1441
|
outline: "",
|
|
@@ -1462,19 +1450,19 @@ const wn = { class: "flex items-center gap-12 pl-8" }, Fn = { class: "flex flex-
|
|
|
1462
1450
|
}
|
|
1463
1451
|
])
|
|
1464
1452
|
}, [
|
|
1465
|
-
m("div",
|
|
1453
|
+
m("div", Rn, A(o.value.name), 1)
|
|
1466
1454
|
], 2),
|
|
1467
|
-
n.value ?
|
|
1468
|
-
c(
|
|
1455
|
+
n.value ? j("", !0) : (f(), T("div", Tn, [
|
|
1456
|
+
c(N, {
|
|
1469
1457
|
label: d(g)("inventory.ingredient.import.replaceFile"),
|
|
1470
1458
|
variant: h.value ? "destructive" : "secondary",
|
|
1471
1459
|
"prepend-icon": h.value ? void 0 : "autorenew",
|
|
1472
|
-
onClick:
|
|
1460
|
+
onClick: w
|
|
1473
1461
|
}, null, 8, ["label", "variant", "prepend-icon", "onClick"])
|
|
1474
1462
|
]))
|
|
1475
1463
|
], 2),
|
|
1476
|
-
l.value.length ? (f(), T("div",
|
|
1477
|
-
(f(!0), T(X, null,
|
|
1464
|
+
l.value.length ? (f(), T("div", An, [
|
|
1465
|
+
(f(!0), T(X, null, re(l.value, (v, R) => (f(), T("div", {
|
|
1478
1466
|
key: R,
|
|
1479
1467
|
class: "flex gap-8 items-center"
|
|
1480
1468
|
}, [
|
|
@@ -1483,49 +1471,49 @@ const wn = { class: "flex items-center gap-12 pl-8" }, Fn = { class: "flex flex-
|
|
|
1483
1471
|
size: "sm",
|
|
1484
1472
|
color: "system-error-300"
|
|
1485
1473
|
}),
|
|
1486
|
-
m("div",
|
|
1474
|
+
m("div", Dn, A(v), 1)
|
|
1487
1475
|
]))), 128))
|
|
1488
|
-
])) :
|
|
1476
|
+
])) : j("", !0)
|
|
1489
1477
|
])
|
|
1490
1478
|
]),
|
|
1491
1479
|
key: "0"
|
|
1492
1480
|
} : void 0
|
|
1493
1481
|
]), 1032, ["class", "label", "button-label"]),
|
|
1494
|
-
k.value ? (f(), T("div",
|
|
1495
|
-
m("div",
|
|
1496
|
-
(f(!0), T(X, null,
|
|
1497
|
-
key:
|
|
1498
|
-
code:
|
|
1499
|
-
name:
|
|
1500
|
-
errors:
|
|
1482
|
+
k.value ? (f(), T("div", Pn, [
|
|
1483
|
+
m("div", Bn, A(d(g)("inventory.ingredient.import.summary")), 1),
|
|
1484
|
+
(f(!0), T(X, null, re(i.value, (w) => (f(), B(qe, {
|
|
1485
|
+
key: w.sku._id,
|
|
1486
|
+
code: w.sku.code,
|
|
1487
|
+
name: w.sku.name,
|
|
1488
|
+
errors: w.errors,
|
|
1501
1489
|
type: "create"
|
|
1502
1490
|
}, null, 8, ["code", "name", "errors"]))), 128)),
|
|
1503
|
-
(f(!0), T(X, null,
|
|
1504
|
-
key:
|
|
1505
|
-
code:
|
|
1506
|
-
name:
|
|
1507
|
-
errors:
|
|
1491
|
+
(f(!0), T(X, null, re(a.value, (w) => (f(), B(qe, {
|
|
1492
|
+
key: w.sku._id,
|
|
1493
|
+
code: w.sku.code,
|
|
1494
|
+
name: w.sku.name,
|
|
1495
|
+
errors: w.errors,
|
|
1508
1496
|
type: "update"
|
|
1509
1497
|
}, null, 8, ["code", "name", "errors"]))), 128))
|
|
1510
|
-
])) :
|
|
1498
|
+
])) : j("", !0)
|
|
1511
1499
|
]);
|
|
1512
1500
|
};
|
|
1513
1501
|
}
|
|
1514
|
-
}),
|
|
1502
|
+
}), zn = { class: "flex flex-col py-8" }, Ln = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Hn = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, oo = /* @__PURE__ */ te({
|
|
1515
1503
|
__name: "IngredientsView",
|
|
1516
1504
|
setup(u) {
|
|
1517
|
-
const o =
|
|
1505
|
+
const o = ne(), y = S(() => o.skus), r = _t(), n = Xe(), l = ke(), i = Ie(), { t: a } = oe(), { createIngredient: h, updateIngredient: k } = Fe(), { ingredientDialogProps: g, ingredientViewLoading: b } = $t(Fe()), { columnDefs: s } = Tt();
|
|
1518
1506
|
function x(D) {
|
|
1519
1507
|
switch (D) {
|
|
1520
1508
|
case "add":
|
|
1521
1509
|
return i.isEnabled ? void 0 : h();
|
|
1522
1510
|
case "import":
|
|
1523
|
-
return
|
|
1511
|
+
return se();
|
|
1524
1512
|
case "export":
|
|
1525
|
-
return
|
|
1513
|
+
return Q();
|
|
1526
1514
|
}
|
|
1527
1515
|
}
|
|
1528
|
-
const U =
|
|
1516
|
+
const U = q(""), I = q(!1), N = S(() => I.value || b.value), { breakpoints: w } = wt(), v = S(() => w.value.xs || w.value.sm), R = S(() => v.value ? 10 : 20), J = xt(), Z = q(!1), L = [
|
|
1529
1517
|
{
|
|
1530
1518
|
value: "import",
|
|
1531
1519
|
label: a("common.import")
|
|
@@ -1535,12 +1523,12 @@ const wn = { class: "flex items-center gap-12 pl-8" }, Fn = { class: "flex flex-
|
|
|
1535
1523
|
label: a("common.export")
|
|
1536
1524
|
}
|
|
1537
1525
|
];
|
|
1538
|
-
function
|
|
1539
|
-
switch (
|
|
1526
|
+
function Y(D) {
|
|
1527
|
+
switch (Z.value = !1, D) {
|
|
1540
1528
|
case "import":
|
|
1541
|
-
return
|
|
1529
|
+
return se();
|
|
1542
1530
|
case "export":
|
|
1543
|
-
return
|
|
1531
|
+
return Q();
|
|
1544
1532
|
}
|
|
1545
1533
|
}
|
|
1546
1534
|
const H = S(() => [
|
|
@@ -1555,18 +1543,18 @@ const wn = { class: "flex items-center gap-12 pl-8" }, Fn = { class: "flex flex-
|
|
|
1555
1543
|
],
|
|
1556
1544
|
{ label: a("common.export"), value: "export" }
|
|
1557
1545
|
]);
|
|
1558
|
-
function
|
|
1559
|
-
const D =
|
|
1546
|
+
function Q() {
|
|
1547
|
+
const D = xn();
|
|
1560
1548
|
l.open({
|
|
1561
1549
|
title: a("inventory.ingredient.export.success"),
|
|
1562
1550
|
message: a("inventory.ingredient.export.filename", [D]),
|
|
1563
1551
|
type: "success"
|
|
1564
1552
|
});
|
|
1565
1553
|
}
|
|
1566
|
-
function
|
|
1554
|
+
function se() {
|
|
1567
1555
|
n.open({
|
|
1568
1556
|
title: a("inventory.ingredient.import.title"),
|
|
1569
|
-
contentComponent:
|
|
1557
|
+
contentComponent: Nn,
|
|
1570
1558
|
overlay: !0,
|
|
1571
1559
|
closeButton: !0,
|
|
1572
1560
|
primaryActions: {
|
|
@@ -1606,29 +1594,29 @@ const wn = { class: "flex items-center gap-12 pl-8" }, Fn = { class: "flex flex-
|
|
|
1606
1594
|
});
|
|
1607
1595
|
return;
|
|
1608
1596
|
}
|
|
1609
|
-
n.close(),
|
|
1610
|
-
}).onTertiary(
|
|
1597
|
+
n.close(), ye(D);
|
|
1598
|
+
}).onTertiary(kn);
|
|
1611
1599
|
}
|
|
1612
|
-
async function
|
|
1600
|
+
async function ye(D) {
|
|
1613
1601
|
I.value = !0;
|
|
1614
1602
|
try {
|
|
1615
1603
|
const $ = [
|
|
1616
|
-
...D.importCreateResult.map(({ sku:
|
|
1617
|
-
...D.importUpdateResult.map(({ sku:
|
|
1618
|
-
],
|
|
1619
|
-
let
|
|
1620
|
-
const
|
|
1621
|
-
|
|
1604
|
+
...D.importCreateResult.map(({ sku: P }) => ({ type: "create", sku: P })),
|
|
1605
|
+
...D.importUpdateResult.map(({ sku: P }) => ({ type: "update", sku: P }))
|
|
1606
|
+
], ie = 100;
|
|
1607
|
+
let le = 0;
|
|
1608
|
+
const de = () => {
|
|
1609
|
+
le += ie, l.open({
|
|
1622
1610
|
title: a("inventory.ingredient.import.progress", [
|
|
1623
|
-
Math.min(
|
|
1611
|
+
Math.min(le, $.length),
|
|
1624
1612
|
$.length
|
|
1625
1613
|
])
|
|
1626
1614
|
});
|
|
1627
1615
|
};
|
|
1628
|
-
for (const
|
|
1629
|
-
|
|
1630
|
-
create:
|
|
1631
|
-
update:
|
|
1616
|
+
for (const P of $.chunk(100))
|
|
1617
|
+
de(), await o.importSkus({
|
|
1618
|
+
create: P.filter((z) => z.type === "create").map((z) => z.sku),
|
|
1619
|
+
update: P.filter((z) => z.type === "update").map((z) => z.sku)
|
|
1632
1620
|
});
|
|
1633
1621
|
l.open({
|
|
1634
1622
|
title: a("inventory.ingredient.import.success"),
|
|
@@ -1645,8 +1633,8 @@ const wn = { class: "flex items-center gap-12 pl-8" }, Fn = { class: "flex flex-
|
|
|
1645
1633
|
}
|
|
1646
1634
|
}
|
|
1647
1635
|
return (D, $) => {
|
|
1648
|
-
const
|
|
1649
|
-
return f(),
|
|
1636
|
+
const ie = C("FmTable"), le = C("FmCollapsibleTabs"), de = C("FmBottomSheet");
|
|
1637
|
+
return f(), B(kt, {
|
|
1650
1638
|
title: d(a)("inventory.ingredient.title"),
|
|
1651
1639
|
actions: H.value,
|
|
1652
1640
|
"onClick:action": x
|
|
@@ -1661,40 +1649,40 @@ const wn = { class: "flex items-center gap-12 pl-8" }, Fn = { class: "flex flex-
|
|
|
1661
1649
|
}
|
|
1662
1650
|
])
|
|
1663
1651
|
}, [
|
|
1664
|
-
c(
|
|
1652
|
+
c(Vt, {
|
|
1665
1653
|
searchable: "",
|
|
1666
1654
|
search: U.value,
|
|
1667
|
-
"onUpdate:search": $[0] || ($[0] = (
|
|
1655
|
+
"onUpdate:search": $[0] || ($[0] = (P) => U.value = P)
|
|
1668
1656
|
}, null, 8, ["search"]),
|
|
1669
|
-
c(
|
|
1670
|
-
style:
|
|
1657
|
+
c(ie, {
|
|
1658
|
+
style: rt(d(J).tableHeight),
|
|
1671
1659
|
"column-defs": d(s),
|
|
1672
1660
|
"row-data": y.value,
|
|
1673
1661
|
"search-value": U.value,
|
|
1674
|
-
loading: !d(r)._currentLocation ||
|
|
1662
|
+
loading: !d(r)._currentLocation || N.value,
|
|
1675
1663
|
"loading-text": "Loading",
|
|
1676
|
-
onRowClick: $[1] || ($[1] = (
|
|
1664
|
+
onRowClick: $[1] || ($[1] = (P) => d(k)(P.original)),
|
|
1677
1665
|
"page-size": R.value
|
|
1678
1666
|
}, {
|
|
1679
|
-
"list-row": V((
|
|
1680
|
-
c(
|
|
1681
|
-
row:
|
|
1667
|
+
"list-row": V((P) => [
|
|
1668
|
+
c(St, {
|
|
1669
|
+
row: P,
|
|
1682
1670
|
onRowClick: d(k)
|
|
1683
|
-
},
|
|
1671
|
+
}, Ge({
|
|
1684
1672
|
default: V((z) => {
|
|
1685
|
-
var
|
|
1673
|
+
var ge, ue, t, e, p, _, E, F, O, G;
|
|
1686
1674
|
return [
|
|
1687
|
-
m("div",
|
|
1688
|
-
m("div",
|
|
1689
|
-
c(d(
|
|
1690
|
-
render: (
|
|
1691
|
-
props: (
|
|
1675
|
+
m("div", zn, [
|
|
1676
|
+
m("div", Ln, [
|
|
1677
|
+
c(d(He), {
|
|
1678
|
+
render: (t = (ue = (ge = z.code) == null ? void 0 : ge.column) == null ? void 0 : ue.columnDef) == null ? void 0 : t.cell,
|
|
1679
|
+
props: (p = (e = z.code) == null ? void 0 : e.getContext) == null ? void 0 : p.call(e)
|
|
1692
1680
|
}, null, 8, ["render", "props"])
|
|
1693
1681
|
]),
|
|
1694
|
-
m("div",
|
|
1695
|
-
c(d(
|
|
1696
|
-
render: (
|
|
1697
|
-
props: (
|
|
1682
|
+
m("div", Hn, [
|
|
1683
|
+
c(d(He), {
|
|
1684
|
+
render: (F = (E = (_ = z.name) == null ? void 0 : _.column) == null ? void 0 : E.columnDef) == null ? void 0 : F.cell,
|
|
1685
|
+
props: (G = (O = z.name) == null ? void 0 : O.getContext) == null ? void 0 : G.call(O)
|
|
1698
1686
|
}, null, 8, ["render", "props"])
|
|
1699
1687
|
])
|
|
1700
1688
|
])
|
|
@@ -1714,20 +1702,20 @@ const wn = { class: "flex items-center gap-12 pl-8" }, Fn = { class: "flex flex-
|
|
|
1714
1702
|
_: 1
|
|
1715
1703
|
}, 8, ["style", "column-defs", "row-data", "search-value", "loading", "page-size"])
|
|
1716
1704
|
], 2),
|
|
1717
|
-
(f(),
|
|
1718
|
-
c(
|
|
1705
|
+
(f(), B(Pe, { to: "body" }, [
|
|
1706
|
+
c(fn, st(it(d(g))), null, 16)
|
|
1719
1707
|
])),
|
|
1720
|
-
(f(),
|
|
1721
|
-
c(
|
|
1708
|
+
(f(), B(Pe, { to: "body" }, [
|
|
1709
|
+
c(de, {
|
|
1722
1710
|
"dismiss-away": "",
|
|
1723
|
-
modelValue:
|
|
1724
|
-
"onUpdate:modelValue": $[3] || ($[3] = (
|
|
1711
|
+
modelValue: Z.value,
|
|
1712
|
+
"onUpdate:modelValue": $[3] || ($[3] = (P) => Z.value = P)
|
|
1725
1713
|
}, {
|
|
1726
1714
|
default: V(() => [
|
|
1727
|
-
c(
|
|
1715
|
+
c(le, {
|
|
1728
1716
|
class: "pb-8",
|
|
1729
1717
|
items: L,
|
|
1730
|
-
"onUpdate:modelValue": $[2] || ($[2] = (
|
|
1718
|
+
"onUpdate:modelValue": $[2] || ($[2] = (P) => Y(P))
|
|
1731
1719
|
})
|
|
1732
1720
|
]),
|
|
1733
1721
|
_: 1
|
|
@@ -1740,5 +1728,5 @@ const wn = { class: "flex items-center gap-12 pl-8" }, Fn = { class: "flex flex-
|
|
|
1740
1728
|
}
|
|
1741
1729
|
});
|
|
1742
1730
|
export {
|
|
1743
|
-
|
|
1731
|
+
oo as default
|
|
1744
1732
|
};
|