63 lines
2.2 KiB
HTML

<!doctype html>
<html lang="en" xmlns:th="http://www.thymeleaf.org" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
layout:decorate="~{main}">
<head>
<title th:text="#{default.title}"></title>
<script th:inline="javascript">
function deleteClientById(id) {
const confirmationResult = confirm(/*[[#{common.deleteConfirmation.label}]]*/);
if (confirmationResult) {
const url = /*[[@{/client/delete/}]]*/;
$.ajax({
url: url + id,
type: 'DELETE',
success: function () {
$('#client-row-' + id).remove();
}
});
}
}
</script>
</head>
<body>
<div layout:fragment="content">
<h1 th:text="#{client.title}"></h1>
<div class="pull-right">
<a class="btn btn-success" th:href="@{/client/create}" th:text="#{common.create.button}"></a>
</div>
<table class="table table-striped table-hover" th:unless="${clientList.isEmpty()}">
<thead>
<tr>
<th th:text="#{firstName.label}"></th>
<th th:text="#{middleName.label}"></th>
<th th:text="#{lastName.label}"></th>
<th th:text="#{phoneNo.label}"></th>
<th>&nbsp;</th>
</tr>
</thead>
<tbody>
<tr th:each="client : ${clientList}" th:id="'client-row-' + ${client.id}">
<td th:text="${client.firstName}"></td>
<td th:text="${client.middleName}"></td>
<td th:text="${client.lastName}"></td>
<td th:text="${client.phoneNo}"></td>
<td>
<div class="btn-group pull-right">
<a th:href="@{/client/edit/{id}(id=${client.id})}" class="btn btn-default" th:text="#{common.edit.button}"></a>
<button type="button" class="btn btn-danger" th:onclick="'deleteClientById(' + ${client.id} + ')'" th:text="#{common.delete.button}"></button>
</div>
</td>
</tr>
</tbody>
</table>
<div th:if="${clientList.isEmpty()}" th:text="#{common.nothingFound.label}"></div>
<div th:replace="common::pagination(${totalPages})"></div>
</div>
</body>
</html>