<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">
    <data-kc-navigation data-kc-current="credentials" data-kc-realm="realm.realm" data-kc-social="realm.social"></data-kc-navigation>

    <div id="content">
        <ol class="breadcrumb">
            <li><a href="#/realms/{{realm.realm}}">{{realm.realm}}</a></li>
            <li><a href="#/realms/{{realm.realm}}">Settings</a></li>
            <li class="active">Required Credentials</li>
        </ol>
        <h2><span>{{realm.realm}}</span> Credentials</h2>
        <form class="form-horizontal" name="realmForm" novalidate kc-read-only="!access.manageRealm">
            <fieldset class="border-top">
                <legend><span class="text">Realm Credentials Settings</span></legend>
                <div class="form-group">
                    <label class="col-sm-2 control-label" for="user" class="control-label two-lines">Required User Credentials</label>

                    <div class="col-sm-4">
                        <input id="user" type="text" ui-select2="userCredentialOptions" ng-model="realm.requiredCredentials" placeholder="Type a role and enter">
                    </div>
                </div>
            </fieldset>
            <fieldset class="border-top">
                <legend><span class="text">Realm Password Policy</span></legend>
                <table class="table table-striped table-bordered">
                    <caption class="hidden">Table of Password Policies</caption>
                    <thead>
                    <tr ng-show="(allPolicies|remove:policy:'name').length > 0">
                        <th colspan="5" class="kc-table-actions">
                            <div class="pull-right">
                                <div class="select-kc">
                                    <select ng-model="selectedPolicy"
                                            ng-options="(p.name|capitalize) for p in (allPolicies|remove:policy:'name')"
                                            data-ng-change="addPolicy(selectedPolicy); selectedPolicy = null">
                                        <option value="" disabled selected>Add policy...</option>
                                    </select>
                                </div>
                            </div>
                        </th>
                    </tr>
                    <tr>
                        <th>Policy Type</th>
                        <th>Policy Value</th>
                        <th class="actions">Actions</th>
                    </tr>
                    </thead>
                    <tbody>
                    <tr ng-repeat="p in policy">
                        <td>
                            <input class="form-control disabled" type="text" value="{{p.name|capitalize}}" readonly>
                        </td>
                        <td>
                            <input class="form-control" ng-model="p.value" type="number" placeholder="No value assigned"  min="1">
                        </td>
                        <td class="actions">
                            <div class="action-div"><i class="pficon pficon-delete" ng-click="removePolicy($index)" tooltip-placement="right" tooltip="Remove Policy"></i></div>
                        </td>
                    </tr>
                    </tbody>
                </table>
            </fieldset>
            <div class="pull-right form-actions" data-ng-show="access.manageRealm">
                <button kc-reset data-ng-show="changed">Clear changes</button>
                <button kc-save data-ng-show="changed">Save</button>
            </div>
        </form>
    </div>
</div>