<div class="bs-sidebar col-sm-3 " data-ng-include data-src="'partials/realm-menu.html'"></div>
<div id="content-area" class="col-sm-9" role="main">
    <kc-navigation data-kc-current="general" data-kc-realm="realm.realm" data-kc-social="social"></kc-navigation>
    <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>
        <div data-ng-show="access.viewRealm">
            <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 class="form-horizontal" name="realmForm" novalidate kc-read-only="!access.manageRealm">
                <fieldset>
                    <legend class="aj-collapse open"><span class="text">Required Settings</span></legend>
                    <div class="form-group">
                        <label class="col-sm-2 control-label" for="name">Name <span class="required" data-ng-show="createRealm">*</span></label>

                        <div class="col-sm-4">
                            <input class="form-control" type="text" id="name" name="name" data-ng-model="realm.realm" autofocus required>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label" for="enabled">Enabled</label>
                        <div class="col-sm-4">
                            <input ng-model="realm.enabled" name="enabled" id="enabled" onoffswitch />
                        </div>
                    </div>
                </fieldset>
                <fieldset>
                    <legend><span class="text">Login Options</span></legend>
                    <div class="form-group">
                        <label class="col-sm-2 control-label" for="social">Social login</label>
                        <div class="col-sm-4">
                            <input ng-model="realm.social" name="social" id="social" onoffswitch />
                        </div>
                    </div>
                    <div class="form-group" data-ng-show="realm.social">
                        <label class="col-sm-2 control-label" for="updateProfileOnInitialSocialLogin">Update profile on first social login</label>
                        <div class="col-sm-4">
                            <input ng-model="realm.updateProfileOnInitialSocialLogin" name="updateProfileOnInitialSocialLogin" id="updateProfileOnInitialSocialLogin" onoffswitch />
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="registrationAllowed" class="col-sm-2 control-label">User registration</label>
                        <div class="col-sm-4">
                            <input ng-model="realm.registrationAllowed" name="registrationAllowed" id="registrationAllowed" onoffswitch />
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="resetPasswordAllowed" class="col-sm-2 control-label">Forget password</label>
                        <div class="col-sm-4">
                            <input ng-model="realm.resetPasswordAllowed" name="resetPasswordAllowed" id="resetPasswordAllowed" onoffswitch />
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label" for="rememberMe">Remember Me</label>
                        <div class="col-sm-4">
                            <input ng-model="realm.rememberMe" name="rememberMe" id="rememberMe" onoffswitch />
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="verifyEmail" class="col-sm-2 control-label">Verify email</label>
                        <div class="col-sm-4">
                            <input ng-model="realm.verifyEmail" name="verifyEmail" id="verifyEmail" onoffswitch />
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="passwordCredentialGrantAllowed" class="col-sm-2 control-label">Direct Grant API</label>
                        <div class="col-sm-4">
                            <input ng-model="realm.passwordCredentialGrantAllowedpasswordCredentialGrantAllowed" name="passwordCredentialGrantAllowed" id="passwordCredentialGrantAllowed" onoffswitch />
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="requireSsl" class="col-sm-2 control-label">Require SSL</label>
                        <div class="col-sm-4">
                            <input ng-model="realm.requireSsl" name="requireSsl" id="requireSsl" onoffswitch />
                        </div>
                    </div>
                </fieldset>
                <fieldset>
                    <legend><span class="text">Optional Settings</span></legend>
                    <div class="form-group">
                        <label class="col-sm-2 control-label" for="loginTheme">Login Theme</label>
                        <div class="col-sm-4">
                            <div class="select-kc">
                                <select id="loginTheme"
                                        ng-model="realm.loginTheme"
                                        ng-options="o as o for o in serverInfo.themes.login">
                                    <option value="" disabled selected>Select one...</option>
                                </select>
                            </div>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label" for="accountTheme">Account Theme</label>
                        <div class="col-sm-4">
                            <div class="select-kc">
                                <select id="accountTheme"
                                        ng-model="realm.accountTheme"
                                        ng-options="o as o for o in serverInfo.themes.account">
                                    <option value="" disabled selected>Select one...</option>
                                </select>
                            </div>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label" for="adminTheme">Admin Console Theme</label>
                        <div class="col-sm-4">
                            <div class="select-kc">
                                <select id="adminTheme"
                                        ng-model="realm.adminTheme"
                                        ng-options="o as o for o in serverInfo.themes.admin">
                                    <option value="" disabled selected>Select one...</option>
                                </select>
                            </div>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label" for="emailTheme">Email Theme</label>
                        <div class="col-sm-4">
                            <div class="select-kc">
                                <select id="emailTheme"
                                        ng-model="realm.emailTheme"
                                        ng-options="o as o for o in serverInfo.themes.email">
                                    <option value="" disabled selected>Select one...</option>
                                </select>
                            </div>
                        </div>
                    </div>
                </fieldset>

                <div class="pull-right form-actions" data-ng-show="createRealm && access.manageRealm">
                    <button kc-cancel data-ng-click="cancel()">Cancel</button>
                    <button kc-save data-ng-show="changed">Save</button>
                </div>
                <div class="pull-right form-actions" data-ng-show="!createRealm && access.manageRealm">
                    <button kc-reset data-ng-show="changed">Clear changes</button>
                    <button kc-save  data-ng-show="changed">Save</button>
                    <button kc-delete data-ng-click="remove()" data-ng-hide="changed">Delete</button>
                </div>
            </form>
        </div>
        <div data-ng-hide="access.viewRealm">
            <h2 ><span>{{realm.realm}}</span></h2>
        </div>

    </div>
</div>