<%- include("../../../partials/header.ejs") %>
<link href="/css/theme/<%= preferredTheme %>/form.css?v=<%= cssVersion %>" media="screen, print" rel="stylesheet" />
<%- include("../../../partials/nav.ejs") %>
<section class="hero is-primary">
    <div class="hero-body">
        <div class="container has-text-centered">
            <br />
            <h1 class="title">
                <span class="icon is-medium iconalign">
                    <i aria-hidden="true" class="fad fa-crown has-text-default fa-1x"></i>
                </span>
                <br />
                <span><%= __("page.users.modifyRank") %></span>
            </h1>
            <h2 class="subtitle"><%= __("page.users.modifyRank.subtitle", targetUser.fullUsername) %></h2>
        </div>
    </div>
</section>
<div class="container">
    <div class="section">
        <form method="POST">
            <div class="field">
                <label class="label has-text-default"><%= __("page.users.modifyRank.primary") %></label>
                <% if (req.user.db.rank.admin === true) { %>
                    <input class="is-checkradio is-circle has-background-color is-danger" id="admin" type="radio" value="admin" name="rank" <% if (targetUser.rank.mod === true && targetUser.rank.assistant === true && targetUser.rank.admin === true) { %>checked="checked"<% } %>>
                    <label for="admin" class="has-text-danger"><%= __("common.rank.admin.short") %></label>
                    <input class="is-checkradio is-circle has-background-color is-orange" id="assistant" type="radio" value="assistant" name="rank" <% if (targetUser.rank.mod === true && targetUser.rank.assistant === true && targetUser.rank.admin === false) { %>checked="checked"<% } %>>
                    <label for="assistant" class="has-text-orange"><%= __("common.rank.assistant.short") %></label>
                    <input class="is-checkradio is-circle has-background-color is-success" id="mod" type="radio" value="mod" name="rank" <% if (targetUser.rank.mod === true && targetUser.rank.assistant === false && targetUser.rank.admin === false) { %>checked="checked"<% } %>>
                <% } %>
                <label for="mod" class="has-text-success"><%= __("common.rank.mod.short") %></label>
                <input class="is-checkradio is-circle has-background-color is-light" id="user" type="radio" value="user" name="rank" <% if (targetUser.rank.mod === false && targetUser.rank.assistant === false && targetUser.rank.admin === false) { %>checked="checked"<% } %>>
                <label for="user" class="has-text-light"><%= __("common.rank.user") %></label>
            </div>
            <br />
            <div class="field">
                <label class="label has-text-default"><%= __("common.rank.translator") %></label>
                <input id="translatorSwitch" type="checkbox" name="translator" class="switch is-rounded is-info" <% if (targetUser.rank.translator === true) { %>checked="checked"<% } %>>
                <label for="translatorSwitch"></label>
            </div>
            <br />
            <div class="field">
                <label class="label has-text-default"><%= __("common.rank.tester") %></label>
                <input id="testerSwitch" type="checkbox" name="tester" class="switch is-rounded is-link" <% if (targetUser.rank.tester === true) { %>checked="checked"<% } %>>
                <label for="testerSwitch"></label>
            </div>
            <br />
            <div class="field">
                <label class="label has-text-default"><%= __("common.rank.covid") %></label>
                <input id="covidSwitch" type="checkbox" name="covid" class="switch is-rounded is-magenta" <% if (targetUser.rank.covid === true) { %>checked="checked"<% } %>>
                <label for="covidSwitch"></label>
            </div>
            <br />
            <div class="field">
                <label class="label has-text-default"><%= __("common.rank.donator") %></label>
                <input id="verifySwitch" type="checkbox" name="premium" class="switch is-rounded is-red" <% if (targetUser.rank.premium === true) { %>checked="checked"<% } %>>
                <label for="verifySwitch"></label>
            </div>
            <br />
            <div class="field is-grouped">
                <div class="buttons">
                    <button class="button is-success">
                        <span class="icon"><i aria-hidden="true" class="fas fa-check-circle"></i></span>
                        <span><%= __("common.set") %></span>
                    </button>
                    <a class="button is-danger" href="/users/<%= targetUser._id %>">
                        <span class="icon"><i aria-hidden="true" class="fas fa-times-circle"></i></span>
                        <span><%= __("common.cancel") %></span>
                    </a>
                </div>
            </div>
        </form>
    </div>
</div>
<%- include("../../../partials/footer.ejs") %>
