{{ define "content" }}

<div class="container">
  
  <div class="karmen-info-header">
    <div class="row">
      <div class="col-md-8">
	<h1>Docenti ({{len .Data}})</h1>
      </div>
      <div class="col-md-4">
	
	<div class="btn-group float-right">
	  
	  <a href="/teachers/add/?{{query "tpl_layout" "base" "tpl_content" "teachers_add_update"}}" class="btn btn-primary">
	    <span class="fa fa-plus-circle" aria-hidden="true"></span>
	    Crea nuovo docente
	  </a>
	   	
      </div>
    </div>
  </div>

  <div class="input-group" style="margin-bottom: 20px">
    <span class="input-group-addon" id="search-query"><span class="glyphicon glyphicon-search"></span></span>
    <input type="text" id="myInput" class="form-control" aria-describedby="search-query">
  </div>
  
  {{if not .}}
  <p>Non c'è alcun elemento da visualizzare</p>
  {{else}}
  <div class="list-group" id="myUL">
    {{range $teacher := .Data}}
    <a class="list-group-item list-group-item-action" href="/teachers/{{$teacher.ID}}?{{query "tpl_layout" "base" "tpl_content" "teachers_show"}}">
      <span class="fa fa-user"></span>
      {{$teacher.Surname}} {{$teacher.Name}}
      <div class="text-right">
	{{if $teacher.Classes}}
	{{range $class := $teacher.Classes}}
	<small>{{$class.Name}}</small>
	{{end}}
	{{else}}
	<small>no classi</small>
	{{end}}
	{{if $teacher.Subjects}}
	{{range $subject := $teacher.Subjects}}
	<small>{{$subject.Name}}</small>
	{{end}}
	{{else}}
	<small>no materie</small>
        {{end}}
      </div>
    </a>
    {{end}}
    {{end}}
  </div>

</div>
{{ end }}
