<!--
  ~ 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 class="active">
            <a href="#/realms/{{realm.realm}}/client-policies/profiles">{{:: 'client-policies-profiles' | translate}}</a>
            <kc-tooltip>{{:: 'client-policies-profiles.tooltip' | translate}}</kc-tooltip>
        </li>
        <li>
            <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/profiles">{{:: 'client-profiles-form-view' | translate}}</a></li>
        <li><a href="#/realms/{{realm.realm}}/client-policies/profiles-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/profiles-create" class="btn btn-default">{{:: 'create' | translate}}</a>
                                </div>
                            </div>
                        </th>
                    </tr>
                    <tr>
                        <th>{{:: 'name' | translate}}</th>
                        <th>{{:: 'description' | translate}}</th>
                        <th>{{:: 'global' | translate}}</th>
                        <th colspan="2">{{:: 'actions' | translate}}</th>
                    </tr>
                </thead>
                <tbody>
                    <tr ng-repeat="clientProfile in clientProfiles.globalProfiles">
                        <td><a href="#/realms/{{realm.realm}}/client-policies/profiles-update/{{clientProfile.name}}">{{clientProfile.name}}</a></td>
                        <td>{{clientProfile.description}}</td>
                        <td>{{:: 'true' | translate}}</td>
                        <td colspan="2" class="kc-action-cell" kc-open="/realms/{{realm.realm}}/client-policies/profiles-update/{{clientProfile.name}}">{{:: 'edit' | translate}}</td>
                    </tr>
                    <tr ng-repeat="clientProfile in clientProfiles.profiles">
                        <td><a href="#/realms/{{realm.realm}}/client-policies/profiles-update/{{clientProfile.name}}">{{clientProfile.name}}</a></td>
                        <td>{{clientProfile.description}}</td>
                        <td>{{:: 'false' | translate}}</td>
                        <td class="kc-action-cell" kc-open="/realms/{{realm.realm}}/client-policies/profiles-update/{{clientProfile.name}}">{{:: 'edit' | translate}}</td>
                        <td class="kc-action-cell" data-ng-click="removeClientProfile(clientProfile)" data-ng-show="access.manageRealm">{{:: 'delete' | translate}}</td>
                    </tr>
                </tbody>
            </table>
        </fieldset>

    </form>
</div>

<kc-menu></kc-menu>
