@feedmepos/mf-inventory-portal 1.2.7-dev.3 → 1.2.7-dev.5
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-JINYgYlH.js → App-D-KXb_V4.js} +1 -1
- package/dist/{ApprovalView-BOVW2i8o.js → ApprovalView-CsKOxurA.js} +26 -26
- package/dist/{BindingsDialog-BKGLpdd-.js → BindingsDialog-kjERSnxa.js} +2 -2
- package/dist/{BindingsPicker-Tml6Oxod.js → BindingsPicker-EVKOOG5B.js} +1 -1
- package/dist/{BindingsTable-DixFHTyC.js → BindingsTable-B1JqtkAz.js} +1 -1
- package/dist/{ClosingDraftView-nYSugXo0.js → ClosingDraftView-DHMT4v-d.js} +203 -203
- package/dist/{ClosingTemplateView-C-gfh6s5.js → ClosingTemplateView-BOkJvuFp.js} +53 -53
- package/dist/{DeliveryOrderPrintPreview-BM9ZkrEw.js → DeliveryOrderPrintPreview-CPKPeJQI.js} +9 -9
- package/dist/{FmAdminBadge-CiWXN0lw.js → FmAdminBadge-pU1X5Yn4.js} +6 -6
- package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-Dn_c22ms.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-BqmttydS.js} +21 -21
- package/dist/{FmMultiselectDialog-Bvekm8TI.js → FmMultiselectDialog-CwqvhCpx.js} +1 -1
- package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-D62ZdWwZ.js → FmUnitInput.vue_vue_type_script_setup_true_lang-Dbej6KBu.js} +27 -27
- package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-BudJCuVV.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-XjYJ03c6.js} +1 -1
- package/dist/{IngredientGroupView-DTQzZBKp.js → IngredientGroupView-Dj1wbUXi.js} +12 -12
- package/dist/IngredientsView-B7AKdwz5.js +2194 -0
- package/dist/{IntegrationView-CN6amPy_.js → IntegrationView-Dyb-shZZ.js} +84 -84
- package/dist/{InventoryBindingForm-Dl9n2GJn.js → InventoryBindingForm-8Mo0N4ti.js} +1 -1
- package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-4N9XvkmZ.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-3Q8zHn_i.js} +41 -41
- package/dist/{InventoryBindingSummary-eAPN3X_L.js → InventoryBindingSummary-B9-I5Jo_.js} +1 -1
- package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-CSp3zFJ3.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-8vhGMGrt.js} +1 -1
- package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-D2L9cWwt.js → PremiumBadge.vue_vue_type_script_setup_true_lang-B-wDdcG4.js} +5 -5
- package/dist/{PublishView-BzN2wu_M.js → PublishView-BsTvJ-rb.js} +17 -17
- package/dist/{PurchaseOrderPrintPreview-BR40N-ew.js → PurchaseOrderPrintPreview-B4S020Dy.js} +9 -9
- package/dist/{ReceiveRequestView-DtYFO3Wi.js → ReceiveRequestView-BpH2TvAE.js} +80 -80
- package/dist/{RecipeView-DlK-VV0_.js → RecipeView-CnE96AES.js} +49 -49
- package/dist/StockView-DSxsDKW2.js +2101 -0
- package/dist/SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-Bc0fwGq2.js +158 -0
- package/dist/{SupplierView-Cs8-A2B0.js → SupplierView-Cv-FJVM7.js} +1103 -1016
- package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-Dzm9Q3SP.js → TransferDetails.vue_vue_type_script_setup_true_lang-DDnhftMb.js} +6 -6
- package/dist/{TransferTemplateView-DlzKEqem.js → TransferTemplateView-CpguVi60.js} +88 -87
- package/dist/{UnitView-BsYiE8aM.js → UnitView-CbtWqtXO.js} +59 -59
- package/dist/{WarehouseView-DIW3iPB6.js → WarehouseView-JYKSCpwD.js} +25 -25
- package/dist/api/netsuite.d.ts +3 -0
- package/dist/api/purchase-order-template.d.ts +1 -0
- package/dist/{app-Bszzf6y-.js → app-CoQo_jq8.js} +2401 -2294
- package/dist/app.d.ts +57 -0
- package/dist/app.js +3 -3
- package/dist/components/FmInventoryTableToolbar.vue.d.ts +9 -2
- package/dist/components/SubsidiaryTreeDialog.vue.d.ts +2 -0
- package/dist/{decimal-BoNXDQoB.js → decimal-IHcKpXSH.js} +1 -1
- package/dist/{format-unit-display-Dbabkv1O.js → format-unit-display-I8vKcqcG.js} +368 -400
- package/dist/{index-Dk2QEFDL.js → index-C5WsQ8SM.js} +1 -1
- package/dist/{index-DlhdJ3A4.js → index-Dr4zDNEV.js} +1 -1
- package/dist/purchase-order-template-R8t_fJYZ.js +41 -0
- package/dist/{stock-BXV3de2I.js → stock-BRaT53YB.js} +1 -1
- package/dist/stores/integration/netsuite.d.ts +19 -0
- package/dist/{supplier-CKKYVzDf.js → supplier-C6KmsrC2.js} +1 -1
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/{use-ingredient-select-dialog-DEmxBaQb.js → use-ingredient-select-dialog-DkjF8Xtg.js} +5 -5
- package/dist/{use-inventory-binding-dialog-DCN0J-F8.js → use-inventory-binding-dialog-mzDIl-dW.js} +8 -8
- package/dist/views/ingredients/components/ingredient-form/IngredientForm.vue.d.ts +16 -0
- package/dist/views/ingredients/components/ingredient-form/IngredientFormProps.d.ts +4 -0
- package/dist/views/integration/components/netsuite/business/BusinessNetSuiteSideSheet.vue.d.ts +2 -0
- package/dist/views/supplier/components/SupplierSupplyItemField.vue.d.ts +3 -0
- package/package.json +2 -2
- package/dist/IngredientsView-DOUCnkCT.js +0 -1886
- package/dist/StockForecast.vue_vue_type_style_index_0_lang-KLXSWvo5.js +0 -59
- package/dist/StockView-B4acF5it.js +0 -2086
|
@@ -0,0 +1,2194 @@
|
|
|
1
|
+
import { ref as D, h as Y, defineComponent as ge, computed as k, resolveComponent as I, openBlock as b, createBlock as B, withCtx as x, createVNode as p, unref as a, createElementBlock as U, Fragment as re, createElementVNode as i, createCommentVNode as j, 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 L, 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-CoQo_jq8.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-Bc0fwGq2.js";
|
|
8
|
+
import { _ as gn } from "./InventoryBindingForm.vue_vue_type_script_setup_true_lang-3Q8zHn_i.js";
|
|
9
|
+
import { _ as je } from "./IngredientBindedItem.vue_vue_type_script_setup_true_lang-XjYJ03c6.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-R8t_fJYZ.js";
|
|
13
|
+
import { r as hn } from "./random-CSbEbElR.js";
|
|
14
|
+
import "./array-Ca8T3f_G.js";
|
|
15
|
+
import { u as _n } from "./FmMultiselectDialog-CwqvhCpx.js";
|
|
16
|
+
const He = pn("ingredientForm", function() {
|
|
17
|
+
const o = Ye(), v = $e(), l = ce(), d = D(!1), { t: y } = be(), g = D();
|
|
18
|
+
function t() {
|
|
19
|
+
const s = {
|
|
20
|
+
unit: {},
|
|
21
|
+
mode: L.CREATE,
|
|
22
|
+
show: !0,
|
|
23
|
+
"onUpdate:show"(m) {
|
|
24
|
+
g.value.show = m;
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
g.value = s;
|
|
28
|
+
}
|
|
29
|
+
async function u(s) {
|
|
30
|
+
const m = {
|
|
31
|
+
unit: ht(s),
|
|
32
|
+
mode: L.UPDATE,
|
|
33
|
+
show: !0,
|
|
34
|
+
"onUpdate:show"(_) {
|
|
35
|
+
g.value.show = _;
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
g.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: g,
|
|
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: "netsuiteIdSubsidiary",
|
|
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
|
|
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: g } = 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"), E = I("FmSelect"), $ = I("FmCard");
|
|
294
|
+
return b(), B($, {
|
|
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(g)("inventory.ingredient.convertible.title"),
|
|
306
|
+
sublabel: a(g)("inventory.ingredient.convertible.subtitle"),
|
|
307
|
+
labelPlacement: "right",
|
|
308
|
+
disabled: m.readonly
|
|
309
|
+
}, null, 8, ["model-value", "label", "sublabel", "disabled"]),
|
|
310
|
+
t.value ? (b(), U(re, { key: 0 }, [
|
|
311
|
+
i("div", null, [
|
|
312
|
+
p(E, {
|
|
313
|
+
label: a(g)("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)) : j("", !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"), g = I("FmField");
|
|
360
|
+
return o.locked ? (b(), U("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(g, { disabled: o.disabled }, {
|
|
369
|
+
prepend: x(() => [
|
|
370
|
+
o.tooltipMessage ? (b(), 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"])) : (b(), 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(), g = _t(), t = r, u = v, c = ce(), f = Ue(), s = Vt(), m = De(), _ = k(() => m.isEnabled);
|
|
451
|
+
D(void 0);
|
|
452
|
+
const N = D([]), E = D([]), $ = 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 === L.CREATE && C(), s.enableWastageTemplate && t.mode === L.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 = [], $.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
|
+
$.value = !1;
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
async function we() {
|
|
482
|
+
E.value = [], $.value = !0;
|
|
483
|
+
try {
|
|
484
|
+
const [e] = await Promise.all([g.readTemplates()]).delayed(
|
|
485
|
+
1e3
|
|
486
|
+
);
|
|
487
|
+
E.value = e;
|
|
488
|
+
} catch (e) {
|
|
489
|
+
console.log("Something went wrong when fetching wastage templates:", e);
|
|
490
|
+
} finally {
|
|
491
|
+
$.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 === L.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 === L.CREATE && E.value.length > 0 ? E.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 b(), 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
|
+
(b(!0), U(re, null, ye(Q.value, (J, Rt) => (b(), U(re, { key: Rt }, [
|
|
908
|
+
J.displayAsSection ? (b(), U(re, { key: 0 }, [
|
|
909
|
+
p(ae, {
|
|
910
|
+
label: J.label
|
|
911
|
+
}, null, 8, ["label"]),
|
|
912
|
+
p(se)
|
|
913
|
+
], 64)) : (b(), 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 ? (b(), 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"])) : j("", !0),
|
|
962
|
+
a(s).enableTotalCost ? (b(), 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"])) : j("", !0),
|
|
1010
|
+
!_.value || he.value ? (b(), 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"])) : j("", !0),
|
|
1017
|
+
e.mode !== a(L).CREATE ? (b(), U("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
|
+
])) : j("", !0),
|
|
1029
|
+
e.mode !== a(L).CREATE ? (b(), U("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 ? (b(), B(je, {
|
|
1039
|
+
key: 0,
|
|
1040
|
+
name: a(l)("inventory.ingredient.bindedItems.ingredient"),
|
|
1041
|
+
bindings: ie.value
|
|
1042
|
+
}, null, 8, ["name", "bindings"])) : j("", !0),
|
|
1043
|
+
te.value && M.value.length ? (b(), B(je, {
|
|
1044
|
+
key: 1,
|
|
1045
|
+
name: a(l)("inventory.ingredient.bindedItems.recipe"),
|
|
1046
|
+
bindings: M.value
|
|
1047
|
+
}, null, 8, ["name", "bindings"])) : j("", !0),
|
|
1048
|
+
te.value && W.value.length ? (b(), B(je, {
|
|
1049
|
+
key: 2,
|
|
1050
|
+
name: a(l)("inventory.ingredient.bindedItems.menu"),
|
|
1051
|
+
bindings: W.value
|
|
1052
|
+
}, null, 8, ["name", "bindings"])) : j("", !0)
|
|
1053
|
+
])) : j("", !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(L).CREATE ? (b(), U("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 ? (b(), U("div", oo, [
|
|
1170
|
+
i("div", lo, [
|
|
1171
|
+
(b(!0), U(re, null, ye(Te.value, (T) => (b(), B(Ze, {
|
|
1172
|
+
key: T.value,
|
|
1173
|
+
label: T.label,
|
|
1174
|
+
variant: "info",
|
|
1175
|
+
compact: ""
|
|
1176
|
+
}, null, 8, ["label"]))), 128))
|
|
1177
|
+
])
|
|
1178
|
+
])) : j("", !0)
|
|
1179
|
+
])) : j("", !0),
|
|
1180
|
+
a(s).enableWastageTemplate && e.mode === a(L).CREATE ? (b(), U("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 ? (b(), U("div", co, [
|
|
1200
|
+
i("div", mo, [
|
|
1201
|
+
(b(!0), U(re, null, ye(Ie.value, (T) => (b(), B(Ze, {
|
|
1202
|
+
key: T.value,
|
|
1203
|
+
label: T.label,
|
|
1204
|
+
variant: "info",
|
|
1205
|
+
compact: ""
|
|
1206
|
+
}, null, 8, ["label"]))), 128))
|
|
1207
|
+
])
|
|
1208
|
+
])) : j("", !0)
|
|
1209
|
+
])) : j("", !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: L.READ }
|
|
1229
|
+
},
|
|
1230
|
+
emits: ["update:show"],
|
|
1231
|
+
setup(r) {
|
|
1232
|
+
const o = r, v = ce(), l = De(), d = Tt(), y = _t(), g = $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 L.READ:
|
|
1240
|
+
return "";
|
|
1241
|
+
case L.UPDATE:
|
|
1242
|
+
return t("inventory.ingredient.update.title");
|
|
1243
|
+
case L.CREATE:
|
|
1244
|
+
return t("inventory.ingredient.create.title");
|
|
1245
|
+
}
|
|
1246
|
+
return "";
|
|
1247
|
+
}), N = k(() => {
|
|
1248
|
+
switch (o.mode) {
|
|
1249
|
+
case L.READ:
|
|
1250
|
+
return "";
|
|
1251
|
+
case L.UPDATE:
|
|
1252
|
+
return t("common.save");
|
|
1253
|
+
case L.CREATE:
|
|
1254
|
+
return t("common.add");
|
|
1255
|
+
}
|
|
1256
|
+
return "";
|
|
1257
|
+
}), E = D(), $ = D(!1);
|
|
1258
|
+
async function P() {
|
|
1259
|
+
$.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, g.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 || g.open({
|
|
1270
|
+
title: t("inventory.ingredient.create.error.title"),
|
|
1271
|
+
message: t("inventory.ingredient.create.error.message"),
|
|
1272
|
+
type: "error"
|
|
1273
|
+
});
|
|
1274
|
+
} finally {
|
|
1275
|
+
$.value = !1;
|
|
1276
|
+
}
|
|
1277
|
+
}
|
|
1278
|
+
async function G() {
|
|
1279
|
+
$.value = !0;
|
|
1280
|
+
try {
|
|
1281
|
+
await v.updateSku(c.value), $.value = !1, u.value = !1, g.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 || g.open({
|
|
1288
|
+
title: t("inventory.ingredient.update.error.title"),
|
|
1289
|
+
message: t("inventory.ingredient.update.error.message"),
|
|
1290
|
+
type: "error"
|
|
1291
|
+
});
|
|
1292
|
+
} finally {
|
|
1293
|
+
$.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
|
+
g.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
|
+
g.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 = E.value) == null ? void 0 : w.validateInputs) == null || A.call(w);
|
|
1367
|
+
}
|
|
1368
|
+
function me() {
|
|
1369
|
+
switch (o.mode) {
|
|
1370
|
+
case L.READ:
|
|
1371
|
+
return;
|
|
1372
|
+
case L.UPDATE:
|
|
1373
|
+
return G();
|
|
1374
|
+
case L.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 b(), 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: $.value,
|
|
1398
|
+
label: N.value,
|
|
1399
|
+
onClick: ne
|
|
1400
|
+
}, null, 8, ["loading", "label"]),
|
|
1401
|
+
p(le, {
|
|
1402
|
+
disabled: $.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 ? (b(), B(K, {
|
|
1413
|
+
key: 0,
|
|
1414
|
+
label: "Managed by Netsuite",
|
|
1415
|
+
compact: ""
|
|
1416
|
+
})) : j("", !0)
|
|
1417
|
+
]),
|
|
1418
|
+
p(po, {
|
|
1419
|
+
class: "w-full",
|
|
1420
|
+
ref_key: "hasValidationExpose",
|
|
1421
|
+
ref: E,
|
|
1422
|
+
modelValue: a(c),
|
|
1423
|
+
"onUpdate:modelValue": A[0] || (A[0] = (H) => lt(c) ? c.value = H : null),
|
|
1424
|
+
mode: w.mode,
|
|
1425
|
+
disabled: $.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(), g = l.substring(d + 1).trim();
|
|
1460
|
+
y && g && (o[y] = g);
|
|
1461
|
+
}
|
|
1462
|
+
}
|
|
1463
|
+
return Object.keys(o).length > 0 ? o : void 0;
|
|
1464
|
+
}
|
|
1465
|
+
function _o(r) {
|
|
1466
|
+
var v, l, d, y, g;
|
|
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: ((g = r.thresholds) == null ? void 0 : g.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
|
+
], g = d.map((c) => `system:${c.id}`), t = wt(y, g), 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), g = "FeedMe ingredients template.xlsx";
|
|
1541
|
+
return St(y, g), g;
|
|
1542
|
+
}
|
|
1543
|
+
function Vo(r) {
|
|
1544
|
+
const [
|
|
1545
|
+
o,
|
|
1546
|
+
v,
|
|
1547
|
+
l,
|
|
1548
|
+
d,
|
|
1549
|
+
y,
|
|
1550
|
+
g,
|
|
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 E in u) {
|
|
1563
|
+
const $ = u[E];
|
|
1564
|
+
Object.assign(N, { [$]: m[E] });
|
|
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(), g = v.filter((C) => C.data.code === r.code);
|
|
1575
|
+
g.length > 1 && y.push(
|
|
1576
|
+
`Code ${r.code} is already used in row ${g.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, E = "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
|
+
...E !== null && { customAttributes: E }
|
|
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]), g = o.filter((c) => d[c.data.code]), t = y.map(
|
|
1621
|
+
(c) => ft(c.data, c.index, o)
|
|
1622
|
+
), u = g.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 b(), U("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" ? (b(), U("span", Co, "(new)")) : j("", !0)
|
|
1682
|
+
], 2),
|
|
1683
|
+
o.errors.length ? (b(), U("div", Fo, [
|
|
1684
|
+
p(d, { "z-index": 50 }, {
|
|
1685
|
+
content: x(() => [
|
|
1686
|
+
i("ol", null, [
|
|
1687
|
+
(b(!0), U(re, null, ye(o.errors, (y, g) => (b(), U("li", { key: g }, 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
|
+
])) : j("", !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()), g = D([]), t = D([]), u = k(
|
|
1727
|
+
() => !!y.value.length || g.value.some((m) => m.errors.length) || t.value.some((m) => m.errors.length)
|
|
1728
|
+
), c = k(
|
|
1729
|
+
() => !!g.value.length || !!t.value.length
|
|
1730
|
+
), { t: f } = be();
|
|
1731
|
+
async function s(m) {
|
|
1732
|
+
y.value = [], g.value = [], t.value = [];
|
|
1733
|
+
try {
|
|
1734
|
+
d.value = !0;
|
|
1735
|
+
const [_] = await Promise.all([
|
|
1736
|
+
Xt(m),
|
|
1737
|
+
// fake buffer
|
|
1738
|
+
new Promise(($) => setTimeout($, 1e3))
|
|
1739
|
+
]), N = _.SheetNames.find(($) => $);
|
|
1740
|
+
if (!N) {
|
|
1741
|
+
y.value.push(f("inventory.ingredient.import.fileError.noSheet"));
|
|
1742
|
+
return;
|
|
1743
|
+
}
|
|
1744
|
+
const E = wo(_.Sheets[N]);
|
|
1745
|
+
if (E.invalidExcel) {
|
|
1746
|
+
y.value.push(E.invalidExcelMessage ?? f("inventory.ingredient.import.fileError.invalidExcel"));
|
|
1747
|
+
return;
|
|
1748
|
+
}
|
|
1749
|
+
if (g.value = E.importCreateResult, t.value = E.importUpdateResult, !g.value.length && !t.value.length) {
|
|
1750
|
+
y.value.push(f("inventory.ingredient.import.fileError.noData"));
|
|
1751
|
+
return;
|
|
1752
|
+
}
|
|
1753
|
+
v.emitData(E);
|
|
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"), E = I("FmIcon"), $ = I("FmButton");
|
|
1771
|
+
return b(), U("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 ? (b(), B(N, {
|
|
1798
|
+
key: 0,
|
|
1799
|
+
size: "md",
|
|
1800
|
+
color: "neutral-gray-200"
|
|
1801
|
+
})) : (b(), B(E, {
|
|
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 ? j("", !0) : (b(), U("div", Ao, [
|
|
1819
|
+
p($, {
|
|
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 ? (b(), U("div", Ro, [
|
|
1828
|
+
(b(!0), U(re, null, ye(y.value, (G, C) => (b(), U("div", {
|
|
1829
|
+
key: C,
|
|
1830
|
+
class: "flex gap-8 items-center"
|
|
1831
|
+
}, [
|
|
1832
|
+
p(E, {
|
|
1833
|
+
name: "error",
|
|
1834
|
+
size: "sm",
|
|
1835
|
+
color: "system-error-300"
|
|
1836
|
+
}),
|
|
1837
|
+
i("div", Po, R(G), 1)
|
|
1838
|
+
]))), 128))
|
|
1839
|
+
])) : j("", !0)
|
|
1840
|
+
])
|
|
1841
|
+
]),
|
|
1842
|
+
key: "0"
|
|
1843
|
+
} : void 0
|
|
1844
|
+
]), 1032, ["class", "label", "button-label"]),
|
|
1845
|
+
c.value ? (b(), U("div", Oo, [
|
|
1846
|
+
i("div", Bo, R(a(f)("inventory.ingredient.import.summary")), 1),
|
|
1847
|
+
(b(!0), U(re, null, ye(g.value, (P) => (b(), 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
|
+
(b(!0), U(re, null, ye(t.value, (P) => (b(), 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
|
+
])) : j("", !0)
|
|
1862
|
+
]);
|
|
1863
|
+
};
|
|
1864
|
+
}
|
|
1865
|
+
}), No = { class: "flex items-center gap-1" }, 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({
|
|
1866
|
+
__name: "IngredientsView",
|
|
1867
|
+
setup(r) {
|
|
1868
|
+
const o = ce(), v = De(), l = k(() => [
|
|
1869
|
+
{
|
|
1870
|
+
type: "string",
|
|
1871
|
+
key: "skuCode",
|
|
1872
|
+
entity: "sku",
|
|
1873
|
+
values: o.skus.map((V) => V.code)
|
|
1874
|
+
},
|
|
1875
|
+
{
|
|
1876
|
+
type: "string",
|
|
1877
|
+
key: "skuUnitAbbrev",
|
|
1878
|
+
entity: "sku",
|
|
1879
|
+
values: o.units.map((V) => V.abbrev)
|
|
1880
|
+
},
|
|
1881
|
+
{
|
|
1882
|
+
type: "string",
|
|
1883
|
+
key: "status",
|
|
1884
|
+
entity: "sku",
|
|
1885
|
+
values: ["Inactive", "Active"]
|
|
1886
|
+
}
|
|
1887
|
+
]), d = D({
|
|
1888
|
+
logic: "AND",
|
|
1889
|
+
rules: [
|
|
1890
|
+
{
|
|
1891
|
+
property: "status",
|
|
1892
|
+
operator: "$in",
|
|
1893
|
+
value: ["Active"],
|
|
1894
|
+
type: "string"
|
|
1895
|
+
}
|
|
1896
|
+
]
|
|
1897
|
+
}), y = k(
|
|
1898
|
+
() => new Set(v.getAvailableItems(v.businessSubsidiaryId))
|
|
1899
|
+
), g = k(() => {
|
|
1900
|
+
if (!d.value)
|
|
1901
|
+
return o.skus;
|
|
1902
|
+
const F = en.build(d.value);
|
|
1903
|
+
return o.skus.filter((V) => ne.value && y.value && !y.value.has(V._id) ? !1 : tn(
|
|
1904
|
+
{
|
|
1905
|
+
skuCode: V.code,
|
|
1906
|
+
skuUnitAbbrev: V.unit.abbrev,
|
|
1907
|
+
status: V.isInactive ? "Inactive" : "Active"
|
|
1908
|
+
},
|
|
1909
|
+
F
|
|
1910
|
+
));
|
|
1911
|
+
}), t = nn(), u = Ye(), c = _n(), f = $e(), { t: s } = be(), { createIngredient: m, updateIngredient: _ } = He(), { ingredientDialogProps: N, ingredientViewLoading: E } = vn(He()), { columnDefs: $ } = xn();
|
|
1912
|
+
function P(F) {
|
|
1913
|
+
switch (F) {
|
|
1914
|
+
case "add":
|
|
1915
|
+
return v.isEnabled ? void 0 : m();
|
|
1916
|
+
case "import":
|
|
1917
|
+
return Z();
|
|
1918
|
+
case "export":
|
|
1919
|
+
return H();
|
|
1920
|
+
}
|
|
1921
|
+
}
|
|
1922
|
+
const G = D(""), C = D(!1), we = k(() => C.value || E.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 = [
|
|
1923
|
+
{
|
|
1924
|
+
value: "import",
|
|
1925
|
+
label: s("common.import")
|
|
1926
|
+
},
|
|
1927
|
+
{
|
|
1928
|
+
value: "export",
|
|
1929
|
+
label: s("common.export")
|
|
1930
|
+
}
|
|
1931
|
+
];
|
|
1932
|
+
function le(F) {
|
|
1933
|
+
switch (A.value = !1, F) {
|
|
1934
|
+
case "import":
|
|
1935
|
+
return Z();
|
|
1936
|
+
case "export":
|
|
1937
|
+
return H();
|
|
1938
|
+
}
|
|
1939
|
+
}
|
|
1940
|
+
const Q = k(() => [
|
|
1941
|
+
...v.isEnabled ? [] : [
|
|
1942
|
+
{
|
|
1943
|
+
label: s("inventory.ingredient.create.title"),
|
|
1944
|
+
value: "add",
|
|
1945
|
+
isPrimary: !0,
|
|
1946
|
+
prependIcon: "add"
|
|
1947
|
+
}
|
|
1948
|
+
],
|
|
1949
|
+
{ label: s("common.import"), value: "import" },
|
|
1950
|
+
{ label: s("common.export"), value: "export" }
|
|
1951
|
+
]);
|
|
1952
|
+
function H() {
|
|
1953
|
+
const F = xo();
|
|
1954
|
+
f.open({
|
|
1955
|
+
title: s("inventory.ingredient.export.success"),
|
|
1956
|
+
message: s("inventory.ingredient.export.filename", [F]),
|
|
1957
|
+
type: "success"
|
|
1958
|
+
});
|
|
1959
|
+
}
|
|
1960
|
+
function Z() {
|
|
1961
|
+
u.open({
|
|
1962
|
+
title: s("inventory.ingredient.import.title"),
|
|
1963
|
+
contentComponent: Do,
|
|
1964
|
+
overlay: !0,
|
|
1965
|
+
closeButton: !0,
|
|
1966
|
+
primaryActions: {
|
|
1967
|
+
text: s("common.import"),
|
|
1968
|
+
close: !1
|
|
1969
|
+
},
|
|
1970
|
+
secondaryActions: {
|
|
1971
|
+
text: s("common.close"),
|
|
1972
|
+
close: !0
|
|
1973
|
+
},
|
|
1974
|
+
tertiaryActions: {
|
|
1975
|
+
text: s("inventory.ingredient.import.actions.downloadTemplate"),
|
|
1976
|
+
close: !1,
|
|
1977
|
+
variant: "plain"
|
|
1978
|
+
}
|
|
1979
|
+
}).onPrimary((F) => {
|
|
1980
|
+
if (!F) {
|
|
1981
|
+
f.open({
|
|
1982
|
+
title: s("inventory.ingredient.import.error.noData"),
|
|
1983
|
+
type: "error"
|
|
1984
|
+
});
|
|
1985
|
+
return;
|
|
1986
|
+
}
|
|
1987
|
+
if (!F.importCreateResult.length && !F.importUpdateResult.length) {
|
|
1988
|
+
f.open({
|
|
1989
|
+
title: s("inventory.ingredient.import.error.invalidContent"),
|
|
1990
|
+
message: s("inventory.ingredient.import.error.noImportData"),
|
|
1991
|
+
type: "error"
|
|
1992
|
+
});
|
|
1993
|
+
return;
|
|
1994
|
+
}
|
|
1995
|
+
if (F.importCreateResult.some((V) => V.errors.length) || F.importUpdateResult.some((V) => V.errors.length)) {
|
|
1996
|
+
f.open({
|
|
1997
|
+
title: s("inventory.ingredient.import.error.invalidContent"),
|
|
1998
|
+
message: s("inventory.ingredient.import.error.hasErrors"),
|
|
1999
|
+
type: "error"
|
|
2000
|
+
});
|
|
2001
|
+
return;
|
|
2002
|
+
}
|
|
2003
|
+
u.close(), he(F);
|
|
2004
|
+
}).onTertiary(ko);
|
|
2005
|
+
}
|
|
2006
|
+
async function he(F) {
|
|
2007
|
+
C.value = !0;
|
|
2008
|
+
try {
|
|
2009
|
+
const V = [
|
|
2010
|
+
...F.importCreateResult.map(({ sku: M }) => ({ type: "create", sku: M })),
|
|
2011
|
+
...F.importUpdateResult.map(({ sku: M }) => ({ type: "update", sku: M }))
|
|
2012
|
+
], X = 100;
|
|
2013
|
+
let ee = 0;
|
|
2014
|
+
const te = () => {
|
|
2015
|
+
ee += X, f.open({
|
|
2016
|
+
title: s("inventory.ingredient.import.progress", [
|
|
2017
|
+
Math.min(ee, V.length),
|
|
2018
|
+
V.length
|
|
2019
|
+
])
|
|
2020
|
+
});
|
|
2021
|
+
}, ie = new Array();
|
|
2022
|
+
for (const M of V.chunk(100)) {
|
|
2023
|
+
te();
|
|
2024
|
+
try {
|
|
2025
|
+
const W = await o.importSkus({
|
|
2026
|
+
create: M.filter((q) => q.type === "create").map((q) => q.sku),
|
|
2027
|
+
update: M.filter((q) => q.type === "update").map((q) => q.sku)
|
|
2028
|
+
});
|
|
2029
|
+
ie.push(...W.errors);
|
|
2030
|
+
} catch (W) {
|
|
2031
|
+
ie.push(
|
|
2032
|
+
...M.map((q) => {
|
|
2033
|
+
const _e = {
|
|
2034
|
+
module: rn.enum.sku,
|
|
2035
|
+
_id: q.sku._id,
|
|
2036
|
+
name: q.sku.name,
|
|
2037
|
+
message: (W == null ? void 0 : W.stack) ?? W
|
|
2038
|
+
};
|
|
2039
|
+
return {
|
|
2040
|
+
data: q.sku,
|
|
2041
|
+
error: [_e]
|
|
2042
|
+
};
|
|
2043
|
+
})
|
|
2044
|
+
);
|
|
2045
|
+
}
|
|
2046
|
+
}
|
|
2047
|
+
f.open({
|
|
2048
|
+
title: s("inventory.ingredient.import.success"),
|
|
2049
|
+
type: "success"
|
|
2050
|
+
}), ie.length && c.alert(
|
|
2051
|
+
"Some operation failed",
|
|
2052
|
+
Y(
|
|
2053
|
+
"div",
|
|
2054
|
+
{ class: "flex flex-col gap-8" },
|
|
2055
|
+
ie.map(
|
|
2056
|
+
(M) => Y("div", { class: "flex flex-col" }, [
|
|
2057
|
+
Y("div", { class: "fm-typo-en-body-lg-600" }, `(${M.data.code}) ${M.data.name}`),
|
|
2058
|
+
Y(
|
|
2059
|
+
"div",
|
|
2060
|
+
{ class: "fm-typo-en-body-lg-400" },
|
|
2061
|
+
`${M.error.map((W) => (W == null ? void 0 : W.message) ?? "Unknown error").join(", ")}`
|
|
2062
|
+
)
|
|
2063
|
+
])
|
|
2064
|
+
)
|
|
2065
|
+
)
|
|
2066
|
+
);
|
|
2067
|
+
} catch (V) {
|
|
2068
|
+
f.open({
|
|
2069
|
+
title: s("inventory.ingredient.import.error.failed"),
|
|
2070
|
+
message: s("inventory.ingredient.import.error.systemMessage", [V == null ? void 0 : V.message]),
|
|
2071
|
+
type: "error"
|
|
2072
|
+
}), console.error("Error in importing skus", F, V);
|
|
2073
|
+
} finally {
|
|
2074
|
+
C.value = !1;
|
|
2075
|
+
}
|
|
2076
|
+
}
|
|
2077
|
+
return (F, V) => {
|
|
2078
|
+
const X = I("FmSwitch"), ee = I("FmTable"), te = I("FmCollapsibleTabs"), ie = I("FmBottomSheet");
|
|
2079
|
+
return b(), B(ln, {
|
|
2080
|
+
title: a(s)("inventory.ingredient.title"),
|
|
2081
|
+
actions: Q.value,
|
|
2082
|
+
"onClick:action": P
|
|
2083
|
+
}, {
|
|
2084
|
+
default: x(() => [
|
|
2085
|
+
i("div", {
|
|
2086
|
+
class: ue([
|
|
2087
|
+
"flex flex-col gap-8 max-h-full",
|
|
2088
|
+
{
|
|
2089
|
+
"p-0": oe.value,
|
|
2090
|
+
"px-24 ": !oe.value
|
|
2091
|
+
}
|
|
2092
|
+
])
|
|
2093
|
+
}, [
|
|
2094
|
+
p(an, {
|
|
2095
|
+
searchable: "",
|
|
2096
|
+
search: G.value,
|
|
2097
|
+
"onUpdate:search": V[1] || (V[1] = (M) => G.value = M),
|
|
2098
|
+
filterable: "",
|
|
2099
|
+
"filter-attributes": l.value,
|
|
2100
|
+
filter: d.value,
|
|
2101
|
+
"onUpdate:filter": V[2] || (V[2] = (M) => d.value = M)
|
|
2102
|
+
}, {
|
|
2103
|
+
default: x(() => [
|
|
2104
|
+
i("div", No, [
|
|
2105
|
+
i("span", zo, R(a(s)("inventory.integration.netsuite.subsidiaryHierarchy.filtering")), 1),
|
|
2106
|
+
p(yn),
|
|
2107
|
+
p(X, {
|
|
2108
|
+
modelValue: ne.value,
|
|
2109
|
+
"onUpdate:modelValue": V[0] || (V[0] = (M) => ne.value = M)
|
|
2110
|
+
}, null, 8, ["modelValue"])
|
|
2111
|
+
])
|
|
2112
|
+
]),
|
|
2113
|
+
_: 1
|
|
2114
|
+
}, 8, ["search", "filter-attributes", "filter"]),
|
|
2115
|
+
(b(), B(ee, {
|
|
2116
|
+
key: JSON.stringify(d.value),
|
|
2117
|
+
style: Bt(a(w).tableHeight),
|
|
2118
|
+
"column-defs": a($),
|
|
2119
|
+
"row-data": g.value,
|
|
2120
|
+
"search-value": G.value,
|
|
2121
|
+
columnVisibility: {
|
|
2122
|
+
netsuiteSubsidiary: a(v).isEnabled
|
|
2123
|
+
},
|
|
2124
|
+
loading: (!a(t)._currentLocation || we.value) && a(v).isReady,
|
|
2125
|
+
"loading-text": "Loading",
|
|
2126
|
+
onRowClick: V[3] || (V[3] = (M) => a(_)(M.original)),
|
|
2127
|
+
"page-size": pe.value
|
|
2128
|
+
}, {
|
|
2129
|
+
"list-row": x((M) => [
|
|
2130
|
+
p(sn, {
|
|
2131
|
+
row: M,
|
|
2132
|
+
onRowClick: a(_)
|
|
2133
|
+
}, bt({
|
|
2134
|
+
default: x((W) => {
|
|
2135
|
+
var q, _e, Ae, xe, ve, de, Se, Te, fe, Ie;
|
|
2136
|
+
return [
|
|
2137
|
+
i("div", Lo, [
|
|
2138
|
+
i("div", jo, [
|
|
2139
|
+
p(a(mt), {
|
|
2140
|
+
render: (Ae = (_e = (q = W.code) == null ? void 0 : q.column) == null ? void 0 : _e.columnDef) == null ? void 0 : Ae.cell,
|
|
2141
|
+
props: (ve = (xe = W.code) == null ? void 0 : xe.getContext) == null ? void 0 : ve.call(xe)
|
|
2142
|
+
}, null, 8, ["render", "props"])
|
|
2143
|
+
]),
|
|
2144
|
+
i("div", Ho, [
|
|
2145
|
+
p(a(mt), {
|
|
2146
|
+
render: (Te = (Se = (de = W.name) == null ? void 0 : de.column) == null ? void 0 : Se.columnDef) == null ? void 0 : Te.cell,
|
|
2147
|
+
props: (Ie = (fe = W.name) == null ? void 0 : fe.getContext) == null ? void 0 : Ie.call(fe)
|
|
2148
|
+
}, null, 8, ["render", "props"])
|
|
2149
|
+
])
|
|
2150
|
+
])
|
|
2151
|
+
];
|
|
2152
|
+
}),
|
|
2153
|
+
_: 2
|
|
2154
|
+
}, [
|
|
2155
|
+
C.value ? {
|
|
2156
|
+
name: "loading-text",
|
|
2157
|
+
fn: x(() => [
|
|
2158
|
+
i("div", null, R(a(s)("inventory.ingredient.table.importing")), 1)
|
|
2159
|
+
]),
|
|
2160
|
+
key: "0"
|
|
2161
|
+
} : void 0
|
|
2162
|
+
]), 1032, ["row", "onRowClick"])
|
|
2163
|
+
]),
|
|
2164
|
+
_: 1
|
|
2165
|
+
}, 8, ["style", "column-defs", "row-data", "search-value", "columnVisibility", "loading", "page-size"]))
|
|
2166
|
+
], 2),
|
|
2167
|
+
(b(), B(at, { to: "body" }, [
|
|
2168
|
+
p(yo, Dt(Nt(a(N))), null, 16)
|
|
2169
|
+
])),
|
|
2170
|
+
(b(), B(at, { to: "body" }, [
|
|
2171
|
+
p(ie, {
|
|
2172
|
+
"dismiss-away": "",
|
|
2173
|
+
modelValue: A.value,
|
|
2174
|
+
"onUpdate:modelValue": V[5] || (V[5] = (M) => A.value = M)
|
|
2175
|
+
}, {
|
|
2176
|
+
default: x(() => [
|
|
2177
|
+
p(te, {
|
|
2178
|
+
class: "pb-8",
|
|
2179
|
+
items: K,
|
|
2180
|
+
"onUpdate:modelValue": V[4] || (V[4] = (M) => le(M))
|
|
2181
|
+
})
|
|
2182
|
+
]),
|
|
2183
|
+
_: 1
|
|
2184
|
+
}, 8, ["modelValue"])
|
|
2185
|
+
]))
|
|
2186
|
+
]),
|
|
2187
|
+
_: 1
|
|
2188
|
+
}, 8, ["title", "actions"]);
|
|
2189
|
+
};
|
|
2190
|
+
}
|
|
2191
|
+
});
|
|
2192
|
+
export {
|
|
2193
|
+
rl as default
|
|
2194
|
+
};
|