{{ define "title"}}{{ t "page.new_user.title" }}{{ end }}

{{ define "page_header"}}
<section class="page-header" aria-labelledby="page-header-title">
    <h1 id="page-header-title">{{ t "page.new_user.title" }}</h1>
    {{ template "settings_menu" dict "user" .user }}
</section>
{{ end }}

{{ define "content"}}
<form action="{{ routePath "/user/save" }}" method="post" autocomplete="off">
    <input type="hidden" name="csrf" value="{{ .csrf }}">

    {{ if .errorMessage }}
        <div role="alert" class="alert alert-error">{{ .errorMessage }}</div>
    {{ end }}

    <label for="form-username">{{ t "form.user.label.username" }}</label>
    <input type="text" name="username" id="form-username" value="{{ .form.Username }}" autocomplete="username" spellcheck="false" required autofocus>

    <label for="form-password">{{ t "form.user.label.password" }}</label>
    <input type="password" name="password" id="form-password" value="{{ .form.Password }}" autocomplete="new-password" required>

    <label for="form-confirmation">{{ t "form.user.label.confirmation" }}</label>
    <input type="password" name="confirmation" id="form-confirmation" value="{{ .form.Confirmation }}" autocomplete="new-password" required>

    <label><input type="checkbox" name="is_admin" value="1" {{ if .form.IsAdmin }}checked{{ end }}> {{ t "form.user.label.admin" }}</label>

    <div class="buttons">
        <button type="submit" class="button button-primary" data-label-loading="{{ t "form.submit.saving" }}">{{ t "action.save" }}</button> {{ t "action.or" }} <a href="{{ routePath "/users" }}">{{ t "action.cancel" }}</a>
    </div>
</form>
{{ end }}
