{% extends 'base.html' %}

{% block top %}
  <p>
    utente che autorizzato: {{ utenteautorizzato.mail }}@{{ utenteautorizzato.domain.nome }}
  </p>
{% endblock %}

{% block body %}
  <div>
    <p>Domini da eliminare</p>
    <table class='table'>
      <thead>
        <tr>
          <th scope='col'>#</th>
          <th scope='col'>Dominio</th>
        </tr>
      </thead>
      <tbody>
        <form name="domainlist" method="POST">
          {% csrf_token %}
          {% for u in dominidacancellare %}
            <tr>
      <th scope='row'><a href="{% url 'Cancellazione:CancellazioneDominio' u.id %}">{{ u.id }}</a></th>
      <td> {{ u.nome }} </td><td>{{ u.date_expire_contract }}</td><td>{{ u.date_expire_registrar }}</td>
    </tr>
  {% endfor %}
</form>
</tbody>
</table>
</div>

<div>
<p>
Caselle Email Impostate per la Cancellazione
<form name="userlistall" method='POST'>
  {% csrf_token %}
  <input type="submit" class='btn btn-primary' name='cancellazioneutentetutti' value='Cancella tutti gli utenti elencati!!'>
</form>
</p>

<table class='table'>
  <thead>
    <tr>
      <th scope='col'>#</th>
      <th scope='col'>Email</th>
      <th scope='col'>Nome Completo</th>
      <th scope='col'>Attivato il</th>
      <th scope='col'>Disattivato il</th>
    </tr>
  </thead>
<tbody>
<form name="userlist" method="POST">
  {% csrf_token %}
  {% for u in utentidacancellare %}
    <tr>
      <th scope='row'><a href="{% url 'Cancellazione:CancellazioneUtente' u.id %}">{{ u.id }}</a></th>
              <td>{{ u.mail }}@{{ u.domain.nome }}</td>
              <td>{{ u.nome }}</td>
              <td>{{ u.account_date_creation }}</td>
              <td>{{ u.account_date_disabled }}</td>
            </tr>
          {% endfor %}
        </form>
      </tbody>
    </table>
</tbody>
</div>

<div>
  <p>
  Alias da rimuovere definitivamente
  <form name="userlistall" method='POST'>
    {% csrf_token %}
    <input type="submit" class='btn btn-primary' name='cancellazionealiastutti' value='Cancella tutti gli alias elencati!!'>
  </form>
  </p>

<table class='table'>
  <thead>
    <tr>
      <th scope='col'>#</th>
      <th scope='col'>alias</th>
      <th scope='col'>Da</th>
      <th scope='col'>A</th>
    </tr>
  </thead>
  <tbody>
    <form name="aliaslist" method="POST">
    {% csrf_token %}
    {% for u in aliasdacancellare %}
      <tr>
        <th scope='row'><a href="{% url 'Cancellazione:CancellazioneAlias' u.id %}">{{ u.id }}</a></th>
        <td> {{ u.mailfrom }} </td>
        <td> {{ u.mailto }} </td>
      </tr>
    {% endfor %}
    </form>
  </tbody>
</table>
</div>

  <div>
    <p>Databases da eliminare</p>
    <table class='table'>
      <thead>
        <tr>
          <th scope='col'>#</th>
          <th scope='col'>Database</th>
          <th scope='col'>Utente</th>
	  <th scope='col'>Dominio</th>
        </tr>
      </thead>
      <tbody>
        <form name="sqldatabaselist" method="POST">
          {% csrf_token %}
          {% for u in sqldatabasedacancellare %}
            <tr>
		    <th scope='row'><a href="{% url 'Cancellazione:CancellazioneDatabase' u.id %}">{{ u.id }}</a></th>
              <td> {{ u.nome }} </td>
              <td> {{ u.username }} </td>
	      <td> {{ u.dominio.nome }} </td>
            </tr>
          {% endfor %}
        </form> 
      </tbody>
    </table> 
  </div>

  <div>
    <p>Ftp da eliminare</p>
    <table class='table'>
      <thead>
        <tr>
          <th scope='col'>#</th>
          <th scope='col'>ftp</th>
          <th scope='col'>homedir</th>
        </tr>
      </thead>
      <tbody>
        <form name="ftpuserlist" method="POST">
          {% csrf_token %}
          {% for u in eracancellare %}
            <tr>
              <th scope='row'>{{ u.id }}</th>
              <td> {{ u.user }}@{{ u.domain.nome </td>
              <td> {{ u.homedir }} </td>
            </tr>
          {% endfor %}
        </form> 
      </tbody>
    </table> 
  </div>

{% endblock %}
