<div class="bs-sidebar col-md-3 clearfix" data-ng-include data-src="'partials/realm-menu.html'"></div>
<div id="content-area" class="col-md-9" role="main">

    <ul class="nav nav-tabs nav-tabs-pf"  data-ng-show="!create">
        <li><a href="#/realms/{{realm.realm}}/oauth-clients/{{oauth.id}}">Settings</a></li>
        <li><a href="#/realms/{{realm.realm}}/oauth-clients/{{oauth.id}}/credentials">Credentials</a></li>
        <li class="active"><a href="#/realms/{{realm.realm}}/oauth-clients/{{oauth.id}}/scope-mappings">Scope</a></li>
        <li><a href="#/realms/{{realm.realm}}/oauth-clients/{{oauth.id}}/installation">Installation</a></li>
    </ul>

    <div id="content">
        <ol class="breadcrumb" data-ng-hide="create">
            <li><a href="#/realms/{{realm.realm}}">{{realm.realm}}</a></li>
            <li><a href="#/realms/{{realm.realm}}/oauth-clients">OAuth Clients</a></li>
            <li><a href="#/realms/{{realm.realm}}/oauth-clients/{{oauth.id}}">{{oauth.name}}</a></li>
            <li class="active">Scope</li>
        </ol>
        <h2><span>{{oauth.name}}</span> Scope Mappings</h2>
        <p class="subtitle"></p>
        <form class="form-horizontal" name="realmForm" novalidate>
            <fieldset>
                <legend uncollapsed><span class="text">Realm Roles</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</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 kc-vertical">
                            <button class="kc-button" type="submit" ng-click="addRealmRole()" tooltip="Move right" tooltip-placement="right">
                                <span class="kc-icon-arrow-right">Move right</span>
                            </button>
                            <button class="kc-button" type="submit" ng-click="deleteRealmRole()" tooltip="Move left" tooltip-placement="right">
                                <span class="kc-icon-arrow-left">Move left</span>
                            </button>
                        </div>
                        <div class="select-title">
                            <label class="control-label" for="assigned">Assigned Roles</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>
                </div>
            </fieldset>

            <fieldset ng-show="applications.length > 0">
                <legend collapsed><span class="text">Application Roles</span> </legend>
                <div class="form-group input-select">
                    <label class="control-label col-sm-2" for="applications">Application</label>
                    <div class="form-group col-sm-4">
                        <div class="select-kc">
                            <select id="applications" name="applications" ng-change="changeApplication()" ng-model="targetApp" ng-options="a.name for a in (applications)">
                                <option value="" selected> Select an Application </option>
                            </select>
                        </div>
                    </div>
                </div>
                <div class="form-group col-sm-10" ng-show="targetApp">
                    <div class="controls changing-selectors application">
                        <div class="select-title">
                            <label class="control-label" for="app-available">Available Roles</label>
                            <select id="app-available" class="form-control" multiple size="5"
                                    ng-multiple="true"
                                    ng-model="selectedApplicationRoles"
                                    ng-options="r.name for r in applicationRoles">
                            </select>
                        </div>
                        <div class="middle-buttons kc-vertical">
                            <button class="kc-button" type="submit" ng-click="addApplicationRole()" tooltip="Move right" tooltip-placement="right">
                                <span class="kc-icon-arrow-right">Move right</span>
                            </button>
                            <button class="kc-button" type="submit" ng-click="deleteApplicationRole()" tooltip="Move left" tooltip-placement="right">
                                <span class="kc-icon-arrow-left">Move left</span>
                            </button>
                        </div>
                        <div class="select-title">
                            <label class="control-label" for="app-assigned">Assigned Roles</label>
                            <select id="app-assigned" class="form-control" multiple size=5
                                    ng-multiple="true"
                                    ng-model="selectedApplicationMappings"
                                    ng-options="r.name for r in applicationMappings">
                            </select>
                        </div>
                    </div>
                </div>
            </fieldset>
        </form>
    </div>
</div>