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

{% block title %}Suplování{% endblock %}

{% block body %}

    <h2>Seznam všech suplování</h2>

    <hr>

    <div class="shadow" style="width: max-content;">
        <table id="table" data-toggle="table" data-height="500"
               class="table table-bordered table-borderless">
            <thead class="thead-light">
            <tr>
                <th> ID </th>
                <th> Datum </th>
                <th> Čas </th>
                <th> Předmět </th>
                <th> Supl. Učitel </th>
                <th> Chyb. Učitel </th>
                <th> Upravit </th>
                <th> Smazat </th>
            </tr>
            </thead>

            <tbody>


            {% for s in vysledek %}


                    <tr style="transform: rotate(0);">

                            <td scope="colgroup" style="background-color: #808080; color: #f2f2f2">
                                    {{ s[0].id }}
                            </td>


                        <td style="background-color: #bfbfbf">
                                {{ s[0].absence.datum|date('d-m-Y') }}
                        </td>

                        <td>
                            {{ s[0].absence.doba }}
                        </td>

                        <td>
                            {{ s[0].absence.predmet }}
                        </td>

                        <td>
                            {{ s[0].ucitel }}
                        </td>

                        <td>
                            {{ s[0].absence.ucitele }}
                        </td>

                        <td>
                            <a href="{{ path('absence.createUc', {date: s[0].absence.datum|date('d-m-Y'), doba: s[0].absence.doba.id, predmet: s[0].absence.predmet.id, ucitel: s[0].absence.ucitele.id }) }}"
                               class="btn btn-outline-info btn-group">
                                Upravit
                            </a>
                        </td>

                        <td>
                            <a href="{{ path('absence.delete', {suplovani: s[0].id }) }}"
                               class="btn btn-outline-danger btn-group">
                                Smazat
                            </a>
                        </td>

                    </tr>

            {% endfor %}

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

    <hr>

    <div class="text-left">
        {{ form_start(form) }}

        <div class="input-group mb-3">
            <div class="input-group-prepend">
                <span class="input-group-text">Od: </span>
            </div>
            {{ form_widget(form.dateZ) }}
        </div>
        <div class="input-group mb-3">
            <div class="input-group-prepend">
                <span class="input-group-text">Do: </span>
            </div>
            {{ form_widget(form.dateK) }}
        </div>

        {{ form_widget(form.save) }}

        {{ form_end(form) }}
    </div>

{% endblock %}

