<div class="col-lg-12 dash-header">
    <h1 class="page-header">
        Users <small> Summary</small>
        <button ng-click="openCreateUser()" class="btn btn-primary pull-right"><i class="fa fa-plus-square-o"></i> Create User</button>
    </h1>
    <ng-include ng-if="error_message" src="'/views/admin/notice.html'"></ng-include>
</div>
<div class="col-lg-12">
    <div ng-if="users.length == 0">
        <h3>No users to display.</h3>
    </div>
    <table ng-if="users.length" datatable="ng" dt-options="dtOptions"
           class="table table-striped table-hover">
        <thead>
        <tr>
            <th>Name</th>
            <th>UserName</th>
            <th>Created Date</th>
            <th>Active</th>
            <th></th>
        </tr>
        </thead>
        <tbody>
        <tr dt-rows ng-repeat="user in users">
            <td>{{user.first_name}} {{user.last_name}}</td>
            <td>{{user.username}}</td>
            <td>{{user.created | date}}</td>
            <td><input type="checkbox" ng-model="user.active" name="active" ng-checked="user.active"></td>
            <td>
                <button ng-click="selectUser(user)" class="btn btn-info btn-xs"><i class="fa fa-edit"></i> Edit</button>
                <button ng-click="updateUser(user)" class="btn btn-primary btn-xs"><i class="fa fa fa-floppy-o"></i> Save</button>
                <button ng-click="deleteUser(user.id)" class="btn btn-danger btn-xs"><i class="fa fa-trash-o"></i> Delete</button>
            </td>
        </tr>
        </tbody>
    </table>
</div>