<div id="wrapper" class="container">
    <div class="row">
        <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">
            <div class="top-nav">
                <ul class="rcue-tabs">
                    <li></li>
                </ul>
            </div>
            <div id="content">
                <ol class="breadcrumb">
                    <li><a href="#/realms/{{realm.id}}">{{realm.realm}}</a></li>
                    <li class="active">Applications</li>
                </ol>
                <h2><span>{{realm.realm}}</span> Applications</h2>
                <div class="feedback info inline" data-ng-show="!applications || applications.length == 0">
                    <p><strong>You have not configured applications.</strong> <a class="button" href="#/create/application/{{realm.id}}">Add Application</a></p>
                </div>
                <table data-ng-hide="applications.length == 0">
                    <thead>
                    <tr>
                        <th class="rcue-table-actions" colspan="3">
                            <div class="search-comp clearfix">
                                <input type="text" placeholder="Search..." class="search" data-ng-model="search.name"
                                       onkeyup="if(event.keyCode == 13){$(this).next('button').click();}">
                                <button class="icon-search" tooltip-placement="right"
                                        tooltip="Search by application name.">
                                    Icon: search
                                </button>
                            </div>
                            <div class="actions">
                                <a class="button" href="#/create/application/{{realm.id}}">Add Application</a>
                            </div>
                        </th>
                    </tr>
                    <tr data-ng-show="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.id}}/applications/{{app.id}}">{{app.name}}</a></td>
                        <td>{{app.enabled}}</td>
                        <td ng-class="{'text-muted': !app.baseUrl}">{{app.baseUrl || "Not defined"}}</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>
        <div id="container-right-bg"></div>
    </div>
</div>