mirror of
https://github.com/mrfluffy-dev/PRG381.git
synced 2026-01-17 10:20:33 +00:00
done bra
This commit is contained in:
62
target/classes/templates/admin.html
Normal file
62
target/classes/templates/admin.html
Normal file
@@ -0,0 +1,62 @@
|
||||
<!DOCTYPE html>
|
||||
<html xmlns:th="http://www.thymeleaf.org"
|
||||
xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity3">
|
||||
<head>
|
||||
<meta charset="ISO-8859-1">
|
||||
<title>Registration and Login App</title>
|
||||
|
||||
<link rel="stylesheet"
|
||||
href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"
|
||||
integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u"
|
||||
crossorigin="anonymous">
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<!-- create navigation bar ( header) -->
|
||||
<nav class="navbar navbar-inverse navbar-fixed-top">
|
||||
<div class="container">
|
||||
<div class="navbar-header">
|
||||
<button type="button" class="navbar-toggle collapsed"
|
||||
data-toggle="collapse" data-target="#navbar" aria-expanded="false"
|
||||
aria-controls="navbar">
|
||||
<span class="sr-only">Toggle navigation</span> <span
|
||||
class="icon-bar"></span> <span class="icon-bar"></span> <span
|
||||
class="icon-bar"></span>
|
||||
</button>
|
||||
<a class="navbar-brand" href="#" th:href="@{/}">Registration and
|
||||
Login Module</a>
|
||||
</div>
|
||||
<div id="navbar" class="collapse navbar-collapse">
|
||||
<ul class="nav navbar-nav">
|
||||
<li sec:authorize="isAuthenticated()"><a th:href="@{/logout}">Logout</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<br>
|
||||
<br>
|
||||
|
||||
<table class="table table-dark">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">#</th>
|
||||
<th scope="col">FirstName</th>
|
||||
<th scope="col">LastName</th>
|
||||
<th scope="col">Email</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr th:each="user : ${listUsers}">
|
||||
<th th:text="${user.id}"></th>
|
||||
<td th:text="${user.firstName}"></td>
|
||||
<td th:text="${user.lastName}"></td>
|
||||
<td th:text="${user.email}"></td>
|
||||
<td> <a th:href="@{/showFormForUpdate/{id}(id=${user.id})}" class="btn btn-primary">Update</a>
|
||||
<a th:href="@{/deleteEmployee/{id}(id=${user.id})}" class="btn btn-danger">Delete</a>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
@@ -29,6 +29,7 @@
|
||||
<div id="navbar" class="collapse navbar-collapse">
|
||||
<ul class="nav navbar-nav">
|
||||
<li sec:authorize="isAuthenticated()"><a th:href="@{/logout}">Logout</a></li>
|
||||
<li sec:authorize="isAuthenticated()"><a th:href="@{/admin}">Admin</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
@@ -41,8 +42,6 @@
|
||||
<h1>Registration and Login with Spring Boot, Spring Security,
|
||||
Thymeleaf, Hibernate and MySQL</h1>
|
||||
Welcome <span sec:authentication="principal.username"> User</span>
|
||||
<button type="button" class="btn btn-primary"
|
||||
th:href="@{/admin}">admin</button>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
39
target/classes/templates/update_user.html
Normal file
39
target/classes/templates/update_user.html
Normal file
@@ -0,0 +1,39 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en" xmlns:th="http://www.thymeleaf.org">
|
||||
<head>
|
||||
<meta charset="ISO-8859-1">
|
||||
<title>Employee Management System</title>
|
||||
|
||||
<link rel="stylesheet"
|
||||
href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css">
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<h1>Employee Management System</h1>
|
||||
<hr>
|
||||
<h2>Update Employee</h2>
|
||||
|
||||
<form action="#" th:action="@{/saveUser}" th:object="${user}"
|
||||
method="POST" th:href="@{/admin}">
|
||||
|
||||
<!-- Add hidden form field to handle update -->
|
||||
<input type="hidden" th:field="*{id}" />
|
||||
|
||||
<input type="text" th:field="*{firstName}" class="form-control mb-4 col-4">
|
||||
|
||||
<input type="text" th:field="*{lastName}" class="form-control mb-4 col-4">
|
||||
|
||||
<input type="text" th:field="*{email}" class="form-control mb-4 col-4">
|
||||
|
||||
<input type="text" th:field="*{password}" class="form-control mb-4 col-4">
|
||||
|
||||
|
||||
<button type="submit" class="btn btn-info col-2" th:href = "@{/admin}"> Update User</button>
|
||||
</form>
|
||||
|
||||
<hr>
|
||||
|
||||
<a th:href = "@{/admin}"> Back to User List</a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user