{{ define "content" }}

<div class="container">

  <nav aria-label="breadcrumb">
    <ol class="breadcrumb">
      <li class="breadcrumb-item"><a href="/teachers?{{query "tpl_layout" "base" "tpl_content" "teachers"}}">Docenti</a></li>
      <li class="breadcrumb-item active"><a href="#">{{.Data.Name}} {{.Data.Surname}}</a></li>
    </ol>
  </nav>

  <div class="karmen-info-header">
    <div class="row">
      <div class="col-md-8">
	<h1>{{.Data.Name}} {{.Data.Surname}}</h1>
      </div>
      <div class="col-md-4">
	<div class="btn-group float-right" role="group">
	  <a href="/teachers/{{.Data.ID}}/update?{{query "tpl_layout" "base" "tpl_content" "teachers_add_update" "update" "true"}}" class="btn btn-primary">
	    <span class="fa fa-edit" aria-hidden="true"></span>
	    Modifica
	  </a>
	  <button href="/teachers/{{.Data.ID}}/delete"
		  data-url="/teachers/{{.Data.ID}}/delete"
		  class="btn btn-danger karmen-ajax-delete">
	    <span class="fa fa-trash" aria-hidden="true"></span>
	    Elimina
	  </button>
	</div>
      </div>
    </div>
  </div>

  <div class="row">
    <div class="col-md-12">
      
      <h2 class="karmen-relation-header">Materie</h2>
      {{if .Data.Subjects}}
      <div class="list-group" id="materie_list_group">
    	{{range $subject := .Data.Subjects}}
    	<a href="/subjects/{{$subject.ID}}?{{query "tpl_layout" "base" "tpl_content" "subjects_show"}}" class="list-group-item list-group-item-action">
    	  <span class="fa fa-book"></span>
    	  {{$subject.Name}}
    	  {{end}}
    	</a>
      </div>
      {{else}}
      <p>Al docente non è associata alcuna attività
    	didattica. Clicca <a href="/activities/add/?{{query "tpl_layout" "base" "tpl_content" "activities_add_update"}}">qui</a> per
    	creare una nuova attività didattica da associare al docente.</p>
      {{end}}
    </div>
    
  </div>

  <div class="row">
    <div class="col-md-12">
      
      <h2 class="karmen-relation-header">Classi</h2>
      {{if .Data.Classes}}
      <div class="list-group" id="classes_list_group">
	{{range $class := .Data.Classes}}
	<a href="/classes/{{$class.ID}}?{{query "tpl_layout" "base" "tpl_content" "classes_show"}}" class="list-group-item list-group-item-action">
	  <span class="fa fa-users"></span>
	  {{$class.Name}}
	  {{end}}
	</a>
      </div>
      {{else}}
      <p>Al docente non è associata alcuna attività
	didattica. Clicca <a href="/activities/add/?{{query "tpl_layout" "base" "tpl_content" "activities_add_update"}}">qui</a> per
	creare una nuova attività didattica da associare al docente.</p>
      {{end}}
    </div>
    
  </div>

  <div class="row">
    <div class="col-md-12">
      
      <h2 class="karmen-relation-header">Studenti</h2>
      {{if .Data.Students}}
      <div class="list-group" id="students_list_group">
	{{range $student := .Data.Students}}
	<a href="/students/{{$student.ID}}?{{query "tpl_layout" "base" "tpl_content" "students_show"}}" class="list-group-item list-group-item-action">
	  <span class="fa fa-user"></span>
	  {{$student.Surname}} {{$student.Name}}
	  {{end}}
	</a>
      </div>
      {{else}}
      <p>Al docente non è associata alcuna attività
	didattica. Clicca <a href="/activities/add/?{{query "tpl_layout" "base" "tpl_content" "activities_add_update"}}">qui</a> per
	creare una nuova attività didattica da associare al docente.</p>
      {{end}}
    </div>
    
  </div>

  <div class="row">
    <div class="col-md-12">
   
      <h2 class="karmen-relation-header">Attività del docente ({{.Data.ActualHours}}h)</h2>
      {{if .Data.Activities}}
      <div class="list-group" id="classes_list_group">
	{{range $activity := .Data.Activities}}
	<a href="/activities/{{$activity.ID}}?{{query "tpl_layout" "base" "tpl_content" "activities_show"}}" class="list-group-item list-group-item-action">
	  <span class="fa fa-business-time"></span>
	  {{$activity.Subject.Name}} {{if $activity.Class}}{{$activity.Class.Name}}{{else}}no classe{{end}} {{$activity.Hours}}h{{if $activity.SupplyTeacher}}{{if ne $.Data.Surname $activity.SupplyTeacher.Surname}} (sostituito da {{$activity.SupplyTeacher.Surname}}){{else}} (sostituisce {{$activity.Teacher.Surname}}){{end}}{{end}}
	  {{end}}
	</a>
      </div>
      
      {{if $classes := .Data.CoordinatorClasses}}
      <p>Il docente è <strong>coordinatore</strong> nelle seguenti classi</p>
      <div class="list-group" id="coord_classes_list_group">
	{{range $class := $classes}}
	<a href="/classes/{{$class.ID}}?{{query "tpl_layout" "base" "tpl_content" "classes_show"}}" class="list-group-item list-group-item-action">
	  <span class="fa fa-users"></span>
	  {{$class.Name}}
	  {{end}}
	</a>
      </div>
      {{end}}

      {{if $classes := .Data.MinuterClasses}}
      <p>Il docente è <strong>verbalizzante</strong> nelle seguenti classi</p>
      <div class="list-group" id="coord_classes_list_group">
	{{range $class := $classes}}
	<a href="/classes/{{$class.ID}}?{{query "tpl_layout" "base" "tpl_content" "classes_show"}}" class="list-group-item list-group-item-action">
	  <span class="fa fa-users"></span>
	  {{$class.Name}}
	  {{end}}
	</a>
      </div>
      {{end}}

      
      {{else}}
      <p>Al docente non è associata alcuna attività
	didattica. Clicca <a href="/activities/add/?{{query "base" "activities_add_update"}}">qui</a> per
	creare una nuova attività didattica da associare al docente.</p>
      {{end}}
    </div>
  </div>


</div>    

{{ end }}
