{{ define "eiffel.elicitation.template" }}
{{ if .Data.Form.Template }} Aktuelle Schablone {{ .Data.Form.Template.Name }}
{{ .Data.Form.Template.Description }} {{ else }} {{ t "eiffel.elicitation.template.search.not-yet-selected" }} {{ end }}
{{ if .Data.Form.Template }} {{ $templateID := .Data.Form.TemplateID }} {{ $rules := .Data.Form.Template.Rules }} {{ $displayTypes := .Data.Form.DisplayTypes }} {{ $variantKey := .Data.Form.VariantKey }}
{{ $current := false }} {{ $prevOrNext := "prev" }} {{ range $key, $variant := .Data.Form.Template.Variants }} {{ $class := printf "eiffel-template-variant-%s" $prevOrNext }} {{ if eq $variantKey $key }} {{ $current = true }} {{ $class = "eiffel-template-variant-current" }} {{ end }}
{{ if $current }} {{ $prevOrNext = "next" }} {{ $current = false }} {{ end }} {{ end }}
{{ t "eiffel.elicitation.template.variant.left.shortcut" }} {{ t "eiffel.elicitation.template.variant.right.shortcut" }}

{{ if .Data.Form.Variant.Format }} {{ .Data.Form.Variant.Format }} {{ else }} {{ range .Data.Form.Variant.Rules }} {{ $rule := index $rules . }} {{ if eq (index $displayTypes .) "text" }} {{ $rule.Value }} {{ else }} {{ if $rule.Optional }} [{{ $rule.Name }}] {{ else }} <{{ $rule.Name }}> {{ end }} {{ end }} {{ end }} {{ end }}
{{ if .Data.Form.Variant.Example }}

{{ .Data.Form.Variant.Example }}
{{ end }} {{ if or .Data.Form.Variant.Description .Data.Form.Template.Description }}

{{ if .Data.Form.Variant.Description }}
{{ t "eiffel.elicitation.template.variant.description" }}
{{ .Data.Form.Variant.Description }}
{{ end }} {{ if .Data.Form.Template.Description }}
{{ t "eiffel.elicitation.template.description" }}
{{ .Data.Form.Template.Description }}
{{ end }}
{{ end }}

{{ template "eiffel.elicitation.form" . }}
{{ else }} {{ if not .Data.Valid }} {{ range .Data.AllViolations }} {{ end }} {{ else }} {{ end }} {{ end }} {{ end }}