-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
create car, car list dan edit car html
- Loading branch information
1 parent
2cee9f6
commit 036c36f
Showing
3 changed files
with
113 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<!DOCTYPE html> | ||
<html lang="en" xmlns:th="http://www.thymeleaf.org"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>Car List</title> | ||
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous"> | ||
</head> | ||
<body> | ||
|
||
<div class="container my-2"> | ||
<h2>Car' List</h2> | ||
<a th:href="@{/car/createCar}" class="btn btn-primary btn-sm mb-3">Create Car</a> | ||
|
||
<table border="1" class="table table-striped table-responsive-md"> | ||
<thead> | ||
<tr> | ||
<th scope="col">Car Name</th> | ||
<th scope="col">Quantity</th> | ||
<th scope="col">Color</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr th:each="car: ${cars}"> | ||
<td th:text="${car.carName}"></td> | ||
<td th:text="${car.carColor}"></td> | ||
<td th:text="${car.carQuantity}"></td> | ||
<td> | ||
<a th:href="@{/car/editCar/{id}(id=${car.carId})}" class="btn btn-info btn-sm">Edit</a> | ||
</td> | ||
<td> | ||
<form th:action="@{/car/deleteCar}" method="post" > | ||
<input type="hidden" th:name="carId" th:value="${car.carId}" /> | ||
<button type="submit" class="btn btn-danger btn-sm">Delete</button> | ||
</form> | ||
</td> | ||
</tr> | ||
|
||
</tbody> | ||
</table> | ||
</div> | ||
|
||
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p" crossorigin="anonymous"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<!DOCTYPE html> | ||
<html lang="en" xmlns:th="http://www.thymeleaf.org"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>Create New Car</title> | ||
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css"rel="stylesheet" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERd`knLPMO" crossorigin="anonymous"> | ||
</head> | ||
<body> | ||
|
||
<div class="container"> | ||
<h3>Create New Car</h3> | ||
|
||
<form th:action="@{/car/createCar}" th:object="${car}" method="post"> | ||
<div class="form-group"> | ||
<label for="nameInput">Name</label> | ||
<input th:field="*{carName}" type="text" class="form-control mb-4 col-4" id="nameInput" placeholder="Enter car' name"> | ||
</div> | ||
<div class="form-group"> | ||
<label for="colorInput">Color</label> | ||
<input th:field="*{carColor}" type="text" class="form-control mb-4 col-4" id="colorInput" placeholder="Enter car' color"> | ||
</div> | ||
<div class="form-group"> | ||
<label for="quantityInput">Quantity</label> | ||
<input th:field="*{carQuantity}" type="text" class="form-control mb-4 col-4" id="quantityInput" placeholder="Enter car' quantity"> | ||
</div> | ||
|
||
<button type="submit" class="btn btn-primary">Submit</button> | ||
</form> | ||
</div> | ||
|
||
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p" crossorigin="anonymous"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/tailwind.min.css" rel="stylesheet"> | ||
<title>Edit Car</title> | ||
</head> | ||
<body class="bg-gray-100"> | ||
<div class="container mx-auto mt-8"> | ||
<h1 class="text-3xl font-bold mb-4">Edit Car</h1> | ||
|
||
<form th:action="@{/car/editCar}" method="post" th:object="${car}" class="max-w-md bg-white p-6 rounded-md shadow-md"> | ||
<input type="hidden" th:field="*{carId}" /> | ||
<div class="mb-4"> | ||
<label for="carName" class="block text-sm font-medium text-gray-600">Car Name</label> | ||
<input type="text" id="carName" th:field="*{carName}" name="carName" th:value="${car.carName}" class="mt-1 p-2 w-full border rounded-md"> | ||
</div> | ||
|
||
<div class="mb-4"> | ||
<label for="carColor" class="block text-sm font-medium text-gray-600">Car Color</label> | ||
<input th:field="*{carColor}" type="text" id="carColor" name="carQuantity" th:value="${car.carColor}" class="mt-1 p-2 w-full border rounded-md"> | ||
</div> | ||
|
||
<div class="mb-4"> | ||
<label for="carQuantity" class="block text-sm font-medium text-gray-600">Car Quantity</label> | ||
<input th:field="*{carQuantity}" type="number" id="carQuantity" name="carQuantity" th:value="${car.carQuantity}" class="mt-1 p-2 w-full border rounded-md"> | ||
</div> | ||
|
||
<div class="flex justify-end"> | ||
<button type="submit" class="bg-blue-500 text-white px-4 py-2 rounded-md">Save Changes</button> | ||
</div> | ||
</form> | ||
</div> | ||
</body> | ||
</html> |