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

    <ul class="nav nav-tabs">
        <li class="active"><a href="#/realms/{{realm.realm}}/roles">Realm Roles</a></li>
        <li><a href="#/realms/{{realm.realm}}/default-roles">Default Roles</a></li>
    </ul>

    <table class="table table-striped table-bordered">
        <thead>
        <tr>
            <th class="kc-table-actions" colspan="4">
                <div class="form-inline">
                    <div class="form-group">
                        <div class="input-group">
                            <input type="text" placeholder="Search..." data-ng-model="searchQuery" class="form-control search" onkeyup="if(event.keyCode == 13){$(this).next('I').click();}">
                            <div class="input-group-addon">
                                <i class="fa fa-search" type="submit"></i>
                            </div>
                        </div>
                    </div>

                    <div class="pull-right" data-ng-show="access.manageRealm">
                        <a id="createRole" class="btn btn-default" href="#/create/role/{{realm.realm}}">Add Role</a>
                    </div>
                </div>
            </th>
        </tr>
        <tr data-ng-show="roles && roles.length > 0">
            <th>Role Name</th>
            <th>Composite</th>
            <th>Description</th>
            <th>Actions</th>
        </tr>
        </thead>
        <tbody>
        <tr ng-repeat="role in roles | orderBy:'name' | filter:{name: searchQuery}">
            <td><a href="#/realms/{{realm.realm}}/roles/{{role.id}}">{{role.name}}</a></td>
            <td>{{role.composite}}</td>
            <td>{{role.description}}</td>
            <td class="kc-action-cell">
                <button class="btn btn-default btn-block btn-sm" kc-open="/realms/{{realm.realm}}/roles/{{role.id}}">Edit</button>
            </td>
        </tr>
        <tr data-ng-show="(roles | filter:{name: searchQuery}).length == 0">
            <td class="text-muted" colspan="3" data-ng-show="searchQuery">No results</td>
            <td class="text-muted" colspan="3" data-ng-hide="searchQuery">No realm roles available</td>
        </tr>
        </tbody>
    </table>
</div>

<kc-menu></kc-menu>