<!--
  ~ Copyright 2021 Red Hat, Inc. and/or its affiliates
  ~ and other contributors as indicated by the @author tags.
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~ http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  ~
  -->

<div class="col-sm-9 col-md-10 col-sm-push-3 col-md-push-2">
    <kc-tabs-realm></kc-tabs-realm>

    <ul class="nav nav-tabs nav-tabs-pf">
        <li>
            <a href="#/realms/{{realm.realm}}/client-policies/profiles">{{:: 'client-policies-profiles' | translate}}</a>
            <kc-tooltip>{{:: 'client-policies-profiles.tooltip' | translate}}</kc-tooltip>
        </li>
        <li class="active">
            <a href="#/realms/{{realm.realm}}/client-policies/policies">{{:: 'client-policies-policies' | translate}}</a>
            <kc-tooltip>{{:: 'client-policies-policies.tooltip' | translate}}</kc-tooltip>
        </li>
    </ul>

    <ul class="nav nav-tabs nav-tabs-pf">
        <li class="active"><a href="#/realms/{{realm.realm}}/client-policies/policies">{{:: 'client-profiles-form-view' | translate}}</a></li>
        <li><a href="#/realms/{{realm.realm}}/client-policies/policies-json">{{:: 'client-profiles-json-editor' | translate}}</a></li>
    </ul>

    <form class="form-horizontal" name="realmForm" novalidate kc-read-only="!access.manageRealm">

        <fieldset>
            <table class="table table-striped table-bordered">
                <thead>
                <tr data-ng-show="access.manageRealm">
                    <th class="kc-table-actions" colspan="6">
                        <div class="form-inline">
                            <div class="pull-right">
                                <a href="#/realms/{{realm.realm}}/client-policies/policy-create" class="btn btn-default">{{:: 'create' | translate}}</a>
                            </div>
                        </div>
                    </th>
                </tr>
                <tr>
                    <th>{{:: 'name' | translate}}</th>
                    <th>{{:: 'description' | translate}}</th>
                    <th>{{:: 'enabled' | translate}}</th>
                    <th colspan="2">{{:: 'actions' | translate}}</th>
                </tr>
                </thead>
                <tbody>
                <tr ng-repeat="clientPolicy in clientPolicies.policies">
                    <td><a href="#/realms/{{realm.realm}}/client-policies/policies-update/{{clientPolicy.name}}">{{clientPolicy.name}}</a></td>
                    <td>{{clientPolicy.description}}</td>
                    <td translate="{{clientPolicy.enabled}}"></td>
                    <td class="kc-action-cell" kc-open="/realms/{{realm.realm}}/client-policies/policies-update/{{clientPolicy.name}}">{{:: 'edit' | translate}}</td>
                    <td class="kc-action-cell" data-ng-click="removeClientPolicy(clientPolicy)" data-ng-show="access.manageRealm">{{:: 'delete' | translate}}</td>
                </tr>
                </tbody>
            </table>
        </fieldset>

    </form>
</div>

<kc-menu></kc-menu>
