@@ -0,0 +1,119 @@
|
||||
import { Link, useForm } from "@inertiajs/react";
|
||||
import { Management, Field, button, control, states } from "./shared";
|
||||
|
||||
type Interest = {
|
||||
id: number;
|
||||
reference: string;
|
||||
full_name: string;
|
||||
email: string;
|
||||
phone: string | null;
|
||||
investor_type: string;
|
||||
country: string;
|
||||
sector_interest: string;
|
||||
opportunity_reference: string | null;
|
||||
investment_range: string | null;
|
||||
message: string;
|
||||
status: string;
|
||||
consented_at: string | null;
|
||||
reviewed_at: string | null;
|
||||
reviewed_by: number | null;
|
||||
created_at: string;
|
||||
metadata?: {
|
||||
submission_id?: string;
|
||||
journey_id?: string;
|
||||
dossier_id?: string;
|
||||
role?: string;
|
||||
horizon?: string;
|
||||
};
|
||||
};
|
||||
function dateTime(value: string | null) {
|
||||
if (!value) return "—";
|
||||
return new Intl.DateTimeFormat("pt-MZ", {
|
||||
dateStyle: "medium",
|
||||
timeStyle: "short",
|
||||
timeZone: "Africa/Maputo",
|
||||
}).format(new Date(value));
|
||||
}
|
||||
export default function InterestDetail({ interest }: { interest: Interest }) {
|
||||
const form = useForm({ status: interest.status });
|
||||
const rows: [string, string | number | null][] = [
|
||||
["Nome", interest.full_name],
|
||||
["Email", interest.email],
|
||||
["Telefone", interest.phone],
|
||||
["Tipo de investidor", interest.investor_type],
|
||||
["País", interest.country],
|
||||
["Sector", interest.sector_interest],
|
||||
["Oportunidade", interest.opportunity_reference],
|
||||
["Faixa de investimento", interest.investment_range],
|
||||
["Recebido em (Maputo)", dateTime(interest.created_at)],
|
||||
["Consentimento em (Maputo)", dateTime(interest.consented_at)],
|
||||
["Revisto em (Maputo)", dateTime(interest.reviewed_at)],
|
||||
["Revisto pelo utilizador", interest.reviewed_by],
|
||||
];
|
||||
return (
|
||||
<Management title={interest.reference}>
|
||||
{interest.metadata?.submission_id && (
|
||||
<Link
|
||||
className="underline"
|
||||
href={`/investidor/manifestacoes/${interest.metadata.submission_id}`}
|
||||
>
|
||||
Consultar manifestação completa, necessidades e anexos privados
|
||||
</Link>
|
||||
)}
|
||||
{interest.metadata?.dossier_id && (
|
||||
<section className="space-y-2 rounded border p-4">
|
||||
<h2 className="font-semibold">Contexto de investimento</h2>
|
||||
<Link
|
||||
className="underline"
|
||||
href={`/management/portfolio/${interest.metadata.dossier_id}`}
|
||||
>
|
||||
Consultar corredor, cluster ou projecto de origem
|
||||
</Link>
|
||||
<p>Jornada: {interest.metadata.journey_id}</p>
|
||||
<p>
|
||||
Papel: {interest.metadata.role} · Horizonte: {interest.metadata.horizon}
|
||||
</p>
|
||||
</section>
|
||||
)}
|
||||
<Link className={button} href={`/management/crm/convert/${interest.id}`}>
|
||||
Encaminhar para o CRM
|
||||
</Link>
|
||||
<dl className="grid gap-4 sm:grid-cols-2">
|
||||
{rows.map(([label, value]) => (
|
||||
<div key={label}>
|
||||
<dt className="text-muted-foreground text-sm">{label}</dt>
|
||||
<dd className="break-words">{value ?? "—"}</dd>
|
||||
</div>
|
||||
))}
|
||||
</dl>
|
||||
<section>
|
||||
<h2 className="font-semibold">Mensagem</h2>
|
||||
<p className="mt-2 break-words whitespace-pre-wrap">{interest.message}</p>
|
||||
</section>
|
||||
<form
|
||||
className="max-w-sm space-y-4"
|
||||
onSubmit={(e) => {
|
||||
e.preventDefault();
|
||||
form.patch(`/management/interests/${interest.id}`);
|
||||
}}
|
||||
>
|
||||
<Field label="Estado do pedido" error={form.errors.status}>
|
||||
<select
|
||||
className={control}
|
||||
value={form.data.status}
|
||||
onChange={(e) => form.setData("status", e.target.value)}
|
||||
>
|
||||
{["received", "in_review", "contacted", "closed"].map((key) => (
|
||||
<option key={key} value={key}>
|
||||
{states[key]}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</Field>
|
||||
<button className={button} disabled={form.processing}>
|
||||
{form.processing ? "A guardar…" : "Guardar estado"}
|
||||
</button>
|
||||
</form>
|
||||
</Management>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user