diff --git a/project/frontend/src/components/KennzahlenTable.tsx b/project/frontend/src/components/KennzahlenTable.tsx index f4db2d7..10058ca 100644 --- a/project/frontend/src/components/KennzahlenTable.tsx +++ b/project/frontend/src/components/KennzahlenTable.tsx @@ -286,18 +286,22 @@ export default function KennzahlenTable({ )} - - onPageClick?.( - Number(row.extractedValues.at(0)?.page), - row.extractedValues.at(0)?.entity || "", - ) - } - sx={{ cursor: "pointer" }} - > - {row.extractedValues.at(0)?.page} - + {(row.extractedValues.at(0)?.page ?? 0) > 0 ? ( + { + const extractedValue = row.extractedValues.at(0); + if (extractedValue?.page && extractedValue.page > 0) { + onPageClick?.(Number(extractedValue.page), extractedValue.entity || ""); + } + }} + sx={{ cursor: "pointer" }} + > + {row.extractedValues.at(0)?.page} + + ) : ( + "" + )} ); diff --git a/project/frontend/src/routes/extractedResult_.$pitchBook.$kpi.tsx b/project/frontend/src/routes/extractedResult_.$pitchBook.$kpi.tsx index b2f6b17..22ec938 100644 --- a/project/frontend/src/routes/extractedResult_.$pitchBook.$kpi.tsx +++ b/project/frontend/src/routes/extractedResult_.$pitchBook.$kpi.tsx @@ -30,8 +30,6 @@ import { useEffect, useState } from "react"; import PDFViewer from "../components/pdfViewer"; import { fetchPutKPI } from "../util/api"; import { kpiQueryOptions } from "../util/query"; -import ArrowBackIcon from "@mui/icons-material/ArrowBack"; -import {fetchPutKPI} from "../util/api"; import { redirect } from "@tanstack/react-router"; export const Route = createFileRoute("/extractedResult_/$pitchBook/$kpi")({ @@ -78,9 +76,21 @@ function ExtractedResultsPage() { const { mutate: updateKPI } = useMutation({ mutationFn: () => { const updatedData = { ...kpiData }; + let baseObject; + if (selectedIndex >= 0) { + baseObject = kpiValues[selectedIndex]; + } else { + baseObject = { + label: kpi.toUpperCase(), + entity: selectedValue, + page: 0, + status: "single-source", + source: "manual", + }; + } updatedData[kpi.toUpperCase()] = [ { - ...kpiValues[0], + ...baseObject, entity: selectedValue, }, ];