<div class="col-sm-9 col-md-10 col-sm-push-3 col-md-push-2">

    <ol class="breadcrumb">
        <li><a href="#/realms/{{realm.realm}}/clients">{{:: 'clients' | translate}}</a></li>
        <li>{{client.clientId}}</li>
    </ol>

    <kc-tabs-client></kc-tabs-client>

    <form class="form-horizontal" name="sessionStats">
        <fieldset class="border-top">
            <div class="form-group">
                <label class="col-md-2 control-label" for="activeSessions">{{:: 'offline-tokens' | translate}}</label>
                <div class="col-md-6">
                    <input class="form-control" type="text" id="activeSessions" name="activeSessions" data-ng-model="count" ng-disabled="true">
                </div>
                <kc-tooltip>{{:: 'offline-tokens.tooltip' | translate}}</kc-tooltip>
            </div>
        </fieldset>
    </form>
    <table class="table table-striped table-bordered" data-ng-show="count > 0">
        <thead>
        <tr>
            <th class="kc-table-actions" colspan="4">
                <div class="pull-right">
                    <a class="btn btn-default" ng-click="loadUsers()" tooltip-placement="left" tooltip-trigger="mouseover mouseout" tooltip="{{:: 'show-offline-tokens.tooltip' | translate}}">{{:: 'show-offline-tokens' | translate}}</a>
                </div>
            </th>
        </tr>
        <tr data-ng-show="sessions">
            <th>{{:: 'user' | translate}}</th>
            <th>{{:: 'from-ip' | translate}}</th>
            <th>{{:: 'token-issued' | translate}}</th>
            <th>{{:: 'last-access' | translate}}</th>
        </tr>
        </thead>
        <tfoot data-ng-show="sessions && (sessions.length >= 5 || query.first != 0)">
        <tr>
            <td colspan="7">
                <div class="table-nav">
                    <button data-ng-click="firstPage()" class="first" ng-disabled="query.first == 0">{{:: 'first-page' | translate}}</button>
                    <button data-ng-click="previousPage()" class="prev" ng-disabled="query.first == 0">{{:: 'previous-page' | translate}}</button>
                    <button data-ng-click="nextPage()" class="next" ng-disabled="sessions.length < query.max">{{:: 'next-page' | translate}}</button>
                </div>
            </td>
        </tr>
        </tfoot>
        <tbody>
        <tr data-ng-repeat="session in sessions">
            <td><a href="#/realms/{{realm.realm}}/users/{{session.userId}}">{{session.username}}</a></td>
            <td>{{session.ipAddress}}</td>
            <td>{{session.start | date:'medium'}}</td>
            <td>{{session.lastAccess | date:'medium'}}</td>
        </tr>
        </tbody>
    </table>
</div>

<kc-menu></kc-menu>