feat(reports): enrich all-user report details
This commit is contained in:
@@ -10,10 +10,12 @@ import {
|
||||
getChartReport,
|
||||
getDayDetailsReport,
|
||||
getTableReport,
|
||||
getUserSummaryReport,
|
||||
type ChartReportResponse,
|
||||
type DayDetailsResponse,
|
||||
type ReportFilters,
|
||||
type TableReportResponse,
|
||||
type UserScopedTableReport,
|
||||
} from "../api/reports";
|
||||
import { getTags, type Tag } from "../api/tags";
|
||||
import { fetchWorkspaceMemberships, type WorkspaceMembership } from "../api/workspaces";
|
||||
@@ -262,6 +264,13 @@ export default function Reports() {
|
||||
}
|
||||
};
|
||||
|
||||
const handleLoadUserSummaryReport = async (userId: string): Promise<UserScopedTableReport> => {
|
||||
if (!apiFilters) {
|
||||
throw new Error("Missing report filters");
|
||||
}
|
||||
return getUserSummaryReport(apiFilters, userId);
|
||||
};
|
||||
|
||||
if (!activeWorkspace) {
|
||||
return (
|
||||
<div className="p-6">
|
||||
@@ -362,13 +371,10 @@ export default function Reports() {
|
||||
}}
|
||||
/>
|
||||
|
||||
{isLoading ? (
|
||||
<div className="rounded-2xl border border-slate-200 bg-white p-6 text-sm text-slate-600 dark:border-slate-800 dark:bg-slate-900 dark:text-slate-300">
|
||||
{t.loading || "Loading..."}
|
||||
</div>
|
||||
) : tab === "chart" ? (
|
||||
{tab === "chart" ? (
|
||||
<ReportsChartPanel
|
||||
data={chartData}
|
||||
isLoading={isLoading}
|
||||
labels={{
|
||||
totalHours: t.reports?.totalHours || "Total hours",
|
||||
billableHours: t.reports?.billableHours || "Billable hours",
|
||||
@@ -376,6 +382,7 @@ export default function Reports() {
|
||||
totalIncome: t.reports?.totalIncome || "Total income",
|
||||
chart: t.reports?.chartTitle || "Activity chart",
|
||||
totalSeconds: t.reports?.totalSeconds || "Total seconds",
|
||||
loading: t.loading || "Loading...",
|
||||
}}
|
||||
/>
|
||||
) : (
|
||||
@@ -384,8 +391,10 @@ export default function Reports() {
|
||||
dayDetails={dayDetails}
|
||||
openDay={openDay}
|
||||
onToggleDay={(day) => void handleToggleDay(day)}
|
||||
onLoadUserSummaryReport={(userId) => handleLoadUserSummaryReport(userId)}
|
||||
onExport={(type) => void handleExport(type)}
|
||||
exportState={exportState}
|
||||
isLoading={isLoading}
|
||||
labels={{
|
||||
exportExcel: t.reports?.exportExcel || "Export Excel",
|
||||
exportPdf: t.reports?.exportPdf || "Export PDF",
|
||||
@@ -409,13 +418,19 @@ export default function Reports() {
|
||||
userSummaryDetailsTitle: t.reports?.userSummaryDetailsTitle || "User details: {name}",
|
||||
userSummaryDetailsDescription: t.reports?.userSummaryDetailsDescription || "Detailed rate history and distribution for the selected user.",
|
||||
rateHistory: t.reports?.rateHistory || "Rate history",
|
||||
project: t.reports?.project || "Project",
|
||||
fromDate: t.reports?.fromDate || "From",
|
||||
toDate: t.reports?.toDate || "To",
|
||||
now: t.reports?.now || "Now",
|
||||
loadDetailsError: t.reports?.loadError || "Failed to load user report details.",
|
||||
hourPercentage: t.reports?.hourPercentage || "Hour %",
|
||||
incomePercentage: t.reports?.incomePercentage || "Income %",
|
||||
noData: t.reports?.noData || "No data",
|
||||
clientsTable: t.reports?.clientsTable || "Clients",
|
||||
projectsTable: t.reports?.projectsTable || "Projects",
|
||||
tagsTable: t.reports?.tagsTable || "Tags",
|
||||
noDescription: t.timesheet?.emptyDescription || "No description",
|
||||
loading: t.loading || "Loading...",
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user