diff --git a/src/main/java/org/springframework/cheapy/web/OfertaController.java b/src/main/java/org/springframework/cheapy/web/OfertaController.java index 81fdae55e..e203cc1c3 100644 --- a/src/main/java/org/springframework/cheapy/web/OfertaController.java +++ b/src/main/java/org/springframework/cheapy/web/OfertaController.java @@ -2,7 +2,6 @@ package org.springframework.cheapy.web; import java.time.format.DateTimeFormatter; -import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -114,6 +113,17 @@ public class OfertaController { @GetMapping("/offersByPlace") public String processFindFormByPlace(final Map model, final HttpServletRequest request) { + + if (request.getParameter("municipio").equals("") || request.getParameter("municipio").equals(null)) { + // Añade la lista de municipios al desplegable + model.put("municipios", Municipio.values()); + + //Se añade formateador de fecha al modelo + model.put("localDateTimeFormat", DateTimeFormatter.ofPattern("dd/MM/yyyy HH:mm")); + + return "redirect:/offers/"; + } + Municipio mun = Municipio.valueOf(request.getParameter("municipio")); List foodOfferLs = this.foodOfferService.findFoodOfferByClientPlace(mun); @@ -161,30 +171,30 @@ public class OfertaController { return "offers/offersCreate"; } - + @GetMapping("/offersRecord") public String processOffersRecordForm(final Map model) { - + Pageable p = PageRequest.of(0, 3); - + Map datos = new HashMap(); - - for(Offer of:this.foodOfferService.findAllFoodOffer(p)) { + + for (Offer of : this.foodOfferService.findAllFoodOffer(p)) { datos.put(of, "food"); } - - for(Offer of:this.nuOfferService.findAllNuOffer(p)) { + + for (Offer of : this.nuOfferService.findAllNuOffer(p)) { datos.put(of, "nu"); } - - for(Offer of:this.speedOfferService.findAllSpeedOffer(p)) { + + for (Offer of : this.speedOfferService.findAllSpeedOffer(p)) { datos.put(of, "speed"); } - - for(Offer of:this.timeOfferService.findAllTimeOffer(p)) { + + for (Offer of : this.timeOfferService.findAllTimeOffer(p)) { datos.put(of, "time"); } - + model.put("datos", datos); //Se añade formateador de fecha al modelo @@ -192,7 +202,7 @@ public class OfertaController { return "offers/offersRecordList"; } - + // @GetMapping("/owners/{ownerId}/edit") // public String initUpdateOwnerForm(@PathVariable("ownerId") int ownerId, Model model) { // Owner owner = this.ownerService.findOwnerById(ownerId); diff --git a/src/main/less/cheapy.less b/src/main/less/cheapy.less index da0e89be5..a2324b005 100644 --- a/src/main/less/cheapy.less +++ b/src/main/less/cheapy.less @@ -696,3 +696,4 @@ hr { @import "typography.less"; @import "header.less"; @import "responsive.less"; +@import "starRating.less" diff --git a/src/main/less/starRating.less b/src/main/less/starRating.less new file mode 100644 index 000000000..0cf338fc6 --- /dev/null +++ b/src/main/less/starRating.less @@ -0,0 +1,40 @@ +.rating { + display: flex; + flex-direction: row-reverse; + justify-content: flex-end + } + + .rating>input { + display: none + } + + .rating>label { + position: relative; + width: 1em; + font-size: 200%; + color: #FFD600; + cursor: pointer + } + + .rating>label::before { + content: "\2605"; + position: absolute; + opacity: 0 + } + + .rating>label:hover:before, + .rating>label:hover~label:before { + opacity: 1 !important + } + + .rating>input:checked~label:before { + opacity: 1 + } + + .rating:hover>input:checked~label:before { + opacity: 0.4 + } + + + + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/jsp/reviews/createOrUpdateReviewForm.jsp b/src/main/webapp/WEB-INF/jsp/reviews/createOrUpdateReviewForm.jsp index ae1b43151..2af06c0d8 100644 --- a/src/main/webapp/WEB-INF/jsp/reviews/createOrUpdateReviewForm.jsp +++ b/src/main/webapp/WEB-INF/jsp/reviews/createOrUpdateReviewForm.jsp @@ -10,13 +10,14 @@

- Nueva Reseña + Nueva Reseña

- + +
@@ -25,10 +26,10 @@ + Crear reseña - +
diff --git a/src/main/webapp/WEB-INF/jsp/reviews/reviewsList.jsp b/src/main/webapp/WEB-INF/jsp/reviews/reviewsList.jsp index c443cbd10..c521a350a 100644 --- a/src/main/webapp/WEB-INF/jsp/reviews/reviewsList.jsp +++ b/src/main/webapp/WEB-INF/jsp/reviews/reviewsList.jsp @@ -4,7 +4,9 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> <%@ taglib prefix="cheapy" tagdir="/WEB-INF/tags" %> +<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %> <%@ page contentType="text/html; charset=UTF-8" %> + @@ -27,6 +29,7 @@ + <%-- --%> @@ -35,7 +38,10 @@ - + + + + @@ -52,6 +58,7 @@ + diff --git a/src/main/webapp/WEB-INF/jsp/reviews/reviewsShow.jsp b/src/main/webapp/WEB-INF/jsp/reviews/reviewsShow.jsp index a63ebe277..0a4c9207b 100644 --- a/src/main/webapp/WEB-INF/jsp/reviews/reviewsShow.jsp +++ b/src/main/webapp/WEB-INF/jsp/reviews/reviewsShow.jsp @@ -7,25 +7,31 @@ <%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %> <%@ page contentType="text/html; charset=UTF-8" %> +<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %> +

+ + + - + + - +
- +
diff --git a/src/main/webapp/WEB-INF/tags/ratingStar.tag b/src/main/webapp/WEB-INF/tags/ratingStar.tag new file mode 100644 index 000000000..6d6bcb83d --- /dev/null +++ b/src/main/webapp/WEB-INF/tags/ratingStar.tag @@ -0,0 +1,37 @@ +<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> +<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %> +<%@ taglib uri = "http://java.sun.com/jsp/jstl/functions" prefix = "fn" %> +<%@ attribute name="name" required="true" rtexprvalue="true" + description="Name of corresponding property in bean object" %> +<%@ attribute name="disabled" required="false" rtexprvalue="true" + description="Disable the input" %> +<%@ attribute name="label" required="true" rtexprvalue="true" + description="Label appears in red color if input is considered as invalid after submission" %> +<%@ attribute name="placeholder" required="false" rtexprvalue="true" + description="Example for input field" %> + + + + +
+ + + +
+
+ + + + + + +
+ + + + ${status.errorMessage} + +
+
+
diff --git a/src/main/webapp/WEB-INF/tags/showStars.tag b/src/main/webapp/WEB-INF/tags/showStars.tag new file mode 100644 index 000000000..f68844d5c --- /dev/null +++ b/src/main/webapp/WEB-INF/tags/showStars.tag @@ -0,0 +1,18 @@ +<%@tag import="com.sun.org.apache.xalan.internal.xsltc.compiler.sym"%> +<%@ tag language="java" pageEncoding="ISO-8859-1"%> +<%@ attribute name="value" required="true" rtexprvalue="true" type="Integer" + description="Number of starts" %> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> +<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %> +
+ + +
+ /> + /> + /> + /> + /> +
+ +