<% if (allrecs.length > 0) {%>
    <table border="1">
        <tr>
            <th>Product ID</th>
            <th>Product Name</th>
            <th>Image</th>
            <th>Description</th>
            <th>Price</th>
            <th>Stock</th>
            <th>Homepage</th>
        </tr>
        <% allrecs.forEach((recref, index) => { %>
            <tr>
                <td><%= recref.product_id %></td>
                <td><%= recref.productname %></td>
                <td><%= recref.prodimage %></td>
                <td><%= recref.description %></td>
                <td><%= Intl.NumberFormat('en-US', { style: 'currency', currency: 'USD' }).format(recref.saleprice) %></td>
                <td><%= recref.stock %></td>
                <td><%= recref.homepage %></td>
                <td><a href='/product/<%= recref.product_id %>/show'>Details</a></td>
                <td><a href='/product/<%= recref.product_id%>/edit'>Edit</a></td>
                <td><a href='/product/<%= recref.product_id %>/delete' onclick="return confirm('Are you sure you want to delete this record?');">Delete</a></td>
            </tr>
        <% }); %>
    </table>
<% } else { %>
    <p>No Records Available</p>
<% } %>
<p> <a href='/product/addrecord'>Add New</a> </p>
    