<!DOCTYPE html>
<html>
<head>
     <title>Course Planner</title>
    <link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">
</head>
<body>
<h1>Edit Course</h1>

<form action="" method="POST">
    <input type="text" name="code" placeholder="Course Code" value="{{ course.code }}" required>
    <input type="text" name="name" placeholder="Course Name" value="{{ course.name }}" required>

    <label>Days:</label><br>
    {% set selected_days = course.day.split(',') %}
    <input type="checkbox" name="days" value="Mon" {% if 'Mon' in selected_days %}checked{% endif %}> Mon
    <input type="checkbox" name="days" value="Tue" {% if 'Tue' in selected_days %}checked{% endif %}> Tue
    <input type="checkbox" name="days" value="Wed" {% if 'Wed' in selected_days %}checked{% endif %}> Wed
    <input type="checkbox" name="days" value="Thu" {% if 'Thu' in selected_days %}checked{% endif %}> Thu
    <input type="checkbox" name="days" value="Fri" {% if 'Fri' in selected_days %}checked{% endif %}> Fri
    <input type="checkbox" name="days" value="Online" {% if 'Online' in selected_days %}checked{% endif %}> Online
    <br><br>

    <input type="text" name="time" placeholder="HH:MM-HH:MM (24-hour)" value="{{ course.time }}" required>
    <input type="number" name="credits" placeholder="Credits" value="{{ course.credits }}" required>
    <input type="text" name="semester" placeholder="Semester" value="{{ course.semester }}" required>
    <input type="text" name="type" placeholder="Type (Lecture/Lab)" value="{{ course.type }}" required>
    <input type="text" name="major" placeholder="Major" value="{{ course.major }}" required>

    <button type="submit">Update Course</button>
</form>

<a href="/">Back to Home</a>
</body>
</html>