{% extends 'base.html' %}

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

{% block body %}

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

  <form method="POST" name="FormCausale">
    {% csrf_token %}

    <div class='row form-group'>
      <div class='col'>
        <label for='nome'>Nome Causale</label>
	<input type='text' class='form-control' id='nome' name='nome' placeholder='causale' value='{{ formcausale.nome.value }}'>
      </div>
      <div class='col form-check-inline'>
	<label for='enabled' class='form-check-label'>Abilitato</label>
        <input type='checkbox' class='form-check-input' id='enabled' name='enabled' {% if formcausale.enabled.value %} checked {% endif %}>
      </div>
      <div class='col'>
        <label for='valore'>Valore</label>
	<input type='number' class='form-control' id='valore' name=?valore' value='formcausale.valore.value }}'>
      </div>
    </div>
    <hr>
      <div class='row form-group'>
	<div class='col form-check-inline'>
          <label for='send_email_admin' class='form-check-label'>Invia Mail Agli Amministratori</LAbel>
	  <input type='checkbox' class='form-check-input' id='send_email_admin' name='send_email_user' {% if causale.send_email_admin.value %} checked {% endif %}>
	</div>
	<div class='col'>
	  <label for='send_email_user' class='form-label'>Mail Amministratori:</label>
	  <input type='text' class='form-control' id='to_mail' name='to_mail' value='{% if causale.to_email.value %}{{ causale.to_email.value }}{% endif %}'></input>
      </div>
    </div>

    <div class='row'>
      <div class='col'>
        <label for='send_email_account' class='form-check-label'>Invia Mail Contabilità</label>
        <input type='checkbox' class='form-check-input' id='send_email_account' name='send_email_account' {% if causale.to_email_account.value %} checked {% endif %}>
      </div>
      <div class='col'>
        <label for='to_account'>Mail Contabilità:</label>
        <input type='text' class='form-control' id='to_account' name='to_account' value='{% if causale.to_account.value %}{{ causale.to_account.value }}{% endif %}'></input>
      </div>
    </div>

    <div class='row from-group'>
      <div class='col'>
        <label for='send_email_other' clasS='form-check-label'>Invia Mail A Altri</label>
        <input type='checkbox' class='form-check-input' id='send_email_other' name='send_email_other' {% if causale.to_email_other.value %} checked {% endif %}>
      </div>
      <div class='col'>
     	<label for='to_account'>Mail Esterne:</label>
        <input type='text' class='form-control' id='to_other' name='to_other' value='{% if causale.to_other.value %}{{ causale.to_other.value }}{% endif %}'></input>
      </div>
    </div>

    <div class='raw from-group'>
      <div class='col'>
        <label for='from_email'>Mittente email:</label>
        <input type='text' class='form-control' id='from_email' name='to_email' value='{% if causale.from_email.value %}{{ causale.from_email.value }}{% endif %}'></input>
      </div>
      <div class='col'>
      	<label for='send_email_user' class='form-check-label'>Invia comunicazione:</label>
        <input type='checkbox' class='form-check-label' id='send_email_user' name='send_email_user' {% if causale.send_mail_user.value %} checked {% endif %}>
      </div>
    </div>

    <hr>

    <div class='row'>
      Servizi Associati:
    </div>

    <hr>

  <div class='btn-group' role='group' aria-label='conferme'>
    <button type='submit' class='btn btn-primary'>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>

{% endblock %}


