{% extends "staff/staff_layout.html" %}
{% block staff_content %}

<h3>Edit Exam</h3>
<br>
<form class="form-group" action="{{ url_for('update_exam_details',e_code=exam_info[0]) }}" method="post">
    {% if msg %}
    <div class="msg alert alert-danger">{{ msg }}</div>
    {% endif %}

    <div class="form-floating">
        <input type="text" class="shadow form-control has-validation" name="exam_title" placeholder="Enter Exam Title"
            id="exam_title" value="{{ exam_info[1] }}" required>
        <label for="exam_title">Enter Exam Title</label>
    </div><br>
    <div class="form-floating">
        <textarea class="shadow form-control has-validation" name="exam_instructions"
            placeholder="Enter Exam Instructions" id="exam_instructions" style="width: 100%; height: 120px">{{ exam_info [2] }}</textarea>
        <label for="exam_instructions">Enter Exam Instructions</label>
    </div><br>
    <div class="row">
        <div class="col">
            <div class="form-floating">
                <select class="shadow form-select" id="{{ exam_info[9] }}" name="subject">
                    {% for sub in subjects %}
                    <option value='{{ sub[0] }}'>{{sub[1]}}</option>
                    {% endfor %}
                </select>
                <label for="subject">Subject</label>
            </div><br>
        </div>
        <div class="col">
            <div class="form-floating">
                <input type="text" class="shadow form-control has-validation" name="exam_time_limit"
                    placeholder="Enter Time Limit" id="exam_time_limit" value="{{ exam_info[3] }}" required>
                <label for="exam_time_limit">Enter Time Limit (in minutes)</label>
            </div><br>
        </div>
    </div>
    <div class="row">
        <div class="col">
            <div class="form-floating">
                <input type="text" class="shadow form-control has-validation" name="exam_total_marks"
                    placeholder="Enter Total Marks" id="exam_total_marks" value="{{ exam_info[5] }}" required>
                <label for="exam_no_of_questions">Enter Total Marks</label>
            </div><br>
        </div>
    </div>
    <div class="row">
        <div class="col">
            <div class="form-floating">
                <input type="date" class="shadow form-control has-validation" name="exam_start_date"
                    placeholder="Enter Start Date" id="exam_start_date" value="{{ exam_info[6] }}" required>
                <label for="exam_start_date">Enter Start Date</label>
            </div><br>
        </div>
        <div class="col">
            <div class="form-floating">
                <input type="date" class="shadow form-control has-validation" name="exam_end_date"
                    placeholder="Enter End Date" id="exam_end_date" value="{{ exam_info[7] }}" required>
                <label for="exam_end_date">Enter End Date</label>
            </div><br>
        </div>
    </div>
    <button type="submit" class="btn btn-primary">Save Details</button>
</form>

{% endblock %}