<div class="col-sm-9 col-md-10 col-sm-push-3 col-md-push-2">

    <kc-tabs-resource-server></kc-tabs-resource-server>

    <table class="table table-striped table-bordered">
        <thead>
            <tr>
                <th class="kc-table-actions" colspan="5">
                    <div class="form-inline">
                        <div class="form-group">
                            {{:: 'filter' | translate}}:&nbsp;&nbsp;
                            <div class="input-group">
                                <input type="text" placeholder="{{:: 'name' | translate}}" data-ng-model="search.name" class="form-control search" onkeyup="if(event.keyCode == 13){$(this).next('I').click();}">
                            </div>
                            <div class="input-group">
                                <select class="form-control search" data-ng-model="search.type"
                                        ng-options="p.type as p.name group by p.group for p in policyProviders track by p.type">
                                    <option value="" selected ng-click="search.type = ''">{{:: 'authz-all-types' | translate}}</option>
                                </select>
                            </div>
                        </div>
                        <div class="pull-right">
                            <select class="form-control" ng-model="policyType"
                                    ng-options="p.name group by p.group for p in policyProviders track by p.type"
                                    data-ng-change="addPolicy(policyType);">
                                <option value="" disabled selected>{{:: 'authz-create-policy' | translate}}...</option>
                            </select>
                        </div>
                    </div>
                </th>
            </tr>
            <tr data-ng-hide="policies.length == 0">
                <th>{{:: 'name' | translate}}</th>
                <th>{{:: 'description' | translate}}</th>
                <th>{{:: 'type' | translate}}</th>
            </tr>
        </thead>
        <tbody>
            <tr ng-repeat="policy in policies | filter: {name: search.name, type: search.type} | orderBy:'name'">
                <td><a href="#/realms/{{realm.realm}}/clients/{{client.id}}/authz/resource-server/policy/{{policy.type}}/{{policy.id}}">{{policy.name}}</a></td>
                <td>{{policy.description}}</td>
                <td>{{policy.type}}</td>
            </tr>
            <tr data-ng-show="(policies | filter:search).length == 0">
                <td class="text-muted" colspan="3" data-ng-show="search.name">{{:: 'no-results' | translate}}</td>
                <td class="text-muted" colspan="3" data-ng-hide="search.name">{{:: 'authz-no-policies-available' | translate}}</td>
            </tr>
        </tbody>
    </table>
</div>

<kc-menu></kc-menu>