{{ define "title" }}Add email address for {{ .Form.User.Name }}{{ end }}

{{ define "main" }}
    <form action="/users/{{ .Form.User.ID }}/add-mail" method="post">
        <input type="hidden" name="csrf_token" value="{{ .CSRFToken }}">
        <div class="ui form segment{{ if .Form.FieldErrors }} error{{ end }}">
            <div class="ui message">
                <div class="header">
                    Add email address for {{ .Form.User.Name }}
                </div>
                <p>The following addresses are registered for {{ .Form.User.Name }}:</p>
                <div class="ui list">
                    {{ range .Form.EmailAddresses }}
                        <div class="item">
                            <i class="mail icon"></i>
                            <div class="content">{{ . }}</div>
                        </div>
                    {{ end }}
                </div>
            </div>
            <div class="required field{{ if .Form.FieldErrors.email_address }} error{{ end }}">
                <label for="email_address">Email address:</label>
                <input id="email_address" name="email_address" type="text" value="{{ .Form.EmailAddress }}">
                {{ if .Form.FieldErrors.email_address }}
                    <span class="ui small error text">{{ .Form.FieldErrors.email_address }}</span>
                {{ end }}
            </div>
            <div class="required field{{ if .Form.FieldErrors.reasoning }} error{{ end }}">
                <label for="reasoning">Reasoning for the change</label>
                <textarea id="reasoning" name="reasoning" rows="2">{{ .Form.Reasoning }}</textarea>
                {{ if .Form.FieldErrors.reasoning }}
                    <span class="ui small error text">{{ .Form.FieldErrors.reasoning }}</span>
                {{ end }}
            </div>
            <button class="ui primary labeled icon button" type="submit"><i class="add icon"></i> Add email address
            </button>
            <a href="/users/{{ .Form.User.ID }}/" class="ui button">Cancel</a>
        </div>
    </form>
{{ end }}