<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>{% block title %}Školní Systém{% endblock %}</title>

    {% block stylesheets %}

        <link rel="stylesheet" href="{{ asset('css/bootstrap.min.css') }}" type="text/css"/>
        <link rel="stylesheet" href="{{ asset('css/style.css') }}" type="text/css"/>

    {% endblock %}

</head>


<body class="text-center">

<div class="shadow-sm">
    <nav class="navbar navbar-expand-lg navbar-light bg-light fixed-top" style="opacity: 0.8">

        <a class="navbar-brand" href="{{ path('home') }}">Školní Systém</a>
        <button class="navbar-toggler" type="button" data-toggle="collapse"
                data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent"
                aria-expanded="false" aria-label="Toggle navigation">
            <span class="navbar-toggler-icon"></span>
        </button>

        <div class="collapse navbar-collapse" id="navbarSupportedContent">
            <ul class="navbar-nav mr-auto">

                {% if is_granted('ROLE_TEACHER') %}

                    <li class="nav-item">
                        <a class="nav-link" href="{{ path('absence.showUc', {dateK:  "now"|date("d-m-Y"), dateZ: "now"|date("d-m-Y"), ucitel: app.user.ucitel.id}) }}">Suplování</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="{{ path('absence.index', {date:  "now"|date("d-m-Y") ,id: 1, doba: 1, redirect: 0}) }}">Absence</a>
                    </li>

                    <li class="nav-item">
                        <a class="nav-link" href="{{ path('grades.index', {pid: 1, tid: 1}) }}">Známky</a>
                    </li>
                    <li class="nav-item">

                        {% if app.user.ucitel.trida.id == null %}

                            <a class="nav-link" href="{{ path('time_table.index', {id: 1}) }}">Rozvrhy</a>

                        {% else %}

                            <a class="nav-link" href="{{ path('time_table.index', {id: app.user.ucitel.trida.id}) }}">Rozvrhy</a>

                        {% endif %}

                    </li>

                    <li class="nav-item">
                        <a class="nav-link" href="{{ path('rodic.index') }}">Rodiče</a>
                    </li>

                    <li class="nav-item">
                        <a class="nav-link" href="{{ path('zak.index') }}">Žáci</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="{{ path('ucitele.index') }}">Učitelé</a>
                    </li>

                    <li class="nav-item">
                        <a class="nav-link" href="{{ path('zprava.index') }}">Zprávy</a>
                    </li>

                    <li class="nav-item">
                        <a class="nav-link" href="{{ path('ucitele.show', {id: app.user.ucitel.id}) }}">Profil</a>
                    </li>

                {% endif %}

                {% if is_granted('ROLE_STUDENT') %}

                    <li class="nav-item">
                        <a class="nav-link" href="{{ path('absence.show', {zak: app.user.zak.id}) }}">Absence</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="{{ path('grades.studentShow', {id: app.user.zak.trida.id}) }}">Známky</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="{{ path('time_table.index', {id: app.user.zak.trida.id}) }}">Rozvrhy</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="{{ path('ucitele.index') }}">Učitelé</a>
                    </li>

                    <li class="nav-item">
                        <a class="nav-link" href="{{ path('zprava.index') }}">Zprávy</a>
                    </li>

                    <li class="nav-item">
                        <a class="nav-link" href="{{ path('zak.show', {id: app.user.zak.id}) }}">Profil</a>
                    </li>

                {% endif %}

                {% if is_granted('ROLE_PARENT') %}

                    {% for zak  in app.user.rodic.zak %}

                        <li class="nav-item">
                            <a class="nav-link" href="{{ path('absence.show', {zak: zak.id}) }}">Absence {{ zak.jmeno }} {{ zak.prijmeni }}</a>
                        </li>

                    {% endfor %}

                    {% for zak  in app.user.rodic.zak %}

                        <li class="nav-item">
                            <a class="nav-link" href="{{ path('grades.studentShow', {id: zak.id}) }}">Známky {{ zak.jmeno }} {{ zak.prijmeni }}</a>
                        </li>

                    {% endfor %}

                    {% for zak  in app.user.rodic.zak %}

                        <li class="nav-item">
                            <a class="nav-link" href="{{ path('time_table.index', {id: zak.id}) }}">Rozvrhy {{ zak.jmeno }} {{ zak.prijmeni }}</a>
                        </li>

                    {% endfor %}

                    {% for zak  in app.user.rodic.zak %}

                        <li class="nav-item">
                            <a class="nav-link" href="{{ path('zak.show', {id: zak.id}) }}">Profil {{ zak.jmeno }} {{ zak.prijmeni }}</a>
                        </li>

                    {% endfor %}

                    <li class="nav-item">
                        <a class="nav-link" href="{{ path('ucitele.index') }}">Učitelé</a>
                    </li>

                    <li class="nav-item">
                        <a class="nav-link" href="{{ path('zprava.index') }}">Zprávy</a>
                    </li>

                    <li class="nav-item">
                        <a class="nav-link" href="{{ path('rodic.show', {rodic: app.user.rodic.id}) }}">Profil </a>
                    </li>

                {% endif %}

                {% if is_granted('ROLE_ADMIN') %}

                    <li class="nav-item">
                        <a class="nav-link" href="{{ path('absence.absenceUc', {datum:  "now"|date("d-m-Y"), doba: 1}) }}">Suplování</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="{{ path('absence.index', {date:  "now"|date("d-m-Y") ,id: 1, doba: 1, redirect: 0}) }}">Absence</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="{{ path('grades.index', {pid: 1, tid: 1}) }}">Známky</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="{{ path('time_table.index', {id: 1}) }}">Rozvrhy</a>
                    </li>

                    <li class="nav-item">
                        <a class="nav-link" href="{{ path('rodic.index') }}">Rodiče</a>
                    </li>

                    <li class="nav-item">
                        <a class="nav-link" href="{{ path('zak.index') }}">Žáci</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="{{ path('ucitele.index') }}">Učitelé</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="{{ path('register') }}">Registrace</a>
                    </li>

                    <li class="nav-item">
                        <a class="nav-link" href="{{ path('zprava.index') }}">Zprávy</a>
                    </li>

                {% endif %}

                {% if is_granted('IS_AUTHENTICATED_FULLY') %}

                    <li class="nav-item float-right">
                        <a class="nav-link" href="{{ path('app_logout') }}">Odhlásit</a>
                    </li>

                {% endif %}

            </ul>
        </div>
    </nav>
</div>


<table id="tbl_wrap">
    <tbody>
    <tr>
        <td id="td_wrap">

            <div class="d-flex justify-content-center" style="padding-top: 0px">
                <div class="shadow-lg" style="border-radius: 4px;">
                    <div class="card" style="opacity:0.7; padding: 25px">
                        <div class="card-body text-dark">
                            <div class="container">

                                {% for message in app.flashes('success') %}

                                    <div class="alert alert-success">
                                        {{ message }}
                                    </div>

                                {% endfor %}

                                {% block body %}{% endblock %}

                            </div>
                            {% block javascripts %}

                                <script src="{{ asset('js/bootstrap.min.js') }}"></script>
                                <script src="{{ asset('js/JS.js') }}"></script>

                            {% endblock %}
                        </div>
                    </div>
                </div>
            </div>
        </td>
    </tr>
    </tbody>
</table>
</body>
</html>
