@feedmepos/mf-inventory-portal 0.0.22-dev.5 → 0.0.22-dev.50

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 (144) hide show
  1. package/dist/ApprovalView-CyIOcyG5.js +140 -0
  2. package/dist/{BindingsDialog-DQJhC3Mo.js → BindingsDialog-BXePN5iL.js} +10 -10
  3. package/dist/{BindingsPicker-YfbPb_dG.js → BindingsPicker-Bd_qb0aO.js} +15 -15
  4. package/dist/{BindingsTable-D3MVcHXZ.js → BindingsTable-BV-nP9HU.js} +4 -4
  5. package/dist/ClosingTemplateView-CSvWLccZ.js +1829 -0
  6. package/dist/FmDroppableField-DwZ6ujPh.js +154 -0
  7. package/dist/FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-DpCoW_-F.js +266 -0
  8. package/dist/FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-BpzreBHD.js +435 -0
  9. package/dist/IngredientBindedItem.vue_vue_type_script_setup_true_lang-C8k7pSPT.js +51 -0
  10. package/dist/IngredientGroupView-C0hPeD41.js +608 -0
  11. package/dist/IngredientsView-CpwVIGXd.js +1608 -0
  12. package/dist/IntegrationView-Bt8pGAHS.js +1225 -0
  13. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-wsBLYBpB.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-yA-qJUUz.js} +1 -1
  14. package/dist/PremiumBadge.vue_vue_type_script_setup_true_lang-BqcqoKyN.js +116 -0
  15. package/dist/{PurchaseOrderPrintPreview-BcAmgmD8.js → PurchaseOrderPrintPreview-D3ugzCW_.js} +7 -7
  16. package/dist/ReceiveRequestView-D14YTEEe.js +4073 -0
  17. package/dist/RecipeView-D0WsMfKm.js +594 -0
  18. package/dist/Standalone.vue.d.ts +2 -0
  19. package/dist/StockView-sxI0L6MP.js +7770 -0
  20. package/dist/SupplierView-clAkARuW.js +1468 -0
  21. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-C9NU1m6S.js +1150 -0
  22. package/dist/TransferTemplateView-DpI6kVqX.js +1258 -0
  23. package/dist/{UnitView-B95q8Xrj.js → UnitView-CneJsDum.js} +18 -18
  24. package/dist/{WarehouseView-CHGXvyeS.js → WarehouseView-DYbFWTlh.js} +176 -177
  25. package/dist/api/bill.d.ts +84 -238
  26. package/dist/api/closing-template.d.ts +6 -4
  27. package/dist/api/inventory.d.ts +282 -91
  28. package/dist/api/netsuite.d.ts +71 -0
  29. package/dist/api/purchase-order-template.d.ts +4 -6
  30. package/dist/api/supplier.d.ts +1 -0
  31. package/dist/{app-CfXF4jdF.js → app-B4pi48sM.js} +26414 -24985
  32. package/dist/app.d.ts +88 -3
  33. package/dist/app.js +3 -3
  34. package/dist/components/FmFilterableMenuOptions.vue.d.ts +54 -0
  35. package/dist/components/FmMinMaxInputRules.d.ts +2 -0
  36. package/dist/components/FmMultiselectDialog.vue.d.ts +3 -9
  37. package/dist/components/FmMultiselectDialogProps.d.ts +0 -2
  38. package/dist/components/FmUnitInputRules.d.ts +2 -0
  39. package/dist/components/inventory-binding/InventoryBinding.vue.d.ts +5 -5
  40. package/dist/components/map/GoogleMap.vue.d.ts +4 -4
  41. package/dist/components/shell/inventory/binding-dialog.vue.d.ts +2 -2
  42. package/dist/components/shell/inventory/binding-ui.vue.d.ts +2 -2
  43. package/dist/{decimal-BZ7tX47r.js → decimal-C8O2p3Sg.js} +1 -1
  44. package/dist/defineDeepModel-BXP1vLGf.js +13 -0
  45. package/dist/extensions/array.d.ts +1 -0
  46. package/dist/format-time-from-id-DgW7OJL_.js +15 -0
  47. package/dist/format-unit-display-BP4O0Pym.js +1195 -0
  48. package/dist/helper/rules.d.ts +7 -0
  49. package/dist/helper/rules.spec.d.ts +1 -0
  50. package/dist/helper/xlsx.util.d.ts +7 -0
  51. package/dist/router/name.d.ts +1 -0
  52. package/dist/stores/api.d.ts +1 -0
  53. package/dist/stores/feature.d.ts +0 -1
  54. package/dist/stores/helper/core-store-proxy.d.ts +3 -0
  55. package/dist/stores/helper/generate-backend-urls.d.ts +1 -0
  56. package/dist/stores/integration/foodmarkethub.d.ts +391 -0
  57. package/dist/stores/integration/index.d.ts +7 -0
  58. package/dist/stores/integration/netsuite.d.ts +102 -0
  59. package/dist/stores/inventory.d.ts +294 -9
  60. package/dist/stores/location.d.ts +508 -503
  61. package/dist/stores/supplier.d.ts +124 -4
  62. package/dist/style.css +1 -1
  63. package/dist/supplier-D-8XhuF_.js +77 -0
  64. package/dist/tsconfig.app.tsbuildinfo +1 -1
  65. package/dist/use-template-enabled-locations-2-C2E4j3k-.js +85 -0
  66. package/dist/views/closing-template/closing-template-import/ClosingTemplateImport.vue.d.ts +2 -0
  67. package/dist/views/closing-template/closing-template-import/ClosingTemplateImportItem.vue.d.ts +12 -0
  68. package/dist/views/closing-template/closing-template-import/ClosingTemplateImportItemProps.d.ts +7 -0
  69. package/dist/views/closing-template/components/closing-template-form/composables/use-closing-template-items.d.ts +1 -1
  70. package/dist/views/closing-template/composables/use-closing-template-actions.d.ts +877 -1038
  71. package/dist/views/closing-template/composables/use-closing-template-table.d.ts +882 -1049
  72. package/dist/views/closing-template/helpers/import-export.helper.d.ts +58 -0
  73. package/dist/views/ingredient-group/IngredientGroupView.vue.d.ts +3 -0
  74. package/dist/views/ingredient-group/components/ingredient-group-dialog/IngredientGroupDialog.vue.d.ts +31 -0
  75. package/dist/views/ingredient-group/components/ingredient-group-dialog/IngredientGroupDialogProps.d.ts +12 -0
  76. package/dist/views/ingredient-group/components/ingredient-group-form/IngredientGroupForm.vue.d.ts +20 -0
  77. package/dist/views/ingredient-group/components/ingredient-group-form/IngredientGroupFormProps.d.ts +12 -0
  78. package/dist/views/ingredient-group/composables/use-ingredient-group-actions.d.ts +24 -0
  79. package/dist/views/ingredient-group/composables/use-ingredient-group-table.d.ts +215 -0
  80. package/dist/views/ingredients/components/convert/ConvertForm.vue.d.ts +2 -2
  81. package/dist/views/ingredients/components/ingredient-form/IngredientForm.vue.d.ts +2 -2
  82. package/dist/views/ingredients/components/inventory-binding/InventoryBindingForm.vue.d.ts +5 -5
  83. package/dist/views/ingredients/composables/use-ingredient-form.d.ts +2 -2
  84. package/dist/views/ingredients/composables/use-ingredient-table.d.ts +1 -1
  85. package/dist/views/integration/FoodMarketHub.vue.d.ts +2 -0
  86. package/dist/views/integration/NetSuite.vue.d.ts +2 -0
  87. package/dist/views/integration/components/ApplyProductDialog.vue.d.ts +7 -7
  88. package/dist/views/integration/components/ApplyProductDialogV4.vue.d.ts +7 -7
  89. package/dist/views/receive-request/components/transfer-details/TransferDetailsProps.d.ts +1 -0
  90. package/dist/views/receive-request/components/transfer-form/NetSuiteField.vue.d.ts +49 -0
  91. package/dist/views/receive-request/components/transfer-form/TransferForm.vue.d.ts +1961 -87
  92. package/dist/views/receive-request/components/transfer-form/TransferFormProps.d.ts +1 -0
  93. package/dist/views/receive-request/components/transfer-form/components/ForecastStock.vue.d.ts +2 -2
  94. package/dist/views/receive-request/components/transfer-form/composables/use-transfer-items.d.ts +1 -1
  95. package/dist/views/receive-request/composables/use-receive-request-form.d.ts +2377 -292
  96. package/dist/views/receive-request/composables/use-receive-request-table.d.ts +2329 -244
  97. package/dist/views/recipe/components/recipe-form/RecipeForm.vue.d.ts +2 -2
  98. package/dist/views/recipe/composables/use-recipe-form.d.ts +2 -2
  99. package/dist/views/stock/components/StockRecordCard.vue.d.ts +42 -119
  100. package/dist/views/stock/components/dialog/AdjustedItemForm.vue.d.ts +32 -2
  101. package/dist/views/stock/composables/use-stock-action.d.ts +2 -2
  102. package/dist/views/supplier/components/supplier-import/SupplierImport.vue.d.ts +2 -0
  103. package/dist/views/supplier/components/supplier-import/SupplierImportItem.vue.d.ts +12 -0
  104. package/dist/views/supplier/components/supplier-import/SupplierImportItemProps.d.ts +6 -0
  105. package/dist/views/supplier/composables/use-supplier-actions.d.ts +10 -0
  106. package/dist/views/supplier/helpers/import-export.helper.d.ts +50 -0
  107. package/dist/views/transfer-template/components/transfer-template-details/TransferTemplateDetails.vue.d.ts +0 -2
  108. package/dist/views/transfer-template/components/transfer-template-details/TransferTemplateDetailsProps.d.ts +0 -1
  109. package/dist/views/transfer-template/components/transfer-template-form/composables/use-template-enabled-locations-2.d.ts +13 -0
  110. package/dist/views/transfer-template/components/transfer-template-form/composables/use-template-enabled-locations.d.ts +71 -85
  111. package/dist/views/transfer-template/components/transfer-template-form/composables/use-transfer-locations.d.ts +39 -2
  112. package/dist/views/transfer-template/components/transfer-template-form/composables/use-transfer-template-items.d.ts +1 -1
  113. package/dist/views/transfer-template/components/transfer-template-import/TransferTemplateImport.vue.d.ts +2 -0
  114. package/dist/views/transfer-template/components/transfer-template-import/TransferTemplateImportItem.vue.d.ts +12 -0
  115. package/dist/views/transfer-template/components/transfer-template-import/TransferTemplateImportItemProps.d.ts +9 -0
  116. package/dist/views/transfer-template/composables/use-transfer-template-actions.d.ts +1277 -1478
  117. package/dist/views/transfer-template/composables/use-transfer-template-table.d.ts +1697 -906
  118. package/dist/views/transfer-template/helpers/import-export.helper.d.ts +76 -0
  119. package/dist/views/transfer-template/helpers/remove-deleted-skus.helper.d.ts +1 -247
  120. package/dist/views/transfer-template/helpers/template-item.error.helper.d.ts +1 -0
  121. package/dist/views/unit/composables/use-unit-form.d.ts +2 -2
  122. package/dist/{xlsx-BtP1Qjj6.js → xlsx-Dsy-fxZw.js} +1525 -1525
  123. package/dist/xlsx.util-CxGmvsp9.js +78 -0
  124. package/package.json +10 -7
  125. package/dist/ApprovalView-BdaNwUBc.js +0 -129
  126. package/dist/ClosingTemplateView-BpErgepi.js +0 -1030
  127. package/dist/FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-D3B7kOlU.js +0 -372
  128. package/dist/IngredientsView-GqrkpCm5.js +0 -1758
  129. package/dist/IntegrationView-7c3MpUzS.js +0 -1141
  130. package/dist/PremiumBadge.vue_vue_type_script_setup_true_lang-BIwdObb1.js +0 -88
  131. package/dist/ReceiveRequestView-BAuXvzQW.js +0 -215
  132. package/dist/RecipeView-C6tZPQ-K.js +0 -581
  133. package/dist/StockView-4uXHYz4E.js +0 -1892
  134. package/dist/SupplierView-CuWvKCWY.js +0 -827
  135. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-CTQ9HIqf.js +0 -740
  136. package/dist/TransferDialog.vue_vue_type_script_setup_true_lang--6JoXOLD.js +0 -1409
  137. package/dist/TransferTemplateView-D1Lfi3aW.js +0 -1230
  138. package/dist/defineDeepModel-BKAs9qN6.js +0 -13
  139. package/dist/format-time-from-id-B7ZE4sdX.js +0 -15
  140. package/dist/id-to-date-D1lOqIir.js +0 -30
  141. package/dist/purchase-order-transaction-type-tZ7cj1dz.js +0 -702
  142. package/dist/supplier-BIDBk5S6.js +0 -69
  143. package/dist/use-template-enabled-locations-DlMnS9WJ.js +0 -57
  144. package/dist/xlsx.util-BKFiH-ig.js +0 -109
@@ -0,0 +1,608 @@
1
+ import { ref as C, computed as I, defineComponent as Y, resolveComponent as S, openBlock as M, createBlock as O, withCtx as R, createElementVNode as x, createVNode as g, unref as l, createElementBlock as ee, toDisplayString as H, createTextVNode as te, watch as ue, isRef as ce, normalizeClass as de, normalizeStyle as me, createSlots as pe, Teleport as fe, normalizeProps as ve, guardReactiveProps as ge } from "vue";
2
+ import { u as J, c as B, R as ye, A as be, j as oe, e as ne, i as _e } from "./app-B4pi48sM.js";
3
+ import { useDialog as le, useSnackbar as Z, useProxiedModel as xe, useBreakpoints as ke } from "@feedmepos/ui-library";
4
+ import { F as h, D as se, R as Q } from "./row-action.enum-PMKMRrZR.js";
5
+ import { useI18n as W } from "@feedmepos/mf-common";
6
+ import { defineStore as ie, storeToRefs as ae } from "pinia";
7
+ import "vue-router";
8
+ import { c as he, _ as we, F as re } from "./TableActionableRow.vue_vue_type_script_setup_true_lang-DlNJ6kRg.js";
9
+ import { u as Se, _ as Fe, a as Ie } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-BpzreBHD.js";
10
+ import { d as Ce } from "./defineDeepModel-BXP1vLGf.js";
11
+ const X = ie(
12
+ "ingredientGroupactions",
13
+ function() {
14
+ const c = le(), w = Z(), o = J(), { t: r } = W(), i = C();
15
+ function p() {
16
+ const d = {
17
+ modelValue: {},
18
+ mode: h.CREATE,
19
+ show: !0,
20
+ "onUpdate:show"(a) {
21
+ i.value.show = a;
22
+ }
23
+ };
24
+ i.value = d;
25
+ }
26
+ async function v(d) {
27
+ const a = {
28
+ modelValue: B(d),
29
+ mode: h.UPDATE,
30
+ show: !0,
31
+ "onUpdate:show"(s) {
32
+ i.value.show = s;
33
+ }
34
+ };
35
+ i.value = a;
36
+ }
37
+ async function f(d, a, s) {
38
+ a.value = !0;
39
+ try {
40
+ await o.deleteSkuGroup(d), w.open({
41
+ title: "Success",
42
+ message: `Deleted ${d.name}`,
43
+ type: "success"
44
+ });
45
+ } catch (n) {
46
+ w.open({
47
+ title: `Cannot delete ${d.name}`,
48
+ message: "Please try again.",
49
+ type: "error"
50
+ }), console.error("failed to delete ingredient", n);
51
+ } finally {
52
+ a.value = !1, s();
53
+ }
54
+ }
55
+ function y(d, a, s) {
56
+ c.open({
57
+ title: r("inventory.ingredient.delete.title", [(d == null ? void 0 : d.name) ?? ""]),
58
+ closeButton: !1,
59
+ message: r("inventory.ingredient.delete.message"),
60
+ primaryActions: {
61
+ text: r("common.delete"),
62
+ close: !0,
63
+ variant: "destructive"
64
+ },
65
+ secondaryActions: {
66
+ text: r("common.cancel"),
67
+ close: !0
68
+ }
69
+ }).onPrimary(() => f(d, a, s));
70
+ }
71
+ function A() {
72
+ }
73
+ function b() {
74
+ }
75
+ return {
76
+ createIngredientGroup: p,
77
+ updateIngredientGroup: v,
78
+ deleteIngredientGroup: y,
79
+ importIngredientGroups: A,
80
+ exportIngredientGroups: b,
81
+ ingredientGroupDialogProps: i
82
+ };
83
+ }
84
+ ), Ae = ie(
85
+ "ingredientGroupTable",
86
+ function() {
87
+ const c = C(!1), w = Z(), o = J(), r = X();
88
+ async function i() {
89
+ c.value = !0;
90
+ try {
91
+ await o.readInventory();
92
+ } catch (f) {
93
+ console.error("error on reading inventory", f), w.open({
94
+ title: "Error",
95
+ message: "Something went wrong, please try again.",
96
+ type: "error"
97
+ });
98
+ } finally {
99
+ c.value = !1;
100
+ }
101
+ }
102
+ function p(f, y) {
103
+ switch (y = B(y), f) {
104
+ case Q.Edit:
105
+ return r.updateIngredientGroup(y);
106
+ case Q.Delete:
107
+ return r.deleteIngredientGroup(
108
+ y,
109
+ c,
110
+ () => i()
111
+ );
112
+ }
113
+ }
114
+ const v = I(() => [
115
+ {
116
+ accessorKey: "name",
117
+ header: () => "Name"
118
+ },
119
+ {
120
+ accessorKey: "skus.length",
121
+ header: () => "No. of items"
122
+ },
123
+ {
124
+ accessorKey: "ref",
125
+ header: () => "Reference"
126
+ },
127
+ {
128
+ id: "action",
129
+ header: "",
130
+ cell(f) {
131
+ return he(
132
+ [se[Q.Edit], se[Q.Delete]],
133
+ (y) => {
134
+ p(y, f.row.original);
135
+ }
136
+ );
137
+ },
138
+ enableSorting: !1,
139
+ size: 40,
140
+ meta: {
141
+ cellClass: "",
142
+ headerClass: ""
143
+ }
144
+ }
145
+ ]);
146
+ return {
147
+ fetchIngredientGroups: i,
148
+ loading: c,
149
+ columnDefs: v
150
+ };
151
+ }
152
+ ), De = { class: "flex flex-col gap-16" }, Ge = { class: "flex flex-col gap-8 cursor-pointer" }, Ve = {
153
+ key: 0,
154
+ class: "text-fm-color-typo-primary fm-typo-en-body-lg-400 line-clamp-1 break-all"
155
+ }, Ee = { class: "text-fm-color-typo-secondary" }, Re = {
156
+ key: 1,
157
+ class: "text-fm-color-typo-secondary fm-typo-en-body-lg-400 line-clamp-1 break-all"
158
+ }, Te = { class: "text-fm-color-typo-secondary fm-typo-en-body-sm-400 flex flex-col gap-4" }, $e = { class: "flex flex-col gap-16" }, Pe = { class: "flex items-center" }, Me = /* @__PURE__ */ Y({
159
+ __name: "IngredientGroupForm",
160
+ props: {
161
+ mode: {},
162
+ disabled: { type: Boolean },
163
+ modelValue: {}
164
+ },
165
+ emits: ["validation-success"],
166
+ setup(U, { expose: c, emit: w }) {
167
+ const o = Ce("modelValue"), r = w, i = J(), p = le(), { t: v } = W(), f = C();
168
+ c({
169
+ validateInputs: () => {
170
+ var a;
171
+ return (a = f.value) == null ? void 0 : a.validateInputs();
172
+ },
173
+ resetInputsValidation: () => {
174
+ var a;
175
+ return (a = f.value) == null ? void 0 : a.resetInputsValidation();
176
+ },
177
+ resetInputs: () => {
178
+ var a;
179
+ return (a = f.value) == null ? void 0 : a.resetInputs();
180
+ }
181
+ });
182
+ const y = I(() => i.skus.groupBy((a) => a.unit._id));
183
+ function A() {
184
+ var s;
185
+ const a = i.skus.filter((n) => {
186
+ var t;
187
+ return (((t = y.value.get(n.unit._id)) == null ? void 0 : t.length) ?? 0) > 1;
188
+ }).map((n) => ({
189
+ label: n.name,
190
+ sublabel: n.code,
191
+ value: n
192
+ })).sort((n, t) => {
193
+ var e, u, _, m;
194
+ return (m = (e = n.value) == null ? void 0 : e.unit) == null ? void 0 : m.abbrev.localeCompare((_ = (u = t.value) == null ? void 0 : u.unit) == null ? void 0 : _.abbrev);
195
+ });
196
+ p.open({
197
+ title: v("inventory.closing.form.items.selectItem"),
198
+ closeButton: !0,
199
+ contentComponent: oe,
200
+ contentComponentProps: {
201
+ modelValue: [(s = o.skus) == null ? void 0 : s[0]],
202
+ items: a,
203
+ singleSelect: !0,
204
+ virtualScroll: !0
205
+ },
206
+ primaryActions: {
207
+ text: v("common.confirm"),
208
+ close: !0
209
+ },
210
+ secondaryActions: {
211
+ text: v("common.close"),
212
+ close: !0,
213
+ variant: "tertiary"
214
+ }
215
+ }).onPrimary((n) => {
216
+ var t;
217
+ o.skus = n.map((e) => B(e)), o.unit = ((t = n[0]) == null ? void 0 : t.unit) ?? o.unit;
218
+ });
219
+ }
220
+ function b() {
221
+ const a = i.skus.filter((n) => {
222
+ var t, e, u;
223
+ return n.unit._id === ((t = o == null ? void 0 : o.unit) == null ? void 0 : t._id) && n._id !== ((u = (e = o.skus) == null ? void 0 : e[0]) == null ? void 0 : u._id);
224
+ }).map((n) => ({
225
+ label: n.name,
226
+ sublabel: n.code,
227
+ value: n
228
+ })).sort((n, t) => {
229
+ var e, u, _, m;
230
+ return (m = (e = n.value) == null ? void 0 : e.unit) == null ? void 0 : m.abbrev.localeCompare((_ = (u = t.value) == null ? void 0 : u.unit) == null ? void 0 : _.abbrev);
231
+ }), s = a.filter((n) => {
232
+ var t;
233
+ return (t = o.skus) == null ? void 0 : t.find((e) => (e == null ? void 0 : e._id) === n.value._id);
234
+ }).map((n) => n.value);
235
+ p.open({
236
+ title: v("inventory.closing.form.items.selectItem"),
237
+ closeButton: !0,
238
+ contentComponent: oe,
239
+ contentComponentProps: {
240
+ modelValue: s,
241
+ items: a,
242
+ virtualScroll: !0
243
+ },
244
+ primaryActions: {
245
+ text: v("common.confirm"),
246
+ close: !0
247
+ },
248
+ secondaryActions: {
249
+ text: v("common.close"),
250
+ close: !0,
251
+ variant: "tertiary"
252
+ }
253
+ }).onPrimary((n) => {
254
+ var u, _;
255
+ const t = ((u = o.skus) == null ? void 0 : u.slice(1)) ?? [], e = n.map((m) => {
256
+ const D = t.find((G) => (G == null ? void 0 : G._id) === m._id);
257
+ return D || B(m, ["unit"]);
258
+ });
259
+ o.skus = [(_ = o.skus) == null ? void 0 : _[0], ...e];
260
+ });
261
+ }
262
+ const d = [
263
+ {
264
+ accessorKey: "code",
265
+ header: () => "Code",
266
+ enableSorting: !1
267
+ },
268
+ {
269
+ accessorKey: "name",
270
+ header: () => "Name",
271
+ enableSorting: !1
272
+ }
273
+ ];
274
+ return (a, s) => {
275
+ const n = S("FmTextField"), t = S("FmLabel"), e = S("FmField"), u = S("FmFormGroup"), _ = S("FmButton"), m = S("FmTable"), D = S("FmForm");
276
+ return M(), O(D, {
277
+ onValidationSuccess: s[5] || (s[5] = (F) => r("validation-success")),
278
+ ref_key: "formRef",
279
+ ref: f,
280
+ class: "flex flex-col gap-32"
281
+ }, {
282
+ default: R(() => {
283
+ var F, G, V, T, L;
284
+ return [
285
+ x("div", De, [
286
+ g(n, {
287
+ label: "Name",
288
+ "label-mark": "required",
289
+ rules: [l(ye)()],
290
+ modelValue: l(o).name,
291
+ "onUpdate:modelValue": s[0] || (s[0] = (k) => l(o).name = k)
292
+ }, null, 8, ["rules", "modelValue"]),
293
+ g(n, {
294
+ label: "Reference",
295
+ "label-mark": "optional",
296
+ modelValue: l(o).ref,
297
+ "onUpdate:modelValue": s[1] || (s[1] = (k) => l(o).ref = k)
298
+ }, null, 8, ["modelValue"]),
299
+ x("div", Ge, [
300
+ g(t, {
301
+ label: "Main ingredient",
302
+ required: ""
303
+ }),
304
+ g(e, {
305
+ onClick: s[2] || (s[2] = (k) => A())
306
+ }, {
307
+ default: R(() => {
308
+ var k, E, $, z, N, K, q, P, j;
309
+ return [
310
+ ($ = (E = (k = l(o)) == null ? void 0 : k.skus) == null ? void 0 : E[0]) != null && $.name ? (M(), ee("span", Ve, [
311
+ x("span", Ee, "[" + H((K = (N = (z = l(o)) == null ? void 0 : z.skus) == null ? void 0 : N[0]) == null ? void 0 : K.code) + "]", 1),
312
+ te(" " + H((j = (P = (q = l(o)) == null ? void 0 : q.skus) == null ? void 0 : P[0]) == null ? void 0 : j.name), 1)
313
+ ])) : (M(), ee("span", Re, H("Click to select main item")))
314
+ ];
315
+ }),
316
+ _: 1
317
+ }),
318
+ x("div", Te, [
319
+ s[6] || (s[6] = te(H("Select a main item to filter out substitutable items with same unit.") + " ")),
320
+ g(u, {
321
+ "model-value": ((F = l(o)) == null ? void 0 : F.skus) ?? [],
322
+ rules: [l(be)(1, "Required")]
323
+ }, null, 8, ["model-value", "rules"])
324
+ ])
325
+ ])
326
+ ]),
327
+ x("div", $e, [
328
+ x("div", Pe, [
329
+ s[7] || (s[7] = x("div", { class: "flex-1 fm-typo-en-title-sm-600" }, "Substitutables", -1)),
330
+ x("div", null, [
331
+ g(_, {
332
+ label: "Add items",
333
+ disabled: (((V = (G = l(o)) == null ? void 0 : G.skus) == null ? void 0 : V.length) ?? 0) < 1,
334
+ onClick: s[3] || (s[3] = (k) => b()),
335
+ "prepend-icon": "add",
336
+ variant: "secondary",
337
+ "text-color": "primary",
338
+ "bg-color": "transparent",
339
+ "border-color": "primary"
340
+ }, null, 8, ["disabled"])
341
+ ])
342
+ ]),
343
+ g(m, {
344
+ "shrink-at": 9999,
345
+ "column-defs": d,
346
+ "row-data": (T = l(o).skus) == null ? void 0 : T.slice(1),
347
+ onDndChanged: s[4] || (s[4] = (k) => {
348
+ var E;
349
+ return l(o).skus = [(E = l(o).skus) == null ? void 0 : E[0], ...k];
350
+ }),
351
+ draggable: "",
352
+ "hide-footer": "",
353
+ "page-size": ((L = l(o).skus) == null ? void 0 : L.length) ?? 0
354
+ }, null, 8, ["row-data", "page-size"])
355
+ ])
356
+ ];
357
+ }),
358
+ _: 1
359
+ }, 512);
360
+ };
361
+ }
362
+ }), Be = { class: "flex gap-4" }, Ue = /* @__PURE__ */ Y({
363
+ __name: "IngredientGroupDialog",
364
+ props: {
365
+ show: { type: Boolean },
366
+ mode: { default: h.READ },
367
+ modelValue: {}
368
+ },
369
+ emits: ["update:show"],
370
+ setup(U) {
371
+ const c = U, w = J(), o = Z(), { t: r } = W(), i = xe(c, "show"), p = C({}), v = C(`${Math.random()}`);
372
+ ue(
373
+ () => c.show,
374
+ (t) => {
375
+ t && (Object.keys(p.value).forEach((e) => {
376
+ delete p.value[e];
377
+ }), Object.keys(c.modelValue ?? {}).forEach((e) => {
378
+ var u;
379
+ p.value[e] = (u = c.modelValue) == null ? void 0 : u[e];
380
+ }), v.value = `${Math.random()}`);
381
+ }
382
+ );
383
+ const f = I(() => {
384
+ switch (c.mode) {
385
+ case h.READ:
386
+ return "";
387
+ case h.UPDATE:
388
+ return r("inventory.ingredient.update.title");
389
+ case h.CREATE:
390
+ return r("inventory.ingredient.create.title");
391
+ }
392
+ return "";
393
+ }), y = I(() => {
394
+ switch (c.mode) {
395
+ case h.READ:
396
+ return "";
397
+ case h.UPDATE:
398
+ return r("common.save");
399
+ case h.CREATE:
400
+ return r("common.add");
401
+ }
402
+ return "";
403
+ }), A = C(), b = C(!1);
404
+ async function d() {
405
+ b.value = !0;
406
+ const t = B(p.value);
407
+ try {
408
+ await w.createSkuGroup(t), i.value = !1, o.open({
409
+ title: r("inventory.common.success"),
410
+ message: r("inventory.ingredient.create.success", { name: t.name }),
411
+ type: "success"
412
+ });
413
+ } catch (e) {
414
+ e instanceof ne || o.open({
415
+ title: r("inventory.ingredient.create.error.title"),
416
+ message: r("inventory.ingredient.create.error.message"),
417
+ type: "error"
418
+ });
419
+ } finally {
420
+ b.value = !1;
421
+ }
422
+ }
423
+ async function a() {
424
+ b.value = !0;
425
+ const t = B(p.value);
426
+ try {
427
+ await w.updateSkuGroup(t), b.value = !1, i.value = !1, o.open({
428
+ title: r("inventory.common.success"),
429
+ message: r("inventory.ingredient.update.success", { name: t.name }),
430
+ type: "success"
431
+ });
432
+ } catch (e) {
433
+ e instanceof ne || o.open({
434
+ title: r("inventory.ingredient.update.error.title"),
435
+ message: r("inventory.ingredient.update.error.message"),
436
+ type: "error"
437
+ });
438
+ } finally {
439
+ b.value = !1;
440
+ }
441
+ }
442
+ function s() {
443
+ var t, e;
444
+ (e = (t = A.value) == null ? void 0 : t.validateInputs) == null || e.call(t);
445
+ }
446
+ function n() {
447
+ switch (c.mode) {
448
+ case h.READ:
449
+ return;
450
+ case h.UPDATE:
451
+ return a();
452
+ case h.CREATE:
453
+ return d();
454
+ }
455
+ }
456
+ return (t, e) => {
457
+ const u = S("FmButton"), _ = S("FmSideSheet");
458
+ return M(), O(_, {
459
+ "model-value": l(i),
460
+ "onUpdate:modelValue": e[3] || (e[3] = (m) => ce(i) ? i.value = m : null),
461
+ header: f.value,
462
+ "close-button": "",
463
+ "dismiss-away": "",
464
+ "max-width": 500
465
+ }, {
466
+ "side-sheet-footer": R(() => [
467
+ x("div", Be, [
468
+ g(u, {
469
+ loading: b.value,
470
+ label: y.value,
471
+ onClick: s
472
+ }, null, 8, ["loading", "label"]),
473
+ g(u, {
474
+ disabled: b.value,
475
+ label: l(r)("common.close"),
476
+ variant: "tertiary",
477
+ onClick: e[2] || (e[2] = (m) => i.value = !1)
478
+ }, null, 8, ["disabled", "label"])
479
+ ])
480
+ ]),
481
+ default: R(() => [
482
+ (M(), O(Me, {
483
+ class: "w-full",
484
+ ref_key: "hasValidationExpose",
485
+ ref: A,
486
+ key: v.value,
487
+ "model-value": p.value,
488
+ "onUpdate:modelValue": e[0] || (e[0] = (m) => p.value = m),
489
+ mode: t.mode,
490
+ disabled: b.value,
491
+ onValidationSuccess: e[1] || (e[1] = (m) => n())
492
+ }, null, 8, ["model-value", "mode", "disabled"]))
493
+ ]),
494
+ _: 1
495
+ }, 8, ["model-value", "header"]);
496
+ };
497
+ }
498
+ }), Le = { class: "flex flex-col py-8" }, ze = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Ne = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, Ze = /* @__PURE__ */ Y({
499
+ __name: "IngredientGroupView",
500
+ setup(U) {
501
+ const c = J(), w = I(() => c.skuGroups), o = _e(), { t: r } = W(), {
502
+ createIngredientGroup: i,
503
+ updateIngredientGroup: p,
504
+ importIngredientGroups: v,
505
+ exportIngredientGroups: f
506
+ } = X(), { columnDefs: y, loading: A } = ae(Ae()), { ingredientGroupDialogProps: b } = ae(X());
507
+ function d(D) {
508
+ switch (D) {
509
+ case "add":
510
+ return i();
511
+ case "import":
512
+ return v();
513
+ case "export":
514
+ return f();
515
+ }
516
+ }
517
+ const a = C(""), s = C(!1), n = I(() => s.value || A.value), { breakpoints: t } = ke(), e = I(() => t.value.xs || t.value.sm), u = I(() => e.value ? 10 : 20), _ = Se(), m = I(() => [
518
+ {
519
+ label: r("inventory.ingredient.create.title"),
520
+ value: "add",
521
+ isPrimary: !0,
522
+ prependIcon: "add"
523
+ },
524
+ { label: r("common.import"), value: "import" },
525
+ { label: r("common.export"), value: "export" }
526
+ ]);
527
+ return (D, F) => {
528
+ const G = S("FmTable");
529
+ return M(), O(Fe, {
530
+ title: l(r)("inventory.ingredientGroup.title"),
531
+ actions: m.value,
532
+ "onClick:action": d
533
+ }, {
534
+ default: R(() => [
535
+ x("div", {
536
+ class: de([
537
+ "flex flex-col gap-8 max-h-full",
538
+ {
539
+ "p-0": e.value,
540
+ "px-24 ": !e.value
541
+ }
542
+ ])
543
+ }, [
544
+ g(Ie, {
545
+ searchable: "",
546
+ search: a.value,
547
+ "onUpdate:search": F[0] || (F[0] = (V) => a.value = V)
548
+ }, null, 8, ["search"]),
549
+ g(G, {
550
+ style: me(l(_).tableHeight),
551
+ "column-defs": l(y),
552
+ "row-data": w.value,
553
+ "search-value": a.value,
554
+ loading: !l(o)._currentLocation || n.value,
555
+ "loading-text": "Loading",
556
+ onRowClick: F[1] || (F[1] = (V) => l(p)(V.original)),
557
+ "page-size": u.value
558
+ }, {
559
+ "list-row": R((V) => [
560
+ g(we, {
561
+ row: V,
562
+ onRowClick: l(p)
563
+ }, pe({
564
+ default: R((T) => {
565
+ var L, k, E, $, z, N, K, q, P, j;
566
+ return [
567
+ x("div", Le, [
568
+ x("div", ze, [
569
+ g(l(re), {
570
+ render: (E = (k = (L = T.code) == null ? void 0 : L.column) == null ? void 0 : k.columnDef) == null ? void 0 : E.cell,
571
+ props: (z = ($ = T.code) == null ? void 0 : $.getContext) == null ? void 0 : z.call($)
572
+ }, null, 8, ["render", "props"])
573
+ ]),
574
+ x("div", Ne, [
575
+ g(l(re), {
576
+ render: (q = (K = (N = T.name) == null ? void 0 : N.column) == null ? void 0 : K.columnDef) == null ? void 0 : q.cell,
577
+ props: (j = (P = T.name) == null ? void 0 : P.getContext) == null ? void 0 : j.call(P)
578
+ }, null, 8, ["render", "props"])
579
+ ])
580
+ ])
581
+ ];
582
+ }),
583
+ _: 2
584
+ }, [
585
+ s.value ? {
586
+ name: "loading-text",
587
+ fn: R(() => [
588
+ x("div", null, H(l(r)("inventory.ingredient.table.importing")), 1)
589
+ ]),
590
+ key: "0"
591
+ } : void 0
592
+ ]), 1032, ["row", "onRowClick"])
593
+ ]),
594
+ _: 1
595
+ }, 8, ["style", "column-defs", "row-data", "search-value", "loading", "page-size"])
596
+ ], 2),
597
+ (M(), O(fe, { to: "body" }, [
598
+ g(Ue, ve(ge(l(b))), null, 16)
599
+ ]))
600
+ ]),
601
+ _: 1
602
+ }, 8, ["title", "actions"]);
603
+ };
604
+ }
605
+ });
606
+ export {
607
+ Ze as default
608
+ };