@feedmepos/mf-inventory-portal 1.2.63-dev.1 → 1.2.63

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 (124) hide show
  1. package/dist/{App-BHssUobV.js → App-W35c1JM6.js} +78 -82
  2. package/dist/{ApprovalView-DRGCQeGY.js → ApprovalView-qZaYBUOw.js} +5 -5
  3. package/dist/{BindingsDialog-CWl3LpdO.js → BindingsDialog-Bgvqj142.js} +5 -5
  4. package/dist/{BindingsPicker-BcASw3JJ.js → BindingsPicker-BlUUKBUF.js} +3 -3
  5. package/dist/{BindingsTable-BiKiLiVY.js → BindingsTable-Bb2CUGOE.js} +5 -5
  6. package/dist/{ClosingDraftView-mh5Kw46x.js → ClosingDraftView-BgIB7VGF.js} +216 -217
  7. package/dist/{ClosingHistoryView-C-ZrFei9.js → ClosingHistoryView-BNrhBSY1.js} +36 -36
  8. package/dist/{ClosingTemplateView-DBNRH0Tt.js → ClosingTemplateView-BHexv7IS.js} +14 -14
  9. package/dist/{DeliveryOrderPrintPreview-Dv3JZ3yr.js → DeliveryOrderPrintPreview-b6HAqBJ3.js} +7 -7
  10. package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-CfL1adhx.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-BMZ6uK2r.js} +16 -16
  11. package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-Db0JeXbc.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-DTN2FDK5.js} +2 -2
  12. package/dist/{FmMultiselectDialog-DuYKQng9.js → FmMultiselectDialog-BRhLiA42.js} +16 -16
  13. package/dist/{FmMultiselectDialog-D9g07F_c.js → FmMultiselectDialog-ClPRjx_J.js} +1 -1
  14. package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-CeXRT7Lf.js → FmUnitInput.vue_vue_type_script_setup_true_lang-D6jUtx5F.js} +22 -23
  15. package/dist/{ImportView-DoMyJ1NE.js → ImportView-D0oguV-P.js} +6 -6
  16. package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-CqJQcOBK.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-05HRp0Rw.js} +1 -1
  17. package/dist/{IngredientGroupView-D_Cl4kJy.js → IngredientGroupView-C8qcgsqS.js} +5 -5
  18. package/dist/{IngredientsView-CG6wUGzt.js → IngredientsView-DZLBIxnp.js} +24 -25
  19. package/dist/{IntegrationView-BIWPp1JH.js → IntegrationView-DoLRBfXS.js} +17 -18
  20. package/dist/{InventoryBindingForm-BrL6-2He.js → InventoryBindingForm-Ddc2xNun.js} +1 -1
  21. package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-M3uVquEq.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-Drnfo6QF.js} +16 -17
  22. package/dist/{InventoryBindingSummary-mnlQU1Mp.js → InventoryBindingSummary-C9G9UNHE.js} +1 -1
  23. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-ByPOKZRm.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-C-2ZqPDQ.js} +5 -5
  24. package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-DHwXNoTs.js → PremiumBadge.vue_vue_type_script_setup_true_lang-CCFfnd1y.js} +2 -2
  25. package/dist/{PublishView-B4iVMq25.js → PublishView-CA0ndWK1.js} +8 -8
  26. package/dist/{PurchaseOrderPrintPreview-ws-SKrEC.js → PurchaseOrderPrintPreview-C0fSwRzh.js} +11 -11
  27. package/dist/{ReceiveRequestView-deSiORNX.js → ReceiveRequestView-7LQVLMw_.js} +142 -143
  28. package/dist/RecipeView-C970Tbje.js +646 -0
  29. package/dist/{StockView-6j_t2Kf1.js → StockView-DMFw_TH_.js} +105 -106
  30. package/dist/{SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-CgAMsW8n.js → SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-BnBRHve2.js} +1 -1
  31. package/dist/{SupplierView-D5tSOECx.js → SupplierView-BgwlWXfk.js} +19 -20
  32. package/dist/{SurchargeView-CP81Q4dW.js → SurchargeView-Cg6fbAF-.js} +6 -6
  33. package/dist/{SystemTrailDialog.vue_vue_type_script_setup_true_lang-Bmuw4PTO.js → SystemTrailDialog.vue_vue_type_script_setup_true_lang-B65wyG1T.js} +2 -2
  34. package/dist/{TemplatePublishDialog.vue_vue_type_script_setup_true_lang-D1FuB-kv.js → TemplatePublishDialog.vue_vue_type_script_setup_true_lang-jjtyBmso.js} +1 -1
  35. package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-Canrz2ri.js → TransferDetails.vue_vue_type_script_setup_true_lang-Gi-bL9hh.js} +124 -124
  36. package/dist/{TransferTemplateView-CRI_Lexa.js → TransferTemplateView-B54hUzme.js} +21 -22
  37. package/dist/{UnitView-BZmfd-aw.js → UnitView-DOfJbxkC.js} +10 -11
  38. package/dist/{WarehouseView-BcmSyjA0.js → WarehouseView-x7UBmz1U.js} +5 -5
  39. package/dist/{WastageTemplateView-CNsdu0ga.js → WastageTemplateView-DyAlJgfd.js} +14 -14
  40. package/dist/api/inventory.d.ts +36 -126
  41. package/dist/api/netsuite.d.ts +1 -8
  42. package/dist/{app-ayv5Jw7D.js → app-CA2Cny0i.js} +7036 -8041
  43. package/dist/app.d.ts +0 -228
  44. package/dist/app.js +1 -1
  45. package/dist/{closing-template-D9UR8sMo.js → closing-template-DTv1fwBu.js} +1 -1
  46. package/dist/components/inventory-binding/InventoryBinding.vue.d.ts +1 -37
  47. package/dist/components/shell/inventory/binding-dialog.vue.d.ts +0 -14
  48. package/dist/components/shell/inventory/binding-ui.vue.d.ts +1 -16
  49. package/dist/{date2-GNP-79dA.js → date2-Cp4YfWcb.js} +1 -1
  50. package/dist/{dayjs.min-Bg_wgP2J.js → dayjs.min-CgirzsHV.js} +16 -16
  51. package/dist/{defineDeepModel-Co03tZfS.js → defineDeepModel-D9OlXcS_.js} +1 -1
  52. package/dist/{duplicate-template-BiPU4Z2Y.js → duplicate-template-DyCBVMov.js} +1 -1
  53. package/dist/{feature-BGeFfaiX.js → feature-BxsRwVch.js} +89 -94
  54. package/dist/{format-time-from-id-ByV0VX1x.js → format-time-from-id-BusUCMUA.js} +1 -1
  55. package/dist/{format-unit-display-r1Hb4DfH.js → format-unit-display-BvtbVzxs.js} +15 -16
  56. package/dist/{import-export.helper-PB9pPO3m.js → import-export.helper-B3Le8F5L.js} +15 -16
  57. package/dist/{index-DWWlEK_r.js → index-CLSRasCh.js} +1412 -1471
  58. package/dist/{index-ClbYCYSU.js → index-DzJrZhr1.js} +3 -3
  59. package/dist/{index-DMqOVOHw.js → index-f9YwK5uk.js} +1 -1
  60. package/dist/{lodash-BbWPSHMM.js → lodash--YJHqtef.js} +1 -1
  61. package/dist/{netsuite-VGghPz8h.js → netsuite-CBG_dy7k.js} +92 -92
  62. package/dist/{purchase-order-template-BMNxJR59.js → purchase-order-template-sK4yLnG5.js} +1 -1
  63. package/dist/router/name.d.ts +0 -1
  64. package/dist/rules-DPShesHe.js +327 -0
  65. package/dist/{stock-b7nNc6ko.js → stock-iBLjW3Y5.js} +1 -1
  66. package/dist/stock-q7nfubr2.js +75 -0
  67. package/dist/stores/feature.d.ts +0 -2
  68. package/dist/stores/integration/netsuite.d.ts +1 -8
  69. package/dist/stores/inventory.d.ts +30 -119
  70. package/dist/{supplier-Dm-bxVXL.js → supplier-pjh8CQtC.js} +2 -2
  71. package/dist/{surcharge-ZM-_XIvY.js → surcharge-CN4HYoU0.js} +1 -1
  72. package/dist/tsconfig.app.tsbuildinfo +1 -1
  73. package/dist/{use-ingredient-select-dialog-BYxTRqif.js → use-ingredient-select-dialog-Do34jWZ9.js} +2 -2
  74. package/dist/{use-inventory-binding-dialog-Dg9Mp0Vk.js → use-inventory-binding-dialog-CH_yEZAR.js} +2 -2
  75. package/dist/{use-template-enabled-locations-2-BmgcViqJ.js → use-template-enabled-locations-2-DDUlfrLq.js} +2 -2
  76. package/dist/views/closing-draft/components/closing-draft-dialog/ClosingDraftDialog.vue.d.ts +8 -64
  77. package/dist/views/closing-draft/composables/use-closing-draft-table.d.ts +24 -192
  78. package/dist/views/closing-template/components/closing-template-form/composables/use-closing-template-items.d.ts +1 -8
  79. package/dist/views/closing-template/composables/use-closing-template-actions.d.ts +12 -96
  80. package/dist/views/closing-template/composables/use-closing-template-table.d.ts +12 -96
  81. package/dist/views/ingredient-group/composables/use-ingredient-group-table.d.ts +18 -18
  82. package/dist/views/ingredients/components/convert/ConvertForm.vue.d.ts +0 -14
  83. package/dist/views/ingredients/components/ingredient-form/IngredientForm.vue.d.ts +4 -32
  84. package/dist/views/ingredients/components/inventory-binding/InventoryBindingForm.vue.d.ts +0 -28
  85. package/dist/views/ingredients/composables/use-ingredient-table.d.ts +1 -8
  86. package/dist/views/integration/components/netsuite/InventoryTransferIngredientTable.vue.d.ts +2 -16
  87. package/dist/views/receive-request/components/transfer-form/TransferFormWithController.vue.d.ts +5 -33
  88. package/dist/views/receive-request/components/transfer-form/components/ForecastStock.vue.d.ts +2 -16
  89. package/dist/views/receive-request/components/transfer-form/components/TransferItemTable.vue.d.ts +4 -32
  90. package/dist/views/receive-request/components/transfer-form/composables/use-transfer-items.d.ts +1 -8
  91. package/dist/views/receive-request/composables/use-process-purchase-order.d.ts +6 -41
  92. package/dist/views/receive-request/composables/use-receive-request-form.d.ts +36 -246
  93. package/dist/views/receive-request/composables/use-receive-request-table.d.ts +42 -287
  94. package/dist/views/recipe/components/recipe-form/RecipeForm.vue.d.ts +0 -16
  95. package/dist/views/stock/components/StockRecordCard.vue.d.ts +0 -1
  96. package/dist/views/stock/components/dialog/AdjustedItemForm.vue.d.ts +2 -16
  97. package/dist/views/transfer-template/components/transfer-template-dialog/TransferTemplateDialog.vue.d.ts +2 -16
  98. package/dist/views/transfer-template/components/transfer-template-form/components/NetSuiteCustomCodeSelection.vue.d.ts +2 -16
  99. package/dist/views/transfer-template/components/transfer-template-form/components/TransferTemplateItemTable.vue.d.ts +2 -16
  100. package/dist/views/transfer-template/components/transfer-template-form/composables/use-transfer-template-items.d.ts +1 -8
  101. package/dist/views/transfer-template/composables/use-netsuite-custom-field.d.ts +3 -24
  102. package/dist/views/transfer-template/composables/use-transfer-template-actions.d.ts +12 -96
  103. package/dist/views/transfer-template/composables/use-transfer-template-table.d.ts +12 -96
  104. package/dist/{vue-i18n-BwxQzDKn.js → vue-i18n-CVbjsMxl.js} +538 -538
  105. package/dist/{xlsx-dJMIfias.js → xlsx-CSeMIpYz.js} +1 -1
  106. package/dist/{xlsx.util-dclbjq8C.js → xlsx.util-CsYD8XWC.js} +1 -1
  107. package/package.json +3 -3
  108. package/dist/RecipeView-EEK7PiKl.js +0 -1558
  109. package/dist/UnitCostHistoryView-CT-4QDK8.js +0 -651
  110. package/dist/api/unit-cost-history.d.ts +0 -28
  111. package/dist/number-DPuTdA-J.js +0 -232
  112. package/dist/rules-CyF-4tvp.js +0 -98
  113. package/dist/stock-D1SElOsp.js +0 -75
  114. package/dist/views/ingredients/components/inventory-binding/v2/InventoryBindingFormV2.vue.d.ts +0 -169
  115. package/dist/views/ingredients/components/inventory-binding/v2/components/InventoryBindingAlternative.vue.d.ts +0 -43
  116. package/dist/views/ingredients/components/inventory-binding/v2/components/InventoryBindingRule.vue.d.ts +0 -25
  117. package/dist/views/ingredients/components/inventory-binding/v2/components/InventoryRecipeBindingV2Field.vue.d.ts +0 -125
  118. package/dist/views/ingredients/components/inventory-binding/v2/components/InventorySkuBindingV2Field.vue.d.ts +0 -129
  119. package/dist/views/ingredients/components/inventory-binding/v2/composables/use-inventory-binding-alternative-table.d.ts +0 -30
  120. package/dist/views/ingredients/components/inventory-binding/v2/composables/use-inventory-binding-dialog.d.ts +0 -4
  121. package/dist/views/unit-cost-history/UnitCostHistoryView.vue.d.ts +0 -2
  122. package/dist/views/unit-cost-history/components/UnitCostDetailsSideSheet.vue.d.ts +0 -19
  123. package/dist/views/unit-cost-history/components/UnitCostRecalculationDialog.vue.d.ts +0 -11
  124. package/dist/views/unit-cost-history/composables/use-unit-cost-history.d.ts +0 -65
@@ -0,0 +1,646 @@
1
+ import { defineComponent as Y, ref as E, onMounted as ie, resolveComponent as F, openBlock as k, createElementBlock as B, Fragment as ue, createElementVNode as x, toDisplayString as ce, createVNode as y, createCommentVNode as q, computed as I, watch as de, createBlock as G, withCtx as U, unref as g, isRef as te, normalizeClass as me, normalizeStyle as pe, Teleport as fe, normalizeProps as ve, guardReactiveProps as ye } from "vue";
2
+ import { a as A, c as Q, S as ge, F as H, j as ne, u as be } from "./app-CA2Cny0i.js";
3
+ import { useDialog as re, useSnackbar as W, useProxiedModel as oe, useBreakpoints as _e } from "@feedmepos/ui-library";
4
+ import { i as Re, _ as he } from "./is-linked-ingredient-error-fJ2TJb3z.js";
5
+ import { F as C } from "./form-mode.enum-BKiNVH6A.js";
6
+ import { _ as le } from "./IngredientBindedItem.vue_vue_type_script_setup_true_lang-05HRp0Rw.js";
7
+ import { defineStore as we, storeToRefs as Se } from "pinia";
8
+ import { D as ae, R as K } from "./row-action.enum-BcW_L_nE.js";
9
+ import { c as xe } from "./component-DpCUABT3.js";
10
+ import { a as P, R as Ve, U as Ce, A as Ee } from "./rules-DPShesHe.js";
11
+ import { useI18n as O } from "@feedmepos/mf-common";
12
+ import { u as ke, _ as Fe } from "./SingleColumnLayout.vue_vue_type_script_setup_true_lang-CWZkVCAj.js";
13
+ import { _ as Ie } from "./InventoryBindingForm.vue_vue_type_script_setup_true_lang-Drnfo6QF.js";
14
+ import { _ as $e } from "./FmCustomAttribute.vue_vue_type_script_setup_true_lang-D-IWRjRD.js";
15
+ import { u as De } from "./feature-BxsRwVch.js";
16
+ import { _ as Ae, F as se } from "./TableActionableRow.vue_vue_type_script_setup_true_lang-Ca_eYa8-.js";
17
+ import { b as Be, d as Pe } from "./xlsx.util-CsYD8XWC.js";
18
+ import { f as Ue } from "./date2-Cp4YfWcb.js";
19
+ import { _ as Te } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-DTN2FDK5.js";
20
+ const Me = {
21
+ key: 0,
22
+ class: "flex flex-col items-center w-full h-full gap-24"
23
+ }, Ge = { key: 1 }, Ne = { key: 0 }, Le = /* @__PURE__ */ Y({
24
+ __name: "DeleteDialog",
25
+ props: {
26
+ type: {},
27
+ data: {},
28
+ message: {},
29
+ bindedItems: {}
30
+ },
31
+ setup(b) {
32
+ const f = b, v = E(f.bindedItems || []), s = E(!1);
33
+ ie(() => {
34
+ r();
35
+ });
36
+ async function r() {
37
+ var c, m;
38
+ !s.value && ((c = f.data) != null && c._id) && (s.value = !0, v.value = await A().getAffectedMenu((m = f.data) == null ? void 0 : m._id), s.value = !1);
39
+ }
40
+ return (c, m) => {
41
+ const w = F("FmSpacer"), l = F("FmCircularProgress");
42
+ return k(), B(ue, null, [
43
+ x("p", null, ce(c.message), 1),
44
+ s.value ? (k(), B("div", Me, [
45
+ y(w),
46
+ x("div", null, [
47
+ y(l, { size: "xl" })
48
+ ]),
49
+ m[0] || (m[0] = x("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary pl-8" }, "Loading...", -1)),
50
+ y(w)
51
+ ])) : (k(), B("div", Ge, [
52
+ m[2] || (m[2] = x("br", null, null, -1)),
53
+ v.value.length > 0 ? (k(), B("div", Ne, [
54
+ m[1] || (m[1] = x("p", { class: "fm-typo-en-body-lg-600" }, "Affected menu items:", -1)),
55
+ y(le, {
56
+ name: "Menu",
57
+ bindings: v.value
58
+ }, null, 8, ["bindings"])
59
+ ])) : q("", !0)
60
+ ]))
61
+ ], 64);
62
+ };
63
+ }
64
+ }), J = we("recipeForm", function() {
65
+ const f = re(), v = W(), s = A(), r = E(!1), c = E();
66
+ function m() {
67
+ const n = {
68
+ recipe: {},
69
+ mode: C.CREATE,
70
+ show: !0,
71
+ "onUpdate:show"(o) {
72
+ c.value.show = o;
73
+ }
74
+ };
75
+ c.value = n;
76
+ }
77
+ async function w(n) {
78
+ const o = {
79
+ recipe: Q(n),
80
+ mode: C.UPDATE,
81
+ show: !0,
82
+ "onUpdate:show"(u) {
83
+ c.value.show = u;
84
+ }
85
+ };
86
+ c.value = o;
87
+ }
88
+ async function l(n) {
89
+ r.value = !0;
90
+ try {
91
+ await s.deleteRecipe(n), v.open({
92
+ title: "Success",
93
+ message: `Deleted ${n.name}`,
94
+ type: "success"
95
+ });
96
+ } catch (o) {
97
+ o instanceof ge && Re(o) ? f.open({
98
+ title: "Cannot delete recipe",
99
+ contentComponent: he,
100
+ contentComponentProps: {
101
+ subject: (n == null ? void 0 : n.name) ?? "",
102
+ items: o.errorResponse.message
103
+ },
104
+ secondaryActions: {
105
+ text: "Close",
106
+ close: !0
107
+ }
108
+ }) : console.log("unable to delete recipe", o), v.open({
109
+ title: `Cannot delete ${n == null ? void 0 : n.name}`,
110
+ message: "Please try again.",
111
+ type: "error"
112
+ }), console.error("failed to delete recipe", o);
113
+ } finally {
114
+ r.value = !1;
115
+ }
116
+ }
117
+ function p(n) {
118
+ f.open({
119
+ title: `Delete ${(n == null ? void 0 : n.name) ?? "recipe"}?`,
120
+ closeButton: !1,
121
+ primaryActions: {
122
+ text: "Delete",
123
+ close: !0,
124
+ variant: "destructive"
125
+ },
126
+ secondaryActions: {
127
+ text: "Cancel",
128
+ close: !0
129
+ },
130
+ contentComponent: Le,
131
+ contentComponentProps: {
132
+ type: "menu",
133
+ data: n,
134
+ message: "You may not be able to delete this recipe if it is linked in any of the inventory modules."
135
+ }
136
+ }).onPrimary(() => l(n));
137
+ }
138
+ return {
139
+ createRecipe: m,
140
+ updateRecipe: w,
141
+ deleteRecipe: p,
142
+ recipeDialogProps: c,
143
+ recipeViewLoading: r
144
+ };
145
+ });
146
+ function ze() {
147
+ const { updateRecipe: b, deleteRecipe: f } = J(), v = A(), { t: s } = O();
148
+ async function r(l, p) {
149
+ const n = Q(p);
150
+ if (l === K.Edit) {
151
+ await b(n);
152
+ return;
153
+ }
154
+ if (l === K.Delete) {
155
+ await f(n);
156
+ return;
157
+ }
158
+ }
159
+ function c(l, p) {
160
+ const n = l.filter((i) => i.type === H.enum.SKU), o = l.filter(
161
+ (i) => i.type === H.enum.SKU_GROUP
162
+ ), u = l.filter((i) => i.type === H.enum.RECIPE);
163
+ return [
164
+ ...n.map((i) => ({ ...i, recipeIds: [...p] })),
165
+ ...o.map((i) => ({ ...i, isGroup: !0, recipeIds: [...p] })),
166
+ ...u.filter((i) => v.recipeById[i.id] && !p.has(i.id)).flatMap(
167
+ (i) => c(v.recipeById[i.id].contains, /* @__PURE__ */ new Set([...p, i.id]))
168
+ )
169
+ ];
170
+ }
171
+ const m = [
172
+ {
173
+ accessorKey: "recipe",
174
+ header: () => s("inventory.recipe.name"),
175
+ size: 400
176
+ },
177
+ {
178
+ accessorKey: "ingredients",
179
+ header: () => s("inventory.recipe.ingredients"),
180
+ size: "auto"
181
+ },
182
+ {
183
+ id: "action",
184
+ header: "",
185
+ cell(l) {
186
+ return xe(
187
+ [ae[K.Edit], ae[K.Delete]],
188
+ (p) => {
189
+ r(p, l.row.original.original);
190
+ }
191
+ );
192
+ },
193
+ enableSorting: !1,
194
+ size: 40,
195
+ meta: {
196
+ cellClass: "",
197
+ headerClass: ""
198
+ }
199
+ }
200
+ ];
201
+ function w(l) {
202
+ const p = A();
203
+ return l.map((n) => ({
204
+ recipe: n.name,
205
+ ingredients: c(n.contains, /* @__PURE__ */ new Set([n._id])).map((o) => {
206
+ var i, S, e, d, _, h;
207
+ if (o.isGroup) {
208
+ const R = p.skuGroupById[o.id];
209
+ return o.recipeIds.slice(1).length ? `(${(i = p.recipeById[o.recipeIds.at(-1) ?? ""]) == null ? void 0 : i.name}) ${R.name} (x ${P(o.amount)})` : `${R.name} (x${P(o.amount)})`;
210
+ }
211
+ const u = p.skuById[o.id];
212
+ return u ? o.recipeIds.slice(1).length ? `(${(S = p.recipeById[o.recipeIds.at(-1) ?? ""]) == null ? void 0 : S.name}) ${u.name} (${P(o.amount)}${((e = o.measurement) == null ? void 0 : e.abbrev) ?? ((d = u == null ? void 0 : u.unit) == null ? void 0 : d.abbrev)})` : `${u.name} (${P(o.amount)}${((_ = o.measurement) == null ? void 0 : _.abbrev) ?? ((h = u == null ? void 0 : u.unit) == null ? void 0 : h.abbrev)})` : null;
213
+ }).filter((o) => o).join(", "),
214
+ original: n
215
+ }));
216
+ }
217
+ return { columnDefs: m, formatRowData: w };
218
+ }
219
+ const je = { class: "flex flex-col gap-40" }, Ke = {
220
+ key: 0,
221
+ 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"
222
+ }, Ye = {
223
+ key: 0,
224
+ class: "flex flex-col items-center w-full h-full gap-24"
225
+ }, Oe = { key: 1 }, He = { class: "mt-32" }, qe = /* @__PURE__ */ Y({
226
+ __name: "RecipeForm",
227
+ props: {
228
+ mode: {},
229
+ modelValue: {},
230
+ disabled: { type: Boolean }
231
+ },
232
+ emits: ["update:modelValue", "click:submit"],
233
+ setup(b, { expose: f, emit: v }) {
234
+ var R;
235
+ const s = b, r = v, c = De(), { t: m } = O(), w = I({
236
+ get() {
237
+ var t;
238
+ return ((t = s.modelValue) == null ? void 0 : t.name) ?? "";
239
+ },
240
+ set(t) {
241
+ const a = s.modelValue ?? {};
242
+ a.name = t, r("update:modelValue", a);
243
+ }
244
+ }), l = I({
245
+ get() {
246
+ var t;
247
+ return ((t = s.modelValue) == null ? void 0 : t.contains) ?? [];
248
+ },
249
+ set(t) {
250
+ const a = s.modelValue ?? {};
251
+ a.contains = t, r("update:modelValue", a);
252
+ }
253
+ }), p = I({
254
+ get() {
255
+ var t;
256
+ return ((t = s.modelValue) == null ? void 0 : t.customAttributes) ?? {};
257
+ },
258
+ set(t) {
259
+ const a = s.modelValue ? {
260
+ ...s.modelValue
261
+ } : {};
262
+ a.customAttributes = t, r("update:modelValue", a);
263
+ }
264
+ });
265
+ function n() {
266
+ r("click:submit");
267
+ }
268
+ const o = E();
269
+ f({
270
+ validateInputs: () => {
271
+ var t, a;
272
+ (a = (t = o.value) == null ? void 0 : t.validateInputs) == null || a.call(t);
273
+ },
274
+ resetInputsValidation: () => {
275
+ var t, a;
276
+ (a = (t = o.value) == null ? void 0 : t.resetInputsValidation) == null || a.call(t);
277
+ },
278
+ resetInputs: () => {
279
+ var t, a;
280
+ (a = (t = o.value) == null ? void 0 : t.resetInputs) == null || a.call(t);
281
+ }
282
+ });
283
+ const u = A(), i = E([]), S = E(!1), e = E(!1);
284
+ de(S, async (t) => {
285
+ d(t);
286
+ });
287
+ async function d(t) {
288
+ var a, $;
289
+ t && !e.value && ((a = s.modelValue) != null && a._id) && (e.value = !0, i.value = await u.getAffectedMenu(($ = s.modelValue) == null ? void 0 : $._id).delayed(500), e.value = !1);
290
+ }
291
+ const _ = I(
292
+ () => u.recipes.map((t) => ({ label: t.name, value: t.name }))
293
+ ), h = E((R = s.modelValue) == null ? void 0 : R.name);
294
+ return (t, a) => {
295
+ const $ = F("FmTextField"), D = F("FmCard"), N = F("FmSwitch"), M = F("FmSpacer"), L = F("FmCircularProgress"), T = F("FmForm");
296
+ return k(), G(T, {
297
+ ref_key: "formRef",
298
+ ref: o,
299
+ onValidationSuccess: n
300
+ }, {
301
+ default: U(() => [
302
+ x("div", je, [
303
+ y($, {
304
+ disabled: t.disabled,
305
+ label: g(m)("inventory.recipe.name"),
306
+ "model-value": w.value,
307
+ "onUpdate:modelValue": a[0] || (a[0] = (V) => w.value = V),
308
+ rules: [
309
+ g(Ve)(),
310
+ g(Ce)(_.value, h.value, (V) => `[${V.value}] already exists`)
311
+ ],
312
+ "label-mark": "required"
313
+ }, null, 8, ["disabled", "label", "model-value", "rules"]),
314
+ y(D, {
315
+ variant: "outlined",
316
+ class: "p-16"
317
+ }, {
318
+ default: U(() => {
319
+ var V;
320
+ return [
321
+ y(Ie, {
322
+ id: (V = t.modelValue) == null ? void 0 : V._id,
323
+ disabled: t.disabled,
324
+ "model-value": l.value,
325
+ "onUpdate:modelValue": a[1] || (a[1] = (z) => l.value = z),
326
+ rules: [g(Ee)(1)],
327
+ "enable-ingredient-group": g(c).enableIngredientGroup
328
+ }, null, 8, ["id", "disabled", "model-value", "rules", "enable-ingredient-group"])
329
+ ];
330
+ }),
331
+ _: 1
332
+ })
333
+ ]),
334
+ t.mode !== g(C).CREATE ? (k(), B("div", Ke, [
335
+ y(N, {
336
+ label: "Show binded items",
337
+ modelValue: S.value,
338
+ "onUpdate:modelValue": a[2] || (a[2] = (V) => S.value = V),
339
+ "label-placement": "right",
340
+ disabled: e.value
341
+ }, null, 8, ["modelValue", "disabled"]),
342
+ e.value ? (k(), B("div", Ye, [
343
+ y(M),
344
+ x("div", null, [
345
+ y(L, { size: "xl" })
346
+ ]),
347
+ a[4] || (a[4] = x("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary pl-8" }, "Loading...", -1)),
348
+ y(M)
349
+ ])) : S.value && i.value.length ? (k(), B("div", Oe, [
350
+ y(le, {
351
+ name: "Menu",
352
+ bindings: i.value
353
+ }, null, 8, ["bindings"])
354
+ ])) : q("", !0)
355
+ ])) : q("", !0),
356
+ x("div", He, [
357
+ y($e, {
358
+ entity: "inventoryRecipe",
359
+ modelValue: p.value,
360
+ "onUpdate:modelValue": a[3] || (a[3] = (V) => p.value = V)
361
+ }, null, 8, ["modelValue"])
362
+ ])
363
+ ]),
364
+ _: 1
365
+ }, 512);
366
+ };
367
+ }
368
+ }), Je = { class: "flex gap-4" }, Qe = /* @__PURE__ */ Y({
369
+ __name: "RecipeDialog",
370
+ props: {
371
+ show: { type: Boolean },
372
+ recipe: {},
373
+ mode: { default: C.READ }
374
+ },
375
+ emits: ["update:show"],
376
+ setup(b) {
377
+ const f = b, v = A(), s = W(), { t: r } = O(), c = oe(f, "show"), m = oe(f, "recipe"), w = I(() => {
378
+ switch (f.mode) {
379
+ case C.READ:
380
+ return "";
381
+ case C.UPDATE:
382
+ return r("inventory.recipe.update.title");
383
+ case C.CREATE:
384
+ return r("inventory.recipe.create.title");
385
+ }
386
+ return "";
387
+ }), l = I(() => {
388
+ switch (f.mode) {
389
+ case C.READ:
390
+ return "";
391
+ case C.UPDATE:
392
+ return r("common.save");
393
+ case C.CREATE:
394
+ return r("common.add");
395
+ }
396
+ return "";
397
+ }), p = E(), n = E(!1);
398
+ async function o() {
399
+ n.value = !0;
400
+ try {
401
+ const e = Q(m.value);
402
+ e.precision ?? (e.precision = 0), e.measurements ?? (e.measurements = []), await v.createRecipe(e), c.value = !1, s.open({
403
+ title: r("inventory.common.success"),
404
+ message: r("inventory.recipe.create.success", { name: m.value.name }),
405
+ type: "success"
406
+ });
407
+ } catch (e) {
408
+ e instanceof ne || s.open({
409
+ title: r("inventory.recipe.create.error.title"),
410
+ message: r("inventory.recipe.create.error.message"),
411
+ type: "error"
412
+ });
413
+ } finally {
414
+ n.value = !1;
415
+ }
416
+ }
417
+ async function u() {
418
+ n.value = !0;
419
+ try {
420
+ await v.updateRecipe(m.value), c.value = !1, s.open({
421
+ title: r("inventory.common.success"),
422
+ message: r("inventory.recipe.update.success", { name: m.value.name }),
423
+ type: "success"
424
+ });
425
+ } catch (e) {
426
+ e instanceof ne || s.open({
427
+ title: r("inventory.recipe.update.error.title"),
428
+ message: r("inventory.recipe.update.error.message"),
429
+ type: "error"
430
+ });
431
+ } finally {
432
+ n.value = !1;
433
+ }
434
+ }
435
+ function i() {
436
+ var e, d;
437
+ (d = (e = p.value) == null ? void 0 : e.validateInputs) == null || d.call(e);
438
+ }
439
+ function S() {
440
+ switch (f.mode) {
441
+ case C.READ:
442
+ return;
443
+ case C.UPDATE:
444
+ return u();
445
+ case C.CREATE:
446
+ return o();
447
+ }
448
+ }
449
+ return (e, d) => {
450
+ const _ = F("FmButton"), h = F("FmSideSheet");
451
+ return k(), G(h, {
452
+ "model-value": g(c),
453
+ "onUpdate:modelValue": d[3] || (d[3] = (R) => te(c) ? c.value = R : null),
454
+ header: w.value,
455
+ "close-button": "",
456
+ "dismiss-away": "",
457
+ "max-width": 500
458
+ }, {
459
+ "side-sheet-footer": U(() => [
460
+ x("div", Je, [
461
+ y(_, {
462
+ loading: n.value,
463
+ label: l.value,
464
+ onClick: i
465
+ }, null, 8, ["loading", "label"]),
466
+ y(_, {
467
+ disabled: n.value,
468
+ label: g(r)("common.close"),
469
+ variant: "tertiary",
470
+ onClick: d[2] || (d[2] = (R) => c.value = !1)
471
+ }, null, 8, ["disabled", "label"])
472
+ ])
473
+ ]),
474
+ default: U(() => [
475
+ y(qe, {
476
+ class: "w-full",
477
+ ref_key: "hasValidationExpose",
478
+ ref: p,
479
+ modelValue: g(m),
480
+ "onUpdate:modelValue": d[0] || (d[0] = (R) => te(m) ? m.value = R : null),
481
+ mode: e.mode,
482
+ disabled: n.value,
483
+ "onClick:submit": d[1] || (d[1] = (R) => S())
484
+ }, null, 8, ["modelValue", "mode", "disabled"])
485
+ ]),
486
+ _: 1
487
+ }, 8, ["model-value", "header"]);
488
+ };
489
+ }
490
+ });
491
+ function We(b) {
492
+ return !b || Object.keys(b).length === 0 ? "" : Object.entries(b).map(([f, v]) => `${f}: ${v}`).join(", ");
493
+ }
494
+ function Xe() {
495
+ const b = A(), f = b.recipes, v = b.recipeById, s = b.skuById, r = b.skuGroupById, c = f.flatMap((l, p) => {
496
+ var o;
497
+ const n = We(l.customAttributes);
498
+ if ((o = l.contains) != null && o.length) {
499
+ const u = l.contains.filter((e) => e.type === "RECIPE"), i = l.contains.filter((e) => e.type === "SKU"), S = l.contains.filter((e) => e.type === "SKU_GROUP");
500
+ return [
501
+ ...p === 0 ? [] : [["", "", "", "", "", "", ""]],
502
+ ...u.map(
503
+ (e, d) => {
504
+ var _;
505
+ return [
506
+ d === 0 ? l.name : "",
507
+ "RECIPE",
508
+ "",
509
+ (_ = v[e.id]) == null ? void 0 : _.name,
510
+ P(e.amount),
511
+ "UNIT",
512
+ d === 0 ? n : ""
513
+ ];
514
+ }
515
+ ),
516
+ ...i.map(
517
+ (e, d) => {
518
+ var _, h, R, t;
519
+ return [
520
+ !u.length && d === 0 ? l.name : "",
521
+ "INGREDIENT",
522
+ (_ = s[e.id]) == null ? void 0 : _.code,
523
+ (h = s[e.id]) == null ? void 0 : h.name,
524
+ P(e.amount),
525
+ e.measurement ? e.measurement.abbrev : (t = (R = s[e.id]) == null ? void 0 : R.unit) == null ? void 0 : t.abbrev,
526
+ !u.length && d === 0 ? n : ""
527
+ ];
528
+ }
529
+ ),
530
+ ...S.map(
531
+ (e, d) => {
532
+ var _, h;
533
+ return [
534
+ u.length === 0 && i.length === 0 && d === 0 ? l.name : "",
535
+ "SKU_GROUP",
536
+ ((_ = r[e.id]) == null ? void 0 : _.ref) || "",
537
+ (h = r[e.id]) == null ? void 0 : h.name,
538
+ P(e.amount),
539
+ "UNIT",
540
+ u.length === 0 && i.length === 0 && d === 0 ? n : ""
541
+ ];
542
+ }
543
+ )
544
+ ];
545
+ }
546
+ return [
547
+ ...p === 0 ? [] : [["", "", "", "", "", "", ""]],
548
+ [l.name, "No bindings", "", "", "", "", n]
549
+ ];
550
+ }), w = Be(c, ["Name", "Type", "Code", "Item", "Amount", "Unit", "Custom Attributes"]);
551
+ Pe(w, `RECIPE_${Ue(/* @__PURE__ */ new Date(), "-", "-")}.xlsx`);
552
+ }
553
+ const Ze = { class: "flex flex-col py-8" }, et = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, tt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, ht = /* @__PURE__ */ Y({
554
+ __name: "RecipeView",
555
+ setup(b) {
556
+ const f = A(), v = I(() => f.recipes), s = be(), { createRecipe: r, updateRecipe: c } = J(), { recipeDialogProps: m, recipeViewLoading: w } = Se(J()), { columnDefs: l, formatRowData: p } = ze(), n = I(() => p(v.value));
557
+ re(), W(), E(!1);
558
+ function o(R) {
559
+ if (R === "add")
560
+ return r();
561
+ if (R === "export")
562
+ return Xe();
563
+ }
564
+ const u = E(""), i = I(() => w.value), { breakpoints: S } = _e(), e = I(() => S.value.xs || S.value.sm), d = I(() => e.value ? 10 : 20), _ = ke(), { t: h } = O();
565
+ return (R, t) => {
566
+ const a = F("FmTable");
567
+ return k(), G(Fe, {
568
+ title: g(h)("inventory.recipe.title"),
569
+ actions: [
570
+ {
571
+ label: g(h)("inventory.recipe.create.title"),
572
+ value: "add",
573
+ isPrimary: !0,
574
+ prependIcon: "add"
575
+ },
576
+ { label: g(h)("common.export"), value: "export", isPrimary: !1 }
577
+ ],
578
+ "onClick:action": o
579
+ }, {
580
+ default: U(() => [
581
+ x("div", {
582
+ class: me([
583
+ "flex flex-col gap-8 max-h-full",
584
+ {
585
+ "p-0": e.value,
586
+ "px-24 ": !e.value
587
+ }
588
+ ])
589
+ }, [
590
+ y(Te, {
591
+ searchable: "",
592
+ search: u.value,
593
+ "onUpdate:search": t[0] || (t[0] = ($) => u.value = $)
594
+ }, null, 8, ["search"]),
595
+ (k(), G(a, {
596
+ style: pe(g(_).tableHeight),
597
+ "column-defs": g(l),
598
+ "row-data": n.value,
599
+ "search-value": u.value,
600
+ loading: !g(s)._currentLocation || i.value,
601
+ onRowClick: t[1] || (t[1] = ($) => g(c)($.original.original)),
602
+ key: v.value.length,
603
+ "page-size": d.value
604
+ }, {
605
+ "list-row": U(($) => [
606
+ y(Ae, {
607
+ row: $,
608
+ onRowClick: (D) => g(c)(D.original)
609
+ }, {
610
+ default: U((D) => {
611
+ var N, M, L, T, V, z, X, Z, j, ee;
612
+ return [
613
+ x("div", Ze, [
614
+ x("div", et, [
615
+ y(g(se), {
616
+ render: (L = (M = (N = D.recipe) == null ? void 0 : N.column) == null ? void 0 : M.columnDef) == null ? void 0 : L.cell,
617
+ props: (V = (T = D.recipe) == null ? void 0 : T.getContext) == null ? void 0 : V.call(T)
618
+ }, null, 8, ["render", "props"])
619
+ ]),
620
+ x("div", tt, [
621
+ y(g(se), {
622
+ render: (Z = (X = (z = D.ingredients) == null ? void 0 : z.column) == null ? void 0 : X.columnDef) == null ? void 0 : Z.cell,
623
+ props: (ee = (j = D.ingredients) == null ? void 0 : j.getContext) == null ? void 0 : ee.call(j)
624
+ }, null, 8, ["render", "props"])
625
+ ])
626
+ ])
627
+ ];
628
+ }),
629
+ _: 2
630
+ }, 1032, ["row", "onRowClick"])
631
+ ]),
632
+ _: 1
633
+ }, 8, ["style", "column-defs", "row-data", "search-value", "loading", "page-size"]))
634
+ ], 2),
635
+ (k(), G(fe, { to: "body" }, [
636
+ y(Qe, ve(ye(g(m))), null, 16)
637
+ ]))
638
+ ]),
639
+ _: 1
640
+ }, 8, ["title", "actions"]);
641
+ };
642
+ }
643
+ });
644
+ export {
645
+ ht as default
646
+ };