<!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">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">

    <title>Storage</title>
</head>
<body>
    <div class ="container">
        <h1 class ="mb-2"> Storage items</h1>
        <a href = "/products/add" class = "btn btn-success">New Product</a>

        <% products.forEach(products => { %>
            <div class = "card mt-4">
              <div class ="card-body">
                  <h3 class = "card-title">
                    <%= products.name %>
                  </h3>
                  <div class = "card-subtitle text-muted mb-2">
                      <%= products.supplied.toLocaleDateString() %>
                  </div>

               <div class ="card-text mb-2"><%= products.quantity%></div>
               <a href = "products/<%= products.slug%>" class = "btn btn-primary">See more about product</a>
               <a href = "/products/edit/<%= products.id%>"
                class= "btn btn-info">Edit</a>
               <form action ="/products/<%= products.id%>?_method=DELETE" method = "POST" class = 
                "d-inline">
                   <button type = "submit" class ="btn btn-danger">Delete</button>
               </form>
              </div>
            </div>

        <% }) %>
    </div>
</body>
</html>
