Muestra fotos y notas por zona en la ficha del lead

- agruparPorZona (lib/funnel/fotos.ts): helper puro que agrupa fotos
  (antes/después) y notas por zona, con fallback al tipo del lead. 5 tests.
- getLead trae también lead_notas.
- LeadFotosGaleria: galería por zona (Antes/Después + notas) que sustituye el
  grid plano de la ficha del panel.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Carlos Narro
2026-06-03 19:22:12 +02:00
parent 0a5f8cba2b
commit 5df608f203
5 changed files with 186 additions and 12 deletions

View File

@@ -5,6 +5,7 @@ import { getLead } from '@/db/queries';
import EstadoControl from '@/components/panel/EstadoControl';
import ConceptosEditor from '@/components/panel/ConceptosEditor';
import OpinionLinkBox from '@/components/panel/OpinionLinkBox';
import LeadFotosGaleria from '@/components/panel/LeadFotosGaleria';
import {
PIPELINE_LABEL,
PIPELINE_NEXT,
@@ -32,7 +33,7 @@ export default async function LeadDetailPage({ params }: { params: Promise<{ id:
const data = await getLead(id);
if (!data) notFound();
const { lead, fotos, eventos, precision } = data;
const { lead, fotos, notas, eventos, precision } = data;
const reachedStages = new Set(eventos.map((e) => e.stage));
const snapshot = lead.desgloseSnapshot as { result: BudgetResult } | null;
@@ -275,15 +276,10 @@ export default async function LeadDetailPage({ params }: { params: Promise<{ id:
</Section>
</div>
{/* Fotos subidas */}
{fotos.length > 0 && (
<Section title="Fotos subidas por el cliente">
<div className="flex flex-wrap gap-3">
{fotos.map((f) => (
// eslint-disable-next-line @next/next/no-img-element
<img key={f.id} src={f.url} alt="" className="w-32 h-24 object-cover rounded-lg border border-gray-200" />
))}
</div>
{/* Fotos y notas por zona */}
{(fotos.length > 0 || notas.length > 0) && (
<Section title="Fotos y detalles por zona">
<LeadFotosGaleria fotos={fotos} notas={notas} tipoLead={lead.tipoReforma} />
</Section>
)}