<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</a></li>
        <li>{{client.clientId}}</li>
    </ol>

    <h1>{{client.clientId|capitalize}}</h1>

    <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">Active Sessions</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>Total number of active user sessions for this client.</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="3">
                <div class="pull-right">
                    <a class="btn btn-primary" ng-click="loadUsers()" tooltip-placement="left" tooltip="Warning, this is a potentially expensive operation depending on number of active sessions.">Show Sessions</a>
                </div>
            </th>
        </tr>
        <tr data-ng-show="sessions">
            <th>User</th>
            <th>From IP</th>
            <th>Session Start</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</button>
                    <button data-ng-click="previousPage()" class="prev" ng-disabled="query.first == 0">Previous page</button>
                    <button data-ng-click="nextPage()" class="next" ng-disabled="sessions.length < query.max">Next page</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>
        </tr>
        </tbody>
    </table>
</div>

<kc-menu></kc-menu>