feature: my page

This commit is contained in:
antv
2026-07-03 16:54:43 +07:00
parent 1943f23406
commit d8f0e48bf3
7 changed files with 126 additions and 93 deletions
+29 -7
View File
@@ -33,8 +33,6 @@
@if(Auth::check() && Auth::user()->role == \App\Models\User::ROLE_ADMIN)
<!-- ADMIN SIDEBAR -->
<div class="pt-2 mt-2 border-t border-gray-100"></div>
<x-sidebar-item href="{{ route('admin.users.index') }}" :active="request()->routeIs('admin.users.index')" icon="users">
Quản User
</x-sidebar-item>
@@ -51,18 +49,42 @@
</div>
<!-- User Profile Section -->
<div class="p-5 border-t border-gray-100 flex items-center justify-between cursor-pointer hover:bg-gray-50 transition-colors shrink-0">
<div id="sidebar-profile" class="p-5 border-t border-gray-100 flex items-center justify-between cursor-pointer hover:bg-gray-50 transition-colors shrink-0">
<div class="flex items-center gap-3">
<div class="w-10 h-10 rounded-full overflow-hidden shrink-0 border border-gray-200">
<img src="https://api.dicebear.com/7.x/notionists/svg?seed={{ Auth::id() ?? 'MinhAnh' }}&backgroundColor=e2e8f0" alt="Avatar" class="w-full h-full object-cover">
@php
$avatarUrl = Auth::check() && Auth::user()->avatar
? Auth::user()->avatar
: (Auth::check() && Auth::user()->name
? 'https://api.dicebear.com/7.x/notionists/svg?seed=' . urlencode(Auth::user()->name) . '&backgroundColor=e2e8f0'
: asset('images/avatar.png'));
@endphp
<img src="{{ $avatarUrl }}" alt="Avatar" class="w-full h-full object-cover">
</div>
<div class="flex flex-col">
<span class="text-[14px] font-bold text-[#1e293b] leading-tight truncate max-w-[130px]">{{ Auth::check() ? (Auth::user()->name ?? 'Nguyễn Minh Anh') : 'Nguyễn Minh Anh' }}</span>
<span class="text-[12px] text-gray-500 font-medium">{{ Auth::check() ? (Auth::user()->role == \App\Models\User::ROLE_ADMIN ? 'Administrator' : 'Product Team') : 'Product Team' }}</span>
</div>
</div>
<svg class="w-4 h-4 text-gray-600" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
<path stroke-linecap="round" stroke-linejoin="round" d="M19 9l-7 7-7-7" />
</svg>
<svg class="w-4 h-4 text-gray-600" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path stroke-linecap="round" stroke-linejoin="round" d="M19 9l-7 7-7-7" /></svg>
</div>
<!-- Logout Modal -->
<div id="logout-modal" class="fixed inset-0 flex items-center justify-center bg-black bg-opacity-50 hidden">
<div class="bg-white rounded-lg shadow-lg p-6 w-80">
<h2 class="text-lg font-semibold mb-4">Bạn muốn đăng xuất?</h2>
<form method="POST" action="{{ route('logout') }}">
@csrf
<button type="submit" class="w-full bg-red-600 text-white py-2 rounded-md hover:bg-red-700">Logout</button>
</form>
<button id="close-logout-modal" class="mt-3 w-full text-gray-600 py-2 rounded-md hover:bg-gray-100">Cancel</button>
</div>
</div>
<script>
document.getElementById('sidebar-profile')?.addEventListener('click', function () {
document.getElementById('logout-modal').classList.remove('hidden');
});
document.getElementById('close-logout-modal')?.addEventListener('click', function () {
document.getElementById('logout-modal').classList.add('hidden');
});
</script>
</aside>