<!--

    Queue - A Queueing system that can be used to handle labs in higher education
    Copyright (C) 2016-2024  Delft University of Technology

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU Affero General Public License as
    published by the Free Software Foundation, either version 3 of the
    License, or (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Affero General Public License for more details.

    You should have received a copy of the GNU Affero General Public License
    along with this program.  If not, see <https://www.gnu.org/licenses/>.

-->
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" layout:decorate="~{edition/view}">
    <head>
        <title th:text="|Edit Assignment|"></title>

        <script src="/webjars/momentjs/min/moment.min.js"></script>
    </head>

    <body>
        <section layout:fragment="subcontent">
            <form th:with="action = @{/assignment/{id}/edit(id=${assignment.id})}" th:action="${action}" th:method="patch" class="flex vertical">
                <h3 class="font-500 mb-3">Edit Assignment</h3>

                <div class="grid col-2 gap-3 align-center" style="--col-1: minmax(0, 14rem)">
                    <label for="assignment-name" th:text="Name"></label>
                    <input
                        id="assignment-name"
                        th:name="name"
                        th:field="*{assignment.name}"
                        placeholder="Enter name"
                        type="text"
                        class="textfield"
                        required />

                    <label for="assignment-description" th:text="Description"></label>
                    <textarea
                        id="assignment-description"
                        th:name="description.text"
                        class="textfield"
                        th:text="${assignment.description?.text}"
                        placeholder="Enter description"></textarea>

                    <label for="assignment-deadline">Deadline</label>
                    <input
                        id="assignment-deadline"
                        th:name="deadline"
                        th:value="${#temporals.format(assignment.deadline, 'yyyy-MM-dd''T''HH:mm')}"
                        type="datetime-local"
                        class="textfield" />
                </div>

                <div class="flex space-between">
                    <a th:href="@{/edition/{eId}/modules(eId=${edition.id})}" th:text="Cancel" class="button p-less" data-style="outlined"></a>
                    <button type="submit" class="button p-less" th:text="Save"></button>
                </div>
            </form>
        </section>
    </body>
</html>
