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