@feedmepos/mf-inventory-portal 0.0.19-dev.1 → 0.0.19-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 (59) hide show
  1. package/dist/{ApprovalView-BTZwnKLf.js → ApprovalView-DU7oB2Zk.js} +42 -39
  2. package/dist/{BindingsDialog-DpC48bqK.js → BindingsDialog-BgfV0G46.js} +2 -2
  3. package/dist/{BindingsPicker-BU52g6zk.js → BindingsPicker-tUI5WYBk.js} +2 -2
  4. package/dist/{BindingsTable-aIuFdScv.js → BindingsTable-8G-Nc4pC.js} +18 -17
  5. package/dist/FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-DaHXKF1s.js +273 -0
  6. package/dist/{FmMultiselectDialog.vue_vue_type_script_setup_true_lang-n09XXJZK.js → FmMultiselectDialog.vue_vue_type_script_setup_true_lang-CxOk5ule.js} +2 -2
  7. package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-B-19iYaK.js → FmUnitInput.vue_vue_type_script_setup_true_lang-D-vJDMKb.js} +3 -3
  8. package/dist/IngredientsView-CAh7D4tL.js +1760 -0
  9. package/dist/{IntegrationView-Dn_qL_vC.js → IntegrationView-Bf7yHuS8.js} +3 -3
  10. package/dist/InventoryBindingForm.vue_vue_type_script_setup_true_lang-BdVrpR9J.js +277 -0
  11. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-BuyM580N.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-BKlWhMnB.js} +1 -1
  12. package/dist/{PurchaseOrderPrintPreview-EeKhENYH.js → PurchaseOrderPrintPreview-YFcOtdfJ.js} +1 -1
  13. package/dist/ReceiveRequestView-bIXyVVX9.js +1401 -0
  14. package/dist/RecipeView-BD0mvxCg.js +575 -0
  15. package/dist/StockForecast.vue_vue_type_style_index_0_lang-KLXSWvo5.js +59 -0
  16. package/dist/StockView-BCq37bGl.js +1865 -0
  17. package/dist/SupplierView-BiSqTXnz.js +804 -0
  18. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-CvbKNb0C.js +1033 -0
  19. package/dist/UnitView-DSdn__9m.js +643 -0
  20. package/dist/WarehouseView-B8UxxAL6.js +1051 -0
  21. package/dist/api/bill.d.ts +2 -2
  22. package/dist/app-RVyC2D4O.js +43892 -0
  23. package/dist/app.d.ts +1002 -0
  24. package/dist/app.js +4 -3
  25. package/dist/components/FmDroppableField.vue.d.ts +1 -1
  26. package/dist/{date2-Cvp5iJkI.js → date2-C2PfOqbB.js} +1 -1
  27. package/dist/{dayjs.min-D1_pOsO7.js → dayjs.min-0pzT_dbr.js} +1 -1
  28. package/dist/{decimal-BAZuuTcd.js → decimal-BtIn4K57.js} +1 -1
  29. package/dist/{fuzzy-0roCBvgC.js → fuzzy-yzIM5KUK.js} +1 -1
  30. package/dist/{index-B_aEOJsR.js → index-l87_vggM.js} +1 -1
  31. package/dist/{layout-BnTfCS_X.js → layout-ITqYtCVu.js} +1 -1
  32. package/dist/{number-DLj3W3RW.js → number-B5d98l0m.js} +1 -1
  33. package/dist/router/name.d.ts +2 -1
  34. package/dist/{rules-CCmXA0Yi.js → rules-CCwuHe8Y.js} +2 -2
  35. package/dist/{stock-estimate-CL4HShG8.js → stock-estimate-C4PL0Fcz.js} +2 -2
  36. package/dist/style.css +1 -1
  37. package/dist/{supplier-CjAH8O1y.js → supplier-CA0OR3DU.js} +1 -1
  38. package/dist/tsconfig.app.tsbuildinfo +1 -1
  39. package/dist/{use-inventory-binding-dialog-GkJOzE6V.js → use-inventory-binding-dialog-CTriImiV.js} +2 -2
  40. package/dist/views/receive-request/components/transfer-form/SparkIcon.vue.d.ts +1 -1
  41. package/dist/views/stock/components/StockRecordCard.vue.d.ts +1 -1
  42. package/dist/views/stock/components/dialog/AdjustedItemForm.vue.d.ts +2 -2
  43. package/dist/views/stock/helper/compute-summary-total.d.ts +2 -2
  44. package/dist/{xlsx-vUzm_udV.js → xlsx-DAVatAlv.js} +660 -660
  45. package/dist/xlsx.util-BsZI2tNE.js +109 -0
  46. package/package.json +6 -5
  47. package/dist/FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-DjgmtvXU.js +0 -268
  48. package/dist/IngredientsView-DMyEGdik.js +0 -1767
  49. package/dist/InventoryBindingForm.vue_vue_type_script_setup_true_lang-DGTLUrb9.js +0 -276
  50. package/dist/ReceiveRequestView-BOdgbFFM.js +0 -1394
  51. package/dist/RecipeView-B1aNLDIK.js +0 -573
  52. package/dist/StockForecast.vue_vue_type_style_index_0_lang-B5EK101t.js +0 -58
  53. package/dist/StockView-C_Ur_jTg.js +0 -1862
  54. package/dist/SupplierView-CXfOoHTr.js +0 -796
  55. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-kjV5Eazv.js +0 -1028
  56. package/dist/UnitView-DHXfAsnq.js +0 -635
  57. package/dist/WarehouseView-DMwbxs1q.js +0 -1043
  58. package/dist/app-BkcO8oNJ.js +0 -66113
  59. package/dist/xlsx.util-B_bqymTM.js +0 -107
@@ -0,0 +1,575 @@
1
+ import { defineComponent as N, ref as x, onMounted as se, resolveComponent as k, openBlock as R, createElementBlock as A, Fragment as le, createElementVNode as h, toDisplayString as re, createVNode as p, createCommentVNode as j, computed as S, watch as ie, createBlock as M, withCtx as I, unref as y, isRef as X, normalizeStyle as ce, Teleport as ue, normalizeProps as de, guardReactiveProps as me } from "vue";
2
+ import { u as P, c as K, S as pe, b as Z, f as fe } from "./app-RVyC2D4O.js";
3
+ import { useDialog as ve, useSnackbar as ne, useProxiedModel as ee, useBreakpoints as ye } from "@feedmepos/ui-library";
4
+ import { i as _e, _ as ge } from "./is-linked-ingredient-error-C6AghEwR.js";
5
+ import { F as w, D as te, R as z } from "./row-action.enum-BwQbURNh.js";
6
+ import { _ as ae, t as be, d as he } from "./xlsx.util-BsZI2tNE.js";
7
+ import { c as we, _ as Re, F as oe, u as xe } from "./layout-ITqYtCVu.js";
8
+ import { a as q } from "./number-B5d98l0m.js";
9
+ import { useI18n as Y } from "@feedmepos/mf-common";
10
+ import { _ as Ce, a as Ee } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-DaHXKF1s.js";
11
+ import { R as ke, U as Ve } from "./rules-CCwuHe8Y.js";
12
+ import { _ as Fe } from "./InventoryBindingForm.vue_vue_type_script_setup_true_lang-BdVrpR9J.js";
13
+ import { f as De } from "./date2-C2PfOqbB.js";
14
+ const Se = {
15
+ key: 0,
16
+ class: "flex flex-col items-center w-full h-full gap-24"
17
+ }, $e = /* @__PURE__ */ h("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary pl-8" }, "Loading...", -1), Ae = { key: 1 }, Ie = /* @__PURE__ */ h("br", null, null, -1), Pe = { key: 0 }, Te = /* @__PURE__ */ h("p", { class: "fm-typo-en-body-lg-600" }, "Affected menu items:", -1), Me = /* @__PURE__ */ N({
18
+ __name: "DeleteDialog",
19
+ props: {
20
+ type: {},
21
+ data: {},
22
+ message: {},
23
+ bindedItems: {}
24
+ },
25
+ setup(_) {
26
+ const d = _, f = x(d.bindedItems || []), s = x(!1);
27
+ se(() => {
28
+ n();
29
+ });
30
+ async function n() {
31
+ var u, l;
32
+ !s.value && ((u = d.data) != null && u._id) && (s.value = !0, f.value = await P().getAffectedMenu((l = d.data) == null ? void 0 : l._id), s.value = !1);
33
+ }
34
+ return (u, l) => {
35
+ const c = k("FmSpacer"), m = k("FmCircularProgress");
36
+ return R(), A(le, null, [
37
+ h("p", null, re(u.message), 1),
38
+ s.value ? (R(), A("div", Se, [
39
+ p(c),
40
+ h("div", null, [
41
+ p(m, { size: "xl" })
42
+ ]),
43
+ $e,
44
+ p(c)
45
+ ])) : (R(), A("div", Ae, [
46
+ Ie,
47
+ f.value.length > 0 ? (R(), A("div", Pe, [
48
+ Te,
49
+ p(ae, {
50
+ name: "Menu",
51
+ bindings: f.value
52
+ }, null, 8, ["bindings"])
53
+ ])) : j("", !0)
54
+ ]))
55
+ ], 64);
56
+ };
57
+ }
58
+ });
59
+ function Ue() {
60
+ const _ = ve(), d = ne(), f = P(), s = x(!1), n = x();
61
+ function u() {
62
+ const t = {
63
+ recipe: {},
64
+ mode: w.CREATE,
65
+ show: !0,
66
+ "onUpdate:show"(a) {
67
+ n.value.show = a;
68
+ }
69
+ };
70
+ n.value = t;
71
+ }
72
+ async function l(t) {
73
+ const a = {
74
+ recipe: K(t),
75
+ mode: w.UPDATE,
76
+ show: !0,
77
+ "onUpdate:show"(b) {
78
+ n.value.show = b;
79
+ }
80
+ };
81
+ n.value = a;
82
+ }
83
+ async function c(t) {
84
+ s.value = !0;
85
+ try {
86
+ await f.deleteRecipe(t), d.open({
87
+ title: "Success",
88
+ message: `Deleted ${t.name}`,
89
+ type: "success"
90
+ });
91
+ } catch (a) {
92
+ a instanceof pe && _e(a) ? _.open({
93
+ title: "Cannot delete recipe",
94
+ contentComponent: ge,
95
+ contentComponentProps: {
96
+ subject: (t == null ? void 0 : t.name) ?? "",
97
+ items: a.errorResponse.message
98
+ },
99
+ secondaryActions: {
100
+ text: "Close",
101
+ close: !0
102
+ }
103
+ }) : console.log("unable to delete recipe", a), d.open({
104
+ title: `Cannot delete ${t == null ? void 0 : t.name}`,
105
+ message: "Please try again.",
106
+ type: "error"
107
+ }), console.error("failed to delete recipe", a);
108
+ } finally {
109
+ s.value = !1;
110
+ }
111
+ }
112
+ function m(t) {
113
+ _.open({
114
+ title: `Delete ${(t == null ? void 0 : t.name) ?? "recipe"}?`,
115
+ closeButton: !1,
116
+ primaryActions: {
117
+ text: "Delete",
118
+ close: !0,
119
+ variant: "destructive"
120
+ },
121
+ secondaryActions: {
122
+ text: "Cancel",
123
+ close: !0
124
+ },
125
+ contentComponent: Me,
126
+ contentComponentProps: {
127
+ type: "menu",
128
+ data: t,
129
+ message: "You may not be able to delete this recipe if it is linked in any of the inventory modules."
130
+ }
131
+ }).onPrimary(() => c(t));
132
+ }
133
+ return {
134
+ createRecipe: u,
135
+ updateRecipe: l,
136
+ deleteRecipe: m,
137
+ recipeDialogProps: n,
138
+ recipeViewLoading: s
139
+ };
140
+ }
141
+ function Be({
142
+ updateRecipe: _,
143
+ deleteRecipe: d
144
+ }) {
145
+ const { t: f } = Y();
146
+ async function s(l, c) {
147
+ const m = K(c);
148
+ if (l === z.Edit) {
149
+ await _(m);
150
+ return;
151
+ }
152
+ if (l === z.Delete) {
153
+ await d(m);
154
+ return;
155
+ }
156
+ }
157
+ const n = [
158
+ {
159
+ accessorKey: "recipe",
160
+ header: f("inventory.recipe.name"),
161
+ size: 400
162
+ },
163
+ {
164
+ accessorKey: "ingredients",
165
+ header: f("inventory.recipe.ingredients"),
166
+ size: "auto"
167
+ },
168
+ {
169
+ id: "action",
170
+ header: "",
171
+ cell(l) {
172
+ return we(
173
+ [te[z.Edit], te[z.Delete]],
174
+ (c) => {
175
+ s(c, l.row.original.original);
176
+ }
177
+ );
178
+ },
179
+ enableSorting: !1,
180
+ size: 40,
181
+ meta: {
182
+ cellClass: "",
183
+ headerClass: ""
184
+ }
185
+ }
186
+ ];
187
+ function u(l) {
188
+ const c = P();
189
+ return l.map((m) => ({
190
+ recipe: m.name,
191
+ ingredients: m.contains.map((t) => {
192
+ var b, i;
193
+ const a = c.skuById[t.id];
194
+ return a ? `${a.name} (${q(t.amount)}${((b = t.measurement) == null ? void 0 : b.abbrev) ?? ((i = a == null ? void 0 : a.unit) == null ? void 0 : i.abbrev)})` : null;
195
+ }).filter((t) => t).join(", "),
196
+ original: m
197
+ }));
198
+ }
199
+ return { columnDefs: n, formatRowData: u };
200
+ }
201
+ const Le = { class: "flex flex-col gap-40" }, ze = {
202
+ key: 0,
203
+ class: "col-span-2 mt-16 border-1 border-fm-color-neutral-gray-200 fm-corner-radius-lg flex flex-col p-16 gap-16"
204
+ }, Ne = {
205
+ key: 0,
206
+ class: "flex flex-col items-center w-full h-full gap-24"
207
+ }, Ye = /* @__PURE__ */ h("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary pl-8" }, "Loading...", -1), He = { key: 1 }, je = /* @__PURE__ */ N({
208
+ __name: "RecipeForm",
209
+ props: {
210
+ mode: {},
211
+ modelValue: {},
212
+ disabled: { type: Boolean }
213
+ },
214
+ emits: ["update:modelValue", "click:submit"],
215
+ setup(_, { expose: d, emit: f }) {
216
+ var V;
217
+ const s = _, n = f, { t: u } = Y(), l = S({
218
+ get() {
219
+ var e;
220
+ return ((e = s.modelValue) == null ? void 0 : e.name) ?? "";
221
+ },
222
+ set(e) {
223
+ const o = s.modelValue ?? {};
224
+ o.name = e, n("update:modelValue", o);
225
+ }
226
+ }), c = S({
227
+ get() {
228
+ var e;
229
+ return ((e = s.modelValue) == null ? void 0 : e.contains) ?? [];
230
+ },
231
+ set(e) {
232
+ const o = s.modelValue ?? {};
233
+ o.contains = e, n("update:modelValue", o);
234
+ }
235
+ });
236
+ function m() {
237
+ n("click:submit");
238
+ }
239
+ const t = x();
240
+ d({
241
+ validateInputs: () => {
242
+ var e, o;
243
+ (o = (e = t.value) == null ? void 0 : e.validateInputs) == null || o.call(e);
244
+ },
245
+ resetInputsValidation: () => {
246
+ var e, o;
247
+ (o = (e = t.value) == null ? void 0 : e.resetInputsValidation) == null || o.call(e);
248
+ },
249
+ resetInputs: () => {
250
+ var e, o;
251
+ (o = (e = t.value) == null ? void 0 : e.resetInputs) == null || o.call(e);
252
+ }
253
+ });
254
+ const a = P(), b = x([]), i = x(!1), g = x(!1);
255
+ ie(i, async (e) => {
256
+ C(e);
257
+ });
258
+ async function C(e) {
259
+ var o, F;
260
+ e && !g.value && ((o = s.modelValue) != null && o._id) && (g.value = !0, b.value = await a.getAffectedMenu((F = s.modelValue) == null ? void 0 : F._id), g.value = !1);
261
+ }
262
+ const r = S(
263
+ () => a.recipes.map((e) => ({ label: e.name, value: e.name }))
264
+ ), v = x((V = s.modelValue) == null ? void 0 : V.name);
265
+ return (e, o) => {
266
+ const F = k("FmTextField"), H = k("FmCard"), $ = k("FmSwitch"), D = k("FmSpacer"), U = k("FmCircularProgress"), B = k("FmForm");
267
+ return R(), M(B, {
268
+ ref_key: "formRef",
269
+ ref: t,
270
+ onValidationSuccess: m
271
+ }, {
272
+ default: I(() => [
273
+ h("div", Le, [
274
+ p(F, {
275
+ disabled: e.disabled,
276
+ label: y(u)("inventory.recipe.name"),
277
+ "model-value": l.value,
278
+ "onUpdate:modelValue": o[0] || (o[0] = (E) => l.value = E),
279
+ rules: [
280
+ y(ke)(),
281
+ y(Ve)(r.value, v.value, (E) => `[${E.value}] already exists`)
282
+ ],
283
+ "label-mark": "required"
284
+ }, null, 8, ["disabled", "label", "model-value", "rules"]),
285
+ p(H, {
286
+ variant: "outlined",
287
+ class: "p-16"
288
+ }, {
289
+ default: I(() => {
290
+ var E;
291
+ return [
292
+ p(Fe, {
293
+ id: (E = e.modelValue) == null ? void 0 : E._id,
294
+ disabled: e.disabled,
295
+ "model-value": c.value,
296
+ "onUpdate:modelValue": o[1] || (o[1] = (T) => c.value = T)
297
+ }, null, 8, ["id", "disabled", "model-value"])
298
+ ];
299
+ }),
300
+ _: 1
301
+ })
302
+ ]),
303
+ e.mode !== y(w).CREATE ? (R(), A("div", ze, [
304
+ h("div", null, [
305
+ p($, {
306
+ label: "Show binded items",
307
+ modelValue: i.value,
308
+ "onUpdate:modelValue": o[2] || (o[2] = (E) => i.value = E),
309
+ "label-placement": "right",
310
+ disabled: g.value
311
+ }, null, 8, ["modelValue", "disabled"])
312
+ ]),
313
+ g.value ? (R(), A("div", Ne, [
314
+ p(D),
315
+ h("div", null, [
316
+ p(U, { size: "xl" })
317
+ ]),
318
+ Ye,
319
+ p(D)
320
+ ])) : (R(), A("div", He, [
321
+ i.value && b.value.length ? (R(), M(ae, {
322
+ key: 0,
323
+ name: "Menu",
324
+ bindings: b.value
325
+ }, null, 8, ["bindings"])) : j("", !0)
326
+ ]))
327
+ ])) : j("", !0)
328
+ ]),
329
+ _: 1
330
+ }, 512);
331
+ };
332
+ }
333
+ }), qe = { class: "flex gap-4" }, Ke = /* @__PURE__ */ N({
334
+ __name: "RecipeDialog",
335
+ props: {
336
+ show: { type: Boolean },
337
+ recipe: {},
338
+ mode: { default: w.READ }
339
+ },
340
+ emits: ["update:show"],
341
+ setup(_) {
342
+ const d = _, f = P(), s = ne(), { t: n } = Y(), u = ee(d, "show"), l = ee(d, "recipe"), c = S(() => {
343
+ switch (d.mode) {
344
+ case w.READ:
345
+ return "";
346
+ case w.UPDATE:
347
+ return n("inventory.recipe.update.title");
348
+ case w.CREATE:
349
+ return n("inventory.recipe.create.title");
350
+ }
351
+ return "";
352
+ }), m = S(() => {
353
+ switch (d.mode) {
354
+ case w.READ:
355
+ return "";
356
+ case w.UPDATE:
357
+ return n("common.save");
358
+ case w.CREATE:
359
+ return n("common.add");
360
+ }
361
+ return "";
362
+ }), t = x(), a = x(!1);
363
+ async function b() {
364
+ a.value = !0;
365
+ try {
366
+ const r = K(l.value);
367
+ r.precision ?? (r.precision = 0), r.measurements ?? (r.measurements = []), await f.createRecipe(r), u.value = !1, s.open({
368
+ title: n("common.success"),
369
+ message: n("inventory.recipe.create.success", { name: l.value.name }),
370
+ type: "success"
371
+ });
372
+ } catch (r) {
373
+ r instanceof Z || s.open({
374
+ title: n("inventory.recipe.create.error.title"),
375
+ message: n("inventory.recipe.create.error.message"),
376
+ type: "error"
377
+ });
378
+ } finally {
379
+ a.value = !1;
380
+ }
381
+ }
382
+ async function i() {
383
+ a.value = !0;
384
+ try {
385
+ await f.updateRecipe(l.value), u.value = !1, s.open({
386
+ title: n("common.success"),
387
+ message: n("inventory.recipe.update.success", { name: l.value.name }),
388
+ type: "success"
389
+ });
390
+ } catch (r) {
391
+ r instanceof Z || s.open({
392
+ title: n("inventory.recipe.update.error.title"),
393
+ message: n("inventory.recipe.update.error.message"),
394
+ type: "error"
395
+ });
396
+ } finally {
397
+ a.value = !1;
398
+ }
399
+ }
400
+ function g() {
401
+ var r, v;
402
+ (v = (r = t.value) == null ? void 0 : r.validateInputs) == null || v.call(r);
403
+ }
404
+ function C() {
405
+ switch (d.mode) {
406
+ case w.READ:
407
+ return;
408
+ case w.UPDATE:
409
+ return i();
410
+ case w.CREATE:
411
+ return b();
412
+ }
413
+ }
414
+ return (r, v) => {
415
+ const V = k("FmButton"), e = k("FmSideSheet");
416
+ return R(), M(e, {
417
+ "model-value": y(u),
418
+ "onUpdate:modelValue": v[3] || (v[3] = (o) => X(u) ? u.value = o : null),
419
+ header: c.value,
420
+ "close-button": "",
421
+ "dismiss-away": "",
422
+ "max-width": 500
423
+ }, {
424
+ "side-sheet-footer": I(() => [
425
+ h("div", qe, [
426
+ p(V, {
427
+ loading: a.value,
428
+ label: m.value,
429
+ onClick: g
430
+ }, null, 8, ["loading", "label"]),
431
+ p(V, {
432
+ disabled: a.value,
433
+ label: y(n)("common.close"),
434
+ variant: "tertiary",
435
+ onClick: v[2] || (v[2] = (o) => u.value = !1)
436
+ }, null, 8, ["disabled", "label"])
437
+ ])
438
+ ]),
439
+ default: I(() => [
440
+ p(je, {
441
+ class: "w-full",
442
+ ref_key: "hasValidationExpose",
443
+ ref: t,
444
+ modelValue: y(l),
445
+ "onUpdate:modelValue": v[0] || (v[0] = (o) => X(l) ? l.value = o : null),
446
+ mode: r.mode,
447
+ disabled: a.value,
448
+ "onClick:submit": v[1] || (v[1] = (o) => C())
449
+ }, null, 8, ["modelValue", "mode", "disabled"])
450
+ ]),
451
+ _: 1
452
+ }, 8, ["model-value", "header"]);
453
+ };
454
+ }
455
+ });
456
+ function Ge() {
457
+ const _ = P(), d = _.recipes, f = _.recipeById, s = _.skuById, n = d.flatMap((c, m) => {
458
+ var t;
459
+ if ((t = c.contains) != null && t.length) {
460
+ const a = c.contains.filter((i) => i.type === "RECIPE"), b = c.contains.filter((i) => i.type === "SKU");
461
+ return [
462
+ ...m === 0 ? [] : [["", "", "", "", "", ""]],
463
+ ...a.map(
464
+ (i, g) => {
465
+ var C;
466
+ return [
467
+ g === 0 ? c.name : "",
468
+ "RECIPE",
469
+ "",
470
+ (C = f[i.id]) == null ? void 0 : C.name,
471
+ q(i.amount),
472
+ "UNIT"
473
+ ];
474
+ }
475
+ ),
476
+ ...b.map(
477
+ (i, g) => {
478
+ var C, r, v, V;
479
+ return [
480
+ !a.length && g === 0 ? c.name : "",
481
+ "INGREDIENT",
482
+ (C = s[i.id]) == null ? void 0 : C.code,
483
+ (r = s[i.id]) == null ? void 0 : r.name,
484
+ q(i.amount),
485
+ i.measurement ? i.measurement.abbrev : (V = (v = s[i.id]) == null ? void 0 : v.unit) == null ? void 0 : V.abbrev
486
+ ];
487
+ }
488
+ )
489
+ ];
490
+ }
491
+ return [
492
+ ...m === 0 ? [] : [["", "", "", "", "", ""]],
493
+ [c.name, "No bindings", "", "", "", ""]
494
+ ];
495
+ }), l = be(n, ["Name", "Type", "Code", "Item", "Amount", "Unit"]);
496
+ he(l, `RECIPE_${De(/* @__PURE__ */ new Date(), "-", "-")}.xlsx`);
497
+ }
498
+ const Je = { class: "px-24 xs:p-0 sm:p-0 flex flex-col gap-8 max-h-full" }, Oe = { class: "flex flex-col py-8" }, Qe = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, We = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, dt = /* @__PURE__ */ N({
499
+ __name: "RecipeView",
500
+ setup(_) {
501
+ const d = P(), f = S(() => d.recipes), s = fe(), { createRecipe: n, updateRecipe: u, deleteRecipe: l, recipeDialogProps: c, recipeViewLoading: m } = Ue(), { columnDefs: t, formatRowData: a } = Be({
502
+ updateRecipe: u,
503
+ deleteRecipe: l
504
+ }), b = S(() => a(f.value));
505
+ function i(o) {
506
+ o === "add" && n();
507
+ }
508
+ const g = x(""), C = S(() => m.value), { breakpoints: r } = ye(), v = S(() => r.value.xs || r.value.sm ? 10 : 20), V = xe(), { t: e } = Y();
509
+ return (o, F) => {
510
+ const H = k("FmTable");
511
+ return R(), M(Ce, {
512
+ title: y(e)("inventory.recipe.title"),
513
+ actions: [{ label: y(e)("inventory.recipe.create.title"), value: "add", isPrimary: !0, prependIcon: "add" }],
514
+ "onClick:action": i
515
+ }, {
516
+ default: I(() => [
517
+ h("div", Je, [
518
+ p(Ee, {
519
+ searchable: "",
520
+ search: g.value,
521
+ "onUpdate:search": F[0] || (F[0] = ($) => g.value = $),
522
+ actions: [{ icon: "ios_share", onClick: y(Ge) }]
523
+ }, null, 8, ["search", "actions"]),
524
+ (R(), M(H, {
525
+ style: ce(y(V).tableHeight),
526
+ "column-defs": y(t),
527
+ "row-data": b.value,
528
+ "search-value": g.value,
529
+ loading: !y(s)._currentLocation || C.value,
530
+ onRowClick: F[1] || (F[1] = ($) => y(u)($.original.original)),
531
+ key: f.value.length,
532
+ "page-size": v.value
533
+ }, {
534
+ "list-row": I(($) => [
535
+ p(Re, {
536
+ row: $,
537
+ onRowClick: (D) => y(u)(D.original)
538
+ }, {
539
+ default: I((D) => {
540
+ var U, B, E, T, G, J, O, Q, L, W;
541
+ return [
542
+ h("div", Oe, [
543
+ h("div", Qe, [
544
+ p(y(oe), {
545
+ render: (E = (B = (U = D.recipe) == null ? void 0 : U.column) == null ? void 0 : B.columnDef) == null ? void 0 : E.cell,
546
+ props: (G = (T = D.recipe) == null ? void 0 : T.getContext) == null ? void 0 : G.call(T)
547
+ }, null, 8, ["render", "props"])
548
+ ]),
549
+ h("div", We, [
550
+ p(y(oe), {
551
+ render: (Q = (O = (J = D.ingredients) == null ? void 0 : J.column) == null ? void 0 : O.columnDef) == null ? void 0 : Q.cell,
552
+ props: (W = (L = D.ingredients) == null ? void 0 : L.getContext) == null ? void 0 : W.call(L)
553
+ }, null, 8, ["render", "props"])
554
+ ])
555
+ ])
556
+ ];
557
+ }),
558
+ _: 2
559
+ }, 1032, ["row", "onRowClick"])
560
+ ]),
561
+ _: 1
562
+ }, 8, ["style", "column-defs", "row-data", "search-value", "loading", "page-size"]))
563
+ ]),
564
+ (R(), M(ue, { to: "body" }, [
565
+ p(Ke, de(me(y(c))), null, 16)
566
+ ]))
567
+ ]),
568
+ _: 1
569
+ }, 8, ["title", "actions"]);
570
+ };
571
+ }
572
+ });
573
+ export {
574
+ dt as default
575
+ };
@@ -0,0 +1,59 @@
1
+ import { defineComponent as m, computed as p, openBlock as i, createElementBlock as l, createElementVNode as r, normalizeClass as c, toDisplayString as d, unref as f } from "vue";
2
+ import { useI18n as y } from "@feedmepos/mf-common";
3
+ function $(e, o = !1) {
4
+ var t;
5
+ return e ? [
6
+ {
7
+ label: o ? e.abbrev : `1 ${e.name} (${e.abbrev})`,
8
+ abbrev: e.abbrev,
9
+ value: null
10
+ },
11
+ ...((t = e.measurements) == null ? void 0 : t.map((n) => ({
12
+ label: o ? n.abbrev : `1 ${n.name} (${n.abbrev})`,
13
+ abbrev: n.abbrev,
14
+ value: n.id
15
+ }))) ?? []
16
+ ] : [];
17
+ }
18
+ var a = /* @__PURE__ */ ((e) => (e.noInfo = "no-info", e.low = "low", e.mid = "mid", e.high = "high", e))(a || {});
19
+ const u = {
20
+ key: 0,
21
+ class: "flex"
22
+ }, b = {
23
+ key: 1,
24
+ class: "flex"
25
+ }, v = { class: "flex px-8 py-4 bg-fm-color-neutral-gray-100 fm-corner-radius-md gap-8" }, _ = { class: "fm-typo-en-body-md-600 text-fm-color-typo-secondary" }, k = /* @__PURE__ */ m({
26
+ __name: "StockForecast",
27
+ props: {
28
+ days: {},
29
+ level: {}
30
+ },
31
+ setup(e) {
32
+ const o = e, { t: s } = y(), t = p(() => o.level ? o.level : typeof o.days != "number" ? a.noInfo : o.days > 14 ? a.high : o.days >= 7 && o.days <= 14 ? a.mid : a.low);
33
+ return (n, g) => typeof o.days == "number" ? (i(), l("div", u, [
34
+ r("div", {
35
+ class: c([
36
+ `fm-forecast-notification-${t.value}`,
37
+ "flex items-center gap-8 p-4 fm-corner-radius-md fm-typo-en-body-md-600"
38
+ ])
39
+ }, [
40
+ r("div", {
41
+ class: c([
42
+ "fm-forecast-notification-indicator",
43
+ `fm-forecast-notification-indicator-${t.value}`
44
+ ])
45
+ }, null, 2),
46
+ r("div", null, d(f(s)("inventory.stock.prediction.days", [o.days])), 1)
47
+ ], 2)
48
+ ])) : (i(), l("div", b, [
49
+ r("div", v, [
50
+ r("p", _, d(f(s)("inventory.stock.prediction.noData")), 1)
51
+ ])
52
+ ]));
53
+ }
54
+ });
55
+ export {
56
+ a as S,
57
+ k as _,
58
+ $ as g
59
+ };