@@ -11,7 +11,12 @@ type Record = {
|
||||
is_active?: boolean;
|
||||
status?: string;
|
||||
geography_scope?: string;
|
||||
primary_territory?: { name: string; location_type: string; source_system?: string; source_code?: string | null } | null;
|
||||
primary_territory?: {
|
||||
name: string;
|
||||
location_type: string;
|
||||
source_system?: string;
|
||||
source_code?: string | null;
|
||||
} | null;
|
||||
};
|
||||
export default function Catalog({
|
||||
resource,
|
||||
@@ -22,7 +27,12 @@ export default function Catalog({
|
||||
}: {
|
||||
resource: 'sectors' | 'opportunities';
|
||||
records: Paginated<Record>;
|
||||
filters: { q?: string; status?: string; sector_id?: number | string; geography_scope?: string };
|
||||
filters: {
|
||||
q?: string;
|
||||
status?: string;
|
||||
sector_id?: number | string;
|
||||
geography_scope?: string;
|
||||
};
|
||||
sectors: { id: number; name: string }[];
|
||||
geographyReviewCount?: number;
|
||||
}) {
|
||||
@@ -41,7 +51,9 @@ export default function Catalog({
|
||||
</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.
|
||||
{geographyReviewCount} oportunidade(s) aguardam confirmação
|
||||
do âmbito geográfico. A lista não altera localizações;
|
||||
confirme apenas com fontes existentes.
|
||||
</p>
|
||||
)}
|
||||
<form
|
||||
@@ -85,34 +97,47 @@ export default function Catalog({
|
||||
</select>
|
||||
{resource === 'opportunities' && (
|
||||
<>
|
||||
<select
|
||||
aria-label="Sector"
|
||||
className={`${control} max-w-xs`}
|
||||
value={form.data.sector_id}
|
||||
onChange={(event) =>
|
||||
form.setData('sector_id', event.target.value)
|
||||
}
|
||||
>
|
||||
<option value="">Todos os sectores</option>
|
||||
{sectors.map((sector) => (
|
||||
<option key={sector.id} value={sector.id}>
|
||||
{sector.name}
|
||||
<select
|
||||
aria-label="Sector"
|
||||
className={`${control} max-w-xs`}
|
||||
value={form.data.sector_id}
|
||||
onChange={(event) =>
|
||||
form.setData('sector_id', event.target.value)
|
||||
}
|
||||
>
|
||||
<option value="">Todos os sectores</option>
|
||||
{sectors.map((sector) => (
|
||||
<option key={sector.id} value={sector.id}>
|
||||
{sector.name}
|
||||
</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>
|
||||
))}
|
||||
</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>
|
||||
<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}>
|
||||
@@ -148,11 +173,23 @@ 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>
|
||||
)}
|
||||
{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