@feedmepos/mf-inventory-portal 0.0.17-dev.9 → 0.0.18-dev.2

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