<!--
  ~ Copyright 2017 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">

    <ol class="breadcrumb">
        <li><a href="#/realms/{{realm.realm}}/clients">{{:: 'clients' | translate}}</a></li>
        <li>{{client.clientId}}</li>
    </ol>

    <kc-tabs-client></kc-tabs-client>

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

    <form class="form-horizontal" name="realmForm" novalidate kc-read-only="!access.manageClients">
        <div class="form-group">
            <label class="col-md-2 control-label" class="control-label">{{:: 'client-scopes.default' | translate}}</label>
            <kc-tooltip>{{:: 'client-scopes.default.tooltip' | translate}}</kc-tooltip>

            <div class="col-md-10">
                <div class="row">
                    <div class="col-md-4">
                        <label class="control-label" for="available">{{:: 'client-scopes.default.available' | translate}}</label>
                        <kc-tooltip>{{:: 'client-scopes.default.available.tooltip' | translate}}</kc-tooltip>
                        <select id="available" class="form-control overflow-select" multiple size="5"
                                ng-multiple="true"
                                ng-model="selectedDefaultClientScopes">
                            <option ng-repeat="r in availableClientScopes | orderBy:'name' | filter: {attributes: {'is.dynamic.scope': '!true'}}"
                                    value="{{r}}" title="{{r.name}}">
                                {{r.name}}
                            </option>
                        </select>
                        <button ng-disabled="selectedDefaultClientScopes.length == 0" class="btn btn-default" type="submit" ng-click="addDefaultClientScope()">
                            {{:: 'add-selected' | translate}} <i class="fa fa-angle-double-right"></i>
                        </button>
                    </div>
                    <div class="col-md-4">
                        <label class="control-label" for="assigned">{{:: 'client-scopes.default.assigned' | translate}}</label>
                        <kc-tooltip>{{:: 'client-scopes.default.assigned.tooltip' | translate}}</kc-tooltip>
                        <select id="assigned" class="form-control overflow-select" multiple size=5
                                ng-multiple="true"
                                ng-model="selectedDefDefaultClientScopes">
                            <option ng-repeat="r in clientDefaultClientScopes | orderBy:'name'"
                                    value="{{r}}" title="{{r.name}}">
                                {{r.name}}
                            </option>
                        </select>
                        <button ng-disabled="selectedDefDefaultClientScopes.length == 0" class="btn btn-default" type="submit" ng-click="deleteDefaultClientScope()">
                            <i class="fa fa-angle-double-left"></i> {{:: 'remove-selected' | translate}}
                        </button>
                    </div>
                </div>
            </div>
        </div>

        <div class="form-group" data-ng-show="client.protocol == 'openid-connect'">
            <label class="col-md-2 control-label" class="control-label">{{:: 'client-scopes.optional' | translate}}</label>
            <kc-tooltip>{{:: 'client-scopes.optional.tooltip' | translate}}</kc-tooltip>

            <div class="col-md-10">
                <div class="row">
                    <div class="col-md-4">
                        <label class="control-label" for="available-opt">{{:: 'client-scopes.optional.available' | translate}}</label>
                        <kc-tooltip>{{:: 'client-scopes.optional.available.tooltip' | translate}}</kc-tooltip>
                        <select id="available-opt" class="form-control overflow-select" multiple size="5"
                                ng-multiple="true"
                                ng-model="selectedOptionalClientScopes">
                            <option ng-repeat="r in availableClientScopes | orderBy:'name'"
                                    value="{{r}}" title="{{r.name}}">
                                {{r.name}}
                            </option>
                        </select>
                        <button ng-disabled="selectedOptionalClientScopes.length == 0" class="btn btn-default" type="submit" ng-click="addOptionalClientScope()">
                            {{:: 'add-selected' | translate}} <i class="fa fa-angle-double-right"></i>
                        </button>
                    </div>
                    <div class="col-md-4">
                        <label class="control-label" for="assigned-opt">{{:: 'client-scopes.optional.assigned' | translate}}</label>
                        <kc-tooltip>{{:: 'client-scopes.optional.assigned.tooltip' | translate}}</kc-tooltip>
                        <select id="assigned-opt" class="form-control overflow-select" multiple size=5
                                ng-multiple="true"
                                ng-model="selectedDefOptionalClientScopes">
                            <option ng-repeat="r in clientOptionalClientScopes | orderBy:'name'"
                                    value="{{r}}" title="{{r.name}}">
                                {{r.name}}
                            </option>
                        </select>
                        <button ng-disabled="selectedDefOptionalClientScopes.length == 0" class="btn btn-default" type="submit" ng-click="deleteOptionalClientScope()">
                            <i class="fa fa-angle-double-left"></i> {{:: 'remove-selected' | translate}}
                        </button>
                    </div>
                </div>
            </div>
        </div>

    </form>

</div>

<kc-menu></kc-menu>