mirror of
https://github.com/Prominence/car-repair-site.git
synced 2026-01-09 19:56:43 +03:00
64 lines
2.3 KiB
HTML
64 lines
2.3 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="header">
|
|
<h1 th:text="#{client.title}"></h1>
|
|
</div>
|
|
<div layout:fragment="content">
|
|
<div class="float-right mb-3">
|
|
<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> </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.phone}"></td>
|
|
<td>
|
|
<div class="btn-group float-right">
|
|
<a th:href="@{/client/edit/{id}(id=${client.id})}" class="btn btn-secondary" 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> |