oportunidades 4
tests / ci (push) Canceled after 0s

This commit is contained in:
2026-10-10 07:03:59 +02:00
parent e662230df7
commit 6ddafc95ba
179 changed files with 22750 additions and 933 deletions
+91 -1
View File
@@ -2,6 +2,7 @@ import { Link, router } from '@inertiajs/react';
import { useState } from 'react';
import { Management, Pagination, button, control, states } from './shared';
import type { Paginated } from './shared';
import CountrySelect, { type Country } from '@/components/country-select';
type Interest = {
id: number;
@@ -15,17 +16,34 @@ type Interest = {
next_action: string | null;
next_action_due_at: string | null;
status: string;
countryName: string | null;
declaredOrigin: { code: string | null; name: string };
};
export default function Interests({
requests,
filters,
countries,
originStatistics,
}: {
requests: Paginated<Interest>;
filters: { q?: string; status?: string; follow_up?: string };
filters: {
q?: string;
status?: string;
follow_up?: string;
country?: string;
origin?: string;
};
countries: Country[];
originStatistics: Record<
string,
{ code: string | null; name: string; count: number }[]
>;
}) {
const [q, setQ] = useState(filters.q ?? '');
const [status, setStatus] = useState(filters.status ?? '');
const [followUp, setFollowUp] = useState(filters.follow_up ?? '');
const [country, setCountry] = useState(filters.country ?? '');
const [origin, setOrigin] = useState(filters.origin ?? '');
return (
<Management title="Manifestações de interesse">
<form
@@ -36,6 +54,8 @@ export default function Interests({
q,
status,
follow_up: followUp,
country,
origin,
});
}}
>
@@ -91,6 +111,29 @@ export default function Interests({
<option value="upcoming">Acções por vencer</option>
<option value="unassigned">Sem responsável</option>
</select>
<CountrySelect
countries={countries}
value={country}
onChange={setCountry}
label="Filtrar país do requerente"
/>
<label>
Origem declarada
<select
aria-label="Filtrar origem declarada"
className={control}
value={origin}
onChange={(e) => setOrigin(e.target.value)}
>
<option value="">Todas as origens</option>
<option value="unknown">Não informada</option>
{countries.map((c) => (
<option key={c.code} value={c.code}>
{c.name} ({c.code})
</option>
))}
</select>
</label>
<button className={button}>Pesquisar</button>
</form>
<div className="overflow-x-auto">
@@ -101,6 +144,8 @@ export default function Interests({
'Referência',
'Nome',
'Email',
'País do requerente',
'Origem declarada',
'Sector',
'Modalidade',
'Responsável',
@@ -129,6 +174,12 @@ export default function Interests({
{item.full_name}
</td>
<td className="border-b p-3">{item.email}</td>
<td className="border-b p-3">
{item.countryName ?? 'Não informado'}
</td>
<td className="border-b p-3">
{item.declaredOrigin.name}
</td>
<td className="border-b p-3">
{item.sector_interest}
</td>
@@ -161,6 +212,45 @@ export default function Interests({
</div>
{!requests.data.length && <p>Nenhum pedido encontrado.</p>}
<Pagination page={requests} />
<details>
<summary>
Estatísticas de solicitações por origem declarada
</summary>
<p>
Contagens por conjunto e filtro de origem; o filtro do país
do requerente aplica-se à lista. Rascunhos de negócios e do
Balcão são excluídos. Apoio fundiário recebido integra
manifestações; não se soma como outro conjunto nem se contam
investidores únicos.
</p>
{Object.entries(originStatistics).map(([group, counts]) => (
<section key={group}>
<h2>
{
(
{
interests:
'Manifestações recebidas, incluindo apoio fundiário',
desk: 'Pedidos do Balcão',
businesses: 'Negócios submetidos',
} as Record<string, string>
)[group]
}
</h2>
{counts.length ? (
<ul>
{counts.map((row) => (
<li key={row.code ?? 'unknown'}>
{row.name}: {row.count}
</li>
))}
</ul>
) : (
<p>Sem solicitações neste conjunto.</p>
)}
</section>
))}
</details>
</Management>
);
}