<!DOCTYPE html>
<html>

<head>
  {% load static %}
  <title>{% block title %} {% endblock %}</title>
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
  <!-- versione 5.3.x --> 
  <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
  <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous"></script>
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  {% block headersupplement %}
  {% endblock %}
</head>

<body style='padding-top:50px;padding-bottom:20px;'>
{% if Navbar %}
  <!-- https://getbootstrap.com/docs/5.0/components/navbar/ -->
  <nav class="navbar fixed-top navbar-expand-lg navbar-light bg-light">

    <div class="container-fluid">
    <a class="navbar-brand" href="#">Gestione Documenti</a>
    <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-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 me-auto mb-2 mb-lg-0">
        <li class="nav-item">
          <ul>
            <form name="scegliazienda" method=POST class='d-flex'>
            {% csrf_token %}
            <select class="form-select form-select-lg mb-1" aria-label=".form-select-lg" name="sceltaazienda" onchange="this.form.submit()">
	      <option value=-1>Scelta Azienda</option>
              {% for a in AziendaLista %}
	      <option value={{ a.azienda.id }} {% if a.azienda.id == azienda.id %}selected{% endif %}>{{ a.azienda.nome }}</button></option>
              {% endfor %}
              <option value=0>Nuova Azienda</option>
            </select>
            </form>
	  </ul>
	</li>
	<li class="nav-item">
	  <ul>
            <form name="sceglisede" method=POST class='d-flex'>
            {% csrf_token %}
            <select class="form-select form-select-lg mb-1" aria-label=".form-select-lg" name="sceltasede" onchange="this.form.submit()">
	      <option value=-1>Scelta Sede</option>
              {% for s in sedeLista %}
	      <option value={{ s.id }} {% if s.id == sede.id %}selected{% endif %}>{{ s.nome }}</button></option>
              {% endfor %}
              <option value=0>Nuova Sede</option>
            </select>
            </form>
          </ul>
        </li>
      </ul>

      <form class="d-flex" method='POST'>
        {% csrf_token %}
        <input class="form-control me-2" type="search" placeholder="Search" aria-label="Search">
        <button class="btn btn-outline-success" type="submit">Search</button>
        <button class="btn btn-outline-success" name='indietro' type="submit">Logout</button>
      </form>
    </div>
  </div>

  </nav>
{% endif %}
<div class="col-md-3 col-sm-3 col-xs-3">&nbsp;</div>

<!-- blocco info generali -->
<div class='container'>
    {% block top %}
    <div class='form-outline mb-5 text-center h2'>
           {{ HeaderTitle }}
    </div>
    <div class='form-outline mb-2 text-center h3'>
	    {% if admin %} {{ admin.nome }} {% endif %}
    </div>
    <div class='form-outline mb-5 text-center h3'>
            {% if azienda %} {{ azienda.nome }} {% endif %}
            {% if sede %} / {{ sede.nome }} {% endif %}
    </div>

    {% endblock %}
</div>

<!-- blocco centrale -->
<div class='container'>
      {% block body %}
        Place Holder
      {% endblock %}
</div>

<div class='container'>
      {% block bodybottom %}
      {% endblock %}
</div>

<div class='container'>
  {% block help %}
  {% endblock %}
</div>

<div class='separator'></div>

<div class='fixed-bottom'>
  {% block bottom %}
  {% endblock %}
</div>
