<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">
    <ul class="nav nav-tabs nav-tabs-pf">
        <li class="active"><a href="">Application List</a></li>
    </ul>
    <div id="content">
        <ol class="breadcrumb">
            <li><a href="#/realms/{{realm.realm}}">{{realm.realm}}</a></li>
            <li class="active">Applications</li>
        </ol>
        <h2><span>{{realm.realm}}</span> Applications</h2>
        <table class="table">
            <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="#/create/application/{{realm.realm}}">Add Application</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"> <!-- todo -->
            <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.name}}">{{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>