<!-- Copyright (C) 2024 Nastro_ -->
<!-- This Source Code Form is subject to the terms of the Mozilla Public
   - License, v. 2.0. If a copy of the MPL was not distributed with this
   - file, You can obtain one at https://mozilla.org/MPL/2.0/. -->

{% extends "gestionale/base.html" %}
{% load static %}
{% block content %}
{% if user.is_authenticated %}
<div class="detail-content">
<table class="pure-table pure-table-horizontal width-100 margin-tb-2rem">
    <thead>
    <tr>
        <td>Id Corso</td>
        <td>Nome Corso</td>
        <td>Nome Corso esteso</td>
        <td>Anno Corso</td>
        <td>Numero Studenti</td>
        <td>Posizione Corso</td>
        <td>Status Corso</td>
    </tr>
    </thead>
    <tbody>
    <tr>
        <td>{{ course.id }}</td>
        <td>{{ course.course_name }}</td>
        <td>{{ course.course_name_extended }}</td>
        <td>{{ course.course_year }}</td>
        <td>{{ course.student_number }}</td>
        <td>{{ course.course_location }}</td>
        <td>{{ course.course_status }}</td>
    </tr>
    </tbody>
</table>
<table class="pure-table pure-table-horizontal width-100">
    <thead>
    <tr>
        <td>Id Studente</td>
        <td>Immagine Profilo</td>
        <td>Nome</td>
        <td>Cognome</td>
        <td>Data di Nascita</td>
        <td>Codice Fiscale</td>
        <td>Sesso</td>
        <td>Numero di Telefono</td>
        <td>Comune di Residenza</td>
        <td>Provincia di Residenza</td>
        <td>Data di Dimissioni</td>
        <td>Status Studente</td>
        <td>Azioni</td>
    </tr>
    </thead>
    <tbody>
    {% for student in students %}
    {% if student.resignation_date == None %}
    <tr>
        <td>{{ student.id }}</td>
        <td><img src="/media/{{ student.profile_image }}" alt="profile_image"></td>
        <td>{{ student.first_name }}</td>
        <td>{{ student.last_name }}</td>
        <td>{{ student.birth_date }}</td>
        <td>{{ student.codice_fiscale }}</td>
        <td>{{ student.gender }}</td>
        <td>{{ student.phone_number }}</td>
        <td>{{ student.municipality_residence }}</td>
        <td>{{ student.province_residence }}</td>
        <td>{{ student.resignation_date }}</td>
        <td>{{ student.student_status }}</td>
        <td>
            <a href="/details/student/{{ student.id }}" class="pure-button">
                <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-list"
                     viewBox="0 0 16 16">
                    <path fill-rule="evenodd"
                          d="M2.5 12a.5.5 0 0 1 .5-.5h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5m0-4a.5.5 0 0 1 .5-.5h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5m0-4a.5.5 0 0 1 .5-.5h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5"/>
                </svg>
            </a>

            <a href="/edit/student/{{ student.id }}" class="pure-button">
                <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor"
                     class="bi bi-pencil-square" viewBox="0 0 16 16">
                    <path d="M15.502 1.94a.5.5 0 0 1 0 .706L14.459 3.69l-2-2L13.502.646a.5.5 0 0 1 .707 0l1.293 1.293zm-1.75 2.456-2-2L4.939 9.21a.5.5 0 0 0-.121.196l-.805 2.414a.25.25 0 0 0 .316.316l2.414-.805a.5.5 0 0 0 .196-.12l6.813-6.814z"/>
                    <path fill-rule="evenodd"
                          d="M1 13.5A1.5 1.5 0 0 0 2.5 15h11a1.5 1.5 0 0 0 1.5-1.5v-6a.5.5 0 0 0-1 0v6a.5.5 0 0 1-.5.5h-11a.5.5 0 0 1-.5-.5v-11a.5.5 0 0 1 .5-.5H9a.5.5 0 0 0 0-1H2.5A1.5 1.5 0 0 0 1 2.5z"/>
                </svg>
            </a>
            <a href="/delete/student/{{ student.id }}" class="pure-button">
                <svg xmlns="http://www.w3.org/2000/svg" width="16"
                     height="16" fill="currentColor" class="bi bi-trash" viewBox="0 0 16 16">
                    <path
                            d="M5.5 5.5A.5.5 0 0 1 6 6v6a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5m2.5 0a.5.5 0 0 1 .5.5v6a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5m3 .5a.5.5 0 0 0-1 0v6a.5.5 0 0 0 1 0z"/>
                    <path
                            d="M14.5 3a1 1 0 0 1-1 1H13v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V4h-.5a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1H6a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1h3.5a1 1 0 0 1 1 1zM4.118 4 4 4.059V13a1 1 0 0 0 1 1h6a1 1 0 0 0 1-1V4.059L11.882 4zM2.5 3h11V2h-11z"/>
                </svg>
            </a>
        </td>
    </tr>
    {% endif %}
    {% endfor %}
    </tbody>
</table>
</div>
{% endif %}
{% endblock %}