diff --git a/backend/app/main.py b/backend/app/main.py index 5ccf7d1..7d25d55 100644 --- a/backend/app/main.py +++ b/backend/app/main.py @@ -204,7 +204,7 @@ def send_completed_inspection_to_n8n(inspection, db): # No lanzamos excepción para no interrumpir el flujo normal -BACKEND_VERSION = "1.0.76" +BACKEND_VERSION = "1.0.77" app = FastAPI(title="Checklist Inteligente API", version=BACKEND_VERSION) # S3/MinIO configuration @@ -1374,7 +1374,23 @@ def generate_inspection_pdf(inspection_id: int, db: Session) -> str: checklist = db.query(models.Checklist).filter(models.Checklist.id == inspection.checklist_id).first() # ===== PORTADA ===== - elements.append(Spacer(1, 15*mm)) + elements.append(Spacer(1, 10*mm)) + + # Logo del checklist (si existe) + if checklist.logo_url: + try: + logo_resp = requests.get(checklist.logo_url, timeout=10) + if logo_resp.status_code == 200: + logo_bytes = BytesIO(logo_resp.content) + logo_img = RLImage(logo_bytes, width=40*mm, height=40*mm) + logo_table = Table([[logo_img]], colWidths=[40*mm]) + logo_table.setStyle(TableStyle([ + ('ALIGN', (0, 0), (-1, -1), 'CENTER'), + ])) + elements.append(logo_table) + elements.append(Spacer(1, 5*mm)) + except Exception as e: + print(f"⚠️ Error cargando logo del checklist: {e}") # Título con diseño moderno elements.append(Paragraph("📋 INFORME DE INSPECCIÓN VEHICULAR", title_style))