Redirect on the roght page after adding/deletind care/consent behavior.
This commit is contained in:
parent
498eaa02cb
commit
7d9bbbaa56
|
|
@ -223,7 +223,8 @@ public class AnimalController {
|
||||||
public String doPostAddProgression(final ModelMap pModel, HttpSession httpSession,
|
public String doPostAddProgression(final ModelMap pModel, HttpSession httpSession,
|
||||||
@PathVariable(value = "animal_id") final int animalId,
|
@PathVariable(value = "animal_id") final int animalId,
|
||||||
@RequestParam(name = "care_id", required = true) int careId,
|
@RequestParam(name = "care_id", required = true) int careId,
|
||||||
@RequestParam(name = "consent_behavior_id", required = true) int consentBehaviorId) {
|
@RequestParam(name = "consent_behavior_id", required = true) int consentBehaviorId,
|
||||||
|
@RequestParam(value = "page", required = true) final String pageFrom) {
|
||||||
String ret;
|
String ret;
|
||||||
|
|
||||||
if (LoginController.isUserAlreadyAuth(httpSession)) {
|
if (LoginController.isUserAlreadyAuth(httpSession)) {
|
||||||
|
|
@ -235,8 +236,16 @@ public class AnimalController {
|
||||||
serviceAnimal.addProgression(animalId, careId, consentBehaviorId);
|
serviceAnimal.addProgression(animalId, careId, consentBehaviorId);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO Where do redirection ?
|
if (pageFrom.equals("care")) {
|
||||||
ret = IndexController.URL_REDIRECT + IndexController.URL_ANIMAL_CARES_AND_BEHAVIORS_LIST.replaceAll("\\{animal_id\\}", animalId + "");
|
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 {
|
} else {
|
||||||
ret = IndexController.URL_REDIRECT + IndexController.URL_LOGIN;
|
ret = IndexController.URL_REDIRECT + IndexController.URL_LOGIN;
|
||||||
}
|
}
|
||||||
|
|
@ -247,7 +256,9 @@ public class AnimalController {
|
||||||
@RequestMapping(value = IndexController.URL_ANIMAL_PROGRESSION_DELETE, method = RequestMethod.POST)
|
@RequestMapping(value = IndexController.URL_ANIMAL_PROGRESSION_DELETE, method = RequestMethod.POST)
|
||||||
public String doPostDeleteProgression(final ModelMap pModel, HttpSession httpSession,
|
public String doPostDeleteProgression(final ModelMap pModel, HttpSession httpSession,
|
||||||
@PathVariable(value = "animal_id") final int animalId,
|
@PathVariable(value = "animal_id") final int animalId,
|
||||||
@PathVariable(value = "progression_id") final int progressionId) {
|
@PathVariable(value = "progression_id") final int progressionId,
|
||||||
|
@RequestParam(value = "page", required = true) final String pageFrom,
|
||||||
|
@RequestParam(value = "redirect_id", required = true) final int redirectId) {
|
||||||
String ret;
|
String ret;
|
||||||
|
|
||||||
if (LoginController.isUserAlreadyAuth(httpSession)) {
|
if (LoginController.isUserAlreadyAuth(httpSession)) {
|
||||||
|
|
@ -259,8 +270,16 @@ public class AnimalController {
|
||||||
serviceAnimal.deleteAnimalProgression(animalId, userDetails.getUsername(), progressionId);
|
serviceAnimal.deleteAnimalProgression(animalId, userDetails.getUsername(), progressionId);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO Where do redirection ?
|
if (pageFrom.equals("care")) {
|
||||||
ret = IndexController.URL_REDIRECT + IndexController.URL_ANIMAL_CARES_AND_BEHAVIORS_LIST.replaceAll("\\{animal_id\\}", animalId + "");
|
ret = IndexController.URL_REDIRECT + IndexController.URL_ANIMAL_CARE
|
||||||
|
.replaceAll("\\{care_id\\}", redirectId + "");
|
||||||
|
} else if (pageFrom.equals("consent_behavior")) {
|
||||||
|
ret = IndexController.URL_REDIRECT + IndexController.URL_ANIMAL_BEHAVIOR
|
||||||
|
.replaceAll("\\{consent_behavior_id\\}", redirectId + "");
|
||||||
|
} else {
|
||||||
|
ret = IndexController.URL_REDIRECT + IndexController.URL_ANIMAL_CARES_AND_BEHAVIORS_LIST;
|
||||||
|
}
|
||||||
|
ret = ret.replaceAll("\\{animal_id\\}", animalId + "");
|
||||||
} else {
|
} else {
|
||||||
ret = IndexController.URL_REDIRECT + IndexController.URL_LOGIN;
|
ret = IndexController.URL_REDIRECT + IndexController.URL_LOGIN;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -67,8 +67,11 @@
|
||||||
<c:if test="${progression.getProgressionByVeterinary() == 'NOT_TRAINED'}">active</c:if>
|
<c:if test="${progression.getProgressionByVeterinary() == 'NOT_TRAINED'}">active</c:if>
|
||||||
">${progression.getProgressionByVeterinary()}</td>
|
">${progression.getProgressionByVeterinary()}</td>
|
||||||
<td>
|
<td>
|
||||||
<!--TODO MODIFICATION-->
|
|
||||||
<form class="pull-right" action="${animalDeleteProgressionURL}/${progression.getId()}" method="POST">
|
<form class="pull-right" action="${animalDeleteProgressionURL}/${progression.getId()}" method="POST">
|
||||||
|
<label class="sr-only" for="form_page">Page</label>
|
||||||
|
<input id="form_page" name="page" value="consent_behavior" hidden />
|
||||||
|
<label class="sr-only" for="form_consent_behavior_id">Consent behavior ID</label>
|
||||||
|
<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="Suppression"><span class="glyphicon glyphicon-trash" aria-hidden="true"></span></button>
|
<button class="btn btn-danger" type="submit" data-toggle="tooltip" data-placement="bottom" title="Suppression"><span class="glyphicon glyphicon-trash" aria-hidden="true"></span></button>
|
||||||
</form>
|
</form>
|
||||||
</td>
|
</td>
|
||||||
|
|
@ -80,6 +83,8 @@
|
||||||
<hr/>
|
<hr/>
|
||||||
<h4>Ajouter un soins pour ce comportement de consentement</h4>
|
<h4>Ajouter un soins pour ce comportement de consentement</h4>
|
||||||
<form class="form-inline" action="${animalAddProgressionURL}" method="POST">
|
<form class="form-inline" action="${animalAddProgressionURL}" method="POST">
|
||||||
|
<label class="sr-only" for="form_page">Page</label>
|
||||||
|
<input id="form_page" name="page" value="consent_behavior" hidden />
|
||||||
<label class="sr-only" for="form_consent_behavior_id">Consent Behavior ID</label>
|
<label class="sr-only" for="form_consent_behavior_id">Consent Behavior ID</label>
|
||||||
<input id="form_consent_behavior_id" name="consent_behavior_id" value="${MODEL_MAP_ANIMAL_CONSENT_BEHAVIOR_ID}" hidden />
|
<input id="form_consent_behavior_id" name="consent_behavior_id" value="${MODEL_MAP_ANIMAL_CONSENT_BEHAVIOR_ID}" hidden />
|
||||||
<label class="sr-only" for="form_care_id">Care ID</label>
|
<label class="sr-only" for="form_care_id">Care ID</label>
|
||||||
|
|
|
||||||
|
|
@ -71,8 +71,11 @@
|
||||||
<c:if test="${progression.getProgressionByVeterinary() == 'NOT_TRAINED'}">active</c:if>
|
<c:if test="${progression.getProgressionByVeterinary() == 'NOT_TRAINED'}">active</c:if>
|
||||||
"><fmt:message key="progression.value.${progression.getProgressionByVeterinary()}"></fmt:message></td>
|
"><fmt:message key="progression.value.${progression.getProgressionByVeterinary()}"></fmt:message></td>
|
||||||
<td>
|
<td>
|
||||||
<!--TODO MODIFICATION-->
|
|
||||||
<form class="pull-right" action="${animalDeleteProgressionURL}/${progression.getId()}" method="POST">
|
<form class="pull-right" action="${animalDeleteProgressionURL}/${progression.getId()}" method="POST">
|
||||||
|
<label class="sr-only" for="form_page">Page</label>
|
||||||
|
<input id="form_page" name="page" value="care" hidden />
|
||||||
|
<label class="sr-only" for="form_care_id">Care ID</label>
|
||||||
|
<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="Suppression"><span class="glyphicon glyphicon-trash" aria-hidden="true"></span></button>
|
<button class="btn btn-danger" type="submit" data-toggle="tooltip" data-placement="bottom" title="Suppression"><span class="glyphicon glyphicon-trash" aria-hidden="true"></span></button>
|
||||||
</form>
|
</form>
|
||||||
</td>
|
</td>
|
||||||
|
|
@ -84,6 +87,8 @@
|
||||||
<hr/>
|
<hr/>
|
||||||
<h4>Ajouter un comportement de consentement pour ce soin</h4>
|
<h4>Ajouter un comportement de consentement pour ce soin</h4>
|
||||||
<form class="form-inline" action="${animalAddProgressionURL}" method="POST">
|
<form class="form-inline" action="${animalAddProgressionURL}" method="POST">
|
||||||
|
<label class="sr-only" for="form_page">Page</label>
|
||||||
|
<input id="form_page" name="page" value="care" hidden />
|
||||||
<label class="sr-only" for="form_care_id">Care ID</label>
|
<label class="sr-only" for="form_care_id">Care ID</label>
|
||||||
<input id="form_care_id" name="care_id" value="${MODEL_MAP_ANIMAL_CARE_ID}" hidden />
|
<input id="form_care_id" name="care_id" value="${MODEL_MAP_ANIMAL_CARE_ID}" hidden />
|
||||||
<label class="sr-only" for="form_consent_behavior_id">Consent Behavior ID</label>
|
<label class="sr-only" for="form_consent_behavior_id">Consent Behavior ID</label>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue