@feedmepos/mf-inventory-portal 1.2.55-dev.1 → 1.2.56-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 (114) hide show
  1. package/dist/{App-Dr4bSbWV.js → App-Dlnr4iYC.js} +3 -3
  2. package/dist/{ApprovalView-BrUi6das.js → ApprovalView-Txmz-hCz.js} +5 -5
  3. package/dist/{BindingsDialog-DtsEDaFx.js → BindingsDialog-BXnuWCaK.js} +5 -5
  4. package/dist/{BindingsPicker-BDSimsxV.js → BindingsPicker-CO2_vfjx.js} +3 -3
  5. package/dist/{BindingsTable-ArpmNkQm.js → BindingsTable-amypZb8r.js} +5 -5
  6. package/dist/{ClosingDraftView-D7qz1YGt.js → ClosingDraftView-Kegm5V38.js} +629 -622
  7. package/dist/{ClosingHistoryView-ND9smQRb.js → ClosingHistoryView-D9VXx7c6.js} +36 -36
  8. package/dist/{ClosingTemplateView--1tzOPIu.js → ClosingTemplateView-PYKa8KDQ.js} +14 -14
  9. package/dist/{DeliveryOrderPrintPreview-Ctv1Qp_a.js → DeliveryOrderPrintPreview-BBUliD2T.js} +7 -7
  10. package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-lA-iPoWZ.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-DhJjC8RN.js} +17 -17
  11. package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-UJewH4Il.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-D0z-41dr.js} +2 -2
  12. package/dist/{FmMultiselectDialog-Br5_D-b5.js → FmMultiselectDialog-CswtC1AP.js} +16 -16
  13. package/dist/{FmMultiselectDialog-BrJlUxMZ.js → FmMultiselectDialog-DTYS42tQ.js} +1 -1
  14. package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-BvIdnKjl.js → FmUnitInput.vue_vue_type_script_setup_true_lang-DXkTWOFj.js} +11 -11
  15. package/dist/{ImportView-fEnHrPWZ.js → ImportView-DvECDSkN.js} +6 -6
  16. package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-DVELkyVY.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-Dg0gQJFw.js} +1 -1
  17. package/dist/{IngredientGroupView-B1owkM3C.js → IngredientGroupView-PYLW-jdb.js} +5 -5
  18. package/dist/{IngredientsView-BTKXnnw5.js → IngredientsView-fzMFu5Kd.js} +14 -14
  19. package/dist/{IntegrationView-C2jarXxh.js → IntegrationView-BJraR9yF.js} +12 -12
  20. package/dist/{InventoryBindingForm-Gq8XfKbC.js → InventoryBindingForm-BCLg-OVi.js} +1 -1
  21. package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-BVkTXQvA.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-BAoFz9Xy.js} +14 -14
  22. package/dist/{InventoryBindingSummary-CqQu65hi.js → InventoryBindingSummary-BaihKVNj.js} +1 -1
  23. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-DIukT297.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-sxY8hdeR.js} +1 -1
  24. package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-D2aU4Ij2.js → PremiumBadge.vue_vue_type_script_setup_true_lang-BhOwDBiq.js} +2 -2
  25. package/dist/{PublishView-CBYg-KST.js → PublishView-BMmcC0Vq.js} +8 -8
  26. package/dist/{PurchaseOrderPrintPreview-C_jrGksW.js → PurchaseOrderPrintPreview-BWl9FIys.js} +11 -11
  27. package/dist/{ReceiveRequestView-iawt5dnN.js → ReceiveRequestView-Cn5w0cDy.js} +19 -19
  28. package/dist/RecipeView-BW5KCmkx.js +1557 -0
  29. package/dist/{StockView-oSkKCORB.js → StockView-oxOQh8eg.js} +116 -116
  30. package/dist/{SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-BJ3gnpTq.js → SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-JGzokQMQ.js} +1 -1
  31. package/dist/{SupplierView-tipIYgX7.js → SupplierView-TSbv1g43.js} +11 -11
  32. package/dist/{SurchargeView-CW1lsyEC.js → SurchargeView-CZDaMAk2.js} +6 -6
  33. package/dist/{SystemTrailDialog.vue_vue_type_script_setup_true_lang-B3FZqxjr.js → SystemTrailDialog.vue_vue_type_script_setup_true_lang-BH90OuDB.js} +2 -2
  34. package/dist/{TemplatePublishDialog.vue_vue_type_script_setup_true_lang-D86rTw7c.js → TemplatePublishDialog.vue_vue_type_script_setup_true_lang-D0geyvW9.js} +1 -1
  35. package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-cGzs-dHw.js → TransferDetails.vue_vue_type_script_setup_true_lang-Dxm9e7s0.js} +72 -72
  36. package/dist/{TransferTemplateView-dSJSgnil.js → TransferTemplateView-Ds4UfF6z.js} +15 -15
  37. package/dist/{UnitView-VHi5WMrF.js → UnitView-DNfslwNA.js} +6 -6
  38. package/dist/{WarehouseView-DLZaux-w.js → WarehouseView-DkcPy1mF.js} +5 -5
  39. package/dist/{WastageTemplateView-KyvwCkdu.js → WastageTemplateView-CP_sQsdU.js} +60 -60
  40. package/dist/api/inventory.d.ts +126 -36
  41. package/dist/api/netsuite.d.ts +8 -1
  42. package/dist/{app-Cq2T5z21.js → app-Do7d9F2j.js} +7340 -6379
  43. package/dist/app.d.ts +200 -0
  44. package/dist/app.js +1 -1
  45. package/dist/{closing-template-TwdeC6qT.js → closing-template-BidraMN0.js} +1 -1
  46. package/dist/components/inventory-binding/InventoryBinding.vue.d.ts +37 -1
  47. package/dist/components/shell/inventory/binding-dialog.vue.d.ts +14 -0
  48. package/dist/components/shell/inventory/binding-ui.vue.d.ts +16 -1
  49. package/dist/{date2-Dunl1OWI.js → date2-xmQqiCBU.js} +1 -1
  50. package/dist/{dayjs.min-D_81k3gd.js → dayjs.min-C2InbamH.js} +16 -16
  51. package/dist/{decimal-B9DLzi9Y.js → decimal-BHD_uD50.js} +2 -2
  52. package/dist/{defineDeepModel-B15nBS96.js → defineDeepModel-CoBQILOz.js} +1 -1
  53. package/dist/{duplicate-template-BSxFsv2u.js → duplicate-template-BfJ6g_ux.js} +1 -1
  54. package/dist/{feature-KwyjpPTq.js → feature-BsP8KV0O.js} +94 -89
  55. package/dist/{format-time-from-id-BfL9V23H.js → format-time-from-id-CLLM4KoK.js} +1 -1
  56. package/dist/{format-unit-display-BfSLhflE.js → format-unit-display-BLtS1XcY.js} +10 -10
  57. package/dist/{import-export.helper-TUsgMxew.js → import-export.helper-DQvkoWnj.js} +7 -7
  58. package/dist/{index-C2H5HeFF.js → index-CUm44l1O.js} +1 -1
  59. package/dist/{index-DTnKa-sF.js → index-CrS7Yig1.js} +1471 -1412
  60. package/dist/{index-CXtJlhZZ.js → index-p8EMSeUp.js} +3 -3
  61. package/dist/{lodash-DRR2nS2T.js → lodash-BNImU2Ov.js} +1 -1
  62. package/dist/{netsuite-CAFiEoX5.js → netsuite-DpB7HK5Q.js} +60 -60
  63. package/dist/{purchase-order-template-CSJXceBK.js → purchase-order-template-DgbM99CO.js} +1 -1
  64. package/dist/{rules-BdFLL1aa.js → rules-CmGXcEkE.js} +18 -18
  65. package/dist/{stock-B80FaSS2.js → stock-C1-SWNBT.js} +1 -1
  66. package/dist/{stock-CgsgvX9b.js → stock-CUjopFIE.js} +3 -3
  67. package/dist/stores/feature.d.ts +2 -0
  68. package/dist/stores/integration/netsuite.d.ts +8 -1
  69. package/dist/stores/inventory.d.ts +119 -30
  70. package/dist/{supplier-BsycjnD1.js → supplier-BLGyTOqT.js} +2 -2
  71. package/dist/{surcharge-BH6kETCu.js → surcharge-BA-bc8RT.js} +1 -1
  72. package/dist/tsconfig.app.tsbuildinfo +1 -1
  73. package/dist/{use-ingredient-select-dialog-B2cFOc3t.js → use-ingredient-select-dialog-BDMeEnJC.js} +2 -2
  74. package/dist/{use-inventory-binding-dialog-CKUtJDHW.js → use-inventory-binding-dialog-CmAOk0d6.js} +2 -2
  75. package/dist/{use-template-enabled-locations-2-tPL4lEZ_.js → use-template-enabled-locations-2-DSQY7vNB.js} +2 -2
  76. package/dist/views/closing-draft/components/closing-draft-dialog/ClosingDraftDialog.vue.d.ts +64 -8
  77. package/dist/views/closing-draft/composables/use-closing-draft-table.d.ts +192 -24
  78. package/dist/views/closing-template/components/closing-template-form/composables/use-closing-template-items.d.ts +8 -1
  79. package/dist/views/closing-template/composables/use-closing-template-actions.d.ts +96 -12
  80. package/dist/views/closing-template/composables/use-closing-template-table.d.ts +96 -12
  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 +14 -0
  83. package/dist/views/ingredients/components/ingredient-form/IngredientForm.vue.d.ts +32 -4
  84. package/dist/views/ingredients/components/inventory-binding/InventoryBindingForm.vue.d.ts +28 -0
  85. package/dist/views/ingredients/components/inventory-binding/v2/InventoryBindingFormV2.vue.d.ts +169 -0
  86. package/dist/views/ingredients/components/inventory-binding/v2/components/InventoryBindingAlternative.vue.d.ts +43 -0
  87. package/dist/views/ingredients/components/inventory-binding/v2/components/InventoryBindingRule.vue.d.ts +25 -0
  88. package/dist/views/ingredients/components/inventory-binding/v2/components/InventoryRecipeBindingV2Field.vue.d.ts +125 -0
  89. package/dist/views/ingredients/components/inventory-binding/v2/components/InventorySkuBindingV2Field.vue.d.ts +129 -0
  90. package/dist/views/ingredients/components/inventory-binding/v2/composables/use-inventory-binding-alternative-table.d.ts +30 -0
  91. package/dist/views/ingredients/components/inventory-binding/v2/composables/use-inventory-binding-dialog.d.ts +4 -0
  92. package/dist/views/ingredients/composables/use-ingredient-table.d.ts +8 -1
  93. package/dist/views/integration/components/netsuite/InventoryTransferIngredientTable.vue.d.ts +16 -2
  94. package/dist/views/receive-request/components/transfer-form/TransferFormWithController.vue.d.ts +33 -5
  95. package/dist/views/receive-request/components/transfer-form/components/ForecastStock.vue.d.ts +16 -2
  96. package/dist/views/receive-request/components/transfer-form/components/TransferItemTable.vue.d.ts +32 -4
  97. package/dist/views/receive-request/components/transfer-form/composables/use-transfer-items.d.ts +8 -1
  98. package/dist/views/receive-request/composables/use-process-purchase-order.d.ts +41 -6
  99. package/dist/views/receive-request/composables/use-receive-request-form.d.ts +246 -36
  100. package/dist/views/receive-request/composables/use-receive-request-table.d.ts +287 -42
  101. package/dist/views/recipe/components/recipe-form/RecipeForm.vue.d.ts +16 -0
  102. package/dist/views/stock/components/dialog/AdjustedItemForm.vue.d.ts +16 -2
  103. package/dist/views/transfer-template/components/transfer-template-dialog/TransferTemplateDialog.vue.d.ts +16 -2
  104. package/dist/views/transfer-template/components/transfer-template-form/components/NetSuiteCustomCodeSelection.vue.d.ts +16 -2
  105. package/dist/views/transfer-template/components/transfer-template-form/components/TransferTemplateItemTable.vue.d.ts +16 -2
  106. package/dist/views/transfer-template/components/transfer-template-form/composables/use-transfer-template-items.d.ts +8 -1
  107. package/dist/views/transfer-template/composables/use-netsuite-custom-field.d.ts +24 -3
  108. package/dist/views/transfer-template/composables/use-transfer-template-actions.d.ts +96 -12
  109. package/dist/views/transfer-template/composables/use-transfer-template-table.d.ts +96 -12
  110. package/dist/{vue-i18n-BhCaMx-9.js → vue-i18n-CIhYwCeG.js} +321 -321
  111. package/dist/{xlsx-DJaY2xSF.js → xlsx-BcQjo8NU.js} +398 -398
  112. package/dist/{xlsx.util-CZq_uKdw.js → xlsx.util-GOcrvAJZ.js} +1 -1
  113. package/package.json +1 -1
  114. package/dist/RecipeView-Dv5BTxLT.js +0 -646
@@ -1,4 +1,4 @@
1
- import { r as m, u, a as d } from "./xlsx-DJaY2xSF.js";
1
+ import { r as m, u, a as d } from "./xlsx-BcQjo8NU.js";
2
2
  function* x(o) {
3
3
  const [e, n] = o.split(":"), t = /\d+/, l = t.exec(e), c = t.exec(n);
4
4
  if (!l || !c)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@feedmepos/mf-inventory-portal",
3
- "version": "1.2.55-dev.1",
3
+ "version": "1.2.56-dev.1",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"
@@ -1,646 +0,0 @@
1
- import { defineComponent as Y, ref as E, onMounted as ie, resolveComponent as F, openBlock as k, createElementBlock as B, Fragment as ue, createElementVNode as x, toDisplayString as ce, createVNode as y, createCommentVNode as q, computed as I, watch as de, createBlock as G, withCtx as U, unref as g, isRef as te, normalizeClass as me, normalizeStyle as pe, Teleport as fe, normalizeProps as ve, guardReactiveProps as ye } from "vue";
2
- import { a as A, c as Q, S as ge, F as H, j as ne, u as be } from "./app-Cq2T5z21.js";
3
- import { useDialog as re, useSnackbar as W, useProxiedModel as oe, useBreakpoints as _e } from "@feedmepos/ui-library";
4
- import { i as Re, _ as he } from "./is-linked-ingredient-error-fJ2TJb3z.js";
5
- import { F as C } from "./form-mode.enum-BKiNVH6A.js";
6
- import { _ as le } from "./IngredientBindedItem.vue_vue_type_script_setup_true_lang-DVELkyVY.js";
7
- import { defineStore as we, storeToRefs as Se } from "pinia";
8
- import { D as ae, R as K } from "./row-action.enum-BcW_L_nE.js";
9
- import { c as xe } from "./component-DpCUABT3.js";
10
- import { a as P, R as Ve, U as Ce, A as Ee } from "./rules-BdFLL1aa.js";
11
- import { useI18n as O } from "@feedmepos/mf-common";
12
- import { u as ke, _ as Fe } from "./SingleColumnLayout.vue_vue_type_script_setup_true_lang-CWZkVCAj.js";
13
- import { _ as Ie } from "./InventoryBindingForm.vue_vue_type_script_setup_true_lang-BVkTXQvA.js";
14
- import { _ as $e } from "./FmCustomAttribute.vue_vue_type_script_setup_true_lang-D-IWRjRD.js";
15
- import { u as De } from "./feature-KwyjpPTq.js";
16
- import { _ as Ae, F as se } from "./TableActionableRow.vue_vue_type_script_setup_true_lang-Ca_eYa8-.js";
17
- import { b as Be, d as Pe } from "./xlsx.util-CZq_uKdw.js";
18
- import { f as Ue } from "./date2-Dunl1OWI.js";
19
- import { _ as Te } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-UJewH4Il.js";
20
- const Me = {
21
- key: 0,
22
- class: "flex flex-col items-center w-full h-full gap-24"
23
- }, Ge = { key: 1 }, Ne = { key: 0 }, Le = /* @__PURE__ */ Y({
24
- __name: "DeleteDialog",
25
- props: {
26
- type: {},
27
- data: {},
28
- message: {},
29
- bindedItems: {}
30
- },
31
- setup(b) {
32
- const f = b, v = E(f.bindedItems || []), s = E(!1);
33
- ie(() => {
34
- r();
35
- });
36
- async function r() {
37
- var c, m;
38
- !s.value && ((c = f.data) != null && c._id) && (s.value = !0, v.value = await A().getAffectedMenu((m = f.data) == null ? void 0 : m._id), s.value = !1);
39
- }
40
- return (c, m) => {
41
- const w = F("FmSpacer"), l = F("FmCircularProgress");
42
- return k(), B(ue, null, [
43
- x("p", null, ce(c.message), 1),
44
- s.value ? (k(), B("div", Me, [
45
- y(w),
46
- x("div", null, [
47
- y(l, { size: "xl" })
48
- ]),
49
- m[0] || (m[0] = x("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary pl-8" }, "Loading...", -1)),
50
- y(w)
51
- ])) : (k(), B("div", Ge, [
52
- m[2] || (m[2] = x("br", null, null, -1)),
53
- v.value.length > 0 ? (k(), B("div", Ne, [
54
- m[1] || (m[1] = x("p", { class: "fm-typo-en-body-lg-600" }, "Affected menu items:", -1)),
55
- y(le, {
56
- name: "Menu",
57
- bindings: v.value
58
- }, null, 8, ["bindings"])
59
- ])) : q("", !0)
60
- ]))
61
- ], 64);
62
- };
63
- }
64
- }), J = we("recipeForm", function() {
65
- const f = re(), v = W(), s = A(), r = E(!1), c = E();
66
- function m() {
67
- const n = {
68
- recipe: {},
69
- mode: C.CREATE,
70
- show: !0,
71
- "onUpdate:show"(o) {
72
- c.value.show = o;
73
- }
74
- };
75
- c.value = n;
76
- }
77
- async function w(n) {
78
- const o = {
79
- recipe: Q(n),
80
- mode: C.UPDATE,
81
- show: !0,
82
- "onUpdate:show"(u) {
83
- c.value.show = u;
84
- }
85
- };
86
- c.value = o;
87
- }
88
- async function l(n) {
89
- r.value = !0;
90
- try {
91
- await s.deleteRecipe(n), v.open({
92
- title: "Success",
93
- message: `Deleted ${n.name}`,
94
- type: "success"
95
- });
96
- } catch (o) {
97
- o instanceof ge && Re(o) ? f.open({
98
- title: "Cannot delete recipe",
99
- contentComponent: he,
100
- contentComponentProps: {
101
- subject: (n == null ? void 0 : n.name) ?? "",
102
- items: o.errorResponse.message
103
- },
104
- secondaryActions: {
105
- text: "Close",
106
- close: !0
107
- }
108
- }) : console.log("unable to delete recipe", o), v.open({
109
- title: `Cannot delete ${n == null ? void 0 : n.name}`,
110
- message: "Please try again.",
111
- type: "error"
112
- }), console.error("failed to delete recipe", o);
113
- } finally {
114
- r.value = !1;
115
- }
116
- }
117
- function p(n) {
118
- f.open({
119
- title: `Delete ${(n == null ? void 0 : n.name) ?? "recipe"}?`,
120
- closeButton: !1,
121
- primaryActions: {
122
- text: "Delete",
123
- close: !0,
124
- variant: "destructive"
125
- },
126
- secondaryActions: {
127
- text: "Cancel",
128
- close: !0
129
- },
130
- contentComponent: Le,
131
- contentComponentProps: {
132
- type: "menu",
133
- data: n,
134
- message: "You may not be able to delete this recipe if it is linked in any of the inventory modules."
135
- }
136
- }).onPrimary(() => l(n));
137
- }
138
- return {
139
- createRecipe: m,
140
- updateRecipe: w,
141
- deleteRecipe: p,
142
- recipeDialogProps: c,
143
- recipeViewLoading: r
144
- };
145
- });
146
- function ze() {
147
- const { updateRecipe: b, deleteRecipe: f } = J(), v = A(), { t: s } = O();
148
- async function r(l, p) {
149
- const n = Q(p);
150
- if (l === K.Edit) {
151
- await b(n);
152
- return;
153
- }
154
- if (l === K.Delete) {
155
- await f(n);
156
- return;
157
- }
158
- }
159
- function c(l, p) {
160
- const n = l.filter((i) => i.type === H.enum.SKU), o = l.filter(
161
- (i) => i.type === H.enum.SKU_GROUP
162
- ), u = l.filter((i) => i.type === H.enum.RECIPE);
163
- return [
164
- ...n.map((i) => ({ ...i, recipeIds: [...p] })),
165
- ...o.map((i) => ({ ...i, isGroup: !0, recipeIds: [...p] })),
166
- ...u.filter((i) => v.recipeById[i.id] && !p.has(i.id)).flatMap(
167
- (i) => c(v.recipeById[i.id].contains, /* @__PURE__ */ new Set([...p, i.id]))
168
- )
169
- ];
170
- }
171
- const m = [
172
- {
173
- accessorKey: "recipe",
174
- header: () => s("inventory.recipe.name"),
175
- size: 400
176
- },
177
- {
178
- accessorKey: "ingredients",
179
- header: () => s("inventory.recipe.ingredients"),
180
- size: "auto"
181
- },
182
- {
183
- id: "action",
184
- header: "",
185
- cell(l) {
186
- return xe(
187
- [ae[K.Edit], ae[K.Delete]],
188
- (p) => {
189
- r(p, l.row.original.original);
190
- }
191
- );
192
- },
193
- enableSorting: !1,
194
- size: 40,
195
- meta: {
196
- cellClass: "",
197
- headerClass: ""
198
- }
199
- }
200
- ];
201
- function w(l) {
202
- const p = A();
203
- return l.map((n) => ({
204
- recipe: n.name,
205
- ingredients: c(n.contains, /* @__PURE__ */ new Set([n._id])).map((o) => {
206
- var i, S, e, d, _, h;
207
- if (o.isGroup) {
208
- const R = p.skuGroupById[o.id];
209
- return o.recipeIds.slice(1).length ? `(${(i = p.recipeById[o.recipeIds.at(-1) ?? ""]) == null ? void 0 : i.name}) ${R.name} (x ${P(o.amount)})` : `${R.name} (x${P(o.amount)})`;
210
- }
211
- const u = p.skuById[o.id];
212
- return u ? o.recipeIds.slice(1).length ? `(${(S = p.recipeById[o.recipeIds.at(-1) ?? ""]) == null ? void 0 : S.name}) ${u.name} (${P(o.amount)}${((e = o.measurement) == null ? void 0 : e.abbrev) ?? ((d = u == null ? void 0 : u.unit) == null ? void 0 : d.abbrev)})` : `${u.name} (${P(o.amount)}${((_ = o.measurement) == null ? void 0 : _.abbrev) ?? ((h = u == null ? void 0 : u.unit) == null ? void 0 : h.abbrev)})` : null;
213
- }).filter((o) => o).join(", "),
214
- original: n
215
- }));
216
- }
217
- return { columnDefs: m, formatRowData: w };
218
- }
219
- const je = { class: "flex flex-col gap-40" }, Ke = {
220
- key: 0,
221
- class: "col-span-2 mt-16 border-1 border-fm-color-neutral-gray-200 fm-corner-radius-lg flex flex-col p-16 gap-16"
222
- }, Ye = {
223
- key: 0,
224
- class: "flex flex-col items-center w-full h-full gap-24"
225
- }, Oe = { key: 1 }, He = { class: "mt-32" }, qe = /* @__PURE__ */ Y({
226
- __name: "RecipeForm",
227
- props: {
228
- mode: {},
229
- modelValue: {},
230
- disabled: { type: Boolean }
231
- },
232
- emits: ["update:modelValue", "click:submit"],
233
- setup(b, { expose: f, emit: v }) {
234
- var R;
235
- const s = b, r = v, c = De(), { t: m } = O(), w = I({
236
- get() {
237
- var t;
238
- return ((t = s.modelValue) == null ? void 0 : t.name) ?? "";
239
- },
240
- set(t) {
241
- const a = s.modelValue ?? {};
242
- a.name = t, r("update:modelValue", a);
243
- }
244
- }), l = I({
245
- get() {
246
- var t;
247
- return ((t = s.modelValue) == null ? void 0 : t.contains) ?? [];
248
- },
249
- set(t) {
250
- const a = s.modelValue ?? {};
251
- a.contains = t, r("update:modelValue", a);
252
- }
253
- }), p = I({
254
- get() {
255
- var t;
256
- return ((t = s.modelValue) == null ? void 0 : t.customAttributes) ?? {};
257
- },
258
- set(t) {
259
- const a = s.modelValue ? {
260
- ...s.modelValue
261
- } : {};
262
- a.customAttributes = t, r("update:modelValue", a);
263
- }
264
- });
265
- function n() {
266
- r("click:submit");
267
- }
268
- const o = E();
269
- f({
270
- validateInputs: () => {
271
- var t, a;
272
- (a = (t = o.value) == null ? void 0 : t.validateInputs) == null || a.call(t);
273
- },
274
- resetInputsValidation: () => {
275
- var t, a;
276
- (a = (t = o.value) == null ? void 0 : t.resetInputsValidation) == null || a.call(t);
277
- },
278
- resetInputs: () => {
279
- var t, a;
280
- (a = (t = o.value) == null ? void 0 : t.resetInputs) == null || a.call(t);
281
- }
282
- });
283
- const u = A(), i = E([]), S = E(!1), e = E(!1);
284
- de(S, async (t) => {
285
- d(t);
286
- });
287
- async function d(t) {
288
- var a, $;
289
- t && !e.value && ((a = s.modelValue) != null && a._id) && (e.value = !0, i.value = await u.getAffectedMenu(($ = s.modelValue) == null ? void 0 : $._id).delayed(500), e.value = !1);
290
- }
291
- const _ = I(
292
- () => u.recipes.map((t) => ({ label: t.name, value: t.name }))
293
- ), h = E((R = s.modelValue) == null ? void 0 : R.name);
294
- return (t, a) => {
295
- const $ = F("FmTextField"), D = F("FmCard"), N = F("FmSwitch"), M = F("FmSpacer"), L = F("FmCircularProgress"), T = F("FmForm");
296
- return k(), G(T, {
297
- ref_key: "formRef",
298
- ref: o,
299
- onValidationSuccess: n
300
- }, {
301
- default: U(() => [
302
- x("div", je, [
303
- y($, {
304
- disabled: t.disabled,
305
- label: g(m)("inventory.recipe.name"),
306
- "model-value": w.value,
307
- "onUpdate:modelValue": a[0] || (a[0] = (V) => w.value = V),
308
- rules: [
309
- g(Ve)(),
310
- g(Ce)(_.value, h.value, (V) => `[${V.value}] already exists`)
311
- ],
312
- "label-mark": "required"
313
- }, null, 8, ["disabled", "label", "model-value", "rules"]),
314
- y(D, {
315
- variant: "outlined",
316
- class: "p-16"
317
- }, {
318
- default: U(() => {
319
- var V;
320
- return [
321
- y(Ie, {
322
- id: (V = t.modelValue) == null ? void 0 : V._id,
323
- disabled: t.disabled,
324
- "model-value": l.value,
325
- "onUpdate:modelValue": a[1] || (a[1] = (z) => l.value = z),
326
- rules: [g(Ee)(1)],
327
- "enable-ingredient-group": g(c).enableIngredientGroup
328
- }, null, 8, ["id", "disabled", "model-value", "rules", "enable-ingredient-group"])
329
- ];
330
- }),
331
- _: 1
332
- })
333
- ]),
334
- t.mode !== g(C).CREATE ? (k(), B("div", Ke, [
335
- y(N, {
336
- label: "Show binded items",
337
- modelValue: S.value,
338
- "onUpdate:modelValue": a[2] || (a[2] = (V) => S.value = V),
339
- "label-placement": "right",
340
- disabled: e.value
341
- }, null, 8, ["modelValue", "disabled"]),
342
- e.value ? (k(), B("div", Ye, [
343
- y(M),
344
- x("div", null, [
345
- y(L, { size: "xl" })
346
- ]),
347
- a[4] || (a[4] = x("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary pl-8" }, "Loading...", -1)),
348
- y(M)
349
- ])) : S.value && i.value.length ? (k(), B("div", Oe, [
350
- y(le, {
351
- name: "Menu",
352
- bindings: i.value
353
- }, null, 8, ["bindings"])
354
- ])) : q("", !0)
355
- ])) : q("", !0),
356
- x("div", He, [
357
- y($e, {
358
- entity: "inventoryRecipe",
359
- modelValue: p.value,
360
- "onUpdate:modelValue": a[3] || (a[3] = (V) => p.value = V)
361
- }, null, 8, ["modelValue"])
362
- ])
363
- ]),
364
- _: 1
365
- }, 512);
366
- };
367
- }
368
- }), Je = { class: "flex gap-4" }, Qe = /* @__PURE__ */ Y({
369
- __name: "RecipeDialog",
370
- props: {
371
- show: { type: Boolean },
372
- recipe: {},
373
- mode: { default: C.READ }
374
- },
375
- emits: ["update:show"],
376
- setup(b) {
377
- const f = b, v = A(), s = W(), { t: r } = O(), c = oe(f, "show"), m = oe(f, "recipe"), w = I(() => {
378
- switch (f.mode) {
379
- case C.READ:
380
- return "";
381
- case C.UPDATE:
382
- return r("inventory.recipe.update.title");
383
- case C.CREATE:
384
- return r("inventory.recipe.create.title");
385
- }
386
- return "";
387
- }), l = I(() => {
388
- switch (f.mode) {
389
- case C.READ:
390
- return "";
391
- case C.UPDATE:
392
- return r("common.save");
393
- case C.CREATE:
394
- return r("common.add");
395
- }
396
- return "";
397
- }), p = E(), n = E(!1);
398
- async function o() {
399
- n.value = !0;
400
- try {
401
- const e = Q(m.value);
402
- e.precision ?? (e.precision = 0), e.measurements ?? (e.measurements = []), await v.createRecipe(e), c.value = !1, s.open({
403
- title: r("inventory.common.success"),
404
- message: r("inventory.recipe.create.success", { name: m.value.name }),
405
- type: "success"
406
- });
407
- } catch (e) {
408
- e instanceof ne || s.open({
409
- title: r("inventory.recipe.create.error.title"),
410
- message: r("inventory.recipe.create.error.message"),
411
- type: "error"
412
- });
413
- } finally {
414
- n.value = !1;
415
- }
416
- }
417
- async function u() {
418
- n.value = !0;
419
- try {
420
- await v.updateRecipe(m.value), c.value = !1, s.open({
421
- title: r("inventory.common.success"),
422
- message: r("inventory.recipe.update.success", { name: m.value.name }),
423
- type: "success"
424
- });
425
- } catch (e) {
426
- e instanceof ne || s.open({
427
- title: r("inventory.recipe.update.error.title"),
428
- message: r("inventory.recipe.update.error.message"),
429
- type: "error"
430
- });
431
- } finally {
432
- n.value = !1;
433
- }
434
- }
435
- function i() {
436
- var e, d;
437
- (d = (e = p.value) == null ? void 0 : e.validateInputs) == null || d.call(e);
438
- }
439
- function S() {
440
- switch (f.mode) {
441
- case C.READ:
442
- return;
443
- case C.UPDATE:
444
- return u();
445
- case C.CREATE:
446
- return o();
447
- }
448
- }
449
- return (e, d) => {
450
- const _ = F("FmButton"), h = F("FmSideSheet");
451
- return k(), G(h, {
452
- "model-value": g(c),
453
- "onUpdate:modelValue": d[3] || (d[3] = (R) => te(c) ? c.value = R : null),
454
- header: w.value,
455
- "close-button": "",
456
- "dismiss-away": "",
457
- "max-width": 500
458
- }, {
459
- "side-sheet-footer": U(() => [
460
- x("div", Je, [
461
- y(_, {
462
- loading: n.value,
463
- label: l.value,
464
- onClick: i
465
- }, null, 8, ["loading", "label"]),
466
- y(_, {
467
- disabled: n.value,
468
- label: g(r)("common.close"),
469
- variant: "tertiary",
470
- onClick: d[2] || (d[2] = (R) => c.value = !1)
471
- }, null, 8, ["disabled", "label"])
472
- ])
473
- ]),
474
- default: U(() => [
475
- y(qe, {
476
- class: "w-full",
477
- ref_key: "hasValidationExpose",
478
- ref: p,
479
- modelValue: g(m),
480
- "onUpdate:modelValue": d[0] || (d[0] = (R) => te(m) ? m.value = R : null),
481
- mode: e.mode,
482
- disabled: n.value,
483
- "onClick:submit": d[1] || (d[1] = (R) => S())
484
- }, null, 8, ["modelValue", "mode", "disabled"])
485
- ]),
486
- _: 1
487
- }, 8, ["model-value", "header"]);
488
- };
489
- }
490
- });
491
- function We(b) {
492
- return !b || Object.keys(b).length === 0 ? "" : Object.entries(b).map(([f, v]) => `${f}: ${v}`).join(", ");
493
- }
494
- function Xe() {
495
- const b = A(), f = b.recipes, v = b.recipeById, s = b.skuById, r = b.skuGroupById, c = f.flatMap((l, p) => {
496
- var o;
497
- const n = We(l.customAttributes);
498
- if ((o = l.contains) != null && o.length) {
499
- const u = l.contains.filter((e) => e.type === "RECIPE"), i = l.contains.filter((e) => e.type === "SKU"), S = l.contains.filter((e) => e.type === "SKU_GROUP");
500
- return [
501
- ...p === 0 ? [] : [["", "", "", "", "", "", ""]],
502
- ...u.map(
503
- (e, d) => {
504
- var _;
505
- return [
506
- d === 0 ? l.name : "",
507
- "RECIPE",
508
- "",
509
- (_ = v[e.id]) == null ? void 0 : _.name,
510
- P(e.amount),
511
- "UNIT",
512
- d === 0 ? n : ""
513
- ];
514
- }
515
- ),
516
- ...i.map(
517
- (e, d) => {
518
- var _, h, R, t;
519
- return [
520
- !u.length && d === 0 ? l.name : "",
521
- "INGREDIENT",
522
- (_ = s[e.id]) == null ? void 0 : _.code,
523
- (h = s[e.id]) == null ? void 0 : h.name,
524
- P(e.amount),
525
- e.measurement ? e.measurement.abbrev : (t = (R = s[e.id]) == null ? void 0 : R.unit) == null ? void 0 : t.abbrev,
526
- !u.length && d === 0 ? n : ""
527
- ];
528
- }
529
- ),
530
- ...S.map(
531
- (e, d) => {
532
- var _, h;
533
- return [
534
- u.length === 0 && i.length === 0 && d === 0 ? l.name : "",
535
- "SKU_GROUP",
536
- ((_ = r[e.id]) == null ? void 0 : _.ref) || "",
537
- (h = r[e.id]) == null ? void 0 : h.name,
538
- P(e.amount),
539
- "UNIT",
540
- u.length === 0 && i.length === 0 && d === 0 ? n : ""
541
- ];
542
- }
543
- )
544
- ];
545
- }
546
- return [
547
- ...p === 0 ? [] : [["", "", "", "", "", "", ""]],
548
- [l.name, "No bindings", "", "", "", "", n]
549
- ];
550
- }), w = Be(c, ["Name", "Type", "Code", "Item", "Amount", "Unit", "Custom Attributes"]);
551
- Pe(w, `RECIPE_${Ue(/* @__PURE__ */ new Date(), "-", "-")}.xlsx`);
552
- }
553
- const Ze = { class: "flex flex-col py-8" }, et = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, tt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, ht = /* @__PURE__ */ Y({
554
- __name: "RecipeView",
555
- setup(b) {
556
- const f = A(), v = I(() => f.recipes), s = be(), { createRecipe: r, updateRecipe: c } = J(), { recipeDialogProps: m, recipeViewLoading: w } = Se(J()), { columnDefs: l, formatRowData: p } = ze(), n = I(() => p(v.value));
557
- re(), W(), E(!1);
558
- function o(R) {
559
- if (R === "add")
560
- return r();
561
- if (R === "export")
562
- return Xe();
563
- }
564
- const u = E(""), i = I(() => w.value), { breakpoints: S } = _e(), e = I(() => S.value.xs || S.value.sm), d = I(() => e.value ? 10 : 20), _ = ke(), { t: h } = O();
565
- return (R, t) => {
566
- const a = F("FmTable");
567
- return k(), G(Fe, {
568
- title: g(h)("inventory.recipe.title"),
569
- actions: [
570
- {
571
- label: g(h)("inventory.recipe.create.title"),
572
- value: "add",
573
- isPrimary: !0,
574
- prependIcon: "add"
575
- },
576
- { label: g(h)("common.export"), value: "export", isPrimary: !1 }
577
- ],
578
- "onClick:action": o
579
- }, {
580
- default: U(() => [
581
- x("div", {
582
- class: me([
583
- "flex flex-col gap-8 max-h-full",
584
- {
585
- "p-0": e.value,
586
- "px-24 ": !e.value
587
- }
588
- ])
589
- }, [
590
- y(Te, {
591
- searchable: "",
592
- search: u.value,
593
- "onUpdate:search": t[0] || (t[0] = ($) => u.value = $)
594
- }, null, 8, ["search"]),
595
- (k(), G(a, {
596
- style: pe(g(_).tableHeight),
597
- "column-defs": g(l),
598
- "row-data": n.value,
599
- "search-value": u.value,
600
- loading: !g(s)._currentLocation || i.value,
601
- onRowClick: t[1] || (t[1] = ($) => g(c)($.original.original)),
602
- key: v.value.length,
603
- "page-size": d.value
604
- }, {
605
- "list-row": U(($) => [
606
- y(Ae, {
607
- row: $,
608
- onRowClick: (D) => g(c)(D.original)
609
- }, {
610
- default: U((D) => {
611
- var N, M, L, T, V, z, X, Z, j, ee;
612
- return [
613
- x("div", Ze, [
614
- x("div", et, [
615
- y(g(se), {
616
- render: (L = (M = (N = D.recipe) == null ? void 0 : N.column) == null ? void 0 : M.columnDef) == null ? void 0 : L.cell,
617
- props: (V = (T = D.recipe) == null ? void 0 : T.getContext) == null ? void 0 : V.call(T)
618
- }, null, 8, ["render", "props"])
619
- ]),
620
- x("div", tt, [
621
- y(g(se), {
622
- render: (Z = (X = (z = D.ingredients) == null ? void 0 : z.column) == null ? void 0 : X.columnDef) == null ? void 0 : Z.cell,
623
- props: (ee = (j = D.ingredients) == null ? void 0 : j.getContext) == null ? void 0 : ee.call(j)
624
- }, null, 8, ["render", "props"])
625
- ])
626
- ])
627
- ];
628
- }),
629
- _: 2
630
- }, 1032, ["row", "onRowClick"])
631
- ]),
632
- _: 1
633
- }, 8, ["style", "column-defs", "row-data", "search-value", "loading", "page-size"]))
634
- ], 2),
635
- (k(), G(fe, { to: "body" }, [
636
- y(Qe, ve(ye(g(m))), null, 16)
637
- ]))
638
- ]),
639
- _: 1
640
- }, 8, ["title", "actions"]);
641
- };
642
- }
643
- });
644
- export {
645
- ht as default
646
- };