{if edit_user}
<div class="row">
    <div class="col-12">
        <div class='blogPost'>
            <h1 class="text-center">Edit User</h1>
            <form action="/admin/users/" method ="post" >
                <div class="form-group">
                    <input class="form-control" type="text" name="edit_user_name" value='{user_name}' required>
                    <label class="w3-label w3-validate">User Name</label>
                </div>
                <div class="form-group">
                    <input class="form-control" type="password" name="edit_user_password" value='' required>
                    <label class="w3-label w3-validate">Password</label>
                </div>
                <div>
                    <input type="submit" name="submit" value="Edit" class="btn btn-lg btn-secondary"/>
                </div>
                <input type='hidden' name='edit_user_2' value='{edit_user}'/>
            </form>
        </div>
        <br>
    </div>
</div>
{/if}


<div class="row">
    <!-- Current Users -->
    <div class="col-md-6">
        <div class='blogPost'>
            <h1 class="text-center">Users</h1>
            <div class="">
                <table class="table table-striped">
                    <thead class="thead-dark">
                    <tr>
                        <td>User ID</td>
                        <td>User Name</td>
                        <td>Edit</td>
                        <td>Delete</td>
                    </tr>
                    </thead>

                    <tbody>
                    {for user in users}
                    <tr>
                        <td>
                            {user.user_id}
                        </td>
                        <td>
                            {user.user_name}
                        </td>
                        <td>
                            <form action="/admin/users/" method ="post" >
                                <input type="submit" name="submit" value="Edit" class="btn btn-secondary"/>
                                <input type='hidden' name='edit_user' value='{user.user_id}' />
                            </form>
                        </td>
                        <td>
                            <form action="/admin/users/" method ="post" >
                                <input type="submit" name="submit" value="Delete" class="btn btn-secondary"/>
                                <input type='hidden' name='delete_user' value='{user.user_id}' />
                            </form>
                        </td>
                    </tr>
                    {/for}
                    </tbody>
                </table>
            </div>
        </div>
    </div>

    <!-- Add User -->
    <div class="col-md-6">
        <div class="blogPost">
            <h1 class="text-center">Add New User</h1>

            <form action="/admin/users/" method ="post" class="p-2">
                <div class="form-group">
                    <input class="form-control" type="text" name="add_user_name" required>
                    <label>User Name</label>
                </div>
                <div class="form-group">
                    <input class="form-control" type="password" name="add_user_password" required>
                    <label>Password</label>
                </div>
                <div class="text-center">
                    <input type="submit" name="add_user" value="Create User"
                           class="btn btn-lg btn-secondary"/>
                </div>
            </form>
        </div>
        <br>
    </div>
</div>