{{ define "content" }}

<div class="container">

  {{if .Options.Get "update"}}
  <ol class="breadcrumb">
    <li><a href="/teachers{{query "tpl_layout" "base" "tpl_content" "teachers_show"}}">Docenti</a></li>
    <li><a href="/teachers/{{.Data.ID}}{{query "tpl_layout" "base" "tpl_content" "teachers_show"}}">{{.Data.Name}} {{.Data.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 .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 action="/teachers/{{.Data.ID}}/update" method="POST" role="form" data-toggle="validator">
  {{else}}
  <form action="/teachers/add/" method="POST" role="form" data-toggle="validator">
  {{end}}  
    <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 .Options.Get "update"}} value="{{.Data.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 .Options.Get "update"}} value="{{.Data.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 .Options.Get "update"}}value="{{.Data.Hours}}"{{else}}value="18"{{end}} required>
    </div>

    {{if .Options.Get "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="{{.Data.Password}}" required>
    </div>

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

    <div class="form-group has-feedback">
      <label class="control-label">Email</label>
      <p class="form-control-static">{{.Data.Email}}</p>
    </div>    
    {{end}}
    
    <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 }}
