Compare commits
2 Commits
79247d6b34
...
525b55d74a
| Author | SHA1 | Date |
|---|---|---|
|
|
525b55d74a | |
|
|
b64485f3bd |
|
|
@ -4,12 +4,14 @@ import fr.geoffrey.medical_training_tracker.dao.IAnimalDao;
|
||||||
import fr.geoffrey.medical_training_tracker.dao.ICareDao;
|
import fr.geoffrey.medical_training_tracker.dao.ICareDao;
|
||||||
import fr.geoffrey.medical_training_tracker.dao.IConsentBehaviorDao;
|
import fr.geoffrey.medical_training_tracker.dao.IConsentBehaviorDao;
|
||||||
import fr.geoffrey.medical_training_tracker.dao.IProgressionDao;
|
import fr.geoffrey.medical_training_tracker.dao.IProgressionDao;
|
||||||
|
import fr.geoffrey.medical_training_tracker.dao.IProgressionsNoteDao;
|
||||||
import fr.geoffrey.medical_training_tracker.dao.IUserDao;
|
import fr.geoffrey.medical_training_tracker.dao.IUserDao;
|
||||||
import fr.geoffrey.medical_training_tracker.dao.bdd.BddConnectionManager;
|
import fr.geoffrey.medical_training_tracker.dao.bdd.BddConnectionManager;
|
||||||
import fr.geoffrey.medical_training_tracker.dao.bdd.postgres.AnimalDao;
|
import fr.geoffrey.medical_training_tracker.dao.bdd.postgres.AnimalDao;
|
||||||
import fr.geoffrey.medical_training_tracker.dao.bdd.postgres.CareDao;
|
import fr.geoffrey.medical_training_tracker.dao.bdd.postgres.CareDao;
|
||||||
import fr.geoffrey.medical_training_tracker.dao.bdd.postgres.ConsentBehaviorDao;
|
import fr.geoffrey.medical_training_tracker.dao.bdd.postgres.ConsentBehaviorDao;
|
||||||
import fr.geoffrey.medical_training_tracker.dao.bdd.postgres.ProgressionDao;
|
import fr.geoffrey.medical_training_tracker.dao.bdd.postgres.ProgressionDao;
|
||||||
|
import fr.geoffrey.medical_training_tracker.dao.bdd.postgres.ProgressionsNoteDao;
|
||||||
import fr.geoffrey.medical_training_tracker.dao.bdd.postgres.UserBddDao;
|
import fr.geoffrey.medical_training_tracker.dao.bdd.postgres.UserBddDao;
|
||||||
import javax.servlet.ServletContextEvent;
|
import javax.servlet.ServletContextEvent;
|
||||||
import javax.servlet.ServletContextListener;
|
import javax.servlet.ServletContextListener;
|
||||||
|
|
@ -40,6 +42,9 @@ public class Servlet implements ServletContextListener {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
IProgressionDao progressionDao;
|
IProgressionDao progressionDao;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
IProgressionsNoteDao progressionsNoteDao;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void contextInitialized(ServletContextEvent sce) {
|
public void contextInitialized(ServletContextEvent sce) {
|
||||||
|
|
@ -82,6 +87,13 @@ public class Servlet implements ServletContextListener {
|
||||||
if (!progressionDao.isStorageExist()) {
|
if (!progressionDao.isStorageExist()) {
|
||||||
progressionDao.createStorage();
|
progressionDao.createStorage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (progressionsNoteDao instanceof ProgressionsNoteDao) {
|
||||||
|
((ProgressionsNoteDao) progressionsNoteDao).setBddConnectionManager(bddConnectionManager);
|
||||||
|
}
|
||||||
|
if (!progressionsNoteDao.isStorageExist()) {
|
||||||
|
progressionsNoteDao.createStorage();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -27,9 +27,18 @@ public class AnimalController {
|
||||||
public static final String MODEL_MAP_ANIMAL_CONSENT_BEHAVIOR_ID = "MODEL_MAP_ANIMAL_CONSENT_BEHAVIOR_ID";
|
public static final String MODEL_MAP_ANIMAL_CONSENT_BEHAVIOR_ID = "MODEL_MAP_ANIMAL_CONSENT_BEHAVIOR_ID";
|
||||||
public static final String MODEL_MAP_PROGRESSION = "MODEL_MAP_PROGRESSION";
|
public static final String MODEL_MAP_PROGRESSION = "MODEL_MAP_PROGRESSION";
|
||||||
public static final String MODEL_MAP_LIST_REMAINING_CONSENT_BEHAVIORS = "MODEL_MAP_LIST_REMAINING_CONSENT_BEHAVIORS";
|
public static final String MODEL_MAP_LIST_REMAINING_CONSENT_BEHAVIORS = "MODEL_MAP_LIST_REMAINING_CONSENT_BEHAVIORS";
|
||||||
|
public static final String MODEL_MAP_LIST_ALL_CONSENT_BEHAVIORS = "MODEL_MAP_LIST_ALL_CONSENT_BEHAVIORS";
|
||||||
public static final String MODEL_MAP_LIST_REMAINING_CARES = "MODEL_MAP_LIST_REMAINING_CARES";
|
public static final String MODEL_MAP_LIST_REMAINING_CARES = "MODEL_MAP_LIST_REMAINING_CARES";
|
||||||
|
public static final String MODEL_MAP_LIST_ALL_CARES = "MODEL_MAP_LIST_ALL_CARES";
|
||||||
public static final String MODEL_MAP_PROGRESSION_TYPE = "MODEL_MAP_PROGRESSION_TYPE";
|
public static final String MODEL_MAP_PROGRESSION_TYPE = "MODEL_MAP_PROGRESSION_TYPE";
|
||||||
|
|
||||||
|
public static final String MODEL_MAP_PREVIOUS_CARE = "MODEL_MAP_PREVIOUS_CARE";
|
||||||
|
public static final String MODEL_MAP_CURRENT_CARE = "MODEL_MAP_CURRENT_CARE";
|
||||||
|
public static final String MODEL_MAP_NEXT_CARE = "MODEL_MAP_NEXT_CARE";
|
||||||
|
public static final String MODEL_MAP_PREVIOUS_CONSENT_BEHAVIOR = "MODEL_MAP_PREVIOUS_CONSENT_BEHAVIOR";
|
||||||
|
public static final String MODEL_MAP_CURRENT_CONSENT_BEHAVIOR = "MODEL_MAP_CURRENT_CONSENT_BEHAVIOR";
|
||||||
|
public static final String MODEL_MAP_NEXT_CONSENT_BEHAVIOR = "MODEL_MAP_NEXT_CONSENT_BEHAVIOR";
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
IServiceAnimal serviceAnimal;
|
IServiceAnimal serviceAnimal;
|
||||||
|
|
||||||
|
|
@ -328,6 +337,41 @@ public class AnimalController {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@RequestMapping(value = IndexController.URL_ANIMAL_PROGRESSIONS_NOTE_ADD, method = RequestMethod.POST)
|
||||||
|
public String doPostAddProgressionsNote(final ModelMap pModel, HttpSession httpSession,
|
||||||
|
@PathVariable(value = "animal_id") final int animalId,
|
||||||
|
@PathVariable(value = "progression_id") final int progressionId,
|
||||||
|
@RequestParam(name = "note_content", required = true) final String noteContent,
|
||||||
|
@RequestParam(name = "care_or_consent_behavior_id", required = true) int careOrConsentBehaviorId,
|
||||||
|
@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.addProgressionsNote(animalId, progressionId, noteContent);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pageFrom.equals("care")) {
|
||||||
|
ret = IndexController.URL_REDIRECT + IndexController.URL_ANIMAL_CARE
|
||||||
|
.replaceAll("\\{care_id\\}", careOrConsentBehaviorId + "");
|
||||||
|
} else if (pageFrom.equals("consent_behavior")) {
|
||||||
|
ret = IndexController.URL_REDIRECT + IndexController.URL_ANIMAL_BEHAVIOR
|
||||||
|
.replaceAll("\\{consent_behavior_id\\}", careOrConsentBehaviorId + "");
|
||||||
|
} 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_EDIT_PROGRESSION, method = RequestMethod.POST)
|
@RequestMapping(value = IndexController.URL_ANIMAL_EDIT_PROGRESSION, method = RequestMethod.POST)
|
||||||
public String doPostEditProgression(final ModelMap pModel, HttpSession httpSession,
|
public String doPostEditProgression(final ModelMap pModel, HttpSession httpSession,
|
||||||
@PathVariable(value = "animal_id") final int animalId,
|
@PathVariable(value = "animal_id") final int animalId,
|
||||||
|
|
@ -416,6 +460,23 @@ public class AnimalController {
|
||||||
Animal animal = serviceAnimal.getAnimalCareProgression(userDetails.getUsername(), animalId, careId);
|
Animal animal = serviceAnimal.getAnimalCareProgression(userDetails.getUsername(), animalId, careId);
|
||||||
pModel.addAttribute(MODEL_MAP_ANIMAL, animal);
|
pModel.addAttribute(MODEL_MAP_ANIMAL, animal);
|
||||||
|
|
||||||
|
List<Care> listAllCares = serviceAnimal.getAnimalCares(userDetails.getUsername(), animalId);
|
||||||
|
pModel.addAttribute(MODEL_MAP_LIST_ALL_CARES, listAllCares);
|
||||||
|
if (listAllCares.size() >= 3) {
|
||||||
|
Care lastCare = null;
|
||||||
|
for (Care care: listAllCares) {
|
||||||
|
if (care.getId() == careId) {
|
||||||
|
if (lastCare != null) {
|
||||||
|
pModel.addAttribute(MODEL_MAP_PREVIOUS_CARE, lastCare);
|
||||||
|
}
|
||||||
|
pModel.addAttribute(MODEL_MAP_CURRENT_CARE, care);
|
||||||
|
} else if (lastCare != null && lastCare.getId() == careId) {
|
||||||
|
pModel.addAttribute(MODEL_MAP_NEXT_CARE, care);
|
||||||
|
}
|
||||||
|
lastCare = care;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
List<Animal> animals = serviceAnimal.getAnimals(userDetails.getUsername());
|
List<Animal> animals = serviceAnimal.getAnimals(userDetails.getUsername());
|
||||||
pModel.addAttribute(MODEL_MAP_ANIMAL_LIST, animals);
|
pModel.addAttribute(MODEL_MAP_ANIMAL_LIST, animals);
|
||||||
|
|
||||||
|
|
@ -451,6 +512,23 @@ public class AnimalController {
|
||||||
Animal animal = serviceAnimal.getAnimalConsentBehaviorProgression(userDetails.getUsername(), animalId, consentBehaviorId);
|
Animal animal = serviceAnimal.getAnimalConsentBehaviorProgression(userDetails.getUsername(), animalId, consentBehaviorId);
|
||||||
pModel.addAttribute(MODEL_MAP_ANIMAL, animal);
|
pModel.addAttribute(MODEL_MAP_ANIMAL, animal);
|
||||||
|
|
||||||
|
List<ConsentBehavior> listAllConsentBehaviors = serviceAnimal.getAnimalConsentBehaviors(userDetails.getUsername(), animalId);
|
||||||
|
pModel.addAttribute(MODEL_MAP_LIST_ALL_CONSENT_BEHAVIORS, listAllConsentBehaviors);
|
||||||
|
if (listAllConsentBehaviors.size() >= 3) {
|
||||||
|
ConsentBehavior lastConsentBehavior = null;
|
||||||
|
for (ConsentBehavior consentBehavior: listAllConsentBehaviors) {
|
||||||
|
if (consentBehavior.getId() == consentBehaviorId) {
|
||||||
|
if (lastConsentBehavior != null) {
|
||||||
|
pModel.addAttribute(MODEL_MAP_PREVIOUS_CONSENT_BEHAVIOR, lastConsentBehavior);
|
||||||
|
}
|
||||||
|
pModel.addAttribute(MODEL_MAP_CURRENT_CONSENT_BEHAVIOR, consentBehavior);
|
||||||
|
} else if (lastConsentBehavior != null && lastConsentBehavior.getId() == consentBehaviorId) {
|
||||||
|
pModel.addAttribute(MODEL_MAP_NEXT_CONSENT_BEHAVIOR, consentBehavior);
|
||||||
|
}
|
||||||
|
lastConsentBehavior = consentBehavior;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
List<Animal> animals = serviceAnimal.getAnimals(userDetails.getUsername());
|
List<Animal> animals = serviceAnimal.getAnimals(userDetails.getUsername());
|
||||||
pModel.addAttribute(MODEL_MAP_ANIMAL_LIST, animals);
|
pModel.addAttribute(MODEL_MAP_ANIMAL_LIST, animals);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ package fr.geoffrey.medical_training_tracker.controller;
|
||||||
import fr.geoffrey.medical_training_tracker.dao.bean.Animal;
|
import fr.geoffrey.medical_training_tracker.dao.bean.Animal;
|
||||||
import fr.geoffrey.medical_training_tracker.services.IServiceAnimal;
|
import fr.geoffrey.medical_training_tracker.services.IServiceAnimal;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpSession;
|
import javax.servlet.http.HttpSession;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.security.core.Authentication;
|
import org.springframework.security.core.Authentication;
|
||||||
|
|
@ -54,6 +55,7 @@ public class IndexController {
|
||||||
public static final String URL_ANIMAL_CARES_ADD = "/animal/{animal_id}/add/care";
|
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";
|
public static final String URL_ANIMAL_CONSENT_BEHAVIOR_ADD = "/animal/{animal_id}/add/consent_behavior";
|
||||||
public static final String URL_ANIMAL_PROGRESSION_ADD = "/animal/{animal_id}/add/progression";
|
public static final String URL_ANIMAL_PROGRESSION_ADD = "/animal/{animal_id}/add/progression";
|
||||||
|
public static final String URL_ANIMAL_PROGRESSIONS_NOTE_ADD = "/animal/{animal_id}/add/progressions_note/{progression_id}";
|
||||||
// Delete URL
|
// Delete URL
|
||||||
public static final String URL_ANIMAL_DELETE = "/animal/delete/{animal_id}";
|
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_CARES_DELETE = "/animal/{animal_id}/delete/care/{care_id}";
|
||||||
|
|
@ -68,7 +70,6 @@ public class IndexController {
|
||||||
public static final String URL_REDIRECT = "redirect:";
|
public static final String URL_REDIRECT = "redirect:";
|
||||||
//</editor-fold>
|
//</editor-fold>
|
||||||
|
|
||||||
|
|
||||||
public static final String SESSION_ATTRIBUTE_LOGIN = "user";
|
public static final String SESSION_ATTRIBUTE_LOGIN = "user";
|
||||||
public static final String SESSION_ATTRIBUTE_AUTHENTICATION = "authentication";
|
public static final String SESSION_ATTRIBUTE_AUTHENTICATION = "authentication";
|
||||||
|
|
||||||
|
|
@ -91,4 +92,24 @@ public class IndexController {
|
||||||
}
|
}
|
||||||
return IndexController.PAGE_INDEX;
|
return IndexController.PAGE_INDEX;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@RequestMapping(value = "errors", method = RequestMethod.GET)
|
||||||
|
public String renderErrorPage(HttpServletRequest httpRequest) {
|
||||||
|
String ret = "errors/error";
|
||||||
|
int httpErrorCode = (Integer) httpRequest.getAttribute("javax.servlet.error.status_code");
|
||||||
|
|
||||||
|
switch (httpErrorCode) {
|
||||||
|
case 400:
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 404:
|
||||||
|
ret = "errors/404";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 500:
|
||||||
|
ret = "errors/500";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,8 @@ import fr.geoffrey.medical_training_tracker.dao.bean.Animal;
|
||||||
*/
|
*/
|
||||||
public interface IProgressionDao extends CommonDao {
|
public interface IProgressionDao extends CommonDao {
|
||||||
|
|
||||||
|
public boolean isProgressionExist(int animalId, int progressionId);
|
||||||
|
|
||||||
public void fillAnimalProgression(Animal animal);
|
public void fillAnimalProgression(Animal animal);
|
||||||
public void deleteProgression(int progressionId, int animalId, String owner);
|
public void deleteProgression(int progressionId, int animalId, String owner);
|
||||||
public void deleteAllAnimalProgression(int animalId, String owner);
|
public void deleteAllAnimalProgression(int animalId, String owner);
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
package fr.geoffrey.medical_training_tracker.dao;
|
||||||
|
|
||||||
|
import fr.geoffrey.medical_training_tracker.dao.bean.Animal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Geoffrey
|
||||||
|
*/
|
||||||
|
public interface IProgressionsNoteDao extends CommonDao {
|
||||||
|
public void fillProgressionNote(Animal animal);
|
||||||
|
public void addProgressionsNote(int progressionId, String noteContent);
|
||||||
|
|
||||||
|
public void deleteAllProgressionsNoteByProgressionId(int progressionId);
|
||||||
|
public void deleteAllProgressionsNoteByConsentBehaviorId(int consentBehaviorId);
|
||||||
|
public void deleteAllProgressionsNoteByCareId(int careId);
|
||||||
|
public void deleteAllProgressionsNoteByAnimalId(int animalId);
|
||||||
|
}
|
||||||
|
|
@ -5,6 +5,7 @@ import java.sql.Connection;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
import java.sql.Timestamp;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import javax.sql.DataSource;
|
import javax.sql.DataSource;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
@ -129,6 +130,8 @@ public abstract class BddConnectionManager extends Thread {
|
||||||
statement.setString(index, (String) param);
|
statement.setString(index, (String) param);
|
||||||
} else if (param instanceof Integer) {
|
} else if (param instanceof Integer) {
|
||||||
statement.setInt(index, (int) param);
|
statement.setInt(index, (int) param);
|
||||||
|
} else if (param instanceof Timestamp) {
|
||||||
|
statement.setTimestamp(index, (Timestamp) param);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,38 @@ public class ProgressionDao extends PostgresSqlDao implements IProgressionDao {
|
||||||
_createSequence(SEQUENCE_NAME);
|
_createSequence(SEQUENCE_NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isProgressionExist(int animalId, int progressionId) {
|
||||||
|
boolean ret = false;
|
||||||
|
Map<Integer, Object> params = new HashMap<>();
|
||||||
|
String sql = "SELECT * FROM "+TABLE_NAME+" WHERE id = ? AND animal = ?;";
|
||||||
|
params.put(1, progressionId);
|
||||||
|
params.put(2, animalId);
|
||||||
|
|
||||||
|
ResultSet resultSet = bddConnectionManager.executeQuery(sql, params);
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (resultSet != null) {
|
||||||
|
while (resultSet.next()) {
|
||||||
|
ret = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (SQLException ex) {
|
||||||
|
System.err.println(IndexController.LOG_TAG + " SQLException -> isProgressionExist() - " + ex.getMessage());
|
||||||
|
ex.printStackTrace();
|
||||||
|
} finally {
|
||||||
|
if (resultSet != null) {
|
||||||
|
try {
|
||||||
|
resultSet.close();
|
||||||
|
} catch (SQLException ex) {
|
||||||
|
System.err.println(IndexController.LOG_TAG + " Failed close ResultSet -> isProgressionExist()");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
//<editor-fold defaultstate="collapsed" desc="Fill methods">
|
//<editor-fold defaultstate="collapsed" desc="Fill methods">
|
||||||
@Override
|
@Override
|
||||||
public void fillAnimalProgression(Animal animal) {
|
public void fillAnimalProgression(Animal animal) {
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,137 @@
|
||||||
|
package fr.geoffrey.medical_training_tracker.dao.bdd.postgres;
|
||||||
|
|
||||||
|
import fr.geoffrey.medical_training_tracker.controller.IndexController;
|
||||||
|
import fr.geoffrey.medical_training_tracker.dao.IProgressionsNoteDao;
|
||||||
|
import fr.geoffrey.medical_training_tracker.dao.bean.Animal;
|
||||||
|
import fr.geoffrey.medical_training_tracker.dao.bean.Progression;
|
||||||
|
import fr.geoffrey.medical_training_tracker.dao.bean.ProgressionsNote;
|
||||||
|
import java.sql.ResultSet;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
import java.sql.Timestamp;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Geoffrey
|
||||||
|
*/
|
||||||
|
public class ProgressionsNoteDao extends PostgresSqlDao implements IProgressionsNoteDao {
|
||||||
|
|
||||||
|
public static final String TABLE_NAME = "progressions_note";
|
||||||
|
private static final String SEQUENCE_NAME = "progressions_note_id_seq";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isStorageExist() {
|
||||||
|
return _isTableExist(TABLE_NAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void createStorage() {
|
||||||
|
_createTable("CREATE TABLE "+TABLE_NAME+" (id int8 NOT NULL, progression int8 NOT NULL, horodate_insertion timestamp NOT NULL, note text NOT NULL, CONSTRAINT progressions_note_pk PRIMARY KEY (id), CONSTRAINT progressions_note_fk FOREIGN KEY (progression) REFERENCES progression(id));");
|
||||||
|
_createSequence(SEQUENCE_NAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void fillProgressionNote(Animal animal) {
|
||||||
|
for (Progression progression: animal.getProgressionList()) {
|
||||||
|
Map<Integer, Object> params = new HashMap<>();
|
||||||
|
String sql = "select * from "+TABLE_NAME+" where progression = ?";
|
||||||
|
params.put(1, progression.getId());
|
||||||
|
|
||||||
|
ResultSet resultSet = bddConnectionManager.executeQuery(sql, params);
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (resultSet != null) {
|
||||||
|
while (resultSet.next()) {
|
||||||
|
ProgressionsNote note = new ProgressionsNote();
|
||||||
|
note.setId(resultSet.getInt("id"));
|
||||||
|
note.setContent(resultSet.getString("note"));
|
||||||
|
note.setHorodate(resultSet.getTimestamp("horodate_insertion"));
|
||||||
|
|
||||||
|
progression.addNote(note);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (SQLException ex) {
|
||||||
|
System.err.println(IndexController.LOG_TAG + " SQLException -> fillProgressionNote() - " + ex.getMessage());
|
||||||
|
ex.printStackTrace();
|
||||||
|
} finally {
|
||||||
|
if (resultSet != null) {
|
||||||
|
try {
|
||||||
|
resultSet.close();
|
||||||
|
} catch (SQLException ex) {
|
||||||
|
System.err.println(IndexController.LOG_TAG + " Failed close ResultSet -> fillProgressionNote()");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addProgressionsNote(int progressionId, String noteContent) {
|
||||||
|
Map<Integer, Object> params = new HashMap<>();
|
||||||
|
String sql = "INSERT INTO "+TABLE_NAME+" (id, progression, horodate_insertion, note) VALUES (nextval(?), ?, ?, ?);";
|
||||||
|
|
||||||
|
params.put(1, SEQUENCE_NAME);
|
||||||
|
params.put(2, progressionId);
|
||||||
|
params.put(3, new Timestamp(new Date().getTime()));
|
||||||
|
params.put(4, formatNoteContent(noteContent));
|
||||||
|
|
||||||
|
bddConnectionManager.executeUpdate(sql, params);
|
||||||
|
}
|
||||||
|
|
||||||
|
private String formatNoteContent(String noteContent) {
|
||||||
|
String ret = noteContent;
|
||||||
|
|
||||||
|
ret = ret.replaceAll("\r\n", "<br/>");
|
||||||
|
ret = ret.replaceAll("\r", "<br/>");
|
||||||
|
ret = ret.replaceAll("\n", "<br/>");
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
//<editor-fold defaultstate="collapsed" desc="Delete methods">
|
||||||
|
@Override
|
||||||
|
public void deleteAllProgressionsNoteByProgressionId(int progressionId) {
|
||||||
|
Map<Integer, Object> params = new HashMap<>();
|
||||||
|
String sql = "DELETE FROM "+TABLE_NAME+" WHERE progression = ?;";
|
||||||
|
|
||||||
|
params.put(1, progressionId);
|
||||||
|
|
||||||
|
bddConnectionManager.executeUpdate(sql, params);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteAllProgressionsNoteByConsentBehaviorId(int consentBehaviorId) {
|
||||||
|
Map<Integer, Object> params = new HashMap<>();
|
||||||
|
String sql = "DELETE FROM "+TABLE_NAME+" WHERE progression IN ("
|
||||||
|
+ "SELECT id FROM "+ProgressionDao.TABLE_NAME+" WHERE consent_behavior = ? );";
|
||||||
|
|
||||||
|
params.put(1, consentBehaviorId);
|
||||||
|
|
||||||
|
bddConnectionManager.executeUpdate(sql, params);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteAllProgressionsNoteByCareId(int careId) {
|
||||||
|
Map<Integer, Object> params = new HashMap<>();
|
||||||
|
String sql = "DELETE FROM "+TABLE_NAME+" WHERE progression IN ("
|
||||||
|
+ "SELECT id FROM "+ProgressionDao.TABLE_NAME+" WHERE care = ? );";
|
||||||
|
|
||||||
|
params.put(1, careId);
|
||||||
|
|
||||||
|
bddConnectionManager.executeUpdate(sql, params);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteAllProgressionsNoteByAnimalId(int animalId) {
|
||||||
|
Map<Integer, Object> params = new HashMap<>();
|
||||||
|
String sql = "DELETE FROM "+TABLE_NAME+" WHERE progression IN ("
|
||||||
|
+ "SELECT id FROM "+ProgressionDao.TABLE_NAME+" WHERE animal = ? );";
|
||||||
|
|
||||||
|
params.put(1, animalId);
|
||||||
|
|
||||||
|
bddConnectionManager.executeUpdate(sql, params);
|
||||||
|
}
|
||||||
|
//</editor-fold>
|
||||||
|
}
|
||||||
|
|
@ -1,5 +1,10 @@
|
||||||
package fr.geoffrey.medical_training_tracker.dao.bean;
|
package fr.geoffrey.medical_training_tracker.dao.bean;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.TreeMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Geoffrey
|
* @author Geoffrey
|
||||||
|
|
@ -17,6 +22,7 @@ public class Progression {
|
||||||
private String progressionByMe;
|
private String progressionByMe;
|
||||||
private String progressionBySomeoneElse;
|
private String progressionBySomeoneElse;
|
||||||
private String progressionByVeterinary;
|
private String progressionByVeterinary;
|
||||||
|
private final Map<Integer, ProgressionsNote> mapNotes = new TreeMap<>(Collections.reverseOrder());
|
||||||
|
|
||||||
public int getId() {
|
public int getId() {
|
||||||
return id;
|
return id;
|
||||||
|
|
@ -110,4 +116,12 @@ public class Progression {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Collection<ProgressionsNote> getNotes() {
|
||||||
|
return mapNotes.values();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addNote(ProgressionsNote note) {
|
||||||
|
mapNotes.put(note.getId(), note);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,72 @@
|
||||||
|
package fr.geoffrey.medical_training_tracker.dao.bean;
|
||||||
|
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Geoffrey
|
||||||
|
*/
|
||||||
|
public class ProgressionsNote implements Comparable<ProgressionsNote> {
|
||||||
|
|
||||||
|
private static final String DATE_FORMAT = "YYYY/MM/dd HH:mm";
|
||||||
|
|
||||||
|
private int id;
|
||||||
|
private String content;
|
||||||
|
private Date horodate;
|
||||||
|
|
||||||
|
public int getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(int id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getContent() {
|
||||||
|
return content;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setContent(String content) {
|
||||||
|
this.content = content;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getHorodateString() {
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT);
|
||||||
|
return sdf.format(horodate);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHorodate(Date date) {
|
||||||
|
this.horodate = date;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
int hash = 3;
|
||||||
|
hash = 83 * hash + this.id;
|
||||||
|
return hash;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object obj) {
|
||||||
|
if (this == obj) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (obj == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (getClass() != obj.getClass()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
final ProgressionsNote other = (ProgressionsNote) obj;
|
||||||
|
if (this.id != other.id) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int compareTo(ProgressionsNote o) {
|
||||||
|
return id - o.id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -21,6 +21,7 @@ public interface IServiceAnimal {
|
||||||
public void addCare(int animalId, String name, String description);
|
public void addCare(int animalId, String name, String description);
|
||||||
public void addConsentBehavior(int animalId, String name, String description);
|
public void addConsentBehavior(int animalId, String name, String description);
|
||||||
public void addProgression(int animalId, int careId, int consentBehaviorId);
|
public void addProgression(int animalId, int careId, int consentBehaviorId);
|
||||||
|
public void addProgressionsNote(int animalId, int progressionId, String noteContent);
|
||||||
|
|
||||||
public void deleteAnimal(int animalId, String owner);
|
public void deleteAnimal(int animalId, String owner);
|
||||||
public void deleteAnimalCare(int animalId, String owner, int careId);
|
public void deleteAnimalCare(int animalId, String owner, int careId);
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import fr.geoffrey.medical_training_tracker.dao.IAnimalDao;
|
||||||
import fr.geoffrey.medical_training_tracker.dao.ICareDao;
|
import fr.geoffrey.medical_training_tracker.dao.ICareDao;
|
||||||
import fr.geoffrey.medical_training_tracker.dao.IConsentBehaviorDao;
|
import fr.geoffrey.medical_training_tracker.dao.IConsentBehaviorDao;
|
||||||
import fr.geoffrey.medical_training_tracker.dao.IProgressionDao;
|
import fr.geoffrey.medical_training_tracker.dao.IProgressionDao;
|
||||||
|
import fr.geoffrey.medical_training_tracker.dao.IProgressionsNoteDao;
|
||||||
import fr.geoffrey.medical_training_tracker.dao.bean.Animal;
|
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.Care;
|
||||||
import fr.geoffrey.medical_training_tracker.dao.bean.ConsentBehavior;
|
import fr.geoffrey.medical_training_tracker.dao.bean.ConsentBehavior;
|
||||||
|
|
@ -19,6 +20,7 @@ public class ServiceAnimal implements IServiceAnimal {
|
||||||
private ICareDao careDao;
|
private ICareDao careDao;
|
||||||
private IConsentBehaviorDao consentBehaviorDao;
|
private IConsentBehaviorDao consentBehaviorDao;
|
||||||
private IProgressionDao progressionDao;
|
private IProgressionDao progressionDao;
|
||||||
|
private IProgressionsNoteDao progressionsNoteDao;
|
||||||
|
|
||||||
public void setAnimalDao(IAnimalDao animalDao) {
|
public void setAnimalDao(IAnimalDao animalDao) {
|
||||||
this.animalDao = animalDao;
|
this.animalDao = animalDao;
|
||||||
|
|
@ -32,7 +34,11 @@ public class ServiceAnimal implements IServiceAnimal {
|
||||||
public void setProgressionDao(IProgressionDao progressionDao) {
|
public void setProgressionDao(IProgressionDao progressionDao) {
|
||||||
this.progressionDao = progressionDao;
|
this.progressionDao = progressionDao;
|
||||||
}
|
}
|
||||||
|
public void setProgressionsNoteDao(IProgressionsNoteDao progressionsNoteDao) {
|
||||||
|
this.progressionsNoteDao = progressionsNoteDao;
|
||||||
|
}
|
||||||
|
|
||||||
|
//<editor-fold defaultstate="collapsed" desc="Get methods">
|
||||||
@Override
|
@Override
|
||||||
public List<Animal> getAnimals(String owner) {
|
public List<Animal> getAnimals(String owner) {
|
||||||
return animalDao.getAnimals(owner);
|
return animalDao.getAnimals(owner);
|
||||||
|
|
@ -49,52 +55,13 @@ public class ServiceAnimal implements IServiceAnimal {
|
||||||
return animal;
|
return animal;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addAnimal(String name, String owner) {
|
|
||||||
animalDao.addAnimal(name, owner);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addCare(int animalId, String name, String description) {
|
|
||||||
careDao.addCare(animalId, name, description);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addConsentBehavior(int animalId, String name, String description) {
|
|
||||||
consentBehaviorDao.addConsentBehavior(animalId, name, description);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void deleteAnimal(int animalId, String owner) {
|
|
||||||
progressionDao.deleteAllAnimalProgression(animalId, owner);
|
|
||||||
careDao.deleteAllAnimalCares(animalId, owner);
|
|
||||||
consentBehaviorDao.deleteAllAnimalConsentBehavior(animalId, owner);
|
|
||||||
animalDao.deleteAnimal(animalId, owner);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void deleteAnimalCare(int animalId, String owner, int careId) {
|
|
||||||
progressionDao.deleteAllAnimalCareProgression(animalId, owner, careId);
|
|
||||||
careDao.deleteCare(careId, animalId, owner);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void deleteAnimalConsentBehavior(int animalId, String owner, int consentBehaviorId) {
|
|
||||||
progressionDao.deleteAllAnimalConsentBehaviorProgression(animalId, owner, consentBehaviorId);
|
|
||||||
consentBehaviorDao.deleteConsentBehavior(consentBehaviorId, animalId, owner);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void deleteAnimalProgression(int animalId, String owner, int progressionId) {
|
|
||||||
progressionDao.deleteProgression(progressionId, animalId, owner);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Animal getAnimalCareProgression(String owner, int animalId, int careId) {
|
public Animal getAnimalCareProgression(String owner, int animalId, int careId) {
|
||||||
Animal animal = animalDao.getAnimal(owner, animalId);
|
Animal animal = animalDao.getAnimal(owner, animalId);
|
||||||
if (animal != null) {
|
if (animal != null) {
|
||||||
animal.addCare(careDao.getAnimalCare(owner, animalId, careId));
|
animal.addCare(careDao.getAnimalCare(owner, animalId, careId));
|
||||||
progressionDao.fillAnimalProgressionByCare(animal, careId);
|
progressionDao.fillAnimalProgressionByCare(animal, careId);
|
||||||
|
progressionsNoteDao.fillProgressionNote(animal);
|
||||||
}
|
}
|
||||||
return animal;
|
return animal;
|
||||||
}
|
}
|
||||||
|
|
@ -105,6 +72,7 @@ public class ServiceAnimal implements IServiceAnimal {
|
||||||
if (animal != null) {
|
if (animal != null) {
|
||||||
animal.addConsentBehavior(consentBehaviorDao.getAnimalConsentBehavior(owner, animalId, consentBehaviorId));
|
animal.addConsentBehavior(consentBehaviorDao.getAnimalConsentBehavior(owner, animalId, consentBehaviorId));
|
||||||
progressionDao.fillAnimalProgressionByConsentBehavior(animal, consentBehaviorId);
|
progressionDao.fillAnimalProgressionByConsentBehavior(animal, consentBehaviorId);
|
||||||
|
progressionsNoteDao.fillProgressionNote(animal);
|
||||||
}
|
}
|
||||||
return animal;
|
return animal;
|
||||||
}
|
}
|
||||||
|
|
@ -145,12 +113,69 @@ public class ServiceAnimal implements IServiceAnimal {
|
||||||
public List<Care> getAnimalCares(String username, int animalId) {
|
public List<Care> getAnimalCares(String username, int animalId) {
|
||||||
return careDao.getAllAnimalCares(username, animalId);
|
return careDao.getAllAnimalCares(username, animalId);
|
||||||
}
|
}
|
||||||
|
//</editor-fold>
|
||||||
|
|
||||||
|
//<editor-fold defaultstate="collapsed" desc="Add methods">
|
||||||
|
@Override
|
||||||
|
public void addAnimal(String name, String owner) {
|
||||||
|
animalDao.addAnimal(name, owner);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addCare(int animalId, String name, String description) {
|
||||||
|
careDao.addCare(animalId, name, description);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addConsentBehavior(int animalId, String name, String description) {
|
||||||
|
consentBehaviorDao.addConsentBehavior(animalId, name, description);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addProgression(int animalId, int careId, int consentBehaviorId) {
|
public void addProgression(int animalId, int careId, int consentBehaviorId) {
|
||||||
progressionDao.addProgression(animalId, careId, consentBehaviorId);
|
progressionDao.addProgression(animalId, careId, consentBehaviorId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addProgressionsNote(int animalId, int progressionId, String noteContent) {
|
||||||
|
if (progressionDao.isProgressionExist(animalId, progressionId)) {
|
||||||
|
progressionsNoteDao.addProgressionsNote(progressionId, noteContent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//</editor-fold>
|
||||||
|
|
||||||
|
//<editor-fold defaultstate="collapsed" desc="Delete methods">
|
||||||
|
@Override
|
||||||
|
public void deleteAnimal(int animalId, String owner) {
|
||||||
|
progressionsNoteDao.deleteAllProgressionsNoteByAnimalId(animalId);
|
||||||
|
progressionDao.deleteAllAnimalProgression(animalId, owner);
|
||||||
|
careDao.deleteAllAnimalCares(animalId, owner);
|
||||||
|
consentBehaviorDao.deleteAllAnimalConsentBehavior(animalId, owner);
|
||||||
|
animalDao.deleteAnimal(animalId, owner);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteAnimalCare(int animalId, String owner, int careId) {
|
||||||
|
progressionsNoteDao.deleteAllProgressionsNoteByCareId(careId);
|
||||||
|
progressionDao.deleteAllAnimalCareProgression(animalId, owner, careId);
|
||||||
|
careDao.deleteCare(careId, animalId, owner);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteAnimalConsentBehavior(int animalId, String owner, int consentBehaviorId) {
|
||||||
|
progressionsNoteDao.deleteAllProgressionsNoteByConsentBehaviorId(consentBehaviorId);
|
||||||
|
progressionDao.deleteAllAnimalConsentBehaviorProgression(animalId, owner, consentBehaviorId);
|
||||||
|
consentBehaviorDao.deleteConsentBehavior(consentBehaviorId, animalId, owner);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteAnimalProgression(int animalId, String owner, int progressionId) {
|
||||||
|
progressionsNoteDao.deleteAllProgressionsNoteByProgressionId(progressionId);
|
||||||
|
progressionDao.deleteProgression(progressionId, animalId, owner);
|
||||||
|
}
|
||||||
|
//</editor-fold>
|
||||||
|
|
||||||
|
//<editor-fold defaultstate="collapsed" desc="Update methods">
|
||||||
@Override
|
@Override
|
||||||
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);
|
||||||
|
|
@ -170,4 +195,6 @@ public class ServiceAnimal implements IServiceAnimal {
|
||||||
public void updateProgression(int animalId, String owner, int progressionId, String progressionByMe, String progressionBySomeoneElse, String progressionByVeterinary) {
|
public void updateProgression(int animalId, String owner, int progressionId, String progressionByMe, String progressionBySomeoneElse, String progressionByVeterinary) {
|
||||||
progressionDao.updateProgression(animalId, owner, progressionId, progressionByMe, progressionBySomeoneElse, progressionByVeterinary);
|
progressionDao.updateProgression(animalId, owner, progressionId, progressionByMe, progressionBySomeoneElse, progressionByVeterinary);
|
||||||
}
|
}
|
||||||
|
//</editor-fold>
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ animal_care.add_behavior=Add a consent behavior to this care
|
||||||
animal_care.button.add.tooltip=Add
|
animal_care.button.add.tooltip=Add
|
||||||
animal_care.button.delete.tooltip=Delete
|
animal_care.button.delete.tooltip=Delete
|
||||||
animal_care.button.edit.tooltip=Edit
|
animal_care.button.edit.tooltip=Edit
|
||||||
|
animal_care.button.note.tooltip=Note list
|
||||||
animal_care.subtitle=Progression of "{0}"
|
animal_care.subtitle=Progression of "{0}"
|
||||||
animal_care.table.behavior=Consent behavior
|
animal_care.table.behavior=Consent behavior
|
||||||
animal_care.table.executed_by_me=Execute by me
|
animal_care.table.executed_by_me=Execute by me
|
||||||
|
|
@ -50,6 +51,7 @@ animal_cares_and_behaviors.delete.modal_body.behavior=Do you want to delete this
|
||||||
animal_cares_and_behaviors.delete.modal_body.care=Do you want to delete this care?
|
animal_cares_and_behaviors.delete.modal_body.care=Do you want to delete this care?
|
||||||
|
|
||||||
animal_consent_behavior.button.edit.tooltip=Edit
|
animal_consent_behavior.button.edit.tooltip=Edit
|
||||||
|
animal_consent_behavior.button.note.tooltip=Note list
|
||||||
|
|
||||||
animal_list.animal.add.label=Animal's name:
|
animal_list.animal.add.label=Animal's name:
|
||||||
animal_list.animal.add.placeholder=Name
|
animal_list.animal.add.placeholder=Name
|
||||||
|
|
@ -86,6 +88,7 @@ footer.source_code = Source code
|
||||||
modal_button.cancel=Cancel
|
modal_button.cancel=Cancel
|
||||||
modal_button.delete=Delete
|
modal_button.delete=Delete
|
||||||
modal_button.edit=Edit
|
modal_button.edit=Edit
|
||||||
|
modal_button.add=Add
|
||||||
|
|
||||||
navbar.cares_and_behaviors = Care and Behaviors
|
navbar.cares_and_behaviors = Care and Behaviors
|
||||||
navbar.language = Language
|
navbar.language = Language
|
||||||
|
|
@ -97,6 +100,11 @@ navbar.signup = Sign up
|
||||||
progression.by_me=Progression by me
|
progression.by_me=Progression by me
|
||||||
progression.by_someone_else=Progression by someone else
|
progression.by_someone_else=Progression by someone else
|
||||||
progression.by_veterinary=Done by veterinary
|
progression.by_veterinary=Done by veterinary
|
||||||
|
progression.modale.notes.add.label=Add new note
|
||||||
|
progression.modale.notes.add.placeholder=Content of the note
|
||||||
|
progression.modale.notes.title=Notes
|
||||||
|
progression.modale.notes.title.care_name=Care:
|
||||||
|
progression.modale.notes.title.consent_behavior_name=Consent behavior:
|
||||||
progression.table.column.behavior=Consent behavior
|
progression.table.column.behavior=Consent behavior
|
||||||
progression.table.column.care=Care
|
progression.table.column.care=Care
|
||||||
progression.title={0} sheet
|
progression.title={0} sheet
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ animal_care.add_behavior=Add a consent behavior to this care
|
||||||
animal_care.button.add.tooltip=Add
|
animal_care.button.add.tooltip=Add
|
||||||
animal_care.button.delete.tooltip=Delete
|
animal_care.button.delete.tooltip=Delete
|
||||||
animal_care.button.edit.tooltip=Edit
|
animal_care.button.edit.tooltip=Edit
|
||||||
|
animal_care.button.note.tooltip=Note list
|
||||||
animal_care.subtitle=Progression of "{0}"
|
animal_care.subtitle=Progression of "{0}"
|
||||||
animal_care.table.behavior=Consent behavior
|
animal_care.table.behavior=Consent behavior
|
||||||
animal_care.table.executed_by_me=Execute by me
|
animal_care.table.executed_by_me=Execute by me
|
||||||
|
|
@ -50,6 +51,7 @@ animal_cares_and_behaviors.delete.modal_body.behavior=Do you want to delete this
|
||||||
animal_cares_and_behaviors.delete.modal_body.care=Do you want to delete this care?
|
animal_cares_and_behaviors.delete.modal_body.care=Do you want to delete this care?
|
||||||
|
|
||||||
animal_consent_behavior.button.edit.tooltip=Edit
|
animal_consent_behavior.button.edit.tooltip=Edit
|
||||||
|
animal_consent_behavior.button.note.tooltip=Note list
|
||||||
|
|
||||||
animal_list.animal.add.label=Animal's name:
|
animal_list.animal.add.label=Animal's name:
|
||||||
animal_list.animal.add.placeholder=Name
|
animal_list.animal.add.placeholder=Name
|
||||||
|
|
@ -86,6 +88,7 @@ footer.source_code=Source code
|
||||||
modal_button.cancel=Cancel
|
modal_button.cancel=Cancel
|
||||||
modal_button.delete=Delete
|
modal_button.delete=Delete
|
||||||
modal_button.edit=Edit
|
modal_button.edit=Edit
|
||||||
|
modal_button.add=Add
|
||||||
|
|
||||||
navbar.cares_and_behaviors = Care and Behaviors
|
navbar.cares_and_behaviors = Care and Behaviors
|
||||||
navbar.language = Language
|
navbar.language = Language
|
||||||
|
|
@ -97,6 +100,11 @@ navbar.signup = Sign up
|
||||||
progression.by_me=Progression by me
|
progression.by_me=Progression by me
|
||||||
progression.by_someone_else=Progression by someone else
|
progression.by_someone_else=Progression by someone else
|
||||||
progression.by_veterinary=Done by veterinary
|
progression.by_veterinary=Done by veterinary
|
||||||
|
progression.modale.notes.add.label=Add new note
|
||||||
|
progression.modale.notes.add.placeholder=Content of the note
|
||||||
|
progression.modale.notes.title=Notes
|
||||||
|
progression.modale.notes.title.care_name=Care:
|
||||||
|
progression.modale.notes.title.consent_behavior_name=Consent behavior:
|
||||||
progression.table.column.behavior=Consent behavior
|
progression.table.column.behavior=Consent behavior
|
||||||
progression.table.column.care=Care
|
progression.table.column.care=Care
|
||||||
progression.title={0} sheet
|
progression.title={0} sheet
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ animal_care.add_behavior=Ajouter un comportement de consentement \u00e0 ce soin
|
||||||
animal_care.button.add.tooltip=Ajouter
|
animal_care.button.add.tooltip=Ajouter
|
||||||
animal_care.button.delete.tooltip=Supptimer
|
animal_care.button.delete.tooltip=Supptimer
|
||||||
animal_care.button.edit.tooltip=Modifier
|
animal_care.button.edit.tooltip=Modifier
|
||||||
|
animal_care.button.note.tooltip=Liste des notes
|
||||||
animal_care.subtitle=Progression de "{0}"
|
animal_care.subtitle=Progression de "{0}"
|
||||||
animal_care.table.behavior=Comportement de consentement
|
animal_care.table.behavior=Comportement de consentement
|
||||||
animal_care.table.executed_by_me=Ex\u00e9cut\u00e9 par moi
|
animal_care.table.executed_by_me=Ex\u00e9cut\u00e9 par moi
|
||||||
|
|
@ -50,6 +51,7 @@ animal_cares_and_behaviors.delete.modal_body.behavior=Voulez-vous vraiment suppr
|
||||||
animal_cares_and_behaviors.delete.modal_body.care=Voulez-vous vraiment supprimer ce soin ?
|
animal_cares_and_behaviors.delete.modal_body.care=Voulez-vous vraiment supprimer ce soin ?
|
||||||
|
|
||||||
animal_consent_behavior.button.edit.tooltip=Modifier
|
animal_consent_behavior.button.edit.tooltip=Modifier
|
||||||
|
animal_consent_behavior.button.note.tooltip=Liste des notes
|
||||||
|
|
||||||
animal_list.animal.add.label=Nom de l'animal :
|
animal_list.animal.add.label=Nom de l'animal :
|
||||||
animal_list.animal.add.placeholder=Nom
|
animal_list.animal.add.placeholder=Nom
|
||||||
|
|
@ -86,6 +88,7 @@ footer.source_code=Code source
|
||||||
modal_button.cancel=Annuler
|
modal_button.cancel=Annuler
|
||||||
modal_button.delete=Supprimer
|
modal_button.delete=Supprimer
|
||||||
modal_button.edit=Modifier
|
modal_button.edit=Modifier
|
||||||
|
modal_button.add=Ajouter
|
||||||
|
|
||||||
navbar.cares_and_behaviors = Soins et Comportements
|
navbar.cares_and_behaviors = Soins et Comportements
|
||||||
navbar.language = Langue
|
navbar.language = Langue
|
||||||
|
|
@ -97,6 +100,11 @@ navbar.signup = Cr\u00e9er un compte
|
||||||
progression.by_me=Progression par moi
|
progression.by_me=Progression par moi
|
||||||
progression.by_someone_else=Progression par quelqu'un d'autre
|
progression.by_someone_else=Progression par quelqu'un d'autre
|
||||||
progression.by_veterinary=R\u00e9alis\u00e9 par le v\u00e9t\u00e9rinaire
|
progression.by_veterinary=R\u00e9alis\u00e9 par le v\u00e9t\u00e9rinaire
|
||||||
|
progression.modale.notes.add.label=Ajouter une nouvelle note
|
||||||
|
progression.modale.notes.add.placeholder=Contenue de la note
|
||||||
|
progression.modale.notes.title=Notes
|
||||||
|
progression.modale.notes.title.care_name=Soin :
|
||||||
|
progression.modale.notes.title.consent_behavior_name=Comportement de consentement :
|
||||||
progression.table.column.behavior=Comportement de consentement
|
progression.table.column.behavior=Comportement de consentement
|
||||||
progression.table.column.care=Soin
|
progression.table.column.care=Soin
|
||||||
progression.title=Feuille de {0}
|
progression.title=Feuille de {0}
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,7 @@
|
||||||
<bean id="careDao" class="fr.geoffrey.medical_training_tracker.dao.bdd.postgres.CareDao"></bean>
|
<bean id="careDao" class="fr.geoffrey.medical_training_tracker.dao.bdd.postgres.CareDao"></bean>
|
||||||
<bean id="consentBehaviorDao" class="fr.geoffrey.medical_training_tracker.dao.bdd.postgres.ConsentBehaviorDao"></bean>
|
<bean id="consentBehaviorDao" class="fr.geoffrey.medical_training_tracker.dao.bdd.postgres.ConsentBehaviorDao"></bean>
|
||||||
<bean id="progressionDao" class="fr.geoffrey.medical_training_tracker.dao.bdd.postgres.ProgressionDao"></bean>
|
<bean id="progressionDao" class="fr.geoffrey.medical_training_tracker.dao.bdd.postgres.ProgressionDao"></bean>
|
||||||
|
<bean id="progressionsNoteDao" class="fr.geoffrey.medical_training_tracker.dao.bdd.postgres.ProgressionsNoteDao"></bean>
|
||||||
|
|
||||||
<bean id="serviceAnimal" class="fr.geoffrey.medical_training_tracker.services.ServiceAnimal">
|
<bean id="serviceAnimal" class="fr.geoffrey.medical_training_tracker.services.ServiceAnimal">
|
||||||
<property name="animalDao">
|
<property name="animalDao">
|
||||||
|
|
@ -54,6 +55,9 @@
|
||||||
<property name="progressionDao">
|
<property name="progressionDao">
|
||||||
<ref bean="progressionDao"/>
|
<ref bean="progressionDao"/>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="progressionsNoteDao">
|
||||||
|
<ref bean="progressionsNoteDao"/>
|
||||||
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="serviceRegister" class="fr.geoffrey.medical_training_tracker.services.ServiceRegister">
|
<bean id="serviceRegister" class="fr.geoffrey.medical_training_tracker.services.ServiceRegister">
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,10 @@
|
||||||
<listener>
|
<listener>
|
||||||
<listener-class>fr.geoffrey.medical_training_tracker.Servlet</listener-class>
|
<listener-class>fr.geoffrey.medical_training_tracker.Servlet</listener-class>
|
||||||
</listener>
|
</listener>
|
||||||
|
|
||||||
|
<error-page>
|
||||||
|
<location>/errors</location>
|
||||||
|
</error-page>
|
||||||
|
|
||||||
|
|
||||||
<!-- Declaration de la servlet de Spring et de son mapping -->
|
<!-- Declaration de la servlet de Spring et de son mapping -->
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@
|
||||||
<spring:url value="/animal/${MODEL_MAP_ANIMAL.getId()}/delete/progression" var="animalDeleteProgressionURL" />
|
<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()}/edit/progression" var="animalEditProgressionURL" />
|
||||||
<spring:url value="/animal/${MODEL_MAP_ANIMAL.getId()}/add/progression" var="animalAddProgressionURL" />
|
<spring:url value="/animal/${MODEL_MAP_ANIMAL.getId()}/add/progression" var="animalAddProgressionURL" />
|
||||||
|
<spring:url value="/animal/${MODEL_MAP_ANIMAL.getId()}/add/progressions_note" var="animalNotesProgressionURL" />
|
||||||
|
|
||||||
<%@ include file="base/language.jsp" %>
|
<%@ include file="base/language.jsp" %>
|
||||||
|
|
||||||
|
|
@ -37,7 +38,49 @@
|
||||||
<fmt:message key="animal_behavior.title">
|
<fmt:message key="animal_behavior.title">
|
||||||
<fmt:param value="${MODEL_MAP_ANIMAL.getName()}" />
|
<fmt:param value="${MODEL_MAP_ANIMAL.getName()}" />
|
||||||
</fmt:message>
|
</fmt:message>
|
||||||
</h1></center>
|
</h1>
|
||||||
|
</center>
|
||||||
|
|
||||||
|
<!--navigation between cares-->
|
||||||
|
<div class="btn-group pull-right" role="group" aria-label="...">
|
||||||
|
<c:choose>
|
||||||
|
<c:when test="${MODEL_MAP_PREVIOUS_CONSENT_BEHAVIOR != null}">
|
||||||
|
<a class="btn btn-default" href="${animalURL}/${MODEL_MAP_ANIMAL.getId()}/consent_behavior/${MODEL_MAP_PREVIOUS_CONSENT_BEHAVIOR.getId()}"><span class="glyphicon glyphicon-menu-left" aria-hidden="true"></span> ${MODEL_MAP_PREVIOUS_CONSENT_BEHAVIOR.getName()}</a>
|
||||||
|
</c:when>
|
||||||
|
<c:otherwise>
|
||||||
|
<a class="btn btn-default disabled" ><span class="glyphicon glyphicon-menu-left" aria-hidden="true"></span></a>
|
||||||
|
</c:otherwise>
|
||||||
|
</c:choose>
|
||||||
|
|
||||||
|
<div class="btn-group" role="group">
|
||||||
|
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||||
|
${MODEL_MAP_ANIMAL.getConsentBehaviorById(MODEL_MAP_ANIMAL_CONSENT_BEHAVIOR_ID).getName()}
|
||||||
|
<span class="caret"></span>
|
||||||
|
</button>
|
||||||
|
<ul class="dropdown-menu">
|
||||||
|
<c:forEach items="${MODEL_MAP_LIST_ALL_CONSENT_BEHAVIORS}" var="consent_behavior">
|
||||||
|
<c:choose>
|
||||||
|
<c:when test="${consent_behavior.getId() == MODEL_MAP_ANIMAL_CONSENT_BEHAVIOR_ID}">
|
||||||
|
<li class="active"><a href="${animalURL}/${MODEL_MAP_ANIMAL.getId()}/consent_behavior/${consent_behavior.getId()}">${consent_behavior.getName()}</a></li>
|
||||||
|
</c:when>
|
||||||
|
<c:otherwise>
|
||||||
|
<li><a href="${animalURL}/${MODEL_MAP_ANIMAL.getId()}/consent_behavior/${consent_behavior.getId()}">${consent_behavior.getName()}</a></li>
|
||||||
|
</c:otherwise>
|
||||||
|
</c:choose>
|
||||||
|
</c:forEach>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<c:choose>
|
||||||
|
<c:when test="${MODEL_MAP_NEXT_CONSENT_BEHAVIOR != null}">
|
||||||
|
<a class="btn btn-default" href="${animalURL}/${MODEL_MAP_ANIMAL.getId()}/consent_behavior/${MODEL_MAP_NEXT_CONSENT_BEHAVIOR.getId()}">${MODEL_MAP_NEXT_CONSENT_BEHAVIOR.getName()} <span class="glyphicon glyphicon-menu-right" aria-hidden="true"></span></a>
|
||||||
|
</c:when>
|
||||||
|
<c:otherwise>
|
||||||
|
<a class="btn btn-default disabled" ><span class="glyphicon glyphicon-menu-right" aria-hidden="true"></span></a>
|
||||||
|
</c:otherwise>
|
||||||
|
</c:choose>
|
||||||
|
</div>
|
||||||
|
|
||||||
<h3>
|
<h3>
|
||||||
<fmt:message key="animal_behavior.subtitle">
|
<fmt:message key="animal_behavior.subtitle">
|
||||||
<fmt:param value="${MODEL_MAP_ANIMAL.getConsentBehaviorById(MODEL_MAP_ANIMAL_CONSENT_BEHAVIOR_ID).getName()}" />
|
<fmt:param value="${MODEL_MAP_ANIMAL.getConsentBehaviorById(MODEL_MAP_ANIMAL_CONSENT_BEHAVIOR_ID).getName()}" />
|
||||||
|
|
@ -105,6 +148,14 @@
|
||||||
<input value="${progression.getProgressionByVeterinary()}" 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>
|
<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>
|
</form>
|
||||||
|
|
||||||
|
<form class="pull-right" action="${animalNotesProgressionURL}/${progression.getId()}" method="GET">
|
||||||
|
<input value="${progression.getCare().getName()}" hidden />
|
||||||
|
<c:forEach items="${progression.getNotes()}" var="note">
|
||||||
|
<input value="${note.getContent()}" data-horodate="${note.getHorodateString()}" hidden />
|
||||||
|
</c:forEach>
|
||||||
|
<button class="btn btn-default" type="submit" data-toggle="tooltip" data-placement="bottom" title="<fmt:message key="animal_consent_behavior.button.note.tooltip"></fmt:message>"><span class="glyphicon glyphicon-file" aria-hidden="true"></span></button>
|
||||||
|
</form>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</c:forEach>
|
</c:forEach>
|
||||||
|
|
@ -212,6 +263,47 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div id="modal_note_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">×</button>
|
||||||
|
<h4 id="modal_note_progression_title" class="modal-title">
|
||||||
|
<fmt:message key="progression.modale.notes.title"></fmt:message>
|
||||||
|
</h4>
|
||||||
|
<h4 class="modal-title">
|
||||||
|
<fmt:message key="progression.modale.notes.title.care_name"></fmt:message>
|
||||||
|
<span id="modal_note_progression_title_care_name">${MODEL_MAP_ANIMAL.getConsentBehaviorById(MODEL_MAP_ANIMAL_CONSENT_BEHAVIOR_ID).getName()}</span>
|
||||||
|
</h4>
|
||||||
|
<h4 class="modal-title">
|
||||||
|
<fmt:message key="progression.modale.notes.title.consent_behavior_name"></fmt:message>
|
||||||
|
<span id="modal_note_progression_title_consent_behavior_name"></span>
|
||||||
|
</h4>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<div id="modal_note_list" >
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<hr/>
|
||||||
|
|
||||||
|
<form id="modal_note_progression_validate" action="" method="POST">
|
||||||
|
<input id="modal_note_progression_form_progression_id" name="progression_id" value="" hidden />
|
||||||
|
<input name="page" value="care" hidden />
|
||||||
|
<input name="care_or_consent_behavior_id" value="${MODEL_MAP_ANIMAL_CONSENT_BEHAVIOR_ID}" hidden />
|
||||||
|
</form>
|
||||||
|
<label for="modal_add_note_progression_form"><fmt:message key="progression.modale.notes.add.label"></fmt:message></label>
|
||||||
|
<textarea id="modal_add_note_progression_form" class="form-control" name="note_content" form="modal_note_progression_validate" placeholder="<fmt:message key="progression.modale.notes.add.placeholder"></fmt:message>" ></textarea>
|
||||||
|
</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_note_progression_validate" type="submit" class="btn btn-primary"><fmt:message key="modal_button.add"></fmt:message></button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
@ -252,6 +344,23 @@
|
||||||
});
|
});
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
}
|
}
|
||||||
|
} else if (formUrl.startsWith('${animalNotesProgressionURL}')) {
|
||||||
|
if ($(this).attr('id') !== 'modal_note_progression_validate') {
|
||||||
|
$('#modal_note_list').empty();
|
||||||
|
var data = $(this).find('input');
|
||||||
|
for (i = 0; i < data.length; i++) {
|
||||||
|
if (i == 0) {
|
||||||
|
$('#modal_note_progression_title_consent_behavior_name').html(data[i].value);
|
||||||
|
} else {
|
||||||
|
$('#modal_note_list').append("<div class=\"alert alert-info\" role=\"alert\"><small><b>"+$(data[i]).data("horodate")+"</b></small> <hr/> "+data[i].value+"</div>");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$('#modal_note_progression_validate').attr('action', formUrl);
|
||||||
|
$('#modal_note_progression').modal({
|
||||||
|
show: true
|
||||||
|
});
|
||||||
|
event.preventDefault();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@
|
||||||
<spring:url value="/animal/${MODEL_MAP_ANIMAL.getId()}/delete/progression" var="animalDeleteProgressionURL" />
|
<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()}/edit/progression" var="animalEditProgressionURL" />
|
||||||
<spring:url value="/animal/${MODEL_MAP_ANIMAL.getId()}/add/progression" var="animalAddProgressionURL" />
|
<spring:url value="/animal/${MODEL_MAP_ANIMAL.getId()}/add/progression" var="animalAddProgressionURL" />
|
||||||
|
<spring:url value="/animal/${MODEL_MAP_ANIMAL.getId()}/add/progressions_note" var="animalNotesProgressionURL" />
|
||||||
|
|
||||||
<%@ include file="base/language.jsp" %>
|
<%@ include file="base/language.jsp" %>
|
||||||
|
|
||||||
|
|
@ -33,11 +34,54 @@
|
||||||
<body>
|
<body>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<%@ include file="base/navbar.jsp" %>
|
<%@ include file="base/navbar.jsp" %>
|
||||||
<center><h1>
|
<center>
|
||||||
|
<h1>
|
||||||
<fmt:message key="animal_care.title">
|
<fmt:message key="animal_care.title">
|
||||||
<fmt:param value="${MODEL_MAP_ANIMAL.getName()}" />
|
<fmt:param value="${MODEL_MAP_ANIMAL.getName()}" />
|
||||||
</fmt:message>
|
</fmt:message>
|
||||||
</h1></center>
|
</h1>
|
||||||
|
</center>
|
||||||
|
|
||||||
|
<!--navigation between cares-->
|
||||||
|
<div class="btn-group pull-right" role="group" aria-label="...">
|
||||||
|
<c:choose>
|
||||||
|
<c:when test="${MODEL_MAP_PREVIOUS_CARE != null}">
|
||||||
|
<a class="btn btn-default" href="${animalURL}/${MODEL_MAP_ANIMAL.getId()}/care/${MODEL_MAP_PREVIOUS_CARE.getId()}"><span class="glyphicon glyphicon-menu-left" aria-hidden="true"></span> ${MODEL_MAP_PREVIOUS_CARE.getName()}</a>
|
||||||
|
</c:when>
|
||||||
|
<c:otherwise>
|
||||||
|
<a class="btn btn-default disabled" ><span class="glyphicon glyphicon-menu-left" aria-hidden="true"></span></a>
|
||||||
|
</c:otherwise>
|
||||||
|
</c:choose>
|
||||||
|
|
||||||
|
<div class="btn-group" role="group">
|
||||||
|
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||||
|
${MODEL_MAP_ANIMAL.getCareById(MODEL_MAP_ANIMAL_CARE_ID).getName()}
|
||||||
|
<span class="caret"></span>
|
||||||
|
</button>
|
||||||
|
<ul class="dropdown-menu">
|
||||||
|
<c:forEach items="${MODEL_MAP_LIST_ALL_CARES}" var="care">
|
||||||
|
<c:choose>
|
||||||
|
<c:when test="${care.getId() == MODEL_MAP_ANIMAL_CARE_ID}">
|
||||||
|
<li class="active"><a href="${animalURL}/${MODEL_MAP_ANIMAL.getId()}/care/${care.getId()}">${care.getName()}</a></li>
|
||||||
|
</c:when>
|
||||||
|
<c:otherwise>
|
||||||
|
<li><a href="${animalURL}/${MODEL_MAP_ANIMAL.getId()}/care/${care.getId()}">${care.getName()}</a></li>
|
||||||
|
</c:otherwise>
|
||||||
|
</c:choose>
|
||||||
|
</c:forEach>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<c:choose>
|
||||||
|
<c:when test="${MODEL_MAP_NEXT_CARE != null}">
|
||||||
|
<a class="btn btn-default" href="${animalURL}/${MODEL_MAP_ANIMAL.getId()}/care/${MODEL_MAP_NEXT_CARE.getId()}">${MODEL_MAP_NEXT_CARE.getName()} <span class="glyphicon glyphicon-menu-right" aria-hidden="true"></span></a>
|
||||||
|
</c:when>
|
||||||
|
<c:otherwise>
|
||||||
|
<a class="btn btn-default disabled" ><span class="glyphicon glyphicon-menu-right" aria-hidden="true"></span></a>
|
||||||
|
</c:otherwise>
|
||||||
|
</c:choose>
|
||||||
|
</div>
|
||||||
|
|
||||||
<h3>
|
<h3>
|
||||||
<fmt:message key="animal_care.subtitle">
|
<fmt:message key="animal_care.subtitle">
|
||||||
<fmt:param value="${MODEL_MAP_ANIMAL.getCareById(MODEL_MAP_ANIMAL_CARE_ID).getName()}" />
|
<fmt:param value="${MODEL_MAP_ANIMAL.getCareById(MODEL_MAP_ANIMAL_CARE_ID).getName()}" />
|
||||||
|
|
@ -105,6 +149,14 @@
|
||||||
<input value="${progression.getProgressionByVeterinary()}" 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>
|
<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>
|
</form>
|
||||||
|
|
||||||
|
<form class="pull-right" action="${animalNotesProgressionURL}/${progression.getId()}" method="GET">
|
||||||
|
<input value="${progression.getConsentBehavior().getName()}" hidden />
|
||||||
|
<c:forEach items="${progression.getNotes()}" var="note">
|
||||||
|
<input value="${note.getContent()}" data-id="${note.getId()}" data-horodate="${note.getHorodateString()}" hidden />
|
||||||
|
</c:forEach>
|
||||||
|
<button class="btn btn-default" type="submit" data-toggle="tooltip" data-placement="bottom" title="<fmt:message key="animal_care.button.note.tooltip"></fmt:message>"><span class="glyphicon glyphicon-file" aria-hidden="true"></span></button>
|
||||||
|
</form>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</c:forEach>
|
</c:forEach>
|
||||||
|
|
@ -211,6 +263,47 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div id="modal_note_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">×</button>
|
||||||
|
<h4 id="modal_note_progression_title" class="modal-title">
|
||||||
|
<fmt:message key="progression.modale.notes.title"></fmt:message>
|
||||||
|
</h4>
|
||||||
|
<h4 class="modal-title">
|
||||||
|
<fmt:message key="progression.modale.notes.title.care_name"></fmt:message>
|
||||||
|
<span id="modal_note_progression_title_care_name">${MODEL_MAP_ANIMAL.getCareById(MODEL_MAP_ANIMAL_CARE_ID).getName()}</span>
|
||||||
|
</h4>
|
||||||
|
<h4 class="modal-title">
|
||||||
|
<fmt:message key="progression.modale.notes.title.consent_behavior_name"></fmt:message>
|
||||||
|
<span id="modal_note_progression_title_consent_behavior_name"></span>
|
||||||
|
</h4>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<div id="modal_note_list" >
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<hr/>
|
||||||
|
|
||||||
|
<form id="modal_note_progression_validate" action="" method="POST">
|
||||||
|
<input id="modal_note_progression_form_progression_id" name="progression_id" value="" hidden />
|
||||||
|
<input name="page" value="care" hidden />
|
||||||
|
<input name="care_or_consent_behavior_id" value="${MODEL_MAP_ANIMAL_CARE_ID}" hidden />
|
||||||
|
</form>
|
||||||
|
<label for="modal_add_note_progression_form"><fmt:message key="progression.modale.notes.add.label"></fmt:message></label>
|
||||||
|
<textarea id="modal_add_note_progression_form" class="form-control" name="note_content" form="modal_note_progression_validate" placeholder="<fmt:message key="progression.modale.notes.add.placeholder"></fmt:message>" ></textarea>
|
||||||
|
</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_note_progression_validate" type="submit" class="btn btn-primary"><fmt:message key="modal_button.add"></fmt:message></button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
@ -251,6 +344,23 @@
|
||||||
});
|
});
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
}
|
}
|
||||||
|
} else if (formUrl.startsWith('${animalNotesProgressionURL}')) {
|
||||||
|
if ($(this).attr('id') !== 'modal_note_progression_validate') {
|
||||||
|
$('#modal_note_list').empty();
|
||||||
|
var data = $(this).find('input');
|
||||||
|
for (i = 0; i < data.length; i++) {
|
||||||
|
if (i == 0) {
|
||||||
|
$('#modal_note_progression_title_consent_behavior_name').html(data[i].value);
|
||||||
|
} else {
|
||||||
|
$('#modal_note_list').append("<div class=\"alert alert-info\" role=\"alert\"><small><b>"+$(data[i]).data("horodate")+"</b></small> <hr/> "+data[i].value+"</div>");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$('#modal_note_progression_validate').attr('action', formUrl);
|
||||||
|
$('#modal_note_progression').modal({
|
||||||
|
show: true
|
||||||
|
});
|
||||||
|
event.preventDefault();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue