mirror of
https://github.com/Hestia-Homes/assessment-model.git
synced 2026-06-30 12:55:02 +00:00
setting up basic functionality for filter ooptions
This commit is contained in:
parent
7caada25ca
commit
ce2475e395
1 changed files with 14 additions and 4 deletions
|
|
@ -21,6 +21,7 @@ import type {
|
|||
PropertyTypeCount,
|
||||
ScenarioSummary,
|
||||
} from "./types";
|
||||
import { ReportingFunctionalityButtons } from "./ReportingFunctionalityButtons";
|
||||
|
||||
interface ReportingClientAreaProps {
|
||||
baseline: BaselineMetrics;
|
||||
|
|
@ -40,7 +41,7 @@ async function fetchScenarioReport({
|
|||
scenarioId: number;
|
||||
}) {
|
||||
const res = await fetch(
|
||||
`/api/portfolio/${portfolioId}/scenario/${scenarioId}/metrics`
|
||||
`/api/portfolio/${portfolioId}/scenario/${scenarioId}/metrics`,
|
||||
);
|
||||
if (!res.ok) {
|
||||
console.error("Failed to fetch scenario report:", await res.text());
|
||||
|
|
@ -57,7 +58,7 @@ async function fetchScenarioMeasures({
|
|||
scenarioId: number;
|
||||
}) {
|
||||
const res = await fetch(
|
||||
`/api/portfolio/${portfolioId}/scenario/${scenarioId}/measures`
|
||||
`/api/portfolio/${portfolioId}/scenario/${scenarioId}/measures`,
|
||||
);
|
||||
|
||||
if (!res.ok) {
|
||||
|
|
@ -74,9 +75,10 @@ export function ReportingClientArea({
|
|||
portfolioId,
|
||||
}: ReportingClientAreaProps) {
|
||||
const [selectedScenarioId, setSelectedScenarioId] = useState<number | null>(
|
||||
null
|
||||
null,
|
||||
);
|
||||
const [measuresOpen, setMeasuresOpen] = useState<boolean>(false);
|
||||
const [hideNonCompliant, setHideNonCompliant] = useState(false);
|
||||
|
||||
const drawerOpen = Boolean(selectedScenarioId);
|
||||
|
||||
|
|
@ -193,6 +195,7 @@ export function ReportingClientArea({
|
|||
{/* RIGHT: Actions (only when scenario selected) */}
|
||||
{selectedScenarioId && (
|
||||
<div className="flex items-center gap-2">
|
||||
{/* Show measures */}
|
||||
<button
|
||||
onClick={() => setMeasuresOpen(true)}
|
||||
disabled={scenarioLoading}
|
||||
|
|
@ -208,11 +211,18 @@ export function ReportingClientArea({
|
|||
{scenarioLoading ? "Loading…" : "Show measures"}
|
||||
</button>
|
||||
|
||||
<ReportingFunctionalityButtons
|
||||
hideNonCompliant={hideNonCompliant}
|
||||
onApplyHideNonCompliant={setHideNonCompliant}
|
||||
disabled={scenarioLoading}
|
||||
/>
|
||||
|
||||
{/* Download PDF */}
|
||||
<button
|
||||
onClick={() => {
|
||||
window.open(
|
||||
`/portfolio/${portfolioId}/reporting/pdf?scenarioId=${selectedScenarioId}`,
|
||||
"_blank"
|
||||
"_blank",
|
||||
);
|
||||
}}
|
||||
disabled={scenarioLoading}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue