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

    <ol class="breadcrumb">
        <li><a href="#/realms/{{realm.realm}}/client-policies/policies">{{:: 'client-policies' | translate}}</a></li>
        <li><a href="#/realms/{{realm.realm}}/client-policies/policies-update/{{editedPolicy.name}}">{{editedPolicy.name}}</a></li>
        <li data-ng-show="createNew">{{:: 'create-condition' | translate}}</li>
        <li data-ng-hide="createNew">{{conditionType.id}}</li>
    </ol>

    <h1 data-ng-hide="createNew">{{conditionType.id|capitalize}}</h1>
    <h1 data-ng-show="createNew">{{:: 'create-condition' | translate}}</h1>

    <form class="form-horizontal" name="realmForm" novalidate kc-read-only="isReadOnly()">
        <fieldset>
            <div class="form-group" data-ng-show="createNew">
                <label class="col-md-2 control-label" for="conditionTypeCreate">{{:: 'condition-type' | translate}}</label>
                <div class="col-sm-6">
                    <div>
                        <select class="form-control" id="conditionTypeCreate"
                                ng-model="conditionType"
                                ng-options="conditionType.id for (conditionKey, conditionType) in conditionTypes">
                        </select>
                    </div>
                </div>
                <kc-tooltip>{{conditionType.helpText}}</kc-tooltip>
            </div>
            <div class="form-group clearfix" data-ng-hide="createNew">
                <label class="col-md-2 control-label" for="conditionType">{{:: 'condition-type' | translate}}</label>
                <div class="col-md-6">
                    <input class="form-control" id="conditionType" type="text" ng-model="conditionType.id" data-ng-readonly="true">
                </div>
                <kc-tooltip>{{conditionType.helpText}}</kc-tooltip>
            </div>
            <kc-provider-config config="condition.config" properties="conditionType.properties" realm="realm"></kc-provider-config>
        </fieldset>

        <div class="form-group" data-ng-hide="isReadOnly()">
            <div class="col-md-10 col-md-offset-2">
                <button kc-save>{{:: 'save' | translate}}</button>
                <button kc-cancel data-ng-click="cancel()">{{:: 'cancel' | translate}}</button>
            </div>
        </div>

    </form>
</div>

<kc-menu></kc-menu>