@feedmepos/mf-inventory-portal 0.0.23-dev.38 → 0.0.23-dev.40

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