@feedmepos/mf-inventory-portal 1.0.8-dev.3 → 1.0.8-dev.5

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 (46) hide show
  1. package/dist/{App-D1Ei96Td.js → App-DEoAUoz8.js} +2 -2
  2. package/dist/{ApprovalView-KyYFHsD4.js → ApprovalView-Bm0wpCi5.js} +2 -2
  3. package/dist/{BindingsDialog-Bk41M0Za.js → BindingsDialog-CS8Tt3sC.js} +4 -4
  4. package/dist/{BindingsPicker-q_Qp179g.js → BindingsPicker-FfNuWRrW.js} +5 -5
  5. package/dist/{BindingsTable-qcSqGs6P.js → BindingsTable-DOn-0_-r.js} +8 -8
  6. package/dist/{ClosingDraftView-xVK3s9-w.js → ClosingDraftView-ChhIs35h.js} +2 -2
  7. package/dist/{ClosingTemplateView-DXtqcMVS.js → ClosingTemplateView-3ht4mT2t.js} +2 -2
  8. package/dist/{DeliveryOrderPrintPreview-Dd32mROT.js → DeliveryOrderPrintPreview-DCFJZFET.js} +1 -1
  9. package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-C-J0jfDV.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-DvG0g37O.js} +3 -3
  10. package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-DLN-KdoO.js → FmUnitInput.vue_vue_type_script_setup_true_lang-P0RSWG_u.js} +1 -1
  11. package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-C3pROg1Z.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-Bsh8ti95.js} +1 -1
  12. package/dist/{IngredientGroupView-BD038ujU.js → IngredientGroupView-BXmeU623.js} +1 -1
  13. package/dist/{IngredientsView-j7Zte4a4.js → IngredientsView-Bwlo74DQ.js} +611 -588
  14. package/dist/{IntegrationView-BQ34-sr7.js → IntegrationView-DVJ0SCv9.js} +71 -71
  15. package/dist/{InventoryBindingForm-OpMzVd5G.js → InventoryBindingForm-reP3_BCb.js} +1 -1
  16. package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-BZQXFMdC.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-DD9VIRXF.js} +11 -11
  17. package/dist/{InventoryBindingSummary-DPG1DYe_.js → InventoryBindingSummary-yy4dAMvw.js} +1 -1
  18. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-Di6Ntfm3.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-B3duMqgc.js} +1 -1
  19. package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-c_I2QWkT.js → PremiumBadge.vue_vue_type_script_setup_true_lang-CmZrBTpY.js} +1 -1
  20. package/dist/{PublishView-C90lNnwK.js → PublishView-KjMFoL-D.js} +8 -8
  21. package/dist/{PurchaseOrderPrintPreview-DeNeQ32j.js → PurchaseOrderPrintPreview-BHLQ8HLJ.js} +1 -1
  22. package/dist/{ReceiveRequestView-D_br1aIb.js → ReceiveRequestView-C1xncLZR.js} +9 -9
  23. package/dist/RecipeView-0WNHdQyq.js +616 -0
  24. package/dist/{StockView-DsAsWTdQ.js → StockView-BarUhnA3.js} +7 -7
  25. package/dist/{SupplierView-DiJJZ2xw.js → SupplierView-CXiT-xDT.js} +4 -4
  26. package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-BtpsLkMN.js → TransferDetails.vue_vue_type_script_setup_true_lang-bFfAtojp.js} +378 -376
  27. package/dist/{TransferTemplateView-asigQIL4.js → TransferTemplateView-BSVjDdZM.js} +7 -7
  28. package/dist/{UnitView-CqRB7vKd.js → UnitView-BkC2sK7O.js} +3 -3
  29. package/dist/{WarehouseView-B11DRFVm.js → WarehouseView-Bt1u1b-N.js} +1 -1
  30. package/dist/{app-DNCoZ4FQ.js → app-CZPd55uY.js} +1160 -1158
  31. package/dist/app.js +1 -1
  32. package/dist/{decimal-eIdAHXap.js → decimal-C_LTHWRm.js} +1 -1
  33. package/dist/{feature-DOpRevVj.js → feature-d6md97vH.js} +306 -339
  34. package/dist/{format-unit-display-C_J3o59j.js → format-unit-display-BJdRinaC.js} +2 -2
  35. package/dist/{index-M0i4mwwE.js → index-BDnwn7lO.js} +2 -2
  36. package/dist/{index-DpSW6sjM.js → index-CJ7gbqx0.js} +1 -1
  37. package/dist/{stock-BuOgLe5i.js → stock-BmWCyR8t.js} +1 -1
  38. package/dist/{supplier-BVyIOtYO.js → supplier-vR2Ui9hx.js} +1 -1
  39. package/dist/tsconfig.app.tsbuildinfo +1 -1
  40. package/dist/{use-ingredient-select-dialog-vQMMseR3.js → use-ingredient-select-dialog-BzDhKf-W.js} +1 -1
  41. package/dist/{use-inventory-binding-dialog-CGBthpTR.js → use-inventory-binding-dialog-CGp_dLQw.js} +1 -1
  42. package/dist/views/ingredients/helper/import-export.helper.d.ts +3 -0
  43. package/dist/views/ingredients/helper/import-export.helper.spec.d.ts +1 -0
  44. package/dist/{vue-i18n-ob4esuxD.js → vue-i18n-BuyX-Pk-.js} +2 -2
  45. package/package.json +1 -1
  46. package/dist/RecipeView-DwhKufWg.js +0 -610
@@ -1,610 +0,0 @@
1
- import { defineComponent as H, ref as E, onMounted as re, resolveComponent as S, openBlock as x, createElementBlock as $, Fragment as ie, createElementVNode as R, toDisplayString as ce, createVNode as v, createCommentVNode as j, computed as F, watch as ue, createBlock as T, withCtx as P, unref as b, isRef as Z, normalizeClass as de, normalizeStyle as me, Teleport as pe, normalizeProps as fe, guardReactiveProps as ve } from "vue";
2
- import { a as A, d as V, e as O, S as ye, f as ge, D as ee, h as Y, i as q, F as te, l as be, U as _e, A as we, p as ne, q as Re, s as he, r as Ve, u as xe, z as Ce, _ as Ee, B as Se, C as Fe, E as oe } from "./app-DNCoZ4FQ.js";
3
- import { useDialog as ke, useSnackbar as se, useProxiedModel as ae, useBreakpoints as De } from "@feedmepos/ui-library";
4
- import { i as Ae, _ as Ie } from "./is-linked-ingredient-error-fJ2TJb3z.js";
5
- import { _ as le } from "./IngredientBindedItem.vue_vue_type_script_setup_true_lang-C3pROg1Z.js";
6
- import { defineStore as $e, storeToRefs as Pe } from "pinia";
7
- import { useI18n as K } from "@feedmepos/mf-common";
8
- import { _ as Be } from "./InventoryBindingForm.vue_vue_type_script_setup_true_lang-BZQXFMdC.js";
9
- import { _ as Te } from "./FmCustomAttribute.vue_vue_type_script_setup_true_lang-D-IWRjRD.js";
10
- const Me = {
11
- key: 0,
12
- class: "flex flex-col items-center w-full h-full gap-24"
13
- }, Ue = { key: 1 }, Ne = { key: 0 }, ze = /* @__PURE__ */ H({
14
- __name: "DeleteDialog",
15
- props: {
16
- type: {},
17
- data: {},
18
- message: {},
19
- bindedItems: {}
20
- },
21
- setup(h) {
22
- const p = h, y = E(p.bindedItems || []), a = E(!1);
23
- re(() => {
24
- s();
25
- });
26
- async function s() {
27
- var c, i;
28
- !a.value && ((c = p.data) != null && c._id) && (a.value = !0, y.value = await A().getAffectedMenu((i = p.data) == null ? void 0 : i._id), a.value = !1);
29
- }
30
- return (c, i) => {
31
- const f = S("FmSpacer"), u = S("FmCircularProgress");
32
- return x(), $(ie, null, [
33
- R("p", null, ce(c.message), 1),
34
- a.value ? (x(), $("div", Me, [
35
- v(f),
36
- R("div", null, [
37
- v(u, { size: "xl" })
38
- ]),
39
- i[0] || (i[0] = R("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary pl-8" }, "Loading...", -1)),
40
- v(f)
41
- ])) : (x(), $("div", Ue, [
42
- i[2] || (i[2] = R("br", null, null, -1)),
43
- y.value.length > 0 ? (x(), $("div", Ne, [
44
- i[1] || (i[1] = R("p", { class: "fm-typo-en-body-lg-600" }, "Affected menu items:", -1)),
45
- v(le, {
46
- name: "Menu",
47
- bindings: y.value
48
- }, null, 8, ["bindings"])
49
- ])) : j("", !0)
50
- ]))
51
- ], 64);
52
- };
53
- }
54
- }), G = $e("recipeForm", function() {
55
- const p = ke(), y = se(), a = A(), s = E(!1), c = E();
56
- function i() {
57
- const n = {
58
- recipe: {},
59
- mode: V.CREATE,
60
- show: !0,
61
- "onUpdate:show"(l) {
62
- c.value.show = l;
63
- }
64
- };
65
- c.value = n;
66
- }
67
- async function f(n) {
68
- const l = {
69
- recipe: O(n),
70
- mode: V.UPDATE,
71
- show: !0,
72
- "onUpdate:show"(t) {
73
- c.value.show = t;
74
- }
75
- };
76
- c.value = l;
77
- }
78
- async function u(n) {
79
- s.value = !0;
80
- try {
81
- await a.deleteRecipe(n), y.open({
82
- title: "Success",
83
- message: `Deleted ${n.name}`,
84
- type: "success"
85
- });
86
- } catch (l) {
87
- l instanceof ye && Ae(l) ? p.open({
88
- title: "Cannot delete recipe",
89
- contentComponent: Ie,
90
- contentComponentProps: {
91
- subject: (n == null ? void 0 : n.name) ?? "",
92
- items: l.errorResponse.message
93
- },
94
- secondaryActions: {
95
- text: "Close",
96
- close: !0
97
- }
98
- }) : console.log("unable to delete recipe", l), y.open({
99
- title: `Cannot delete ${n == null ? void 0 : n.name}`,
100
- message: "Please try again.",
101
- type: "error"
102
- }), console.error("failed to delete recipe", l);
103
- } finally {
104
- s.value = !1;
105
- }
106
- }
107
- function d(n) {
108
- p.open({
109
- title: `Delete ${(n == null ? void 0 : n.name) ?? "recipe"}?`,
110
- closeButton: !1,
111
- primaryActions: {
112
- text: "Delete",
113
- close: !0,
114
- variant: "destructive"
115
- },
116
- secondaryActions: {
117
- text: "Cancel",
118
- close: !0
119
- },
120
- contentComponent: ze,
121
- contentComponentProps: {
122
- type: "menu",
123
- data: n,
124
- message: "You may not be able to delete this recipe if it is linked in any of the inventory modules."
125
- }
126
- }).onPrimary(() => u(n));
127
- }
128
- return {
129
- createRecipe: i,
130
- updateRecipe: f,
131
- deleteRecipe: d,
132
- recipeDialogProps: c,
133
- recipeViewLoading: s
134
- };
135
- });
136
- function Le() {
137
- const { updateRecipe: h, deleteRecipe: p } = G(), y = A(), { t: a } = K();
138
- async function s(u, d) {
139
- const n = O(d);
140
- if (u === Y.Edit) {
141
- await h(n);
142
- return;
143
- }
144
- if (u === Y.Delete) {
145
- await p(n);
146
- return;
147
- }
148
- }
149
- function c(u, d) {
150
- const n = u.filter((t) => t.type === te.enum.SKU), l = u.filter((t) => t.type === te.enum.RECIPE);
151
- return [
152
- ...n.map((t) => ({ ...t, recipeIds: [...d] })),
153
- ...l.filter((t) => y.recipeById[t.id] && !d.has(t.id)).flatMap(
154
- (t) => c(y.recipeById[t.id].contains, /* @__PURE__ */ new Set([...d, t.id]))
155
- )
156
- ];
157
- }
158
- const i = [
159
- {
160
- accessorKey: "recipe",
161
- header: () => a("inventory.recipe.name"),
162
- size: 400
163
- },
164
- {
165
- accessorKey: "ingredients",
166
- header: () => a("inventory.recipe.ingredients"),
167
- size: "auto"
168
- },
169
- {
170
- id: "action",
171
- header: "",
172
- cell(u) {
173
- return ge(
174
- [ee[Y.Edit], ee[Y.Delete]],
175
- (d) => {
176
- s(d, u.row.original.original);
177
- }
178
- );
179
- },
180
- enableSorting: !1,
181
- size: 40,
182
- meta: {
183
- cellClass: "",
184
- headerClass: ""
185
- }
186
- }
187
- ];
188
- function f(u) {
189
- const d = A();
190
- return u.map((n) => ({
191
- recipe: n.name,
192
- ingredients: c(n.contains, /* @__PURE__ */ new Set([n._id])).map((l) => {
193
- var _, g, r, m, C;
194
- const t = d.skuById[l.id];
195
- return t ? l.recipeIds.slice(1).length ? `(linked recipe ${(_ = d.recipeById[l.recipeIds.at(-1) ?? ""]) == null ? void 0 : _.name}) ${t.name} (${q(l.amount)}${((g = l.measurement) == null ? void 0 : g.abbrev) ?? ((r = t == null ? void 0 : t.unit) == null ? void 0 : r.abbrev)})` : `${t.name} (${q(l.amount)}${((m = l.measurement) == null ? void 0 : m.abbrev) ?? ((C = t == null ? void 0 : t.unit) == null ? void 0 : C.abbrev)})` : null;
196
- }).filter((l) => l).join(", "),
197
- original: n
198
- }));
199
- }
200
- return { columnDefs: i, formatRowData: f };
201
- }
202
- const Ye = { class: "flex flex-col gap-40" }, qe = {
203
- key: 0,
204
- class: "col-span-2 mt-16 border-1 border-fm-color-neutral-gray-200 fm-corner-radius-lg flex flex-col p-16 gap-16"
205
- }, He = {
206
- key: 0,
207
- class: "flex flex-col items-center w-full h-full gap-24"
208
- }, Ke = { key: 1 }, je = { class: "mt-32" }, Ge = /* @__PURE__ */ H({
209
- __name: "RecipeForm",
210
- props: {
211
- mode: {},
212
- modelValue: {},
213
- disabled: { type: Boolean }
214
- },
215
- emits: ["update:modelValue", "click:submit"],
216
- setup(h, { expose: p, emit: y }) {
217
- var k;
218
- const a = h, s = y, { t: c } = K(), i = F({
219
- get() {
220
- var e;
221
- return ((e = a.modelValue) == null ? void 0 : e.name) ?? "";
222
- },
223
- set(e) {
224
- const o = a.modelValue ?? {};
225
- o.name = e, s("update:modelValue", o);
226
- }
227
- }), f = F({
228
- get() {
229
- var e;
230
- return ((e = a.modelValue) == null ? void 0 : e.contains) ?? [];
231
- },
232
- set(e) {
233
- const o = a.modelValue ?? {};
234
- o.contains = e, s("update:modelValue", o);
235
- }
236
- }), u = F({
237
- get() {
238
- var e;
239
- return ((e = a.modelValue) == null ? void 0 : e.customAttributes) ?? {};
240
- },
241
- set(e) {
242
- const o = a.modelValue ? {
243
- ...a.modelValue
244
- } : {};
245
- o.customAttributes = e, s("update:modelValue", o);
246
- }
247
- });
248
- function d() {
249
- s("click:submit");
250
- }
251
- const n = E();
252
- p({
253
- validateInputs: () => {
254
- var e, o;
255
- (o = (e = n.value) == null ? void 0 : e.validateInputs) == null || o.call(e);
256
- },
257
- resetInputsValidation: () => {
258
- var e, o;
259
- (o = (e = n.value) == null ? void 0 : e.resetInputsValidation) == null || o.call(e);
260
- },
261
- resetInputs: () => {
262
- var e, o;
263
- (o = (e = n.value) == null ? void 0 : e.resetInputs) == null || o.call(e);
264
- }
265
- });
266
- const l = A(), t = E([]), _ = E(!1), g = E(!1);
267
- ue(_, async (e) => {
268
- r(e);
269
- });
270
- async function r(e) {
271
- var o, B;
272
- e && !g.value && ((o = a.modelValue) != null && o._id) && (g.value = !0, t.value = await l.getAffectedMenu((B = a.modelValue) == null ? void 0 : B._id), g.value = !1);
273
- }
274
- const m = F(
275
- () => l.recipes.map((e) => ({ label: e.name, value: e.name }))
276
- ), C = E((k = a.modelValue) == null ? void 0 : k.name);
277
- return (e, o) => {
278
- const B = S("FmTextField"), I = S("FmCard"), D = S("FmSwitch"), M = S("FmSpacer"), U = S("FmCircularProgress"), N = S("FmForm");
279
- return x(), T(N, {
280
- ref_key: "formRef",
281
- ref: n,
282
- onValidationSuccess: d
283
- }, {
284
- default: P(() => [
285
- R("div", Ye, [
286
- v(B, {
287
- disabled: e.disabled,
288
- label: b(c)("inventory.recipe.name"),
289
- "model-value": i.value,
290
- "onUpdate:modelValue": o[0] || (o[0] = (w) => i.value = w),
291
- rules: [
292
- b(be)(),
293
- b(_e)(m.value, C.value, (w) => `[${w.value}] already exists`)
294
- ],
295
- "label-mark": "required"
296
- }, null, 8, ["disabled", "label", "model-value", "rules"]),
297
- v(I, {
298
- variant: "outlined",
299
- class: "p-16"
300
- }, {
301
- default: P(() => {
302
- var w;
303
- return [
304
- v(Be, {
305
- id: (w = e.modelValue) == null ? void 0 : w._id,
306
- disabled: e.disabled,
307
- "model-value": f.value,
308
- "onUpdate:modelValue": o[1] || (o[1] = (z) => f.value = z),
309
- rules: [b(we)(1)]
310
- }, null, 8, ["id", "disabled", "model-value", "rules"])
311
- ];
312
- }),
313
- _: 1
314
- })
315
- ]),
316
- e.mode !== b(V).CREATE ? (x(), $("div", qe, [
317
- R("div", null, [
318
- v(D, {
319
- label: "Show binded items",
320
- modelValue: _.value,
321
- "onUpdate:modelValue": o[2] || (o[2] = (w) => _.value = w),
322
- "label-placement": "right",
323
- disabled: g.value
324
- }, null, 8, ["modelValue", "disabled"])
325
- ]),
326
- g.value ? (x(), $("div", He, [
327
- v(M),
328
- R("div", null, [
329
- v(U, { size: "xl" })
330
- ]),
331
- o[4] || (o[4] = R("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary pl-8" }, "Loading...", -1)),
332
- v(M)
333
- ])) : (x(), $("div", Ke, [
334
- _.value && t.value.length ? (x(), T(le, {
335
- key: 0,
336
- name: "Menu",
337
- bindings: t.value
338
- }, null, 8, ["bindings"])) : j("", !0)
339
- ]))
340
- ])) : j("", !0),
341
- R("div", je, [
342
- v(Te, {
343
- entity: "inventoryRecipe",
344
- modelValue: u.value,
345
- "onUpdate:modelValue": o[3] || (o[3] = (w) => u.value = w)
346
- }, null, 8, ["modelValue"])
347
- ])
348
- ]),
349
- _: 1
350
- }, 512);
351
- };
352
- }
353
- }), Oe = { class: "flex gap-4" }, Je = /* @__PURE__ */ H({
354
- __name: "RecipeDialog",
355
- props: {
356
- show: { type: Boolean },
357
- recipe: {},
358
- mode: { default: V.READ }
359
- },
360
- emits: ["update:show"],
361
- setup(h) {
362
- const p = h, y = A(), a = se(), { t: s } = K(), c = ae(p, "show"), i = ae(p, "recipe"), f = F(() => {
363
- switch (p.mode) {
364
- case V.READ:
365
- return "";
366
- case V.UPDATE:
367
- return s("inventory.recipe.update.title");
368
- case V.CREATE:
369
- return s("inventory.recipe.create.title");
370
- }
371
- return "";
372
- }), u = F(() => {
373
- switch (p.mode) {
374
- case V.READ:
375
- return "";
376
- case V.UPDATE:
377
- return s("common.save");
378
- case V.CREATE:
379
- return s("common.add");
380
- }
381
- return "";
382
- }), d = E(), n = E(!1);
383
- async function l() {
384
- n.value = !0;
385
- try {
386
- const r = O(i.value);
387
- r.precision ?? (r.precision = 0), r.measurements ?? (r.measurements = []), await y.createRecipe(r), c.value = !1, a.open({
388
- title: s("inventory.common.success"),
389
- message: s("inventory.recipe.create.success", { name: i.value.name }),
390
- type: "success"
391
- });
392
- } catch (r) {
393
- r instanceof ne || a.open({
394
- title: s("inventory.recipe.create.error.title"),
395
- message: s("inventory.recipe.create.error.message"),
396
- type: "error"
397
- });
398
- } finally {
399
- n.value = !1;
400
- }
401
- }
402
- async function t() {
403
- n.value = !0;
404
- try {
405
- await y.updateRecipe(i.value), c.value = !1, a.open({
406
- title: s("inventory.common.success"),
407
- message: s("inventory.recipe.update.success", { name: i.value.name }),
408
- type: "success"
409
- });
410
- } catch (r) {
411
- r instanceof ne || a.open({
412
- title: s("inventory.recipe.update.error.title"),
413
- message: s("inventory.recipe.update.error.message"),
414
- type: "error"
415
- });
416
- } finally {
417
- n.value = !1;
418
- }
419
- }
420
- function _() {
421
- var r, m;
422
- (m = (r = d.value) == null ? void 0 : r.validateInputs) == null || m.call(r);
423
- }
424
- function g() {
425
- switch (p.mode) {
426
- case V.READ:
427
- return;
428
- case V.UPDATE:
429
- return t();
430
- case V.CREATE:
431
- return l();
432
- }
433
- }
434
- return (r, m) => {
435
- const C = S("FmButton"), k = S("FmSideSheet");
436
- return x(), T(k, {
437
- "model-value": b(c),
438
- "onUpdate:modelValue": m[3] || (m[3] = (e) => Z(c) ? c.value = e : null),
439
- header: f.value,
440
- "close-button": "",
441
- "dismiss-away": "",
442
- "max-width": 500
443
- }, {
444
- "side-sheet-footer": P(() => [
445
- R("div", Oe, [
446
- v(C, {
447
- loading: n.value,
448
- label: u.value,
449
- onClick: _
450
- }, null, 8, ["loading", "label"]),
451
- v(C, {
452
- disabled: n.value,
453
- label: b(s)("common.close"),
454
- variant: "tertiary",
455
- onClick: m[2] || (m[2] = (e) => c.value = !1)
456
- }, null, 8, ["disabled", "label"])
457
- ])
458
- ]),
459
- default: P(() => [
460
- v(Ge, {
461
- class: "w-full",
462
- ref_key: "hasValidationExpose",
463
- ref: d,
464
- modelValue: b(i),
465
- "onUpdate:modelValue": m[0] || (m[0] = (e) => Z(i) ? i.value = e : null),
466
- mode: r.mode,
467
- disabled: n.value,
468
- "onClick:submit": m[1] || (m[1] = (e) => g())
469
- }, null, 8, ["modelValue", "mode", "disabled"])
470
- ]),
471
- _: 1
472
- }, 8, ["model-value", "header"]);
473
- };
474
- }
475
- });
476
- function Qe() {
477
- const h = A(), p = h.recipes, y = h.recipeById, a = h.skuById, s = p.flatMap((f, u) => {
478
- var d;
479
- if ((d = f.contains) != null && d.length) {
480
- const n = f.contains.filter((t) => t.type === "RECIPE"), l = f.contains.filter((t) => t.type === "SKU");
481
- return [
482
- ...u === 0 ? [] : [["", "", "", "", "", ""]],
483
- ...n.map(
484
- (t, _) => {
485
- var g;
486
- return [
487
- _ === 0 ? f.name : "",
488
- "RECIPE",
489
- "",
490
- (g = y[t.id]) == null ? void 0 : g.name,
491
- q(t.amount),
492
- "UNIT"
493
- ];
494
- }
495
- ),
496
- ...l.map(
497
- (t, _) => {
498
- var g, r, m, C;
499
- return [
500
- !n.length && _ === 0 ? f.name : "",
501
- "INGREDIENT",
502
- (g = a[t.id]) == null ? void 0 : g.code,
503
- (r = a[t.id]) == null ? void 0 : r.name,
504
- q(t.amount),
505
- t.measurement ? t.measurement.abbrev : (C = (m = a[t.id]) == null ? void 0 : m.unit) == null ? void 0 : C.abbrev
506
- ];
507
- }
508
- )
509
- ];
510
- }
511
- return [
512
- ...u === 0 ? [] : [["", "", "", "", "", ""]],
513
- [f.name, "No bindings", "", "", "", ""]
514
- ];
515
- }), i = Re(s, ["Name", "Type", "Code", "Item", "Amount", "Unit"]);
516
- he(i, `RECIPE_${Ve(/* @__PURE__ */ new Date(), "-", "-")}.xlsx`);
517
- }
518
- const We = { class: "flex flex-col py-8" }, Xe = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, Ze = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, ct = /* @__PURE__ */ H({
519
- __name: "RecipeView",
520
- setup(h) {
521
- const p = A(), y = F(() => p.recipes), a = xe(), { createRecipe: s, updateRecipe: c } = G(), { recipeDialogProps: i, recipeViewLoading: f } = Pe(G()), { columnDefs: u, formatRowData: d } = Le(), n = F(() => d(y.value));
522
- function l(e) {
523
- if (e === "add")
524
- return s();
525
- if (e === "export")
526
- return Qe();
527
- }
528
- const t = E(""), _ = F(() => f.value), { breakpoints: g } = De(), r = F(() => g.value.xs || g.value.sm), m = F(() => r.value ? 10 : 20), C = Ce(), { t: k } = K();
529
- return (e, o) => {
530
- const B = S("FmTable");
531
- return x(), T(Ee, {
532
- title: b(k)("inventory.recipe.title"),
533
- actions: [
534
- {
535
- label: b(k)("inventory.recipe.create.title"),
536
- value: "add",
537
- isPrimary: !0,
538
- prependIcon: "add"
539
- },
540
- { label: b(k)("common.export"), value: "export", isPrimary: !1 }
541
- ],
542
- "onClick:action": l
543
- }, {
544
- default: P(() => [
545
- R("div", {
546
- class: de([
547
- "flex flex-col gap-8 max-h-full",
548
- {
549
- "p-0": r.value,
550
- "px-24 ": !r.value
551
- }
552
- ])
553
- }, [
554
- v(Se, {
555
- searchable: "",
556
- search: t.value,
557
- "onUpdate:search": o[0] || (o[0] = (I) => t.value = I)
558
- }, null, 8, ["search"]),
559
- (x(), T(B, {
560
- style: me(b(C).tableHeight),
561
- "column-defs": b(u),
562
- "row-data": n.value,
563
- "search-value": t.value,
564
- loading: !b(a)._currentLocation || _.value,
565
- onRowClick: o[1] || (o[1] = (I) => b(c)(I.original.original)),
566
- key: y.value.length,
567
- "page-size": m.value
568
- }, {
569
- "list-row": P((I) => [
570
- v(Fe, {
571
- row: I,
572
- onRowClick: (D) => b(c)(D.original)
573
- }, {
574
- default: P((D) => {
575
- var M, U, N, w, z, J, Q, W, L, X;
576
- return [
577
- R("div", We, [
578
- R("div", Xe, [
579
- v(b(oe), {
580
- render: (N = (U = (M = D.recipe) == null ? void 0 : M.column) == null ? void 0 : U.columnDef) == null ? void 0 : N.cell,
581
- props: (z = (w = D.recipe) == null ? void 0 : w.getContext) == null ? void 0 : z.call(w)
582
- }, null, 8, ["render", "props"])
583
- ]),
584
- R("div", Ze, [
585
- v(b(oe), {
586
- render: (W = (Q = (J = D.ingredients) == null ? void 0 : J.column) == null ? void 0 : Q.columnDef) == null ? void 0 : W.cell,
587
- props: (X = (L = D.ingredients) == null ? void 0 : L.getContext) == null ? void 0 : X.call(L)
588
- }, null, 8, ["render", "props"])
589
- ])
590
- ])
591
- ];
592
- }),
593
- _: 2
594
- }, 1032, ["row", "onRowClick"])
595
- ]),
596
- _: 1
597
- }, 8, ["style", "column-defs", "row-data", "search-value", "loading", "page-size"]))
598
- ], 2),
599
- (x(), T(pe, { to: "body" }, [
600
- v(Je, fe(ve(b(i))), null, 16)
601
- ]))
602
- ]),
603
- _: 1
604
- }, 8, ["title", "actions"]);
605
- };
606
- }
607
- });
608
- export {
609
- ct as default
610
- };