Files
labtimesheet/src/main/resources/templates/attendance/calendar.html
T

45 lines
2.7 KiB
HTML

<!doctype html>
<html lang="en" xmlns:th="http://www.thymeleaf.org"
th:replace="~{fragments/layout :: shell(
pageTitle='Global calendar',
section='Admin',
activeNav='calendar',
primaryAction=~{::#primary-action},
content=~{::main})}">
<body>
<a id="primary-action" class="button" th:href="@{/dashboard}">Back to overview</a>
<main>
<p class="page-description">Maintain the global events and day-off rules applied to attendance.</p>
<p class="alert" th:if="${message}" role="status" th:text="${message}"></p>
<form class="panel form-panel form-grid" method="post" th:action="@{/attendance/calendar}">
<div class="form-grid form-grid-three">
<div class="field"><label class="field-label" for="date">Date</label><input class="control" id="date" name="date" type="date" required th:min="${today}"></div>
<div class="field"><label class="field-label" for="name">Name</label><input class="control" id="name" name="name" type="text" maxlength="200" required></div>
<label class="checkbox"><input name="dayOff" type="checkbox" value="true"> <span>Day off</span></label>
</div>
<div class="form-actions"><button class="button button-primary" type="submit">Add event</button></div>
</form>
<section class="panel" th:if="${#lists.isEmpty(events)}"><th:block th:replace="~{fragments/components :: empty('No upcoming calendar events', 'Added events and global days off will appear here.')} "></th:block></section>
<div class="panel table-scroll" th:unless="${#lists.isEmpty(events)}"><table class="data-table">
<caption>Upcoming global events</caption>
<thead><tr><th scope="col">Date</th><th scope="col">Name</th><th scope="col">Day off</th><th scope="col">Save</th></tr></thead>
<tbody>
<tr th:each="event : ${events}">
<td><input class="control" name="date" type="date" required th:min="${today}" th:value="${event.date}" th:attr="form=|event-${event.id}|" aria-label="Event date"></td>
<td><input class="control" name="name" type="text" maxlength="200" required th:value="${event.name}" th:attr="form=|event-${event.id}|" aria-label="Event name"></td>
<td><input name="dayOff" type="checkbox" value="true" th:checked="${event.dayOff}" th:attr="form=|event-${event.id}|" aria-label="Day off"></td>
<td>
<form method="post" th:id="|event-${event.id}|" th:action="@{/attendance/calendar/{id}(id=${event.id})}">
<input name="version" type="hidden" th:value="${event.version}">
<button class="button" type="submit">Save</button>
</form>
</td>
</tr>
</tbody>
</table></div>
</main>
</body>
</html>