<div class="col-sm-9 col-md-10 col-sm-push-3 col-md-push-2">
    <h1>Authentication</h1>

    <kc-tabs-authentication></kc-tabs-authentication>

    <table class="table table-striped table-bordered">
        <thead>
        <tr>
            <th colspan="{{levelmax + 1 + choicesmax + 4}}" class="kc-table-actions">
                <div class="dropdown pull-left">
                    <select class="form-control" ng-model="flow"
                            ng-options="(flow.alias|capitalize) for flow in flows"
                            data-ng-change="selectFlow(flow)">
                    </select>
                </div>
                &nbsp;&nbsp;<i class="fa fa-question-circle text-muted" tooltip-trigger="mouseover mouseout" tooltip="{{flow.description}}" tooltip-placement="right"> </i>
                <div class="pull-right" data-ng-show="access.manageRealm">
                    <button class="btn btn-default" data-ng-click="createFlow()">New</button>
                    <button class="btn btn-default" data-ng-click="copyFlow()">Copy</button>
                    <button class="btn btn-default" data-ng-hide="flow.builtIn" data-ng-click="removeFlow()">Delete</button>
                    <button class="btn btn-default" data-ng-hide="flow.builtIn" data-ng-click="addExecution()">Add Execution</button>
                    <button class="btn btn-default" data-ng-hide="flow.builtIn || flow.providerId === 'client-flow'" data-ng-click="addFlow()">Add Flow</button>
                </div>
            </th>
         </tr>
        <tr data-ng-hide="executions.length == 0">
            <th colspan="{{levelmax + 1}}">Auth Type</th>
            <th colspan="{{choicesmax}}">Requirement</th>
            <th>&nbsp;</th>
        </tr>
        </thead>
        <tbody>
        <tr ng-repeat="execution in executions" data-ng-show="executions.length > 0">
            <td ng-repeat="lev in execution.preLevels"></td>
            <td class="kc-sorter">
                    <button data-ng-hide="flow.builtIn" data-ng-disabled="$first" class="btn btn-default btn-sm" data-ng-click="raisePriority(execution)"><i class="fa fa-angle-up"></i></button>
                    <button data-ng-hide="flow.builtIn" data-ng-disabled="$last" class="btn btn-default btn-sm" data-ng-click="lowerPriority(execution)"><i class="fa fa-angle-down"></i></button>
                    <span>{{execution.displayName|capitalize}}</span>
            </td>
            <td ng-repeat="lev in execution.postLevels"></td>
            <td ng-repeat="choice in execution.requirementChoices">
            <label>
                <input type="radio" ng-model="execution.requirement" ng-value="choice" ng-change="updateExecution(execution)">
                {{choice}}
            </label>

            </td>
            <td ng-repeat="emptee in execution.empties"></td>
            <td>
                <div class="dropdown" data-ng-hide="flow.builtIn && !execution.configurable">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown">Actions <b class="caret"></b></a>
                    <ul class="dropdown-menu"  >
                        <li data-ng-hide="flow.builtIn"><a href="" ng-click="removeExecution(execution)">Delete</a></li>
                        <li data-ng-hide="flow.builtIn || !execution.authenticationFlow"><a href="" ng-click="addSubFlowExecution(execution)">Add Execution</a></li>
                        <li data-ng-hide="flow.builtIn || !execution.authenticationFlow"><a href="" ng-click="addSubFlow(execution)">Add Flow</a></li>
                        <li data-ng-show="execution.configurable && execution.authenticationConfig == null"><a href="#/create/authentication/{{realm.realm}}/execution/{{execution.id}}/provider/{{execution.providerId}}">Config</a></li>
                        <li data-ng-show="execution.configurable && execution.authenticationConfig != null"><a href="#/realms/{{realm.realm}}/authentication/config/{{execution.providerId}}/{{execution.authenticationConfig}}">Config</a></li>
                    </ul>
                </div>
            </td>
         </tr>
        <tr data-ng-show="executions.length == 0">
            <td>No executions available</td>
        </tr>
        </tbody>
    </table>
</div>

<kc-menu></kc-menu>