{{ define "title" }}Add user{{ end }}

{{ define "main" }}
    <form action="/new-user/" method="post">
        <input type="hidden" name="csrf_token" , value="{{ .CSRFToken }}">
        <div class="ui form segment{{ if .Form.FieldErrors }} error{{ end }}">
            <div class="required field{{ if .Form.FieldErrors.name }} error{{ end }}">
                <label for="name">Name</label>
                <input id="name" type="text" name="name" value="{{ .Form.Name }}">
                {{ if .Form.FieldErrors.name }}
                    <span class="ui small error text">{{ .Form.FieldErrors.name }}</span>
                {{ end }}
            </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="email" 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="magic icon"></i> Add user
            </button>
            <a href="/users/" class="ui button">Cancel</a>
        </div>
    </form>
{{ end }}