<% title = 'Edit Note - MyNotes' %>
<%- include('../partials/header') %>

<div class="card">
  <h1>Edit Note</h1>
  <form action="/notes/<%= note.id %>?_method=PUT" method="POST">
    <label for="title">Title</label>
    <input type="text" id="title" name="title" value="<%= note.title || '' %>" required>

    <label for="content">Content</label>
    <textarea id="content" name="content" rows="10"><%= note.content || '' %></textarea>

    <button type="submit" class="btn btn-primary">Save Changes</button>
    <a href="/notes" class="btn btn-secondary">Cancel</a>
  </form>

  <form action="/notes/<%= note.id %>/email" method="POST" class="inline-form" style="margin-top:1rem;">
    <button type="submit" class="btn btn-secondary">Email this note to me</button>
  </form>
</div>

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