<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">
    <data-kc-navigation data-kc-current="social" data-kc-realm="realm.realm" data-kc-social="realm.social"></data-kc-navigation>
    <h2></h2>
    <div id="content">
        <h2 class="pull-left"><span>{{realm.realm}}</span> Identity Providers Settings</h2>

        <form name="realmForm" novalidate class="form-horizontal">
            <fieldset>
                <div>
                    <table class="table table-striped table-bordered">
                        <caption class="hidden">Table of identity providers</caption>
                        <thead>
                        <tr>
                            <th colspan="5" class="kc-table-actions">
                                <div class="pull-right">
                                    <div class="select-kc">
                                        <select ng-model="provider"
                                                ng-options="p.name group by p.groupName for p in allProviders track by p.id"
                                                data-ng-change="addProvider(provider); provider = null">
                                            <option value="" disabled selected>Add provider...</option>
                                        </select>
                                    </div>
                                </div>
                            </th>
                        </tr>
                        <tr ng-show="configuredProviders.length > 0">
                            <th>Name</th>
                            <th>Callback URI</th>
                        </tr>
                        </thead>
                        <tbody ng-show="configuredProviders.length > 0">
                        <tr ng-repeat="identityProvider in configuredProviders">
                            <td>
                                <a href="#/realms/{{realm.realm}}/identity-provider-settings/provider/{{identityProvider.providerId}}/{{identityProvider.alias}}">{{identityProvider.alias}}</a>
                            </td>
                            <td>
                                {{callbackUrl}}{{identityProvider.alias}}
                            </td>
                        </tr>
                        </tbody>
                    </table>
                </div>
            </fieldset>
        </form>
    </div>
</div>
</div>

<!-- TODO remove once this page is properly styled -->
<style type="text/css">
    .social-provider input.ng-invalid.dirty,
    .social-provider input.ng-invalid.ng-dirty {
        background-color: #FFEEEE;
    }

    .social-provider .actions > div {
        display: inline-block;
        overflow: hidden;
    }

    .social-provider td {
        font-size: 10px;
    }

    .social-provider .action-div {
        display: inline-block;
        margin: 5px;
    }

    .social-provider .icon-remove, .social-provider .icon-question {
        cursor: pointer;
    }
</style>