{% load static %}

{% include "_head.html"  %}

<body class="app">
  <header class="app-header fixed-top">	   	            
    <div class="app-header-inner">  
        <div class="container-fluid py-2">
            <div class="app-header-content"> 
                <div class="row justify-content-between align-items-center">
                
                    <div class="col-auto">
                        <a id="sidepanel-toggler" class="sidepanel-toggler d-inline-block d-xl-none" href="#">
                            <svg xmlns="http://www.w3.org/2000/svg" width="30" height="30" viewBox="0 0 30 30" role="img"><title>Menu</title><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg>
                        </a>
                    </div><!--//col-->

                    <div class="app-utilities col-auto">
                        {% block menuapp %}

                        <div class="app-utility-item app-user-dropdown dropdown">
                        </div>

                        {% endblock menuapp %}

                        <div class="app-utility-item app-user-dropdown dropdown">
                            {% if user.is_authenticated %}
                            <a class="dropdown-toggle" id="user-dropdown-toggle" data-bs-toggle="dropdown" href="#" role="button" aria-expanded="false"><img src=" {{user.foto.url }}"></a>
                            {% else %}
                            <a class="dropdown-toggle" id="user-dropdown-toggle" data-bs-toggle="dropdown" href="#" role="button" aria-expanded="false">Sin usuario</a>
                            {% endif %}
                            <ul class="dropdown-menu" aria-labelledby="user-dropdown-toggle">
                                {% if user.is_authenticated %}
                                <li>
                                    <a class="dropdown-item">{{ user.nombre }}</a>
                                </li>
                                <li><a class="dropdown-item">                        
                                    <form method="post" action="{% url 'logout' %}" >
                                        {% csrf_token %}
                                        <button
                                        style="background: none!important;
                                                    border: none;
                                                    padding: 0!important;
                                                    /*optional*/
                                                    font-family: arial, sans-serif;
                                                    /*input has OS specific font-family*/
                                                    /*color: #069;
                                                    text-decoration: underline;*/
                                                    cursor: pointer;"   
                                            
                                        type="submit">Salir</button>
                                    </form></a>
                                </li>
                                {% else %}
                                <li><a class="dropdown-item" href="{% url 'login' %}">Entrar</a></li>
                                {% endif %} 
                            </ul>
                        </div><!--//app-user-dropdown--> 
                    </div><!--//app-utilities-->

                </div><!--//row-->
            </div><!--//app-header-content-->
        </div><!--//container-fluid-->
    </div><!--//app-header-inner-->

    <div id="app-sidepanel" class="app-sidepanel"> 
        <div id="sidepanel-drop" class="sidepanel-drop"></div>
        <div class="sidepanel-inner d-flex flex-column">
            <a href="#" id="sidepanel-close" class="sidepanel-close d-xl-none">&times;</a>

            {% include "_branding.html"  %}
            
            <nav id="app-nav-main" class="app-nav app-nav-main flex-grow-1">
                <ul class="app-menu list-unstyled accordion" id="menu-accordion">
                    <li class="nav-item">
                        <!--//Bootstrap Icons: https://icons.getbootstrap.com/ -->
                        <a class="nav-link active" href="{% url 'principal' %}">
                            <span class="nav-icon">
                            <svg width="1em" height="1em" viewBox="0 0 16 16" class="bi bi-house-door" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
      <path fill-rule="evenodd" d="M7.646 1.146a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1 .146.354v7a.5.5 0 0 1-.5.5H9.5a.5.5 0 0 1-.5-.5v-4H7v4a.5.5 0 0 1-.5.5H2a.5.5 0 0 1-.5-.5v-7a.5.5 0 0 1 .146-.354l6-6zM2.5 7.707V14H6v-4a.5.5 0 0 1 .5-.5h3a.5.5 0 0 1 .5.5v4h3.5V7.707L8 2.207l-5.5 5.5z"/>
      <path fill-rule="evenodd" d="M13 2.5V6l-2-2V2.5a.5.5 0 0 1 .5-.5h1a.5.5 0 0 1 .5.5z"/>
    </svg>
                             </span>
                             <span class="nav-link-text">Principal</span>
                        </a><!--//nav-link-->
                    </li><!--//nav-item-->

                    {% if user.is_authenticated %}

                    <li class="nav-item">
                        <!--//Bootstrap Icons: https://icons.getbootstrap.com/ -->
                        <a class="nav-link" href="{% url 'gestion:principal' %}">
                            <span class="nav-icon">
                            <!--//Bootstrap Icons: https://icons.getbootstrap.com/ -->
                            <svg width="1em" height="1em" viewBox="0 0 16 16" class="bi bi-files" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
  <path fill-rule="evenodd" d="M4 2h7a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2zm0 1a1 1 0 0 0-1 1v10a1 1 0 0 0 1 1h7a1 1 0 0 0 1-1V4a1 1 0 0 0-1-1H4z"/>
  <path d="M6 0h7a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2v-1a1 1 0 0 0 1-1V2a1 1 0 0 0-1-1H6a1 1 0 0 0-1 1H4a2 2 0 0 1 2-2z"/>
</svg>
                             </span>
                             <span class="nav-link-text">Riesgos</span>
                        </a><!--//nav-link-->
                    </li><!--//nav-item-->
                    {% endif %}
                </ul><!--//app-menu-->
            </nav><!--//app-nav-->           
        </div><!--//sidepanel-inner-->
    </div><!--//app-sidepanel-->

</header><!--//app-header-->

    <div class="app-wrapper">
	    
	    <div class="app-content pt-3 p-md-3 p-lg-4">
			{% block content %}{% endblock %}
	    </div><!--//app-content-->

      {% include "_footer.html"  %}

    </div><!--//app-wrapper-->    					

     <!-- Javascript -->          
    <script src="{% static 'plugins/popper.min.js' %}"></script>
    <script src="{%  static 'plugins/bootstrap/js/bootstrap.min.js' %}"></script>  

    <!-- Charts JS -->
    <script src="{%  static 'plugins/chart.js/chart.min.js' %}"></script> 
    <script src="{%  static 'js/index-charts.js' %}"></script> 

    <!-- La línea siguiente es para la demo de los charts en charts.html -->
    <script src="{%  static 'js/charts-demo.js' %}"></script> 

    
    <!-- Page Specific JS -->
    <script src="{%  static 'js/app.js' %}"></script> 
    </body>
</html> 

