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")}
options={companyOptions}
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
size="sm"
@ -396,7 +396,7 @@ export function ReportTemplatesManager({ tenantId: tenantIdProp }: ReportTemplat
onValueChange={(value) => setTargetCompanyId(value ?? "all")}
options={companyOptions}
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">
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 tenantId = session?.user.tenantId ?? DEFAULT_TENANT_ID
const enabled = Boolean(isStaff && convexUserId)
const canView = Boolean(isStaff)
const enabled = Boolean(canView && convexUserId)
const data = useQuery(
api.reports.ticketsByMachineAndCategory,
@ -118,7 +119,7 @@ export function MachineCategoryReport() {
[items]
)
if (!enabled) {
if (!canView) {
return (
<Card className="border-slate-200">
<CardHeader>

View file

@ -54,7 +54,7 @@ export function ReportsFilterToolbar({
onValueChange={(next) => onCompanyChange(next ?? "all")}
options={companyOptions}
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 ? (
<ToggleGroup