{{ define "content" }}

<div class="container">

  <nav aria-label="breadcrumb">
    <ol class="breadcrumb">
      <li class="breadcrumb-item"><a href="/documents?{{query "tpl_layout" "base" "tpl_content" "documents"}}">Documenti</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="/documents/add/?{{query "tpl_layout" "base" "tpl_content" "documents_add_update"}}" class="btn btn-success">
            <span class="fa fa-plus-circle" aria-hidden="true"></span>
	    Crea
	  </a>

	  <a href="/documents/{{.Data.ID}}/update?{{query "tpl_layout" "base" "tpl_content" "documents_add_update" "update" "true"}}"  class="btn btn-primary">
            <span class="fa fa-edit" aria-hidden="true"></span>
	    Modifica
	  </a>
	  <button href="/documents/{{.Data.ID}}/delete"
		  data-url="/documents/{{.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">Lavori in esecuzione</h2>
      {{if .Data.RunningJobs}}
      <div class="list-group" id="jobs_list_group">
    	{{range $job := .Data.RunningJobs}}
    	<a href="/jobs/{{$job.ID}}?{{query "tpl_layout" "base" "tpl_content" "jobs_show"}}" class="list-group-item list-group-item-action">
    	  <span class="fa fa-file-alt"></span>
    	  Il lavoro con ID {{$job.ID}} è in esecuzione.
    	  {{end}}
    	</a>
      </div>
      {{else}}
      <p>Nessun lavoro è attualmente in esecuzione. Clicca <a href="/documents/{{.Data.ID}}/execute?{{query "tpl_layout" "base" "tpl_content" "documents_execute"}}">qui</a> per avviare l'esecuzione di un nuovo lavoro.</p>
      {{end}}
    </div>
    
  </div>

  <div class="row">
    <div class="col-md-12">
      
      <h2 class="karmen-relation-header">Lavori terminati di recente</h2>
      {{if .Data.CompletedJobs}}
      <div class="list-group" id="jobs_list_group">
    	{{range $job := .Data.CompletedJobs}}
    	<a href="/jobs/{{$job.ID}}?{{query "tpl_layout" "base" "tpl_content" "jobs_show"}}" class="list-group-item list-group-item-action">
    	  <span class="fa fa-file-alt"></span>
    	  Il lavoro con ID {{$job.ID}} è stato completato in data {{$job.End}}.
    	  {{end}}
    	</a>
      </div>
      {{else}}
      <p>Nessun lavoro è stato terminato di recente.</p>
      {{end}}
    </div>
    
  </div>
  

</div>    

{{ end }}
