{{ define "content" }}

<div class="container">

  <nav aria-label="breadcrumb">
    <ol class="breadcrumb">
      <li class="breadcrumb-item"><a href="/subjects?{{query "tpl_layout" "base" "tpl_content" "subjects"}}">Materie</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>{{.Data.Name}}</h1>
      </div>
      <div class="col-md-4">
	<div class="btn-group float-right" role="group">
	  <a href="/subjects/{{.Data.ID}}/update?{{query "tpl_layout" "base" "tpl_content" "subjects_add_update" "update" "true"}}" class="btn btn-primary">
	    <span class="fa fa-edit" aria-hidden="true"></span>
	    Modifica
	  </a>
	  <button href="/subjects/{{.Data.ID}}/delete"
		  data-url="/subjects/{{.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>

  <h2 class="karmen-relation-header">Docenti di {{.Data.Name}}</h2>
  <div class="list-group" id="subjects_list_group">
    {{if not .Data.Teachers}}
    <p>Alla materia 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 alla materia.</p>
    {{else}}
    {{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-user"></span>
      {{$activity.Teacher.Surname}} {{$activity.Teacher.Name}}
      <div class="text-right">
	<small>{{$activity.Subject.Name}} {{$activity.Hours}}h</small>
      </div>
    </a>
    {{end}}
    {{end}}
  </div>


</div>    

{{ end }}
