<div class="bs-sidebar col-md-3 clearfix" data-ng-include data-src="resourceUrl + '/partials/realm-menu.html'"></div>
<div id="content-area" class="col-md-9" role="main">
    <kc-navigation-user></kc-navigation-user>
    <div id="content">
        <ol class="breadcrumb">
            <li><a href="#/realms/{{realm.realm}}/users">Users</a></li>
            <li><a href="#/realms/{{realm.realm}}/users/{{user.username}}">{{user.username}}</a></li>
            <li class="active">Role Mappings</li>
        </ol>
        <h2>User <span>{{user.username}}'s</span> Role Mappings</h2>
        <form class="form-horizontal" name="realmForm" novalidate kc-read-only="!access.manageUsers">

            <fieldset>
                <legend><span class="text">Realm Roles</span> <span tooltip-placement="right" tooltip="Realm level roles mapped to user." class="fa fa-info-circle"></span>
                </legend>
                <div class="form-group col-sm-10">
                    <div class="controls changing-selectors">
                        <div class="select-title">
                            <label class="control-label" for="available">Available Roles <span tooltip-placement="right" tooltip="Realm roles that can be assigned to the user." 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.name for r in realmRoles">
                            </select>
                        </div>
                        <div class="middle-buttons">
                            <button class="btn btn-default" type="submit" ng-click="addRealmRole()" tooltip="Assign role" tooltip-placement="right">
                                <span class="kc-icon-arrow-right">Move right</span>
                            </button>
                            <button class="btn btn-default" type="submit" ng-click="deleteRealmRole()" tooltip="Unassign role" tooltip-placement="left">
                                <span class="kc-icon-arrow-left">Move left</span>
                            </button>
                        </div>
                        <div class="select-title">
                            <label class="control-label" for="assigned">Assigned Roles <span tooltip-placement="right" tooltip="Realm roles mapped to the user" class="fa fa-info-circle"></span>
                            </label>
                            <select id="assigned" class="form-control" multiple size=5
                                    ng-multiple="true"
                                    ng-model="selectedRealmMappings"
                                    ng-options="r.name for r in realmMappings">
                            </select>
                        </div>
                        <div class="middle-buttons">
                            -
                        </div>
                        <div class="select-title">
                            <label class="control-label" for="realm-composite">Effective Roles <span tooltip-placement="right" tooltip="All realm role mappings.  Some roles here might be inherited from a mapped composite role." class="fa fa-info-circle"></span>
                            </label>
                            <select id="realm-composite" class="form-control" multiple size=5
                                    ng-disabled="true"
                                    ng-model="dummymodel"
                                    ng-options="r.name for r in realmComposite">
                            </select>
                        </div>
                    </div>
                </div>
            </fieldset>

            <fieldset ng-show="clients.length > 0">
                <legend><span class="text">Client Roles</span> </legend>
                <div class="form-group input-select">
                    <label class="col-sm-2 control-label" for="clients">Client <span tooltip-placement="right" tooltip="Select a client to view or modify additional roles to map." 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="Assignable roles from this client." 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.name for r in clientRoles">
                            </select>
                        </div>
                        <div class="middle-buttons">
                            <button class="btn btn-default" type="submit" ng-click="addClientRole()" tooltip="Assign role" tooltip-placement="right">
                                <span class="kc-icon-arrow-right">Move right</span>
                            </button>
                            <button class="btn btn-default" type="submit" ng-click="deleteClientRole()" tooltip="Unassign role" tooltip-placement="left">
                                <span class="kc-icon-arrow-left">Move left</span>
                            </button>
                        </div>
                        <div class="select-title">
                            <label class="control-label" for="assigned-client">Assigned Roles <span tooltip-placement="right" tooltip="Role mappings for this client." class="fa fa-info-circle"></span></label>
                            <select id="assigned-client" class="form-control" multiple size=5
                                    ng-multiple="true"
                                    ng-model="selectedClientMappings"
                                    ng-options="r.name for r in clientMappings">
                            </select>
                        </div>
                        <div class="middle-buttons">
                            -
                        </div>
                        <div class="select-title">
                            <label class="control-label" for="client-composite">Effective Roles <span tooltip-placement="right" tooltip="Role mappings for this client.  Some roles here might be inherited from a mapped composite role." class="fa fa-info-circle"></span></label>
                            <select id="client-composite" class="form-control" multiple size=5
                                    ng-disabled="true"
                                    ng-model="dummymodel"
                                    ng-options="r.name for r in clientComposite">
                            </select>
                        </div>
                    </div>
                </div>
            </fieldset>
        </form>
    </div>
</div>