<div id="wrapper" class="container">
    <div class="row">
        <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">
            <div class="top-nav">
                <ul class="rcue-tabs">
                    <li><a href="#/realms/{{realm.realm}}">General</a></li>
                    <li data-ng-show="realm.social"><a href="#/realms/{{realm.realm}}/social-settings">Social</a></li>
                    <li class="active"><a href="#/realms/{{realm.realm}}/roles">Roles</a></li>
                    <li><a href="#/realms/{{realm.realm}}/default-roles">Default Roles</a></li>
                    <li><a href="#/realms/{{realm.realm}}/required-credentials">Credentials</a></li>
                    <li><a href="#/realms/{{realm.realm}}/token-settings">Token</a></li>
                    <li><a href="#/realms/{{realm.realm}}/keys-settings">Keys</a></li>
                    <li><a href="#/realms/{{realm.realm}}/smtp-settings">Email</a></li>
                </ul>
            </div>
            <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}}">Settings</a></li>
                    <li><a href="#/realms/{{realm.realm}}/roles">Roles</a></li>
                    <li class="active">{{role.name}}</li>
                </ol>
                <h2 class="pull-left" data-ng-hide="create"><span>{{realm.realm}}</span> {{role.name}}</h2>
                <ol class="breadcrumb" data-ng-show="create">
                    <li><a href="#/realms/{{realm.realm}}">{{realm.realm}}</a></li>
                    <li><a href="#/realms/{{realm.realm}}">Settings</a></li>
                    <li><a href="#/realms/{{realm.realm}}/roles">Roles</a></li>
                    <li class="active">Add Role</li>
                </ol>
                <h2 class="pull-left" data-ng-show="create"><span>{{realm.realm}}</span> Add Role</h2>
                <p class="subtitle" data-ng-show="create"><span class="required">*</span> Required fields</p>
                <form name="realmForm" novalidate>
                    <fieldset class="border-top">
                        <div class="form-group">
                            <label for="name">Role name <span class="required" data-ng-show="create">*</span></label>

                            <div class="controls">
                                <input type="text" id="name" name="name" data-ng-model="role.name" autofocus
                                       required data-ng-readonly="!create">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="description">Description </label>

                            <div class="controls">
                                <textarea rows="5" cols="50" id="description" name="description" data-ng-model="role.description"></textarea>
                            </div>
                        </div>
                    </fieldset>
                    <div class="form-actions" data-ng-show="create">
                        <button type="submit" kc-save class="primary" data-ng-show="changed">Save
                        </button>
                        <button type="submit" data-ng-click="cancel()" data-ng-click="cancel()"
                                data-ng-show="changed">Cancel
                        </button>
                    </div>

                    <div class="form-actions" data-ng-show="!create">
                        <button type="submit" kc-save class="primary" data-ng-show="changed">Save
                        </button>
                        <button type="submit" kc-reset data-ng-show="changed">Clear changes
                        </button>
                        <button type="submit" data-ng-click="remove()" class="destructive" data-ng-hide="changed">
                            Delete
                        </button>
                    </div>

                    <fieldset data-ng-show="!create">
                        <legend collapsed><span class="text">Composite Realm Roles</span> </legend>
                        <div class="form-group">
                            <div class="controls changing-selectors">
                                <div class="select-title">
                                    <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">
                                    <button type="submit" ng-click="addRealmRole()" tooltip="Move right" tooltip-placement="right"><span class="icon-arrow-right">Move right</span></button>
                                    <button type="submit" ng-click="deleteRealmRole()" tooltip="Move left" tooltip-placement="right"><span class="icon-arrow-left">Move left</span></button>
                                </div>
                                <div class="select-title">
                                    <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 && !create">
                        <legend collapsed><span class="text">Composite Application Roles</span> </legend>
                        <div class="form-group input-select">
                            <label for="applications">Application</label>
                            <div class="input-group">
                                <div class="select-rcue">
                                    <select id="applications" name="applications" ng-change="changeApplication()" ng-model="compositeApp" ng-options="a.name for a in applications">
                                        <option value="" selected> Select an Application...</option>
                                    </select>
                                </div>
                            </div>
                        </div>
                        <div class="form-group" ng-show="compositeApp">
                            <div class="controls changing-selectors application">
                                <div class="select-title">
                                    <label for="available-app">Available Roles</label>
                                    <select id="available-app" 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">
                                    <button type="submit" ng-click="addApplicationRole()" tooltip="Move right" tooltip-placement="right"><span class="icon-arrow-right">Move right</span></button>
                                    <button type="submit" ng-click="deleteApplicationRole()" tooltip="Move left" tooltip-placement="right"><span class="icon-arrow-left">Move left</span></button>
                                </div>
                                <div class="select-title">
                                    <label for="assigned-app">Assigned Roles</label>
                                    <select id="assigned-app" 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>
        <div id="container-right-bg"></div>
    </div>
</div>