Browse Source

Fixed Date problem

Drowsito 18 hours ago
parent
commit
1541575ebe

+ 2 - 3
src/main/java/es/uv/saic/feign/ProceduresClient.java

@@ -27,9 +27,8 @@ public interface ProceduresClient {
 	public HashMap<String, Object> getActiveInstances(@RequestParam(required = false) String _new,
         @RequestParam String usuari);
 
-    @GetMapping("/procedure/{id}")
-	    public HashMap<String, Object> getInstance(@RequestParam String location,
-        @PathVariable BigInteger id, @RequestParam String usuari);
+    @GetMapping("/procedure/{id}/{usuari}")
+	    public HashMap<String, Object> getInstance(@PathVariable BigInteger id, @PathVariable String usuari);
     
     @PostMapping("/procedure/files/{id}")
 	@ResponseBody 

+ 15 - 7
src/main/java/es/uv/saic/web/ProceduresController.java

@@ -93,14 +93,22 @@ public class ProceduresController {
 	public String getInstance(Model model, Authentication auth, HttpSession session, @PathVariable BigInteger id) {
 		
 		HashMap<String, Object> response =
-                pc.getInstance(session.getAttribute("location").toString(), id, ((Usuari) auth.getPrincipal()).getUsuari());
-        if (response != null && response.get("redirect") != null) {
-			model.addAllAttributes(response);
-			session.setAttribute("location", model.getAttribute("location"));
-            return response.get("redirect").toString();
-        }
+                pc.getInstance(id, ((Usuari) auth.getPrincipal()).getUsuari());
+		
+		if(session.getAttribute("location") != null) {
+			model.addAttribute("location", session.getAttribute("location"));
+		}
+		else {
+			session.setAttribute("location", "procedures");
+			model.addAttribute("location", "procedures");
+		}		
 
-		return "401";
+		if(response == null){
+			return "401";
+		}
+		
+        model.addAllAttributes(response);
+		return "procedure";
 	}
 	
 

+ 4 - 4
src/main/resources/templates/procedure.html

@@ -139,7 +139,7 @@
 									</span>
 									<br>
 									
-									<span th:if="${item.estat == 'A' or item.estat == null}"><span th:text="#{procedures.dateLimit}"></span>: <span th:text="${#dates.format(item.dataLim, 'YYYY-MM-DD')}"></span></span>
+									<span th:if="${item.estat == 'A' or item.estat == null}"><span th:text="#{procedures.dateLimit}"></span>: <span th:text="${item.dataLim}"></span></span>
 									<span style="float: right; margin-top:-5px;" th:if="${item.estat == 'A' and item.isAssignedToUser}" th:attr="title=#{procedures.status.title.a}"><i class="fa fa-play-circle"></i></span>
 									<span style="float: right; margin-top:-5px;" th:if="${item.estat == 'A' and not item.isAssignedToUser}" th:attr="title=#{procedures.status.title.o}"><i class="fa fa-exclamation-triangle"></i></span>
 									<span style="float: right; margin-top:-5px;" th:if="${item.estat == null}"><i class="fa fa-lock" th:attr="title=#{procedures.status.title.p}"></i></span>
@@ -197,7 +197,7 @@
 												<div class="card-body-inner-action" th:if="${item.tipus == 11 or item.tipus == 15}">
 													<textarea id="editor" name="evidencia_text" th:text="${item.text}"></textarea>
 													<div style="text-align: left;">
-														<small style="text-align: left;font-weight: bold;"><span th:text="#{procedures.autosave.lastdate}">Última modificación</span>: <span th:if="${item.dataMod != null}" id="lastmoddate" th:text="${#dates.format(item.dataMod, 'dd/MM/yyyy HH:mm:ss')}"></span><span th:if="${item.dataMod == null}" id="lastmoddate" th:text="#{procedures.autosave.none}"></span></small>
+														<small style="text-align: left;font-weight: bold;"><span th:text="#{procedures.autosave.lastdate}">Última modificación</span>: <span th:if="${item.dataMod != null}" id="lastmoddate" th:text="${item.dataMod}"></span><span th:if="${item.dataMod == null}" id="lastmoddate" th:text="#{procedures.autosave.none}"></span></small>
 													</div>
 												</div>
 												
@@ -273,7 +273,7 @@
 											<br>
 											<span><span th:text="#{procedures.done.user}"></span>: <span th:text="${item.usuariFet}"></span></span>
 											<br>
-											<span><span th:text="#{procedures.done.date}"></span>: <span th:text="${#dates.format(item.dataFet, 'YYYY-MM-DD')}"></span></span>
+											<span><span th:text="#{procedures.done.date}"></span>: <span th:text="${item.dataFet}"></span></span>
 										</span>
 									</div>
 									<div class="container" th:if="${item.versions != null}" style="margin-top:25px;text-align:left;margin-left: 0px;">
@@ -311,7 +311,7 @@
 												<br>
 												<span><span th:text="#{procedures.done.user}"></span>: <span th:text="${version.usuariFet}"></span></span>
 												<br>
-												<span><span th:text="#{procedures.done.date}"></span>: <span th:text="${#dates.format(version.dataFet, 'YYYY-MM-DD')}"></span></span>
+												<span><span th:text="#{procedures.done.date}"></span>: <span th:text="${version.dataFet}"></span></span>
 											</div>
 											<br>
 										</div>

+ 1 - 1
src/main/resources/templates/testerTemplateEditor.html

@@ -299,7 +299,7 @@
 			}
 		}
 		
-		function save_content(){			
+		function 	(){			
 			$.post("/ajax/template/save", 
 			   {id: $('#templateSelector').val(),
 				codi:$('#codiInput').val(),