Visualisation of progression by care or consent behavior.
This commit is contained in:
parent
b6ad90b2f8
commit
21272c53b2
|
|
@ -83,18 +83,17 @@ public class SecSecurityConfig extends WebSecurityConfigurerAdapter {
|
|||
.sameOrigin()
|
||||
.and()
|
||||
.authorizeRequests()
|
||||
.antMatchers("/"+IndexController.PAGE_ANIMAL).hasAnyRole(ROLE_ADMIN, ROLE_USER)
|
||||
// .antMatchers("/" + IndexController.PAGE_ALARMES + "*").hasAnyRole(ROLE_ADMIN, ROLE_ALARMES)
|
||||
.antMatchers("/").permitAll()
|
||||
.antMatchers("/"+IndexController.PAGE_LOGIN).permitAll()
|
||||
.antMatchers("/"+IndexController.PAGE_REGISTER).permitAll()
|
||||
.antMatchers("/"+IndexController.PAGE_LOGOUT).hasAnyRole(ROLE_ADMIN, ROLE_USER)
|
||||
.antMatchers(IndexController.URL_ANIMAL_LIST).hasAnyRole(ROLE_ADMIN, ROLE_USER)
|
||||
.antMatchers(IndexController.URL_INDEX).permitAll()
|
||||
.antMatchers(IndexController.URL_LOGIN).permitAll()
|
||||
.antMatchers(IndexController.URL_REGISTER).permitAll()
|
||||
.antMatchers(IndexController.URL_LOGOUT).hasAnyRole(ROLE_ADMIN, ROLE_USER)
|
||||
.anyRequest().authenticated()
|
||||
.and()
|
||||
// Authentification interne
|
||||
.formLogin()
|
||||
.loginPage("/" + IndexController.PAGE_LOGIN)
|
||||
.loginProcessingUrl("/" + IndexController.PAGE_LOGIN)
|
||||
.loginPage(IndexController.URL_LOGIN)
|
||||
.loginProcessingUrl(IndexController.URL_LOGIN)
|
||||
.usernameParameter("username")
|
||||
.passwordParameter("password")
|
||||
.defaultSuccessUrl("/", true)
|
||||
|
|
@ -112,7 +111,7 @@ public class SecSecurityConfig extends WebSecurityConfigurerAdapter {
|
|||
// }
|
||||
|
||||
response.setStatus(HttpServletResponse.SC_FOUND);
|
||||
response.setHeader("Location", request.getRequestURL().toString().replaceAll(IndexController.PAGE_LOGIN, IndexController.PAGE_ANIMAL));
|
||||
response.setHeader("Location", request.getRequestURL().toString().replaceAll(IndexController.URL_LOGIN, IndexController.URL_ANIMAL_LIST));
|
||||
}
|
||||
})
|
||||
.failureHandler(new AuthenticationFailureHandler() {
|
||||
|
|
@ -131,7 +130,7 @@ public class SecSecurityConfig extends WebSecurityConfigurerAdapter {
|
|||
.and()
|
||||
// Logout authentification interne
|
||||
.logout()
|
||||
.logoutUrl("/" + IndexController.PAGE_LOGOUT)
|
||||
.logoutUrl(IndexController.URL_LOGOUT)
|
||||
.logoutSuccessHandler(new LogoutSuccessHandler() {
|
||||
@Override
|
||||
public void onLogoutSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication)
|
||||
|
|
@ -140,7 +139,7 @@ public class SecSecurityConfig extends WebSecurityConfigurerAdapter {
|
|||
// HttpSession httpSession = request.getSession();
|
||||
|
||||
response.setStatus(HttpServletResponse.SC_FOUND);
|
||||
response.setHeader("Location", request.getRequestURL().toString().replaceAll("logout", ""));
|
||||
response.setHeader("Location", request.getRequestURL().toString().replaceAll(IndexController.URL_LOGOUT.substring(1), ""));
|
||||
}
|
||||
})
|
||||
.invalidateHttpSession(true)
|
||||
|
|
|
|||
|
|
@ -20,13 +20,14 @@ public class AnimalController {
|
|||
|
||||
public static final String MODEL_MAP_ANIMAL_LIST = "MODEL_MAP_ANIMAL_LIST";
|
||||
public static final String MODEL_MAP_ANIMAL = "MODEL_MAP_ANIMAL";
|
||||
public static final String MODEL_MAP_ANIMAL_CARE_ID = "MODEL_MAP_ANIMAL_CARE_ID";
|
||||
public static final String MODEL_MAP_ANIMAL_CONSENT_BEHAVIOR_ID = "MODEL_MAP_ANIMAL_CONSENT_BEHAVIOR_ID";
|
||||
|
||||
@Autowired
|
||||
IServiceAnimal serviceAnimal;
|
||||
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="Animal">
|
||||
@RequestMapping(value = "/animal", method = RequestMethod.GET)
|
||||
@RequestMapping(value = IndexController.URL_ANIMAL_LIST, method = RequestMethod.GET)
|
||||
public String doGetAnimal(final ModelMap pModel, HttpSession httpSession) {
|
||||
String ret;
|
||||
|
||||
|
|
@ -41,16 +42,17 @@ public class AnimalController {
|
|||
|
||||
ret = IndexController.PAGE_ANIMAL_LIST;
|
||||
} else {
|
||||
ret = IndexController.PAGE_REDIRECT + IndexController.PAGE_LOGIN;
|
||||
ret = IndexController.URL_REDIRECT + IndexController.URL_LOGIN;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
@RequestMapping(value = "/animal", method = RequestMethod.POST)
|
||||
|
||||
@RequestMapping(value = IndexController.URL_ANIMAL_LIST, method = RequestMethod.POST)
|
||||
public String doPostAddAnimal(final ModelMap pModel, HttpSession httpSession,
|
||||
@RequestParam(name = "name", required = true) String name) {
|
||||
|
||||
String ret = IndexController.PAGE_ANIMAL_LIST;
|
||||
String ret;
|
||||
if (LoginController.isUserAlreadyAuth(httpSession)) {
|
||||
Authentication authentication = (Authentication) httpSession.getAttribute(IndexController.SESSION_ATTRIBUTE_AUTHENTICATION);
|
||||
Object oUserDetails = authentication.getPrincipal();
|
||||
|
|
@ -59,16 +61,16 @@ public class AnimalController {
|
|||
|
||||
serviceAnimal.addAnimal(name, userDetails.getUsername());
|
||||
}
|
||||
ret = IndexController.PAGE_REDIRECT + "animal";
|
||||
ret = IndexController.URL_REDIRECT + IndexController.URL_ANIMAL_LIST;
|
||||
} else {
|
||||
ret = IndexController.PAGE_REDIRECT + IndexController.PAGE_LOGIN;
|
||||
ret = IndexController.URL_REDIRECT + IndexController.URL_LOGIN;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/animal/delete/{id}", method = RequestMethod.POST)
|
||||
public String doGetDeleteAnimal(final ModelMap pModel, HttpSession httpSession, @PathVariable(value="id") final int animalId) {
|
||||
@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;
|
||||
|
||||
if (LoginController.isUserAlreadyAuth(httpSession)) {
|
||||
|
|
@ -80,9 +82,9 @@ public class AnimalController {
|
|||
serviceAnimal.deleteAnimal(animalId, userDetails.getUsername());
|
||||
}
|
||||
|
||||
ret = IndexController.PAGE_REDIRECT + "animal";
|
||||
ret = IndexController.URL_REDIRECT + IndexController.URL_ANIMAL_LIST;
|
||||
} else {
|
||||
ret = IndexController.PAGE_REDIRECT + IndexController.PAGE_LOGIN;
|
||||
ret = IndexController.URL_REDIRECT + IndexController.URL_LOGIN;
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
|
@ -90,8 +92,8 @@ public class AnimalController {
|
|||
//</editor-fold>
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="Animal definition">
|
||||
@RequestMapping(value = "/animal/{id}/definition", method = RequestMethod.GET)
|
||||
public String doGetAnimal(final ModelMap pModel, HttpSession httpSession, @PathVariable(value="id") final int animalId) {
|
||||
@RequestMapping(value = IndexController.URL_ANIMAL_CARES_AND_BEHAVIORS_LIST, method = RequestMethod.GET)
|
||||
public String doGetAnimal(final ModelMap pModel, HttpSession httpSession, @PathVariable(value = "animal_id") final int animalId) {
|
||||
String ret;
|
||||
|
||||
if (LoginController.isUserAlreadyAuth(httpSession)) {
|
||||
|
|
@ -107,17 +109,17 @@ public class AnimalController {
|
|||
pModel.addAttribute(MODEL_MAP_ANIMAL_LIST, animals);
|
||||
}
|
||||
|
||||
ret = IndexController.PAGE_ANIMAL_DEFINITION;
|
||||
ret = IndexController.PAGE_ANIMAL_CARES_AND_BEHAVIORS;
|
||||
} else {
|
||||
ret = IndexController.PAGE_REDIRECT + IndexController.PAGE_LOGIN;
|
||||
ret = IndexController.URL_REDIRECT + IndexController.URL_LOGIN;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/animal/{id}/add/care", method = RequestMethod.POST)
|
||||
@RequestMapping(value = IndexController.URL_ANIMAL_CARES_ADD, method = RequestMethod.POST)
|
||||
public String doPostAddCare(final ModelMap pModel, HttpSession httpSession,
|
||||
@PathVariable(value="id") final int animalId,
|
||||
@PathVariable(value = "animal_id") final int animalId,
|
||||
@RequestParam(name = "name", required = true) String name,
|
||||
@RequestParam(name = "description", required = false, defaultValue = "") String description) {
|
||||
String ret;
|
||||
|
|
@ -131,18 +133,18 @@ public class AnimalController {
|
|||
serviceAnimal.addCare(animalId, name, description);
|
||||
}
|
||||
|
||||
ret = IndexController.PAGE_REDIRECT + "animal/"+animalId+"/definition";
|
||||
ret = IndexController.URL_REDIRECT + IndexController.URL_ANIMAL_CARES_AND_BEHAVIORS_LIST.replaceAll("\\{animal_id\\}", animalId + "");
|
||||
} else {
|
||||
ret = IndexController.PAGE_REDIRECT + IndexController.PAGE_LOGIN;
|
||||
ret = IndexController.URL_REDIRECT + IndexController.URL_LOGIN;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/animal/{id}/delete/care/{care_id}", method = RequestMethod.POST)
|
||||
@RequestMapping(value = IndexController.URL_ANIMAL_CARES_DELETE, method = RequestMethod.POST)
|
||||
public String doPostDeleteCare(final ModelMap pModel, HttpSession httpSession,
|
||||
@PathVariable(value="id") final int animalId,
|
||||
@PathVariable(value="care_id") final int careId) {
|
||||
@PathVariable(value = "animal_id") final int animalId,
|
||||
@PathVariable(value = "care_id") final int careId) {
|
||||
String ret;
|
||||
|
||||
if (LoginController.isUserAlreadyAuth(httpSession)) {
|
||||
|
|
@ -154,17 +156,17 @@ public class AnimalController {
|
|||
serviceAnimal.deleteAnimalCare(animalId, userDetails.getUsername(), careId);
|
||||
}
|
||||
|
||||
ret = IndexController.PAGE_REDIRECT + "animal/"+animalId+"/definition";
|
||||
ret = IndexController.URL_REDIRECT + IndexController.URL_ANIMAL_CARES_AND_BEHAVIORS_LIST.replaceAll("\\{animal_id\\}", animalId + "");
|
||||
} else {
|
||||
ret = IndexController.PAGE_REDIRECT + IndexController.PAGE_LOGIN;
|
||||
ret = IndexController.URL_REDIRECT + IndexController.URL_LOGIN;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/animal/{id}/add/consent_behavior", method = RequestMethod.POST)
|
||||
@RequestMapping(value = IndexController.URL_ANIMAL_CONSENT_BEHAVIOR_ADD, method = RequestMethod.POST)
|
||||
public String doPostAddConsentBehavior(final ModelMap pModel, HttpSession httpSession,
|
||||
@PathVariable(value="id") final int animalId,
|
||||
@PathVariable(value = "animal_id") final int animalId,
|
||||
@RequestParam(name = "name", required = true) String name,
|
||||
@RequestParam(name = "description", required = false, defaultValue = "") String description) {
|
||||
String ret;
|
||||
|
|
@ -178,18 +180,18 @@ public class AnimalController {
|
|||
serviceAnimal.addConsentBehavior(animalId, name, description);
|
||||
}
|
||||
|
||||
ret = IndexController.PAGE_REDIRECT + "animal/"+animalId+"/definition";
|
||||
ret = IndexController.URL_REDIRECT + IndexController.URL_ANIMAL_CARES_AND_BEHAVIORS_LIST.replaceAll("\\{animal_id\\}", animalId + "");
|
||||
} else {
|
||||
ret = IndexController.PAGE_REDIRECT + IndexController.PAGE_LOGIN;
|
||||
ret = IndexController.URL_REDIRECT + IndexController.URL_LOGIN;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/animal/{id}/delete/consent_behavior/{cb_id}", method = RequestMethod.POST)
|
||||
@RequestMapping(value = IndexController.URL_ANIMAL_CONSENT_BEHAVIOR_DELETE, method = RequestMethod.POST)
|
||||
public String doPostDeleteConsentBehavior(final ModelMap pModel, HttpSession httpSession,
|
||||
@PathVariable(value="id") final int animalId,
|
||||
@PathVariable(value="cb_id") final int consentBehaviorId) {
|
||||
@PathVariable(value = "animal_id") final int animalId,
|
||||
@PathVariable(value = "consent_behavior_id") final int consentBehaviorId) {
|
||||
String ret;
|
||||
|
||||
if (LoginController.isUserAlreadyAuth(httpSession)) {
|
||||
|
|
@ -201,12 +203,70 @@ public class AnimalController {
|
|||
serviceAnimal.deleteAnimalConsentBehavior(animalId, userDetails.getUsername(), consentBehaviorId);
|
||||
}
|
||||
|
||||
ret = IndexController.PAGE_REDIRECT + "animal/"+animalId+"/definition";
|
||||
ret = IndexController.URL_REDIRECT + IndexController.URL_ANIMAL_CARES_AND_BEHAVIORS_LIST.replaceAll("\\{animal_id\\}", animalId + "");
|
||||
} else {
|
||||
ret = IndexController.PAGE_REDIRECT + IndexController.PAGE_LOGIN;
|
||||
ret = IndexController.URL_REDIRECT + IndexController.URL_LOGIN;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
@RequestMapping(value = IndexController.URL_ANIMAL_CARE, method = RequestMethod.GET)
|
||||
public String doGetAnimalCare(final ModelMap pModel, HttpSession httpSession,
|
||||
@PathVariable(value = "animal_id") final int animalId,
|
||||
@PathVariable(value = "care_id") final int careId) {
|
||||
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;
|
||||
|
||||
Animal animal = serviceAnimal.getAnimalCareProgression(userDetails.getUsername(), animalId, careId);
|
||||
pModel.addAttribute(MODEL_MAP_ANIMAL, animal);
|
||||
|
||||
List<Animal> animals = serviceAnimal.getAnimals(userDetails.getUsername());
|
||||
pModel.addAttribute(MODEL_MAP_ANIMAL_LIST, animals);
|
||||
|
||||
pModel.addAttribute(MODEL_MAP_ANIMAL_CARE_ID, careId);
|
||||
}
|
||||
|
||||
ret = IndexController.PAGE_ANIMAL_CARE;
|
||||
} else {
|
||||
ret = IndexController.URL_REDIRECT + IndexController.URL_LOGIN;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@RequestMapping(value = IndexController.URL_ANIMAL_BEHAVIOR, method = RequestMethod.GET)
|
||||
public String doGetAnimalConsentBehavior(final ModelMap pModel, HttpSession httpSession,
|
||||
@PathVariable(value = "animal_id") final int animalId,
|
||||
@PathVariable(value = "consent_behavior_id") final int consentBehaviorId) {
|
||||
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;
|
||||
|
||||
Animal animal = serviceAnimal.getAnimalConsentBehaviorProgression(userDetails.getUsername(), animalId, consentBehaviorId);
|
||||
pModel.addAttribute(MODEL_MAP_ANIMAL, animal);
|
||||
|
||||
List<Animal> animals = serviceAnimal.getAnimals(userDetails.getUsername());
|
||||
pModel.addAttribute(MODEL_MAP_ANIMAL_LIST, animals);
|
||||
|
||||
pModel.addAttribute(MODEL_MAP_ANIMAL_CONSENT_BEHAVIOR_ID, consentBehaviorId);
|
||||
}
|
||||
|
||||
ret = IndexController.PAGE_ANIMAL_BEHAVIOR;
|
||||
} else {
|
||||
ret = IndexController.URL_REDIRECT + IndexController.URL_LOGIN;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,16 +21,42 @@ public class IndexController {
|
|||
|
||||
public static final String LOG_TAG = "[MedicalTrainingTracker]";
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="Pages">
|
||||
public static final String PAGE_INDEX = "index";
|
||||
public static final String PAGE_ANIMAL = "animal";
|
||||
public static final String PAGE_ANIMAL_DEFINITION = "animal_definition";
|
||||
public static final String PAGE_ANIMAL_CARES_AND_BEHAVIORS = "animal_cares_and_behaviors";
|
||||
public static final String PAGE_ANIMAL_CARE = "animal_care";
|
||||
public static final String PAGE_ANIMAL_BEHAVIOR = "animal_behavior";
|
||||
public static final String PAGE_ANIMAL_PROGRESSION = "animal_progression";
|
||||
public static final String PAGE_ANIMAL_LIST = "animal_list";
|
||||
public static final String PAGE_LOGIN = "login";
|
||||
public static final String PAGE_LOGOUT = "logout";
|
||||
public static final String PAGE_REGISTER = "register";
|
||||
//</editor-fold>
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="URL">
|
||||
public static final String URL_LOGIN = "/login";
|
||||
public static final String URL_LOGOUT = "/logout";
|
||||
public static final String URL_REGISTER = "/register";
|
||||
public static final String URL_INDEX = "/";
|
||||
|
||||
public static final String URL_ANIMAL_LIST = "/animal";
|
||||
public static final String URL_ANIMAL_CARES_AND_BEHAVIORS_LIST = "/animal/{animal_id}/cares_and_behaviors";
|
||||
public static final String URL_ANIMAL_CARE = "/animal/{animal_id}/care/{care_id}";
|
||||
public static final String URL_ANIMAL_BEHAVIOR = "/animal/{animal_id}/consent_behavior/{consent_behavior_id}";
|
||||
public static final String URL_ANIMAL_PROGRESSIONS_LIST = "/animal/{animal_id}/progressions";
|
||||
|
||||
// Add URL
|
||||
public static final String URL_ANIMAL_CARES_ADD = "/animal/{animal_id}/add/care";
|
||||
public static final String URL_ANIMAL_CONSENT_BEHAVIOR_ADD = "/animal/{animal_id}/add/consent_behavior";
|
||||
// Delete URL
|
||||
public static final String URL_ANIMAL_DELETE = "/animal/delete/{animal_id}";
|
||||
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_REDIRECT = "redirect:";
|
||||
//</editor-fold>
|
||||
|
||||
public static final String PAGE_REDIRECT = "redirect:/";
|
||||
|
||||
public static final String SESSION_ATTRIBUTE_LOGIN = "user";
|
||||
public static final String SESSION_ATTRIBUTE_AUTHENTICATION = "authentication";
|
||||
|
|
|
|||
|
|
@ -2,8 +2,6 @@ package fr.geoffrey.medical_training_tracker.controller;
|
|||
|
||||
import fr.geoffrey.medical_training_tracker.dao.UserAlreadyExistException;
|
||||
import fr.geoffrey.medical_training_tracker.services.IServiceRegister;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import javax.servlet.http.HttpSession;
|
||||
import javax.servlet.http.HttpSessionEvent;
|
||||
import javax.servlet.http.HttpSessionListener;
|
||||
|
|
@ -32,12 +30,12 @@ public class LoginController implements HttpSessionListener {
|
|||
return authentication != null && authentication.isAuthenticated();
|
||||
}
|
||||
|
||||
@RequestMapping(value = IndexController.PAGE_LOGIN, method = RequestMethod.GET)
|
||||
@RequestMapping(value = IndexController.URL_LOGIN, method = RequestMethod.GET)
|
||||
public String doGet(final ModelMap pModel, HttpSession httpSession, @RequestParam(name = "errAuth", required = false, defaultValue = "false") boolean errAuth) {
|
||||
String page = IndexController.PAGE_LOGIN;
|
||||
if (isUserAlreadyAuth(httpSession)) {
|
||||
// Deja authentifie, redirection sur le viewer photo
|
||||
page = IndexController.PAGE_REDIRECT;
|
||||
page = IndexController.URL_REDIRECT+IndexController.URL_INDEX;
|
||||
} else if (errAuth) {
|
||||
pModel.addAttribute("isErrorAuth", true);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,9 @@ import java.util.List;
|
|||
*/
|
||||
public interface ICareDao extends CommonDao {
|
||||
|
||||
public List<Care> getAllAnialCares(String owner, int animalId);
|
||||
public List<Care> getAllAnimalCares(String owner, int animalId);
|
||||
public Care getAnimalCare(String owner, int animalId, int careId);
|
||||
|
||||
|
||||
public void addCare(int animalId, String name, String description);
|
||||
public void deleteCare(int careId, int animalId, String owner);
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import java.util.List;
|
|||
public interface IConsentBehaviorDao extends CommonDao {
|
||||
|
||||
public List<ConsentBehavior> getAllAnialConsentBehavior(String owner, int animalId);
|
||||
public ConsentBehavior getAnimalConsentBehavior(String owner, int animalId, int consentBehaviorId);
|
||||
|
||||
public void addConsentBehavior(int animalId, String name, String description);
|
||||
public void deleteConsentBehavior(int consentBehaviorId, int animalId, String owner);
|
||||
|
|
|
|||
|
|
@ -13,4 +13,8 @@ public interface IProgressionDao extends CommonDao {
|
|||
public void deleteAllAnimalProgression(int animalId, String owner);
|
||||
public void deleteAllAnimalCareProgression(int animalId, String owner, int careId);
|
||||
public void deleteAllAnimalConsentBehaviorProgression(int animalId, String owner, int consentBehaviorId);
|
||||
|
||||
public void fillAnimalProgressionByCare(Animal animal, int careId);
|
||||
|
||||
public void fillAnimalProgressionByConsentBehavior(Animal animal, int consentBehaviorId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ public class CareDao extends PostgresSqlDao implements ICareDao {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<Care> getAllAnialCares(String owner, int animalId) {
|
||||
public List<Care> getAllAnimalCares(String owner, int animalId) {
|
||||
List<Care> ret = new ArrayList<>();
|
||||
|
||||
Connection conn = null;
|
||||
|
|
@ -88,6 +88,64 @@ public class CareDao extends PostgresSqlDao implements ICareDao {
|
|||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Care getAnimalCare(String owner, int animalId, int careId) {
|
||||
Care ret = null;
|
||||
|
||||
Connection conn = null;
|
||||
PreparedStatement statement = null;
|
||||
ResultSet resultSet = null;
|
||||
try {
|
||||
conn = mDataSource.getConnection();
|
||||
statement = conn.prepareStatement("select "
|
||||
+ TABLE_NAME+".id as care_id, "+TABLE_NAME+".name as care_name, "+TABLE_NAME+".description as care_desc "
|
||||
+ "from "+TABLE_NAME+" "
|
||||
+ "left join "+AnimalDao.TABLE_NAME+" on "+TABLE_NAME+".animal = "+AnimalDao.TABLE_NAME+".id "
|
||||
+ "where "+AnimalDao.TABLE_NAME+".owner = ? and "+AnimalDao.TABLE_NAME+".id = ? and "+TABLE_NAME+".id = ?;");
|
||||
statement.setString(1, owner);
|
||||
statement.setInt(2, animalId);
|
||||
statement.setInt(3, careId);
|
||||
System.out.println(IndexController.LOG_TAG + " SQL -> " + statement.toString());
|
||||
resultSet = statement.executeQuery();
|
||||
|
||||
if (resultSet != null) {
|
||||
while (resultSet.next()) {
|
||||
ret = new Care();
|
||||
ret.setId(resultSet.getInt("care_id"));
|
||||
ret.setName(resultSet.getString("care_name"));
|
||||
ret.setDescription(resultSet.getString("care_desc"));
|
||||
}
|
||||
resultSet.close();
|
||||
}
|
||||
} catch (SQLException ex) {
|
||||
System.err.println(IndexController.LOG_TAG + " SQLException -> getAnimalCare() - " + ex.getMessage());
|
||||
ex.printStackTrace();
|
||||
} finally {
|
||||
if (resultSet != null) {
|
||||
try {
|
||||
resultSet.close();
|
||||
} catch (SQLException ex) {
|
||||
System.err.println(IndexController.LOG_TAG + " Failed close ResultSet -> getAnimalCare()");
|
||||
}
|
||||
}
|
||||
if (statement != null) {
|
||||
try {
|
||||
statement.close();
|
||||
} catch (SQLException ex) {
|
||||
System.err.println(IndexController.LOG_TAG + " Failed close statement -> getAnimalCare()");
|
||||
}
|
||||
}
|
||||
if (conn != null) {
|
||||
try {
|
||||
conn.close();
|
||||
} catch (SQLException ex) {
|
||||
System.err.println(IndexController.LOG_TAG + " Failed close connection -> getAnimalCare()");
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCare(int animalId, String name, String description) {
|
||||
Connection conn = null;
|
||||
|
|
|
|||
|
|
@ -88,6 +88,64 @@ public class ConsentBehaviorDao extends PostgresSqlDao implements IConsentBehavi
|
|||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConsentBehavior getAnimalConsentBehavior(String owner, int animalId, int consentBehaviorId) {
|
||||
ConsentBehavior ret = null;
|
||||
|
||||
Connection conn = null;
|
||||
PreparedStatement statement = null;
|
||||
ResultSet resultSet = null;
|
||||
try {
|
||||
conn = mDataSource.getConnection();
|
||||
statement = conn.prepareStatement("select "
|
||||
+ TABLE_NAME+".id as cb_id, "+TABLE_NAME+".name as cb_name, "+TABLE_NAME+".description as cb_desc "
|
||||
+ "from "+TABLE_NAME+" "
|
||||
+ "left join "+AnimalDao.TABLE_NAME+" on "+TABLE_NAME+".animal = "+AnimalDao.TABLE_NAME+".id "
|
||||
+ "where "+AnimalDao.TABLE_NAME+".owner = ? and "+AnimalDao.TABLE_NAME+".id = ? and "+TABLE_NAME+".id = ?;");
|
||||
statement.setString(1, owner);
|
||||
statement.setInt(2, animalId);
|
||||
statement.setInt(3, consentBehaviorId);
|
||||
System.out.println(IndexController.LOG_TAG + " SQL -> " + statement.toString());
|
||||
resultSet = statement.executeQuery();
|
||||
|
||||
if (resultSet != null) {
|
||||
while (resultSet.next()) {
|
||||
ret = new ConsentBehavior();
|
||||
ret.setId(resultSet.getInt("cb_id"));
|
||||
ret.setName(resultSet.getString("cb_name"));
|
||||
ret.setDescription(resultSet.getString("cb_desc"));
|
||||
}
|
||||
resultSet.close();
|
||||
}
|
||||
} catch (SQLException ex) {
|
||||
System.err.println(IndexController.LOG_TAG + " SQLException -> getAnimalConsentBehavior() - " + ex.getMessage());
|
||||
ex.printStackTrace();
|
||||
} finally {
|
||||
if (resultSet != null) {
|
||||
try {
|
||||
resultSet.close();
|
||||
} catch (SQLException ex) {
|
||||
System.err.println(IndexController.LOG_TAG + " Failed close ResultSet -> getAnimalConsentBehavior()");
|
||||
}
|
||||
}
|
||||
if (statement != null) {
|
||||
try {
|
||||
statement.close();
|
||||
} catch (SQLException ex) {
|
||||
System.err.println(IndexController.LOG_TAG + " Failed close statement -> getAnimalConsentBehavior()");
|
||||
}
|
||||
}
|
||||
if (conn != null) {
|
||||
try {
|
||||
conn.close();
|
||||
} catch (SQLException ex) {
|
||||
System.err.println(IndexController.LOG_TAG + " Failed close connection -> getAnimalConsentBehavior()");
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addConsentBehavior(int animalId, String name, String description) {
|
||||
Connection conn = null;
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@ package fr.geoffrey.medical_training_tracker.dao.bdd.postgres;
|
|||
import fr.geoffrey.medical_training_tracker.controller.IndexController;
|
||||
import fr.geoffrey.medical_training_tracker.dao.IProgressionDao;
|
||||
import fr.geoffrey.medical_training_tracker.dao.bean.Animal;
|
||||
import fr.geoffrey.medical_training_tracker.dao.bean.Care;
|
||||
import fr.geoffrey.medical_training_tracker.dao.bean.ConsentBehavior;
|
||||
import fr.geoffrey.medical_training_tracker.dao.bean.Progression;
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
|
|
@ -29,6 +31,7 @@ public class ProgressionDao extends PostgresSqlDao implements IProgressionDao {
|
|||
_createSequence(SEQUENCE_NAME);
|
||||
}
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="Fill methods">
|
||||
@Override
|
||||
public void fillAnimalProgression(Animal animal) {
|
||||
Connection conn = null;
|
||||
|
|
@ -98,6 +101,162 @@ public class ProgressionDao extends PostgresSqlDao implements IProgressionDao {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fillAnimalProgressionByCare(Animal animal, int careId) {
|
||||
Connection conn = null;
|
||||
PreparedStatement statement = null;
|
||||
ResultSet resultSet = null;
|
||||
try {
|
||||
conn = mDataSource.getConnection();
|
||||
statement = conn.prepareStatement("select "
|
||||
+ AnimalDao.TABLE_NAME+".id as animal_id, "+AnimalDao.TABLE_NAME+".name as animal_name, "+AnimalDao.TABLE_NAME+".owner as animal_owner, "
|
||||
+ TABLE_NAME+".id as progression_id, "+TABLE_NAME+".progression_by_me as prog_by_me, "+TABLE_NAME+".progression_by_someone_else as prog_by_someone_else, "+TABLE_NAME+".progression_by_veterinary as prog_by_vet, "
|
||||
+ TABLE_NAME+".care as care_id, "+TABLE_NAME+".consent_behavior as consent_behavior_id, "
|
||||
+ ConsentBehaviorDao.TABLE_NAME+".name as consent_behavior_name, "+ConsentBehaviorDao.TABLE_NAME+".description as consent_behavior_desc "
|
||||
+ "from "+TABLE_NAME+" "
|
||||
+ "left join "+AnimalDao.TABLE_NAME+" on "+TABLE_NAME+".animal = "+AnimalDao.TABLE_NAME+".id "
|
||||
+ "left join "+ConsentBehaviorDao.TABLE_NAME+" on "+TABLE_NAME+".consent_behavior = "+ConsentBehaviorDao.TABLE_NAME+".id "
|
||||
+ "where "+AnimalDao.TABLE_NAME+".owner = ? and "+AnimalDao.TABLE_NAME+".id = ? and "+TABLE_NAME+".care = ?;");
|
||||
statement.setString(1, animal.getOwner());
|
||||
statement.setInt(2, animal.getId());
|
||||
statement.setInt(3, careId);
|
||||
System.out.println(IndexController.LOG_TAG + " SQL -> " + statement.toString());
|
||||
resultSet = statement.executeQuery();
|
||||
|
||||
if (resultSet != null) {
|
||||
while (resultSet.next()) {
|
||||
Progression progression = new Progression();
|
||||
progression.setId(resultSet.getInt("progression_id"));
|
||||
progression.setProgressionByMe(resultSet.getString("prog_by_me"));
|
||||
progression.setProgressionBySomeoneElse(resultSet.getString("prog_by_someone_else"));
|
||||
progression.setProgressionByVeterinary(resultSet.getString("prog_by_vet"));
|
||||
|
||||
int _careId = resultSet.getInt("care_id");
|
||||
if (animal.containsCareKey(_careId)) {
|
||||
progression.setCare(animal.getCareById(_careId));
|
||||
}
|
||||
|
||||
int consentBehaviorId = resultSet.getInt("consent_behavior_id");
|
||||
if (!animal.containsConsentBehaviorKey(consentBehaviorId)) {
|
||||
ConsentBehavior consentBehavior = new ConsentBehavior();
|
||||
consentBehavior.setId(consentBehaviorId);
|
||||
consentBehavior.setName(resultSet.getString("consent_behavior_name"));
|
||||
consentBehavior.setDescription(resultSet.getString("consent_behavior_desc"));
|
||||
animal.addConsentBehavior(consentBehavior);
|
||||
}
|
||||
progression.setConsentBehavior(animal.getConsentBehaviorById(consentBehaviorId));
|
||||
|
||||
animal.addProgression(progression);
|
||||
}
|
||||
resultSet.close();
|
||||
}
|
||||
} catch (SQLException ex) {
|
||||
System.err.println(IndexController.LOG_TAG + " SQLException -> fillAnimalProgressionByCare() - " + ex.getMessage());
|
||||
ex.printStackTrace();
|
||||
} finally {
|
||||
if (resultSet != null) {
|
||||
try {
|
||||
resultSet.close();
|
||||
} catch (SQLException ex) {
|
||||
System.err.println(IndexController.LOG_TAG + " Failed close ResultSet -> fillAnimalProgressionByCare()");
|
||||
}
|
||||
}
|
||||
if (statement != null) {
|
||||
try {
|
||||
statement.close();
|
||||
} catch (SQLException ex) {
|
||||
System.err.println(IndexController.LOG_TAG + " Failed close statement -> fillAnimalProgressionByCare()");
|
||||
}
|
||||
}
|
||||
if (conn != null) {
|
||||
try {
|
||||
conn.close();
|
||||
} catch (SQLException ex) {
|
||||
System.err.println(IndexController.LOG_TAG + " Failed close connection -> fillAnimalProgressionByCare()");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fillAnimalProgressionByConsentBehavior(Animal animal, int consentBehaviorId) {
|
||||
Connection conn = null;
|
||||
PreparedStatement statement = null;
|
||||
ResultSet resultSet = null;
|
||||
try {
|
||||
conn = mDataSource.getConnection();
|
||||
statement = conn.prepareStatement("select "
|
||||
+ AnimalDao.TABLE_NAME+".id as animal_id, "+AnimalDao.TABLE_NAME+".name as animal_name, "+AnimalDao.TABLE_NAME+".owner as animal_owner, "
|
||||
+ TABLE_NAME+".id as progression_id, "+TABLE_NAME+".progression_by_me as prog_by_me, "+TABLE_NAME+".progression_by_someone_else as prog_by_someone_else, "+TABLE_NAME+".progression_by_veterinary as prog_by_vet, "
|
||||
+ TABLE_NAME+".care as care_id, "+TABLE_NAME+".consent_behavior as consent_behavior_id, "
|
||||
+ CareDao.TABLE_NAME+".name as care_name, "+CareDao.TABLE_NAME+".description as care_desc "
|
||||
+ "from "+TABLE_NAME+" "
|
||||
+ "left join "+AnimalDao.TABLE_NAME+" on "+TABLE_NAME+".animal = "+AnimalDao.TABLE_NAME+".id "
|
||||
+ "left join "+CareDao.TABLE_NAME+" on "+TABLE_NAME+".care = "+CareDao.TABLE_NAME+".id "
|
||||
+ "where "+AnimalDao.TABLE_NAME+".owner = ? and "+AnimalDao.TABLE_NAME+".id = ? and "+TABLE_NAME+".consent_behavior = ?;");
|
||||
statement.setString(1, animal.getOwner());
|
||||
statement.setInt(2, animal.getId());
|
||||
statement.setInt(3, consentBehaviorId);
|
||||
System.out.println(IndexController.LOG_TAG + " SQL -> " + statement.toString());
|
||||
resultSet = statement.executeQuery();
|
||||
|
||||
if (resultSet != null) {
|
||||
while (resultSet.next()) {
|
||||
Progression progression = new Progression();
|
||||
progression.setId(resultSet.getInt("progression_id"));
|
||||
progression.setProgressionByMe(resultSet.getString("prog_by_me"));
|
||||
progression.setProgressionBySomeoneElse(resultSet.getString("prog_by_someone_else"));
|
||||
progression.setProgressionByVeterinary(resultSet.getString("prog_by_vet"));
|
||||
|
||||
int careId = resultSet.getInt("care_id");
|
||||
if (!animal.containsCareKey(careId)) {
|
||||
Care care = new Care();
|
||||
care.setId(careId);
|
||||
care.setName(resultSet.getString("care_name"));
|
||||
care.setDescription(resultSet.getString("care_desc"));
|
||||
animal.addCare(care);
|
||||
}
|
||||
progression.setCare(animal.getCareById(careId));
|
||||
|
||||
int _consentBehaviorId = resultSet.getInt("consent_behavior_id");
|
||||
if (animal.containsConsentBehaviorKey(_consentBehaviorId)) {
|
||||
progression.setConsentBehavior(animal.getConsentBehaviorById(_consentBehaviorId));
|
||||
}
|
||||
|
||||
animal.addProgression(progression);
|
||||
}
|
||||
resultSet.close();
|
||||
}
|
||||
} catch (SQLException ex) {
|
||||
System.err.println(IndexController.LOG_TAG + " SQLException -> fillAnimalProgressionByConsentBehavior() - " + ex.getMessage());
|
||||
ex.printStackTrace();
|
||||
} finally {
|
||||
if (resultSet != null) {
|
||||
try {
|
||||
resultSet.close();
|
||||
} catch (SQLException ex) {
|
||||
System.err.println(IndexController.LOG_TAG + " Failed close ResultSet -> fillAnimalProgressionByConsentBehavior()");
|
||||
}
|
||||
}
|
||||
if (statement != null) {
|
||||
try {
|
||||
statement.close();
|
||||
} catch (SQLException ex) {
|
||||
System.err.println(IndexController.LOG_TAG + " Failed close statement -> fillAnimalProgressionByConsentBehavior()");
|
||||
}
|
||||
}
|
||||
if (conn != null) {
|
||||
try {
|
||||
conn.close();
|
||||
} catch (SQLException ex) {
|
||||
System.err.println(IndexController.LOG_TAG + " Failed close connection -> fillAnimalProgressionByConsentBehavior()");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="Delete methods">
|
||||
@Override
|
||||
public void deleteProgression(int progressionId, int animalId, String owner) {
|
||||
Connection conn = null;
|
||||
|
|
@ -241,4 +400,5 @@ public class ProgressionDao extends PostgresSqlDao implements IProgressionDao {
|
|||
}
|
||||
}
|
||||
}
|
||||
//</editor-fold>
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,8 @@ public interface IServiceAnimal {
|
|||
|
||||
public List<Animal> getAnimals(String owner);
|
||||
public Animal getAnimalProgression(String owner, int animalId);
|
||||
public Animal getAnimalCareProgression(String owner, int animalId, int careId);
|
||||
public Animal getAnimalConsentBehaviorProgression(String owner, int animalId, int consentBehaviorId);
|
||||
|
||||
public void addAnimal(String name, String owner);
|
||||
public void addCare(int animalId, String name, String description);
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ public class ServiceAnimal implements IServiceAnimal {
|
|||
public Animal getAnimalProgression(String owner, int animalId) {
|
||||
Animal animal = animalDao.getAnimal(owner, animalId);
|
||||
if (animal != null) {
|
||||
animal.addCares(careDao.getAllAnialCares(owner, animalId));
|
||||
animal.addCares(careDao.getAllAnimalCares(owner, animalId));
|
||||
animal.addConsentBehaviors(consentBehaviorDao.getAllAnialConsentBehavior(owner, animalId));
|
||||
progressionDao.fillAnimalProgression(animal);
|
||||
}
|
||||
|
|
@ -86,4 +86,24 @@ public class ServiceAnimal implements IServiceAnimal {
|
|||
public void deleteAnimalProgression(int animalId, String owner, int progressionId) {
|
||||
progressionDao.deleteProgression(progressionId, animalId, owner);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Animal getAnimalCareProgression(String owner, int animalId, int careId) {
|
||||
Animal animal = animalDao.getAnimal(owner, animalId);
|
||||
if (animal != null) {
|
||||
animal.addCare(careDao.getAnimalCare(owner, animalId, careId));
|
||||
progressionDao.fillAnimalProgressionByCare(animal, careId);
|
||||
}
|
||||
return animal;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Animal getAnimalConsentBehaviorProgression(String owner, int animalId, int consentBehaviorId) {
|
||||
Animal animal = animalDao.getAnimal(owner, animalId);
|
||||
if (animal != null) {
|
||||
animal.addConsentBehavior(consentBehaviorDao.getAnimalConsentBehavior(owner, animalId, consentBehaviorId));
|
||||
progressionDao.fillAnimalProgressionByConsentBehavior(animal, consentBehaviorId);
|
||||
}
|
||||
return animal;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,71 @@
|
|||
<%@page import="fr.geoffrey.medical_training_tracker.dao.bean.Animal"%>
|
||||
<%@page import="java.util.List"%>
|
||||
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
|
||||
<%@ taglib uri="http://www.springframework.org/tags" prefix="spring"%>
|
||||
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
|
||||
<%@ page isELIgnored="false" %>
|
||||
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<%@ include file="base/header.jsp" %>
|
||||
<style type="text/css">
|
||||
fieldset {
|
||||
margin: auto;
|
||||
width: 600px;
|
||||
margin-top: 30px;
|
||||
margin-bottom: 10px;
|
||||
padding: 20px;
|
||||
text-align: left;
|
||||
border: 2px solid #aaa;
|
||||
}
|
||||
fieldset a {
|
||||
width: 150px;
|
||||
margin-bottom: 10px;
|
||||
float: right;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<%@ include file="base/navbar.jsp" %>
|
||||
<center><h1>Feuille de ${MODEL_MAP_ANIMAL.getName()}</h1></center>
|
||||
<h4>${MODEL_MAP_ANIMAL.getConsentBehaviorById(MODEL_MAP_ANIMAL_CONSENT_BEHAVIOR_ID).getName()}</h4>
|
||||
<p>${MODEL_MAP_ANIMAL.getConsentBehaviorById(MODEL_MAP_ANIMAL_CONSENT_BEHAVIOR_ID).getDescription()}</p>
|
||||
<h4>Progression</h4>
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Soins</th>
|
||||
<th>Réalisé par moi</th>
|
||||
<th>Réalisé par quelqu'un d'autre</th>
|
||||
<th>Réalisé par le vétérinaire</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<c:forEach items="${MODEL_MAP_ANIMAL.getProgressionList()}" var="progression">
|
||||
<tr>
|
||||
<td><a href="${animalURL}/${MODEL_MAP_ANIMAL.getId()}/care/${progression.getCare().getId()}">${progression.getCare().getName()}</a></td>
|
||||
<td class="
|
||||
<c:if test="${progression.getProgressionByMe() == 'TRAINED'}">success</c:if>
|
||||
<c:if test="${progression.getProgressionByMe() == 'CURRENTLY_TRAINING'}">info</c:if>
|
||||
<c:if test="${progression.getProgressionByMe() == 'NOT_TRAINED'}">active</c:if>
|
||||
">${progression.getProgressionByMe()}</td>
|
||||
<td class="
|
||||
<c:if test="${progression.getProgressionBySomeoneElse() == 'TRAINED'}">success</c:if>
|
||||
<c:if test="${progression.getProgressionBySomeoneElse() == 'CURRENTLY_TRAINING'}">info</c:if>
|
||||
<c:if test="${progression.getProgressionBySomeoneElse() == 'NOT_TRAINED'}">active</c:if>
|
||||
">${progression.getProgressionBySomeoneElse()}</td>
|
||||
<td class="
|
||||
<c:if test="${progression.getProgressionByVeterinary() == 'TRAINED'}">success</c:if>
|
||||
<c:if test="${progression.getProgressionByVeterinary() == 'CURRENTLY_TRAINING'}">info</c:if>
|
||||
<c:if test="${progression.getProgressionByVeterinary() == 'NOT_TRAINED'}">active</c:if>
|
||||
">${progression.getProgressionByVeterinary()}</td>
|
||||
</tr>
|
||||
</c:forEach>
|
||||
</tbody>
|
||||
</table>
|
||||
<%@ include file="base/footer.jsp" %>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,71 @@
|
|||
<%@page import="fr.geoffrey.medical_training_tracker.dao.bean.Animal"%>
|
||||
<%@page import="java.util.List"%>
|
||||
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
|
||||
<%@ taglib uri="http://www.springframework.org/tags" prefix="spring"%>
|
||||
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
|
||||
<%@ page isELIgnored="false" %>
|
||||
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<%@ include file="base/header.jsp" %>
|
||||
<style type="text/css">
|
||||
fieldset {
|
||||
margin: auto;
|
||||
width: 600px;
|
||||
margin-top: 30px;
|
||||
margin-bottom: 10px;
|
||||
padding: 20px;
|
||||
text-align: left;
|
||||
border: 2px solid #aaa;
|
||||
}
|
||||
fieldset a {
|
||||
width: 150px;
|
||||
margin-bottom: 10px;
|
||||
float: right;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<%@ include file="base/navbar.jsp" %>
|
||||
<center><h1>Feuille de ${MODEL_MAP_ANIMAL.getName()}</h1></center>
|
||||
<h4>${MODEL_MAP_ANIMAL.getCareById(MODEL_MAP_ANIMAL_CARE_ID).getName()}</h4>
|
||||
<p>${MODEL_MAP_ANIMAL.getCareById(MODEL_MAP_ANIMAL_CARE_ID).getDescription()}</p>
|
||||
<h4>Progression</h4>
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Comportement de consentement</th>
|
||||
<th>Réalisé par moi</th>
|
||||
<th>Réalisé par quelqu'un d'autre</th>
|
||||
<th>Réalisé par le vétérinaire</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<c:forEach items="${MODEL_MAP_ANIMAL.getProgressionList()}" var="progression">
|
||||
<tr>
|
||||
<td><a href="${animalURL}/${MODEL_MAP_ANIMAL.getId()}/consent_behavior/${progression.getConsentBehavior().getId()}">${progression.getConsentBehavior().getName()}</a></td>
|
||||
<td class="
|
||||
<c:if test="${progression.getProgressionByMe() == 'TRAINED'}">success</c:if>
|
||||
<c:if test="${progression.getProgressionByMe() == 'CURRENTLY_TRAINING'}">info</c:if>
|
||||
<c:if test="${progression.getProgressionByMe() == 'NOT_TRAINED'}">active</c:if>
|
||||
">${progression.getProgressionByMe()}</td>
|
||||
<td class="
|
||||
<c:if test="${progression.getProgressionBySomeoneElse() == 'TRAINED'}">success</c:if>
|
||||
<c:if test="${progression.getProgressionBySomeoneElse() == 'CURRENTLY_TRAINING'}">info</c:if>
|
||||
<c:if test="${progression.getProgressionBySomeoneElse() == 'NOT_TRAINED'}">active</c:if>
|
||||
">${progression.getProgressionBySomeoneElse()}</td>
|
||||
<td class="
|
||||
<c:if test="${progression.getProgressionByVeterinary() == 'TRAINED'}">success</c:if>
|
||||
<c:if test="${progression.getProgressionByVeterinary() == 'CURRENTLY_TRAINING'}">info</c:if>
|
||||
<c:if test="${progression.getProgressionByVeterinary() == 'NOT_TRAINED'}">active</c:if>
|
||||
">${progression.getProgressionByVeterinary()}</td>
|
||||
</tr>
|
||||
</c:forEach>
|
||||
</tbody>
|
||||
</table>
|
||||
<%@ include file="base/footer.jsp" %>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -42,7 +42,7 @@
|
|||
<h4>Liste des soins</h4>
|
||||
<div class="list-group">
|
||||
<c:forEach items="${MODEL_MAP_ANIMAL.getListCares()}" var="care">
|
||||
<div class="list-group-item">
|
||||
<a href="${animalURL}/${MODEL_MAP_ANIMAL.getId()}/care/${care.getId()}" class="list-group-item">
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
${care.getName()}
|
||||
|
|
@ -55,7 +55,7 @@
|
|||
<div class="col-lg-1"></div>
|
||||
<div class="col-lg-11"><small>${care.getDescription()}</small></div>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</c:forEach>
|
||||
</div>
|
||||
<hr/>
|
||||
|
|
@ -74,7 +74,7 @@
|
|||
<h4>Liste des comportements de consentements</h4>
|
||||
<div class="list-group">
|
||||
<c:forEach items="${MODEL_MAP_ANIMAL.getListConsentBehavior()}" var="consentBehavior">
|
||||
<div class="list-group-item">
|
||||
<a href="${animalURL}/${MODEL_MAP_ANIMAL.getId()}/consent_behavior/${consentBehavior.getId()}" class="list-group-item">
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
${consentBehavior.getName()}
|
||||
|
|
@ -87,7 +87,7 @@
|
|||
<div class="col-lg-1"></div>
|
||||
<div class="col-lg-11"><small>${consentBehavior.getDescription()}</small></div>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</c:forEach>
|
||||
</div>
|
||||
<hr/>
|
||||
|
|
@ -18,6 +18,6 @@
|
|||
<!--<footer style="text-align: center;">-->
|
||||
<footer style="text-align: center;">
|
||||
<p style="font-size: 0.8em;"><img src="${logoPNG}" alt="Logo Koario" style="max-height: 20px;" /> Medical Training Tracker</p>
|
||||
<p style="font-size: 0.8em;">Application sous licence <a href="#">MIT</a></p>
|
||||
<p><a href="#" style="font-size: 0.8em;">Code source</a></p>
|
||||
<p style="font-size: 0.8em;">Application sous licence <a href="https://git.kingpenguin.tk/chteufleur/MedicalTrainingTracker/src/branch/master/LICENSE">MIT</a></p>
|
||||
<p><a href="https://git.kingpenguin.tk/chteufleur/MedicalTrainingTracker" style="font-size: 0.8em;">Code source</a></p>
|
||||
</footer>
|
||||
|
|
@ -37,8 +37,8 @@
|
|||
<li class="dropdown" <c:if test="${MODEL_MAP_ANIMAL.getId() == animal.getId()}">class="active"</c:if> >
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">${animal.getName()} <span class="caret"></span></a>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a href="${animalURL}/${animal.getId()}/definition">Soins et Comportements</a></li>
|
||||
<li><a href="${animalURL}/${animal.getId()}/progression">Progressions</a></li>
|
||||
<li><a href="${animalURL}/${animal.getId()}/cares_and_behaviors">Soins et Comportements</a></li>
|
||||
<li><a href="${animalURL}/${animal.getId()}/progressions">Progressions</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</c:forEach>
|
||||
|
|
|
|||
Loading…
Reference in New Issue