Can edit cares and behaviors.
This commit is contained in:
parent
7574a59d14
commit
4000bcbad2
|
|
@ -176,6 +176,30 @@ public class AnimalController {
|
||||||
return ret;
|
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)
|
@RequestMapping(value = IndexController.URL_ANIMAL_CARES_DELETE, method = RequestMethod.POST)
|
||||||
public String doPostDeleteCare(final ModelMap pModel, HttpSession httpSession,
|
public String doPostDeleteCare(final ModelMap pModel, HttpSession httpSession,
|
||||||
@PathVariable(value = "animal_id") final int animalId,
|
@PathVariable(value = "animal_id") final int animalId,
|
||||||
|
|
@ -223,6 +247,30 @@ public class AnimalController {
|
||||||
return ret;
|
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)
|
@RequestMapping(value = IndexController.URL_ANIMAL_CONSENT_BEHAVIOR_DELETE, method = RequestMethod.POST)
|
||||||
public String doPostDeleteConsentBehavior(final ModelMap pModel, HttpSession httpSession,
|
public String doPostDeleteConsentBehavior(final ModelMap pModel, HttpSession httpSession,
|
||||||
@PathVariable(value = "animal_id") final int animalId,
|
@PathVariable(value = "animal_id") final int animalId,
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,9 @@ public class IndexController {
|
||||||
public static final String URL_ANIMAL_CONSENT_BEHAVIOR_DELETE = "/animal/{animal_id}/delete/consent_behavior/{consent_behavior_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}";
|
public static final String URL_ANIMAL_PROGRESSION_DELETE = "/animal/{animal_id}/delete/progression/{progression_id}";
|
||||||
// Edit URL
|
// Edit URL
|
||||||
public static final String URL_ANIMAL_EDIT = "/animal/edit/{animal_id}";
|
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:";
|
public static final String URL_REDIRECT = "redirect:";
|
||||||
//</editor-fold>
|
//</editor-fold>
|
||||||
|
|
|
||||||
|
|
@ -16,4 +16,6 @@ public interface ICareDao extends CommonDao {
|
||||||
public void addCare(int animalId, String name, String description);
|
public void addCare(int animalId, String name, String description);
|
||||||
public void deleteCare(int careId, int animalId, String owner);
|
public void deleteCare(int careId, int animalId, String owner);
|
||||||
public void deleteAllAnimalCares(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 addConsentBehavior(int animalId, String name, String description);
|
||||||
public void deleteConsentBehavior(int consentBehaviorId, int animalId, String owner);
|
public void deleteConsentBehavior(int consentBehaviorId, int animalId, String owner);
|
||||||
public void deleteAllAnimalConsentBehavior(int animalId, String owner);
|
public void deleteAllAnimalConsentBehavior(int animalId, String owner);
|
||||||
|
|
||||||
|
public void updateConsentBehavior(int consentBehaviorId, int animalId, String owner, String name, String description);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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()");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -29,4 +29,7 @@ public interface IServiceAnimal {
|
||||||
|
|
||||||
public void changeAnimalName(int animalId, String owner, String name);
|
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);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -155,4 +155,14 @@ public class ServiceAnimal implements IServiceAnimal {
|
||||||
public void changeAnimalName(int animalId, String owner, String name) {
|
public void changeAnimalName(int animalId, String owner, String name) {
|
||||||
animalDao.changeName(animalId, owner, 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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -93,3 +93,15 @@ animal_list.animal.edit.tooltip=Edit
|
||||||
animal_list.edit_animal.modal.label=Animal's name:
|
animal_list.edit_animal.modal.label=Animal's name:
|
||||||
animal_list.edit_animal.modal.placeholder=New name
|
animal_list.edit_animal.modal.placeholder=New name
|
||||||
modal_button.edit=Edit
|
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)
|
||||||
|
|
|
||||||
|
|
@ -89,3 +89,15 @@ animal_list.animal.edit.tooltip=Edit
|
||||||
animal_list.edit_animal.modal.label=Animal's name:
|
animal_list.edit_animal.modal.label=Animal's name:
|
||||||
animal_list.edit_animal.modal.placeholder=New name
|
animal_list.edit_animal.modal.placeholder=New name
|
||||||
modal_button.edit=Edit
|
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)
|
||||||
|
|
|
||||||
|
|
@ -89,3 +89,15 @@ animal_list.animal.edit.tooltip=Modifier
|
||||||
animal_list.edit_animal.modal.label=Nom de l'animal :
|
animal_list.edit_animal.modal.label=Nom de l'animal :
|
||||||
animal_list.edit_animal.modal.placeholder=Nouveau nom
|
animal_list.edit_animal.modal.placeholder=Nouveau nom
|
||||||
modal_button.edit=Modifier
|
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" %>
|
<%@ page isELIgnored="false" %>
|
||||||
<spring:url value="/animal/${MODEL_MAP_ANIMAL.getId()}/add/care" var="animalAddCareURL" />
|
<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()}/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()}/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()}/delete/consent_behavior" var="animalDeleteConsentBehaviorURL" />
|
||||||
|
<spring:url value="/animal/${MODEL_MAP_ANIMAL.getId()}/edit/consent_behavior" var="animalEditConsentBehaviorURL" />
|
||||||
|
|
||||||
<%@ include file="base/language.jsp" %>
|
<%@ include file="base/language.jsp" %>
|
||||||
|
|
||||||
|
|
@ -46,7 +48,7 @@
|
||||||
|
|
||||||
<div class="col-lg-5">
|
<div class="col-lg-5">
|
||||||
<h4><fmt:message key="animal_care_and_behavior.care_list"></fmt:message></h4>
|
<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">
|
<c:forEach items="${MODEL_MAP_ANIMAL.getListCares()}" var="care">
|
||||||
<a href="${animalURL}/${MODEL_MAP_ANIMAL.getId()}/care/${care.getId()}" class="list-group-item">
|
<a href="${animalURL}/${MODEL_MAP_ANIMAL.getId()}/care/${care.getId()}" class="list-group-item">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
|
@ -55,12 +57,18 @@
|
||||||
<form class="pull-right" action="${animalDeleteCareURL}/${care.getId()}" method="POST">
|
<form class="pull-right" action="${animalDeleteCareURL}/${care.getId()}" method="POST">
|
||||||
<input value="${care.getName()}" hidden />
|
<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>
|
<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>
|
<div class="row">
|
||||||
<div class="row">
|
<div class="col-lg-1"></div>
|
||||||
<div class="col-lg-1"></div>
|
<div class="col-lg-11"><small>${care.getDescription()}</small></div>
|
||||||
<div class="col-lg-11"><small>${care.getDescription()}</small></div>
|
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
</c:forEach>
|
</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 />
|
<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>
|
<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>
|
<button class="btn btn btn-primary" type="submit"><fmt:message key="animal_care_and_behavior.add_care.button.submit"></fmt:message></button>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-lg-1">
|
<div class="col-lg-1">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-lg-5">
|
<div class="col-lg-5">
|
||||||
<h4><fmt:message key="animal_care_and_behavior.behavior_list"></fmt:message></h4>
|
<h4><fmt:message key="animal_care_and_behavior.behavior_list"></fmt:message></h4>
|
||||||
<div class="list-group">
|
<div class="list-group">
|
||||||
<c:forEach items="${MODEL_MAP_ANIMAL.getListConsentBehavior()}" var="consentBehavior">
|
<c:forEach items="${MODEL_MAP_ANIMAL.getListConsentBehavior()}" var="consentBehavior">
|
||||||
<a href="${animalURL}/${MODEL_MAP_ANIMAL.getId()}/consent_behavior/${consentBehavior.getId()}" class="list-group-item">
|
<a href="${animalURL}/${MODEL_MAP_ANIMAL.getId()}/consent_behavior/${consentBehavior.getId()}" class="list-group-item">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
|
@ -88,12 +96,18 @@
|
||||||
<form class="pull-right" action="${animalDeleteConsentBehaviorURL}/${consentBehavior.getId()}" method="POST">
|
<form class="pull-right" action="${animalDeleteConsentBehaviorURL}/${consentBehavior.getId()}" method="POST">
|
||||||
<input value="${consentBehavior.getName()}" hidden />
|
<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>
|
<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>
|
<div class="row">
|
||||||
<div class="row">
|
<div class="col-lg-1"></div>
|
||||||
<div class="col-lg-1"></div>
|
<div class="col-lg-11"><small>${consentBehavior.getDescription()}</small></div>
|
||||||
<div class="col-lg-11"><small>${consentBehavior.getDescription()}</small></div>
|
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
</c:forEach>
|
</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 />
|
<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>
|
<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>
|
<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>
|
||||||
</div>
|
|
||||||
|
|
||||||
<%@ include file="base/footer.jsp" %>
|
<%@ include file="base/footer.jsp" %>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -134,6 +148,60 @@
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</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>
|
</body>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
@ -157,6 +225,36 @@
|
||||||
show: true
|
show: true
|
||||||
});
|
});
|
||||||
event.preventDefault();
|
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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue