<%- include("../partials/head") %> 

<% projectCategories.forEach(category => { %>
<div>
<h2><%= category %> </h2> 
<ul>
    <li>
        <form action="/tasks" method="post">
            <input type="text" id="task-input" name="task" value="Add new task"/>
            <input type="text" hidden id="category" name="category" value="<%=category%>">
            <input type="date" id="date" name="date" value="<%=today%>"/>
            <input type="submit" value="Add">
        </form>
    </li>
    <% local_data_file.forEach(task_item => { %>
        <% if (task_item.category == category) { %>
                <li> 
                    <form method="POST" action="/tasks/<%= task_item.taskID %>?_method=DELETE">
                        <%= task_item.task %> <%= task_item.date %> <a href="/tasks/<%= task_item.taskID %>/edit">Edit</a>
                         <button>Delete</button>
                    </form></li>
        <% } %>
    <% }) %>
</ul>
<% }) %>
</div>