@feedmepos/mf-inventory-portal 0.0.23-dev.38 → 0.0.23-dev.40

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 (42) hide show
  1. package/dist/{App-DQgtWkQj.js → App-D8DXxTIq.js} +2 -2
  2. package/dist/{ApprovalView-CvSK9fGA.js → ApprovalView-BWGXkHV6.js} +2 -2
  3. package/dist/{BindingsDialog-BAC0_xCP.js → BindingsDialog-D7WypDot.js} +2 -2
  4. package/dist/{BindingsPicker-ecWMwsNp.js → BindingsPicker-DUlGwkwM.js} +1 -1
  5. package/dist/{BindingsTable-D5kQydOU.js → BindingsTable-BjeZYCaJ.js} +1 -1
  6. package/dist/{ClosingDraftView-CnHQ59rX.js → ClosingDraftView-o2LEUfo8.js} +2 -2
  7. package/dist/{ClosingTemplateView-vRTsVZ0c.js → ClosingTemplateView-Dt983Cg4.js} +1 -1
  8. package/dist/FmCustomAttribute.vue_vue_type_script_setup_true_lang-Dc_7IyBG.js +142 -0
  9. package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-CpIzIvkU.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-wocPyZls.js} +3 -3
  10. package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-CNzEHF-R.js → FmUnitInput.vue_vue_type_script_setup_true_lang-DzoEp-Pg.js} +1 -1
  11. package/dist/{IngredientGroupView-BLsABZ3h.js → IngredientGroupView-CIPpIpv1.js} +1 -1
  12. package/dist/IngredientsView-CFV3kX7Q.js +1707 -0
  13. package/dist/{IntegrationView-BqAqngtM.js → IntegrationView-DkW32m-t.js} +1 -1
  14. package/dist/{InventoryBindingForm-D54V_qZQ.js → InventoryBindingForm-B4CBet9W.js} +1 -1
  15. package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-KIW9J7Xn.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-DpdDVf6O.js} +3 -3
  16. package/dist/{InventoryBindingSummary-htT7GNto.js → InventoryBindingSummary-75ImZtqK.js} +1 -1
  17. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-BlEgALMj.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-DfpG3Fy8.js} +1 -1
  18. package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-DHbxXDGy.js → PremiumBadge.vue_vue_type_script_setup_true_lang-B4d0c3nk.js} +1 -1
  19. package/dist/{PurchaseOrderPrintPreview-hmzxKuIa.js → PurchaseOrderPrintPreview-BYO0JcQW.js} +1 -1
  20. package/dist/{ReceiveRequestView-_YioyWqU.js → ReceiveRequestView-cFLNExw9.js} +182 -182
  21. package/dist/RecipeView-CjfpaHaT.js +609 -0
  22. package/dist/{StockView-R4cnEbHQ.js → StockView-HMtD9qar.js} +8 -8
  23. package/dist/{SupplierView-CevGG507.js → SupplierView-Cidfe-Xm.js} +4 -4
  24. package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-CeWP9msS.js → TransferDetails.vue_vue_type_script_setup_true_lang-CdU3HPBC.js} +4 -4
  25. package/dist/{TransferTemplateView-QDniAq8o.js → TransferTemplateView-Doxr1fXP.js} +6 -6
  26. package/dist/{UnitView-SjwJ3lZ0.js → UnitView-C1af71aM.js} +228 -223
  27. package/dist/{WarehouseView-55LiPQXG.js → WarehouseView-CviOLXfX.js} +1 -1
  28. package/dist/{app-UTiudUUR.js → app-BE8SgDqI.js} +92 -93
  29. package/dist/app.js +1 -1
  30. package/dist/{decimal-tyBgHJ47.js → decimal-xj3kVOP6.js} +1 -1
  31. package/dist/{feature-z7inw9y6.js → feature-CWpNYcWJ.js} +1 -1
  32. package/dist/{format-unit-display-DN0KtCh2.js → format-unit-display-CZ835oaL.js} +2 -2
  33. package/dist/{index-Dj2Ccgp1.js → index-B8IWDKYv.js} +3 -3
  34. package/dist/{index-DlhdTaa8.js → index-C6SzYqK7.js} +1 -1
  35. package/dist/{stock-CxRxidDu.js → stock-C2xyYnS7.js} +1 -1
  36. package/dist/{supplier-BhyiTwSJ.js → supplier-B-7o9hg1.js} +1 -1
  37. package/dist/tsconfig.app.tsbuildinfo +1 -1
  38. package/dist/{use-inventory-binding-dialog-DwSvUvRl.js → use-inventory-binding-dialog-Dm8Ky1MH.js} +1 -1
  39. package/package.json +3 -3
  40. package/dist/IngredientBindedItem.vue_vue_type_script_setup_true_lang-DBhBaRrd.js +0 -51
  41. package/dist/IngredientsView-Cs4TIf6V.js +0 -1794
  42. package/dist/RecipeView-88KJ0nvU.js +0 -591
@@ -0,0 +1,609 @@
1
+ import { defineComponent as H, ref as C, 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, o as ne, p as Re, r as he, q as Ve, u as xe, y as Ee, z as Ce, B as Se, E as Fe, G as oe } from "./app-BE8SgDqI.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, a as $e } from "./FmCustomAttribute.vue_vue_type_script_setup_true_lang-Dc_7IyBG.js";
6
+ import { defineStore as Pe, storeToRefs as Be } from "pinia";
7
+ import { useI18n as K } from "@feedmepos/mf-common";
8
+ import { _ as Te } from "./InventoryBindingForm.vue_vue_type_script_setup_true_lang-DpdDVf6O.js";
9
+ const Me = {
10
+ key: 0,
11
+ class: "flex flex-col items-center w-full h-full gap-24"
12
+ }, Ue = { key: 1 }, Ne = { key: 0 }, ze = /* @__PURE__ */ H({
13
+ __name: "DeleteDialog",
14
+ props: {
15
+ type: {},
16
+ data: {},
17
+ message: {},
18
+ bindedItems: {}
19
+ },
20
+ setup(h) {
21
+ const p = h, y = C(p.bindedItems || []), a = C(!1);
22
+ re(() => {
23
+ s();
24
+ });
25
+ async function s() {
26
+ var c, i;
27
+ !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);
28
+ }
29
+ return (c, i) => {
30
+ const f = S("FmSpacer"), u = S("FmCircularProgress");
31
+ return x(), $(ie, null, [
32
+ R("p", null, ce(c.message), 1),
33
+ a.value ? (x(), $("div", Me, [
34
+ v(f),
35
+ R("div", null, [
36
+ v(u, { size: "xl" })
37
+ ]),
38
+ i[0] || (i[0] = R("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary pl-8" }, "Loading...", -1)),
39
+ v(f)
40
+ ])) : (x(), $("div", Ue, [
41
+ i[2] || (i[2] = R("br", null, null, -1)),
42
+ y.value.length > 0 ? (x(), $("div", Ne, [
43
+ i[1] || (i[1] = R("p", { class: "fm-typo-en-body-lg-600" }, "Affected menu items:", -1)),
44
+ v(le, {
45
+ name: "Menu",
46
+ bindings: y.value
47
+ }, null, 8, ["bindings"])
48
+ ])) : j("", !0)
49
+ ]))
50
+ ], 64);
51
+ };
52
+ }
53
+ }), G = Pe("recipeForm", function() {
54
+ const p = ke(), y = se(), a = A(), s = C(!1), c = C();
55
+ function i() {
56
+ const n = {
57
+ recipe: {},
58
+ mode: V.CREATE,
59
+ show: !0,
60
+ "onUpdate:show"(l) {
61
+ c.value.show = l;
62
+ }
63
+ };
64
+ c.value = n;
65
+ }
66
+ async function f(n) {
67
+ const l = {
68
+ recipe: O(n),
69
+ mode: V.UPDATE,
70
+ show: !0,
71
+ "onUpdate:show"(t) {
72
+ c.value.show = t;
73
+ }
74
+ };
75
+ c.value = l;
76
+ }
77
+ async function u(n) {
78
+ s.value = !0;
79
+ try {
80
+ await a.deleteRecipe(n), y.open({
81
+ title: "Success",
82
+ message: `Deleted ${n.name}`,
83
+ type: "success"
84
+ });
85
+ } catch (l) {
86
+ l instanceof ye && Ae(l) ? p.open({
87
+ title: "Cannot delete recipe",
88
+ contentComponent: Ie,
89
+ contentComponentProps: {
90
+ subject: (n == null ? void 0 : n.name) ?? "",
91
+ items: l.errorResponse.message
92
+ },
93
+ secondaryActions: {
94
+ text: "Close",
95
+ close: !0
96
+ }
97
+ }) : console.log("unable to delete recipe", l), y.open({
98
+ title: `Cannot delete ${n == null ? void 0 : n.name}`,
99
+ message: "Please try again.",
100
+ type: "error"
101
+ }), console.error("failed to delete recipe", l);
102
+ } finally {
103
+ s.value = !1;
104
+ }
105
+ }
106
+ function d(n) {
107
+ p.open({
108
+ title: `Delete ${(n == null ? void 0 : n.name) ?? "recipe"}?`,
109
+ closeButton: !1,
110
+ primaryActions: {
111
+ text: "Delete",
112
+ close: !0,
113
+ variant: "destructive"
114
+ },
115
+ secondaryActions: {
116
+ text: "Cancel",
117
+ close: !0
118
+ },
119
+ contentComponent: ze,
120
+ contentComponentProps: {
121
+ type: "menu",
122
+ data: n,
123
+ message: "You may not be able to delete this recipe if it is linked in any of the inventory modules."
124
+ }
125
+ }).onPrimary(() => u(n));
126
+ }
127
+ return {
128
+ createRecipe: i,
129
+ updateRecipe: f,
130
+ deleteRecipe: d,
131
+ recipeDialogProps: c,
132
+ recipeViewLoading: s
133
+ };
134
+ });
135
+ function Le() {
136
+ const { updateRecipe: h, deleteRecipe: p } = G(), y = A(), { t: a } = K();
137
+ async function s(u, d) {
138
+ const n = O(d);
139
+ if (u === Y.Edit) {
140
+ await h(n);
141
+ return;
142
+ }
143
+ if (u === Y.Delete) {
144
+ await p(n);
145
+ return;
146
+ }
147
+ }
148
+ function c(u, d) {
149
+ const n = u.filter((t) => t.type === te.enum.SKU), l = u.filter((t) => t.type === te.enum.RECIPE);
150
+ return [
151
+ ...n.map((t) => ({ ...t, recipeIds: [...d] })),
152
+ ...l.filter((t) => y.recipeById[t.id] && !d.has(t.id)).flatMap(
153
+ (t) => c(y.recipeById[t.id].contains, /* @__PURE__ */ new Set([...d, t.id]))
154
+ )
155
+ ];
156
+ }
157
+ const i = [
158
+ {
159
+ accessorKey: "recipe",
160
+ header: () => a("inventory.recipe.name"),
161
+ size: 400
162
+ },
163
+ {
164
+ accessorKey: "ingredients",
165
+ header: () => a("inventory.recipe.ingredients"),
166
+ size: "auto"
167
+ },
168
+ {
169
+ id: "action",
170
+ header: "",
171
+ cell(u) {
172
+ return ge(
173
+ [ee[Y.Edit], ee[Y.Delete]],
174
+ (d) => {
175
+ s(d, u.row.original.original);
176
+ }
177
+ );
178
+ },
179
+ enableSorting: !1,
180
+ size: 40,
181
+ meta: {
182
+ cellClass: "",
183
+ headerClass: ""
184
+ }
185
+ }
186
+ ];
187
+ function f(u) {
188
+ const d = A();
189
+ return u.map((n) => ({
190
+ recipe: n.name,
191
+ ingredients: c(n.contains, /* @__PURE__ */ new Set([n._id])).map((l) => {
192
+ var _, g, r, m, E;
193
+ const t = d.skuById[l.id];
194
+ 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) ?? ((E = t == null ? void 0 : t.unit) == null ? void 0 : E.abbrev)})` : null;
195
+ }).filter((l) => l).join(", "),
196
+ original: n
197
+ }));
198
+ }
199
+ return { columnDefs: i, formatRowData: f };
200
+ }
201
+ const Ye = { class: "flex flex-col gap-40" }, qe = {
202
+ key: 0,
203
+ 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"
204
+ }, He = {
205
+ key: 0,
206
+ class: "flex flex-col items-center w-full h-full gap-24"
207
+ }, Ke = { key: 1 }, je = { class: "mt-32" }, Ge = /* @__PURE__ */ H({
208
+ __name: "RecipeForm",
209
+ props: {
210
+ mode: {},
211
+ modelValue: {},
212
+ disabled: { type: Boolean }
213
+ },
214
+ emits: ["update:modelValue", "click:submit"],
215
+ setup(h, { expose: p, emit: y }) {
216
+ var k;
217
+ const a = h, s = y, { t: c } = K(), i = F({
218
+ get() {
219
+ var e;
220
+ return ((e = a.modelValue) == null ? void 0 : e.name) ?? "";
221
+ },
222
+ set(e) {
223
+ const o = a.modelValue ?? {};
224
+ o.name = e, s("update:modelValue", o);
225
+ }
226
+ }), f = F({
227
+ get() {
228
+ var e;
229
+ return ((e = a.modelValue) == null ? void 0 : e.contains) ?? [];
230
+ },
231
+ set(e) {
232
+ const o = a.modelValue ?? {};
233
+ o.contains = e, s("update:modelValue", o);
234
+ }
235
+ }), u = F({
236
+ get() {
237
+ var e;
238
+ return ((e = a.modelValue) == null ? void 0 : e.customAttributes) ?? {};
239
+ },
240
+ set(e) {
241
+ const o = a.modelValue ? {
242
+ ...a.modelValue
243
+ } : {};
244
+ o.customAttributes = e, s("update:modelValue", o);
245
+ }
246
+ });
247
+ function d() {
248
+ s("click:submit");
249
+ }
250
+ const n = C();
251
+ p({
252
+ validateInputs: () => {
253
+ var e, o;
254
+ (o = (e = n.value) == null ? void 0 : e.validateInputs) == null || o.call(e);
255
+ },
256
+ resetInputsValidation: () => {
257
+ var e, o;
258
+ (o = (e = n.value) == null ? void 0 : e.resetInputsValidation) == null || o.call(e);
259
+ },
260
+ resetInputs: () => {
261
+ var e, o;
262
+ (o = (e = n.value) == null ? void 0 : e.resetInputs) == null || o.call(e);
263
+ }
264
+ });
265
+ const l = A(), t = C([]), _ = C(!1), g = C(!1);
266
+ ue(_, async (e) => {
267
+ r(e);
268
+ });
269
+ async function r(e) {
270
+ var o, B;
271
+ 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);
272
+ }
273
+ const m = F(
274
+ () => l.recipes.map((e) => ({ label: e.name, value: e.name }))
275
+ ), E = C((k = a.modelValue) == null ? void 0 : k.name);
276
+ return (e, o) => {
277
+ const B = S("FmTextField"), I = S("FmCard"), D = S("FmSwitch"), M = S("FmSpacer"), U = S("FmCircularProgress"), N = S("FmForm");
278
+ return x(), T(N, {
279
+ ref_key: "formRef",
280
+ ref: n,
281
+ onValidationSuccess: d
282
+ }, {
283
+ default: P(() => [
284
+ R("div", Ye, [
285
+ v(B, {
286
+ disabled: e.disabled,
287
+ label: b(c)("inventory.recipe.name"),
288
+ "model-value": i.value,
289
+ "onUpdate:modelValue": o[0] || (o[0] = (w) => i.value = w),
290
+ rules: [
291
+ b(be)(),
292
+ b(_e)(m.value, E.value, (w) => `[${w.value}] already exists`)
293
+ ],
294
+ "label-mark": "required"
295
+ }, null, 8, ["disabled", "label", "model-value", "rules"]),
296
+ v(I, {
297
+ variant: "outlined",
298
+ class: "p-16"
299
+ }, {
300
+ default: P(() => {
301
+ var w;
302
+ return [
303
+ v(Te, {
304
+ id: (w = e.modelValue) == null ? void 0 : w._id,
305
+ disabled: e.disabled,
306
+ "model-value": f.value,
307
+ "onUpdate:modelValue": o[1] || (o[1] = (z) => f.value = z),
308
+ rules: [b(we)(1)]
309
+ }, null, 8, ["id", "disabled", "model-value", "rules"])
310
+ ];
311
+ }),
312
+ _: 1
313
+ })
314
+ ]),
315
+ e.mode !== b(V).CREATE ? (x(), $("div", qe, [
316
+ R("div", null, [
317
+ v(D, {
318
+ label: "Show binded items",
319
+ modelValue: _.value,
320
+ "onUpdate:modelValue": o[2] || (o[2] = (w) => _.value = w),
321
+ "label-placement": "right",
322
+ disabled: g.value
323
+ }, null, 8, ["modelValue", "disabled"])
324
+ ]),
325
+ g.value ? (x(), $("div", He, [
326
+ v(M),
327
+ R("div", null, [
328
+ v(U, { size: "xl" })
329
+ ]),
330
+ o[4] || (o[4] = R("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary pl-8" }, "Loading...", -1)),
331
+ v(M)
332
+ ])) : (x(), $("div", Ke, [
333
+ _.value && t.value.length ? (x(), T(le, {
334
+ key: 0,
335
+ name: "Menu",
336
+ bindings: t.value
337
+ }, null, 8, ["bindings"])) : j("", !0)
338
+ ]))
339
+ ])) : j("", !0),
340
+ R("div", je, [
341
+ v($e, {
342
+ entity: "inventoryRecipe",
343
+ modelValue: u.value,
344
+ "onUpdate:modelValue": o[3] || (o[3] = (w) => u.value = w)
345
+ }, null, 8, ["modelValue"])
346
+ ])
347
+ ]),
348
+ _: 1
349
+ }, 512);
350
+ };
351
+ }
352
+ }), Oe = { class: "flex gap-4" }, Je = /* @__PURE__ */ H({
353
+ __name: "RecipeDialog",
354
+ props: {
355
+ show: { type: Boolean },
356
+ recipe: {},
357
+ mode: { default: V.READ }
358
+ },
359
+ emits: ["update:show"],
360
+ setup(h) {
361
+ const p = h, y = A(), a = se(), { t: s } = K(), c = ae(p, "show"), i = ae(p, "recipe"), f = F(() => {
362
+ switch (p.mode) {
363
+ case V.READ:
364
+ return "";
365
+ case V.UPDATE:
366
+ return s("inventory.recipe.update.title");
367
+ case V.CREATE:
368
+ return s("inventory.recipe.create.title");
369
+ }
370
+ return "";
371
+ }), u = F(() => {
372
+ switch (p.mode) {
373
+ case V.READ:
374
+ return "";
375
+ case V.UPDATE:
376
+ return s("common.save");
377
+ case V.CREATE:
378
+ return s("common.add");
379
+ }
380
+ return "";
381
+ }), d = C(), n = C(!1);
382
+ async function l() {
383
+ n.value = !0;
384
+ try {
385
+ const r = O(i.value);
386
+ r.precision ?? (r.precision = 0), r.measurements ?? (r.measurements = []), await y.createRecipe(r), c.value = !1, a.open({
387
+ title: s("inventory.common.success"),
388
+ message: s("inventory.recipe.create.success", { name: i.value.name }),
389
+ type: "success"
390
+ });
391
+ } catch (r) {
392
+ r instanceof ne || a.open({
393
+ title: s("inventory.recipe.create.error.title"),
394
+ message: s("inventory.recipe.create.error.message"),
395
+ type: "error"
396
+ });
397
+ } finally {
398
+ n.value = !1;
399
+ }
400
+ }
401
+ async function t() {
402
+ n.value = !0;
403
+ try {
404
+ await y.updateRecipe(i.value), c.value = !1, a.open({
405
+ title: s("inventory.common.success"),
406
+ message: s("inventory.recipe.update.success", { name: i.value.name }),
407
+ type: "success"
408
+ });
409
+ } catch (r) {
410
+ r instanceof ne || a.open({
411
+ title: s("inventory.recipe.update.error.title"),
412
+ message: s("inventory.recipe.update.error.message"),
413
+ type: "error"
414
+ });
415
+ } finally {
416
+ n.value = !1;
417
+ }
418
+ }
419
+ function _() {
420
+ var r, m;
421
+ (m = (r = d.value) == null ? void 0 : r.validateInputs) == null || m.call(r);
422
+ }
423
+ function g() {
424
+ switch (p.mode) {
425
+ case V.READ:
426
+ return;
427
+ case V.UPDATE:
428
+ return t();
429
+ case V.CREATE:
430
+ return l();
431
+ }
432
+ }
433
+ return (r, m) => {
434
+ const E = S("FmButton"), k = S("FmSideSheet");
435
+ return x(), T(k, {
436
+ "model-value": b(c),
437
+ "onUpdate:modelValue": m[3] || (m[3] = (e) => Z(c) ? c.value = e : null),
438
+ header: f.value,
439
+ "close-button": "",
440
+ "dismiss-away": "",
441
+ "max-width": 500
442
+ }, {
443
+ "side-sheet-footer": P(() => [
444
+ R("div", Oe, [
445
+ v(E, {
446
+ loading: n.value,
447
+ label: u.value,
448
+ onClick: _
449
+ }, null, 8, ["loading", "label"]),
450
+ v(E, {
451
+ disabled: n.value,
452
+ label: b(s)("common.close"),
453
+ variant: "tertiary",
454
+ onClick: m[2] || (m[2] = (e) => c.value = !1)
455
+ }, null, 8, ["disabled", "label"])
456
+ ])
457
+ ]),
458
+ default: P(() => [
459
+ v(Ge, {
460
+ class: "w-full",
461
+ ref_key: "hasValidationExpose",
462
+ ref: d,
463
+ modelValue: b(i),
464
+ "onUpdate:modelValue": m[0] || (m[0] = (e) => Z(i) ? i.value = e : null),
465
+ mode: r.mode,
466
+ disabled: n.value,
467
+ "onClick:submit": m[1] || (m[1] = (e) => g())
468
+ }, null, 8, ["modelValue", "mode", "disabled"])
469
+ ]),
470
+ _: 1
471
+ }, 8, ["model-value", "header"]);
472
+ };
473
+ }
474
+ });
475
+ function Qe() {
476
+ const h = A(), p = h.recipes, y = h.recipeById, a = h.skuById, s = p.flatMap((f, u) => {
477
+ var d;
478
+ if ((d = f.contains) != null && d.length) {
479
+ const n = f.contains.filter((t) => t.type === "RECIPE"), l = f.contains.filter((t) => t.type === "SKU");
480
+ return [
481
+ ...u === 0 ? [] : [["", "", "", "", "", ""]],
482
+ ...n.map(
483
+ (t, _) => {
484
+ var g;
485
+ return [
486
+ _ === 0 ? f.name : "",
487
+ "RECIPE",
488
+ "",
489
+ (g = y[t.id]) == null ? void 0 : g.name,
490
+ q(t.amount),
491
+ "UNIT"
492
+ ];
493
+ }
494
+ ),
495
+ ...l.map(
496
+ (t, _) => {
497
+ var g, r, m, E;
498
+ return [
499
+ !n.length && _ === 0 ? f.name : "",
500
+ "INGREDIENT",
501
+ (g = a[t.id]) == null ? void 0 : g.code,
502
+ (r = a[t.id]) == null ? void 0 : r.name,
503
+ q(t.amount),
504
+ t.measurement ? t.measurement.abbrev : (E = (m = a[t.id]) == null ? void 0 : m.unit) == null ? void 0 : E.abbrev
505
+ ];
506
+ }
507
+ )
508
+ ];
509
+ }
510
+ return [
511
+ ...u === 0 ? [] : [["", "", "", "", "", ""]],
512
+ [f.name, "No bindings", "", "", "", ""]
513
+ ];
514
+ }), i = Re(s, ["Name", "Type", "Code", "Item", "Amount", "Unit"]);
515
+ he(i, `RECIPE_${Ve(/* @__PURE__ */ new Date(), "-", "-")}.xlsx`);
516
+ }
517
+ 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" }, it = /* @__PURE__ */ H({
518
+ __name: "RecipeView",
519
+ setup(h) {
520
+ const p = A(), y = F(() => p.recipes), a = xe(), { createRecipe: s, updateRecipe: c } = G(), { recipeDialogProps: i, recipeViewLoading: f } = Be(G()), { columnDefs: u, formatRowData: d } = Le(), n = F(() => d(y.value));
521
+ function l(e) {
522
+ if (e === "add")
523
+ return s();
524
+ if (e === "export")
525
+ return Qe();
526
+ }
527
+ const t = C(""), _ = F(() => f.value), { breakpoints: g } = De(), r = F(() => g.value.xs || g.value.sm), m = F(() => r.value ? 10 : 20), E = Ee(), { t: k } = K();
528
+ return (e, o) => {
529
+ const B = S("FmTable");
530
+ return x(), T(Ce, {
531
+ title: b(k)("inventory.recipe.title"),
532
+ actions: [
533
+ {
534
+ label: b(k)("inventory.recipe.create.title"),
535
+ value: "add",
536
+ isPrimary: !0,
537
+ prependIcon: "add"
538
+ },
539
+ { label: b(k)("common.export"), value: "export", isPrimary: !1 }
540
+ ],
541
+ "onClick:action": l
542
+ }, {
543
+ default: P(() => [
544
+ R("div", {
545
+ class: de([
546
+ "flex flex-col gap-8 max-h-full",
547
+ {
548
+ "p-0": r.value,
549
+ "px-24 ": !r.value
550
+ }
551
+ ])
552
+ }, [
553
+ v(Se, {
554
+ searchable: "",
555
+ search: t.value,
556
+ "onUpdate:search": o[0] || (o[0] = (I) => t.value = I)
557
+ }, null, 8, ["search"]),
558
+ (x(), T(B, {
559
+ style: me(b(E).tableHeight),
560
+ "column-defs": b(u),
561
+ "row-data": n.value,
562
+ "search-value": t.value,
563
+ loading: !b(a)._currentLocation || _.value,
564
+ onRowClick: o[1] || (o[1] = (I) => b(c)(I.original.original)),
565
+ key: y.value.length,
566
+ "page-size": m.value
567
+ }, {
568
+ "list-row": P((I) => [
569
+ v(Fe, {
570
+ row: I,
571
+ onRowClick: (D) => b(c)(D.original)
572
+ }, {
573
+ default: P((D) => {
574
+ var M, U, N, w, z, J, Q, W, L, X;
575
+ return [
576
+ R("div", We, [
577
+ R("div", Xe, [
578
+ v(b(oe), {
579
+ render: (N = (U = (M = D.recipe) == null ? void 0 : M.column) == null ? void 0 : U.columnDef) == null ? void 0 : N.cell,
580
+ props: (z = (w = D.recipe) == null ? void 0 : w.getContext) == null ? void 0 : z.call(w)
581
+ }, null, 8, ["render", "props"])
582
+ ]),
583
+ R("div", Ze, [
584
+ v(b(oe), {
585
+ render: (W = (Q = (J = D.ingredients) == null ? void 0 : J.column) == null ? void 0 : Q.columnDef) == null ? void 0 : W.cell,
586
+ props: (X = (L = D.ingredients) == null ? void 0 : L.getContext) == null ? void 0 : X.call(L)
587
+ }, null, 8, ["render", "props"])
588
+ ])
589
+ ])
590
+ ];
591
+ }),
592
+ _: 2
593
+ }, 1032, ["row", "onRowClick"])
594
+ ]),
595
+ _: 1
596
+ }, 8, ["style", "column-defs", "row-data", "search-value", "loading", "page-size"]))
597
+ ], 2),
598
+ (x(), T(pe, { to: "body" }, [
599
+ v(Je, fe(ve(b(i))), null, 16)
600
+ ]))
601
+ ]),
602
+ _: 1
603
+ }, 8, ["title", "actions"]);
604
+ };
605
+ }
606
+ });
607
+ export {
608
+ it as default
609
+ };
@@ -1,19 +1,19 @@
1
1
  import { defineComponent as re, ref as H, computed as I, resolveComponent as B, openBlock as $, createBlock as z, withCtx as D, createElementVNode as n, normalizeClass as he, toDisplayString as k, createVNode as g, createElementBlock as O, Fragment as ne, renderList as ae, unref as u, h as ye, watch as ke, isRef as je, createCommentVNode as te, reactive as at, onMounted as qe, normalizeStyle as Je, createTextVNode as pe, Teleport as rt, normalizeProps as Se, mergeProps as we } from "vue";
2
- import { u as ce, O as lt, e as Ue, f as it, a as Ie, F as Le, P as Ce, i as ie, K as ut, t as ge, N as Me, A as ct, M as dt, L as ve, Q as mt, T as ee, V as pt, W as ze, l as vt, J as ft, X as yt, Y as _t, Z as Qe, $ as q, a0 as ht, q as Xe, a1 as De, a2 as kt, a3 as gt, n as Ne, a4 as bt, a5 as xt, C as Fe, a6 as St, a7 as wt, a8 as Ft, y as $t, z as At, B as Vt, E as Ct, G as Ye } from "./app-UTiudUUR.js";
3
- import { u as Pe, a as Te } from "./stock-CxRxidDu.js";
4
- import { g as be } from "./decimal-tyBgHJ47.js";
5
- import { e as Mt, u as Ze, i as et, _ as Ke } from "./PremiumBadge.vue_vue_type_script_setup_true_lang-DHbxXDGy.js";
2
+ import { u as ce, O as lt, e as Ue, f as it, a as Ie, F as Le, P as Ce, i as ie, K as ut, t as ge, N as Me, A as ct, M as dt, L as ve, Q as mt, T as ee, V as pt, W as ze, l as vt, J as ft, X as yt, Y as _t, Z as Qe, $ as q, a0 as ht, q as Xe, a1 as De, a2 as kt, a3 as gt, n as Ne, a4 as bt, a5 as xt, C as Fe, a6 as St, a7 as wt, a8 as Ft, y as $t, z as At, B as Vt, E as Ct, G as Ye } from "./app-BE8SgDqI.js";
3
+ import { u as Pe, a as Te } from "./stock-C2xyYnS7.js";
4
+ import { g as be } from "./decimal-xj3kVOP6.js";
5
+ import { e as Mt, u as Ze, i as et, _ as Ke } from "./PremiumBadge.vue_vue_type_script_setup_true_lang-B4d0c3nk.js";
6
6
  import { _ as Be, S as $e, g as tt } from "./StockForecast.vue_vue_type_style_index_0_lang-KLXSWvo5.js";
7
7
  import { _ as Dt } from "./PreviewBadge.vue_vue_type_script_setup_true_lang-CRZiQHjx.js";
8
8
  import { useI18n as le, useCoreStore as Bt } from "@feedmepos/mf-common";
9
9
  import { useSnackbar as fe, useDialog as nt, useProxiedModel as Re, useBreakpoints as jt } from "@feedmepos/ui-library";
10
10
  import { defineStore as Ut } from "pinia";
11
- import { u as It } from "./use-inventory-binding-dialog-DwSvUvRl.js";
12
- import { _ as Pt } from "./NumberPrecisionInput.vue_vue_type_script_setup_true_lang-BlEgALMj.js";
11
+ import { u as It } from "./use-inventory-binding-dialog-Dm8Ky1MH.js";
12
+ import { _ as Pt } from "./NumberPrecisionInput.vue_vue_type_script_setup_true_lang-DfpG3Fy8.js";
13
13
  import { E as Tt } from "./empty-placeholder-wf6-BWE8.js";
14
- import "./index-DlhdTaa8.js";
14
+ import "./index-C6SzYqK7.js";
15
15
  import "./array-hChJVZLE.js";
16
- import { u as Rt } from "./feature-z7inw9y6.js";
16
+ import { u as Rt } from "./feature-CWpNYcWJ.js";
17
17
  var _e = /* @__PURE__ */ ((p) => (p.History = "History", p.Convert = "Convert", p.Adjust = "Adjust", p))(_e || {});
18
18
  const Ht = [
19
19
  {
@@ -1,11 +1,11 @@
1
1
  import { defineComponent as Q, mergeModels as Gd, computed as F, useModel as Hd, resolveComponent as T, openBlock as E, createElementBlock as O, createElementVNode as g, createVNode as N, withCtx as k, toDisplayString as A, unref as f, Fragment as q, renderList as ee, ref as L, createBlock as j, createCommentVNode as K, isRef as Qe, createTextVNode as Id, normalizeClass as J, watch as Fd, createSlots as jd, onMounted as Kd, normalizeStyle as Wd, Teleport as Yd } from "vue";
2
- import { u as re } from "./supplier-BhyiTwSJ.js";
3
- import { b as Fe, f as Xd, D as ed, h as ie, e as Pe, a as Od, n as dd, j as Zd, J as zd, C as he, s as wd, u as pe, l as G, d as U, p as Ad, q as qd, r as Rd, v as Jd, w as Qd, x as et, y as dt, z as tt, B as rt, E as nt, G as le } from "./app-UTiudUUR.js";
2
+ import { u as re } from "./supplier-B-7o9hg1.js";
3
+ import { b as Fe, f as Xd, D as ed, h as ie, e as Pe, a as Od, n as dd, j as Zd, J as zd, C as he, s as wd, u as pe, l as G, d as U, p as Ad, q as qd, r as Rd, v as Jd, w as Qd, x as et, y as dt, z as tt, B as rt, E as nt, G as le } from "./app-BE8SgDqI.js";
4
4
  import { useI18n as X, useCoreStore as Oe } from "@feedmepos/mf-common";
5
5
  import { useDialog as we, useSnackbar as me, useProxiedModel as td, useDialogChild as ot, useBreakpoints as at } from "@feedmepos/ui-library";
6
6
  import { _ as $t } from "./PreviewBadge.vue_vue_type_script_setup_true_lang-CRZiQHjx.js";
7
- import { _ as it } from "./FmUnitInput.vue_vue_type_script_setup_true_lang-CNzEHF-R.js";
8
- import { u as Td } from "./feature-z7inw9y6.js";
7
+ import { _ as it } from "./FmUnitInput.vue_vue_type_script_setup_true_lang-DzoEp-Pg.js";
8
+ import { u as Td } from "./feature-CWpNYcWJ.js";
9
9
  import { defineStore as lt } from "pinia";
10
10
  function st(e, d) {
11
11
  const { t } = X(), r = Fe();
@@ -1,9 +1,9 @@
1
1
  import { ref as L, computed as G, h as te, defineComponent as ge, unref as i, openBlock as S, createElementBlock as k, createElementVNode as e, toDisplayString as g, createCommentVNode as x, resolveComponent as ee, createVNode as V, createBlock as Z, isRef as Be, withCtx as me, Fragment as re, normalizeClass as fe, renderList as pe } from "vue";
2
- import { X as Me, u as ye, aF as q, a2 as Ue, a4 as Le, a5 as je, ah as Ve, d as Oe, e as Ne, aq as M, V as Te, aG as Ke, Z as be, L as ve, i as le, aH as xe, a9 as he, f as De, D as U, h as B, b as Pe, a3 as Ge, an as qe, a1 as ke, ad as Ae } from "./app-UTiudUUR.js";
2
+ import { X as Me, u as ye, aF as q, a2 as Ue, a4 as Le, a5 as je, ah as Ve, d as Oe, e as Ne, aq as M, V as Te, aG as Ke, Z as be, L as ve, i as le, aH as xe, a9 as he, f as De, D as U, h as B, b as Pe, a3 as Ge, an as qe, a1 as ke, ad as Ae } from "./app-BE8SgDqI.js";
3
3
  import { useDialog as Se, useSnackbar as _e, useProxiedModel as He } from "@feedmepos/ui-library";
4
- import { u as Ce } from "./feature-z7inw9y6.js";
5
- import { b as ze, u as Ye, f as $e, P as se } from "./format-unit-display-DN0KtCh2.js";
6
- import { F as Qe } from "./decimal-tyBgHJ47.js";
4
+ import { u as Ce } from "./feature-CWpNYcWJ.js";
5
+ import { b as ze, u as Ye, f as $e, P as se } from "./format-unit-display-CZ835oaL.js";
6
+ import { F as Qe } from "./decimal-xj3kVOP6.js";
7
7
  import { useI18n as Ee } from "@feedmepos/mf-common";
8
8
  import { E as We } from "./empty-placeholder-wf6-BWE8.js";
9
9
  const Ie = Me((v, y) => {