diff --git a/src/main/java/fr/geoffrey/medical_training_tracker/controller/AnimalController.java b/src/main/java/fr/geoffrey/medical_training_tracker/controller/AnimalController.java
index 91e6798..e5c5eee 100644
--- a/src/main/java/fr/geoffrey/medical_training_tracker/controller/AnimalController.java
+++ b/src/main/java/fr/geoffrey/medical_training_tracker/controller/AnimalController.java
@@ -223,7 +223,8 @@ public class AnimalController {
public String doPostAddProgression(final ModelMap pModel, HttpSession httpSession,
@PathVariable(value = "animal_id") final int animalId,
@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;
if (LoginController.isUserAlreadyAuth(httpSession)) {
@@ -235,8 +236,16 @@ public class AnimalController {
serviceAnimal.addProgression(animalId, careId, consentBehaviorId);
}
- // TODO Where do redirection ?
- ret = IndexController.URL_REDIRECT + IndexController.URL_ANIMAL_CARES_AND_BEHAVIORS_LIST.replaceAll("\\{animal_id\\}", animalId + "");
+ 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;
}
@@ -247,7 +256,9 @@ public class AnimalController {
@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,
- @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;
if (LoginController.isUserAlreadyAuth(httpSession)) {
@@ -259,8 +270,16 @@ public class AnimalController {
serviceAnimal.deleteAnimalProgression(animalId, userDetails.getUsername(), progressionId);
}
- // TODO Where do redirection ?
- ret = IndexController.URL_REDIRECT + IndexController.URL_ANIMAL_CARES_AND_BEHAVIORS_LIST.replaceAll("\\{animal_id\\}", animalId + "");
+ if (pageFrom.equals("care")) {
+ 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 {
ret = IndexController.URL_REDIRECT + IndexController.URL_LOGIN;
}
diff --git a/src/main/webapp/vue/animal_behavior.jsp b/src/main/webapp/vue/animal_behavior.jsp
index b5f5137..7b89862 100644
--- a/src/main/webapp/vue/animal_behavior.jsp
+++ b/src/main/webapp/vue/animal_behavior.jsp
@@ -67,8 +67,11 @@