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

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