{% extends 'base.html' %}

{% block title %}{% if form.instance.pk %}Edit Note{% else %}New Note{% endif %} - PixelMinds{% endblock %}

{% block content %}
<div class="container mt-5">
  <h1>{% if form.instance.pk %}Edit Note{% else %}New Note{% endif %}</h1>
  <form method="post">
    {% csrf_token %}
    <div class="mb-3">
      <label for="id_title" class="form-label">Title</label>
      <input type="text" name="title" id="id_title" class="form-control" value="{{ form.title.value|default:'' }}" required>
    </div>
    <div class="mb-3">
      <label for="id_content" class="form-label">Content</label>
      <textarea name="content" id="id_content" class="form-control" rows="10" required>{{ form.content.value|default:'' }}</textarea>
    </div>
    <button type="submit" class="btn btn-primary">Save</button>
    <a href="{% if form.instance.pk %}{% url 'core:note_detail' form.instance.pk %}{% else %}{% url 'core:note_list' %}{% endif %}" class="btn btn-secondary">Cancel</a>
  </form>
</div>
{% endblock %}
