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