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