@feedmepos/mf-inventory-portal 1.0.12-dev.1 → 1.0.12-dev.2

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 (55) hide show
  1. package/dist/{App-Cicsptfk.js → App-Byn7tHre.js} +37 -37
  2. package/dist/{ApprovalView-oRqJ-z0x.js → ApprovalView-C_B6Ud1v.js} +2 -2
  3. package/dist/{BindingsDialog-BOIsLkdn.js → BindingsDialog-DpM-rpFr.js} +2 -2
  4. package/dist/{BindingsPicker-Co4UtTLT.js → BindingsPicker-CCKlnHQ8.js} +1 -1
  5. package/dist/{BindingsTable-DLsppTGt.js → BindingsTable-m3Z7ozrU.js} +1 -1
  6. package/dist/{ClosingDraftView-CQ0s4iL_.js → ClosingDraftView-Dm8eo0Vz.js} +2 -2
  7. package/dist/{ClosingTemplateView-B0q2VTDz.js → ClosingTemplateView-C0kKeAKu.js} +2 -2
  8. package/dist/{DeliveryOrderPrintPreview-BVR-8Wuk.js → DeliveryOrderPrintPreview-BiFBV9NI.js} +1 -1
  9. package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-DozsNol6.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-bBhR9dWX.js} +3 -3
  10. package/dist/{FmMultiselectDialog-cp5Eu4lS.js → FmMultiselectDialog-Cg-plZjp.js} +1 -1
  11. package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-BLqmn5u9.js → FmUnitInput.vue_vue_type_script_setup_true_lang-B0DdbgR8.js} +1 -1
  12. package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-Di-N8CUr.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-DNkyBsYX.js} +1 -1
  13. package/dist/IngredientGroupView-oRzzQrxP.js +8779 -0
  14. package/dist/{IngredientsView-Bqs24FKe.js → IngredientsView-UYr-9ckX.js} +5 -5
  15. package/dist/{IntegrationView-B5UglyZs.js → IntegrationView-Nb0j9Myn.js} +5 -5
  16. package/dist/{InventoryBindingForm-CNHEIU--.js → InventoryBindingForm-CfV17fI5.js} +1 -1
  17. package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-CXs6G1yw.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-LZRjwQEB.js} +4 -4
  18. package/dist/{InventoryBindingSummary-Y_t0JvQf.js → InventoryBindingSummary-B2rDd4KS.js} +1 -1
  19. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-BtpbycMa.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-O3oG04C3.js} +1 -1
  20. package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-Bv_4XhnW.js → PremiumBadge.vue_vue_type_script_setup_true_lang-C9P0w1Yo.js} +1 -1
  21. package/dist/{PublishView-CwZCF0a5.js → PublishView-lKWxaVGi.js} +2 -2
  22. package/dist/{PurchaseOrderPrintPreview-CSYvISrP.js → PurchaseOrderPrintPreview-C3pE7pKw.js} +1 -1
  23. package/dist/{ReceiveRequestView-CTuh_NZ_.js → ReceiveRequestView-Cntcdt7e.js} +11 -11
  24. package/dist/RecipeView-bzu1U9Gq.js +620 -0
  25. package/dist/{StockView-Cg1jE2Zw.js → StockView-R5AjS5ZP.js} +8 -8
  26. package/dist/{SupplierView-EknM6vks.js → SupplierView-BP_67SXq.js} +4 -4
  27. package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-Dkk3gKIY.js → TransferDetails.vue_vue_type_script_setup_true_lang-BvgmrVSD.js} +6 -6
  28. package/dist/{TransferTemplateView-Ciwc17PA.js → TransferTemplateView-BJLK64th.js} +7 -7
  29. package/dist/{UnitView-B2mpu5IV.js → UnitView--wdY45MB.js} +3 -3
  30. package/dist/{WarehouseView-DpZzsLzE.js → WarehouseView-iSOrBTnq.js} +1 -1
  31. package/dist/api/inventory.d.ts +0 -66
  32. package/dist/{app-C_s8CpzV.js → app-kveWTQjE.js} +3154 -3245
  33. package/dist/app.js +1 -1
  34. package/dist/{array-hChJVZLE.js → array-Ca8T3f_G.js} +7 -6
  35. package/dist/components/inventory-binding/InventoryBinding.vue.d.ts +0 -22
  36. package/dist/components/shell/inventory/binding-ui.vue.d.ts +0 -22
  37. package/dist/{decimal-D6jyMGK9.js → decimal-DY8OyZOE.js} +1 -1
  38. package/dist/{feature-BGozj4cq.js → feature-C0TlUzuT.js} +2 -2
  39. package/dist/{format-unit-display-WWMXXaOF.js → format-unit-display-Q_edRr_A.js} +2 -2
  40. package/dist/{index-ChkhtUlV.js → index-B-ZEfBgj.js} +2 -2
  41. package/dist/{index-D1dhDInI.js → index-BMpOpRCf.js} +1 -1
  42. package/dist/{stock-5qJE0ApW.js → stock-C40mVN4W.js} +1 -1
  43. package/dist/stores/inventory.d.ts +0 -88
  44. package/dist/{supplier-CxTBVGVa.js → supplier-DvZ8SCGg.js} +2 -2
  45. package/dist/tsconfig.app.tsbuildinfo +1 -1
  46. package/dist/{use-ingredient-select-dialog-Cxn_cX8W.js → use-ingredient-select-dialog-CeK0rLZb.js} +1 -1
  47. package/dist/{use-inventory-binding-dialog--nqAQCSl.js → use-inventory-binding-dialog-BV-rxXkP.js} +1 -1
  48. package/dist/views/recipe/components/recipe-form/RecipeForm.vue.d.ts +0 -44
  49. package/dist/{vue-i18n-DDOrxu8s.js → vue-i18n-CYoGKQoJ.js} +201 -201
  50. package/package.json +3 -3
  51. package/dist/IngredientGroupView-DbkNqoE2.js +0 -898
  52. package/dist/RecipeView-OMZcKOQh.js +0 -767
  53. package/dist/app-YTo31ukE.js +0 -7888
  54. package/dist/views/recipe/components/recipe-override-form-field/RecipeOverrideFormField.vue.d.ts +0 -61
  55. package/dist/views/recipe/composables/use-recipe-overrides-form-field.d.ts +0 -10
@@ -0,0 +1,620 @@
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
+ };
@@ -1,18 +1,18 @@
1
1
  import { defineComponent as ie, ref as O, computed as U, resolveComponent as M, openBlock as A, createBlock as Y, withCtx as D, createElementVNode as t, normalizeClass as ge, toDisplayString as h, createVNode as g, createElementBlock as R, Fragment as X, renderList as le, unref as r, h as _e, watch as be, isRef as Ie, createCommentVNode as ne, reactive as at, onMounted as qe, normalizeStyle as Je, createTextVNode as ce, Teleport as rt, normalizeProps as we, mergeProps as $e } from "vue";
2
- import { u as pe, L as lt, e as Te, f as it, a as Ue, F as Le, N as ut, O as Be, i as de, H as ct, t as xe, K as De, A as dt, M as mt, J as fe, P as pt, Q as te, T as vt, V as Ne, l as ft, W as yt, X as _t, Y as kt, Z as Qe, $ as G, a0 as ht, r as Xe, a1 as ke, a2 as gt, a3 as bt, n as Ae, k as ze, o as xt, a4 as St, a5 as Ft, a6 as wt, a7 as $t, a8 as At, z as Ct, _ as Vt, B as Mt, C as Bt, E as Ye } from "./app-C_s8CpzV.js";
3
- import { u as Pe, a as He } from "./stock-5qJE0ApW.js";
4
- import { g as Se } from "./decimal-D6jyMGK9.js";
5
- import { e as Dt, u as Ze, i as et, _ as Ke } from "./PremiumBadge.vue_vue_type_script_setup_true_lang-Bv_4XhnW.js";
2
+ import { u as pe, L as lt, e as Te, f as it, a as Ue, F as Le, N as ut, O as Be, i as de, H as ct, t as xe, K as De, A as dt, M as mt, J as fe, P as pt, Q as te, T as vt, V as Ne, l as ft, W as yt, X as _t, Y as kt, Z as Qe, $ as G, a0 as ht, r as Xe, a1 as ke, a2 as gt, a3 as bt, n as Ae, k as ze, o as xt, a4 as St, a5 as Ft, a6 as wt, a7 as $t, a8 as At, z as Ct, _ as Vt, B as Mt, C as Bt, E as Ye } from "./app-kveWTQjE.js";
3
+ import { u as Pe, a as He } from "./stock-C40mVN4W.js";
4
+ import { g as Se } from "./decimal-DY8OyZOE.js";
5
+ import { e as Dt, u as Ze, i as et, _ as Ke } from "./PremiumBadge.vue_vue_type_script_setup_true_lang-C9P0w1Yo.js";
6
6
  import { _ as je, S as Ce, g as tt } from "./StockForecast.vue_vue_type_style_index_0_lang-KLXSWvo5.js";
7
7
  import { _ as jt } from "./PreviewBadge.vue_vue_type_script_setup_true_lang-CRZiQHjx.js";
8
8
  import { useI18n as ue, useCoreStore as It } from "@feedmepos/mf-common";
9
9
  import { useSnackbar as ye, useDialog as nt, useProxiedModel as Ee, useBreakpoints as Tt } from "@feedmepos/ui-library";
10
10
  import { defineStore as Ut } from "pinia";
11
- import { u as Pt } from "./use-inventory-binding-dialog--nqAQCSl.js";
12
- import { _ as Ht } from "./NumberPrecisionInput.vue_vue_type_script_setup_true_lang-BtpbycMa.js";
11
+ import { u as Pt } from "./use-inventory-binding-dialog-BV-rxXkP.js";
12
+ import { _ as Ht } from "./NumberPrecisionInput.vue_vue_type_script_setup_true_lang-O3oG04C3.js";
13
13
  import { E as Et } from "./empty-placeholder-wf6-BWE8.js";
14
- import "./array-hChJVZLE.js";
15
- import { u as Rt } from "./feature-BGozj4cq.js";
14
+ import "./array-Ca8T3f_G.js";
15
+ import { u as Rt } from "./feature-C0TlUzuT.js";
16
16
  var he = /* @__PURE__ */ ((f) => (f.History = "History", f.Convert = "Convert", f.Adjust = "Adjust", f))(he || {});
17
17
  const Ot = [
18
18
  {
@@ -1,11 +1,11 @@
1
1
  import { defineComponent as Q, mergeModels as Bd, computed as I, useModel as Gd, resolveComponent as T, openBlock as S, createElementBlock as F, createElementVNode as g, createVNode as N, withCtx as k, toDisplayString as w, unref as u, Fragment as q, renderList as ee, ref as D, createBlock as j, createCommentVNode as K, isRef as Je, normalizeClass as J, createTextVNode as Hd, watch as Id, createSlots as jd, normalizeStyle as Kd, Teleport as Wd } from "vue";
2
- import { u as re } from "./supplier-CxTBVGVa.js";
3
- import { b as Ie, f as Yd, D as Qe, h as ie, e as _e, a as Fd, n as ed, o as dd, j as Xd, W as Zd, v as Od, u as pe, l as G, d as V, q as wd, r as zd, s as Ad, w as qd, x as Jd, y as Qd, z as et, _ as dt, B as tt, C as rt, E as le } from "./app-C_s8CpzV.js";
2
+ import { u as re } from "./supplier-DvZ8SCGg.js";
3
+ import { b as Ie, f as Yd, D as Qe, h as ie, e as _e, a as Fd, n as ed, o as dd, j as Xd, W as Zd, v as Od, u as pe, l as G, d as V, q as wd, r as zd, s as Ad, w as qd, x as Jd, y as Qd, z as et, _ as dt, B as tt, C as rt, E as le } from "./app-kveWTQjE.js";
4
4
  import { useI18n as X, useCoreStore as Fe } from "@feedmepos/mf-common";
5
5
  import { useDialog as Oe, useSnackbar as me, useProxiedModel as td, useDialogChild as nt, useBreakpoints as ot } from "@feedmepos/ui-library";
6
6
  import { _ as at } from "./PreviewBadge.vue_vue_type_script_setup_true_lang-CRZiQHjx.js";
7
- import { _ as $t } from "./FmUnitInput.vue_vue_type_script_setup_true_lang-BLqmn5u9.js";
8
- import { u as Td } from "./feature-BGozj4cq.js";
7
+ import { _ as $t } from "./FmUnitInput.vue_vue_type_script_setup_true_lang-B0DdbgR8.js";
8
+ import { u as Td } from "./feature-C0TlUzuT.js";
9
9
  import { defineStore as it } from "pinia";
10
10
  function lt(e, d) {
11
11
  const { t } = X(), r = Ie();
@@ -1,13 +1,13 @@
1
- import { X as it, u as me, aH as D, b as Be, a2 as ut, a4 as dt, a5 as mt, aI as ft, d as Ye, e as tt, T as rt, aJ as pt, Z as Fe, J as ke, i as le, aK as st, a9 as De, f as We, h as z, D as Z, aq as se, a3 as yt, ao as Je, a1 as xe, aL as vt, ae as Pe, ar as ht } from "./app-C_s8CpzV.js";
1
+ import { X as it, u as me, aH as D, b as Be, a2 as ut, a4 as dt, a5 as mt, aI as ft, d as Ye, e as tt, T as rt, aJ as pt, Z as Fe, J as ke, i as le, aK as st, a9 as De, f as We, h as z, D as Z, aq as se, a3 as yt, ao as Je, a1 as xe, aL as vt, ae as Pe, ar as ht } from "./app-kveWTQjE.js";
2
2
  import { ref as j, computed as G, h as N, defineComponent as Ne, onMounted as at, unref as p, openBlock as _, createElementBlock as k, createElementVNode as r, toDisplayString as R, createCommentVNode as L, resolveComponent as Q, createVNode as E, reactive as bt, createBlock as ue, withCtx as de, watch as gt, isRef as _t, Fragment as te, normalizeClass as Oe, createTextVNode as $e, renderList as ye, resolveDynamicComponent as wt } from "vue";
3
- import { F as St } from "./decimal-D6jyMGK9.js";
4
- import { b as Rt, u as xt, f as nt, P as he } from "./format-unit-display-WWMXXaOF.js";
3
+ import { F as St } from "./decimal-DY8OyZOE.js";
4
+ import { b as Rt, u as xt, f as nt, P as he } from "./format-unit-display-Q_edRr_A.js";
5
5
  import { useCoreStore as Ue, useI18n as ot } from "@feedmepos/mf-common";
6
6
  import { E as Ot } from "./empty-placeholder-wf6-BWE8.js";
7
7
  import { useDialog as Le, useSnackbar as Ve, components as Xe, FmButtonVariant as re, useProxiedModel as kt } from "@feedmepos/ui-library";
8
- import { u as Me, F as Ce } from "./feature-BGozj4cq.js";
9
- import { u as Dt } from "./index-ChkhtUlV.js";
10
- import { _ as Nt, F as qt, a as At } from "./FmUnitInput.vue_vue_type_script_setup_true_lang-BLqmn5u9.js";
8
+ import { u as Me, F as Ce } from "./feature-C0TlUzuT.js";
9
+ import { u as Dt } from "./index-B-ZEfBgj.js";
10
+ import { _ as Nt, F as qt, a as At } from "./FmUnitInput.vue_vue_type_script_setup_true_lang-B0DdbgR8.js";
11
11
  import { u as Tt, R as Ze } from "./usePromise-CbVUCxhj.js";
12
12
  const qe = it((n, l) => {
13
13
  const o = me(), g = Ue();