{% extends "base.html" %}

{% block content %}
    <h1>Edit Question</h1>
    <form method="POST">
        <div class="form-group">
            <label for="text">Question Text:</label>
            <textarea id="text" name="text" class="form-control" rows="3" required>{{ question.text }}</textarea>
        </div>
        <div class="form-group">
            <label for="question_type">Question Type:</label>
            <select id="question_type" name="question_type" class="form-control">
                <option value="multiple_choice" {% if question.question_type == 'multiple_choice' %}selected{% endif %}>Multiple Choice</option>
                <option value="yes_no" {% if question.question_type == 'yes_no' %}selected{% endif %}>Yes/No</option>
                <option value="likert" {% if question.question_type == 'likert' %}selected{% endif %}>Likert Scale</option>
            </select>
        </div>
        <div class="form-group">
            <label for="domain">Domain (Optional):</label>
            <input type="text" id="domain" name="domain" class="form-control" value="{{ question.domain or '' }}">
        </div>
        <div class="form-group">
            <label for="choices_and_scores">Choices and Scores (e.g., Option A:1|Option B:2):</label>
            <input type="text" id="choices_and_scores" name="choices_and_scores" class="form-control" value="{{ choices_str }}">
            <small class="form-text text-muted">Separate choices with '|' and text from score with ':' (e.g., Yes:1|No:0)</small>
        </div>
        <button type="submit" class="btn btn-primary">Update Question</button>
    </form>
{% endblock %}
