<div class="bs-sidebar col-sm-3 " data-ng-include data-src="resourceUrl + '/partials/realm-menu.html'"></div>
<div id="content-area" class="col-sm-9" role="main">
    <ul class="nav nav-tabs nav-tabs-pf">
        <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>
    <h2></h2>
    <div id="content">
        <h2><span>{{realm.realm}}</span> Default Roles <span tooltip-placement="right" tooltip="Role mappings to assign to newly created users.  This includes registration, social login, and users created in the admin console." class="fa fa-info-circle"></span></h2>
        <form class="form-horizontal" name="realmForm" novalidate kc-read-only="!access.manageRealm">
            <fieldset>
                <legend><span class="text">Realm Default Roles</span> </legend>
                <div class="form-group">
                    <div class="controls changing-selectors col-sm-10">
                        <div class="select-title">
                            <label class="control-label" for="available">Available Roles <span tooltip-placement="right" tooltip="Realm level roles that can be assigned." class="fa fa-info-circle"></span></label>
                            <select id="available" class="form-control" multiple size="5"
                                    ng-multiple="true"
                                    ng-model="selectedRealmRoles"
                                    ng-options="r for r in availableRealmRoles">
                            </select>
                        </div>
                        <div class="middle-buttons">
                            <button class="btn btn-default" type="submit" ng-click="addRealmDefaultRole()" tooltip="Assign role" tooltip-placement="right">
                                <span class="kc-icon-arrow-right"><span>Move right</span></span>
                            </button>
                            <button class="btn btn-default" type="submit" ng-click="deleteRealmDefaultRole()" tooltip="Unassign role" tooltip-placement="left">
                                <span class="kc-icon-arrow-left"><span>Move left</span></span>
                            </button>
                        </div>
                        <div class="select-title">
                            <label class="control-label" for="assigned">Realm Default Roles <span tooltip-placement="right" tooltip="Realm level roles assigned to new users." class="fa fa-info-circle"></span></label>
                            <select id="assigned" class="form-control" multiple size=5
                                    ng-multiple="true"
                                    ng-model="selectedRealmDefRoles"
                                    ng-options="r for r in realm.defaultRoles">
                            </select>
                        </div>
                    </div>
                </div>
            </fieldset>

            <fieldset ng-show="clients.length > 0">
                <legend><span class="text">Client Default Roles</span> </legend>
                <div class="form-group input-select">
                    <label class="col-sm-2 control-label" for="clients">Client <span tooltip-placement="top" tooltip="Select an client to view/modify assigned default roles." class="fa fa-info-circle"></span></label>
                    <div class="col-sm-4">
                        <div class="input-group">
                            <div class="select-kc">
                                <select id="clients" name="clients" ng-change="changeClient()" ng-model="client" ng-options="a.clientId for a in clients" ng-disabled="false">
                                    <option value="" selected> Select a Client...</option>
                                </select>
                            </div>
                        </div>
                    </div>

                </div>
                <div class="form-group" ng-show="client">
                    <div class="controls changing-selectors col-sm-10">
                        <div class="select-title">
                            <label class="control-label" for="available-client">Available Roles <span tooltip-placement="right" tooltip="Roles from this client that are assignable as a default." class="fa fa-info-circle"></span></label>
                            <select id="available-client" class="form-control" multiple size="5"
                                    ng-multiple="true"
                                    ng-model="selectedClientRoles"
                                    ng-options="r for r in availableClientRoles">
                            </select>
                        </div>
                        <div class="middle-buttons">
                            <button class="btn btn-default" type="submit" ng-click="addClientDefaultRole()" tooltip="Assign role" tooltip-placement="right">
                                <span class="kc-icon-arrow-right"><span>Move right</span></span>
                            </button>
                            <button class="btn btn-default" type="submit" ng-click="rmClientDefaultRole()" tooltip="Unassign role" tooltip-placement="left">
                                <span class="kc-icon-arrow-left"><span>Move left</span></span>
                            </button>
                        </div>
                        <div class="select-title">
                            <label class="control-label" for="assigned-client">Client Default Roles <span tooltip-placement="right" tooltip="Roles from this client assigned as a default role." class="fa fa-info-circle"></span></label>
                            <select id="assigned-client" class="form-control" multiple size=5
                                    ng-multiple="true"
                                    ng-model="selectedClientDefRoles"
                                    ng-options="r for r in client.defaultRoles">
                            </select>
                        </div>
                    </div>
                </div>
            </fieldset>
        </form>
    </div>
</div>