diff --git a/backend/app/api/v1/endpoints/tickets.py b/backend/app/api/v1/endpoints/tickets.py index 887b5f9..48f534f 100644 --- a/backend/app/api/v1/endpoints/tickets.py +++ b/backend/app/api/v1/endpoints/tickets.py @@ -865,10 +865,16 @@ async def download_attachment( current_tenant: Tenant = Depends(get_current_tenant) ): """Descargar un archivo adjunto""" + import logging + logger = logging.getLogger(__name__) + + logger.info(f"Download request - ticket_id: {ticket_id}, attachment_id: {attachment_id}") + try: ticket_uuid = uuid.UUID(ticket_id) attachment_uuid = uuid.UUID(attachment_id) except ValueError: + logger.error(f"Invalid UUID format - ticket_id: {ticket_id}, attachment_id: {attachment_id}") raise HTTPException(status_code=400, detail="ID inválido") # Verificar ticket @@ -878,6 +884,7 @@ async def download_attachment( ticket = result.scalar_one_or_none() if not ticket: + logger.error(f"Ticket not found - ticket_id: {ticket_id}") raise HTTPException(status_code=404, detail="Ticket no encontrado") # Obtener attachment @@ -888,12 +895,26 @@ async def download_attachment( attachment = result.scalar_one_or_none() if not attachment: + logger.error(f"Attachment not found - attachment_id: {attachment_id}") raise HTTPException(status_code=404, detail="Adjunto no encontrado") + logger.info(f"Attachment found - file_path: {attachment.file_path}, original_filename: {attachment.original_filename}") + # Obtener path del archivo - file_path = file_handler.get_file_path(attachment.file_path) + try: + file_path = file_handler.get_file_path(attachment.file_path) + logger.info(f"Absolute file path: {file_path}") + + if not file_path.exists(): + logger.error(f"File does not exist at path: {file_path}") + raise HTTPException(status_code=404, detail="Archivo no encontrado en el sistema") + + except Exception as e: + logger.error(f"Error getting file path: {str(e)}") + raise # Retornar archivo + logger.info(f"Returning file: {attachment.original_filename}") return FileResponse( path=file_path, filename=attachment.original_filename, diff --git a/frontend-client/src/lib/components/Header.svelte b/frontend-client/src/lib/components/Header.svelte index c810bd7..2ab1ab1 100644 --- a/frontend-client/src/lib/components/Header.svelte +++ b/frontend-client/src/lib/components/Header.svelte @@ -2,20 +2,20 @@ import { onMount } from 'svelte'; import { auth } from '$lib/stores/auth.js'; import Icon from './Icon.svelte'; - + export let showLogo = true; export let showNavigation = true; - + let isMenuOpen = false; - + onMount(() => { auth.init(); }); - + function toggleMenu() { isMenuOpen = !isMenuOpen; } - + function handleLogout() { auth.logout(); isMenuOpen = false; @@ -43,10 +43,16 @@ {#if showNavigation && $auth.isAuthenticated} @@ -60,7 +66,7 @@ on:click={toggleMenu} class="flex items-center space-x-2 text-gray-700 hover:text-primary-600 focus:outline-none focus:ring-2 focus:ring-primary-500 focus:ring-offset-2 rounded-md p-2" tabindex="0" - on:keydown={(e) => e.key === 'Enter' && toggleMenu()} + on:keydown={e => e.key === 'Enter' && toggleMenu()} >
- Gestiona tus tickets de soporte de manera eficiente. Crea nuevos tickets, - da seguimiento a los existentes y mantente actualizado con el estado de tus solicitudes. + Gestiona tus tickets de soporte de manera eficiente. Crea nuevos tickets, da seguimiento a + los existentes y mantente actualizado con el estado de tus solicitudes.
- Reporta un problema o solicita soporte técnico -
+Reporta un problema o solicita soporte técnico
- Consulta el estado de todos tus tickets -
+Consulta el estado de todos tus tickets
- Actualiza tu información personal -
+Actualiza tu información personal
Últimos tickets que has creado o actualizado
Cargando tickets...
Error al cargar los tickets
-
-
+ - Portal de atención a clientes. Genere tickets de soporte técnico para nuestros sistemas y reciba asistencia especializada para garantizar la continuidad de su operación. -
-+ Portal de atención a clientes. Genere tickets de soporte técnico para nuestros sistemas y + reciba asistencia especializada para garantizar la continuidad de su operación. +
+Ingrese a su cuenta corporativa
+ +Ingrese a su cuenta corporativa
+Cargando ticket...
{$tickets.error}
-{$tickets.currentTicket.description}
- {Math.round(attachment.size_bytes / 1024)} KB • - Subido por {attachment.uploaded_by_name} • + {Math.round(attachment.size_bytes / 1024)} KB • Subido por {attachment.uploaded_by_name} + • {formatDate(attachment.uploaded_at)}
- ¿Estás seguro de que quieres cerrar este ticket? Esta acción indica que el problema ha sido resuelto satisfactoriamente. + ¿Estás seguro de que quieres cerrar este ticket? Esta acción indica que el + problema ha sido resuelto satisfactoriamente.
Panel Interno
- {$auth.user?.first_name} {$auth.user?.last_name} + {$auth.user?.first_name} + {$auth.user?.last_name}
- {$auth.user?.role === 'ADMIN' ? 'Administrador' : - $auth.user?.role === 'SUPPORT_MANAGER' ? 'Gerente de Soporte' : - $auth.user?.role === 'AGENT' ? 'Agente' : 'Auditor'} + {$auth.user?.role === 'ADMIN' + ? 'Administrador' + : $auth.user?.role === 'SUPPORT_MANAGER' + ? 'Gerente de Soporte' + : $auth.user?.role === 'AGENT' + ? 'Agente' + : 'Auditor'}
Cargando ticket...
+ {attachment.original_filename} +
++ {Math.round(attachment.size_bytes / 1024)} KB + {#if attachment.uploaded_by_name} + • Subido por {attachment.uploaded_by_name} + {/if} + {#if attachment.uploaded_at} + • {formatDate(attachment.uploaded_at)} + {/if} +
+