forked from springframeworkguru/sfg-pet-clinic
-
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.
adding forms from PetClinic. springframeworkguru#56
- Loading branch information
1 parent
03b09b7
commit b4a5042
Showing
2 changed files
with
99 additions
and
0 deletions.
There are no files selected for viewing
38 changes: 38 additions & 0 deletions
38
pet-clinic-web/src/main/resources/templates/pets/createOrUpdatePetForm.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,38 @@ | ||
<html xmlns:th="http://www.thymeleaf.org" | ||
th:replace="~{fragments/layout :: layout (~{::body},'owners')}"> | ||
|
||
<body> | ||
|
||
<h2> | ||
<th:block th:if="${pet['new']}">New </th:block> | ||
Pet | ||
</h2> | ||
<form th:object="${pet}" class="form-horizontal" method="post"> | ||
<input type="hidden" name="id" th:value="*{id}" /> | ||
<div class="form-group has-feedback"> | ||
<div class="form-group"> | ||
<label class="col-sm-2 control-label">Owner</label> | ||
<div class="col-sm-10"> | ||
<span th:text="${pet.owner?.firstName + ' ' + pet.owner?.lastName}" /> | ||
</div> | ||
</div> | ||
<input | ||
th:replace="~{fragments/inputField :: input ('Name', 'name', 'text')}" /> | ||
<input | ||
th:replace="~{fragments/inputField :: input ('Birth Date', 'birthDate', 'date')}" /> | ||
<input | ||
th:replace="~{fragments/selectField :: select ('Type', 'type', ${types})}" /> | ||
</div> | ||
<div class="form-group"> | ||
<div class="col-sm-offset-2 col-sm-10"> | ||
<button | ||
th:with="text=${pet['new']} ? 'Add Pet' : 'Update Pet'" | ||
class="btn btn-default" type="submit" th:text="${text}">Add | ||
Pet</button> | ||
</div> | ||
</div> | ||
</form> | ||
|
||
</body> | ||
|
||
</html> |
61 changes: 61 additions & 0 deletions
61
pet-clinic-web/src/main/resources/templates/pets/createOrUpdateVisitForm.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,61 @@ | ||
<html xmlns:th="http://www.thymeleaf.org" | ||
th:replace="~{fragments/layout :: layout (~{::body},'owners')}"> | ||
|
||
<body> | ||
|
||
<h2> | ||
<th:block th:if="${visit['new']}">New </th:block> | ||
Visit | ||
</h2> | ||
|
||
<b>Pet</b> | ||
<table class="table table-striped"> | ||
<thead> | ||
<tr> | ||
<th>Name</th> | ||
<th>Birth Date</th> | ||
<th>Type</th> | ||
<th>Owner</th> | ||
</tr> | ||
</thead> | ||
<tr> | ||
<td th:text="${pet.name}" /></td> | ||
<td | ||
th:text="${#temporals.format(pet.birthDate, 'yyyy-MM-dd')}" /></td> | ||
<td th:text="${pet.type}" /></td> | ||
<td | ||
th:text="${pet.owner?.firstName + ' ' + pet.owner?.lastName}" /></td> | ||
</tr> | ||
</table> | ||
|
||
<form th:object="${visit}" class="form-horizontal" method="post"> | ||
<div class="form-group has-feedback"> | ||
<input | ||
th:replace="~{fragments/inputField :: input ('Date', 'date', 'date')}" /> | ||
<input | ||
th:replace="~{fragments/inputField :: input ('Description', 'description', 'text')}" /> | ||
</div> | ||
|
||
<div class="form-group"> | ||
<div class="col-sm-offset-2 col-sm-10"> | ||
<input type="hidden" name="petId" th:value="${pet.id}" /> | ||
<button class="btn btn-default" type="submit">Add Visit</button> | ||
</div> | ||
</div> | ||
</form> | ||
|
||
<br /> | ||
<b>Previous Visits</b> | ||
<table class="table table-striped"> | ||
<tr> | ||
<th>Date</th> | ||
<th>Description</th> | ||
</tr> | ||
<tr th:if="${!visit['new']}" th:each="visit : ${pet.visits}"> | ||
<td th:text="${#temporals.format(visit.date, 'yyyy-MM-dd')}" /></td> | ||
<td th:text=" ${visit.description}" /></td> | ||
</tr> | ||
</table> | ||
|
||
</body> | ||
</html> |