@feedmepos/mf-inventory-portal 0.0.19-dev.2 → 0.0.19-dev.3

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