<!DOCTYPE html>
<html lang="ja">
    <head>
        <%- include("../layout/head",{ title: "ユーザー管理" }); %>
    </head>
    <body>
        <header>
            <%- include("../layout/header"); %>
        </header>
        <main>
            <div class="container">
                <%- include("../components/errorAlert",{ message: errorMessage }); %>
                <%- include("../components/successAlert",{ message: successMessage }); %>
                <div class="card">
                    <h5 class="card-header">ユーザー管理</h5>
                    <div class="card-body">
                        <div class="table-responsive">
                            <table class="table">
                                <thead>
                                    <tr>
                                        <th scope="col">名前</th>
                                        <th scope="col"></th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <% users.forEach(user=>{ %>
                                        <tr>
                                            <th scope="row"><%= user.name %></th>
                                            <td>
                                                <form action="/admin/user" method="POST">
                                                    <input type="hidden" name="name" value="<%= user.name %>">
                                                    <input type="submit" class="btn btn-sm btn-danger" value="削除" >
                                                </form>
                                            </td>
                                        </tr>
                                    <% }); %>
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
            </div>
        </main>
        <footer>
            <%- include("../layout/footer"); %>
        </footer>
    </body>
    <script src="https://code.jquery.com/jquery-3.4.1.slim.min.js" integrity="sha384-J6qa4849blE2+poT4WnyKhv5vZF5SrPo0iEjwBvKU7imGFAV0wwj1yYfoRSJoZ+n" crossorigin="anonymous"></script>
    <script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.11.6/dist/umd/popper.min.js" integrity="sha384-oBqDVmMz9ATKxIep9tiCxS/Z9fNfEXiDAYTujMAeBAsjFuCZSmKbSSUnQlmh/jp3" crossorigin="anonymous"></script>
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.min.js" integrity="sha384-cuYeSxntonz0PPNlHhBs68uyIAVpIIOZZ5JqeqvYYIcEL727kskC66kF92t6Xl2V" crossorigin="anonymous"></script>
</html>