{{ define "content" }}

<div class="container">
  
  <div class="karmen-info-header">
    <div class="row">
      <div class="col-md-8">
	<h1>Materie ({{len .Data}})</h1>
      </div>
      <div class="col-md-4">
	<div class="btn-group float-right">

	  <a href="/subjects/add/?{{query "tpl_layout" "base" "tpl_content" "subjects_add_update"}}" class="btn btn-primary">
	    <span class="fa fa-plus-circle" aria-hidden="true"></span>
	    Crea nuova materia
	  </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 $subject := .Data}}
    <a class="list-group-item list-group-item-action" href="/subjects/{{$subject.ID}}?{{query "tpl_layout" "base" "tpl_content" "subjects_show"}}">
      <span class="fa fa-book"></span>
      {{$subject.Name}}
      <div class="text-right">
	{{if $subject.Teachers}}
	{{range $teacher := $subject.Teachers}}
	<small>{{$teacher.Surname}}</small>
	{{end}}
	{{else}}
	<small>no docente</small>
	{{end}}
      </div>
    </a>
    {{end}}
  </div>
  {{end}}
</div>
  
{{ end }}
