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