@@ -8,15 +8,28 @@ export default function Leads({
|
||||
leads,
|
||||
filters,
|
||||
owners,
|
||||
originStatistics,
|
||||
countries,
|
||||
}: {
|
||||
leads: Paginated<Lead>;
|
||||
filters: { q?: string; status?: string; owner_user_id?: number };
|
||||
filters: {
|
||||
q?: string;
|
||||
status?: string;
|
||||
owner_user_id?: number;
|
||||
origin?: string;
|
||||
};
|
||||
owners: Owner[];
|
||||
countries: { code: string; name: string }[];
|
||||
originStatistics: {
|
||||
interests: { code: string | null; name: string; count: number }[];
|
||||
desk: { code: string | null; name: string; count: number }[];
|
||||
};
|
||||
}) {
|
||||
const form = useForm({
|
||||
q: filters.q ?? '',
|
||||
status: filters.status ?? '',
|
||||
owner_user_id: String(filters.owner_user_id ?? ''),
|
||||
origin: filters.origin ?? '',
|
||||
});
|
||||
return (
|
||||
<Management title="CRM — Leads">
|
||||
@@ -31,6 +44,74 @@ export default function Leads({
|
||||
Acompanhamento do investidor — pedidos, tarefas e respostas do
|
||||
Balcão
|
||||
</Link>
|
||||
<details
|
||||
open={Boolean(filters.origin)}
|
||||
className="rounded border p-3"
|
||||
>
|
||||
<summary>Solicitações por origem declarada</summary>
|
||||
<p>
|
||||
Conta pedidos por origem declarada, sem inferir
|
||||
nacionalidade. Manifestações e pedidos do Balcão são
|
||||
conjuntos separados; não representam uma contagem de
|
||||
investidores únicos.
|
||||
</p>
|
||||
<form
|
||||
className="my-3 flex flex-wrap gap-3"
|
||||
onSubmit={(e) => {
|
||||
e.preventDefault();
|
||||
form.get('/management/crm/leads', {
|
||||
preserveState: false,
|
||||
});
|
||||
}}
|
||||
>
|
||||
<label className="max-w-full">
|
||||
Origem das estatísticas
|
||||
<select
|
||||
aria-label="Origem das estatísticas"
|
||||
className={`${control} max-w-full`}
|
||||
value={form.data.origin}
|
||||
onChange={(e) =>
|
||||
form.setData('origin', e.target.value)
|
||||
}
|
||||
>
|
||||
<option value="">Todas as origens</option>
|
||||
<option value="unknown">Não informado</option>
|
||||
{countries.map((country) => (
|
||||
<option key={country.code} value={country.code}>
|
||||
{country.name}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</label>
|
||||
<button className={button} disabled={form.processing}>
|
||||
Filtrar estatísticas
|
||||
</button>
|
||||
</form>
|
||||
<p className="text-sm">
|
||||
Este filtro aplica-se apenas às contagens de solicitações. A
|
||||
lista de leads mantém os filtros abaixo.
|
||||
</p>
|
||||
{(['interests', 'desk'] as const).map((group) => (
|
||||
<section key={group}>
|
||||
<h2>
|
||||
{group === 'interests'
|
||||
? 'Manifestações recebidas'
|
||||
: 'Pedidos do Balcão em acompanhamento'}
|
||||
</h2>
|
||||
{originStatistics[group].length ? (
|
||||
<ul>
|
||||
{originStatistics[group].map((row) => (
|
||||
<li key={row.code ?? 'unknown'}>
|
||||
{row.name}: {row.count}
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
) : (
|
||||
<p>Sem pedidos neste conjunto.</p>
|
||||
)}
|
||||
</section>
|
||||
))}
|
||||
</details>
|
||||
<form
|
||||
className="flex flex-wrap gap-3"
|
||||
onSubmit={(e) => {
|
||||
|
||||
Reference in New Issue
Block a user