navbar.html.twig 5.92 KB
Newer Older
1

2
<nav class="navbar navbar-expand-md navbar-dark bg-dark">
3

Mat's avatar
Mat committed
4 5 6 7 8
    <a href="{{ path('potage_homepage') }}">
        <span class="navbar-brand mb-0 h1">
            <img src="{{ asset('css/img/radis.1inv.png') }}" class="d-inline-block align-top" alt="logo">
            Potage
        </span>
9
    </a>
10

11 12
    <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent"
            aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
13 14 15 16 17 18
        <span class="navbar-toggler-icon"></span>
    </button>

    <div class="collapse navbar-collapse" id="navbarSupportedContent">

        <ul class="navbar-nav mr-auto">
Mat's avatar
Mat committed
19 20


21
        </ul>
22 23 24 25 26
        <div id="login">
            <ul class="navbar-nav mr-auto">

                {% if is_granted("IS_AUTHENTICATED_REMEMBERED") %}

27 28 29 30 31 32
                    <li class="nav-item">
                        <a class="nav-link {{ app.request.get('_route') == 'potage_today' ? '' }}"
                           href="{{ path('potage_today') }}">En ce moment
                            <span class="sr-only">(current)</span></a>
                    </li>

33 34 35 36
                    {% if is_granted('ROLE_ADMIN') %}
                        <li class="nav-item dropdown">
                            <a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button"
                               data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Mat's avatar
Mat committed
37
                                Magasin
38
                            </a>
39 40
                            <div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbarDropdown">

Mat's avatar
Mat committed
41
                                <a class="dropdown-item" href="{{ path('potage_legume_ajax_display') }}">Les légumes</a>
42
                                <a class="dropdown-item" href="{{ path('potage_offre_ajax_display') }}">Les offres</a>
43 44

                                <div class="dropdown-divider"></div>
45
                                <a class="dropdown-item" href="{{ path('potage_info_ajax_display') }}">Les actualités</a>
46
                                <a class="dropdown-item" href="{{ path('potage_lettre_ajax_display') }}">Les infoslettres</a>
47 48

                                <div class="dropdown-divider"></div>
49 50
                                <a class="dropdown-item" href="{{ path('potage_groupe_ajax_display') }}">Les groupes et les dépôts</a>
                                <a class="dropdown-item" href="{{ path('potage_utilisateur_ajax_display') }}">Les utilisateurs</a>
51 52

                                <div class="dropdown-divider"></div>
53
                                <a class="dropdown-item disabled" href="#">Les commandes</a>
54

55 56 57 58 59

                            </div>
                        </li>
                    {% endif %}

Mat's avatar
Mat committed
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
                    {% if is_granted('ROLE_SUPER_ADMIN') %}
                        <li class="nav-item dropdown">
                            <a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button"
                               data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                                Préférences
                            </a>
                            <div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbarDropdown">

                                <a class="dropdown-item" href="{{ path('potage_test') }}">Page de test</a>

                                <div class="dropdown-divider"></div>

                            </div>
                        </li>
                    {% endif %}

76 77 78
                    <li class="nav-item dropdown">
                        <a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button"
                           data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Mat's avatar
Mat committed
79 80 81 82 83 84 85 86 87 88 89
                            {% if app.user.utilisateur %}
                                {{ app.user.utilisateur.prenom }} {{ app.user.utilisateur.nom }}
                            {% else %}
                                {{ app.user.username }}
                            {% endif %}
                            <span class="userrole">
                                {% if is_granted('ROLE_SUPER_ADMIN') %}
                                    Administrateur
                                {% elseif is_granted('ROLE_ADMIN') %}
                                    Maraîcher
                                {% else %}
Mat's avatar
Mat committed
90
                                    Abonné
Mat's avatar
Mat committed
91 92
                                {% endif %}
                            </span>
93 94 95 96 97 98
                        </a>
                        <div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbarDropdown">

                            <a href="{{ path('fos_user_profile_show') }}" class="dropdown-item">
                                Mon profil
                            </a>
99 100 101 102
                            <a href="{{ path('potage_resume') }}" class="dropdown-item">
                                Mes commandes
                            </a>

103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122
                            <div class="dropdown-divider"></div>
                            <a href="{{ path('fos_user_security_logout') }}" class="dropdown-item">
                                {{ 'layout.logout'|trans({}, 'FOSUserBundle') }}
                            </a>

                        </div>
                    </li>

                {% else %}
                    <li class="nav-item">
                        <a href="{{ path('fos_user_security_login') }}" class="nav-link">
                            {{ 'layout.login'|trans({}, 'FOSUserBundle') }}
                        </a>
                    </li>
                    <li class="nav-item">
                        <a href="{{ path('fos_user_registration_register') }}" class="nav-link">
                            {{ 'layout.register'|trans({}, 'FOSUserBundle') }}
                        </a>
                    </li>
                {% endif %}
123

124 125
            </ul>
        </div>
126 127 128

    </div>
</nav>