chore: refine report filters and access gating

This commit is contained in:
Esdras Renan 2025-11-13 23:35:05 -03:00
parent 52c03ff1cf
commit 6938bebdbb
3 changed files with 6 additions and 5 deletions

View file

@ -303,7 +303,7 @@ export function ReportTemplatesManager({ tenantId: tenantIdProp }: ReportTemplat
onValueChange={(value) => setFilterCompanyId(value ?? "all")} onValueChange={(value) => setFilterCompanyId(value ?? "all")}
options={companyOptions} options={companyOptions}
placeholder="Todas as empresas" placeholder="Todas as empresas"
className="w-full min-w-56 md:w-64" className="h-9 w-full min-w-56 rounded-full border border-slate-300 bg-white px-3 text-sm font-medium text-neutral-800 md:w-64"
/> />
<Button <Button
size="sm" size="sm"
@ -396,7 +396,7 @@ export function ReportTemplatesManager({ tenantId: tenantIdProp }: ReportTemplat
onValueChange={(value) => setTargetCompanyId(value ?? "all")} onValueChange={(value) => setTargetCompanyId(value ?? "all")}
options={companyOptions} options={companyOptions}
placeholder="Todas as empresas" placeholder="Todas as empresas"
className="w-full" className="h-9 w-full rounded-full border border-slate-300 bg-white px-3 text-sm font-medium text-neutral-800"
/> />
<p className="mt-2 text-xs text-neutral-500"> <p className="mt-2 text-xs text-neutral-500">
Defina se este template será global ou específico para uma empresa. Defina se este template será global ou específico para uma empresa.

View file

@ -38,7 +38,8 @@ export function MachineCategoryReport() {
const { session, convexUserId, isStaff } = useAuth() const { session, convexUserId, isStaff } = useAuth()
const tenantId = session?.user.tenantId ?? DEFAULT_TENANT_ID const tenantId = session?.user.tenantId ?? DEFAULT_TENANT_ID
const enabled = Boolean(isStaff && convexUserId) const canView = Boolean(isStaff)
const enabled = Boolean(canView && convexUserId)
const data = useQuery( const data = useQuery(
api.reports.ticketsByMachineAndCategory, api.reports.ticketsByMachineAndCategory,
@ -118,7 +119,7 @@ export function MachineCategoryReport() {
[items] [items]
) )
if (!enabled) { if (!canView) {
return ( return (
<Card className="border-slate-200"> <Card className="border-slate-200">
<CardHeader> <CardHeader>

View file

@ -54,7 +54,7 @@ export function ReportsFilterToolbar({
onValueChange={(next) => onCompanyChange(next ?? "all")} onValueChange={(next) => onCompanyChange(next ?? "all")}
options={companyOptions} options={companyOptions}
placeholder="Todas as empresas" placeholder="Todas as empresas"
className="w-full min-w-56 md:w-64" className="h-10 w-full min-w-56 rounded-2xl border border-border/60 bg-background/95 px-3 text-left text-sm font-semibold text-neutral-800 md:w-64"
/> />
{showBillingFilter ? ( {showBillingFilter ? (
<ToggleGroup <ToggleGroup