{% extends 'base.html' %}

{% block top %}
    <div class='form-outline mb-3 text-center btn-primary h3'>
           {{ HeaderTitle }}
    </div>
    <div class='form-outline mb-3 text-center btn-primary h3'>
           Amministratore: {{ admin.username }} 
    </div>
{% endblock %}

{% block body %}

  <!-- errori utente -->
  {% if azienda.errors %}
    {{ azienda.errors }}
    {% for field in azienda %}
      {% for error in field.errors %}
        <div class="alert alert-danger">
          <strong>{{ error|escape }}</strong>
        </div>
      {% endfor %}
    {% endfor %}

    {% for error in azienda.non_field_errors %}
      <div class="alert alert-danger">
          <strong>{{ error|escape }}</strong>
      </div>
    {% endfor %}
  {% else %}
    Nessun Errore rilevato
  {% endif %}
  <!-- fine zona errori -->

  <!-- profilo utente -->
  <form name='AziendaEdit' method='post'>
    {% csrf_token %}
    <div class='form-group'>
      <label for="nome">Nome Azienda</label>
      <input type='text' class='form-control form-control-lg' name='nome' id='nome' value='{{ azienda.nome.value }}'>
    </div>
    <div class='form-group'>
      <label for="partitaiva">Partita IVA</label>
      <input type='text' class='form-control' name='partitaiva' id='partitaiva' value='{{ azienda.partitaiva.value }}'>
    </div>
    <div class='form-group'>
      <label for="mail" class="form-control-label">Email</label>
      <input type='mail' class='form-control' name='mail' id='mail' value='{{ azienda.mail.value }}'>
    </div>
    <div class='form-check'>
      <input class="form-check-input" type="checkbox" value="{{ azienda.forzanuovapassword.value }}" id="forzanuovapassword" name="forzanuovapassword">
      <label for='forzanuovapassword' class='form-control-label'>L'utente deve cambiare la password al primo login</label>
    </div>
    <div class="form-check">
      <input class="form-check-input" type="checkbox" value="{{ azienda.cancellaazienda.value }}" id="cancellaazienda" name="cancellaazienda">
      <label class="form-check-label" for="cancellaazienda">Cancella Azienda!</label>
    </div>

    <input type='submit' class="btn btn-secondary" value='Aggiorna'>
    <input type='submit' class="btn btn-primary" name="ritorna" value="Ritorna">
  </form>

</div>{% endblock %}
