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