feat: mapeamento automatico de categoria na importacao de planilhas

This commit is contained in:
Yuri Argolo
2026-06-13 15:54:27 -03:00
committed by Felipe Coutinho
parent 2fd6e3c323
commit 558197e870
3 changed files with 19 additions and 6 deletions

View File

@@ -108,9 +108,18 @@ export function ImportPage({
setRows(
stmt.transactions.map((t) => {
const mappedCategoryId =
let mappedCategoryId =
categoryMappings[normalizeDescriptionKey(t.description)] ?? null;
if (t.categoryRaw) {
const matchedOption = categoryOptions.find(
(opt) => opt.label.toLowerCase() === t.categoryRaw?.toLowerCase()
);
if (matchedOption) {
mappedCategoryId = matchedOption.value;
}
}
return {
...t,
isDuplicate: t.externalId ? duplicates.has(t.externalId) : false,
@@ -129,7 +138,7 @@ export function ImportPage({
setIsChecking(false);
}
},
[isCategoryCompatible, payerId],
[isCategoryCompatible, payerId, categoryOptions],
);
// Pré-seleciona cartão ou conta com base no tipo detectado no OFX