Add sección de preferencias detectadas en el detalle del lead
This commit is contained in:
@@ -35,6 +35,7 @@ export default async function LeadDetailPage({ params }: { params: Promise<{ id:
|
|||||||
|
|
||||||
const snapshot = lead.desgloseSnapshot as { result: BudgetResult } | null;
|
const snapshot = lead.desgloseSnapshot as { result: BudgetResult } | null;
|
||||||
const desglose = snapshot?.result ?? null;
|
const desglose = snapshot?.result ?? null;
|
||||||
|
const prefs = lead.preferencesSnapshot as import('@/lib/voice/preferences').AbstractedPreferences | null;
|
||||||
const yaEnviado = lead.pipelineStage === 'whatsapp_entregado';
|
const yaEnviado = lead.pipelineStage === 'whatsapp_entregado';
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -128,6 +129,49 @@ export default async function LeadDetailPage({ params }: { params: Promise<{ id:
|
|||||||
)}
|
)}
|
||||||
</Section>
|
</Section>
|
||||||
|
|
||||||
|
{/* Preferencias detectadas */}
|
||||||
|
<Section title="Preferencias detectadas">
|
||||||
|
{prefs ? (
|
||||||
|
<div className="flex flex-col gap-3 text-sm">
|
||||||
|
<p className="text-gray-700">{prefs.resumen}</p>
|
||||||
|
{prefs.estiloRender.length > 0 && (
|
||||||
|
<div className="flex flex-wrap gap-2">
|
||||||
|
{prefs.estiloRender.map((e) => (
|
||||||
|
<span key={e} className="px-2 py-0.5 rounded-full bg-gray-100 text-gray-700 text-xs">
|
||||||
|
{e}
|
||||||
|
</span>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
{prefs.elementos.length > 0 && (
|
||||||
|
<ul className="flex flex-col gap-1">
|
||||||
|
{prefs.elementos.map((el) => (
|
||||||
|
<li key={el.key} className="flex justify-between">
|
||||||
|
<span className="text-gray-600">{el.label}</span>
|
||||||
|
<span className="text-black font-medium">{formatEuros(el.importe)}</span>
|
||||||
|
</li>
|
||||||
|
))}
|
||||||
|
</ul>
|
||||||
|
)}
|
||||||
|
{prefs.ajustes.length > 0 && (
|
||||||
|
<ul className="text-xs text-gray-500 flex flex-col gap-1">
|
||||||
|
{prefs.ajustes.map((a, i) => (
|
||||||
|
<li key={i}>
|
||||||
|
<span className="font-medium text-gray-700">{a.label}</span> — {a.motivo}
|
||||||
|
</li>
|
||||||
|
))}
|
||||||
|
</ul>
|
||||||
|
)}
|
||||||
|
<div className="text-xs text-gray-400">
|
||||||
|
Confianza de la extracción: {prefs.confianza}
|
||||||
|
{prefs.camposFaltantes.length > 0 && ` · faltan: ${prefs.camposFaltantes.join(', ')}`}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
|
<p className="text-sm text-gray-400">Sin preferencias procesadas aún.</p>
|
||||||
|
)}
|
||||||
|
</Section>
|
||||||
|
|
||||||
{/* 2. Transcripción */}
|
{/* 2. Transcripción */}
|
||||||
<Section title="Transcripción de la llamada">
|
<Section title="Transcripción de la llamada">
|
||||||
{lead.transcripcion ? (
|
{lead.transcripcion ? (
|
||||||
|
|||||||
Reference in New Issue
Block a user