Fix responsive layouts for Internaciones/Evoluciones tables and currentUser undefined error
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { clsx, type ClassValue } from "clsx"
|
||||
import { twMerge } from "tailwind-merge"
|
||||
import type { Usuario } from '@/types'
|
||||
|
||||
export function cn(...inputs: ClassValue[]) {
|
||||
return twMerge(clsx(inputs))
|
||||
@@ -12,3 +13,14 @@ export function formatDateDDMMYYYY(dateString: string): string {
|
||||
const [year, month, day] = parts;
|
||||
return `${day}-${month}-${year}`;
|
||||
}
|
||||
|
||||
export function getNombreProfesional(user?: Usuario | null): string {
|
||||
if (!user) return 'Admin';
|
||||
if (user.rol === 'admin') return 'Admin';
|
||||
const apellido = user.apellido?.trim() || '';
|
||||
const nombre = user.nombre?.trim() || '';
|
||||
if (apellido && nombre) return `${apellido}, ${nombre}`;
|
||||
if (apellido) return apellido;
|
||||
if (nombre) return nombre;
|
||||
return 'Admin';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user