<header class="modal-header">
    <h1>Invite a New User</h1>
</header>
<a class="close" href="" title="Close" {{action "closeModal"}}>{{svg-jar "close"}}<span class="hidden">Close</span></a>

<div class="modal-body">
    <fieldset>
        {{#gh-form-group errors=errors hasValidated=hasValidated property="email"}}
            <label for="new-user-email">Email Address</label>
            {{gh-text-input
                class="email"
                id="new-user-email"
                type="email"
                placeholder="Email Address"
                name="email"
                autofocus="autofocus"
                autocapitalize="off"
                autocorrect="off"
                value=(readonly email)
                input=(action (mut email) value="target.value")
                keyEvents=(hash
                    Enter=(action "confirm")
                )
                focus-out=(action "validate" "email")
            }}
            {{gh-error-message errors=errors property="email"}}
        {{/gh-form-group}}


        {{#gh-form-group class="for-select" errors=errors hasValidated=hasValidated property="role"}}
            <label for="new-user-role">Role</label>
            <span class="gh-select">
                {{one-way-select
                    id="new-user-role"
                    name="role"
                    options=(readonly roles)
                    optionValuePath="id"
                    optionLabelPath="name"
                    value=role
                    update=(action "setRole")
                }}
                {{svg-jar "arrow-down-small"}}
            </span>
            {{gh-error-message errors=errors property="role"}}
        {{/gh-form-group}}
    </fieldset>
</div>

<div class="modal-footer">
    {{gh-task-button "Send invitation now"
        successText="Sent"
        task=sendInvitation
        class="gh-btn gh-btn-green gh-btn-icon"
        disabled=fetchRoles.isRunning}}
</div>
