oef/templates/participants.html.tpl

79 lines
2 KiB
Smarty
Raw Normal View History

2019-11-14 15:04:11 +01:00
{{ define "content" }}
{{$isAdmin := .Claims|isAdmin}}
{{$isSchool := .Claims|isSchool}}
2019-11-14 15:04:11 +01:00
<div class="container">
{{$options := `
2019-11-15 10:41:32 +01:00
title: "Participanti"
buttonTitle: "Crea nuovo partecipante"
2019-11-14 15:04:11 +01:00
`}}
{{$modelPath := ""}}
{{if $isAdmin}}
{{$modelPath = (create "Participant")}}
2019-12-09 15:48:02 +01:00
{{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"}}
2019-11-14 15:04:11 +01:00
{{if not .}}
{{template "display_no_elements"}}
{{else}}
2019-11-14 15:04:11 +01:00
<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}}
2019-11-14 15:04:11 +01:00
</div>
2019-12-09 14:18:31 +01:00
{{if $isSchool}}
2020-01-27 14:21:08 +01:00
<div class="row">
<div class="col-md-12">
2020-01-27 14:21:08 +01:00
<h2 class="karmen-relation-header">Suggerimenti</h2>
{{if le (len .Data) 1}}
2020-01-27 14:21:08 +01:00
<p>
E' possibile iscrivere fino a due partecipanti alla gara (di diversa categoria). {{(printf "Clicca %s per iscrivere un partecipante." ((create "Participant")|anchor "qui")|html)}}
2020-01-27 14:21:08 +01:00
</p>
{{end}}
{{if eq (len .Data) 2}}
<div class="alert alert-warning mt-4">
<strong>Iscrizione completa.</strong> Non è possibile aggiungere ulteriori partecipanti.
</div>
2020-01-27 14:21:08 +01:00
{{end}}
</div>
</div>
2020-01-27 14:21:08 +01:00
2019-12-09 14:18:31 +01:00
{{end}}
2019-11-14 15:04:11 +01:00
</div>
{{ end }}