diff --git a/src/main/java/org/springframework/cheapy/web/NuOfferController.java b/src/main/java/org/springframework/cheapy/web/NuOfferController.java
index 01a3f9cb0..fc8472da9 100644
--- a/src/main/java/org/springframework/cheapy/web/NuOfferController.java
+++ b/src/main/java/org/springframework/cheapy/web/NuOfferController.java
@@ -1,6 +1,7 @@
package org.springframework.cheapy.web;
import java.security.Principal;
+import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.List;
import java.util.Map;
@@ -14,12 +15,14 @@ import org.springframework.cheapy.model.NuOffer;
import org.springframework.cheapy.model.StatusOffer;
import org.springframework.cheapy.service.ClientService;
import org.springframework.cheapy.service.NuOfferService;
+import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestParam;
@Controller
public class NuOfferController {
@@ -98,8 +101,15 @@ public class NuOfferController {
}
@PostMapping("/offers/nu/new")
- public String processCreationForm(@Valid NuOffer nuOffer, BindingResult result) {
+ public String processCreationForm(@RequestParam(value="start") String x,@Valid NuOffer nuOffer,BindingResult result) {
+ System.out.println(x);
+ LocalDateTime y= LocalDateTime.parse(x);
+ DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd/MM/yyyy HH:mm");
+ String formatDateTime = y.format(formatter);
+ System.out.println(formatDateTime);
+ LocalDateTime start2=LocalDateTime.parse(formatDateTime,formatter);
+ nuOffer.setStart(start2);
if(!this.checkDates(nuOffer)) {
result.rejectValue("end","" ,"La fecha de fin debe ser posterior a la fecha de inicio");
@@ -114,6 +124,7 @@ public class NuOfferController {
}
if (result.hasErrors()) {
+ System.out.println(result.getAllErrors());
return VIEWS_NU_OFFER_CREATE_OR_UPDATE_FORM;
}
nuOffer.setStatus(StatusOffer.hidden);
diff --git a/src/main/webapp/WEB-INF/jsp/offers/nu/createOrUpdateNuOfferForm.jsp b/src/main/webapp/WEB-INF/jsp/offers/nu/createOrUpdateNuOfferForm.jsp
index 1dcc0f41d..fa312a38a 100644
--- a/src/main/webapp/WEB-INF/jsp/offers/nu/createOrUpdateNuOfferForm.jsp
+++ b/src/main/webapp/WEB-INF/jsp/offers/nu/createOrUpdateNuOfferForm.jsp
@@ -5,27 +5,79 @@
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib prefix="cheapy" tagdir="/WEB-INF/tags" %>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
-
-
+
+
+
+
+
-
+
+
-
+