{{ define "content" }}

<div class="container">

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

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

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

	  <a href="/students/{{.Data.ID}}/update?{{query "tpl_layout" "base" "tpl_content" "students_add_update" "update" "true"}}"  class="btn btn-primary">
	    <span class="fa fa-edit" aria-hidden="true"></span>
	    Modifica
	  </a>
	  <button href="/students/{{.Data.ID}}/delete"
		  data-url="/students/{{.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">Attività associate all'allievo</h2>
      <div class="list-group" id="classes_list_group">
	{{if not .Data.Activities}}
	<p>All'allievo non è associata alcuna attività
	  didattica. Clicca <a href="/activities/add?{{query "tpl_content" "activities_add_show" "tpl_layout" "base"}}">qui</a> per creare
	  una nuova attività didattica da associare all'allievo.</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>
	  {{if $activity.Teacher}}{{$activity.Teacher.Surname}} {{$activity.Teacher.Name}}{{else}}no docente{{end}}
	  <div class="text-right">
	    <small>{{if $activity.Class}}{{$activity.Class.Name}}{{else}}no classe{{end}}  {{if $activity.Subject}}{{$activity.Subject.Name}}{{else}}no materia{{end}} {{$activity.Hours}}h</small>
	  </div>
	</a>
	{{end}}
	{{end}}
      </div>
    
  </div>

</div>    

{{ end }}
