{{ define "content" }}

<div class="container">

  {{if .Update}}
  <ol class="breadcrumb">
    <li><a href="/teachers">Docenti</a></li>
    <li><a href="/teachers/{{.Teacher.ID}}">{{.Teacher.Name}} {{.Teacher.Surname}}</a></li>
    <li class="active"><a href="#">Aggiorna</a></li>
  </ol>  
  {{else}}  
  <ol class="breadcrumb">
    <li><a href="/teachers">Docenti</a></li>
    <li class="active"><a href="#">Aggiungi</a></li>
  </ol>
  {{end}}

  {{if .Update}}
  <h1 class="karmen-info-header">Aggiorna il docente "{{.Teacher.Name}} {{.Teacher.Surname}}"</h1>
  {{else}}
  <h1 class="karmen-info-header">Crea un nuovo docente</h1>
  {{end}}
  
  <form action="{{.SubmitUrl}}" method="POST" role="form" data-toggle="validator">
    
    <div class="form-group has-feedback">
      <label class="control-label" for="teacher_name">Nome</label>
      <input type="text" name="Name" class="form-control" id="teacher_name" placeholder="Nome" {{if .Update}} value="{{.Teacher.Name}}" {{end}} required>
    </div>
    
    <div class="form-group has-feedback">
      <label class="control-label" for="teacher_surname">Cognome</label>
      <input type="text" name="Surname" class="form-control" id="teacher_surname" placeholder="Cognome" {{if .Update}} value="{{.Teacher.Surname}}" {{end}} required>
    </div>

    <div class="form-group has-feedback">
      <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 .Update}}value="{{.Teacher.Hours}}"{{else}}value="18"{{end}} required>
    </div>

    {{if .Update}}
    <div class="form-group has-feedback">
      <label class="control-label" for="teacher_password">Password</label>
      <input type="password" name="Password" class="form-control" id="password" placeholder="Password" value="{{.Teacher.Password}}" required>
    </div>

    <div class="form-group has-feedback">
      <label class="control-label">Nome utente</label>
      <p class="form-control-static">{{.Teacher.Username}}</p>
    </div>

    <div class="form-group has-feedback">
      <label class="control-label">Email</label>
      <p class="form-control-static">{{.Teacher.Email}}</p>
    </div>    
    {{end}}
    
    <div class="form-group">
      <button type="submit" class="btn btn-primary">Salva</button>
      {{if .Update}}
      <a href="/teachers/{{.Teacher.ID}}" class="btn btn-default">Annulla</a>
      {{else}}
      <a href="/teachers" class="btn btn-default">Annulla</a>
      {{end}}
    </div>
    
  </form>

  
</div>

{{ end }}
