<%- include("./partials/header") %>
<nav class="navbar navbar-expand-lg bg-light">
    <div class="container-fluid">
      <a class="navbar-brand" href="#">Todo list nodejs</a>
      <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
        <span class="navbar-toggler-icon"></span>
      </button>
    </div>
  </nav>

  <div class="container">
    <div class="row justify-content-center">
        <div class="col-md-8 mt-5">
            <form action="/add/todo" method="POST">
                <div class="input-group mb-3">
                    <input type="text" class="form-control" placeholder="Ingresar tarea" aria-label="" name="todo" aria-describedby="button-addon2">
                    <button class="btn btn-outline-primary" type="submit" id="button-addon2">Agregar</button>
                </div>
            </form>

            <ul class="list-group mt-5">
                <% todo.forEach(todos => { %>
                  <li class="list-group-item d-flex justify-content-between align-items-center">
                    <%= todos.todo %>
                    <a href="/delete/todo/<%= todos._id %>"><span class="badge bg-danger rounded-pill">Borrar</span></a>
                  </li>
                <% }) %> 
            </ul>
        </div>
    </div>
  </div>
    

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