diff --git a/src/main/java/org/springframework/cheapy/configuration/SecurityConfiguration.java b/src/main/java/org/springframework/cheapy/configuration/SecurityConfiguration.java index 7189740f2..ce15fc2b0 100644 --- a/src/main/java/org/springframework/cheapy/configuration/SecurityConfiguration.java +++ b/src/main/java/org/springframework/cheapy/configuration/SecurityConfiguration.java @@ -44,11 +44,14 @@ public class SecurityConfiguration extends WebSecurityConfigurerAdapter { .antMatchers("/owners/**").hasAnyAuthority("owner", "admin") + .antMatchers("/offers/**/new").hasAnyAuthority("admin", "client") .antMatchers("/offers/**/activate").hasAnyAuthority("admin","client") - + .antMatchers("/clients/new").permitAll() .antMatchers("/offers/**").permitAll() + .antMatchers("/offersCreate").hasAuthority("client") + .and().formLogin() @@ -69,7 +72,7 @@ public class SecurityConfiguration extends WebSecurityConfigurerAdapter { public void configure(final AuthenticationManagerBuilder auth) throws Exception { auth.jdbcAuthentication().dataSource(this.dataSource) //[login de admin,owner y vet] .usersByUsernameQuery("select username,password,enabled " + "from users " + "where username = ?") - .usersByUsernameQuery("select username, password, enabled from users where username=?").authoritiesByUsernameQuery("select username, authority " + "from authorities " + "where username = ?") + .usersByUsernameQuery("select username, password, enabled from users where username=?").authoritiesByUsernameQuery("select username, authority " + "from authorities " + "where username = ?") .passwordEncoder(this.passwordEncoder()); } diff --git a/src/main/java/org/springframework/cheapy/web/OfertaController.java b/src/main/java/org/springframework/cheapy/web/OfertaController.java index 73b3553cd..2ae80261c 100644 --- a/src/main/java/org/springframework/cheapy/web/OfertaController.java +++ b/src/main/java/org/springframework/cheapy/web/OfertaController.java @@ -13,16 +13,19 @@ import org.springframework.cheapy.service.FoodOfferService; import org.springframework.cheapy.service.NuOfferService; import org.springframework.cheapy.service.SpeedOfferService; import org.springframework.cheapy.service.TimeOfferService; +import org.springframework.security.authentication.AnonymousAuthenticationToken; +import org.springframework.security.core.Authentication; +import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.GetMapping; @Controller public class OfertaController { - + private final ClientService clientService; - + private final FoodOfferService foodOfferService; - private final NuOfferService nuOfferService; + private final NuOfferService nuOfferService; private final SpeedOfferService speedOfferService; private final TimeOfferService timeOfferService; @@ -42,40 +45,49 @@ public class OfertaController { List nuOfferLs=this.nuOfferService.findActiveNuOffer(); List speedOfferLs=this.speedOfferService.findActiveSpeedOffer(); List timeOfferLs=this.timeOfferService.findActiveTimeOffer(); - + model.put("foodOfferLs", foodOfferLs); model.put("nuOfferLs", nuOfferLs); model.put("speedOfferLs", speedOfferLs); model.put("timeOfferLs", timeOfferLs); - - //Se añade formateador de fecha al modelo + + //Se añade formateador de fecha al modelo model.put("localDateTimeFormat", DateTimeFormatter.ofPattern("dd/MM/yyyy HH:mm")); - + return "offers/offersList"; } - + + @GetMapping("/myOffers") public String processMyOffersForm( Map model) { - + int actual = this.clientService.getCurrentClient().getId(); - + List foodOfferLs = this.foodOfferService.findFoodOfferByUserId(actual); List nuOfferLs = this.nuOfferService.findNuOfferByUserId(actual); List speedOfferLs = this.speedOfferService.findSpeedOfferByUserId(actual); List timeOfferLs = this.timeOfferService.findTimeOfferByUserId(actual); - + model.put("foodOfferLs", foodOfferLs); model.put("nuOfferLs", nuOfferLs); model.put("speedOfferLs", speedOfferLs); model.put("timeOfferLs", timeOfferLs); - - //Se añade formateador de fecha al modelo - model.put("localDateTimeFormat", DateTimeFormatter.ofPattern("dd/MM/yyyy HH:mm")); - - return "offers/myOffersList"; - } + //Se añade formateador de fecha al modelo + model.put("localDateTimeFormat", DateTimeFormatter.ofPattern("dd/MM/yyyy HH:mm")); + + return "offers/myOffersList"; + } + + @GetMapping("/offersCreate") + public String createOffers() { + + return "offers/offersCreate"; + } + + + // @GetMapping("/owners/{ownerId}/edit") // public String initUpdateOwnerForm(@PathVariable("ownerId") int ownerId, Model model) { // Owner owner = this.ownerService.findOwnerById(ownerId); @@ -99,10 +111,10 @@ public class OfertaController { // public ModelAndView showOwner(@PathVariable("ownerId") int ownerId) { // ModelAndView mav = new ModelAndView("owners/ownerDetails"); // Owner owner = this.ownerService.findOwnerById(ownerId); -// +// // mav.addObject(owner); // return mav; // } - - + + } diff --git a/src/main/less/cheapy.less b/src/main/less/cheapy.less index 2ad446686..6844c25df 100644 --- a/src/main/less/cheapy.less +++ b/src/main/less/cheapy.less @@ -56,7 +56,7 @@ .table-filter { background-color: @spring-brown; - padding: 9px 12px; + padding: 5px 12px; } .nav > li > a { @@ -240,20 +240,81 @@ img.img-responsive{ background-color: rgb(40, 140, 215); } +.btn-home{ + display: table; + margin: 0 auto; +} + +.btn-create button { + background-color: rgb(40, 140, 215); + border: 1px solid rgb(0, 0, 160); + color: white; + padding: 10px 24px; + cursor: pointer; + width: 70%; + display: block; + +} + +.btn-create button:not(:last-child) { + border-bottom: none; +} + + +.btn-create button:hover { + background-color: rgb(0, 64, 128) +} + +.btn-create-max button { + padding: 20px; + margin-left:auto; + margin-right: auto; + margin-bottom: 20px; +} + +.btn-mod{ + display: table; + margin: 0 auto; + float:left; +} + +.btn-mod button { + background-color: rgb(0, 64, 128); + border: 1px solid rgb(0, 0, 160); + color: white; + padding: 10px 24px; + cursor: pointer; + display: block; +} + +.btn-mod button:not(:last-child) { + border-bottom: none; +} + + +.btn-mod button:hover { + background-color: rgb(40, 140, 215); +} + #foodOfferTable th { width: 25%; + text-align: center; + } #nuOfferTable th { - width: 33%; + width: 25%; +text-align: center; } #speedOfferTable th { - width: 33%; + width: 25%; +text-align: center; } #timeOfferTable th { - width: 33%; + width: 25%; +text-align: center; } .btn-detalles button { @@ -278,7 +339,52 @@ img.img-responsive{ .btn-return{ display: table; margin: 0 auto; - width: 100%; + float:left; +} + +.btns-edit{ + display: table; + margin: 0 auto; + float:right; +} + +.btns-edit button{ + background-color: rgb(0, 64, 128); + border: 1px solid rgb(0, 0, 160); + color: white; + padding: 10px 24px; + cursor: pointer; +} + +.btns-edit button:not(:last-child) { + border-bottom: none; +} + + +.btns-edit button:hover { + background-color: rgb(40, 140, 215); +} + +.btns-delete{ + display: table; + margin: 0 auto; + float:left; +} + +.btns-delete button{ + background-color: rgb(0, 64, 128); + border: 1px solid rgb(0, 0, 160); + color: white; + padding: 10px 24px; + cursor: pointer; +} + +.btns-delete button:not(:last-child) { + border-bottom: none; +} + +.btns-delete button:hover { + background-color: rgb(40, 140, 215); } .btn-return button { @@ -288,32 +394,50 @@ img.img-responsive{ padding: 10px 24px; cursor: pointer; display: block; - left: 0%; } .btn-return button:not(:last-child) { border-bottom: none; } - .btn-return button:hover { background-color: rgb(40, 140, 215); } #foodOfferTable td{ vertical-align:middle; +text-align: center; } #nuOfferTable td{ vertical-align:middle; +text-align: center; } #speedOfferTable td{ vertical-align:middle; +text-align: center; } #timeOfferTable td{ vertical-align:middle; +text-align: center; +} + +#nuOffer-table th{ + text-align: center; +} + +#nuOffer-table td{ + text-align: center; +} + +#speedOffer-table th{ + text-align: center; +} + +#speedOffer-table td{ + text-align: center; } #nuOffer-table tr:nth-child(3){ diff --git a/src/main/resources/messages/messages_es.properties b/src/main/resources/messages/messages_es.properties index 81b71314d..c93d14f77 100644 --- a/src/main/resources/messages/messages_es.properties +++ b/src/main/resources/messages/messages_es.properties @@ -1,9 +1,14 @@ welcome=Bienvenido a +new=Nueva +deleteOffer=Eliminar Oferta +cancel=Cancelar +deleteOfferMessage=Confirme que quiere eliminar su oferta listOffers=Ver Ofertas -foodOffers=Ofertas por plato especifico -foodOffer=Oferta por plato especifico -nuOffers=Ofertas por numero de comensales -nuOffer=Oferta por numero de comensales +createOffers=Crear Ofertas +foodOffers=Ofertas por plato espec�fico +foodOffer=Oferta por plato espec�fico +nuOffers=Ofertas por n�mero de comensales +nuOffer=Oferta por n�mero de comensales speedOffers=Ofertas rapidez comiendo speedOffer=Oferta por comer veloz timeOffers=Ofertas por franja horaria @@ -23,12 +28,18 @@ offerBeginning=Inicio de la oferta endDate=Fecha fin offerEnding=Fin de la oferta details=Detalles -offerCode=Codigo de la oferta +offerCode=C�digo de la oferta return=Volver -required=Es requeridOfertas por franja horariao +required=Es requerido Ofertas por franja horaria notFound=No ha sido encontrado duplicate=Ya se encuentra en uso -nonNumeric=Sólo debe contener numeros -duplicateFormSubmission=No se permite el envío de formularios duplicados -typeMismatch.date=Fecha invalida -typeMismatch.birthDate=Fecha invalida \ No newline at end of file +nonNumeric=S�lo debe contener n�meros +duplicateFormSubmission=No se permite el env�o de formularios duplicados +typeMismatch.date=Fecha inv�lida +typeMismatch.birthDate=Fecha inv�lida +createFoodOffers= Crear ofertas por plato espec�fico +createNuOffers= Crear ofertas por n�mero de comensales +createSpeedOffers= Crear ofertas por rapidez comiendo +createTimeOffers= Crear ofertas por franja horaria +init= Inicio del intervalo +finish= Fin del intervalo \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/jsp/login.jsp b/src/main/webapp/WEB-INF/jsp/login.jsp index 796cdceeb..aee0598c1 100644 --- a/src/main/webapp/WEB-INF/jsp/login.jsp +++ b/src/main/webapp/WEB-INF/jsp/login.jsp @@ -1,6 +1,8 @@ <%@ page session="false" trimDirectiveWhitespaces="true" %> <%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %> <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> +<%@ 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="sec" uri="http://www.springframework.org/security/tags" %> @@ -275,26 +277,29 @@
- +
+ +

El usuario y/o la contraseña son incorrectos

+ +
-
-

Invalid username or password

-
+ +
diff --git a/src/main/webapp/WEB-INF/jsp/offers/food/createOrUpdateFoodOfferForm.jsp b/src/main/webapp/WEB-INF/jsp/offers/food/createOrUpdateFoodOfferForm.jsp index daeeec363..a2366158e 100644 --- a/src/main/webapp/WEB-INF/jsp/offers/food/createOrUpdateFoodOfferForm.jsp +++ b/src/main/webapp/WEB-INF/jsp/offers/food/createOrUpdateFoodOfferForm.jsp @@ -4,33 +4,52 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> <%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %> -<%@ taglib prefix="petclinic" tagdir="/WEB-INF/tags" %> +<%@ taglib prefix="cheapy" tagdir="/WEB-INF/tags" %> + - -

- New FoodOffer + +

+

- - - - + + + +
- - - - - - - - +
+ + + + + + + + +
- + +
+ +
+ + +
diff --git a/src/main/webapp/WEB-INF/jsp/offers/food/foodOffersShow.jsp b/src/main/webapp/WEB-INF/jsp/offers/food/foodOffersShow.jsp index 043248d25..84757189b 100644 --- a/src/main/webapp/WEB-INF/jsp/offers/food/foodOffersShow.jsp +++ b/src/main/webapp/WEB-INF/jsp/offers/food/foodOffersShow.jsp @@ -29,7 +29,7 @@ - + @@ -38,26 +38,42 @@ - -
- + +
+
+ +
+ +
+ + + + + + + + + + + + + + +
- - - - Editar oferta - - - - - Activar oferta - - - - - Desactivar oferta - + + 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 904bbfffb..d693e8ae9 100644 --- a/src/main/webapp/WEB-INF/jsp/offers/nu/createOrUpdateNuOfferForm.jsp +++ b/src/main/webapp/WEB-INF/jsp/offers/nu/createOrUpdateNuOfferForm.jsp @@ -4,39 +4,58 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> <%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %> -<%@ taglib prefix="petclinic" tagdir="/WEB-INF/tags" %> +<%@ taglib prefix="cheapy" tagdir="/WEB-INF/tags" %> + - -

- New NuOffer + +

+

- - + + - - - - - - + + + + + +
- - - - - - - - +
+ + + + + + + + +
- + +
+ +
+ + +
diff --git a/src/main/webapp/WEB-INF/jsp/offers/nu/nuOffersShow.jsp b/src/main/webapp/WEB-INF/jsp/offers/nu/nuOffersShow.jsp index 8f916aeb6..ee04b01b5 100644 --- a/src/main/webapp/WEB-INF/jsp/offers/nu/nuOffersShow.jsp +++ b/src/main/webapp/WEB-INF/jsp/offers/nu/nuOffersShow.jsp @@ -22,53 +22,69 @@ - + - + - + - + Meta bronce - + - + - -
- + +
+
+ +
+ +
+ + + + + + + + + + + + + + +
- - - - Editar oferta - - - - - Activar oferta - - - - - Desactivar oferta + diff --git a/src/main/webapp/WEB-INF/jsp/offers/offersCreate.jsp b/src/main/webapp/WEB-INF/jsp/offers/offersCreate.jsp new file mode 100644 index 000000000..d0b418471 --- /dev/null +++ b/src/main/webapp/WEB-INF/jsp/offers/offersCreate.jsp @@ -0,0 +1,46 @@ +<%@ page session="false" trimDirectiveWhitespaces="true" %> +<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %> +<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> +<%@ 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" %> + + + +
+
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+
+ +
+ +
diff --git a/src/main/webapp/WEB-INF/jsp/offers/offersList.jsp b/src/main/webapp/WEB-INF/jsp/offers/offersList.jsp index 30ee72a07..baa17bde9 100644 --- a/src/main/webapp/WEB-INF/jsp/offers/offersList.jsp +++ b/src/main/webapp/WEB-INF/jsp/offers/offersList.jsp @@ -14,6 +14,7 @@ + @@ -25,6 +26,9 @@ + + + @@ -55,6 +59,8 @@ + + @@ -69,6 +75,12 @@ + + + + + + @@ -91,6 +103,8 @@ + + @@ -105,6 +119,12 @@ + + + + + + @@ -128,6 +148,8 @@ + + @@ -141,6 +163,13 @@ + + + + + + + @@ -155,4 +184,14 @@ +
+ +
+ diff --git a/src/main/webapp/WEB-INF/jsp/offers/speed/createOrUpdateSpeedOfferForm.jsp b/src/main/webapp/WEB-INF/jsp/offers/speed/createOrUpdateSpeedOfferForm.jsp index 3327373db..d466bc2f5 100644 --- a/src/main/webapp/WEB-INF/jsp/offers/speed/createOrUpdateSpeedOfferForm.jsp +++ b/src/main/webapp/WEB-INF/jsp/offers/speed/createOrUpdateSpeedOfferForm.jsp @@ -4,37 +4,56 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> <%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %> -<%@ taglib prefix="petclinic" tagdir="/WEB-INF/tags" %> +<%@ taglib prefix="cheapy" tagdir="/WEB-INF/tags" %> + - -

- New SpeedOffer + +

+

- - - - - - - - + + + + + + + +
- - - - - - - - +
+ + + + + + + + +
- + +
+ +
+ + +
diff --git a/src/main/webapp/WEB-INF/jsp/offers/speed/speedOffersShow.jsp b/src/main/webapp/WEB-INF/jsp/offers/speed/speedOffersShow.jsp index 54d492ac2..d39923fb1 100644 --- a/src/main/webapp/WEB-INF/jsp/offers/speed/speedOffersShow.jsp +++ b/src/main/webapp/WEB-INF/jsp/offers/speed/speedOffersShow.jsp @@ -22,53 +22,69 @@ - + - + - + - + - + - + - -
- + +
+
+ +
+ +
+ + + + + + + + + + + + + + +
- - - - Editar oferta - - - - - Activar oferta - - - - - Desactivar oferta + diff --git a/src/main/webapp/WEB-INF/jsp/offers/time/createOrUpdateTimeOfferForm.jsp b/src/main/webapp/WEB-INF/jsp/offers/time/createOrUpdateTimeOfferForm.jsp index cd12ad6fc..51c188e8d 100644 --- a/src/main/webapp/WEB-INF/jsp/offers/time/createOrUpdateTimeOfferForm.jsp +++ b/src/main/webapp/WEB-INF/jsp/offers/time/createOrUpdateTimeOfferForm.jsp @@ -4,37 +4,56 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> <%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %> -<%@ taglib prefix="petclinic" tagdir="/WEB-INF/tags" %> +<%@ taglib prefix="cheapy" tagdir="/WEB-INF/tags" %> + - -

- New TimeOffer + +

+

- - - - - - + + + + + +
- - - - - - - - +
+ + + + + + + + +
- + +
+ +
+ + +
diff --git a/src/main/webapp/WEB-INF/jsp/offers/time/timeOffersShow.jsp b/src/main/webapp/WEB-INF/jsp/offers/time/timeOffersShow.jsp index a291144d9..00be22400 100644 --- a/src/main/webapp/WEB-INF/jsp/offers/time/timeOffersShow.jsp +++ b/src/main/webapp/WEB-INF/jsp/offers/time/timeOffersShow.jsp @@ -11,7 +11,7 @@

- +
@@ -21,9 +21,17 @@ + + + + + + + + - + @@ -32,25 +40,42 @@
- - - - Editar oferta - - - - - Activar oferta - - - - - Desactivar oferta +
+
+ +
-
- +
+ + + + + + + + + + + + + + +
- + + + + diff --git a/src/main/webapp/WEB-INF/jsp/welcome.jsp b/src/main/webapp/WEB-INF/jsp/welcome.jsp index 95c506f42..7f7ac42a2 100644 --- a/src/main/webapp/WEB-INF/jsp/welcome.jsp +++ b/src/main/webapp/WEB-INF/jsp/welcome.jsp @@ -1,11 +1,14 @@ <%@ page session="false" trimDirectiveWhitespaces="true" %> <%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %> <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> +<%@ 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="sec" uri="http://www.springframework.org/security/tags" %> - +

@@ -14,10 +17,19 @@
-
+ + +
+ +
+
+
diff --git a/src/main/webapp/WEB-INF/tags/inputField.tag b/src/main/webapp/WEB-INF/tags/inputField.tag index 0db10f39d..72de53f0b 100644 --- a/src/main/webapp/WEB-INF/tags/inputField.tag +++ b/src/main/webapp/WEB-INF/tags/inputField.tag @@ -5,15 +5,17 @@ description="Name of corresponding property in bean object" %> <%@ 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="Placeholder para los campos en los input fields" %>
- +
- +