|
|
@@ -40,6 +40,7 @@ import es.uv.saic.domain.Rol;
|
|
|
import es.uv.saic.domain.Tipus;
|
|
|
import es.uv.saic.domain.Usuari;
|
|
|
import es.uv.saic.dto.EvidenciaBuscadorDTO;
|
|
|
+import es.uv.saic.feign.PlantillaClient;
|
|
|
import es.uv.saic.service.CalendariService;
|
|
|
import es.uv.saic.service.EmailService;
|
|
|
import es.uv.saic.service.EvidenciaIndicadorEnquestaService;
|
|
|
@@ -82,6 +83,8 @@ public class AjaxController {
|
|
|
private InstanciaTascaService its;
|
|
|
@Autowired
|
|
|
private EmailService es;
|
|
|
+ @Autowired
|
|
|
+ private PlantillaClient plc;
|
|
|
|
|
|
@PostMapping("/ajax/active/centres")
|
|
|
public String getActiveCentres(Model model, Authentication auth) throws IOException {
|
|
|
@@ -423,7 +426,7 @@ public class AjaxController {
|
|
|
Proces p = new Proces();
|
|
|
model.addAttribute("action", action);
|
|
|
List<Tipus> tipus = tps.findAll();
|
|
|
- List<Plantilla> templates = pls.findAll();
|
|
|
+ List<Plantilla> templates = plc.findAll();
|
|
|
model.addAttribute("tipus", tipus);
|
|
|
model.addAttribute("templates", templates);
|
|
|
|
|
|
@@ -487,7 +490,7 @@ public class AjaxController {
|
|
|
public String newTaskForm(Model model, Authentication auth, @PathVariable Integer i) throws IOException {
|
|
|
List<Rol> roles = rs.findAssignables();
|
|
|
List<Tipus> tipus = tps.findAll();
|
|
|
- List<Plantilla> templates = pls.findAll();
|
|
|
+ List<Plantilla> templates = plc.findAll();
|
|
|
model.addAttribute("tipus", tipus);
|
|
|
model.addAttribute("roles", roles);
|
|
|
model.addAttribute("i", i);
|
|
|
@@ -507,7 +510,7 @@ public class AjaxController {
|
|
|
@ResponseBody
|
|
|
@PostMapping("/ajax/find/template")
|
|
|
public String findTemplate(Model model, Authentication auth, @RequestParam("id") Integer idPlantilla) throws IOException {
|
|
|
- Plantilla p = pls.findByID(idPlantilla);
|
|
|
+ Plantilla p = plc.findByID(idPlantilla);
|
|
|
return p.getText();
|
|
|
}
|
|
|
|
|
|
@@ -530,13 +533,13 @@ public class AjaxController {
|
|
|
return "components/form_template";
|
|
|
}
|
|
|
else if(action.equals("edit")) {
|
|
|
- Plantilla p = pls.findByID(idPlantilla);
|
|
|
+ Plantilla p = plc.findByID(idPlantilla);
|
|
|
model.addAttribute("editable", false);
|
|
|
model.addAttribute("template", p);
|
|
|
return "components/form_template";
|
|
|
}
|
|
|
else if(action.equals("duplicate")) {
|
|
|
- Plantilla p = pls.findByID(idPlantilla);
|
|
|
+ Plantilla p = plc.findByID(idPlantilla);
|
|
|
p.setVersio(p.getVersio()+1);
|
|
|
model.addAttribute("editable", true);
|
|
|
model.addAttribute("template", p);
|
|
|
@@ -554,7 +557,7 @@ public class AjaxController {
|
|
|
return "0";
|
|
|
}
|
|
|
else {
|
|
|
- Plantilla p = pls.findByID(idPlantilla);
|
|
|
+ Plantilla p = plc.findByID(idPlantilla);
|
|
|
pls.delete(p);
|
|
|
return "1";
|
|
|
}
|
|
|
@@ -569,7 +572,7 @@ public class AjaxController {
|
|
|
@RequestParam("nomCas") String nomCas, @RequestParam("nomVal") String nomVal, @RequestParam("ambit") String ambit) throws IOException {
|
|
|
|
|
|
if(action.equals("edit")) {
|
|
|
- Plantilla p = pls.findByID(idPlantilla);
|
|
|
+ Plantilla p = plc.findByID(idPlantilla);
|
|
|
p.setNomCas(nomCas);
|
|
|
p.setNomVal(nomVal);
|
|
|
p.setText(text);
|
|
|
@@ -579,7 +582,7 @@ public class AjaxController {
|
|
|
}
|
|
|
else if(action.equals("duplicate") || action.equals("new")) {
|
|
|
Plantilla p = new Plantilla();
|
|
|
- Plantilla p2 = pls.findByVersioCodiAmbit(versio, codi, ambit);
|
|
|
+ Plantilla p2 = plc.findByVersioCodiAmbit(versio, codi, ambit);
|
|
|
if(p2 != null) {
|
|
|
return "0";
|
|
|
}
|
|
|
@@ -599,7 +602,7 @@ public class AjaxController {
|
|
|
@PostMapping("/ajax/draft/save/{id}")
|
|
|
public String saveTemplate(Model model, Authentication auth, @PathVariable("id") Integer idPlantilla,
|
|
|
@RequestParam("text") String text) throws IOException {
|
|
|
- Plantilla p = pls.findByID(idPlantilla);
|
|
|
+ Plantilla p = plc.findByID(idPlantilla);
|
|
|
p.setText(text);
|
|
|
pls.save(p);
|
|
|
return "1";
|