@feedmepos/mf-inventory-portal 0.0.23-dev.31 → 0.0.23-dev.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{App-CEmWJ9lp.js → App-FsTwD8n6.js} +73 -85
- package/dist/{ApprovalView-jDll4AVe.js → ApprovalView-BXPFwc54.js} +27 -24
- package/dist/{BindingsDialog-BC_gRSif.js → BindingsDialog-CHkMKliu.js} +4 -4
- package/dist/{BindingsPicker-BJsGoBzM.js → BindingsPicker-D12ragAp.js} +9 -8
- package/dist/{BindingsTable-DSdwNK_q.js → BindingsTable-COag_o6k.js} +22 -18
- package/dist/{ClosingTemplateView-BzG16gl5.js → ClosingTemplateView-D8jKBDLt.js} +286 -272
- package/dist/FmDroppableField-8RzKjEdL.js +154 -0
- package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-DW2IOPST.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-BQtdWZI5.js} +23 -22
- package/dist/FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-RNrM3eSt.js +436 -0
- package/dist/FmMultiselectDialog-BQVgChfN.js +415 -0
- package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-DDuZEf_v.js → FmUnitInput.vue_vue_type_script_setup_true_lang-DECE_vKa.js} +49 -48
- package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-CiNvnaaE.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-BUy5XAra.js} +5 -5
- package/dist/{IngredientGroupView-DL8eBhkk.js → IngredientGroupView-C5W6TKVb.js} +69 -63
- package/dist/{IngredientsView-B_HC9fgq.js → IngredientsView-DS18EGAg.js} +253 -245
- package/dist/{IntegrationView-BeFT5S24.js → IntegrationView-BCXq5C_i.js} +95 -92
- package/dist/{InventoryBindingForm-DJ3uwq_X.js → InventoryBindingForm-D2oUHybU.js} +1 -1
- package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-DIviTipZ.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-Do_WCGzA.js} +27 -25
- package/dist/{InventoryBindingSummary-CvB5j9xq.js → InventoryBindingSummary-CTzl--8n.js} +1 -1
- package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-CQPdnXEF.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-CrdZrQaL.js} +1 -1
- package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-BdscwUGn.js → PremiumBadge.vue_vue_type_script_setup_true_lang-Ce01_vRB.js} +24 -23
- package/dist/{PurchaseOrderPrintPreview-3_6nBajH.js → PurchaseOrderPrintPreview-C_cUNqE4.js} +14 -13
- package/dist/{ReceiveRequestView-B_0UldQ7.js → ReceiveRequestView-iKUSCnjc.js} +1302 -1325
- package/dist/{RecipeView-D9p0Ou_I.js → RecipeView-9jSzsC2o.js} +85 -79
- package/dist/{StockView-TIdUgG3O.js → StockView-CkLx8c-q.js} +1446 -1338
- package/dist/{SupplierView-B1b9Otcr.js → SupplierView-zo_pVaja.js} +809 -2345
- package/dist/TableActionableRow.vue_vue_type_script_setup_true_lang-DlNJ6kRg.js +135 -0
- package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-DVkVNrNG.js +1209 -0
- package/dist/TransferTemplateView-CkJs2zmu.js +1261 -0
- package/dist/{UnitView-BrpzJ7D3.js → UnitView-DdUCn3QX.js} +44 -40
- package/dist/{WarehouseView-CjbdEy8o.js → WarehouseView-BSKKIUlu.js} +100 -94
- package/dist/_plugin-vue_export-helper-CHgC5LLL.js +9 -0
- package/dist/api/closing.d.ts +0 -1
- package/dist/api/netsuite.d.ts +3 -3
- package/dist/app-CVmmRPWd.js +33496 -0
- package/dist/app.d.ts +0 -56
- package/dist/app.js +2 -2
- package/dist/components/FmMultiselectDialogProps.d.ts +0 -1
- package/dist/components/row-action.enum.d.ts +0 -1
- package/dist/composable/defineDeepModel.d.ts +1 -1
- package/dist/date2-B8or025L.js +117 -0
- package/dist/dayjs.min-CIK0S4n6.js +282 -0
- package/dist/{decimal-DHYZglKx.js → decimal-DnON7sYp.js} +1 -1
- package/dist/defineDeepModel-ZvHrR7G4.js +13 -0
- package/dist/{feature-G-NnqKcY.js → feature-CfLuWtSb.js} +1 -1
- package/dist/format-time-from-id-DgZIvkJL.js +15 -0
- package/dist/{format-unit-display-BWqJsV_R.js → format-unit-display-BL51mLWH.js} +171 -162
- package/dist/fuzzy-BrZpb26S.js +41 -0
- package/dist/index-20AY5LL4.js +10545 -0
- package/dist/index-BHBzUsyp.js +45 -0
- package/dist/index-Cgi2fvdH.js +22283 -0
- package/dist/netsuite-C6f_DtMT.js +224 -0
- package/dist/normalizeArguments-DP7Hrren.js +1552 -0
- package/dist/router/name.d.ts +0 -2
- package/dist/row-action.enum-PMKMRrZR.js +50 -0
- package/dist/rules-CyLD3MFT.js +199 -0
- package/dist/stores/integration/netsuite.d.ts +2 -3
- package/dist/stores/inventory.d.ts +4 -1
- package/dist/style.css +1 -1
- package/dist/{supplier-DTUUR48O.js → supplier-pYrSAyO6.js} +15 -15
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/{use-inventory-binding-dialog-DvC_i-Ih.js → use-inventory-binding-dialog-BRfRiwVk.js} +11 -10
- package/dist/use-template-enabled-locations-2-BFm4_EuV.js +86 -0
- package/dist/views/closing-template/composables/use-closing-template-actions.d.ts +192 -24
- package/dist/views/closing-template/composables/use-closing-template-table.d.ts +193 -25
- package/dist/views/receive-request/components/transfer-form/NetSuiteField.vue.d.ts +0 -2
- package/dist/views/receive-request/components/transfer-form/TransferForm.vue.d.ts +0 -6
- package/dist/views/receive-request/composables/use-receive-request-form.d.ts +0 -9
- package/dist/views/receive-request/composables/use-receive-request-table.d.ts +0 -9
- package/dist/views/stock/components/dialog/AdjustedItemForm.vue.d.ts +2 -2
- package/dist/views/stock/helper/compute-summary-total.d.ts +2 -2
- package/dist/xlsx-BFsAkixf.js +24004 -0
- package/dist/xlsx.util-ClkX4qFH.js +78 -0
- package/package.json +1 -1
- package/dist/ClosingDraftView-UfWdRXb-.js +0 -1190
- package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-jUYB4L8Y.js +0 -1275
- package/dist/TransferTemplateView-Dxk5b-2j.js +0 -1264
- package/dist/api/adjustment-template.d.ts +0 -23
- package/dist/api/closing-draft.d.ts +0 -6
- package/dist/app-AcMtTQ07.js +0 -84202
- package/dist/index-Bt8vaUdT.js +0 -12087
- package/dist/stock-VZXyPw2C.js +0 -125
- package/dist/views/adjustment-template/import/AdjustmentTemplateImport.vue.d.ts +0 -2
- package/dist/views/adjustment-template/import/AdjustmentTemplateImportItem.vue.d.ts +0 -18
- package/dist/views/adjustment-template/import/export.d.ts +0 -60
- package/dist/views/adjustment-template/wastage-template/WastageTemplateDetails.vue.d.ts +0 -2
- package/dist/views/adjustment-template/wastage-template/WastageTemplateDialog.vue.d.ts +0 -22
- package/dist/views/adjustment-template/wastage-template/WastageTemplatePublish.vue.d.ts +0 -6
- package/dist/views/adjustment-template/wastage-template/WastageTemplateView.vue.d.ts +0 -2
- package/dist/views/adjustment-template/wastage-template/actions.d.ts +0 -1295
- package/dist/views/adjustment-template/wastage-template/form/WastageTemplateForm.vue.d.ts +0 -16
- package/dist/views/adjustment-template/wastage-template/form/WastageTemplateItemTable.vue.d.ts +0 -35
- package/dist/views/adjustment-template/wastage-template/form/useAdjustmentTemplateItems.d.ts +0 -20
- package/dist/views/adjustment-template/wastage-template/props.d.ts +0 -29
- package/dist/views/adjustment-template/wastage-template/table.d.ts +0 -1273
- package/dist/views/closing-draft/ClosingDraftView.vue.d.ts +0 -2
- package/dist/views/closing-draft/components/closing-draft-action/ClosingDraftAction.vue.d.ts +0 -22
- package/dist/views/closing-draft/components/closing-draft-dialog/ClosingDraftDialog.vue.d.ts +0 -621
- package/dist/views/closing-draft/composables/use-closing-draft-actions.d.ts +0 -25
- package/dist/views/closing-draft/composables/use-closing-draft-table.d.ts +0 -3621
- package/dist/views/closing-draft/helpers/draft-status-to-class-name.helper.d.ts +0 -1
- package/dist/views/closing-draft/helpers/export-draft.helper.d.ts +0 -19
- package/dist/views/closing-draft/helpers/get-calculated-total.helper.d.ts +0 -4
- package/dist/views/receive-request/components/netsuite/NetSuiteInfo.vue.d.ts +0 -12
- package/dist/views/receive-request/components/netsuite/NetSuiteProps.d.ts +0 -13
- package/dist/views/receive-request/components/netsuite/NetSuiteSync.vue.d.ts +0 -12
|
@@ -1,17 +1,25 @@
|
|
|
1
|
-
import { ref as
|
|
2
|
-
import { a as
|
|
3
|
-
import { useDialog as
|
|
4
|
-
import { i as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { _ as
|
|
9
|
-
import { _ as
|
|
10
|
-
import {
|
|
1
|
+
import { ref as G, defineComponent as me, computed as V, resolveComponent as $, openBlock as v, createBlock as A, withCtx as S, createVNode as f, unref as d, createElementBlock as R, Fragment as J, createElementVNode as u, createCommentVNode as H, onMounted as nt, watch as ze, normalizeClass as le, createTextVNode as He, toDisplayString as N, renderList as te, isRef as Ee, createSlots as Oe, normalizeStyle as ot, Teleport as Re, normalizeProps as lt, guardReactiveProps as rt } from "vue";
|
|
2
|
+
import { a as re, c as je, S as at, d as he, e as ve, f as Ae, C as xe, h as De, i as st, u as it } from "./app-CVmmRPWd.js";
|
|
3
|
+
import { useDialog as Ye, useSnackbar as _e, useProxiedModel as Te, useDialogChild as ut, useBreakpoints as dt } from "@feedmepos/ui-library";
|
|
4
|
+
import { i as mt, _ as ct } from "./is-linked-ingredient-error-fJ2TJb3z.js";
|
|
5
|
+
import { F as W, D as Pe, R as ge } from "./row-action.enum-PMKMRrZR.js";
|
|
6
|
+
import { useI18n as ae, useCoreStore as fe } from "@feedmepos/mf-common";
|
|
7
|
+
import { defineStore as pt, storeToRefs as vt } from "pinia";
|
|
8
|
+
import { c as ft, _ as yt, F as Be } from "./TableActionableRow.vue_vue_type_script_setup_true_lang-DlNJ6kRg.js";
|
|
9
|
+
import { u as gt, _ as bt, a as ht } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-RNrM3eSt.js";
|
|
10
|
+
import { A as be, a as Ge, t as qe, R as Ve, U as _t, M as xt, I as Vt } from "./rules-CyLD3MFT.js";
|
|
11
|
+
import { g as kt, _ as ke, S as Se } from "./StockForecast.vue_vue_type_style_index_0_lang-KLXSWvo5.js";
|
|
12
|
+
import { _ as St } from "./InventoryBindingForm.vue_vue_type_script_setup_true_lang-Do_WCGzA.js";
|
|
13
|
+
import { _ as Ce } from "./IngredientBindedItem.vue_vue_type_script_setup_true_lang-BUy5XAra.js";
|
|
14
|
+
import { u as We } from "./feature-CfLuWtSb.js";
|
|
11
15
|
import { _ as we } from "./PreviewBadge.vue_vue_type_script_setup_true_lang-CRZiQHjx.js";
|
|
16
|
+
import { u as Ct } from "./netsuite-C6f_DtMT.js";
|
|
17
|
+
import { t as Ke, d as Je, s as wt, r as Ft } from "./xlsx.util-ClkX4qFH.js";
|
|
18
|
+
import { f as Mt } from "./date2-B8or025L.js";
|
|
19
|
+
import { F as It } from "./FmDroppableField-8RzKjEdL.js";
|
|
12
20
|
import "./array-hChJVZLE.js";
|
|
13
|
-
const
|
|
14
|
-
const
|
|
21
|
+
const Fe = pt("ingredientForm", function() {
|
|
22
|
+
const r = Ye(), g = _e(), s = re(), n = G(!1), { t: l } = ae(), o = G();
|
|
15
23
|
function m() {
|
|
16
24
|
const b = {
|
|
17
25
|
unit: {},
|
|
@@ -43,9 +51,9 @@ const Me = wt("ingredientForm", function() {
|
|
|
43
51
|
type: "success"
|
|
44
52
|
});
|
|
45
53
|
} catch (i) {
|
|
46
|
-
i instanceof
|
|
54
|
+
i instanceof at && mt(i) ? r.open({
|
|
47
55
|
title: "Cannot delete ingredient",
|
|
48
|
-
contentComponent:
|
|
56
|
+
contentComponent: ct,
|
|
49
57
|
contentComponentProps: {
|
|
50
58
|
subject: (b == null ? void 0 : b.name) ?? "",
|
|
51
59
|
items: i.errorResponse.message
|
|
@@ -64,7 +72,7 @@ const Me = wt("ingredientForm", function() {
|
|
|
64
72
|
}
|
|
65
73
|
}
|
|
66
74
|
function x(b) {
|
|
67
|
-
|
|
75
|
+
r.open({
|
|
68
76
|
title: l("inventory.ingredient.delete.title", [(b == null ? void 0 : b.name) ?? ""]),
|
|
69
77
|
closeButton: !1,
|
|
70
78
|
message: l("inventory.ingredient.delete.message"),
|
|
@@ -88,15 +96,15 @@ const Me = wt("ingredientForm", function() {
|
|
|
88
96
|
};
|
|
89
97
|
});
|
|
90
98
|
function $t() {
|
|
91
|
-
const { updateIngredient:
|
|
99
|
+
const { updateIngredient: a, deleteIngredient: r } = Fe(), { t: g } = ae();
|
|
92
100
|
async function s(l, o) {
|
|
93
101
|
const m = je(o);
|
|
94
102
|
if (l === ge.Edit) {
|
|
95
|
-
await
|
|
103
|
+
await a(m);
|
|
96
104
|
return;
|
|
97
105
|
}
|
|
98
106
|
if (l === ge.Delete) {
|
|
99
|
-
await
|
|
107
|
+
await r(m);
|
|
100
108
|
return;
|
|
101
109
|
}
|
|
102
110
|
}
|
|
@@ -135,8 +143,8 @@ function $t() {
|
|
|
135
143
|
id: "action",
|
|
136
144
|
header: "",
|
|
137
145
|
cell(l) {
|
|
138
|
-
return
|
|
139
|
-
[
|
|
146
|
+
return ft(
|
|
147
|
+
[Pe[ge.Edit], Pe[ge.Delete]],
|
|
140
148
|
(o) => {
|
|
141
149
|
s(o, l.row.original);
|
|
142
150
|
}
|
|
@@ -151,7 +159,7 @@ function $t() {
|
|
|
151
159
|
}
|
|
152
160
|
] };
|
|
153
161
|
}
|
|
154
|
-
const
|
|
162
|
+
const Ut = /* @__PURE__ */ me({
|
|
155
163
|
__name: "ConvertForm",
|
|
156
164
|
props: {
|
|
157
165
|
modelValue: {},
|
|
@@ -159,14 +167,14 @@ const Et = /* @__PURE__ */ me({
|
|
|
159
167
|
disabled: { type: Boolean }
|
|
160
168
|
},
|
|
161
169
|
emits: ["update:modelValue"],
|
|
162
|
-
setup(
|
|
163
|
-
const g =
|
|
170
|
+
setup(a, { emit: r }) {
|
|
171
|
+
const g = a, s = V(() => {
|
|
164
172
|
var i;
|
|
165
173
|
return (i = g.rootValue) == null ? void 0 : i.unit;
|
|
166
174
|
}), n = V(() => {
|
|
167
175
|
var i;
|
|
168
176
|
return (i = g.rootValue) == null ? void 0 : i._id;
|
|
169
|
-
}), l =
|
|
177
|
+
}), l = r, { t: o } = ae(), m = V({
|
|
170
178
|
get() {
|
|
171
179
|
return !!g.modelValue;
|
|
172
180
|
},
|
|
@@ -176,7 +184,7 @@ const Et = /* @__PURE__ */ me({
|
|
|
176
184
|
inventoryBindings: []
|
|
177
185
|
}) : l("update:modelValue", null);
|
|
178
186
|
}
|
|
179
|
-
}), y = V(() =>
|
|
187
|
+
}), y = V(() => kt(s.value));
|
|
180
188
|
function _(i) {
|
|
181
189
|
const p = g.modelValue ?? {};
|
|
182
190
|
p.measurement = i ? `${i}` : null, l("update:modelValue", p);
|
|
@@ -197,12 +205,12 @@ const Et = /* @__PURE__ */ me({
|
|
|
197
205
|
class: "p-16 flex flex-col gap-16"
|
|
198
206
|
}, {
|
|
199
207
|
default: S(() => {
|
|
200
|
-
var C,
|
|
208
|
+
var C, F;
|
|
201
209
|
return [
|
|
202
210
|
f(D, {
|
|
203
211
|
value: "",
|
|
204
212
|
"model-value": m.value,
|
|
205
|
-
"onUpdate:modelValue": p[0] || (p[0] = (
|
|
213
|
+
"onUpdate:modelValue": p[0] || (p[0] = (M) => m.value = M),
|
|
206
214
|
label: d(o)("inventory.ingredient.convertible.title"),
|
|
207
215
|
sublabel: d(o)("inventory.ingredient.convertible.subtitle"),
|
|
208
216
|
labelPlacement: "right"
|
|
@@ -216,9 +224,9 @@ const Et = /* @__PURE__ */ me({
|
|
|
216
224
|
items: y.value
|
|
217
225
|
}, null, 8, ["label", "modelValue", "items"])
|
|
218
226
|
]),
|
|
219
|
-
f(
|
|
227
|
+
f(St, {
|
|
220
228
|
id: n.value,
|
|
221
|
-
"model-value": ((
|
|
229
|
+
"model-value": ((F = i.modelValue) == null ? void 0 : F.inventoryBindings) ?? [],
|
|
222
230
|
"onUpdate:modelValue": x,
|
|
223
231
|
"exclude-binding-id": n.value,
|
|
224
232
|
rules: [d(be)(1)]
|
|
@@ -237,14 +245,14 @@ function de() {
|
|
|
237
245
|
mid: 14
|
|
238
246
|
};
|
|
239
247
|
}
|
|
240
|
-
const
|
|
248
|
+
const Et = { class: "flex gap-8" }, Rt = { class: "flex-1" }, At = { class: "flex-1" }, Dt = { class: "text-fm-color-typo-secondary" }, Tt = { class: "text-fm-color-typo-secondary whitespace-nowrap" }, Pt = {
|
|
241
249
|
type: "button",
|
|
242
250
|
class: "inline-flex h-32 items-center"
|
|
243
251
|
}, Bt = {
|
|
244
252
|
key: 2,
|
|
245
253
|
class: "border-1 border-fm-color-neutral-gray-200 fm-corner-radius-lg flex flex-col p-16 gap-16"
|
|
246
|
-
}, Nt = { class: "flex flex-col gap-12" }, Lt = { class: "flex flex-col gap-4" }, zt = { class: "fm-typo-en-title-sm-600" }, Ht = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Ot = { class: "flex flex-col gap-4" }, jt = { class: "flex fm-corner-radius-md border-1 border-fm-color-neutral-gray-200" }, Yt = { class: "flex-1 p-12 flex flex-col gap-8" },
|
|
247
|
-
var
|
|
254
|
+
}, Nt = { class: "flex flex-col gap-12" }, Lt = { class: "flex flex-col gap-4" }, zt = { class: "fm-typo-en-title-sm-600" }, Ht = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Ot = { class: "flex flex-col gap-4" }, jt = { class: "flex fm-corner-radius-md border-1 border-fm-color-neutral-gray-200" }, Yt = { class: "flex-1 p-12 flex flex-col gap-8" }, Gt = { class: "mx-auto" }, qt = { class: "flex flex-col" }, Wt = { class: "fm-typo-en-body-sm-600 translate-y-4" }, Kt = { class: "flex-1 p-12 flex flex-col gap-8" }, Jt = { class: "mx-auto" }, Qt = { class: "flex flex-col" }, Xt = { class: "fm-typo-en-body-sm-600 translate-y-4" }, Zt = { class: "flex-1 p-12 flex flex-col gap-8" }, en = { class: "mx-auto" }, tn = { class: "flex flex-col" }, nn = { class: "fm-typo-en-body-sm-600 translate-y-4" };
|
|
255
|
+
var Me = /* @__PURE__ */ ((a) => (a.Daily = "Daily", a.Consumables = "Consumables", a.ShortTerm = "Short term", a.Kitchen = "Kitchen", a))(Me || {});
|
|
248
256
|
const on = /* @__PURE__ */ me({
|
|
249
257
|
__name: "IngredientForm",
|
|
250
258
|
props: {
|
|
@@ -253,9 +261,9 @@ const on = /* @__PURE__ */ me({
|
|
|
253
261
|
disabled: { type: Boolean }
|
|
254
262
|
},
|
|
255
263
|
emits: ["update:modelValue", "click:submit"],
|
|
256
|
-
setup(
|
|
264
|
+
setup(a, { expose: r, emit: g }) {
|
|
257
265
|
var oe;
|
|
258
|
-
const { t: s } =
|
|
266
|
+
const { t: s } = ae(), n = a, l = g, o = re(), m = fe(), y = We();
|
|
259
267
|
function _(e) {
|
|
260
268
|
if (e.length === 0) return;
|
|
261
269
|
const t = e[0], c = n.modelValue ?? {
|
|
@@ -297,10 +305,10 @@ const on = /* @__PURE__ */ me({
|
|
|
297
305
|
get() {
|
|
298
306
|
var t, c;
|
|
299
307
|
const e = (c = (t = n.modelValue) == null ? void 0 : t.defaultCost) == null ? void 0 : c.costPerUnit;
|
|
300
|
-
return e ? +
|
|
308
|
+
return e ? +Ge(e) : 0;
|
|
301
309
|
},
|
|
302
310
|
set(e) {
|
|
303
|
-
var c, h,
|
|
311
|
+
var c, h, U, I;
|
|
304
312
|
const t = n.modelValue ? {
|
|
305
313
|
...n.modelValue
|
|
306
314
|
} : {};
|
|
@@ -310,7 +318,7 @@ const on = /* @__PURE__ */ me({
|
|
|
310
318
|
precision: 2,
|
|
311
319
|
currency: ((c = he(m.currentCountry.value)) == null ? void 0 : c.currency) ?? "MYR"
|
|
312
320
|
},
|
|
313
|
-
measurement: (
|
|
321
|
+
measurement: (I = (U = (h = n.modelValue) == null ? void 0 : h.unit) == null ? void 0 : U.measurements) == null ? void 0 : I.find(
|
|
314
322
|
(Q) => {
|
|
315
323
|
var K;
|
|
316
324
|
return Q.id === ((K = n.modelValue) == null ? void 0 : K.trackingMeasurement);
|
|
@@ -323,13 +331,13 @@ const on = /* @__PURE__ */ me({
|
|
|
323
331
|
}
|
|
324
332
|
}), D = V(() => {
|
|
325
333
|
var t, c, h;
|
|
326
|
-
const e = ((t = n.modelValue) == null ? void 0 : t.unit) ?? o.units.find((
|
|
334
|
+
const e = ((t = n.modelValue) == null ? void 0 : t.unit) ?? o.units.find((U) => U);
|
|
327
335
|
return e ? {
|
|
328
336
|
_id: e._id,
|
|
329
337
|
measurement: (c = n.modelValue) == null ? void 0 : c.trackingMeasurement,
|
|
330
|
-
name: ((h = e.measurements.find((
|
|
331
|
-
var
|
|
332
|
-
return
|
|
338
|
+
name: ((h = e.measurements.find((U) => {
|
|
339
|
+
var I;
|
|
340
|
+
return U.id === ((I = n.modelValue) == null ? void 0 : I.trackingMeasurement);
|
|
333
341
|
})) == null ? void 0 : h.name) ?? e.name
|
|
334
342
|
} : null;
|
|
335
343
|
}), w = V({
|
|
@@ -346,7 +354,7 @@ const on = /* @__PURE__ */ me({
|
|
|
346
354
|
}), L = V(
|
|
347
355
|
() => [
|
|
348
356
|
...new Set(
|
|
349
|
-
o.skus.map((e) => e.operationalGroup ?? "").filter((e) => e && !Object.values(
|
|
357
|
+
o.skus.map((e) => e.operationalGroup ?? "").filter((e) => e && !Object.values(Me).includes(e))
|
|
350
358
|
)
|
|
351
359
|
].sort()
|
|
352
360
|
), C = V({
|
|
@@ -356,7 +364,7 @@ const on = /* @__PURE__ */ me({
|
|
|
356
364
|
set(e) {
|
|
357
365
|
e ? w.value = "" : w.value = null;
|
|
358
366
|
}
|
|
359
|
-
}),
|
|
367
|
+
}), F = V(
|
|
360
368
|
() => o.units.flatMap(({ name: e, _id: t, abbrev: c, measurements: h }) => [
|
|
361
369
|
{
|
|
362
370
|
label: `${e}`,
|
|
@@ -368,34 +376,34 @@ const on = /* @__PURE__ */ me({
|
|
|
368
376
|
value: { _id: t },
|
|
369
377
|
displayAsSection: !1
|
|
370
378
|
},
|
|
371
|
-
...h.map(({ id:
|
|
372
|
-
label: `${
|
|
373
|
-
value: { _id: t, measurement:
|
|
379
|
+
...h.map(({ id: U, name: I, abbrev: Q }) => ({
|
|
380
|
+
label: `${I} (${Q})`,
|
|
381
|
+
value: { _id: t, measurement: U },
|
|
374
382
|
displayAsSection: !1
|
|
375
383
|
}))
|
|
376
384
|
])
|
|
377
385
|
);
|
|
378
|
-
function
|
|
379
|
-
var t, c, h,
|
|
380
|
-
return ((c = (t = n.modelValue) == null ? void 0 : t.unit) == null ? void 0 : c._id) === ((h = e.value) == null ? void 0 : h._id) && ((
|
|
386
|
+
function M(e) {
|
|
387
|
+
var t, c, h, U, I;
|
|
388
|
+
return ((c = (t = n.modelValue) == null ? void 0 : t.unit) == null ? void 0 : c._id) === ((h = e.value) == null ? void 0 : h._id) && ((U = n.modelValue) == null ? void 0 : U.trackingMeasurement) === ((I = e.value) == null ? void 0 : I.measurement);
|
|
381
389
|
}
|
|
382
390
|
function P(e) {
|
|
383
391
|
var Q, K;
|
|
384
392
|
if (!e) return;
|
|
385
|
-
const { _id: t, measurement: c } = e, h = c || void 0,
|
|
386
|
-
if (!
|
|
393
|
+
const { _id: t, measurement: c } = e, h = c || void 0, U = o.units.find((ue) => ue._id === t);
|
|
394
|
+
if (!U)
|
|
387
395
|
return;
|
|
388
|
-
const
|
|
389
|
-
|
|
390
|
-
measurement:
|
|
396
|
+
const I = n.modelValue ?? {};
|
|
397
|
+
I.unit = U, I.trackingMeasurement = h, I.convert && (I.convert.measurement = h || null), y.enableTotalCost && (I.defaultCost = {
|
|
398
|
+
measurement: U.measurements.find((ue) => ue.id === h),
|
|
391
399
|
costPerUnit: {
|
|
392
|
-
...((Q =
|
|
400
|
+
...((Q = I.defaultCost) == null ? void 0 : Q.costPerUnit) ?? {
|
|
393
401
|
amount: 0,
|
|
394
402
|
precision: 2,
|
|
395
403
|
currency: ((K = he(m.currentCountry.value)) == null ? void 0 : K.currency) ?? "MYR"
|
|
396
404
|
}
|
|
397
405
|
}
|
|
398
|
-
}), l("update:modelValue",
|
|
406
|
+
}), l("update:modelValue", I);
|
|
399
407
|
}
|
|
400
408
|
const X = V({
|
|
401
409
|
get() {
|
|
@@ -424,8 +432,8 @@ const on = /* @__PURE__ */ me({
|
|
|
424
432
|
} : {};
|
|
425
433
|
t.valuation = e, l("update:modelValue", t);
|
|
426
434
|
}
|
|
427
|
-
}), O =
|
|
428
|
-
|
|
435
|
+
}), O = G();
|
|
436
|
+
r({
|
|
429
437
|
validateInputs: () => {
|
|
430
438
|
var e, t;
|
|
431
439
|
(t = (e = O.value) == null ? void 0 : e.validateInputs) == null || t.call(e);
|
|
@@ -439,7 +447,7 @@ const on = /* @__PURE__ */ me({
|
|
|
439
447
|
(t = (e = O.value) == null ? void 0 : e.resetInputs) == null || t.call(e);
|
|
440
448
|
}
|
|
441
449
|
});
|
|
442
|
-
const z =
|
|
450
|
+
const z = G(!1), se = V(
|
|
443
451
|
() => {
|
|
444
452
|
var e, t, c;
|
|
445
453
|
return (e = n.modelValue) != null && e._id ? ((c = o.menu.bindedBySkuId[(t = n.modelValue) == null ? void 0 : t._id]) == null ? void 0 : c.filter(
|
|
@@ -453,14 +461,14 @@ const on = /* @__PURE__ */ me({
|
|
|
453
461
|
(h) => h.from === "RECIPE"
|
|
454
462
|
)) ?? [] : [];
|
|
455
463
|
}
|
|
456
|
-
),
|
|
464
|
+
), E = V(
|
|
457
465
|
() => {
|
|
458
466
|
var e, t, c;
|
|
459
467
|
return (e = n.modelValue) != null && e._id ? ((c = o.menu.bindedBySkuId[(t = n.modelValue) == null ? void 0 : t._id]) == null ? void 0 : c.filter((h) => h.from === "MENU")) ?? [] : [];
|
|
460
468
|
}
|
|
461
469
|
), ce = V(
|
|
462
470
|
() => o.skus.map((e) => ({ label: e.name, value: e.code }))
|
|
463
|
-
), ie =
|
|
471
|
+
), ie = G((oe = n.modelValue) == null ? void 0 : oe.code);
|
|
464
472
|
function pe(e) {
|
|
465
473
|
var c;
|
|
466
474
|
const t = e.el;
|
|
@@ -468,25 +476,25 @@ const on = /* @__PURE__ */ me({
|
|
|
468
476
|
}
|
|
469
477
|
function B(e) {
|
|
470
478
|
switch (e) {
|
|
471
|
-
case
|
|
479
|
+
case xe.MY:
|
|
472
480
|
return "MYR";
|
|
473
|
-
case
|
|
481
|
+
case xe.SG:
|
|
474
482
|
return "SGD";
|
|
475
|
-
case
|
|
483
|
+
case xe.ID:
|
|
476
484
|
return "IDR";
|
|
477
485
|
default:
|
|
478
486
|
return "MYR";
|
|
479
487
|
}
|
|
480
488
|
}
|
|
481
|
-
const
|
|
489
|
+
const q = V(
|
|
482
490
|
() => {
|
|
483
|
-
var e, t, c, h,
|
|
491
|
+
var e, t, c, h, U, I;
|
|
484
492
|
return ((h = (c = (t = (e = n.modelValue) == null ? void 0 : e.unit) == null ? void 0 : t.measurements) == null ? void 0 : c.find(
|
|
485
493
|
(Q) => {
|
|
486
494
|
var K;
|
|
487
495
|
return Q.id === ((K = n.modelValue) == null ? void 0 : K.trackingMeasurement);
|
|
488
496
|
}
|
|
489
|
-
)) == null ? void 0 : h.abbrev) ?? ((
|
|
497
|
+
)) == null ? void 0 : h.abbrev) ?? ((I = (U = n.modelValue) == null ? void 0 : U.unit) == null ? void 0 : I.abbrev);
|
|
490
498
|
}
|
|
491
499
|
), ne = V({
|
|
492
500
|
get() {
|
|
@@ -523,7 +531,7 @@ const on = /* @__PURE__ */ me({
|
|
|
523
531
|
};
|
|
524
532
|
}
|
|
525
533
|
return (e, t) => {
|
|
526
|
-
const c = $("FmTextField"), h = $("FmLabel"),
|
|
534
|
+
const c = $("FmTextField"), h = $("FmLabel"), U = $("FmField"), I = $("FmMenuHeader"), Q = $("FmMenuDivider"), K = $("FmMenuItem"), ue = $("FmMenu"), Ie = $("FmFormGroup"), Xe = $("FmSelect"), $e = $("FmSwitch"), Ze = $("FmIcon"), et = $("FmCard"), Ue = $("FmStepperField"), tt = $("FmForm");
|
|
527
535
|
return v(), A(tt, {
|
|
528
536
|
disabled: e.disabled,
|
|
529
537
|
ref_key: "formRef",
|
|
@@ -532,13 +540,13 @@ const on = /* @__PURE__ */ me({
|
|
|
532
540
|
onValidationSuccess: x
|
|
533
541
|
}, {
|
|
534
542
|
default: S(() => [
|
|
535
|
-
u("div",
|
|
543
|
+
u("div", Et, [
|
|
536
544
|
u("div", Rt, [
|
|
537
545
|
f(c, {
|
|
538
546
|
label: d(s)("inventory.ingredient.code"),
|
|
539
547
|
"model-value": b.value,
|
|
540
548
|
"onUpdate:modelValue": t[0] || (t[0] = (k) => b.value = k),
|
|
541
|
-
rules: [d(
|
|
549
|
+
rules: [d(Ve)(), d(_t)(ce.value, ie.value)],
|
|
542
550
|
"label-mark": "required"
|
|
543
551
|
}, null, 8, ["label", "model-value", "rules"])
|
|
544
552
|
]),
|
|
@@ -547,14 +555,14 @@ const on = /* @__PURE__ */ me({
|
|
|
547
555
|
label: d(s)("inventory.ingredient.name"),
|
|
548
556
|
"model-value": i.value,
|
|
549
557
|
"onUpdate:modelValue": t[1] || (t[1] = (k) => i.value = k),
|
|
550
|
-
rules: [d(
|
|
558
|
+
rules: [d(Ve)()],
|
|
551
559
|
"label-mark": "required"
|
|
552
560
|
}, null, 8, ["label", "model-value", "rules"])
|
|
553
561
|
])
|
|
554
562
|
]),
|
|
555
|
-
f(
|
|
563
|
+
f(Ie, {
|
|
556
564
|
"model-value": D.value,
|
|
557
|
-
rules: [d(
|
|
565
|
+
rules: [d(Ve)()],
|
|
558
566
|
"label-mark": "required"
|
|
559
567
|
}, {
|
|
560
568
|
label: S(() => [
|
|
@@ -565,7 +573,7 @@ const on = /* @__PURE__ */ me({
|
|
|
565
573
|
default: S(({ invalid: k }) => [
|
|
566
574
|
f(ue, null, {
|
|
567
575
|
"menu-button": S(() => [
|
|
568
|
-
f(
|
|
576
|
+
f(U, {
|
|
569
577
|
class: le([
|
|
570
578
|
"fm-typo-en-body-lg-400",
|
|
571
579
|
{
|
|
@@ -590,20 +598,20 @@ const on = /* @__PURE__ */ me({
|
|
|
590
598
|
class: "overflow-x-hidden overflow-y-auto max-h-[300px]",
|
|
591
599
|
onVnodeMounted: pe
|
|
592
600
|
}, [
|
|
593
|
-
(v(!0), R(J, null, te(
|
|
601
|
+
(v(!0), R(J, null, te(F.value, (Y) => (v(), R(J, {
|
|
594
602
|
key: Y.label
|
|
595
603
|
}, [
|
|
596
604
|
Y.displayAsSection ? (v(), R(J, { key: 0 }, [
|
|
597
|
-
f(
|
|
605
|
+
f(I, {
|
|
598
606
|
label: Y.label
|
|
599
607
|
}, null, 8, ["label"]),
|
|
600
608
|
f(Q)
|
|
601
609
|
], 64)) : (v(), A(K, {
|
|
602
610
|
key: 1,
|
|
603
611
|
label: Y.label,
|
|
604
|
-
"model-value":
|
|
612
|
+
"model-value": M(Y),
|
|
605
613
|
onClick: (Nn) => P(Y.value),
|
|
606
|
-
"x-should-scroll-into": `${
|
|
614
|
+
"x-should-scroll-into": `${M(Y)}`
|
|
607
615
|
}, null, 8, ["label", "model-value", "onClick", "x-should-scroll-into"]))
|
|
608
616
|
], 64))), 128))
|
|
609
617
|
], 512)
|
|
@@ -636,7 +644,7 @@ const on = /* @__PURE__ */ me({
|
|
|
636
644
|
key: 1,
|
|
637
645
|
"model-value": p.value,
|
|
638
646
|
"onUpdate:modelValue": t[3] || (t[3] = (k) => p.value = k),
|
|
639
|
-
rules: [d(be)(0), d(
|
|
647
|
+
rules: [d(be)(0), d(xt)(4)]
|
|
640
648
|
}, {
|
|
641
649
|
label: S(() => [
|
|
642
650
|
f(we, { "z-index": 50 }, {
|
|
@@ -651,11 +659,11 @@ const on = /* @__PURE__ */ me({
|
|
|
651
659
|
prepend: S(() => {
|
|
652
660
|
var k, Y;
|
|
653
661
|
return [
|
|
654
|
-
u("div", Dt, N(B(((k = d(m).currentCountry) == null ? void 0 : k.value) ?? d(
|
|
662
|
+
u("div", Dt, N(B(((k = d(m).currentCountry) == null ? void 0 : k.value) ?? d(Ae)) === "MYR" ? "RM" : B(((Y = d(m).currentCountry) == null ? void 0 : Y.value) ?? d(Ae))), 1)
|
|
655
663
|
];
|
|
656
664
|
}),
|
|
657
665
|
append: S(() => [
|
|
658
|
-
u("div", Tt, " / " + N(
|
|
666
|
+
u("div", Tt, " / " + N(q.value), 1)
|
|
659
667
|
]),
|
|
660
668
|
_: 1
|
|
661
669
|
}, 8, ["model-value", "rules"])) : H("", !0),
|
|
@@ -689,14 +697,14 @@ const on = /* @__PURE__ */ me({
|
|
|
689
697
|
}, 8, ["modelValue"])
|
|
690
698
|
]),
|
|
691
699
|
default: S(() => [
|
|
692
|
-
f(
|
|
693
|
-
(v(!0), R(J, null, te(Object.values(
|
|
700
|
+
f(I, { label: "Preset" }),
|
|
701
|
+
(v(!0), R(J, null, te(Object.values(Me), (k) => (v(), A(K, {
|
|
694
702
|
key: k,
|
|
695
703
|
label: k,
|
|
696
704
|
"model-value": w.value === k,
|
|
697
705
|
onClick: (Y) => w.value = k
|
|
698
706
|
}, null, 8, ["label", "model-value", "onClick"]))), 128)),
|
|
699
|
-
L.value.length ? (v(), A(
|
|
707
|
+
L.value.length ? (v(), A(I, {
|
|
700
708
|
key: 0,
|
|
701
709
|
label: "Custom"
|
|
702
710
|
})) : H("", !0),
|
|
@@ -712,7 +720,7 @@ const on = /* @__PURE__ */ me({
|
|
|
712
720
|
]),
|
|
713
721
|
_: 1
|
|
714
722
|
}),
|
|
715
|
-
f(
|
|
723
|
+
f(Ut, {
|
|
716
724
|
"model-value": X.value,
|
|
717
725
|
"onUpdate:modelValue": t[6] || (t[6] = (k) => X.value = k),
|
|
718
726
|
"root-value": e.modelValue
|
|
@@ -736,10 +744,10 @@ const on = /* @__PURE__ */ me({
|
|
|
736
744
|
name: d(s)("inventory.ingredient.bindedItems.recipe"),
|
|
737
745
|
bindings: T.value
|
|
738
746
|
}, null, 8, ["name", "bindings"])) : H("", !0),
|
|
739
|
-
z.value &&
|
|
747
|
+
z.value && E.value.length ? (v(), A(Ce, {
|
|
740
748
|
key: 2,
|
|
741
749
|
name: d(s)("inventory.ingredient.bindedItems.menu"),
|
|
742
|
-
bindings:
|
|
750
|
+
bindings: E.value
|
|
743
751
|
}, null, 8, ["name", "bindings"])) : H("", !0)
|
|
744
752
|
])) : H("", !0),
|
|
745
753
|
u("div", Nt, [
|
|
@@ -753,21 +761,21 @@ const on = /* @__PURE__ */ me({
|
|
|
753
761
|
u("div", Ht, N(d(s)("inventory.ingredient.threshold.subtitle")), 1)
|
|
754
762
|
]),
|
|
755
763
|
u("div", Ot, [
|
|
756
|
-
f(
|
|
764
|
+
f(Ie, {
|
|
757
765
|
"model-value": { low: ne.value, mid: ee.value },
|
|
758
766
|
rules: [ye()]
|
|
759
767
|
}, null, 8, ["model-value", "rules"]),
|
|
760
768
|
u("div", jt, [
|
|
761
769
|
u("div", Yt, [
|
|
762
|
-
u("div",
|
|
770
|
+
u("div", Gt, [
|
|
763
771
|
f(ke, {
|
|
764
772
|
days: ne.value,
|
|
765
773
|
level: d(Se).low
|
|
766
774
|
}, null, 8, ["days", "level"])
|
|
767
775
|
]),
|
|
768
|
-
u("div",
|
|
776
|
+
u("div", qt, [
|
|
769
777
|
u("div", Wt, N(d(s)("inventory.ingredient.threshold.whenRemaining")), 1),
|
|
770
|
-
f(
|
|
778
|
+
f(Ue, {
|
|
771
779
|
modelValue: ne.value,
|
|
772
780
|
"onUpdate:modelValue": t[8] || (t[8] = (k) => ne.value = k),
|
|
773
781
|
rules: [d(be)(0)]
|
|
@@ -800,7 +808,7 @@ const on = /* @__PURE__ */ me({
|
|
|
800
808
|
]),
|
|
801
809
|
u("div", Qt, [
|
|
802
810
|
u("div", Xt, N(d(s)("inventory.ingredient.threshold.whenRemaining")), 1),
|
|
803
|
-
f(
|
|
811
|
+
f(Ue, {
|
|
804
812
|
modelValue: ee.value,
|
|
805
813
|
"onUpdate:modelValue": t[9] || (t[9] = (k) => ee.value = k),
|
|
806
814
|
rules: [d(be)(0)]
|
|
@@ -843,10 +851,10 @@ const on = /* @__PURE__ */ me({
|
|
|
843
851
|
}, 8, ["disabled"]);
|
|
844
852
|
};
|
|
845
853
|
}
|
|
846
|
-
}), ln = { class: "flex flex-col gap-32" },
|
|
854
|
+
}), ln = { class: "flex flex-col gap-32" }, rn = {
|
|
847
855
|
key: 0,
|
|
848
856
|
class: "flex flex-col gap-12"
|
|
849
|
-
},
|
|
857
|
+
}, an = { class: "flex flex-col gap-4" }, sn = { class: "flex-1 fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, un = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, dn = { class: "flex gap-4" }, mn = /* @__PURE__ */ me({
|
|
850
858
|
__name: "IngredientDialog",
|
|
851
859
|
props: {
|
|
852
860
|
show: { type: Boolean },
|
|
@@ -854,17 +862,17 @@ const on = /* @__PURE__ */ me({
|
|
|
854
862
|
mode: { default: W.READ }
|
|
855
863
|
},
|
|
856
864
|
emits: ["update:show"],
|
|
857
|
-
setup(
|
|
858
|
-
const
|
|
865
|
+
setup(a) {
|
|
866
|
+
const r = a, g = re(), s = Ct(), n = _e(), { t: l } = ae(), o = Te(r, "show"), m = Te(r, "unit"), y = V(
|
|
859
867
|
() => {
|
|
860
|
-
var
|
|
861
|
-
return s.isEnabled && s.netSuiteItemBySkuId.has((
|
|
868
|
+
var M;
|
|
869
|
+
return s.isEnabled && s.netSuiteItemBySkuId.has((M = r.unit) == null ? void 0 : M._id);
|
|
862
870
|
}
|
|
863
871
|
), _ = V(() => {
|
|
864
|
-
var
|
|
865
|
-
return !((
|
|
872
|
+
var M;
|
|
873
|
+
return !((M = r.unit) != null && M._id) || !y.value;
|
|
866
874
|
}), x = V(() => {
|
|
867
|
-
switch (
|
|
875
|
+
switch (r.mode) {
|
|
868
876
|
case W.READ:
|
|
869
877
|
return "";
|
|
870
878
|
case W.UPDATE:
|
|
@@ -874,7 +882,7 @@ const on = /* @__PURE__ */ me({
|
|
|
874
882
|
}
|
|
875
883
|
return "";
|
|
876
884
|
}), b = V(() => {
|
|
877
|
-
switch (
|
|
885
|
+
switch (r.mode) {
|
|
878
886
|
case W.READ:
|
|
879
887
|
return "";
|
|
880
888
|
case W.UPDATE:
|
|
@@ -883,7 +891,7 @@ const on = /* @__PURE__ */ me({
|
|
|
883
891
|
return l("common.add");
|
|
884
892
|
}
|
|
885
893
|
return "";
|
|
886
|
-
}), i =
|
|
894
|
+
}), i = G(), p = G(!1);
|
|
887
895
|
async function D() {
|
|
888
896
|
p.value = !0;
|
|
889
897
|
try {
|
|
@@ -892,8 +900,8 @@ const on = /* @__PURE__ */ me({
|
|
|
892
900
|
message: l("inventory.ingredient.create.success", { name: m.value.name }),
|
|
893
901
|
type: "success"
|
|
894
902
|
});
|
|
895
|
-
} catch (
|
|
896
|
-
|
|
903
|
+
} catch (M) {
|
|
904
|
+
M instanceof De || n.open({
|
|
897
905
|
title: l("inventory.ingredient.create.error.title"),
|
|
898
906
|
message: l("inventory.ingredient.create.error.message"),
|
|
899
907
|
type: "error"
|
|
@@ -910,8 +918,8 @@ const on = /* @__PURE__ */ me({
|
|
|
910
918
|
message: l("inventory.ingredient.update.success", { name: m.value.name }),
|
|
911
919
|
type: "success"
|
|
912
920
|
});
|
|
913
|
-
} catch (
|
|
914
|
-
|
|
921
|
+
} catch (M) {
|
|
922
|
+
M instanceof De || n.open({
|
|
915
923
|
title: l("inventory.ingredient.update.error.title"),
|
|
916
924
|
message: l("inventory.ingredient.update.error.message"),
|
|
917
925
|
type: "error"
|
|
@@ -921,11 +929,11 @@ const on = /* @__PURE__ */ me({
|
|
|
921
929
|
}
|
|
922
930
|
}
|
|
923
931
|
function L() {
|
|
924
|
-
var
|
|
925
|
-
(P = (
|
|
932
|
+
var M, P;
|
|
933
|
+
(P = (M = i.value) == null ? void 0 : M.validateInputs) == null || P.call(M);
|
|
926
934
|
}
|
|
927
935
|
function C() {
|
|
928
|
-
switch (
|
|
936
|
+
switch (r.mode) {
|
|
929
937
|
case W.READ:
|
|
930
938
|
return;
|
|
931
939
|
case W.UPDATE:
|
|
@@ -934,12 +942,12 @@ const on = /* @__PURE__ */ me({
|
|
|
934
942
|
return D();
|
|
935
943
|
}
|
|
936
944
|
}
|
|
937
|
-
const
|
|
945
|
+
const F = V(() => {
|
|
938
946
|
var X, Z;
|
|
939
|
-
if (!s.isEnabled || !((X =
|
|
940
|
-
const
|
|
941
|
-
return
|
|
942
|
-
(j) => j.parentNetSuiteId ===
|
|
947
|
+
if (!s.isEnabled || !((X = r.unit) != null && X._id)) return null;
|
|
948
|
+
const M = (Z = s.netSuiteItemBySkuId.get(r.unit._id)) == null ? void 0 : Z[0];
|
|
949
|
+
return M ? s.state.setting.childItems.filter(
|
|
950
|
+
(j) => j.parentNetSuiteId === M.netSuiteId
|
|
943
951
|
).map((j) => {
|
|
944
952
|
var z;
|
|
945
953
|
const O = (z = s.measurementByNetsuiteId.get(j.unitOfMeasureId)) == null ? void 0 : z[0];
|
|
@@ -949,11 +957,11 @@ const on = /* @__PURE__ */ me({
|
|
|
949
957
|
} : null;
|
|
950
958
|
}).filter((j) => j).map((j) => j) : null;
|
|
951
959
|
});
|
|
952
|
-
return (
|
|
960
|
+
return (M, P) => {
|
|
953
961
|
const X = $("FmChip"), Z = $("FmButton"), j = $("FmSideSheet");
|
|
954
962
|
return v(), A(j, {
|
|
955
963
|
"model-value": d(o),
|
|
956
|
-
"onUpdate:modelValue": P[3] || (P[3] = (O) =>
|
|
964
|
+
"onUpdate:modelValue": P[3] || (P[3] = (O) => Ee(o) ? o.value = O : null),
|
|
957
965
|
header: x.value,
|
|
958
966
|
"close-button": "",
|
|
959
967
|
"dismiss-away": "",
|
|
@@ -991,15 +999,15 @@ const on = /* @__PURE__ */ me({
|
|
|
991
999
|
ref_key: "hasValidationExpose",
|
|
992
1000
|
ref: i,
|
|
993
1001
|
modelValue: d(m),
|
|
994
|
-
"onUpdate:modelValue": P[0] || (P[0] = (z) =>
|
|
995
|
-
mode:
|
|
1002
|
+
"onUpdate:modelValue": P[0] || (P[0] = (z) => Ee(m) ? m.value = z : null),
|
|
1003
|
+
mode: M.mode,
|
|
996
1004
|
disabled: p.value,
|
|
997
1005
|
"onClick:submit": P[1] || (P[1] = (z) => C())
|
|
998
1006
|
}, null, 8, ["modelValue", "mode", "disabled"]),
|
|
999
|
-
(O =
|
|
1007
|
+
(O = F.value) != null && O.length ? (v(), R("div", rn, [
|
|
1000
1008
|
P[4] || (P[4] = u("div", { class: "fm-typo-en-title-sm-600" }, N("NetSuite info"), -1)),
|
|
1001
|
-
u("div",
|
|
1002
|
-
(v(!0), R(J, null, te(
|
|
1009
|
+
u("div", an, [
|
|
1010
|
+
(v(!0), R(J, null, te(F.value, (z, se) => (v(), R("div", {
|
|
1003
1011
|
key: se,
|
|
1004
1012
|
class: "flex items-center"
|
|
1005
1013
|
}, [
|
|
@@ -1016,12 +1024,12 @@ const on = /* @__PURE__ */ me({
|
|
|
1016
1024
|
};
|
|
1017
1025
|
}
|
|
1018
1026
|
});
|
|
1019
|
-
function* cn(
|
|
1027
|
+
function* cn(a) {
|
|
1020
1028
|
for (; ; )
|
|
1021
|
-
yield
|
|
1029
|
+
yield a[Math.floor(Math.random() * a.length)];
|
|
1022
1030
|
}
|
|
1023
|
-
function pn(
|
|
1024
|
-
return Array.from({ length:
|
|
1031
|
+
function pn(a = 4, r = cn("qwertyuiopasdfghjklzxcvbnm".split(""))) {
|
|
1032
|
+
return Array.from({ length: a }).map(() => r.next().value).join("");
|
|
1025
1033
|
}
|
|
1026
1034
|
function vn() {
|
|
1027
1035
|
return `sku_${(/* @__PURE__ */ new Date()).toISOString()}_${pn()}`;
|
|
@@ -1033,22 +1041,22 @@ const fn = {
|
|
|
1033
1041
|
precision: 0,
|
|
1034
1042
|
measurements: []
|
|
1035
1043
|
};
|
|
1036
|
-
function yn(
|
|
1044
|
+
function yn(a) {
|
|
1037
1045
|
var g, s, n, l, o;
|
|
1038
1046
|
return {
|
|
1039
|
-
code:
|
|
1040
|
-
name:
|
|
1041
|
-
unit: ((g =
|
|
1042
|
-
baseUnit:
|
|
1043
|
-
valuationMethod:
|
|
1044
|
-
pricePerUnit: (s =
|
|
1045
|
-
thresholdLow: ((l =
|
|
1046
|
-
thresholdMid: ((o =
|
|
1047
|
+
code: a.code,
|
|
1048
|
+
name: a.name,
|
|
1049
|
+
unit: ((g = a.unit.measurements.find((m) => m.id === a.trackingMeasurement)) == null ? void 0 : g.abbrev) ?? a.unit.abbrev,
|
|
1050
|
+
baseUnit: a.unit.abbrev,
|
|
1051
|
+
valuationMethod: a.valuation ?? "WAVG",
|
|
1052
|
+
pricePerUnit: (s = a.defaultCost) != null && s.costPerUnit ? +Ge((n = a.defaultCost) == null ? void 0 : n.costPerUnit) : 0,
|
|
1053
|
+
thresholdLow: ((l = a.thresholds) == null ? void 0 : l.low) ?? de().low,
|
|
1054
|
+
thresholdMid: ((o = a.thresholds) == null ? void 0 : o.mid) ?? de().mid
|
|
1047
1055
|
};
|
|
1048
1056
|
}
|
|
1049
1057
|
function Qe() {
|
|
1050
1058
|
var n;
|
|
1051
|
-
const
|
|
1059
|
+
const a = [
|
|
1052
1060
|
{
|
|
1053
1061
|
id: "code",
|
|
1054
1062
|
name: "Code"
|
|
@@ -1065,8 +1073,8 @@ function Qe() {
|
|
|
1065
1073
|
id: "baseUnit",
|
|
1066
1074
|
name: "Base unit"
|
|
1067
1075
|
}
|
|
1068
|
-
],
|
|
1069
|
-
return
|
|
1076
|
+
], r = We(), g = fe(), s = he(g.currentCountry.value);
|
|
1077
|
+
return r.enableTotalCost && a.push(
|
|
1070
1078
|
{
|
|
1071
1079
|
id: "valuationMethod",
|
|
1072
1080
|
name: "Valuation method"
|
|
@@ -1075,7 +1083,7 @@ function Qe() {
|
|
|
1075
1083
|
id: "pricePerUnit",
|
|
1076
1084
|
name: `Price per unit (${s == null ? void 0 : s.currency})`
|
|
1077
1085
|
}
|
|
1078
|
-
), ((n = g.currentBusiness.value) == null ? void 0 : n.menuVersion) === "v4" &&
|
|
1086
|
+
), ((n = g.currentBusiness.value) == null ? void 0 : n.menuVersion) === "v4" && a.push(
|
|
1079
1087
|
{
|
|
1080
1088
|
id: "thresholdLow",
|
|
1081
1089
|
name: "Show RED when remaining"
|
|
@@ -1084,42 +1092,42 @@ function Qe() {
|
|
|
1084
1092
|
id: "thresholdMid",
|
|
1085
1093
|
name: "Show YELLOW when remaining"
|
|
1086
1094
|
}
|
|
1087
|
-
),
|
|
1095
|
+
), a;
|
|
1088
1096
|
}
|
|
1089
1097
|
function gn() {
|
|
1090
|
-
const
|
|
1098
|
+
const r = re().skus.map(yn), s = fe().currentBusiness.value, n = Qe(), l = [
|
|
1091
1099
|
["Business name:", s == null ? void 0 : s.name],
|
|
1092
1100
|
["Business ID:", s == null ? void 0 : s._id],
|
|
1093
1101
|
["Menu version", s == null ? void 0 : s.menuVersion],
|
|
1094
1102
|
[],
|
|
1095
1103
|
n.map((_) => _.name),
|
|
1096
|
-
...
|
|
1097
|
-
], o = n.map((_) => `system:${_.id}`), m =
|
|
1098
|
-
return
|
|
1104
|
+
...r.map((_) => n.map((x) => _[x.id]))
|
|
1105
|
+
], o = n.map((_) => `system:${_.id}`), m = Ke(l, o), y = `${s == null ? void 0 : s.name} ingredients (${Mt(/* @__PURE__ */ new Date())}).xlsx`;
|
|
1106
|
+
return Je(m, y), y;
|
|
1099
1107
|
}
|
|
1100
1108
|
function bn() {
|
|
1101
|
-
const
|
|
1102
|
-
["Business name:",
|
|
1103
|
-
["Business ID:",
|
|
1104
|
-
["Menu version",
|
|
1109
|
+
const r = fe().currentBusiness.value, g = Qe(), s = [
|
|
1110
|
+
["Business name:", r == null ? void 0 : r.name],
|
|
1111
|
+
["Business ID:", r == null ? void 0 : r._id],
|
|
1112
|
+
["Menu version", r == null ? void 0 : r.menuVersion],
|
|
1105
1113
|
[],
|
|
1106
1114
|
g.map((m) => m.name)
|
|
1107
|
-
], n = g.map((m) => `system:${m.id}`), l =
|
|
1108
|
-
return
|
|
1115
|
+
], n = g.map((m) => `system:${m.id}`), l = Ke(s, n), o = "FeedMe ingredients template.xlsx";
|
|
1116
|
+
return Je(l, o), o;
|
|
1109
1117
|
}
|
|
1110
|
-
function hn(
|
|
1118
|
+
function hn(a) {
|
|
1111
1119
|
const [
|
|
1112
|
-
|
|
1120
|
+
r,
|
|
1113
1121
|
g,
|
|
1114
1122
|
s,
|
|
1115
1123
|
n,
|
|
1116
1124
|
l,
|
|
1117
1125
|
o,
|
|
1118
1126
|
...m
|
|
1119
|
-
] =
|
|
1120
|
-
if (!
|
|
1127
|
+
] = wt(a);
|
|
1128
|
+
if (!r || !r.length || r.some((i) => i.length && !i.startsWith("system:")))
|
|
1121
1129
|
throw new Error("Missing meta header. Excel file does not come from the template.");
|
|
1122
|
-
const y =
|
|
1130
|
+
const y = r.map((i) => i.split(":")[1]), x = ["code", "name", "unit", "baseUnit"].filter((i) => !y.includes(i));
|
|
1123
1131
|
if (x.length)
|
|
1124
1132
|
throw new Error(
|
|
1125
1133
|
`Missing meta headers (${x.join()}). Excel file does not come from the template.`
|
|
@@ -1136,57 +1144,57 @@ function hn(r) {
|
|
|
1136
1144
|
};
|
|
1137
1145
|
});
|
|
1138
1146
|
}
|
|
1139
|
-
function Ne(
|
|
1147
|
+
function Ne(a, r, g) {
|
|
1140
1148
|
var C;
|
|
1141
|
-
const n =
|
|
1149
|
+
const n = re().units, l = new Array(), o = g.filter((F) => F.data.code === a.code);
|
|
1142
1150
|
o.length > 1 && l.push(
|
|
1143
|
-
`Code ${
|
|
1151
|
+
`Code ${a.code} is already used in row ${o.map((F) => F.index + 6).join()}.`
|
|
1144
1152
|
);
|
|
1145
|
-
const m = n.find((
|
|
1153
|
+
const m = n.find((F) => F.abbrev === a.baseUnit), y = m == null ? void 0 : m.measurements.find((F) => F.abbrev === a.unit);
|
|
1146
1154
|
if (!m)
|
|
1147
|
-
l.push(`Cannot find base unit of symbol ${
|
|
1148
|
-
else if (
|
|
1149
|
-
const
|
|
1150
|
-
l.push(
|
|
1155
|
+
l.push(`Cannot find base unit of symbol ${a.baseUnit}.`);
|
|
1156
|
+
else if (a.baseUnit !== a.unit && !y) {
|
|
1157
|
+
const F = `Cannot find unit conversion for ${a.baseUnit} with symbol ${a.unit || "[empty]"}.`;
|
|
1158
|
+
l.push(F);
|
|
1151
1159
|
}
|
|
1152
1160
|
const _ = ve.options.find(
|
|
1153
|
-
(
|
|
1161
|
+
(F) => F === a.valuationMethod
|
|
1154
1162
|
);
|
|
1155
|
-
|
|
1156
|
-
`Expected valuation method to be one of ${ve.options.join()} but got ${
|
|
1163
|
+
a.valuationMethod && !_ && l.push(
|
|
1164
|
+
`Expected valuation method to be one of ${ve.options.join()} but got ${a.valuationMethod} instead.`
|
|
1157
1165
|
);
|
|
1158
|
-
const b = fe().currentCountry.value, i = (
|
|
1166
|
+
const b = fe().currentCountry.value, i = (F) => `${F}`.length && Vt()(F) === !0, p = i(`${a.pricePerUnit}`) === !0 ? {
|
|
1159
1167
|
costPerUnit: {
|
|
1160
|
-
...qe(Number(
|
|
1168
|
+
...qe(Number(a.pricePerUnit) || 0),
|
|
1161
1169
|
currency: ((C = he(b)) == null ? void 0 : C.currency) ?? "MYR"
|
|
1162
1170
|
},
|
|
1163
1171
|
measurement: y
|
|
1164
|
-
} : void 0, D = i(`${
|
|
1165
|
-
low: Number(
|
|
1166
|
-
mid: Number(
|
|
1172
|
+
} : void 0, D = i(`${a.thresholdLow}`) && i(`${a.thresholdMid}`) ? {
|
|
1173
|
+
low: Number(a.thresholdLow) || 0,
|
|
1174
|
+
mid: Number(a.thresholdMid) || 0
|
|
1167
1175
|
} : void 0;
|
|
1168
1176
|
return {
|
|
1169
1177
|
type: "create",
|
|
1170
1178
|
sku: {
|
|
1171
1179
|
_id: vn(),
|
|
1172
|
-
code:
|
|
1173
|
-
name:
|
|
1174
|
-
unit: m ?? n.find((
|
|
1180
|
+
code: a.code,
|
|
1181
|
+
name: a.name,
|
|
1182
|
+
unit: m ?? n.find((F) => F) ?? fn,
|
|
1175
1183
|
trackingMeasurement: y == null ? void 0 : y.id,
|
|
1176
1184
|
valuation: _,
|
|
1177
1185
|
defaultCost: p,
|
|
1178
1186
|
thresholds: D
|
|
1179
1187
|
},
|
|
1180
1188
|
errors: l,
|
|
1181
|
-
excelRowNumber:
|
|
1189
|
+
excelRowNumber: r + 6
|
|
1182
1190
|
};
|
|
1183
1191
|
}
|
|
1184
|
-
function _n(
|
|
1192
|
+
function _n(a) {
|
|
1185
1193
|
try {
|
|
1186
|
-
const
|
|
1187
|
-
(_) => Ne(_.data, _.index,
|
|
1194
|
+
const r = hn(a).filter((_) => _.data.code), s = re().skus, n = st(s, "code"), l = r.filter((_) => !n[_.data.code]), o = r.filter((_) => n[_.data.code]), m = l.map(
|
|
1195
|
+
(_) => Ne(_.data, _.index, r)
|
|
1188
1196
|
), y = o.map((_) => {
|
|
1189
|
-
const x = Ne(_.data, _.index,
|
|
1197
|
+
const x = Ne(_.data, _.index, r), b = n[_.data.code];
|
|
1190
1198
|
return {
|
|
1191
1199
|
...x,
|
|
1192
1200
|
type: "update",
|
|
@@ -1209,10 +1217,10 @@ function _n(r) {
|
|
|
1209
1217
|
importCreateResult: m,
|
|
1210
1218
|
importUpdateResult: y
|
|
1211
1219
|
};
|
|
1212
|
-
} catch (
|
|
1220
|
+
} catch (r) {
|
|
1213
1221
|
return {
|
|
1214
1222
|
invalidExcel: !0,
|
|
1215
|
-
invalidExcelMessage: (
|
|
1223
|
+
invalidExcelMessage: (r == null ? void 0 : r.message) ?? "Invalid excel",
|
|
1216
1224
|
importCreateResult: [],
|
|
1217
1225
|
importUpdateResult: []
|
|
1218
1226
|
};
|
|
@@ -1229,8 +1237,8 @@ const xn = { class: "flex items-center gap-12 pl-8" }, Vn = { class: "flex flex-
|
|
|
1229
1237
|
name: {},
|
|
1230
1238
|
errors: {}
|
|
1231
1239
|
},
|
|
1232
|
-
setup(
|
|
1233
|
-
return (
|
|
1240
|
+
setup(a) {
|
|
1241
|
+
return (r, g) => {
|
|
1234
1242
|
const s = $("FmIcon"), n = $("FmTooltip");
|
|
1235
1243
|
return v(), R("div", xn, [
|
|
1236
1244
|
g[0] || (g[0] = u("div", null, "•", -1)),
|
|
@@ -1238,17 +1246,17 @@ const xn = { class: "flex items-center gap-12 pl-8" }, Vn = { class: "flex flex-
|
|
|
1238
1246
|
u("div", kn, [
|
|
1239
1247
|
u("div", {
|
|
1240
1248
|
class: le({
|
|
1241
|
-
"text-fm-color-system-error-300":
|
|
1249
|
+
"text-fm-color-system-error-300": r.errors.length
|
|
1242
1250
|
})
|
|
1243
1251
|
}, [
|
|
1244
|
-
He(N(
|
|
1245
|
-
|
|
1252
|
+
He(N(r.name) + " ", 1),
|
|
1253
|
+
r.type === "create" ? (v(), R("span", Sn, "(new)")) : H("", !0)
|
|
1246
1254
|
], 2),
|
|
1247
|
-
|
|
1255
|
+
r.errors.length ? (v(), R("div", Cn, [
|
|
1248
1256
|
f(n, { "z-index": 50 }, {
|
|
1249
1257
|
content: S(() => [
|
|
1250
1258
|
u("ol", null, [
|
|
1251
|
-
(v(!0), R(J, null, te(
|
|
1259
|
+
(v(!0), R(J, null, te(r.errors, (l, o) => (v(), R("li", { key: o }, N(l), 1))), 128))
|
|
1252
1260
|
])
|
|
1253
1261
|
]),
|
|
1254
1262
|
default: S(() => [
|
|
@@ -1266,38 +1274,38 @@ const xn = { class: "flex items-center gap-12 pl-8" }, Vn = { class: "flex flex-
|
|
|
1266
1274
|
class: le([
|
|
1267
1275
|
"fm-typo-en-body-sm-400",
|
|
1268
1276
|
{
|
|
1269
|
-
"text-fm-color-system-error-200":
|
|
1270
|
-
"text-fm-color-typo-secondary": !
|
|
1277
|
+
"text-fm-color-system-error-200": r.errors.length,
|
|
1278
|
+
"text-fm-color-typo-secondary": !r.errors.length
|
|
1271
1279
|
}
|
|
1272
1280
|
])
|
|
1273
|
-
}, N(
|
|
1281
|
+
}, N(r.code), 3)
|
|
1274
1282
|
])
|
|
1275
1283
|
]);
|
|
1276
1284
|
};
|
|
1277
1285
|
}
|
|
1278
|
-
}), wn = { class: "flex flex-col gap-24" },
|
|
1286
|
+
}), wn = { class: "flex flex-col gap-24" }, Fn = { class: "fm-typo-en-body-md-400" }, Mn = { class: "flex flex-col gap-8" }, In = { class: "line-clamp-2 text-ellipsis break-all" }, $n = {
|
|
1279
1287
|
key: 2,
|
|
1280
1288
|
class: "shrink-0"
|
|
1281
|
-
},
|
|
1289
|
+
}, Un = {
|
|
1282
1290
|
key: 0,
|
|
1283
1291
|
class: "flex flex-col"
|
|
1284
|
-
},
|
|
1292
|
+
}, En = { class: "text-fm-color-system-error-300 fm-typo-en-body-sm-400" }, Rn = {
|
|
1285
1293
|
key: 0,
|
|
1286
1294
|
class: "max-h-[200px] overflow-y-auto flex flex-col gap-8"
|
|
1287
1295
|
}, An = { class: "fm-typo-en-body-lg-600" }, Dn = /* @__PURE__ */ me({
|
|
1288
1296
|
__name: "ImportIngredients",
|
|
1289
|
-
setup(
|
|
1290
|
-
const
|
|
1297
|
+
setup(a) {
|
|
1298
|
+
const r = G(null), g = ut(), s = _e(), n = G(!1), l = G(new Array()), o = G([]), m = G([]), y = V(
|
|
1291
1299
|
() => !!l.value.length || o.value.some((i) => i.errors.length) || m.value.some((i) => i.errors.length)
|
|
1292
1300
|
), _ = V(
|
|
1293
1301
|
() => !!o.value.length || !!m.value.length
|
|
1294
|
-
), { t: x } =
|
|
1302
|
+
), { t: x } = ae();
|
|
1295
1303
|
async function b(i) {
|
|
1296
1304
|
l.value = [], o.value = [], m.value = [];
|
|
1297
1305
|
try {
|
|
1298
1306
|
n.value = !0;
|
|
1299
1307
|
const [p] = await Promise.all([
|
|
1300
|
-
|
|
1308
|
+
Ft(i),
|
|
1301
1309
|
// fake buffer
|
|
1302
1310
|
new Promise((L) => setTimeout(L, 1e3))
|
|
1303
1311
|
]), D = p.SheetNames.find((L) => L);
|
|
@@ -1328,26 +1336,26 @@ const xn = { class: "flex items-center gap-12 pl-8" }, Vn = { class: "flex flex-
|
|
|
1328
1336
|
}), n.value = !1;
|
|
1329
1337
|
}
|
|
1330
1338
|
}
|
|
1331
|
-
return ze(
|
|
1339
|
+
return ze(r, (i) => {
|
|
1332
1340
|
i && b(i);
|
|
1333
1341
|
}), (i, p) => {
|
|
1334
1342
|
const D = $("FmCircularProgress"), w = $("FmIcon"), L = $("FmButton");
|
|
1335
1343
|
return v(), R("div", wn, [
|
|
1336
|
-
u("div",
|
|
1337
|
-
f(
|
|
1344
|
+
u("div", Fn, N(d(x)("inventory.ingredient.import.uploadDescription")), 1),
|
|
1345
|
+
f(It, {
|
|
1338
1346
|
class: le({
|
|
1339
1347
|
"w-full": !0,
|
|
1340
|
-
"h-[200px]": !
|
|
1348
|
+
"h-[200px]": !r.value
|
|
1341
1349
|
}),
|
|
1342
1350
|
accept: ".xlsx",
|
|
1343
|
-
onFileUpload: p[0] || (p[0] = (C) =>
|
|
1351
|
+
onFileUpload: p[0] || (p[0] = (C) => r.value = C),
|
|
1344
1352
|
label: d(x)("inventory.ingredient.import.uploadTemplate"),
|
|
1345
1353
|
"button-label": d(x)("inventory.ingredient.import.selectFile")
|
|
1346
1354
|
}, Oe({ _: 2 }, [
|
|
1347
|
-
|
|
1355
|
+
r.value ? {
|
|
1348
1356
|
name: "default",
|
|
1349
1357
|
fn: S(({ openFileDialog: C }) => [
|
|
1350
|
-
u("div",
|
|
1358
|
+
u("div", Mn, [
|
|
1351
1359
|
u("div", {
|
|
1352
1360
|
class: le([
|
|
1353
1361
|
"fm-corner-radius-md p-16 flex items-center gap-16",
|
|
@@ -1377,7 +1385,7 @@ const xn = { class: "flex items-center gap-12 pl-8" }, Vn = { class: "flex flex-
|
|
|
1377
1385
|
}
|
|
1378
1386
|
])
|
|
1379
1387
|
}, [
|
|
1380
|
-
u("div",
|
|
1388
|
+
u("div", In, N(r.value.name), 1)
|
|
1381
1389
|
], 2),
|
|
1382
1390
|
n.value ? H("", !0) : (v(), R("div", $n, [
|
|
1383
1391
|
f(L, {
|
|
@@ -1388,9 +1396,9 @@ const xn = { class: "flex items-center gap-12 pl-8" }, Vn = { class: "flex flex-
|
|
|
1388
1396
|
}, null, 8, ["label", "variant", "prepend-icon", "onClick"])
|
|
1389
1397
|
]))
|
|
1390
1398
|
], 2),
|
|
1391
|
-
l.value.length ? (v(), R("div",
|
|
1392
|
-
(v(!0), R(J, null, te(l.value, (
|
|
1393
|
-
key:
|
|
1399
|
+
l.value.length ? (v(), R("div", Un, [
|
|
1400
|
+
(v(!0), R(J, null, te(l.value, (F, M) => (v(), R("div", {
|
|
1401
|
+
key: M,
|
|
1394
1402
|
class: "flex gap-8 items-center"
|
|
1395
1403
|
}, [
|
|
1396
1404
|
f(w, {
|
|
@@ -1398,7 +1406,7 @@ const xn = { class: "flex items-center gap-12 pl-8" }, Vn = { class: "flex flex-
|
|
|
1398
1406
|
size: "sm",
|
|
1399
1407
|
color: "system-error-300"
|
|
1400
1408
|
}),
|
|
1401
|
-
u("div",
|
|
1409
|
+
u("div", En, N(F), 1)
|
|
1402
1410
|
]))), 128))
|
|
1403
1411
|
])) : H("", !0)
|
|
1404
1412
|
])
|
|
@@ -1426,10 +1434,10 @@ const xn = { class: "flex items-center gap-12 pl-8" }, Vn = { class: "flex flex-
|
|
|
1426
1434
|
]);
|
|
1427
1435
|
};
|
|
1428
1436
|
}
|
|
1429
|
-
}), Tn = { class: "flex flex-col py-8" }, Pn = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Bn = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" },
|
|
1437
|
+
}), Tn = { class: "flex flex-col py-8" }, Pn = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Bn = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, ao = /* @__PURE__ */ me({
|
|
1430
1438
|
__name: "IngredientsView",
|
|
1431
|
-
setup(
|
|
1432
|
-
const
|
|
1439
|
+
setup(a) {
|
|
1440
|
+
const r = re(), g = V(() => r.skus), s = it(), n = Ye(), l = _e(), { t: o } = ae(), { createIngredient: m, updateIngredient: y } = Fe(), { ingredientDialogProps: _, ingredientViewLoading: x } = vt(Fe()), { columnDefs: b } = $t();
|
|
1433
1441
|
function i(T) {
|
|
1434
1442
|
switch (T) {
|
|
1435
1443
|
case "add":
|
|
@@ -1440,7 +1448,7 @@ const xn = { class: "flex items-center gap-12 pl-8" }, Vn = { class: "flex flex-
|
|
|
1440
1448
|
return O();
|
|
1441
1449
|
}
|
|
1442
1450
|
}
|
|
1443
|
-
const p =
|
|
1451
|
+
const p = G(""), D = G(!1), w = V(() => D.value || x.value), { breakpoints: L } = dt(), C = V(() => L.value.xs || L.value.sm), F = V(() => C.value ? 10 : 20), M = gt(), P = G(!1), X = [
|
|
1444
1452
|
{
|
|
1445
1453
|
value: "import",
|
|
1446
1454
|
label: o("common.import")
|
|
@@ -1511,7 +1519,7 @@ const xn = { class: "flex items-center gap-12 pl-8" }, Vn = { class: "flex flex-
|
|
|
1511
1519
|
});
|
|
1512
1520
|
return;
|
|
1513
1521
|
}
|
|
1514
|
-
if (T.importCreateResult.some((
|
|
1522
|
+
if (T.importCreateResult.some((E) => E.errors.length) || T.importUpdateResult.some((E) => E.errors.length)) {
|
|
1515
1523
|
l.open({
|
|
1516
1524
|
title: o("inventory.ingredient.import.error.invalidContent"),
|
|
1517
1525
|
message: o("inventory.ingredient.import.error.hasErrors"),
|
|
@@ -1525,7 +1533,7 @@ const xn = { class: "flex items-center gap-12 pl-8" }, Vn = { class: "flex flex-
|
|
|
1525
1533
|
async function se(T) {
|
|
1526
1534
|
D.value = !0;
|
|
1527
1535
|
try {
|
|
1528
|
-
const
|
|
1536
|
+
const E = [
|
|
1529
1537
|
...T.importCreateResult.map(({ sku: B }) => ({ type: "create", sku: B })),
|
|
1530
1538
|
...T.importUpdateResult.map(({ sku: B }) => ({ type: "update", sku: B }))
|
|
1531
1539
|
], ce = 100;
|
|
@@ -1533,33 +1541,33 @@ const xn = { class: "flex items-center gap-12 pl-8" }, Vn = { class: "flex flex-
|
|
|
1533
1541
|
const pe = () => {
|
|
1534
1542
|
ie += ce, l.open({
|
|
1535
1543
|
title: o("inventory.ingredient.import.progress", [
|
|
1536
|
-
Math.min(ie,
|
|
1537
|
-
|
|
1544
|
+
Math.min(ie, E.length),
|
|
1545
|
+
E.length
|
|
1538
1546
|
])
|
|
1539
1547
|
});
|
|
1540
1548
|
};
|
|
1541
|
-
for (const B of
|
|
1542
|
-
pe(), await
|
|
1543
|
-
create: B.filter((
|
|
1544
|
-
update: B.filter((
|
|
1549
|
+
for (const B of E.chunk(100))
|
|
1550
|
+
pe(), await r.importSkus({
|
|
1551
|
+
create: B.filter((q) => q.type === "create").map((q) => q.sku),
|
|
1552
|
+
update: B.filter((q) => q.type === "update").map((q) => q.sku)
|
|
1545
1553
|
});
|
|
1546
1554
|
l.open({
|
|
1547
1555
|
title: o("inventory.ingredient.import.success"),
|
|
1548
1556
|
type: "success"
|
|
1549
1557
|
});
|
|
1550
|
-
} catch (
|
|
1558
|
+
} catch (E) {
|
|
1551
1559
|
l.open({
|
|
1552
1560
|
title: o("inventory.ingredient.import.error.failed"),
|
|
1553
|
-
message: o("inventory.ingredient.import.error.systemMessage", [
|
|
1561
|
+
message: o("inventory.ingredient.import.error.systemMessage", [E == null ? void 0 : E.message]),
|
|
1554
1562
|
type: "error"
|
|
1555
|
-
}), console.error("Error in importing skus", T,
|
|
1563
|
+
}), console.error("Error in importing skus", T, E);
|
|
1556
1564
|
} finally {
|
|
1557
1565
|
D.value = !1;
|
|
1558
1566
|
}
|
|
1559
1567
|
}
|
|
1560
|
-
return (T,
|
|
1568
|
+
return (T, E) => {
|
|
1561
1569
|
const ce = $("FmTable"), ie = $("FmCollapsibleTabs"), pe = $("FmBottomSheet");
|
|
1562
|
-
return v(), A(
|
|
1570
|
+
return v(), A(bt, {
|
|
1563
1571
|
title: d(o)("inventory.ingredient.title"),
|
|
1564
1572
|
actions: j.value,
|
|
1565
1573
|
"onClick:action": i
|
|
@@ -1574,40 +1582,40 @@ const xn = { class: "flex items-center gap-12 pl-8" }, Vn = { class: "flex flex-
|
|
|
1574
1582
|
}
|
|
1575
1583
|
])
|
|
1576
1584
|
}, [
|
|
1577
|
-
f(
|
|
1585
|
+
f(ht, {
|
|
1578
1586
|
searchable: "",
|
|
1579
1587
|
search: p.value,
|
|
1580
|
-
"onUpdate:search":
|
|
1588
|
+
"onUpdate:search": E[0] || (E[0] = (B) => p.value = B)
|
|
1581
1589
|
}, null, 8, ["search"]),
|
|
1582
1590
|
f(ce, {
|
|
1583
|
-
style: ot(d(
|
|
1591
|
+
style: ot(d(M).tableHeight),
|
|
1584
1592
|
"column-defs": d(b),
|
|
1585
1593
|
"row-data": g.value,
|
|
1586
1594
|
"search-value": p.value,
|
|
1587
1595
|
loading: !d(s)._currentLocation || w.value,
|
|
1588
1596
|
"loading-text": "Loading",
|
|
1589
|
-
onRowClick:
|
|
1590
|
-
"page-size":
|
|
1597
|
+
onRowClick: E[1] || (E[1] = (B) => d(y)(B.original)),
|
|
1598
|
+
"page-size": F.value
|
|
1591
1599
|
}, {
|
|
1592
1600
|
"list-row": S((B) => [
|
|
1593
|
-
f(
|
|
1601
|
+
f(yt, {
|
|
1594
1602
|
row: B,
|
|
1595
1603
|
onRowClick: d(y)
|
|
1596
1604
|
}, Oe({
|
|
1597
|
-
default: S((
|
|
1598
|
-
var ne, ee, ye, oe, e, t, c, h,
|
|
1605
|
+
default: S((q) => {
|
|
1606
|
+
var ne, ee, ye, oe, e, t, c, h, U, I;
|
|
1599
1607
|
return [
|
|
1600
1608
|
u("div", Tn, [
|
|
1601
1609
|
u("div", Pn, [
|
|
1602
|
-
f(d(
|
|
1603
|
-
render: (ye = (ee = (ne =
|
|
1604
|
-
props: (e = (oe =
|
|
1610
|
+
f(d(Be), {
|
|
1611
|
+
render: (ye = (ee = (ne = q.code) == null ? void 0 : ne.column) == null ? void 0 : ee.columnDef) == null ? void 0 : ye.cell,
|
|
1612
|
+
props: (e = (oe = q.code) == null ? void 0 : oe.getContext) == null ? void 0 : e.call(oe)
|
|
1605
1613
|
}, null, 8, ["render", "props"])
|
|
1606
1614
|
]),
|
|
1607
1615
|
u("div", Bn, [
|
|
1608
|
-
f(d(
|
|
1609
|
-
render: (h = (c = (t =
|
|
1610
|
-
props: (
|
|
1616
|
+
f(d(Be), {
|
|
1617
|
+
render: (h = (c = (t = q.name) == null ? void 0 : t.column) == null ? void 0 : c.columnDef) == null ? void 0 : h.cell,
|
|
1618
|
+
props: (I = (U = q.name) == null ? void 0 : U.getContext) == null ? void 0 : I.call(U)
|
|
1611
1619
|
}, null, 8, ["render", "props"])
|
|
1612
1620
|
])
|
|
1613
1621
|
])
|
|
@@ -1628,19 +1636,19 @@ const xn = { class: "flex items-center gap-12 pl-8" }, Vn = { class: "flex flex-
|
|
|
1628
1636
|
}, 8, ["style", "column-defs", "row-data", "search-value", "loading", "page-size"])
|
|
1629
1637
|
], 2),
|
|
1630
1638
|
(v(), A(Re, { to: "body" }, [
|
|
1631
|
-
f(mn, lt(
|
|
1639
|
+
f(mn, lt(rt(d(_))), null, 16)
|
|
1632
1640
|
])),
|
|
1633
1641
|
(v(), A(Re, { to: "body" }, [
|
|
1634
1642
|
f(pe, {
|
|
1635
1643
|
"dismiss-away": "",
|
|
1636
1644
|
modelValue: P.value,
|
|
1637
|
-
"onUpdate:modelValue":
|
|
1645
|
+
"onUpdate:modelValue": E[3] || (E[3] = (B) => P.value = B)
|
|
1638
1646
|
}, {
|
|
1639
1647
|
default: S(() => [
|
|
1640
1648
|
f(ie, {
|
|
1641
1649
|
class: "pb-8",
|
|
1642
1650
|
items: X,
|
|
1643
|
-
"onUpdate:modelValue":
|
|
1651
|
+
"onUpdate:modelValue": E[2] || (E[2] = (B) => Z(B))
|
|
1644
1652
|
})
|
|
1645
1653
|
]),
|
|
1646
1654
|
_: 1
|
|
@@ -1653,5 +1661,5 @@ const xn = { class: "flex items-center gap-12 pl-8" }, Vn = { class: "flex flex-
|
|
|
1653
1661
|
}
|
|
1654
1662
|
});
|
|
1655
1663
|
export {
|
|
1656
|
-
|
|
1664
|
+
ao as default
|
|
1657
1665
|
};
|