Skip to content

Commit

Permalink
Merge pull request #302 from josdem/feature/285
Browse files Browse the repository at this point in the history
[small]feature/285
  • Loading branch information
josdem authored Aug 24, 2024
2 parents abb36c2 + 9a67cda commit f7baf3d
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 6 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ ext {
}

group = 'com.josdem.vetlog'
version = '1.6.10'
version = '1.7.0'

configurations {
compileOnly {
Expand Down
25 changes: 22 additions & 3 deletions src/main/java/com/josdem/vetlog/enums/PetStatus.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,26 @@
package com.josdem.vetlog.enums;

public enum PetStatus {
OWNED,
IN_ADOPTION,
ADOPTED
OWNED("Owned"),
IN_ADOPTION("In Adoption"),
ADOPTED("Adopted");

private final String value;

PetStatus(String value) {
this.value = value;
}

public String getValue() {
return value;
}

public static PetStatus getPetStatusByValue(String value) {
for (PetStatus status : PetStatus.values()) {
if (value.equals(status.value)) {
return status;
}
}
return null;
}
}
1 change: 1 addition & 0 deletions src/main/resources/i18n/messages.properties
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ pet.vaccinated=Vaccinated
pet.not.vaccinated=Not Vaccinated
pet.breed=Breed
pet.type=Pet Type
pet.status=Status
pet.list.empty=List is empty
pet.image=Pet's Image
pet.data=Pet and Data
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/i18n/messages_es.properties
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ pet.vaccinated=Vacunado
pet.not.vaccinated=No Vacunado
pet.breed=Tipo de Mascota
pet.type=Raza
pet.status=Estatus
pet.list.empty=Lista Vacía
pet.image=Imágen de la mascota
pet.data=Mascota y Datos
Expand Down
14 changes: 12 additions & 2 deletions src/main/resources/templates/pet/edit.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<!DOCTYPE html>
<html xmlns:th="https://www.thymeleaf.org">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org"
xmlns:sec="http://www.thymeleaf.org/extras/spring-security" th:lang="${#locale.language}">
<head>
<title th:text="#{pet.view.create.title}"/>
<head th:insert="~{fragments/include}"/>
Expand All @@ -25,6 +26,7 @@
<form id="register" th:action="@{/pet/update}" th:object="${petCommand}" method="post"
class="form-horizontal" enctype="multipart/form-data">
<fieldset>
<legend th:text="#{pet.edit}"/>
<label for="name"><h4 th:text="#{pet.name}"/></label>
<input type="text" name='name' th:field="*{name}" class="form-control" placeholder="name"
id='name'/>
Expand All @@ -44,7 +46,7 @@
<div th:each="image : ${petCommand.images}" class="item"
th:classappend="|${petCommand.images.indexOf(image) == 0 ? 'active' : ''}|"
align="center">
<img style="width:350px;height:300px;"
<img th:alt="image" style="width:350px;height:300px;"
th:attr="src=@{${gcpImageUrl} + ${image.uuid}}"/>
</div>
</div>
Expand Down Expand Up @@ -85,6 +87,14 @@
<label th:if="${#fields.hasErrors('vaccinated')}" th:errors="*{vaccinated}"></label>
<br/>
<br/>
<div sec:authorize="hasAuthority('ADMIN')">
<label for="status"><h4 th:text="#{pet.status}"/></label>
<select id="statusSelector" name="status" th:field="*{status}" class="form-control">
<option th:each=" status : ${T(com.josdem.vetlog.enums.PetStatus).values()}"
th:value="${status}" th:text="${status.value}" th:selected="(${status} == *{status})"/>
</select>
<br/>
</div>
<label for="type"><h4 th:text="#{pet.type}"/></label>
<select id="typeSelector" name="type" th:field="*{type}" class="form-control"
onchange="updateBreedType()">
Expand Down

0 comments on commit f7baf3d

Please sign in to comment.