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