<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" data-ng-hide="createRealm">
                <ul class="rcue-tabs">
                    <li class="active"><a href="#/realms/{{realm.id}}">Settings</a></li>
                    <li data-ng-show="realm.social"><a href="#">Social</a></li>
                    <li><a href="#/realms/{{realm.id}}/roles">Roles</a></li>
                    <li><a href="#">Required Credentials</a></li>
                    <li><a href="#">Token Settings</a></li>
                </ul>
            </div>
            <div id="content">
                <h2 class="pull-left" data-ng-show="createRealm">New Realm</h2>
                <h2 class="pull-left" data-ng-hide="createRealm">Realm: <span>{{realm.realm}}</span></h2>
                <p class="subtitle" data-ng-show="createRealm"><span class="required">*</span> Required fields</p>
                <form name="realmForm" novalidate>
                    <fieldset>
                        <legend uncollapsed><span class="text">Required Settings</span> </legend>
                        <div class="form-group">
                            <label for="name">Name </label><span class="required" data-ng-show="createRealm">*</span>

                            <div class="controls">
                                <input type="text" id="name" name="name" data-ng-model="realm.realm" autofocus
                                       required>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="control-label">Enabled</label>

                            <div class="onoffswitch">
                                <input type="checkbox" data-ng-model="realm.enabled" class="onoffswitch-checkbox"
                                       name="enabled" id="enabled">
                                <label for="enabled" class="onoffswitch-label">
                                            <span class="onoffswitch-inner">
                                                <span class="onoffswitch-active">ON</span>
                                                <span class="onoffswitch-inactive">OFF</span>
                                            </span>
                                    <span class="onoffswitch-switch"></span>
                                </label>
                            </div>
                        </div>
                    </fieldset>
                    <fieldset>
                        <legend uncollapsed><span class="text">Login Options</span></legend>
                        <div class="form-group clearfix block">
                            <label class="control-label">Social login</label>
                            <div class="onoffswitch">
                                <input type="checkbox" data-ng-model="realm.social" class="onoffswitch-checkbox" name="social" id="social">
                                <label for="social" class="onoffswitch-label">
                                            <span class="onoffswitch-inner">
                                                <span class="onoffswitch-active">ON</span>
                                                <span class="onoffswitch-inactive">OFF</span>
                                            </span>
                                    <span class="onoffswitch-switch"></span>
                                </label>
                            </div>
                        </div>
                        <div class="form-group clearfix block">
                            <label class="control-label">User registration</label>
                            <div class="onoffswitch">
                                <input type="checkbox" data-ng-model="realm.userRegistration" class="onoffswitch-checkbox" name="userRegistration" id="userRegistration">
                                <label for="userRegistration" class="onoffswitch-label">
                                            <span class="onoffswitch-inner">
                                                <span class="onoffswitch-active">ON</span>
                                                <span class="onoffswitch-inactive">OFF</span>
                                            </span>
                                    <span class="onoffswitch-switch"></span>
                                </label>
                            </div>
                        </div>
                        <div class="form-group clearfix block">
                            <label class="control-label">Require SSL</label>
                            <div class="onoffswitch">
                                <input type="checkbox" data-ng-model="realm.requireSsl" class="onoffswitch-checkbox" name="requireSsl" id="requireSsl">
                                <label for="requireSsl" class="onoffswitch-label">
                                            <span class="onoffswitch-inner">
                                                <span class="onoffswitch-active">ON</span>
                                                <span class="onoffswitch-inactive">OFF</span>
                                            </span>
                                    <span class="onoffswitch-switch"></span>
                                </label>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="control-label">Cookie login allowed</label>
                            <div class="onoffswitch">
                                <input type="checkbox" data-ng-model="realm.cookieLoginAllowed" class="onoffswitch-checkbox" name="cookieLoginAllowed" id="cookieLoginAllowed">
                                <label for="cookieLoginAllowed" class="onoffswitch-label">
                                            <span class="onoffswitch-inner">
                                                <span class="onoffswitch-active">ON</span>
                                                <span class="onoffswitch-inactive">OFF</span>
                                            </span>
                                    <span class="onoffswitch-switch"></span>
                                </label>
                            </div>
                        </div>
                    </fieldset>
                    <fieldset>
                        <legend collapsed><span class="text">Token Settings</span></legend>
                        <div class="form-group input-select">
                            <label for="tokenLifespan">Token lifespan</label>
                            <div class="input-group">
                                <input type="text" data-ng-model="realm.tokenLifespan" id="tokenLifespan" name="tokenLifespan" class="tiny">
                                <div class="select-rcue">
                                    <select name="tokenLifespanUnit" data-ng-model="realm.tokenLifespanUnit">
                                        <option data-ng-selected="!realm.tokenLifespanUnit">Seconds</option>
                                        <option>Minutes</option>
                                        <option>Hours</option>
                                        <option>Days</option>
                                    </select>
                                </div>
                            </div>
                        </div>
                        <div class="form-group input-select">
                            <label for="accessCodeLifespan">Access code lifespan</label>
                            <div class="input-group">
                                <input type="text" data-ng-model="realm.accessCodeLifespan" id="accessCodeLifespan" name="accessCodeLifespan" class="tiny">
                                <div class="select-rcue">
                                    <select name="accessCodeLifespanUnit" data-ng-model="realm.accessCodeLifespanUnit">
                                        <option data-ng-selected="!realm.accessCodeLifespanUnit">Seconds</option>
                                        <option>Minutes</option>
                                        <option>Hours</option>
                                        <option>Days</option>
                                    </select>
                                </div>
                            </div>
                        </div>
                     </fieldset>
                    <fieldset>
                        <legend collapsed><span class="text">Default Credential Settings</span></legend>
                        <div class="form-group">
                            <label class="control-label">Required User Credentials</label>

                            <div class="controls">
                                <input style="width:250px" type="text" ui-select2="userCredentialOptions" ng-model="realm.requiredCredentials">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="control-label">Required Application Credentials</label>

                            <div class="controls">
                                <input style="width:250;height:25" type="text" ui-select2="userCredentialOptions" ng-model="realm.requiredApplicationCredentials">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="control-label">Required OAuth Credentials</label>

                            <div class="controls">
                                <input style="width:250px" type="text" ui-select2="userCredentialOptions" ng-model="realm.requiredOAuthClientCredentials">
                            </div>
                        </div>
                    </fieldset>
                    <div class="form-actions" data-ng-show="createRealm">
                        <button type="submit" data-ng-click="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="!createRealm">
                        <button type="submit" data-ng-click="save()" class="primary" data-ng-show="changed">Save
                            changes
                        </button>
                        <button type="submit" data-ng-click="reset()" data-ng-show="changed">Clear changes
                        </button>
                        <button type="submit" data-ng-click="remove()" class="danger" data-ng-hide="changed">
                            Delete
                        </button>
                    </div>

                </form>
            </div>
        </div>
        <div id="container-right-bg"></div>
    </div>
</div>