<section class="content-header">
    <h1>
        Groups
        <small>organize your users</small>
    </h1>
</section>
<section class="content">
    <div class="box">
        <div class="box-header with-border">
            &nbsp;
            <div class="box-filters hidden-xs">
                <div class="form-group form-group-sm has-feedback has-feedback-left">
                    <input type="text" id="filterSearch" class="form-control" placeholder="Search groups..."
                           style="width: 200px;" ng-model="filterSearch">
                    <span class="fa fa-search form-control-feedback text-muted" aria-hidden="true"></span>
                </div>
            </div>
            <div class="box-tools">
                <button type="button" class="btn btn-primary btn-sm btn-flat" ng-click="add()">
                    <i class="fa fa-fw fa-plus-circle"></i> New Group
                </button>
            </div>
        </div>
        <div class="box-body" ng-class="{'no-padding': filteredGroups.length}">
            <div ng-show="loading && !groups.length">
                Loading...
            </div>
            <div ng-show="!filteredGroups.length && filterSearch">
                No groups to list.
            </div>
            <div ng-show="!loading && !groups.length">
                <p>There are no groups yet for your organization.</p>
                <button type="button" ng-click="add()" class="btn btn-default btn-flat">Add a Group</button>
            </div>
            <div class="table-responsive" ng-show="groups.length">
                <table class="table table-striped table-hover table-vmiddle">
                    <tbody>
                        <tr ng-repeat="group in filteredGroups = (groups | filter: (filterSearch || '') |
                            orderBy: ['name']) track by group.id">
                            <td style="width: 70px;">
                                <div class="btn-group" data-append-to="body">
                                    <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
                                        <i class="fa fa-cog"></i> <span class="caret"></span>
                                    </button>
                                    <ul class="dropdown-menu">
                                        <li>
                                            <a href="#" stop-click ng-click="users(group)">
                                                <i class="fa fa-fw fa-users"></i> Users
                                            </a>
                                        </li>
                                        <li>
                                            <a href="#" stop-click ng-click="delete(group)" class="text-red">
                                                <i class="fa fa-fw fa-trash"></i> Delete
                                            </a>
                                        </li>
                                    </ul>
                                </div>
                            </td>
                            <td valign="middle">
                                <a href="#" stop-click ng-click="edit(group)">
                                    {{group.name}}
                                </a>
                            </td>
                        </tr>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</section>
