{% extends 'base.html' %}

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

{% block body %}

<div>Gestione server sql</div>

<div><p></div>

<div></div>

<form name='sqlserveredit' method='post'>
  {% csrf_token %}

  <div class='form-group'>
    <div class='row'>
      <div class='col'>
	<label for='nome'>Nome Server</label>
	<input type='text' id='nome' name='nome' value='{{ formsqlserver.nome.value }}'/>
      </div>
      <div class='col'>
	<label for='nome'>Server (nome dns/ip)</label>
	<input type='text' id='server' name='server' value='{{ formsqlserver.server.value }}'/>
      </div>
   </div>
  </div>
  <div class='form-group'>
    <div class='row'>
      <div class='col'>
	<label for='adminuser'>Utente Creatore</label>
	<input type='text' id='adminuser' name='adminuser' value='{{ formsqlserver.adminuser.value }}'>
      </div>
      <div class='col'>
	<label for='adminpass'>Password Creatore</label>
	<input type='password' id='adminpass' name='adminpass' value='{{ formsqlserver.adminpass.value }}' >
      </div>
   </div>
  </div>
  <div class='form-group'>
    <div class='row'>
      <div class='col'>
        <label for='enabled'>Abilitato</label>
	<input type='checkbox' class='form-control' id='enabled' name='enabled' {% if formsqlserver.enabled.value %} checked {% endif %}>
      </div>
    </div>
  </div>

  <div class='form-group'>
    <div class='row'>
      <div class='col'>
        <label for='nota'>Nota</label>
        <textarea name='nota' class='form-control' rows='5'>{{ formsqlserver.nota.value }}</textarea>
      </div>
    </div>
  </div>

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

         <div class='row'>
         {% for e in formsqlserver.non_field_errors %}
           <div class="alter alter-danger">
      	     <strong>{{ e|escape }}</strong><br>
           </div>
         {% endfor %}
         </div>

       {% endif %}
     </div>
  </div>

  <hr>
  <div class='row 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='Ritorna'>Ritorna (Senza Salvare)</button>
  </div>
</form>

{% endblock %}
