<div class="bs-sidebar col-md-3 clearfix" data-ng-include data-src="'partials/realm-menu.html'"></div>
<div id="content-area" class="col-md-9" role="main">
    <h2></h2>
    <div id="content">
        <h2><span>{{realm.realm}}</span> Applications  <span tooltip-placement="right" tooltip="Applications are trusted browser apps and web services in a realm.  These applications can request a login. You can also define application specific roles." class="fa fa-info-circle"></span></h2>
        <table class="table table-striped table-bordered">
            <thead>
            <tr>
                <th class="kc-table-actions" colspan="3">
                    <div class="search-comp clearfix">
                        <input type="text" placeholder="Search..." class="form-control search" data-ng-model="search.name"
                               onkeyup="if(event.keyCode == 13){$(this).next('button').click();}">
                        <button type="submit" class="kc-icon-search" tooltip-placement="right"
                                tooltip="Search by application name.">
                            Icon: search
                        </button>
                    </div>
                    <div class="pull-right">
                        <a class="btn btn-primary" href="#/import/application/{{realm.realm}}" data-ng-show="importButton">Import</a>
                        <a class="btn btn-primary" href="#/create/application/{{realm.realm}}">Create</a>
                    </div>
                </th>
            </tr>
            <tr data-ng-hide="applications.length == 0">
                <th>Application Name</th>
                <th>Enabled</th>
                <th>Base URL</th>
            </tr>
            </thead>
            <!--<tfoot data-ng-show="applications && applications.length > 5">
            <tr>
                <td colspan="3">
                    <div class="table-nav">
                        <a href="#" class="first disabled">First page</a><a href="#" class="prev disabled">Previous
                        page</a><span><strong>1-8</strong> of <strong>10</strong></span><a href="#"
                                                                                           class="next">Next
                        page</a><a href="#" class="last">Last page</a>
                    </div>
                </td>
            </tr>
            </tfoot>-->
            <tbody>
            <tr ng-repeat="app in applications | filter:search">
                <td><a href="#/realms/{{realm.realm}}/applications/{{app.id}}">{{app.name}}</a></td>
                <td>{{app.enabled}}</td>
                <td ng-class="{'text-muted': !app.baseUrl}">
                    <a href="{{app.baseUrl}}" data-ng-show="app.baseUrl">{{app.baseUrl}}</a>
                    <span data-ng-hide="app.baseUrl">Not defined</span>
            </tr>
            <tr data-ng-show="applications.length == 0">
                <td>No applications available</td>
            </tr>
            </tbody>
        </table>
        <div class="feedback warning inline" data-ng-show="search && applications.length == 0">
            <p><strong>Your search returned no results.</strong><br>Try modifying the query and try again.</p>
        </div>
    </div>
</div>