{{ define "content" }}

<div class="container">
  
  <div class="karmen-info-header">
    <div class="row">
      <div class="col-md-8">
	<h1>Studenti ({{len .Data}})</h1>
      </div>
      <div class="col-md-4">
	<a href="/students/add/?{{query "tpl_layout" "base" "tpl_content" "students_add_update"}}" class="btn btn-primary float-right">
	  <span class="fa fa-plus-circle" aria-hidden="true"></span>
	  Crea nuovo studente
	</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 .Data}}
  <p>Non c'è alcun elemento da visualizzare</p>
  {{else}}
  <div class="list-group" id="myUL">
    {{range $student := .Data}}
    <a class="list-group-item list-group-item-action" href="/students/{{$student.ID}}?{{query "tpl_layout" "base" "tpl_content" "students_show"}}">
      <span class="fa fa-user"></span>
      {{$student.Surname}} {{$student.Name}}
      {{if $student.Class}}
      <div class="text-right">
	<small>{{$student.Class.Name}}</small>
      </div>
      {{else}}
      <div class="text-right">
	<small>no classe</small>
      </div>

      {{end}}
    </a>
    {{end}}
  </div>
  {{end}}
</div>
  
{{ end }}
