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