<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">
    <ul class="nav nav-tabs nav-tabs-pf">
        <li><a href="#/realms/{{realm.realm}}/users">User List</a></li>
        <li><a href="#/realms/{{realm.realm}}/user-federation">Federation</a></li>
    </ul>
    <h2></h2>
    <div id="content">
        <h2 class="pull-left"><span>{{realm.realm}}</span> Provider Settings</h2>
        <p class="subtitle"><span class="required">*</span> Required fields</p>
        <form class="form-horizontal" name="realmForm" novalidate kc-read-only="!access.manageRealm">

            <fieldset>
                <legend><span class="text">Required Settings</span></legend>
                <div class="form-group clearfix" data-ng-show="!create">
                    <label class="col-sm-2 control-label" for="providerId">Provider ID </label>
                    <div class="col-sm-4">
                        <input class="form-control" id="providerId" type="text" ng-model="instance.id" readonly>
                    </div>
                </div>
                <div class="form-group clearfix">
                    <label class="col-sm-2 control-label" for="consoleDisplayName">Console display name </label>
                    <div class="col-sm-4">
                        <input class="form-control" id="consoleDisplayName" type="text" ng-model="instance.displayName" placeholder="defaults to id">
                    </div>
                </div>
                <div class="form-group clearfix">
                    <label class="col-sm-2 control-label" for="priority">Priority </label>
                    <div class="col-sm-4">
                        <input class="form-control" id="priority" type="text" ng-model="instance.priority">
                    </div>
                </div>
                <div data-ng-repeat="option in providerFactory.options" class="form-group">
                    <label class="col-sm-2 control-label">{{option|capitalize}} </label>

                    <div class="col-sm-4">
                        <input class="form-control" type="text" data-ng-model="instance.config[ option ]" >
                    </div>
                </div>

            </fieldset>

            <fieldset>
                <legend><span class="text">Sync settings</span></legend>
                <div class="form-group clearfix">
                    <label class="col-sm-2 control-label" for="fullSyncEnabled">Periodic full sync</label>
                    <div class="col-sm-4">
                        <input ng-model="fullSyncEnabled" name="fullSyncEnabled" id="fullSyncEnabled" onoffswitch />
                    </div>
                </div>
                <div class="form-group clearfix" data-ng-show="fullSyncEnabled">
                    <label class="col-sm-2 control-label" for="fullSyncPeriod">Full sync period</label>
                    <div class="col-sm-4">
                        <input class="form-control" type="number" ng-model="instance.fullSyncPeriod" id="fullSyncPeriod" />
                    </div>
                </div>
                <div class="form-group clearfix">
                    <label class="col-sm-2 control-label" for="changedSyncEnabled">Periodic changed users sync</label>
                    <div class="col-sm-4">
                        <input ng-model="changedSyncEnabled" name="changedSyncEnabled" id="changedSyncEnabled" onoffswitch />
                    </div>
                </div>
                <div class="form-group clearfix" data-ng-show="changedSyncEnabled">
                    <label class="col-sm-2 control-label" for="changedSyncPeriod">Changed users sync period</label>
                    <div class="col-sm-4">
                        <input class="form-control" type="number" ng-model="instance.changedSyncPeriod" id="changedSyncPeriod" />
                    </div>
                </div>
            </fieldset>

            <div class="pull-right form-actions" data-ng-show="create && access.manageUsers">
                <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="!create && access.manageUsers">
                <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>
                <button kc-delete data-ng-click="triggerFullSync()" data-ng-hide="changed">Synchronize all users</button>
                <button kc-delete data-ng-click="triggerChangedUsersSync()" data-ng-hide="changed">Synchronize changed users</button>
            </div>
        </form>
    </div>
</div>