<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.realm}}">General</a></li>
                    <li data-ng-show="social"><a href="#/realms/{{realm.realm}}/social-settings">Social</a></li>
                    <li><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="createRealm">
                    <li><a href="#/realms/{{realm.realm}}">{{realm.realm}}</a></li>
                    <li><a href="#/realms/{{realm.realm}}">Settings</a></li>
                    <li class="active">General</li>
                </ol>
                <h2 class="pull-left" data-ng-show="createRealm">Add Realm</h2>
                <h2 data-ng-hide="createRealm"><span>{{realm.realm}}</span> General Settings</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 <span class="required" data-ng-show="createRealm">*</span></label>

                            <div class="controls">
                                <input type="text" id="name" name="name" data-ng-model="realm.realm" autofocus
                                       required>
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="enabled" class="control-label">Enabled</label>
                            <input ng-model="realm.enabled" name="enabled" id="enabled" onoffswitch />
                        </div>
                    </fieldset>
                    <fieldset>
                        <legend uncollapsed><span class="text">Login Options</span></legend>
                        <div class="form-group clearfix block">
                            <label for="social" class="control-label">Social login</label>
                            <input ng-model="realm.social" name="social" id="social" onoffswitch />
                        </div>
                        <div class="form-group clearfix block" data-ng-show="realm.social">
                            <label for="updateProfileOnInitialSocialLogin" class="control-label">Update profile on first social login</label>
                            <input ng-model="realm.updateProfileOnInitialSocialLogin" name="updateProfileOnInitialSocialLogin" id="updateProfileOnInitialSocialLogin" onoffswitch />
                        </div>
                        <div class="form-group clearfix block">
                            <label for="registrationAllowed" class="control-label">User registration</label>
                            <input ng-model="realm.registrationAllowed" name="registrationAllowed" id="registrationAllowed" onoffswitch />
                        </div>
                        <div class="form-group clearfix block">
                            <label for="resetPasswordAllowed" class="control-label">Reset password</label>
                            <input ng-model="realm.resetPasswordAllowed" name="resetPasswordAllowed" id="resetPasswordAllowed" onoffswitch />
                        </div>
                        <div class="form-group clearfix block">
                            <label for="verifyEmail" class="control-label">Verify email</label>
                            <input ng-model="realm.verifyEmail" name="verifyEmail" id="verifyEmail" onoffswitch />
                        </div>
                        <div class="form-group clearfix block">
                            <label for="requireSsl" class="control-label">Require SSL</label>
                            <input ng-model="realm.requireSsl" name="requireSsl" id="requireSsl" onoffswitch />
                        </div>
                    </fieldset>
                    <fieldset>
                        <legend uncollapsed><span class="text">Optional Settings</span></legend>
                        <div class="form-group">
                            <label for="loginTheme">Login Theme</label>

                            <div class="controls">
                                <select id="loginTheme" name="loginTheme" ng-model="realm.loginTheme" ng-options="t for t in serverInfo.themes.login"></select>
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="accountTheme">Account Theme</label>

                            <div class="controls">
                                <select id="accountTheme" name="accountTheme" ng-model="realm.accountTheme" ng-options="t for t in serverInfo.themes.account"></select>
                            </div>
                        </div>
                    </fieldset>


                    <div class="form-actions" data-ng-show="createRealm">
                        <button type="submit" kc-save class="primary" data-ng-show="changed">Save
                        </button>
                        <button type="submit" data-ng-click="cancel()">Cancel
                        </button>
                    </div>

                    <div class="form-actions" data-ng-show="!createRealm">
                        <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>

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