{{ define "content" }}

<div class="container">

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

  <div class="karmen-info-header">
    <div class="row">
      <div class="col-md-8">
	<h1>Dipartimento di {{.Data.Name}}</h1>
      </div>
      <div class="col-md-4">

	<div class="btn-group float-right" role="group">
	  <a href="/departments/add/?{{query "tpl_layout" "base" "tpl_content" "departments_add_update"}}" class="btn btn-success">
	    <span class="fa fa-edit" aria-hidden="true"></span>
	    Crea
	  </a>

	  <a href="/departments/{{.Data.ID}}/update?{{query "tpl_layout" "base" "tpl_content" "departments_add_update" "update" "true"}}"  class="btn btn-primary">
	    <span class="fa fa-edit" aria-hidden="true"></span>
	    Modifica
	  </a>
	  <button href="/departments/{{.Data.ID}}/delete"
		  data-url="/departments/{{.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">Coordinatore del dipartimento</h2>
      <div class="list-group" id="departments_list_group">
	{{if ne .Data.Coordinator.ID 0}}
	<a href="/teachers/{{.Data.Coordinator.ID}}?{{query "tpl_layout" "base" "tpl_content" "teachers_show"}}" class="list-group-item list-group-item-action">
	  <span class="fa fa-user"></span>
	  {{.Data.Coordinator.Surname}} {{.Data.Coordinator.Name}}
	  <div class="text-right">
	    <small>Coordinatore</small>
	  </div>
	</a>
	{{else}}
	<span class="list-group-item list-group-item-action">Nessun coordinatore</span>
	{{end}}
      </div>
    </div>
    
    <div class="col-md-12">
      <h2 class="karmen-relation-header">Docenti del dipartimento</h2>
      {{if not .Data.Teachers}}
      <p>Nel dipartimento non è presente alcun docente
	didattica. Clicca <a href="/activities/add/?{{query "tpl_layout" "base" "tpl_content" "activities_add_update"}}">qui</a> per creare
	una nuova attività didattica.</p>
      {{else}}
      <div class="list-group" id="teachers_list_group">
	{{range $teacher := .Data.Teachers}}
	<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}}
	</a>
	{{end}}
      </div>
      {{end}}
    </div>    

    <div class="col-md-12">
      <h2 class="karmen-relation-header">Materie afferenti al dipartimento</h2>
      {{if not .Data.Teachers}}
      <p>Nel dipartimento non è presente alcuna materia
	didattica. Clicca <a href="/subjects?{{query "tpl_layout" "base" "tpl_content" "subjects"}}">qui</a> per visualizzare le materie.</p>
      {{else}}
      <div class="list-group" id="subjects_list_group">
	{{range $subject := .Data.Subjects}}
	<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}}
	</a>
	{{end}}
	
      </div>
      {{end}}
    </div>    

    {{ end }}
