<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><a href="#/realms/{{realm.realm}}/roles">Realm Roles</a></li>
        <li class="active"><a href="#/realms/{{realm.realm}}/default-roles">Default Roles</a></li>
    </ul>
    <form class="form-horizontal" name="realmForm" novalidate kc-read-only="!access.manageRealm">
        <div class="form-group">
            <label class="col-md-2 control-label" class="control-label">Realm Roles</label>

            <div class="col-md-10">
                <div class="row">
                    <div class="col-md-4">
                        <label class="control-label" for="available">Available Roles</label>
                        <kc-tooltip>Realm level roles that can be assigned.</kc-tooltip>
                        <select id="available" class="form-control" multiple size="5"
                                ng-multiple="true"
                                ng-model="selectedRealmRoles"
                                ng-options="r for r in availableRealmRoles | orderBy:'toString()'">
                        </select>
                        <button class="btn btn-default" type="submit" ng-click="addRealmDefaultRole()" tooltip="Assign role" tooltip-placement="right">
                            Add selected <i class="fa fa-angle-double-right"></i>
                        </button>
                    </div>
                    <div class="col-md-4">
                        <label class="control-label" for="assigned">Realm Default Roles</label>
                        <kc-tooltip>Realm level roles assigned to new users.</kc-tooltip>
                        <select id="assigned" class="form-control" multiple size=5
                                ng-multiple="true"
                                ng-model="selectedRealmDefRoles"
                                ng-options="r for r in realm.defaultRoles | orderBy:'toString()'">
                        </select>
                        <button class="btn btn-default" type="submit" ng-click="deleteRealmDefaultRole()" tooltip="Unassign role" tooltip-placement="left">
                            <i class="fa fa-angle-double-left"></i> Remove selected
                        </button>
                    </div>
                </div>
            </div>
        </div>

        <div class="form-group">
            <label class="col-md-2 control-label" class="control-label">
                <span>Client Roles</span>
                <select class="form-control" id="clients" name="clients" ng-change="changeClient()" ng-model="client" ng-options="a.clientId for a in clients" ng-disabled="false"></select>
            </label>
            <div class="col-md-10" data-ng-show="client">
                <div class="row" data-ng-hide="client">
                    <div class="col-md-4"><span class="text-muted">Select client to view roles for client</span></div>
                </div>
                <div class="row" data-ng-show="client">
                    <div class="col-md-4">
                        <label class="control-label" for="available-client">Available Roles</label>
                        <kc-tooltip>Roles from this client that are assignable as a default.</kc-tooltip>
                        <select id="available-client" class="form-control" multiple size="5"
                                ng-multiple="true"
                                ng-model="selectedClientRoles"
                                ng-options="r for r in availableClientRoles | orderBy:'toString()'">
                        </select>
                        <button class="btn btn-default" type="submit" ng-click="addClientDefaultRole()" tooltip="Assign role" tooltip-placement="right">
                            Add selected <i class="fa fa-angle-double-right"></i>
                        </button>
                    </div>
                    <div class="col-md-4">
                        <label class="control-label" for="assigned-client">Client Default Roles</label>
                        <kc-tooltip>Roles from this client assigned as a default role.</kc-tooltip>
                        <select id="assigned-client" class="form-control" multiple size=5
                                ng-multiple="true"
                                ng-model="selectedClientDefRoles"
                                ng-options="r for r in client.defaultRoles | orderBy:'toString()'">
                        </select>
                        <button class="btn btn-default" type="submit" ng-click="rmClientDefaultRole()" tooltip="Unassign role" tooltip-placement="left">
                            <i class="fa fa-angle-double-left"></i> Remove selected
                        </button>
                    </div>
                </div>
            </div>
        </div>
    </form>
</div>

<kc-menu></kc-menu>