Food Menu Management

All Food Items

<% foods.forEach(food => { %> <% }) %>
Image Name Category Price Discount Prep Time Status Rating Actions
<% if (food.image) { %> <%= food.name %> <% } else { %>
<% } %>
<%= food.name %> <%= food.category.charAt(0).toUpperCase() + food.category.slice(1) %> $<%= food.price.toFixed(2) %> <% if (food.discountPrice) { %> $<%= food.discountPrice.toFixed(2) %> <% } else { %> - <% } %> <%= food.prepTime %> mins <% if (food.isAvailable) { %> Available <% } else { %> Unavailable <% } %>
<% for(let i = 1; i <= 5; i++) { %> <% if (i <= Math.floor(food.rating)) { %> <% } else if (i === Math.ceil(food.rating) && food.rating % 1 !== 0) { %> <% } else { %> <% } %> <% } %> (<%= food.totalRatings || 0 %>)

<%= foods.length %>

Total Items

<%= foods.filter(f => f.isAvailable).length %>

Available Items

<% const avgRating = foods.reduce((sum, f) => sum + (f.rating || 0), 0) / (foods.length || 1); %> <%= avgRating.toFixed(1) %>

Average Rating

<%= foods.filter(f => f.discountPrice).length %>

Discounted Items