{% extends 'sbas/base.html' %}

{% block title %}Generate Exam{% endblock %}

{% block content %}
  <div class="container mt-3">
    <h2>Generate Personal SBA Exam</h2>
    <p>Choose filters and provide a name for your exam. The created exam will be active and available for you to take.</p>

    <form method="post" action="{% url 'sbas:exam_create_from_filters_with_name' %}">
      {% csrf_token %}
      <div class="mb-3">
        <label for="exam-name" class="form-label">Exam name</label>
        <input type="text" class="form-control" id="exam-name" name="name" placeholder="My personal SBA exam">
      </div>

      <div class="mb-3">
        <label for="id_category" class="form-label">Category</label>
        <select id="id_category" name="category" class="form-select">
          <option value="">Any</option>
          {% for c in categories %}
            <option value="{{ c.id }}">{{ c.category }}</option>
          {% endfor %}
        </select>
      </div>

      <div class="mb-3">
        <label for="create-count" class="form-label">Number of questions (0 = all)</label>
        <input type="number" id="create-count" name="count" class="form-control" value="0" min="0">
      </div>

      <div class="form-check mb-3">
        <input class="form-check-input" type="checkbox" value="on" id="exclude-answered" name="exclude_answered">
        <label class="form-check-label" for="exclude-answered">
          Exclude questions I have already answered in other exams
        </label>
      </div>

      <button type="submit" class="btn btn-primary">Generate Exam</button>
    </form>
  </div>
{% endblock %}
