{% extends 'base.html' %}

{% block top %}
  <p>
    utente che sta effettuando gli aggiornamenti {{ utenteautorizzato.mail }}@{{ utenteautorizzato.domain.nome }}
  </p>
{% endblock %}

{% block body %}
  <form name='Nuova Configurazione Web' method='post'>
    {% csrf_token %}
    <button class="btn btn-primary" type="submit" name='Nuovo' value="Nuovo">Nuova Configurazione Web</button>
  </form>
  <table class='table'>
    <thead>
      <tr>
        <th scope='col'>Nome</th>
        <th scope='col'>Sub</th>
	<th scope='col'>Server</th>
	<th scope='col'>Http</th>
	<th scope='col'>Https</th>
	<th scope='col'>Path</th>
      </tr>
    </thead>
    <tbody>
      <form name="proxyserverlist" method="POST">
      {% csrf_token %}
      {% for w in proxyserver %}
        <tr>
          <th scope='row'>{{ w.nome }}</th>
          <td> {{ w.sub }} </td>
          <td> {{ w.server }} </td>
	  <td> {{ w.http }} </td>
	  <td> {{ w.https }} </td>
	  <td> {{ w.path }} </td>

          <td><button class="btn btn-primary" type="submit" name='edit' value="{{ w.id }}">Edit</button>
              <button class="btn btn-primary" type="button" data-toggle="modal" data-target="#ConfirmDisable{{ w.id }}" name='disable' value="{{ w.id }}" {% if not w.enabled %} disabled {% endif %}>Disabilita</button>
              <button class="btn btn-primary" type="submit" name='enable' value="{{ w.id }}" {% if w.enabled %} disabled {% endif %}>Abilita</button>
              <button class="btn btn-primary" type="button" data-toggle="modal" data-target="#ConfirmDelete{{ w.id }}" name='delete' value="{{ w.id }}" {% if not w.enabled %} disabled {% endif %}>Cancella</button></td>
       </tr>

        <!-- Modal -->
        <div class="modal fade" id="ConfirmDisable{{ w.id }}" tabindex="-1" role="dialog" aria-labelledby="exampleModalLongTitle" aria-hidden="true">
          <div class="modal-dialog" role="document">
            <div class="modal-content">
              <div class="modal-header">
                <h5 class="modal fade" id="exampleModalLongTitle">Conferma Disattivazione</h5>
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                  <span aria-hidden="true">&times;</span>
                </button>
              </div>
              <div class="modal-body">
                Sei sicuro di voler disattivare questo Filtro? 
              </div>
              <div class="modal-footer">
                <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
		<button type="submit" class="btn btn-primary" name="disable" value="{{ w.id }}">Conferma</button>
              </div>
            </div>  
          </div>  
        </div>
        <!-- Modal -->
        <div class="modal fade" id="ConfirmDelete{{ w.id }}" tabindex="-1" role="dialog" aria-labelledby="exampleModalLongTitle" aria-hidden="true">
          <div class="modal-dialog" role="document">
            <div class="modal-content">
              <div class="modal-header">
                <h5 class="modal fade" id="exampleModalLongTitle">Conferma cancellazione</h5>
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                  <span aria-hidden="true">&times;</span>
                </button>
              </div>
              <div class="modal-body">
                Sei sicuro di voler Cancellare Questa Regola? 
              </div>
              <div class="modal-footer">
                <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
		<button type="submit" class="btn btn-primary" name="delete" value="{{ w.id }}">Conferma</button>
              </div>
            </div>  
          </div>  
        </div>

      {% endfor %}
      </form>
    </tbody>
{% endblock %}
