oef/templates/participants.html.tpl
2019-12-09 14:18:31 +01:00

64 lines
1.6 KiB
Smarty

{{ define "content" }}
{{$isAdmin := .Claims|isAdmin}}
{{$isSchool := .Claims|isSchool}}
<div class="container">
{{$options := `
title: "Participanti"
buttonTitle: "Crea nuovo partecipante"
`}}
{{$modelPath := ""}}
{{if lt (len .Data) 2}}
{{$modelPath = (create "Participant")}}
{{end}}
{{template "read_all_header" dict "options" ($options | yaml) "lengthData" (len .Data) "modelPath" $modelPath}}
{{template "search_input"}}
{{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}}
{{if eq (len .Data) 2}}
<div class="row">
<div class="col-md-12">
<div class="alert alert-warning mt-4">
<strong>Iscrizione completa.</strong> Non è possibile aggiungere ulteriori partecipanti.
</div>
</div>
</div>
{{end}}
{{end}}
</div>
{{ end }}