<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">
    <ul class="nav nav-tabs nav-tabs-pf" data-ng-show="!create">
        <li class="active"><a href="#/realms/{{realm.realm}}/oauth-clients/{{oauth.name}}">Settings</a></li>
        <li data-ng-show="!oauth.publicClient"><a href="#/realms/{{realm.realm}}/oauth-clients/{{oauth.name}}/credentials">Credentials</a></li>
        <li><a href="#/realms/{{realm.realm}}/oauth-clients/{{oauth.name}}/claims">Claims</a></li>
        <li><a href="#/realms/{{realm.realm}}/oauth-clients/{{oauth.name}}/scope-mappings">Scope</a></li>
        <li><a href="#/realms/{{realm.realm}}/oauth-clients/{{oauth.name}}/installation">Installation</a></li>
        <li><a href="#/realms/{{realm.realm}}/oauth-clients/{{oauth.name}}/revocation">Revocation</a></li>
    </ul>
    <div id="content">
        <ol class="breadcrumb" data-ng-show="create">
            <li><a href="#/realms/{{realm.realm}}">{{realm.realm}}</a></li>
            <li><a href="#/realms/{{realm.realm}}/oauth-clients">OAuth Clients</a></li>
            <li class="active">Add OAuth Client</li>
        </ol>
        <h2 data-ng-show="create" class="pull-left"><span>{{realm.realm}}</span> Add OAuth Client</h2>
        <p class="subtitle" data-ng-show="create"><span class="required">*</span> Required fields</p>
        <ol class="breadcrumb" data-ng-hide="create">
            <li><a href="#/realms/{{realm.realm}}">{{realm.realm}}</a></li>
            <li><a href="#/realms/{{realm.realm}}/oauth-clients">OAuth Clients</a></li>
            <li><a href="#/realms/{{realm.realm}}/oauth-clients/{{oauth.id}}">{{oauth.name}}</a></li>
            <li class="active">Settings</li>
        </ol>
        <h2 data-ng-hide="create"><span>{{oauth.name}}</span> Settings</h2>
        <form class="form-horizontal" name="oauthForm" novalidate kc-read-only="!access.manageClients">
            <fieldset class="border-top">

                <div class="form-group">
                    <label class="col-sm-2 control-label" for="name">Name <span class="required" data-ng-show="create">*</span></label>
                    <div class="col-sm-4">
                        <input class="form-control" type="text" id="name" name="name" data-ng-model="oauth.name" autofocus
                               required>
                    </div>
                </div>

                <div class="form-group clearfix block">
                    <label class="col-sm-2 control-label" for="enabled">Enabled</label>
                    <div class="col-sm-4">
                        <input ng-model="oauth.enabled" name="enabled" id="enabled" onoffswitch />
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label" for="accessType">Access Type</label>
                    <div class="col-sm-4">
                        <div class="select-kc">
                            <select id="accessType"
                                    ng-change="changeAccessType()"
                                    ng-model="accessType"
                                    ng-options="aType for aType in accessTypes">
                            </select>
                        </div>
                    </div>
                </div>
                <div class="form-group clearfix block">
                    <label class="col-sm-2 control-label" for="directGrantsOnly">Direct Grants Only</label>
                    <div class="col-sm-4">
                        <input ng-model="oauth.directGrantsOnly" name="directGrantsOnly" id="directGrantsOnly" onoffswitch />
                    </div>
                </div>
                <div class="form-group" data-ng-hide="oauth.directGrantsOnly">
                    <label class="col-sm-2 control-label" for="newRedirectUri">Redirect URI <span class="required" data-ng-show="create">*</span></label>
                    <div class="col-sm-4 multiple" ng-repeat="redirectUri in oauth.redirectUris">
                        <div class="input-group kc-item-deletable">
                            <input  class="form-control" type="text" data-ng-class="{'input-below':!$first}"
                                    name="redirectUri" id="redirectUri" data-ng-model="redirectUri" readonly />
                            <span class="input-group-btn">
                                <button class="btn btn-default" type="button" data-ng-click="deleteRedirectUri($index)">
                                    Delete</button>
                            </span>
                        </div>
                    </div>
                    <div class="col-sm-4 multiple">
                        <div class="input-group">
                            <input  class="form-control" type="text" name="newRedirectUri" id="newRedirectUri"
                                    placeholder="New Redirect URI..." data-ng-model="newRedirectUri"
                                    data-ng-class="{'input-below':oauth.redirectUris.length}" />
                            <span class="input-group-btn">
                                <button class="btn btn-default" data-ng-click="addRedirectUri()" ng-show="newRedirectUri.length > 0">Add</button>
                            </span>
                        </div>
                    </div>
                </div>
                <div class="form-group" data-ng-hide="create">
                    <label class="col-sm-2 control-label" for="newWebOrigin">Web Origin</label>
                    <div class="col-sm-4 multiple" ng-repeat="webOrigin in oauth.webOrigins">
                        <div class="input-group kc-item-deletable">
                            <input class="form-control" type="text" data-ng-class="{'input-below':!$first}"
                                   name="webOrigin" id="webOrigin" data-ng-model="webOrigin" readonly />
                            <span class="input-group-btn">
                                <button class="btn btn-default" type="button" data-ng-click="deleteWebOrigin($index)">
                                    Delete</button>
                            </span>
                        </div>
                    </div>
                    <div class="col-sm-4 multiple">
                        <div class="input-group">
                            <input class="form-control" type="text" name="newWebOrigin" id="newWebOrigin"
                                   placeholder="New Web Origin..." data-ng-model="newWebOrigin"
                                   data-ng-class="{'input-below':oauth.webOrigins.length}" />
                            <span class="input-group-btn">
                                <button class="btn btn-default" data-ng-click="addWebOrigin()" ng-show="newWebOrigin.length > 0">Add</button>
                            </span>
                        </div>
                    </div>
                </div>
            </fieldset>

            <div class="pull-right form-actions" data-ng-show="create && access.manageClients">
                <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.manageClients">
                <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>