swt23w23/src/main/resources/templates/staff.html

59 lines
1.9 KiB
HTML
Raw Normal View History

2023-11-10 17:09:39 +01:00
<!DOCTYPE html>
<html
xmlns:th="http://www.thymeleaf.org"
2023-11-13 20:09:39 +01:00
xmlns:sec="http://www.thymeleaf.org/extras/spring-security"
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
layout:decorate="~{layout.html(title='Angestellte')}"
>
<head> </head>
2023-11-10 17:09:39 +01:00
<body>
2023-11-15 17:27:04 +01:00
<div layout:fragment="content">
<div>
2023-11-13 20:09:39 +01:00
<h2>Mitarbeiterdetails</h2>
2023-11-15 17:27:04 +01:00
<table class="table">
2023-11-13 20:09:39 +01:00
<tr>
<th>Name</th>
2023-11-13 20:09:39 +01:00
<th>Beruf</th>
2023-11-15 17:27:04 +01:00
<th></th>
<th></th>
2023-11-13 20:09:39 +01:00
</tr>
2023-11-10 17:09:39 +01:00
<tr th:each="employee : ${staff}">
<td th:text="${employee.name}">Max</td>
<td th:text="${employee.job}">Koch</td>
2023-11-13 20:09:39 +01:00
<td>
<a th:href="@{'/staff/edit/' + ${employee.id}}"
><button class="btn btn-warning">Bearbeiten</button></a
>
2023-11-13 20:09:39 +01:00
</td>
<td>
<form th:action="@{/staff/remove}" method="post">
<input type="hidden" th:name="id" th:value="${employee.id}" />
2023-11-15 17:27:04 +01:00
<button type="submit" class="btn btn-danger">Entfernen</button>
2023-11-13 20:09:39 +01:00
</form>
</td>
</tr>
</table>
</div>
2023-11-15 17:27:04 +01:00
<div>
2023-11-13 20:09:39 +01:00
<h2>Personal Hinzufügen</h2>
<form th:object="${form}" th:action="@{/staff/add}" method="post">
2023-11-15 17:27:04 +01:00
<div class="mb-3">
<label class="form-label" for="name">Name</label>
<input class="form-control" type="text" th:field="*{name}" th:errorclass="is-invalid" required>
<div th:if="${#fields.hasErrors('name')}" class="invalid-feedback">Ungültiger Name</div>
2023-11-15 17:27:04 +01:00
</div>
<div class="mb-3">
2023-11-21 16:02:42 +01:00
<label class="form-label" for="job">Beruf:</label>
<select th:field="*{job}" class="form-select" th:errorclass="is-invalid">
2023-11-21 16:02:42 +01:00
<option th:each="type : ${T(catering.staff.JobType).values()}" th:value="${type}" th:text="${type}" required></option>
</select>
<div th:if="${#fields.hasErrors('job')}" class="invalid-feedback">Ungültiger Job</div>
2023-11-15 17:27:04 +01:00
</div>
<button class="btn btn-primary" type="submit">Hinzufügen</button>
2023-11-13 20:09:39 +01:00
</form>
</div>
2023-11-15 17:27:04 +01:00
</div>
2023-11-10 17:09:39 +01:00
</body>
</html>