oef/templates/participants.html.tpl

83 lines
2.1 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"
2020-01-27 15:05:24 +01:00
buttonTitle: "Iscrivi un 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}}
2020-01-27 15:22:11 +01:00
{{template "read_all_header" dict "options" ($options | yaml) "lengthData" (len .Data) "modelPath" $modelPath}}
{{template "search_input" .Data}}
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>
2020-01-27 15:05:24 +01:00
E' possibile iscrivere fino a due partecipanti alla gara (di diversa categoria).
2020-02-11 10:10:10 +01:00
<a id="new_participant_subscribe" href="{{create "Participant"}}" class="float-right btn btn-success btn-sm">
2020-01-27 15:05:24 +01:00
<span class="fa fa-plus-circle" aria-hidden="true"></span>
Iscrivi un nuovo partecipante
</a>
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 }}