<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>

    <form class="form-horizontal" name="allowScope" novalidate kc-read-only="!access.manageClients">
        <fieldset class="border-top">
            <div class="form-group" ng-show="client.clientTemplate">
                <label class="col-md-2 control-label" for="useTemplateScope">Inherit Template Mappers</label>
                <kc-tooltip>Inherit mappers from client template</kc-tooltip>
                <div class="col-md-1">
                    <input ng-model="client.useTemplateMappers" ng-click="changeFlag()" name="useTemplateScope" id="useTemplateScope" onoffswitch on-text="{{:: 'onText' | translate}}" off-text="{{:: 'offText' | translate}}" />
                </div>
                <div class="col-md-2">
                    <a href="#/realms/{{realm.realm}}/client-templates/{{template.id}}/mappers">view template mappers</a>
                </div>
            </div>
        </fieldset>
    </form>
    <table class="table table-striped table-bordered">
        <thead>
        <tr>
            <th class="kc-table-actions" colspan="6">
                <div class="form-inline">
                    <div class="form-group">
                        <div class="input-group">
                            <input type="text" placeholder="{{:: 'search.placeholder' | translate}}" data-ng-model="search.name" class="form-control search" onkeyup="if(event.keyCode == 13){$(this).next('I').click();}">
                            <div class="input-group-addon">
                                <i class="fa fa-search" type="submit"></i>
                            </div>
                        </div>
                    </div>

                    <div class="pull-right" data-ng-show="access.manageClients">
                        <a class="btn btn-default" href="#/create/client/{{realm.realm}}/{{client.id}}/mappers">{{:: 'create' | translate}}</a>
                        <a class="btn btn-default" href="#/realms/{{realm.realm}}/clients/{{client.id}}/add-mappers">{{:: 'add-builtin' | translate}}</a>
                    </div>
                </div>
            </th>
        </tr>
        <tr data-ng-hide="mappers.length == 0">
            <th>{{:: 'name' | translate}}</th>
            <th>{{:: 'category' | translate}}</th>
            <th>{{:: 'type' | translate}}</th>
            <th colspan="2">{{:: 'actions' | translate}}</th>
        </tr>
        </thead>
        <tbody>
        <tr ng-repeat="mapper in mappers | filter:search">
            <td><a href="#/realms/{{realm.realm}}/clients/{{client.id}}/mappers/{{mapper.id}}">{{mapper.name}}</a></td>
            <td>{{mapperTypes[mapper.protocolMapper].category}}</td>
            <td>{{mapperTypes[mapper.protocolMapper].name}}</td>
            <td class="kc-action-cell">
                <button class="btn btn-default btn-block btn-sm" kc-open="/realms/{{realm.realm}}/clients/{{client.id}}/mappers/{{mapper.id}}">{{:: 'edit' | translate}}</button>
            </td>
            <td class="kc-action-cell">
                <button class="btn btn-default btn-block btn-sm" data-ng-click="removeMapper(mapper)">{{:: 'delete' | translate}}</button>
            </td>
        </tr>
        <tr data-ng-show="mappers.length == 0">
            <td>{{:: 'no-mappers-available' | translate}}</td>
        </tr>
        </tbody>
    </table>
</div>

<kc-menu></kc-menu>