@feedmepos/mf-inventory-portal 1.2.7-dev.6 → 1.2.7-dev.8
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-B4nreEjd.js → App-DIqdK9d8.js} +1 -1
- package/dist/{ApprovalView-BEWmetGr.js → ApprovalView-BKK_eDzO.js} +2 -2
- package/dist/{BindingsDialog-CV5CHq0A.js → BindingsDialog-BRzOVR30.js} +2 -2
- package/dist/{BindingsPicker-CJ6YuIO_.js → BindingsPicker-BtCdvAgU.js} +1 -1
- package/dist/{BindingsTable-B5qmvSON.js → BindingsTable-DnS3ypzP.js} +1 -1
- package/dist/{ClosingDraftView-DcYrPHmC.js → ClosingDraftView-BZLUoCOk.js} +2 -2
- package/dist/ClosingTemplateView-BwDaPcHe.js +1862 -0
- package/dist/{DeliveryOrderPrintPreview-Dd8Z_oJX.js → DeliveryOrderPrintPreview-ClbyQK9l.js} +1 -1
- package/dist/{FmAdminBadge-nUE-Uwkt.js → FmAdminBadge-DcDyRj6K.js} +1 -1
- package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-DRTPdSjq.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-Da5zZ3ZF.js} +3 -3
- package/dist/{FmMultiselectDialog-6NnaNM69.js → FmMultiselectDialog-CYPN-2of.js} +1 -1
- package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-BAM0Fl5H.js → FmUnitInput.vue_vue_type_script_setup_true_lang-C4QKxv_V.js} +1 -1
- package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-BifABTYI.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-Bollyyl1.js} +1 -1
- package/dist/{IngredientGroupView-DHFOfraH.js → IngredientGroupView-baNWf_60.js} +2 -2
- package/dist/IngredientsView-B00A9orQ.js +2306 -0
- package/dist/{IntegrationView-FZQO-eq9.js → IntegrationView-CiwxB7rj.js} +4 -4
- package/dist/{InventoryBindingForm-Cv8_IjGu.js → InventoryBindingForm-BCY8vtGx.js} +1 -1
- package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-CpysGFX-.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-hjbfvhVh.js} +3 -3
- package/dist/{InventoryBindingSummary-DoMDUnzN.js → InventoryBindingSummary-CCPxd5ir.js} +1 -1
- package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-DBy4cZIn.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-CmqDgde9.js} +1 -1
- package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-DtWphfCy.js → PremiumBadge.vue_vue_type_script_setup_true_lang-DnpRhNG0.js} +1 -1
- package/dist/{PublishView-rGpWxJ2Z.js → PublishView-CDrYaJX9.js} +1 -1
- package/dist/{PurchaseOrderPrintPreview-Ca-uCoOs.js → PurchaseOrderPrintPreview-QeqPa532.js} +1 -1
- package/dist/{ReceiveRequestView-gZWPn8W7.js → ReceiveRequestView-C8NJ7ILf.js} +8 -8
- package/dist/{RecipeView-CgED4XAg.js → RecipeView-Bmvl_poR.js} +3 -3
- package/dist/{StockView-BykTXP3X.js → StockView-H8EcBWrt.js} +250 -247
- package/dist/{SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-pWaVz8ye.js → SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-D-H0oT-V.js} +1 -1
- package/dist/{SupplierView-BMNRQEX6.js → SupplierView-Dq3vMn5q.js} +4 -4
- package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-V9gy4pr6.js → TransferDetails.vue_vue_type_script_setup_true_lang-r7U0Wgsm.js} +6 -6
- package/dist/{TransferTemplateView-DnWZ18yS.js → TransferTemplateView-NTw0N3zX.js} +7 -7
- package/dist/{UnitView-BO6nG93s.js → UnitView-BFeT0jpH.js} +3 -3
- package/dist/{WarehouseView-CEk4yyoz.js → WarehouseView-50a9WiLB.js} +1 -1
- package/dist/{app-ps5buMDz.js → app-D5vamHiS.js} +223 -208
- package/dist/app.d.ts +15 -0
- package/dist/app.js +1 -1
- package/dist/closing-template-C8n1siov.js +53 -0
- package/dist/{decimal-Bw7W8Rls.js → decimal-BVxO-7VE.js} +1 -1
- package/dist/{format-unit-display-Br364rNI.js → format-unit-display-CvUKKMA2.js} +3 -3
- package/dist/{index-BXYkTV1E.js → index-BmPwzWR6.js} +1 -1
- package/dist/{index-D0OpdgKo.js → index-_TXzIRmu.js} +282 -267
- package/dist/{purchase-order-template-Cs5hlug7.js → purchase-order-template-CekjfB92.js} +1 -1
- package/dist/{stock-CNXehEEm.js → stock-4-rgOZcm.js} +1 -1
- package/dist/{supplier-Cr40xpgh.js → supplier-BOW9xXhe.js} +1 -1
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/{use-ingredient-select-dialog-DCD-eQNb.js → use-ingredient-select-dialog-DbJhveFq.js} +1 -1
- package/dist/{use-inventory-binding-dialog-CFqlEVQS.js → use-inventory-binding-dialog-BNY9P_Pg.js} +1 -1
- package/dist/views/ingredients/components/ingredient-form/IngredientForm.vue.d.ts +8 -0
- package/dist/views/ingredients/components/ingredient-form/IngredientFormProps.d.ts +2 -0
- package/package.json +1 -1
- package/dist/ClosingTemplateView-DBX9DLF2.js +0 -1908
- package/dist/IngredientsView-DhhgIHK9.js +0 -2197
- /package/dist/components/{SubsidiaryTreeDialog.vue.d.ts → netsuite/SubsidiaryTreeDialog.vue.d.ts} +0 -0
|
@@ -1,2197 +0,0 @@
|
|
|
1
|
-
import { ref as D, h as Y, defineComponent as ge, computed as k, resolveComponent as I, openBlock as g, createBlock as B, withCtx as x, createVNode as p, unref as a, createElementBlock as E, Fragment as re, createElementVNode as i, createCommentVNode as L, renderSlot as Fe, createTextVNode as We, toDisplayString as R, normalizeClass as ue, mergeModels as ot, onMounted as Pt, watch as gt, useModel as Ot, renderList as ye, isRef as lt, createSlots as bt, normalizeStyle as Bt, Teleport as at, normalizeProps as Dt, guardReactiveProps as Nt } from "vue";
|
|
2
|
-
import { a as ce, e as j, f as ht, S as zt, b as De, h as Lt, D as st, i as Re, A as Oe, j as _t, k as xt, l as Be, t as kt, m as jt, n as Ee, o as Ne, U as Ht, p as Wt, M as Yt, q as rt, r as it, c as Vt, s as ut, v as dt, w as qt, x as ct, y as wt, z as Gt, B as St, C as Kt, E as Jt, I as Qt, G as Zt, H as Xt, N as en, J as tn, u as nn, K as on, _ as ln, L as an, O as sn, P as mt, Q as rn } from "./app-ps5buMDz.js";
|
|
3
|
-
import { useDialog as Ye, useSnackbar as $e, components as Pe, useProxiedModel as pt, useDialogChild as un, useBreakpoints as dn } from "@feedmepos/ui-library";
|
|
4
|
-
import { i as cn, _ as mn } from "./is-linked-ingredient-error-fJ2TJb3z.js";
|
|
5
|
-
import { useI18n as be, useCoreStore as Ue } from "@feedmepos/mf-common";
|
|
6
|
-
import { defineStore as pn, storeToRefs as vn } from "pinia";
|
|
7
|
-
import { g as fn, _ as ze, S as Le, a as yn } from "./SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-pWaVz8ye.js";
|
|
8
|
-
import { _ as gn } from "./InventoryBindingForm.vue_vue_type_script_setup_true_lang-CpysGFX-.js";
|
|
9
|
-
import { _ as je } from "./IngredientBindedItem.vue_vue_type_script_setup_true_lang-BifABTYI.js";
|
|
10
|
-
import { _ as ke } from "./PreviewBadge.vue_vue_type_script_setup_true_lang-CRZiQHjx.js";
|
|
11
|
-
import { _ as bn } from "./FmCustomAttribute.vue_vue_type_script_setup_true_lang-D-IWRjRD.js";
|
|
12
|
-
import { u as Tt } from "./purchase-order-template-Cs5hlug7.js";
|
|
13
|
-
import { r as hn } from "./random-CSbEbElR.js";
|
|
14
|
-
import "./array-Ca8T3f_G.js";
|
|
15
|
-
import { u as _n } from "./FmMultiselectDialog-6NnaNM69.js";
|
|
16
|
-
const He = pn("ingredientForm", function() {
|
|
17
|
-
const o = Ye(), v = $e(), l = ce(), d = D(!1), { t: y } = be(), b = D();
|
|
18
|
-
function t() {
|
|
19
|
-
const s = {
|
|
20
|
-
unit: {},
|
|
21
|
-
mode: j.CREATE,
|
|
22
|
-
show: !0,
|
|
23
|
-
"onUpdate:show"(m) {
|
|
24
|
-
b.value.show = m;
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
b.value = s;
|
|
28
|
-
}
|
|
29
|
-
async function u(s) {
|
|
30
|
-
const m = {
|
|
31
|
-
unit: ht(s),
|
|
32
|
-
mode: j.UPDATE,
|
|
33
|
-
show: !0,
|
|
34
|
-
"onUpdate:show"(_) {
|
|
35
|
-
b.value.show = _;
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
b.value = m;
|
|
39
|
-
}
|
|
40
|
-
async function c(s) {
|
|
41
|
-
d.value = !0;
|
|
42
|
-
try {
|
|
43
|
-
await l.deleteSku(s), v.open({
|
|
44
|
-
title: "Success",
|
|
45
|
-
message: `Deleted ${s.name}`,
|
|
46
|
-
type: "success"
|
|
47
|
-
});
|
|
48
|
-
} catch (m) {
|
|
49
|
-
m instanceof zt && cn(m) ? o.open({
|
|
50
|
-
title: "Cannot delete ingredient",
|
|
51
|
-
contentComponent: mn,
|
|
52
|
-
contentComponentProps: {
|
|
53
|
-
subject: (s == null ? void 0 : s.name) ?? "",
|
|
54
|
-
items: m.errorResponse.message
|
|
55
|
-
},
|
|
56
|
-
secondaryActions: {
|
|
57
|
-
text: "Close",
|
|
58
|
-
close: !0
|
|
59
|
-
}
|
|
60
|
-
}) : console.log("unable to delete ingredient", m), v.open({
|
|
61
|
-
title: `Cannot delete ${s.name}`,
|
|
62
|
-
message: "Please try again.",
|
|
63
|
-
type: "error"
|
|
64
|
-
}), console.error("failed to delete ingredient", m);
|
|
65
|
-
} finally {
|
|
66
|
-
d.value = !1;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
function f(s) {
|
|
70
|
-
o.open({
|
|
71
|
-
title: y("inventory.ingredient.delete.title", [(s == null ? void 0 : s.name) ?? ""]),
|
|
72
|
-
closeButton: !1,
|
|
73
|
-
message: y("inventory.ingredient.delete.message"),
|
|
74
|
-
primaryActions: {
|
|
75
|
-
text: y("common.delete"),
|
|
76
|
-
close: !0,
|
|
77
|
-
variant: "destructive"
|
|
78
|
-
},
|
|
79
|
-
secondaryActions: {
|
|
80
|
-
text: y("common.cancel"),
|
|
81
|
-
close: !0
|
|
82
|
-
}
|
|
83
|
-
}).onPrimary(() => c(s));
|
|
84
|
-
}
|
|
85
|
-
return {
|
|
86
|
-
createIngredient: t,
|
|
87
|
-
updateIngredient: u,
|
|
88
|
-
deleteIngredient: f,
|
|
89
|
-
ingredientDialogProps: b,
|
|
90
|
-
ingredientViewLoading: d
|
|
91
|
-
};
|
|
92
|
-
});
|
|
93
|
-
function xn() {
|
|
94
|
-
const { updateIngredient: r, deleteIngredient: o } = He(), v = ce(), l = De(), { t: d } = be();
|
|
95
|
-
async function y(t, u) {
|
|
96
|
-
const c = ht(u);
|
|
97
|
-
if (t === Re.Edit) {
|
|
98
|
-
await r(c);
|
|
99
|
-
return;
|
|
100
|
-
}
|
|
101
|
-
if (t === Re.Delete) {
|
|
102
|
-
await o(c);
|
|
103
|
-
return;
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
return { columnDefs: [
|
|
107
|
-
{
|
|
108
|
-
accessorKey: "code",
|
|
109
|
-
header: () => d("inventory.ingredient.code"),
|
|
110
|
-
enableSorting: !0,
|
|
111
|
-
size: 300
|
|
112
|
-
},
|
|
113
|
-
{
|
|
114
|
-
accessorKey: "name",
|
|
115
|
-
header: () => d("inventory.ingredient.name"),
|
|
116
|
-
enableSorting: !0,
|
|
117
|
-
size: 300,
|
|
118
|
-
cell(t) {
|
|
119
|
-
const u = t.row.original, c = v.skuBindingFlattenCache[u._id], f = c == null ? void 0 : c.inventoryBindings.some(
|
|
120
|
-
(s) => "error" in s && s.reason === "circularDependency"
|
|
121
|
-
);
|
|
122
|
-
return Y("div", { class: "flex items-center w-full gap-4" }, [
|
|
123
|
-
f ? Y(
|
|
124
|
-
Pe.FmTooltip,
|
|
125
|
-
{ class: "text-left" },
|
|
126
|
-
{
|
|
127
|
-
default() {
|
|
128
|
-
return Y(Pe.FmIcon, {
|
|
129
|
-
name: "info",
|
|
130
|
-
color: "system-error-300",
|
|
131
|
-
size: "sm"
|
|
132
|
-
});
|
|
133
|
-
},
|
|
134
|
-
content() {
|
|
135
|
-
return d("inventory.inventoryBindings.circularError");
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
) : null,
|
|
139
|
-
u.name
|
|
140
|
-
]);
|
|
141
|
-
}
|
|
142
|
-
},
|
|
143
|
-
{
|
|
144
|
-
id: "unit",
|
|
145
|
-
header: () => d("inventory.ingredient.unit"),
|
|
146
|
-
accessorFn: (t) => vt(t),
|
|
147
|
-
cell(t) {
|
|
148
|
-
const u = t.row.original, c = vt(u);
|
|
149
|
-
return Y(
|
|
150
|
-
Pe.FmTooltip,
|
|
151
|
-
{ zIndex: 51, content: c },
|
|
152
|
-
Y(
|
|
153
|
-
"span",
|
|
154
|
-
{
|
|
155
|
-
class: "flex-auto line-clamp-2 text-ellipsis break-all"
|
|
156
|
-
},
|
|
157
|
-
c
|
|
158
|
-
)
|
|
159
|
-
);
|
|
160
|
-
},
|
|
161
|
-
enableSorting: !1,
|
|
162
|
-
size: "auto"
|
|
163
|
-
},
|
|
164
|
-
{
|
|
165
|
-
accessorKey: "isInactive",
|
|
166
|
-
header: () => d("inventory.ingredient.status.title"),
|
|
167
|
-
cell(t) {
|
|
168
|
-
const u = t.row.original.isInactive;
|
|
169
|
-
return Y(
|
|
170
|
-
"span",
|
|
171
|
-
{
|
|
172
|
-
class: [
|
|
173
|
-
"inline-block px-3 py-1 rounded-full text-xs font-semibold",
|
|
174
|
-
u ? "bg-red-100 text-red-700" : "bg-green-100 text-green-700"
|
|
175
|
-
].join(" ")
|
|
176
|
-
},
|
|
177
|
-
d(u ? "inventory.ingredient.status.inactive" : "inventory.ingredient.status.active")
|
|
178
|
-
);
|
|
179
|
-
},
|
|
180
|
-
enableSorting: !0
|
|
181
|
-
},
|
|
182
|
-
{
|
|
183
|
-
accessorKey: "netsuiteSubsidiary",
|
|
184
|
-
header: () => "NetSuite Subsidiary",
|
|
185
|
-
cell(t) {
|
|
186
|
-
const u = t.row.original, { includeChildren: c, subsidiaryNames: f } = l.getSkuSubsidiaries(u._id);
|
|
187
|
-
return Y(
|
|
188
|
-
Pe.FmTooltip,
|
|
189
|
-
{ zIndex: 51, variant: "rich" },
|
|
190
|
-
{
|
|
191
|
-
default: () => Y(
|
|
192
|
-
"span",
|
|
193
|
-
{
|
|
194
|
-
class: "flex-auto line-clamp-2 text-ellipsis break-all whitespace-pre-wrap"
|
|
195
|
-
},
|
|
196
|
-
f.join(", ")
|
|
197
|
-
),
|
|
198
|
-
content: () => Y("div", { class: "flex flex-col" }, [
|
|
199
|
-
Y("div", { class: "font-semibold" }, [
|
|
200
|
-
c ? Y("span", { class: "text-green-500" }, "Include ") : Y("span", { class: "text-red-500" }, "Not Include "),
|
|
201
|
-
"Children Subsidiaries"
|
|
202
|
-
]),
|
|
203
|
-
Y(
|
|
204
|
-
"ul",
|
|
205
|
-
{ class: "text-left pb-2" },
|
|
206
|
-
f.map(
|
|
207
|
-
(s) => Y(
|
|
208
|
-
"li",
|
|
209
|
-
{
|
|
210
|
-
class: "my-1 p-1 rounded bg-fm-color-system-info-100 text-fm-color-neutral-black"
|
|
211
|
-
},
|
|
212
|
-
s
|
|
213
|
-
)
|
|
214
|
-
)
|
|
215
|
-
)
|
|
216
|
-
])
|
|
217
|
-
}
|
|
218
|
-
);
|
|
219
|
-
},
|
|
220
|
-
enableSorting: !1,
|
|
221
|
-
size: "auto"
|
|
222
|
-
},
|
|
223
|
-
{
|
|
224
|
-
id: "action",
|
|
225
|
-
header: "",
|
|
226
|
-
cell(t) {
|
|
227
|
-
return Lt(
|
|
228
|
-
[st[Re.Edit], st[Re.Delete]],
|
|
229
|
-
(u) => {
|
|
230
|
-
y(u, t.row.original);
|
|
231
|
-
}
|
|
232
|
-
);
|
|
233
|
-
},
|
|
234
|
-
enableSorting: !1,
|
|
235
|
-
size: 40,
|
|
236
|
-
meta: {
|
|
237
|
-
cellClass: "",
|
|
238
|
-
headerClass: ""
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
] };
|
|
242
|
-
}
|
|
243
|
-
function vt(r) {
|
|
244
|
-
var o;
|
|
245
|
-
if (r.trackingMeasurement) {
|
|
246
|
-
const v = (o = r.unit.measurements) == null ? void 0 : o.find((l) => l.id === r.trackingMeasurement);
|
|
247
|
-
if (v)
|
|
248
|
-
return `${v.name} (${v.abbrev})`;
|
|
249
|
-
}
|
|
250
|
-
return `${r.unit.name} (${r.unit.abbrev})`;
|
|
251
|
-
}
|
|
252
|
-
const kn = /* @__PURE__ */ ge({
|
|
253
|
-
__name: "ConvertForm",
|
|
254
|
-
props: {
|
|
255
|
-
modelValue: {},
|
|
256
|
-
rootValue: {},
|
|
257
|
-
disabled: { type: Boolean },
|
|
258
|
-
readonly: { type: Boolean }
|
|
259
|
-
},
|
|
260
|
-
emits: ["update:modelValue"],
|
|
261
|
-
setup(r, { emit: o }) {
|
|
262
|
-
const v = r, l = k(() => {
|
|
263
|
-
var m;
|
|
264
|
-
return (m = v.rootValue) == null ? void 0 : m.unit;
|
|
265
|
-
}), d = k(() => {
|
|
266
|
-
var m;
|
|
267
|
-
return (m = v.rootValue) == null ? void 0 : m._id;
|
|
268
|
-
}), y = o, { t: b } = be(), t = k({
|
|
269
|
-
get() {
|
|
270
|
-
return !!v.modelValue;
|
|
271
|
-
},
|
|
272
|
-
set(m) {
|
|
273
|
-
m ? y("update:modelValue", {
|
|
274
|
-
measurement: null,
|
|
275
|
-
inventoryBindings: []
|
|
276
|
-
}) : y("update:modelValue", null);
|
|
277
|
-
}
|
|
278
|
-
}), u = k(() => fn(l.value));
|
|
279
|
-
function c(m) {
|
|
280
|
-
const _ = v.modelValue ?? {};
|
|
281
|
-
_.measurement = m ? `${m}` : null, y("update:modelValue", _);
|
|
282
|
-
}
|
|
283
|
-
function f(m) {
|
|
284
|
-
const _ = v.modelValue ?? {};
|
|
285
|
-
_.inventoryBindings = m, y("update:modelValue", _);
|
|
286
|
-
}
|
|
287
|
-
const s = k(() => {
|
|
288
|
-
if (!v.modelValue) return null;
|
|
289
|
-
const m = v.modelValue;
|
|
290
|
-
return m.measurement ? u.value.find((_) => _.value === m.measurement) ?? null : u.value.find((_) => _.value === null) ?? null;
|
|
291
|
-
});
|
|
292
|
-
return (m, _) => {
|
|
293
|
-
const N = I("FmSwitch"), $ = I("FmSelect"), U = I("FmCard");
|
|
294
|
-
return g(), B(U, {
|
|
295
|
-
variant: "outlined",
|
|
296
|
-
class: "p-16 flex flex-col gap-16"
|
|
297
|
-
}, {
|
|
298
|
-
default: x(() => {
|
|
299
|
-
var P, G;
|
|
300
|
-
return [
|
|
301
|
-
p(N, {
|
|
302
|
-
value: "",
|
|
303
|
-
"model-value": t.value,
|
|
304
|
-
"onUpdate:modelValue": _[0] || (_[0] = (C) => t.value = C),
|
|
305
|
-
label: a(b)("inventory.ingredient.convertible.title"),
|
|
306
|
-
sublabel: a(b)("inventory.ingredient.convertible.subtitle"),
|
|
307
|
-
labelPlacement: "right",
|
|
308
|
-
disabled: m.readonly
|
|
309
|
-
}, null, 8, ["model-value", "label", "sublabel", "disabled"]),
|
|
310
|
-
t.value ? (g(), E(re, { key: 0 }, [
|
|
311
|
-
i("div", null, [
|
|
312
|
-
p($, {
|
|
313
|
-
label: a(b)("inventory.ingredient.convertible.convertTo"),
|
|
314
|
-
modelValue: (P = s.value) == null ? void 0 : P.value,
|
|
315
|
-
"onUpdate:modelValue": c,
|
|
316
|
-
items: u.value,
|
|
317
|
-
disabled: m.readonly
|
|
318
|
-
}, null, 8, ["label", "modelValue", "items", "disabled"])
|
|
319
|
-
]),
|
|
320
|
-
p(gn, {
|
|
321
|
-
id: d.value,
|
|
322
|
-
"model-value": ((G = m.modelValue) == null ? void 0 : G.inventoryBindings) ?? [],
|
|
323
|
-
"onUpdate:modelValue": f,
|
|
324
|
-
"exclude-binding-id": d.value,
|
|
325
|
-
rules: [a(Oe)(1)],
|
|
326
|
-
readonly: m.readonly
|
|
327
|
-
}, null, 8, ["id", "model-value", "exclude-binding-id", "rules", "readonly"])
|
|
328
|
-
], 64)) : L("", !0)
|
|
329
|
-
];
|
|
330
|
-
}),
|
|
331
|
-
_: 1
|
|
332
|
-
});
|
|
333
|
-
};
|
|
334
|
-
}
|
|
335
|
-
});
|
|
336
|
-
function Ve() {
|
|
337
|
-
return {
|
|
338
|
-
low: 6,
|
|
339
|
-
mid: 14
|
|
340
|
-
};
|
|
341
|
-
}
|
|
342
|
-
const Vn = {
|
|
343
|
-
key: 0,
|
|
344
|
-
class: "flex flex-col gap-4"
|
|
345
|
-
}, Me = /* @__PURE__ */ ge({
|
|
346
|
-
__name: "FmLockableField",
|
|
347
|
-
props: {
|
|
348
|
-
locked: { type: Boolean },
|
|
349
|
-
disabled: { type: Boolean },
|
|
350
|
-
label: {},
|
|
351
|
-
helperText: {},
|
|
352
|
-
modelValue: {},
|
|
353
|
-
tooltipMessage: {},
|
|
354
|
-
tooltipPlacement: {},
|
|
355
|
-
tooltipZIndex: {}
|
|
356
|
-
},
|
|
357
|
-
setup(r) {
|
|
358
|
-
return (o, v) => {
|
|
359
|
-
const l = I("FmLabel"), d = I("FmIcon"), y = I("FmTooltip"), b = I("FmField");
|
|
360
|
-
return o.locked ? (g(), E("div", Vn, [
|
|
361
|
-
Fe(o.$slots, "label", {}, () => [
|
|
362
|
-
p(l, {
|
|
363
|
-
label: o.label,
|
|
364
|
-
disabled: o.disabled
|
|
365
|
-
}, null, 8, ["label", "disabled"])
|
|
366
|
-
]),
|
|
367
|
-
Fe(o.$slots, "field", {}, () => [
|
|
368
|
-
p(b, { disabled: o.disabled }, {
|
|
369
|
-
prepend: x(() => [
|
|
370
|
-
o.tooltipMessage ? (g(), B(y, {
|
|
371
|
-
key: 0,
|
|
372
|
-
placement: o.tooltipPlacement,
|
|
373
|
-
"z-index": o.tooltipZIndex
|
|
374
|
-
}, {
|
|
375
|
-
content: x(() => [
|
|
376
|
-
We(R(o.tooltipMessage), 1)
|
|
377
|
-
]),
|
|
378
|
-
default: x(() => [
|
|
379
|
-
p(d, {
|
|
380
|
-
name: "lock",
|
|
381
|
-
color: "neutral-gray-400"
|
|
382
|
-
})
|
|
383
|
-
]),
|
|
384
|
-
_: 1
|
|
385
|
-
}, 8, ["placement", "z-index"])) : (g(), B(d, {
|
|
386
|
-
key: 1,
|
|
387
|
-
name: "lock",
|
|
388
|
-
color: "neutral-gray-400"
|
|
389
|
-
}))
|
|
390
|
-
]),
|
|
391
|
-
default: x(() => [
|
|
392
|
-
Fe(o.$slots, "modelValue", {}, () => [
|
|
393
|
-
i("div", {
|
|
394
|
-
class: ue([
|
|
395
|
-
o.disabled ? "text-fm-color-typo-disabled" : "text-fm-color-typo-primary",
|
|
396
|
-
"line-clamp-1 text-ellipsis break-all"
|
|
397
|
-
])
|
|
398
|
-
}, R(o.modelValue), 3)
|
|
399
|
-
])
|
|
400
|
-
]),
|
|
401
|
-
_: 3
|
|
402
|
-
}, 8, ["disabled"])
|
|
403
|
-
]),
|
|
404
|
-
Fe(o.$slots, "helper-text", {}, () => [
|
|
405
|
-
i("div", {
|
|
406
|
-
class: ue([
|
|
407
|
-
"fm-typo-en-body-sm-400 line-clamp-1",
|
|
408
|
-
o.disabled ? "text-fm-color-typo-disabled" : "text-fm-color-typo-secondary"
|
|
409
|
-
])
|
|
410
|
-
}, R(o.helperText), 3)
|
|
411
|
-
])
|
|
412
|
-
])) : Fe(o.$slots, "default", { key: 1 });
|
|
413
|
-
};
|
|
414
|
-
}
|
|
415
|
-
}), wn = { class: "flex gap-8" }, Sn = { class: "flex-1" }, Tn = { class: "flex-1" }, In = { class: "flex flex-col gap-5" }, Cn = { class: "text-fm-color-typo-secondary" }, Fn = { class: "text-fm-color-typo-secondary whitespace-nowrap" }, Mn = {
|
|
416
|
-
key: 3,
|
|
417
|
-
class: "border-1 border-fm-color-neutral-gray-200 fm-corner-radius-lg flex flex-col p-16 gap-16"
|
|
418
|
-
}, En = { class: "flex flex-col" }, $n = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Un = {
|
|
419
|
-
key: 4,
|
|
420
|
-
class: "border-1 border-fm-color-neutral-gray-200 fm-corner-radius-lg flex flex-col p-16 gap-16"
|
|
421
|
-
}, An = { class: "flex flex-col gap-12" }, Rn = { class: "flex flex-col gap-4" }, Pn = { class: "fm-typo-en-title-sm-600" }, On = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Bn = { class: "flex flex-col gap-4" }, Dn = { class: "flex fm-corner-radius-md border-1 border-fm-color-neutral-gray-200" }, Nn = { class: "flex-1 p-12 flex flex-col gap-8" }, zn = { class: "mx-auto" }, Ln = { class: "flex flex-col" }, jn = { class: "fm-typo-en-body-sm-600 translate-y-4" }, Hn = { class: "flex-1 p-12 flex flex-col gap-8" }, Wn = { class: "mx-auto" }, Yn = { class: "flex flex-col" }, qn = { class: "fm-typo-en-body-sm-600 translate-y-4" }, Gn = { class: "flex-1 p-12 flex flex-col gap-8" }, Kn = { class: "mx-auto" }, Jn = { class: "flex flex-col" }, Qn = { class: "fm-typo-en-body-sm-600 translate-y-4" }, Zn = {
|
|
422
|
-
key: 5,
|
|
423
|
-
class: "flex flex-col gap-12"
|
|
424
|
-
}, Xn = { class: "flex flex-col" }, eo = { class: "flex items-center justify-between" }, to = { class: "fm-typo-en-title-sm-600" }, no = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, oo = {
|
|
425
|
-
key: 0,
|
|
426
|
-
class: "flex flex-col gap-8"
|
|
427
|
-
}, lo = { class: "flex flex-wrap gap-8" }, ao = {
|
|
428
|
-
key: 6,
|
|
429
|
-
class: "flex flex-col gap-12"
|
|
430
|
-
}, so = { class: "flex flex-col" }, ro = { class: "flex items-center justify-between" }, io = { class: "fm-typo-en-title-sm-600" }, uo = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, co = {
|
|
431
|
-
key: 0,
|
|
432
|
-
class: "flex flex-col gap-8"
|
|
433
|
-
}, mo = { class: "flex flex-wrap gap-8" }, po = /* @__PURE__ */ ge({
|
|
434
|
-
__name: "IngredientForm",
|
|
435
|
-
props: /* @__PURE__ */ ot({
|
|
436
|
-
mode: {},
|
|
437
|
-
modelValue: {},
|
|
438
|
-
disabled: { type: Boolean },
|
|
439
|
-
purchaseOrderTemplateIds: {},
|
|
440
|
-
wastageTemplateIds: {}
|
|
441
|
-
}, {
|
|
442
|
-
search: {},
|
|
443
|
-
searchModifiers: {}
|
|
444
|
-
}),
|
|
445
|
-
emits: /* @__PURE__ */ ot(["update:modelValue", "click:submit", "update:purchaseOrderTemplateIds", "update:wastageTemplateIds"], ["update:search"]),
|
|
446
|
-
setup(r, { expose: o, emit: v }) {
|
|
447
|
-
var qe;
|
|
448
|
-
const { t: l } = be(), d = Ye();
|
|
449
|
-
$e();
|
|
450
|
-
const y = Tt(), b = _t(), t = r, u = v, c = ce(), f = Ue(), s = Vt(), m = De(), _ = k(() => m.isEnabled);
|
|
451
|
-
D(void 0);
|
|
452
|
-
const N = D([]), $ = D([]), U = D(!1);
|
|
453
|
-
function P(e) {
|
|
454
|
-
if (e.length === 0) return;
|
|
455
|
-
const n = e[0], h = t.modelValue ?? {
|
|
456
|
-
unit: c.units.find((S) => S)
|
|
457
|
-
};
|
|
458
|
-
h.unit || (h.unit = n, u("update:modelValue", h));
|
|
459
|
-
}
|
|
460
|
-
Pt(() => {
|
|
461
|
-
P(c.units), s.mustUsePoTemplate && t.mode === j.CREATE && C(), s.enableWastageTemplate && t.mode === j.CREATE && we();
|
|
462
|
-
}), gt([() => c.units], ([e]) => {
|
|
463
|
-
P(e);
|
|
464
|
-
});
|
|
465
|
-
function G() {
|
|
466
|
-
u("click:submit");
|
|
467
|
-
}
|
|
468
|
-
async function C() {
|
|
469
|
-
N.value = [], U.value = !0;
|
|
470
|
-
try {
|
|
471
|
-
const [e] = await Promise.all([y.readTemplates()]).delayed(
|
|
472
|
-
1e3
|
|
473
|
-
);
|
|
474
|
-
N.value = e;
|
|
475
|
-
} catch (e) {
|
|
476
|
-
console.log("Something went wrong when fetching templates:", e);
|
|
477
|
-
} finally {
|
|
478
|
-
U.value = !1;
|
|
479
|
-
}
|
|
480
|
-
}
|
|
481
|
-
async function we() {
|
|
482
|
-
$.value = [], U.value = !0;
|
|
483
|
-
try {
|
|
484
|
-
const [e] = await Promise.all([b.readTemplates()]).delayed(
|
|
485
|
-
1e3
|
|
486
|
-
);
|
|
487
|
-
$.value = e;
|
|
488
|
-
} catch (e) {
|
|
489
|
-
console.log("Something went wrong when fetching wastage templates:", e);
|
|
490
|
-
} finally {
|
|
491
|
-
U.value = !1;
|
|
492
|
-
}
|
|
493
|
-
}
|
|
494
|
-
const ne = k({
|
|
495
|
-
get() {
|
|
496
|
-
var e;
|
|
497
|
-
return ((e = t.modelValue) == null ? void 0 : e.code) ?? "";
|
|
498
|
-
},
|
|
499
|
-
set(e) {
|
|
500
|
-
const n = t.modelValue ? {
|
|
501
|
-
...t.modelValue
|
|
502
|
-
} : {};
|
|
503
|
-
n.code = e, u("update:modelValue", n);
|
|
504
|
-
}
|
|
505
|
-
}), me = k({
|
|
506
|
-
get() {
|
|
507
|
-
var e;
|
|
508
|
-
return ((e = t.modelValue) == null ? void 0 : e.isInactive) ?? !1;
|
|
509
|
-
},
|
|
510
|
-
set(e) {
|
|
511
|
-
const n = t.modelValue ? {
|
|
512
|
-
...t.modelValue
|
|
513
|
-
} : {};
|
|
514
|
-
n.isInactive = e, u("update:modelValue", n);
|
|
515
|
-
}
|
|
516
|
-
}), oe = k({
|
|
517
|
-
get() {
|
|
518
|
-
var e;
|
|
519
|
-
return ((e = t.modelValue) == null ? void 0 : e.name) ?? "";
|
|
520
|
-
},
|
|
521
|
-
set(e) {
|
|
522
|
-
const n = t.modelValue ? {
|
|
523
|
-
...t.modelValue
|
|
524
|
-
} : {};
|
|
525
|
-
n.name = e, u("update:modelValue", n);
|
|
526
|
-
}
|
|
527
|
-
}), pe = k({
|
|
528
|
-
get() {
|
|
529
|
-
var n, h;
|
|
530
|
-
const e = (h = (n = t.modelValue) == null ? void 0 : n.defaultCost) == null ? void 0 : h.costPerUnit;
|
|
531
|
-
return e ? +xt(e) : 0;
|
|
532
|
-
},
|
|
533
|
-
set(e) {
|
|
534
|
-
var h, S, z, O;
|
|
535
|
-
const n = t.modelValue ? {
|
|
536
|
-
...t.modelValue
|
|
537
|
-
} : {};
|
|
538
|
-
n.defaultCost ?? (n.defaultCost = {
|
|
539
|
-
costPerUnit: {
|
|
540
|
-
amount: 0,
|
|
541
|
-
precision: 2,
|
|
542
|
-
currency: ((h = Be(f.currentCountry.value)) == null ? void 0 : h.currency) ?? "MYR"
|
|
543
|
-
},
|
|
544
|
-
measurement: (O = (z = (S = t.modelValue) == null ? void 0 : S.unit) == null ? void 0 : z.measurements) == null ? void 0 : O.find(
|
|
545
|
-
(ae) => {
|
|
546
|
-
var se;
|
|
547
|
-
return ae.id === ((se = t.modelValue) == null ? void 0 : se.trackingMeasurement);
|
|
548
|
-
}
|
|
549
|
-
)
|
|
550
|
-
}), n.defaultCost.costPerUnit = {
|
|
551
|
-
...n.defaultCost.costPerUnit,
|
|
552
|
-
...kt(+e, 4)
|
|
553
|
-
}, u("update:modelValue", n);
|
|
554
|
-
}
|
|
555
|
-
}), w = k(() => {
|
|
556
|
-
var n, h, S;
|
|
557
|
-
const e = ((n = t.modelValue) == null ? void 0 : n.unit) ?? c.units.find((z) => z);
|
|
558
|
-
return e ? {
|
|
559
|
-
_id: e._id,
|
|
560
|
-
measurement: (h = t.modelValue) == null ? void 0 : h.trackingMeasurement,
|
|
561
|
-
name: ((S = e.measurements.find((z) => {
|
|
562
|
-
var O;
|
|
563
|
-
return z.id === ((O = t.modelValue) == null ? void 0 : O.trackingMeasurement);
|
|
564
|
-
})) == null ? void 0 : S.name) ?? e.name
|
|
565
|
-
} : null;
|
|
566
|
-
}), A = k(
|
|
567
|
-
() => c.units.flatMap(({ name: e, _id: n, abbrev: h, measurements: S }) => [
|
|
568
|
-
{
|
|
569
|
-
label: `${e}`,
|
|
570
|
-
value: null,
|
|
571
|
-
displayAsSection: !0
|
|
572
|
-
},
|
|
573
|
-
{
|
|
574
|
-
label: `${e} (${h})`,
|
|
575
|
-
value: { _id: n },
|
|
576
|
-
displayAsSection: !1
|
|
577
|
-
},
|
|
578
|
-
...S.map(({ id: z, name: O, abbrev: ae }) => ({
|
|
579
|
-
label: `${O} (${ae})`,
|
|
580
|
-
value: { _id: n, measurement: z },
|
|
581
|
-
displayAsSection: !1
|
|
582
|
-
}))
|
|
583
|
-
])
|
|
584
|
-
), K = Ot(r, "search"), le = k(
|
|
585
|
-
() => new jt(A.value, ["label", "value"], {
|
|
586
|
-
caseSensitive: !1,
|
|
587
|
-
sort: !0
|
|
588
|
-
})
|
|
589
|
-
), Q = k(() => le.value.search(K.value));
|
|
590
|
-
function H(e) {
|
|
591
|
-
var n, h, S, z, O;
|
|
592
|
-
return ((h = (n = t.modelValue) == null ? void 0 : n.unit) == null ? void 0 : h._id) === ((S = e.value) == null ? void 0 : S._id) && ((z = t.modelValue) == null ? void 0 : z.trackingMeasurement) === ((O = e.value) == null ? void 0 : O.measurement);
|
|
593
|
-
}
|
|
594
|
-
function Z(e) {
|
|
595
|
-
var ae, se;
|
|
596
|
-
if (!e) return;
|
|
597
|
-
const { _id: n, measurement: h } = e, S = h || void 0, z = c.units.find((Ce) => Ce._id === n);
|
|
598
|
-
if (!z)
|
|
599
|
-
return;
|
|
600
|
-
const O = t.modelValue ?? {};
|
|
601
|
-
O.unit = z, O.trackingMeasurement = S, O.convert && (O.convert.measurement = S || null), s.enableTotalCost && (O.defaultCost = {
|
|
602
|
-
measurement: z.measurements.find((Ce) => Ce.id === S),
|
|
603
|
-
costPerUnit: {
|
|
604
|
-
...((ae = O.defaultCost) == null ? void 0 : ae.costPerUnit) ?? {
|
|
605
|
-
amount: 0,
|
|
606
|
-
precision: 2,
|
|
607
|
-
currency: ((se = Be(f.currentCountry.value)) == null ? void 0 : se.currency) ?? "MYR"
|
|
608
|
-
}
|
|
609
|
-
}
|
|
610
|
-
}), u("update:modelValue", O);
|
|
611
|
-
}
|
|
612
|
-
const he = k({
|
|
613
|
-
get() {
|
|
614
|
-
var e;
|
|
615
|
-
return ((e = t.modelValue) == null ? void 0 : e.convert) ?? null;
|
|
616
|
-
},
|
|
617
|
-
set(e) {
|
|
618
|
-
const n = t.modelValue ? {
|
|
619
|
-
...t.modelValue
|
|
620
|
-
} : {};
|
|
621
|
-
e ? n.convert = e : n.convert = null, u("update:modelValue", n);
|
|
622
|
-
}
|
|
623
|
-
}), F = k(() => Ee.options.filter(
|
|
624
|
-
(e) => e === Ee.enum.FIFO || e === Ee.enum.WAVG
|
|
625
|
-
).map((e) => ({
|
|
626
|
-
label: l(`inventory.ingredient.valuationMethod.${e}`),
|
|
627
|
-
value: e
|
|
628
|
-
}))), V = k({
|
|
629
|
-
get() {
|
|
630
|
-
var e;
|
|
631
|
-
return ((e = t.modelValue) == null ? void 0 : e.valuation) ?? "WAVG";
|
|
632
|
-
},
|
|
633
|
-
set(e) {
|
|
634
|
-
const n = t.modelValue ? {
|
|
635
|
-
...t.modelValue
|
|
636
|
-
} : {};
|
|
637
|
-
n.valuation = e, u("update:modelValue", n);
|
|
638
|
-
}
|
|
639
|
-
}), X = k({
|
|
640
|
-
get() {
|
|
641
|
-
var e;
|
|
642
|
-
return ((e = t.modelValue) == null ? void 0 : e.customAttributes) ?? {};
|
|
643
|
-
},
|
|
644
|
-
set(e) {
|
|
645
|
-
const n = t.modelValue ? {
|
|
646
|
-
...t.modelValue
|
|
647
|
-
} : {};
|
|
648
|
-
n.customAttributes = e, u("update:modelValue", n);
|
|
649
|
-
}
|
|
650
|
-
}), ee = D();
|
|
651
|
-
o({
|
|
652
|
-
validateInputs: () => {
|
|
653
|
-
var e, n;
|
|
654
|
-
(n = (e = ee.value) == null ? void 0 : e.validateInputs) == null || n.call(e);
|
|
655
|
-
},
|
|
656
|
-
resetInputsValidation: () => {
|
|
657
|
-
var e, n;
|
|
658
|
-
(n = (e = ee.value) == null ? void 0 : e.resetInputsValidation) == null || n.call(e);
|
|
659
|
-
},
|
|
660
|
-
resetInputs: () => {
|
|
661
|
-
var e, n;
|
|
662
|
-
(n = (e = ee.value) == null ? void 0 : e.resetInputs) == null || n.call(e);
|
|
663
|
-
}
|
|
664
|
-
});
|
|
665
|
-
const te = D(!1), ie = k(
|
|
666
|
-
() => {
|
|
667
|
-
var e, n, h;
|
|
668
|
-
return (e = t.modelValue) != null && e._id ? ((h = c.menu.bindedBySkuId[(n = t.modelValue) == null ? void 0 : n._id]) == null ? void 0 : h.filter(
|
|
669
|
-
(S) => S.from === "INGREDIENT"
|
|
670
|
-
)) ?? [] : [];
|
|
671
|
-
}
|
|
672
|
-
), M = k(
|
|
673
|
-
() => {
|
|
674
|
-
var e, n, h;
|
|
675
|
-
return (e = t.modelValue) != null && e._id ? ((h = c.menu.bindedBySkuId[(n = t.modelValue) == null ? void 0 : n._id]) == null ? void 0 : h.filter(
|
|
676
|
-
(S) => S.from === "RECIPE"
|
|
677
|
-
)) ?? [] : [];
|
|
678
|
-
}
|
|
679
|
-
), W = k(
|
|
680
|
-
() => {
|
|
681
|
-
var e, n, h;
|
|
682
|
-
return (e = t.modelValue) != null && e._id ? ((h = c.menu.bindedBySkuId[(n = t.modelValue) == null ? void 0 : n._id]) == null ? void 0 : h.filter((S) => S.from === "MENU")) ?? [] : [];
|
|
683
|
-
}
|
|
684
|
-
), q = k(
|
|
685
|
-
() => c.skus.map((e) => ({ label: e.name, value: e.code }))
|
|
686
|
-
), _e = D((qe = t.modelValue) == null ? void 0 : qe.code);
|
|
687
|
-
function Ae(e) {
|
|
688
|
-
var h;
|
|
689
|
-
const n = e.el;
|
|
690
|
-
n && ((h = n.querySelector("[x-should-scroll-into=true]")) == null || h.scrollIntoView());
|
|
691
|
-
}
|
|
692
|
-
const xe = k(
|
|
693
|
-
() => {
|
|
694
|
-
var e, n, h, S, z, O;
|
|
695
|
-
return ((S = (h = (n = (e = t.modelValue) == null ? void 0 : e.unit) == null ? void 0 : n.measurements) == null ? void 0 : h.find(
|
|
696
|
-
(ae) => {
|
|
697
|
-
var se;
|
|
698
|
-
return ae.id === ((se = t.modelValue) == null ? void 0 : se.trackingMeasurement);
|
|
699
|
-
}
|
|
700
|
-
)) == null ? void 0 : S.abbrev) ?? ((O = (z = t.modelValue) == null ? void 0 : z.unit) == null ? void 0 : O.abbrev);
|
|
701
|
-
}
|
|
702
|
-
), ve = k({
|
|
703
|
-
get() {
|
|
704
|
-
var e, n;
|
|
705
|
-
return ((n = (e = t.modelValue) == null ? void 0 : e.thresholds) == null ? void 0 : n.low) ?? Ve().low;
|
|
706
|
-
},
|
|
707
|
-
set(e) {
|
|
708
|
-
var S;
|
|
709
|
-
const n = ((S = t.modelValue) == null ? void 0 : S.thresholds) ?? Ve();
|
|
710
|
-
n.low = e;
|
|
711
|
-
const h = t.modelValue ? {
|
|
712
|
-
...t.modelValue
|
|
713
|
-
} : {};
|
|
714
|
-
h.thresholds = n, u("update:modelValue", h);
|
|
715
|
-
}
|
|
716
|
-
}), de = k({
|
|
717
|
-
get() {
|
|
718
|
-
var e, n;
|
|
719
|
-
return ((n = (e = t.modelValue) == null ? void 0 : e.thresholds) == null ? void 0 : n.mid) ?? Ve().mid;
|
|
720
|
-
},
|
|
721
|
-
set(e) {
|
|
722
|
-
var S;
|
|
723
|
-
const n = ((S = t.modelValue) == null ? void 0 : S.thresholds) ?? Ve();
|
|
724
|
-
n.mid = e;
|
|
725
|
-
const h = t.modelValue ? {
|
|
726
|
-
...t.modelValue
|
|
727
|
-
} : {};
|
|
728
|
-
h.thresholds = n, u("update:modelValue", h);
|
|
729
|
-
}
|
|
730
|
-
}), Se = k(() => s.mustUsePoTemplate && t.mode === j.CREATE && N.value.length > 0 ? N.value.map((e) => ({
|
|
731
|
-
label: e.name || "Template",
|
|
732
|
-
value: e._id || "template_" + e.name
|
|
733
|
-
})) : []), Te = k(() => Se.value.filter(
|
|
734
|
-
(e) => (t.purchaseOrderTemplateIds ?? []).includes(e.value)
|
|
735
|
-
)), fe = k(() => s.enableWastageTemplate && t.mode === j.CREATE && $.value.length > 0 ? $.value.map((e) => ({
|
|
736
|
-
label: e.name || "Template",
|
|
737
|
-
value: e._id || "template_" + e.name
|
|
738
|
-
})) : []), Ie = k(() => fe.value.filter(
|
|
739
|
-
(e) => (t.wastageTemplateIds ?? []).includes(e.value)
|
|
740
|
-
));
|
|
741
|
-
function Ft() {
|
|
742
|
-
d.open({
|
|
743
|
-
title: l("inventory.ingredient.purchaseOrderTemplates.selectTitle"),
|
|
744
|
-
closeButton: !0,
|
|
745
|
-
contentComponent: ut,
|
|
746
|
-
contentComponentProps: {
|
|
747
|
-
modelValue: t.purchaseOrderTemplateIds ?? [],
|
|
748
|
-
items: Se.value
|
|
749
|
-
},
|
|
750
|
-
primaryActions: {
|
|
751
|
-
text: l("common.confirm"),
|
|
752
|
-
close: !0
|
|
753
|
-
},
|
|
754
|
-
secondaryActions: {
|
|
755
|
-
text: l("common.cancel"),
|
|
756
|
-
close: !0,
|
|
757
|
-
variant: "tertiary"
|
|
758
|
-
}
|
|
759
|
-
}).onPrimary((e) => {
|
|
760
|
-
u("update:purchaseOrderTemplateIds", e);
|
|
761
|
-
});
|
|
762
|
-
}
|
|
763
|
-
function Mt() {
|
|
764
|
-
d.open({
|
|
765
|
-
title: l("inventory.ingredient.wastageTemplates.selectTitle"),
|
|
766
|
-
closeButton: !0,
|
|
767
|
-
contentComponent: ut,
|
|
768
|
-
contentComponentProps: {
|
|
769
|
-
modelValue: t.wastageTemplateIds ?? [],
|
|
770
|
-
items: fe.value
|
|
771
|
-
},
|
|
772
|
-
primaryActions: {
|
|
773
|
-
text: l("common.confirm"),
|
|
774
|
-
close: !0
|
|
775
|
-
},
|
|
776
|
-
secondaryActions: {
|
|
777
|
-
text: l("common.cancel"),
|
|
778
|
-
close: !0,
|
|
779
|
-
variant: "tertiary"
|
|
780
|
-
}
|
|
781
|
-
}).onPrimary((e) => {
|
|
782
|
-
u("update:wastageTemplateIds", e);
|
|
783
|
-
});
|
|
784
|
-
}
|
|
785
|
-
function Et() {
|
|
786
|
-
return function(n) {
|
|
787
|
-
return typeof (n == null ? void 0 : n.low) != "number" || typeof (n == null ? void 0 : n.mid) != "number" ? "Required" : n.low >= n.mid ? "Days for red indicator should be less than yellow indicator." : !0;
|
|
788
|
-
};
|
|
789
|
-
}
|
|
790
|
-
return (e, n) => {
|
|
791
|
-
const h = I("FmTextField"), S = I("FmLabel"), z = I("FmField"), O = I("FmIcon"), ae = I("FmMenuHeader"), se = I("FmMenuDivider"), Ce = I("FmMenuItem"), $t = I("FmMenu"), Ge = I("FmFormGroup"), Ut = I("FmSelect"), Ke = I("FmSwitch"), Je = I("FmStepperField"), Qe = I("FmButton"), Ze = I("FmChip"), At = I("FmForm");
|
|
792
|
-
return g(), B(At, {
|
|
793
|
-
disabled: e.disabled,
|
|
794
|
-
ref_key: "formRef",
|
|
795
|
-
ref: ee,
|
|
796
|
-
class: "flex flex-col gap-32",
|
|
797
|
-
onValidationSuccess: G
|
|
798
|
-
}, {
|
|
799
|
-
default: x(() => {
|
|
800
|
-
var Xe, et, tt, nt;
|
|
801
|
-
return [
|
|
802
|
-
i("div", wn, [
|
|
803
|
-
i("div", Sn, [
|
|
804
|
-
p(Me, {
|
|
805
|
-
"tooltip-message": "This field is managed by NetSuite",
|
|
806
|
-
"tooltip-z-index": 50,
|
|
807
|
-
label: a(l)("inventory.ingredient.code"),
|
|
808
|
-
"model-value": ne.value,
|
|
809
|
-
"onUpdate:modelValue": n[1] || (n[1] = (T) => ne.value = T),
|
|
810
|
-
locked: _.value,
|
|
811
|
-
disabled: e.disabled
|
|
812
|
-
}, {
|
|
813
|
-
default: x(() => [
|
|
814
|
-
p(h, {
|
|
815
|
-
label: a(l)("inventory.ingredient.code"),
|
|
816
|
-
"model-value": ne.value,
|
|
817
|
-
"onUpdate:modelValue": n[0] || (n[0] = (T) => ne.value = T),
|
|
818
|
-
rules: [a(Ne)(), a(Ht)(q.value, _e.value)],
|
|
819
|
-
"label-mark": "required"
|
|
820
|
-
}, null, 8, ["label", "model-value", "rules"])
|
|
821
|
-
]),
|
|
822
|
-
_: 1
|
|
823
|
-
}, 8, ["label", "model-value", "locked", "disabled"])
|
|
824
|
-
]),
|
|
825
|
-
i("div", Tn, [
|
|
826
|
-
p(Me, {
|
|
827
|
-
"tooltip-message": "This field is managed by NetSuite",
|
|
828
|
-
"tooltip-z-index": 50,
|
|
829
|
-
label: a(l)("inventory.ingredient.name"),
|
|
830
|
-
"model-value": oe.value,
|
|
831
|
-
"onUpdate:modelValue": n[3] || (n[3] = (T) => oe.value = T),
|
|
832
|
-
locked: _.value,
|
|
833
|
-
disabled: e.disabled
|
|
834
|
-
}, {
|
|
835
|
-
default: x(() => [
|
|
836
|
-
p(h, {
|
|
837
|
-
label: a(l)("inventory.ingredient.name"),
|
|
838
|
-
"model-value": oe.value,
|
|
839
|
-
"onUpdate:modelValue": n[2] || (n[2] = (T) => oe.value = T),
|
|
840
|
-
rules: [a(Ne)()],
|
|
841
|
-
"label-mark": "required"
|
|
842
|
-
}, null, 8, ["label", "model-value", "rules"])
|
|
843
|
-
]),
|
|
844
|
-
_: 1
|
|
845
|
-
}, 8, ["label", "model-value", "locked", "disabled"])
|
|
846
|
-
])
|
|
847
|
-
]),
|
|
848
|
-
p(Me, {
|
|
849
|
-
"tooltip-message": "This field is managed by NetSuite",
|
|
850
|
-
"tooltip-z-index": 50,
|
|
851
|
-
label: a(l)("inventory.ingredient.unit"),
|
|
852
|
-
"helper-text": (Xe = e.modelValue) != null && Xe.trackingMeasurement ? `Base unit: ${(tt = (et = e.modelValue) == null ? void 0 : et.unit) == null ? void 0 : tt.name}` : void 0,
|
|
853
|
-
"model-value": (nt = w.value) == null ? void 0 : nt.name,
|
|
854
|
-
locked: _.value,
|
|
855
|
-
disabled: e.disabled
|
|
856
|
-
}, {
|
|
857
|
-
default: x(() => [
|
|
858
|
-
p(Ge, {
|
|
859
|
-
"model-value": w.value,
|
|
860
|
-
rules: [a(Ne)()],
|
|
861
|
-
"label-mark": "required"
|
|
862
|
-
}, {
|
|
863
|
-
label: x(() => [
|
|
864
|
-
p(S, {
|
|
865
|
-
label: a(l)("inventory.ingredient.unit")
|
|
866
|
-
}, null, 8, ["label"])
|
|
867
|
-
]),
|
|
868
|
-
default: x(({ invalid: T }) => [
|
|
869
|
-
p($t, null, {
|
|
870
|
-
"menu-button": x(() => [
|
|
871
|
-
p(z, {
|
|
872
|
-
class: ue([
|
|
873
|
-
"fm-typo-en-body-lg-400",
|
|
874
|
-
{
|
|
875
|
-
"text-fm-color-typo-primary": !e.disabled,
|
|
876
|
-
"text-fm-color-typo-disabled": e.disabled
|
|
877
|
-
}
|
|
878
|
-
]),
|
|
879
|
-
invalid: T,
|
|
880
|
-
"append-icon": "expand_more"
|
|
881
|
-
}, {
|
|
882
|
-
default: x(() => {
|
|
883
|
-
var J;
|
|
884
|
-
return [
|
|
885
|
-
We(R((J = w.value) == null ? void 0 : J.name), 1)
|
|
886
|
-
];
|
|
887
|
-
}),
|
|
888
|
-
_: 2
|
|
889
|
-
}, 1032, ["class", "invalid"])
|
|
890
|
-
]),
|
|
891
|
-
default: x(() => [
|
|
892
|
-
i("div", In, [
|
|
893
|
-
p(h, {
|
|
894
|
-
modelValue: K.value,
|
|
895
|
-
"onUpdate:modelValue": n[4] || (n[4] = (J) => K.value = J),
|
|
896
|
-
placeholder: "Filter options"
|
|
897
|
-
}, {
|
|
898
|
-
prepend: x(() => [
|
|
899
|
-
p(O, { name: "search" })
|
|
900
|
-
]),
|
|
901
|
-
_: 1
|
|
902
|
-
}, 8, ["modelValue"]),
|
|
903
|
-
i("div", {
|
|
904
|
-
class: "overflow-x-hidden overflow-y-auto max-h-[300px]",
|
|
905
|
-
onVnodeMounted: Ae
|
|
906
|
-
}, [
|
|
907
|
-
(g(!0), E(re, null, ye(Q.value, (J, Rt) => (g(), E(re, { key: Rt }, [
|
|
908
|
-
J.displayAsSection ? (g(), E(re, { key: 0 }, [
|
|
909
|
-
p(ae, {
|
|
910
|
-
label: J.label
|
|
911
|
-
}, null, 8, ["label"]),
|
|
912
|
-
p(se)
|
|
913
|
-
], 64)) : (g(), B(Ce, {
|
|
914
|
-
key: 1,
|
|
915
|
-
label: J.label,
|
|
916
|
-
"model-value": H(J),
|
|
917
|
-
onClick: (Wo) => Z(J.value),
|
|
918
|
-
"x-should-scroll-into": `${H(J)}`
|
|
919
|
-
}, null, 8, ["label", "model-value", "onClick", "x-should-scroll-into"]))
|
|
920
|
-
], 64))), 128))
|
|
921
|
-
], 512)
|
|
922
|
-
])
|
|
923
|
-
]),
|
|
924
|
-
_: 2
|
|
925
|
-
}, 1024)
|
|
926
|
-
]),
|
|
927
|
-
_: 1
|
|
928
|
-
}, 8, ["model-value", "rules"])
|
|
929
|
-
]),
|
|
930
|
-
_: 1
|
|
931
|
-
}, 8, ["label", "helper-text", "model-value", "locked", "disabled"]),
|
|
932
|
-
a(s).enableTotalCost ? (g(), B(Me, {
|
|
933
|
-
key: 0,
|
|
934
|
-
"tooltip-message": "This field is managed by NetSuite",
|
|
935
|
-
"tooltip-z-index": 50,
|
|
936
|
-
label: a(l)("inventory.ingredient.valuationMethod.title"),
|
|
937
|
-
"model-value": a(l)("inventory.ingredient.valuationMethod." + V.value),
|
|
938
|
-
locked: _.value,
|
|
939
|
-
disabled: e.disabled
|
|
940
|
-
}, {
|
|
941
|
-
label: x(() => [
|
|
942
|
-
p(ke, { "z-index": 50 }, {
|
|
943
|
-
default: x(() => [
|
|
944
|
-
p(S, {
|
|
945
|
-
label: a(l)("inventory.ingredient.valuationMethod.title")
|
|
946
|
-
}, null, 8, ["label"])
|
|
947
|
-
]),
|
|
948
|
-
_: 1
|
|
949
|
-
})
|
|
950
|
-
]),
|
|
951
|
-
default: x(() => [
|
|
952
|
-
p(Ut, {
|
|
953
|
-
class: "col-span-2",
|
|
954
|
-
label: a(l)("inventory.ingredient.valuationMethod.title"),
|
|
955
|
-
"model-value": V.value,
|
|
956
|
-
"onUpdate:modelValue": n[5] || (n[5] = (T) => V.value = T),
|
|
957
|
-
items: F.value
|
|
958
|
-
}, null, 8, ["label", "model-value", "items"])
|
|
959
|
-
]),
|
|
960
|
-
_: 1
|
|
961
|
-
}, 8, ["label", "model-value", "locked", "disabled"])) : L("", !0),
|
|
962
|
-
a(s).enableTotalCost ? (g(), B(Me, {
|
|
963
|
-
key: 1,
|
|
964
|
-
"tooltip-message": "This field is managed by NetSuite",
|
|
965
|
-
"tooltip-z-index": 50,
|
|
966
|
-
"model-value": `${a(Wt)()} ${pe.value}`,
|
|
967
|
-
locked: _.value,
|
|
968
|
-
disabled: e.disabled
|
|
969
|
-
}, {
|
|
970
|
-
label: x(() => [
|
|
971
|
-
p(ke, { "z-index": 50 }, {
|
|
972
|
-
default: x(() => [
|
|
973
|
-
p(S, {
|
|
974
|
-
label: a(l)("inventory.ingredient.pricePerUnit")
|
|
975
|
-
}, null, 8, ["label"])
|
|
976
|
-
]),
|
|
977
|
-
_: 1
|
|
978
|
-
})
|
|
979
|
-
]),
|
|
980
|
-
default: x(() => [
|
|
981
|
-
p(h, {
|
|
982
|
-
"model-value": pe.value,
|
|
983
|
-
"onUpdate:modelValue": n[6] || (n[6] = (T) => pe.value = T),
|
|
984
|
-
rules: [a(Oe)(0), a(Yt)(4)]
|
|
985
|
-
}, {
|
|
986
|
-
label: x(() => [
|
|
987
|
-
p(ke, { "z-index": 50 }, {
|
|
988
|
-
default: x(() => [
|
|
989
|
-
p(S, {
|
|
990
|
-
label: a(l)("inventory.ingredient.pricePerUnit")
|
|
991
|
-
}, null, 8, ["label"])
|
|
992
|
-
]),
|
|
993
|
-
_: 1
|
|
994
|
-
})
|
|
995
|
-
]),
|
|
996
|
-
prepend: x(() => {
|
|
997
|
-
var T, J;
|
|
998
|
-
return [
|
|
999
|
-
i("div", Cn, R(a(rt)(((T = a(f).currentCountry) == null ? void 0 : T.value) ?? a(it)) === "MYR" ? "RM" : a(rt)(((J = a(f).currentCountry) == null ? void 0 : J.value) ?? a(it))), 1)
|
|
1000
|
-
];
|
|
1001
|
-
}),
|
|
1002
|
-
append: x(() => [
|
|
1003
|
-
i("div", Fn, " / " + R(xe.value), 1)
|
|
1004
|
-
]),
|
|
1005
|
-
_: 1
|
|
1006
|
-
}, 8, ["model-value", "rules"])
|
|
1007
|
-
]),
|
|
1008
|
-
_: 1
|
|
1009
|
-
}, 8, ["model-value", "locked", "disabled"])) : L("", !0),
|
|
1010
|
-
!_.value || he.value ? (g(), B(kn, {
|
|
1011
|
-
key: 2,
|
|
1012
|
-
"model-value": he.value,
|
|
1013
|
-
"onUpdate:modelValue": n[7] || (n[7] = (T) => he.value = T),
|
|
1014
|
-
"root-value": e.modelValue,
|
|
1015
|
-
readonly: _.value
|
|
1016
|
-
}, null, 8, ["model-value", "root-value", "readonly"])) : L("", !0),
|
|
1017
|
-
e.mode !== a(j).CREATE ? (g(), E("div", Mn, [
|
|
1018
|
-
p(Ke, {
|
|
1019
|
-
label: a(l)("inventory.ingredient.status.inactive"),
|
|
1020
|
-
"model-value": me.value,
|
|
1021
|
-
"onUpdate:modelValue": n[8] || (n[8] = (T) => me.value = T),
|
|
1022
|
-
"label-placement": "right",
|
|
1023
|
-
disabled: _.value
|
|
1024
|
-
}, null, 8, ["label", "model-value", "disabled"]),
|
|
1025
|
-
i("div", En, [
|
|
1026
|
-
i("div", $n, R(a(l)("inventory.ingredient.status.preventFromOrder")), 1)
|
|
1027
|
-
])
|
|
1028
|
-
])) : L("", !0),
|
|
1029
|
-
e.mode !== a(j).CREATE ? (g(), E("div", Un, [
|
|
1030
|
-
i("div", null, [
|
|
1031
|
-
p(Ke, {
|
|
1032
|
-
label: a(l)("inventory.ingredient.bindedItems.title"),
|
|
1033
|
-
modelValue: te.value,
|
|
1034
|
-
"onUpdate:modelValue": n[9] || (n[9] = (T) => te.value = T),
|
|
1035
|
-
"label-placement": "right"
|
|
1036
|
-
}, null, 8, ["label", "modelValue"])
|
|
1037
|
-
]),
|
|
1038
|
-
te.value && ie.value.length ? (g(), B(je, {
|
|
1039
|
-
key: 0,
|
|
1040
|
-
name: a(l)("inventory.ingredient.bindedItems.ingredient"),
|
|
1041
|
-
bindings: ie.value
|
|
1042
|
-
}, null, 8, ["name", "bindings"])) : L("", !0),
|
|
1043
|
-
te.value && M.value.length ? (g(), B(je, {
|
|
1044
|
-
key: 1,
|
|
1045
|
-
name: a(l)("inventory.ingredient.bindedItems.recipe"),
|
|
1046
|
-
bindings: M.value
|
|
1047
|
-
}, null, 8, ["name", "bindings"])) : L("", !0),
|
|
1048
|
-
te.value && W.value.length ? (g(), B(je, {
|
|
1049
|
-
key: 2,
|
|
1050
|
-
name: a(l)("inventory.ingredient.bindedItems.menu"),
|
|
1051
|
-
bindings: W.value
|
|
1052
|
-
}, null, 8, ["name", "bindings"])) : L("", !0)
|
|
1053
|
-
])) : L("", !0),
|
|
1054
|
-
i("div", An, [
|
|
1055
|
-
i("div", Rn, [
|
|
1056
|
-
p(ke, null, {
|
|
1057
|
-
default: x(() => [
|
|
1058
|
-
i("div", Pn, R(a(l)("inventory.ingredient.threshold.title")), 1)
|
|
1059
|
-
]),
|
|
1060
|
-
_: 1
|
|
1061
|
-
}),
|
|
1062
|
-
i("div", On, R(a(l)("inventory.ingredient.threshold.subtitle")), 1)
|
|
1063
|
-
]),
|
|
1064
|
-
i("div", Bn, [
|
|
1065
|
-
p(Ge, {
|
|
1066
|
-
"model-value": { low: ve.value, mid: de.value },
|
|
1067
|
-
rules: [Et()]
|
|
1068
|
-
}, null, 8, ["model-value", "rules"]),
|
|
1069
|
-
i("div", Dn, [
|
|
1070
|
-
i("div", Nn, [
|
|
1071
|
-
i("div", zn, [
|
|
1072
|
-
p(ze, {
|
|
1073
|
-
days: ve.value,
|
|
1074
|
-
level: a(Le).low
|
|
1075
|
-
}, null, 8, ["days", "level"])
|
|
1076
|
-
]),
|
|
1077
|
-
i("div", Ln, [
|
|
1078
|
-
i("div", jn, R(a(l)("inventory.ingredient.threshold.whenRemaining")), 1),
|
|
1079
|
-
p(Je, {
|
|
1080
|
-
modelValue: ve.value,
|
|
1081
|
-
"onUpdate:modelValue": n[10] || (n[10] = (T) => ve.value = T),
|
|
1082
|
-
rules: [a(Oe)(0)]
|
|
1083
|
-
}, {
|
|
1084
|
-
append: x(() => n[13] || (n[13] = [
|
|
1085
|
-
i("div", {
|
|
1086
|
-
class: "text-fm-color-typo-secondary",
|
|
1087
|
-
style: { "padding-right": "32px" }
|
|
1088
|
-
}, "days", -1)
|
|
1089
|
-
])),
|
|
1090
|
-
_: 1
|
|
1091
|
-
}, 8, ["modelValue", "rules"])
|
|
1092
|
-
])
|
|
1093
|
-
]),
|
|
1094
|
-
n[15] || (n[15] = i("div", {
|
|
1095
|
-
class: "h-full bg-fm-color-neutral-gray-200 relative",
|
|
1096
|
-
style: { width: "1px" }
|
|
1097
|
-
}, [
|
|
1098
|
-
i("div", {
|
|
1099
|
-
class: "absolute bg-white",
|
|
1100
|
-
style: { transform: "translate(-50%, -50%)", left: "50%", top: "24px" }
|
|
1101
|
-
}, " < ")
|
|
1102
|
-
], -1)),
|
|
1103
|
-
i("div", Hn, [
|
|
1104
|
-
i("div", Wn, [
|
|
1105
|
-
p(ze, {
|
|
1106
|
-
days: de.value,
|
|
1107
|
-
level: a(Le).mid
|
|
1108
|
-
}, null, 8, ["days", "level"])
|
|
1109
|
-
]),
|
|
1110
|
-
i("div", Yn, [
|
|
1111
|
-
i("div", qn, R(a(l)("inventory.ingredient.threshold.whenRemaining")), 1),
|
|
1112
|
-
p(Je, {
|
|
1113
|
-
modelValue: de.value,
|
|
1114
|
-
"onUpdate:modelValue": n[11] || (n[11] = (T) => de.value = T),
|
|
1115
|
-
rules: [a(Oe)(0)]
|
|
1116
|
-
}, {
|
|
1117
|
-
append: x(() => n[14] || (n[14] = [
|
|
1118
|
-
i("div", {
|
|
1119
|
-
class: "text-fm-color-typo-secondary",
|
|
1120
|
-
style: { "padding-right": "32px" }
|
|
1121
|
-
}, "days", -1)
|
|
1122
|
-
])),
|
|
1123
|
-
_: 1
|
|
1124
|
-
}, 8, ["modelValue", "rules"])
|
|
1125
|
-
])
|
|
1126
|
-
]),
|
|
1127
|
-
n[16] || (n[16] = i("div", {
|
|
1128
|
-
class: "h-full bg-fm-color-neutral-gray-200 relative",
|
|
1129
|
-
style: { width: "1px" }
|
|
1130
|
-
}, [
|
|
1131
|
-
i("div", {
|
|
1132
|
-
class: "absolute bg-white",
|
|
1133
|
-
style: { transform: "translate(-50%, -50%)", left: "50%", top: "24px" }
|
|
1134
|
-
}, " < ")
|
|
1135
|
-
], -1)),
|
|
1136
|
-
i("div", Gn, [
|
|
1137
|
-
i("div", Kn, [
|
|
1138
|
-
p(ze, {
|
|
1139
|
-
days: de.value + 1,
|
|
1140
|
-
level: a(Le).high
|
|
1141
|
-
}, null, 8, ["days", "level"])
|
|
1142
|
-
]),
|
|
1143
|
-
i("div", Jn, [
|
|
1144
|
-
i("div", Qn, R(a(l)("inventory.ingredient.threshold.stockIsStaple")), 1)
|
|
1145
|
-
])
|
|
1146
|
-
])
|
|
1147
|
-
])
|
|
1148
|
-
])
|
|
1149
|
-
]),
|
|
1150
|
-
a(s).mustUsePoTemplate && e.mode === a(j).CREATE ? (g(), E("div", Zn, [
|
|
1151
|
-
i("div", Xn, [
|
|
1152
|
-
i("div", eo, [
|
|
1153
|
-
p(ke, null, {
|
|
1154
|
-
default: x(() => [
|
|
1155
|
-
i("div", to, R(a(l)("inventory.ingredient.purchaseOrderTemplates.title")), 1)
|
|
1156
|
-
]),
|
|
1157
|
-
_: 1
|
|
1158
|
-
}),
|
|
1159
|
-
p(Qe, {
|
|
1160
|
-
variant: "secondary",
|
|
1161
|
-
"text-color": "primary",
|
|
1162
|
-
"border-color": "primary",
|
|
1163
|
-
"prepend-icon": "add",
|
|
1164
|
-
onClick: Ft
|
|
1165
|
-
})
|
|
1166
|
-
]),
|
|
1167
|
-
i("div", no, R(a(l)("inventory.ingredient.purchaseOrderTemplates.description")), 1)
|
|
1168
|
-
]),
|
|
1169
|
-
Te.value.length > 0 ? (g(), E("div", oo, [
|
|
1170
|
-
i("div", lo, [
|
|
1171
|
-
(g(!0), E(re, null, ye(Te.value, (T) => (g(), B(Ze, {
|
|
1172
|
-
key: T.value,
|
|
1173
|
-
label: T.label,
|
|
1174
|
-
variant: "info",
|
|
1175
|
-
compact: ""
|
|
1176
|
-
}, null, 8, ["label"]))), 128))
|
|
1177
|
-
])
|
|
1178
|
-
])) : L("", !0)
|
|
1179
|
-
])) : L("", !0),
|
|
1180
|
-
a(s).enableWastageTemplate && e.mode === a(j).CREATE ? (g(), E("div", ao, [
|
|
1181
|
-
i("div", so, [
|
|
1182
|
-
i("div", ro, [
|
|
1183
|
-
p(ke, null, {
|
|
1184
|
-
default: x(() => [
|
|
1185
|
-
i("div", io, R(a(l)("inventory.ingredient.wastageTemplates.title")), 1)
|
|
1186
|
-
]),
|
|
1187
|
-
_: 1
|
|
1188
|
-
}),
|
|
1189
|
-
p(Qe, {
|
|
1190
|
-
variant: "secondary",
|
|
1191
|
-
"text-color": "primary",
|
|
1192
|
-
"border-color": "primary",
|
|
1193
|
-
"prepend-icon": "add",
|
|
1194
|
-
onClick: Mt
|
|
1195
|
-
})
|
|
1196
|
-
]),
|
|
1197
|
-
i("div", uo, R(a(l)("inventory.ingredient.wastageTemplates.description")), 1)
|
|
1198
|
-
]),
|
|
1199
|
-
Ie.value.length > 0 ? (g(), E("div", co, [
|
|
1200
|
-
i("div", mo, [
|
|
1201
|
-
(g(!0), E(re, null, ye(Ie.value, (T) => (g(), B(Ze, {
|
|
1202
|
-
key: T.value,
|
|
1203
|
-
label: T.label,
|
|
1204
|
-
variant: "info",
|
|
1205
|
-
compact: ""
|
|
1206
|
-
}, null, 8, ["label"]))), 128))
|
|
1207
|
-
])
|
|
1208
|
-
])) : L("", !0)
|
|
1209
|
-
])) : L("", !0),
|
|
1210
|
-
i("div", null, [
|
|
1211
|
-
p(bn, {
|
|
1212
|
-
entity: "inventorySku",
|
|
1213
|
-
modelValue: X.value,
|
|
1214
|
-
"onUpdate:modelValue": n[12] || (n[12] = (T) => X.value = T)
|
|
1215
|
-
}, null, 8, ["modelValue"])
|
|
1216
|
-
])
|
|
1217
|
-
];
|
|
1218
|
-
}),
|
|
1219
|
-
_: 1
|
|
1220
|
-
}, 8, ["disabled"]);
|
|
1221
|
-
};
|
|
1222
|
-
}
|
|
1223
|
-
}), vo = { class: "flex flex-col gap-32" }, fo = { class: "flex gap-4" }, yo = /* @__PURE__ */ ge({
|
|
1224
|
-
__name: "IngredientDialog",
|
|
1225
|
-
props: {
|
|
1226
|
-
show: { type: Boolean },
|
|
1227
|
-
unit: {},
|
|
1228
|
-
mode: { default: j.READ }
|
|
1229
|
-
},
|
|
1230
|
-
emits: ["update:show"],
|
|
1231
|
-
setup(r) {
|
|
1232
|
-
const o = r, v = ce(), l = De(), d = Tt(), y = _t(), b = $e(), { t } = be(), u = pt(o, "show"), c = pt(o, "unit"), f = D([]), s = D([]), m = k(
|
|
1233
|
-
() => {
|
|
1234
|
-
var w;
|
|
1235
|
-
return l.isEnabled && l.netSuiteItemBySkuId.has((w = o.unit) == null ? void 0 : w._id);
|
|
1236
|
-
}
|
|
1237
|
-
), _ = k(() => {
|
|
1238
|
-
switch (o.mode) {
|
|
1239
|
-
case j.READ:
|
|
1240
|
-
return "";
|
|
1241
|
-
case j.UPDATE:
|
|
1242
|
-
return t("inventory.ingredient.update.title");
|
|
1243
|
-
case j.CREATE:
|
|
1244
|
-
return t("inventory.ingredient.create.title");
|
|
1245
|
-
}
|
|
1246
|
-
return "";
|
|
1247
|
-
}), N = k(() => {
|
|
1248
|
-
switch (o.mode) {
|
|
1249
|
-
case j.READ:
|
|
1250
|
-
return "";
|
|
1251
|
-
case j.UPDATE:
|
|
1252
|
-
return t("common.save");
|
|
1253
|
-
case j.CREATE:
|
|
1254
|
-
return t("common.add");
|
|
1255
|
-
}
|
|
1256
|
-
return "";
|
|
1257
|
-
}), $ = D(), U = D(!1);
|
|
1258
|
-
async function P() {
|
|
1259
|
-
U.value = !0;
|
|
1260
|
-
try {
|
|
1261
|
-
await v.createSku(c.value);
|
|
1262
|
-
const w = v.skuByCode[c.value.code];
|
|
1263
|
-
f.value.length > 0 && await C(w), s.value.length > 0 && await we(w), u.value = !1, b.open({
|
|
1264
|
-
title: t("inventory.common.success"),
|
|
1265
|
-
message: t("inventory.ingredient.create.success", { name: c.value.name }),
|
|
1266
|
-
type: "success"
|
|
1267
|
-
});
|
|
1268
|
-
} catch (w) {
|
|
1269
|
-
w instanceof dt || b.open({
|
|
1270
|
-
title: t("inventory.ingredient.create.error.title"),
|
|
1271
|
-
message: t("inventory.ingredient.create.error.message"),
|
|
1272
|
-
type: "error"
|
|
1273
|
-
});
|
|
1274
|
-
} finally {
|
|
1275
|
-
U.value = !1;
|
|
1276
|
-
}
|
|
1277
|
-
}
|
|
1278
|
-
async function G() {
|
|
1279
|
-
U.value = !0;
|
|
1280
|
-
try {
|
|
1281
|
-
await v.updateSku(c.value), U.value = !1, u.value = !1, b.open({
|
|
1282
|
-
title: t("inventory.common.success"),
|
|
1283
|
-
message: t("inventory.ingredient.update.success", { name: c.value.name }),
|
|
1284
|
-
type: "success"
|
|
1285
|
-
});
|
|
1286
|
-
} catch (w) {
|
|
1287
|
-
w instanceof dt || b.open({
|
|
1288
|
-
title: t("inventory.ingredient.update.error.title"),
|
|
1289
|
-
message: t("inventory.ingredient.update.error.message"),
|
|
1290
|
-
type: "error"
|
|
1291
|
-
});
|
|
1292
|
-
} finally {
|
|
1293
|
-
U.value = !1;
|
|
1294
|
-
}
|
|
1295
|
-
}
|
|
1296
|
-
async function C(w) {
|
|
1297
|
-
var A, K, le, Q;
|
|
1298
|
-
try {
|
|
1299
|
-
for (const H of f.value) {
|
|
1300
|
-
const Z = await d.getTemplate(H);
|
|
1301
|
-
if (!Z) {
|
|
1302
|
-
console.warn(`Template with ID ${H} not found`);
|
|
1303
|
-
continue;
|
|
1304
|
-
}
|
|
1305
|
-
if (!Z.purchaseOrder.items.find((F) => F.sku._id === w._id)) {
|
|
1306
|
-
const F = { amount: 1, precision: qt(w.unit) }, V = {
|
|
1307
|
-
sku: w,
|
|
1308
|
-
name: w.name,
|
|
1309
|
-
code: w.code,
|
|
1310
|
-
quantity: F,
|
|
1311
|
-
minimumQuantity: F,
|
|
1312
|
-
quantityStep: F,
|
|
1313
|
-
measurement: ((K = (A = w.unit) == null ? void 0 : A.measurements) == null ? void 0 : K[0]) || null
|
|
1314
|
-
}, X = {
|
|
1315
|
-
...Z,
|
|
1316
|
-
purchaseOrder: {
|
|
1317
|
-
...Z.purchaseOrder,
|
|
1318
|
-
items: [...Z.purchaseOrder.items, V]
|
|
1319
|
-
}
|
|
1320
|
-
};
|
|
1321
|
-
(((le = X.purchaseOrder.supplier) == null ? void 0 : le.internal) === ct.enum.warehouse || ((Q = X.purchaseOrder.supplier) == null ? void 0 : Q.internal) === ct.enum.restaurant) && (X.purchaseOrder.items = X.purchaseOrder.items.map(
|
|
1322
|
-
({ totalCost: ee, ...te }) => te
|
|
1323
|
-
)), await d.updateTemplate(X), await new Promise((ee) => setTimeout(ee, 1e3));
|
|
1324
|
-
}
|
|
1325
|
-
}
|
|
1326
|
-
} catch (H) {
|
|
1327
|
-
b.open({
|
|
1328
|
-
title: t("inventory.transfer.template.update.error"),
|
|
1329
|
-
message: t("inventory.transfer.template.update.errorMessage"),
|
|
1330
|
-
type: "error"
|
|
1331
|
-
}), console.error("Error in updating transfer template", H);
|
|
1332
|
-
}
|
|
1333
|
-
}
|
|
1334
|
-
async function we(w) {
|
|
1335
|
-
try {
|
|
1336
|
-
for (const A of s.value) {
|
|
1337
|
-
const K = await y.getTemplate(A);
|
|
1338
|
-
if (!K) {
|
|
1339
|
-
console.warn(`Wastage Template with ID ${A} not found`);
|
|
1340
|
-
continue;
|
|
1341
|
-
}
|
|
1342
|
-
if (!K.items.find((Q) => Q.id === w._id)) {
|
|
1343
|
-
const Q = {
|
|
1344
|
-
id: w._id,
|
|
1345
|
-
name: w.name,
|
|
1346
|
-
code: w.code,
|
|
1347
|
-
type: "sku",
|
|
1348
|
-
disabledMeasurements: []
|
|
1349
|
-
}, H = {
|
|
1350
|
-
...K,
|
|
1351
|
-
items: [...K.items, Q]
|
|
1352
|
-
};
|
|
1353
|
-
await y.updateTemplate(H), await new Promise((Z) => setTimeout(Z, 1e3));
|
|
1354
|
-
}
|
|
1355
|
-
}
|
|
1356
|
-
} catch (A) {
|
|
1357
|
-
b.open({
|
|
1358
|
-
title: t("inventory.wastage.template.update.error"),
|
|
1359
|
-
message: t("inventory.wastage.template.update.errorMessage"),
|
|
1360
|
-
type: "error"
|
|
1361
|
-
}), console.error("Error in updating wastage template", A);
|
|
1362
|
-
}
|
|
1363
|
-
}
|
|
1364
|
-
function ne() {
|
|
1365
|
-
var w, A;
|
|
1366
|
-
(A = (w = $.value) == null ? void 0 : w.validateInputs) == null || A.call(w);
|
|
1367
|
-
}
|
|
1368
|
-
function me() {
|
|
1369
|
-
switch (o.mode) {
|
|
1370
|
-
case j.READ:
|
|
1371
|
-
return;
|
|
1372
|
-
case j.UPDATE:
|
|
1373
|
-
return G();
|
|
1374
|
-
case j.CREATE:
|
|
1375
|
-
return P();
|
|
1376
|
-
}
|
|
1377
|
-
}
|
|
1378
|
-
function oe(w) {
|
|
1379
|
-
f.value = w;
|
|
1380
|
-
}
|
|
1381
|
-
function pe(w) {
|
|
1382
|
-
s.value = w;
|
|
1383
|
-
}
|
|
1384
|
-
return (w, A) => {
|
|
1385
|
-
const K = I("FmChip"), le = I("FmButton"), Q = I("FmSideSheet");
|
|
1386
|
-
return g(), B(Q, {
|
|
1387
|
-
"model-value": a(u),
|
|
1388
|
-
"onUpdate:modelValue": A[3] || (A[3] = (H) => lt(u) ? u.value = H : null),
|
|
1389
|
-
header: _.value,
|
|
1390
|
-
"close-button": "",
|
|
1391
|
-
"dismiss-away": "",
|
|
1392
|
-
"max-width": 500
|
|
1393
|
-
}, {
|
|
1394
|
-
"side-sheet-footer": x(() => [
|
|
1395
|
-
i("div", fo, [
|
|
1396
|
-
p(le, {
|
|
1397
|
-
loading: U.value,
|
|
1398
|
-
label: N.value,
|
|
1399
|
-
onClick: ne
|
|
1400
|
-
}, null, 8, ["loading", "label"]),
|
|
1401
|
-
p(le, {
|
|
1402
|
-
disabled: U.value,
|
|
1403
|
-
label: a(t)("common.close"),
|
|
1404
|
-
variant: "tertiary",
|
|
1405
|
-
onClick: A[2] || (A[2] = (H) => u.value = !1)
|
|
1406
|
-
}, null, 8, ["disabled", "label"])
|
|
1407
|
-
])
|
|
1408
|
-
]),
|
|
1409
|
-
default: x(() => [
|
|
1410
|
-
i("div", vo, [
|
|
1411
|
-
i("div", null, [
|
|
1412
|
-
m.value ? (g(), B(K, {
|
|
1413
|
-
key: 0,
|
|
1414
|
-
label: "Managed by Netsuite",
|
|
1415
|
-
compact: ""
|
|
1416
|
-
})) : L("", !0)
|
|
1417
|
-
]),
|
|
1418
|
-
p(po, {
|
|
1419
|
-
class: "w-full",
|
|
1420
|
-
ref_key: "hasValidationExpose",
|
|
1421
|
-
ref: $,
|
|
1422
|
-
modelValue: a(c),
|
|
1423
|
-
"onUpdate:modelValue": A[0] || (A[0] = (H) => lt(c) ? c.value = H : null),
|
|
1424
|
-
mode: w.mode,
|
|
1425
|
-
disabled: U.value,
|
|
1426
|
-
purchaseOrderTemplateIds: f.value,
|
|
1427
|
-
wastageTemplateIds: s.value,
|
|
1428
|
-
"onClick:submit": A[1] || (A[1] = (H) => me()),
|
|
1429
|
-
"onUpdate:purchaseOrderTemplateIds": oe,
|
|
1430
|
-
"onUpdate:wastageTemplateIds": pe
|
|
1431
|
-
}, null, 8, ["modelValue", "mode", "disabled", "purchaseOrderTemplateIds", "wastageTemplateIds"])
|
|
1432
|
-
])
|
|
1433
|
-
]),
|
|
1434
|
-
_: 1
|
|
1435
|
-
}, 8, ["model-value", "header"]);
|
|
1436
|
-
};
|
|
1437
|
-
}
|
|
1438
|
-
});
|
|
1439
|
-
function go() {
|
|
1440
|
-
return `sku_${(/* @__PURE__ */ new Date()).toISOString()}_${hn()}`;
|
|
1441
|
-
}
|
|
1442
|
-
const bo = {
|
|
1443
|
-
_id: "",
|
|
1444
|
-
name: "",
|
|
1445
|
-
abbrev: "",
|
|
1446
|
-
precision: 0,
|
|
1447
|
-
measurements: []
|
|
1448
|
-
};
|
|
1449
|
-
function ho(r) {
|
|
1450
|
-
return !r || Object.keys(r).length === 0 ? "" : Object.entries(r).map(([o, v]) => `${o}: ${v}`).join(", ");
|
|
1451
|
-
}
|
|
1452
|
-
function It(r) {
|
|
1453
|
-
if (!r || r.trim() === "")
|
|
1454
|
-
return;
|
|
1455
|
-
const o = {}, v = r.split(",").map((l) => l.trim());
|
|
1456
|
-
for (const l of v) {
|
|
1457
|
-
const d = l.indexOf(":");
|
|
1458
|
-
if (d > 0) {
|
|
1459
|
-
const y = l.substring(0, d).trim(), b = l.substring(d + 1).trim();
|
|
1460
|
-
y && b && (o[y] = b);
|
|
1461
|
-
}
|
|
1462
|
-
}
|
|
1463
|
-
return Object.keys(o).length > 0 ? o : void 0;
|
|
1464
|
-
}
|
|
1465
|
-
function _o(r) {
|
|
1466
|
-
var v, l, d, y, b;
|
|
1467
|
-
return {
|
|
1468
|
-
code: r.code,
|
|
1469
|
-
name: r.name,
|
|
1470
|
-
unit: ((v = r.unit.measurements.find((t) => t.id === r.trackingMeasurement)) == null ? void 0 : v.abbrev) ?? r.unit.abbrev,
|
|
1471
|
-
baseUnit: r.unit.abbrev,
|
|
1472
|
-
valuationMethod: r.valuation ?? "WAVG",
|
|
1473
|
-
pricePerUnit: (l = r.defaultCost) != null && l.costPerUnit ? +xt((d = r.defaultCost) == null ? void 0 : d.costPerUnit) : 0,
|
|
1474
|
-
thresholdLow: ((y = r.thresholds) == null ? void 0 : y.low) ?? Ve().low,
|
|
1475
|
-
thresholdMid: ((b = r.thresholds) == null ? void 0 : b.mid) ?? Ve().mid,
|
|
1476
|
-
customAttributes: ho(r.customAttributes)
|
|
1477
|
-
};
|
|
1478
|
-
}
|
|
1479
|
-
function Ct() {
|
|
1480
|
-
var d;
|
|
1481
|
-
const r = [
|
|
1482
|
-
{
|
|
1483
|
-
id: "code",
|
|
1484
|
-
name: "Code"
|
|
1485
|
-
},
|
|
1486
|
-
{
|
|
1487
|
-
id: "name",
|
|
1488
|
-
name: "Name"
|
|
1489
|
-
},
|
|
1490
|
-
{
|
|
1491
|
-
id: "unit",
|
|
1492
|
-
name: "Unit"
|
|
1493
|
-
},
|
|
1494
|
-
{
|
|
1495
|
-
id: "baseUnit",
|
|
1496
|
-
name: "Base unit"
|
|
1497
|
-
}
|
|
1498
|
-
], o = Vt(), v = Ue(), l = Be(v.currentCountry.value);
|
|
1499
|
-
return o.enableTotalCost && r.push(
|
|
1500
|
-
{
|
|
1501
|
-
id: "valuationMethod",
|
|
1502
|
-
name: "Valuation method"
|
|
1503
|
-
},
|
|
1504
|
-
{
|
|
1505
|
-
id: "pricePerUnit",
|
|
1506
|
-
name: `Price per unit (${l == null ? void 0 : l.currency})`
|
|
1507
|
-
}
|
|
1508
|
-
), ((d = v.currentBusiness.value) == null ? void 0 : d.menuVersion) === "v4" && r.push(
|
|
1509
|
-
{
|
|
1510
|
-
id: "thresholdLow",
|
|
1511
|
-
name: "Show RED when remaining"
|
|
1512
|
-
},
|
|
1513
|
-
{
|
|
1514
|
-
id: "thresholdMid",
|
|
1515
|
-
name: "Show YELLOW when remaining"
|
|
1516
|
-
}
|
|
1517
|
-
), r.push({
|
|
1518
|
-
id: "customAttributes",
|
|
1519
|
-
name: "Custom Attributes"
|
|
1520
|
-
}), r;
|
|
1521
|
-
}
|
|
1522
|
-
function xo() {
|
|
1523
|
-
const o = ce().skus.map(_o), l = Ue().currentBusiness.value, d = Ct(), y = [
|
|
1524
|
-
["Business name:", l == null ? void 0 : l.name],
|
|
1525
|
-
["Business ID:", l == null ? void 0 : l._id],
|
|
1526
|
-
["Menu version", l == null ? void 0 : l.menuVersion],
|
|
1527
|
-
[],
|
|
1528
|
-
d.map((c) => c.name),
|
|
1529
|
-
...o.map((c) => d.map((f) => c[f.id]))
|
|
1530
|
-
], b = d.map((c) => `system:${c.id}`), t = wt(y, b), u = `${l == null ? void 0 : l.name} ingredients (${Gt(/* @__PURE__ */ new Date())}).xlsx`;
|
|
1531
|
-
return St(t, u), u;
|
|
1532
|
-
}
|
|
1533
|
-
function ko() {
|
|
1534
|
-
const o = Ue().currentBusiness.value, v = Ct(), l = [
|
|
1535
|
-
["Business name:", o == null ? void 0 : o.name],
|
|
1536
|
-
["Business ID:", o == null ? void 0 : o._id],
|
|
1537
|
-
["Menu version", o == null ? void 0 : o.menuVersion],
|
|
1538
|
-
[],
|
|
1539
|
-
v.map((t) => t.name)
|
|
1540
|
-
], d = v.map((t) => `system:${t.id}`), y = wt(l, d), b = "FeedMe ingredients template.xlsx";
|
|
1541
|
-
return St(y, b), b;
|
|
1542
|
-
}
|
|
1543
|
-
function Vo(r) {
|
|
1544
|
-
const [
|
|
1545
|
-
o,
|
|
1546
|
-
v,
|
|
1547
|
-
l,
|
|
1548
|
-
d,
|
|
1549
|
-
y,
|
|
1550
|
-
b,
|
|
1551
|
-
...t
|
|
1552
|
-
] = Jt(r);
|
|
1553
|
-
if (!o || !o.length || o.some((m) => m.length && !m.startsWith("system:")))
|
|
1554
|
-
throw new Error("Missing meta header. Excel file does not come from the template.");
|
|
1555
|
-
const u = o.map((m) => m.split(":")[1]), f = ["code", "name", "unit", "baseUnit"].filter((m) => !u.includes(m));
|
|
1556
|
-
if (f.length)
|
|
1557
|
-
throw new Error(
|
|
1558
|
-
`Missing meta headers (${f.join()}). Excel file does not come from the template.`
|
|
1559
|
-
);
|
|
1560
|
-
return t.map((m, _) => {
|
|
1561
|
-
const N = {};
|
|
1562
|
-
for (const $ in u) {
|
|
1563
|
-
const U = u[$];
|
|
1564
|
-
Object.assign(N, { [U]: m[$] });
|
|
1565
|
-
}
|
|
1566
|
-
return {
|
|
1567
|
-
index: _,
|
|
1568
|
-
data: N
|
|
1569
|
-
};
|
|
1570
|
-
});
|
|
1571
|
-
}
|
|
1572
|
-
function ft(r, o, v) {
|
|
1573
|
-
var G;
|
|
1574
|
-
const d = ce().units, y = new Array(), b = v.filter((C) => C.data.code === r.code);
|
|
1575
|
-
b.length > 1 && y.push(
|
|
1576
|
-
`Code ${r.code} is already used in row ${b.map((C) => C.index + 6).join()}.`
|
|
1577
|
-
);
|
|
1578
|
-
const t = d.find((C) => C.abbrev === r.baseUnit), u = t == null ? void 0 : t.measurements.find((C) => C.abbrev === r.unit);
|
|
1579
|
-
if (!t)
|
|
1580
|
-
y.push(`Cannot find base unit of symbol ${r.baseUnit}.`);
|
|
1581
|
-
else if (r.baseUnit !== r.unit && !u) {
|
|
1582
|
-
const C = `Cannot find unit conversion for ${r.baseUnit} with symbol ${r.unit || "[empty]"}.`;
|
|
1583
|
-
y.push(C);
|
|
1584
|
-
}
|
|
1585
|
-
const c = Ee.options.find(
|
|
1586
|
-
(C) => C === r.valuationMethod
|
|
1587
|
-
);
|
|
1588
|
-
r.valuationMethod && !c && y.push(
|
|
1589
|
-
`Expected valuation method to be one of ${Ee.options.join()} but got ${r.valuationMethod} instead.`
|
|
1590
|
-
);
|
|
1591
|
-
const s = Ue().currentCountry.value, m = (C) => `${C}`.length && Qt()(C) === !0, _ = m(`${r.pricePerUnit}`) === !0 ? {
|
|
1592
|
-
costPerUnit: {
|
|
1593
|
-
...kt(Number(r.pricePerUnit) || 0),
|
|
1594
|
-
currency: ((G = Be(s)) == null ? void 0 : G.currency) ?? "MYR"
|
|
1595
|
-
},
|
|
1596
|
-
measurement: u
|
|
1597
|
-
} : void 0, N = m(`${r.thresholdLow}`) && m(`${r.thresholdMid}`) ? {
|
|
1598
|
-
low: Number(r.thresholdLow) || 0,
|
|
1599
|
-
mid: Number(r.thresholdMid) || 0
|
|
1600
|
-
} : void 0, $ = "customAttributes" in r ? It(r.customAttributes) : null;
|
|
1601
|
-
return {
|
|
1602
|
-
type: "create",
|
|
1603
|
-
sku: {
|
|
1604
|
-
_id: go(),
|
|
1605
|
-
code: r.code,
|
|
1606
|
-
name: r.name,
|
|
1607
|
-
unit: t ?? d.find((C) => C) ?? bo,
|
|
1608
|
-
trackingMeasurement: u == null ? void 0 : u.id,
|
|
1609
|
-
valuation: c,
|
|
1610
|
-
defaultCost: _,
|
|
1611
|
-
thresholds: N,
|
|
1612
|
-
...$ !== null && { customAttributes: $ }
|
|
1613
|
-
},
|
|
1614
|
-
errors: y,
|
|
1615
|
-
excelRowNumber: o + 6
|
|
1616
|
-
};
|
|
1617
|
-
}
|
|
1618
|
-
function wo(r) {
|
|
1619
|
-
try {
|
|
1620
|
-
const o = Vo(r).filter((c) => c.data.code), l = ce().skus, d = Kt(l, "code"), y = o.filter((c) => !d[c.data.code]), b = o.filter((c) => d[c.data.code]), t = y.map(
|
|
1621
|
-
(c) => ft(c.data, c.index, o)
|
|
1622
|
-
), u = b.map((c) => {
|
|
1623
|
-
const f = ft(c.data, c.index, o), s = d[c.data.code];
|
|
1624
|
-
let m = s.customAttributes;
|
|
1625
|
-
return "customAttributes" in c.data && (m = It(c.data.customAttributes)), {
|
|
1626
|
-
...f,
|
|
1627
|
-
type: "update",
|
|
1628
|
-
original: s,
|
|
1629
|
-
sku: {
|
|
1630
|
-
// to maintain original props not in the import excel, e.g. inventory binding, etc...
|
|
1631
|
-
...s,
|
|
1632
|
-
code: f.sku.code || s.code,
|
|
1633
|
-
name: f.sku.name || s.name,
|
|
1634
|
-
unit: f.sku.unit || s.unit,
|
|
1635
|
-
trackingMeasurement: f.sku.trackingMeasurement || s.trackingMeasurement,
|
|
1636
|
-
valuation: f.sku.valuation || s.valuation,
|
|
1637
|
-
defaultCost: f.sku.defaultCost || s.defaultCost,
|
|
1638
|
-
thresholds: f.sku.thresholds || s.thresholds,
|
|
1639
|
-
customAttributes: m
|
|
1640
|
-
}
|
|
1641
|
-
};
|
|
1642
|
-
});
|
|
1643
|
-
return {
|
|
1644
|
-
invalidExcel: !1,
|
|
1645
|
-
importCreateResult: t,
|
|
1646
|
-
importUpdateResult: u
|
|
1647
|
-
};
|
|
1648
|
-
} catch (o) {
|
|
1649
|
-
return {
|
|
1650
|
-
invalidExcel: !0,
|
|
1651
|
-
invalidExcelMessage: (o == null ? void 0 : o.message) ?? "Invalid excel",
|
|
1652
|
-
importCreateResult: [],
|
|
1653
|
-
importUpdateResult: []
|
|
1654
|
-
};
|
|
1655
|
-
}
|
|
1656
|
-
}
|
|
1657
|
-
const So = { class: "flex items-center gap-12 pl-8" }, To = { class: "flex flex-col" }, Io = { class: "fm-typo-en-body-md-400 text-fm-color-typo-primary flex items-center gap-4" }, Co = {
|
|
1658
|
-
key: 0,
|
|
1659
|
-
class: "text-fm-color-typo-secondary fm-typo-en-body-sm-400"
|
|
1660
|
-
}, Fo = { key: 0 }, yt = /* @__PURE__ */ ge({
|
|
1661
|
-
__name: "ImportIngredientItem",
|
|
1662
|
-
props: {
|
|
1663
|
-
type: {},
|
|
1664
|
-
code: {},
|
|
1665
|
-
name: {},
|
|
1666
|
-
errors: {}
|
|
1667
|
-
},
|
|
1668
|
-
setup(r) {
|
|
1669
|
-
return (o, v) => {
|
|
1670
|
-
const l = I("FmIcon"), d = I("FmTooltip");
|
|
1671
|
-
return g(), E("div", So, [
|
|
1672
|
-
v[0] || (v[0] = i("div", null, "•", -1)),
|
|
1673
|
-
i("div", To, [
|
|
1674
|
-
i("div", Io, [
|
|
1675
|
-
i("div", {
|
|
1676
|
-
class: ue({
|
|
1677
|
-
"text-fm-color-system-error-300": o.errors.length
|
|
1678
|
-
})
|
|
1679
|
-
}, [
|
|
1680
|
-
We(R(o.name) + " ", 1),
|
|
1681
|
-
o.type === "create" ? (g(), E("span", Co, "(new)")) : L("", !0)
|
|
1682
|
-
], 2),
|
|
1683
|
-
o.errors.length ? (g(), E("div", Fo, [
|
|
1684
|
-
p(d, { "z-index": 50 }, {
|
|
1685
|
-
content: x(() => [
|
|
1686
|
-
i("ol", null, [
|
|
1687
|
-
(g(!0), E(re, null, ye(o.errors, (y, b) => (g(), E("li", { key: b }, R(y), 1))), 128))
|
|
1688
|
-
])
|
|
1689
|
-
]),
|
|
1690
|
-
default: x(() => [
|
|
1691
|
-
p(l, {
|
|
1692
|
-
name: "error",
|
|
1693
|
-
size: "sm",
|
|
1694
|
-
color: "system-error-300"
|
|
1695
|
-
})
|
|
1696
|
-
]),
|
|
1697
|
-
_: 1
|
|
1698
|
-
})
|
|
1699
|
-
])) : L("", !0)
|
|
1700
|
-
]),
|
|
1701
|
-
i("div", {
|
|
1702
|
-
class: ue([
|
|
1703
|
-
"fm-typo-en-body-sm-400",
|
|
1704
|
-
{
|
|
1705
|
-
"text-fm-color-system-error-200": o.errors.length,
|
|
1706
|
-
"text-fm-color-typo-secondary": !o.errors.length
|
|
1707
|
-
}
|
|
1708
|
-
])
|
|
1709
|
-
}, R(o.code), 3)
|
|
1710
|
-
])
|
|
1711
|
-
]);
|
|
1712
|
-
};
|
|
1713
|
-
}
|
|
1714
|
-
}), Mo = { class: "flex flex-col gap-24" }, Eo = { class: "fm-typo-en-body-md-400" }, $o = { class: "flex flex-col gap-8" }, Uo = { class: "line-clamp-2 text-ellipsis break-all" }, Ao = {
|
|
1715
|
-
key: 2,
|
|
1716
|
-
class: "shrink-0"
|
|
1717
|
-
}, Ro = {
|
|
1718
|
-
key: 0,
|
|
1719
|
-
class: "flex flex-col"
|
|
1720
|
-
}, Po = { class: "text-fm-color-system-error-300 fm-typo-en-body-sm-400" }, Oo = {
|
|
1721
|
-
key: 0,
|
|
1722
|
-
class: "max-h-[200px] overflow-y-auto flex flex-col gap-8"
|
|
1723
|
-
}, Bo = { class: "fm-typo-en-body-lg-600" }, Do = /* @__PURE__ */ ge({
|
|
1724
|
-
__name: "ImportIngredients",
|
|
1725
|
-
setup(r) {
|
|
1726
|
-
const o = D(null), v = un(), l = $e(), d = D(!1), y = D(new Array()), b = D([]), t = D([]), u = k(
|
|
1727
|
-
() => !!y.value.length || b.value.some((m) => m.errors.length) || t.value.some((m) => m.errors.length)
|
|
1728
|
-
), c = k(
|
|
1729
|
-
() => !!b.value.length || !!t.value.length
|
|
1730
|
-
), { t: f } = be();
|
|
1731
|
-
async function s(m) {
|
|
1732
|
-
y.value = [], b.value = [], t.value = [];
|
|
1733
|
-
try {
|
|
1734
|
-
d.value = !0;
|
|
1735
|
-
const [_] = await Promise.all([
|
|
1736
|
-
Xt(m),
|
|
1737
|
-
// fake buffer
|
|
1738
|
-
new Promise((U) => setTimeout(U, 1e3))
|
|
1739
|
-
]), N = _.SheetNames.find((U) => U);
|
|
1740
|
-
if (!N) {
|
|
1741
|
-
y.value.push(f("inventory.ingredient.import.fileError.noSheet"));
|
|
1742
|
-
return;
|
|
1743
|
-
}
|
|
1744
|
-
const $ = wo(_.Sheets[N]);
|
|
1745
|
-
if ($.invalidExcel) {
|
|
1746
|
-
y.value.push($.invalidExcelMessage ?? f("inventory.ingredient.import.fileError.invalidExcel"));
|
|
1747
|
-
return;
|
|
1748
|
-
}
|
|
1749
|
-
if (b.value = $.importCreateResult, t.value = $.importUpdateResult, !b.value.length && !t.value.length) {
|
|
1750
|
-
y.value.push(f("inventory.ingredient.import.fileError.noData"));
|
|
1751
|
-
return;
|
|
1752
|
-
}
|
|
1753
|
-
v.emitData($);
|
|
1754
|
-
} catch (_) {
|
|
1755
|
-
l.open({
|
|
1756
|
-
title: f("inventory.ingredient.import.fileError.unableToRead"),
|
|
1757
|
-
message: _ == null ? void 0 : _.message,
|
|
1758
|
-
type: "error"
|
|
1759
|
-
}), console.error("Error in reading file", _);
|
|
1760
|
-
} finally {
|
|
1761
|
-
y.value.length && l.open({
|
|
1762
|
-
title: f("inventory.ingredient.import.fileError.invalidExcel"),
|
|
1763
|
-
type: "error"
|
|
1764
|
-
}), d.value = !1;
|
|
1765
|
-
}
|
|
1766
|
-
}
|
|
1767
|
-
return gt(o, (m) => {
|
|
1768
|
-
m && s(m);
|
|
1769
|
-
}), (m, _) => {
|
|
1770
|
-
const N = I("FmCircularProgress"), $ = I("FmIcon"), U = I("FmButton");
|
|
1771
|
-
return g(), E("div", Mo, [
|
|
1772
|
-
i("div", Eo, R(a(f)("inventory.ingredient.import.uploadDescription")), 1),
|
|
1773
|
-
p(Zt, {
|
|
1774
|
-
class: ue({
|
|
1775
|
-
"w-full": !0,
|
|
1776
|
-
"h-[200px]": !o.value
|
|
1777
|
-
}),
|
|
1778
|
-
accept: ".xlsx",
|
|
1779
|
-
onFileUpload: _[0] || (_[0] = (P) => o.value = P),
|
|
1780
|
-
label: a(f)("inventory.ingredient.import.uploadTemplate"),
|
|
1781
|
-
"button-label": a(f)("inventory.ingredient.import.selectFile")
|
|
1782
|
-
}, bt({ _: 2 }, [
|
|
1783
|
-
o.value ? {
|
|
1784
|
-
name: "default",
|
|
1785
|
-
fn: x(({ openFileDialog: P }) => [
|
|
1786
|
-
i("div", $o, [
|
|
1787
|
-
i("div", {
|
|
1788
|
-
class: ue([
|
|
1789
|
-
"fm-corner-radius-md p-16 flex items-center gap-16",
|
|
1790
|
-
{
|
|
1791
|
-
"border border-fm-color-neutral-gray-100": d.value,
|
|
1792
|
-
"border border-fm-color-neutral-gray-200": !d.value && !u.value,
|
|
1793
|
-
"border border-fm-color-system-error-200": u.value
|
|
1794
|
-
}
|
|
1795
|
-
])
|
|
1796
|
-
}, [
|
|
1797
|
-
d.value ? (g(), B(N, {
|
|
1798
|
-
key: 0,
|
|
1799
|
-
size: "md",
|
|
1800
|
-
color: "neutral-gray-200"
|
|
1801
|
-
})) : (g(), B($, {
|
|
1802
|
-
key: 1,
|
|
1803
|
-
name: u.value ? "error" : "attach_file",
|
|
1804
|
-
outline: "",
|
|
1805
|
-
color: u.value ? "system-error-300" : void 0
|
|
1806
|
-
}, null, 8, ["name", "color"])),
|
|
1807
|
-
i("div", {
|
|
1808
|
-
class: ue([
|
|
1809
|
-
"fm-typo-en-body-md-400 flex-1 h-[36px] flex items-center",
|
|
1810
|
-
{
|
|
1811
|
-
"text-fm-color-typo-disabled": d.value,
|
|
1812
|
-
"text-fm-color-typo-primary": !d.value
|
|
1813
|
-
}
|
|
1814
|
-
])
|
|
1815
|
-
}, [
|
|
1816
|
-
i("div", Uo, R(o.value.name), 1)
|
|
1817
|
-
], 2),
|
|
1818
|
-
d.value ? L("", !0) : (g(), E("div", Ao, [
|
|
1819
|
-
p(U, {
|
|
1820
|
-
label: a(f)("inventory.ingredient.import.replaceFile"),
|
|
1821
|
-
variant: u.value ? "destructive" : "secondary",
|
|
1822
|
-
"prepend-icon": u.value ? void 0 : "autorenew",
|
|
1823
|
-
onClick: P
|
|
1824
|
-
}, null, 8, ["label", "variant", "prepend-icon", "onClick"])
|
|
1825
|
-
]))
|
|
1826
|
-
], 2),
|
|
1827
|
-
y.value.length ? (g(), E("div", Ro, [
|
|
1828
|
-
(g(!0), E(re, null, ye(y.value, (G, C) => (g(), E("div", {
|
|
1829
|
-
key: C,
|
|
1830
|
-
class: "flex gap-8 items-center"
|
|
1831
|
-
}, [
|
|
1832
|
-
p($, {
|
|
1833
|
-
name: "error",
|
|
1834
|
-
size: "sm",
|
|
1835
|
-
color: "system-error-300"
|
|
1836
|
-
}),
|
|
1837
|
-
i("div", Po, R(G), 1)
|
|
1838
|
-
]))), 128))
|
|
1839
|
-
])) : L("", !0)
|
|
1840
|
-
])
|
|
1841
|
-
]),
|
|
1842
|
-
key: "0"
|
|
1843
|
-
} : void 0
|
|
1844
|
-
]), 1032, ["class", "label", "button-label"]),
|
|
1845
|
-
c.value ? (g(), E("div", Oo, [
|
|
1846
|
-
i("div", Bo, R(a(f)("inventory.ingredient.import.summary")), 1),
|
|
1847
|
-
(g(!0), E(re, null, ye(b.value, (P) => (g(), B(yt, {
|
|
1848
|
-
key: P.sku._id,
|
|
1849
|
-
code: P.sku.code,
|
|
1850
|
-
name: P.sku.name,
|
|
1851
|
-
errors: P.errors,
|
|
1852
|
-
type: "create"
|
|
1853
|
-
}, null, 8, ["code", "name", "errors"]))), 128)),
|
|
1854
|
-
(g(!0), E(re, null, ye(t.value, (P) => (g(), B(yt, {
|
|
1855
|
-
key: P.sku._id,
|
|
1856
|
-
code: P.sku.code,
|
|
1857
|
-
name: P.sku.name,
|
|
1858
|
-
errors: P.errors,
|
|
1859
|
-
type: "update"
|
|
1860
|
-
}, null, 8, ["code", "name", "errors"]))), 128))
|
|
1861
|
-
])) : L("", !0)
|
|
1862
|
-
]);
|
|
1863
|
-
};
|
|
1864
|
-
}
|
|
1865
|
-
}), No = {
|
|
1866
|
-
key: 0,
|
|
1867
|
-
class: "flex items-center gap-1"
|
|
1868
|
-
}, zo = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Lo = { class: "flex flex-col py-8" }, jo = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Ho = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, rl = /* @__PURE__ */ ge({
|
|
1869
|
-
__name: "IngredientsView",
|
|
1870
|
-
setup(r) {
|
|
1871
|
-
const o = ce(), v = De(), l = k(() => [
|
|
1872
|
-
{
|
|
1873
|
-
type: "string",
|
|
1874
|
-
key: "skuCode",
|
|
1875
|
-
entity: "sku",
|
|
1876
|
-
values: o.skus.map((V) => V.code)
|
|
1877
|
-
},
|
|
1878
|
-
{
|
|
1879
|
-
type: "string",
|
|
1880
|
-
key: "skuUnitAbbrev",
|
|
1881
|
-
entity: "sku",
|
|
1882
|
-
values: o.units.map((V) => V.abbrev)
|
|
1883
|
-
},
|
|
1884
|
-
{
|
|
1885
|
-
type: "string",
|
|
1886
|
-
key: "status",
|
|
1887
|
-
entity: "sku",
|
|
1888
|
-
values: ["Inactive", "Active"]
|
|
1889
|
-
}
|
|
1890
|
-
]), d = D({
|
|
1891
|
-
logic: "AND",
|
|
1892
|
-
rules: [
|
|
1893
|
-
{
|
|
1894
|
-
property: "status",
|
|
1895
|
-
operator: "$in",
|
|
1896
|
-
value: ["Active"],
|
|
1897
|
-
type: "string"
|
|
1898
|
-
}
|
|
1899
|
-
]
|
|
1900
|
-
}), y = k(
|
|
1901
|
-
() => new Set(v.getAvailableItems(v.businessSubsidiaryId))
|
|
1902
|
-
), b = k(() => {
|
|
1903
|
-
if (!d.value)
|
|
1904
|
-
return o.skus;
|
|
1905
|
-
const F = en.build(d.value);
|
|
1906
|
-
return o.skus.filter((V) => v.isEnabled && ne.value && y.value && !y.value.has(V._id) ? !1 : tn(
|
|
1907
|
-
{
|
|
1908
|
-
skuCode: V.code,
|
|
1909
|
-
skuUnitAbbrev: V.unit.abbrev,
|
|
1910
|
-
status: V.isInactive ? "Inactive" : "Active"
|
|
1911
|
-
},
|
|
1912
|
-
F
|
|
1913
|
-
));
|
|
1914
|
-
}), t = nn(), u = Ye(), c = _n(), f = $e(), { t: s } = be(), { createIngredient: m, updateIngredient: _ } = He(), { ingredientDialogProps: N, ingredientViewLoading: $ } = vn(He()), { columnDefs: U } = xn();
|
|
1915
|
-
function P(F) {
|
|
1916
|
-
switch (F) {
|
|
1917
|
-
case "add":
|
|
1918
|
-
return v.isEnabled ? void 0 : m();
|
|
1919
|
-
case "import":
|
|
1920
|
-
return Z();
|
|
1921
|
-
case "export":
|
|
1922
|
-
return H();
|
|
1923
|
-
}
|
|
1924
|
-
}
|
|
1925
|
-
const G = D(""), C = D(!1), we = k(() => C.value || $.value), ne = D(!0), { breakpoints: me } = dn(), oe = k(() => me.value.xs || me.value.sm), pe = k(() => oe.value ? 10 : 20), w = on(), A = D(!1), K = [
|
|
1926
|
-
{
|
|
1927
|
-
value: "import",
|
|
1928
|
-
label: s("common.import")
|
|
1929
|
-
},
|
|
1930
|
-
{
|
|
1931
|
-
value: "export",
|
|
1932
|
-
label: s("common.export")
|
|
1933
|
-
}
|
|
1934
|
-
];
|
|
1935
|
-
function le(F) {
|
|
1936
|
-
switch (A.value = !1, F) {
|
|
1937
|
-
case "import":
|
|
1938
|
-
return Z();
|
|
1939
|
-
case "export":
|
|
1940
|
-
return H();
|
|
1941
|
-
}
|
|
1942
|
-
}
|
|
1943
|
-
const Q = k(() => [
|
|
1944
|
-
...v.isEnabled ? [] : [
|
|
1945
|
-
{
|
|
1946
|
-
label: s("inventory.ingredient.create.title"),
|
|
1947
|
-
value: "add",
|
|
1948
|
-
isPrimary: !0,
|
|
1949
|
-
prependIcon: "add"
|
|
1950
|
-
}
|
|
1951
|
-
],
|
|
1952
|
-
{ label: s("common.import"), value: "import" },
|
|
1953
|
-
{ label: s("common.export"), value: "export" }
|
|
1954
|
-
]);
|
|
1955
|
-
function H() {
|
|
1956
|
-
const F = xo();
|
|
1957
|
-
f.open({
|
|
1958
|
-
title: s("inventory.ingredient.export.success"),
|
|
1959
|
-
message: s("inventory.ingredient.export.filename", [F]),
|
|
1960
|
-
type: "success"
|
|
1961
|
-
});
|
|
1962
|
-
}
|
|
1963
|
-
function Z() {
|
|
1964
|
-
u.open({
|
|
1965
|
-
title: s("inventory.ingredient.import.title"),
|
|
1966
|
-
contentComponent: Do,
|
|
1967
|
-
overlay: !0,
|
|
1968
|
-
closeButton: !0,
|
|
1969
|
-
primaryActions: {
|
|
1970
|
-
text: s("common.import"),
|
|
1971
|
-
close: !1
|
|
1972
|
-
},
|
|
1973
|
-
secondaryActions: {
|
|
1974
|
-
text: s("common.close"),
|
|
1975
|
-
close: !0
|
|
1976
|
-
},
|
|
1977
|
-
tertiaryActions: {
|
|
1978
|
-
text: s("inventory.ingredient.import.actions.downloadTemplate"),
|
|
1979
|
-
close: !1,
|
|
1980
|
-
variant: "plain"
|
|
1981
|
-
}
|
|
1982
|
-
}).onPrimary((F) => {
|
|
1983
|
-
if (!F) {
|
|
1984
|
-
f.open({
|
|
1985
|
-
title: s("inventory.ingredient.import.error.noData"),
|
|
1986
|
-
type: "error"
|
|
1987
|
-
});
|
|
1988
|
-
return;
|
|
1989
|
-
}
|
|
1990
|
-
if (!F.importCreateResult.length && !F.importUpdateResult.length) {
|
|
1991
|
-
f.open({
|
|
1992
|
-
title: s("inventory.ingredient.import.error.invalidContent"),
|
|
1993
|
-
message: s("inventory.ingredient.import.error.noImportData"),
|
|
1994
|
-
type: "error"
|
|
1995
|
-
});
|
|
1996
|
-
return;
|
|
1997
|
-
}
|
|
1998
|
-
if (F.importCreateResult.some((V) => V.errors.length) || F.importUpdateResult.some((V) => V.errors.length)) {
|
|
1999
|
-
f.open({
|
|
2000
|
-
title: s("inventory.ingredient.import.error.invalidContent"),
|
|
2001
|
-
message: s("inventory.ingredient.import.error.hasErrors"),
|
|
2002
|
-
type: "error"
|
|
2003
|
-
});
|
|
2004
|
-
return;
|
|
2005
|
-
}
|
|
2006
|
-
u.close(), he(F);
|
|
2007
|
-
}).onTertiary(ko);
|
|
2008
|
-
}
|
|
2009
|
-
async function he(F) {
|
|
2010
|
-
C.value = !0;
|
|
2011
|
-
try {
|
|
2012
|
-
const V = [
|
|
2013
|
-
...F.importCreateResult.map(({ sku: M }) => ({ type: "create", sku: M })),
|
|
2014
|
-
...F.importUpdateResult.map(({ sku: M }) => ({ type: "update", sku: M }))
|
|
2015
|
-
], X = 100;
|
|
2016
|
-
let ee = 0;
|
|
2017
|
-
const te = () => {
|
|
2018
|
-
ee += X, f.open({
|
|
2019
|
-
title: s("inventory.ingredient.import.progress", [
|
|
2020
|
-
Math.min(ee, V.length),
|
|
2021
|
-
V.length
|
|
2022
|
-
])
|
|
2023
|
-
});
|
|
2024
|
-
}, ie = new Array();
|
|
2025
|
-
for (const M of V.chunk(100)) {
|
|
2026
|
-
te();
|
|
2027
|
-
try {
|
|
2028
|
-
const W = await o.importSkus({
|
|
2029
|
-
create: M.filter((q) => q.type === "create").map((q) => q.sku),
|
|
2030
|
-
update: M.filter((q) => q.type === "update").map((q) => q.sku)
|
|
2031
|
-
});
|
|
2032
|
-
ie.push(...W.errors);
|
|
2033
|
-
} catch (W) {
|
|
2034
|
-
ie.push(
|
|
2035
|
-
...M.map((q) => {
|
|
2036
|
-
const _e = {
|
|
2037
|
-
module: rn.enum.sku,
|
|
2038
|
-
_id: q.sku._id,
|
|
2039
|
-
name: q.sku.name,
|
|
2040
|
-
message: (W == null ? void 0 : W.stack) ?? W
|
|
2041
|
-
};
|
|
2042
|
-
return {
|
|
2043
|
-
data: q.sku,
|
|
2044
|
-
error: [_e]
|
|
2045
|
-
};
|
|
2046
|
-
})
|
|
2047
|
-
);
|
|
2048
|
-
}
|
|
2049
|
-
}
|
|
2050
|
-
f.open({
|
|
2051
|
-
title: s("inventory.ingredient.import.success"),
|
|
2052
|
-
type: "success"
|
|
2053
|
-
}), ie.length && c.alert(
|
|
2054
|
-
"Some operation failed",
|
|
2055
|
-
Y(
|
|
2056
|
-
"div",
|
|
2057
|
-
{ class: "flex flex-col gap-8" },
|
|
2058
|
-
ie.map(
|
|
2059
|
-
(M) => Y("div", { class: "flex flex-col" }, [
|
|
2060
|
-
Y("div", { class: "fm-typo-en-body-lg-600" }, `(${M.data.code}) ${M.data.name}`),
|
|
2061
|
-
Y(
|
|
2062
|
-
"div",
|
|
2063
|
-
{ class: "fm-typo-en-body-lg-400" },
|
|
2064
|
-
`${M.error.map((W) => (W == null ? void 0 : W.message) ?? "Unknown error").join(", ")}`
|
|
2065
|
-
)
|
|
2066
|
-
])
|
|
2067
|
-
)
|
|
2068
|
-
)
|
|
2069
|
-
);
|
|
2070
|
-
} catch (V) {
|
|
2071
|
-
f.open({
|
|
2072
|
-
title: s("inventory.ingredient.import.error.failed"),
|
|
2073
|
-
message: s("inventory.ingredient.import.error.systemMessage", [V == null ? void 0 : V.message]),
|
|
2074
|
-
type: "error"
|
|
2075
|
-
}), console.error("Error in importing skus", F, V);
|
|
2076
|
-
} finally {
|
|
2077
|
-
C.value = !1;
|
|
2078
|
-
}
|
|
2079
|
-
}
|
|
2080
|
-
return (F, V) => {
|
|
2081
|
-
const X = I("FmSwitch"), ee = I("FmTable"), te = I("FmCollapsibleTabs"), ie = I("FmBottomSheet");
|
|
2082
|
-
return g(), B(ln, {
|
|
2083
|
-
title: a(s)("inventory.ingredient.title"),
|
|
2084
|
-
actions: Q.value,
|
|
2085
|
-
"onClick:action": P
|
|
2086
|
-
}, {
|
|
2087
|
-
default: x(() => [
|
|
2088
|
-
i("div", {
|
|
2089
|
-
class: ue([
|
|
2090
|
-
"flex flex-col gap-8 max-h-full",
|
|
2091
|
-
{
|
|
2092
|
-
"p-0": oe.value,
|
|
2093
|
-
"px-24 ": !oe.value
|
|
2094
|
-
}
|
|
2095
|
-
])
|
|
2096
|
-
}, [
|
|
2097
|
-
p(an, {
|
|
2098
|
-
searchable: "",
|
|
2099
|
-
search: G.value,
|
|
2100
|
-
"onUpdate:search": V[1] || (V[1] = (M) => G.value = M),
|
|
2101
|
-
filterable: "",
|
|
2102
|
-
"filter-attributes": l.value,
|
|
2103
|
-
filter: d.value,
|
|
2104
|
-
"onUpdate:filter": V[2] || (V[2] = (M) => d.value = M)
|
|
2105
|
-
}, {
|
|
2106
|
-
default: x(() => [
|
|
2107
|
-
a(v).isEnabled ? (g(), E("div", No, [
|
|
2108
|
-
i("span", zo, R(a(s)("inventory.integration.netsuite.subsidiaryHierarchy.filtering")), 1),
|
|
2109
|
-
p(yn),
|
|
2110
|
-
p(X, {
|
|
2111
|
-
modelValue: ne.value,
|
|
2112
|
-
"onUpdate:modelValue": V[0] || (V[0] = (M) => ne.value = M)
|
|
2113
|
-
}, null, 8, ["modelValue"])
|
|
2114
|
-
])) : L("", !0)
|
|
2115
|
-
]),
|
|
2116
|
-
_: 1
|
|
2117
|
-
}, 8, ["search", "filter-attributes", "filter"]),
|
|
2118
|
-
(g(), B(ee, {
|
|
2119
|
-
key: JSON.stringify(d.value),
|
|
2120
|
-
style: Bt(a(w).tableHeight),
|
|
2121
|
-
"column-defs": a(U),
|
|
2122
|
-
"row-data": b.value,
|
|
2123
|
-
"search-value": G.value,
|
|
2124
|
-
columnVisibility: {
|
|
2125
|
-
netsuiteSubsidiary: a(v).isEnabled
|
|
2126
|
-
},
|
|
2127
|
-
loading: (!a(t)._currentLocation || we.value) && a(v).isReady,
|
|
2128
|
-
"loading-text": "Loading",
|
|
2129
|
-
onRowClick: V[3] || (V[3] = (M) => a(_)(M.original)),
|
|
2130
|
-
"page-size": pe.value
|
|
2131
|
-
}, {
|
|
2132
|
-
"list-row": x((M) => [
|
|
2133
|
-
p(sn, {
|
|
2134
|
-
row: M,
|
|
2135
|
-
onRowClick: a(_)
|
|
2136
|
-
}, bt({
|
|
2137
|
-
default: x((W) => {
|
|
2138
|
-
var q, _e, Ae, xe, ve, de, Se, Te, fe, Ie;
|
|
2139
|
-
return [
|
|
2140
|
-
i("div", Lo, [
|
|
2141
|
-
i("div", jo, [
|
|
2142
|
-
p(a(mt), {
|
|
2143
|
-
render: (Ae = (_e = (q = W.code) == null ? void 0 : q.column) == null ? void 0 : _e.columnDef) == null ? void 0 : Ae.cell,
|
|
2144
|
-
props: (ve = (xe = W.code) == null ? void 0 : xe.getContext) == null ? void 0 : ve.call(xe)
|
|
2145
|
-
}, null, 8, ["render", "props"])
|
|
2146
|
-
]),
|
|
2147
|
-
i("div", Ho, [
|
|
2148
|
-
p(a(mt), {
|
|
2149
|
-
render: (Te = (Se = (de = W.name) == null ? void 0 : de.column) == null ? void 0 : Se.columnDef) == null ? void 0 : Te.cell,
|
|
2150
|
-
props: (Ie = (fe = W.name) == null ? void 0 : fe.getContext) == null ? void 0 : Ie.call(fe)
|
|
2151
|
-
}, null, 8, ["render", "props"])
|
|
2152
|
-
])
|
|
2153
|
-
])
|
|
2154
|
-
];
|
|
2155
|
-
}),
|
|
2156
|
-
_: 2
|
|
2157
|
-
}, [
|
|
2158
|
-
C.value ? {
|
|
2159
|
-
name: "loading-text",
|
|
2160
|
-
fn: x(() => [
|
|
2161
|
-
i("div", null, R(a(s)("inventory.ingredient.table.importing")), 1)
|
|
2162
|
-
]),
|
|
2163
|
-
key: "0"
|
|
2164
|
-
} : void 0
|
|
2165
|
-
]), 1032, ["row", "onRowClick"])
|
|
2166
|
-
]),
|
|
2167
|
-
_: 1
|
|
2168
|
-
}, 8, ["style", "column-defs", "row-data", "search-value", "columnVisibility", "loading", "page-size"]))
|
|
2169
|
-
], 2),
|
|
2170
|
-
(g(), B(at, { to: "body" }, [
|
|
2171
|
-
p(yo, Dt(Nt(a(N))), null, 16)
|
|
2172
|
-
])),
|
|
2173
|
-
(g(), B(at, { to: "body" }, [
|
|
2174
|
-
p(ie, {
|
|
2175
|
-
"dismiss-away": "",
|
|
2176
|
-
modelValue: A.value,
|
|
2177
|
-
"onUpdate:modelValue": V[5] || (V[5] = (M) => A.value = M)
|
|
2178
|
-
}, {
|
|
2179
|
-
default: x(() => [
|
|
2180
|
-
p(te, {
|
|
2181
|
-
class: "pb-8",
|
|
2182
|
-
items: K,
|
|
2183
|
-
"onUpdate:modelValue": V[4] || (V[4] = (M) => le(M))
|
|
2184
|
-
})
|
|
2185
|
-
]),
|
|
2186
|
-
_: 1
|
|
2187
|
-
}, 8, ["modelValue"])
|
|
2188
|
-
]))
|
|
2189
|
-
]),
|
|
2190
|
-
_: 1
|
|
2191
|
-
}, 8, ["title", "actions"]);
|
|
2192
|
-
};
|
|
2193
|
-
}
|
|
2194
|
-
});
|
|
2195
|
-
export {
|
|
2196
|
-
rl as default
|
|
2197
|
-
};
|