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