@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
@@ -1,581 +0,0 @@
1
- import { defineComponent as N, ref as x, onMounted as le, resolveComponent as F, openBlock as h, createElementBlock as $, Fragment as re, createElementVNode as b, toDisplayString as ie, createVNode as y, createCommentVNode as H, computed as V, watch as ce, createBlock as M, withCtx as I, unref as v, isRef as Z, normalizeClass as ue, normalizeStyle as de, Teleport as me, normalizeProps as pe, guardReactiveProps as fe } from "vue";
2
- import { u as P, c as G, S as ve, a as q, R as ye, U as ge, _ as be, A as _e, e as ee, f as we, j as Re } from "./app-CfXF4jdF.js";
3
- import { useDialog as he, useSnackbar as ae, useProxiedModel as te, useBreakpoints as Ce } from "@feedmepos/ui-library";
4
- import { i as xe, _ as Ee } from "./is-linked-ingredient-error-fJ2TJb3z.js";
5
- import { F as R, D as ne, R as z } from "./row-action.enum-PMKMRrZR.js";
6
- import { _ as se, t as Fe, d as ke } from "./xlsx.util-BKFiH-ig.js";
7
- import { defineStore as Ve, storeToRefs as Se } from "pinia";
8
- import { c as De, _ as Ae, F as oe } from "./TableActionableRow.vue_vue_type_script_setup_true_lang-DlNJ6kRg.js";
9
- import { useI18n as Y } from "@feedmepos/mf-common";
10
- import { u as $e, _ as Ie, a as Pe } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-D3B7kOlU.js";
11
- const Te = {
12
- key: 0,
13
- class: "flex flex-col items-center w-full h-full gap-24"
14
- }, Me = { key: 1 }, Ue = { key: 0 }, Be = /* @__PURE__ */ N({
15
- __name: "DeleteDialog",
16
- props: {
17
- type: {},
18
- data: {},
19
- message: {},
20
- bindedItems: {}
21
- },
22
- setup(_) {
23
- const d = _, p = x(d.bindedItems || []), l = x(!1);
24
- le(() => {
25
- a();
26
- });
27
- async function a() {
28
- var i, o;
29
- !l.value && ((i = d.data) != null && i._id) && (l.value = !0, p.value = await P().getAffectedMenu((o = d.data) == null ? void 0 : o._id), l.value = !1);
30
- }
31
- return (i, o) => {
32
- const c = F("FmSpacer"), f = F("FmCircularProgress");
33
- return h(), $(re, null, [
34
- b("p", null, ie(i.message), 1),
35
- l.value ? (h(), $("div", Te, [
36
- y(c),
37
- b("div", null, [
38
- y(f, { size: "xl" })
39
- ]),
40
- o[0] || (o[0] = b("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary pl-8" }, "Loading...", -1)),
41
- y(c)
42
- ])) : (h(), $("div", Me, [
43
- o[2] || (o[2] = b("br", null, null, -1)),
44
- p.value.length > 0 ? (h(), $("div", Ue, [
45
- o[1] || (o[1] = b("p", { class: "fm-typo-en-body-lg-600" }, "Affected menu items:", -1)),
46
- y(se, {
47
- name: "Menu",
48
- bindings: p.value
49
- }, null, 8, ["bindings"])
50
- ])) : H("", !0)
51
- ]))
52
- ], 64);
53
- };
54
- }
55
- }), K = Ve("recipeForm", function() {
56
- const d = he(), p = ae(), l = P(), a = x(!1), i = x();
57
- function o() {
58
- const t = {
59
- recipe: {},
60
- mode: R.CREATE,
61
- show: !0,
62
- "onUpdate:show"(u) {
63
- i.value.show = u;
64
- }
65
- };
66
- i.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"(s) {
74
- i.value.show = s;
75
- }
76
- };
77
- i.value = u;
78
- }
79
- async function f(t) {
80
- a.value = !0;
81
- try {
82
- await l.deleteRecipe(t), p.open({
83
- title: "Success",
84
- message: `Deleted ${t.name}`,
85
- type: "success"
86
- });
87
- } catch (u) {
88
- u instanceof ve && xe(u) ? d.open({
89
- title: "Cannot delete recipe",
90
- contentComponent: Ee,
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
- a.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: Be,
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: o,
131
- updateRecipe: c,
132
- deleteRecipe: m,
133
- recipeDialogProps: i,
134
- recipeViewLoading: a
135
- };
136
- });
137
- function Le() {
138
- const { updateRecipe: _, deleteRecipe: d } = K(), { t: p } = Y();
139
- async function l(o, c) {
140
- const f = G(c);
141
- if (o === z.Edit) {
142
- await _(f);
143
- return;
144
- }
145
- if (o === z.Delete) {
146
- await d(f);
147
- return;
148
- }
149
- }
150
- const a = [
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(o) {
165
- return De(
166
- [ne[z.Edit], ne[z.Delete]],
167
- (c) => {
168
- l(c, o.row.original.original);
169
- }
170
- );
171
- },
172
- enableSorting: !1,
173
- size: 40,
174
- meta: {
175
- cellClass: "",
176
- headerClass: ""
177
- }
178
- }
179
- ];
180
- function i(o) {
181
- const c = P();
182
- return o.map((f) => ({
183
- recipe: f.name,
184
- ingredients: f.contains.map((m) => {
185
- var u, s;
186
- const t = c.skuById[m.id];
187
- return t ? `${t.name} (${q(m.amount)}${((u = m.measurement) == null ? void 0 : u.abbrev) ?? ((s = t == null ? void 0 : t.unit) == null ? void 0 : s.abbrev)})` : null;
188
- }).filter((m) => m).join(", "),
189
- original: f
190
- }));
191
- }
192
- return { columnDefs: a, formatRowData: i };
193
- }
194
- const ze = { class: "flex flex-col gap-40" }, Ne = {
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
- }, Ye = {
198
- key: 0,
199
- class: "flex flex-col items-center w-full h-full gap-24"
200
- }, je = { key: 1 }, He = /* @__PURE__ */ N({
201
- __name: "RecipeForm",
202
- props: {
203
- mode: {},
204
- modelValue: {},
205
- disabled: { type: Boolean }
206
- },
207
- emits: ["update:modelValue", "click:submit"],
208
- setup(_, { expose: d, emit: p }) {
209
- var k;
210
- const l = _, a = p, { t: i } = Y(), o = V({
211
- get() {
212
- var e;
213
- return ((e = l.modelValue) == null ? void 0 : e.name) ?? "";
214
- },
215
- set(e) {
216
- const n = l.modelValue ?? {};
217
- n.name = e, a("update:modelValue", n);
218
- }
219
- }), c = V({
220
- get() {
221
- var e;
222
- return ((e = l.modelValue) == null ? void 0 : e.contains) ?? [];
223
- },
224
- set(e) {
225
- const n = l.modelValue ?? {};
226
- n.contains = e, a("update:modelValue", n);
227
- }
228
- });
229
- function f() {
230
- a("click:submit");
231
- }
232
- const m = x();
233
- d({
234
- validateInputs: () => {
235
- var e, n;
236
- (n = (e = m.value) == null ? void 0 : e.validateInputs) == null || n.call(e);
237
- },
238
- resetInputsValidation: () => {
239
- var e, n;
240
- (n = (e = m.value) == null ? void 0 : e.resetInputsValidation) == null || n.call(e);
241
- },
242
- resetInputs: () => {
243
- var e, n;
244
- (n = (e = m.value) == null ? void 0 : e.resetInputs) == null || n.call(e);
245
- }
246
- });
247
- const t = P(), u = x([]), s = x(!1), w = x(!1);
248
- ce(s, async (e) => {
249
- C(e);
250
- });
251
- async function C(e) {
252
- var n, S;
253
- e && !w.value && ((n = l.modelValue) != null && n._id) && (w.value = !0, u.value = await t.getAffectedMenu((S = l.modelValue) == null ? void 0 : S._id), w.value = !1);
254
- }
255
- const r = V(
256
- () => t.recipes.map((e) => ({ label: e.name, value: e.name }))
257
- ), g = x((k = l.modelValue) == null ? void 0 : k.name);
258
- return (e, n) => {
259
- const S = F("FmTextField"), j = F("FmCard"), A = F("FmSwitch"), D = F("FmSpacer"), U = F("FmCircularProgress"), B = F("FmForm");
260
- return h(), M(B, {
261
- ref_key: "formRef",
262
- ref: m,
263
- onValidationSuccess: f
264
- }, {
265
- default: I(() => [
266
- b("div", ze, [
267
- y(S, {
268
- disabled: e.disabled,
269
- label: v(i)("inventory.recipe.name"),
270
- "model-value": o.value,
271
- "onUpdate:modelValue": n[0] || (n[0] = (E) => o.value = E),
272
- rules: [
273
- v(ye)(),
274
- v(ge)(r.value, g.value, (E) => `[${E.value}] already exists`)
275
- ],
276
- "label-mark": "required"
277
- }, null, 8, ["disabled", "label", "model-value", "rules"]),
278
- y(j, {
279
- variant: "outlined",
280
- class: "p-16"
281
- }, {
282
- default: I(() => {
283
- var E;
284
- return [
285
- y(be, {
286
- id: (E = e.modelValue) == null ? void 0 : E._id,
287
- disabled: e.disabled,
288
- "model-value": c.value,
289
- "onUpdate:modelValue": n[1] || (n[1] = (T) => c.value = T),
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 ? (h(), $("div", Ne, [
298
- b("div", null, [
299
- y(A, {
300
- label: "Show binded items",
301
- modelValue: s.value,
302
- "onUpdate:modelValue": n[2] || (n[2] = (E) => s.value = E),
303
- "label-placement": "right",
304
- disabled: w.value
305
- }, null, 8, ["modelValue", "disabled"])
306
- ]),
307
- w.value ? (h(), $("div", Ye, [
308
- y(D),
309
- b("div", null, [
310
- y(U, { size: "xl" })
311
- ]),
312
- n[3] || (n[3] = b("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary pl-8" }, "Loading...", -1)),
313
- y(D)
314
- ])) : (h(), $("div", je, [
315
- s.value && u.value.length ? (h(), M(se, {
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
- }), qe = { class: "flex gap-4" }, Ke = /* @__PURE__ */ N({
328
- __name: "RecipeDialog",
329
- props: {
330
- show: { type: Boolean },
331
- recipe: {},
332
- mode: { default: R.READ }
333
- },
334
- emits: ["update:show"],
335
- setup(_) {
336
- const d = _, p = P(), l = ae(), { t: a } = Y(), i = te(d, "show"), o = te(d, "recipe"), c = V(() => {
337
- switch (d.mode) {
338
- case R.READ:
339
- return "";
340
- case R.UPDATE:
341
- return a("inventory.recipe.update.title");
342
- case R.CREATE:
343
- return a("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 a("common.save");
352
- case R.CREATE:
353
- return a("common.add");
354
- }
355
- return "";
356
- }), m = x(), t = x(!1);
357
- async function u() {
358
- t.value = !0;
359
- try {
360
- const r = G(o.value);
361
- r.precision ?? (r.precision = 0), r.measurements ?? (r.measurements = []), await p.createRecipe(r), i.value = !1, l.open({
362
- title: a("common.success"),
363
- message: a("inventory.recipe.create.success", { name: o.value.name }),
364
- type: "success"
365
- });
366
- } catch (r) {
367
- r instanceof ee || l.open({
368
- title: a("inventory.recipe.create.error.title"),
369
- message: a("inventory.recipe.create.error.message"),
370
- type: "error"
371
- });
372
- } finally {
373
- t.value = !1;
374
- }
375
- }
376
- async function s() {
377
- t.value = !0;
378
- try {
379
- await p.updateRecipe(o.value), i.value = !1, l.open({
380
- title: a("common.success"),
381
- message: a("inventory.recipe.update.success", { name: o.value.name }),
382
- type: "success"
383
- });
384
- } catch (r) {
385
- r instanceof ee || l.open({
386
- title: a("inventory.recipe.update.error.title"),
387
- message: a("inventory.recipe.update.error.message"),
388
- type: "error"
389
- });
390
- } finally {
391
- t.value = !1;
392
- }
393
- }
394
- function w() {
395
- var r, g;
396
- (g = (r = m.value) == null ? void 0 : r.validateInputs) == null || g.call(r);
397
- }
398
- function C() {
399
- switch (d.mode) {
400
- case R.READ:
401
- return;
402
- case R.UPDATE:
403
- return s();
404
- case R.CREATE:
405
- return u();
406
- }
407
- }
408
- return (r, g) => {
409
- const k = F("FmButton"), e = F("FmSideSheet");
410
- return h(), M(e, {
411
- "model-value": v(i),
412
- "onUpdate:modelValue": g[3] || (g[3] = (n) => Z(i) ? i.value = n : null),
413
- header: c.value,
414
- "close-button": "",
415
- "dismiss-away": "",
416
- "max-width": 500
417
- }, {
418
- "side-sheet-footer": I(() => [
419
- b("div", qe, [
420
- y(k, {
421
- loading: t.value,
422
- label: f.value,
423
- onClick: w
424
- }, null, 8, ["loading", "label"]),
425
- y(k, {
426
- disabled: t.value,
427
- label: v(a)("common.close"),
428
- variant: "tertiary",
429
- onClick: g[2] || (g[2] = (n) => i.value = !1)
430
- }, null, 8, ["disabled", "label"])
431
- ])
432
- ]),
433
- default: I(() => [
434
- y(He, {
435
- class: "w-full",
436
- ref_key: "hasValidationExpose",
437
- ref: m,
438
- modelValue: v(o),
439
- "onUpdate:modelValue": g[0] || (g[0] = (n) => Z(o) ? o.value = n : null),
440
- mode: r.mode,
441
- disabled: t.value,
442
- "onClick:submit": g[1] || (g[1] = (n) => C())
443
- }, null, 8, ["modelValue", "mode", "disabled"])
444
- ]),
445
- _: 1
446
- }, 8, ["model-value", "header"]);
447
- };
448
- }
449
- });
450
- function Ge() {
451
- const _ = P(), d = _.recipes, p = _.recipeById, l = _.skuById, a = d.flatMap((c, f) => {
452
- var m;
453
- if ((m = c.contains) != null && m.length) {
454
- const t = c.contains.filter((s) => s.type === "RECIPE"), u = c.contains.filter((s) => s.type === "SKU");
455
- return [
456
- ...f === 0 ? [] : [["", "", "", "", "", ""]],
457
- ...t.map(
458
- (s, w) => {
459
- var C;
460
- return [
461
- w === 0 ? c.name : "",
462
- "RECIPE",
463
- "",
464
- (C = p[s.id]) == null ? void 0 : C.name,
465
- q(s.amount),
466
- "UNIT"
467
- ];
468
- }
469
- ),
470
- ...u.map(
471
- (s, w) => {
472
- var C, r, g, k;
473
- return [
474
- !t.length && w === 0 ? c.name : "",
475
- "INGREDIENT",
476
- (C = l[s.id]) == null ? void 0 : C.code,
477
- (r = l[s.id]) == null ? void 0 : r.name,
478
- q(s.amount),
479
- s.measurement ? s.measurement.abbrev : (k = (g = l[s.id]) == null ? void 0 : g.unit) == null ? void 0 : k.abbrev
480
- ];
481
- }
482
- )
483
- ];
484
- }
485
- return [
486
- ...f === 0 ? [] : [["", "", "", "", "", ""]],
487
- [c.name, "No bindings", "", "", "", ""]
488
- ];
489
- }), o = Fe(a, ["Name", "Type", "Code", "Item", "Amount", "Unit"]);
490
- ke(o, `RECIPE_${we(/* @__PURE__ */ new Date(), "-", "-")}.xlsx`);
491
- }
492
- const Je = { class: "flex flex-col py-8" }, Oe = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, Qe = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, rt = /* @__PURE__ */ N({
493
- __name: "RecipeView",
494
- setup(_) {
495
- const d = P(), p = V(() => d.recipes), l = Re(), { createRecipe: a, updateRecipe: i } = K(), { recipeDialogProps: o, recipeViewLoading: c } = Se(K()), { columnDefs: f, formatRowData: m } = Le(), t = V(() => m(p.value));
496
- function u(n) {
497
- n === "add" && a();
498
- }
499
- const s = x(""), w = V(() => c.value), { breakpoints: C } = Ce(), r = V(() => C.value.xs || C.value.sm), g = V(() => r.value ? 10 : 20), k = $e(), { t: e } = Y();
500
- return (n, S) => {
501
- const j = F("FmTable");
502
- return h(), M(Ie, {
503
- title: v(e)("inventory.recipe.title"),
504
- actions: [
505
- {
506
- label: v(e)("inventory.recipe.create.title"),
507
- value: "add",
508
- isPrimary: !0,
509
- prependIcon: "add"
510
- }
511
- ],
512
- "onClick:action": u
513
- }, {
514
- default: I(() => [
515
- b("div", {
516
- class: ue([
517
- "flex flex-col gap-8 max-h-full",
518
- {
519
- "p-0": r.value,
520
- "px-24 ": !r.value
521
- }
522
- ])
523
- }, [
524
- y(Pe, {
525
- searchable: "",
526
- search: s.value,
527
- "onUpdate:search": S[0] || (S[0] = (A) => s.value = A),
528
- actions: [{ icon: "ios_share", onClick: v(Ge) }]
529
- }, null, 8, ["search", "actions"]),
530
- (h(), M(j, {
531
- style: de(v(k).tableHeight),
532
- "column-defs": v(f),
533
- "row-data": t.value,
534
- "search-value": s.value,
535
- loading: !v(l)._currentLocation || w.value,
536
- onRowClick: S[1] || (S[1] = (A) => v(i)(A.original.original)),
537
- key: p.value.length,
538
- "page-size": g.value
539
- }, {
540
- "list-row": I((A) => [
541
- y(Ae, {
542
- row: A,
543
- onRowClick: (D) => v(i)(D.original)
544
- }, {
545
- default: I((D) => {
546
- var U, B, E, T, J, O, Q, W, L, X;
547
- return [
548
- b("div", Je, [
549
- b("div", Oe, [
550
- y(v(oe), {
551
- render: (E = (B = (U = D.recipe) == null ? void 0 : U.column) == null ? void 0 : B.columnDef) == null ? void 0 : E.cell,
552
- props: (J = (T = D.recipe) == null ? void 0 : T.getContext) == null ? void 0 : J.call(T)
553
- }, null, 8, ["render", "props"])
554
- ]),
555
- b("div", Qe, [
556
- y(v(oe), {
557
- render: (W = (Q = (O = D.ingredients) == null ? void 0 : O.column) == null ? void 0 : Q.columnDef) == null ? void 0 : W.cell,
558
- props: (X = (L = D.ingredients) == null ? void 0 : L.getContext) == null ? void 0 : X.call(L)
559
- }, null, 8, ["render", "props"])
560
- ])
561
- ])
562
- ];
563
- }),
564
- _: 2
565
- }, 1032, ["row", "onRowClick"])
566
- ]),
567
- _: 1
568
- }, 8, ["style", "column-defs", "row-data", "search-value", "loading", "page-size"]))
569
- ], 2),
570
- (h(), M(me, { to: "body" }, [
571
- y(Ke, pe(fe(v(o))), null, 16)
572
- ]))
573
- ]),
574
- _: 1
575
- }, 8, ["title", "actions"]);
576
- };
577
- }
578
- });
579
- export {
580
- rt as default
581
- };