<div class="column is-half" is-user-card>
    <div class="box has-background-primary" style="overflow: hidden; height: 100%;">
        <article class="media">
            <div class="media-left">
                <figure class="image is-64x64">
                    <img width="64" height="64" class="is-rounded" loading="lazy" src="<%= user.avatar.hash ? user.avatar.url : `${baseURL}/img/defaultavatar` %>.webp" alt="<%= __("common.img.avatar", user.fullUsername) %>" onerror="this.onerror = null;this.src = '/img/defaultavatar.webp';console.log('<%= __("common.img.loadFail", user._id) %>');" >
                </figure>
            </div>
            <div style="overflow: hidden;" class="media-content">
                <div class="content">
                    <p>
                    <a href="<%= linkPrefix %>/users/<%= user._id %>" class="is-size-4 title has-text-default is-mobile">
                        <span><%= user.fullUsername %></span>
                    </a>
                        <br />
                        <%- include("../staffStanding.ejs") %>
                        <%
                            if (!user.staffTracking.punishments) {
                                user.staffTracking.punishments = {
                                    warnings: 0,
                                    strikes: 0
                                }
                            }
                        %>
                        <br />
                        <strong><%= __("page.staff.manager.strikes") %></strong> <a class="has-text-info" id="strikeModal-<%= user._id %>"><%= user.staffTracking.punishments.strikes.length %></a>  
                        <br />
                        <strong><%= __("page.staff.manager.warnings") %></strong> <a class="has-text-info" id="warningModal-<%= user._id %>"><%= user.staffTracking.punishments.warnings.length %></a>
                        <br />
                        <strong><%= __("page.staff.manager.onLeave") %></strong> <%= user.staffTracking.details.away.status ? __("page.staff.manager.onLeave.yes") : __("page.staff.manager.onLeave.no") %>
                        <br />
                        <br />
                        <strong><%= __("page.staff.manager.lastLogin.time") %></strong> <%= functions.parseDate(__, req.locale, user.staffTracking.lastLogin) %>
                        <br />
                        <strong><%= __("page.staff.manager.lastAccess.time") %></strong> <%= functions.parseDate(__, req.locale, user.staffTracking.lastAccessed.time) %>
                        <br />
                        <strong><%= __("page.staff.manager.lastAccess.page") %></strong> <%= user.staffTracking.lastAccessed.page %>
                        <br />
                        <br />
                        <a class="has-text-info" id="botStat-<%= user._id %>"><%= __("page.staff.manager.viewBotStat") %></a>
                    </p>
                </div>
                <div class="content-footer">
                    <div class="buttons">
                        <a href="<%= linkPrefix %>/staff/staff-manager/away/<%= user._id %>" class="button is-default is-outlined">
                            <span class="icon">
                                <i class="fas fa-lights-holiday"></i>
                            </span>
                            <span><%= __("page.staff.manager.setAway") %></span>
                        </a>
                        <a href="<%= linkPrefix %>/staff/staff-manager/standing/<%= user._id %>" class="button is-default is-outlined">
                            <span class="icon">
                                <i class="fas fa-star"></i>
                            </span>
                            <span><%= __("page.staff.manager.setStanding") %></span>
                        </a>
                        <a href="<%= linkPrefix %>/staff/staff-manager/punish/warn/<%= user._id %>" class="button is-default is-outlined">
                            <span class="icon">
                                <i class="fas fa-exclamation-triangle"></i>
                            </span>
                            <span><%= __("page.staff.manager.warn") %></span>
                        </a>
                        <a href="<%= linkPrefix %>/staff/staff-manager/punish/strike/<%= user._id %>" class="button is-default is-outlined">
                            <span class="icon">
                                <i class="fas fa-ban"></i>
                            </span>
                            <span><%= __("page.staff.manager.strike") %></span>
                        </a>
                    </div>
                </div>
            </div>
        </article>
    </div>
</div>
<div class="modal warningModal-<%= user._id %>">
    <div class="modal-background"></div>
    <div class="modal-card">
        <header class="modal-card-head is-warning">
            <p class="modal-card-title has-text-warning"><%= __("page.staff.manager.warnings.normal") %></p>
        </header>
        <section class="modal-card-body has-text-warning">
            <% if (user.staffTracking.punishments.warnings.length <= 0) { %>
                <%= __("page.staff.manager.punish.nothingHere") %>
            <% } else { %>
                <%- user.staffTracking.punishments.warnings.map(warning => include("../../partials/cards/warnings.ejs", { warning })).join("") %>
            <% } %>
        </section>
    </div>
    <script>document.querySelector("a#warningModal-<%= user._id %>").addEventListener("click",function(event){event.preventDefault();const modal=document.querySelector(".warningModal-<%= user._id %>");const html=document.querySelector("html");modal.classList.add("is-active");html.classList.add("is-clipped");modal.querySelector(".modal-background").addEventListener("click",function(e){e.preventDefault();modal.classList.remove("is-active");html.classList.remove("is-clipped")});document.querySelector("button#close-modal").addEventListener("click",function(e){e.preventDefault();modal.classList.remove("is-active");html.classList.remove("is-clipped")})})</script>
</div>
<div class="modal strikeModal-<%= user._id %>">
    <div class="modal-background"></div>
    <div class="modal-card">
        <header class="modal-card-head is-danger">
            <p class="modal-card-title has-text-danger"><%= __("page.staff.manager.strikes.normal") %></p>
        </header>
        <section class="modal-card-body has-text-danger">
            <% if (user.staffTracking.punishments.strikes.length <= 0) { %>
                <%= __("page.staff.manager.punish.nothingHere") %>
            <% } else { %>
                <%- user.staffTracking.punishments.strikes.map(strike => include("../../partials/cards/strikes.ejs", { strike })).join("") %>
            <% } %>
        </section>
    </div>
    <script>document.querySelector("a#strikeModal-<%= user._id %>").addEventListener("click",function(event){event.preventDefault();const modal=document.querySelector(".strikeModal-<%= user._id %>");const html=document.querySelector("html");modal.classList.add("is-active");html.classList.add("is-clipped");modal.querySelector(".modal-background").addEventListener("click",function(e){e.preventDefault();modal.classList.remove("is-active");html.classList.remove("is-clipped")});document.querySelector("button#close-modal").addEventListener("click",function(e){e.preventDefault();modal.classList.remove("is-active");html.classList.remove("is-clipped")})})</script>
</div>
<div class="modal botStat-<%= user._id %>">
    <div class="modal-background"></div>
    <div class="modal-card">
        <header class="modal-card-head is-info">
            <p class="modal-card-title has-text-info"><%= __("page.staff.manager.botStat") %></p>
        </header>
        <section class="modal-card-body has-text-info">
            <h4 class="is-size-4"><%= __("page.staff.manager.botStat.thisWeek") %></h4>
            <%- include("../botHandlingStats.ejs", { range: "thisWeek" }) %>
            
            <h4 class="is-size-4"><%= __("page.staff.manager.botStat.previousWeek") %></h4>
            <%- include("../botHandlingStats.ejs", { range: "prevWeek" }) %>

            <h4 class="is-size-4"><%= __("page.staff.manager.botStat.allTime") %></h4>
            <%- include("../botHandlingStats.ejs", { range: "allTime" }) %>
        </section>
    </div>
    <script>document.querySelector("a#botStat-<%= user._id %>").addEventListener("click",function(event){event.preventDefault();const modal=document.querySelector(".botStat-<%= user._id %>");const html=document.querySelector("html");modal.classList.add("is-active");html.classList.add("is-clipped");modal.querySelector(".modal-background").addEventListener("click",function(e){e.preventDefault();modal.classList.remove("is-active");html.classList.remove("is-clipped")});document.querySelector("button#close-modal").addEventListener("click",function(e){e.preventDefault();modal.classList.remove("is-active");html.classList.remove("is-clipped")})})</script>
</div>
