@feedmepos/mf-inventory-portal 0.0.22-dev.9 → 0.0.23-dev.1

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 (163) hide show
  1. package/dist/App-Y3Ez8Rjf.js +255 -0
  2. package/dist/ApprovalView-BUU1G4Q2.js +141 -0
  3. package/dist/{BindingsDialog-GzX9Bo2g.js → BindingsDialog-8wc4Q0JQ.js} +13 -12
  4. package/dist/{BindingsPicker-SbOetc0-.js → BindingsPicker-DGWN1LQc.js} +19 -18
  5. package/dist/{BindingsTable-CAcE5y8U.js → BindingsTable-7NJP2jT6.js} +20 -16
  6. package/dist/ClosingTemplateView-9s7vmwaT.js +1833 -0
  7. package/dist/FmDroppableField-8RzKjEdL.js +154 -0
  8. package/dist/FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-B4DDh9-a.js +267 -0
  9. package/dist/FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-5DINn0ZB.js +436 -0
  10. package/dist/FmMultiselectDialog-7hok9sJP.js +411 -0
  11. package/dist/FmUnitInput.vue_vue_type_script_setup_true_lang-CxR1FCft.js +326 -0
  12. package/dist/IngredientBindedItem.vue_vue_type_script_setup_true_lang-FQ0HjuL3.js +51 -0
  13. package/dist/IngredientGroupView-C3maHTCg.js +610 -0
  14. package/dist/IngredientsView-DCR3IBkR.js +1613 -0
  15. package/dist/IntegrationView-gO4h89Wj.js +1227 -0
  16. package/dist/InventoryBindingForm-dh3GeyG-.js +4 -0
  17. package/dist/InventoryBindingForm.vue_vue_type_script_setup_true_lang-CJuo3i7W.js +278 -0
  18. package/dist/InventoryBindingSummary-BPoPcEoe.js +75 -0
  19. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-1FCwvO8A.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-olm8sZKt.js} +1 -1
  20. package/dist/PremiumBadge.vue_vue_type_script_setup_true_lang-BezTV43V.js +116 -0
  21. package/dist/{PurchaseOrderPrintPreview-5HIWHR_f.js → PurchaseOrderPrintPreview-Dix_fIoo.js} +14 -13
  22. package/dist/ReceiveRequestView-DdPiYb2P.js +4082 -0
  23. package/dist/RecipeView-C4-a4IEW.js +597 -0
  24. package/dist/Standalone.vue.d.ts +2 -0
  25. package/dist/StockView-Du2txrIP.js +7778 -0
  26. package/dist/SupplierView-D_09FbQh.js +1474 -0
  27. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-C9MOos--.js +1144 -0
  28. package/dist/TransferTemplateView-j3CRy6Lc.js +1262 -0
  29. package/dist/{UnitView-BpU0Yk7X.js → UnitView-BXw2Vwq1.js} +30 -29
  30. package/dist/{WarehouseView-DqxWgogc.js → WarehouseView-CKamiETC.js} +205 -202
  31. package/dist/_plugin-vue_export-helper-CHgC5LLL.js +9 -0
  32. package/dist/api/bill.d.ts +86 -240
  33. package/dist/api/closing-template.d.ts +6 -4
  34. package/dist/api/inventory.d.ts +281 -88
  35. package/dist/api/netsuite.d.ts +32 -1
  36. package/dist/api/purchase-order-template.d.ts +4 -2
  37. package/dist/api/supplier.d.ts +1 -0
  38. package/dist/app-GUbzqEtW.js +33456 -0
  39. package/dist/app.d.ts +259 -6
  40. package/dist/app.js +8 -7
  41. package/dist/array-hChJVZLE.js +43 -0
  42. package/dist/components/FmFilterableMenuOptions.vue.d.ts +54 -0
  43. package/dist/components/FmMinMaxInputRules.d.ts +2 -0
  44. package/dist/components/FmMultiselectDialog.vue.d.ts +3 -9
  45. package/dist/components/FmMultiselectDialogProps.d.ts +0 -2
  46. package/dist/components/FmUnitInputRules.d.ts +2 -0
  47. package/dist/components/inventory-binding/InventoryBinding.vue.d.ts +5 -5
  48. package/dist/components/map/GoogleMap.vue.d.ts +4 -4
  49. package/dist/components/shell/inventory/binding-dialog.vue.d.ts +2 -2
  50. package/dist/components/shell/inventory/binding-ui.vue.d.ts +2 -2
  51. package/dist/date2-CLE9fB2R.js +117 -0
  52. package/dist/dayjs.min-CY1d38w7.js +282 -0
  53. package/dist/{decimal-DWbwRn_v.js → decimal-SIjO6Mjw.js} +1 -1
  54. package/dist/defineDeepModel-l40rX7kr.js +13 -0
  55. package/dist/extensions/array.d.ts +1 -0
  56. package/dist/feature-BXruKUhX.js +78 -0
  57. package/dist/{format-time-from-id-BnmaRuab.js → format-time-from-id-CcFsBXmk.js} +1 -1
  58. package/dist/format-unit-display-DEKg8cJm.js +1198 -0
  59. package/dist/fuzzy-CVOV9zJc.js +41 -0
  60. package/dist/googlemap-Dm8ERVai.js +97 -0
  61. package/dist/helper/rules.d.ts +7 -0
  62. package/dist/helper/rules.spec.d.ts +1 -0
  63. package/dist/helper/xlsx.util.d.ts +7 -0
  64. package/dist/index-BX5KZXhI.js +22279 -0
  65. package/dist/index-CVsyOEb1.js +10545 -0
  66. package/dist/index-m9e9nYfl.js +45 -0
  67. package/dist/netsuite-DAKRv7zr.js +146 -0
  68. package/dist/normalizeArguments-DP7Hrren.js +1552 -0
  69. package/dist/router/name.d.ts +1 -0
  70. package/dist/rules-DlnN8IP3.js +198 -0
  71. package/dist/stores/integration/foodmarkethub.d.ts +391 -0
  72. package/dist/stores/integration/index.d.ts +7 -0
  73. package/dist/stores/integration/netsuite.d.ts +102 -0
  74. package/dist/stores/inventory.d.ts +295 -9
  75. package/dist/stores/location.d.ts +508 -485
  76. package/dist/stores/supplier.d.ts +124 -4
  77. package/dist/stores/warehouse.d.ts +7 -4
  78. package/dist/style.css +1 -1
  79. package/dist/supplier-B21WlSAM.js +77 -0
  80. package/dist/tsconfig.app.tsbuildinfo +1 -1
  81. package/dist/use-inventory-binding-dialog-D3x6xj2O.js +95 -0
  82. package/dist/{use-template-enabled-locations-2-ClBq9FjN.js → use-template-enabled-locations-2-z-b-UXef.js} +9 -8
  83. package/dist/useTabStorage-BkIVScW_.js +25 -0
  84. package/dist/views/closing-template/closing-template-import/ClosingTemplateImport.vue.d.ts +2 -0
  85. package/dist/views/closing-template/closing-template-import/ClosingTemplateImportItem.vue.d.ts +12 -0
  86. package/dist/views/closing-template/closing-template-import/ClosingTemplateImportItemProps.d.ts +7 -0
  87. package/dist/views/closing-template/components/closing-template-form/composables/use-closing-template-items.d.ts +1 -1
  88. package/dist/views/closing-template/composables/use-closing-template-actions.d.ts +877 -1002
  89. package/dist/views/closing-template/composables/use-closing-template-table.d.ts +882 -1013
  90. package/dist/views/closing-template/helpers/import-export.helper.d.ts +58 -0
  91. package/dist/views/ingredient-group/IngredientGroupView.vue.d.ts +3 -0
  92. package/dist/views/ingredient-group/components/ingredient-group-dialog/IngredientGroupDialog.vue.d.ts +31 -0
  93. package/dist/views/ingredient-group/components/ingredient-group-dialog/IngredientGroupDialogProps.d.ts +12 -0
  94. package/dist/views/ingredient-group/components/ingredient-group-form/IngredientGroupForm.vue.d.ts +20 -0
  95. package/dist/views/ingredient-group/components/ingredient-group-form/IngredientGroupFormProps.d.ts +12 -0
  96. package/dist/views/ingredient-group/composables/use-ingredient-group-actions.d.ts +24 -0
  97. package/dist/views/ingredient-group/composables/use-ingredient-group-table.d.ts +215 -0
  98. package/dist/views/ingredients/components/convert/ConvertForm.vue.d.ts +2 -2
  99. package/dist/views/ingredients/components/ingredient-form/IngredientForm.vue.d.ts +2 -2
  100. package/dist/views/ingredients/components/inventory-binding/InventoryBindingForm.vue.d.ts +5 -5
  101. package/dist/views/ingredients/composables/use-ingredient-form.d.ts +2 -2
  102. package/dist/views/ingredients/composables/use-ingredient-table.d.ts +1 -1
  103. package/dist/views/integration/FoodMarketHub.vue.d.ts +2 -0
  104. package/dist/views/integration/NetSuite.vue.d.ts +2 -0
  105. package/dist/views/integration/components/ApplyProductDialog.vue.d.ts +7 -7
  106. package/dist/views/integration/components/ApplyProductDialogV4.vue.d.ts +7 -7
  107. package/dist/views/receive-request/components/transfer-details/TransferDetailsProps.d.ts +1 -0
  108. package/dist/views/receive-request/components/transfer-form/NetSuiteField.vue.d.ts +49 -0
  109. package/dist/views/receive-request/components/transfer-form/TransferForm.vue.d.ts +1913 -53
  110. package/dist/views/receive-request/components/transfer-form/TransferFormProps.d.ts +1 -0
  111. package/dist/views/receive-request/components/transfer-form/components/ForecastStock.vue.d.ts +2 -2
  112. package/dist/views/receive-request/components/transfer-form/composables/use-transfer-items.d.ts +1 -1
  113. package/dist/views/receive-request/composables/use-receive-request-form.d.ts +2370 -327
  114. package/dist/views/receive-request/composables/use-receive-request-table.d.ts +2304 -261
  115. package/dist/views/recipe/components/recipe-form/RecipeForm.vue.d.ts +2 -2
  116. package/dist/views/recipe/composables/use-recipe-form.d.ts +2 -2
  117. package/dist/views/stock/components/StockRecordCard.vue.d.ts +43 -120
  118. package/dist/views/stock/components/dialog/AdjustedItemForm.vue.d.ts +34 -4
  119. package/dist/views/stock/composables/use-stock-action.d.ts +2 -2
  120. package/dist/views/stock/helper/compute-summary-total.d.ts +2 -2
  121. package/dist/views/supplier/components/supplier-import/SupplierImport.vue.d.ts +2 -0
  122. package/dist/views/supplier/components/supplier-import/SupplierImportItem.vue.d.ts +12 -0
  123. package/dist/views/supplier/components/supplier-import/SupplierImportItemProps.d.ts +6 -0
  124. package/dist/views/supplier/composables/use-supplier-actions.d.ts +10 -0
  125. package/dist/views/supplier/helpers/import-export.helper.d.ts +50 -0
  126. package/dist/views/transfer-template/components/transfer-template-details/TransferTemplateDetails.vue.d.ts +0 -2
  127. package/dist/views/transfer-template/components/transfer-template-details/TransferTemplateDetailsProps.d.ts +0 -1
  128. package/dist/views/transfer-template/components/transfer-template-form/composables/use-template-enabled-locations.d.ts +71 -82
  129. package/dist/views/transfer-template/components/transfer-template-form/composables/use-transfer-locations.d.ts +38 -1
  130. package/dist/views/transfer-template/components/transfer-template-form/composables/use-transfer-template-items.d.ts +1 -1
  131. package/dist/views/transfer-template/components/transfer-template-import/TransferTemplateImport.vue.d.ts +2 -0
  132. package/dist/views/transfer-template/components/transfer-template-import/TransferTemplateImportItem.vue.d.ts +12 -0
  133. package/dist/views/transfer-template/components/transfer-template-import/TransferTemplateImportItemProps.d.ts +9 -0
  134. package/dist/views/transfer-template/composables/use-transfer-template-actions.d.ts +1279 -1528
  135. package/dist/views/transfer-template/composables/use-transfer-template-table.d.ts +2207 -446
  136. package/dist/views/transfer-template/helpers/import-export.helper.d.ts +76 -0
  137. package/dist/views/transfer-template/helpers/remove-deleted-skus.helper.d.ts +1 -251
  138. package/dist/views/transfer-template/helpers/template-item.error.helper.d.ts +1 -0
  139. package/dist/views/unit/composables/use-unit-form.d.ts +2 -2
  140. package/dist/views/warehouse/components/WarehouseForm.vue.d.ts +14 -8
  141. package/dist/{xlsx-DiOKvJ6l.js → xlsx-6mM1eNiL.js} +1525 -1525
  142. package/dist/xlsx.util-BLftcF4q.js +78 -0
  143. package/package.json +7 -4
  144. package/dist/ApprovalView-BPsScR5_.js +0 -129
  145. package/dist/ClosingTemplateView-DECwEnlK.js +0 -1066
  146. package/dist/FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-DnogYrRE.js +0 -372
  147. package/dist/IngredientsView-8fT1Ljd5.js +0 -1758
  148. package/dist/IntegrationView-CjGLRM78.js +0 -1141
  149. package/dist/PremiumBadge.vue_vue_type_script_setup_true_lang-DlhNc8Vk.js +0 -88
  150. package/dist/ReceiveRequestView-CXZv8g5U.js +0 -215
  151. package/dist/RecipeView-sB0Lgmob.js +0 -581
  152. package/dist/StockView-CY2kNohB.js +0 -1892
  153. package/dist/SupplierView-DTqeZPts.js +0 -827
  154. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-BBby29tW.js +0 -762
  155. package/dist/TransferDialog.vue_vue_type_script_setup_true_lang-ByNQap9n.js +0 -1498
  156. package/dist/TransferTemplateView-DkRVfAox.js +0 -1277
  157. package/dist/app-BuyAj4kw.js +0 -69068
  158. package/dist/defineDeepModel-DuVmbMwq.js +0 -13
  159. package/dist/id-to-date-CI5Vv0Ji.js +0 -30
  160. package/dist/purchase-order-transaction-type-DrFJFvtK.js +0 -676
  161. package/dist/stores/netsuite.d.ts +0 -49
  162. package/dist/supplier-BQyK2eSZ.js +0 -69
  163. package/dist/xlsx.util-CZ7zYxdP.js +0 -109
@@ -0,0 +1,597 @@
1
+ import { defineComponent as Y, ref as E, onMounted as re, resolveComponent as S, 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 { a as I, c as G, S as ye, F as ee, h as te, u as ge } from "./app-GUbzqEtW.js";
3
+ import { useDialog as be, useSnackbar as se, useProxiedModel as ne, useBreakpoints as _e } from "@feedmepos/ui-library";
4
+ import { i as we, _ as Re } 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-FQ0HjuL3.js";
7
+ import { defineStore as he, storeToRefs as xe } from "pinia";
8
+ import { c as Ce, _ as Ee, F as ae } from "./TableActionableRow.vue_vue_type_script_setup_true_lang-DlNJ6kRg.js";
9
+ import { a as z, R as Fe, U as Se, A as Ve } from "./rules-DlnN8IP3.js";
10
+ import { useI18n as H } from "@feedmepos/mf-common";
11
+ import { u as ke, _ as De, a as Ie } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-5DINn0ZB.js";
12
+ import { _ as $e } from "./InventoryBindingForm.vue_vue_type_script_setup_true_lang-CJuo3i7W.js";
13
+ import { t as Ae, d as Pe } from "./xlsx.util-BLftcF4q.js";
14
+ import { f as Be } from "./date2-CLE9fB2R.js";
15
+ const Te = {
16
+ key: 0,
17
+ class: "flex flex-col items-center w-full h-full gap-24"
18
+ }, Me = { key: 1 }, Ue = { key: 0 }, Ne = /* @__PURE__ */ Y({
19
+ __name: "DeleteDialog",
20
+ props: {
21
+ type: {},
22
+ data: {},
23
+ message: {},
24
+ bindedItems: {}
25
+ },
26
+ setup(R) {
27
+ const p = R, v = E(p.bindedItems || []), r = E(!1);
28
+ re(() => {
29
+ l();
30
+ });
31
+ async function l() {
32
+ var c, i;
33
+ !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);
34
+ }
35
+ return (c, i) => {
36
+ const f = S("FmSpacer"), d = S("FmCircularProgress");
37
+ return C(), A(ie, null, [
38
+ w("p", null, ce(c.message), 1),
39
+ r.value ? (C(), A("div", Te, [
40
+ g(f),
41
+ w("div", null, [
42
+ g(d, { size: "xl" })
43
+ ]),
44
+ i[0] || (i[0] = w("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary pl-8" }, "Loading...", -1)),
45
+ g(f)
46
+ ])) : (C(), A("div", Me, [
47
+ i[2] || (i[2] = w("br", null, null, -1)),
48
+ v.value.length > 0 ? (C(), A("div", Ue, [
49
+ i[1] || (i[1] = w("p", { class: "fm-typo-en-body-lg-600" }, "Affected menu items:", -1)),
50
+ g(le, {
51
+ name: "Menu",
52
+ bindings: v.value
53
+ }, null, 8, ["bindings"])
54
+ ])) : j("", !0)
55
+ ]))
56
+ ], 64);
57
+ };
58
+ }
59
+ }), q = he("recipeForm", function() {
60
+ const p = be(), v = se(), r = I(), l = E(!1), c = E();
61
+ function i() {
62
+ const t = {
63
+ recipe: {},
64
+ mode: x.CREATE,
65
+ show: !0,
66
+ "onUpdate:show"(a) {
67
+ c.value.show = a;
68
+ }
69
+ };
70
+ c.value = t;
71
+ }
72
+ async function f(t) {
73
+ const a = {
74
+ recipe: G(t),
75
+ mode: x.UPDATE,
76
+ show: !0,
77
+ "onUpdate:show"(e) {
78
+ c.value.show = e;
79
+ }
80
+ };
81
+ c.value = a;
82
+ }
83
+ async function d(t) {
84
+ l.value = !0;
85
+ try {
86
+ await r.deleteRecipe(t), v.open({
87
+ title: "Success",
88
+ message: `Deleted ${t.name}`,
89
+ type: "success"
90
+ });
91
+ } catch (a) {
92
+ a instanceof ye && we(a) ? p.open({
93
+ title: "Cannot delete recipe",
94
+ contentComponent: Re,
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), v.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
+ l.value = !1;
110
+ }
111
+ }
112
+ function u(t) {
113
+ p.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: Ne,
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(() => d(t));
132
+ }
133
+ return {
134
+ createRecipe: i,
135
+ updateRecipe: f,
136
+ deleteRecipe: u,
137
+ recipeDialogProps: c,
138
+ recipeViewLoading: l
139
+ };
140
+ });
141
+ function Le() {
142
+ const { updateRecipe: R, deleteRecipe: p } = q(), v = I(), { t: r } = H();
143
+ async function l(d, u) {
144
+ const t = G(u);
145
+ if (d === L.Edit) {
146
+ await R(t);
147
+ return;
148
+ }
149
+ if (d === L.Delete) {
150
+ await p(t);
151
+ return;
152
+ }
153
+ }
154
+ function c(d, u) {
155
+ const t = d.filter((e) => e.type === ee.enum.SKU), a = d.filter((e) => e.type === ee.enum.RECIPE);
156
+ return [
157
+ ...t.map((e) => ({ ...e, recipeIds: [...u] })),
158
+ ...a.filter((e) => v.recipeById[e.id] && !u.has(e.id)).flatMap(
159
+ (e) => c(v.recipeById[e.id].contains, /* @__PURE__ */ new Set([...u, e.id]))
160
+ )
161
+ ];
162
+ }
163
+ const i = [
164
+ {
165
+ accessorKey: "recipe",
166
+ header: () => r("inventory.recipe.name"),
167
+ size: 400
168
+ },
169
+ {
170
+ accessorKey: "ingredients",
171
+ header: () => r("inventory.recipe.ingredients"),
172
+ size: "auto"
173
+ },
174
+ {
175
+ id: "action",
176
+ header: "",
177
+ cell(d) {
178
+ return Ce(
179
+ [oe[L.Edit], oe[L.Delete]],
180
+ (u) => {
181
+ l(u, d.row.original.original);
182
+ }
183
+ );
184
+ },
185
+ enableSorting: !1,
186
+ size: 40,
187
+ meta: {
188
+ cellClass: "",
189
+ headerClass: ""
190
+ }
191
+ }
192
+ ];
193
+ function f(d) {
194
+ const u = I();
195
+ return d.map((t) => ({
196
+ recipe: t.name,
197
+ ingredients: c(t.contains, /* @__PURE__ */ new Set([t._id])).map((a) => {
198
+ var b, _, s, m, h;
199
+ const e = u.skuById[a.id];
200
+ 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;
201
+ }).filter((a) => a).join(", "),
202
+ original: t
203
+ }));
204
+ }
205
+ return { columnDefs: i, formatRowData: f };
206
+ }
207
+ const ze = { class: "flex flex-col gap-40" }, Ye = {
208
+ key: 0,
209
+ 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"
210
+ }, He = {
211
+ key: 0,
212
+ class: "flex flex-col items-center w-full h-full gap-24"
213
+ }, Ke = { key: 1 }, je = /* @__PURE__ */ Y({
214
+ __name: "RecipeForm",
215
+ props: {
216
+ mode: {},
217
+ modelValue: {},
218
+ disabled: { type: Boolean }
219
+ },
220
+ emits: ["update:modelValue", "click:submit"],
221
+ setup(R, { expose: p, emit: v }) {
222
+ var h;
223
+ const r = R, l = v, { t: c } = H(), i = V({
224
+ get() {
225
+ var n;
226
+ return ((n = r.modelValue) == null ? void 0 : n.name) ?? "";
227
+ },
228
+ set(n) {
229
+ const o = r.modelValue ?? {};
230
+ o.name = n, l("update:modelValue", o);
231
+ }
232
+ }), f = V({
233
+ get() {
234
+ var n;
235
+ return ((n = r.modelValue) == null ? void 0 : n.contains) ?? [];
236
+ },
237
+ set(n) {
238
+ const o = r.modelValue ?? {};
239
+ o.contains = n, l("update:modelValue", o);
240
+ }
241
+ });
242
+ function d() {
243
+ l("click:submit");
244
+ }
245
+ const u = E();
246
+ p({
247
+ validateInputs: () => {
248
+ var n, o;
249
+ (o = (n = u.value) == null ? void 0 : n.validateInputs) == null || o.call(n);
250
+ },
251
+ resetInputsValidation: () => {
252
+ var n, o;
253
+ (o = (n = u.value) == null ? void 0 : n.resetInputsValidation) == null || o.call(n);
254
+ },
255
+ resetInputs: () => {
256
+ var n, o;
257
+ (o = (n = u.value) == null ? void 0 : n.resetInputs) == null || o.call(n);
258
+ }
259
+ });
260
+ const t = I(), a = E([]), e = E(!1), b = E(!1);
261
+ ue(e, async (n) => {
262
+ _(n);
263
+ });
264
+ async function _(n) {
265
+ var o, k;
266
+ 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);
267
+ }
268
+ const s = V(
269
+ () => t.recipes.map((n) => ({ label: n.name, value: n.name }))
270
+ ), m = E((h = r.modelValue) == null ? void 0 : h.name);
271
+ return (n, o) => {
272
+ const k = S("FmTextField"), K = S("FmCard"), $ = S("FmSwitch"), D = S("FmSpacer"), M = S("FmCircularProgress"), U = S("FmForm");
273
+ return C(), T(U, {
274
+ ref_key: "formRef",
275
+ ref: u,
276
+ onValidationSuccess: d
277
+ }, {
278
+ default: P(() => [
279
+ w("div", ze, [
280
+ g(k, {
281
+ disabled: n.disabled,
282
+ label: y(c)("inventory.recipe.name"),
283
+ "model-value": i.value,
284
+ "onUpdate:modelValue": o[0] || (o[0] = (F) => i.value = F),
285
+ rules: [
286
+ y(Fe)(),
287
+ y(Se)(s.value, m.value, (F) => `[${F.value}] already exists`)
288
+ ],
289
+ "label-mark": "required"
290
+ }, null, 8, ["disabled", "label", "model-value", "rules"]),
291
+ g(K, {
292
+ variant: "outlined",
293
+ class: "p-16"
294
+ }, {
295
+ default: P(() => {
296
+ var F;
297
+ return [
298
+ g($e, {
299
+ id: (F = n.modelValue) == null ? void 0 : F._id,
300
+ disabled: n.disabled,
301
+ "model-value": f.value,
302
+ "onUpdate:modelValue": o[1] || (o[1] = (B) => f.value = B),
303
+ rules: [y(Ve)(1)]
304
+ }, null, 8, ["id", "disabled", "model-value", "rules"])
305
+ ];
306
+ }),
307
+ _: 1
308
+ })
309
+ ]),
310
+ n.mode !== y(x).CREATE ? (C(), A("div", Ye, [
311
+ w("div", null, [
312
+ g($, {
313
+ label: "Show binded items",
314
+ modelValue: e.value,
315
+ "onUpdate:modelValue": o[2] || (o[2] = (F) => e.value = F),
316
+ "label-placement": "right",
317
+ disabled: b.value
318
+ }, null, 8, ["modelValue", "disabled"])
319
+ ]),
320
+ b.value ? (C(), A("div", He, [
321
+ g(D),
322
+ w("div", null, [
323
+ g(M, { size: "xl" })
324
+ ]),
325
+ o[3] || (o[3] = w("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary pl-8" }, "Loading...", -1)),
326
+ g(D)
327
+ ])) : (C(), A("div", Ke, [
328
+ e.value && a.value.length ? (C(), T(le, {
329
+ key: 0,
330
+ name: "Menu",
331
+ bindings: a.value
332
+ }, null, 8, ["bindings"])) : j("", !0)
333
+ ]))
334
+ ])) : j("", !0)
335
+ ]),
336
+ _: 1
337
+ }, 512);
338
+ };
339
+ }
340
+ }), qe = { class: "flex gap-4" }, Ge = /* @__PURE__ */ Y({
341
+ __name: "RecipeDialog",
342
+ props: {
343
+ show: { type: Boolean },
344
+ recipe: {},
345
+ mode: { default: x.READ }
346
+ },
347
+ emits: ["update:show"],
348
+ setup(R) {
349
+ const p = R, v = I(), r = se(), { t: l } = H(), c = ne(p, "show"), i = ne(p, "recipe"), f = V(() => {
350
+ switch (p.mode) {
351
+ case x.READ:
352
+ return "";
353
+ case x.UPDATE:
354
+ return l("inventory.recipe.update.title");
355
+ case x.CREATE:
356
+ return l("inventory.recipe.create.title");
357
+ }
358
+ return "";
359
+ }), d = V(() => {
360
+ switch (p.mode) {
361
+ case x.READ:
362
+ return "";
363
+ case x.UPDATE:
364
+ return l("common.save");
365
+ case x.CREATE:
366
+ return l("common.add");
367
+ }
368
+ return "";
369
+ }), u = E(), t = E(!1);
370
+ async function a() {
371
+ t.value = !0;
372
+ try {
373
+ const s = G(i.value);
374
+ s.precision ?? (s.precision = 0), s.measurements ?? (s.measurements = []), await v.createRecipe(s), c.value = !1, r.open({
375
+ title: l("inventory.common.success"),
376
+ message: l("inventory.recipe.create.success", { name: i.value.name }),
377
+ type: "success"
378
+ });
379
+ } catch (s) {
380
+ s instanceof te || r.open({
381
+ title: l("inventory.recipe.create.error.title"),
382
+ message: l("inventory.recipe.create.error.message"),
383
+ type: "error"
384
+ });
385
+ } finally {
386
+ t.value = !1;
387
+ }
388
+ }
389
+ async function e() {
390
+ t.value = !0;
391
+ try {
392
+ await v.updateRecipe(i.value), c.value = !1, r.open({
393
+ title: l("inventory.common.success"),
394
+ message: l("inventory.recipe.update.success", { name: i.value.name }),
395
+ type: "success"
396
+ });
397
+ } catch (s) {
398
+ s instanceof te || r.open({
399
+ title: l("inventory.recipe.update.error.title"),
400
+ message: l("inventory.recipe.update.error.message"),
401
+ type: "error"
402
+ });
403
+ } finally {
404
+ t.value = !1;
405
+ }
406
+ }
407
+ function b() {
408
+ var s, m;
409
+ (m = (s = u.value) == null ? void 0 : s.validateInputs) == null || m.call(s);
410
+ }
411
+ function _() {
412
+ switch (p.mode) {
413
+ case x.READ:
414
+ return;
415
+ case x.UPDATE:
416
+ return e();
417
+ case x.CREATE:
418
+ return a();
419
+ }
420
+ }
421
+ return (s, m) => {
422
+ const h = S("FmButton"), n = S("FmSideSheet");
423
+ return C(), T(n, {
424
+ "model-value": y(c),
425
+ "onUpdate:modelValue": m[3] || (m[3] = (o) => Z(c) ? c.value = o : null),
426
+ header: f.value,
427
+ "close-button": "",
428
+ "dismiss-away": "",
429
+ "max-width": 500
430
+ }, {
431
+ "side-sheet-footer": P(() => [
432
+ w("div", qe, [
433
+ g(h, {
434
+ loading: t.value,
435
+ label: d.value,
436
+ onClick: b
437
+ }, null, 8, ["loading", "label"]),
438
+ g(h, {
439
+ disabled: t.value,
440
+ label: y(l)("common.close"),
441
+ variant: "tertiary",
442
+ onClick: m[2] || (m[2] = (o) => c.value = !1)
443
+ }, null, 8, ["disabled", "label"])
444
+ ])
445
+ ]),
446
+ default: P(() => [
447
+ g(je, {
448
+ class: "w-full",
449
+ ref_key: "hasValidationExpose",
450
+ ref: u,
451
+ modelValue: y(i),
452
+ "onUpdate:modelValue": m[0] || (m[0] = (o) => Z(i) ? i.value = o : null),
453
+ mode: s.mode,
454
+ disabled: t.value,
455
+ "onClick:submit": m[1] || (m[1] = (o) => _())
456
+ }, null, 8, ["modelValue", "mode", "disabled"])
457
+ ]),
458
+ _: 1
459
+ }, 8, ["model-value", "header"]);
460
+ };
461
+ }
462
+ });
463
+ function Oe() {
464
+ const R = I(), p = R.recipes, v = R.recipeById, r = R.skuById, l = p.flatMap((f, d) => {
465
+ var u;
466
+ if ((u = f.contains) != null && u.length) {
467
+ const t = f.contains.filter((e) => e.type === "RECIPE"), a = f.contains.filter((e) => e.type === "SKU");
468
+ return [
469
+ ...d === 0 ? [] : [["", "", "", "", "", ""]],
470
+ ...t.map(
471
+ (e, b) => {
472
+ var _;
473
+ return [
474
+ b === 0 ? f.name : "",
475
+ "RECIPE",
476
+ "",
477
+ (_ = v[e.id]) == null ? void 0 : _.name,
478
+ z(e.amount),
479
+ "UNIT"
480
+ ];
481
+ }
482
+ ),
483
+ ...a.map(
484
+ (e, b) => {
485
+ var _, s, m, h;
486
+ return [
487
+ !t.length && b === 0 ? f.name : "",
488
+ "INGREDIENT",
489
+ (_ = r[e.id]) == null ? void 0 : _.code,
490
+ (s = r[e.id]) == null ? void 0 : s.name,
491
+ z(e.amount),
492
+ e.measurement ? e.measurement.abbrev : (h = (m = r[e.id]) == null ? void 0 : m.unit) == null ? void 0 : h.abbrev
493
+ ];
494
+ }
495
+ )
496
+ ];
497
+ }
498
+ return [
499
+ ...d === 0 ? [] : [["", "", "", "", "", ""]],
500
+ [f.name, "No bindings", "", "", "", ""]
501
+ ];
502
+ }), i = Ae(l, ["Name", "Type", "Code", "Item", "Amount", "Unit"]);
503
+ Pe(i, `RECIPE_${Be(/* @__PURE__ */ new Date(), "-", "-")}.xlsx`);
504
+ }
505
+ 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" }, mt = /* @__PURE__ */ Y({
506
+ __name: "RecipeView",
507
+ setup(R) {
508
+ const p = I(), v = V(() => p.recipes), r = ge(), { createRecipe: l, updateRecipe: c } = q(), { recipeDialogProps: i, recipeViewLoading: f } = xe(q()), { columnDefs: d, formatRowData: u } = Le(), t = V(() => u(v.value));
509
+ function a(o) {
510
+ if (o === "add")
511
+ return l();
512
+ if (o === "export")
513
+ return Oe();
514
+ }
515
+ const e = E(""), b = V(() => f.value), { breakpoints: _ } = _e(), s = V(() => _.value.xs || _.value.sm), m = V(() => s.value ? 10 : 20), h = ke(), { t: n } = H();
516
+ return (o, k) => {
517
+ const K = S("FmTable");
518
+ return C(), T(De, {
519
+ title: y(n)("inventory.recipe.title"),
520
+ actions: [
521
+ {
522
+ label: y(n)("inventory.recipe.create.title"),
523
+ value: "add",
524
+ isPrimary: !0,
525
+ prependIcon: "add"
526
+ },
527
+ { label: y(n)("common.export"), value: "export", isPrimary: !1 }
528
+ ],
529
+ "onClick:action": a
530
+ }, {
531
+ default: P(() => [
532
+ w("div", {
533
+ class: de([
534
+ "flex flex-col gap-8 max-h-full",
535
+ {
536
+ "p-0": s.value,
537
+ "px-24 ": !s.value
538
+ }
539
+ ])
540
+ }, [
541
+ g(Ie, {
542
+ searchable: "",
543
+ search: e.value,
544
+ "onUpdate:search": k[0] || (k[0] = ($) => e.value = $)
545
+ }, null, 8, ["search"]),
546
+ (C(), T(K, {
547
+ style: me(y(h).tableHeight),
548
+ "column-defs": y(d),
549
+ "row-data": t.value,
550
+ "search-value": e.value,
551
+ loading: !y(r)._currentLocation || b.value,
552
+ onRowClick: k[1] || (k[1] = ($) => y(c)($.original.original)),
553
+ key: v.value.length,
554
+ "page-size": m.value
555
+ }, {
556
+ "list-row": P(($) => [
557
+ g(Ee, {
558
+ row: $,
559
+ onRowClick: (D) => y(c)(D.original)
560
+ }, {
561
+ default: P((D) => {
562
+ var M, U, F, B, O, J, Q, W, N, X;
563
+ return [
564
+ w("div", Je, [
565
+ w("div", Qe, [
566
+ g(y(ae), {
567
+ render: (F = (U = (M = D.recipe) == null ? void 0 : M.column) == null ? void 0 : U.columnDef) == null ? void 0 : F.cell,
568
+ props: (O = (B = D.recipe) == null ? void 0 : B.getContext) == null ? void 0 : O.call(B)
569
+ }, null, 8, ["render", "props"])
570
+ ]),
571
+ w("div", We, [
572
+ g(y(ae), {
573
+ render: (W = (Q = (J = D.ingredients) == null ? void 0 : J.column) == null ? void 0 : Q.columnDef) == null ? void 0 : W.cell,
574
+ props: (X = (N = D.ingredients) == null ? void 0 : N.getContext) == null ? void 0 : X.call(N)
575
+ }, null, 8, ["render", "props"])
576
+ ])
577
+ ])
578
+ ];
579
+ }),
580
+ _: 2
581
+ }, 1032, ["row", "onRowClick"])
582
+ ]),
583
+ _: 1
584
+ }, 8, ["style", "column-defs", "row-data", "search-value", "loading", "page-size"]))
585
+ ], 2),
586
+ (C(), T(pe, { to: "body" }, [
587
+ g(Ge, fe(ve(y(i))), null, 16)
588
+ ]))
589
+ ]),
590
+ _: 1
591
+ }, 8, ["title", "actions"]);
592
+ };
593
+ }
594
+ });
595
+ export {
596
+ mt as default
597
+ };
@@ -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;