{% extends 'base.html' %}

{% block top %}
   <div>Pannello Controllo Note - gestione</div>
  <div><br></div>

 <p>
    utente che sta effettuando gli aggiornamenti: {{ utenteautorizzato.mail }}@{{ utenteautorizzato.domain.nome }}
  </p>
  <p>
    {% if filtro.filtro.value %}
    si stanno effettuando aggiornamenti sulla filtro: <b>{{ filtro.filtro.value }}</b>
    {% endif %}
  </p>
{% endblock %}

{% block body %}

  <form name='filtroedit' method='post'>
    {% csrf_token %}
    <div class='row form-group'>
      <div class='col'>
        <label for='mail'>Filtro</label>
        <input type='text' class='form-control' id='Filtro' name='filtro' placeholder='filtro' value='{{filtro.filtro.value }}'>
      </div>
    </div>

  <div class='row'>
    <div class='col'>
	    <label for='status'>Status</label>
      <select class='form-control' id='status' name='status'>
        <option value="ok" {% if "ok" == filtro.status.value %} selected {% endif %}>OK</option>
        <option value="reject" {% if "reject" == filtro.status.value %} selected {% endif %}>reject</option>
        <option value="hold" {% if "hold" == filtro.status.value %} selected {% endif %}>hold</option>
        <option value="pass" {% if "pass" == filtro.status.value %} selected {% endif %}>pass</option>
        <option value="redirect" {% if "redirect" == filtro.status.value %} selected {% endif %}>Redirect</option>
        <option value="dunno" {% if "dunno" == filtro.status.value %} selected {% endif %}>dunno</option>
     </select>
    </div>
  </div>

  <div class='row form-group'>
    <div class='col'>
      <label for='destination'>Rcpt</label>
      <input type='text' class='form-control' id='destination' name='destination' placeholder='destination' value='{{filtro.destination.value }}'>
    </div>
  </div>

  <div class='row form-group'>
    <div class='col'>
      <label for='redirect'>Redirect To</label>
      <input type='text' class='form-control' id='redirect' name='redirect' placeholder='redirect' value='{{filtro.redirect.value }}'>
    </div>
  </div>

  <div class='form-check-group'>
    <label class='form-check-label' for='dinput'>Input</label>
    <input type='checkbox' class='form-check-input' id='dinput' name='dinput' {% if filtro.dinput.value %} checked {% endif %}>
    <label class='form-check-label' for='doutput'>Output</label>
    <input type='checkbox' class='form-check-input' id='doutput' name='doutput' {% if filtro.doutput.value %} checked {% endif %}>
    <label class='form-check-label' for='header'>Header</label>
    <input type='checkbox' class='form-check-input' id='header' name='header' {% if filtro.header.value %} checked {% endif %}>
    <label class='form-check-label' for='body'>Body</label>
    <input type='checkbox' class='form-check-input' id='body' name='body' {% if filtro.body.value %} checked {% endif %}>
    <label class='form-check-label' for='enabled'>Enabled</label>
    <input type='checkbox' class='form-check-input' id='enabled' name='enabled' {% if filtro.enabled.value %} checked {% endif %}>
  </div>

  <div>
    {% if filtro.errors %}
      <p>Rilevati Errori, impossibile proseguire.</p>
      {% for f in filtro %}
        {% for e in f.errors %}
          <div class="alter alter-danger">
            <strong>{{f.label|escape }}: {{ e|escape }}</strong>
          </div>
        {% endfor %}
      {% endfor %}
      {% for e in formalias.non_field_errors %}
        <div class="alter alter-danger">
          <strong>{{ e|escape }}</strong>
        </div>
      {% endfor %}
    {% endif %}
  </div>

  <div><br></div>
  <div class='form-group btn-group' role='group' aria-label='conferme'>
    <button type='submit' class='btn btn-secondary'>Conferma</button>
    <button type='reset' class='btn btn-secondary'>Reset</button>
    <button type='submit' class='btn btn-secondary' name="Ritorno">Ritorno (Senza salvare)</button>
  </div>
</form>
</div>

{% endblock %}

