import { useState } from "react";
import toast from "react-hot-toast";
import {
ArrowRight,
BarChart3,
Boxes,
CheckCircle2,
DoorOpen,
Loader2,
Sparkles,
Table2,
TrendingUp,
} from "lucide-react";
import { getEquipmentDemandReport, getRoomUtilizationReport } from "../api.js";
export default function ReportsPage() {
const [roomReport, setRoomReport] = useState([]);
const [equipmentReport, setEquipmentReport] = useState([]);
const [activeReport, setActiveReport] = useState(null);
const [loadingRoomReport, setLoadingRoomReport] = useState(false);
const [loadingEquipmentReport, setLoadingEquipmentReport] = useState(false);
async function loadRoomReport() {
setLoadingRoomReport(true);
try {
const data = await getRoomUtilizationReport();
setRoomReport(Array.isArray(data) ? data : []);
setActiveReport("rooms");
toast.success("Room utilization report loaded");
} catch (err) {
toast.error(err.message || "Room utilization report could not be loaded.");
} finally {
setLoadingRoomReport(false);
}
}
async function loadEquipmentReport() {
setLoadingEquipmentReport(true);
try {
const data = await getEquipmentDemandReport();
setEquipmentReport(Array.isArray(data) ? data : []);
setActiveReport("equipment");
toast.success("Equipment demand report loaded");
} catch (err) {
toast.error(err.message || "Equipment demand report could not be loaded.");
} finally {
setLoadingEquipmentReport(false);
}
}
return (
Review room utilization, equipment demand and operational trends
using live data from the project database.
Choose one of the analytical reports above. Results will be loaded
from the live database and displayed in a structured table.
Reports & Insights
Select a report to view results
{subtitle}
| {column} | ))}
|---|
| {String(cell ?? "")} | ))}
The query executed successfully, but there is no matching data for the current dataset.