fix: checkbox 'fatura de cartão' auto-configura colunas corretas

Ao marcar 'Fatura de cartão', amount_column=3, description=1,
skip_negative=true — elimina erro de coluna errada no CSV do banco.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
This commit is contained in:
2026-05-27 15:58:04 -03:00
co-authored by Claude Sonnet 4.6
parent e438002c0a
commit 54d5a03604
+15 -1
View File
@@ -1,5 +1,5 @@
<script setup lang="ts">
import { ref, computed } from 'vue'
import { ref, computed, watch } from 'vue'
import { useImportStore, type CSVMapping } from '@/stores/import'
import NeonPanel from '@/components/NeonPanel.vue'
@@ -21,6 +21,20 @@ const csvMapping = ref<CSVMapping>({
all_expenses: false,
})
// Quando "Fatura de cartão" é marcado, configura automaticamente as colunas corretas
watch(() => csvMapping.value.all_expenses, (isCard) => {
if (isCard) {
csvMapping.value.date_column = 0
csvMapping.value.description_column = 1
csvMapping.value.amount_column = 3
csvMapping.value.field_separator = ';'
csvMapping.value.decimal_separator = ','
csvMapping.value.date_format = '02/01/2006'
csvMapping.value.has_header = true
csvMapping.value.skip_negative = true
}
})
function onFileChange(e: Event) {
const input = e.target as HTMLInputElement
const file = input.files?.[0]