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