{% extends 'base.html' %}
{% load i18n %}
{% block title %} {{ title }} | {% trans 'Learning management system' %}{% endblock title %}

{% load static %}


{% block content %}

{% if user.is_authenticated %}

<nav style="--bs-breadcrumb-divider: '>';" aria-label="breadcrumb">
    <ol class="breadcrumb">
      <li class="breadcrumb-item"><a href="/">{% trans 'Home' %}</a></li>
      <li class="breadcrumb-item active" aria-current="page">{{ user.get_full_name }}</li>
    </ol>
</nav>

{% include 'snippets/messages.html' %}

<div class="row">

    <div class="col-md-3 mx-auto">
        <div class="card  p-2">
            <div class="text-center">
                <img src="{{ user.picture.url }}" class="w-100">
                <ul class="px-2 list-unstyled">
                    <li>{{ user.get_full_name|title }}</li>
                    <li><strong>{% trans 'Last login:' %} </strong>{{ user.last_login|date }}</li>
                    <li><strong>{% trans 'Role:' %} </strong>
                        {{ user.get_user_role }}
                    </li>
                </ul>
            </div>
            <hr>
            <a class="mb-2" href="{% url 'edit_profile' %}"><i class="fas fa-user-edit unstyled"></i>
                <span class="mobile-hide">{% trans 'Edit Profile' %}</span></a>
            <a href="{% url 'change_password' %}"><i class="fas fa-lock unstyled"></i><span class="mobile-hide">
                {% trans 'Change password' %}</span></a>
        </div>
    </div>

    <div class="col-md-9 mx-auto">
        <div class="card">
            <div class="card-body">
                <!-- {% if user.is_student %}
                <p class="form-title"><i class="fas fa-book-open"></i>Enrolled Courses</p>
                <div class="dashboard-description">
                    {% if courses %}
                        <div class="flex">
                            {% for course in courses %}
                                <div class="flex"><a class="edit-btn" href="{{ course.get_absolute_url }}">{{ course }}</a></div>
                            {% endfor %}
                        </div>
                    {% else %}
                            <div class="text-danger"><i class="far fa-frown"></i>No courses!</div>
                    {% endif %}
                </div>
                {% endif %} -->
    
                {% if user.is_lecturer %}
                <p class="fw-bold"><i class="fas fa-book-open"></i>{% trans 'My Courses' %}</p>
                {% if courses %}
                <ul>
                    {% for course in courses %}
                    <li><a href="{{ course.get_absolute_url }}">{{ course }}</a></li>
                    {% endfor %}
                </ul>
                {% else %}
                <div class="text-danger">{% trans 'No courses assigned!' %}</div>
                {% endif %}
                <hr>
                {% endif %}
    
                <p class="fw-bold"><i class="fas fa-user"></i>{% trans 'Personal Info' %}</p>
                <div class="dashboard-description">
                    <p><strong>{% trans 'First Name:' %}</strong> {{ user.first_name|title }}</p>
                    <p><strong>{% trans 'Last Name:' %}</strong> {{ user.last_name|title }}</p>
                    <p><strong>{% trans 'ID No.:' %}</strong> {{ user.username }}</p>
                </div>
                {% if user.is_student %}
                <hr>
                <p class="fw-bold"><i class="fas fa-graduation-cap"></i>{% trans 'Applicant Info' %}</p>
                <div class="dashboard-description">
                    <p><strong>{% trans 'School:' %} </strong>{% trans 'Hawas Preparatory School' %}</p>
                    <p><strong>{% trans 'Level:' %} </strong>{{ level.level }}</p>
                </div>
                {% endif %}
    
                <hr>
                <p class="fw-bold"><i class="fas fa-phone-square-alt"></i>{% trans 'Contact Info' %}</p>
                <div class="dashboard-description">
                    <p><strong>{% trans 'Email:' %}</strong> {{ user.email }}</p>
                    <p><strong>{% trans 'Tel No.:' %}</strong> {{ user.phone }}</p>
                    <p><strong>{% trans 'Address/city:' %}</strong> {{ user.address }}</p>
                </div>
    
                <hr>
                <p class="fw-bold"><i class="fa fa-calendar-day"></i>{% trans 'Important Dates' %}</p>
                <div class="dashboard-description">
                    <p><strong>{% trans 'Last login:' %}</strong> {{ user.last_login }}</p>
                    {% if current_semester and current_session %}
                    <p><strong>{% trans 'Academic Year:' %}</strong> {{ current_semester }} {% trans 'Semester' %} {{ current_session }}</p>
                    {% endif %}
                    <p><strong>{% trans 'Registered Date:' %}</strong> {{ user.date_joined|date }}</p>
                </div>
            </div>
        </div>
    </div>

    <div class="col-md-3 mx-auto"></div>

</div>
{% endif %}

{% endblock content %}