82 lines
2.1 KiB
Smarty
82 lines
2.1 KiB
Smarty
{{ define "content" }}
|
|
|
|
{{$isAdmin := .Claims|isAdmin}}
|
|
{{$isSchool := .Claims|isSchool}}
|
|
|
|
<div class="container">
|
|
{{$options := `
|
|
title: "Participanti"
|
|
buttonTitle: "Iscrivi un nuovo partecipante"
|
|
`}}
|
|
|
|
{{$modelPath := ""}}
|
|
|
|
{{if $isAdmin}}
|
|
{{$modelPath = (create "Participant")}}
|
|
{{end}}
|
|
|
|
{{if $isSchool}}
|
|
{{if lt (len .Data) 2}}
|
|
{{$modelPath = (create "Participant")}}
|
|
{{end}}
|
|
{{end}}
|
|
|
|
{{template "read_all_header" dict "options" ($options | yaml) "lengthData" (len .Data) "modelPath" $modelPath}}
|
|
{{template "search_input" .Data}}
|
|
|
|
{{if not .}}
|
|
{{template "display_no_elements"}}
|
|
{{else}}
|
|
<div class="list-group" id="myUL">
|
|
{{range $element := .Data}}
|
|
<a class="list-group-item list-group-item-action" href={{$element.ID|show "Participant"}}>
|
|
<span class="fa fa-user"></span>
|
|
{{$element|string}}
|
|
{{if $isAdmin}}
|
|
<div class="text-right">
|
|
{{$options := `noElements: "nessuna gara"`}}
|
|
{{template "small" dict "options" ($options | yaml) "data" $element.Contests}}
|
|
|
|
{{$options := `noElements: "nessuna scuola"`}}
|
|
{{template "small" dict "options" ($options | yaml) "data" $element.School}}
|
|
</div>
|
|
{{else}}
|
|
<div class="text-right">
|
|
{{$options := `noElements: "nessuna categoria"`}}
|
|
{{template "small" dict "options" ($options | yaml) "data" $element.Category}}
|
|
</div>
|
|
{{end}}
|
|
</a>
|
|
{{end}}
|
|
{{end}}
|
|
|
|
</div>
|
|
|
|
{{if $isSchool}}
|
|
|
|
<div class="row">
|
|
<div class="col-md-12">
|
|
<h2 class="karmen-relation-header">Suggerimenti</h2>
|
|
{{if le (len .Data) 1}}
|
|
<p>
|
|
E' possibile iscrivere fino a due partecipanti alla gara (di diversa categoria).
|
|
<a id="new_participant_subscribe" href="{{create "Participant"}}" class="float-right btn btn-success btn-sm">
|
|
<span class="fa fa-plus-circle" aria-hidden="true"></span>
|
|
Iscrivi un nuovo partecipante
|
|
</a>
|
|
</p>
|
|
{{end}}
|
|
{{if eq (len .Data) 2}}
|
|
<div class="alert alert-warning mt-4">
|
|
<strong>Iscrizione completa.</strong> Non è possibile aggiungere ulteriori partecipanti.
|
|
</div>
|
|
{{end}}
|
|
</div>
|
|
</div>
|
|
|
|
{{end}}
|
|
|
|
</div>
|
|
|
|
|
|
{{ end }}
|