Implement CSV import functionality in TableManagement component and update API routes to utilize database for CSV data handling. Remove old CSV parsing logic and enhance month retrieval from the database. Add UI elements for CSV import in the TableManagement view.

This commit is contained in:
sebseb7
2025-08-01 13:32:59 +02:00
parent fbfd918d81
commit cbc826a4e1
2 changed files with 62 additions and 203 deletions

View File

@@ -10,16 +10,19 @@ import {
AccountBalance as KreditorIcon,
AccountBalanceWallet as KontoIcon,
Receipt as BUIcon,
CloudUpload as ImportIcon,
} from '@mui/icons-material';
import KreditorTable from './admin/KreditorTable';
import KontoTable from './admin/KontoTable';
import BUTable from './admin/BUTable';
import CSVImportDialog from './CSVImportDialog';
class TableManagement extends Component {
constructor(props) {
super(props);
this.state = {
activeTab: 0,
csvImportOpen: false,
};
}
@@ -27,6 +30,14 @@ class TableManagement extends Component {
this.setState({ activeTab: newValue });
};
handleOpenCSVImport = () => {
this.setState({ csvImportOpen: true });
};
handleCloseCSVImport = () => {
this.setState({ csvImportOpen: false });
};
render() {
const { activeTab } = this.state;
const { user } = this.props;
@@ -59,6 +70,11 @@ class TableManagement extends Component {
label="Buchungsschlüssel"
sx={{ minHeight: 64 }}
/>
<Tab
icon={<ImportIcon />}
label="CSV Import"
sx={{ minHeight: 64 }}
/>
</Tabs>
</Box>
@@ -66,6 +82,21 @@ class TableManagement extends Component {
{activeTab === 0 && <KreditorTable user={user} />}
{activeTab === 1 && <KontoTable user={user} />}
{activeTab === 2 && <BUTable user={user} />}
{activeTab === 3 && (
<Box>
<Typography variant="h6" gutterBottom>
CSV Transaktionen importieren
</Typography>
<Typography variant="body2" color="text.secondary" paragraph>
Hier können Sie CSV-Dateien von Ihrer Bank importieren. Die Daten werden in die Datenbank gespeichert und können dann Banking-Konten zugeordnet werden.
</Typography>
<CSVImportDialog
open={true}
onClose={() => {}} // Always open in this tab
user={user}
/>
</Box>
)}
</Box>
</Paper>
</Box>