feat: improve requester combobox and admin cleanup flows

This commit is contained in:
Esdras Renan 2025-10-24 00:45:41 -03:00
parent 788f6928a1
commit 37c32149a6
13 changed files with 923 additions and 180 deletions

View file

@ -30,7 +30,6 @@ import {
COMPANY_CONTRACT_TYPES,
COMPANY_LOCATION_TYPES,
COMPANY_STATE_REGISTRATION_TYPES,
SLA_SEVERITY_LEVELS,
companyFormSchema,
type CompanyBusinessHours,
type CompanyContract,
@ -119,14 +118,6 @@ const DAY_OPTIONS = [
] as const
const EMPTY_SELECT_VALUE = "__empty__"
const SLA_LEVEL_LABEL: Record<(typeof SLA_SEVERITY_LEVELS)[number], string> = {
P1: "P1",
P2: "P2",
P3: "P3",
P4: "P4",
}
function createId(prefix: string) {
if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
return `${prefix}-${crypto.randomUUID()}`
@ -763,7 +754,6 @@ function TableView({ companies, machineCountsBySlug, onEdit, onDelete }: TableVi
<TableHead>Empresa</TableHead>
<TableHead>Contratos ativos</TableHead>
<TableHead>Contatos</TableHead>
<TableHead>SLA</TableHead>
<TableHead>Máquinas</TableHead>
<TableHead className="text-right">Ações</TableHead>
</TableRow>
@ -771,7 +761,7 @@ function TableView({ companies, machineCountsBySlug, onEdit, onDelete }: TableVi
<TableBody>
{companies.length === 0 ? (
<TableRow>
<TableCell colSpan={6}>
<TableCell colSpan={5}>
<div className="flex flex-col items-center gap-2 py-6 text-sm text-muted-foreground">
<IconBuildingSkyscraper className="size-6 text-border" />
<p>Nenhuma empresa encontrada com os filtros atuais.</p>
@ -852,27 +842,6 @@ function TableView({ companies, machineCountsBySlug, onEdit, onDelete }: TableVi
</ul>
)}
</TableCell>
<TableCell className="align-middle text-xs">
{company.sla ? (
<div className="space-y-1 rounded-md border border-border/60 px-2 py-1">
<p className="font-semibold uppercase text-muted-foreground">
{company.sla.calendar.toUpperCase()}
</p>
<ul className="space-y-1">
{company.sla.severities.map((severity) => (
<li key={severity.level} className="flex items-center justify-between text-[11px]">
<span>{SLA_LEVEL_LABEL[severity.level]}</span>
<span>
{severity.responseMinutes}m · {severity.resolutionMinutes}m
</span>
</li>
))}
</ul>
</div>
) : (
<p className="text-muted-foreground">Sem SLA cadastrado.</p>
)}
</TableCell>
<TableCell className="align-middle text-sm">
<Badge variant="outline">{machineCount}</Badge>
</TableCell>