@@ -10,22 +10,27 @@ type Record = {
|
||||
slug: string;
|
||||
is_active?: boolean;
|
||||
status?: string;
|
||||
geography_scope?: string;
|
||||
primary_territory?: { name: string; location_type: string; source_system?: string; source_code?: string | null } | null;
|
||||
};
|
||||
export default function Catalog({
|
||||
resource,
|
||||
records,
|
||||
filters,
|
||||
sectors,
|
||||
geographyReviewCount = 0,
|
||||
}: {
|
||||
resource: 'sectors' | 'opportunities';
|
||||
records: Paginated<Record>;
|
||||
filters: { q?: string; status?: string; sector_id?: number | string };
|
||||
filters: { q?: string; status?: string; sector_id?: number | string; geography_scope?: string };
|
||||
sectors: { id: number; name: string }[];
|
||||
geographyReviewCount?: number;
|
||||
}) {
|
||||
const form = useForm({
|
||||
q: filters.q ?? '',
|
||||
status: filters.status ?? '',
|
||||
sector_id: String(filters.sector_id ?? ''),
|
||||
geography_scope: filters.geography_scope ?? '',
|
||||
});
|
||||
return (
|
||||
<Management
|
||||
@@ -34,6 +39,11 @@ export default function Catalog({
|
||||
<Link className={button} href={`/management/${resource}/create`}>
|
||||
Criar {resource === 'sectors' ? 'sector' : 'oportunidade'}
|
||||
</Link>
|
||||
{resource === 'opportunities' && (
|
||||
<p role="status" className="my-3">
|
||||
{geographyReviewCount} oportunidade(s) aguardam confirmação do âmbito geográfico. A lista não altera localizações; confirme apenas com fontes existentes.
|
||||
</p>
|
||||
)}
|
||||
<form
|
||||
className="flex flex-wrap gap-3"
|
||||
onSubmit={(event) => {
|
||||
@@ -74,6 +84,7 @@ export default function Catalog({
|
||||
))}
|
||||
</select>
|
||||
{resource === 'opportunities' && (
|
||||
<>
|
||||
<select
|
||||
aria-label="Sector"
|
||||
className={`${control} max-w-xs`}
|
||||
@@ -89,6 +100,20 @@ export default function Catalog({
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
<select
|
||||
aria-label="Âmbito geográfico"
|
||||
className={`${control} max-w-xs`}
|
||||
value={form.data.geography_scope}
|
||||
onChange={(event) => form.setData('geography_scope', event.target.value)}
|
||||
>
|
||||
<option value="">Todos os âmbitos</option>
|
||||
<option value="unspecified">Pendente de confirmação</option>
|
||||
<option value="specific">Localização específica</option>
|
||||
<option value="multiple">Várias localizações</option>
|
||||
<option value="national">Âmbito nacional</option>
|
||||
<option value="digital">Digital/sem instalação definida</option>
|
||||
</select>
|
||||
</>
|
||||
)}
|
||||
<button className={button} disabled={form.processing}>
|
||||
Pesquisar
|
||||
@@ -123,6 +148,11 @@ export default function Catalog({
|
||||
: 'Inactivo'
|
||||
: states[record.status ?? 'draft']}
|
||||
</p>
|
||||
{resource === 'opportunities' && record.geography_scope === 'unspecified' && (
|
||||
<p className="mt-1 text-sm">
|
||||
Pendente de confirmação; território já registado: {record.primary_territory?.name ?? 'nenhum'}. Fonte do território: {record.primary_territory?.source_system ?? 'não indicada'}{record.primary_territory?.source_code ? `, código ${record.primary_territory.source_code}` : ''}. A classificação não é alterada automaticamente.
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
<Link
|
||||
className="underline"
|
||||
|
||||
Reference in New Issue
Block a user