<%- include('partials/head', {title :'Enter your daily weight'}) %>
<%- include('partials/header') %>

<body>
    <% if (user) { %>
        <h1>Hello <%= user.userName %>, </h1>
      <% } %>

    <form class="weight" action="/weights/createWeight" method='POST'>
        <label>Please enter your weight for:</label>
            <input type="date" name="date" id="date" min="1980-01-01" max="2023-01-01" required>
        <label>Enter your current weight</label>
            <input class="lbs" type="text" placeholder="lbs" name='weightItem'>
        
        <input type="submit">
    </form>

    <div class="mt-lg">
    <h5>Your current tracked weights</h5>
    <ul class="tracked-weights">
        <% weights.forEach( el => { %>
                <li class='cell' data-id='<%=el._id%>'>
                    <span class='<%= el.completed === true ? 'completed' : 'not'%>'><%= el.currentWeight %></span>
                    <!-- <span class='<%= el.completed === true ? 'completed' : 'not'%>'><%= el.date %></span> -->
                    <!-- <span class='del'> Delete </span> -->
                </li>
        <% }) %>    
    </ul>
    </div>

    <script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
    <script src="js/main.js"></script>
</body>

<%- include("partials/footer") %>