Compare commits
3 Commits
f1b94f48b8
...
4000bcbad2
| Author | SHA1 | Date |
|---|---|---|
|
|
4000bcbad2 | |
|
|
7574a59d14 | |
|
|
fcbe488095 |
|
|
@ -82,6 +82,28 @@ public class AnimalController {
|
|||
return ret;
|
||||
}
|
||||
|
||||
@RequestMapping(value = IndexController.URL_ANIMAL_EDIT, method = RequestMethod.POST)
|
||||
public String doPostEditAnimal(final ModelMap pModel, HttpSession httpSession,
|
||||
@PathVariable(value = "animal_id") final int animalId,
|
||||
@RequestParam(name = "name", required = true) String name) {
|
||||
|
||||
String ret;
|
||||
if (LoginController.isUserAlreadyAuth(httpSession)) {
|
||||
Authentication authentication = (Authentication) httpSession.getAttribute(IndexController.SESSION_ATTRIBUTE_AUTHENTICATION);
|
||||
Object oUserDetails = authentication.getPrincipal();
|
||||
if (oUserDetails instanceof UserDetails) {
|
||||
UserDetails userDetails = (UserDetails) oUserDetails;
|
||||
|
||||
serviceAnimal.changeAnimalName(animalId, userDetails.getUsername(), name);
|
||||
}
|
||||
ret = IndexController.URL_REDIRECT + IndexController.URL_ANIMAL_LIST;
|
||||
} else {
|
||||
ret = IndexController.URL_REDIRECT + IndexController.URL_LOGIN;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@RequestMapping(value = IndexController.URL_ANIMAL_DELETE, method = RequestMethod.POST)
|
||||
public String doGetDeleteAnimal(final ModelMap pModel, HttpSession httpSession, @PathVariable(value = "animal_id") final int animalId) {
|
||||
String ret;
|
||||
|
|
@ -154,6 +176,30 @@ public class AnimalController {
|
|||
return ret;
|
||||
}
|
||||
|
||||
@RequestMapping(value = IndexController.URL_ANIMAL_EDIT_CARE, method = RequestMethod.POST)
|
||||
public String doPostEditCare(final ModelMap pModel, HttpSession httpSession,
|
||||
@PathVariable(value = "animal_id") final int animalId,
|
||||
@PathVariable(value = "care_id") final int careId,
|
||||
@RequestParam(name = "name", required = true) String name,
|
||||
@RequestParam(name = "description", required = false, defaultValue = "") String description) {
|
||||
|
||||
String ret;
|
||||
if (LoginController.isUserAlreadyAuth(httpSession)) {
|
||||
Authentication authentication = (Authentication) httpSession.getAttribute(IndexController.SESSION_ATTRIBUTE_AUTHENTICATION);
|
||||
Object oUserDetails = authentication.getPrincipal();
|
||||
if (oUserDetails instanceof UserDetails) {
|
||||
UserDetails userDetails = (UserDetails) oUserDetails;
|
||||
|
||||
serviceAnimal.updateCare(careId, animalId, userDetails.getUsername(), name, description);
|
||||
}
|
||||
ret = IndexController.URL_REDIRECT + IndexController.URL_ANIMAL_CARES_AND_BEHAVIORS_LIST.replaceAll("\\{animal_id\\}", animalId + "");
|
||||
} else {
|
||||
ret = IndexController.URL_REDIRECT + IndexController.URL_LOGIN;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@RequestMapping(value = IndexController.URL_ANIMAL_CARES_DELETE, method = RequestMethod.POST)
|
||||
public String doPostDeleteCare(final ModelMap pModel, HttpSession httpSession,
|
||||
@PathVariable(value = "animal_id") final int animalId,
|
||||
|
|
@ -201,6 +247,30 @@ public class AnimalController {
|
|||
return ret;
|
||||
}
|
||||
|
||||
@RequestMapping(value = IndexController.URL_ANIMAL_EDIT_CONSENT_BEHAVIOR, method = RequestMethod.POST)
|
||||
public String doPostEditAnimal(final ModelMap pModel, HttpSession httpSession,
|
||||
@PathVariable(value = "animal_id") final int animalId,
|
||||
@PathVariable(value = "consent_behavior_id") final int consentBehaviorId,
|
||||
@RequestParam(name = "name", required = true) String name,
|
||||
@RequestParam(name = "description", required = false, defaultValue = "") String description) {
|
||||
|
||||
String ret;
|
||||
if (LoginController.isUserAlreadyAuth(httpSession)) {
|
||||
Authentication authentication = (Authentication) httpSession.getAttribute(IndexController.SESSION_ATTRIBUTE_AUTHENTICATION);
|
||||
Object oUserDetails = authentication.getPrincipal();
|
||||
if (oUserDetails instanceof UserDetails) {
|
||||
UserDetails userDetails = (UserDetails) oUserDetails;
|
||||
|
||||
serviceAnimal.updateConsentBehavior(consentBehaviorId, animalId, userDetails.getUsername(), name, description);
|
||||
}
|
||||
ret = IndexController.URL_REDIRECT + IndexController.URL_ANIMAL_CARES_AND_BEHAVIORS_LIST.replaceAll("\\{animal_id\\}", animalId + "");
|
||||
} else {
|
||||
ret = IndexController.URL_REDIRECT + IndexController.URL_LOGIN;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@RequestMapping(value = IndexController.URL_ANIMAL_CONSENT_BEHAVIOR_DELETE, method = RequestMethod.POST)
|
||||
public String doPostDeleteConsentBehavior(final ModelMap pModel, HttpSession httpSession,
|
||||
@PathVariable(value = "animal_id") final int animalId,
|
||||
|
|
|
|||
|
|
@ -59,6 +59,10 @@ public class IndexController {
|
|||
public static final String URL_ANIMAL_CARES_DELETE = "/animal/{animal_id}/delete/care/{care_id}";
|
||||
public static final String URL_ANIMAL_CONSENT_BEHAVIOR_DELETE = "/animal/{animal_id}/delete/consent_behavior/{consent_behavior_id}";
|
||||
public static final String URL_ANIMAL_PROGRESSION_DELETE = "/animal/{animal_id}/delete/progression/{progression_id}";
|
||||
// Edit URL
|
||||
public static final String URL_ANIMAL_EDIT = "/animal/{animal_id}/edit";
|
||||
public static final String URL_ANIMAL_EDIT_CARE = "/animal/{animal_id}/edit/care/{care_id}";
|
||||
public static final String URL_ANIMAL_EDIT_CONSENT_BEHAVIOR = "/animal/{animal_id}/edit/consent_behavior/{consent_behavior_id}";
|
||||
|
||||
public static final String URL_REDIRECT = "redirect:";
|
||||
//</editor-fold>
|
||||
|
|
|
|||
|
|
@ -14,4 +14,6 @@ public interface IAnimalDao extends CommonDao {
|
|||
|
||||
public void addAnimal(String name, String owner);
|
||||
public void deleteAnimal(int animalId, String owner);
|
||||
|
||||
public void changeName(int animalId, String owner, String name);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,4 +16,6 @@ public interface ICareDao extends CommonDao {
|
|||
public void addCare(int animalId, String name, String description);
|
||||
public void deleteCare(int careId, int animalId, String owner);
|
||||
public void deleteAllAnimalCares(int animalId, String owner);
|
||||
|
||||
public void updateCare(int careId, int animalId, String owner, String name, String description);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,4 +15,6 @@ public interface IConsentBehaviorDao extends CommonDao {
|
|||
public void addConsentBehavior(int animalId, String name, String description);
|
||||
public void deleteConsentBehavior(int consentBehaviorId, int animalId, String owner);
|
||||
public void deleteAllAnimalConsentBehavior(int animalId, String owner);
|
||||
|
||||
public void updateConsentBehavior(int consentBehaviorId, int animalId, String owner, String name, String description);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -201,4 +201,38 @@ public class AnimalDao extends PostgresSqlDao implements IAnimalDao {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeName(int animalId, String owner, String name) {
|
||||
Connection conn = null;
|
||||
PreparedStatement statement = null;
|
||||
try {
|
||||
conn = mDataSource.getConnection();
|
||||
statement = conn.prepareStatement("UPDATE "+TABLE_NAME+" SET name = ? WHERE id = ? AND owner = ?;");
|
||||
statement.setString(1, name);
|
||||
statement.setInt(2, animalId);
|
||||
statement.setString(3, owner);
|
||||
System.out.println(IndexController.LOG_TAG + " SQL -> " + statement.toString());
|
||||
statement.executeUpdate();
|
||||
} catch (SQLException ex) {
|
||||
System.err.println(IndexController.LOG_TAG + " SQLException -> changeName()");
|
||||
System.err.println(ex.getMessage());
|
||||
ex.printStackTrace();
|
||||
} finally {
|
||||
if (statement != null) {
|
||||
try {
|
||||
statement.close();
|
||||
} catch (SQLException ex) {
|
||||
System.err.println(IndexController.LOG_TAG + " Failed close statement -> changeName()");
|
||||
}
|
||||
}
|
||||
if (conn != null) {
|
||||
try {
|
||||
conn.close();
|
||||
} catch (SQLException ex) {
|
||||
System.err.println(IndexController.LOG_TAG + " Failed close connection -> changeName()");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -254,4 +254,41 @@ public class CareDao extends PostgresSqlDao implements ICareDao {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateCare(int careId, int animalId, String owner, String name, String description) {
|
||||
Connection conn = null;
|
||||
PreparedStatement statement = null;
|
||||
try {
|
||||
conn = mDataSource.getConnection();
|
||||
statement = conn.prepareStatement("UPDATE "+TABLE_NAME+" SET name = ?, description = ? WHERE id = ? AND animal = ("
|
||||
+ "SELECT id FROM "+AnimalDao.TABLE_NAME+" WHERE owner = ? AND id = ?)");
|
||||
statement.setString(1, name);
|
||||
statement.setString(2, description);
|
||||
statement.setInt(3, careId);
|
||||
statement.setString(4, owner);
|
||||
statement.setInt(5, animalId);
|
||||
System.out.println(IndexController.LOG_TAG + " SQL -> " + statement.toString());
|
||||
statement.executeUpdate();
|
||||
} catch (SQLException ex) {
|
||||
System.err.println(IndexController.LOG_TAG + " SQLException -> updateCare()");
|
||||
System.err.println(ex.getMessage());
|
||||
ex.printStackTrace();
|
||||
} finally {
|
||||
if (statement != null) {
|
||||
try {
|
||||
statement.close();
|
||||
} catch (SQLException ex) {
|
||||
System.err.println(IndexController.LOG_TAG + " Failed close statement -> updateCare()");
|
||||
}
|
||||
}
|
||||
if (conn != null) {
|
||||
try {
|
||||
conn.close();
|
||||
} catch (SQLException ex) {
|
||||
System.err.println(IndexController.LOG_TAG + " Failed close connection -> updateCare()");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -254,4 +254,41 @@ public class ConsentBehaviorDao extends PostgresSqlDao implements IConsentBehavi
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateConsentBehavior(int consentBehaviorId, int animalId, String owner, String name, String description) {
|
||||
Connection conn = null;
|
||||
PreparedStatement statement = null;
|
||||
try {
|
||||
conn = mDataSource.getConnection();
|
||||
statement = conn.prepareStatement("UPDATE "+TABLE_NAME+" SET name = ?, description = ? WHERE id = ? AND animal = ("
|
||||
+ "SELECT id FROM "+AnimalDao.TABLE_NAME+" WHERE owner = ? AND id = ?)");
|
||||
statement.setString(1, name);
|
||||
statement.setString(2, description);
|
||||
statement.setInt(3, consentBehaviorId);
|
||||
statement.setString(4, owner);
|
||||
statement.setInt(5, animalId);
|
||||
System.out.println(IndexController.LOG_TAG + " SQL -> " + statement.toString());
|
||||
statement.executeUpdate();
|
||||
} catch (SQLException ex) {
|
||||
System.err.println(IndexController.LOG_TAG + " SQLException -> updateConsentBehavior()");
|
||||
System.err.println(ex.getMessage());
|
||||
ex.printStackTrace();
|
||||
} finally {
|
||||
if (statement != null) {
|
||||
try {
|
||||
statement.close();
|
||||
} catch (SQLException ex) {
|
||||
System.err.println(IndexController.LOG_TAG + " Failed close statement -> updateConsentBehavior()");
|
||||
}
|
||||
}
|
||||
if (conn != null) {
|
||||
try {
|
||||
conn.close();
|
||||
} catch (SQLException ex) {
|
||||
System.err.println(IndexController.LOG_TAG + " Failed close connection -> updateConsentBehavior()");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,4 +27,9 @@ public interface IServiceAnimal {
|
|||
public void deleteAnimalConsentBehavior(int animalId, String owner, int consentBehaviorId);
|
||||
public void deleteAnimalProgression(int animalId, String owner, int progressionId);
|
||||
|
||||
public void changeAnimalName(int animalId, String owner, String name);
|
||||
|
||||
public void updateCare(int careId, int animalId, String owner, String name, String description);
|
||||
public void updateConsentBehavior(int consentBehaviorId, int animalId, String owner, String name, String description);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -150,4 +150,19 @@ public class ServiceAnimal implements IServiceAnimal {
|
|||
public void addProgression(int animalId, int careId, int consentBehaviorId) {
|
||||
progressionDao.addProgression(animalId, careId, consentBehaviorId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeAnimalName(int animalId, String owner, String name) {
|
||||
animalDao.changeName(animalId, owner, name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateCare(int careId, int animalId, String owner, String name, String description) {
|
||||
careDao.updateCare(careId, animalId, owner, name, description);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateConsentBehavior(int consentBehaviorId, int animalId, String owner, String name, String description) {
|
||||
consentBehaviorDao.updateConsentBehavior(consentBehaviorId, animalId, owner, name, description);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -89,3 +89,19 @@ animal_behavior.button.delete.tooltip=Delete
|
|||
animal_behavior.button.add.tooltip=Add
|
||||
animal_behavior.add_care=Add care to this consent behavior
|
||||
animal_behavior.add_care.empty_list=No more cares to add
|
||||
animal_list.animal.edit.tooltip=Edit
|
||||
animal_list.edit_animal.modal.label=Animal's name:
|
||||
animal_list.edit_animal.modal.placeholder=New name
|
||||
modal_button.edit=Edit
|
||||
animal_care_and_behavior.button.edit.tooltip=Edit
|
||||
animal_list.edit_animal.modal.title=Editing animal's name
|
||||
animal_care_and_behavior.edit_care.modal.title=Editing care
|
||||
animal_care_and_behavior.edit_care.modal.name.label=Care name:
|
||||
animal_care_and_behavior.edit_care.modal.name.placeholder=Care name
|
||||
animal_care_and_behavior.edit_care.modal.description.label=Care description:
|
||||
animal_care_and_behavior.edit_care.modal.description.placeholder=Care description (optional)
|
||||
animal_care_and_behavior.edit_behavior.modal.title=Editing consent behavior
|
||||
animal_care_and_behavior.edit_behavior.modal.name.label=Consent behavior name:
|
||||
animal_care_and_behavior.edit_behavior.modal.name.placeholder=Consent behavior name
|
||||
animal_care_and_behavior.edit_behavior.modal.description.label=Consent behavior description:
|
||||
animal_care_and_behavior.edit_behavior.modal.description.placeholder=Consent behavior description (optional)
|
||||
|
|
|
|||
|
|
@ -85,3 +85,19 @@ animal_behavior.button.delete.tooltip=Delete
|
|||
animal_behavior.button.add.tooltip=Add
|
||||
animal_behavior.add_care=Add care to this consent behavior
|
||||
animal_behavior.add_care.empty_list=No more cares to add
|
||||
animal_list.animal.edit.tooltip=Edit
|
||||
animal_list.edit_animal.modal.label=Animal's name:
|
||||
animal_list.edit_animal.modal.placeholder=New name
|
||||
modal_button.edit=Edit
|
||||
animal_care_and_behavior.button.edit.tooltip=Edit
|
||||
animal_list.edit_animal.modal.title=Editing animal's name
|
||||
animal_care_and_behavior.edit_care.modal.title=Editing care
|
||||
animal_care_and_behavior.edit_care.modal.name.label=Care name:
|
||||
animal_care_and_behavior.edit_care.modal.name.placeholder=Care name
|
||||
animal_care_and_behavior.edit_care.modal.description.label=Care description:
|
||||
animal_care_and_behavior.edit_care.modal.description.placeholder=Care description (optional)
|
||||
animal_care_and_behavior.edit_behavior.modal.title=Editing consent behavior
|
||||
animal_care_and_behavior.edit_behavior.modal.name.label=Consent behavior name:
|
||||
animal_care_and_behavior.edit_behavior.modal.name.placeholder=Consent behavior name
|
||||
animal_care_and_behavior.edit_behavior.modal.description.label=Consent behavior description:
|
||||
animal_care_and_behavior.edit_behavior.modal.description.placeholder=Consent behavior description (optional)
|
||||
|
|
|
|||
|
|
@ -85,3 +85,19 @@ animal_behavior.button.delete.tooltip=Supprimer
|
|||
animal_behavior.button.add.tooltip=Ajouter
|
||||
animal_behavior.add_care=Ajouter un soin \u00e0 ce comportement de consentement
|
||||
animal_behavior.add_care.empty_list=Aucun soins \u00e0 ajouter
|
||||
animal_list.animal.edit.tooltip=Modifier
|
||||
animal_list.edit_animal.modal.label=Nom de l'animal :
|
||||
animal_list.edit_animal.modal.placeholder=Nouveau nom
|
||||
modal_button.edit=Modifier
|
||||
animal_care_and_behavior.button.edit.tooltip=Modifier
|
||||
animal_list.edit_animal.modal.title=Modifier le nom de l'animal
|
||||
animal_care_and_behavior.edit_care.modal.title=Modification du soin
|
||||
animal_care_and_behavior.edit_care.modal.name.label=Nom du soin :
|
||||
animal_care_and_behavior.edit_care.modal.name.placeholder=Nom du soin
|
||||
animal_care_and_behavior.edit_care.modal.description.label=Description du soin :
|
||||
animal_care_and_behavior.edit_care.modal.description.placeholder=Description du soin (optionelle)
|
||||
animal_care_and_behavior.edit_behavior.modal.title=Modification du comportement de consentement
|
||||
animal_care_and_behavior.edit_behavior.modal.name.label=Nom du comportement de consentement :
|
||||
animal_care_and_behavior.edit_behavior.modal.name.placeholder=Nom du comportement de consentement
|
||||
animal_care_and_behavior.edit_behavior.modal.description.label=Description du comportement de consentment :
|
||||
animal_care_and_behavior.edit_behavior.modal.description.placeholder=Description du comportement de consentement (optionelle)
|
||||
|
|
|
|||
|
|
@ -6,8 +6,10 @@
|
|||
<%@ page isELIgnored="false" %>
|
||||
<spring:url value="/animal/${MODEL_MAP_ANIMAL.getId()}/add/care" var="animalAddCareURL" />
|
||||
<spring:url value="/animal/${MODEL_MAP_ANIMAL.getId()}/delete/care" var="animalDeleteCareURL" />
|
||||
<spring:url value="/animal/${MODEL_MAP_ANIMAL.getId()}/edit/care" var="animalEditCareURL" />
|
||||
<spring:url value="/animal/${MODEL_MAP_ANIMAL.getId()}/add/consent_behavior" var="animalAddConsentBehaviorURL" />
|
||||
<spring:url value="/animal/${MODEL_MAP_ANIMAL.getId()}/delete/consent_behavior" var="animalDeleteConsentBehaviorURL" />
|
||||
<spring:url value="/animal/${MODEL_MAP_ANIMAL.getId()}/edit/consent_behavior" var="animalEditConsentBehaviorURL" />
|
||||
|
||||
<%@ include file="base/language.jsp" %>
|
||||
|
||||
|
|
@ -46,7 +48,7 @@
|
|||
|
||||
<div class="col-lg-5">
|
||||
<h4><fmt:message key="animal_care_and_behavior.care_list"></fmt:message></h4>
|
||||
<div class="list-group">
|
||||
<div class="list-group">
|
||||
<c:forEach items="${MODEL_MAP_ANIMAL.getListCares()}" var="care">
|
||||
<a href="${animalURL}/${MODEL_MAP_ANIMAL.getId()}/care/${care.getId()}" class="list-group-item">
|
||||
<div class="row">
|
||||
|
|
@ -55,12 +57,18 @@
|
|||
<form class="pull-right" action="${animalDeleteCareURL}/${care.getId()}" method="POST">
|
||||
<input value="${care.getName()}" hidden />
|
||||
<button class="btn btn-danger" type="submit" data-toggle="tooltip" data-placement="bottom" title="<fmt:message key="animal_care_and_behavior.button.delete.tooltip"></fmt:message>"><span class="glyphicon glyphicon-trash" aria-hidden="true"></span></button>
|
||||
</form>
|
||||
</form>
|
||||
|
||||
<form class="pull-right" action="${animalEditCareURL}/${care.getId()}" method="GET">
|
||||
<input value="${care.getName()}" hidden />
|
||||
<input value="${care.getDescription()}" hidden />
|
||||
<button class="btn btn-default" type="submit" data-toggle="tooltip" data-placement="bottom" title="<fmt:message key="animal_care_and_behavior.button.edit.tooltip"></fmt:message>"><span class="glyphicon glyphicon-edit" aria-hidden="true"></span></button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-lg-1"></div>
|
||||
<div class="col-lg-11"><small>${care.getDescription()}</small></div>
|
||||
<div class="row">
|
||||
<div class="col-lg-1"></div>
|
||||
<div class="col-lg-11"><small>${care.getDescription()}</small></div>
|
||||
</div>
|
||||
</a>
|
||||
</c:forEach>
|
||||
|
|
@ -71,15 +79,15 @@
|
|||
<input type="text" id="form_care_name" name="name" class="form-control" placeholder="<fmt:message key="animal_care_and_behavior.add_care.care_name.placeholder"></fmt:message>" required />
|
||||
<textarea id="form_care_description_name" name="description" class="form-control" placeholder="<fmt:message key="animal_care_and_behavior.add_care.care_description.placeholder"></fmt:message>" ></textarea>
|
||||
<button class="btn btn btn-primary" type="submit"><fmt:message key="animal_care_and_behavior.add_care.button.submit"></fmt:message></button>
|
||||
</form>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="col-lg-1">
|
||||
</div>
|
||||
<div class="col-lg-1">
|
||||
</div>
|
||||
|
||||
<div class="col-lg-5">
|
||||
<h4><fmt:message key="animal_care_and_behavior.behavior_list"></fmt:message></h4>
|
||||
<div class="list-group">
|
||||
<div class="col-lg-5">
|
||||
<h4><fmt:message key="animal_care_and_behavior.behavior_list"></fmt:message></h4>
|
||||
<div class="list-group">
|
||||
<c:forEach items="${MODEL_MAP_ANIMAL.getListConsentBehavior()}" var="consentBehavior">
|
||||
<a href="${animalURL}/${MODEL_MAP_ANIMAL.getId()}/consent_behavior/${consentBehavior.getId()}" class="list-group-item">
|
||||
<div class="row">
|
||||
|
|
@ -88,12 +96,18 @@
|
|||
<form class="pull-right" action="${animalDeleteConsentBehaviorURL}/${consentBehavior.getId()}" method="POST">
|
||||
<input value="${consentBehavior.getName()}" hidden />
|
||||
<button class="btn btn-danger" type="submit" data-toggle="tooltip" data-placement="bottom" title="<fmt:message key="animal_care_and_behavior.button.delete.tooltip"></fmt:message>"><span class="glyphicon glyphicon-trash" aria-hidden="true"></span></button>
|
||||
</form>
|
||||
</form>
|
||||
|
||||
<form class="pull-right" action="${animalEditConsentBehaviorURL}/${consentBehavior.getId()}" method="GET">
|
||||
<input value="${consentBehavior.getName()}" hidden />
|
||||
<input value="${consentBehavior.getDescription()}" hidden />
|
||||
<button class="btn btn-default" type="submit" data-toggle="tooltip" data-placement="bottom" title="<fmt:message key="animal_care_and_behavior.button.edit.tooltip"></fmt:message>"><span class="glyphicon glyphicon-edit" aria-hidden="true"></span></button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-lg-1"></div>
|
||||
<div class="col-lg-11"><small>${consentBehavior.getDescription()}</small></div>
|
||||
<div class="row">
|
||||
<div class="col-lg-1"></div>
|
||||
<div class="col-lg-11"><small>${consentBehavior.getDescription()}</small></div>
|
||||
</div>
|
||||
</a>
|
||||
</c:forEach>
|
||||
|
|
@ -104,9 +118,9 @@
|
|||
<input type="text" id="form_consent_behavior_name" name="name" class="form-control" placeholder="<fmt:message key="animal_care_and_behavior.add_behavior.care_name.placeholder"></fmt:message>" required />
|
||||
<textarea id="form_consent_behavior_description_name" name="description" class="form-control" placeholder="<fmt:message key="animal_care_and_behavior.add_behavior.care_description.placeholder"></fmt:message>" ></textarea>
|
||||
<button class="btn btn btn-primary" type="submit"><fmt:message key="animal_care_and_behavior.add_behavior.button.submit"></fmt:message></button>
|
||||
</form>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%@ include file="base/footer.jsp" %>
|
||||
</div>
|
||||
|
|
@ -134,6 +148,60 @@
|
|||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Edit care -->
|
||||
<div id="modal_edit_care" class="modal fade" role="dialog">
|
||||
<div class="modal-dialog">
|
||||
|
||||
<!-- Modal content-->
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal">×</button>
|
||||
<h4 id="modal_edit_care_title" class="modal-title"><fmt:message key="animal_care_and_behavior.edit_care.modal.title"></fmt:message></h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form id="modal_edit_care_form" action="" method="POST">
|
||||
<label for="modal_edit_care_form_care_name"><fmt:message key="animal_care_and_behavior.edit_care.modal.name.label"></fmt:message></label>
|
||||
<input type="text" id="modal_edit_care_form_care_name" name="name" class="form-control" placeholder="<fmt:message key="animal_care_and_behavior.edit_care.modal.name.placeholder"></fmt:message>" required />
|
||||
<label for="modal_edit_care_form_care_description"><fmt:message key="animal_care_and_behavior.edit_care.modal.description.label"></fmt:message></label>
|
||||
<textarea id="modal_edit_care_form_care_description" name="description" class="form-control" placeholder="<fmt:message key="animal_care_and_behavior.edit_care.modal.description.placeholder"></fmt:message>" ></textarea>
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal"><fmt:message key="modal_button.cancel"></fmt:message></button>
|
||||
<button form="modal_edit_care_form" type="submit" class="btn btn-primary"><fmt:message key="modal_button.edit"></fmt:message></button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Edit behavior -->
|
||||
<div id="modal_edit_consent_behavior" class="modal fade" role="dialog">
|
||||
<div class="modal-dialog">
|
||||
|
||||
<!-- Modal content-->
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal">×</button>
|
||||
<h4 id="modal_edit_consent_behavior_title" class="modal-title"><fmt:message key="animal_care_and_behavior.edit_behavior.modal.title"></fmt:message></h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form id="modal_edit_consent_behavior_form" action="" method="POST">
|
||||
<label for="modal_edit_consent_behavior_form_behavior_name"><fmt:message key="animal_care_and_behavior.edit_behavior.modal.name.label"></fmt:message></label>
|
||||
<input type="text" id="modal_edit_consent_behavior_form_behavior_name" name="name" class="form-control" placeholder="<fmt:message key="animal_care_and_behavior.edit_behavior.modal.name.placeholder"></fmt:message>" required />
|
||||
<label for="modal_edit_consent_behavior_form_behavior_description"><fmt:message key="animal_care_and_behavior.edit_behavior.modal.description.label"></fmt:message></label>
|
||||
<textarea id="modal_edit_consent_behavior_form_behavior_description" name="description" class="form-control" placeholder="<fmt:message key="animal_care_and_behavior.edit_behavior.modal.description.placeholder"></fmt:message>" ></textarea>
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal"><fmt:message key="modal_button.cancel"></fmt:message></button>
|
||||
<button form="modal_edit_consent_behavior_form" type="submit" class="btn btn-primary"><fmt:message key="modal_button.edit"></fmt:message></button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
|
@ -157,6 +225,36 @@
|
|||
show: true
|
||||
});
|
||||
event.preventDefault();
|
||||
|
||||
} else if (formUrl.startsWith('${animalEditCareURL}')) {
|
||||
if ($(this).attr('id') !== 'modal_edit_care_form') {
|
||||
// Only for editing care form
|
||||
var data = $(this).find('input');
|
||||
var careName = data[0].value;
|
||||
var careDesc = data[1].value;
|
||||
$('#modal_edit_care_form').attr('action', formUrl);
|
||||
$('#modal_edit_care_form_care_name').val(careName);
|
||||
$('#modal_edit_care_form_care_description').val(careDesc);
|
||||
$('#modal_edit_care').modal({
|
||||
show: true
|
||||
});
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
} else if (formUrl.startsWith('${animalEditConsentBehaviorURL}')) {
|
||||
if ($(this).attr('id') !== 'modal_edit_consent_behavior_form') {
|
||||
// Only for editing care form
|
||||
var data = $(this).find('input');
|
||||
var consentBehaviorName = data[0].value;
|
||||
var consentBehaviorDesc = data[1].value;
|
||||
$('#modal_edit_consent_behavior_form').attr('action', formUrl);
|
||||
$('#modal_edit_consent_behavior_form_behavior_name').val(consentBehaviorName);
|
||||
$('#modal_edit_consent_behavior_form_behavior_description').val(consentBehaviorDesc);
|
||||
$('#modal_edit_consent_behavior').modal({
|
||||
show: true
|
||||
});
|
||||
event.preventDefault();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -33,19 +33,24 @@
|
|||
<div class="container">
|
||||
<%@ include file="base/navbar.jsp" %>
|
||||
<center><h1><fmt:message key="animal_list.title"></fmt:message></h1></center>
|
||||
<div class="row">
|
||||
<div class="col-lg-5">
|
||||
<h4><fmt:message key="animal_list.animal_list.title"></fmt:message></h4>
|
||||
<div class="list-group">
|
||||
<div class="row">
|
||||
<div class="col-lg-5">
|
||||
<h4><fmt:message key="animal_list.animal_list.title"></fmt:message></h4>
|
||||
<div class="list-group">
|
||||
<c:forEach items="${MODEL_MAP_ANIMAL_LIST}" var="animal">
|
||||
<a class="list-group-item" href="${animalURL}/${animal.getId()}/cares_and_behaviors">
|
||||
${animal.getName()}
|
||||
<form class="pull-right" action="${animalDeleteURL}/${animal.getId()}" method="POST">
|
||||
<input value="${animal.getName()}" hidden />
|
||||
<button class="btn btn-xs btn-danger" type="submit" data-toggle="tooltip" data-placement="bottom" title="<fmt:message key="animal_list.animal.delete.tooltip"></fmt:message>"><span class="glyphicon glyphicon-trash" aria-hidden="true"></span></button>
|
||||
</form>
|
||||
</a>
|
||||
<!-- <div class="list-group-item">
|
||||
</form>
|
||||
|
||||
<form class="pull-right" action="${animalURL}/${animal.getId()}/edit" method="GET">
|
||||
<input value="${animal.getName()}" hidden />
|
||||
<button class="btn btn-xs btn-default" type="submit" data-toggle="tooltip" data-placement="bottom" title="<fmt:message key="animal_list.animal.edit.tooltip"></fmt:message>"><span class="glyphicon glyphicon-edit" aria-hidden="true"></span></button>
|
||||
</form>
|
||||
</a>
|
||||
<!-- <div class="list-group-item">
|
||||
${animal.getName()}
|
||||
<form class="pull-right" action="${animalDeleteURL}/${animal.getId()}" method="POST">
|
||||
<button class="btn btn-sm btn-danger" type="submit" data-toggle="tooltip" data-placement="bottom" title="Suppression"><span class="glyphicon glyphicon-trash" aria-hidden="true"></span></button>
|
||||
|
|
@ -60,15 +65,15 @@
|
|||
<form id="addAnimalForm" class="form-inline" action="${animalURL}" method="POST">
|
||||
<div class="form-group">
|
||||
<label for="form_animal_name"><fmt:message key="animal_list.animal.add.label"></fmt:message></label>
|
||||
<input type="text" id="form_animal_name" name="name" class="form-control" placeholder="<fmt:message key="animal_list.animal.add.placeholder"></fmt:message>" />
|
||||
</div>
|
||||
<button class="btn btn btn-success" type="submit" data-toggle="tooltip" data-placement="bottom" title="<fmt:message key="animal_list.animal.add.tooltip"></fmt:message>"><span class="glyphicon glyphicon-plus" aria-hidden="true"></span></button>
|
||||
</form>
|
||||
</div>
|
||||
<div class="col-lg-2">
|
||||
</div>
|
||||
<div class="col-lg-5">
|
||||
<h4><fmt:message key="animal_list.change_password.title"></fmt:message></h4>
|
||||
<input type="text" id="form_animal_name" name="name" class="form-control" placeholder="<fmt:message key="animal_list.animal.add.placeholder"></fmt:message>" required />
|
||||
</div>
|
||||
<button class="btn btn btn-success" type="submit" data-toggle="tooltip" data-placement="bottom" title="<fmt:message key="animal_list.animal.add.tooltip"></fmt:message>"><span class="glyphicon glyphicon-plus" aria-hidden="true"></span></button>
|
||||
</form>
|
||||
</div>
|
||||
<div class="col-lg-2">
|
||||
</div>
|
||||
<div class="col-lg-5">
|
||||
<h4><fmt:message key="animal_list.change_password.title"></fmt:message></h4>
|
||||
<form id="changePasswordForm" action="${changePasswordURL}" method="POST">
|
||||
<div class="form-group">
|
||||
<label for="old_password"><fmt:message key="animal_list.change_password.old_password.label"></fmt:message></label>
|
||||
|
|
@ -77,9 +82,9 @@
|
|||
<input type="password" id="password" name="password" class="form-control" placeholder="<fmt:message key="animal_list.change_password.new_password.placeholder"></fmt:message>" required/>
|
||||
<label for="password_check"><fmt:message key="animal_list.change_password.new_password_check.label"></fmt:message></label>
|
||||
<input type="password" id="password_check" name="password_check" class="form-control" placeholder="<fmt:message key="animal_list.change_password.new_password_check.placeholder"></fmt:message>" required/>
|
||||
</div>
|
||||
<button class="btn btn btn-primary" type="submit"><fmt:message key="animal_list.change_password.submit"></fmt:message></button>
|
||||
</form>
|
||||
</div>
|
||||
<button class="btn btn btn-primary" type="submit"><fmt:message key="animal_list.change_password.submit"></fmt:message></button>
|
||||
</form>
|
||||
<c:if test="${MODEL_MAP_CHANGE_PASSWORD_ERROR_MESSAGE == 'true'}">
|
||||
<div class="list-group">
|
||||
<h5 class="list-group-item list-group-item-danger" style="border-radius: 5px;">Erreur lors de la mise à jour du mot de passe</h5>
|
||||
|
|
@ -112,13 +117,37 @@
|
|||
<div class="modal-footer">
|
||||
<form id="modal_delete_animal_validate_delete" class="pull-right" action="" method="POST">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal"><fmt:message key="modal_button.cancel"></fmt:message></button>
|
||||
<button type="submit" class="btn btn-danger"><fmt:message key="modal_button.delete"></fmt:message></button>
|
||||
<button type="submit" class="btn btn-danger"><fmt:message key="modal_button.delete"></fmt:message></button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="modal_edit_animal" class="modal fade" role="dialog">
|
||||
<div class="modal-dialog">
|
||||
|
||||
<!-- Modal content-->
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal">×</button>
|
||||
<h4 id="modal_edit_animal_title" class="modal-title"><fmt:message key="animal_list.edit_animal.modal.title"></fmt:message></h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form id="modal_edit_animal_form" action="" method="POST">
|
||||
<label for="modal_edit_animal_form_name"><fmt:message key="animal_list.edit_animal.modal.label"></fmt:message></label>
|
||||
<input type="text" id="modal_edit_animal_form_name" name="name" class="form-control" placeholder="<fmt:message key="animal_list.edit_animal.modal.placeholder"></fmt:message>" required/>
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal"><fmt:message key="modal_button.cancel"></fmt:message></button>
|
||||
<button form="modal_edit_animal_form" type="submit" class="btn btn-primary"><fmt:message key="modal_button.edit"></fmt:message></button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
|
@ -126,9 +155,9 @@
|
|||
$('[data-toggle="tooltip"]').tooltip();
|
||||
|
||||
$("form").submit(function (event) {
|
||||
if ($(this).attr('id') !== 'modal_delete_animal_validate_delete') {
|
||||
var formUrl = $(this).attr('action');
|
||||
if (formUrl.startsWith('${animalDeleteURL}')) {
|
||||
var formUrl = $(this).attr('action');
|
||||
if (formUrl.startsWith('${animalDeleteURL}')) {
|
||||
if ($(this).attr('id') !== 'modal_delete_animal_validate_delete') {
|
||||
// Only for deleting animal forms
|
||||
var animalName = $(this).find('input')[0].value;
|
||||
$('#modal_delete_animal_title').text(animalName);
|
||||
|
|
@ -138,6 +167,18 @@
|
|||
});
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
} else if (formUrl.match(new RegExp('${animalURL}/[0-9]+/edit', 'g'))) {
|
||||
if ($(this).attr('id') !== 'modal_edit_animal_form') {
|
||||
// Only for editing animal form
|
||||
var animalName = $(this).find('input')[0].value;
|
||||
$('#modal_edit_animal_form').attr('action', formUrl);
|
||||
$('#modal_edit_animal_form_name').val(animalName);
|
||||
$('#modal_edit_animal').modal({
|
||||
show: true
|
||||
});
|
||||
event.preventDefault();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue