{% extends "base.html" %}

{% block title %}Mon profil — GMAO{% endblock %}

{% block content %}
<div class="container-fluid">
    <div class="row mb-4">
        <div class="col">
            <h1 class="h3">
                <i class="fas fa-user me-2"></i>Mon profil
            </h1>
        </div>
    </div>

    <div class="row">
        <div class="col-lg-6">
            <div class="card">
                <div class="card-header">
                    <h5 class="mb-0">Informations</h5>
                </div>
                <div class="card-body">
                    <dl class="row">
                        <dt class="col-sm-4">Nom d'utilisateur</dt>
                        <dd class="col-sm-8">{{ user.username }}</dd>
                        
                        <dt class="col-sm-4">Nom complet</dt>
                        <dd class="col-sm-8">{{ user.full_name or '—' }}</dd>
                        
                        <dt class="col-sm-4">Email</dt>
                        <dd class="col-sm-8">{{ user.email or '—' }}</dd>
                        
                        <dt class="col-sm-4">Rôle</dt>
                        <dd class="col-sm-8">
                            {% if user.is_admin() %}
                            <span class="badge bg-danger">Administrateur</span>
                            {% elif user.has_permission('patrimoine.manage') %}
                            <span class="badge bg-primary">Technicien</span>
                            {% else %}
                            <span class="badge bg-secondary">Utilisateur</span>
                            {% endif %}
                        </dd>
                        
                        <dt class="col-sm-4">Statut</dt>
                        <dd class="col-sm-8">
                            {% if user.is_active %}
                            <span class="badge bg-success">Actif</span>
                            {% else %}
                            <span class="badge bg-secondary">Inactif</span>
                            {% endif %}
                        </dd>
                    </dl>
                </div>
            </div>
            
            <div class="card mt-3">
                <div class="card-body">
                    <a href="{{ url_for('auth.change_own_password') }}" class="btn btn-outline-primary">
                        <i class="fas fa-key me-1"></i>Changer le mot de passe
                    </a>
                </div>
            </div>
        </div>
    </div>
</div>
{% endblock %}
