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