diff --git a/app/Http/Middleware/HandleInertiaRequests.php b/app/Http/Middleware/HandleInertiaRequests.php index 2c56cff..e140a93 100644 --- a/app/Http/Middleware/HandleInertiaRequests.php +++ b/app/Http/Middleware/HandleInertiaRequests.php @@ -4,6 +4,7 @@ use Illuminate\Http\Request; use Illuminate\Support\Facades\Auth; +use Illuminate\Support\Facades\Storage; use Inertia\Middleware; class HandleInertiaRequests extends Middleware @@ -42,6 +43,10 @@ public function share(Request $request): array 'id' => $request->user()->id, 'name' => $request->user()->name, 'email' => $request->user()->email, + 'roles' => $request->user()->roles->pluck('name'), + 'profile_photo_url' => $request->user()->profile_photo_path + ? Storage::url($request->user()->profile_photo_path) + : null, ] : null, ], ]); diff --git a/resources/css/app.css b/resources/css/app.css index 0de2120..b5c61c9 100644 --- a/resources/css/app.css +++ b/resources/css/app.css @@ -1,7 +1,3 @@ @tailwind base; @tailwind components; @tailwind utilities; - -[x-cloak] { - display: none; -} diff --git a/resources/js/Components/Dashboard/NavBar.vue b/resources/js/Components/Dashboard/NavBar.vue index 78654f6..09de721 100644 --- a/resources/js/Components/Dashboard/NavBar.vue +++ b/resources/js/Components/Dashboard/NavBar.vue @@ -1,69 +1,53 @@ @@ -74,8 +58,8 @@ import { router } from '@inertiajs/vue3'; import { useDarkMode } from '@/composables/useDarkMode'; import { usePage } from '@inertiajs/vue3'; - const authUser = computed(() => usePage().props.auth.user); +const isAdmin = computed(() => authUser.value.roles && authUser.value.roles.includes('admin')); const { isDarkMode, toggleDarkMode } = useDarkMode(); const isMenuOpen = ref(false); @@ -84,36 +68,56 @@ const toggleMenu = () => { isMenuOpen.value = !isMenuOpen.value; }; -const theme = computed(() => ({ - primary: isDarkMode.value ? '#42A5F5' : '#1565C0', - textPrimary: isDarkMode.value ? '#E0E0E0' : '#212121', - textSecondary: isDarkMode.value ? '#B0BEC5' : '#757575', - cardBackground: isDarkMode.value ? '#242526' : '#FFFFFF', - navBackground: isDarkMode.value ? '#1E1E1E' : '#FFFFFF', - navShadow: isDarkMode.value ? '0 8px 20px rgba(0, 0, 0, 0.8)' : '0 8px 20px rgba(0, 191, 255, 0.2)', - border: isDarkMode.value ? '#424242' : '#E0E0E0', - gradient: isDarkMode.value ? 'linear-gradient(135deg, #1E1E1E 0%, #2A2A2A 100%)' : 'linear-gradient(135deg, #FFFFFF 0%, #F5F5F5 100%)', - emphasis: isDarkMode.value ? '#FFCA28' : '#FFC107', -})); +const handleExploreRaffles = () => { + window.location.href = '/raffles/admin/rifas'; +}; + +const handleAdminPanel = () => { + window.location.href = '/admin'; +}; + +const goToProfile = () => { + window.location.href = `/profile/${authUser.value.id}`; +}; const logout = () => { - console.log("Logout clickeado"); // Verificar si el clic está funcionando router.post(route('logout'), {}, { onFinish: () => { window.location.href = '/login'; }, }); }; + +const theme = computed(() => ({ + backgroundGradient: isDarkMode.value + ? 'bg-[#1a1a1c] shadow-lg' + : 'bg-[#F5F5F7] shadow-sm', + textPrimary: isDarkMode.value ? 'text-white' : 'text-gray-900', + textSecondary: isDarkMode.value ? 'text-gray-300' : 'text-gray-700', + primaryButton: isDarkMode.value + ? 'bg-blue-700 text-white hover:bg-blue-800' + : 'bg-blue-600 text-white hover:bg-blue-700', + secondaryButton: isDarkMode.value + ? 'bg-red-700 text-white hover:bg-red-800' + : 'bg-red-600 text-white hover:bg-red-700', + cardBackground: isDarkMode.value ? '#242526' : '#FFFFFF', + navBackground: isDarkMode.value ? '#1E1E1E' : '#FFFFFF', + navShadow: isDarkMode.value ? '0 8px 20px rgba(0, 0, 0, 0.8)' : '0 8px 20px rgba(0, 191, 255, 0.2)', + border: isDarkMode.value ? '#424242' : '#E0E0E0', + gradient: isDarkMode.value ? 'linear-gradient(135deg, #1E1E1E 0%, #2A2A2A 100%)' : 'linear-gradient(135deg, #FFFFFF 0%, #F5F5F5 100%)', + emphasis: isDarkMode.value ? '#FFCA28' : '#FFC107', +})); + \ No newline at end of file diff --git a/resources/js/Components/Dashboard/RaffleCard.vue b/resources/js/Components/Dashboard/RaffleCard.vue index aacf29c..fc2c6a0 100644 --- a/resources/js/Components/Dashboard/RaffleCard.vue +++ b/resources/js/Components/Dashboard/RaffleCard.vue @@ -1,19 +1,15 @@ + \ No newline at end of file diff --git a/resources/js/Components/Dashboard/UserTestimonials.vue b/resources/js/Components/Dashboard/UserTestimonials.vue index 0ee6411..a3028db 100644 --- a/resources/js/Components/Dashboard/UserTestimonials.vue +++ b/resources/js/Components/Dashboard/UserTestimonials.vue @@ -92,7 +92,7 @@ diff --git a/routes/web.php b/routes/web.php index 9af8533..12830fc 100644 --- a/routes/web.php +++ b/routes/web.php @@ -52,7 +52,7 @@ Route::middleware(['auth', 'role:admin'])->group(function () { Route::get('/users', [UserController::class, 'index'])->name('users.index'); Route::get('/users/create', [UserController::class, 'create'])->name('users.create'); - Route::get('/users/{user}/edit', [UserController::class, 'edit'])->name('users.edit'); + Route::get('/users/{user}/edit', [UserController::class, 'edit'] )->name('users.edit'); Route::put('/users/{user}', [UserController::class, 'update'])->name('users.update'); Route::delete('/users/{user}', [UserController::class, 'destroy'])->name('users.destroy'); });