feat: add iteration one attendance workflows

This commit is contained in:
sechmachine
2026-08-15 00:43:21 +07:00
parent c01c0089ac
commit 8b48e281f7
44 changed files with 2019 additions and 169 deletions
@@ -0,0 +1,42 @@
<!doctype html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Global calendar</title>
</head>
<body>
<main>
<h1>Global calendar</h1>
<p th:if="${message}" role="status" th:text="${message}"></p>
<form method="post" th:action="@{/attendance/calendar}">
<label for="date">Date</label>
<input id="date" name="date" type="date" required th:min="${today}">
<label for="name">Name</label>
<input id="name" name="name" type="text" maxlength="200" required>
<label><input name="dayOff" type="checkbox" value="true"> Day off</label>
<button type="submit">Add event</button>
</form>
<p th:if="${#lists.isEmpty(events)}">No upcoming calendar events.</p>
<table th:unless="${#lists.isEmpty(events)}">
<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 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 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 type="submit">Save</button>
</form>
</td>
</tr>
</tbody>
</table>
</main>
</body>
</html>
@@ -0,0 +1,55 @@
<!doctype html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Attendance history</title>
</head>
<body>
<main>
<h1 th:text="${ownHistory} ? 'My attendance' : 'Intern attendance'">Attendance</h1>
<p th:if="${message}" role="status" th:text="${message}"></p>
<p th:if="${error}" role="alert" th:text="${error}"></p>
<form th:if="${ownHistory}" method="post" th:action="@{/attendance/check-in}">
<button type="submit">Check in</button>
</form>
<form th:if="${ownHistory}" method="post" th:action="@{/attendance/check-out}">
<button type="submit">Check out</button>
</form>
<form method="get">
<label for="from">From</label>
<input id="from" name="from" type="date" th:value="${from}">
<label for="to">To</label>
<input id="to" name="to" type="date" th:value="${to}">
<button type="submit">Filter</button>
</form>
<p th:if="${#lists.isEmpty(items)}">No attendance records in this period.</p>
<table th:unless="${#lists.isEmpty(items)}">
<caption>Attendance records and applied policy</caption>
<thead>
<tr>
<th scope="col">Date</th>
<th scope="col">Check in</th>
<th scope="col">Check out</th>
<th scope="col">Applied schedule</th>
<th scope="col">Grace</th>
<th scope="col">Result</th>
</tr>
</thead>
<tbody>
<tr th:each="item : ${items}">
<td th:text="${item.workDate}"></td>
<td th:text="${item.checkInAt}"></td>
<td th:text="${item.checkOutAt == null ? 'Missing' : item.checkOutAt}"></td>
<td th:text="|${item.policy.scheduledStart}${item.policy.scheduledEnd} (${item.policy.zoneId})|"></td>
<td th:text="|${item.policy.checkInGraceMinutes} min / ${item.policy.checkoutGraceMinutes} min|"></td>
<td th:text="${item.violations.missingCheckout ? 'Missing checkout' : (item.violations.earlyDeparture ? 'Early departure' : (item.violations.late ? 'Late' : 'On time'))}"></td>
</tr>
</tbody>
</table>
</main>
</body>
</html>