@feedmepos/mf-inventory-portal 0.0.23-dev.9 → 0.0.24-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 (140) hide show
  1. package/dist/App-D3sNH2MR.js +276 -0
  2. package/dist/{ApprovalView-e85YmdZN.js → ApprovalView-DHnRx0hJ.js} +17 -20
  3. package/dist/{BindingsDialog-giBUD0IH.js → BindingsDialog-oTeg2Dai.js} +6 -6
  4. package/dist/{BindingsPicker-CC4MmPbF.js → BindingsPicker-CWdjmMJ3.js} +8 -9
  5. package/dist/{BindingsTable-WphZdzrA.js → BindingsTable-bKLR1OKX.js} +18 -22
  6. package/dist/ClosingDraftView-CIQVz7lY.js +1225 -0
  7. package/dist/{ClosingTemplateView-1lzoDyet.js → ClosingTemplateView-D5pLzQwU.js} +259 -274
  8. package/dist/FmCustomAttribute.vue_vue_type_script_setup_true_lang-ClLDcchC.js +142 -0
  9. package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-Cv-vvzr5.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-B_c6Vn6P.js} +23 -24
  10. package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-DIFQcrc0.js → FmUnitInput.vue_vue_type_script_setup_true_lang-DhpHOaRH.js} +50 -51
  11. package/dist/{IngredientGroupView-UegBM_JK.js → IngredientGroupView-4C437mso.js} +63 -70
  12. package/dist/IngredientsView-DoiGgjre.js +1706 -0
  13. package/dist/{IntegrationView-FYNNzKia.js → IntegrationView-8ZKE7MAM.js} +123 -126
  14. package/dist/{InventoryBindingForm-DsHv_IHG.js → InventoryBindingForm-CcnfliYQ.js} +1 -1
  15. package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-BURSXafS.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-B_J-6C9x.js} +116 -108
  16. package/dist/{InventoryBindingSummary-BLb4MRPZ.js → InventoryBindingSummary-CRdHCzNE.js} +1 -1
  17. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-BG78-DHs.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-B2-TypU0.js} +1 -1
  18. package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-CqID5_7v.js → PremiumBadge.vue_vue_type_script_setup_true_lang-BuQde75S.js} +20 -21
  19. package/dist/PublishView-t5gjGmK_.js +192 -0
  20. package/dist/{PurchaseOrderPrintPreview-BBMU3teq.js → PurchaseOrderPrintPreview-6i53Y-v1.js} +13 -14
  21. package/dist/ReceiveRequestView-uOeSh0Mr.js +1866 -0
  22. package/dist/RecipeView-BTWywckD.js +609 -0
  23. package/dist/StockView-DN2xk8ei.js +1817 -0
  24. package/dist/{SupplierView-B2aObtwK.js → SupplierView-l0XUg3J4.js} +185 -196
  25. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-CWMn6fFf.js +1327 -0
  26. package/dist/TransferTemplateView-wDKXpCWZ.js +1263 -0
  27. package/dist/UnitView-CUI-k-tS.js +648 -0
  28. package/dist/{WarehouseView-G8pej6Y2.js → WarehouseView-WsI_eG5r.js} +190 -197
  29. package/dist/api/adjustment-template.d.ts +25 -0
  30. package/dist/api/bill.d.ts +240 -84
  31. package/dist/api/inventory.d.ts +19 -6
  32. package/dist/api/netsuite.d.ts +3 -3
  33. package/dist/app-DntcWR3_.js +85558 -0
  34. package/dist/app.d.ts +85 -0
  35. package/dist/app.js +2 -2
  36. package/dist/components/FmCustomAttribute.vue.d.ts +23 -0
  37. package/dist/components/FmLockableField.vue.d.ts +37 -0
  38. package/dist/components/FmMultiselectDialogProps.d.ts +1 -0
  39. package/dist/components/inventory-binding/InventoryBinding.vue.d.ts +3 -1
  40. package/dist/components/shell/inventory/binding-ui.vue.d.ts +3 -1
  41. package/dist/composable/defineDeepModel.d.ts +1 -1
  42. package/dist/{decimal-DC07xoJW.js → decimal-DTCTnMwO.js} +1 -1
  43. package/dist/format-unit-display-Hy48Iw5j.js +1215 -0
  44. package/dist/index-Bv9RYyTZ.js +29202 -0
  45. package/dist/{StockView-C5btudss.js → index-D4yJP9I2.js} +2220 -3863
  46. package/dist/layout/SingleColumnLayout.vue.d.ts +1 -0
  47. package/dist/router/name.d.ts +2 -0
  48. package/dist/stock-BsdmfT-b.js +125 -0
  49. package/dist/stores/feature.d.ts +41 -1
  50. package/dist/stores/integration/netsuite.d.ts +3 -2
  51. package/dist/stores/inventory.d.ts +20 -8
  52. package/dist/stores/location.d.ts +29 -1
  53. package/dist/stores/supplier.d.ts +1 -1
  54. package/dist/style.css +1 -1
  55. package/dist/supplier-CXhkgC4M.js +77 -0
  56. package/dist/tsconfig.app.tsbuildinfo +1 -1
  57. package/dist/{use-inventory-binding-dialog-B0G2XYSw.js → use-inventory-binding-dialog-DPMJmBCr.js} +10 -11
  58. package/dist/views/adjustment-template/import/AdjustmentTemplateImport.vue.d.ts +2 -0
  59. package/dist/views/adjustment-template/import/AdjustmentTemplateImportItem.vue.d.ts +18 -0
  60. package/dist/views/adjustment-template/import/export.d.ts +60 -0
  61. package/dist/views/adjustment-template/wastage-template/WastageTemplateDetails.vue.d.ts +2 -0
  62. package/dist/views/adjustment-template/wastage-template/WastageTemplateDialog.vue.d.ts +22 -0
  63. package/dist/views/adjustment-template/wastage-template/WastageTemplatePublish.vue.d.ts +6 -0
  64. package/dist/views/adjustment-template/wastage-template/WastageTemplateReason.vue.d.ts +18 -0
  65. package/dist/views/adjustment-template/wastage-template/WastageTemplateView.vue.d.ts +2 -0
  66. package/dist/views/adjustment-template/wastage-template/actions.d.ts +1377 -0
  67. package/dist/views/adjustment-template/wastage-template/form/WastageTemplateForm.vue.d.ts +16 -0
  68. package/dist/views/adjustment-template/wastage-template/form/WastageTemplateItemTable.vue.d.ts +35 -0
  69. package/dist/views/adjustment-template/wastage-template/form/useAdjustmentTemplateItems.d.ts +20 -0
  70. package/dist/views/adjustment-template/wastage-template/props.d.ts +36 -0
  71. package/dist/views/adjustment-template/wastage-template/table.d.ts +1351 -0
  72. package/dist/views/closing-draft/components/closing-draft-dialog/ClosingDraftDialog.vue.d.ts +198 -12
  73. package/dist/views/closing-draft/composables/use-closing-draft-actions.d.ts +7 -4
  74. package/dist/views/closing-draft/composables/use-closing-draft-table.d.ts +1559 -467
  75. package/dist/views/closing-draft/helpers/export-draft.helper.d.ts +19 -0
  76. package/dist/views/closing-draft/helpers/get-calculated-total.helper.d.ts +4 -0
  77. package/dist/views/closing-template/components/closing-template-form/composables/use-closing-template-items.d.ts +2 -1
  78. package/dist/views/closing-template/composables/use-closing-template-actions.d.ts +72 -12
  79. package/dist/views/closing-template/composables/use-closing-template-table.d.ts +73 -13
  80. package/dist/views/ingredient-group/composables/use-ingredient-group-table.d.ts +6 -3
  81. package/dist/views/ingredients/components/convert/ConvertFormProps.d.ts +1 -0
  82. package/dist/views/ingredients/components/ingredient-form/IngredientForm.vue.d.ts +4 -2
  83. package/dist/views/ingredients/components/inventory-binding/InventoryBindingForm.vue.d.ts +1 -0
  84. package/dist/views/ingredients/composables/use-ingredient-table.d.ts +2 -1
  85. package/dist/views/publish/PublishView.vue.d.ts +2 -0
  86. package/dist/views/receive-request/components/netsuite/NetSuiteInfo.vue.d.ts +12 -0
  87. package/dist/views/receive-request/components/netsuite/NetSuiteProps.d.ts +13 -0
  88. package/dist/views/receive-request/components/netsuite/NetSuiteSync.vue.d.ts +12 -0
  89. package/dist/views/receive-request/components/transfer-form/NetSuiteField.vue.d.ts +13 -0
  90. package/dist/views/receive-request/components/transfer-form/SparkIcon.vue.d.ts +1 -1
  91. package/dist/views/receive-request/components/transfer-form/TransferForm.vue.d.ts +86 -17
  92. package/dist/views/receive-request/components/transfer-form/components/ForecastStock.vue.d.ts +4 -2
  93. package/dist/views/receive-request/components/transfer-form/composables/use-transfer-items.d.ts +2 -1
  94. package/dist/views/receive-request/composables/use-receive-request-form.d.ts +126 -24
  95. package/dist/views/receive-request/composables/use-receive-request-table.d.ts +126 -24
  96. package/dist/views/recipe/components/recipe-form/RecipeForm.vue.d.ts +2 -0
  97. package/dist/views/stock/components/StockRecordCard.vue.d.ts +120 -42
  98. package/dist/views/stock/components/dialog/AdjustedItemForm.vue.d.ts +6 -4
  99. package/dist/views/stock/helper/compute-summary-total.d.ts +2 -2
  100. package/dist/views/transfer-template/components/transfer-template-form/composables/use-template-enabled-locations.d.ts +4 -0
  101. package/dist/views/transfer-template/components/transfer-template-form/composables/use-transfer-template-items.d.ts +2 -1
  102. package/dist/views/transfer-template/composables/use-transfer-template-actions.d.ts +72 -12
  103. package/dist/views/transfer-template/composables/use-transfer-template-table.d.ts +72 -12
  104. package/dist/views/transfer-template/helpers/import-export.helper.d.ts +2 -1
  105. package/dist/vue-i18n-ByVzHsI7.js +2365 -0
  106. package/package.json +5 -4
  107. package/dist/App-ByLgARNp.js +0 -259
  108. package/dist/ClosingDraftView-CQM1Sx45.js +0 -755
  109. package/dist/FmDroppableField-8RzKjEdL.js +0 -154
  110. package/dist/FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-BvkN-71q.js +0 -436
  111. package/dist/FmMultiselectDialog-DScMA6iG.js +0 -415
  112. package/dist/IngredientBindedItem.vue_vue_type_script_setup_true_lang-t4pim_k9.js +0 -51
  113. package/dist/IngredientsView-BfW-jZLM.js +0 -1666
  114. package/dist/ReceiveRequestView-vbANEzne.js +0 -4165
  115. package/dist/RecipeView-DW4DY0C0.js +0 -598
  116. package/dist/TableActionableRow.vue_vue_type_script_setup_true_lang-DlNJ6kRg.js +0 -135
  117. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-B2LOvVef.js +0 -1229
  118. package/dist/TransferTemplateView-BKumN_p6.js +0 -1262
  119. package/dist/UnitView-CHLucv9s.js +0 -648
  120. package/dist/_plugin-vue_export-helper-CHgC5LLL.js +0 -9
  121. package/dist/app-BXjk74IB.js +0 -33538
  122. package/dist/date2-CWAt9bRf.js +0 -117
  123. package/dist/dayjs.min-D3jPOnu6.js +0 -282
  124. package/dist/defineDeepModel-CiD4GtOw.js +0 -13
  125. package/dist/feature-6tcLMotY.js +0 -92
  126. package/dist/form-mode.enum-BKiNVH6A.js +0 -4
  127. package/dist/format-time-from-id-CYU5Z9Mt.js +0 -15
  128. package/dist/format-unit-display-CY-0bznr.js +0 -1217
  129. package/dist/fuzzy-BMkhNYLR.js +0 -41
  130. package/dist/index-BXwQa14X.js +0 -45
  131. package/dist/index-CRLd5xyg.js +0 -22283
  132. package/dist/index-DqwAtOgI.js +0 -12087
  133. package/dist/netsuite-fYUUk_ss.js +0 -225
  134. package/dist/row-action.enum-7rGLGZ5v.js +0 -55
  135. package/dist/rules-BmRGm3yv.js +0 -203
  136. package/dist/stock-CEX0DP2B.js +0 -111
  137. package/dist/supplier-CdJmZr7w.js +0 -77
  138. package/dist/use-template-enabled-locations-2-xbPJWHCs.js +0 -86
  139. package/dist/xlsx-CTOKp7SQ.js +0 -24004
  140. package/dist/xlsx.util-D5NFSfDg.js +0 -78
@@ -1,598 +0,0 @@
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-BXjk74IB.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 } from "./form-mode.enum-BKiNVH6A.js";
6
- import { _ as le } from "./IngredientBindedItem.vue_vue_type_script_setup_true_lang-t4pim_k9.js";
7
- import { defineStore as he, storeToRefs as xe } from "pinia";
8
- import { D as oe, R as L } from "./row-action.enum-7rGLGZ5v.js";
9
- import { c as Ce, _ as Ee, F as ae } from "./TableActionableRow.vue_vue_type_script_setup_true_lang-DlNJ6kRg.js";
10
- import { a as z, R as Fe, U as Se, A as Ve } from "./rules-BmRGm3yv.js";
11
- import { useI18n as H } from "@feedmepos/mf-common";
12
- import { u as ke, _ as De, a as Ie } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-BvkN-71q.js";
13
- import { _ as $e } from "./InventoryBindingForm.vue_vue_type_script_setup_true_lang-BURSXafS.js";
14
- import { t as Ae, d as Pe } from "./xlsx.util-D5NFSfDg.js";
15
- import { f as Be } from "./date2-CWAt9bRf.js";
16
- const Te = {
17
- key: 0,
18
- class: "flex flex-col items-center w-full h-full gap-24"
19
- }, Me = { key: 1 }, Ue = { key: 0 }, Ne = /* @__PURE__ */ Y({
20
- __name: "DeleteDialog",
21
- props: {
22
- type: {},
23
- data: {},
24
- message: {},
25
- bindedItems: {}
26
- },
27
- setup(R) {
28
- const p = R, v = E(p.bindedItems || []), r = E(!1);
29
- re(() => {
30
- l();
31
- });
32
- async function l() {
33
- var c, i;
34
- !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);
35
- }
36
- return (c, i) => {
37
- const f = S("FmSpacer"), d = S("FmCircularProgress");
38
- return C(), A(ie, null, [
39
- w("p", null, ce(c.message), 1),
40
- r.value ? (C(), A("div", Te, [
41
- g(f),
42
- w("div", null, [
43
- g(d, { size: "xl" })
44
- ]),
45
- i[0] || (i[0] = w("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary pl-8" }, "Loading...", -1)),
46
- g(f)
47
- ])) : (C(), A("div", Me, [
48
- i[2] || (i[2] = w("br", null, null, -1)),
49
- v.value.length > 0 ? (C(), A("div", Ue, [
50
- i[1] || (i[1] = w("p", { class: "fm-typo-en-body-lg-600" }, "Affected menu items:", -1)),
51
- g(le, {
52
- name: "Menu",
53
- bindings: v.value
54
- }, null, 8, ["bindings"])
55
- ])) : j("", !0)
56
- ]))
57
- ], 64);
58
- };
59
- }
60
- }), q = he("recipeForm", function() {
61
- const p = be(), v = se(), r = I(), l = E(!1), c = E();
62
- function i() {
63
- const t = {
64
- recipe: {},
65
- mode: x.CREATE,
66
- show: !0,
67
- "onUpdate:show"(a) {
68
- c.value.show = a;
69
- }
70
- };
71
- c.value = t;
72
- }
73
- async function f(t) {
74
- const a = {
75
- recipe: G(t),
76
- mode: x.UPDATE,
77
- show: !0,
78
- "onUpdate:show"(e) {
79
- c.value.show = e;
80
- }
81
- };
82
- c.value = a;
83
- }
84
- async function d(t) {
85
- l.value = !0;
86
- try {
87
- await r.deleteRecipe(t), v.open({
88
- title: "Success",
89
- message: `Deleted ${t.name}`,
90
- type: "success"
91
- });
92
- } catch (a) {
93
- a instanceof ye && we(a) ? p.open({
94
- title: "Cannot delete recipe",
95
- contentComponent: Re,
96
- contentComponentProps: {
97
- subject: (t == null ? void 0 : t.name) ?? "",
98
- items: a.errorResponse.message
99
- },
100
- secondaryActions: {
101
- text: "Close",
102
- close: !0
103
- }
104
- }) : console.log("unable to delete recipe", a), v.open({
105
- title: `Cannot delete ${t == null ? void 0 : t.name}`,
106
- message: "Please try again.",
107
- type: "error"
108
- }), console.error("failed to delete recipe", a);
109
- } finally {
110
- l.value = !1;
111
- }
112
- }
113
- function u(t) {
114
- p.open({
115
- title: `Delete ${(t == null ? void 0 : t.name) ?? "recipe"}?`,
116
- closeButton: !1,
117
- primaryActions: {
118
- text: "Delete",
119
- close: !0,
120
- variant: "destructive"
121
- },
122
- secondaryActions: {
123
- text: "Cancel",
124
- close: !0
125
- },
126
- contentComponent: Ne,
127
- contentComponentProps: {
128
- type: "menu",
129
- data: t,
130
- message: "You may not be able to delete this recipe if it is linked in any of the inventory modules."
131
- }
132
- }).onPrimary(() => d(t));
133
- }
134
- return {
135
- createRecipe: i,
136
- updateRecipe: f,
137
- deleteRecipe: u,
138
- recipeDialogProps: c,
139
- recipeViewLoading: l
140
- };
141
- });
142
- function Le() {
143
- const { updateRecipe: R, deleteRecipe: p } = q(), v = I(), { t: r } = H();
144
- async function l(d, u) {
145
- const t = G(u);
146
- if (d === L.Edit) {
147
- await R(t);
148
- return;
149
- }
150
- if (d === L.Delete) {
151
- await p(t);
152
- return;
153
- }
154
- }
155
- function c(d, u) {
156
- const t = d.filter((e) => e.type === ee.enum.SKU), a = d.filter((e) => e.type === ee.enum.RECIPE);
157
- return [
158
- ...t.map((e) => ({ ...e, recipeIds: [...u] })),
159
- ...a.filter((e) => v.recipeById[e.id] && !u.has(e.id)).flatMap(
160
- (e) => c(v.recipeById[e.id].contains, /* @__PURE__ */ new Set([...u, e.id]))
161
- )
162
- ];
163
- }
164
- const i = [
165
- {
166
- accessorKey: "recipe",
167
- header: () => r("inventory.recipe.name"),
168
- size: 400
169
- },
170
- {
171
- accessorKey: "ingredients",
172
- header: () => r("inventory.recipe.ingredients"),
173
- size: "auto"
174
- },
175
- {
176
- id: "action",
177
- header: "",
178
- cell(d) {
179
- return Ce(
180
- [oe[L.Edit], oe[L.Delete]],
181
- (u) => {
182
- l(u, d.row.original.original);
183
- }
184
- );
185
- },
186
- enableSorting: !1,
187
- size: 40,
188
- meta: {
189
- cellClass: "",
190
- headerClass: ""
191
- }
192
- }
193
- ];
194
- function f(d) {
195
- const u = I();
196
- return d.map((t) => ({
197
- recipe: t.name,
198
- ingredients: c(t.contains, /* @__PURE__ */ new Set([t._id])).map((a) => {
199
- var b, _, s, m, h;
200
- const e = u.skuById[a.id];
201
- 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;
202
- }).filter((a) => a).join(", "),
203
- original: t
204
- }));
205
- }
206
- return { columnDefs: i, formatRowData: f };
207
- }
208
- const ze = { class: "flex flex-col gap-40" }, Ye = {
209
- key: 0,
210
- 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"
211
- }, He = {
212
- key: 0,
213
- class: "flex flex-col items-center w-full h-full gap-24"
214
- }, Ke = { key: 1 }, je = /* @__PURE__ */ Y({
215
- __name: "RecipeForm",
216
- props: {
217
- mode: {},
218
- modelValue: {},
219
- disabled: { type: Boolean }
220
- },
221
- emits: ["update:modelValue", "click:submit"],
222
- setup(R, { expose: p, emit: v }) {
223
- var h;
224
- const r = R, l = v, { t: c } = H(), i = V({
225
- get() {
226
- var n;
227
- return ((n = r.modelValue) == null ? void 0 : n.name) ?? "";
228
- },
229
- set(n) {
230
- const o = r.modelValue ?? {};
231
- o.name = n, l("update:modelValue", o);
232
- }
233
- }), f = V({
234
- get() {
235
- var n;
236
- return ((n = r.modelValue) == null ? void 0 : n.contains) ?? [];
237
- },
238
- set(n) {
239
- const o = r.modelValue ?? {};
240
- o.contains = n, l("update:modelValue", o);
241
- }
242
- });
243
- function d() {
244
- l("click:submit");
245
- }
246
- const u = E();
247
- p({
248
- validateInputs: () => {
249
- var n, o;
250
- (o = (n = u.value) == null ? void 0 : n.validateInputs) == null || o.call(n);
251
- },
252
- resetInputsValidation: () => {
253
- var n, o;
254
- (o = (n = u.value) == null ? void 0 : n.resetInputsValidation) == null || o.call(n);
255
- },
256
- resetInputs: () => {
257
- var n, o;
258
- (o = (n = u.value) == null ? void 0 : n.resetInputs) == null || o.call(n);
259
- }
260
- });
261
- const t = I(), a = E([]), e = E(!1), b = E(!1);
262
- ue(e, async (n) => {
263
- _(n);
264
- });
265
- async function _(n) {
266
- var o, k;
267
- 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);
268
- }
269
- const s = V(
270
- () => t.recipes.map((n) => ({ label: n.name, value: n.name }))
271
- ), m = E((h = r.modelValue) == null ? void 0 : h.name);
272
- return (n, o) => {
273
- const k = S("FmTextField"), K = S("FmCard"), $ = S("FmSwitch"), D = S("FmSpacer"), M = S("FmCircularProgress"), U = S("FmForm");
274
- return C(), T(U, {
275
- ref_key: "formRef",
276
- ref: u,
277
- onValidationSuccess: d
278
- }, {
279
- default: P(() => [
280
- w("div", ze, [
281
- g(k, {
282
- disabled: n.disabled,
283
- label: y(c)("inventory.recipe.name"),
284
- "model-value": i.value,
285
- "onUpdate:modelValue": o[0] || (o[0] = (F) => i.value = F),
286
- rules: [
287
- y(Fe)(),
288
- y(Se)(s.value, m.value, (F) => `[${F.value}] already exists`)
289
- ],
290
- "label-mark": "required"
291
- }, null, 8, ["disabled", "label", "model-value", "rules"]),
292
- g(K, {
293
- variant: "outlined",
294
- class: "p-16"
295
- }, {
296
- default: P(() => {
297
- var F;
298
- return [
299
- g($e, {
300
- id: (F = n.modelValue) == null ? void 0 : F._id,
301
- disabled: n.disabled,
302
- "model-value": f.value,
303
- "onUpdate:modelValue": o[1] || (o[1] = (B) => f.value = B),
304
- rules: [y(Ve)(1)]
305
- }, null, 8, ["id", "disabled", "model-value", "rules"])
306
- ];
307
- }),
308
- _: 1
309
- })
310
- ]),
311
- n.mode !== y(x).CREATE ? (C(), A("div", Ye, [
312
- w("div", null, [
313
- g($, {
314
- label: "Show binded items",
315
- modelValue: e.value,
316
- "onUpdate:modelValue": o[2] || (o[2] = (F) => e.value = F),
317
- "label-placement": "right",
318
- disabled: b.value
319
- }, null, 8, ["modelValue", "disabled"])
320
- ]),
321
- b.value ? (C(), A("div", He, [
322
- g(D),
323
- w("div", null, [
324
- g(M, { size: "xl" })
325
- ]),
326
- o[3] || (o[3] = w("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary pl-8" }, "Loading...", -1)),
327
- g(D)
328
- ])) : (C(), A("div", Ke, [
329
- e.value && a.value.length ? (C(), T(le, {
330
- key: 0,
331
- name: "Menu",
332
- bindings: a.value
333
- }, null, 8, ["bindings"])) : j("", !0)
334
- ]))
335
- ])) : j("", !0)
336
- ]),
337
- _: 1
338
- }, 512);
339
- };
340
- }
341
- }), qe = { class: "flex gap-4" }, Ge = /* @__PURE__ */ Y({
342
- __name: "RecipeDialog",
343
- props: {
344
- show: { type: Boolean },
345
- recipe: {},
346
- mode: { default: x.READ }
347
- },
348
- emits: ["update:show"],
349
- setup(R) {
350
- const p = R, v = I(), r = se(), { t: l } = H(), c = ne(p, "show"), i = ne(p, "recipe"), f = V(() => {
351
- switch (p.mode) {
352
- case x.READ:
353
- return "";
354
- case x.UPDATE:
355
- return l("inventory.recipe.update.title");
356
- case x.CREATE:
357
- return l("inventory.recipe.create.title");
358
- }
359
- return "";
360
- }), d = V(() => {
361
- switch (p.mode) {
362
- case x.READ:
363
- return "";
364
- case x.UPDATE:
365
- return l("common.save");
366
- case x.CREATE:
367
- return l("common.add");
368
- }
369
- return "";
370
- }), u = E(), t = E(!1);
371
- async function a() {
372
- t.value = !0;
373
- try {
374
- const s = G(i.value);
375
- s.precision ?? (s.precision = 0), s.measurements ?? (s.measurements = []), await v.createRecipe(s), c.value = !1, r.open({
376
- title: l("inventory.common.success"),
377
- message: l("inventory.recipe.create.success", { name: i.value.name }),
378
- type: "success"
379
- });
380
- } catch (s) {
381
- s instanceof te || r.open({
382
- title: l("inventory.recipe.create.error.title"),
383
- message: l("inventory.recipe.create.error.message"),
384
- type: "error"
385
- });
386
- } finally {
387
- t.value = !1;
388
- }
389
- }
390
- async function e() {
391
- t.value = !0;
392
- try {
393
- await v.updateRecipe(i.value), c.value = !1, r.open({
394
- title: l("inventory.common.success"),
395
- message: l("inventory.recipe.update.success", { name: i.value.name }),
396
- type: "success"
397
- });
398
- } catch (s) {
399
- s instanceof te || r.open({
400
- title: l("inventory.recipe.update.error.title"),
401
- message: l("inventory.recipe.update.error.message"),
402
- type: "error"
403
- });
404
- } finally {
405
- t.value = !1;
406
- }
407
- }
408
- function b() {
409
- var s, m;
410
- (m = (s = u.value) == null ? void 0 : s.validateInputs) == null || m.call(s);
411
- }
412
- function _() {
413
- switch (p.mode) {
414
- case x.READ:
415
- return;
416
- case x.UPDATE:
417
- return e();
418
- case x.CREATE:
419
- return a();
420
- }
421
- }
422
- return (s, m) => {
423
- const h = S("FmButton"), n = S("FmSideSheet");
424
- return C(), T(n, {
425
- "model-value": y(c),
426
- "onUpdate:modelValue": m[3] || (m[3] = (o) => Z(c) ? c.value = o : null),
427
- header: f.value,
428
- "close-button": "",
429
- "dismiss-away": "",
430
- "max-width": 500
431
- }, {
432
- "side-sheet-footer": P(() => [
433
- w("div", qe, [
434
- g(h, {
435
- loading: t.value,
436
- label: d.value,
437
- onClick: b
438
- }, null, 8, ["loading", "label"]),
439
- g(h, {
440
- disabled: t.value,
441
- label: y(l)("common.close"),
442
- variant: "tertiary",
443
- onClick: m[2] || (m[2] = (o) => c.value = !1)
444
- }, null, 8, ["disabled", "label"])
445
- ])
446
- ]),
447
- default: P(() => [
448
- g(je, {
449
- class: "w-full",
450
- ref_key: "hasValidationExpose",
451
- ref: u,
452
- modelValue: y(i),
453
- "onUpdate:modelValue": m[0] || (m[0] = (o) => Z(i) ? i.value = o : null),
454
- mode: s.mode,
455
- disabled: t.value,
456
- "onClick:submit": m[1] || (m[1] = (o) => _())
457
- }, null, 8, ["modelValue", "mode", "disabled"])
458
- ]),
459
- _: 1
460
- }, 8, ["model-value", "header"]);
461
- };
462
- }
463
- });
464
- function Oe() {
465
- const R = I(), p = R.recipes, v = R.recipeById, r = R.skuById, l = p.flatMap((f, d) => {
466
- var u;
467
- if ((u = f.contains) != null && u.length) {
468
- const t = f.contains.filter((e) => e.type === "RECIPE"), a = f.contains.filter((e) => e.type === "SKU");
469
- return [
470
- ...d === 0 ? [] : [["", "", "", "", "", ""]],
471
- ...t.map(
472
- (e, b) => {
473
- var _;
474
- return [
475
- b === 0 ? f.name : "",
476
- "RECIPE",
477
- "",
478
- (_ = v[e.id]) == null ? void 0 : _.name,
479
- z(e.amount),
480
- "UNIT"
481
- ];
482
- }
483
- ),
484
- ...a.map(
485
- (e, b) => {
486
- var _, s, m, h;
487
- return [
488
- !t.length && b === 0 ? f.name : "",
489
- "INGREDIENT",
490
- (_ = r[e.id]) == null ? void 0 : _.code,
491
- (s = r[e.id]) == null ? void 0 : s.name,
492
- z(e.amount),
493
- e.measurement ? e.measurement.abbrev : (h = (m = r[e.id]) == null ? void 0 : m.unit) == null ? void 0 : h.abbrev
494
- ];
495
- }
496
- )
497
- ];
498
- }
499
- return [
500
- ...d === 0 ? [] : [["", "", "", "", "", ""]],
501
- [f.name, "No bindings", "", "", "", ""]
502
- ];
503
- }), i = Ae(l, ["Name", "Type", "Code", "Item", "Amount", "Unit"]);
504
- Pe(i, `RECIPE_${Be(/* @__PURE__ */ new Date(), "-", "-")}.xlsx`);
505
- }
506
- 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" }, pt = /* @__PURE__ */ Y({
507
- __name: "RecipeView",
508
- setup(R) {
509
- 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));
510
- function a(o) {
511
- if (o === "add")
512
- return l();
513
- if (o === "export")
514
- return Oe();
515
- }
516
- 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();
517
- return (o, k) => {
518
- const K = S("FmTable");
519
- return C(), T(De, {
520
- title: y(n)("inventory.recipe.title"),
521
- actions: [
522
- {
523
- label: y(n)("inventory.recipe.create.title"),
524
- value: "add",
525
- isPrimary: !0,
526
- prependIcon: "add"
527
- },
528
- { label: y(n)("common.export"), value: "export", isPrimary: !1 }
529
- ],
530
- "onClick:action": a
531
- }, {
532
- default: P(() => [
533
- w("div", {
534
- class: de([
535
- "flex flex-col gap-8 max-h-full",
536
- {
537
- "p-0": s.value,
538
- "px-24 ": !s.value
539
- }
540
- ])
541
- }, [
542
- g(Ie, {
543
- searchable: "",
544
- search: e.value,
545
- "onUpdate:search": k[0] || (k[0] = ($) => e.value = $)
546
- }, null, 8, ["search"]),
547
- (C(), T(K, {
548
- style: me(y(h).tableHeight),
549
- "column-defs": y(d),
550
- "row-data": t.value,
551
- "search-value": e.value,
552
- loading: !y(r)._currentLocation || b.value,
553
- onRowClick: k[1] || (k[1] = ($) => y(c)($.original.original)),
554
- key: v.value.length,
555
- "page-size": m.value
556
- }, {
557
- "list-row": P(($) => [
558
- g(Ee, {
559
- row: $,
560
- onRowClick: (D) => y(c)(D.original)
561
- }, {
562
- default: P((D) => {
563
- var M, U, F, B, O, J, Q, W, N, X;
564
- return [
565
- w("div", Je, [
566
- w("div", Qe, [
567
- g(y(ae), {
568
- render: (F = (U = (M = D.recipe) == null ? void 0 : M.column) == null ? void 0 : U.columnDef) == null ? void 0 : F.cell,
569
- props: (O = (B = D.recipe) == null ? void 0 : B.getContext) == null ? void 0 : O.call(B)
570
- }, null, 8, ["render", "props"])
571
- ]),
572
- w("div", We, [
573
- g(y(ae), {
574
- render: (W = (Q = (J = D.ingredients) == null ? void 0 : J.column) == null ? void 0 : Q.columnDef) == null ? void 0 : W.cell,
575
- props: (X = (N = D.ingredients) == null ? void 0 : N.getContext) == null ? void 0 : X.call(N)
576
- }, null, 8, ["render", "props"])
577
- ])
578
- ])
579
- ];
580
- }),
581
- _: 2
582
- }, 1032, ["row", "onRowClick"])
583
- ]),
584
- _: 1
585
- }, 8, ["style", "column-defs", "row-data", "search-value", "loading", "page-size"]))
586
- ], 2),
587
- (C(), T(pe, { to: "body" }, [
588
- g(Ge, fe(ve(y(i))), null, 16)
589
- ]))
590
- ]),
591
- _: 1
592
- }, 8, ["title", "actions"]);
593
- };
594
- }
595
- });
596
- export {
597
- pt as default
598
- };