Files
soft_usite/resources/views/partials/header.html
T
2026-04-29 22:07:37 -05:00

83 lines
5.2 KiB
HTML
Executable File

<header class="h-16 bg-white border-b border-slate-200 flex items-center justify-between px-4 md:px-6 flex-shrink-0 z-20"
x-data="{
open: false,
initial: '{{ .user.NombreUsuario }}'.charAt(0).toUpperCase() || 'U',
userName: '{{ .user.NombreUsuario }}',
roleName: '{{ .user.Role.Name }}'
}">
<!-- Left: page context -->
<div class="flex items-center gap-3">
<!-- Mobile logo placeholder (sidebar button is in lateral.html) -->
<div class="md:hidden w-8"></div>
<!-- Breadcrumb / title area -->
<div class="hidden sm:flex items-center gap-2 text-sm text-slate-500">
<svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4 text-slate-400" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
<path stroke-linecap="round" stroke-linejoin="round" d="M2.25 12l8.954-8.955c.44-.439 1.152-.439 1.591 0L21.75 12M4.5 9.75v10.125c0 .621.504 1.125 1.125 1.125H9.75v-4.875c0-.621.504-1.125 1.125-1.125h2.25c.621 0 1.125.504 1.125 1.125V21h4.125c.621 0 1.125-.504 1.125-1.125V9.75M8.25 21h8.25"/>
</svg>
<span class="text-slate-400">Panel de control</span>
</div>
</div>
<!-- Right: actions + user menu -->
<div class="flex items-center gap-3">
<!-- User info (desktop) -->
<div class="hidden md:flex flex-col items-end mr-1">
<span class="text-xs font-semibold text-slate-700 leading-tight" x-text="userName"></span>
<span class="text-xs text-slate-400 leading-tight" x-text="roleName"></span>
</div>
<!-- Avatar dropdown -->
<div class="relative">
<button @click="open = !open"
class="flex items-center gap-2 p-1 rounded-xl hover:bg-slate-100 transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1"
style="--tw-ring-color:#8eb02f">
<div class="ui-avatar ui-avatar-lg" x-text="initial"></div>
<svg xmlns="http://www.w3.org/2000/svg"
class="h-3.5 w-3.5 text-slate-400 transition-transform duration-150"
:class="open ? 'rotate-180' : ''"
fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2.5">
<path stroke-linecap="round" stroke-linejoin="round" d="M19.5 8.25l-7.5 7.5-7.5-7.5"/>
</svg>
</button>
<!-- Dropdown -->
<div x-show="open"
@click.outside="open = false"
x-transition:enter="transition ease-out duration-150"
x-transition:enter-start="opacity-0 scale-95 -translate-y-1"
x-transition:enter-end="opacity-100 scale-100 translate-y-0"
x-transition:leave="transition ease-in duration-100"
x-transition:leave-start="opacity-100 scale-100 translate-y-0"
x-transition:leave-end="opacity-0 scale-95 -translate-y-1"
class="absolute right-0 top-12 w-52 bg-white rounded-xl shadow-lg border border-slate-200 overflow-hidden z-50">
<!-- User info in dropdown -->
<div class="px-4 py-3 border-b border-slate-100">
<p class="text-sm font-semibold text-slate-800 truncate" x-text="userName"></p>
<p class="text-xs text-slate-500 truncate" x-text="roleName"></p>
</div>
<!-- Links -->
<div class="py-1">
<a href="/app/profile"
class="flex items-center gap-3 px-4 py-2.5 text-sm text-slate-700 hover:bg-slate-50 transition-colors">
<svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4 text-slate-400" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
<path stroke-linecap="round" stroke-linejoin="round" d="M17.982 18.725A7.488 7.488 0 0012 15.75a7.488 7.488 0 00-5.982 2.975m11.963 0a9 9 0 10-11.963 0m11.963 0A8.966 8.966 0 0112 21a8.966 8.966 0 01-5.982-2.275M15 9.75a3 3 0 11-6 0 3 3 0 016 0z"/>
</svg>
Mi cuenta
</a>
<div class="border-t border-slate-100 my-1"></div>
<a href="/do/logout"
class="flex items-center gap-3 px-4 py-2.5 text-sm text-red-600 hover:bg-red-50 transition-colors"
onclick="event.preventDefault(); document.getElementById('header-logout').submit();">
<svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
<path stroke-linecap="round" stroke-linejoin="round" d="M15.75 9V5.25A2.25 2.25 0 0013.5 3h-6a2.25 2.25 0 00-2.25 2.25v13.5A2.25 2.25 0 007.5 21h6a2.25 2.25 0 002.25-2.25V15M12 9l-3 3m0 0l3 3m-3-3h12.75"/>
</svg>
Cerrar sesión
</a>
<form id="header-logout" action="/do/logout" method="POST" class="hidden"></form>
</div>
</div>
</div>
</div>
</header>