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