@feedmepos/mf-inventory-portal 1.2.10-dev.2 → 1.2.10-dev.4

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 (52) hide show
  1. package/dist/{App-BWhxmKHS.js → App-DE0rygXX.js} +1 -1
  2. package/dist/{ApprovalView-CWKSx6tf.js → ApprovalView-9H9G2OWv.js} +17 -17
  3. package/dist/{BindingsDialog-pf7Pseqo.js → BindingsDialog-BjXHdsGH.js} +2 -2
  4. package/dist/{BindingsPicker-DPF6fGOz.js → BindingsPicker-BijILjQH.js} +4 -4
  5. package/dist/{BindingsTable-BOwDjj1w.js → BindingsTable-DlSpPTRi.js} +1 -1
  6. package/dist/{ClosingDraftView-BdPBSsbx.js → ClosingDraftView-BaDkJuyF.js} +123 -123
  7. package/dist/{ClosingTemplateView-CrFwfxa0.js → ClosingTemplateView-CdESDzwA.js} +26 -26
  8. package/dist/{DeliveryOrderPrintPreview-M96uWAH1.js → DeliveryOrderPrintPreview-Bwrd33F_.js} +9 -9
  9. package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-BjdAAL2R.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-QlB_K9Yi.js} +16 -16
  10. package/dist/{FmMultiselectDialog-BR3zi2Qz.js → FmMultiselectDialog-CLxZbi3l.js} +4 -4
  11. package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-rT6wwbOn.js → FmUnitInput.vue_vue_type_script_setup_true_lang-B6TbIvQI.js} +43 -43
  12. package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-DXzgrzX9.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-CtLFZtQZ.js} +7 -7
  13. package/dist/{IngredientGroupView-CEqIGjmQ.js → IngredientGroupView-DXQ2TKjI.js} +13 -13
  14. package/dist/IngredientsView-FLCGHbsn.js +2467 -0
  15. package/dist/{IntegrationView-CFguVXIq.js → IntegrationView-BKI0tf68.js} +24 -25
  16. package/dist/{InventoryBindingForm-KKLzZfag.js → InventoryBindingForm-BGov_1MJ.js} +1 -1
  17. package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-D1F8sNi4.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-4IM7dQuV.js} +12 -12
  18. package/dist/{InventoryBindingSummary-ypHlF4-M.js → InventoryBindingSummary-BQA0Sm_K.js} +1 -1
  19. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-BHTULAxS.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-Bc5diF2E.js} +1 -1
  20. package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-qOPiI7X6.js → PremiumBadge.vue_vue_type_script_setup_true_lang-s529wQrr.js} +1 -1
  21. package/dist/{PublishView-Dg9HHIt8.js → PublishView-DhZ5eMg0.js} +19 -19
  22. package/dist/{PurchaseOrderPrintPreview-NT9bddXA.js → PurchaseOrderPrintPreview-cMNE8VTL.js} +7 -7
  23. package/dist/{ReceiveRequestView-BqvQC4Yv.js → ReceiveRequestView-Cv-Cgi_o.js} +80 -80
  24. package/dist/{RecipeView-Cq8bWv-p.js → RecipeView-ipT51Tbl.js} +39 -39
  25. package/dist/{StockView-B8Sg9MkB.js → StockView-CKok9_oG.js} +839 -831
  26. package/dist/SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-BnAwlQE1.js +172 -0
  27. package/dist/{SupplierView-B6PJPIjW.js → SupplierView-cGpKVDGP.js} +4 -4
  28. package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-CusQL6MO.js → TransferDetails.vue_vue_type_script_setup_true_lang-0ule7sK7.js} +11 -12
  29. package/dist/{TransferTemplateView-Q76fWi4K.js → TransferTemplateView-DrlLa0ed.js} +109 -109
  30. package/dist/{UnitView-Bcd_C1qi.js → UnitView-YFAtJ0CL.js} +16 -16
  31. package/dist/{WarehouseView-DhkwuXWo.js → WarehouseView-CV5pg-4p.js} +16 -16
  32. package/dist/{app-BLEVBe_A.js → app-CUMtg_U0.js} +11575 -11496
  33. package/dist/app.js +1 -1
  34. package/dist/{closing-template-C7_dXuIo.js → closing-template-Cyva214n.js} +1 -1
  35. package/dist/components/FmInventoryTableToolbar.vue.d.ts +7 -0
  36. package/dist/components/netsuite/ItemSubsidiaryTreeDialog.vue.d.ts +16 -0
  37. package/dist/{decimal-8MxI03d0.js → decimal-117ZlAfM.js} +1 -1
  38. package/dist/{format-unit-display-CerhQXAR.js → format-unit-display-BXHj4DAV.js} +3 -3
  39. package/dist/{index-sEpAJ9CK.js → index-Da1f9OoS.js} +1 -1
  40. package/dist/{index-D-yaA6J1.js → index-PWnt_za9.js} +1 -1
  41. package/dist/{purchase-order-template-BkCYKaeL.js → purchase-order-template-AWsxLxPR.js} +1 -1
  42. package/dist/{stock-CXhe_jH3.js → stock-D7EiEqJe.js} +1 -1
  43. package/dist/stores/integration/netsuite.d.ts +25 -3
  44. package/dist/style.css +1 -1
  45. package/dist/{supplier-DxTkTi0f.js → supplier-DQmyhp0R.js} +1 -1
  46. package/dist/tsconfig.app.tsbuildinfo +1 -1
  47. package/dist/{use-ingredient-select-dialog-lmLojXEr.js → use-ingredient-select-dialog-C37DLY6c.js} +4 -4
  48. package/dist/{use-inventory-binding-dialog-DAMV-jsc.js → use-inventory-binding-dialog-CmZereh8.js} +1 -1
  49. package/package.json +1 -1
  50. package/dist/FmAdminBadge-yFwlzxM2.js +0 -44
  51. package/dist/IngredientsView-BjXPJZ3X.js +0 -2313
  52. package/dist/SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-DAWM5EXt.js +0 -158
@@ -1,2313 +0,0 @@
1
- import { ref as B, h as K, defineComponent as ye, computed as k, resolveComponent as C, openBlock as f, createBlock as N, withCtx as w, createVNode as m, unref as a, createElementBlock as E, Fragment as X, createElementVNode as d, createCommentVNode as L, renderSlot as Se, createTextVNode as Ge, toDisplayString as R, normalizeClass as ae, mergeModels as dt, onMounted as jt, watch as wt, useModel as Ht, renderList as ie, isRef as ct, createSlots as Tt, normalizeStyle as Wt, Teleport as mt, normalizeProps as Yt, guardReactiveProps as qt } from "vue";
2
- import { a as ue, e as H, f as Vt, S as Gt, b as De, h as Kt, D as pt, i as Re, A as Oe, j as It, k as St, l as Be, t as Ct, m as Jt, n as Fe, o as Le, U as Qt, p as Zt, M as Xt, q as vt, r as ft, c as Ke, s as je, _ as en, v as yt, w as tn, x as gt, y as Ft, z as nn, B as Mt, C as on, E as ln, I as an, G as sn, H as rn, N as un, J as dn, u as cn, K as mn, L as pn, O as vn, P as fn, Q as bt, T as yn } from "./app-BLEVBe_A.js";
3
- import { useDialog as Je, useSnackbar as Me, components as Pe, useProxiedModel as ht, useDialogChild as gn, useBreakpoints as bn } from "@feedmepos/ui-library";
4
- import { i as hn, _ as _n } from "./is-linked-ingredient-error-fJ2TJb3z.js";
5
- import { useI18n as ge, useCoreStore as Ee } from "@feedmepos/mf-common";
6
- import { defineStore as xn, storeToRefs as kn } from "pinia";
7
- import { g as wn, _ as He, S as We, a as Tn } from "./SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-DAWM5EXt.js";
8
- import { _ as Vn } from "./InventoryBindingForm.vue_vue_type_script_setup_true_lang-D1F8sNi4.js";
9
- import { _ as Ye } from "./IngredientBindedItem.vue_vue_type_script_setup_true_lang-DXzgrzX9.js";
10
- import { _ as fe } from "./PreviewBadge.vue_vue_type_script_setup_true_lang-CRZiQHjx.js";
11
- import { _ as In } from "./FmCustomAttribute.vue_vue_type_script_setup_true_lang-D-IWRjRD.js";
12
- import { u as Et } from "./purchase-order-template-BkCYKaeL.js";
13
- import { u as At } from "./closing-template-C7_dXuIo.js";
14
- import { r as Sn } from "./random-CSbEbElR.js";
15
- import "./array-Ca8T3f_G.js";
16
- import { u as Cn } from "./FmMultiselectDialog-BR3zi2Qz.js";
17
- const qe = xn("ingredientForm", function() {
18
- const o = Je(), v = Me(), l = ue(), c = B(!1), { t: g } = ge(), _ = B();
19
- function y() {
20
- const r = {
21
- sku: {},
22
- mode: H.CREATE,
23
- show: !0,
24
- "onUpdate:show"(i) {
25
- _.value.show = i;
26
- }
27
- };
28
- _.value = r;
29
- }
30
- async function n(r) {
31
- const i = {
32
- sku: Vt(r),
33
- mode: H.UPDATE,
34
- show: !0,
35
- "onUpdate:show"(T) {
36
- _.value.show = T;
37
- }
38
- };
39
- _.value = i;
40
- }
41
- async function s(r) {
42
- c.value = !0;
43
- try {
44
- await l.deleteSku(r), v.open({
45
- title: "Success",
46
- message: `Deleted ${r.name}`,
47
- type: "success"
48
- });
49
- } catch (i) {
50
- i instanceof Gt && hn(i) ? o.open({
51
- title: "Cannot delete ingredient",
52
- contentComponent: _n,
53
- contentComponentProps: {
54
- subject: (r == null ? void 0 : r.name) ?? "",
55
- items: i.errorResponse.message
56
- },
57
- secondaryActions: {
58
- text: "Close",
59
- close: !0
60
- }
61
- }) : console.log("unable to delete ingredient", i), v.open({
62
- title: `Cannot delete ${r.name}`,
63
- message: "Please try again.",
64
- type: "error"
65
- }), console.error("failed to delete ingredient", i);
66
- } finally {
67
- c.value = !1;
68
- }
69
- }
70
- function p(r) {
71
- o.open({
72
- title: g("inventory.ingredient.delete.title", [(r == null ? void 0 : r.name) ?? ""]),
73
- closeButton: !1,
74
- message: g("inventory.ingredient.delete.message"),
75
- primaryActions: {
76
- text: g("common.delete"),
77
- close: !0,
78
- variant: "destructive"
79
- },
80
- secondaryActions: {
81
- text: g("common.cancel"),
82
- close: !0
83
- }
84
- }).onPrimary(() => s(r));
85
- }
86
- return {
87
- createIngredient: y,
88
- updateIngredient: n,
89
- deleteIngredient: p,
90
- ingredientDialogProps: _,
91
- ingredientViewLoading: c
92
- };
93
- });
94
- function Fn() {
95
- const { updateIngredient: u, deleteIngredient: o } = qe(), v = ue(), l = De(), { t: c } = ge();
96
- async function g(y, n) {
97
- const s = Vt(n);
98
- if (y === Re.Edit) {
99
- await u(s);
100
- return;
101
- }
102
- if (y === Re.Delete) {
103
- await o(s);
104
- return;
105
- }
106
- }
107
- return { columnDefs: [
108
- {
109
- accessorKey: "code",
110
- header: () => c("inventory.ingredient.code"),
111
- enableSorting: !0,
112
- size: 300
113
- },
114
- {
115
- accessorKey: "name",
116
- header: () => c("inventory.ingredient.name"),
117
- enableSorting: !0,
118
- size: 300,
119
- cell(y) {
120
- const n = y.row.original, s = v.skuBindingFlattenCache[n._id], p = s == null ? void 0 : s.inventoryBindings.some(
121
- (r) => "error" in r && r.reason === "circularDependency"
122
- );
123
- return K("div", { class: "flex items-center w-full gap-4" }, [
124
- p ? K(
125
- Pe.FmTooltip,
126
- { class: "text-left" },
127
- {
128
- default() {
129
- return K(Pe.FmIcon, {
130
- name: "info",
131
- color: "system-error-300",
132
- size: "sm"
133
- });
134
- },
135
- content() {
136
- return c("inventory.inventoryBindings.circularError");
137
- }
138
- }
139
- ) : null,
140
- n.name
141
- ]);
142
- }
143
- },
144
- {
145
- id: "unit",
146
- header: () => c("inventory.ingredient.unit"),
147
- accessorFn: (y) => _t(y),
148
- cell(y) {
149
- const n = y.row.original, s = _t(n);
150
- return K(
151
- Pe.FmTooltip,
152
- { zIndex: 51, content: s },
153
- K(
154
- "span",
155
- {
156
- class: "flex-auto line-clamp-2 text-ellipsis break-all"
157
- },
158
- s
159
- )
160
- );
161
- },
162
- enableSorting: !1,
163
- size: "auto"
164
- },
165
- {
166
- accessorKey: "isInactive",
167
- header: () => c("inventory.ingredient.status.title"),
168
- cell(y) {
169
- const n = y.row.original.isInactive;
170
- return K(
171
- "span",
172
- {
173
- class: [
174
- "inline-block px-3 py-1 rounded-full text-xs font-semibold",
175
- n ? "bg-red-100 text-red-700" : "bg-green-100 text-green-700"
176
- ].join(" ")
177
- },
178
- c(n ? "inventory.ingredient.status.inactive" : "inventory.ingredient.status.active")
179
- );
180
- },
181
- enableSorting: !0
182
- },
183
- {
184
- accessorKey: "netsuiteSubsidiary",
185
- header: () => "NetSuite Subsidiary",
186
- cell(y) {
187
- const n = y.row.original, { includeChildren: s, subsidiaryNames: p } = l.getSkuSubsidiaries(n._id);
188
- return K(
189
- Pe.FmTooltip,
190
- { zIndex: 51, variant: "rich" },
191
- {
192
- default: () => K(
193
- "span",
194
- {
195
- class: "flex-auto line-clamp-2 text-ellipsis break-all whitespace-pre-wrap"
196
- },
197
- p.join(", ")
198
- ),
199
- content: () => K("div", { class: "flex flex-col" }, [
200
- K("div", { class: "font-semibold" }, [
201
- s ? K("span", { class: "text-green-500" }, "Include ") : K("span", { class: "text-red-500" }, "Not Include "),
202
- "Children Subsidiaries"
203
- ]),
204
- K(
205
- "ul",
206
- { class: "text-left pb-2" },
207
- p.map(
208
- (r) => K(
209
- "li",
210
- {
211
- class: "my-1 p-1 rounded bg-fm-color-system-info-100 text-fm-color-neutral-black"
212
- },
213
- r
214
- )
215
- )
216
- )
217
- ])
218
- }
219
- );
220
- },
221
- enableSorting: !1,
222
- size: "auto"
223
- },
224
- {
225
- id: "action",
226
- header: "",
227
- cell(y) {
228
- return Kt(
229
- [pt[Re.Edit], pt[Re.Delete]],
230
- (n) => {
231
- g(n, y.row.original);
232
- }
233
- );
234
- },
235
- enableSorting: !1,
236
- size: 40,
237
- meta: {
238
- cellClass: "",
239
- headerClass: ""
240
- }
241
- }
242
- ] };
243
- }
244
- function _t(u) {
245
- var o;
246
- if (u.trackingMeasurement) {
247
- const v = (o = u.unit.measurements) == null ? void 0 : o.find((l) => l.id === u.trackingMeasurement);
248
- if (v)
249
- return `${v.name} (${v.abbrev})`;
250
- }
251
- return `${u.unit.name} (${u.unit.abbrev})`;
252
- }
253
- const Mn = /* @__PURE__ */ ye({
254
- __name: "ConvertForm",
255
- props: {
256
- modelValue: {},
257
- rootValue: {},
258
- disabled: { type: Boolean },
259
- readonly: { type: Boolean }
260
- },
261
- emits: ["update:modelValue"],
262
- setup(u, { emit: o }) {
263
- const v = u, l = k(() => {
264
- var i;
265
- return (i = v.rootValue) == null ? void 0 : i.unit;
266
- }), c = k(() => {
267
- var i;
268
- return (i = v.rootValue) == null ? void 0 : i._id;
269
- }), g = o, { t: _ } = ge(), y = k({
270
- get() {
271
- return !!v.modelValue;
272
- },
273
- set(i) {
274
- i ? g("update:modelValue", {
275
- measurement: null,
276
- inventoryBindings: []
277
- }) : g("update:modelValue", null);
278
- }
279
- }), n = k(() => wn(l.value));
280
- function s(i) {
281
- const T = v.modelValue ?? {};
282
- T.measurement = i ? `${i}` : null, g("update:modelValue", T);
283
- }
284
- function p(i) {
285
- const T = v.modelValue ?? {};
286
- T.inventoryBindings = i, g("update:modelValue", T);
287
- }
288
- const r = k(() => {
289
- if (!v.modelValue) return null;
290
- const i = v.modelValue;
291
- return i.measurement ? n.value.find((T) => T.value === i.measurement) ?? null : n.value.find((T) => T.value === null) ?? null;
292
- });
293
- return (i, T) => {
294
- const $ = C("FmSwitch"), O = C("FmSelect"), q = C("FmCard");
295
- return f(), N(q, {
296
- variant: "outlined",
297
- class: "p-16 flex flex-col gap-16"
298
- }, {
299
- default: w(() => {
300
- var P, j;
301
- return [
302
- m($, {
303
- value: "",
304
- "model-value": y.value,
305
- "onUpdate:modelValue": T[0] || (T[0] = (V) => y.value = V),
306
- label: a(_)("inventory.ingredient.convertible.title"),
307
- sublabel: a(_)("inventory.ingredient.convertible.subtitle"),
308
- labelPlacement: "right",
309
- disabled: i.readonly
310
- }, null, 8, ["model-value", "label", "sublabel", "disabled"]),
311
- y.value ? (f(), E(X, { key: 0 }, [
312
- d("div", null, [
313
- m(O, {
314
- label: a(_)("inventory.ingredient.convertible.convertTo"),
315
- modelValue: (P = r.value) == null ? void 0 : P.value,
316
- "onUpdate:modelValue": s,
317
- items: n.value,
318
- disabled: i.readonly
319
- }, null, 8, ["label", "modelValue", "items", "disabled"])
320
- ]),
321
- m(Vn, {
322
- id: c.value,
323
- "model-value": ((j = i.modelValue) == null ? void 0 : j.inventoryBindings) ?? [],
324
- "onUpdate:modelValue": p,
325
- "exclude-binding-id": c.value,
326
- rules: [a(Oe)(1)],
327
- readonly: i.readonly
328
- }, null, 8, ["id", "model-value", "exclude-binding-id", "rules", "readonly"])
329
- ], 64)) : L("", !0)
330
- ];
331
- }),
332
- _: 1
333
- });
334
- };
335
- }
336
- });
337
- function xe() {
338
- return {
339
- low: 6,
340
- mid: 14
341
- };
342
- }
343
- const En = {
344
- key: 0,
345
- class: "flex flex-col gap-4"
346
- }, Ce = /* @__PURE__ */ ye({
347
- __name: "FmLockableField",
348
- props: {
349
- locked: { type: Boolean },
350
- disabled: { type: Boolean },
351
- label: {},
352
- helperText: {},
353
- modelValue: {},
354
- tooltipMessage: {},
355
- tooltipPlacement: {},
356
- tooltipZIndex: {}
357
- },
358
- setup(u) {
359
- return (o, v) => {
360
- const l = C("FmLabel"), c = C("FmIcon"), g = C("FmTooltip"), _ = C("FmField");
361
- return o.locked ? (f(), E("div", En, [
362
- Se(o.$slots, "label", {}, () => [
363
- m(l, {
364
- label: o.label,
365
- disabled: o.disabled
366
- }, null, 8, ["label", "disabled"])
367
- ]),
368
- Se(o.$slots, "field", {}, () => [
369
- m(_, { disabled: o.disabled }, {
370
- prepend: w(() => [
371
- o.tooltipMessage ? (f(), N(g, {
372
- key: 0,
373
- placement: o.tooltipPlacement,
374
- "z-index": o.tooltipZIndex
375
- }, {
376
- content: w(() => [
377
- Ge(R(o.tooltipMessage), 1)
378
- ]),
379
- default: w(() => [
380
- m(c, {
381
- name: "lock",
382
- color: "neutral-gray-400"
383
- })
384
- ]),
385
- _: 1
386
- }, 8, ["placement", "z-index"])) : (f(), N(c, {
387
- key: 1,
388
- name: "lock",
389
- color: "neutral-gray-400"
390
- }))
391
- ]),
392
- default: w(() => [
393
- Se(o.$slots, "modelValue", {}, () => [
394
- d("div", {
395
- class: ae([
396
- o.disabled ? "text-fm-color-typo-disabled" : "text-fm-color-typo-primary",
397
- "line-clamp-1 text-ellipsis break-all"
398
- ])
399
- }, R(o.modelValue), 3)
400
- ])
401
- ]),
402
- _: 3
403
- }, 8, ["disabled"])
404
- ]),
405
- Se(o.$slots, "helper-text", {}, () => [
406
- d("div", {
407
- class: ae([
408
- "fm-typo-en-body-sm-400 line-clamp-1",
409
- o.disabled ? "text-fm-color-typo-disabled" : "text-fm-color-typo-secondary"
410
- ])
411
- }, R(o.helperText), 3)
412
- ])
413
- ])) : Se(o.$slots, "default", { key: 1 });
414
- };
415
- }
416
- }), An = { class: "flex gap-8" }, $n = { class: "flex-1" }, Un = { class: "flex-1" }, Rn = { class: "flex flex-col gap-5" }, Pn = { class: "text-fm-color-typo-secondary" }, On = { class: "text-fm-color-typo-secondary whitespace-nowrap" }, Bn = {
417
- key: 3,
418
- class: "border-1 border-fm-color-neutral-gray-200 fm-corner-radius-lg flex flex-col p-16 gap-16"
419
- }, Dn = { class: "flex flex-col" }, Nn = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, zn = {
420
- key: 4,
421
- class: "border-1 border-fm-color-neutral-gray-200 fm-corner-radius-lg flex flex-col p-16 gap-16"
422
- }, Ln = { class: "flex flex-col gap-12" }, jn = { class: "flex flex-col gap-4" }, Hn = { class: "fm-typo-en-title-sm-600" }, Wn = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Yn = { class: "flex flex-col gap-4" }, qn = { class: "flex fm-corner-radius-md border-1 border-fm-color-neutral-gray-200" }, Gn = { class: "flex-1 p-12 flex flex-col gap-8" }, Kn = { class: "mx-auto" }, Jn = { class: "flex flex-col" }, Qn = { class: "fm-typo-en-body-sm-600 translate-y-4" }, Zn = { class: "flex-1 p-12 flex flex-col gap-8" }, Xn = { class: "mx-auto" }, eo = { class: "flex flex-col" }, to = { class: "fm-typo-en-body-sm-600 translate-y-4" }, no = { class: "flex-1 p-12 flex flex-col gap-8" }, oo = { class: "mx-auto" }, lo = { class: "flex flex-col" }, ao = { class: "fm-typo-en-body-sm-600 translate-y-4" }, so = {
423
- key: 5,
424
- class: "flex flex-col gap-12"
425
- }, ro = { class: "flex flex-col" }, io = { class: "flex items-center justify-between" }, uo = { class: "fm-typo-en-title-sm-600" }, co = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, mo = {
426
- key: 0,
427
- class: "flex flex-col gap-8"
428
- }, po = { class: "flex flex-wrap gap-8" }, vo = {
429
- key: 6,
430
- class: "flex flex-col gap-12"
431
- }, fo = { class: "flex flex-col" }, yo = { class: "flex items-center justify-between" }, go = { class: "fm-typo-en-title-sm-600" }, bo = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, ho = {
432
- key: 0,
433
- class: "flex flex-col gap-8"
434
- }, _o = { class: "flex flex-wrap gap-8" }, xo = {
435
- key: 7,
436
- class: "flex flex-col gap-12"
437
- }, ko = { class: "flex flex-col" }, wo = { class: "flex items-center justify-between" }, To = { class: "fm-typo-en-title-sm-600" }, Vo = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Io = {
438
- key: 0,
439
- class: "flex flex-col gap-8"
440
- }, So = { class: "flex flex-wrap gap-8" }, Co = /* @__PURE__ */ ye({
441
- __name: "IngredientForm",
442
- props: /* @__PURE__ */ dt({
443
- mode: {},
444
- modelValue: {},
445
- disabled: { type: Boolean },
446
- purchaseOrderTemplateIds: {},
447
- wastageTemplateIds: {},
448
- closingTemplateIds: {}
449
- }, {
450
- search: {},
451
- searchModifiers: {}
452
- }),
453
- emits: /* @__PURE__ */ dt(["update:modelValue", "click:submit", "update:purchaseOrderTemplateIds", "update:wastageTemplateIds", "update:closingTemplateIds"], ["update:search"]),
454
- setup(u, { expose: o, emit: v }) {
455
- var nt;
456
- const { t: l } = ge(), c = Je();
457
- Me();
458
- const g = Et(), _ = It(), y = At(), n = u, s = v, p = ue(), r = Ee(), i = Ke(), T = De(), $ = k(() => T.isEnabled);
459
- B(void 0);
460
- const O = B([]), q = B([]), P = B([]), j = B(!1);
461
- function V(e) {
462
- if (e.length === 0) return;
463
- const t = e[0], x = n.modelValue ?? {
464
- unit: p.units.find((S) => S)
465
- };
466
- x.unit || (x.unit = t, s("update:modelValue", x));
467
- }
468
- jt(() => {
469
- V(p.units), n.mode === H.CREATE && (i.mustUsePoTemplate && de(), i.enableWastageTemplate && be(), i.enableClosingTemplate && ce());
470
- }), wt([() => p.units], ([e]) => {
471
- V(e);
472
- });
473
- function ke() {
474
- s("click:submit");
475
- }
476
- async function de() {
477
- O.value = [], j.value = !0;
478
- try {
479
- const [e] = await Promise.all([g.readTemplates()]).delayed(1e3);
480
- O.value = e;
481
- } catch (e) {
482
- console.log("Something went wrong when fetching templates:", e);
483
- } finally {
484
- j.value = !1;
485
- }
486
- }
487
- async function be() {
488
- q.value = [], j.value = !0;
489
- try {
490
- const [e] = await Promise.all([_.readTemplates()]).delayed(
491
- 1e3
492
- );
493
- q.value = e;
494
- } catch (e) {
495
- console.log("Something went wrong when fetching wastage templates:", e);
496
- } finally {
497
- j.value = !1;
498
- }
499
- }
500
- async function ce() {
501
- P.value = [], j.value = !0;
502
- try {
503
- const [e] = await Promise.all([y.readTemplates()]).delayed(
504
- 1e3
505
- );
506
- P.value = e;
507
- } catch (e) {
508
- console.log("Something went wrong when fetching closing templates:", e);
509
- } finally {
510
- j.value = !1;
511
- }
512
- }
513
- const se = k({
514
- get() {
515
- var e;
516
- return ((e = n.modelValue) == null ? void 0 : e.code) ?? "";
517
- },
518
- set(e) {
519
- const t = n.modelValue ? {
520
- ...n.modelValue
521
- } : {};
522
- t.code = e, s("update:modelValue", t);
523
- }
524
- }), he = k({
525
- get() {
526
- var e;
527
- return ((e = n.modelValue) == null ? void 0 : e.isInactive) ?? !1;
528
- },
529
- set(e) {
530
- const t = n.modelValue ? {
531
- ...n.modelValue
532
- } : {};
533
- t.isInactive = e, s("update:modelValue", t);
534
- }
535
- }), ee = k({
536
- get() {
537
- var e;
538
- return ((e = n.modelValue) == null ? void 0 : e.name) ?? "";
539
- },
540
- set(e) {
541
- const t = n.modelValue ? {
542
- ...n.modelValue
543
- } : {};
544
- t.name = e, s("update:modelValue", t);
545
- }
546
- }), me = k({
547
- get() {
548
- var t, x;
549
- const e = (x = (t = n.modelValue) == null ? void 0 : t.defaultCost) == null ? void 0 : x.costPerUnit;
550
- return e ? +St(e) : 0;
551
- },
552
- set(e) {
553
- var x, S, Y, D;
554
- const t = n.modelValue ? {
555
- ...n.modelValue
556
- } : {};
557
- t.defaultCost ?? (t.defaultCost = {
558
- costPerUnit: {
559
- amount: 0,
560
- precision: 2,
561
- currency: ((x = Be(r.currentCountry.value)) == null ? void 0 : x.currency) ?? "MYR"
562
- },
563
- measurement: (D = (Y = (S = n.modelValue) == null ? void 0 : S.unit) == null ? void 0 : Y.measurements) == null ? void 0 : D.find(
564
- (ne) => {
565
- var oe;
566
- return ne.id === ((oe = n.modelValue) == null ? void 0 : oe.trackingMeasurement);
567
- }
568
- )
569
- }), t.defaultCost.costPerUnit = {
570
- ...t.defaultCost.costPerUnit,
571
- ...Ct(+e, 4)
572
- }, s("update:modelValue", t);
573
- }
574
- }), pe = k(() => {
575
- var t, x, S;
576
- const e = ((t = n.modelValue) == null ? void 0 : t.unit) ?? p.units.find((Y) => Y);
577
- return e ? {
578
- _id: e._id,
579
- measurement: (x = n.modelValue) == null ? void 0 : x.trackingMeasurement,
580
- name: ((S = e.measurements.find((Y) => {
581
- var D;
582
- return Y.id === ((D = n.modelValue) == null ? void 0 : D.trackingMeasurement);
583
- })) == null ? void 0 : S.name) ?? e.name
584
- } : null;
585
- }), we = k(
586
- () => p.units.flatMap(({ name: e, _id: t, abbrev: x, measurements: S }) => [
587
- {
588
- label: `${e}`,
589
- value: null,
590
- displayAsSection: !0
591
- },
592
- {
593
- label: `${e} (${x})`,
594
- value: { _id: t },
595
- displayAsSection: !1
596
- },
597
- ...S.map(({ id: Y, name: D, abbrev: ne }) => ({
598
- label: `${D} (${ne})`,
599
- value: { _id: t, measurement: Y },
600
- displayAsSection: !1
601
- }))
602
- ])
603
- ), h = Ht(u, "search"), A = k(
604
- () => new Jt(we.value, ["label", "value"], {
605
- caseSensitive: !1,
606
- sort: !0
607
- })
608
- ), G = k(() => A.value.search(h.value));
609
- function F(e) {
610
- var t, x, S, Y, D;
611
- return ((x = (t = n.modelValue) == null ? void 0 : t.unit) == null ? void 0 : x._id) === ((S = e.value) == null ? void 0 : S._id) && ((Y = n.modelValue) == null ? void 0 : Y.trackingMeasurement) === ((D = e.value) == null ? void 0 : D.measurement);
612
- }
613
- function b(e) {
614
- var ne, oe;
615
- if (!e) return;
616
- const { _id: t, measurement: x } = e, S = x || void 0, Y = p.units.find((Ie) => Ie._id === t);
617
- if (!Y)
618
- return;
619
- const D = n.modelValue ?? {};
620
- D.unit = Y, D.trackingMeasurement = S, D.convert && (D.convert.measurement = S || null), i.enableTotalCost && (D.defaultCost = {
621
- measurement: Y.measurements.find((Ie) => Ie.id === S),
622
- costPerUnit: {
623
- ...((ne = D.defaultCost) == null ? void 0 : ne.costPerUnit) ?? {
624
- amount: 0,
625
- precision: 2,
626
- currency: ((oe = Be(r.currentCountry.value)) == null ? void 0 : oe.currency) ?? "MYR"
627
- }
628
- }
629
- }), s("update:modelValue", D);
630
- }
631
- const z = k({
632
- get() {
633
- var e;
634
- return ((e = n.modelValue) == null ? void 0 : e.convert) ?? null;
635
- },
636
- set(e) {
637
- const t = n.modelValue ? {
638
- ...n.modelValue
639
- } : {};
640
- e ? t.convert = e : t.convert = null, s("update:modelValue", t);
641
- }
642
- }), J = k(() => Fe.options.filter(
643
- (e) => e === Fe.enum.FIFO || e === Fe.enum.WAVG
644
- ).map((e) => ({
645
- label: l(`inventory.ingredient.valuationMethod.${e}`),
646
- value: e
647
- }))), re = k({
648
- get() {
649
- var e;
650
- return ((e = n.modelValue) == null ? void 0 : e.valuation) ?? "WAVG";
651
- },
652
- set(e) {
653
- const t = n.modelValue ? {
654
- ...n.modelValue
655
- } : {};
656
- t.valuation = e, s("update:modelValue", t);
657
- }
658
- }), Q = k({
659
- get() {
660
- var e;
661
- return ((e = n.modelValue) == null ? void 0 : e.customAttributes) ?? {};
662
- },
663
- set(e) {
664
- const t = n.modelValue ? {
665
- ...n.modelValue
666
- } : {};
667
- t.customAttributes = e, s("update:modelValue", t);
668
- }
669
- }), M = B();
670
- o({
671
- validateInputs: () => {
672
- var e, t;
673
- (t = (e = M.value) == null ? void 0 : e.validateInputs) == null || t.call(e);
674
- },
675
- resetInputsValidation: () => {
676
- var e, t;
677
- (t = (e = M.value) == null ? void 0 : e.resetInputsValidation) == null || t.call(e);
678
- },
679
- resetInputs: () => {
680
- var e, t;
681
- (t = (e = M.value) == null ? void 0 : e.resetInputs) == null || t.call(e);
682
- }
683
- });
684
- const U = B(!1), W = k(
685
- () => {
686
- var e, t, x;
687
- return (e = n.modelValue) != null && e._id ? ((x = p.menu.bindedBySkuId[(t = n.modelValue) == null ? void 0 : t._id]) == null ? void 0 : x.filter(
688
- (S) => S.from === "INGREDIENT"
689
- )) ?? [] : [];
690
- }
691
- ), le = k(
692
- () => {
693
- var e, t, x;
694
- return (e = n.modelValue) != null && e._id ? ((x = p.menu.bindedBySkuId[(t = n.modelValue) == null ? void 0 : t._id]) == null ? void 0 : x.filter(
695
- (S) => S.from === "RECIPE"
696
- )) ?? [] : [];
697
- }
698
- ), Te = k(
699
- () => {
700
- var e, t, x;
701
- return (e = n.modelValue) != null && e._id ? ((x = p.menu.bindedBySkuId[(t = n.modelValue) == null ? void 0 : t._id]) == null ? void 0 : x.filter((S) => S.from === "MENU")) ?? [] : [];
702
- }
703
- ), _e = k(
704
- () => p.skus.map((e) => ({ label: e.name, value: e.code }))
705
- ), Ae = B((nt = n.modelValue) == null ? void 0 : nt.code);
706
- function $e(e) {
707
- var x;
708
- const t = e.el;
709
- t && ((x = t.querySelector("[x-should-scroll-into=true]")) == null || x.scrollIntoView());
710
- }
711
- const Ue = k(
712
- () => {
713
- var e, t, x, S, Y, D;
714
- return ((S = (x = (t = (e = n.modelValue) == null ? void 0 : e.unit) == null ? void 0 : t.measurements) == null ? void 0 : x.find(
715
- (ne) => {
716
- var oe;
717
- return ne.id === ((oe = n.modelValue) == null ? void 0 : oe.trackingMeasurement);
718
- }
719
- )) == null ? void 0 : S.abbrev) ?? ((D = (Y = n.modelValue) == null ? void 0 : Y.unit) == null ? void 0 : D.abbrev);
720
- }
721
- ), ve = k({
722
- get() {
723
- var e, t;
724
- return ((t = (e = n.modelValue) == null ? void 0 : e.thresholds) == null ? void 0 : t.low) ?? xe().low;
725
- },
726
- set(e) {
727
- var S;
728
- const t = ((S = n.modelValue) == null ? void 0 : S.thresholds) ?? xe();
729
- t.low = e;
730
- const x = n.modelValue ? {
731
- ...n.modelValue
732
- } : {};
733
- x.thresholds = t, s("update:modelValue", x);
734
- }
735
- }), te = k({
736
- get() {
737
- var e, t;
738
- return ((t = (e = n.modelValue) == null ? void 0 : e.thresholds) == null ? void 0 : t.mid) ?? xe().mid;
739
- },
740
- set(e) {
741
- var S;
742
- const t = ((S = n.modelValue) == null ? void 0 : S.thresholds) ?? xe();
743
- t.mid = e;
744
- const x = n.modelValue ? {
745
- ...n.modelValue
746
- } : {};
747
- x.thresholds = t, s("update:modelValue", x);
748
- }
749
- }), Ve = k(() => i.mustUsePoTemplate && n.mode === H.CREATE && O.value.length > 0 ? O.value.map((e) => ({
750
- label: e.name || "Template",
751
- value: e._id || "template_" + e.name
752
- })) : []), Qe = k(() => Ve.value.filter(
753
- (e) => (n.purchaseOrderTemplateIds ?? []).includes(e.value)
754
- )), Ze = k(() => i.enableWastageTemplate && n.mode === H.CREATE && q.value.length > 0 ? q.value.map((e) => ({
755
- label: e.name || "Template",
756
- value: e._id || "template_" + e.name
757
- })) : []), Xe = k(() => Ze.value.filter(
758
- (e) => (n.wastageTemplateIds ?? []).includes(e.value)
759
- )), et = k(() => i.enableClosingTemplate && n.mode === H.CREATE && P.value.length > 0 ? P.value.map((e) => ({
760
- label: e.name || "Template",
761
- value: e._id || "template_" + e.name
762
- })) : []), tt = k(() => et.value.filter(
763
- (e) => (n.closingTemplateIds ?? []).includes(e.value)
764
- ));
765
- function Rt() {
766
- c.open({
767
- title: l("inventory.ingredient.purchaseOrderTemplates.selectTitle"),
768
- closeButton: !0,
769
- contentComponent: je,
770
- contentComponentProps: {
771
- modelValue: n.purchaseOrderTemplateIds ?? [],
772
- items: Ve.value
773
- },
774
- primaryActions: {
775
- text: l("common.confirm"),
776
- close: !0
777
- },
778
- secondaryActions: {
779
- text: l("common.cancel"),
780
- close: !0,
781
- variant: "tertiary"
782
- }
783
- }).onPrimary((e) => {
784
- s("update:purchaseOrderTemplateIds", e);
785
- });
786
- }
787
- function Pt() {
788
- c.open({
789
- title: l("inventory.ingredient.wastageTemplates.selectTitle"),
790
- closeButton: !0,
791
- contentComponent: je,
792
- contentComponentProps: {
793
- modelValue: n.wastageTemplateIds ?? [],
794
- items: Ze.value
795
- },
796
- primaryActions: {
797
- text: l("common.confirm"),
798
- close: !0
799
- },
800
- secondaryActions: {
801
- text: l("common.cancel"),
802
- close: !0,
803
- variant: "tertiary"
804
- }
805
- }).onPrimary((e) => {
806
- s("update:wastageTemplateIds", e);
807
- });
808
- }
809
- function Ot() {
810
- c.open({
811
- title: l("inventory.ingredient.closingTemplates.selectTitle"),
812
- closeButton: !0,
813
- contentComponent: je,
814
- contentComponentProps: {
815
- modelValue: n.closingTemplateIds ?? [],
816
- items: et.value
817
- },
818
- primaryActions: {
819
- text: l("common.confirm"),
820
- close: !0
821
- },
822
- secondaryActions: {
823
- text: l("common.cancel"),
824
- close: !0,
825
- variant: "tertiary"
826
- }
827
- }).onPrimary((e) => {
828
- s("update:closingTemplateIds", e);
829
- });
830
- }
831
- function Bt() {
832
- return function(t) {
833
- return typeof (t == null ? void 0 : t.low) != "number" || typeof (t == null ? void 0 : t.mid) != "number" ? "Required" : t.low >= t.mid ? "Days for red indicator should be less than yellow indicator." : !0;
834
- };
835
- }
836
- return (e, t) => {
837
- const x = C("FmTextField"), S = C("FmLabel"), Y = C("FmField"), D = C("FmIcon"), ne = C("FmMenuHeader"), oe = C("FmMenuDivider"), Ie = C("FmMenuItem"), Dt = C("FmMenu"), ot = C("FmFormGroup"), Nt = C("FmSelect"), lt = C("FmSwitch"), at = C("FmStepperField"), Ne = C("FmButton"), ze = C("FmChip"), zt = C("FmForm");
838
- return f(), N(zt, {
839
- disabled: e.disabled,
840
- ref_key: "formRef",
841
- ref: M,
842
- class: "flex flex-col gap-32",
843
- onValidationSuccess: ke
844
- }, {
845
- default: w(() => {
846
- var st, rt, it, ut;
847
- return [
848
- d("div", An, [
849
- d("div", $n, [
850
- m(Ce, {
851
- "tooltip-message": "This field is managed by NetSuite",
852
- "tooltip-z-index": 50,
853
- label: a(l)("inventory.ingredient.code"),
854
- "model-value": se.value,
855
- "onUpdate:modelValue": t[1] || (t[1] = (I) => se.value = I),
856
- locked: $.value,
857
- disabled: e.disabled
858
- }, {
859
- default: w(() => [
860
- m(x, {
861
- label: a(l)("inventory.ingredient.code"),
862
- "model-value": se.value,
863
- "onUpdate:modelValue": t[0] || (t[0] = (I) => se.value = I),
864
- rules: [a(Le)(), a(Qt)(_e.value, Ae.value)],
865
- "label-mark": "required"
866
- }, null, 8, ["label", "model-value", "rules"])
867
- ]),
868
- _: 1
869
- }, 8, ["label", "model-value", "locked", "disabled"])
870
- ]),
871
- d("div", Un, [
872
- m(Ce, {
873
- "tooltip-message": "This field is managed by NetSuite",
874
- "tooltip-z-index": 50,
875
- label: a(l)("inventory.ingredient.name"),
876
- "model-value": ee.value,
877
- "onUpdate:modelValue": t[3] || (t[3] = (I) => ee.value = I),
878
- locked: $.value,
879
- disabled: e.disabled
880
- }, {
881
- default: w(() => [
882
- m(x, {
883
- label: a(l)("inventory.ingredient.name"),
884
- "model-value": ee.value,
885
- "onUpdate:modelValue": t[2] || (t[2] = (I) => ee.value = I),
886
- rules: [a(Le)()],
887
- "label-mark": "required"
888
- }, null, 8, ["label", "model-value", "rules"])
889
- ]),
890
- _: 1
891
- }, 8, ["label", "model-value", "locked", "disabled"])
892
- ])
893
- ]),
894
- m(Ce, {
895
- "tooltip-message": "This field is managed by NetSuite",
896
- "tooltip-z-index": 50,
897
- label: a(l)("inventory.ingredient.unit"),
898
- "helper-text": (st = e.modelValue) != null && st.trackingMeasurement ? `Base unit: ${(it = (rt = e.modelValue) == null ? void 0 : rt.unit) == null ? void 0 : it.name}` : void 0,
899
- "model-value": (ut = pe.value) == null ? void 0 : ut.name,
900
- locked: $.value,
901
- disabled: e.disabled
902
- }, {
903
- default: w(() => [
904
- m(ot, {
905
- "model-value": pe.value,
906
- rules: [a(Le)()],
907
- "label-mark": "required"
908
- }, {
909
- label: w(() => [
910
- m(S, {
911
- label: a(l)("inventory.ingredient.unit")
912
- }, null, 8, ["label"])
913
- ]),
914
- default: w(({ invalid: I }) => [
915
- m(Dt, null, {
916
- "menu-button": w(() => [
917
- m(Y, {
918
- class: ae([
919
- "fm-typo-en-body-lg-400",
920
- {
921
- "text-fm-color-typo-primary": !e.disabled,
922
- "text-fm-color-typo-disabled": e.disabled
923
- }
924
- ]),
925
- invalid: I,
926
- "append-icon": "expand_more"
927
- }, {
928
- default: w(() => {
929
- var Z;
930
- return [
931
- Ge(R((Z = pe.value) == null ? void 0 : Z.name), 1)
932
- ];
933
- }),
934
- _: 2
935
- }, 1032, ["class", "invalid"])
936
- ]),
937
- default: w(() => [
938
- d("div", Rn, [
939
- m(x, {
940
- modelValue: h.value,
941
- "onUpdate:modelValue": t[4] || (t[4] = (Z) => h.value = Z),
942
- placeholder: "Filter options"
943
- }, {
944
- prepend: w(() => [
945
- m(D, { name: "search" })
946
- ]),
947
- _: 1
948
- }, 8, ["modelValue"]),
949
- d("div", {
950
- class: "overflow-x-hidden overflow-y-auto max-h-[300px]",
951
- onVnodeMounted: $e
952
- }, [
953
- (f(!0), E(X, null, ie(G.value, (Z, Lt) => (f(), E(X, { key: Lt }, [
954
- Z.displayAsSection ? (f(), E(X, { key: 0 }, [
955
- m(ne, {
956
- label: Z.label
957
- }, null, 8, ["label"]),
958
- m(oe)
959
- ], 64)) : (f(), N(Ie, {
960
- key: 1,
961
- label: Z.label,
962
- "model-value": F(Z),
963
- onClick: (rl) => b(Z.value),
964
- "x-should-scroll-into": `${F(Z)}`
965
- }, null, 8, ["label", "model-value", "onClick", "x-should-scroll-into"]))
966
- ], 64))), 128))
967
- ], 512)
968
- ])
969
- ]),
970
- _: 2
971
- }, 1024)
972
- ]),
973
- _: 1
974
- }, 8, ["model-value", "rules"])
975
- ]),
976
- _: 1
977
- }, 8, ["label", "helper-text", "model-value", "locked", "disabled"]),
978
- a(i).enableTotalCost ? (f(), N(Ce, {
979
- key: 0,
980
- "tooltip-message": "This field is managed by NetSuite",
981
- "tooltip-z-index": 50,
982
- label: a(l)("inventory.ingredient.valuationMethod.title"),
983
- "model-value": a(l)("inventory.ingredient.valuationMethod." + re.value),
984
- locked: $.value,
985
- disabled: e.disabled
986
- }, {
987
- label: w(() => [
988
- m(fe, { "z-index": 50 }, {
989
- default: w(() => [
990
- m(S, {
991
- label: a(l)("inventory.ingredient.valuationMethod.title")
992
- }, null, 8, ["label"])
993
- ]),
994
- _: 1
995
- })
996
- ]),
997
- default: w(() => [
998
- m(Nt, {
999
- class: "col-span-2",
1000
- label: a(l)("inventory.ingredient.valuationMethod.title"),
1001
- "model-value": re.value,
1002
- "onUpdate:modelValue": t[5] || (t[5] = (I) => re.value = I),
1003
- items: J.value
1004
- }, null, 8, ["label", "model-value", "items"])
1005
- ]),
1006
- _: 1
1007
- }, 8, ["label", "model-value", "locked", "disabled"])) : L("", !0),
1008
- a(i).enableTotalCost ? (f(), N(Ce, {
1009
- key: 1,
1010
- "tooltip-message": "This field is managed by NetSuite",
1011
- "tooltip-z-index": 50,
1012
- "model-value": `${a(Zt)()} ${me.value}`,
1013
- locked: $.value,
1014
- disabled: e.disabled
1015
- }, {
1016
- label: w(() => [
1017
- m(fe, { "z-index": 50 }, {
1018
- default: w(() => [
1019
- m(S, {
1020
- label: a(l)("inventory.ingredient.pricePerUnit")
1021
- }, null, 8, ["label"])
1022
- ]),
1023
- _: 1
1024
- })
1025
- ]),
1026
- default: w(() => [
1027
- m(x, {
1028
- "model-value": me.value,
1029
- "onUpdate:modelValue": t[6] || (t[6] = (I) => me.value = I),
1030
- rules: [a(Oe)(0), a(Xt)(4)]
1031
- }, {
1032
- label: w(() => [
1033
- m(fe, { "z-index": 50 }, {
1034
- default: w(() => [
1035
- m(S, {
1036
- label: a(l)("inventory.ingredient.pricePerUnit")
1037
- }, null, 8, ["label"])
1038
- ]),
1039
- _: 1
1040
- })
1041
- ]),
1042
- prepend: w(() => {
1043
- var I, Z;
1044
- return [
1045
- d("div", Pn, R(a(vt)(((I = a(r).currentCountry) == null ? void 0 : I.value) ?? a(ft)) === "MYR" ? "RM" : a(vt)(((Z = a(r).currentCountry) == null ? void 0 : Z.value) ?? a(ft))), 1)
1046
- ];
1047
- }),
1048
- append: w(() => [
1049
- d("div", On, " / " + R(Ue.value), 1)
1050
- ]),
1051
- _: 1
1052
- }, 8, ["model-value", "rules"])
1053
- ]),
1054
- _: 1
1055
- }, 8, ["model-value", "locked", "disabled"])) : L("", !0),
1056
- !$.value || z.value ? (f(), N(Mn, {
1057
- key: 2,
1058
- "model-value": z.value,
1059
- "onUpdate:modelValue": t[7] || (t[7] = (I) => z.value = I),
1060
- "root-value": e.modelValue,
1061
- readonly: $.value
1062
- }, null, 8, ["model-value", "root-value", "readonly"])) : L("", !0),
1063
- e.mode !== a(H).CREATE ? (f(), E("div", Bn, [
1064
- m(lt, {
1065
- label: a(l)("inventory.ingredient.status.inactive"),
1066
- "model-value": he.value,
1067
- "onUpdate:modelValue": t[8] || (t[8] = (I) => he.value = I),
1068
- "label-placement": "right",
1069
- disabled: $.value
1070
- }, null, 8, ["label", "model-value", "disabled"]),
1071
- d("div", Dn, [
1072
- d("div", Nn, R(a(l)("inventory.ingredient.status.preventFromOrder")), 1)
1073
- ])
1074
- ])) : L("", !0),
1075
- e.mode !== a(H).CREATE ? (f(), E("div", zn, [
1076
- d("div", null, [
1077
- m(lt, {
1078
- label: a(l)("inventory.ingredient.bindedItems.title"),
1079
- modelValue: U.value,
1080
- "onUpdate:modelValue": t[9] || (t[9] = (I) => U.value = I),
1081
- "label-placement": "right"
1082
- }, null, 8, ["label", "modelValue"])
1083
- ]),
1084
- U.value && W.value.length ? (f(), N(Ye, {
1085
- key: 0,
1086
- name: a(l)("inventory.ingredient.bindedItems.ingredient"),
1087
- bindings: W.value
1088
- }, null, 8, ["name", "bindings"])) : L("", !0),
1089
- U.value && le.value.length ? (f(), N(Ye, {
1090
- key: 1,
1091
- name: a(l)("inventory.ingredient.bindedItems.recipe"),
1092
- bindings: le.value
1093
- }, null, 8, ["name", "bindings"])) : L("", !0),
1094
- U.value && Te.value.length ? (f(), N(Ye, {
1095
- key: 2,
1096
- name: a(l)("inventory.ingredient.bindedItems.menu"),
1097
- bindings: Te.value
1098
- }, null, 8, ["name", "bindings"])) : L("", !0)
1099
- ])) : L("", !0),
1100
- d("div", Ln, [
1101
- d("div", jn, [
1102
- m(fe, null, {
1103
- default: w(() => [
1104
- d("div", Hn, R(a(l)("inventory.ingredient.threshold.title")), 1)
1105
- ]),
1106
- _: 1
1107
- }),
1108
- d("div", Wn, R(a(l)("inventory.ingredient.threshold.subtitle")), 1)
1109
- ]),
1110
- d("div", Yn, [
1111
- m(ot, {
1112
- "model-value": { low: ve.value, mid: te.value },
1113
- rules: [Bt()]
1114
- }, null, 8, ["model-value", "rules"]),
1115
- d("div", qn, [
1116
- d("div", Gn, [
1117
- d("div", Kn, [
1118
- m(He, {
1119
- days: ve.value,
1120
- level: a(We).low
1121
- }, null, 8, ["days", "level"])
1122
- ]),
1123
- d("div", Jn, [
1124
- d("div", Qn, R(a(l)("inventory.ingredient.threshold.whenRemaining")), 1),
1125
- m(at, {
1126
- modelValue: ve.value,
1127
- "onUpdate:modelValue": t[10] || (t[10] = (I) => ve.value = I),
1128
- rules: [a(Oe)(0)]
1129
- }, {
1130
- append: w(() => t[13] || (t[13] = [
1131
- d("div", {
1132
- class: "text-fm-color-typo-secondary",
1133
- style: { "padding-right": "32px" }
1134
- }, "days", -1)
1135
- ])),
1136
- _: 1
1137
- }, 8, ["modelValue", "rules"])
1138
- ])
1139
- ]),
1140
- t[15] || (t[15] = d("div", {
1141
- class: "h-full bg-fm-color-neutral-gray-200 relative",
1142
- style: { width: "1px" }
1143
- }, [
1144
- d("div", {
1145
- class: "absolute bg-white",
1146
- style: { transform: "translate(-50%, -50%)", left: "50%", top: "24px" }
1147
- }, " < ")
1148
- ], -1)),
1149
- d("div", Zn, [
1150
- d("div", Xn, [
1151
- m(He, {
1152
- days: te.value,
1153
- level: a(We).mid
1154
- }, null, 8, ["days", "level"])
1155
- ]),
1156
- d("div", eo, [
1157
- d("div", to, R(a(l)("inventory.ingredient.threshold.whenRemaining")), 1),
1158
- m(at, {
1159
- modelValue: te.value,
1160
- "onUpdate:modelValue": t[11] || (t[11] = (I) => te.value = I),
1161
- rules: [a(Oe)(0)]
1162
- }, {
1163
- append: w(() => t[14] || (t[14] = [
1164
- d("div", {
1165
- class: "text-fm-color-typo-secondary",
1166
- style: { "padding-right": "32px" }
1167
- }, "days", -1)
1168
- ])),
1169
- _: 1
1170
- }, 8, ["modelValue", "rules"])
1171
- ])
1172
- ]),
1173
- t[16] || (t[16] = d("div", {
1174
- class: "h-full bg-fm-color-neutral-gray-200 relative",
1175
- style: { width: "1px" }
1176
- }, [
1177
- d("div", {
1178
- class: "absolute bg-white",
1179
- style: { transform: "translate(-50%, -50%)", left: "50%", top: "24px" }
1180
- }, " < ")
1181
- ], -1)),
1182
- d("div", no, [
1183
- d("div", oo, [
1184
- m(He, {
1185
- days: te.value + 1,
1186
- level: a(We).high
1187
- }, null, 8, ["days", "level"])
1188
- ]),
1189
- d("div", lo, [
1190
- d("div", ao, R(a(l)("inventory.ingredient.threshold.stockIsStaple")), 1)
1191
- ])
1192
- ])
1193
- ])
1194
- ])
1195
- ]),
1196
- a(i).mustUsePoTemplate && e.mode === a(H).CREATE ? (f(), E("div", so, [
1197
- d("div", ro, [
1198
- d("div", io, [
1199
- m(fe, null, {
1200
- default: w(() => [
1201
- d("div", uo, R(a(l)("inventory.ingredient.purchaseOrderTemplates.title")), 1)
1202
- ]),
1203
- _: 1
1204
- }),
1205
- m(Ne, {
1206
- variant: "secondary",
1207
- "text-color": "primary",
1208
- "border-color": "primary",
1209
- "prepend-icon": "add",
1210
- onClick: Rt
1211
- })
1212
- ]),
1213
- d("div", co, R(a(l)("inventory.ingredient.purchaseOrderTemplates.description")), 1)
1214
- ]),
1215
- Qe.value.length > 0 ? (f(), E("div", mo, [
1216
- d("div", po, [
1217
- (f(!0), E(X, null, ie(Qe.value, (I) => (f(), N(ze, {
1218
- key: I.value,
1219
- label: I.label,
1220
- variant: "info",
1221
- compact: ""
1222
- }, null, 8, ["label"]))), 128))
1223
- ])
1224
- ])) : L("", !0)
1225
- ])) : L("", !0),
1226
- a(i).enableWastageTemplate && e.mode === a(H).CREATE ? (f(), E("div", vo, [
1227
- d("div", fo, [
1228
- d("div", yo, [
1229
- m(fe, null, {
1230
- default: w(() => [
1231
- d("div", go, R(a(l)("inventory.ingredient.wastageTemplates.title")), 1)
1232
- ]),
1233
- _: 1
1234
- }),
1235
- m(Ne, {
1236
- variant: "secondary",
1237
- "text-color": "primary",
1238
- "border-color": "primary",
1239
- "prepend-icon": "add",
1240
- onClick: Pt
1241
- })
1242
- ]),
1243
- d("div", bo, R(a(l)("inventory.ingredient.wastageTemplates.description")), 1)
1244
- ]),
1245
- Xe.value.length > 0 ? (f(), E("div", ho, [
1246
- d("div", _o, [
1247
- (f(!0), E(X, null, ie(Xe.value, (I) => (f(), N(ze, {
1248
- key: I.value,
1249
- label: I.label,
1250
- variant: "info",
1251
- compact: ""
1252
- }, null, 8, ["label"]))), 128))
1253
- ])
1254
- ])) : L("", !0)
1255
- ])) : L("", !0),
1256
- a(i).enableClosingTemplate && e.mode === a(H).CREATE ? (f(), E("div", xo, [
1257
- d("div", ko, [
1258
- d("div", wo, [
1259
- m(fe, null, {
1260
- default: w(() => [
1261
- d("div", To, R(a(l)("inventory.ingredient.closingTemplates.title")), 1)
1262
- ]),
1263
- _: 1
1264
- }),
1265
- m(Ne, {
1266
- variant: "secondary",
1267
- "text-color": "primary",
1268
- "border-color": "primary",
1269
- "prepend-icon": "add",
1270
- onClick: Ot
1271
- })
1272
- ]),
1273
- d("div", Vo, R(a(l)("inventory.ingredient.closingTemplates.description")), 1)
1274
- ]),
1275
- tt.value.length > 0 ? (f(), E("div", Io, [
1276
- d("div", So, [
1277
- (f(!0), E(X, null, ie(tt.value, (I) => (f(), N(ze, {
1278
- key: I.value,
1279
- label: I.label,
1280
- variant: "info",
1281
- compact: ""
1282
- }, null, 8, ["label"]))), 128))
1283
- ])
1284
- ])) : L("", !0)
1285
- ])) : L("", !0),
1286
- d("div", null, [
1287
- m(In, {
1288
- entity: "inventorySku",
1289
- modelValue: Q.value,
1290
- "onUpdate:modelValue": t[12] || (t[12] = (I) => Q.value = I)
1291
- }, null, 8, ["modelValue"])
1292
- ])
1293
- ];
1294
- }),
1295
- _: 1
1296
- }, 8, ["disabled"]);
1297
- };
1298
- }
1299
- }), Fo = { class: "flex flex-col gap-32" }, Mo = {
1300
- key: 0,
1301
- class: "flex justify-between items-center"
1302
- }, Eo = { class: "flex gap-4" }, Ao = /* @__PURE__ */ ye({
1303
- __name: "IngredientDialog",
1304
- props: {
1305
- show: { type: Boolean },
1306
- sku: {},
1307
- mode: { default: H.READ }
1308
- },
1309
- emits: ["update:show"],
1310
- setup(u) {
1311
- const o = u, v = ue(), l = Ke(), c = De(), g = Et(), _ = It(), y = At(), n = Me(), { t: s } = ge(), p = ht(o, "show"), r = ht(o, "sku"), i = B([]), T = B([]), $ = B([]), O = k(
1312
- () => {
1313
- var h;
1314
- return c.isEnabled && c.netSuiteItemBySkuId.has((h = o.sku) == null ? void 0 : h._id);
1315
- }
1316
- ), q = k(() => {
1317
- switch (o.mode) {
1318
- case H.READ:
1319
- return "";
1320
- case H.UPDATE:
1321
- return s("inventory.ingredient.update.title");
1322
- case H.CREATE:
1323
- return s("inventory.ingredient.create.title");
1324
- }
1325
- return "";
1326
- }), P = k(() => {
1327
- switch (o.mode) {
1328
- case H.READ:
1329
- return "";
1330
- case H.UPDATE:
1331
- return s("common.save");
1332
- case H.CREATE:
1333
- return s("common.add");
1334
- }
1335
- return "";
1336
- }), j = B(), V = B(!1);
1337
- async function ke() {
1338
- V.value = !0;
1339
- try {
1340
- await v.createSku(r.value);
1341
- const h = v.skuByCode[r.value.code];
1342
- l.enablePoTemplate && i.value.length > 0 && await be(h), l.enableWastageTemplate && T.value.length > 0 && await ce(h), l.enableClosingTemplate && $.value.length > 0 && await se(h), p.value = !1, n.open({
1343
- title: s("inventory.common.success"),
1344
- message: s("inventory.ingredient.create.success", { name: r.value.name }),
1345
- type: "success"
1346
- });
1347
- } catch (h) {
1348
- h instanceof yt || n.open({
1349
- title: s("inventory.ingredient.create.error.title"),
1350
- message: s("inventory.ingredient.create.error.message"),
1351
- type: "error"
1352
- });
1353
- } finally {
1354
- V.value = !1;
1355
- }
1356
- }
1357
- async function de() {
1358
- V.value = !0;
1359
- try {
1360
- await v.updateSku(r.value), V.value = !1, p.value = !1, n.open({
1361
- title: s("inventory.common.success"),
1362
- message: s("inventory.ingredient.update.success", { name: r.value.name }),
1363
- type: "success"
1364
- });
1365
- } catch (h) {
1366
- h instanceof yt || n.open({
1367
- title: s("inventory.ingredient.update.error.title"),
1368
- message: s("inventory.ingredient.update.error.message"),
1369
- type: "error"
1370
- });
1371
- } finally {
1372
- V.value = !1;
1373
- }
1374
- }
1375
- async function be(h) {
1376
- var A, G, F, b;
1377
- try {
1378
- for (const z of i.value) {
1379
- const J = await g.getTemplate(z);
1380
- if (!J) {
1381
- console.warn(`Template with ID ${z} not found`);
1382
- continue;
1383
- }
1384
- if (!J.purchaseOrder.items.find(
1385
- (Q) => Q.sku._id === h._id
1386
- )) {
1387
- const Q = { amount: 1, precision: tn(h.unit) }, M = {
1388
- sku: h,
1389
- name: h.name,
1390
- code: h.code,
1391
- quantity: Q,
1392
- minimumQuantity: Q,
1393
- quantityStep: Q,
1394
- measurement: ((G = (A = h.unit) == null ? void 0 : A.measurements) == null ? void 0 : G[0]) || null
1395
- }, U = {
1396
- ...J,
1397
- purchaseOrder: {
1398
- ...J.purchaseOrder,
1399
- items: [...J.purchaseOrder.items, M]
1400
- }
1401
- };
1402
- (((F = U.purchaseOrder.supplier) == null ? void 0 : F.internal) === gt.enum.warehouse || ((b = U.purchaseOrder.supplier) == null ? void 0 : b.internal) === gt.enum.restaurant) && (U.purchaseOrder.items = U.purchaseOrder.items.map(
1403
- ({ totalCost: W, ...le }) => le
1404
- )), await g.updateTemplate(U), await new Promise((W) => setTimeout(W, 1e3));
1405
- }
1406
- }
1407
- } catch (z) {
1408
- n.open({
1409
- title: s("inventory.transfer.template.update.error"),
1410
- message: s("inventory.transfer.template.update.errorMessage"),
1411
- type: "error"
1412
- }), console.error("Error in updating transfer template", z);
1413
- }
1414
- }
1415
- async function ce(h) {
1416
- try {
1417
- for (const A of T.value) {
1418
- const G = await _.getTemplate(A);
1419
- if (!G) {
1420
- console.warn(`Wastage Template with ID ${A} not found`);
1421
- continue;
1422
- }
1423
- if (!G.items.find((b) => b.id === h._id)) {
1424
- const b = {
1425
- id: h._id,
1426
- name: h.name,
1427
- code: h.code,
1428
- type: "sku",
1429
- disabledMeasurements: []
1430
- }, z = {
1431
- ...G,
1432
- items: [...G.items, b]
1433
- };
1434
- await _.updateTemplate(z), await new Promise((J) => setTimeout(J, 1e3));
1435
- }
1436
- }
1437
- } catch (A) {
1438
- n.open({
1439
- title: s("inventory.wastage.template.update.error"),
1440
- message: s("inventory.wastage.template.update.errorMessage"),
1441
- type: "error"
1442
- }), console.error("Error in updating wastage template", A);
1443
- }
1444
- }
1445
- async function se(h) {
1446
- try {
1447
- for (const A of $.value) {
1448
- const G = await y.getTemplate(A);
1449
- if (!G) {
1450
- console.warn(`Closing Template with ID ${A} not found`);
1451
- continue;
1452
- }
1453
- if (!G.items.find((b) => b.sku._id === h._id)) {
1454
- const b = {
1455
- sku: h
1456
- }, z = {
1457
- ...G,
1458
- items: [...G.items, b]
1459
- };
1460
- await y.updateTemplate(z), await new Promise((J) => setTimeout(J, 1e3));
1461
- }
1462
- }
1463
- } catch (A) {
1464
- n.open({
1465
- title: s("inventory.closing.template.update.error"),
1466
- message: s("inventory.closing.template.update.errorMessage"),
1467
- type: "error"
1468
- }), console.error("Error in updating closing template", A);
1469
- }
1470
- }
1471
- function he() {
1472
- var h, A;
1473
- (A = (h = j.value) == null ? void 0 : h.validateInputs) == null || A.call(h);
1474
- }
1475
- function ee() {
1476
- switch (o.mode) {
1477
- case H.READ:
1478
- return;
1479
- case H.UPDATE:
1480
- return de();
1481
- case H.CREATE:
1482
- return ke();
1483
- }
1484
- }
1485
- function me(h) {
1486
- i.value = h;
1487
- }
1488
- function pe(h) {
1489
- T.value = h;
1490
- }
1491
- function we(h) {
1492
- $.value = h;
1493
- }
1494
- return (h, A) => {
1495
- const G = C("FmChip"), F = C("FmButton"), b = C("FmSideSheet");
1496
- return f(), N(b, {
1497
- "model-value": a(p),
1498
- "onUpdate:modelValue": A[3] || (A[3] = (z) => ct(p) ? p.value = z : null),
1499
- header: q.value,
1500
- "close-button": "",
1501
- "dismiss-away": "",
1502
- "max-width": 500
1503
- }, {
1504
- "side-sheet-footer": w(() => [
1505
- d("div", Eo, [
1506
- m(F, {
1507
- loading: V.value,
1508
- label: P.value,
1509
- onClick: he
1510
- }, null, 8, ["loading", "label"]),
1511
- m(F, {
1512
- disabled: V.value,
1513
- label: a(s)("common.close"),
1514
- variant: "tertiary",
1515
- onClick: A[2] || (A[2] = (z) => p.value = !1)
1516
- }, null, 8, ["disabled", "label"])
1517
- ])
1518
- ]),
1519
- default: w(() => [
1520
- d("div", Fo, [
1521
- O.value ? (f(), E("div", Mo, [
1522
- m(G, {
1523
- label: "Managed by Netsuite",
1524
- compact: ""
1525
- }),
1526
- m(en, {
1527
- readonly: "",
1528
- sku: h.sku,
1529
- settingOptions: a(c).skuSettingOptions
1530
- }, null, 8, ["sku", "settingOptions"])
1531
- ])) : L("", !0),
1532
- m(Co, {
1533
- class: "w-full",
1534
- ref_key: "hasValidationExpose",
1535
- ref: j,
1536
- modelValue: a(r),
1537
- "onUpdate:modelValue": A[0] || (A[0] = (z) => ct(r) ? r.value = z : null),
1538
- mode: h.mode,
1539
- disabled: V.value,
1540
- purchaseOrderTemplateIds: i.value,
1541
- wastageTemplateIds: T.value,
1542
- closingTemplateIds: $.value,
1543
- "onClick:submit": A[1] || (A[1] = (z) => ee()),
1544
- "onUpdate:purchaseOrderTemplateIds": me,
1545
- "onUpdate:wastageTemplateIds": pe,
1546
- "onUpdate:closingTemplateIds": we
1547
- }, null, 8, ["modelValue", "mode", "disabled", "purchaseOrderTemplateIds", "wastageTemplateIds", "closingTemplateIds"])
1548
- ])
1549
- ]),
1550
- _: 1
1551
- }, 8, ["model-value", "header"]);
1552
- };
1553
- }
1554
- });
1555
- function $o() {
1556
- return `sku_${(/* @__PURE__ */ new Date()).toISOString()}_${Sn()}`;
1557
- }
1558
- const Uo = {
1559
- _id: "",
1560
- name: "",
1561
- abbrev: "",
1562
- precision: 0,
1563
- measurements: []
1564
- };
1565
- function Ro(u) {
1566
- return !u || Object.keys(u).length === 0 ? "" : Object.entries(u).map(([o, v]) => `${o}: ${v}`).join(", ");
1567
- }
1568
- function $t(u) {
1569
- if (!u || u.trim() === "")
1570
- return;
1571
- const o = {}, v = u.split(",").map((l) => l.trim());
1572
- for (const l of v) {
1573
- const c = l.indexOf(":");
1574
- if (c > 0) {
1575
- const g = l.substring(0, c).trim(), _ = l.substring(c + 1).trim();
1576
- g && _ && (o[g] = _);
1577
- }
1578
- }
1579
- return Object.keys(o).length > 0 ? o : void 0;
1580
- }
1581
- function Po(u) {
1582
- var v, l, c, g, _;
1583
- return {
1584
- code: u.code,
1585
- name: u.name,
1586
- unit: ((v = u.unit.measurements.find((y) => y.id === u.trackingMeasurement)) == null ? void 0 : v.abbrev) ?? u.unit.abbrev,
1587
- baseUnit: u.unit.abbrev,
1588
- valuationMethod: u.valuation ?? "WAVG",
1589
- pricePerUnit: (l = u.defaultCost) != null && l.costPerUnit ? +St((c = u.defaultCost) == null ? void 0 : c.costPerUnit) : 0,
1590
- thresholdLow: ((g = u.thresholds) == null ? void 0 : g.low) ?? xe().low,
1591
- thresholdMid: ((_ = u.thresholds) == null ? void 0 : _.mid) ?? xe().mid,
1592
- customAttributes: Ro(u.customAttributes)
1593
- };
1594
- }
1595
- function Ut() {
1596
- var c;
1597
- const u = [
1598
- {
1599
- id: "code",
1600
- name: "Code"
1601
- },
1602
- {
1603
- id: "name",
1604
- name: "Name"
1605
- },
1606
- {
1607
- id: "unit",
1608
- name: "Unit"
1609
- },
1610
- {
1611
- id: "baseUnit",
1612
- name: "Base unit"
1613
- }
1614
- ], o = Ke(), v = Ee(), l = Be(v.currentCountry.value);
1615
- return o.enableTotalCost && u.push(
1616
- {
1617
- id: "valuationMethod",
1618
- name: "Valuation method"
1619
- },
1620
- {
1621
- id: "pricePerUnit",
1622
- name: `Price per unit (${l == null ? void 0 : l.currency})`
1623
- }
1624
- ), ((c = v.currentBusiness.value) == null ? void 0 : c.menuVersion) === "v4" && u.push(
1625
- {
1626
- id: "thresholdLow",
1627
- name: "Show RED when remaining"
1628
- },
1629
- {
1630
- id: "thresholdMid",
1631
- name: "Show YELLOW when remaining"
1632
- }
1633
- ), u.push({
1634
- id: "customAttributes",
1635
- name: "Custom Attributes"
1636
- }), u;
1637
- }
1638
- function Oo() {
1639
- const o = ue().skus.map(Po), l = Ee().currentBusiness.value, c = Ut(), g = [
1640
- ["Business name:", l == null ? void 0 : l.name],
1641
- ["Business ID:", l == null ? void 0 : l._id],
1642
- ["Menu version", l == null ? void 0 : l.menuVersion],
1643
- [],
1644
- c.map((s) => s.name),
1645
- ...o.map((s) => c.map((p) => s[p.id]))
1646
- ], _ = c.map((s) => `system:${s.id}`), y = Ft(g, _), n = `${l == null ? void 0 : l.name} ingredients (${nn(/* @__PURE__ */ new Date())}).xlsx`;
1647
- return Mt(y, n), n;
1648
- }
1649
- function Bo() {
1650
- const o = Ee().currentBusiness.value, v = Ut(), l = [
1651
- ["Business name:", o == null ? void 0 : o.name],
1652
- ["Business ID:", o == null ? void 0 : o._id],
1653
- ["Menu version", o == null ? void 0 : o.menuVersion],
1654
- [],
1655
- v.map((y) => y.name)
1656
- ], c = v.map((y) => `system:${y.id}`), g = Ft(l, c), _ = "FeedMe ingredients template.xlsx";
1657
- return Mt(g, _), _;
1658
- }
1659
- function Do(u) {
1660
- const [
1661
- o,
1662
- v,
1663
- l,
1664
- c,
1665
- g,
1666
- _,
1667
- ...y
1668
- ] = ln(u);
1669
- if (!o || !o.length || o.some((i) => i.length && !i.startsWith("system:")))
1670
- throw new Error("Missing meta header. Excel file does not come from the template.");
1671
- const n = o.map((i) => i.split(":")[1]), p = ["code", "name", "unit", "baseUnit"].filter((i) => !n.includes(i));
1672
- if (p.length)
1673
- throw new Error(
1674
- `Missing meta headers (${p.join()}). Excel file does not come from the template.`
1675
- );
1676
- return y.map((i, T) => {
1677
- const $ = {};
1678
- for (const O in n) {
1679
- const q = n[O];
1680
- Object.assign($, { [q]: i[O] });
1681
- }
1682
- return {
1683
- index: T,
1684
- data: $
1685
- };
1686
- });
1687
- }
1688
- function xt(u, o, v) {
1689
- var j;
1690
- const c = ue().units, g = new Array(), _ = v.filter((V) => V.data.code === u.code);
1691
- _.length > 1 && g.push(
1692
- `Code ${u.code} is already used in row ${_.map((V) => V.index + 6).join()}.`
1693
- );
1694
- const y = c.find((V) => V.abbrev === u.baseUnit), n = y == null ? void 0 : y.measurements.find((V) => V.abbrev === u.unit);
1695
- if (!y)
1696
- g.push(`Cannot find base unit of symbol ${u.baseUnit}.`);
1697
- else if (u.baseUnit !== u.unit && !n) {
1698
- const V = `Cannot find unit conversion for ${u.baseUnit} with symbol ${u.unit || "[empty]"}.`;
1699
- g.push(V);
1700
- }
1701
- const s = Fe.options.find(
1702
- (V) => V === u.valuationMethod
1703
- );
1704
- u.valuationMethod && !s && g.push(
1705
- `Expected valuation method to be one of ${Fe.options.join()} but got ${u.valuationMethod} instead.`
1706
- );
1707
- const r = Ee().currentCountry.value, i = (V) => `${V}`.length && an()(V) === !0, T = i(`${u.pricePerUnit}`) === !0 ? {
1708
- costPerUnit: {
1709
- ...Ct(Number(u.pricePerUnit) || 0),
1710
- currency: ((j = Be(r)) == null ? void 0 : j.currency) ?? "MYR"
1711
- },
1712
- measurement: n
1713
- } : void 0, $ = i(`${u.thresholdLow}`) && i(`${u.thresholdMid}`) ? {
1714
- low: Number(u.thresholdLow) || 0,
1715
- mid: Number(u.thresholdMid) || 0
1716
- } : void 0, O = "customAttributes" in u ? $t(u.customAttributes) : null;
1717
- return {
1718
- type: "create",
1719
- sku: {
1720
- _id: $o(),
1721
- code: u.code,
1722
- name: u.name,
1723
- unit: y ?? c.find((V) => V) ?? Uo,
1724
- trackingMeasurement: n == null ? void 0 : n.id,
1725
- valuation: s,
1726
- defaultCost: T,
1727
- thresholds: $,
1728
- ...O !== null && { customAttributes: O }
1729
- },
1730
- errors: g,
1731
- excelRowNumber: o + 6
1732
- };
1733
- }
1734
- function No(u) {
1735
- try {
1736
- const o = Do(u).filter((s) => s.data.code), l = ue().skus, c = on(l, "code"), g = o.filter((s) => !c[s.data.code]), _ = o.filter((s) => c[s.data.code]), y = g.map(
1737
- (s) => xt(s.data, s.index, o)
1738
- ), n = _.map((s) => {
1739
- const p = xt(s.data, s.index, o), r = c[s.data.code];
1740
- let i = r.customAttributes;
1741
- return "customAttributes" in s.data && (i = $t(s.data.customAttributes)), {
1742
- ...p,
1743
- type: "update",
1744
- original: r,
1745
- sku: {
1746
- // to maintain original props not in the import excel, e.g. inventory binding, etc...
1747
- ...r,
1748
- code: p.sku.code || r.code,
1749
- name: p.sku.name || r.name,
1750
- unit: p.sku.unit || r.unit,
1751
- trackingMeasurement: p.sku.trackingMeasurement || r.trackingMeasurement,
1752
- valuation: p.sku.valuation || r.valuation,
1753
- defaultCost: p.sku.defaultCost || r.defaultCost,
1754
- thresholds: p.sku.thresholds || r.thresholds,
1755
- customAttributes: i
1756
- }
1757
- };
1758
- });
1759
- return {
1760
- invalidExcel: !1,
1761
- importCreateResult: y,
1762
- importUpdateResult: n
1763
- };
1764
- } catch (o) {
1765
- return {
1766
- invalidExcel: !0,
1767
- invalidExcelMessage: (o == null ? void 0 : o.message) ?? "Invalid excel",
1768
- importCreateResult: [],
1769
- importUpdateResult: []
1770
- };
1771
- }
1772
- }
1773
- const zo = { class: "flex items-center gap-12 pl-8" }, Lo = { class: "flex flex-col" }, jo = { class: "fm-typo-en-body-md-400 text-fm-color-typo-primary flex items-center gap-4" }, Ho = {
1774
- key: 0,
1775
- class: "text-fm-color-typo-secondary fm-typo-en-body-sm-400"
1776
- }, Wo = { key: 0 }, kt = /* @__PURE__ */ ye({
1777
- __name: "ImportIngredientItem",
1778
- props: {
1779
- type: {},
1780
- code: {},
1781
- name: {},
1782
- errors: {}
1783
- },
1784
- setup(u) {
1785
- return (o, v) => {
1786
- const l = C("FmIcon"), c = C("FmTooltip");
1787
- return f(), E("div", zo, [
1788
- v[0] || (v[0] = d("div", null, "•", -1)),
1789
- d("div", Lo, [
1790
- d("div", jo, [
1791
- d("div", {
1792
- class: ae({
1793
- "text-fm-color-system-error-300": o.errors.length
1794
- })
1795
- }, [
1796
- Ge(R(o.name) + " ", 1),
1797
- o.type === "create" ? (f(), E("span", Ho, "(new)")) : L("", !0)
1798
- ], 2),
1799
- o.errors.length ? (f(), E("div", Wo, [
1800
- m(c, { "z-index": 50 }, {
1801
- content: w(() => [
1802
- d("ol", null, [
1803
- (f(!0), E(X, null, ie(o.errors, (g, _) => (f(), E("li", { key: _ }, R(g), 1))), 128))
1804
- ])
1805
- ]),
1806
- default: w(() => [
1807
- m(l, {
1808
- name: "error",
1809
- size: "sm",
1810
- color: "system-error-300"
1811
- })
1812
- ]),
1813
- _: 1
1814
- })
1815
- ])) : L("", !0)
1816
- ]),
1817
- d("div", {
1818
- class: ae([
1819
- "fm-typo-en-body-sm-400",
1820
- {
1821
- "text-fm-color-system-error-200": o.errors.length,
1822
- "text-fm-color-typo-secondary": !o.errors.length
1823
- }
1824
- ])
1825
- }, R(o.code), 3)
1826
- ])
1827
- ]);
1828
- };
1829
- }
1830
- }), Yo = { class: "flex flex-col gap-24" }, qo = { class: "fm-typo-en-body-md-400" }, Go = { class: "flex flex-col gap-8" }, Ko = { class: "line-clamp-2 text-ellipsis break-all" }, Jo = {
1831
- key: 2,
1832
- class: "shrink-0"
1833
- }, Qo = {
1834
- key: 0,
1835
- class: "flex flex-col"
1836
- }, Zo = { class: "text-fm-color-system-error-300 fm-typo-en-body-sm-400" }, Xo = {
1837
- key: 0,
1838
- class: "max-h-[200px] overflow-y-auto flex flex-col gap-8"
1839
- }, el = { class: "fm-typo-en-body-lg-600" }, tl = /* @__PURE__ */ ye({
1840
- __name: "ImportIngredients",
1841
- setup(u) {
1842
- const o = B(null), v = gn(), l = Me(), c = B(!1), g = B(new Array()), _ = B([]), y = B([]), n = k(
1843
- () => !!g.value.length || _.value.some((i) => i.errors.length) || y.value.some((i) => i.errors.length)
1844
- ), s = k(
1845
- () => !!_.value.length || !!y.value.length
1846
- ), { t: p } = ge();
1847
- async function r(i) {
1848
- g.value = [], _.value = [], y.value = [];
1849
- try {
1850
- c.value = !0;
1851
- const [T] = await Promise.all([
1852
- rn(i),
1853
- // fake buffer
1854
- new Promise((q) => setTimeout(q, 1e3))
1855
- ]), $ = T.SheetNames.find((q) => q);
1856
- if (!$) {
1857
- g.value.push(p("inventory.ingredient.import.fileError.noSheet"));
1858
- return;
1859
- }
1860
- const O = No(T.Sheets[$]);
1861
- if (O.invalidExcel) {
1862
- g.value.push(O.invalidExcelMessage ?? p("inventory.ingredient.import.fileError.invalidExcel"));
1863
- return;
1864
- }
1865
- if (_.value = O.importCreateResult, y.value = O.importUpdateResult, !_.value.length && !y.value.length) {
1866
- g.value.push(p("inventory.ingredient.import.fileError.noData"));
1867
- return;
1868
- }
1869
- v.emitData(O);
1870
- } catch (T) {
1871
- l.open({
1872
- title: p("inventory.ingredient.import.fileError.unableToRead"),
1873
- message: T == null ? void 0 : T.message,
1874
- type: "error"
1875
- }), console.error("Error in reading file", T);
1876
- } finally {
1877
- g.value.length && l.open({
1878
- title: p("inventory.ingredient.import.fileError.invalidExcel"),
1879
- type: "error"
1880
- }), c.value = !1;
1881
- }
1882
- }
1883
- return wt(o, (i) => {
1884
- i && r(i);
1885
- }), (i, T) => {
1886
- const $ = C("FmCircularProgress"), O = C("FmIcon"), q = C("FmButton");
1887
- return f(), E("div", Yo, [
1888
- d("div", qo, R(a(p)("inventory.ingredient.import.uploadDescription")), 1),
1889
- m(sn, {
1890
- class: ae({
1891
- "w-full": !0,
1892
- "h-[200px]": !o.value
1893
- }),
1894
- accept: ".xlsx",
1895
- onFileUpload: T[0] || (T[0] = (P) => o.value = P),
1896
- label: a(p)("inventory.ingredient.import.uploadTemplate"),
1897
- "button-label": a(p)("inventory.ingredient.import.selectFile")
1898
- }, Tt({ _: 2 }, [
1899
- o.value ? {
1900
- name: "default",
1901
- fn: w(({ openFileDialog: P }) => [
1902
- d("div", Go, [
1903
- d("div", {
1904
- class: ae([
1905
- "fm-corner-radius-md p-16 flex items-center gap-16",
1906
- {
1907
- "border border-fm-color-neutral-gray-100": c.value,
1908
- "border border-fm-color-neutral-gray-200": !c.value && !n.value,
1909
- "border border-fm-color-system-error-200": n.value
1910
- }
1911
- ])
1912
- }, [
1913
- c.value ? (f(), N($, {
1914
- key: 0,
1915
- size: "md",
1916
- color: "neutral-gray-200"
1917
- })) : (f(), N(O, {
1918
- key: 1,
1919
- name: n.value ? "error" : "attach_file",
1920
- outline: "",
1921
- color: n.value ? "system-error-300" : void 0
1922
- }, null, 8, ["name", "color"])),
1923
- d("div", {
1924
- class: ae([
1925
- "fm-typo-en-body-md-400 flex-1 h-[36px] flex items-center",
1926
- {
1927
- "text-fm-color-typo-disabled": c.value,
1928
- "text-fm-color-typo-primary": !c.value
1929
- }
1930
- ])
1931
- }, [
1932
- d("div", Ko, R(o.value.name), 1)
1933
- ], 2),
1934
- c.value ? L("", !0) : (f(), E("div", Jo, [
1935
- m(q, {
1936
- label: a(p)("inventory.ingredient.import.replaceFile"),
1937
- variant: n.value ? "destructive" : "secondary",
1938
- "prepend-icon": n.value ? void 0 : "autorenew",
1939
- onClick: P
1940
- }, null, 8, ["label", "variant", "prepend-icon", "onClick"])
1941
- ]))
1942
- ], 2),
1943
- g.value.length ? (f(), E("div", Qo, [
1944
- (f(!0), E(X, null, ie(g.value, (j, V) => (f(), E("div", {
1945
- key: V,
1946
- class: "flex gap-8 items-center"
1947
- }, [
1948
- m(O, {
1949
- name: "error",
1950
- size: "sm",
1951
- color: "system-error-300"
1952
- }),
1953
- d("div", Zo, R(j), 1)
1954
- ]))), 128))
1955
- ])) : L("", !0)
1956
- ])
1957
- ]),
1958
- key: "0"
1959
- } : void 0
1960
- ]), 1032, ["class", "label", "button-label"]),
1961
- s.value ? (f(), E("div", Xo, [
1962
- d("div", el, R(a(p)("inventory.ingredient.import.summary")), 1),
1963
- (f(!0), E(X, null, ie(_.value, (P) => (f(), N(kt, {
1964
- key: P.sku._id,
1965
- code: P.sku.code,
1966
- name: P.sku.name,
1967
- errors: P.errors,
1968
- type: "create"
1969
- }, null, 8, ["code", "name", "errors"]))), 128)),
1970
- (f(!0), E(X, null, ie(y.value, (P) => (f(), N(kt, {
1971
- key: P.sku._id,
1972
- code: P.sku.code,
1973
- name: P.sku.name,
1974
- errors: P.errors,
1975
- type: "update"
1976
- }, null, 8, ["code", "name", "errors"]))), 128))
1977
- ])) : L("", !0)
1978
- ]);
1979
- };
1980
- }
1981
- }), nl = {
1982
- key: 0,
1983
- class: "flex items-center gap-1"
1984
- }, ol = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, ll = { class: "flex flex-col py-8" }, al = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, sl = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, Tl = /* @__PURE__ */ ye({
1985
- __name: "IngredientsView",
1986
- setup(u) {
1987
- const o = ue(), v = De(), l = k(() => [
1988
- {
1989
- type: "string",
1990
- key: "skuCode",
1991
- entity: "sku",
1992
- values: o.skus.map((b) => b.code)
1993
- },
1994
- {
1995
- type: "string",
1996
- key: "skuUnitAbbrev",
1997
- entity: "sku",
1998
- values: o.units.map((b) => b.abbrev)
1999
- },
2000
- {
2001
- type: "string",
2002
- key: "status",
2003
- entity: "sku",
2004
- values: ["Active", "Inactive"]
2005
- }
2006
- ]), c = B({
2007
- logic: "AND",
2008
- rules: [
2009
- {
2010
- property: "status",
2011
- operator: "$in",
2012
- value: ["Active"],
2013
- type: "string"
2014
- }
2015
- ]
2016
- }), g = k(
2017
- () => new Set(v.getAvailableItems(v.businessSubsidiaryId))
2018
- ), _ = k(() => {
2019
- if (!c.value)
2020
- return o.skus;
2021
- const F = un.build(c.value);
2022
- return o.skus.filter((b) => v.isEnabled && de.value && g.value && !g.value.has(b._id) ? !1 : dn(
2023
- {
2024
- skuCode: b.code,
2025
- skuUnitAbbrev: b.unit.abbrev,
2026
- status: b.isInactive ? "Inactive" : "Active"
2027
- },
2028
- F
2029
- ));
2030
- }), y = cn(), n = Je(), s = Cn(), p = Me(), { t: r } = ge(), { createIngredient: i, updateIngredient: T } = qe(), { ingredientDialogProps: $, ingredientViewLoading: O } = kn(qe()), { columnDefs: q } = Fn();
2031
- function P(F) {
2032
- switch (F) {
2033
- case "add":
2034
- return v.isEnabled ? void 0 : i();
2035
- case "import":
2036
- return A();
2037
- case "export":
2038
- return h();
2039
- }
2040
- }
2041
- const j = B(""), V = B(!1), ke = k(() => V.value || O.value), de = B(!0), { breakpoints: be } = bn(), ce = k(() => be.value.xs || be.value.sm), se = k(() => ce.value ? 10 : 20), he = mn(), ee = B(!1), me = [
2042
- {
2043
- value: "import",
2044
- label: r("common.import")
2045
- },
2046
- {
2047
- value: "export",
2048
- label: r("common.export")
2049
- }
2050
- ];
2051
- function pe(F) {
2052
- switch (ee.value = !1, F) {
2053
- case "import":
2054
- return A();
2055
- case "export":
2056
- return h();
2057
- }
2058
- }
2059
- const we = k(() => [
2060
- ...v.isEnabled ? [] : [
2061
- {
2062
- label: r("inventory.ingredient.create.title"),
2063
- value: "add",
2064
- isPrimary: !0,
2065
- prependIcon: "add"
2066
- }
2067
- ],
2068
- { label: r("common.import"), value: "import" },
2069
- { label: r("common.export"), value: "export" }
2070
- ]);
2071
- function h() {
2072
- const F = Oo();
2073
- p.open({
2074
- title: r("inventory.ingredient.export.success"),
2075
- message: r("inventory.ingredient.export.filename", [F]),
2076
- type: "success"
2077
- });
2078
- }
2079
- function A() {
2080
- n.open({
2081
- title: r("inventory.ingredient.import.title"),
2082
- contentComponent: tl,
2083
- overlay: !0,
2084
- closeButton: !0,
2085
- primaryActions: {
2086
- text: r("common.import"),
2087
- close: !1
2088
- },
2089
- secondaryActions: {
2090
- text: r("common.close"),
2091
- close: !0
2092
- },
2093
- tertiaryActions: {
2094
- text: r("inventory.ingredient.import.actions.downloadTemplate"),
2095
- close: !1,
2096
- variant: "plain"
2097
- }
2098
- }).onPrimary((F) => {
2099
- if (!F) {
2100
- p.open({
2101
- title: r("inventory.ingredient.import.error.noData"),
2102
- type: "error"
2103
- });
2104
- return;
2105
- }
2106
- if (!F.importCreateResult.length && !F.importUpdateResult.length) {
2107
- p.open({
2108
- title: r("inventory.ingredient.import.error.invalidContent"),
2109
- message: r("inventory.ingredient.import.error.noImportData"),
2110
- type: "error"
2111
- });
2112
- return;
2113
- }
2114
- if (F.importCreateResult.some((b) => b.errors.length) || F.importUpdateResult.some((b) => b.errors.length)) {
2115
- p.open({
2116
- title: r("inventory.ingredient.import.error.invalidContent"),
2117
- message: r("inventory.ingredient.import.error.hasErrors"),
2118
- type: "error"
2119
- });
2120
- return;
2121
- }
2122
- n.close(), G(F);
2123
- }).onTertiary(Bo);
2124
- }
2125
- async function G(F) {
2126
- V.value = !0;
2127
- try {
2128
- const b = [
2129
- ...F.importCreateResult.map(({ sku: M }) => ({ type: "create", sku: M })),
2130
- ...F.importUpdateResult.map(({ sku: M }) => ({ type: "update", sku: M }))
2131
- ], z = 100;
2132
- let J = 0;
2133
- const re = () => {
2134
- J += z, p.open({
2135
- title: r("inventory.ingredient.import.progress", [
2136
- Math.min(J, b.length),
2137
- b.length
2138
- ])
2139
- });
2140
- }, Q = new Array();
2141
- for (const M of b.chunk(100)) {
2142
- re();
2143
- try {
2144
- const U = await o.importSkus({
2145
- create: M.filter((W) => W.type === "create").map((W) => W.sku),
2146
- update: M.filter((W) => W.type === "update").map((W) => W.sku)
2147
- });
2148
- Q.push(...U.errors);
2149
- } catch (U) {
2150
- Q.push(
2151
- ...M.map((W) => {
2152
- const le = {
2153
- module: yn.enum.sku,
2154
- _id: W.sku._id,
2155
- name: W.sku.name,
2156
- message: (U == null ? void 0 : U.stack) ?? U
2157
- };
2158
- return {
2159
- data: W.sku,
2160
- error: [le]
2161
- };
2162
- })
2163
- );
2164
- }
2165
- }
2166
- p.open({
2167
- title: r("inventory.ingredient.import.success"),
2168
- type: "success"
2169
- }), Q.length && s.alert(
2170
- "Some operation failed",
2171
- K(
2172
- "div",
2173
- { class: "flex flex-col gap-8" },
2174
- Q.map(
2175
- (M) => K("div", { class: "flex flex-col" }, [
2176
- K("div", { class: "fm-typo-en-body-lg-600" }, `(${M.data.code}) ${M.data.name}`),
2177
- K(
2178
- "div",
2179
- { class: "fm-typo-en-body-lg-400" },
2180
- `${M.error.map((U) => (U == null ? void 0 : U.message) ?? "Unknown error").join(", ")}`
2181
- )
2182
- ])
2183
- )
2184
- )
2185
- );
2186
- } catch (b) {
2187
- p.open({
2188
- title: r("inventory.ingredient.import.error.failed"),
2189
- message: r("inventory.ingredient.import.error.systemMessage", [b == null ? void 0 : b.message]),
2190
- type: "error"
2191
- }), console.error("Error in importing skus", F, b);
2192
- } finally {
2193
- V.value = !1;
2194
- }
2195
- }
2196
- return (F, b) => {
2197
- const z = C("FmSwitch"), J = C("FmTable"), re = C("FmCollapsibleTabs"), Q = C("FmBottomSheet");
2198
- return f(), N(pn, {
2199
- title: a(r)("inventory.ingredient.title"),
2200
- actions: we.value,
2201
- "onClick:action": P
2202
- }, {
2203
- default: w(() => [
2204
- d("div", {
2205
- class: ae([
2206
- "flex flex-col gap-8 max-h-full",
2207
- {
2208
- "p-0": ce.value,
2209
- "px-24 ": !ce.value
2210
- }
2211
- ])
2212
- }, [
2213
- m(vn, {
2214
- searchable: "",
2215
- search: j.value,
2216
- "onUpdate:search": b[1] || (b[1] = (M) => j.value = M),
2217
- filterable: "",
2218
- "filter-attributes": l.value,
2219
- filter: c.value,
2220
- "onUpdate:filter": b[2] || (b[2] = (M) => c.value = M)
2221
- }, {
2222
- default: w(() => [
2223
- a(v).isEnabled ? (f(), E("div", nl, [
2224
- d("span", ol, R(a(r)("inventory.integration.netsuite.subsidiaryHierarchy.filtering")), 1),
2225
- m(Tn),
2226
- m(z, {
2227
- modelValue: de.value,
2228
- "onUpdate:modelValue": b[0] || (b[0] = (M) => de.value = M)
2229
- }, null, 8, ["modelValue"])
2230
- ])) : L("", !0)
2231
- ]),
2232
- _: 1
2233
- }, 8, ["search", "filter-attributes", "filter"]),
2234
- (f(), N(J, {
2235
- key: JSON.stringify(c.value),
2236
- style: Wt(a(he).tableHeight),
2237
- "column-defs": a(q),
2238
- "row-data": _.value,
2239
- "search-value": j.value,
2240
- columnVisibility: {
2241
- netsuiteSubsidiary: a(v).isEnabled
2242
- },
2243
- loading: (!a(y)._currentLocation || ke.value) && a(v).isReady,
2244
- "loading-text": "Loading",
2245
- onRowClick: b[3] || (b[3] = (M) => a(T)(M.original)),
2246
- "page-size": se.value
2247
- }, {
2248
- "list-row": w((M) => [
2249
- m(fn, {
2250
- row: M,
2251
- onRowClick: a(T)
2252
- }, Tt({
2253
- default: w((U) => {
2254
- var W, le, Te, _e, Ae, $e, Ue, ve, te, Ve;
2255
- return [
2256
- d("div", ll, [
2257
- d("div", al, [
2258
- m(a(bt), {
2259
- render: (Te = (le = (W = U.code) == null ? void 0 : W.column) == null ? void 0 : le.columnDef) == null ? void 0 : Te.cell,
2260
- props: (Ae = (_e = U.code) == null ? void 0 : _e.getContext) == null ? void 0 : Ae.call(_e)
2261
- }, null, 8, ["render", "props"])
2262
- ]),
2263
- d("div", sl, [
2264
- m(a(bt), {
2265
- render: (ve = (Ue = ($e = U.name) == null ? void 0 : $e.column) == null ? void 0 : Ue.columnDef) == null ? void 0 : ve.cell,
2266
- props: (Ve = (te = U.name) == null ? void 0 : te.getContext) == null ? void 0 : Ve.call(te)
2267
- }, null, 8, ["render", "props"])
2268
- ])
2269
- ])
2270
- ];
2271
- }),
2272
- _: 2
2273
- }, [
2274
- V.value ? {
2275
- name: "loading-text",
2276
- fn: w(() => [
2277
- d("div", null, R(a(r)("inventory.ingredient.table.importing")), 1)
2278
- ]),
2279
- key: "0"
2280
- } : void 0
2281
- ]), 1032, ["row", "onRowClick"])
2282
- ]),
2283
- _: 1
2284
- }, 8, ["style", "column-defs", "row-data", "search-value", "columnVisibility", "loading", "page-size"]))
2285
- ], 2),
2286
- (f(), N(mt, { to: "body" }, [
2287
- m(Ao, Yt(qt(a($))), null, 16)
2288
- ])),
2289
- (f(), N(mt, { to: "body" }, [
2290
- m(Q, {
2291
- "dismiss-away": "",
2292
- modelValue: ee.value,
2293
- "onUpdate:modelValue": b[5] || (b[5] = (M) => ee.value = M)
2294
- }, {
2295
- default: w(() => [
2296
- m(re, {
2297
- class: "pb-8",
2298
- items: me,
2299
- "onUpdate:modelValue": b[4] || (b[4] = (M) => pe(M))
2300
- })
2301
- ]),
2302
- _: 1
2303
- }, 8, ["modelValue"])
2304
- ]))
2305
- ]),
2306
- _: 1
2307
- }, 8, ["title", "actions"]);
2308
- };
2309
- }
2310
- });
2311
- export {
2312
- Tl as default
2313
- };