<div
    data-service="users.get"
    data-name="user"
    data-event="load,users.update"
    data-param-user-id="{{router.params.id}}"
    data-success="trigger"
    data-success-param-trigger-events="users.get">

    <div class="cover">
        <h1 class="zone xl margin-bottom-large">
            <a data-ls-attrs="href=/console/users?project={{router.params.project}}" class="back text-size-small link-return-animation--start"><i class="icon-left-open"></i> Users</a>
            <br />

            <span data-ls-bind="{{user.name}}">&nbsp;</span>
            <span data-ls-if="{{user.name|escape}} === '' && {{user.email}} !== ''">Unknown</span>
            <span data-ls-if="{{user.name|escape}} === '' && {{user.email}} === ''">Anonymous User</span>
        </h1>
    </div>

    <div data-ui-modal class="modal width-medium box close" data-button-hide="on" data-open-event="open-update-name">
        <button type="button" class="close pull-end" data-ui-modal-close=""><i class="icon-cancel"></i></button>    
        
        <h2>Update Name</h2>

        <form name="users.updateName"
            data-analytics
            data-analytics-activity
            data-analytics-event="submit"
            data-analytics-category="console"
            data-analytics-label="Update User Name"
            data-service="users.updateName"
            data-scope="sdk"
            data-event="submit"
            data-success="trigger,alert"
            data-success-param-alert-text="User name was updated successfully"
            data-success-param-trigger-events="users.update"
            data-failure="alert"
            data-failure-param-alert-text="Failed to update user name"
            data-failure-param-alert-classname="error">
            
            <input type="hidden" disabled name="userId" data-ls-bind="{{user.$id}}">

            <label for="name">Name</label>
            <input name="name" id="name" type="text" autocomplete="off" data-ls-bind="{{user.name}}" required class="full-width" maxlength="128">

            <hr />

            <footer>
                <button type="submit" class="">Update</button> &nbsp; <button data-ui-modal-close="" type="button" class="reverse">Cancel</button>
            </footer>
        </form>
    </div>
    
    <div data-ui-modal class="modal width-medium box close" data-button-hide="on" data-open-event="open-update-email">
        <button type="button" class="close pull-end" data-ui-modal-close=""><i class="icon-cancel"></i></button>    
        
        <h2>Update Email</h2>

        <form name="users.updateEmail"
            data-analytics
            data-analytics-activity
            data-analytics-event="submit"
            data-analytics-category="console"
            data-analytics-label="Update User Email"
            data-service="users.updateEmail"
            data-scope="sdk"
            data-event="submit"
            data-success="trigger,alert"
            data-success-param-alert-text="User email was updated successfully"
            data-success-param-trigger-events="users.update"
            data-failure="alert"
            data-failure-param-alert-text="Failed to update user email"
            data-failure-param-alert-classname="error">
            
            <input type="hidden" disabled name="userId" data-ls-bind="{{user.$id}}">

            <label for="email">Email</label>
            <input name="email" id="email" type="text" autocomplete="off" data-ls-bind="{{user.email}}" required class="full-width" maxlength="128">

            <hr />

            <footer>
                <button type="submit" class="">Update</button> &nbsp; <button data-ui-modal-close="" type="button" class="reverse">Cancel</button>
            </footer>
        </form>
    </div>

    <div data-ui-modal class="modal width-medium box close" data-button-hide="on" data-open-event="open-update-phone">
        <button type="button" class="close pull-end" data-ui-modal-close=""><i class="icon-cancel"></i></button>    
        
        <h2>Update Phone</h2>

        <form name="users.updatePhone"
            data-analytics
            data-analytics-activity
            data-analytics-event="submit"
            data-analytics-category="console"
            data-analytics-label="Update User Phone"
            data-service="users.updatePhone"
            data-scope="sdk"
            data-event="submit"
            data-success="trigger,alert"
            data-success-param-alert-text="User phone was updated successfully"
            data-success-param-trigger-events="users.update"
            data-failure="alert"
            data-failure-param-alert-text="Failed to update user email"
            data-failure-param-alert-classname="error">
            
            <input type="hidden" disabled name="userId" data-ls-bind="{{user.$id}}">

            <label for="number">Phone number</label>
            <input name="number" id="number" type="text" autocomplete="off" data-ls-bind="{{user.phone}}" pattern="^\+?[1-9]\d{1,14}$" class="full-width" title="Phone number with a leading '+' and maximum of 15 digits (+123456789).">
            <div class="text-fade text-size-xs margin-top-negative-small margin-bottom">Phone number with a leading '+' and maximum of 15 digits (+123456789)</div>

            <hr />

            <footer>
                <button type="submit" class="">Update</button> &nbsp; <button data-ui-modal-close="" type="button" class="reverse">Cancel</button>
            </footer>
        </form>
    </div>

    <div data-ui-modal class="modal width-medium box close" data-button-hide="on" data-open-event="open-update-password">
        <button type="button" class="close pull-end" data-ui-modal-close=""><i class="icon-cancel"></i></button>    
        
        <h2>Update Password</h2>

        <form name="users.updatePassword"
            data-analytics
            data-analytics-activity
            data-analytics-event="submit"
            data-analytics-category="console"
            data-analytics-label="Update User Password"
            data-service="users.updatePassword"
            data-scope="sdk"
            data-event="submit"
            data-success="trigger,alert"
            data-success-param-alert-text="User password was updated successfully"
            data-success-param-trigger-events="users.update"
            data-failure="alert"
            data-failure-param-alert-text="Failed to update user password"
            data-failure-param-alert-classname="error">
            
            <input type="hidden" disabled name="userId" data-ls-bind="{{user.$id}}">

            <label for="password">Password</label>
            <input name="password" id="password" type="password" autocomplete="off" required class="full-width" maxlength="128">

            <hr />

            <footer>
                <button type="submit" class="">Update</button> &nbsp; <button data-ui-modal-close="" type="button" class="reverse">Cancel</button>
            </footer>
        </form>
    </div>

    <div data-ui-modal class="modal width-large box close" data-button-hide="on" data-open-event="open-json">
        <button type="button" class="close pull-end" data-ui-modal-close=""><i class="icon-cancel"></i></button>    
        
        <h2>JSON View</h2>

        <div class="margin-bottom">
            <input type="hidden" data-ls-bind="{{user}}" data-forms-code />
        </div>

        <button data-ui-modal-close="" type="button" class="reverse">Cancel</button>
    </div>

    <div class="zone xl">
        <ul class="phases clear" data-ui-phases data-selected="{{router.params.tab}}">
            <li data-state="/console/users/user?id={{router.params.id}}&project={{router.params.project}}">
                <h2>Overview</h2>

                <div data-ls-if="{{user.status}} === false" style="display: none" class="box padding-small danger margin-bottom-xxl text-align-center">
                    This user account is blocked.
                </div>

                <div class="row responsive margin-top-xl">
                    <div class="col span-8">
                        <label>&nbsp;</label>

                        <div class="box margin-bottom-large" style="padding-bottom: 5px">
                            <div class="text-align-center">
                                <img src="" data-ls-attrs="src={{user|avatar}}" data-size="200" alt="User Avatar" class="avatar huge margin-top-negative-xxl" />

                                <div class="margin-top-small margin-bottom-small" data-ls-bind="Member since {{user.registration|dateText}}"></div>
                                <hr class="margin-top-tiny margin-bottom-tiny" data-ls-if="{{user.email}}">
                                <div class="margin-top-small margin-bottom-small clear" data-ls-if="{{user.email}}">
                                    <span data-ls-bind="{{user.email}}" class="pull-start"></span>
                                    <span data-ls-if="{{user.emailVerification}} === true" class="pull-end">
                                        <span class="tag green">Verified</span>
                                    </span>
                                    <span data-ls-if="{{user.emailVerification}} !== true" class="pull-end">
                                        <span class="tag">Unverified</span>
                                    </span>
                                </div>
                                <hr class="margin-top-tiny margin-bottom-tiny" data-ls-if="{{user.phone}}">
                                <div class="margin-top-small margin-bottom-small clear" data-ls-if="{{user.phone}}">
                                    <span data-ls-bind="{{user.phone}}" class="pull-start"></span>
                                    <span data-ls-if="{{user.phoneVerification}} === true" class="pull-end">
                                        <span class="tag green">Verified</span>
                                    </span>
                                    <span data-ls-if="{{user.phoneVerification}} !== true" class="pull-end">
                                        <span class="tag">Unverified</span>
                                    </span>
                                </div>
                            </div>
                        </div>

                        <h3 class="margin-bottom">Preferences</h3>

                        <div class="box margin-bottom"
                            data-service="users.getPrefs"
                            data-name="user-prefs"
                            data-event="load"
                            data-param-user-id="{{router.params.id}}"
                            data-success="trigger"
                            data-success-param-trigger-events="users.getPrefs">

                            <div data-ls-if="!{{user-prefs|isEmptyObject}}">
                                <table class="vertical">
                                    <thead>
                                        <tr>
                                            <th>Key</th>
                                            <th>Value</th>
                                        </tr>
                                    </thead>
                                    <tbody data-ls-loop="user-prefs" data-ls-as="pref">
                                        <tr>
                                            <td data-title="Key: ">
                                                <span data-ls-bind="{{$index}}"></span>
                                            </td>
                                            <td data-title="Value: ">
                                                <span data-ls-bind="{{pref}}"></span>
                                            </td>
                                        </tr>
                                    </tbody>
                                </table>
                            </div>

                            <div data-ls-if="{{user-prefs|isEmptyObject}}">
                                No user preferences found
                            </div>
                        </div>

                        <h3 class="text-danger">Danger Zone</h3>

                        <div class="box danger margin-bottom">
                            <p>This is the area where you can delete this user.</p>

                            <p>By deleting this user you will lose all data associated with this user.</p>

                            <p>PLEASE NOTE: User deletion is irreversible.</p>

                            <form class="inline"
                                data-analytics
                                data-analytics-activity
                                data-analytics-event="submit"
                                data-analytics-category="console"
                                data-analytics-label="Delete User"
                                data-service="users.delete"
                                data-event="submit"
                                data-param-user-id="{{router.params.id}}"
                                data-success="alert,trigger,redirect"
                                data-confirm="Are you sure you want to delete this user?"
                                data-success-param-alert-text="Deleted user successfully"
                                data-success-param-trigger-events="users.delete"
                                data-success-param-redirect-url="/console/users?project={{router.params.project}}"
                                data-failure="alert"
                                data-failure-param-alert-text="Failed to delete user"
                                data-failure-param-alert-classname="error">
                                <input type="hidden" name="projectId" data-ls-bind="{{router.params.project}}" />

                                <button class="danger reverse" type="submit">Delete User</button>
                            </form>
                        </div>
                    </div>
                    <div class="col span-4 sticky-top">
                        <label>User ID</label>
                        <div class="input-copy margin-bottom">
                            <input id="uid" type="text" autocomplete="off" placeholder="" data-ls-bind="{{user.$id}}" disabled data-forms-copy>
                        </div>

                        <ul class="margin-bottom-large text-fade text-size-small">
                            <li class="margin-bottom-small"><i class="icon-angle-circled-right margin-start-tiny margin-end-tiny"></i> <button data-ls-ui-trigger="open-update-name" class="link text-size-small">Update Name</button></li>
                            <li class="margin-bottom-small"><i class="icon-angle-circled-right margin-start-tiny margin-end-tiny"></i> <button data-ls-ui-trigger="open-update-email" class="link text-size-small">Update Email</button></li>
                            <li class="margin-bottom-small"><i class="icon-angle-circled-right margin-start-tiny margin-end-tiny"></i> <button data-ls-ui-trigger="open-update-phone" class="link text-size-small">Update Phone</button></li>
                            <li class="margin-bottom-small"><i class="icon-angle-circled-right margin-start-tiny margin-end-tiny"></i> <button data-ls-ui-trigger="open-update-password" class="link text-size-small">Update Password</button></li>
                            <li class="margin-bottom-small"><i class="icon-angle-circled-right margin-start-tiny margin-end-tiny"></i>
                                <button data-ls-ui-trigger="open-json" 
                                    class="link text-size-small"
                                    data-analytics
                                    data-analytics-event="click"
                                    data-analytics-category="console"
                                    data-analytics-label="View as JSON (User)">
                                    View as JSON
                                </button>
                            </li>
                        </ul>

                        <div data-ls-if="{{user.email}} && {{user.emailVerification}} === false" style="display: none">
                            <form name="users.updateVerification"  class="margin-bottom"
                                data-analytics
                                data-analytics-activity
                                data-analytics-event="submit"
                                data-analytics-category="console"
                                data-analytics-label="Update Email Verification Status"
                                data-service="users.updateEmailVerification"
                                data-scope="sdk"
                                data-event="submit"
                                data-success="trigger,alert"
                                data-success-param-alert-text="User verification status was updated successfully"
                                data-success-param-trigger-events="users.update"
                                data-failure="alert"
                                data-failure-param-alert-text="Failed to update user verification status"
                                data-failure-param-alert-classname="error"
                            >
                                <input type="hidden" disabled name="userId" data-ls-bind="{{user.$id}}">
                                <input type="hidden" disabled name="emailVerification" value="true" data-cast-to="boolean">
                                <button type="submit" class="dark fill">Verify Email</button>
                            </form>
                        </div>

                        <div data-ls-if="{{user.email}} && {{user.emailVerification}} === true" style="display: none">
                            <form name="users.updateVerification" class="margin-bottom"
                                data-analytics
                                data-analytics-activity
                                data-analytics-event="submit"
                                data-analytics-category="console"
                                data-analytics-label="Update Email Verification Status"
                                data-service="users.updateEmailVerification"
                                data-scope="sdk"
                                data-event="submit"
                                data-success="trigger,alert"
                                data-success-param-alert-text="User verification status was updated successfully"
                                data-success-param-trigger-events="users.update"
                                data-failure="alert"
                                data-failure-param-alert-text="Failed to update user verification status"
                                data-failure-param-alert-classname="error"
                            >
                                <input type="hidden" disabled name="userId" data-ls-bind="{{user.$id}}">
                                <input type="hidden" disabled name="emailVerification" value="false" data-cast-to="boolean">
                                <button type="submit" class="dark fill">Unverify Email</button>
                            </form>
                        </div>

                        <div data-ls-if="{{user.phone}} && {{user.phoneVerification}} === false" style="display: none">
                            <form name="users.updateVerification"  class="margin-bottom"
                                data-analytics
                                data-analytics-activity
                                data-analytics-event="submit"
                                data-analytics-category="console"
                                data-analytics-label="Update Phone Verification Status"
                                data-service="users.updatePhoneVerification"
                                data-scope="sdk"
                                data-event="submit"
                                data-success="trigger,alert"
                                data-success-param-alert-text="User verification status was updated successfully"
                                data-success-param-trigger-events="users.update"
                                data-failure="alert"
                                data-failure-param-alert-text="Failed to update user verification status"
                                data-failure-param-alert-classname="error"
                            >
                                <input type="hidden" disabled name="userId" data-ls-bind="{{user.$id}}">
                                <input type="hidden" disabled name="phoneVerification" value="true" data-cast-to="boolean">
                                <button type="submit" class="dark fill">Verify Phone</button>
                            </form>
                        </div>

                        <div data-ls-if="{{user.phone}} && {{user.phoneVerification}} === true" style="display: none">
                            <form name="users.updateVerification" class="margin-bottom"
                                data-analytics
                                data-analytics-activity
                                data-analytics-event="submit"
                                data-analytics-category="console"
                                data-analytics-label="Update Phone Verification Status"
                                data-service="users.updatePhoneVerification"
                                data-scope="sdk"
                                data-event="submit"
                                data-success="trigger,alert"
                                data-success-param-alert-text="User verification status was updated successfully"
                                data-success-param-trigger-events="users.update"
                                data-failure="alert"
                                data-failure-param-alert-text="Failed to update user verification status"
                                data-failure-param-alert-classname="error"
                            >
                                <input type="hidden" disabled name="userId" data-ls-bind="{{user.$id}}">
                                <input type="hidden" disabled name="phoneVerification" value="false" data-cast-to="boolean">
                                <button type="submit" class="dark fill">Unverify Phone</button>
                            </form>
                        </div>

                        <div data-ls-if="{{user.status}} === true" style="display: none">
                            <form name="users.updateStatus" class="margin-bottom"
                                data-analytics
                                data-analytics-activity
                                data-analytics-event="submit"
                                data-analytics-category="console"
                                data-analytics-label="Update User Status"
                                data-service="users.updateStatus"
                                data-event="submit"
                                data-param-user-id="{{router.params.id}}"
                                data-success="alert,trigger"
                                data-success-param-alert-text="Blocked user successfully"
                                data-success-param-trigger-events="users.update"
                                data-failure="alert"
                                data-failure-param-alert-text="Failed to block user"
                                data-failure-param-alert-classname="error">

                                <button name="status" type="submit" class="danger fill" value="false" data-cast-to="boolean">Block Account</button>
                            </form>
                        </div>

                        <div data-ls-if="{{user.status}} === false" style="display: none">
                            <form name="users.updateStatus" class="margin-bottom"
                                data-analytics
                                data-analytics-activity
                                data-analytics-event="submit"
                                data-analytics-category="console"
                                data-analytics-label="Update User Status"
                                data-service="users.updateStatus"
                                data-event="submit"
                                data-param-user-id="{{router.params.id}}"
                                data-success="alert,trigger"
                                data-success-param-alert-text="Activated user successfully"
                                data-success-param-trigger-events="users.update"
                                data-failure="alert"
                                data-failure-param-alert-text="Failed to activate user"
                                data-failure-param-alert-classname="error">

                                <button name="status" type="submit" class="fill" value="true" data-cast-to="boolean">Activate Account</button>
                            </form>
                        </div>
                    </div>
                </div>
            </li>
            <li data-state="/console/users/user/memberships?id={{router.params.id}}&project={{router.params.project}}">
                <h2>Memberships</h2>

                <div
                    data-service="users.getMemberships"
                    data-name="memberships"
                    data-param-user-id="{{router.params.id}}"
                    data-event="load,users.update,teams.deleteMembership">

                    <div class="box margin-top margin-bottom" data-ls-if="{{memberships.memberships.length}} === 0" style="display: none" class="margin-top-xxl margin-bottom-xxl text-align-center">
                        <h3 class="text-bold margin-bottom-no">No memberships available.</h3>
                    </div>

                    <div data-ls-if="0 != {{memberships.total}}">
                        <div class="margin-bottom-small margin-end-small text-align-end text-size-small margin-top-negative text-fade"><span data-ls-bind="{{memberships.total}}"></span> memberships found</div>

                        <div class="box margin-bottom">
                            <ul data-ls-loop="memberships.memberships" data-ls-as="membership" class="list">
                                <li class="clear">
                                    <form class="pull-end"
                                        data-analytics
                                        data-analytics-activity
                                        data-analytics-event="submit"
                                        data-analytics-category="console"
                                        data-analytics-label="Delete Team Membership"
                                        data-service="teams.deleteMembership"
                                        data-event="submit"
                                        data-success="alert,trigger"
                                        data-confirm="Are you sure you want to remove that user from the team?"
                                        data-success-param-alert-text="Member Removed Successfully"
                                        data-success-param-trigger-events="teams.deleteMembership"
                                        data-failure="alert"
                                        data-failure-param-alert-text="Failed to Remove Member"
                                        data-failure-param-alert-classname="error">

                                        <input name="teamId" data-ls-attrs="id=leave-teamId-{{membership.teamId}}" type="hidden" data-ls-bind="{{membership.teamId}}">
                                        <input name="membershipId" data-ls-attrs="id=leave-membershipId-{{membership.$id}}" type="hidden" data-ls-bind="{{membership.$id}}">

                                        <button class="danger">Remove</button>
                                    </form>
                                    <div class="pull-start margin-end">
                                        <img src="" data-ls-attrs="src={{membership.teamName|avatar}},alt={{membership.teamName}}" data-size="60" class="avatar margin-end pull-start" loading="lazy" width="60" height="60" />
                                    </div>
                                    <a data-ls-attrs="href=/console/users/teams/team?id={{membership.teamId}}&project={{router.params.project}}" data-ls-bind="{{membership.teamName}}"></a>
                                    <div class="margin-top-small">
                                        <span data-ls-if="1 == {{membership.roles.length}}" class="text-fade tooltip" data-ls-bind="{{membership.roles.length}} role" data-ls-attrs="data-tooltip={{membership.roles|arraySentence}}"></span>
                                        <span  data-ls-if="2 <= {{membership.roles.length}}" class="text-fade tooltip" data-ls-bind="{{membership.roles.length}} roles" data-ls-attrs="data-tooltip={{membership.roles|arraySentence}}"></span>
                                        <span data-ls-if="false === {{membership.confirm}}" class="text-danger text-size-small">Pending Approval</span>
                                    </div>
                                </li>
                            </ul>
                        </div>
                    </div>
                </div>
            </li>
            <li data-state="/console/users/user/sessions?id={{router.params.id}}&project={{router.params.project}}">
                <h2>Sessions</h2>

                <div
                    data-service="users.getSessions"
                    data-name="sessions"
                    data-param-user-id="{{router.params.id}}"
                    data-event="load,users.update">

                    <div class="box margin-top margin-bottom" data-ls-if="{{sessions.sessions.length}} === 0" style="display: none" class="margin-top-xxl margin-bottom-xxl text-align-center">
                        <h3 class="text-bold margin-bottom-no">No sessions available.</h3>
                    </div>

                    <div data-ls-if="{{sessions.sessions.length}} !== 0" style="display: none">
                        <div class="box margin-bottom">
                            <ul data-ls-loop="sessions.sessions" data-ls-as="session" class="list">
                                <li class="clear">
                                    <form class="pull-end"
                                        data-analytics
                                        data-analytics-activity
                                        data-analytics-event="submit"
                                        data-analytics-category="console"
                                        data-analytics-label="Delete User Session"
                                        data-service="users.deleteSession"
                                        data-event="submit"
                                        data-loading="Loading..."
                                        data-success="trigger"
                                        data-success-param-trigger-events="users.update"
                                        data-failure="alert"
                                        data-failure-param-alert-text="Failed to logout session"
                                        data-failure-param-alert-classname="error">

                                        <input type="hidden" name="userId" data-ls-bind="{{router.params.id}}">
                                        <input type="hidden" name="sessionId" data-ls-bind="{{session.$id}}">
                                        <button class="danger">Logout</button>
                                    </form>
                                    <div class="pull-start margin-end avatar-container">
                                        <img onerror="this.onerror=null;this.className='avatar hide'" data-ls-if="{{session.clientCode|lowercase}} !== 'cli'" data-ls-attrs="src={{env.API}}/avatars/browsers/{{session.clientCode|lowercase}}?width=120&height=120&project={{env.PROJECT}},title={{session.clientName}},alt={{session.clientName}}" class="avatar" loading="lazy" width="60" height="60" />

                                        <img onerror="this.onerror=null;this.className='avatar hide'" data-ls-if="{{session.clientCode|lowercase}} === 'cli'" data-ls-attrs="src=/images/clients/terminal.png?buster=<?php echo APP_CACHE_BUSTER; ?>,title={{session.clientName}},alt={{session.clientName}}" class="avatar" loading="lazy" width="60" height="60" />
                                        
                                        <div data-ls-if="{{session.provider}} !== 'email'" class="corner">
                                            <img data-ls-attrs="src=/images/users/{{session.provider}}.png?buster=<?php echo APP_CACHE_BUSTER; ?>,title={{session.provider}},alt={{session.provider}}"  class="avatar xs" loading="lazy" width="30" height="30" />
                                        </div>
                                    </div>

                                    <span data-ls-bind="{{session.clientName}}"></span> <span data-ls-bind="{{session.clientVersion}}"></span> on <span data-ls-bind="{{session.deviceModel}}"></span> <span data-ls-bind="{{session.osName}}"></span> <span data-ls-bind="{{session.osVersion}}"></span>

                                    <div class="margin-top-small">
                                        <img onerror="this.onerror=null;this.className='avatar hide'" data-ls-if="{{session.countryCode}} !== '--'" data-ls-attrs="src={{env.API}}/avatars/flags/{{session.countryCode}}?width=120&height=120&project={{env.PROJECT}}" class="avatar xxs margin-end-small inline" />
                                        <small data-ls-bind="{{session.ip}}"></small> / <small data-ls-bind="{{session.countryName}}"></small>
                                    </div>
                                </li>
                            </ul>
                        </div>

                        <form class="inline margin-bottom-large"
                            data-analytics
                            data-analytics-activity
                            data-analytics-event="submit"
                            data-analytics-category="console"
                            data-analytics-label="Delete User Sessions"
                            data-service="users.deleteSessions"
                            data-param-user-id="{{router.params.id}}"
                            data-event="submit"
                            data-success="trigger"
                            data-success-param-trigger-events="users.update"
                            data-failure="alert"
                            data-failure-param-alert-text="Failed to logout all sessions"
                            data-failure-param-alert-classname="error">

                            <button class="danger">Logout from all sessions</button>
                        </form>
                    </div>
                </div>

            </li>
            <li data-state="/console/users/user/audit?id={{router.params.id}}&project={{router.params.project}}">
                <h2>Activity</h2>

                <div
                    data-service="users.getLogs"
                    data-name="logs"
                    data-param-user-id="{{router.params.id}}"
                    data-event="load,logs-load">

                    <div class="box margin-top margin-bottom" data-ls-if="{{logs.logs.length}} === 0" style="display: none" class="margin-top-xxl margin-bottom-xxl text-align-center">
                        <h3 class="text-bold margin-bottom-no">No logs available.</h3>
                    </div>

                    <div class="box" data-ls-if="{{logs.logs.length}} !== 0" style="display: none">
                        <table class="vertical small">
                            <thead>
                                <tr>
                                    <th width="140">Date</th>
                                    <th width="175">Event</th>
                                    <th>Client</th>
                                    <th width="90">Location</th>
                                    <th width="90">IP</th>
                                </tr>
                            </thead>
                            <tbody data-ls-loop="logs.logs" data-ls-as="log">
                                <tr>
                                    <td data-title="Date: "><span data-ls-bind="{{log.time|dateTime}}"></span></td>
                                    <td data-title="Event: "><span data-ls-bind="{{log.event}}"></span></td>
                                    <td data-title="Client: ">
                                        <img onerror="this.onerror=null;this.className='avatar hide'" data-ls-if="{{log.clientCode|lowercase}} !== 'cli'" data-ls-attrs="src={{env.API}}/avatars/browsers/{{log.clientCode|lowercase}}?width=80&height=80&project={{env.PROJECT}},title={{log.clientName}},alt={{log.clientName}}" class="avatar xxs inline margin-end-small" />
                                        
                                        <img onerror="this.onerror=null;this.className='avatar hide'" data-ls-if="{{log.clientCode|lowercase}} === 'cli'" data-ls-attrs="src=/images/clients/terminal.png?buster=<?php echo APP_CACHE_BUSTER; ?>,title={{log.clientName}},alt={{log.clientName}}" class="avatar xxs inline margin-end-small" />
                                        
                                        <span data-ls-if="({{log.clientName}})" data-ls-bind="{{log.clientName}} {{log.clientVersion}} on {{log.model}} {{log.osName}} {{log.osVersion}}"></span>
                                        <div data-ls-if="(!{{log.clientName}})" class="text-align-center text-fade">Unknown</div>
                                    </td>
                                    <td data-title="Location: ">
                                        <img onerror="this.onerror=null;this.className='avatar hide'" data-ls-if="{{log.countryCode}} !== '--'" data-ls-attrs="src={{env.API}}/avatars/flags/{{log.countryCode}}?width=80&height=80&project={{env.PROJECT}}" class="avatar xxs inline margin-end-small" />
                                        <span data-ls-bind="{{log.countryName}}"></span>
                                    </td>
                                    <td data-title="IP: "><span data-ls-bind="{{log.ip}}"></span></td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                </div>
            </li>
        </ul>
    </div>
</div>
