@feedmepos/mf-inventory-portal 0.0.19-dev.1 → 0.0.19-dev.11

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