<!doctype html>
<html lang="en">
<head>
    <title>EatQ</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <%- include('../../template/header') %>
</head>
<body class="font-kanit-sm">
    <%- include('../../template/navbar') %>
    <div class="container px-3">
        <div class="d-flex justify-content-between">
            <a href="/restaurant" class="text-dark text-decoration-none">
              <div class="d-flex align-items-center">
                <i class="fa-solid fa-arrow-left me-2"></i>
                <p class="mb-0">ย้อนกลับ</p>
              </div>
            </a>
            <a href="/table/create">
              <button type="button" class="btn btn-success btn-sm">เพิ่มโต๊ะ</button>
            </a>
          </div>
        <div class="container px-3 py-3">
            <h5>จัดการโต๊ะภายในร้าน</h5>
            <table class="table table-dark">
                <thead>
                  <tr>
                    <th scope="col">หมายเลขโต๊ะ</th>
                    <th scope="col">ประเภทโต๊ะ</th>
                    <th scope="col">สถานะ</th>
                  </tr>
                </thead>
                <tbody>
                    <% tableResult.forEach(element => { %>
                    <tr onclick="window.location.href='/table/manage/<%= element.id %>'">
                        <th scope="row"><%= element.table_number %></th>
                        <td>(<%= element.type_id %>) <%= element.description %> | <%= element.capacity_min %> - <%= element.capacity_max %> คน</td>
                        <td><%= tableStatusData[element.table_status].name %></td>
                    </tr>
                    <% }) %>
                </tbody>
              </table>        
        </div>
    </div>
    <%- include('../../template/bottom_nav') %>
    <script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.11.8/dist/umd/popper.min.js" integrity="sha384-I7E8VVD/ismYTF4hNIPjVp/Zjvgyol6VFvRkX/vR+Vc4jQkC+hVqc2pM8ODewa9r" crossorigin="anonymous"></script>
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.min.js" integrity="sha384-0pUGZvbkm6XF6gxjEnlmuGrJXVbNuzT9qBBavbLwCsOGabYfZo0T0to5eqruptLy" crossorigin="anonymous"></script>
</body>
</html>