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

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