Can edit progressions.

This commit is contained in:
Geoffrey POUZET 2020-10-25 21:12:22 +01:00
parent 4000bcbad2
commit e6cd190afe
13 changed files with 349 additions and 77 deletions

View File

@ -248,7 +248,7 @@ public class AnimalController {
}
@RequestMapping(value = IndexController.URL_ANIMAL_EDIT_CONSENT_BEHAVIOR, method = RequestMethod.POST)
public String doPostEditAnimal(final ModelMap pModel, HttpSession httpSession,
public String doPostEditConsentBehavior(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,
@ -328,6 +328,44 @@ public class AnimalController {
return ret;
}
@RequestMapping(value = IndexController.URL_ANIMAL_EDIT_PROGRESSION, method = RequestMethod.POST)
public String doPostEditProgression(final ModelMap pModel, HttpSession httpSession,
@PathVariable(value = "animal_id") final int animalId,
@PathVariable(value = "progression_id") final int progressionId,
@RequestParam(name = "progression_by_me", required = true) String progressionByMe,
@RequestParam(name = "progression_by_someone_else", required = true) String progressionBySomeoneElse,
@RequestParam(name = "progression_by_veterinary", required = true) String progressionByVeterinary,
@RequestParam(name = "care_id", required = true) int careId,
@RequestParam(name = "consent_behavior_id", required = true) int consentBehaviorId,
@RequestParam(value = "page", required = true) final String pageFrom) {
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.updateProgression(animalId, userDetails.getUsername(), progressionId, progressionByMe, progressionBySomeoneElse, progressionByVeterinary);
}
if (pageFrom.equals("care")) {
ret = IndexController.URL_REDIRECT + IndexController.URL_ANIMAL_CARE
.replaceAll("\\{care_id\\}", careId + "");
} else if (pageFrom.equals("consent_behavior")) {
ret = IndexController.URL_REDIRECT + IndexController.URL_ANIMAL_BEHAVIOR
.replaceAll("\\{consent_behavior_id\\}", consentBehaviorId + "");
} else {
ret = IndexController.URL_REDIRECT + IndexController.URL_ANIMAL_CARES_AND_BEHAVIORS_LIST;
}
ret = ret.replaceAll("\\{animal_id\\}", animalId + "");
} else {
ret = IndexController.URL_REDIRECT + IndexController.URL_LOGIN;
}
return ret;
}
@RequestMapping(value = IndexController.URL_ANIMAL_PROGRESSION_DELETE, method = RequestMethod.POST)
public String doPostDeleteProgression(final ModelMap pModel, HttpSession httpSession,
@PathVariable(value = "animal_id") final int animalId,

View File

@ -63,6 +63,7 @@ public class IndexController {
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_ANIMAL_EDIT_PROGRESSION = "/animal/{animal_id}/edit/progression/{progression_id}";
public static final String URL_REDIRECT = "redirect:";
//</editor-fold>

View File

@ -21,4 +21,6 @@ public interface IProgressionDao extends CommonDao {
public void fillAnimalProgressionByVeterinary(Animal animal, String progressionByVeterinary);
public void addProgression(int animalId, int careId, int consentBehaviorId);
public void updateProgression(int animalId, String owner, int progressionId, String progressionByMe, String progressionBySomeoneElse, String progressionByVeterinary);
}

View File

@ -691,4 +691,42 @@ public class ProgressionDao extends PostgresSqlDao implements IProgressionDao {
}
}
}
@Override
public void updateProgression(int animalId, String owner, int progressionId, String progressionByMe, String progressionBySomeoneElse, String progressionByVeterinary) {
Connection conn = null;
PreparedStatement statement = null;
try {
conn = mDataSource.getConnection();
statement = conn.prepareStatement("UPDATE "+TABLE_NAME+" SET progression_by_me = ?, progression_by_someone_else = ?, progression_by_veterinary = ? WHERE id = ? AND animal = ("
+ "SELECT id FROM "+AnimalDao.TABLE_NAME+" WHERE owner = ? AND id = ?)");
statement.setString(1, progressionByMe);
statement.setString(2, progressionBySomeoneElse);
statement.setString(3, progressionByVeterinary);
statement.setInt(4, progressionId);
statement.setString(5, owner);
statement.setInt(6, 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()");
}
}
}
}
}

View File

@ -32,4 +32,6 @@ public interface IServiceAnimal {
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);
public void updateProgression(int animalId, String owner, int progressionId, String progressionByMe, String progressionBySomeoneElse, String progressionByVeterinary);
}

View File

@ -165,4 +165,9 @@ public class ServiceAnimal implements IServiceAnimal {
public void updateConsentBehavior(int consentBehaviorId, int animalId, String owner, String name, String description) {
consentBehaviorDao.updateConsentBehavior(consentBehaviorId, animalId, owner, name, description);
}
@Override
public void updateProgression(int animalId, String owner, int progressionId, String progressionByMe, String progressionBySomeoneElse, String progressionByVeterinary) {
progressionDao.updateProgression(animalId, owner, progressionId, progressionByMe, progressionBySomeoneElse, progressionByVeterinary);
}
}

View File

@ -105,3 +105,8 @@ 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)
animal_care.button.edit.tooltip=Edit
animal_consent_behavior.button.edit.tooltip=Edit
animal_care_and_behavior.care_list.empty=No cares yet
animal_care_and_behavior.behavior_list.empty=No consent behaviors yet
animal_list.animal_list.empty=No animals yet

View File

@ -101,3 +101,8 @@ 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)
animal_care.button.edit.tooltip=Edit
animal_consent_behavior.button.edit.tooltip=Edit
animal_care_and_behavior.care_list.empty=No cares yet
animal_care_and_behavior.behavior_list.empty=No consent behaviors yet
animal_list.animal_list.empty=No animals yet

View File

@ -101,3 +101,8 @@ animal_care_and_behavior.edit_behavior.modal.name.label=Nom du comportement de c
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)
animal_care.button.edit.tooltip=Modifier
animal_consent_behavior.button.edit.tooltip=Modifier
animal_care_and_behavior.care_list.empty=Pas encore de soins
animal_care_and_behavior.behavior_list.empty=Pas encore de comportements de consentement
animal_list.animal_list.empty=Pas encore d'animaux

View File

@ -4,6 +4,7 @@
<%@ taglib uri="http://www.springframework.org/tags" prefix="spring"%>
<%@ page isELIgnored="false" %>
<spring:url value="/animal/${MODEL_MAP_ANIMAL.getId()}/delete/progression" var="animalDeleteProgressionURL" />
<spring:url value="/animal/${MODEL_MAP_ANIMAL.getId()}/edit/progression" var="animalEditProgressionURL" />
<spring:url value="/animal/${MODEL_MAP_ANIMAL.getId()}/add/progression" var="animalAddProgressionURL" />
<%@ include file="base/language.jsp" %>
@ -94,6 +95,15 @@
<input id="form_consent_behavior_id" name="redirect_id" value="${MODEL_MAP_ANIMAL_CONSENT_BEHAVIOR_ID}" hidden />
<button class="btn btn-danger" type="submit" data-toggle="tooltip" data-placement="bottom" title="<fmt:message key="animal_behavior.button.delete.tooltip"></fmt:message>"><span class="glyphicon glyphicon-trash" aria-hidden="true"></span></button>
</form>
<form class="pull-right" action="${animalEditProgressionURL}/${progression.getId()}" method="GET">
<input value="${progression.getCare().getId()}" hidden />
<input value="${progression.getCare().getName()}" hidden />
<input value="${progression.getProgressionByMe()}" hidden />
<input value="${progression.getProgressionBySomeoneElse()}" hidden />
<input value="${progression.getProgressionByVeterinary()}" hidden />
<button class="btn btn-default" type="submit" data-toggle="tooltip" data-placement="bottom" title="<fmt:message key="animal_consent_behavior.button.edit.tooltip"></fmt:message>"><span class="glyphicon glyphicon-edit" aria-hidden="true"></span></button>
</form>
</td>
</tr>
</c:forEach>
@ -150,27 +160,95 @@
</div>
</div>
</body>
<script type="text/javascript">
$(document).ready(function () {
$('[data-toggle="tooltip"]').tooltip();
$("form").submit(function (event) {
if ($(this).attr('id') !== 'modal_delete_animal_progression_validate_delete') {
<div id="modal_edit_animal_progression" 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">&times;</button>
<h4 id="modal_edit_animal_progression_title" class="modal-title"></h4>
</div>
<div class="modal-body">
<form id="modal_edit_animal_progression_validate" action="" method="POST">
<label for="modal_edit_consent_behavior_form_progression_by_me"><fmt:message key="animal_behavior.table.executed_by_me"></fmt:message></label>
<select id="modal_edit_consent_behavior_form_progression_by_me" name="progression_by_me" class="form-control">
<option value="NOT_TRAINED"><fmt:message key="progression.value.NOT_TRAINED"></fmt:message></option>
<option value="CURRENTLY_TRAINING"><fmt:message key="progression.value.CURRENTLY_TRAINING"></fmt:message></option>
<option value="TRAINED"><fmt:message key="progression.value.TRAINED"></fmt:message></option>
</select>
<label for="modal_edit_consent_behavior_form_progression_by_someone_else"><fmt:message key="animal_behavior.table.executed_by_me"></fmt:message></label>
<select id="modal_edit_consent_behavior_form_progression_by_someone_else" name="progression_by_someone_else" class="form-control">
<option value="NOT_TRAINED"><fmt:message key="progression.value.NOT_TRAINED"></fmt:message></option>
<option value="CURRENTLY_TRAINING"><fmt:message key="progression.value.CURRENTLY_TRAINING"></fmt:message></option>
<option value="TRAINED"><fmt:message key="progression.value.TRAINED"></fmt:message></option>
</select>
<label for="modal_edit_consent_behavior_form_progression_by_veterinary"><fmt:message key="animal_behavior.table.executed_by_me"></fmt:message></label>
<select id="modal_edit_consent_behavior_form_progression_by_veterinary" name="progression_by_veterinary" class="form-control">
<option value="NOT_TRAINED"><fmt:message key="progression.value.NOT_TRAINED"></fmt:message></option>
<option value="CURRENTLY_TRAINING"><fmt:message key="progression.value.CURRENTLY_TRAINING"></fmt:message></option>
<option value="TRAINED"><fmt:message key="progression.value.TRAINED"></fmt:message></option>
</select>
<input name="page" value="consent_behavior" hidden />
<input id="modal_edit_consent_behavior_form_care_id" name="care_id" value="" hidden />
<input name="consent_behavior_id" value="${MODEL_MAP_ANIMAL_CONSENT_BEHAVIOR_ID}" hidden />
</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_progression_validate" type="submit" class="btn btn-primary"><fmt:message key="modal_button.edit"></fmt:message></button>
</div>
</div>
</div>
</div>
</body>
<script type="text/javascript">
$(document).ready(function () {
$('[data-toggle="tooltip"]').tooltip();
$("form").submit(function (event) {
var formUrl = $(this).attr('action');
if (formUrl.startsWith('${animalDeleteProgressionURL}')) {
// Only for deleting care or behavior forms
var behaviorName = $(this).find('input')[0].value;
$('#modal_delete_animal_progression_title').text(behaviorName);
$('#modal_delete_animal_progression_validate_delete').attr('action', formUrl);
$('#modal_delete_animal_progression').modal({
show: true
});
event.preventDefault();
if ($(this).attr('id') !== 'modal_delete_animal_progression_validate_delete') {
// Only for deleting care or behavior forms
var behaviorName = $(this).find('input')[0].value;
$('#modal_delete_animal_progression_title').text(behaviorName);
$('#modal_delete_animal_progression_validate_delete').attr('action', formUrl);
$('#modal_delete_animal_progression').modal({
show: true
});
event.preventDefault();
}
} else if (formUrl.startsWith('${animalEditProgressionURL}')) {
if ($(this).attr('id') !== 'modal_edit_animal_progression_validate') {
// Only for deleting care or behavior forms
var data = $(this).find('input');
var careId = data[0].value;
var careName = data[1].value;
var progressionByMe = data[2].value;
var progressionBySomeoneElse = data[3].value;
var progressionByVeterinary = data[4].value;
$('#modal_edit_consent_behavior_form_care_id').val(careId);
$('#modal_edit_animal_progression_title').text(careName);
$('#modal_edit_consent_behavior_form_progression_by_me').val(progressionByMe);
$('#modal_edit_consent_behavior_form_progression_by_someone_else').val(progressionBySomeoneElse);
$('#modal_edit_consent_behavior_form_progression_by_veterinary').val(progressionByVeterinary);
$('#modal_edit_animal_progression_validate').attr('action', formUrl);
$('#modal_edit_animal_progression').modal({
show: true
});
event.preventDefault();
}
}
}
});
});
});
</script>
</html>

View File

@ -4,6 +4,7 @@
<%@ taglib uri="http://www.springframework.org/tags" prefix="spring"%>
<%@ page isELIgnored="false" %>
<spring:url value="/animal/${MODEL_MAP_ANIMAL.getId()}/delete/progression" var="animalDeleteProgressionURL" />
<spring:url value="/animal/${MODEL_MAP_ANIMAL.getId()}/edit/progression" var="animalEditProgressionURL" />
<spring:url value="/animal/${MODEL_MAP_ANIMAL.getId()}/add/progression" var="animalAddProgressionURL" />
<%@ include file="base/language.jsp" %>
@ -94,6 +95,15 @@
<input id="form_care_id" name="redirect_id" value="${MODEL_MAP_ANIMAL_CARE_ID}" hidden />
<button class="btn btn-danger" type="submit" data-toggle="tooltip" data-placement="bottom" title="<fmt:message key="animal_care.button.delete.tooltip"></fmt:message>"><span class="glyphicon glyphicon-trash" aria-hidden="true"></span></button>
</form>
<form class="pull-right" action="${animalEditProgressionURL}/${progression.getId()}" method="GET">
<input value="${progression.getConsentBehavior().getId()}" hidden />
<input value="${progression.getConsentBehavior().getName()}" hidden />
<input value="${progression.getProgressionByMe()}" hidden />
<input value="${progression.getProgressionBySomeoneElse()}" hidden />
<input value="${progression.getProgressionByVeterinary()}" hidden />
<button class="btn btn-default" type="submit" data-toggle="tooltip" data-placement="bottom" title="<fmt:message key="animal_care.button.edit.tooltip"></fmt:message>"><span class="glyphicon glyphicon-edit" aria-hidden="true"></span></button>
</form>
</td>
</tr>
</c:forEach>
@ -149,27 +159,95 @@
</div>
</div>
</body>
<script type="text/javascript">
$(document).ready(function () {
$('[data-toggle="tooltip"]').tooltip();
$("form").submit(function (event) {
if ($(this).attr('id') !== 'modal_delete_animal_progression_validate_delete') {
<div id="modal_edit_animal_progression" 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">&times;</button>
<h4 id="modal_edit_animal_progression_title" class="modal-title"></h4>
</div>
<div class="modal-body">
<form id="modal_edit_animal_progression_validate" action="" method="POST">
<label for="modal_edit_consent_behavior_form_progression_by_me"><fmt:message key="animal_care.table.executed_by_me"></fmt:message></label>
<select id="modal_edit_consent_behavior_form_progression_by_me" name="progression_by_me" class="form-control">
<option value="NOT_TRAINED"><fmt:message key="progression.value.NOT_TRAINED"></fmt:message></option>
<option value="CURRENTLY_TRAINING"><fmt:message key="progression.value.CURRENTLY_TRAINING"></fmt:message></option>
<option value="TRAINED"><fmt:message key="progression.value.TRAINED"></fmt:message></option>
</select>
<label for="modal_edit_consent_behavior_form_progression_by_someone_else"><fmt:message key="animal_care.table.executed_by_me"></fmt:message></label>
<select id="modal_edit_consent_behavior_form_progression_by_someone_else" name="progression_by_someone_else" class="form-control">
<option value="NOT_TRAINED"><fmt:message key="progression.value.NOT_TRAINED"></fmt:message></option>
<option value="CURRENTLY_TRAINING"><fmt:message key="progression.value.CURRENTLY_TRAINING"></fmt:message></option>
<option value="TRAINED"><fmt:message key="progression.value.TRAINED"></fmt:message></option>
</select>
<label for="modal_edit_consent_behavior_form_progression_by_veterinary"><fmt:message key="animal_care.table.executed_by_me"></fmt:message></label>
<select id="modal_edit_consent_behavior_form_progression_by_veterinary" name="progression_by_veterinary" class="form-control">
<option value="NOT_TRAINED"><fmt:message key="progression.value.NOT_TRAINED"></fmt:message></option>
<option value="CURRENTLY_TRAINING"><fmt:message key="progression.value.CURRENTLY_TRAINING"></fmt:message></option>
<option value="TRAINED"><fmt:message key="progression.value.TRAINED"></fmt:message></option>
</select>
<input name="page" value="care" hidden />
<input name="care_id" value="${MODEL_MAP_ANIMAL_CARE_ID}" hidden />
<input id="modal_edit_consent_behavior_form_behavior_id" name="consent_behavior_id" value="" hidden />
</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_progression_validate" type="submit" class="btn btn-primary"><fmt:message key="modal_button.edit"></fmt:message></button>
</div>
</div>
</div>
</div>
</body>
<script type="text/javascript">
$(document).ready(function () {
$('[data-toggle="tooltip"]').tooltip();
$("form").submit(function (event) {
var formUrl = $(this).attr('action');
if (formUrl.startsWith('${animalDeleteProgressionURL}')) {
// Only for deleting care or behavior forms
var careName = $(this).find('input')[0].value;
$('#modal_delete_animal_progression_title').text(careName);
$('#modal_delete_animal_progression_validate_delete').attr('action', formUrl);
$('#modal_delete_animal_progression').modal({
show: true
});
event.preventDefault();
if ($(this).attr('id') !== 'modal_delete_animal_progression_validate_delete') {
// Only for deleting care or behavior forms
var careName = $(this).find('input')[0].value;
$('#modal_delete_animal_progression_title').text(careName);
$('#modal_delete_animal_progression_validate_delete').attr('action', formUrl);
$('#modal_delete_animal_progression').modal({
show: true
});
event.preventDefault();
}
} else if (formUrl.startsWith('${animalEditProgressionURL}')) {
if ($(this).attr('id') !== 'modal_edit_animal_progression_validate') {
// Only for deleting care or behavior forms
var data = $(this).find('input');
var consentBehaviorId = data[0].value;
var consentBehaviorName = data[1].value;
var progressionByMe = data[2].value;
var progressionBySomeoneElse = data[3].value;
var progressionByVeterinary = data[4].value;
$('#modal_edit_consent_behavior_form_behavior_id').val(consentBehaviorId);
$('#modal_edit_animal_progression_title').text(consentBehaviorName);
$('#modal_edit_consent_behavior_form_progression_by_me').val(progressionByMe);
$('#modal_edit_consent_behavior_form_progression_by_someone_else').val(progressionBySomeoneElse);
$('#modal_edit_consent_behavior_form_progression_by_veterinary').val(progressionByVeterinary);
$('#modal_edit_animal_progression_validate').attr('action', formUrl);
$('#modal_edit_animal_progression').modal({
show: true
});
event.preventDefault();
}
}
}
});
});
});
</script>
</html>

View File

@ -48,31 +48,36 @@
<div class="col-lg-5">
<h4><fmt:message key="animal_care_and_behavior.care_list"></fmt:message></h4>
<c:if test="${MODEL_MAP_ANIMAL.getListCares().size() == 0}">
<p><fmt:message key="animal_care_and_behavior.care_list.empty"></fmt:message></p>
</c:if>
<c:if test="${MODEL_MAP_ANIMAL.getListCares().size() != 0}">
<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">
<div class="col-lg-12">
${care.getName()}
<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 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>
<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">
<div class="col-lg-1"></div>
<div class="col-lg-11"><small>${care.getDescription()}</small></div>
</div>
</a>
</c:forEach>
</div>
<div class="col-lg-12">
${care.getName()}
<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 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 class="row">
<div class="col-lg-1"></div>
<div class="col-lg-11"><small>${care.getDescription()}</small></div>
</div>
</a>
</c:forEach>
</div>
</c:if>
<hr/>
<h4><fmt:message key="animal_care_and_behavior.add_care"></fmt:message></h4>
<form id="addCareForm" action="${animalAddCareURL}" method="POST">
@ -87,6 +92,10 @@
<div class="col-lg-5">
<h4><fmt:message key="animal_care_and_behavior.behavior_list"></fmt:message></h4>
<c:if test="${MODEL_MAP_ANIMAL.getListConsentBehavior().size() == 0}">
<p><fmt:message key="animal_care_and_behavior.behavior_list.empty"></fmt:message></p>
</c:if>
<c:if test="${MODEL_MAP_ANIMAL.getListConsentBehavior().size() != 0}">
<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">
@ -112,6 +121,7 @@
</a>
</c:forEach>
</div>
</c:if>
<hr/>
<h4><fmt:message key="animal_care_and_behavior.add_behavior"></fmt:message></h4>
<form id="addCareForm" action="${animalAddConsentBehaviorURL}" method="POST">

View File

@ -36,28 +36,33 @@
<div class="row">
<div class="col-lg-5">
<h4><fmt:message key="animal_list.animal_list.title"></fmt:message></h4>
<c:if test="${MODEL_MAP_ANIMAL.getListCares().size() == 0}">
<p><fmt:message key="animal_list.animal_list.empty"></fmt:message></p>
</c:if>
<c:if test="${MODEL_MAP_ANIMAL.getListCares().size() != 0}">
<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>
<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>
<form class="pull-right" action="${animalURL}/${animal.getId()}/edit" method="GET">
<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>
</form>
</div>-->
</c:forEach>
</div>
</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>
</form>
</div>-->
</c:forEach>
</div>
</c:if>
<hr/>
@ -136,13 +141,13 @@
</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>
<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>
<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>