@feedmepos/mf-inventory-portal 1.2.1 → 1.2.2-5.dev-1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (147) hide show
  1. package/dist/App-DMkUg806.js +297 -0
  2. package/dist/{ApprovalView-DwRrbVDo.js → ApprovalView-DWJh2K6W.js} +65 -64
  3. package/dist/{BindingsDialog-DUVKv10-.js → BindingsDialog-EmHCvqJI.js} +2 -2
  4. package/dist/{BindingsPicker-Daib_iq4.js → BindingsPicker-h_9jm1s0.js} +3 -3
  5. package/dist/{BindingsTable-Bv9UmcJP.js → BindingsTable-BAVWGUoa.js} +1 -1
  6. package/dist/ClosingDraftView-Du4kOwIg.js +1899 -0
  7. package/dist/ClosingHistoryView-DuW2Vtrs.js +355 -0
  8. package/dist/ClosingTemplateView-CfPY8R5M.js +2001 -0
  9. package/dist/{DeliveryOrderPrintPreview-DZPcRAja.js → DeliveryOrderPrintPreview-C6Cj8mOp.js} +9 -9
  10. package/dist/FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-WWIrybw_.js +230 -0
  11. package/dist/{FmMultiselectDialog-CZmwOkrb.js → FmMultiselectDialog-BzWrQOS4.js} +1 -1
  12. package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-C-2V2bGc.js → FmUnitInput.vue_vue_type_script_setup_true_lang-DwqVRUFz.js} +36 -36
  13. package/dist/ImportView-lKlYeLay.js +1291 -0
  14. package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-BGnoF1Zz.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-_2WZMZU2.js} +5 -5
  15. package/dist/{IngredientGroupView-CAVYpEj3.js → IngredientGroupView-CrmwR2Xt.js} +34 -35
  16. package/dist/IngredientsView-1bAsyz-b.js +2254 -0
  17. package/dist/{IntegrationView-DdLFyZ4H.js → IntegrationView-D16qeEc_.js} +1773 -1635
  18. package/dist/{InventoryBindingForm-C7BdEDtM.js → InventoryBindingForm-BRwOXV_P.js} +1 -1
  19. package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-B7DND2dQ.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-NDbtbtqK.js} +28 -28
  20. package/dist/{InventoryBindingSummary-IZ7F-Lti.js → InventoryBindingSummary-DKM2gX8_.js} +1 -1
  21. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-sgqVSlUB.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-CdaiYTdf.js} +4 -4
  22. package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-DeF32bHu.js → PremiumBadge.vue_vue_type_script_setup_true_lang-B0OKeK5O.js} +7 -7
  23. package/dist/{PublishView-DkgfYneI.js → PublishView-D0NnU22l.js} +73 -63
  24. package/dist/{PurchaseOrderPrintPreview-CltLC4o4.js → PurchaseOrderPrintPreview-BmuwNbeL.js} +4 -4
  25. package/dist/{ReceiveRequestView-Dj7ji0DY.js → ReceiveRequestView-j79m7TKk.js} +343 -333
  26. package/dist/RecipeView-D_fNQQ-C.js +636 -0
  27. package/dist/StockView-DX_xeFBT.js +2385 -0
  28. package/dist/SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-Bg49isUy.js +172 -0
  29. package/dist/{SupplierView-DE_M_9kd.js → SupplierView-DuFTqbOg.js} +1193 -1073
  30. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-c428GXwc.js +3233 -0
  31. package/dist/{TransferTemplateView-gWGBCF3u.js → TransferTemplateView-Ccsfcetz.js} +104 -103
  32. package/dist/UnitView-BklpNsFN.js +674 -0
  33. package/dist/WarehouseView-BrURbU67.js +1066 -0
  34. package/dist/api/adjustment-template.d.ts +1 -0
  35. package/dist/api/bill.d.ts +140 -2
  36. package/dist/api/closing-template.d.ts +1 -0
  37. package/dist/api/closing.d.ts +1 -0
  38. package/dist/api/inventory.d.ts +405 -0
  39. package/dist/api/netsuite.d.ts +5 -1
  40. package/dist/api/purchase-order-template.d.ts +1 -0
  41. package/dist/api/purchase-order.d.ts +3 -0
  42. package/dist/api/shipment.d.ts +11 -0
  43. package/dist/api/stock.d.ts +2 -44
  44. package/dist/api/warehouse.d.ts +3 -1
  45. package/dist/{app-CruHLH1e.js → app-a9r50k3U.js} +68551 -67573
  46. package/dist/app.d.ts +643 -15
  47. package/dist/app.js +6 -6
  48. package/dist/components/FmAdminBadge.vue.d.ts +1 -4
  49. package/dist/components/FmEnhancedSelect.vue.d.ts +30 -0
  50. package/dist/components/FmInventoryTableToolbar.vue.d.ts +16 -2
  51. package/dist/components/FmLockableField.vue.d.ts +3 -0
  52. package/dist/components/netsuite/ItemSubsidiaryTreeDialog.vue.d.ts +16 -0
  53. package/dist/components/netsuite/SubsidiaryTreeDialog.vue.d.ts +2 -0
  54. package/dist/composable/defineApi.d.ts +1 -1
  55. package/dist/composable/useIframe.d.ts +2 -2
  56. package/dist/{decimal-izbvCC1j.js → decimal-AusUnA1W.js} +1 -1
  57. package/dist/{format-unit-display-4SAdfyZB.js → format-unit-display-BqkHL-ph.js} +397 -429
  58. package/dist/helper/array.d.ts +1 -0
  59. package/dist/helper/core/country/utils.d.ts +3 -4
  60. package/dist/helper/country.d.ts +6 -255
  61. package/dist/helper/number.d.ts +1 -0
  62. package/dist/import-export.helper-PIyNeHfa.js +238 -0
  63. package/dist/{index-B6GGthLw.js → index-CjxirPvn.js} +283 -268
  64. package/dist/{index-CnQloOEo.js → index-Dj9-pdT9.js} +1 -1
  65. package/dist/layout/SingleColumnLayout.vue.d.ts +6 -3
  66. package/dist/purchase-order-template-CQikvY1p.js +41 -0
  67. package/dist/router/name.d.ts +2 -0
  68. package/dist/stock-CDZ2uWSF.js +83 -0
  69. package/dist/stock-Dw908dIC.js +74 -0
  70. package/dist/stores/feature.d.ts +12 -0
  71. package/dist/stores/integration/netsuite.d.ts +42 -0
  72. package/dist/stores/inventory.d.ts +28 -199
  73. package/dist/stores/location.d.ts +331 -1
  74. package/dist/stores/supplier.d.ts +96 -0
  75. package/dist/stores/warehouse.d.ts +4 -0
  76. package/dist/style.css +1 -1
  77. package/dist/{supplier-CTVE1lHO.js → supplier-BPPBUudN.js} +1 -1
  78. package/dist/tsconfig.app.tsbuildinfo +1 -1
  79. package/dist/{use-ingredient-select-dialog-CM80TfX0.js → use-ingredient-select-dialog-C_fSKN3_.js} +5 -5
  80. package/dist/{use-inventory-binding-dialog-D_omdhgn.js → use-inventory-binding-dialog-ClAkJ864.js} +8 -8
  81. package/dist/views/adjustment-template/wastage-template/actions.d.ts +60 -0
  82. package/dist/views/adjustment-template/wastage-template/table.d.ts +60 -0
  83. package/dist/views/closing-draft/components/closing-draft-dialog/ClosingDraftDialog.vue.d.ts +56 -0
  84. package/dist/views/closing-draft/composables/use-closing-draft-actions.d.ts +3 -3
  85. package/dist/views/closing-draft/composables/use-closing-draft-table.d.ts +468 -0
  86. package/dist/views/closing-draft/helpers/export-draft.helper.d.ts +9 -2
  87. package/dist/views/closing-history/ClosingHistoryView.vue.d.ts +2 -0
  88. package/dist/views/closing-template/composables/use-closing-template-actions.d.ts +4 -1
  89. package/dist/views/closing-template/helpers/import-export.helper.d.ts +5 -0
  90. package/dist/views/import/ImportView.vue.d.ts +3 -0
  91. package/dist/views/import/components/ImportDialog.vue.d.ts +2 -0
  92. package/dist/views/import/helper/import-export.helper.d.ts +4 -0
  93. package/dist/views/ingredients/components/ingredient-dialog/IngredientDialogProps.d.ts +1 -1
  94. package/dist/views/ingredients/components/ingredient-form/IngredientForm.vue.d.ts +181 -12
  95. package/dist/views/ingredients/components/ingredient-form/IngredientFormProps.d.ts +6 -0
  96. package/dist/views/ingredients/helper/import-export.helper.d.ts +4 -1
  97. package/dist/views/integration/components/netsuite/business/BusinessNetSuiteSideSheet.vue.d.ts +2 -0
  98. package/dist/views/receive-request/components/delivery-order-form/CreateForm.vue.d.ts +16 -0
  99. package/dist/views/receive-request/components/delivery-order-form/CreateFormProps.d.ts +4 -0
  100. package/dist/views/receive-request/components/delivery-order-form/EditForm.vue.d.ts +16 -0
  101. package/dist/views/receive-request/components/delivery-order-form/EditFormProps.d.ts +4 -0
  102. package/dist/views/receive-request/components/delivery-order-form/SystemTrailDialog.vue.d.ts +21 -0
  103. package/dist/views/receive-request/components/netsuite/NetSuiteTransactionChangeLog.vue.d.ts +15 -0
  104. package/dist/views/receive-request/components/transfer-details/TransferDetailsProps.d.ts +1 -0
  105. package/dist/views/receive-request/components/transfer-form/TransferForm.vue.d.ts +420 -2
  106. package/dist/views/receive-request/composables/use-process-purchase-order.d.ts +99 -0
  107. package/dist/views/receive-request/composables/use-receive-request-form.d.ts +644 -13
  108. package/dist/views/receive-request/composables/use-receive-request-table.d.ts +711 -14
  109. package/dist/views/recipe/RecipeView.vue.d.ts +1 -0
  110. package/dist/views/recipe/components/import-recipes/ImportRecipeItem.vue.d.ts +16 -0
  111. package/dist/views/recipe/components/import-recipes/ImportRecipes.vue.d.ts +2 -0
  112. package/dist/views/recipe/helper/import-recipe.d.ts +48 -0
  113. package/dist/views/stock/components/StockRecordCard.vue.d.ts +70 -1
  114. package/dist/views/stock/components/dialog/RecalculationDialog.vue.d.ts +11 -0
  115. package/dist/views/stock/components/dialog/RecalculationDialogProps.d.ts +3 -0
  116. package/dist/views/stock/components/dialog/StockAdjustmentSideSheet.vue.d.ts +20 -0
  117. package/dist/views/supplier/components/SupplierForm.vue.d.ts +8 -0
  118. package/dist/views/supplier/components/SupplierSupplyItemField.vue.d.ts +3 -0
  119. package/dist/views/supplier/composables/use-supplier-table.d.ts +4 -0
  120. package/dist/views/transfer-template/components/transfer-template-dialog/TransferTemplateDialog.vue.d.ts +8 -0
  121. package/dist/views/transfer-template/components/transfer-template-form/components/NetSuiteCustomCodeSelection.vue.d.ts +2 -0
  122. package/dist/views/transfer-template/components/transfer-template-form/composables/use-transfer-locations.d.ts +16 -0
  123. package/dist/views/transfer-template/composables/use-transfer-template-actions.d.ts +48 -0
  124. package/dist/views/transfer-template/composables/use-transfer-template-table.d.ts +48 -0
  125. package/dist/views/unit/UnitView.vue.d.ts +1 -0
  126. package/dist/views/unit/components/import-units/ImportUnitItem.vue.d.ts +12 -0
  127. package/dist/views/unit/components/import-units/ImportUnitItemProps.d.ts +6 -0
  128. package/dist/views/unit/components/import-units/ImportUnits.vue.d.ts +9 -0
  129. package/dist/views/unit/components/import-units/ImportUnitsProps.d.ts +5 -0
  130. package/dist/views/unit/helper/import-export.helper.d.ts +40 -0
  131. package/dist/views/warehouse/components/WarehouseForm.vue.d.ts +8 -0
  132. package/package.json +3 -3
  133. package/dist/App-BqaRC0Sb.js +0 -276
  134. package/dist/ClosingDraftView-sJ_zRPeo.js +0 -1687
  135. package/dist/ClosingTemplateView-cNgXHq1r.js +0 -1908
  136. package/dist/FmAdminBadge-oCnz8SW6.js +0 -34
  137. package/dist/FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-BKR8C4p_.js +0 -224
  138. package/dist/IngredientsView-CHHeAJH_.js +0 -1858
  139. package/dist/RecipeView-BukmKdVG.js +0 -621
  140. package/dist/StockForecast.vue_vue_type_style_index_0_lang-KLXSWvo5.js +0 -59
  141. package/dist/StockView-wxRCw_w-.js +0 -2087
  142. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-eqUOnJoM.js +0 -2336
  143. package/dist/UnitView-BgwDmGZo.js +0 -667
  144. package/dist/WarehouseView-BdccenhO.js +0 -1034
  145. package/dist/array-Ca8T3f_G.js +0 -44
  146. package/dist/helper/core/country/codes.d.ts +0 -255
  147. package/dist/stock-BJP5BB5b.js +0 -146
@@ -0,0 +1,1291 @@
1
+ import { defineComponent as De, ref as F, computed as J, watch as ze, resolveComponent as Y, openBlock as N, createElementBlock as D, createVNode as A, normalizeClass as ce, unref as i, createSlots as Ke, withCtx as Q, createElementVNode as n, createBlock as se, toDisplayString as a, createCommentVNode as Z, Fragment as Be, renderList as Pe, shallowRef as $e, h as Ie, createTextVNode as k } from "vue";
2
+ import { a as ie, as as je, a0 as Fe, aq as Ve, X as We, n as pe, ap as Re, C as Le, E as Je, G as Xe, I as ke, c as qe } from "./app-a9r50k3U.js";
3
+ import { useCoreStore as Ce, useI18n as Oe } from "@feedmepos/mf-common";
4
+ import { useDialogChild as Qe, useSnackbar as He, useDialog as Ye, useBreakpoints as Ze } from "@feedmepos/ui-library";
5
+ import { s as et, g as tt, b as nt, d as Ae } from "./import-export.helper-PIyNeHfa.js";
6
+ import { r as ot } from "./random-CSbEbElR.js";
7
+ function Ee() {
8
+ return `measurement_${(/* @__PURE__ */ new Date()).toISOString()}_${ot()}`;
9
+ }
10
+ function rt(U) {
11
+ const [
12
+ e,
13
+ R,
14
+ g,
15
+ h,
16
+ E,
17
+ x,
18
+ ...r
19
+ ] = je(U);
20
+ if (!e || !e.length || e.some((p) => p.length && !p.startsWith("system:")))
21
+ throw new Error("Missing meta header. Excel file does not come from the template.");
22
+ const l = e.map((p) => p.split(":")[1]), u = ["name", "symbol", "precision"].filter((p) => !l.includes(p));
23
+ if (u.length)
24
+ throw new Error(
25
+ `Missing meta headers (${u.join()}). Excel file does not come from the template.`
26
+ );
27
+ return r.map((p, b) => {
28
+ const f = {};
29
+ for (const d in l) {
30
+ const o = l[d];
31
+ Object.assign(f, { [o]: p[d] });
32
+ }
33
+ return {
34
+ index: b,
35
+ data: f
36
+ };
37
+ });
38
+ }
39
+ function st(U) {
40
+ try {
41
+ const e = rt(U).filter((r) => {
42
+ const { name: l, symbol: s, precision: u, measurement_name: v, measurement_symbol: p, measurement_conversion: b } = r.data;
43
+ return l || s || u || v || p || b;
44
+ }), g = ie().units, h = [], E = [], x = {};
45
+ for (const r of e)
46
+ if (r.data.name && r.data.symbol)
47
+ x[r.data.name] = {
48
+ unit: {
49
+ name: r.data.name,
50
+ abbrev: r.data.symbol,
51
+ precision: Math.max(0, Math.min(10, Math.floor(r.data.precision || 2))),
52
+ measurements: []
53
+ },
54
+ rowNumber: r.index
55
+ }, r.data.measurement_name && r.data.measurement_symbol && r.data.measurement_conversion && x[r.data.name].unit.measurements.push({
56
+ id: Ee(),
57
+ name: r.data.measurement_name,
58
+ abbrev: r.data.measurement_symbol,
59
+ conversion: {
60
+ amount: Math.round(r.data.measurement_conversion * Math.pow(10, x[r.data.name].unit.precision)),
61
+ precision: x[r.data.name].unit.precision
62
+ }
63
+ });
64
+ else {
65
+ const l = Object.keys(x)[Object.keys(x).length - 1];
66
+ l && x[l] && r.data.measurement_name && r.data.measurement_symbol && r.data.measurement_conversion && x[l].unit.measurements.push({
67
+ id: Ee(),
68
+ name: r.data.measurement_name,
69
+ abbrev: r.data.measurement_symbol,
70
+ conversion: {
71
+ amount: Math.round(r.data.measurement_conversion * Math.pow(10, x[l].unit.precision)),
72
+ precision: x[l].unit.precision
73
+ }
74
+ });
75
+ }
76
+ for (const [r, { unit: l, rowNumber: s }] of Object.entries(x)) {
77
+ const u = g.find((v) => {
78
+ var p, b;
79
+ return v.abbrev === l.abbrev && ((p = v.name) == null ? void 0 : p.trim()) === ((b = l.name) == null ? void 0 : b.trim());
80
+ });
81
+ u ? E.push({
82
+ type: "update",
83
+ original: u,
84
+ unit: {
85
+ ...u,
86
+ name: l.name || u.name,
87
+ abbrev: l.abbrev || u.abbrev,
88
+ precision: l.precision !== void 0 ? l.precision : u.precision,
89
+ measurements: l.measurements.map((v) => {
90
+ const p = u.measurements.find((b) => b.name === v.name && b.abbrev === v.abbrev);
91
+ return p ? { ...p, ...v, id: p.id } : { ...v, id: Ee() };
92
+ })
93
+ },
94
+ errors: [],
95
+ excelRowNumber: s
96
+ }) : h.push({
97
+ type: "create",
98
+ unit: {
99
+ ...l,
100
+ measurements: l.measurements.map((v) => ({ ...v, id: Ee() }))
101
+ },
102
+ errors: [],
103
+ excelRowNumber: s
104
+ });
105
+ }
106
+ return {
107
+ invalidExcel: !1,
108
+ importCreateResult: h,
109
+ importUpdateResult: E
110
+ };
111
+ } catch (e) {
112
+ return {
113
+ invalidExcel: !0,
114
+ invalidExcelMessage: (e == null ? void 0 : e.message) ?? "Invalid excel",
115
+ importCreateResult: [],
116
+ importUpdateResult: []
117
+ };
118
+ }
119
+ }
120
+ function it(U, { ignoreErrors: e = !1 } = {}) {
121
+ var R;
122
+ try {
123
+ const g = ie(), h = g.skuByCode, E = g.recipeByName, x = g.skuGroupById, r = g.skuGroups, l = g.units, s = [], u = {};
124
+ for (const o of U) {
125
+ const y = [];
126
+ let _ = "";
127
+ if (o.data.type === "INGREDIENT") {
128
+ const w = h[o.data.code];
129
+ w ? _ = w._id : y.push(`Ingredient with code '${o.data.code}' not found`);
130
+ } else if (o.data.type === "RECIPE") {
131
+ const w = E[o.data.name];
132
+ w ? _ = w._id : y.push(`Recipe with name '${o.data.name}' not found`);
133
+ } else if (o.data.type === "SKU_GROUP") {
134
+ const w = r.find((I) => I.ref === o.data.code || I.name === o.data.name);
135
+ w ? _ = w._id : y.push(`SKU Group with ref '${o.data.code}' or name '${o.data.name}' not found`);
136
+ } else
137
+ y.push(`Invalid type '${o.data.type}'. Must be 'INGREDIENT', 'RECIPE', or 'SKU_GROUP'`);
138
+ o.data.amount || y.push(`Invalid amount '${o.data.amount}'. Must be a valid number`);
139
+ let G;
140
+ if ((o.data.unit || o.data.baseUnit) && o.data.type !== "RECIPE" && o.data.type !== "SKU_GROUP" && (G = l.find((w) => {
141
+ var I, ee;
142
+ return w.abbrev === o.data.baseUnit && ((I = w.name) == null ? void 0 : I.trim()) === ((ee = o.data.unit) == null ? void 0 : ee.trim());
143
+ }), G || (o.data.baseUnit && o.data.unit ? y.push(`Cannot find unit with symbol '${o.data.baseUnit}' and name '${o.data.unit}'`) : o.data.baseUnit ? y.push(`Cannot find unit with symbol '${o.data.baseUnit}'`) : o.data.unit && y.push(`Cannot find unit with name '${o.data.unit}'`))), y.length > 0 && s.push(`Row ${o.index + 6}: ${y.join(", ")}`), e || y.length === 0) {
144
+ let w;
145
+ if (o.data.type === "RECIPE" || o.data.type === "SKU_GROUP" ? w = void 0 : w = (R = G == null ? void 0 : G.measurements) == null ? void 0 : R.find((I) => I.abbrev === o.data.measurementName), o.data.recipeName)
146
+ u[o.data.recipeName] = {
147
+ name: o.data.recipeName,
148
+ customAttributes: o.data.customAttributes ? et(o.data.customAttributes) : {},
149
+ contains: [{
150
+ type: o.data.type === "INGREDIENT" ? "SKU" : o.data.type,
151
+ id: _,
152
+ amount: Fe(+o.data.amount),
153
+ measurement: w || void 0
154
+ }]
155
+ }, s[o.data.recipeName] = y.length > 0 ? `Row ${o.index + 6}: ${y.join(", ")}` : [];
156
+ else {
157
+ const I = Object.keys(u)[Object.keys(u).length - 1];
158
+ I && u[I] && (u[I] = {
159
+ ...u[I],
160
+ contains: [
161
+ ...u[I].contains,
162
+ {
163
+ type: o.data.type === "INGREDIENT" ? "SKU" : o.data.type,
164
+ id: _,
165
+ amount: Fe(+o.data.amount),
166
+ measurement: w || void 0
167
+ }
168
+ ]
169
+ }, s[I] = y.length > 0 ? s[I] ? `${s[I]}, Row ${o.index + 6}: ${y.join(", ")}` : `Row ${o.index + 6}: ${y.join(", ")}` : []);
170
+ }
171
+ }
172
+ }
173
+ const v = Object.values(u), p = v.filter((o) => !E[o.name]), b = v.filter((o) => E[o.name]), f = p.map((o, y) => ({
174
+ type: "create",
175
+ recipe: o,
176
+ // Type assertion - _id will be assigned by backend
177
+ errors: s[o.name],
178
+ excelRowNumber: y + 6
179
+ // Assuming header rows
180
+ })), d = b.map((o, y) => {
181
+ const _ = E[o.name];
182
+ return {
183
+ type: "update",
184
+ original: _,
185
+ recipe: {
186
+ ..._,
187
+ name: o.name || _.name,
188
+ contains: o.contains.length > 0 ? o.contains : _.contains,
189
+ customAttributes: o.customAttributes || _.customAttributes
190
+ },
191
+ errors: s[o.name],
192
+ excelRowNumber: y + 6
193
+ };
194
+ });
195
+ return {
196
+ invalidExcel: s.length > 0,
197
+ invalidExcelMessage: s.length > 0 ? `Import completed with ${s.length} error(s): ${s.join("; ")}` : void 0,
198
+ importCreateResult: f,
199
+ importUpdateResult: d
200
+ };
201
+ } catch (g) {
202
+ return {
203
+ invalidExcel: !0,
204
+ invalidExcelMessage: g instanceof Error ? g.message : "Unknown error occurred",
205
+ importCreateResult: [],
206
+ importUpdateResult: []
207
+ };
208
+ }
209
+ }
210
+ function at(U) {
211
+ const [
212
+ e,
213
+ R,
214
+ g,
215
+ h,
216
+ E,
217
+ x,
218
+ ...r
219
+ ] = je(U);
220
+ if (!e || !e.length || e.some((p) => p.length && !p.startsWith("system:")))
221
+ throw new Error("Missing meta header. Excel file does not come from the template.");
222
+ const l = e.map((p) => p.split(":")[1]), u = ["code", "recipeName", "unit", "baseUnit", "type", "amount"].filter((p) => !l.includes(p));
223
+ if (u.length)
224
+ throw new Error(
225
+ `Missing meta headers (${u.join()}). Excel file does not come from the template.`
226
+ );
227
+ return r.map((p, b) => {
228
+ const f = {};
229
+ for (const d in l) {
230
+ const o = l[d];
231
+ Object.assign(f, { [o]: p[d] });
232
+ }
233
+ return {
234
+ index: b,
235
+ data: f
236
+ };
237
+ }).filter((p) => {
238
+ const { recipeName: b, type: f, code: d, name: o, amount: y, unit: _, baseUnit: G, measurementName: w, customAttributes: I } = p.data;
239
+ return b || f || d || o || y || _ || G || w || I;
240
+ });
241
+ }
242
+ function lt() {
243
+ const e = Ce().currentBusiness.value, R = ie(), g = [
244
+ { id: "name", name: "Unit Name" },
245
+ { id: "symbol", name: "Symbol" },
246
+ { id: "precision", name: "Precision" },
247
+ { id: "measurement_name", name: "Measurement Name" },
248
+ { id: "measurement_symbol", name: "Measurement Symbol" },
249
+ { id: "measurement_conversion", name: "Measurement Conversion" }
250
+ ];
251
+ let h = [];
252
+ R.units.length > 0 ? R.units.forEach((r) => {
253
+ if (r.measurements.length === 0)
254
+ h.push([
255
+ r.name,
256
+ r.abbrev,
257
+ r.precision,
258
+ "",
259
+ "",
260
+ ""
261
+ ]);
262
+ else {
263
+ h.push([
264
+ r.name,
265
+ r.abbrev,
266
+ r.precision,
267
+ r.measurements[0].name,
268
+ r.measurements[0].abbrev,
269
+ +pe(r.measurements[0].conversion)
270
+ ]);
271
+ for (let l = 1; l < r.measurements.length; l++)
272
+ h.push([
273
+ "",
274
+ "",
275
+ "",
276
+ r.measurements[l].name,
277
+ r.measurements[l].abbrev,
278
+ +pe(r.measurements[l].conversion)
279
+ ]);
280
+ }
281
+ }) : h = [
282
+ ["Length", "m", 2, "Meter", "m", 1],
283
+ ["", "", "", "Centimeter", "cm", 0.01],
284
+ ["", "", "", "Millimeter", "mm", 1e-3],
285
+ ["Weight", "kg", 3, "Kilogram", "kg", 1],
286
+ ["", "", "", "Gram", "g", 1e-3],
287
+ ["", "", "", "Pound", "lb", 0.453592]
288
+ ];
289
+ const E = [
290
+ ["Business name:", e == null ? void 0 : e.name],
291
+ ["Business ID:", e == null ? void 0 : e._id],
292
+ ["Menu version", e == null ? void 0 : e.menuVersion],
293
+ [],
294
+ g.map((r) => r.name),
295
+ ...h
296
+ ], x = g.map((r) => `system:${r.id}`);
297
+ return Re(E, x);
298
+ }
299
+ function mt() {
300
+ const e = Ce().currentBusiness.value, R = ie(), g = nt();
301
+ let h = [];
302
+ R.skus.length > 0 ? h = R.skus.map((r) => {
303
+ var l, s, u, v, p, b, f, d;
304
+ return [
305
+ r.code,
306
+ r.name,
307
+ ((l = r.unit) == null ? void 0 : l.name) || "",
308
+ ((s = r.unit) == null ? void 0 : s.abbrev) || "",
309
+ ((v = (u = r.unit) == null ? void 0 : u.measurements.find((o) => o.id === r.trackingMeasurement)) == null ? void 0 : v.abbrev) ?? r.unit.abbrev,
310
+ r.valuation || "WAVG",
311
+ (p = r.defaultCost) != null && p.costPerUnit ? +pe((b = r.defaultCost) == null ? void 0 : b.costPerUnit) : 0,
312
+ ((f = r.thresholds) == null ? void 0 : f.low) ?? Ae().low,
313
+ ((d = r.thresholds) == null ? void 0 : d.mid) ?? Ae().mid,
314
+ r.customAttributes ? Object.entries(r.customAttributes).map(([o, y]) => `${o}:${y}`).join("|") : ""
315
+ ];
316
+ }) : h = [
317
+ ["EXAMPLE_CODE", "Example Ingredient", "kg", "kg", "Unit Name", "WAVG", 10.5, 5, 10, ""]
318
+ ];
319
+ const E = [
320
+ ["Business name:", e == null ? void 0 : e.name],
321
+ ["Business ID:", e == null ? void 0 : e._id],
322
+ ["Menu version", e == null ? void 0 : e.menuVersion],
323
+ [],
324
+ g.map((r) => r.name),
325
+ ...h
326
+ ], x = g.map((r) => `system:${r.id}`);
327
+ return Re(E, x);
328
+ }
329
+ function ut() {
330
+ const e = Ce().currentBusiness.value, R = ie(), g = [
331
+ { id: "recipeName", name: "Recipe Name" },
332
+ { id: "type", name: "Type" },
333
+ { id: "code", name: "Code" },
334
+ { id: "name", name: "Item Name" },
335
+ { id: "amount", name: "Amount" },
336
+ { id: "unit", name: "Unit" },
337
+ { id: "baseUnit", name: "Base Unit" },
338
+ { id: "measurementName", name: "Measurement Name" },
339
+ { id: "customAttributes", name: "Custom Attributes" }
340
+ ];
341
+ let h = [];
342
+ if (R.recipes.length > 0) {
343
+ const r = R.recipeById, l = R.skuById, s = R.skuGroupById;
344
+ h = R.recipes.flatMap((u) => {
345
+ var p;
346
+ const v = u.customAttributes ? Object.entries(u.customAttributes).map(([b, f]) => `${b}:${f}`).join("|") : "";
347
+ if ((p = u.contains) != null && p.length) {
348
+ const b = u.contains.filter((o) => o.type === "RECIPE"), f = u.contains.filter((o) => o.type === "SKU"), d = u.contains.filter((o) => o.type === "SKU_GROUP");
349
+ return [
350
+ ...b.map((o, y) => {
351
+ var _;
352
+ return [
353
+ y === 0 ? u.name : "",
354
+ "RECIPE",
355
+ "",
356
+ ((_ = r[o.id]) == null ? void 0 : _.name) || "",
357
+ o.amount.amount,
358
+ "",
359
+ "unit",
360
+ "Unit",
361
+ y === 0 ? v : ""
362
+ ];
363
+ }),
364
+ ...f.map((o, y) => {
365
+ var _, G, w, I, ee, ve, ye, ge, fe, ae, be, le, he, xe, _e, we;
366
+ return [
367
+ !b.length && y === 0 ? u.name : "",
368
+ "INGREDIENT",
369
+ ((_ = l[o.id]) == null ? void 0 : _.code) || "",
370
+ ((G = l[o.id]) == null ? void 0 : G.name) || "",
371
+ +pe(o.amount),
372
+ o.measurement ? ((I = (w = l[o.id]) == null ? void 0 : w.unit) == null ? void 0 : I.name) || "" : ((ve = (ee = l[o.id]) == null ? void 0 : ee.unit) == null ? void 0 : ve.name) || "",
373
+ o.measurement ? ((ge = (ye = l[o.id]) == null ? void 0 : ye.unit) == null ? void 0 : ge.abbrev) || "" : ((ae = (fe = l[o.id]) == null ? void 0 : fe.unit) == null ? void 0 : ae.abbrev) || "",
374
+ o.measurement ? o.measurement.abbrev : ((xe = (he = (le = (be = l[o.id]) == null ? void 0 : be.unit) == null ? void 0 : le.measurements) == null ? void 0 : he.find((Se) => {
375
+ var m;
376
+ return Se.id === ((m = l[o.id]) == null ? void 0 : m.trackingMeasurement);
377
+ })) == null ? void 0 : xe.abbrev) || ((we = (_e = l[o.id]) == null ? void 0 : _e.unit) == null ? void 0 : we.abbrev) || "",
378
+ !b.length && y === 0 ? v : ""
379
+ ];
380
+ }),
381
+ ...d.map((o, y) => {
382
+ var _, G;
383
+ return [
384
+ b.length === 0 && f.length === 0 && y === 0 ? u.name : "",
385
+ "SKU_GROUP",
386
+ ((_ = s[o.id]) == null ? void 0 : _.ref) || "",
387
+ ((G = s[o.id]) == null ? void 0 : G.name) || "",
388
+ +pe(o.amount),
389
+ "",
390
+ "unit",
391
+ "Unit",
392
+ b.length === 0 && f.length === 0 && y === 0 ? v : ""
393
+ ];
394
+ })
395
+ ];
396
+ }
397
+ return [];
398
+ });
399
+ } else
400
+ h = [
401
+ ["Pizza Dough", "INGREDIENT", "FLOUR001", "Flour", "500", "Weight", "g", "Gram", "difficulty:easy, category:italian"],
402
+ ["", "INGREDIENT", "WATER001", "Water", "300", "Volume", "ml", "Milliliter", ""],
403
+ ["", "INGREDIENT", "SALT001", "Salt", "10", "Weight", "g", "Gram", ""]
404
+ ];
405
+ const E = [
406
+ ["Business name:", e == null ? void 0 : e.name],
407
+ ["Business ID:", e == null ? void 0 : e._id],
408
+ ["Menu version", e == null ? void 0 : e.menuVersion],
409
+ [],
410
+ g.map((r) => r.name),
411
+ ...h
412
+ ], x = g.map((r) => `system:${r.id}`);
413
+ return Re(E, x);
414
+ }
415
+ function dt() {
416
+ const U = Ve({
417
+ unit: lt(),
418
+ ingredient: mt(),
419
+ recipe: ut()
420
+ }), e = "FeedMe comprehensive template.xlsx";
421
+ return We(U, e), e;
422
+ }
423
+ async function ct(U) {
424
+ if (!U) return null;
425
+ try {
426
+ return st(U);
427
+ } catch (e) {
428
+ throw console.error("Error in processUnitsSheet:", e), e;
429
+ }
430
+ }
431
+ async function pt(U) {
432
+ if (!U) return null;
433
+ try {
434
+ return tt(U);
435
+ } catch (e) {
436
+ throw console.error("Error in processIngredientsSheet:", e), e;
437
+ }
438
+ }
439
+ async function vt(U) {
440
+ if (!U) return null;
441
+ try {
442
+ const e = at(U);
443
+ return it(e, { ignoreErrors: !0 });
444
+ } catch (e) {
445
+ throw console.error("Error in processRecipesSheet:", e), e;
446
+ }
447
+ }
448
+ const yt = { class: "flex flex-col gap-24" }, gt = { class: "flex flex-col gap-8" }, ft = { class: "flex flex-col flex-1 gap-4" }, bt = { class: "fm-typo-en-body-md-600" }, ht = {
449
+ key: 2,
450
+ class: "shrink-0"
451
+ }, xt = {
452
+ key: 0,
453
+ class: "flex flex-col"
454
+ }, _t = { class: "text-fm-color-system-error-300 fm-typo-en-body-sm-400" }, wt = {
455
+ key: 0,
456
+ class: "max-h-[200px] overflow-y-auto flex flex-col gap-8"
457
+ }, It = { class: "fm-typo-en-body-lg-600" }, Et = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, St = /* @__PURE__ */ De({
458
+ __name: "ImportDialog",
459
+ setup(U) {
460
+ const e = F(null), R = Qe();
461
+ He();
462
+ const g = F(!1), h = F(new Array()), E = F(null), x = F([]), r = F([]), l = J(() => !!h.value.length), s = J(() => !!E.value && x.value.length > 0), { t: u } = Oe();
463
+ async function v(f) {
464
+ h.value = [], E.value = null, x.value = [], r.value = [];
465
+ try {
466
+ g.value = !0;
467
+ const [d] = await Promise.all([
468
+ Je(f),
469
+ // fake buffer for UX
470
+ new Promise((o) => setTimeout(o, 1e3))
471
+ ]);
472
+ E.value = d, p();
473
+ } catch (d) {
474
+ console.error("Error parsing Excel file:", d), h.value.push((d == null ? void 0 : d.message) || "Unknown error occurred");
475
+ } finally {
476
+ g.value = !1;
477
+ }
478
+ }
479
+ function p() {
480
+ if (h.value = [], !E.value) return;
481
+ const d = ["unit", "ingredient", "recipe"].filter((o) => E.value.Sheets[o]);
482
+ if (d.length === 0) {
483
+ h.value.push("No valid sheets found. Expected sheets: unit, ingredient, or recipe");
484
+ return;
485
+ }
486
+ x.value = d, R.emitData({ availableSheets: d, workbook: E.value });
487
+ }
488
+ ze(e, (f) => {
489
+ f && v(f);
490
+ });
491
+ function b() {
492
+ if (!E.value || x.value.length === 0) return "";
493
+ const f = [];
494
+ return x.value.forEach((d) => {
495
+ switch (d) {
496
+ case "unit":
497
+ f.push("Units sheet found");
498
+ break;
499
+ case "ingredient":
500
+ f.push("Ingredients sheet found");
501
+ break;
502
+ case "recipe":
503
+ f.push("Recipes sheet found");
504
+ break;
505
+ }
506
+ }), f.length > 0 ? `Ready to process: ${f.join(", ")}. Processing will follow dependency order.` : "No valid sheets found";
507
+ }
508
+ return (f, d) => {
509
+ const o = Y("FmCircularProgress"), y = Y("FmIcon"), _ = Y("FmButton");
510
+ return N(), D("div", yt, [
511
+ A(Le, {
512
+ class: ce({
513
+ "w-full": !0,
514
+ "h-[200px]": !e.value
515
+ }),
516
+ accept: ".xlsx,.xls",
517
+ onFileUpload: d[0] || (d[0] = (G) => e.value = G),
518
+ label: i(u)("inventory.ingredient.import.uploadTemplate"),
519
+ "button-label": i(u)("inventory.ingredient.import.selectFile")
520
+ }, Ke({ _: 2 }, [
521
+ e.value ? {
522
+ name: "default",
523
+ fn: Q(({ openFileDialog: G }) => [
524
+ n("div", gt, [
525
+ n("div", {
526
+ class: ce([
527
+ "fm-corner-radius-md p-16 flex items-center gap-16",
528
+ {
529
+ "border border-fm-color-neutral-gray-100": g.value,
530
+ "border border-fm-color-neutral-gray-200": !g.value && !l.value,
531
+ "border border-fm-color-system-error-200": l.value
532
+ }
533
+ ])
534
+ }, [
535
+ g.value ? (N(), se(o, {
536
+ key: 0,
537
+ size: "md",
538
+ color: "neutral-gray-200"
539
+ })) : (N(), se(y, {
540
+ key: 1,
541
+ name: l.value ? "error" : "check_circle",
542
+ color: l.value ? "system-error-300" : "system-success-400",
543
+ size: "lg"
544
+ }, null, 8, ["name", "color"])),
545
+ n("div", ft, [
546
+ n("div", bt, a(e.value.name), 1),
547
+ n("div", {
548
+ class: ce([
549
+ "fm-typo-en-body-sm-400",
550
+ {
551
+ "text-fm-color-system-error-300": l.value,
552
+ "text-fm-color-typo-secondary": !l.value
553
+ }
554
+ ])
555
+ }, a(l.value ? i(u)("inventory.ingredient.import.error.invalidContent") : "File valid"), 3)
556
+ ]),
557
+ g.value ? Z("", !0) : (N(), D("div", ht, [
558
+ A(_, {
559
+ label: i(u)("inventory.ingredient.import.replaceFile"),
560
+ variant: l.value ? "destructive" : "secondary",
561
+ "prepend-icon": l.value ? void 0 : "autorenew",
562
+ onClick: G
563
+ }, null, 8, ["label", "variant", "prepend-icon", "onClick"])
564
+ ]))
565
+ ], 2),
566
+ h.value.length ? (N(), D("div", xt, [
567
+ (N(!0), D(Be, null, Pe(h.value, (w, I) => (N(), D("div", {
568
+ key: I,
569
+ class: "flex gap-8 items-center"
570
+ }, [
571
+ A(y, {
572
+ name: "error",
573
+ size: "sm",
574
+ color: "system-error-300"
575
+ }),
576
+ n("div", _t, a(w), 1)
577
+ ]))), 128))
578
+ ])) : Z("", !0)
579
+ ])
580
+ ]),
581
+ key: "0"
582
+ } : void 0
583
+ ]), 1032, ["class", "label", "button-label"]),
584
+ s.value ? (N(), D("div", wt, [
585
+ n("div", It, a(i(u)("inventory.ingredient.import.summary")), 1),
586
+ n("div", Et, a(b()), 1)
587
+ ])) : Z("", !0)
588
+ ]);
589
+ };
590
+ }
591
+ }), kt = {
592
+ key: 0,
593
+ class: "bg-blue-50 border border-blue-200 rounded-lg p-16"
594
+ }, Rt = { class: "flex items-start gap-12" }, Ct = { class: "flex flex-col gap-8" }, Ut = { class: "fm-typo-en-body-md-400 text-blue-800" }, Gt = { class: "fm-typo-en-body-sm-400 text-blue-700" }, Nt = { class: "mb-8" }, Tt = ["innerHTML"], Mt = ["innerHTML"], $t = { class: "mb-8" }, Ft = { class: "mb-12" }, At = { class: "mb-12" }, Dt = { class: "mb-8" }, Bt = { class: "text-orange-600" }, Pt = {
595
+ key: 1,
596
+ class: "bg-white rounded-lg shadow"
597
+ }, jt = { class: "flex items-center justify-between p-16 border-b" }, Ot = { class: "fm-typo-en-title-md-600" }, Ht = { class: "fm-typo-en-body-sm-400 text-gray-600 mt-4" }, zt = {
598
+ key: 0,
599
+ class: "text-red-600"
600
+ }, Kt = {
601
+ key: 1,
602
+ class: "text-orange-600"
603
+ }, Vt = {
604
+ key: 2,
605
+ class: "text-green-600"
606
+ }, Wt = { class: "flex gap-8" }, Lt = { class: "p-16" }, Jt = {
607
+ key: 2,
608
+ class: "bg-white rounded-lg shadow"
609
+ }, Xt = { class: "flex items-center justify-between p-16 border-b" }, qt = { class: "fm-typo-en-title-md-600 text-red-800" }, Qt = { class: "fm-typo-en-body-sm-400 text-gray-600 mt-4" }, Yt = { class: "flex gap-8" }, Zt = { class: "p-16" }, en = {
610
+ key: 0,
611
+ class: "flex flex-col gap-16 p-16"
612
+ }, tn = { class: "fm-typo-en-title-sm-600 mb-12" }, nn = { class: "grid grid-cols-2 gap-12" }, on = { class: "fm-typo-en-body-sm-400 text-gray-600" }, rn = { class: "fm-typo-en-body-md-600" }, sn = { key: 0 }, an = { class: "fm-typo-en-body-sm-400 text-gray-600" }, ln = { class: "fm-typo-en-body-md-600" }, mn = { class: "fm-typo-en-body-sm-400 text-gray-600" }, un = { class: "fm-typo-en-body-md-600" }, dn = { class: "fm-typo-en-body-sm-400 text-gray-600" }, cn = { class: "fm-typo-en-body-md-600" }, pn = { class: "fm-typo-en-body-sm-400 text-gray-600" }, vn = { class: "fm-typo-en-title-sm-600 mb-12 text-red-800" }, yn = { class: "space-y-8" }, gn = { class: "fm-typo-en-body-md-400 text-red-800" }, fn = { class: "fm-typo-en-title-sm-600 mb-12" }, bn = { class: "bg-gray-50 p-12 rounded border overflow-auto" }, hn = { class: "text-sm" }, xn = { class: "flex gap-8" }, _n = { class: "flex flex-col items-center justify-center h-64 gap-16" }, wn = { class: "text-center" }, In = { class: "fm-typo-en-title-md-600 text-gray-600 mb-8" }, En = { class: "flex flex-col items-center justify-center h-64 gap-16" }, Sn = { class: "text-center" }, kn = { class: "fm-typo-en-title-md-600 text-gray-600 mb-8" }, Rn = { class: "fm-typo-en-body-md-400 text-gray-500" }, $n = /* @__PURE__ */ De({
613
+ __name: "ImportView",
614
+ setup(U) {
615
+ const { t: e } = Oe(), R = Ye(), g = He();
616
+ Xe();
617
+ const h = qe(), { breakpoints: E } = Ze(), x = ie(), r = F("");
618
+ F(!1);
619
+ const l = F(!1), s = F(null), u = F(!1), v = F(null), p = F(!1), b = F([]), f = F(null), d = F([]), o = F(!1), y = J(() => E.value.xs || E.value.sm), _ = J(() => y.value ? 10 : 20), G = J(() => {
620
+ const m = s.value;
621
+ if (!m) return [];
622
+ const t = [], { units: C, skus: B, recipes: W, _invalidExcel: z, _invalidExcelMessage: X } = m, q = (M) => {
623
+ var j;
624
+ return ((j = M.errors) == null ? void 0 : j.length) > 0 ? Array.isArray(M.errors) ? M.errors.join(", ") : M.errors || e("inventory.common.validationFailed") : z ? X || e("inventory.common.invalidExcelFormat") : e("inventory.common.readyToImport");
625
+ }, H = (M, O) => {
626
+ if (M)
627
+ for (const j of ["create", "update"]) {
628
+ const K = M[j];
629
+ if (K)
630
+ for (const P of K)
631
+ t.push({
632
+ name: P.name || P.abbrev || P.code || e("inventory.common.unknown"),
633
+ type: O,
634
+ operation: e(j === "create" ? "inventory.common.create" : "inventory.common.update"),
635
+ status: q(P),
636
+ errors: P.errors || [],
637
+ details: P
638
+ });
639
+ }
640
+ };
641
+ return H(C, e("inventory.common.unit")), H(B, e("inventory.common.ingredient")), H(W, e("inventory.common.recipe")), t;
642
+ }), w = J(() => G.value.some(
643
+ (m) => m.errors && m.errors.length > 0
644
+ )), I = J(() => G.value.some(
645
+ (m) => m.status && m.status.includes("Invalid Excel")
646
+ )), ee = J(() => {
647
+ const m = G.value.find(
648
+ (t) => t.status && t.status.includes("Invalid Excel")
649
+ );
650
+ return (m == null ? void 0 : m.status) || e("inventory.common.invalidExcelFormatDetected");
651
+ }), ve = J(() => !d.value || d.value.length === 0 ? [] : d.value.map((m, t) => {
652
+ var C, B;
653
+ return {
654
+ id: t + 1,
655
+ name: ((C = m.error.data) == null ? void 0 : C.name) || e("inventory.common.unknown"),
656
+ type: m.type || e("inventory.common.general"),
657
+ message: ((B = m.error) == null ? void 0 : B.message) || JSON.stringify(m.error)
658
+ };
659
+ }));
660
+ function ye(m) {
661
+ switch (m) {
662
+ case "import":
663
+ return ge();
664
+ }
665
+ }
666
+ function ge() {
667
+ R.open({
668
+ title: e("inventory.common.import"),
669
+ contentComponent: St,
670
+ overlay: !0,
671
+ closeButton: !0,
672
+ primaryActions: {
673
+ text: e("inventory.common.next"),
674
+ close: !1
675
+ },
676
+ secondaryActions: {
677
+ text: e("inventory.common.close"),
678
+ close: !0
679
+ },
680
+ tertiaryActions: {
681
+ text: e("inventory.ingredient.import.actions.downloadTemplate"),
682
+ close: !1,
683
+ variant: "plain"
684
+ }
685
+ }).onPrimary(async (m) => {
686
+ m && m.workbook && m.availableSheets && (await fe(m), R.close()), b.value.length === 0 && R.close();
687
+ }).onTertiary(() => {
688
+ try {
689
+ const m = dt();
690
+ g.open({
691
+ title: e("inventory.common.export") + " " + e("inventory.ingredient.import.actions.downloadTemplate"),
692
+ message: e("inventory.common.templateDownloaded", [m]),
693
+ type: "success"
694
+ });
695
+ } catch (m) {
696
+ g.open({
697
+ title: e("inventory.common.downloadFailed"),
698
+ message: e("inventory.common.failedDownloadTemplate"),
699
+ type: "error"
700
+ }), console.error("Error downloading template:", m);
701
+ }
702
+ });
703
+ }
704
+ async function fe(m) {
705
+ f.value = m.workbook, b.value = [...m.availableSheets], s.value = {}, d.value = [], await ae();
706
+ }
707
+ async function ae() {
708
+ var t, C, B, W, z, X, q, H, M, O, j, K, P, me, ue;
709
+ if (!f.value || b.value.length === 0) {
710
+ u.value = !0;
711
+ return;
712
+ }
713
+ const m = b.value[0];
714
+ try {
715
+ switch (m) {
716
+ case "unit": {
717
+ const L = f.value.Sheets.unit, S = await ct(L);
718
+ S && (s.value = {
719
+ ...s.value,
720
+ _invalidExcel: S.invalidExcel || ((t = s.value) == null ? void 0 : t._invalidExcel),
721
+ _invalidExcelMessage: S.invalidExcelMessage || ((C = s.value) == null ? void 0 : C._invalidExcelMessage) || e("inventory.common.invalidExcelFormat") + " for Units sheet",
722
+ units: S.importCreateResult || S.importUpdateResult ? {
723
+ create: ((B = S.importCreateResult) == null ? void 0 : B.map(($) => ({
724
+ ...$.unit,
725
+ errors: $.errors
726
+ }))) || [],
727
+ update: ((W = S.importUpdateResult) == null ? void 0 : W.map(($) => ({
728
+ ...$.unit,
729
+ errors: $.errors
730
+ }))) || []
731
+ } : (z = s.value) == null ? void 0 : z.units
732
+ });
733
+ break;
734
+ }
735
+ case "ingredient": {
736
+ const L = f.value.Sheets.ingredient, S = await pt(L);
737
+ S && (s.value = {
738
+ ...s.value,
739
+ _invalidExcel: S.invalidExcel || ((X = s.value) == null ? void 0 : X._invalidExcel),
740
+ _invalidExcelMessage: S.invalidExcelMessage || ((q = s.value) == null ? void 0 : q._invalidExcelMessage) || e("inventory.common.invalidExcelFormat") + " for Ingredients sheet",
741
+ skus: S.importCreateResult || S.importUpdateResult ? {
742
+ create: ((H = S.importCreateResult) == null ? void 0 : H.map(($) => ({
743
+ ...$.sku,
744
+ errors: $.errors
745
+ }))) || [],
746
+ update: ((M = S.importUpdateResult) == null ? void 0 : M.map(($) => ({
747
+ ...$.sku,
748
+ errors: $.errors
749
+ }))) || []
750
+ } : (O = s.value) == null ? void 0 : O.skus
751
+ });
752
+ break;
753
+ }
754
+ case "recipe": {
755
+ const L = f.value.Sheets.recipe, S = await vt(L);
756
+ S && (s.value = {
757
+ ...s.value,
758
+ _invalidExcel: S.invalidExcel || ((j = s.value) == null ? void 0 : j._invalidExcel),
759
+ _invalidExcelMessage: S.invalidExcelMessage || ((K = s.value) == null ? void 0 : K._invalidExcelMessage) || e("inventory.common.invalidExcelFormat") + " for Recipes sheet",
760
+ recipes: S.importCreateResult || S.importUpdateResult ? {
761
+ create: ((P = S.importCreateResult) == null ? void 0 : P.map(($) => ({
762
+ ...$.recipe,
763
+ errors: $.errors
764
+ }))) || [],
765
+ update: ((me = S.importUpdateResult) == null ? void 0 : me.map(($) => ({
766
+ ...$.recipe,
767
+ errors: $.errors
768
+ }))) || []
769
+ } : (ue = s.value) == null ? void 0 : ue.recipes
770
+ });
771
+ break;
772
+ }
773
+ }
774
+ b.value.shift(), u.value = !0;
775
+ } catch (L) {
776
+ console.error(`Error processing ${m} sheet:`, L), g.open({
777
+ title: e("inventory.common.processingError"),
778
+ message: e("inventory.common.failedToProcessSheet", [m]),
779
+ type: "error"
780
+ });
781
+ }
782
+ }
783
+ async function be() {
784
+ var m, t, C, B, W, z, X, q, H, M, O, j, K, P, me, ue, L, S, $, Ue, Ge, Ne, Te, Me;
785
+ if (s.value) {
786
+ if (I.value) {
787
+ g.open({
788
+ title: e("inventory.common.invalidExcelFormatTitle"),
789
+ message: ee.value,
790
+ type: "error"
791
+ });
792
+ return;
793
+ }
794
+ if (w.value) {
795
+ g.open({
796
+ title: e("inventory.ingredient.import.error.invalidContent"),
797
+ message: e("inventory.ingredient.import.error.hasErrors"),
798
+ type: "error"
799
+ });
800
+ return;
801
+ }
802
+ l.value = !0;
803
+ try {
804
+ let V = 0, oe = "";
805
+ if (s.value.units && ((m = s.value.units.create) != null && m.length || (t = s.value.units.update) != null && t.length)) {
806
+ const T = {
807
+ create: ((C = s.value.units.create) == null ? void 0 : C.filter((c) => !c.errors || c.errors.length === 0)) || [],
808
+ update: ((B = s.value.units.update) == null ? void 0 : B.filter((c) => !c.errors || c.errors.length === 0)) || []
809
+ };
810
+ if (T.create.length || T.update.length) {
811
+ const c = await x.importUnits(T);
812
+ ((W = c == null ? void 0 : c.errors) == null ? void 0 : W.length) > 0 && d.value.push(...c.errors.map((re) => ({
813
+ type: "units",
814
+ error: re
815
+ })));
816
+ const te = T.create.length + T.update.length, ne = ((z = c == null ? void 0 : c.errors) == null ? void 0 : z.length) || 0;
817
+ V = te - ne, oe = "units", s.value = {
818
+ ...s.value,
819
+ units: null
820
+ };
821
+ }
822
+ } else if (s.value.skus && ((X = s.value.skus.create) != null && X.length || (q = s.value.skus.update) != null && q.length)) {
823
+ const T = {
824
+ create: ((H = s.value.skus.create) == null ? void 0 : H.filter((c) => !c.errors || c.errors.length === 0)) || [],
825
+ update: ((M = s.value.skus.update) == null ? void 0 : M.filter((c) => !c.errors || c.errors.length === 0)) || []
826
+ };
827
+ if (T.create.length || T.update.length) {
828
+ const c = await x.importSkus(T);
829
+ ((O = c == null ? void 0 : c.errors) == null ? void 0 : O.length) > 0 && d.value.push(...c.errors.map((re) => ({
830
+ type: "ingredients",
831
+ error: re
832
+ })));
833
+ const te = T.create.length + T.update.length, ne = ((j = c == null ? void 0 : c.errors) == null ? void 0 : j.length) || 0;
834
+ V = te - ne, oe = "ingredients", s.value = {
835
+ ...s.value,
836
+ skus: null
837
+ };
838
+ }
839
+ } else if (s.value.recipes && ((K = s.value.recipes.create) != null && K.length || (P = s.value.recipes.update) != null && P.length)) {
840
+ const T = {
841
+ create: ((me = s.value.recipes.create) == null ? void 0 : me.filter((c) => !c.errors || c.errors.length === 0)) || [],
842
+ update: ((ue = s.value.recipes.update) == null ? void 0 : ue.filter((c) => !c.errors || c.errors.length === 0)) || []
843
+ };
844
+ if (T.create.length || T.update.length) {
845
+ const c = await x.importRecipes(T);
846
+ ((L = c == null ? void 0 : c.errors) == null ? void 0 : L.length) > 0 && d.value.push(...c.errors.map((re) => ({
847
+ type: "recipes",
848
+ error: re
849
+ })));
850
+ const te = T.create.length + T.update.length, ne = ((S = c == null ? void 0 : c.errors) == null ? void 0 : S.length) || 0;
851
+ V = te - ne, oe = "recipes", s.value = {
852
+ ...s.value,
853
+ recipes: null
854
+ };
855
+ }
856
+ }
857
+ if (V > 0) {
858
+ const T = d.value.filter((c) => c.type === oe);
859
+ T.length > 0 ? g.open({
860
+ title: e("inventory.common.importCompletedWithIssues"),
861
+ message: e("inventory.common.successfullyImported", [V, oe, T.length, oe]),
862
+ type: "warning"
863
+ }) : g.open({
864
+ title: e("inventory.ingredient.import.success"),
865
+ message: e("inventory.common.successfullyImported", [V, oe, "0", ""]),
866
+ type: "success"
867
+ });
868
+ }
869
+ if (b.value.length > 0)
870
+ await ae();
871
+ else if (!(s.value.units && ((($ = s.value.units.create) == null ? void 0 : $.length) || ((Ue = s.value.units.update) == null ? void 0 : Ue.length)) || s.value.skus && (((Ge = s.value.skus.create) == null ? void 0 : Ge.length) || ((Ne = s.value.skus.update) == null ? void 0 : Ne.length)) || s.value.recipes && (((Te = s.value.recipes.create) == null ? void 0 : Te.length) || ((Me = s.value.recipes.update) == null ? void 0 : Me.length))))
872
+ if (le(), d.value.length > 0) {
873
+ const c = d.value.filter((de) => de.type === "units").length, te = d.value.filter((de) => de.type === "ingredients").length, ne = d.value.filter((de) => de.type === "recipes").length, re = c + te + ne;
874
+ o.value = !0, g.open({
875
+ title: e("inventory.common.importCompletedWithIssues"),
876
+ message: e("inventory.common.importFinishedWithFailedItems", [re, c, te, ne]),
877
+ type: "warning"
878
+ }), console.error("Import errors:", d.value);
879
+ } else
880
+ g.open({
881
+ title: e("inventory.common.importComplete"),
882
+ message: e("inventory.common.allDataSuccessfullyImported"),
883
+ type: "success"
884
+ });
885
+ } catch (V) {
886
+ g.open({
887
+ title: e("inventory.ingredient.import.error.failed"),
888
+ message: (V == null ? void 0 : V.message) || e("inventory.common.unknownErrorOccurred"),
889
+ type: "error"
890
+ }), console.error("Error during import:", V);
891
+ } finally {
892
+ l.value = !1;
893
+ }
894
+ }
895
+ }
896
+ function le() {
897
+ u.value = !1, o.value = !1, s.value = null, b.value = [], f.value = null;
898
+ }
899
+ function he() {
900
+ o.value = !1, d.value = [];
901
+ }
902
+ function xe() {
903
+ p.value = !1, v.value = null;
904
+ }
905
+ const _e = J(() => [
906
+ {
907
+ label: e("inventory.common.import"),
908
+ value: "import",
909
+ isPrimary: !1,
910
+ prependIcon: "upload"
911
+ }
912
+ ]), we = $e([
913
+ {
914
+ id: "name",
915
+ accessorKey: "name",
916
+ header: () => e("inventory.common.name"),
917
+ size: 200
918
+ },
919
+ {
920
+ id: "type",
921
+ accessorKey: "type",
922
+ header: () => e("inventory.common.type"),
923
+ size: 120
924
+ },
925
+ {
926
+ id: "operation",
927
+ accessorKey: "operation",
928
+ header: () => e("inventory.common.operation"),
929
+ size: 100
930
+ },
931
+ {
932
+ id: "status",
933
+ accessorKey: "status",
934
+ header: () => e("inventory.common.status"),
935
+ size: 120,
936
+ cell: (m) => {
937
+ const t = m.row.original.status;
938
+ let C = "px-8 py-4 rounded";
939
+ return t === e("inventory.common.readyToImport") ? C += " bg-blue-100 text-blue-800 border border-blue-200" : t === "Imported" || t === "Successfully Imported" ? C += " bg-green-100 text-green-800 border border-green-200" : t === "Failed" ? C += " bg-red-100 text-red-800 border border-red-200" : t === e("inventory.common.validationFailed") ? C += " bg-orange-100 text-orange-800 border border-orange-200" : (t.includes("Invalid Excel"), C += " bg-red-100 text-red-800 border border-red-200"), Ie("div", { class: C, title: t }, t);
940
+ }
941
+ }
942
+ ]), Se = $e([
943
+ {
944
+ id: "name",
945
+ accessorKey: "name",
946
+ header: () => e("inventory.common.name"),
947
+ cell: (m) => Ie("div", { class: "text-gray-800 text-sm py-2" }, m.row.original.name || e("inventory.common.unknown"))
948
+ },
949
+ {
950
+ id: "type",
951
+ accessorKey: "type",
952
+ header: () => e("inventory.common.errorType"),
953
+ cell: (m) => {
954
+ const t = m.row.original.type, C = e(t === "units" ? "inventory.common.unit" : t === "ingredients" ? "inventory.common.ingredient" : t === "recipes" ? "inventory.common.recipe" : "inventory.common.unknown");
955
+ return Ie("div", { class: "text-gray-800 text-sm py-2" }, C);
956
+ }
957
+ },
958
+ {
959
+ id: "message",
960
+ accessorKey: "message",
961
+ header: () => e("inventory.common.errorMessage"),
962
+ cell: (m) => Ie(
963
+ "div",
964
+ { class: "text-red-800 text-sm py-2", title: m.row.original.message },
965
+ m.row.original.message
966
+ )
967
+ }
968
+ ]);
969
+ return (m, t) => {
970
+ const C = Y("FmIcon"), B = Y("FmButton"), W = Y("FmTable"), z = Y("FmCard"), X = Y("FmSideSheet"), q = Y("FmSpinner");
971
+ return i(h).isLoaded && i(h).enableBulkImport ? (N(), se(ke, {
972
+ key: 0,
973
+ title: i(e)("inventory.common.import"),
974
+ actions: _e.value,
975
+ "onClick:action": ye
976
+ }, {
977
+ default: Q(() => {
978
+ var H;
979
+ return [
980
+ n("div", {
981
+ class: ce([
982
+ "flex flex-col gap-8 max-h-full",
983
+ {
984
+ "p-0": y.value,
985
+ "px-24": !y.value
986
+ }
987
+ ])
988
+ }, [
989
+ u.value ? Z("", !0) : (N(), D("div", kt, [
990
+ n("div", Rt, [
991
+ A(C, {
992
+ name: "info",
993
+ class: "text-blue-600 mt-2"
994
+ }),
995
+ n("div", Ct, [
996
+ n("div", Ut, a(i(e)("inventory.ingredient.import.multiUploadTemplateInstruction")), 1),
997
+ n("div", Gt, [
998
+ n("div", Nt, [
999
+ n("strong", null, a(i(e)("inventory.ingredient.import.importInstructions.detailedGuide.title")), 1)
1000
+ ]),
1001
+ t[39] || (t[39] = k(" 1. ")),
1002
+ n("span", {
1003
+ innerHTML: i(e)("inventory.ingredient.import.importInstructions.step1")
1004
+ }, null, 8, Tt),
1005
+ t[40] || (t[40] = n("br", null, null, -1)),
1006
+ t[41] || (t[41] = k(" 2. ")),
1007
+ n("span", {
1008
+ innerHTML: i(e)("inventory.ingredient.import.importInstructions.step2")
1009
+ }, null, 8, Mt),
1010
+ t[42] || (t[42] = n("br", null, null, -1)),
1011
+ k(" 3. " + a(i(e)("inventory.ingredient.import.importInstructions.step3")), 1),
1012
+ t[43] || (t[43] = n("br", null, null, -1)),
1013
+ k(" 4. " + a(i(e)("inventory.ingredient.import.importInstructions.step4")), 1),
1014
+ t[44] || (t[44] = n("br", null, null, -1)),
1015
+ t[45] || (t[45] = n("br", null, null, -1)),
1016
+ n("div", $t, [
1017
+ n("strong", null, a(i(e)("inventory.ingredient.import.importInstructions.detailedGuide.title")), 1)
1018
+ ]),
1019
+ n("div", Ft, [
1020
+ n("strong", null, a(i(e)("inventory.ingredient.import.importInstructions.detailedGuide.unitsSheet.title")), 1),
1021
+ k(" " + a(i(e)("inventory.ingredient.import.importInstructions.detailedGuide.unitsSheet.description")), 1),
1022
+ t[1] || (t[1] = n("br", null, null, -1)),
1023
+ t[2] || (t[2] = k(" • ")),
1024
+ n("em", null, a(i(e)("inventory.ingredient.import.importInstructions.detailedGuide.unitsSheet.col1")), 1),
1025
+ t[3] || (t[3] = n("br", null, null, -1)),
1026
+ t[4] || (t[4] = k(" • ")),
1027
+ n("em", null, a(i(e)("inventory.ingredient.import.importInstructions.detailedGuide.unitsSheet.col2")), 1),
1028
+ t[5] || (t[5] = n("br", null, null, -1)),
1029
+ t[6] || (t[6] = k(" • ")),
1030
+ n("em", null, a(i(e)("inventory.ingredient.import.importInstructions.detailedGuide.unitsSheet.col3")), 1),
1031
+ t[7] || (t[7] = n("br", null, null, -1)),
1032
+ t[8] || (t[8] = k(" • ")),
1033
+ n("em", null, a(i(e)("inventory.ingredient.import.importInstructions.detailedGuide.unitsSheet.col4")), 1),
1034
+ t[9] || (t[9] = n("br", null, null, -1)),
1035
+ t[10] || (t[10] = k(" • ")),
1036
+ n("em", null, a(i(e)("inventory.ingredient.import.importInstructions.detailedGuide.unitsSheet.col5")), 1),
1037
+ t[11] || (t[11] = n("br", null, null, -1)),
1038
+ t[12] || (t[12] = k(" • ")),
1039
+ n("em", null, a(i(e)("inventory.ingredient.import.importInstructions.detailedGuide.unitsSheet.col6")), 1)
1040
+ ]),
1041
+ n("div", At, [
1042
+ n("strong", null, a(i(e)("inventory.ingredient.import.importInstructions.detailedGuide.ingredientsSheet.title")), 1),
1043
+ k(" " + a(i(e)("inventory.ingredient.import.importInstructions.detailedGuide.ingredientsSheet.description")), 1),
1044
+ t[13] || (t[13] = n("br", null, null, -1)),
1045
+ t[14] || (t[14] = k(" • ")),
1046
+ n("em", null, a(i(e)("inventory.ingredient.import.importInstructions.detailedGuide.ingredientsSheet.col1")), 1),
1047
+ t[15] || (t[15] = n("br", null, null, -1)),
1048
+ t[16] || (t[16] = k(" • ")),
1049
+ n("em", null, a(i(e)("inventory.ingredient.import.importInstructions.detailedGuide.ingredientsSheet.col2")), 1),
1050
+ t[17] || (t[17] = n("br", null, null, -1)),
1051
+ t[18] || (t[18] = k(" • ")),
1052
+ n("em", null, a(i(e)("inventory.ingredient.import.importInstructions.detailedGuide.ingredientsSheet.col3")), 1),
1053
+ t[19] || (t[19] = n("br", null, null, -1)),
1054
+ t[20] || (t[20] = k(" • ")),
1055
+ n("em", null, a(i(e)("inventory.ingredient.import.importInstructions.detailedGuide.ingredientsSheet.col4")), 1),
1056
+ t[21] || (t[21] = n("br", null, null, -1)),
1057
+ t[22] || (t[22] = k(" • ")),
1058
+ n("em", null, a(i(e)("inventory.ingredient.import.importInstructions.detailedGuide.ingredientsSheet.col5")), 1)
1059
+ ]),
1060
+ n("div", Dt, [
1061
+ n("strong", null, a(i(e)("inventory.ingredient.import.importInstructions.detailedGuide.recipesSheet.title")), 1),
1062
+ k(" " + a(i(e)("inventory.ingredient.import.importInstructions.detailedGuide.recipesSheet.description")), 1),
1063
+ t[23] || (t[23] = n("br", null, null, -1)),
1064
+ t[24] || (t[24] = k(" • ")),
1065
+ n("em", null, a(i(e)("inventory.ingredient.import.importInstructions.detailedGuide.recipesSheet.col1")), 1),
1066
+ t[25] || (t[25] = n("br", null, null, -1)),
1067
+ t[26] || (t[26] = k(" • ")),
1068
+ n("em", null, a(i(e)("inventory.ingredient.import.importInstructions.detailedGuide.recipesSheet.col2")), 1),
1069
+ t[27] || (t[27] = n("br", null, null, -1)),
1070
+ t[28] || (t[28] = k(" • ")),
1071
+ n("em", null, a(i(e)("inventory.ingredient.import.importInstructions.detailedGuide.recipesSheet.col3")), 1),
1072
+ t[29] || (t[29] = n("br", null, null, -1)),
1073
+ t[30] || (t[30] = k(" • ")),
1074
+ n("em", null, a(i(e)("inventory.ingredient.import.importInstructions.detailedGuide.recipesSheet.col4")), 1),
1075
+ t[31] || (t[31] = n("br", null, null, -1)),
1076
+ t[32] || (t[32] = k(" • ")),
1077
+ n("em", null, a(i(e)("inventory.ingredient.import.importInstructions.detailedGuide.recipesSheet.col5")), 1),
1078
+ t[33] || (t[33] = n("br", null, null, -1)),
1079
+ t[34] || (t[34] = k(" • ")),
1080
+ n("em", null, a(i(e)("inventory.ingredient.import.importInstructions.detailedGuide.recipesSheet.col6")), 1),
1081
+ t[35] || (t[35] = n("br", null, null, -1)),
1082
+ t[36] || (t[36] = k(" • ")),
1083
+ n("em", null, a(i(e)("inventory.ingredient.import.importInstructions.detailedGuide.recipesSheet.col7")), 1),
1084
+ t[37] || (t[37] = n("br", null, null, -1)),
1085
+ t[38] || (t[38] = k(" • ")),
1086
+ n("em", null, a(i(e)("inventory.ingredient.import.importInstructions.detailedGuide.recipesSheet.col8")), 1)
1087
+ ]),
1088
+ n("div", Bt, [
1089
+ n("strong", null, a(i(e)("inventory.ingredient.import.importInstructions.detailedGuide.warning")), 1)
1090
+ ])
1091
+ ])
1092
+ ])
1093
+ ])
1094
+ ])),
1095
+ u.value ? (N(), D("div", Pt, [
1096
+ n("div", jt, [
1097
+ n("div", null, [
1098
+ n("div", Ot, a(i(e)("inventory.common.importPreview")), 1),
1099
+ n("div", Ht, [
1100
+ I.value ? (N(), D("span", zt, a(i(e)("inventory.common.errorExist")) + ": " + a(ee.value), 1)) : w.value ? (N(), D("span", Kt, a(i(e)("inventory.common.someItemsValidationErrors")), 1)) : (N(), D("span", Vt, a(i(e)("inventory.common.allItemsValidReadyImport")), 1))
1101
+ ])
1102
+ ]),
1103
+ n("div", Wt, [
1104
+ A(B, {
1105
+ variant: "secondary",
1106
+ onClick: le,
1107
+ label: i(e)("inventory.common.cancel")
1108
+ }, null, 8, ["label"]),
1109
+ A(B, {
1110
+ variant: "primary",
1111
+ onClick: be,
1112
+ loading: l.value,
1113
+ disabled: l.value || w.value || I.value,
1114
+ label: i(e)("inventory.common.import")
1115
+ }, null, 8, ["loading", "disabled", "label"])
1116
+ ])
1117
+ ]),
1118
+ n("div", Lt, [
1119
+ A(W, {
1120
+ "column-defs": we.value,
1121
+ "row-data": G.value,
1122
+ "page-size": _.value,
1123
+ "search-value": r.value,
1124
+ loading: !1,
1125
+ "row-hover": ""
1126
+ }, null, 8, ["column-defs", "row-data", "page-size", "search-value"])
1127
+ ])
1128
+ ])) : Z("", !0),
1129
+ o.value && d.value.length > 0 ? (N(), D("div", Jt, [
1130
+ n("div", Xt, [
1131
+ n("div", null, [
1132
+ n("div", qt, a(i(e)("inventory.common.importErrors")), 1),
1133
+ n("div", Qt, a(d.value.length) + " " + a(i(e)("inventory.common.itemsFailedImport")), 1)
1134
+ ]),
1135
+ n("div", Yt, [
1136
+ A(B, {
1137
+ variant: "secondary",
1138
+ onClick: he,
1139
+ label: i(e)("inventory.common.close")
1140
+ }, null, 8, ["label"])
1141
+ ])
1142
+ ]),
1143
+ n("div", Zt, [
1144
+ A(W, {
1145
+ "column-defs": Se.value,
1146
+ "row-data": ve.value,
1147
+ "page-size": _.value,
1148
+ "search-value": r.value,
1149
+ loading: !1,
1150
+ "row-hover": ""
1151
+ }, null, 8, ["column-defs", "row-data", "page-size", "search-value"])
1152
+ ])
1153
+ ])) : Z("", !0)
1154
+ ], 2),
1155
+ A(X, {
1156
+ "model-value": p.value,
1157
+ "onUpdate:modelValue": t[0] || (t[0] = (M) => p.value = M),
1158
+ header: `${(H = v.value) == null ? void 0 : H.type} Details`,
1159
+ "max-width": 600,
1160
+ "dismiss-away": ""
1161
+ }, {
1162
+ "side-sheet-footer": Q(() => [
1163
+ n("div", xn, [
1164
+ A(B, {
1165
+ label: i(e)("inventory.common.close"),
1166
+ variant: "tertiary",
1167
+ onClick: xe
1168
+ }, null, 8, ["label"])
1169
+ ])
1170
+ ]),
1171
+ default: Q(() => [
1172
+ v.value != null ? (N(), D("div", en, [
1173
+ A(z, {
1174
+ variant: "outlined",
1175
+ class: "p-16"
1176
+ }, {
1177
+ default: Q(() => {
1178
+ var M, O, j, K, P;
1179
+ return [
1180
+ n("div", tn, a(i(e)("inventory.common.basicInformation")), 1),
1181
+ n("div", nn, [
1182
+ n("div", null, [
1183
+ n("div", on, a(i(e)("inventory.common.name")), 1),
1184
+ n("div", rn, a(((O = (M = v.value) == null ? void 0 : M.details) == null ? void 0 : O.name) || ((j = v.value) == null ? void 0 : j.name)), 1)
1185
+ ]),
1186
+ (P = (K = v.value) == null ? void 0 : K.details) != null && P.code ? (N(), D("div", sn, [
1187
+ n("div", an, a(i(e)("inventory.common.code")), 1),
1188
+ n("div", ln, a(v.value.details.code), 1)
1189
+ ])) : Z("", !0),
1190
+ n("div", null, [
1191
+ n("div", mn, a(i(e)("inventory.common.type")), 1),
1192
+ n("div", un, a(v.value.type), 1)
1193
+ ]),
1194
+ n("div", null, [
1195
+ n("div", dn, a(i(e)("inventory.common.operation")), 1),
1196
+ n("div", cn, a(v.value.operation), 1)
1197
+ ]),
1198
+ n("div", null, [
1199
+ n("div", pn, a(i(e)("inventory.common.status")), 1),
1200
+ n("div", {
1201
+ class: ce([
1202
+ "inline-block px-8 py-4 rounded text-sm",
1203
+ v.value.status !== i(e)("inventory.common.readyToImport") ? "bg-red-100 text-red-800 border border-red-200" : "bg-green-100 text-green-800 border border-green-200"
1204
+ ])
1205
+ }, a(v.value.status), 3)
1206
+ ])
1207
+ ])
1208
+ ];
1209
+ }),
1210
+ _: 1
1211
+ }),
1212
+ v.value.errors && v.value.errors.length > 0 ? (N(), se(z, {
1213
+ key: 0,
1214
+ variant: "outlined",
1215
+ class: "p-16"
1216
+ }, {
1217
+ default: Q(() => [
1218
+ n("div", vn, a(i(e)("inventory.common.validationErrors")), 1),
1219
+ n("div", yn, [
1220
+ (N(!0), D(Be, null, Pe(v.value.errors, (M, O) => (N(), D("div", {
1221
+ key: O,
1222
+ class: "flex items-start gap-8 p-12 bg-red-50 border border-red-200 rounded"
1223
+ }, [
1224
+ A(C, {
1225
+ name: "error",
1226
+ class: "text-red-600 mt-2",
1227
+ size: "sm"
1228
+ }),
1229
+ n("div", gn, a(M), 1)
1230
+ ]))), 128))
1231
+ ])
1232
+ ]),
1233
+ _: 1
1234
+ })) : Z("", !0),
1235
+ A(z, {
1236
+ variant: "outlined",
1237
+ class: "p-16"
1238
+ }, {
1239
+ default: Q(() => [
1240
+ n("div", fn, a(i(e)("inventory.common.rawData")), 1),
1241
+ n("div", bn, [
1242
+ n("pre", hn, a(JSON.stringify(v.value.details, null, 2)), 1)
1243
+ ])
1244
+ ]),
1245
+ _: 1
1246
+ })
1247
+ ])) : Z("", !0)
1248
+ ]),
1249
+ _: 1
1250
+ }, 8, ["model-value", "header"])
1251
+ ];
1252
+ }),
1253
+ _: 1
1254
+ }, 8, ["title", "actions"])) : i(h).isLoaded ? (N(), se(ke, {
1255
+ key: 2,
1256
+ title: i(e)("inventory.common.import")
1257
+ }, {
1258
+ default: Q(() => [
1259
+ n("div", En, [
1260
+ A(C, {
1261
+ name: "block",
1262
+ class: "text-gray-400",
1263
+ size: "xl"
1264
+ }),
1265
+ n("div", Sn, [
1266
+ n("div", kn, a(i(e)("inventory.common.featureNotAvailable")), 1),
1267
+ n("div", Rn, a(i(e)("inventory.common.bulkImportNotEnabled")), 1)
1268
+ ])
1269
+ ])
1270
+ ]),
1271
+ _: 1
1272
+ }, 8, ["title"])) : (N(), se(ke, {
1273
+ key: 1,
1274
+ title: i(e)("inventory.common.import")
1275
+ }, {
1276
+ default: Q(() => [
1277
+ n("div", _n, [
1278
+ A(q, { size: "lg" }),
1279
+ n("div", wn, [
1280
+ n("div", In, a(i(e)("inventory.common.loading")), 1)
1281
+ ])
1282
+ ])
1283
+ ]),
1284
+ _: 1
1285
+ }, 8, ["title"]));
1286
+ };
1287
+ }
1288
+ });
1289
+ export {
1290
+ $n as default
1291
+ };