{% extends 'base.html.twig' %}

{% block title %}Žáci{% endblock %}

{% block body %}

    <h2>Seznamy žáků a tříd</h2>

    <hr>
    {% if is_granted('ROLE_ADMIN') %}
        <div class="btn-group">
            <a href="{{path('zak.create')}}" class="btn btn-outline-primary float-left">Vytvořit nového žáka</a>
            <a href="{{path('xml.generate', {rozdat: '1.9.2020'|date('d-n-Y')})}}" class="btn btn-outline-primary float-left">Generovat XML soubor</a>
            <a href="{{path('xml.generateA', {rozdat: '1.9.2020'|date('d-n-Y')})}}" class="btn btn-outline-primary float-left">A</a>
            <a href="{{path('xml.generateB', {rozdat: '1.9.2020'|date('d-n-Y')})}}" class="btn btn-outline-primary float-left">B</a>
        </div>
            <br><br>
    {% endif %}

    <div class="shadow-lg">
        <div class="card">
            <div class="card-header">
                <ul class="nav nav-tabs card-header-tabs">
                    <li class="nav-item">
                        <a class="nav-link active" href="#">Seznam všech žáků</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="{{ path('zak.tridy') }}">Filtrování podle tříd</a>
                    </li>
                </ul>
            </div>

            <div class="tab-content">
                <div id="tridy" class="card-body tab-pane active">
                    <div class="shadow" style="width: max-content;">
                        <table id="table" data-toggle="table" data-height="500"
                               class="table table-bordered table-borderless table-hover">
                            <thead class="thead-light">
                            <tr>
                                <th data-field="ID">ID</th>
                                <th data-field="Jmeno">Jméno</th>
                                <th data-field="Prijmeni">Příjmení</th>
                                <th data-field="Ucebna">Učebna</th>
                                <th data-field="Trida">Třída</th>
                                <th data-field="DatNar" style="width:150px">Datum Narození</th>
                                <th data-field="Stat">Stát</th>
                                <th data-field="Okres">Okres</th>
                                <th data-field="Ulice">Ulice</th>
                                <th data-field="CisPop" style="width: 125px">Číslo popisné</th>
                                <th data-field="PSC">PSČ</th>
                            </tr>
                            </thead>
                            <tbody>

                            {% for z in zak %}

                                <tr style="transform: rotate(0);">
                                    <td scope="colgroup"><a href="{{ path('zak.show', {id: z.id}) }}"
                                                            class="stretched-link">{{ z.id }}</a></td>
                                    <td>
                                        {{ z.jmeno }}
                                    </td>
                                    <td>
                                        {{ z.prijmeni }}
                                    </td>
                                    <td>
                                        {{ z.trida.ucebna }}
                                    </td>
                                    <td>
                                        {{ z.trida }}
                                    </td>
                                    <td>
                                        {{ z.datNar|date('Y-m-d') }}
                                    </td>
                                    <td>
                                        {{ z.stat }}
                                    </td>
                                    <td>
                                        {{ z.okres }}
                                    </td>
                                    <td>
                                        {{ z.ulice }}
                                    </td>
                                    <td>
                                        {{ z.cisPop }}
                                    </td>
                                    <td>
                                        {{ z.psc }}
                                    </td>
                                </tr>

                            {% endfor %}

                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>




{% endblock %}
