diff --git a/project/frontend/src/components/KennzahlenTable.tsx b/project/frontend/src/components/KennzahlenTable.tsx new file mode 100644 index 0000000..420ed8f --- /dev/null +++ b/project/frontend/src/components/KennzahlenTable.tsx @@ -0,0 +1,132 @@ +import { + Table, TableBody, TableCell, TableContainer, + TableHead, TableRow, Paper, Box, + Dialog, DialogActions, DialogContent, DialogTitle, + TextField, Button + } from '@mui/material'; + import ErrorOutlineIcon from '@mui/icons-material/ErrorOutline'; + import SearchIcon from '@mui/icons-material/Search'; + import EditIcon from '@mui/icons-material/Edit'; + import { useState } from 'react'; + + + // Beispiel-Daten + const exampleData = [ + { label: 'Fondsname', value: 'Fund Real Estate Prime Europe', page: 1, status: 'ok' }, + { label: 'Fondsmanager', value: '', page: 1, status: 'error' }, + { label: 'Risikoprofil', value: 'Core/Core+', page: 10, status: 'warning' }, + { label: 'LTV', value: '30-35 %', page: 8, status: 'ok' } + ]; + + // React-Komponente + export default function KennzahlenTable() { + // Zustand für bearbeitbare Daten + const [rows, setRows] = useState(exampleData); + + // Zustände für Dialog-Funktion + const [open, setOpen] = useState(false); // Dialog anzeigen? + const [currentValue, setCurrentValue] = useState(''); // Eingabewert + const [currentIndex, setCurrentIndex] = useState(null); // Zeilenindex + + // Beim Klick auf das Stift-Icon: Dialog öffnen + const handleEditClick = (value: string, index: number) => { + setCurrentValue(value); + setCurrentIndex(index); + setOpen(true); + }; + + // Wert speichern und Dialog schließen + const handleSave = () => { + if (currentIndex !== null) { + const updated = [...rows]; + updated[currentIndex].value = currentValue; + setRows(updated); + } + setOpen(false); + }; + + return ( + <> + + + {/* Tabellenkopf */} + + + Kennzahl + Wert + Seite + + + + {/* Tabelleninhalt */} + + {rows.map((row, index) => { + // Rahmenfarbe anhand Status + let borderColor = 'transparent'; + if (row.status === 'error') borderColor = 'red'; + else if (row.status === 'warning') borderColor = '#f6ed48'; + + return ( + + {/* Kennzahl */} + {row.label} + + {/* Wert mit Status-Icons + Stift rechts */} + + + + {row.status === 'error' && } + {row.status === 'warning' && } + {row.value || '—'} + + + {/* Stift-Icon */} + handleEditClick(row.value, index)} + /> + + + + {/* Seitenzahl */} + {row.page} + + ); + })} + +
+
+ + {/* Dialog zum Bearbeiten */} + setOpen(false)}> + Kennzahl bearbeiten + + setCurrentValue(e.target.value)} + label="Neuer Wert" + variant="outlined" + margin="dense" + /> + + + + + + + + ); + } + \ No newline at end of file diff --git a/project/frontend/src/routes/extractedResult.$pitchBook.tsx b/project/frontend/src/routes/extractedResult.$pitchBook.tsx index 5f5fe37..01cbebb 100644 --- a/project/frontend/src/routes/extractedResult.$pitchBook.tsx +++ b/project/frontend/src/routes/extractedResult.$pitchBook.tsx @@ -1,100 +1,100 @@ import ContentPasteIcon from "@mui/icons-material/ContentPaste"; import { Box, Button, Paper, Typography } from "@mui/material"; import { createFileRoute, useNavigate } from "@tanstack/react-router"; +import KennzahlenTable from "../components/KennzahlenTable"; import PDFViewer from "../components/pdfViewer"; export const Route = createFileRoute("/extractedResult/$pitchBook")({ - component: ExtractedResultsPage, + component: ExtractedResultsPage, }); function ExtractedResultsPage() { - const { pitchBook } = Route.useParams(); - const navigate = useNavigate(); - const status: "green" | "yellow" | "red" = "red"; + const { pitchBook } = Route.useParams(); + const navigate = useNavigate(); + const status: "green" | "yellow" | "red" = "red"; - const statusColor = { - red: "#f43131", - yellow: "#f6ed48", - green: "#3fd942", - }[status]; + const statusColor = { + red: "#f43131", + yellow: "#f6ed48", + green: "#3fd942", + }[status]; - return ( - - - - - Kennzahlen extrahiert aus:
- FONDSNAME: TODO -
-
- - - To-do: Table hierhin - - - - - - - - - - - -
- ); + return ( + + + + + Kennzahlen extrahiert aus:
+ FONDSNAME: TODO +
+
+ + + + + + + + + + + + + + +
+ ); }