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:
@@ -3,6 +3,7 @@ import { db } from './index';
|
||||
import {
|
||||
leads,
|
||||
leadFotos,
|
||||
leadNotas,
|
||||
leadEstadoHistory,
|
||||
leadPipelineEventos,
|
||||
precisionHistory,
|
||||
@@ -31,8 +32,9 @@ export async function getLead(id: string) {
|
||||
|
||||
if (!lead) return null;
|
||||
|
||||
const [fotos, eventos, historial, precision] = await Promise.all([
|
||||
const [fotos, notas, eventos, historial, precision] = await Promise.all([
|
||||
db.select().from(leadFotos).where(eq(leadFotos.leadId, id)).orderBy(asc(leadFotos.orden)),
|
||||
db.select().from(leadNotas).where(eq(leadNotas.leadId, id)).orderBy(asc(leadNotas.createdAt)),
|
||||
db
|
||||
.select()
|
||||
.from(leadPipelineEventos)
|
||||
@@ -46,7 +48,7 @@ export async function getLead(id: string) {
|
||||
db.select().from(precisionHistory).where(eq(precisionHistory.leadId, id)),
|
||||
]);
|
||||
|
||||
return { lead, fotos, eventos, historial, precision: precision[0] ?? null };
|
||||
return { lead, fotos, notas, eventos, historial, precision: precision[0] ?? null };
|
||||
}
|
||||
|
||||
export async function getResumen() {
|
||||
|
||||
Reference in New Issue
Block a user