@feedmepos/mf-inventory-portal 0.0.23-dev.4 → 0.0.23-dev.41

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 (136) hide show
  1. package/dist/{App-DReDvY0M.js → App-DW2K97Bb.js} +84 -72
  2. package/dist/{ApprovalView-BMZlYmRk.js → ApprovalView-BgSxdrwt.js} +25 -28
  3. package/dist/{BindingsDialog-Y2K4I7H7.js → BindingsDialog-CQtusdvp.js} +6 -6
  4. package/dist/{BindingsPicker-DKBq9c37.js → BindingsPicker-BnEjRAah.js} +8 -9
  5. package/dist/{BindingsTable-45v4SDfp.js → BindingsTable-DpTPAef_.js} +18 -22
  6. package/dist/ClosingDraftView-CXKYLCZS.js +1190 -0
  7. package/dist/{ClosingTemplateView-CKJVYSbj.js → ClosingTemplateView-CMTJHywt.js} +271 -285
  8. package/dist/FmCustomAttribute.vue_vue_type_script_setup_true_lang-zOmcCdDR.js +142 -0
  9. package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-CMEOp-0r.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-mAPA5_sB.js} +18 -19
  10. package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-C1DjyjyH.js → FmUnitInput.vue_vue_type_script_setup_true_lang-BjNpfucZ.js} +25 -26
  11. package/dist/{IngredientGroupView-BuP-HGeg.js → IngredientGroupView-CrEfiZvn.js} +63 -69
  12. package/dist/IngredientsView-BB8LQlU9.js +1707 -0
  13. package/dist/{IntegrationView-kYCaKG0o.js → IntegrationView-D2wTkDyX.js} +89 -92
  14. package/dist/{InventoryBindingForm-BXHq4h-n.js → InventoryBindingForm-DW7rJDc1.js} +1 -1
  15. package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-CVxJ_bV3.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-Ci8UI1eQ.js} +112 -104
  16. package/dist/{InventoryBindingSummary-Bjasfc_v.js → InventoryBindingSummary-B40KofiI.js} +1 -1
  17. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-DM0C4raP.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-DD7VT9MS.js} +1 -1
  18. package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-C3O3JebE.js → PremiumBadge.vue_vue_type_script_setup_true_lang-BGuXTfn6.js} +19 -20
  19. package/dist/{PurchaseOrderPrintPreview-CmjkfTTS.js → PurchaseOrderPrintPreview-DQmx28Be.js} +17 -18
  20. package/dist/ReceiveRequestView-CJknzKfd.js +4205 -0
  21. package/dist/RecipeView-D5oWQ9Yd.js +609 -0
  22. package/dist/StockView-U59PHCy2.js +1818 -0
  23. package/dist/{SupplierView-DAx7E7sR.js → SupplierView-CLjjpTNZ.js} +2325 -787
  24. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-DLDDXnyG.js +1327 -0
  25. package/dist/TransferTemplateView-CFoVrPIX.js +1264 -0
  26. package/dist/{UnitView-CQPGZ8-r.js → UnitView-CAopphN_.js} +228 -227
  27. package/dist/{WarehouseView-jy-RNCgy.js → WarehouseView-DUZku5U6.js} +100 -106
  28. package/dist/api/adjustment-template.d.ts +25 -0
  29. package/dist/api/bill.d.ts +240 -84
  30. package/dist/api/closing-draft.d.ts +6 -0
  31. package/dist/api/closing.d.ts +1 -0
  32. package/dist/api/inventory.d.ts +15 -6
  33. package/dist/api/netsuite.d.ts +3 -3
  34. package/dist/app-0klJzLit.js +84527 -0
  35. package/dist/app.d.ts +64 -0
  36. package/dist/app.js +2 -2
  37. package/dist/components/FmCustomAttribute.vue.d.ts +23 -0
  38. package/dist/components/FmLockableField.vue.d.ts +37 -0
  39. package/dist/components/FmMultiselectDialogProps.d.ts +1 -0
  40. package/dist/components/inventory-binding/InventoryBinding.vue.d.ts +3 -1
  41. package/dist/components/row-action.enum.d.ts +1 -0
  42. package/dist/components/shell/inventory/binding-ui.vue.d.ts +3 -1
  43. package/dist/composable/defineDeepModel.d.ts +1 -1
  44. package/dist/{decimal-BAc9M88Q.js → decimal-Cu4rlnvU.js} +1 -1
  45. package/dist/feature-C1wCaXKQ.js +946 -0
  46. package/dist/format-unit-display-CMa5UhY1.js +1215 -0
  47. package/dist/{StockView-D9no-mrA.js → index-BJaMpEVJ.js} +2242 -3986
  48. package/dist/index-HTBqkVVr.js +29202 -0
  49. package/dist/router/name.d.ts +2 -0
  50. package/dist/stock-CB4yNRMO.js +125 -0
  51. package/dist/stores/feature.d.ts +6 -0
  52. package/dist/stores/integration/netsuite.d.ts +70 -2
  53. package/dist/stores/inventory.d.ts +21 -12
  54. package/dist/stores/supplier.d.ts +1 -1
  55. package/dist/style.css +1 -1
  56. package/dist/{supplier-DJC0UZWv.js → supplier-biIIXGyr.js} +15 -15
  57. package/dist/tsconfig.app.tsbuildinfo +1 -1
  58. package/dist/{use-inventory-binding-dialog-PEQbFRvO.js → use-inventory-binding-dialog-BopoOOxB.js} +10 -11
  59. package/dist/views/adjustment-template/import/AdjustmentTemplateImport.vue.d.ts +2 -0
  60. package/dist/views/adjustment-template/import/AdjustmentTemplateImportItem.vue.d.ts +18 -0
  61. package/dist/views/adjustment-template/import/export.d.ts +60 -0
  62. package/dist/views/adjustment-template/wastage-template/WastageTemplateDetails.vue.d.ts +2 -0
  63. package/dist/views/adjustment-template/wastage-template/WastageTemplateDialog.vue.d.ts +22 -0
  64. package/dist/views/adjustment-template/wastage-template/WastageTemplatePublish.vue.d.ts +6 -0
  65. package/dist/views/adjustment-template/wastage-template/WastageTemplateReason.vue.d.ts +18 -0
  66. package/dist/views/adjustment-template/wastage-template/WastageTemplateView.vue.d.ts +2 -0
  67. package/dist/views/adjustment-template/wastage-template/actions.d.ts +1329 -0
  68. package/dist/views/adjustment-template/wastage-template/form/WastageTemplateForm.vue.d.ts +16 -0
  69. package/dist/views/adjustment-template/wastage-template/form/WastageTemplateItemTable.vue.d.ts +35 -0
  70. package/dist/views/adjustment-template/wastage-template/form/useAdjustmentTemplateItems.d.ts +20 -0
  71. package/dist/views/adjustment-template/wastage-template/props.d.ts +36 -0
  72. package/dist/views/adjustment-template/wastage-template/table.d.ts +1303 -0
  73. package/dist/views/closing-draft/ClosingDraftView.vue.d.ts +2 -0
  74. package/dist/views/closing-draft/components/closing-draft-action/ClosingDraftAction.vue.d.ts +22 -0
  75. package/dist/views/closing-draft/components/closing-draft-dialog/ClosingDraftDialog.vue.d.ts +625 -0
  76. package/dist/views/closing-draft/composables/use-closing-draft-actions.d.ts +25 -0
  77. package/dist/views/closing-draft/composables/use-closing-draft-table.d.ts +3645 -0
  78. package/dist/views/closing-draft/helpers/draft-status-to-class-name.helper.d.ts +1 -0
  79. package/dist/views/closing-draft/helpers/export-draft.helper.d.ts +19 -0
  80. package/dist/views/closing-draft/helpers/get-calculated-total.helper.d.ts +4 -0
  81. package/dist/views/closing-template/components/closing-template-form/composables/use-closing-template-items.d.ts +2 -1
  82. package/dist/views/closing-template/composables/use-closing-template-actions.d.ts +48 -204
  83. package/dist/views/closing-template/composables/use-closing-template-table.d.ts +49 -205
  84. package/dist/views/ingredient-group/composables/use-ingredient-group-table.d.ts +6 -3
  85. package/dist/views/ingredients/components/convert/ConvertFormProps.d.ts +1 -0
  86. package/dist/views/ingredients/components/ingredient-form/IngredientForm.vue.d.ts +4 -2
  87. package/dist/views/ingredients/components/inventory-binding/InventoryBindingForm.vue.d.ts +1 -0
  88. package/dist/views/ingredients/composables/use-ingredient-table.d.ts +2 -1
  89. package/dist/views/receive-request/components/netsuite/NetSuiteInfo.vue.d.ts +12 -0
  90. package/dist/views/receive-request/components/netsuite/NetSuiteProps.d.ts +13 -0
  91. package/dist/views/receive-request/components/netsuite/NetSuiteSync.vue.d.ts +12 -0
  92. package/dist/views/receive-request/components/transfer-form/NetSuiteField.vue.d.ts +13 -0
  93. package/dist/views/receive-request/components/transfer-form/SparkIcon.vue.d.ts +1 -1
  94. package/dist/views/receive-request/components/transfer-form/TransferForm.vue.d.ts +70 -17
  95. package/dist/views/receive-request/components/transfer-form/components/ForecastStock.vue.d.ts +4 -2
  96. package/dist/views/receive-request/components/transfer-form/composables/use-transfer-items.d.ts +2 -1
  97. package/dist/views/receive-request/composables/use-receive-request-form.d.ts +102 -24
  98. package/dist/views/receive-request/composables/use-receive-request-table.d.ts +102 -24
  99. package/dist/views/recipe/components/recipe-form/RecipeForm.vue.d.ts +2 -0
  100. package/dist/views/stock/components/StockRecordCard.vue.d.ts +120 -42
  101. package/dist/views/stock/components/dialog/AdjustedItemForm.vue.d.ts +6 -4
  102. package/dist/views/stock/helper/compute-summary-total.d.ts +2 -2
  103. package/dist/views/transfer-template/components/transfer-template-form/composables/use-transfer-template-items.d.ts +2 -1
  104. package/dist/views/transfer-template/composables/use-transfer-template-actions.d.ts +24 -12
  105. package/dist/views/transfer-template/composables/use-transfer-template-table.d.ts +24 -12
  106. package/dist/views/transfer-template/helpers/import-export.helper.d.ts +2 -1
  107. package/package.json +7 -6
  108. package/dist/FmDroppableField-8RzKjEdL.js +0 -154
  109. package/dist/FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-BhdcqRh-.js +0 -436
  110. package/dist/FmMultiselectDialog-D7YtdoyJ.js +0 -415
  111. package/dist/IngredientBindedItem.vue_vue_type_script_setup_true_lang-zjvFEF5C.js +0 -51
  112. package/dist/IngredientsView-DMRN-odY.js +0 -1613
  113. package/dist/ReceiveRequestView-aQZJO8sq.js +0 -4165
  114. package/dist/RecipeView-DXO43tFi.js +0 -597
  115. package/dist/TableActionableRow.vue_vue_type_script_setup_true_lang-DlNJ6kRg.js +0 -135
  116. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-DCA0RUfu.js +0 -1209
  117. package/dist/TransferTemplateView-CfxdQF1t.js +0 -1261
  118. package/dist/_plugin-vue_export-helper-CHgC5LLL.js +0 -9
  119. package/dist/app-KnSMkJBV.js +0 -33496
  120. package/dist/date2-CIeUqUIc.js +0 -117
  121. package/dist/dayjs.min-Df5jSnDJ.js +0 -282
  122. package/dist/defineDeepModel-BfuQAIoM.js +0 -13
  123. package/dist/feature-dwB4OxRQ.js +0 -86
  124. package/dist/format-time-from-id-BbvzyIN6.js +0 -15
  125. package/dist/format-unit-display-BBWblJEt.js +0 -1216
  126. package/dist/fuzzy-B9ryZ9VZ.js +0 -41
  127. package/dist/index-BN0CY3sZ.js +0 -22277
  128. package/dist/index-Bj1fJum-.js +0 -45
  129. package/dist/index-C4yL_7rR.js +0 -10545
  130. package/dist/netsuite-ByWOS6tI.js +0 -194
  131. package/dist/normalizeArguments-DP7Hrren.js +0 -1552
  132. package/dist/row-action.enum-PMKMRrZR.js +0 -50
  133. package/dist/rules-C12nWDD1.js +0 -198
  134. package/dist/use-template-enabled-locations-2-k9g5t8tt.js +0 -86
  135. package/dist/xlsx-B4XHad7S.js +0 -24004
  136. package/dist/xlsx.util-BSO4SHJi.js +0 -78
@@ -1,597 +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-KnSMkJBV.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-zjvFEF5C.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-C12nWDD1.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-BhdcqRh-.js";
12
- import { _ as $e } from "./InventoryBindingForm.vue_vue_type_script_setup_true_lang-CVxJ_bV3.js";
13
- import { t as Ae, d as Pe } from "./xlsx.util-BSO4SHJi.js";
14
- import { f as Be } from "./date2-CIeUqUIc.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
- };