{{ define "content" }}

<div class="container">

  {{if .Options.Get "update"}}
  <nav aria-label="breadcrumb">
    <ol class="breadcrumb">
      <li class="breadcrumb-item"><a href="/teachers?{{query "tpl_layout" "base" "tpl_content" "teachers"}}">Docenti</a></li>
      <li class="breadcrumb-item"><a href="/teachers/{{.Data.ID}}?{{query "tpl_layout" "base" "tpl_content" "teachers_show"}}">{{.Data.Name}} {{.Data.Surname}}</a></li>
      <li class="breadcrumb-item active"><a href="#">Aggiorna</a></li>
    </ol>
  </nav>
  {{else}}
  <nav aria-label="breadcrumb">
    <ol class="breadcrumb">
      <li class="breadcrumb-item"><a href="/teachers/?{{query "tpl_layout" "base" "tpl_content" "teachers"}}">Docenti</a></li>
      <li class="breadcrumb-item active"><a href="#">Aggiungi</a></li>
    </ol>
  </nav>
  {{end}}

  {{if .Options.Get "update"}}
  <h1 class="karmen-info-header">Aggiorna il docente "{{.Data.Name}} {{.Data.Surname}}"</h1>
  {{else}}
  <h1 class="karmen-info-header">Crea un nuovo docente</h1>
  {{end}}

  {{if .Options.Get "update"}}
  <form class="needs-validation" action="/teachers/{{.Data.ID}}/update" method="POST" role="form">
  {{else}}
  <form action="/teachers/add/" method="POST" role="form" class="needs-validation">
  {{end}}  
    <div class="form-group">
      <label class="control-label" for="teacher_name">Nome</label>
      <input type="text" name="Name" class="form-control" id="teacher_name" placeholder="Nome" {{if .Options.Get "update"}} value="{{.Data.Name}}" {{end}} required>
    </div>
    
    <div class="form-group">
      <label class="control-label" for="teacher_surname">Cognome</label>
      <input type="text" name="Surname" class="form-control" id="teacher_surname" placeholder="Cognome" {{if .Options.Get "update"}} value="{{.Data.Surname}}" {{end}} required>
    </div>

    <div class="form-group">
      <label class="control-label has-feedback" for="teacher_hours">Numero di ore</label>
      <input type="number" name="Hours" class="form-control" id="teacher_hours" {{if .Options.Get "update"}}value="{{.Data.Hours}}"{{else}}value="18"{{end}} required>
    </div>

    <div class="form-row">
      
      <div class="col">
	<input type="email" name="AltEmail" class="form-control" id="teacher_altemail" placeholder="Email alternativa" {{if .Options.Get "update"}} value="{{.Data.AltEmail}}" {{end}}>
      </div>
      <div class="col">
	<div class="form-check">
	  <input type="checkbox" name="Regenerate" class="form-check-input" id="teacher_regenerate" {{if .Options.Get "update"}}{{if .Data.Regenerate}}checked{{end}}{{end}}>
	  <label class="form-check-label has-feedback" for="teacher_regenerate">Rigenerare/inviare le credenziali</label>
	</div>
      </div>
      <div class="col">
	<div class="form-check">
	  <input type="checkbox" name="Exclude" class="form-check-input" id="teacher_exclude" {{if .Options.Get "update"}}{{if .Data.Exclude}}checked{{end}}{{end}}>
	  <label class="form-check-label has-feedback" for="teacher_exclude">Escludere dalle utenze</label>
	</div>
      </div>
      <div class="col">
	<div class="form-check">
	  <input type="checkbox" name="NotInvited" class="form-check-input" id="teacher_not_invited" {{if .Options.Get "update"}}{{if .Data.NotInvited}}checked{{end}}{{end}}>
	  <label class="form-check-label has-feedback" for="teacher_not_invited">Escludere dagli inviti</label>
	</div>
      </div>


    </div>

    <div class="form-row">
      <div class="col">
	<label class="control-label" for="teacher_date_from">In servizio dal</label>
	<input type="date" name="DateFrom" class="form-control" id="teacher_date_from" {{if .Options.Get "update"}} value="{{convertDate .Data.DateFrom}}" {{end}}>
      </div>
      <div class="col">
	<label class="control-label" for="teacher_date_to">In servizio fino al</label>
	<input type="date" name="DateTo" class="form-control" id="teacher_date_to" {{if .Options.Get "update"}} value="{{convertDate .Data.DateTo}}" {{end}}>
      </div>
    </div>

    <div class="form-group">
      <label class="control-label has-feedback" for="teacher_ldapdnfmt">Stringa DN per LDAP</label>
      <input type="text" name="LdapDNFmt" class="form-control" id="teacher_ldapdnfmt" placeholder="cn=%s %s,ou=People,dc=foo,dc=org" {{if .Options.Get "update"}}value="{{.Data.LdapDNFmt}}"{{end}}>
    </div>

    <div class="form-group">
      <button type="submit" class="btn btn-primary">Salva</button>
      {{if .Options.Get "update"}}
      <a href="/teachers/{{.Data.ID}}?{{query "tpl_layout" "base" "tpl_content" "teachers_show"}}" class="btn btn-default">Annulla</a>
      {{else}}
      <a href="/teachers/?{{query "tpl_layout" "base" "tpl_content" "teachers"}}" class="btn btn-default">Annulla</a>
      {{end}}
    </div>
    
  </form>

  
</div>

{{ end }}
