mirror of
https://github.com/Prominence/car-repair-site.git
synced 2026-07-03 03:06:47 +03:00
Added CRUD for 'Client' entity. Added common templates and demo data populator.
This commit is contained in:
@@ -3,11 +3,58 @@
|
||||
layout:decorate="~{main}">
|
||||
<head>
|
||||
<title th:text="#{default.title}"></title>
|
||||
|
||||
<script th:inline="javascript">
|
||||
function deleteClientById(id) {
|
||||
const confirmationResult = confirm("Are you sure to delete?");
|
||||
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}">Create</a>
|
||||
</div>
|
||||
|
||||
<table class="table table-striped table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>First Name</th>
|
||||
<th>Middle Name</th>
|
||||
<th>Last Name</th>
|
||||
<th>Phone No</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.phoneNo}"></td>
|
||||
<td>
|
||||
<div class="btn-group pull-right">
|
||||
<a th:href="@{/client/edit/{id}(id=${client.id})}" class="btn btn-default">Edit</a>
|
||||
<button type="button" class="btn btn-danger" th:onclick="'deleteClientById(' + ${client.id} + ')'">Delete</button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div th:replace="common::pagination(@{/client/}, ${page}, ${totalPages})"></div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
|
||||
Reference in New Issue
Block a user