{% extends "stampo.htm" %}
{% block title %}Amministrazione{% endblock %}
{% block content %}
<ul class="nav nav-tabs" id="myTab" role="tablist">
    <li class="nav-item">
        <a class="nav-link active" id="home-tab" data-toggle="tab" href="#home" role="tab" aria-controls="home"
           aria-selected="true">Home</a>
    </li>
    <li class="nav-item">
        <a class="nav-link" id="profile-tab" data-toggle="tab" href="#profile" role="tab" aria-controls="profile"
           aria-selected="false">Profile</a>
    </li>
</ul>
<div class="tab-content" id="myTabContent">
    <div class="tab-pane fade show active" id="home" role="tabpanel" aria-labelledby="home-tab">
        <div class="row">
            <div class="col-md-6">
                <br>
                <h3>Riassunti</h3>
                <br>
                <a href="{{ url_for("page_add_riassunto") }}" type="button" class="btn btn-success btn-lg btn-block">Aggiungi un
                    riassunto</a>
                <table class="table table-hover">
                    <thead>
                    <tr>
                        <th scope="col">Nome</th>
                        <th scope="col">Autore</th>
                        <th scope="col">Azioni</th>
                    </tr>
                    </thead>
                    <tbody>
                    {% for riassunto in riassunti %}
                    <tr>
                        <th> {{riassunto.nome}}</th>
                        <th> {{riassunto.autore.nome}} {{riassunto.autore.cognome}}</th>
                        <th><a href="{{ url_for("page_update_riassunto", sid=riassunto.sid) }}"><i class="fas fa-file-upload"></i></a> <a
                                href="{{ url_for("func_delete_riassunto", sid=riassunto.sid) }}"><i class="fas fa-times"></i></a></th>
                    </tr>
                    {% endfor %}
                    </tbody>
                </table>
            </div>
            <div class="col-md-6">
                <br>
                <h3>Materie</h3>
                <br>
                <a href="{{ url_for("page_add_materia") }}" type="button" class="btn btn-success btn-lg btn-block">Aggiungi una materia</a>
                <table class="table table-hover">
                    <thead>
                    <tr>
                        <th scope="col">Corso/Anno/Semestre</th>
                        <th scope="col">Nome</th>
                        <th scope="col">Docente</th>
                        <th>Azioni</th>
                    </tr>
                    </thead>
                    <tbody>
                    {% for corso in materie %}
                    <tr>
                        <th> {{corso.ramo}}/{{corso.anno}}/{{corso.semestre}}</th>
                        <th> {{corso.nome}}</th>
                        <th> {{corso.docente}}</th>
                        <th><a href="{{ url_for("page_edit_materia", cid=corso.cid) }}"><i class="fas fa-edit"></i></a> <a
                                href="{{ url_for("func_delete_materia", cid=corso.cid) }}"><i class="fas fa-times"></i></a></th>
                    </tr>
                    {% endfor %}
                    </tbody>
                </table>
            </div>
        </div>
    </div>
    <div class="tab-pane fade" id="profile" role="tabpanel" aria-labelledby="profile-tab">
        <br>
        <h3> Modifica dell'account </h3>
        <form action="{{ url_for("func_edit_account") }}" method="POST" enctype=multipart/form-data>
            <div class="form-row">
                <div class="form-group col-md-6">
                    <label for="nome" class="col-form-label">Nome</label>
                    <input type="text" class="form-control" id="nome" value="{{utente.nome}}" name="nome">
                </div>
                <div class="form-group col-md-6">
                    <label for="cognome" class="col-form-label">Cognome</label>
                    <input type="text" class="form-control" id="cognome" value="{{utente.cognome}}" name="cognome">
                </div>
            </div>
            <div class="form-row">
                <div class="form-group col-md-6">
                    <label for="email" class="col-form-label">email</label>
                    <input type="email" class="form-control" id="email" value="{{utente.email}}" name="email">
                </div>
                <div class="form-group col-md-6">
                    <label for="password" class="col-form-label">Password</label>
                    <input type="password" class="form-control" id="password" value="" name="password">
                </div>
            </div>
            <div class="form-group row">
                <button type="submit" class="btn btn-primary btn-block">Salva</button>
            </div>
        </form>
    </div>
</div>
{% endblock %}