<div id="userTable" class="table-responsive">
    <h4>TaskBoard Users</h4>
    <table class="table table-striped">
        <thead>
            <tr>
                <th>User</th><th>Admin</th><th>Default Board</th><th>Actions</th>
            </tr>
        </thead>
        <tbody>
            <tr data-ng-if="loadingUsers">
                <td colspan="4" align="center"><span class="fa fa-refresh fa-spin"></span> Loading Users...</td>
            </tr>
            <tr data-ng-if="!loadingUsers && !users.length">
                <td colspan="4" align="center">Something went wrong while loading users. Please refresh the page.</td>
            </tr>
            <tr data-ng-repeat="user in users">
                <td>{{ user.username }}</td>
                <td data-ng-class="user.is_admin == '1' ? 'green' : 'red'">
                    <span data-ng-if="user.is_admin == '1'" class="fa fa-check" title="Yes"></span>
                    <span data-ng-if="user.is_admin == '0'" class="fa fa-times" title="No"></span>
                </td>
                <td>{{ boardLookup[user.default_board] || 'None' }}</td>
                <td>
                    <span class="links"
                          data-ng-if="currentUser.isAdmin == '1' && user.id != currentUser.userId && !isDeleting[user.id]">
                        <a id="edit{{ $index }}"class="fa fa-edit" title="Edit User"
                           data-toggle="modal" data-target=".userModal"
                           data-ng-click="userFormData.setUser(user)"></a>
                        <a id="remove{{ $index }}" class="fa fa-trash-o" title="Remove User"
                           data-ng-click="removeUser(user.id)"></a>
                    </span>
                    <span data-ng-if="isDeleting[user.id]" class="fa fa-refresh fa-spin"></span>
                </td>
            </tr>
        </tbody>
    </table>
    <div data-ng-if="currentUser.isAdmin == '1'">
        <p><a role="button" id="addUser" class="btn btn-info" data-toggle="modal" data-target=".userModal" data-ng-click="userFormData.reset()" title="Add User">Add User <span class="fa fa-plus"> </span></a></p>
    </div>
</div>
