{% load blurp_tags %}
<div id="nav">
    {% if request.user.is_authenticated %} 
	<div class="col-sm-16">
		<div class="box box-full account-panel panel panel-default">
			<div class="panel-heading" id="toplinks">
				<span class="logged-in">
					<h4 class="panel-title user fullname">
						{{ request.user.get_full_name }}
					</h4>
				</span>
			</div>
			<div class="panel-body">
				<ul>
				    <li><a href="{{ idp_url }}/accounts/">Mon compte</a></li>
				    <li><a href="{{ wcs_url }}/myspace/">Mes démarches en cours</a></li>
                    <li><a href="{{ wcs_url }}">Démarches en ligne</a></li>
				    <li><a href="{% url 'auth_logout' %}">Déconnexion</a></li>
				</ul>
			</div>
		</div>
	</div>
    {% endif %}
    {% if request.user.is_anonymous %}
    <div class="col-sm-16">
		<div class="box box-full account-panel panel panel-default">
			<div class="panel-heading" id="toplinks">
				<span class="logged-in">
					<h4 class="panel-title user fullname">
						Compte citoyen
					</h4>
				</span>
			</div>
			<div class="panel-body">
				<ul>
				    <li><a href="{{ idp_url }}/login">Connexion</a></li>
				    <li><a href="{{ idp_url }}/accounts/register/">Créer un compte</a></li>
				    <li><a href="{{ wcs_url }}">Démarches en ligne</a></li>
                    <li><a href="{{ portal_url }}/aide">Aide</a></li>
				</ul>
			</div>
		</div>
	</div>
    {% endif %}

	<div class="col-sm-16">
		<div class="box box-full nav-panel panel panel-default">
			<div class="panel-heading">
				<h4 class="panel-title">
					Démarches et services publics
				</h4>
			</div>
			<div class="panel-body">
				<ul>
                {% blurp "services" %}
                    {% for item in menu %}
                        {% if item.title == "Espace famille" and user.is_authenticated %}
                            <li><a href="{{ item.link }}">{{ item.title }}t</a></li>
                            {% elif item.title == "Espace médiathèque" and user.is_authenticated %}
                            <li><a href="{{ item.link }}">{{ item.title }}</a></li>
                            {% elif item.title == "Espace conservatoire" and user.is_authenticated %}
                            <li><a href="{{ conservatoire_url }}Default.aspx">{{ item.title }}</a></li>
                            {% else %}
                            <li><a href="{{ item.link }}">{{ item.title }}</a></li>
                         {% endif %}
                         {% if item.sub_items %}
                             <ul>
                             {% for subitem in item.sub_items %}
                                <li><a href="{{ subitem.link }}">{{ subitem.title }}</a></li>
                             {% endfor %}
                             </ul>
                         {% endif %}
                     {% endfor %}
                 {% endblurp %}
				</ul>
			</div>
		</div>
	</div>
	<div id="access" class="col-sm-5 col-md-16">
<div class="access panel-group" id="access-menu">
    <div class="box box-full access--directs panel panel-default">
        <div class="panel-heading">
            <h4 class="panel-title"><a data-toggle="collapse" data-parent="#access-menu" href="#access-toggle">Accès directs<i class="fa fa-caret-square-o-down"></i></a></h4>
        </div>
        <div id="access-toggle" class="panel-collapse collapse in">
            <div class="panel-body">
                <ul>
                {% blurp "acces-directs" %}
                    {% for item in menu %}
                     <li><a href="{{ item.link }}">{{ item.title }}</a></li>
                     {% if item.sub_items %}
                         <ul>
                         {% for subitem in item.sub_items %}
                            <li><a href="{{ subitem.link }}">{{ subitem.title }}</a></li>
                         {% endfor %} 
                         </ul>
                     {% endif %}
                     {% endfor %}
                 {% endblurp %}
                </ul>
            </div>
        </div>
    </div>
    <div class="box box-full access--kiosque panel panel-default">
        <div class="panel-heading">
            <h4 class="panel-title"><a data-toggle="collapse" data-parent="#access-menu" href="#kiosque-toggle">Kiosque<i class="fa fa-caret-square-o-down"></i></a></h4>
        </div>
        <div id="kiosque-toggle" class="panel-collapse collapse">
            <div class="panel-body">
                <ul>
               {% blurp "kiosque" %}
                    {% for item in menu %}
                     <li><a href="{{ item.link }}">{{ item.title }}</a></li>
                     {% if item.sub_items %}
                         <ul>
                         {% for subitem in item.sub_items %}
                            <li><a href="{{ subitem.link }}">{{ subitem.title }}</a></li>
                         {% endfor %}
                         </ul>
                     {% endif %}
                     {% endfor %}
                 {% endblurp %}
                </ul>
            </div>
        </div>
    </div>
    <div class="box box-full access--projects panel panel-default">
        <div class="panel-heading" id="projets">
            <h4 class="panel-title"><a data-toggle="collapse" data-parent="#access-menu" href="#projects-toggle">Grand projets<i class="fa fa-caret-square-o-down"></i></a></h4>
        </div>
        <div id="projects-toggle" class="panel-collapse collapse">
            <div class="panel-body">
                <ul>
               {% blurp "grand-projets" %}
                    {% for item in menu %}
                     <li><a href="{{ item.link }}">{{ item.title }}</a></li>
                     {% if item.sub_items %}
                         <ul>
                         {% for subitem in item.sub_items %}
                            <li><a href="{{ subitem.link }}">{{ subitem.title }}</a></li>
                         {% endfor %}
                         </ul>
                     {% endif %}
                     {% endfor %}
                 {% endblurp %}
                </ul>
            </div>
        </div>
    </div>
</div>
	</div>
</div>

