<!-- body bala logic yha pr hoga -->
<% layout('layouts/boilerplate')%>  <!--yha layouts k boiler plate ko use kiya h-->
<%- include('../partials/navbar') %>  <!--navbar ko add krne k liye-->
<%- include('../partials/flash') %>  <!--flash ko add krne k liye-->

<div class="row">
    
   <% for(let item of products){ %>

            <div class="col-lg-4 mt-3">
                <div class="card shadow mx-auto" style="width: 18rem;">
                    <img src="<%=item.img%>" class="card-img-top" alt="...">
                    <div class="card-body">
                      
                      <h5 class="card-title"><%=item.price %></h5>
                      <p class="card-text"><%=item.desc %></p>
                      <a href="/products/<%=item._id%>" class="btn btn-primary btn-info">View Product</a>
                      <% if(currentUser && currentUser.role =='seller'){ %>
                      <form class="d-inline-block" action="/products/<%=item._id%>?_method=DELETE" method="POST">
                        <button class="btn btn-sm btn-danger ">Delete</button>
                      </form>
                  <%  }  %>
                    </div>
                  </div>
                
            </div>
  <%  }   %>
   
</div>
</body>
</html>