@feedmepos/mf-inventory-portal 0.0.22-dev.5 → 0.0.22-dev.50

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 (144) hide show
  1. package/dist/ApprovalView-CyIOcyG5.js +140 -0
  2. package/dist/{BindingsDialog-DQJhC3Mo.js → BindingsDialog-BXePN5iL.js} +10 -10
  3. package/dist/{BindingsPicker-YfbPb_dG.js → BindingsPicker-Bd_qb0aO.js} +15 -15
  4. package/dist/{BindingsTable-D3MVcHXZ.js → BindingsTable-BV-nP9HU.js} +4 -4
  5. package/dist/ClosingTemplateView-CSvWLccZ.js +1829 -0
  6. package/dist/FmDroppableField-DwZ6ujPh.js +154 -0
  7. package/dist/FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-DpCoW_-F.js +266 -0
  8. package/dist/FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-BpzreBHD.js +435 -0
  9. package/dist/IngredientBindedItem.vue_vue_type_script_setup_true_lang-C8k7pSPT.js +51 -0
  10. package/dist/IngredientGroupView-C0hPeD41.js +608 -0
  11. package/dist/IngredientsView-CpwVIGXd.js +1608 -0
  12. package/dist/IntegrationView-Bt8pGAHS.js +1225 -0
  13. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-wsBLYBpB.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-yA-qJUUz.js} +1 -1
  14. package/dist/PremiumBadge.vue_vue_type_script_setup_true_lang-BqcqoKyN.js +116 -0
  15. package/dist/{PurchaseOrderPrintPreview-BcAmgmD8.js → PurchaseOrderPrintPreview-D3ugzCW_.js} +7 -7
  16. package/dist/ReceiveRequestView-D14YTEEe.js +4073 -0
  17. package/dist/RecipeView-D0WsMfKm.js +594 -0
  18. package/dist/Standalone.vue.d.ts +2 -0
  19. package/dist/StockView-sxI0L6MP.js +7770 -0
  20. package/dist/SupplierView-clAkARuW.js +1468 -0
  21. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-C9NU1m6S.js +1150 -0
  22. package/dist/TransferTemplateView-DpI6kVqX.js +1258 -0
  23. package/dist/{UnitView-B95q8Xrj.js → UnitView-CneJsDum.js} +18 -18
  24. package/dist/{WarehouseView-CHGXvyeS.js → WarehouseView-DYbFWTlh.js} +176 -177
  25. package/dist/api/bill.d.ts +84 -238
  26. package/dist/api/closing-template.d.ts +6 -4
  27. package/dist/api/inventory.d.ts +282 -91
  28. package/dist/api/netsuite.d.ts +71 -0
  29. package/dist/api/purchase-order-template.d.ts +4 -6
  30. package/dist/api/supplier.d.ts +1 -0
  31. package/dist/{app-CfXF4jdF.js → app-B4pi48sM.js} +26414 -24985
  32. package/dist/app.d.ts +88 -3
  33. package/dist/app.js +3 -3
  34. package/dist/components/FmFilterableMenuOptions.vue.d.ts +54 -0
  35. package/dist/components/FmMinMaxInputRules.d.ts +2 -0
  36. package/dist/components/FmMultiselectDialog.vue.d.ts +3 -9
  37. package/dist/components/FmMultiselectDialogProps.d.ts +0 -2
  38. package/dist/components/FmUnitInputRules.d.ts +2 -0
  39. package/dist/components/inventory-binding/InventoryBinding.vue.d.ts +5 -5
  40. package/dist/components/map/GoogleMap.vue.d.ts +4 -4
  41. package/dist/components/shell/inventory/binding-dialog.vue.d.ts +2 -2
  42. package/dist/components/shell/inventory/binding-ui.vue.d.ts +2 -2
  43. package/dist/{decimal-BZ7tX47r.js → decimal-C8O2p3Sg.js} +1 -1
  44. package/dist/defineDeepModel-BXP1vLGf.js +13 -0
  45. package/dist/extensions/array.d.ts +1 -0
  46. package/dist/format-time-from-id-DgW7OJL_.js +15 -0
  47. package/dist/format-unit-display-BP4O0Pym.js +1195 -0
  48. package/dist/helper/rules.d.ts +7 -0
  49. package/dist/helper/rules.spec.d.ts +1 -0
  50. package/dist/helper/xlsx.util.d.ts +7 -0
  51. package/dist/router/name.d.ts +1 -0
  52. package/dist/stores/api.d.ts +1 -0
  53. package/dist/stores/feature.d.ts +0 -1
  54. package/dist/stores/helper/core-store-proxy.d.ts +3 -0
  55. package/dist/stores/helper/generate-backend-urls.d.ts +1 -0
  56. package/dist/stores/integration/foodmarkethub.d.ts +391 -0
  57. package/dist/stores/integration/index.d.ts +7 -0
  58. package/dist/stores/integration/netsuite.d.ts +102 -0
  59. package/dist/stores/inventory.d.ts +294 -9
  60. package/dist/stores/location.d.ts +508 -503
  61. package/dist/stores/supplier.d.ts +124 -4
  62. package/dist/style.css +1 -1
  63. package/dist/supplier-D-8XhuF_.js +77 -0
  64. package/dist/tsconfig.app.tsbuildinfo +1 -1
  65. package/dist/use-template-enabled-locations-2-C2E4j3k-.js +85 -0
  66. package/dist/views/closing-template/closing-template-import/ClosingTemplateImport.vue.d.ts +2 -0
  67. package/dist/views/closing-template/closing-template-import/ClosingTemplateImportItem.vue.d.ts +12 -0
  68. package/dist/views/closing-template/closing-template-import/ClosingTemplateImportItemProps.d.ts +7 -0
  69. package/dist/views/closing-template/components/closing-template-form/composables/use-closing-template-items.d.ts +1 -1
  70. package/dist/views/closing-template/composables/use-closing-template-actions.d.ts +877 -1038
  71. package/dist/views/closing-template/composables/use-closing-template-table.d.ts +882 -1049
  72. package/dist/views/closing-template/helpers/import-export.helper.d.ts +58 -0
  73. package/dist/views/ingredient-group/IngredientGroupView.vue.d.ts +3 -0
  74. package/dist/views/ingredient-group/components/ingredient-group-dialog/IngredientGroupDialog.vue.d.ts +31 -0
  75. package/dist/views/ingredient-group/components/ingredient-group-dialog/IngredientGroupDialogProps.d.ts +12 -0
  76. package/dist/views/ingredient-group/components/ingredient-group-form/IngredientGroupForm.vue.d.ts +20 -0
  77. package/dist/views/ingredient-group/components/ingredient-group-form/IngredientGroupFormProps.d.ts +12 -0
  78. package/dist/views/ingredient-group/composables/use-ingredient-group-actions.d.ts +24 -0
  79. package/dist/views/ingredient-group/composables/use-ingredient-group-table.d.ts +215 -0
  80. package/dist/views/ingredients/components/convert/ConvertForm.vue.d.ts +2 -2
  81. package/dist/views/ingredients/components/ingredient-form/IngredientForm.vue.d.ts +2 -2
  82. package/dist/views/ingredients/components/inventory-binding/InventoryBindingForm.vue.d.ts +5 -5
  83. package/dist/views/ingredients/composables/use-ingredient-form.d.ts +2 -2
  84. package/dist/views/ingredients/composables/use-ingredient-table.d.ts +1 -1
  85. package/dist/views/integration/FoodMarketHub.vue.d.ts +2 -0
  86. package/dist/views/integration/NetSuite.vue.d.ts +2 -0
  87. package/dist/views/integration/components/ApplyProductDialog.vue.d.ts +7 -7
  88. package/dist/views/integration/components/ApplyProductDialogV4.vue.d.ts +7 -7
  89. package/dist/views/receive-request/components/transfer-details/TransferDetailsProps.d.ts +1 -0
  90. package/dist/views/receive-request/components/transfer-form/NetSuiteField.vue.d.ts +49 -0
  91. package/dist/views/receive-request/components/transfer-form/TransferForm.vue.d.ts +1961 -87
  92. package/dist/views/receive-request/components/transfer-form/TransferFormProps.d.ts +1 -0
  93. package/dist/views/receive-request/components/transfer-form/components/ForecastStock.vue.d.ts +2 -2
  94. package/dist/views/receive-request/components/transfer-form/composables/use-transfer-items.d.ts +1 -1
  95. package/dist/views/receive-request/composables/use-receive-request-form.d.ts +2377 -292
  96. package/dist/views/receive-request/composables/use-receive-request-table.d.ts +2329 -244
  97. package/dist/views/recipe/components/recipe-form/RecipeForm.vue.d.ts +2 -2
  98. package/dist/views/recipe/composables/use-recipe-form.d.ts +2 -2
  99. package/dist/views/stock/components/StockRecordCard.vue.d.ts +42 -119
  100. package/dist/views/stock/components/dialog/AdjustedItemForm.vue.d.ts +32 -2
  101. package/dist/views/stock/composables/use-stock-action.d.ts +2 -2
  102. package/dist/views/supplier/components/supplier-import/SupplierImport.vue.d.ts +2 -0
  103. package/dist/views/supplier/components/supplier-import/SupplierImportItem.vue.d.ts +12 -0
  104. package/dist/views/supplier/components/supplier-import/SupplierImportItemProps.d.ts +6 -0
  105. package/dist/views/supplier/composables/use-supplier-actions.d.ts +10 -0
  106. package/dist/views/supplier/helpers/import-export.helper.d.ts +50 -0
  107. package/dist/views/transfer-template/components/transfer-template-details/TransferTemplateDetails.vue.d.ts +0 -2
  108. package/dist/views/transfer-template/components/transfer-template-details/TransferTemplateDetailsProps.d.ts +0 -1
  109. package/dist/views/transfer-template/components/transfer-template-form/composables/use-template-enabled-locations-2.d.ts +13 -0
  110. package/dist/views/transfer-template/components/transfer-template-form/composables/use-template-enabled-locations.d.ts +71 -85
  111. package/dist/views/transfer-template/components/transfer-template-form/composables/use-transfer-locations.d.ts +39 -2
  112. package/dist/views/transfer-template/components/transfer-template-form/composables/use-transfer-template-items.d.ts +1 -1
  113. package/dist/views/transfer-template/components/transfer-template-import/TransferTemplateImport.vue.d.ts +2 -0
  114. package/dist/views/transfer-template/components/transfer-template-import/TransferTemplateImportItem.vue.d.ts +12 -0
  115. package/dist/views/transfer-template/components/transfer-template-import/TransferTemplateImportItemProps.d.ts +9 -0
  116. package/dist/views/transfer-template/composables/use-transfer-template-actions.d.ts +1277 -1478
  117. package/dist/views/transfer-template/composables/use-transfer-template-table.d.ts +1697 -906
  118. package/dist/views/transfer-template/helpers/import-export.helper.d.ts +76 -0
  119. package/dist/views/transfer-template/helpers/remove-deleted-skus.helper.d.ts +1 -247
  120. package/dist/views/transfer-template/helpers/template-item.error.helper.d.ts +1 -0
  121. package/dist/views/unit/composables/use-unit-form.d.ts +2 -2
  122. package/dist/{xlsx-BtP1Qjj6.js → xlsx-Dsy-fxZw.js} +1525 -1525
  123. package/dist/xlsx.util-CxGmvsp9.js +78 -0
  124. package/package.json +10 -7
  125. package/dist/ApprovalView-BdaNwUBc.js +0 -129
  126. package/dist/ClosingTemplateView-BpErgepi.js +0 -1030
  127. package/dist/FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-D3B7kOlU.js +0 -372
  128. package/dist/IngredientsView-GqrkpCm5.js +0 -1758
  129. package/dist/IntegrationView-7c3MpUzS.js +0 -1141
  130. package/dist/PremiumBadge.vue_vue_type_script_setup_true_lang-BIwdObb1.js +0 -88
  131. package/dist/ReceiveRequestView-BAuXvzQW.js +0 -215
  132. package/dist/RecipeView-C6tZPQ-K.js +0 -581
  133. package/dist/StockView-4uXHYz4E.js +0 -1892
  134. package/dist/SupplierView-CuWvKCWY.js +0 -827
  135. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-CTQ9HIqf.js +0 -740
  136. package/dist/TransferDialog.vue_vue_type_script_setup_true_lang--6JoXOLD.js +0 -1409
  137. package/dist/TransferTemplateView-D1Lfi3aW.js +0 -1230
  138. package/dist/defineDeepModel-BKAs9qN6.js +0 -13
  139. package/dist/format-time-from-id-B7ZE4sdX.js +0 -15
  140. package/dist/id-to-date-D1lOqIir.js +0 -30
  141. package/dist/purchase-order-transaction-type-tZ7cj1dz.js +0 -702
  142. package/dist/supplier-BIDBk5S6.js +0 -69
  143. package/dist/use-template-enabled-locations-DlMnS9WJ.js +0 -57
  144. package/dist/xlsx.util-BKFiH-ig.js +0 -109
@@ -0,0 +1,594 @@
1
+ import { defineComponent as Y, ref as E, onMounted as re, resolveComponent as F, openBlock as C, createElementBlock as A, Fragment as ie, createElementVNode as w, toDisplayString as ce, createVNode as g, createCommentVNode as j, computed as V, watch as ue, createBlock as T, withCtx as P, unref as y, isRef as Z, normalizeClass as de, normalizeStyle as me, Teleport as pe, normalizeProps as fe, guardReactiveProps as ve } from "vue";
2
+ import { u as I, c as G, S as ye, a as z, k as ee, R as ge, U as be, _ as _e, A as we, e as te, f as Re, i as he } from "./app-B4pi48sM.js";
3
+ import { useDialog as xe, useSnackbar as se, useProxiedModel as ne, useBreakpoints as Ce } from "@feedmepos/ui-library";
4
+ import { i as Ee, _ as Se } from "./is-linked-ingredient-error-fJ2TJb3z.js";
5
+ import { F as x, D as oe, R as L } from "./row-action.enum-PMKMRrZR.js";
6
+ import { _ as le } from "./IngredientBindedItem.vue_vue_type_script_setup_true_lang-C8k7pSPT.js";
7
+ import { defineStore as Fe, storeToRefs as Ve } from "pinia";
8
+ import { c as ke, _ as De, F as ae } from "./TableActionableRow.vue_vue_type_script_setup_true_lang-DlNJ6kRg.js";
9
+ import { useI18n as H } from "@feedmepos/mf-common";
10
+ import { u as Ie, _ as $e, a as Ae } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-BpzreBHD.js";
11
+ import { t as Pe, d as Be } from "./xlsx.util-CxGmvsp9.js";
12
+ const Te = {
13
+ key: 0,
14
+ class: "flex flex-col items-center w-full h-full gap-24"
15
+ }, Me = { key: 1 }, Ue = { key: 0 }, Ne = /* @__PURE__ */ Y({
16
+ __name: "DeleteDialog",
17
+ props: {
18
+ type: {},
19
+ data: {},
20
+ message: {},
21
+ bindedItems: {}
22
+ },
23
+ setup(R) {
24
+ const p = R, v = E(p.bindedItems || []), r = E(!1);
25
+ re(() => {
26
+ l();
27
+ });
28
+ async function l() {
29
+ var c, i;
30
+ !r.value && ((c = p.data) != null && c._id) && (r.value = !0, v.value = await I().getAffectedMenu((i = p.data) == null ? void 0 : i._id), r.value = !1);
31
+ }
32
+ return (c, i) => {
33
+ const f = F("FmSpacer"), d = F("FmCircularProgress");
34
+ return C(), A(ie, null, [
35
+ w("p", null, ce(c.message), 1),
36
+ r.value ? (C(), A("div", Te, [
37
+ g(f),
38
+ w("div", null, [
39
+ g(d, { size: "xl" })
40
+ ]),
41
+ i[0] || (i[0] = w("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary pl-8" }, "Loading...", -1)),
42
+ g(f)
43
+ ])) : (C(), A("div", Me, [
44
+ i[2] || (i[2] = w("br", null, null, -1)),
45
+ v.value.length > 0 ? (C(), A("div", Ue, [
46
+ i[1] || (i[1] = w("p", { class: "fm-typo-en-body-lg-600" }, "Affected menu items:", -1)),
47
+ g(le, {
48
+ name: "Menu",
49
+ bindings: v.value
50
+ }, null, 8, ["bindings"])
51
+ ])) : j("", !0)
52
+ ]))
53
+ ], 64);
54
+ };
55
+ }
56
+ }), q = Fe("recipeForm", function() {
57
+ const p = xe(), v = se(), r = I(), l = E(!1), c = E();
58
+ function i() {
59
+ const t = {
60
+ recipe: {},
61
+ mode: x.CREATE,
62
+ show: !0,
63
+ "onUpdate:show"(a) {
64
+ c.value.show = a;
65
+ }
66
+ };
67
+ c.value = t;
68
+ }
69
+ async function f(t) {
70
+ const a = {
71
+ recipe: G(t),
72
+ mode: x.UPDATE,
73
+ show: !0,
74
+ "onUpdate:show"(e) {
75
+ c.value.show = e;
76
+ }
77
+ };
78
+ c.value = a;
79
+ }
80
+ async function d(t) {
81
+ l.value = !0;
82
+ try {
83
+ await r.deleteRecipe(t), v.open({
84
+ title: "Success",
85
+ message: `Deleted ${t.name}`,
86
+ type: "success"
87
+ });
88
+ } catch (a) {
89
+ a instanceof ye && Ee(a) ? p.open({
90
+ title: "Cannot delete recipe",
91
+ contentComponent: Se,
92
+ contentComponentProps: {
93
+ subject: (t == null ? void 0 : t.name) ?? "",
94
+ items: a.errorResponse.message
95
+ },
96
+ secondaryActions: {
97
+ text: "Close",
98
+ close: !0
99
+ }
100
+ }) : console.log("unable to delete recipe", a), v.open({
101
+ title: `Cannot delete ${t == null ? void 0 : t.name}`,
102
+ message: "Please try again.",
103
+ type: "error"
104
+ }), console.error("failed to delete recipe", a);
105
+ } finally {
106
+ l.value = !1;
107
+ }
108
+ }
109
+ function u(t) {
110
+ p.open({
111
+ title: `Delete ${(t == null ? void 0 : t.name) ?? "recipe"}?`,
112
+ closeButton: !1,
113
+ primaryActions: {
114
+ text: "Delete",
115
+ close: !0,
116
+ variant: "destructive"
117
+ },
118
+ secondaryActions: {
119
+ text: "Cancel",
120
+ close: !0
121
+ },
122
+ contentComponent: Ne,
123
+ contentComponentProps: {
124
+ type: "menu",
125
+ data: t,
126
+ message: "You may not be able to delete this recipe if it is linked in any of the inventory modules."
127
+ }
128
+ }).onPrimary(() => d(t));
129
+ }
130
+ return {
131
+ createRecipe: i,
132
+ updateRecipe: f,
133
+ deleteRecipe: u,
134
+ recipeDialogProps: c,
135
+ recipeViewLoading: l
136
+ };
137
+ });
138
+ function Le() {
139
+ const { updateRecipe: R, deleteRecipe: p } = q(), v = I(), { t: r } = H();
140
+ async function l(d, u) {
141
+ const t = G(u);
142
+ if (d === L.Edit) {
143
+ await R(t);
144
+ return;
145
+ }
146
+ if (d === L.Delete) {
147
+ await p(t);
148
+ return;
149
+ }
150
+ }
151
+ function c(d, u) {
152
+ const t = d.filter((e) => e.type === ee.enum.SKU), a = d.filter((e) => e.type === ee.enum.RECIPE);
153
+ return [
154
+ ...t.map((e) => ({ ...e, recipeIds: [...u] })),
155
+ ...a.filter((e) => v.recipeById[e.id] && !u.has(e.id)).flatMap(
156
+ (e) => c(v.recipeById[e.id].contains, /* @__PURE__ */ new Set([...u, e.id]))
157
+ )
158
+ ];
159
+ }
160
+ const i = [
161
+ {
162
+ accessorKey: "recipe",
163
+ header: () => r("inventory.recipe.name"),
164
+ size: 400
165
+ },
166
+ {
167
+ accessorKey: "ingredients",
168
+ header: () => r("inventory.recipe.ingredients"),
169
+ size: "auto"
170
+ },
171
+ {
172
+ id: "action",
173
+ header: "",
174
+ cell(d) {
175
+ return ke(
176
+ [oe[L.Edit], oe[L.Delete]],
177
+ (u) => {
178
+ l(u, d.row.original.original);
179
+ }
180
+ );
181
+ },
182
+ enableSorting: !1,
183
+ size: 40,
184
+ meta: {
185
+ cellClass: "",
186
+ headerClass: ""
187
+ }
188
+ }
189
+ ];
190
+ function f(d) {
191
+ const u = I();
192
+ return d.map((t) => ({
193
+ recipe: t.name,
194
+ ingredients: c(t.contains, /* @__PURE__ */ new Set([t._id])).map((a) => {
195
+ var b, _, s, m, h;
196
+ const e = u.skuById[a.id];
197
+ return e ? a.recipeIds.slice(1).length ? `(linked recipe ${(b = u.recipeById[a.recipeIds.at(-1) ?? ""]) == null ? void 0 : b.name}) ${e.name} (${z(a.amount)}${((_ = a.measurement) == null ? void 0 : _.abbrev) ?? ((s = e == null ? void 0 : e.unit) == null ? void 0 : s.abbrev)})` : `${e.name} (${z(a.amount)}${((m = a.measurement) == null ? void 0 : m.abbrev) ?? ((h = e == null ? void 0 : e.unit) == null ? void 0 : h.abbrev)})` : null;
198
+ }).filter((a) => a).join(", "),
199
+ original: t
200
+ }));
201
+ }
202
+ return { columnDefs: i, formatRowData: f };
203
+ }
204
+ const ze = { class: "flex flex-col gap-40" }, Ye = {
205
+ key: 0,
206
+ 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"
207
+ }, He = {
208
+ key: 0,
209
+ class: "flex flex-col items-center w-full h-full gap-24"
210
+ }, Ke = { key: 1 }, je = /* @__PURE__ */ Y({
211
+ __name: "RecipeForm",
212
+ props: {
213
+ mode: {},
214
+ modelValue: {},
215
+ disabled: { type: Boolean }
216
+ },
217
+ emits: ["update:modelValue", "click:submit"],
218
+ setup(R, { expose: p, emit: v }) {
219
+ var h;
220
+ const r = R, l = v, { t: c } = H(), i = V({
221
+ get() {
222
+ var n;
223
+ return ((n = r.modelValue) == null ? void 0 : n.name) ?? "";
224
+ },
225
+ set(n) {
226
+ const o = r.modelValue ?? {};
227
+ o.name = n, l("update:modelValue", o);
228
+ }
229
+ }), f = V({
230
+ get() {
231
+ var n;
232
+ return ((n = r.modelValue) == null ? void 0 : n.contains) ?? [];
233
+ },
234
+ set(n) {
235
+ const o = r.modelValue ?? {};
236
+ o.contains = n, l("update:modelValue", o);
237
+ }
238
+ });
239
+ function d() {
240
+ l("click:submit");
241
+ }
242
+ const u = E();
243
+ p({
244
+ validateInputs: () => {
245
+ var n, o;
246
+ (o = (n = u.value) == null ? void 0 : n.validateInputs) == null || o.call(n);
247
+ },
248
+ resetInputsValidation: () => {
249
+ var n, o;
250
+ (o = (n = u.value) == null ? void 0 : n.resetInputsValidation) == null || o.call(n);
251
+ },
252
+ resetInputs: () => {
253
+ var n, o;
254
+ (o = (n = u.value) == null ? void 0 : n.resetInputs) == null || o.call(n);
255
+ }
256
+ });
257
+ const t = I(), a = E([]), e = E(!1), b = E(!1);
258
+ ue(e, async (n) => {
259
+ _(n);
260
+ });
261
+ async function _(n) {
262
+ var o, k;
263
+ n && !b.value && ((o = r.modelValue) != null && o._id) && (b.value = !0, a.value = await t.getAffectedMenu((k = r.modelValue) == null ? void 0 : k._id), b.value = !1);
264
+ }
265
+ const s = V(
266
+ () => t.recipes.map((n) => ({ label: n.name, value: n.name }))
267
+ ), m = E((h = r.modelValue) == null ? void 0 : h.name);
268
+ return (n, o) => {
269
+ const k = F("FmTextField"), K = F("FmCard"), $ = F("FmSwitch"), D = F("FmSpacer"), M = F("FmCircularProgress"), U = F("FmForm");
270
+ return C(), T(U, {
271
+ ref_key: "formRef",
272
+ ref: u,
273
+ onValidationSuccess: d
274
+ }, {
275
+ default: P(() => [
276
+ w("div", ze, [
277
+ g(k, {
278
+ disabled: n.disabled,
279
+ label: y(c)("inventory.recipe.name"),
280
+ "model-value": i.value,
281
+ "onUpdate:modelValue": o[0] || (o[0] = (S) => i.value = S),
282
+ rules: [
283
+ y(ge)(),
284
+ y(be)(s.value, m.value, (S) => `[${S.value}] already exists`)
285
+ ],
286
+ "label-mark": "required"
287
+ }, null, 8, ["disabled", "label", "model-value", "rules"]),
288
+ g(K, {
289
+ variant: "outlined",
290
+ class: "p-16"
291
+ }, {
292
+ default: P(() => {
293
+ var S;
294
+ return [
295
+ g(_e, {
296
+ id: (S = n.modelValue) == null ? void 0 : S._id,
297
+ disabled: n.disabled,
298
+ "model-value": f.value,
299
+ "onUpdate:modelValue": o[1] || (o[1] = (B) => f.value = B),
300
+ rules: [y(we)(1)]
301
+ }, null, 8, ["id", "disabled", "model-value", "rules"])
302
+ ];
303
+ }),
304
+ _: 1
305
+ })
306
+ ]),
307
+ n.mode !== y(x).CREATE ? (C(), A("div", Ye, [
308
+ w("div", null, [
309
+ g($, {
310
+ label: "Show binded items",
311
+ modelValue: e.value,
312
+ "onUpdate:modelValue": o[2] || (o[2] = (S) => e.value = S),
313
+ "label-placement": "right",
314
+ disabled: b.value
315
+ }, null, 8, ["modelValue", "disabled"])
316
+ ]),
317
+ b.value ? (C(), A("div", He, [
318
+ g(D),
319
+ w("div", null, [
320
+ g(M, { size: "xl" })
321
+ ]),
322
+ o[3] || (o[3] = w("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary pl-8" }, "Loading...", -1)),
323
+ g(D)
324
+ ])) : (C(), A("div", Ke, [
325
+ e.value && a.value.length ? (C(), T(le, {
326
+ key: 0,
327
+ name: "Menu",
328
+ bindings: a.value
329
+ }, null, 8, ["bindings"])) : j("", !0)
330
+ ]))
331
+ ])) : j("", !0)
332
+ ]),
333
+ _: 1
334
+ }, 512);
335
+ };
336
+ }
337
+ }), qe = { class: "flex gap-4" }, Ge = /* @__PURE__ */ Y({
338
+ __name: "RecipeDialog",
339
+ props: {
340
+ show: { type: Boolean },
341
+ recipe: {},
342
+ mode: { default: x.READ }
343
+ },
344
+ emits: ["update:show"],
345
+ setup(R) {
346
+ const p = R, v = I(), r = se(), { t: l } = H(), c = ne(p, "show"), i = ne(p, "recipe"), f = V(() => {
347
+ switch (p.mode) {
348
+ case x.READ:
349
+ return "";
350
+ case x.UPDATE:
351
+ return l("inventory.recipe.update.title");
352
+ case x.CREATE:
353
+ return l("inventory.recipe.create.title");
354
+ }
355
+ return "";
356
+ }), d = V(() => {
357
+ switch (p.mode) {
358
+ case x.READ:
359
+ return "";
360
+ case x.UPDATE:
361
+ return l("common.save");
362
+ case x.CREATE:
363
+ return l("common.add");
364
+ }
365
+ return "";
366
+ }), u = E(), t = E(!1);
367
+ async function a() {
368
+ t.value = !0;
369
+ try {
370
+ const s = G(i.value);
371
+ s.precision ?? (s.precision = 0), s.measurements ?? (s.measurements = []), await v.createRecipe(s), c.value = !1, r.open({
372
+ title: l("inventory.common.success"),
373
+ message: l("inventory.recipe.create.success", { name: i.value.name }),
374
+ type: "success"
375
+ });
376
+ } catch (s) {
377
+ s instanceof te || r.open({
378
+ title: l("inventory.recipe.create.error.title"),
379
+ message: l("inventory.recipe.create.error.message"),
380
+ type: "error"
381
+ });
382
+ } finally {
383
+ t.value = !1;
384
+ }
385
+ }
386
+ async function e() {
387
+ t.value = !0;
388
+ try {
389
+ await v.updateRecipe(i.value), c.value = !1, r.open({
390
+ title: l("inventory.common.success"),
391
+ message: l("inventory.recipe.update.success", { name: i.value.name }),
392
+ type: "success"
393
+ });
394
+ } catch (s) {
395
+ s instanceof te || r.open({
396
+ title: l("inventory.recipe.update.error.title"),
397
+ message: l("inventory.recipe.update.error.message"),
398
+ type: "error"
399
+ });
400
+ } finally {
401
+ t.value = !1;
402
+ }
403
+ }
404
+ function b() {
405
+ var s, m;
406
+ (m = (s = u.value) == null ? void 0 : s.validateInputs) == null || m.call(s);
407
+ }
408
+ function _() {
409
+ switch (p.mode) {
410
+ case x.READ:
411
+ return;
412
+ case x.UPDATE:
413
+ return e();
414
+ case x.CREATE:
415
+ return a();
416
+ }
417
+ }
418
+ return (s, m) => {
419
+ const h = F("FmButton"), n = F("FmSideSheet");
420
+ return C(), T(n, {
421
+ "model-value": y(c),
422
+ "onUpdate:modelValue": m[3] || (m[3] = (o) => Z(c) ? c.value = o : null),
423
+ header: f.value,
424
+ "close-button": "",
425
+ "dismiss-away": "",
426
+ "max-width": 500
427
+ }, {
428
+ "side-sheet-footer": P(() => [
429
+ w("div", qe, [
430
+ g(h, {
431
+ loading: t.value,
432
+ label: d.value,
433
+ onClick: b
434
+ }, null, 8, ["loading", "label"]),
435
+ g(h, {
436
+ disabled: t.value,
437
+ label: y(l)("common.close"),
438
+ variant: "tertiary",
439
+ onClick: m[2] || (m[2] = (o) => c.value = !1)
440
+ }, null, 8, ["disabled", "label"])
441
+ ])
442
+ ]),
443
+ default: P(() => [
444
+ g(je, {
445
+ class: "w-full",
446
+ ref_key: "hasValidationExpose",
447
+ ref: u,
448
+ modelValue: y(i),
449
+ "onUpdate:modelValue": m[0] || (m[0] = (o) => Z(i) ? i.value = o : null),
450
+ mode: s.mode,
451
+ disabled: t.value,
452
+ "onClick:submit": m[1] || (m[1] = (o) => _())
453
+ }, null, 8, ["modelValue", "mode", "disabled"])
454
+ ]),
455
+ _: 1
456
+ }, 8, ["model-value", "header"]);
457
+ };
458
+ }
459
+ });
460
+ function Oe() {
461
+ const R = I(), p = R.recipes, v = R.recipeById, r = R.skuById, l = p.flatMap((f, d) => {
462
+ var u;
463
+ if ((u = f.contains) != null && u.length) {
464
+ const t = f.contains.filter((e) => e.type === "RECIPE"), a = f.contains.filter((e) => e.type === "SKU");
465
+ return [
466
+ ...d === 0 ? [] : [["", "", "", "", "", ""]],
467
+ ...t.map(
468
+ (e, b) => {
469
+ var _;
470
+ return [
471
+ b === 0 ? f.name : "",
472
+ "RECIPE",
473
+ "",
474
+ (_ = v[e.id]) == null ? void 0 : _.name,
475
+ z(e.amount),
476
+ "UNIT"
477
+ ];
478
+ }
479
+ ),
480
+ ...a.map(
481
+ (e, b) => {
482
+ var _, s, m, h;
483
+ return [
484
+ !t.length && b === 0 ? f.name : "",
485
+ "INGREDIENT",
486
+ (_ = r[e.id]) == null ? void 0 : _.code,
487
+ (s = r[e.id]) == null ? void 0 : s.name,
488
+ z(e.amount),
489
+ e.measurement ? e.measurement.abbrev : (h = (m = r[e.id]) == null ? void 0 : m.unit) == null ? void 0 : h.abbrev
490
+ ];
491
+ }
492
+ )
493
+ ];
494
+ }
495
+ return [
496
+ ...d === 0 ? [] : [["", "", "", "", "", ""]],
497
+ [f.name, "No bindings", "", "", "", ""]
498
+ ];
499
+ }), i = Pe(l, ["Name", "Type", "Code", "Item", "Amount", "Unit"]);
500
+ Be(i, `RECIPE_${Re(/* @__PURE__ */ new Date(), "-", "-")}.xlsx`);
501
+ }
502
+ const Je = { 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" }, ct = /* @__PURE__ */ Y({
503
+ __name: "RecipeView",
504
+ setup(R) {
505
+ const p = I(), v = V(() => p.recipes), r = he(), { createRecipe: l, updateRecipe: c } = q(), { recipeDialogProps: i, recipeViewLoading: f } = Ve(q()), { columnDefs: d, formatRowData: u } = Le(), t = V(() => u(v.value));
506
+ function a(o) {
507
+ if (o === "add")
508
+ return l();
509
+ if (o === "export")
510
+ return Oe();
511
+ }
512
+ const e = E(""), b = V(() => f.value), { breakpoints: _ } = Ce(), s = V(() => _.value.xs || _.value.sm), m = V(() => s.value ? 10 : 20), h = Ie(), { t: n } = H();
513
+ return (o, k) => {
514
+ const K = F("FmTable");
515
+ return C(), T($e, {
516
+ title: y(n)("inventory.recipe.title"),
517
+ actions: [
518
+ {
519
+ label: y(n)("inventory.recipe.create.title"),
520
+ value: "add",
521
+ isPrimary: !0,
522
+ prependIcon: "add"
523
+ },
524
+ { label: y(n)("common.export"), value: "export", isPrimary: !1 }
525
+ ],
526
+ "onClick:action": a
527
+ }, {
528
+ default: P(() => [
529
+ w("div", {
530
+ class: de([
531
+ "flex flex-col gap-8 max-h-full",
532
+ {
533
+ "p-0": s.value,
534
+ "px-24 ": !s.value
535
+ }
536
+ ])
537
+ }, [
538
+ g(Ae, {
539
+ searchable: "",
540
+ search: e.value,
541
+ "onUpdate:search": k[0] || (k[0] = ($) => e.value = $)
542
+ }, null, 8, ["search"]),
543
+ (C(), T(K, {
544
+ style: me(y(h).tableHeight),
545
+ "column-defs": y(d),
546
+ "row-data": t.value,
547
+ "search-value": e.value,
548
+ loading: !y(r)._currentLocation || b.value,
549
+ onRowClick: k[1] || (k[1] = ($) => y(c)($.original.original)),
550
+ key: v.value.length,
551
+ "page-size": m.value
552
+ }, {
553
+ "list-row": P(($) => [
554
+ g(De, {
555
+ row: $,
556
+ onRowClick: (D) => y(c)(D.original)
557
+ }, {
558
+ default: P((D) => {
559
+ var M, U, S, B, O, J, Q, W, N, X;
560
+ return [
561
+ w("div", Je, [
562
+ w("div", Qe, [
563
+ g(y(ae), {
564
+ render: (S = (U = (M = D.recipe) == null ? void 0 : M.column) == null ? void 0 : U.columnDef) == null ? void 0 : S.cell,
565
+ props: (O = (B = D.recipe) == null ? void 0 : B.getContext) == null ? void 0 : O.call(B)
566
+ }, null, 8, ["render", "props"])
567
+ ]),
568
+ w("div", We, [
569
+ g(y(ae), {
570
+ render: (W = (Q = (J = D.ingredients) == null ? void 0 : J.column) == null ? void 0 : Q.columnDef) == null ? void 0 : W.cell,
571
+ props: (X = (N = D.ingredients) == null ? void 0 : N.getContext) == null ? void 0 : X.call(N)
572
+ }, null, 8, ["render", "props"])
573
+ ])
574
+ ])
575
+ ];
576
+ }),
577
+ _: 2
578
+ }, 1032, ["row", "onRowClick"])
579
+ ]),
580
+ _: 1
581
+ }, 8, ["style", "column-defs", "row-data", "search-value", "loading", "page-size"]))
582
+ ], 2),
583
+ (C(), T(pe, { to: "body" }, [
584
+ g(Ge, fe(ve(y(i))), null, 16)
585
+ ]))
586
+ ]),
587
+ _: 1
588
+ }, 8, ["title", "actions"]);
589
+ };
590
+ }
591
+ });
592
+ export {
593
+ ct as default
594
+ };
@@ -1,2 +1,4 @@
1
+ import '@/extensions/array';
2
+ import '@/extensions/promises';
1
3
  declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
2
4
  export default _default;