@feedmepos/mf-inventory-portal 1.2.1 → 1.2.2-5.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 (147) hide show
  1. package/dist/App-DMkUg806.js +297 -0
  2. package/dist/{ApprovalView-DwRrbVDo.js → ApprovalView-DWJh2K6W.js} +65 -64
  3. package/dist/{BindingsDialog-DUVKv10-.js → BindingsDialog-EmHCvqJI.js} +2 -2
  4. package/dist/{BindingsPicker-Daib_iq4.js → BindingsPicker-h_9jm1s0.js} +3 -3
  5. package/dist/{BindingsTable-Bv9UmcJP.js → BindingsTable-BAVWGUoa.js} +1 -1
  6. package/dist/ClosingDraftView-Du4kOwIg.js +1899 -0
  7. package/dist/ClosingHistoryView-DuW2Vtrs.js +355 -0
  8. package/dist/ClosingTemplateView-CfPY8R5M.js +2001 -0
  9. package/dist/{DeliveryOrderPrintPreview-DZPcRAja.js → DeliveryOrderPrintPreview-C6Cj8mOp.js} +9 -9
  10. package/dist/FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-WWIrybw_.js +230 -0
  11. package/dist/{FmMultiselectDialog-CZmwOkrb.js → FmMultiselectDialog-BzWrQOS4.js} +1 -1
  12. package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-C-2V2bGc.js → FmUnitInput.vue_vue_type_script_setup_true_lang-DwqVRUFz.js} +36 -36
  13. package/dist/ImportView-lKlYeLay.js +1291 -0
  14. package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-BGnoF1Zz.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-_2WZMZU2.js} +5 -5
  15. package/dist/{IngredientGroupView-CAVYpEj3.js → IngredientGroupView-CrmwR2Xt.js} +34 -35
  16. package/dist/IngredientsView-1bAsyz-b.js +2254 -0
  17. package/dist/{IntegrationView-DdLFyZ4H.js → IntegrationView-D16qeEc_.js} +1773 -1635
  18. package/dist/{InventoryBindingForm-C7BdEDtM.js → InventoryBindingForm-BRwOXV_P.js} +1 -1
  19. package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-B7DND2dQ.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-NDbtbtqK.js} +28 -28
  20. package/dist/{InventoryBindingSummary-IZ7F-Lti.js → InventoryBindingSummary-DKM2gX8_.js} +1 -1
  21. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-sgqVSlUB.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-CdaiYTdf.js} +4 -4
  22. package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-DeF32bHu.js → PremiumBadge.vue_vue_type_script_setup_true_lang-B0OKeK5O.js} +7 -7
  23. package/dist/{PublishView-DkgfYneI.js → PublishView-D0NnU22l.js} +73 -63
  24. package/dist/{PurchaseOrderPrintPreview-CltLC4o4.js → PurchaseOrderPrintPreview-BmuwNbeL.js} +4 -4
  25. package/dist/{ReceiveRequestView-Dj7ji0DY.js → ReceiveRequestView-j79m7TKk.js} +343 -333
  26. package/dist/RecipeView-D_fNQQ-C.js +636 -0
  27. package/dist/StockView-DX_xeFBT.js +2385 -0
  28. package/dist/SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-Bg49isUy.js +172 -0
  29. package/dist/{SupplierView-DE_M_9kd.js → SupplierView-DuFTqbOg.js} +1193 -1073
  30. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-c428GXwc.js +3233 -0
  31. package/dist/{TransferTemplateView-gWGBCF3u.js → TransferTemplateView-Ccsfcetz.js} +104 -103
  32. package/dist/UnitView-BklpNsFN.js +674 -0
  33. package/dist/WarehouseView-BrURbU67.js +1066 -0
  34. package/dist/api/adjustment-template.d.ts +1 -0
  35. package/dist/api/bill.d.ts +140 -2
  36. package/dist/api/closing-template.d.ts +1 -0
  37. package/dist/api/closing.d.ts +1 -0
  38. package/dist/api/inventory.d.ts +405 -0
  39. package/dist/api/netsuite.d.ts +5 -1
  40. package/dist/api/purchase-order-template.d.ts +1 -0
  41. package/dist/api/purchase-order.d.ts +3 -0
  42. package/dist/api/shipment.d.ts +11 -0
  43. package/dist/api/stock.d.ts +2 -44
  44. package/dist/api/warehouse.d.ts +3 -1
  45. package/dist/{app-CruHLH1e.js → app-a9r50k3U.js} +68551 -67573
  46. package/dist/app.d.ts +643 -15
  47. package/dist/app.js +6 -6
  48. package/dist/components/FmAdminBadge.vue.d.ts +1 -4
  49. package/dist/components/FmEnhancedSelect.vue.d.ts +30 -0
  50. package/dist/components/FmInventoryTableToolbar.vue.d.ts +16 -2
  51. package/dist/components/FmLockableField.vue.d.ts +3 -0
  52. package/dist/components/netsuite/ItemSubsidiaryTreeDialog.vue.d.ts +16 -0
  53. package/dist/components/netsuite/SubsidiaryTreeDialog.vue.d.ts +2 -0
  54. package/dist/composable/defineApi.d.ts +1 -1
  55. package/dist/composable/useIframe.d.ts +2 -2
  56. package/dist/{decimal-izbvCC1j.js → decimal-AusUnA1W.js} +1 -1
  57. package/dist/{format-unit-display-4SAdfyZB.js → format-unit-display-BqkHL-ph.js} +397 -429
  58. package/dist/helper/array.d.ts +1 -0
  59. package/dist/helper/core/country/utils.d.ts +3 -4
  60. package/dist/helper/country.d.ts +6 -255
  61. package/dist/helper/number.d.ts +1 -0
  62. package/dist/import-export.helper-PIyNeHfa.js +238 -0
  63. package/dist/{index-B6GGthLw.js → index-CjxirPvn.js} +283 -268
  64. package/dist/{index-CnQloOEo.js → index-Dj9-pdT9.js} +1 -1
  65. package/dist/layout/SingleColumnLayout.vue.d.ts +6 -3
  66. package/dist/purchase-order-template-CQikvY1p.js +41 -0
  67. package/dist/router/name.d.ts +2 -0
  68. package/dist/stock-CDZ2uWSF.js +83 -0
  69. package/dist/stock-Dw908dIC.js +74 -0
  70. package/dist/stores/feature.d.ts +12 -0
  71. package/dist/stores/integration/netsuite.d.ts +42 -0
  72. package/dist/stores/inventory.d.ts +28 -199
  73. package/dist/stores/location.d.ts +331 -1
  74. package/dist/stores/supplier.d.ts +96 -0
  75. package/dist/stores/warehouse.d.ts +4 -0
  76. package/dist/style.css +1 -1
  77. package/dist/{supplier-CTVE1lHO.js → supplier-BPPBUudN.js} +1 -1
  78. package/dist/tsconfig.app.tsbuildinfo +1 -1
  79. package/dist/{use-ingredient-select-dialog-CM80TfX0.js → use-ingredient-select-dialog-C_fSKN3_.js} +5 -5
  80. package/dist/{use-inventory-binding-dialog-D_omdhgn.js → use-inventory-binding-dialog-ClAkJ864.js} +8 -8
  81. package/dist/views/adjustment-template/wastage-template/actions.d.ts +60 -0
  82. package/dist/views/adjustment-template/wastage-template/table.d.ts +60 -0
  83. package/dist/views/closing-draft/components/closing-draft-dialog/ClosingDraftDialog.vue.d.ts +56 -0
  84. package/dist/views/closing-draft/composables/use-closing-draft-actions.d.ts +3 -3
  85. package/dist/views/closing-draft/composables/use-closing-draft-table.d.ts +468 -0
  86. package/dist/views/closing-draft/helpers/export-draft.helper.d.ts +9 -2
  87. package/dist/views/closing-history/ClosingHistoryView.vue.d.ts +2 -0
  88. package/dist/views/closing-template/composables/use-closing-template-actions.d.ts +4 -1
  89. package/dist/views/closing-template/helpers/import-export.helper.d.ts +5 -0
  90. package/dist/views/import/ImportView.vue.d.ts +3 -0
  91. package/dist/views/import/components/ImportDialog.vue.d.ts +2 -0
  92. package/dist/views/import/helper/import-export.helper.d.ts +4 -0
  93. package/dist/views/ingredients/components/ingredient-dialog/IngredientDialogProps.d.ts +1 -1
  94. package/dist/views/ingredients/components/ingredient-form/IngredientForm.vue.d.ts +181 -12
  95. package/dist/views/ingredients/components/ingredient-form/IngredientFormProps.d.ts +6 -0
  96. package/dist/views/ingredients/helper/import-export.helper.d.ts +4 -1
  97. package/dist/views/integration/components/netsuite/business/BusinessNetSuiteSideSheet.vue.d.ts +2 -0
  98. package/dist/views/receive-request/components/delivery-order-form/CreateForm.vue.d.ts +16 -0
  99. package/dist/views/receive-request/components/delivery-order-form/CreateFormProps.d.ts +4 -0
  100. package/dist/views/receive-request/components/delivery-order-form/EditForm.vue.d.ts +16 -0
  101. package/dist/views/receive-request/components/delivery-order-form/EditFormProps.d.ts +4 -0
  102. package/dist/views/receive-request/components/delivery-order-form/SystemTrailDialog.vue.d.ts +21 -0
  103. package/dist/views/receive-request/components/netsuite/NetSuiteTransactionChangeLog.vue.d.ts +15 -0
  104. package/dist/views/receive-request/components/transfer-details/TransferDetailsProps.d.ts +1 -0
  105. package/dist/views/receive-request/components/transfer-form/TransferForm.vue.d.ts +420 -2
  106. package/dist/views/receive-request/composables/use-process-purchase-order.d.ts +99 -0
  107. package/dist/views/receive-request/composables/use-receive-request-form.d.ts +644 -13
  108. package/dist/views/receive-request/composables/use-receive-request-table.d.ts +711 -14
  109. package/dist/views/recipe/RecipeView.vue.d.ts +1 -0
  110. package/dist/views/recipe/components/import-recipes/ImportRecipeItem.vue.d.ts +16 -0
  111. package/dist/views/recipe/components/import-recipes/ImportRecipes.vue.d.ts +2 -0
  112. package/dist/views/recipe/helper/import-recipe.d.ts +48 -0
  113. package/dist/views/stock/components/StockRecordCard.vue.d.ts +70 -1
  114. package/dist/views/stock/components/dialog/RecalculationDialog.vue.d.ts +11 -0
  115. package/dist/views/stock/components/dialog/RecalculationDialogProps.d.ts +3 -0
  116. package/dist/views/stock/components/dialog/StockAdjustmentSideSheet.vue.d.ts +20 -0
  117. package/dist/views/supplier/components/SupplierForm.vue.d.ts +8 -0
  118. package/dist/views/supplier/components/SupplierSupplyItemField.vue.d.ts +3 -0
  119. package/dist/views/supplier/composables/use-supplier-table.d.ts +4 -0
  120. package/dist/views/transfer-template/components/transfer-template-dialog/TransferTemplateDialog.vue.d.ts +8 -0
  121. package/dist/views/transfer-template/components/transfer-template-form/components/NetSuiteCustomCodeSelection.vue.d.ts +2 -0
  122. package/dist/views/transfer-template/components/transfer-template-form/composables/use-transfer-locations.d.ts +16 -0
  123. package/dist/views/transfer-template/composables/use-transfer-template-actions.d.ts +48 -0
  124. package/dist/views/transfer-template/composables/use-transfer-template-table.d.ts +48 -0
  125. package/dist/views/unit/UnitView.vue.d.ts +1 -0
  126. package/dist/views/unit/components/import-units/ImportUnitItem.vue.d.ts +12 -0
  127. package/dist/views/unit/components/import-units/ImportUnitItemProps.d.ts +6 -0
  128. package/dist/views/unit/components/import-units/ImportUnits.vue.d.ts +9 -0
  129. package/dist/views/unit/components/import-units/ImportUnitsProps.d.ts +5 -0
  130. package/dist/views/unit/helper/import-export.helper.d.ts +40 -0
  131. package/dist/views/warehouse/components/WarehouseForm.vue.d.ts +8 -0
  132. package/package.json +3 -3
  133. package/dist/App-BqaRC0Sb.js +0 -276
  134. package/dist/ClosingDraftView-sJ_zRPeo.js +0 -1687
  135. package/dist/ClosingTemplateView-cNgXHq1r.js +0 -1908
  136. package/dist/FmAdminBadge-oCnz8SW6.js +0 -34
  137. package/dist/FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-BKR8C4p_.js +0 -224
  138. package/dist/IngredientsView-CHHeAJH_.js +0 -1858
  139. package/dist/RecipeView-BukmKdVG.js +0 -621
  140. package/dist/StockForecast.vue_vue_type_style_index_0_lang-KLXSWvo5.js +0 -59
  141. package/dist/StockView-wxRCw_w-.js +0 -2087
  142. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-eqUOnJoM.js +0 -2336
  143. package/dist/UnitView-BgwDmGZo.js +0 -667
  144. package/dist/WarehouseView-BdccenhO.js +0 -1034
  145. package/dist/array-Ca8T3f_G.js +0 -44
  146. package/dist/helper/core/country/codes.d.ts +0 -255
  147. package/dist/stock-BJP5BB5b.js +0 -146
@@ -0,0 +1,636 @@
1
+ import { defineComponent as j, ref as E, onMounted as ie, resolveComponent as I, openBlock as k, createElementBlock as B, Fragment as ue, createElementVNode as x, toDisplayString as ce, createVNode as y, createCommentVNode as q, computed as F, 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, e as C, f as W, S as ge, i as be, D as ne, j as Y, n as P, F as H, r as _e, U as Re, A as he, c as we, y as oe, W as Se, X as xe, Y as Ve, u as Ce, G as Ee, I as ke, J as Ie, K as Fe, L as ae } from "./app-a9r50k3U.js";
3
+ import { useDialog as le, useSnackbar as X, useProxiedModel as se, useBreakpoints as $e } from "@feedmepos/ui-library";
4
+ import { i as De, _ as Ae } from "./is-linked-ingredient-error-fJ2TJb3z.js";
5
+ import { _ as re } from "./IngredientBindedItem.vue_vue_type_script_setup_true_lang-_2WZMZU2.js";
6
+ import { defineStore as Be, storeToRefs as Pe } from "pinia";
7
+ import { useI18n as O } from "@feedmepos/mf-common";
8
+ import { _ as Ue } from "./InventoryBindingForm.vue_vue_type_script_setup_true_lang-NDbtbtqK.js";
9
+ import { _ as Te } from "./FmCustomAttribute.vue_vue_type_script_setup_true_lang-D-IWRjRD.js";
10
+ const Me = {
11
+ key: 0,
12
+ class: "flex flex-col items-center w-full h-full gap-24"
13
+ }, Ge = { key: 1 }, Ne = { key: 0 }, Le = /* @__PURE__ */ j({
14
+ __name: "DeleteDialog",
15
+ props: {
16
+ type: {},
17
+ data: {},
18
+ message: {},
19
+ bindedItems: {}
20
+ },
21
+ setup(b) {
22
+ const f = b, v = E(f.bindedItems || []), s = E(!1);
23
+ ie(() => {
24
+ l();
25
+ });
26
+ async function l() {
27
+ var c, m;
28
+ !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);
29
+ }
30
+ return (c, m) => {
31
+ const w = I("FmSpacer"), r = I("FmCircularProgress");
32
+ return k(), B(ue, null, [
33
+ x("p", null, ce(c.message), 1),
34
+ s.value ? (k(), B("div", Me, [
35
+ y(w),
36
+ x("div", null, [
37
+ y(r, { size: "xl" })
38
+ ]),
39
+ m[0] || (m[0] = x("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary pl-8" }, "Loading...", -1)),
40
+ y(w)
41
+ ])) : (k(), B("div", Ge, [
42
+ m[2] || (m[2] = x("br", null, null, -1)),
43
+ v.value.length > 0 ? (k(), B("div", Ne, [
44
+ m[1] || (m[1] = x("p", { class: "fm-typo-en-body-lg-600" }, "Affected menu items:", -1)),
45
+ y(re, {
46
+ name: "Menu",
47
+ bindings: v.value
48
+ }, null, 8, ["bindings"])
49
+ ])) : q("", !0)
50
+ ]))
51
+ ], 64);
52
+ };
53
+ }
54
+ }), J = Be("recipeForm", function() {
55
+ const f = le(), v = X(), s = A(), l = E(!1), c = E();
56
+ function m() {
57
+ const n = {
58
+ recipe: {},
59
+ mode: C.CREATE,
60
+ show: !0,
61
+ "onUpdate:show"(o) {
62
+ c.value.show = o;
63
+ }
64
+ };
65
+ c.value = n;
66
+ }
67
+ async function w(n) {
68
+ const o = {
69
+ recipe: W(n),
70
+ mode: C.UPDATE,
71
+ show: !0,
72
+ "onUpdate:show"(u) {
73
+ c.value.show = u;
74
+ }
75
+ };
76
+ c.value = o;
77
+ }
78
+ async function r(n) {
79
+ l.value = !0;
80
+ try {
81
+ await s.deleteRecipe(n), v.open({
82
+ title: "Success",
83
+ message: `Deleted ${n.name}`,
84
+ type: "success"
85
+ });
86
+ } catch (o) {
87
+ o instanceof ge && De(o) ? f.open({
88
+ title: "Cannot delete recipe",
89
+ contentComponent: Ae,
90
+ contentComponentProps: {
91
+ subject: (n == null ? void 0 : n.name) ?? "",
92
+ items: o.errorResponse.message
93
+ },
94
+ secondaryActions: {
95
+ text: "Close",
96
+ close: !0
97
+ }
98
+ }) : console.log("unable to delete recipe", o), v.open({
99
+ title: `Cannot delete ${n == null ? void 0 : n.name}`,
100
+ message: "Please try again.",
101
+ type: "error"
102
+ }), console.error("failed to delete recipe", o);
103
+ } finally {
104
+ l.value = !1;
105
+ }
106
+ }
107
+ function p(n) {
108
+ f.open({
109
+ title: `Delete ${(n == null ? void 0 : n.name) ?? "recipe"}?`,
110
+ closeButton: !1,
111
+ primaryActions: {
112
+ text: "Delete",
113
+ close: !0,
114
+ variant: "destructive"
115
+ },
116
+ secondaryActions: {
117
+ text: "Cancel",
118
+ close: !0
119
+ },
120
+ contentComponent: Le,
121
+ contentComponentProps: {
122
+ type: "menu",
123
+ data: n,
124
+ message: "You may not be able to delete this recipe if it is linked in any of the inventory modules."
125
+ }
126
+ }).onPrimary(() => r(n));
127
+ }
128
+ return {
129
+ createRecipe: m,
130
+ updateRecipe: w,
131
+ deleteRecipe: p,
132
+ recipeDialogProps: c,
133
+ recipeViewLoading: l
134
+ };
135
+ });
136
+ function ze() {
137
+ const { updateRecipe: b, deleteRecipe: f } = J(), v = A(), { t: s } = O();
138
+ async function l(r, p) {
139
+ const n = W(p);
140
+ if (r === Y.Edit) {
141
+ await b(n);
142
+ return;
143
+ }
144
+ if (r === Y.Delete) {
145
+ await f(n);
146
+ return;
147
+ }
148
+ }
149
+ function c(r, p) {
150
+ const n = r.filter((i) => i.type === H.enum.SKU), o = r.filter(
151
+ (i) => i.type === H.enum.SKU_GROUP
152
+ ), u = r.filter((i) => i.type === H.enum.RECIPE);
153
+ return [
154
+ ...n.map((i) => ({ ...i, recipeIds: [...p] })),
155
+ ...o.map((i) => ({ ...i, isGroup: !0, recipeIds: [...p] })),
156
+ ...u.filter((i) => v.recipeById[i.id] && !p.has(i.id)).flatMap(
157
+ (i) => c(v.recipeById[i.id].contains, /* @__PURE__ */ new Set([...p, i.id]))
158
+ )
159
+ ];
160
+ }
161
+ const m = [
162
+ {
163
+ accessorKey: "recipe",
164
+ header: () => s("inventory.recipe.name"),
165
+ size: 400
166
+ },
167
+ {
168
+ accessorKey: "ingredients",
169
+ header: () => s("inventory.recipe.ingredients"),
170
+ size: "auto"
171
+ },
172
+ {
173
+ id: "action",
174
+ header: "",
175
+ cell(r) {
176
+ return be(
177
+ [ne[Y.Edit], ne[Y.Delete]],
178
+ (p) => {
179
+ l(p, r.row.original.original);
180
+ }
181
+ );
182
+ },
183
+ enableSorting: !1,
184
+ size: 40,
185
+ meta: {
186
+ cellClass: "",
187
+ headerClass: ""
188
+ }
189
+ }
190
+ ];
191
+ function w(r) {
192
+ const p = A();
193
+ return r.map((n) => ({
194
+ recipe: n.name,
195
+ ingredients: c(n.contains, /* @__PURE__ */ new Set([n._id])).map((o) => {
196
+ var i, S, e, d, _, h;
197
+ if (o.isGroup) {
198
+ const R = p.skuGroupById[o.id];
199
+ 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)})`;
200
+ }
201
+ const u = p.skuById[o.id];
202
+ 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;
203
+ }).filter((o) => o).join(", "),
204
+ original: n
205
+ }));
206
+ }
207
+ return { columnDefs: m, formatRowData: w };
208
+ }
209
+ const Ke = { class: "flex flex-col gap-40" }, Ye = {
210
+ key: 0,
211
+ 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"
212
+ }, je = {
213
+ key: 0,
214
+ class: "flex flex-col items-center w-full h-full gap-24"
215
+ }, Oe = { key: 1 }, He = { class: "mt-32" }, qe = /* @__PURE__ */ j({
216
+ __name: "RecipeForm",
217
+ props: {
218
+ mode: {},
219
+ modelValue: {},
220
+ disabled: { type: Boolean }
221
+ },
222
+ emits: ["update:modelValue", "click:submit"],
223
+ setup(b, { expose: f, emit: v }) {
224
+ var R;
225
+ const s = b, l = v, c = we(), { t: m } = O(), w = F({
226
+ get() {
227
+ var t;
228
+ return ((t = s.modelValue) == null ? void 0 : t.name) ?? "";
229
+ },
230
+ set(t) {
231
+ const a = s.modelValue ?? {};
232
+ a.name = t, l("update:modelValue", a);
233
+ }
234
+ }), r = F({
235
+ get() {
236
+ var t;
237
+ return ((t = s.modelValue) == null ? void 0 : t.contains) ?? [];
238
+ },
239
+ set(t) {
240
+ const a = s.modelValue ?? {};
241
+ a.contains = t, l("update:modelValue", a);
242
+ }
243
+ }), p = F({
244
+ get() {
245
+ var t;
246
+ return ((t = s.modelValue) == null ? void 0 : t.customAttributes) ?? {};
247
+ },
248
+ set(t) {
249
+ const a = s.modelValue ? {
250
+ ...s.modelValue
251
+ } : {};
252
+ a.customAttributes = t, l("update:modelValue", a);
253
+ }
254
+ });
255
+ function n() {
256
+ l("click:submit");
257
+ }
258
+ const o = E();
259
+ f({
260
+ validateInputs: () => {
261
+ var t, a;
262
+ (a = (t = o.value) == null ? void 0 : t.validateInputs) == null || a.call(t);
263
+ },
264
+ resetInputsValidation: () => {
265
+ var t, a;
266
+ (a = (t = o.value) == null ? void 0 : t.resetInputsValidation) == null || a.call(t);
267
+ },
268
+ resetInputs: () => {
269
+ var t, a;
270
+ (a = (t = o.value) == null ? void 0 : t.resetInputs) == null || a.call(t);
271
+ }
272
+ });
273
+ const u = A(), i = E([]), S = E(!1), e = E(!1);
274
+ de(S, async (t) => {
275
+ d(t);
276
+ });
277
+ async function d(t) {
278
+ var a, $;
279
+ 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);
280
+ }
281
+ const _ = F(
282
+ () => u.recipes.map((t) => ({ label: t.name, value: t.name }))
283
+ ), h = E((R = s.modelValue) == null ? void 0 : R.name);
284
+ return (t, a) => {
285
+ const $ = I("FmTextField"), D = I("FmCard"), N = I("FmSwitch"), M = I("FmSpacer"), L = I("FmCircularProgress"), T = I("FmForm");
286
+ return k(), G(T, {
287
+ ref_key: "formRef",
288
+ ref: o,
289
+ onValidationSuccess: n
290
+ }, {
291
+ default: U(() => [
292
+ x("div", Ke, [
293
+ y($, {
294
+ disabled: t.disabled,
295
+ label: g(m)("inventory.recipe.name"),
296
+ "model-value": w.value,
297
+ "onUpdate:modelValue": a[0] || (a[0] = (V) => w.value = V),
298
+ rules: [
299
+ g(_e)(),
300
+ g(Re)(_.value, h.value, (V) => `[${V.value}] already exists`)
301
+ ],
302
+ "label-mark": "required"
303
+ }, null, 8, ["disabled", "label", "model-value", "rules"]),
304
+ y(D, {
305
+ variant: "outlined",
306
+ class: "p-16"
307
+ }, {
308
+ default: U(() => {
309
+ var V;
310
+ return [
311
+ y(Ue, {
312
+ id: (V = t.modelValue) == null ? void 0 : V._id,
313
+ disabled: t.disabled,
314
+ "model-value": r.value,
315
+ "onUpdate:modelValue": a[1] || (a[1] = (z) => r.value = z),
316
+ rules: [g(he)(1)],
317
+ "enable-ingredient-group": g(c).enableIngredientGroup
318
+ }, null, 8, ["id", "disabled", "model-value", "rules", "enable-ingredient-group"])
319
+ ];
320
+ }),
321
+ _: 1
322
+ })
323
+ ]),
324
+ t.mode !== g(C).CREATE ? (k(), B("div", Ye, [
325
+ y(N, {
326
+ label: "Show binded items",
327
+ modelValue: S.value,
328
+ "onUpdate:modelValue": a[2] || (a[2] = (V) => S.value = V),
329
+ "label-placement": "right",
330
+ disabled: e.value
331
+ }, null, 8, ["modelValue", "disabled"]),
332
+ e.value ? (k(), B("div", je, [
333
+ y(M),
334
+ x("div", null, [
335
+ y(L, { size: "xl" })
336
+ ]),
337
+ a[4] || (a[4] = x("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary pl-8" }, "Loading...", -1)),
338
+ y(M)
339
+ ])) : S.value && i.value.length ? (k(), B("div", Oe, [
340
+ y(re, {
341
+ name: "Menu",
342
+ bindings: i.value
343
+ }, null, 8, ["bindings"])
344
+ ])) : q("", !0)
345
+ ])) : q("", !0),
346
+ x("div", He, [
347
+ y(Te, {
348
+ entity: "inventoryRecipe",
349
+ modelValue: p.value,
350
+ "onUpdate:modelValue": a[3] || (a[3] = (V) => p.value = V)
351
+ }, null, 8, ["modelValue"])
352
+ ])
353
+ ]),
354
+ _: 1
355
+ }, 512);
356
+ };
357
+ }
358
+ }), Je = { class: "flex gap-4" }, We = /* @__PURE__ */ j({
359
+ __name: "RecipeDialog",
360
+ props: {
361
+ show: { type: Boolean },
362
+ recipe: {},
363
+ mode: { default: C.READ }
364
+ },
365
+ emits: ["update:show"],
366
+ setup(b) {
367
+ const f = b, v = A(), s = X(), { t: l } = O(), c = se(f, "show"), m = se(f, "recipe"), w = F(() => {
368
+ switch (f.mode) {
369
+ case C.READ:
370
+ return "";
371
+ case C.UPDATE:
372
+ return l("inventory.recipe.update.title");
373
+ case C.CREATE:
374
+ return l("inventory.recipe.create.title");
375
+ }
376
+ return "";
377
+ }), r = F(() => {
378
+ switch (f.mode) {
379
+ case C.READ:
380
+ return "";
381
+ case C.UPDATE:
382
+ return l("common.save");
383
+ case C.CREATE:
384
+ return l("common.add");
385
+ }
386
+ return "";
387
+ }), p = E(), n = E(!1);
388
+ async function o() {
389
+ n.value = !0;
390
+ try {
391
+ const e = W(m.value);
392
+ e.precision ?? (e.precision = 0), e.measurements ?? (e.measurements = []), await v.createRecipe(e), c.value = !1, s.open({
393
+ title: l("inventory.common.success"),
394
+ message: l("inventory.recipe.create.success", { name: m.value.name }),
395
+ type: "success"
396
+ });
397
+ } catch (e) {
398
+ e instanceof oe || s.open({
399
+ title: l("inventory.recipe.create.error.title"),
400
+ message: l("inventory.recipe.create.error.message"),
401
+ type: "error"
402
+ });
403
+ } finally {
404
+ n.value = !1;
405
+ }
406
+ }
407
+ async function u() {
408
+ n.value = !0;
409
+ try {
410
+ await v.updateRecipe(m.value), c.value = !1, s.open({
411
+ title: l("inventory.common.success"),
412
+ message: l("inventory.recipe.update.success", { name: m.value.name }),
413
+ type: "success"
414
+ });
415
+ } catch (e) {
416
+ e instanceof oe || s.open({
417
+ title: l("inventory.recipe.update.error.title"),
418
+ message: l("inventory.recipe.update.error.message"),
419
+ type: "error"
420
+ });
421
+ } finally {
422
+ n.value = !1;
423
+ }
424
+ }
425
+ function i() {
426
+ var e, d;
427
+ (d = (e = p.value) == null ? void 0 : e.validateInputs) == null || d.call(e);
428
+ }
429
+ function S() {
430
+ switch (f.mode) {
431
+ case C.READ:
432
+ return;
433
+ case C.UPDATE:
434
+ return u();
435
+ case C.CREATE:
436
+ return o();
437
+ }
438
+ }
439
+ return (e, d) => {
440
+ const _ = I("FmButton"), h = I("FmSideSheet");
441
+ return k(), G(h, {
442
+ "model-value": g(c),
443
+ "onUpdate:modelValue": d[3] || (d[3] = (R) => te(c) ? c.value = R : null),
444
+ header: w.value,
445
+ "close-button": "",
446
+ "dismiss-away": "",
447
+ "max-width": 500
448
+ }, {
449
+ "side-sheet-footer": U(() => [
450
+ x("div", Je, [
451
+ y(_, {
452
+ loading: n.value,
453
+ label: r.value,
454
+ onClick: i
455
+ }, null, 8, ["loading", "label"]),
456
+ y(_, {
457
+ disabled: n.value,
458
+ label: g(l)("common.close"),
459
+ variant: "tertiary",
460
+ onClick: d[2] || (d[2] = (R) => c.value = !1)
461
+ }, null, 8, ["disabled", "label"])
462
+ ])
463
+ ]),
464
+ default: U(() => [
465
+ y(qe, {
466
+ class: "w-full",
467
+ ref_key: "hasValidationExpose",
468
+ ref: p,
469
+ modelValue: g(m),
470
+ "onUpdate:modelValue": d[0] || (d[0] = (R) => te(m) ? m.value = R : null),
471
+ mode: e.mode,
472
+ disabled: n.value,
473
+ "onClick:submit": d[1] || (d[1] = (R) => S())
474
+ }, null, 8, ["modelValue", "mode", "disabled"])
475
+ ]),
476
+ _: 1
477
+ }, 8, ["model-value", "header"]);
478
+ };
479
+ }
480
+ });
481
+ function Xe(b) {
482
+ return !b || Object.keys(b).length === 0 ? "" : Object.entries(b).map(([f, v]) => `${f}: ${v}`).join(", ");
483
+ }
484
+ function Qe() {
485
+ const b = A(), f = b.recipes, v = b.recipeById, s = b.skuById, l = b.skuGroupById, c = f.flatMap((r, p) => {
486
+ var o;
487
+ const n = Xe(r.customAttributes);
488
+ if ((o = r.contains) != null && o.length) {
489
+ const u = r.contains.filter((e) => e.type === "RECIPE"), i = r.contains.filter((e) => e.type === "SKU"), S = r.contains.filter((e) => e.type === "SKU_GROUP");
490
+ return [
491
+ ...p === 0 ? [] : [["", "", "", "", "", "", ""]],
492
+ ...u.map(
493
+ (e, d) => {
494
+ var _;
495
+ return [
496
+ d === 0 ? r.name : "",
497
+ "RECIPE",
498
+ "",
499
+ (_ = v[e.id]) == null ? void 0 : _.name,
500
+ P(e.amount),
501
+ "UNIT",
502
+ d === 0 ? n : ""
503
+ ];
504
+ }
505
+ ),
506
+ ...i.map(
507
+ (e, d) => {
508
+ var _, h, R, t;
509
+ return [
510
+ !u.length && d === 0 ? r.name : "",
511
+ "INGREDIENT",
512
+ (_ = s[e.id]) == null ? void 0 : _.code,
513
+ (h = s[e.id]) == null ? void 0 : h.name,
514
+ P(e.amount),
515
+ e.measurement ? e.measurement.abbrev : (t = (R = s[e.id]) == null ? void 0 : R.unit) == null ? void 0 : t.abbrev,
516
+ !u.length && d === 0 ? n : ""
517
+ ];
518
+ }
519
+ ),
520
+ ...S.map(
521
+ (e, d) => {
522
+ var _, h;
523
+ return [
524
+ u.length === 0 && i.length === 0 && d === 0 ? r.name : "",
525
+ "SKU_GROUP",
526
+ ((_ = l[e.id]) == null ? void 0 : _.ref) || "",
527
+ (h = l[e.id]) == null ? void 0 : h.name,
528
+ P(e.amount),
529
+ "UNIT",
530
+ u.length === 0 && i.length === 0 && d === 0 ? n : ""
531
+ ];
532
+ }
533
+ )
534
+ ];
535
+ }
536
+ return [
537
+ ...p === 0 ? [] : [["", "", "", "", "", "", ""]],
538
+ [r.name, "No bindings", "", "", "", "", n]
539
+ ];
540
+ }), w = Se(c, ["Name", "Type", "Code", "Item", "Amount", "Unit", "Custom Attributes"]);
541
+ xe(w, `RECIPE_${Ve(/* @__PURE__ */ new Date(), "-", "-")}.xlsx`);
542
+ }
543
+ 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" }, dt = /* @__PURE__ */ j({
544
+ __name: "RecipeView",
545
+ setup(b) {
546
+ const f = A(), v = F(() => f.recipes), s = Ce(), { createRecipe: l, updateRecipe: c } = J(), { recipeDialogProps: m, recipeViewLoading: w } = Pe(J()), { columnDefs: r, formatRowData: p } = ze(), n = F(() => p(v.value));
547
+ le(), X(), E(!1);
548
+ function o(R) {
549
+ if (R === "add")
550
+ return l();
551
+ if (R === "export")
552
+ return Qe();
553
+ }
554
+ const u = E(""), i = F(() => w.value), { breakpoints: S } = $e(), e = F(() => S.value.xs || S.value.sm), d = F(() => e.value ? 10 : 20), _ = Ee(), { t: h } = O();
555
+ return (R, t) => {
556
+ const a = I("FmTable");
557
+ return k(), G(ke, {
558
+ title: g(h)("inventory.recipe.title"),
559
+ actions: [
560
+ {
561
+ label: g(h)("inventory.recipe.create.title"),
562
+ value: "add",
563
+ isPrimary: !0,
564
+ prependIcon: "add"
565
+ },
566
+ { label: g(h)("common.export"), value: "export", isPrimary: !1 }
567
+ ],
568
+ "onClick:action": o
569
+ }, {
570
+ default: U(() => [
571
+ x("div", {
572
+ class: me([
573
+ "flex flex-col gap-8 max-h-full",
574
+ {
575
+ "p-0": e.value,
576
+ "px-24 ": !e.value
577
+ }
578
+ ])
579
+ }, [
580
+ y(Ie, {
581
+ searchable: "",
582
+ search: u.value,
583
+ "onUpdate:search": t[0] || (t[0] = ($) => u.value = $)
584
+ }, null, 8, ["search"]),
585
+ (k(), G(a, {
586
+ style: pe(g(_).tableHeight),
587
+ "column-defs": g(r),
588
+ "row-data": n.value,
589
+ "search-value": u.value,
590
+ loading: !g(s)._currentLocation || i.value,
591
+ onRowClick: t[1] || (t[1] = ($) => g(c)($.original.original)),
592
+ key: v.value.length,
593
+ "page-size": d.value
594
+ }, {
595
+ "list-row": U(($) => [
596
+ y(Fe, {
597
+ row: $,
598
+ onRowClick: (D) => g(c)(D.original)
599
+ }, {
600
+ default: U((D) => {
601
+ var N, M, L, T, V, z, Q, Z, K, ee;
602
+ return [
603
+ x("div", Ze, [
604
+ x("div", et, [
605
+ y(g(ae), {
606
+ render: (L = (M = (N = D.recipe) == null ? void 0 : N.column) == null ? void 0 : M.columnDef) == null ? void 0 : L.cell,
607
+ props: (V = (T = D.recipe) == null ? void 0 : T.getContext) == null ? void 0 : V.call(T)
608
+ }, null, 8, ["render", "props"])
609
+ ]),
610
+ x("div", tt, [
611
+ y(g(ae), {
612
+ render: (Z = (Q = (z = D.ingredients) == null ? void 0 : z.column) == null ? void 0 : Q.columnDef) == null ? void 0 : Z.cell,
613
+ props: (ee = (K = D.ingredients) == null ? void 0 : K.getContext) == null ? void 0 : ee.call(K)
614
+ }, null, 8, ["render", "props"])
615
+ ])
616
+ ])
617
+ ];
618
+ }),
619
+ _: 2
620
+ }, 1032, ["row", "onRowClick"])
621
+ ]),
622
+ _: 1
623
+ }, 8, ["style", "column-defs", "row-data", "search-value", "loading", "page-size"]))
624
+ ], 2),
625
+ (k(), G(fe, { to: "body" }, [
626
+ y(We, ve(ye(g(m))), null, 16)
627
+ ]))
628
+ ]),
629
+ _: 1
630
+ }, 8, ["title", "actions"]);
631
+ };
632
+ }
633
+ });
634
+ export {
635
+ dt as default
636
+ };