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

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 (114) hide show
  1. package/dist/{App-Dlnr4iYC.js → App-KmP0TzgM.js} +3 -3
  2. package/dist/{ApprovalView-Txmz-hCz.js → ApprovalView-BfXRpwMD.js} +5 -5
  3. package/dist/{BindingsDialog-BXnuWCaK.js → BindingsDialog-DNYn8rOv.js} +5 -5
  4. package/dist/{BindingsPicker-CO2_vfjx.js → BindingsPicker-C_BwhQ6B.js} +3 -3
  5. package/dist/{BindingsTable-amypZb8r.js → BindingsTable-BUNvU001.js} +5 -5
  6. package/dist/{ClosingDraftView-Kegm5V38.js → ClosingDraftView-D7eJrwDC.js} +139 -139
  7. package/dist/{ClosingHistoryView-D9VXx7c6.js → ClosingHistoryView-LPBqAMLm.js} +36 -36
  8. package/dist/{ClosingTemplateView-PYKa8KDQ.js → ClosingTemplateView-GvF2Tvny.js} +14 -14
  9. package/dist/{DeliveryOrderPrintPreview-BBUliD2T.js → DeliveryOrderPrintPreview-CFEuEOxp.js} +7 -7
  10. package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-DhJjC8RN.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-BWq4rWaC.js} +17 -17
  11. package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-D0z-41dr.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-uIJ2INOr.js} +2 -2
  12. package/dist/{FmMultiselectDialog-DTYS42tQ.js → FmMultiselectDialog-B7UPOXEa.js} +1 -1
  13. package/dist/{FmMultiselectDialog-CswtC1AP.js → FmMultiselectDialog-CdBuD2tB.js} +16 -16
  14. package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-DXkTWOFj.js → FmUnitInput.vue_vue_type_script_setup_true_lang-DZPqBIno.js} +11 -11
  15. package/dist/{ImportView-DvECDSkN.js → ImportView-DABcONRX.js} +6 -6
  16. package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-Dg0gQJFw.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-Bgs6kzxt.js} +1 -1
  17. package/dist/{IngredientGroupView-PYLW-jdb.js → IngredientGroupView-Dyw0SWa2.js} +5 -5
  18. package/dist/{IngredientsView-fzMFu5Kd.js → IngredientsView-3svDZ3pM.js} +14 -14
  19. package/dist/{IntegrationView-BJraR9yF.js → IntegrationView-B5Ql6B4Z.js} +12 -12
  20. package/dist/{InventoryBindingForm-BCLg-OVi.js → InventoryBindingForm-BnbjaC3n.js} +1 -1
  21. package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-BAoFz9Xy.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-CU0p8OtH.js} +14 -14
  22. package/dist/{InventoryBindingSummary-BaihKVNj.js → InventoryBindingSummary-BWYqDQFW.js} +1 -1
  23. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-sxY8hdeR.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-DO47als9.js} +1 -1
  24. package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-BhOwDBiq.js → PremiumBadge.vue_vue_type_script_setup_true_lang-B6jIGOQk.js} +2 -2
  25. package/dist/{PublishView-BMmcC0Vq.js → PublishView-X78B9ips.js} +8 -8
  26. package/dist/{PurchaseOrderPrintPreview-BWl9FIys.js → PurchaseOrderPrintPreview-BcBjpdKk.js} +11 -11
  27. package/dist/{ReceiveRequestView-Cn5w0cDy.js → ReceiveRequestView-jCXmQuZN.js} +19 -19
  28. package/dist/RecipeView-BQN7W4_n.js +646 -0
  29. package/dist/{StockView-oxOQh8eg.js → StockView-DBI_vEFM.js} +881 -860
  30. package/dist/{SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-JGzokQMQ.js → SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-BowCyYAA.js} +1 -1
  31. package/dist/{SupplierView-TSbv1g43.js → SupplierView-2OV8kRmK.js} +11 -11
  32. package/dist/{SurchargeView-CZDaMAk2.js → SurchargeView-B_FvfxFV.js} +6 -6
  33. package/dist/{SystemTrailDialog.vue_vue_type_script_setup_true_lang-BH90OuDB.js → SystemTrailDialog.vue_vue_type_script_setup_true_lang-B-yk6Tpp.js} +2 -2
  34. package/dist/{TemplatePublishDialog.vue_vue_type_script_setup_true_lang-D0geyvW9.js → TemplatePublishDialog.vue_vue_type_script_setup_true_lang-BN52gPS6.js} +1 -1
  35. package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-Dxm9e7s0.js → TransferDetails.vue_vue_type_script_setup_true_lang-CJeTHWlX.js} +72 -72
  36. package/dist/{TransferTemplateView-Ds4UfF6z.js → TransferTemplateView-CTZzJO_r.js} +15 -15
  37. package/dist/{UnitView-DNfslwNA.js → UnitView-D4L2o3mi.js} +6 -6
  38. package/dist/{WarehouseView-DkcPy1mF.js → WarehouseView-D0YRCoO-.js} +5 -5
  39. package/dist/{WastageTemplateView-CP_sQsdU.js → WastageTemplateView-BnO927Yb.js} +60 -60
  40. package/dist/api/inventory.d.ts +36 -126
  41. package/dist/api/netsuite.d.ts +1 -8
  42. package/dist/{app-Do7d9F2j.js → app-DDU7NeKU.js} +6379 -7340
  43. package/dist/app.d.ts +0 -200
  44. package/dist/app.js +1 -1
  45. package/dist/{closing-template-BidraMN0.js → closing-template-Cbj_owJh.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-xmQqiCBU.js → date2-CdIVvJMO.js} +1 -1
  50. package/dist/{dayjs.min-C2InbamH.js → dayjs.min-x0l3YFuh.js} +16 -16
  51. package/dist/{decimal-BHD_uD50.js → decimal-BmI-vHdY.js} +2 -2
  52. package/dist/{defineDeepModel-CoBQILOz.js → defineDeepModel-DVq8J3K0.js} +1 -1
  53. package/dist/{duplicate-template-BfJ6g_ux.js → duplicate-template-6sxuQt7G.js} +1 -1
  54. package/dist/{feature-BsP8KV0O.js → feature-CBAV6rwn.js} +89 -94
  55. package/dist/{format-time-from-id-CLLM4KoK.js → format-time-from-id-gonrB7zJ.js} +1 -1
  56. package/dist/{format-unit-display-BLtS1XcY.js → format-unit-display-UX-3QtOQ.js} +10 -10
  57. package/dist/{import-export.helper-DQvkoWnj.js → import-export.helper-D3XtnI5X.js} +7 -7
  58. package/dist/{index-p8EMSeUp.js → index-Bbs6bv6_.js} +3 -3
  59. package/dist/{index-CUm44l1O.js → index-DYB4AFCJ.js} +1 -1
  60. package/dist/{index-CrS7Yig1.js → index-VxOfv9io.js} +1412 -1471
  61. package/dist/{lodash-BNImU2Ov.js → lodash-xDP15O6H.js} +1 -1
  62. package/dist/{netsuite-DpB7HK5Q.js → netsuite-04rSEWQB.js} +60 -60
  63. package/dist/{purchase-order-template-DgbM99CO.js → purchase-order-template-Cc3-mrLi.js} +1 -1
  64. package/dist/{rules-CmGXcEkE.js → rules-CttmEqBJ.js} +18 -18
  65. package/dist/{stock-C1-SWNBT.js → stock-DJB96pzi.js} +1 -1
  66. package/dist/{stock-CUjopFIE.js → stock-VzLu7DTu.js} +3 -3
  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-BLGyTOqT.js → supplier-xpNYUwPV.js} +2 -2
  71. package/dist/{surcharge-BA-bc8RT.js → surcharge-CjnXVWpE.js} +1 -1
  72. package/dist/tsconfig.app.tsbuildinfo +1 -1
  73. package/dist/{use-ingredient-select-dialog-BDMeEnJC.js → use-ingredient-select-dialog-RroJA5ty.js} +2 -2
  74. package/dist/{use-inventory-binding-dialog-CmAOk0d6.js → use-inventory-binding-dialog-kecoeAsI.js} +2 -2
  75. package/dist/{use-template-enabled-locations-2-DSQY7vNB.js → use-template-enabled-locations-2-BKrIbHc5.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/dialog/AdjustedItemForm.vue.d.ts +2 -16
  96. package/dist/views/transfer-template/components/transfer-template-dialog/TransferTemplateDialog.vue.d.ts +2 -16
  97. package/dist/views/transfer-template/components/transfer-template-form/components/NetSuiteCustomCodeSelection.vue.d.ts +2 -16
  98. package/dist/views/transfer-template/components/transfer-template-form/components/TransferTemplateItemTable.vue.d.ts +2 -16
  99. package/dist/views/transfer-template/components/transfer-template-form/composables/use-transfer-template-items.d.ts +1 -8
  100. package/dist/views/transfer-template/composables/use-netsuite-custom-field.d.ts +3 -24
  101. package/dist/views/transfer-template/composables/use-transfer-template-actions.d.ts +12 -96
  102. package/dist/views/transfer-template/composables/use-transfer-template-table.d.ts +12 -96
  103. package/dist/{vue-i18n-CIhYwCeG.js → vue-i18n-DsZSVX8N.js} +328 -328
  104. package/dist/{xlsx-BcQjo8NU.js → xlsx-7KX7f3af.js} +1 -1
  105. package/dist/{xlsx.util-GOcrvAJZ.js → xlsx.util-MseAEQJ5.js} +1 -1
  106. package/package.json +3 -3
  107. package/dist/RecipeView-BW5KCmkx.js +0 -1557
  108. package/dist/views/ingredients/components/inventory-binding/v2/InventoryBindingFormV2.vue.d.ts +0 -169
  109. package/dist/views/ingredients/components/inventory-binding/v2/components/InventoryBindingAlternative.vue.d.ts +0 -43
  110. package/dist/views/ingredients/components/inventory-binding/v2/components/InventoryBindingRule.vue.d.ts +0 -25
  111. package/dist/views/ingredients/components/inventory-binding/v2/components/InventoryRecipeBindingV2Field.vue.d.ts +0 -125
  112. package/dist/views/ingredients/components/inventory-binding/v2/components/InventorySkuBindingV2Field.vue.d.ts +0 -129
  113. package/dist/views/ingredients/components/inventory-binding/v2/composables/use-inventory-binding-alternative-table.d.ts +0 -30
  114. package/dist/views/ingredients/components/inventory-binding/v2/composables/use-inventory-binding-dialog.d.ts +0 -4
@@ -1,1557 +0,0 @@
1
- import { defineComponent as O, ref as D, onMounted as he, resolveComponent as I, openBlock as w, createElementBlock as A, Fragment as ee, createElementVNode as _, toDisplayString as K, createVNode as h, createCommentVNode as S, computed as R, unref as m, normalizeClass as fe, withCtx as N, h as G, createBlock as P, renderList as se, watch as Ve, isRef as re, normalizeStyle as ke, Teleport as Be, normalizeProps as we, guardReactiveProps as xe } from "vue";
2
- import { a as z, c as oe, S as Fe, F as Z, w as Ce, x as Ie, j as de, u as Ae } from "./app-Do7d9F2j.js";
3
- import { useDialog as ie, useSnackbar as le, components as J, useProxiedModel as ue, useBreakpoints as Re } from "@feedmepos/ui-library";
4
- import { i as $e, _ as Se } from "./is-linked-ingredient-error-fJ2TJb3z.js";
5
- import { F as U } from "./form-mode.enum-BKiNVH6A.js";
6
- import { _ as ve } from "./IngredientBindedItem.vue_vue_type_script_setup_true_lang-Dg0gQJFw.js";
7
- import { defineStore as Ee, storeToRefs as Te } from "pinia";
8
- import { D as me, R as X } from "./row-action.enum-BcW_L_nE.js";
9
- import { c as Ue } from "./component-DpCUABT3.js";
10
- import { a as j, f as De, h as ye, d as Pe, I as Me, A as ne, U as be, R as Ge } from "./rules-CmGXcEkE.js";
11
- import { useI18n as Y, useCoreStore as Ne } from "@feedmepos/mf-common";
12
- import { u as ze, _ as Le } from "./SingleColumnLayout.vue_vue_type_script_setup_true_lang-CWZkVCAj.js";
13
- import { _ as Ke } from "./InventoryBindingForm.vue_vue_type_script_setup_true_lang-BAoFz9Xy.js";
14
- import "./dayjs.min-C2InbamH.js";
15
- import { a as ce } from "./FmMultiselectDialog-CswtC1AP.js";
16
- import { d as ge } from "./defineDeepModel-CoBQILOz.js";
17
- import { L as je, P as Oe, D as Ye } from "./app-DiX-EfV6.js";
18
- import { _ as qe, c as He, d as We } from "./FmUnitInput.vue_vue_type_script_setup_true_lang-DXkTWOFj.js";
19
- import { u as Je } from "./FmMultiselectDialog-DTYS42tQ.js";
20
- import { u as Qe } from "./vue-i18n-CIhYwCeG.js";
21
- import { F as Xe, u as Ze } from "./feature-BsP8KV0O.js";
22
- import { _ as en } from "./FmCustomAttribute.vue_vue_type_script_setup_true_lang-D-IWRjRD.js";
23
- import { _ as nn, F as pe } from "./TableActionableRow.vue_vue_type_script_setup_true_lang-Ca_eYa8-.js";
24
- import { b as tn, d as on } from "./xlsx.util-GOcrvAJZ.js";
25
- import { f as ln } from "./date2-xmQqiCBU.js";
26
- import { _ as an } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-D0z-41dr.js";
27
- const sn = {
28
- key: 0,
29
- class: "flex flex-col items-center w-full h-full gap-24"
30
- }, rn = { key: 1 }, dn = { key: 0 }, un = /* @__PURE__ */ O({
31
- __name: "DeleteDialog",
32
- props: {
33
- type: {},
34
- data: {},
35
- message: {},
36
- bindedItems: {}
37
- },
38
- setup(f) {
39
- const k = f, v = D(k.bindedItems || []), d = D(!1);
40
- he(() => {
41
- r();
42
- });
43
- async function r() {
44
- var c, l;
45
- !d.value && ((c = k.data) != null && c._id) && (d.value = !0, v.value = await z().getAffectedMenu((l = k.data) == null ? void 0 : l._id), d.value = !1);
46
- }
47
- return (c, l) => {
48
- const a = I("FmSpacer"), n = I("FmCircularProgress");
49
- return w(), A(ee, null, [
50
- _("p", null, K(c.message), 1),
51
- d.value ? (w(), A("div", sn, [
52
- h(a),
53
- _("div", null, [
54
- h(n, { size: "xl" })
55
- ]),
56
- l[0] || (l[0] = _("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary pl-8" }, "Loading...", -1)),
57
- h(a)
58
- ])) : (w(), A("div", rn, [
59
- l[2] || (l[2] = _("br", null, null, -1)),
60
- v.value.length > 0 ? (w(), A("div", dn, [
61
- l[1] || (l[1] = _("p", { class: "fm-typo-en-body-lg-600" }, "Affected menu items:", -1)),
62
- h(ve, {
63
- name: "Menu",
64
- bindings: v.value
65
- }, null, 8, ["bindings"])
66
- ])) : S("", !0)
67
- ]))
68
- ], 64);
69
- };
70
- }
71
- }), te = Ee("recipeForm", function() {
72
- const k = ie(), v = le(), d = z(), r = D(!1), c = D();
73
- function l() {
74
- const e = {
75
- recipe: {},
76
- mode: U.CREATE,
77
- show: !0,
78
- "onUpdate:show"(i) {
79
- c.value.show = i;
80
- }
81
- };
82
- c.value = e;
83
- }
84
- async function a(e) {
85
- const i = {
86
- recipe: oe(e),
87
- mode: U.UPDATE,
88
- show: !0,
89
- "onUpdate:show"(y) {
90
- c.value.show = y;
91
- }
92
- };
93
- c.value = i;
94
- }
95
- async function n(e) {
96
- r.value = !0;
97
- try {
98
- await d.deleteRecipe(e), v.open({
99
- title: "Success",
100
- message: `Deleted ${e.name}`,
101
- type: "success"
102
- });
103
- } catch (i) {
104
- i instanceof Fe && $e(i) ? k.open({
105
- title: "Cannot delete recipe",
106
- contentComponent: Se,
107
- contentComponentProps: {
108
- subject: (e == null ? void 0 : e.name) ?? "",
109
- items: i.errorResponse.message
110
- },
111
- secondaryActions: {
112
- text: "Close",
113
- close: !0
114
- }
115
- }) : console.log("unable to delete recipe", i), v.open({
116
- title: `Cannot delete ${e == null ? void 0 : e.name}`,
117
- message: "Please try again.",
118
- type: "error"
119
- }), console.error("failed to delete recipe", i);
120
- } finally {
121
- r.value = !1;
122
- }
123
- }
124
- function t(e) {
125
- k.open({
126
- title: `Delete ${(e == null ? void 0 : e.name) ?? "recipe"}?`,
127
- closeButton: !1,
128
- primaryActions: {
129
- text: "Delete",
130
- close: !0,
131
- variant: "destructive"
132
- },
133
- secondaryActions: {
134
- text: "Cancel",
135
- close: !0
136
- },
137
- contentComponent: un,
138
- contentComponentProps: {
139
- type: "menu",
140
- data: e,
141
- message: "You may not be able to delete this recipe if it is linked in any of the inventory modules."
142
- }
143
- }).onPrimary(() => n(e));
144
- }
145
- return {
146
- createRecipe: l,
147
- updateRecipe: a,
148
- deleteRecipe: t,
149
- recipeDialogProps: c,
150
- recipeViewLoading: r
151
- };
152
- });
153
- function mn() {
154
- const { updateRecipe: f, deleteRecipe: k } = te(), v = z(), { t: d } = Y();
155
- async function r(n, t) {
156
- const e = oe(t);
157
- if (n === X.Edit) {
158
- await f(e);
159
- return;
160
- }
161
- if (n === X.Delete) {
162
- await k(e);
163
- return;
164
- }
165
- }
166
- function c(n, t) {
167
- const e = n.filter((s) => s.type === Z.enum.SKU), i = n.filter(
168
- (s) => s.type === Z.enum.SKU_GROUP
169
- ), y = n.filter((s) => s.type === Z.enum.RECIPE);
170
- return [
171
- ...e.map((s) => ({ ...s, recipeIds: [...t] })),
172
- ...i.map((s) => ({ ...s, isGroup: !0, recipeIds: [...t] })),
173
- ...y.filter((s) => v.recipeById[s.id] && !t.has(s.id)).flatMap(
174
- (s) => c(v.recipeById[s.id].contains, /* @__PURE__ */ new Set([...t, s.id]))
175
- )
176
- ];
177
- }
178
- const l = [
179
- {
180
- accessorKey: "recipe",
181
- header: () => d("inventory.recipe.name"),
182
- size: 400
183
- },
184
- {
185
- accessorKey: "ingredients",
186
- header: () => d("inventory.recipe.ingredients"),
187
- size: "auto"
188
- },
189
- {
190
- id: "action",
191
- header: "",
192
- cell(n) {
193
- return Ue(
194
- [me[X.Edit], me[X.Delete]],
195
- (t) => {
196
- r(t, n.row.original.original);
197
- }
198
- );
199
- },
200
- enableSorting: !1,
201
- size: 40,
202
- meta: {
203
- cellClass: "",
204
- headerClass: ""
205
- }
206
- }
207
- ];
208
- function a(n) {
209
- const t = z();
210
- return n.map((e) => ({
211
- recipe: e.name,
212
- ingredients: c(e.contains, /* @__PURE__ */ new Set([e._id])).map((i) => {
213
- var s, B, o, b, V, F;
214
- if (i.isGroup) {
215
- const p = t.skuGroupById[i.id];
216
- return i.recipeIds.slice(1).length ? `(${(s = t.recipeById[i.recipeIds.at(-1) ?? ""]) == null ? void 0 : s.name}) ${p.name} (x ${j(i.amount)})` : `${p.name} (x${j(i.amount)})`;
217
- }
218
- const y = t.skuById[i.id];
219
- return y ? i.recipeIds.slice(1).length ? `(${(B = t.recipeById[i.recipeIds.at(-1) ?? ""]) == null ? void 0 : B.name}) ${y.name} (${j(i.amount)}${((o = i.measurement) == null ? void 0 : o.abbrev) ?? ((b = y == null ? void 0 : y.unit) == null ? void 0 : b.abbrev)})` : `${y.name} (${j(i.amount)}${((V = i.measurement) == null ? void 0 : V.abbrev) ?? ((F = y == null ? void 0 : y.unit) == null ? void 0 : F.abbrev)})` : null;
220
- }).filter((i) => i).join(", "),
221
- original: e
222
- }));
223
- }
224
- return { columnDefs: l, formatRowData: a };
225
- }
226
- function cn() {
227
- const f = z(), k = ie();
228
- async function v(r, c, l, a = []) {
229
- var s, B;
230
- const n = r.filter((o) => o.type === "SKU"), t = r.filter((o) => o.type !== "SKU"), e = /* @__PURE__ */ new Set();
231
- if (l)
232
- for (const o of f.skus)
233
- !a.some((V) => V === o._id) && o._id !== l && !((B = (s = o.convert) == null ? void 0 : s.inventoryBindings) != null && B.some((V) => V.id === l)) || e.add(o._id);
234
- const i = f.skus.map((o) => ({
235
- label: o.name,
236
- sublabel: `${o.code}${e.has(o._id) ? " (Cannot bind, will cause recursive binding)" : ""}`,
237
- value: o,
238
- disabled: e.has(o._id)
239
- })), y = i.filter(
240
- (o) => n.find((b) => b.id === o.value._id) && !e.has(o.value._id)
241
- ).map((o) => o.value);
242
- k.open({
243
- title: "Select ingredients",
244
- contentComponent: ce,
245
- contentComponentProps: {
246
- items: i,
247
- modelValue: y,
248
- virtualScroll: !0
249
- },
250
- primaryActions: {
251
- text: "Confirm",
252
- close: !0
253
- },
254
- secondaryActions: {
255
- text: "Close",
256
- close: !0,
257
- variant: "tertiary"
258
- }
259
- }).onPrimary((o) => {
260
- const b = [
261
- ...t,
262
- ...r.filter((V) => o.find((F) => F._id === V.id)),
263
- ...o.filter((V) => !r.find((F) => F.id === V._id)).map((V) => ({
264
- type: "SKU",
265
- id: V._id,
266
- amount: {
267
- amount: 1,
268
- precision: 0
269
- }
270
- }))
271
- ];
272
- c(b);
273
- });
274
- }
275
- async function d(r, c, l = []) {
276
- var y;
277
- const a = r.filter((s) => s.type === "RECIPE"), n = r.filter((s) => s.type !== "RECIPE"), t = /* @__PURE__ */ new Set();
278
- if (l.length)
279
- for (const s of f.recipes) {
280
- const B = ((y = f.recipeBindingFlattenCache[s._id]) == null ? void 0 : y.inventoryBindings) ?? [], o = B.some(
281
- (F) => F.bindingPaths.some((p) => l.some((x) => x === p.id))
282
- ), b = B.some(
283
- (F) => "success" in F && l.includes(F.ingredient._id)
284
- );
285
- (l.some((F) => F === s._id) || o || b) && t.add(s._id);
286
- }
287
- const e = f.recipes.filter((s) => !l.includes(s._id)).map((s) => ({
288
- label: s.name,
289
- sublabel: t.has(s._id) ? "(Cannot bind, will cause recursive binding)" : `${s.contains.length} inventory bindings`,
290
- value: s,
291
- disabled: t.has(s._id)
292
- })), i = e.filter(
293
- (s) => a.find((B) => B.id === s.value._id) && !t.has(s.value._id)
294
- ).map((s) => s.value);
295
- k.open({
296
- title: "Select recipes",
297
- contentComponent: ce,
298
- contentComponentProps: {
299
- items: e,
300
- modelValue: i,
301
- virtualScroll: !0
302
- },
303
- primaryActions: {
304
- text: "Confirm",
305
- close: !0
306
- },
307
- secondaryActions: {
308
- text: "Close",
309
- close: !0,
310
- variant: "tertiary"
311
- }
312
- }).onPrimary((s) => {
313
- const B = [
314
- ...r.filter((o) => s.find((b) => b._id === o.id)),
315
- ...s.filter((o) => !r.find((b) => b.id === o._id)).map((o) => ({
316
- type: "RECIPE",
317
- id: o._id,
318
- amount: {
319
- amount: 1,
320
- precision: 0
321
- }
322
- })),
323
- ...n
324
- ];
325
- c(B);
326
- });
327
- }
328
- return {
329
- promptIngredientsBinding: v,
330
- promptRecipesBinding: d
331
- };
332
- }
333
- const pn = { class: "flex flex-col" }, fn = { class: "flex flex-col gap-4" }, _e = /* @__PURE__ */ O({
334
- __name: "InventoryBindingRule",
335
- props: {
336
- disabled: { type: Boolean },
337
- modelValue: {},
338
- minCount: {},
339
- maxCount: {}
340
- },
341
- emits: ["update:modelValue"],
342
- setup(f, { emit: k }) {
343
- const v = f, d = k, { t: r } = Y(), c = Ne(), l = R(() => {
344
- var i;
345
- const t = /* @__PURE__ */ new Map(), e = c.restaurants.value.map((y) => y.customAttributes ?? {});
346
- for (const y of e)
347
- for (const [s, B] of Object.entries(y))
348
- t.has(s) || t.set(s, /* @__PURE__ */ new Set()), B && ((i = t.get(s)) == null || i.add(B));
349
- return t;
350
- }), a = R(() => [
351
- ...[...l.value.entries()].map(([e, i]) => ({
352
- type: "string",
353
- key: e,
354
- entity: "restaurant",
355
- values: [...i]
356
- }))
357
- ]), n = R({
358
- get() {
359
- return v.modelValue ? je.build(v.modelValue) : null;
360
- },
361
- set(t) {
362
- d("update:modelValue", t ? Oe.build(t) : null);
363
- }
364
- });
365
- return (t, e) => {
366
- const i = I("FmLabel"), y = I("FmFormGroup");
367
- return w(), A("div", pn, [
368
- _("div", fn, [
369
- h(i, {
370
- label: m(r)("inventory.ingredientGroup.form.rules.title"),
371
- required: t.minCount != null && t.minCount > 0
372
- }, null, 8, ["label", "required"]),
373
- h(m(Ye), {
374
- modelValue: n.value,
375
- "onUpdate:modelValue": e[0] || (e[0] = (s) => n.value = s),
376
- attributes: a.value
377
- }, null, 8, ["modelValue", "attributes"])
378
- ]),
379
- h(y, {
380
- "model-value": n.value,
381
- rules: [
382
- (s) => {
383
- const B = s ? 1 : 0;
384
- return v.minCount !== void 0 && B < v.minCount ? m(r)("inventory.ingredientGroup.form.rules.validation.minCount", {
385
- count: v.minCount
386
- }) : v.maxCount !== void 0 && B > v.maxCount ? m(r)("inventory.ingredientGroup.form.rules.validation.maxCount", {
387
- count: v.maxCount
388
- }) : !0;
389
- }
390
- ]
391
- }, null, 8, ["model-value", "rules"])
392
- ]);
393
- };
394
- }
395
- }), vn = { class: "border-1 mx-3 my-1 rounded-md" }, yn = { class: "flex flex-col w-full border-b border-fm-color-neutral-gray-100" }, bn = {
396
- class: "flex items-center",
397
- style: { "min-height": "48px" }
398
- }, gn = { class: "flex-1 fm-typo-en-body-md-400 py-8 px-12" }, _n = { class: "flex flex-col" }, hn = { class: "line-clamp-1" }, Vn = { class: "w-[200px]" }, kn = {
399
- key: 0,
400
- class: "w-[52px]"
401
- }, Bn = {
402
- key: 1,
403
- class: "w-[52px]"
404
- }, wn = {
405
- key: 0,
406
- class: "flex gap-4 text-fm-color-system-error-400 fm-typo-en-body-sm-400 px-8"
407
- }, xn = { class: "px-12 pb-4" }, Fn = /* @__PURE__ */ O({
408
- __name: "InventoryRecipeBindingV2Field",
409
- props: {
410
- disabled: { type: Boolean },
411
- readonly: { type: Boolean },
412
- modelValue: {},
413
- displayName: {},
414
- showError: { type: Boolean },
415
- showSettingsButton: { type: Boolean }
416
- },
417
- emits: ["update:modelValue", "delete", "settings"],
418
- setup(f, { emit: k }) {
419
- const { t: v } = Y(), d = ge("modelValue");
420
- function r(c) {
421
- const l = +c;
422
- c.length > 0 && isFinite(l) ? d.amount = Pe(l) : d.amount = { amount: 0, precision: 0 };
423
- }
424
- return (c, l) => {
425
- const a = I("FmTooltip"), n = I("FmTextField"), t = I("FmButton"), e = I("FmIcon"), i = I("FmFormGroup");
426
- return w(), A("div", vn, [
427
- h(i, {
428
- class: fe(["mb-2"]),
429
- disabled: c.disabled,
430
- modelValue: +m(j)(m(d).amount),
431
- rules: [m(De)(0), m(ye)(-1)]
432
- }, {
433
- default: N(({ invalid: y }) => [
434
- _("div", yn, [
435
- _("div", bn, [
436
- _("div", gn, [
437
- _("div", _n, [
438
- h(a, {
439
- zIndex: 51,
440
- variant: "plain",
441
- placement: "top",
442
- content: c.displayName
443
- }, {
444
- default: N(() => [
445
- _("span", hn, K(c.displayName), 1)
446
- ]),
447
- _: 1
448
- }, 8, ["content"])
449
- ])
450
- ]),
451
- _("div", Vn, [
452
- h(n, {
453
- class: "w-full",
454
- disabled: c.disabled,
455
- modelValue: +m(j)(m(d).amount),
456
- "onUpdate:modelValue": l[0] || (l[0] = (s) => r(s)),
457
- invalid: y
458
- }, null, 8, ["disabled", "modelValue", "invalid"])
459
- ]),
460
- c.showSettingsButton ? (w(), A("div", kn, [
461
- h(t, {
462
- disabled: c.disabled,
463
- type: "button",
464
- variant: "tertiary",
465
- icon: "settings",
466
- onClick: () => {
467
- }
468
- }, null, 8, ["disabled"])
469
- ])) : S("", !0),
470
- c.readonly ? S("", !0) : (w(), A("div", Bn, [
471
- h(t, {
472
- disabled: c.disabled,
473
- type: "button",
474
- variant: "plain",
475
- icon: "delete",
476
- "icon-color": "#000000",
477
- onClick: () => {
478
- }
479
- }, null, 8, ["disabled"])
480
- ]))
481
- ]),
482
- c.showError ? (w(), A("div", wn, [
483
- h(e, {
484
- name: "error",
485
- color: "system-error-300",
486
- size: "sm"
487
- }),
488
- _("div", null, K(m(v)("inventory.inventoryBindings.circularError")), 1)
489
- ])) : S("", !0)
490
- ])
491
- ]),
492
- _: 1
493
- }, 8, ["disabled", "modelValue", "rules"]),
494
- _("div", xn, [
495
- h(_e, {
496
- modelValue: m(d).rules,
497
- "onUpdate:modelValue": l[1] || (l[1] = (y) => m(d).rules = y),
498
- disabled: c.disabled
499
- }, null, 8, ["modelValue", "disabled"])
500
- ])
501
- ]);
502
- };
503
- }
504
- });
505
- function Cn(f) {
506
- const k = Je(), { t: v } = Qe(), d = z(), r = R(() => [
507
- {
508
- id: "delete",
509
- header: "",
510
- cell(a) {
511
- const n = a.row.original;
512
- return G(
513
- "div",
514
- { class: "w-full flex justify-end" },
515
- G(J.FmButton, {
516
- class: "delete-button",
517
- key: n._id,
518
- type: "button",
519
- icon: "delete",
520
- variant: "tertiary",
521
- size: "md",
522
- disabled: f.disabled ?? !1,
523
- onClick: () => {
524
- f.bindingAlternatives = f.bindingAlternatives.filter(
525
- (t) => t._id !== n._id
526
- );
527
- }
528
- })
529
- );
530
- },
531
- enableSorting: !1,
532
- size: 40,
533
- meta: {
534
- cellClass: "",
535
- headerClass: ""
536
- }
537
- },
538
- {
539
- id: "alternative",
540
- header: () => v("inventory.inventoryBindings.alternativeTable.ingredient"),
541
- accessorFn: (a) => {
542
- var n, t;
543
- return `${((n = d.skuById[a._id]) == null ? void 0 : n.name) ?? ""} (${((t = d.skuById[a._id]) == null ? void 0 : t.code) ?? ""})`;
544
- },
545
- cell: ({ row: a }) => {
546
- const n = d.skuById[a.original._id];
547
- return G(
548
- "div",
549
- {
550
- class: "w-full flex flex-col"
551
- },
552
- [
553
- G("div", { class: "fm-typo-en-body-lg-400 line-clamp-1" }, n.name),
554
- G(
555
- "div",
556
- { class: "fm-typo-en-body-md-400 line-clamp-1 text-fm-color-typo-secondary" },
557
- n.code
558
- )
559
- ]
560
- );
561
- },
562
- size: "auto",
563
- enableSorting: !1
564
- },
565
- {
566
- id: "unit",
567
- header: () => v("inventory.inventoryBindings.alternativeTable.unit"),
568
- accessorFn: (a) => {
569
- const n = d.skuById[a._id];
570
- return n.unit.measurements.computeFirst(
571
- (t) => t.id === a.trackingMeasurement ? t.name : null
572
- ) ?? n.unit.name;
573
- },
574
- enableSorting: !1
575
- },
576
- {
577
- id: "unitOption",
578
- header: () => v("inventory.inventoryBindings.alternativeTable.unit"),
579
- accessorKey: "trackingMeasurement",
580
- cell(a) {
581
- const n = d.skuById[a.row.original._id];
582
- if (!n) return null;
583
- const t = [
584
- {
585
- label: n.unit.name,
586
- sublabel: n.unit.abbrev,
587
- value: null
588
- },
589
- ...n.unit.measurements.map((e) => ({
590
- label: `${e.name} (${e.abbrev})`,
591
- sublabel: v("inventory.inventoryBindings.alternativeTable.measurementOption"),
592
- value: e.id
593
- }))
594
- ].filter((e) => !e.label.toLowerCase().includes("inactive"));
595
- return G(J.FmSelect, {
596
- modelValue: a.row.original.trackingMeasurement ?? null,
597
- items: t,
598
- disabled: f.disabled ?? !1,
599
- "onUpdate:modelValue": (e) => {
600
- f.bindingAlternatives = f.bindingAlternatives.map((i) => i._id === a.row.original._id ? { ...i, trackingMeasurement: e } : i);
601
- }
602
- });
603
- },
604
- enableSorting: !1
605
- },
606
- {
607
- id: "priority",
608
- header: () => v("inventory.inventoryBindings.alternativeTable.priority"),
609
- accessorKey: "priority",
610
- enableSorting: !0,
611
- cell(a) {
612
- const n = a.row.original;
613
- return G(J.FmTextField, {
614
- modelValue: n.priority ?? a.row.index + 1,
615
- rules: [
616
- Me(),
617
- ne(1),
618
- be(
619
- f.bindingAlternatives.filter((t) => t._id !== n._id).map((t) => {
620
- const e = d.skuById[t._id];
621
- return {
622
- label: e == null ? void 0 : e.name,
623
- value: t.priority
624
- };
625
- })
626
- )
627
- ],
628
- "onUpdate:modelValue": (t) => {
629
- const e = Number(t);
630
- isNaN(e) || (f.bindingAlternatives = f.bindingAlternatives.map((i) => i._id === a.row.original._id ? { ...i, priority: e } : i));
631
- }
632
- });
633
- }
634
- },
635
- {
636
- id: "default",
637
- header: () => "",
638
- accessorKey: "default",
639
- cell(a) {
640
- const n = d.skuById[a.row.original._id];
641
- return n ? G(J.FmCheckbox, {
642
- modelValue: a.row.original.default ?? !1,
643
- value: n._id,
644
- disabled: f.disabled ?? !1,
645
- "onUpdate:modelValue": () => {
646
- f.bindingAlternatives = f.bindingAlternatives.map((t) => t._id === a.row.original._id ? { ...t, default: !0 } : { ...t, default: !1 });
647
- }
648
- }) : null;
649
- },
650
- enableSorting: !1,
651
- size: 40,
652
- meta: {
653
- cellClass: "",
654
- headerClass: ""
655
- }
656
- },
657
- {
658
- id: "move",
659
- header: "",
660
- cell(a) {
661
- const n = a.row.original;
662
- return G("div", { class: "w-full flex justify-end" }, [
663
- G(J.FmButton, {
664
- key: n._id,
665
- type: "button",
666
- icon: "keyboard_arrow_up",
667
- variant: "tertiary",
668
- size: "md",
669
- disabled: f.disabled ?? !1,
670
- onClick: () => {
671
- const t = [...f.bindingAlternatives], e = t.findIndex((i) => i._id === n._id);
672
- if (e > 0) {
673
- const i = t[e - 1];
674
- t[e - 1] = n, t[e] = i;
675
- }
676
- f.bindingAlternatives = [...t];
677
- }
678
- }),
679
- G(J.FmButton, {
680
- key: n._id,
681
- type: "button",
682
- icon: "keyboard_arrow_down",
683
- variant: "tertiary",
684
- size: "md",
685
- disabled: f.disabled ?? !1,
686
- onClick: () => {
687
- const t = [...f.bindingAlternatives], e = t.findIndex((i) => i._id === n._id);
688
- if (e < t.length - 1) {
689
- const i = t[e + 1];
690
- t[e + 1] = n, t[e] = i;
691
- }
692
- f.bindingAlternatives = [...t];
693
- }
694
- })
695
- ]);
696
- },
697
- enableSorting: !1,
698
- size: 40,
699
- meta: {
700
- cellClass: "",
701
- headerClass: ""
702
- }
703
- }
704
- ]);
705
- return {
706
- get columnDefs() {
707
- return r.value;
708
- },
709
- promptAddIngredient: async (l) => {
710
- const a = [];
711
- for (const e of d.skus)
712
- l.includes(e._id) || a.push({
713
- label: e.name,
714
- sublabel: e.code,
715
- value: e._id,
716
- disabled: l.includes(e._id)
717
- });
718
- const n = (f.bindingAlternatives ?? []).map((e) => e._id), t = await k.multiSelect(a, n, (e) => {
719
- var y, s, B, o, b, V;
720
- const i = (y = f.bindingAlternatives) == null ? void 0 : y.findIndex((F) => F._id === e);
721
- return {
722
- _id: e,
723
- trackingMeasurement: typeof i != "number" || i == -1 ? (s = d.skuById[e]) == null ? void 0 : s.trackingMeasurement : (o = (B = f.bindingAlternatives) == null ? void 0 : B[i]) == null ? void 0 : o.trackingMeasurement,
724
- priority: ((V = (b = f.bindingAlternatives) == null ? void 0 : b[i]) == null ? void 0 : V.priority) ?? f.bindingAlternatives.length,
725
- default: !1
726
- };
727
- });
728
- f.bindingAlternatives = t ?? f.bindingAlternatives;
729
- },
730
- columnVisibility: {
731
- delete: !0,
732
- unit: !1,
733
- unitOption: !0,
734
- default: !1,
735
- // previous demo: sort priority by moving sku element in the array,
736
- // new demo: sort priority using priority field.
737
- // can reenable if this use case is requested to be restored
738
- move: !1
739
- }
740
- };
741
- }
742
- const In = { class: "flex flex-col gap-16" }, An = { class: "flex flex-col" }, Rn = { class: "flex justify-between items-center px-2" }, $n = /* @__PURE__ */ O({
743
- __name: "InventoryBindingAlternative",
744
- props: {
745
- disabled: { type: Boolean },
746
- modelValue: {},
747
- filterIngredientIds: {}
748
- },
749
- emits: ["update:modelValue"],
750
- setup(f, { emit: k }) {
751
- const v = f, d = k, { t: r } = Y(), c = Cn({
752
- get disabled() {
753
- return v.disabled ?? !1;
754
- },
755
- get bindingAlternatives() {
756
- return v.modelValue ?? [];
757
- },
758
- set bindingAlternatives(n) {
759
- d("update:modelValue", n);
760
- }
761
- }), l = (n) => n && n.some((t) => v.filterIngredientIds.includes(t._id)) ? "Contains invalid ingredient" : !0, a = (n) => n && n.length > 5 ? r("inventory.binding.alternative.maximumExceeded", { max: 5 }) : !0;
762
- return (n, t) => {
763
- var B;
764
- const e = I("FmLabel"), i = I("FmButton"), y = I("FmFormGroup"), s = I("FmTable");
765
- return w(), A("div", In, [
766
- _("div", An, [
767
- _("div", Rn, [
768
- h(e, {
769
- label: m(r)("inventory.alternatives")
770
- }, null, 8, ["label"]),
771
- h(i, {
772
- disabled: n.disabled,
773
- "prepend-icon": "link",
774
- variant: "primary",
775
- class: "border-1 rounded-lg border-fm-color-primary",
776
- onClick: t[0] || (t[0] = (o) => m(c).promptAddIngredient(n.filterIngredientIds)),
777
- size: "md"
778
- }, null, 8, ["disabled"])
779
- ]),
780
- h(y, {
781
- "model-value": n.modelValue,
782
- rules: [l, a]
783
- }, null, 8, ["model-value", "rules"])
784
- ]),
785
- h(s, {
786
- "row-data": n.modelValue ?? [],
787
- "column-defs": m(c).columnDefs,
788
- "page-size": ((B = n.modelValue) == null ? void 0 : B.length) || 0,
789
- "shrink-at": 9999,
790
- "column-visibility": m(c).columnVisibility,
791
- "hide-footer": ""
792
- }, null, 8, ["row-data", "column-defs", "page-size", "column-visibility"])
793
- ]);
794
- };
795
- }
796
- }), Sn = { class: "border-1 mx-3 my-1 rounded-md" }, En = { class: "flex flex-col border-b border-fm-color-neutral-gray-100" }, Tn = {
797
- class: "flex items-center w-full",
798
- style: { "min-height": "48px" }
799
- }, Un = { class: "flex-1 fm-typo-en-body-md-400 py-8 px-12" }, Dn = { class: "line-clamp-1 w-full" }, Pn = { class: "w-[150px]" }, Mn = {
800
- key: 0,
801
- class: "w-[52px]"
802
- }, Gn = { class: "flex flex-col px-12 pb-4" }, Nn = /* @__PURE__ */ O({
803
- __name: "InventorySkuBindingV2Field",
804
- props: {
805
- disabled: { type: Boolean },
806
- readonly: { type: Boolean },
807
- modelValue: {},
808
- displayName: {},
809
- unit: {},
810
- showError: { type: Boolean },
811
- ableToConfigureAlternative: { type: Boolean },
812
- ableToApplyRules: { type: Boolean }
813
- },
814
- emits: ["update:modelValue", "delete", "settings"],
815
- setup(f, { emit: k }) {
816
- const v = k, { t: d } = Y(), r = ge("modelValue");
817
- function c(a) {
818
- a && (r.amount = a.amount, r.measurement = a.measurement);
819
- }
820
- function l() {
821
- return {
822
- modelValue: {
823
- amount: r.amount,
824
- measurement: r.measurement
825
- },
826
- amountAsString: Xe.toFormatString({
827
- value: r.amount
828
- })
829
- };
830
- }
831
- return (a, n) => {
832
- const t = I("FmTooltip"), e = I("FmButton"), i = I("FmFormGroup");
833
- return w(), A("div", Sn, [
834
- _("div", En, [
835
- _("div", Tn, [
836
- _("div", Un, [
837
- h(t, {
838
- zIndex: 51,
839
- variant: "plain",
840
- placement: "top",
841
- content: a.displayName
842
- }, {
843
- default: N(() => [
844
- _("span", Dn, K(a.displayName), 1)
845
- ]),
846
- _: 1
847
- }, 8, ["content"])
848
- ]),
849
- _("div", Pn, [
850
- h(qe, {
851
- "model-value": { amount: m(r).amount, measurement: m(r).measurement },
852
- "onUpdate:modelValue": c,
853
- unit: a.unit,
854
- placement: "bottom",
855
- "convert-amount-on-change-unit": "",
856
- disabled: a.readonly
857
- }, null, 8, ["model-value", "unit", "disabled"])
858
- ]),
859
- a.readonly ? S("", !0) : (w(), A("div", Mn, [
860
- h(e, {
861
- disabled: a.disabled,
862
- type: "button",
863
- variant: "tertiary",
864
- icon: "delete",
865
- onClick: n[0] || (n[0] = () => v("delete", m(r).id))
866
- }, null, 8, ["disabled"])
867
- ]))
868
- ]),
869
- _("div", Gn, [
870
- h(i, {
871
- modelValue: m(r).amount,
872
- rules: [m(ye)(0)]
873
- }, null, 8, ["modelValue", "rules"]),
874
- h(i, {
875
- modelValue: l(),
876
- rules: [
877
- m(He)(),
878
- m(We)(a.unit),
879
- () => a.showError ? m(d)("inventory.inventoryBindings.invalidWarning") : !0
880
- ]
881
- }, null, 8, ["modelValue", "rules"])
882
- ]),
883
- a.ableToApplyRules ? (w(), P(_e, {
884
- key: 0,
885
- modelValue: m(r).rules,
886
- "onUpdate:modelValue": n[1] || (n[1] = (y) => m(r).rules = y),
887
- disabled: a.disabled
888
- }, null, 8, ["modelValue", "disabled"])) : S("", !0),
889
- a.ableToConfigureAlternative ? (w(), P($n, {
890
- key: 1,
891
- modelValue: m(r).alternatives,
892
- "onUpdate:modelValue": n[2] || (n[2] = (y) => m(r).alternatives = y),
893
- disabled: a.disabled,
894
- filterIngredientIds: [m(r).id]
895
- }, null, 8, ["modelValue", "disabled", "filterIngredientIds"])) : S("", !0)
896
- ])
897
- ]);
898
- };
899
- }
900
- });
901
- exports.FfCalculator;
902
- const zn = { class: "flex flex-col gap-24" }, Ln = {
903
- key: 0,
904
- class: "flex flex-col gap-16"
905
- }, Kn = { class: "flex items-center" }, jn = { class: "flex-1 fm-typo-en-title-sm-600" }, On = { class: "flex flex-col" }, Yn = { class: "flex py-8 px-12 border-b border-fm-color-neutral-gray-200 bg-fm-color-neutral-gray-100 h-[44px] items-center" }, qn = { class: "fm-typo-en-body-md-600 text-fm-color-typo-secondary" }, Hn = {
906
- key: 0,
907
- class: "w-[52px]"
908
- }, Wn = {
909
- key: 1,
910
- class: "w-[52px]"
911
- }, Jn = { class: "flex flex-col gap-16" }, Qn = { class: "flex items-center" }, Xn = { class: "flex-1 fm-typo-en-title-sm-600" }, Zn = { class: "flex flex-col" }, et = { class: "flex py-8 px-12 border-b border-fm-color-neutral-gray-200 bg-fm-color-neutral-gray-100 h-[44px] items-center" }, nt = { class: "flex-1 fm-typo-en-body-md-600 text-fm-color-typo-secondary" }, tt = { class: "fm-typo-en-body-md-600 text-fm-color-typo-secondary w-[150px] px-16" }, ot = {
912
- key: 0,
913
- class: "w-[52px]"
914
- }, it = /* @__PURE__ */ O({
915
- __name: "InventoryBindingFormV2",
916
- props: {
917
- id: {},
918
- modelValue: { default: () => [] },
919
- excludeBindingId: {},
920
- rules: { default: () => [] },
921
- iframeMode: { type: Boolean },
922
- disabled: { type: Boolean },
923
- readonly: { type: Boolean },
924
- recipeBindingConfig: { default: () => ({ enabled: !0, ableToApplyRules: !1 }) },
925
- skuBindingConfig: { default: () => ({
926
- enabled: !0,
927
- ableToApplyRules: !1,
928
- ableToConfigureAlternative: !1
929
- }) }
930
- },
931
- emits: ["update:modelValue", "click:pick-inventory-bindings"],
932
- setup(f, { emit: k }) {
933
- const { t: v } = Y(), d = z(), r = R(() => d.recipeById), c = R(() => d.skuById), l = f, a = k, n = R(() => Ce({
934
- parentId: l.id,
935
- bindings: l.modelValue,
936
- recipes: d.recipes.map((C) => C._id === l.id ? {
937
- ...C,
938
- contains: l.modelValue
939
- } : C),
940
- skus: d.skus.map((C) => C._id === l.id ? {
941
- ...C,
942
- convert: {
943
- inventoryBindings: l.modelValue
944
- }
945
- } : C),
946
- skuGroups: d.skuGroups
947
- }).inventoryBindings.filter((C) => "error" in C && C.error).map((C) => C).filter((C) => C.reason === Ie.enum.circularDependency)), t = R(
948
- () => new Set(n.value.map((p) => {
949
- var x;
950
- return (x = p.bindingPaths[0]) == null ? void 0 : x.id;
951
- }))
952
- ), e = R(() => l.modelValue.filter((p) => p.type === "RECIPE")), { promptIngredientsBinding: i, promptRecipesBinding: y } = cn();
953
- async function s() {
954
- if (l.iframeMode) {
955
- a("click:pick-inventory-bindings", "RECIPE");
956
- return;
957
- }
958
- y(
959
- l.modelValue,
960
- (p) => a("update:modelValue", p),
961
- l.id ? [l.id] : []
962
- );
963
- }
964
- const B = R(() => l.modelValue.filter((p) => p.type === "SKU") ?? []);
965
- async function o() {
966
- if (l.iframeMode) {
967
- a("click:pick-inventory-bindings", "SKU");
968
- return;
969
- }
970
- i(
971
- l.modelValue,
972
- (p) => a("update:modelValue", p),
973
- l.excludeBindingId,
974
- l.id ? [l.id] : []
975
- );
976
- }
977
- function b(p) {
978
- const x = l.modelValue.map((C) => C.id === p.id ? p : C);
979
- a("update:modelValue", x);
980
- }
981
- function V(p) {
982
- const x = l.modelValue.filter((C) => C.id !== p);
983
- a("update:modelValue", x);
984
- }
985
- function F(p) {
986
- var C, u;
987
- if (p.type !== Z.enum.SKU)
988
- throw new Error("Non-SKU binding does not have unit");
989
- if (!((C = c.value[p.id]) == null ? void 0 : C.unit))
990
- throw new Error(`Cannot find ingredient: ${p.id}`);
991
- return (u = c.value[p.id]) == null ? void 0 : u.unit;
992
- }
993
- return (p, x) => {
994
- var g, L, q;
995
- const C = I("FmFormGroup"), u = I("FmButton");
996
- return w(), A("div", zn, [
997
- h(C, {
998
- disabled: p.disabled,
999
- "model-value": p.modelValue,
1000
- rules: [
1001
- ...p.rules,
1002
- () => n.value.length ? "There is a binding error in your configuration" : !0
1003
- ]
1004
- }, {
1005
- label: N(() => x[4] || (x[4] = [
1006
- _("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " Define the inventory bindings for this recipe or ingredient. ", -1)
1007
- ])),
1008
- _: 1
1009
- }, 8, ["disabled", "model-value", "rules"]),
1010
- ((g = p.recipeBindingConfig) == null ? void 0 : g.enabled) !== !1 ? (w(), A("div", Ln, [
1011
- _("div", Kn, [
1012
- _("div", jn, K(m(v)("inventory.inventoryBindings.recipe")), 1),
1013
- p.readonly ? S("", !0) : (w(), P(u, {
1014
- key: 0,
1015
- variant: "secondary",
1016
- "text-color": "primary",
1017
- "border-color": "primary",
1018
- label: m(v)("inventory.inventoryBindings.linkRecipe"),
1019
- "prepend-icon": "link",
1020
- onClick: s
1021
- }, null, 8, ["label"]))
1022
- ]),
1023
- _("div", On, [
1024
- _("div", Yn, [
1025
- _("div", qn, K(m(v)("inventory.inventoryBindings.recipe")), 1),
1026
- x[5] || (x[5] = _("div", { class: "w-[200px]" }, null, -1)),
1027
- p.recipeBindingConfig.ableToApplyRules ? (w(), A("div", Hn)) : S("", !0),
1028
- p.readonly ? S("", !0) : (w(), A("div", Wn))
1029
- ]),
1030
- (w(!0), A(ee, null, se(e.value, (E) => {
1031
- var T;
1032
- return w(), P(Fn, {
1033
- key: E.id,
1034
- "model-value": E,
1035
- "display-name": (T = r.value[E.id]) == null ? void 0 : T.name,
1036
- "show-error": t.value.has(E.id),
1037
- "show-settings-button": (p.recipeBindingConfig.ableToApplyRules && !p.readonly) === !0,
1038
- readonly: p.readonly,
1039
- disabled: p.disabled,
1040
- "onUpdate:modelValue": x[0] || (x[0] = (M) => b(M)),
1041
- onDelete: x[1] || (x[1] = (M) => V(M))
1042
- }, null, 8, ["model-value", "display-name", "show-error", "show-settings-button", "readonly", "disabled"]);
1043
- }), 128))
1044
- ])
1045
- ])) : S("", !0),
1046
- _("div", Jn, [
1047
- _("div", Qn, [
1048
- _("div", Xn, K(m(v)("inventory.inventoryBindings.ingredient")), 1),
1049
- p.readonly ? S("", !0) : (w(), P(u, {
1050
- key: 0,
1051
- variant: "secondary",
1052
- "text-color": "primary",
1053
- "border-color": "primary",
1054
- label: m(v)("inventory.inventoryBindings.linkIngredient"),
1055
- "prepend-icon": "link",
1056
- onClick: o
1057
- }, null, 8, ["label"]))
1058
- ]),
1059
- _("div", Zn, [
1060
- _("div", et, [
1061
- _("div", nt, K(m(v)("inventory.inventoryBindings.ingredient")), 1),
1062
- _("div", tt, K(m(v)("inventory.inventoryBindings.amount")), 1),
1063
- x[6] || (x[6] = _("div", { class: "w-[52px]" }, null, -1)),
1064
- (L = p.skuBindingConfig) != null && L.ableToApplyRules || (q = p.skuBindingConfig) != null && q.ableToConfigureAlternative ? (w(), A("div", ot)) : S("", !0)
1065
- ]),
1066
- (w(!0), A(ee, null, se(B.value, (E) => {
1067
- var T, M, W;
1068
- return w(), P(Nn, {
1069
- key: E.id,
1070
- "model-value": E,
1071
- "display-name": (T = c.value[E.id]) == null ? void 0 : T.name,
1072
- unit: F(E),
1073
- "show-error": t.value.has(E.id),
1074
- "able-to-apply-rules": ((M = p.skuBindingConfig) == null ? void 0 : M.ableToApplyRules) === !0,
1075
- "able-to-configure-alternative": ((W = p.skuBindingConfig) == null ? void 0 : W.ableToConfigureAlternative) === !0,
1076
- readonly: p.readonly,
1077
- disabled: p.disabled,
1078
- "onUpdate:modelValue": x[2] || (x[2] = ($) => b($)),
1079
- onDelete: x[3] || (x[3] = ($) => V($))
1080
- }, null, 8, ["model-value", "display-name", "unit", "show-error", "able-to-apply-rules", "able-to-configure-alternative", "readonly", "disabled"]);
1081
- }), 128))
1082
- ])
1083
- ])
1084
- ]);
1085
- };
1086
- }
1087
- }), lt = { class: "flex flex-col gap-40" }, at = {
1088
- key: 0,
1089
- class: "flex flex-col gap-16"
1090
- }, st = {
1091
- key: 0,
1092
- 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"
1093
- }, rt = {
1094
- key: 0,
1095
- class: "flex flex-col items-center w-full h-full gap-24"
1096
- }, dt = { key: 1 }, ut = { class: "mt-32" }, mt = /* @__PURE__ */ O({
1097
- __name: "RecipeForm",
1098
- props: {
1099
- mode: {},
1100
- modelValue: {},
1101
- disabled: { type: Boolean }
1102
- },
1103
- emits: ["update:modelValue", "click:submit"],
1104
- setup(f, { expose: k, emit: v }) {
1105
- var C;
1106
- const d = f, r = v, c = Ze(), { t: l } = Y(), a = R({
1107
- get() {
1108
- var u;
1109
- return ((u = d.modelValue) == null ? void 0 : u.name) ?? "";
1110
- },
1111
- set(u) {
1112
- const g = d.modelValue ?? {};
1113
- g.name = u, r("update:modelValue", g);
1114
- }
1115
- }), n = R({
1116
- get() {
1117
- var u;
1118
- return ((u = d.modelValue) == null ? void 0 : u.contains) ?? [];
1119
- },
1120
- set(u) {
1121
- const g = d.modelValue ?? {};
1122
- g.contains = u, r("update:modelValue", g);
1123
- }
1124
- }), t = R({
1125
- get() {
1126
- var u;
1127
- return ((u = d.modelValue) == null ? void 0 : u.customAttributes) ?? {};
1128
- },
1129
- set(u) {
1130
- const g = d.modelValue ? {
1131
- ...d.modelValue
1132
- } : {};
1133
- g.customAttributes = u, r("update:modelValue", g);
1134
- }
1135
- }), e = R({
1136
- get() {
1137
- var u;
1138
- return ((u = d.modelValue) == null ? void 0 : u.version) ?? null;
1139
- },
1140
- set(u) {
1141
- const g = d.modelValue ? { ...d.modelValue } : {};
1142
- g.version = u, r("update:modelValue", g);
1143
- }
1144
- }), i = R({
1145
- get() {
1146
- return e.value === "v2";
1147
- },
1148
- set(u) {
1149
- e.value = u ? "v2" : null;
1150
- }
1151
- });
1152
- function y() {
1153
- r("click:submit");
1154
- }
1155
- const s = D();
1156
- k({
1157
- validateInputs: () => {
1158
- var u, g;
1159
- (g = (u = s.value) == null ? void 0 : u.validateInputs) == null || g.call(u);
1160
- },
1161
- resetInputsValidation: () => {
1162
- var u, g;
1163
- (g = (u = s.value) == null ? void 0 : u.resetInputsValidation) == null || g.call(u);
1164
- },
1165
- resetInputs: () => {
1166
- var u, g;
1167
- (g = (u = s.value) == null ? void 0 : u.resetInputs) == null || g.call(u);
1168
- }
1169
- });
1170
- const B = z(), o = D([]), b = D(!1), V = D(!1);
1171
- Ve(b, async (u) => {
1172
- F(u);
1173
- });
1174
- async function F(u) {
1175
- var g, L;
1176
- u && !V.value && ((g = d.modelValue) != null && g._id) && (V.value = !0, o.value = await B.getAffectedMenu((L = d.modelValue) == null ? void 0 : L._id).delayed(500), V.value = !1);
1177
- }
1178
- const p = R(
1179
- () => B.recipes.map((u) => ({ label: u.name, value: u.name }))
1180
- ), x = D((C = d.modelValue) == null ? void 0 : C.name);
1181
- return (u, g) => {
1182
- const L = I("FmTextField"), q = I("FmSwitch"), E = I("FmCard"), T = I("FmSpacer"), M = I("FmCircularProgress"), W = I("FmForm");
1183
- return w(), P(W, {
1184
- ref_key: "formRef",
1185
- ref: s,
1186
- onValidationSuccess: y
1187
- }, {
1188
- default: N(() => [
1189
- _("div", lt, [
1190
- h(L, {
1191
- disabled: u.disabled,
1192
- label: m(l)("inventory.recipe.name"),
1193
- "model-value": a.value,
1194
- "onUpdate:modelValue": g[0] || (g[0] = ($) => a.value = $),
1195
- rules: [
1196
- m(Ge)(),
1197
- m(be)(p.value, x.value, ($) => `[${$.value}] already exists`)
1198
- ],
1199
- "label-mark": "required"
1200
- }, null, 8, ["disabled", "label", "model-value", "rules"]),
1201
- m(c).enableRecipeV2 ? (w(), A("div", at, [
1202
- h(q, {
1203
- modelValue: i.value,
1204
- "onUpdate:modelValue": g[1] || (g[1] = ($) => i.value = $),
1205
- value: !0,
1206
- label: m(l)("inventory.recipe.enableRecipeV2"),
1207
- "label-placement": "right",
1208
- disabled: u.disabled,
1209
- sublabel: m(l)("inventory.recipe.recipeV2Warning")
1210
- }, null, 8, ["modelValue", "label", "disabled", "sublabel"])
1211
- ])) : S("", !0),
1212
- h(E, {
1213
- variant: "outlined",
1214
- class: "p-16"
1215
- }, {
1216
- default: N(() => {
1217
- var $, Q;
1218
- return [
1219
- m(c).enableRecipeV2 ? (w(), P(it, {
1220
- key: 0,
1221
- id: ($ = u.modelValue) == null ? void 0 : $._id,
1222
- disabled: u.disabled,
1223
- "model-value": n.value,
1224
- "onUpdate:modelValue": g[2] || (g[2] = (H) => n.value = H),
1225
- rules: [m(ne)(1)],
1226
- "enable-ingredient-group": m(c).enableIngredientGroup,
1227
- "recipe-binding-config": { enabled: !i.value, ableToApplyRules: i.value },
1228
- "sku-binding-config": {
1229
- ableToConfigureAlternative: i.value
1230
- }
1231
- }, null, 8, ["id", "disabled", "model-value", "rules", "enable-ingredient-group", "recipe-binding-config", "sku-binding-config"])) : (w(), P(Ke, {
1232
- key: 1,
1233
- id: (Q = u.modelValue) == null ? void 0 : Q._id,
1234
- disabled: u.disabled,
1235
- "model-value": n.value,
1236
- "onUpdate:modelValue": g[3] || (g[3] = (H) => n.value = H),
1237
- rules: [m(ne)(1)],
1238
- "enable-ingredient-group": m(c).enableIngredientGroup
1239
- }, null, 8, ["id", "disabled", "model-value", "rules", "enable-ingredient-group"]))
1240
- ];
1241
- }),
1242
- _: 1
1243
- })
1244
- ]),
1245
- u.mode !== m(U).CREATE ? (w(), A("div", st, [
1246
- h(q, {
1247
- label: "Show binded items",
1248
- modelValue: b.value,
1249
- "onUpdate:modelValue": g[4] || (g[4] = ($) => b.value = $),
1250
- "label-placement": "right",
1251
- disabled: V.value
1252
- }, null, 8, ["modelValue", "disabled"]),
1253
- V.value ? (w(), A("div", rt, [
1254
- h(T),
1255
- _("div", null, [
1256
- h(M, { size: "xl" })
1257
- ]),
1258
- g[6] || (g[6] = _("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary pl-8" }, "Loading...", -1)),
1259
- h(T)
1260
- ])) : b.value && o.value.length ? (w(), A("div", dt, [
1261
- h(ve, {
1262
- name: "Menu",
1263
- bindings: o.value
1264
- }, null, 8, ["bindings"])
1265
- ])) : S("", !0)
1266
- ])) : S("", !0),
1267
- _("div", ut, [
1268
- h(en, {
1269
- entity: "inventoryRecipe",
1270
- modelValue: t.value,
1271
- "onUpdate:modelValue": g[5] || (g[5] = ($) => t.value = $)
1272
- }, null, 8, ["modelValue"])
1273
- ])
1274
- ]),
1275
- _: 1
1276
- }, 512);
1277
- };
1278
- }
1279
- }), ct = { class: "flex gap-4" }, pt = /* @__PURE__ */ O({
1280
- __name: "RecipeDialog",
1281
- props: {
1282
- show: { type: Boolean },
1283
- recipe: {},
1284
- mode: { default: U.READ }
1285
- },
1286
- emits: ["update:show"],
1287
- setup(f) {
1288
- const k = f, v = z(), d = le(), { t: r } = Y(), c = ue(k, "show"), l = ue(k, "recipe"), a = R(() => {
1289
- switch (k.mode) {
1290
- case U.READ:
1291
- return "";
1292
- case U.UPDATE:
1293
- return r("inventory.recipe.update.title");
1294
- case U.CREATE:
1295
- return r("inventory.recipe.create.title");
1296
- }
1297
- return "";
1298
- }), n = R(() => {
1299
- switch (k.mode) {
1300
- case U.READ:
1301
- return "";
1302
- case U.UPDATE:
1303
- return r("common.save");
1304
- case U.CREATE:
1305
- return r("common.add");
1306
- }
1307
- return "";
1308
- }), t = D(), e = D(!1);
1309
- async function i() {
1310
- e.value = !0;
1311
- try {
1312
- const o = oe(l.value);
1313
- o.precision ?? (o.precision = 0), o.measurements ?? (o.measurements = []), await v.createRecipe(o), c.value = !1, d.open({
1314
- title: r("inventory.common.success"),
1315
- message: r("inventory.recipe.create.success", { name: l.value.name }),
1316
- type: "success"
1317
- });
1318
- } catch (o) {
1319
- o instanceof de || d.open({
1320
- title: r("inventory.recipe.create.error.title"),
1321
- message: r("inventory.recipe.create.error.message"),
1322
- type: "error"
1323
- });
1324
- } finally {
1325
- e.value = !1;
1326
- }
1327
- }
1328
- async function y() {
1329
- e.value = !0;
1330
- try {
1331
- await v.updateRecipe(l.value), c.value = !1, d.open({
1332
- title: r("inventory.common.success"),
1333
- message: r("inventory.recipe.update.success", { name: l.value.name }),
1334
- type: "success"
1335
- });
1336
- } catch (o) {
1337
- o instanceof de || d.open({
1338
- title: r("inventory.recipe.update.error.title"),
1339
- message: r("inventory.recipe.update.error.message"),
1340
- type: "error"
1341
- });
1342
- } finally {
1343
- e.value = !1;
1344
- }
1345
- }
1346
- function s() {
1347
- var o, b;
1348
- (b = (o = t.value) == null ? void 0 : o.validateInputs) == null || b.call(o);
1349
- }
1350
- function B() {
1351
- switch (k.mode) {
1352
- case U.READ:
1353
- return;
1354
- case U.UPDATE:
1355
- return y();
1356
- case U.CREATE:
1357
- return i();
1358
- }
1359
- }
1360
- return (o, b) => {
1361
- const V = I("FmButton"), F = I("FmSideSheet");
1362
- return w(), P(F, {
1363
- "model-value": m(c),
1364
- "onUpdate:modelValue": b[3] || (b[3] = (p) => re(c) ? c.value = p : null),
1365
- header: a.value,
1366
- "close-button": "",
1367
- "dismiss-away": "",
1368
- "max-width": 800
1369
- }, {
1370
- "side-sheet-footer": N(() => [
1371
- _("div", ct, [
1372
- h(V, {
1373
- loading: e.value,
1374
- label: n.value,
1375
- onClick: s
1376
- }, null, 8, ["loading", "label"]),
1377
- h(V, {
1378
- disabled: e.value,
1379
- label: m(r)("common.close"),
1380
- variant: "tertiary",
1381
- onClick: b[2] || (b[2] = (p) => c.value = !1)
1382
- }, null, 8, ["disabled", "label"])
1383
- ])
1384
- ]),
1385
- default: N(() => [
1386
- h(mt, {
1387
- class: "w-full",
1388
- ref_key: "hasValidationExpose",
1389
- ref: t,
1390
- modelValue: m(l),
1391
- "onUpdate:modelValue": b[0] || (b[0] = (p) => re(l) ? l.value = p : null),
1392
- mode: o.mode,
1393
- disabled: e.value,
1394
- "onClick:submit": b[1] || (b[1] = (p) => B())
1395
- }, null, 8, ["modelValue", "mode", "disabled"])
1396
- ]),
1397
- _: 1
1398
- }, 8, ["model-value", "header"]);
1399
- };
1400
- }
1401
- });
1402
- function ft(f) {
1403
- return !f || Object.keys(f).length === 0 ? "" : Object.entries(f).map(([k, v]) => `${k}: ${v}`).join(", ");
1404
- }
1405
- function vt() {
1406
- const f = z(), k = f.recipes, v = f.recipeById, d = f.skuById, r = f.skuGroupById, c = k.flatMap((n, t) => {
1407
- var i;
1408
- const e = ft(n.customAttributes);
1409
- if ((i = n.contains) != null && i.length) {
1410
- const y = n.contains.filter((o) => o.type === "RECIPE"), s = n.contains.filter((o) => o.type === "SKU"), B = n.contains.filter((o) => o.type === "SKU_GROUP");
1411
- return [
1412
- ...t === 0 ? [] : [["", "", "", "", "", "", ""]],
1413
- ...y.map(
1414
- (o, b) => {
1415
- var V;
1416
- return [
1417
- b === 0 ? n.name : "",
1418
- "RECIPE",
1419
- "",
1420
- (V = v[o.id]) == null ? void 0 : V.name,
1421
- j(o.amount),
1422
- "UNIT",
1423
- b === 0 ? e : ""
1424
- ];
1425
- }
1426
- ),
1427
- ...s.map(
1428
- (o, b) => {
1429
- var V, F, p, x;
1430
- return [
1431
- !y.length && b === 0 ? n.name : "",
1432
- "INGREDIENT",
1433
- (V = d[o.id]) == null ? void 0 : V.code,
1434
- (F = d[o.id]) == null ? void 0 : F.name,
1435
- j(o.amount),
1436
- o.measurement ? o.measurement.abbrev : (x = (p = d[o.id]) == null ? void 0 : p.unit) == null ? void 0 : x.abbrev,
1437
- !y.length && b === 0 ? e : ""
1438
- ];
1439
- }
1440
- ),
1441
- ...B.map(
1442
- (o, b) => {
1443
- var V, F;
1444
- return [
1445
- y.length === 0 && s.length === 0 && b === 0 ? n.name : "",
1446
- "SKU_GROUP",
1447
- ((V = r[o.id]) == null ? void 0 : V.ref) || "",
1448
- (F = r[o.id]) == null ? void 0 : F.name,
1449
- j(o.amount),
1450
- "UNIT",
1451
- y.length === 0 && s.length === 0 && b === 0 ? e : ""
1452
- ];
1453
- }
1454
- )
1455
- ];
1456
- }
1457
- return [
1458
- ...t === 0 ? [] : [["", "", "", "", "", "", ""]],
1459
- [n.name, "No bindings", "", "", "", "", e]
1460
- ];
1461
- }), a = tn(c, ["Name", "Type", "Code", "Item", "Amount", "Unit", "Custom Attributes"]);
1462
- on(a, `RECIPE_${ln(/* @__PURE__ */ new Date(), "-", "-")}.xlsx`);
1463
- }
1464
- const yt = { class: "flex flex-col py-8" }, bt = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, gt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Ot = /* @__PURE__ */ O({
1465
- __name: "RecipeView",
1466
- setup(f) {
1467
- const k = z(), v = R(() => k.recipes), d = Ae(), { createRecipe: r, updateRecipe: c } = te(), { recipeDialogProps: l, recipeViewLoading: a } = Te(te()), { columnDefs: n, formatRowData: t } = mn(), e = R(() => t(v.value));
1468
- ie(), le(), D(!1);
1469
- function i(p) {
1470
- if (p === "add")
1471
- return r();
1472
- if (p === "export")
1473
- return vt();
1474
- }
1475
- const y = D(""), s = R(() => a.value), { breakpoints: B } = Re(), o = R(() => B.value.xs || B.value.sm), b = R(() => o.value ? 10 : 20), V = ze(), { t: F } = Y();
1476
- return (p, x) => {
1477
- const C = I("FmTable");
1478
- return w(), P(Le, {
1479
- title: m(F)("inventory.recipe.title"),
1480
- actions: [
1481
- {
1482
- label: m(F)("inventory.recipe.create.title"),
1483
- value: "add",
1484
- isPrimary: !0,
1485
- prependIcon: "add"
1486
- },
1487
- { label: m(F)("common.export"), value: "export", isPrimary: !1 }
1488
- ],
1489
- "onClick:action": i
1490
- }, {
1491
- default: N(() => [
1492
- _("div", {
1493
- class: fe([
1494
- "flex flex-col gap-8 max-h-full",
1495
- {
1496
- "p-0": o.value,
1497
- "px-24 ": !o.value
1498
- }
1499
- ])
1500
- }, [
1501
- h(an, {
1502
- searchable: "",
1503
- search: y.value,
1504
- "onUpdate:search": x[0] || (x[0] = (u) => y.value = u)
1505
- }, null, 8, ["search"]),
1506
- (w(), P(C, {
1507
- style: ke(m(V).tableHeight),
1508
- "column-defs": m(n),
1509
- "row-data": e.value,
1510
- "search-value": y.value,
1511
- loading: !m(d)._currentLocation || s.value,
1512
- onRowClick: x[1] || (x[1] = (u) => m(c)(u.original.original)),
1513
- key: v.value.length,
1514
- "page-size": b.value
1515
- }, {
1516
- "list-row": N((u) => [
1517
- h(nn, {
1518
- row: u,
1519
- onRowClick: (g) => m(c)(g.original)
1520
- }, {
1521
- default: N((g) => {
1522
- var L, q, E, T, M, W, $, Q, H, ae;
1523
- return [
1524
- _("div", yt, [
1525
- _("div", bt, [
1526
- h(m(pe), {
1527
- render: (E = (q = (L = g.recipe) == null ? void 0 : L.column) == null ? void 0 : q.columnDef) == null ? void 0 : E.cell,
1528
- props: (M = (T = g.recipe) == null ? void 0 : T.getContext) == null ? void 0 : M.call(T)
1529
- }, null, 8, ["render", "props"])
1530
- ]),
1531
- _("div", gt, [
1532
- h(m(pe), {
1533
- render: (Q = ($ = (W = g.ingredients) == null ? void 0 : W.column) == null ? void 0 : $.columnDef) == null ? void 0 : Q.cell,
1534
- props: (ae = (H = g.ingredients) == null ? void 0 : H.getContext) == null ? void 0 : ae.call(H)
1535
- }, null, 8, ["render", "props"])
1536
- ])
1537
- ])
1538
- ];
1539
- }),
1540
- _: 2
1541
- }, 1032, ["row", "onRowClick"])
1542
- ]),
1543
- _: 1
1544
- }, 8, ["style", "column-defs", "row-data", "search-value", "loading", "page-size"]))
1545
- ], 2),
1546
- (w(), P(Be, { to: "body" }, [
1547
- h(pt, we(xe(m(l))), null, 16)
1548
- ]))
1549
- ]),
1550
- _: 1
1551
- }, 8, ["title", "actions"]);
1552
- };
1553
- }
1554
- });
1555
- export {
1556
- Ot as default
1557
- };