<% layout('layouts/email') %>
<% const dayNames = ["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]; %>
<h2 align="center" style="margin-bottom:5;"><b><%= event.name %></b> </h2>
<p align="center" style="margin-top: 0;">
  <%= dateOutput(event.eventStart) %>
  <% if (dateOutput(event.eventStart) != dateOutput(event.eventEnd)) { %> to
  <%= dateOutput(event.eventEnd) %>
  <% } %>
</p>
<p style="margin-bottom:0;">Please find the catering information for the event below<%= event.catering.choiceRequired ? ', and indicate your choices for the event.' : '.' %></p>
<% const catering = JSON.parse(JSON.stringify(event.catering)) %>
<% if (catering.menu) { %>
<% for (var d = new Date(event.eventStart); d <= new Date(event.eventEnd); d.setDate(d.getDate() + 1)) { %>
    <b><%=  dayNames[new Date(d).getDay()] %></b><br/>
    <% for (meal of Object.keys(catering?.menu[dayNames[new Date(d).getDay()]].meals)) { %>
        <p><b><%= catering.menu.Saturday.meals[meal].name %></b></p>
        <ul>
        <% for (option of catering.menu[dayNames[new Date(d).getDay()]].meals[meal].options){ %>
            <li><%= option %></li>
        <% } %>
        </ul>
    <% } %>
<% }} %>
<% if (event.catering.choiceRequired) { %>
    <a href="<%= rootUrl %>/events/<%= event._id %>/catering">Please indicate your choices online</a>
<% } %>