<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>OpenKDS &raquo; Orders</title>
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z" crossorigin="anonymous">
    
    <style>
        
        body {
            background-color: #f8f9fa;
        }
        
        
        
        
    </style>
    
</head>
<body>
    
    <nav class="navbar navbar-expand-lg navbar-light bg-light">
        <a class="navbar-brand" href="#">OpenKDS</a>
        <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
            <span class="navbar-toggler-icon"></span>
        </button>
        
        <div class="collapse navbar-collapse" id="navbarSupportedContent">
            <ul class="navbar-nav mr-auto">
                <li class="nav-item">
                    <a class="nav-link" href="/web/dashboard">Dashboard</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" href="/web/stations">Stations</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" href="/web/stationtypes">Station Types</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link active" href="/web/orders">Orders</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" href="/web/items">Menu Items</a>
                </li>
            </ul>
        </div>
    </nav>
    
    <div class="container">
        <div class="row">
            <div class="col-12">
                <h1>Orders</h1>
                <p>View and manage all orders.</p>
                <a href="/web/orders/create" class="btn btn-primary">Create Order Manually</a>
            </div>
        </div>
    </div>
    
    <hr />
    
    <div class="container">
        <table class="table">
            <tr>
                <th>Order ID</th>
                <th>Order Items</th>
                <th>Order Source</th>
                <th>Order Type</th>
                <th>Order Created At</th>
                <th>Order Actions</th>
            </tr>

            <% for (let i = 0; i < orders.length; i++) {
                const order = orders[i]; 
            %>

            <tr>
                <td><%= order.id %></td>
                <td>
                    <% for (let j = 0; j < order.items.length; j++) {
                        const item = order.items[j]; 
                    %>
                        <span class="badge badge-primary"><%= item.name %></span>
                    <% } %>
                </td>
                <td><%= order.source %></td>
                <td><%= order.order_type %></td>
                <td><%= order.time %></td>
                <td>
                    <a href="/web/orders/<%= order.id %>/edit" class="btn btn-primary">Edit</a>
                    <a href="/web/orders/<%= order.id %>/delete" class="btn btn-danger">Delete</a>
                </td>
            </tr>



                
            <% } %>

        </table>
        

        
        


        
        
    </div>
    
    
</body>
</html>