feat: improve reports filters and ticket flows

This commit is contained in:
Esdras Renan 2025-11-14 19:41:47 -03:00
parent 9c74e10675
commit 15d11b6b12
29 changed files with 437 additions and 140 deletions

View file

@ -205,6 +205,16 @@ export function HoursReport() {
[filteredCompaniesWithComputed]
)
const exportHref = useMemo(() => {
const params = new URLSearchParams()
const effectiveRange = timeRange === "365d" || timeRange === "all" ? "90d" : timeRange
params.set("range", effectiveRange)
if (companyId !== "all") params.set("companyId", companyId)
if (dateFrom) params.set("dateFrom", dateFrom)
if (dateTo) params.set("dateTo", dateTo)
return `/api/reports/hours-by-client.xlsx?${params.toString()}`
}, [companyId, dateFrom, dateTo, timeRange])
return (
<div className="space-y-6">
{isAdmin ? (
@ -230,9 +240,7 @@ export function HoursReport() {
showBillingFilter
billingFilter={billingFilter}
onBillingFilterChange={(value) => setBillingFilter(value)}
exportHref={`/api/reports/hours-by-client.xlsx?range=${
timeRange === "365d" || timeRange === "all" ? "90d" : timeRange
}${companyId !== "all" ? `&companyId=${companyId}` : ""}`}
exportHref={exportHref}
onOpenScheduler={isAdmin ? () => setSchedulerOpen(true) : undefined}
dateFrom={dateFrom}
dateTo={dateTo}