@extends('layouts.dashboard') @section('title', 'Mon Profil - Sciences Afrique') @section('page-title', 'Mon Profil') @section('page-subtitle', 'Gérez vos informations personnelles') @php // Calculate profile completion $fields = ['name', 'email', 'bio', 'profile_photo']; if ($user->isStudent()) { $profileFields = ['matricule', 'faculty_id', 'department_id', 'level']; } elseif ($user->isTeacher()) { $profileFields = ['phone', 'office', 'specialties']; } else { $profileFields = ['employee_id']; } $total = count($fields) + count($profileFields); $filled = collect($fields)->filter(fn($f) => !empty($user->$f))->count() + collect($profileFields)->filter(fn($f) => !empty($profile->$f ?? null))->count(); $completion = $total > 0 ? round(($filled / $total) * 100) : 0; $completionColor = $completion >= 80 ? '#22c55e' : ($completion >= 50 ? '#f59e0b' : '#ef4444'); $completionLabel = $completion >= 80 ? 'Excellent !' : ($completion >= 50 ? 'Bien avancé' : 'À compléter'); @endphp @section('content')
{{-- Flash Messages --}} @if(session('success'))
{{ session('success') }}
@endif @if($errors->any())
@endif
{{-- ========== LEFT COLUMN : Profile Card ========== --}}
{{-- Profile Card --}}
{{-- Cover --}}
{{-- Avatar upload --}}
@csrf @method('PUT')
@if($user->isStudent()) Étudiant @elseif($user->isTeacher()) Enseignant @else Admin @endif

{{ $user->name }}

{{ $user->email }}

@if($user->bio)

{{ $user->bio }}

@else

Aucune biographie renseignée

@endif {{-- Quick info chips --}}
@if($user->isStudent() && $profile->faculty) {{ $profile->faculty->name }} @endif @if($user->isStudent() && $profile->level) {{ $profile->level }} @endif @if($user->isTeacher() && $profile->office) {{ $profile->office }} @endif @if($user->isTeacher() && $profile->phone) {{ $profile->phone }} @endif
{{-- Profile Completion Card --}}

Complétion du profil

{{ $completion }}%
{{-- Circular progress --}}
{{ $completionLabel }}
@foreach([ ['label' => 'Nom', 'done' => !empty($user->name)], ['label' => 'Email', 'done' => !empty($user->email)], ['label' => 'Photo', 'done' => !empty($user->profile_photo)], ['label' => 'Biographie', 'done' => !empty($user->bio)], ] as $item)
@if($item['done']) @else @endif {{ $item['label'] }}
@endforeach
@if($completion < 100)

Complétez votre profil pour améliorer votre visibilité

@endif
{{-- Stats card --}}

Activité

{{ $user->enrollments()->count() }} Cours inscrits
{{ $user->total_points ?? 0 }} Points XP
{{-- ========== RIGHT COLUMN : Forms ========== --}}
{{-- Tab navigation --}}
{{-- GENERAL TAB --}}

Informations personnelles

@csrf @method('PUT') {{-- Photo upload section --}}
@if($user->profile_photo) {{ $user->name }} @else
{{ strtoupper(substr($user->name, 0, 1)) }}
@endif

Photo de profil

JPG, PNG ou GIF — max 2 Mo

@error('name')

{{ $message }}

@enderror
@error('email')

{{ $message }}

@enderror

{{ strlen($user->bio ?? '') }}/1000

{{-- ACADEMIC TAB --}}

@if($user->isStudent()) @else @endif @if($user->isStudent()) Informations académiques @elseif($user->isTeacher()) Informations professionnelles @else Informations administratives @endif

@csrf @method('PUT') @if($user->isStudent())
@foreach(['L1' => 'Licence 1', 'L2' => 'Licence 2', 'L3' => 'Licence 3', 'M1' => 'Master 1', 'M2' => 'Master 2', 'D' => 'Doctorat'] as $val => $label) @endforeach
@elseif($user->isTeacher())
@php $specialties = old('specialties', $profile->specialties ?? []); if(is_string($specialties)) $specialties = json_decode($specialties, true) ?? []; @endphp
@foreach(['Mathématiques', 'Physique', 'Chimie', 'Informatique', 'Biologie', 'Économie', 'Droit', 'Lettres', 'Histoire', 'Géographie', 'Médecine', 'Ingénierie'] as $spec) @endforeach
@else
@endif
{{-- SECURITY TAB --}}

Sécurité du compte

@csrf @method('PUT')

Pour modifier votre mot de passe, entrez votre mot de passe actuel pour confirmer votre identité.

@error('current_password')

{{ $message }}

@enderror
@error('password')

{{ $message }}

@enderror

Min. 8 caractères — laisser vide pour ne pas changer

{{-- 2FA toggle --}}

Authentification à deux facteurs

Couche de sécurité supplémentaire

{{-- end right col --}}
{{-- end grid --}}
@push('scripts') @endpush @endsection