<div class="bs-sidebar col-sm-3 " data-ng-include data-src="resourceUrl + '/partials/realm-menu.html'"></div>
<div id="content-area" class="col-sm-9" role="main">
    <kc-navigation-client></kc-navigation-client>
    <div id="content">
        <ol class="breadcrumb" data-ng-show="create">
            <li><a href="#/realms/{{realm.realm}}/identity-provider-settings">Identity Providers</a></li>
            <li><a href="#/realms/{{realm.realm}}/identity-provider-settings/provider/{{identityProvider.providerId}}/{{identityProvider.alias}}">{{identityProvider.alias}} Provider</a></li>
            <li><a href="#/realms/{{realm.realm}}/identity-provider-mappers/{{identityProvider.alias}}/mappers">Identity Provider Mappers</a></li>
            <li class="active">Create IdentityProvider Mapper</li>
        </ol>

        <ol class="breadcrumb" data-ng-hide="create">
            <li><a href="#/realms/{{realm.realm}}/identity-provider-settings">Identity Providers</a></li>
            <li><a href="#/realms/{{realm.realm}}/identity-provider-settings/provider/{{identityProvider.providerId}}/{{identityProvider.alias}}">{{identityProvider.alias}} Provider</a></li>
            <li><a href="#/realms/{{realm.realm}}/identity-provider-mappers/{{identityProvider.alias}}/mappers">Identity Provider Mappers</a></li>
            <li class="active">{{mapper.name}}</li>
        </ol>
        <h2 class="pull-left" data-ng-hide="create">{{mapper.name}} Identity Provider Mapper</h2>
        <h2 class="pull-left" data-ng-show="create">Create Identity Provider Mapper</h2>
        <p class="subtitle"><span class="required">*</span> Required fields</p>
        <form class="form-horizontal" name="realmForm" novalidate kc-read-only="!access.manageRealm">

            <fieldset>
                <div class="form-group clearfix" data-ng-show="!create">
                    <label class="col-sm-2 control-label" for="mapperId">ID </label>
                    <div class="col-sm-4">
                        <input class="form-control" id="mapperId" type="text" ng-model="mapper.id" readonly>
                    </div>
                </div>
                <div class="form-group clearfix">
                    <label class="col-sm-2 control-label" for="name">Name <span class="required">*</span></label>
                    <div class="col-sm-4">
                        <input class="form-control" id="name" type="text" ng-model="mapper.name" data-ng-readonly="!create" required>
                    </div>
                    <span tooltip-placement="right" tooltip="Name of the mapper." class="fa fa-info-circle"></span>
                </div>
                <div class="form-group" data-ng-show="create">
                    <label class="col-sm-2 control-label" for="mapperTypeCreate">Mapper Type</label>
                    <div class="col-sm-6">
                        <div class="select-kc">
                            <select id="mapperTypeCreate"
                                    ng-model="mapperType"
                                    ng-options="mapperType.name for (mapperKey, mapperType) in mapperTypes">
                            </select>
                        </div>
                    </div>
                    <span tooltip-placement="right" tooltip="{{mapperType.helpText}}" class="fa fa-info-circle"></span>
                </div>
                <div class="form-group clearfix" data-ng-hide="create">
                    <label class="col-sm-2 control-label" for="mapperType">Mapper Type</label>
                    <div class="col-sm-4">
                        <input class="form-control" id="mapperType" type="text" ng-model="mapperType.name" data-ng-readonly="true">
                    </div>
                    <span tooltip-placement="right" tooltip="{{mapperType.helpText}}" class="fa fa-info-circle"></span>
                </div>
                <div data-ng-repeat="option in mapperType.properties" class="form-group">
                    <label class="col-sm-2 control-label">{{option.label}}</label>

                    <div class="col-sm-4" data-ng-hide="option.type == 'boolean' || option.type == 'List'">
                        <input class="form-control" type="text" data-ng-model="mapper.config[ option.name ]" >
                    </div>
                    <div class="col-sm-4" data-ng-show="option.type == 'boolean'">
                        <input ng-model="mapper.config[ option.name ]" value="'true'" name="option.name" id="option.name" onoffswitchmodel />
                    </div>
                    <div class="col-sm-4" data-ng-show="option.type == 'List'">
                        <select ng-model="mapper.config[ option.name ]" ng-options="data for data in option.defaultValue">
                            <option value="" selected> Select one... </option>
                        </select>
                    </div>
                    <span tooltip-placement="right" tooltip="{{option.helpText}}" class="fa fa-info-circle"></span>
                </div>

            </fieldset>
            <div class="pull-right form-actions" data-ng-show="create && access.manageRealm">
                <button kc-cancel data-ng-click="cancel()">Cancel</button>
                <button kc-save>Save</button>
            </div>

            <div class="pull-right form-actions" data-ng-show="!create && access.manageRealm">
                <button kc-reset data-ng-show="changed">Clear changes</button>
                <button kc-save  data-ng-show="changed">Save</button>
                <button kc-delete data-ng-click="remove()" data-ng-hide="changed">Delete</button>
            </div>
        </form>
    </div>
</div>