diff --git a/src/main/java/org/springframework/cheapy/web/OfertaController.java b/src/main/java/org/springframework/cheapy/web/OfertaController.java index b2b302cf9..2b82b91dc 100644 --- a/src/main/java/org/springframework/cheapy/web/OfertaController.java +++ b/src/main/java/org/springframework/cheapy/web/OfertaController.java @@ -2,11 +2,14 @@ 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; import org.springframework.cheapy.model.FoodOffer; import org.springframework.cheapy.model.NuOffer; +import org.springframework.cheapy.model.Offer; import org.springframework.cheapy.model.SpeedOffer; import org.springframework.cheapy.model.TimeOffer; import org.springframework.cheapy.service.ClientService; @@ -123,7 +126,38 @@ 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)) { + datos.put(of, "food"); + } + + for(Offer of:this.nuOfferService.findAllNuOffer(p)) { + datos.put(of, "nu"); + } + + for(Offer of:this.speedOfferService.findAllSpeedOffer(p)) { + datos.put(of, "speed"); + } + + for(Offer of:this.timeOfferService.findAllTimeOffer(p)) { + datos.put(of, "time"); + } + + model.put("datos", datos); + //Se aƱade formateador de fecha al modelo + model.put("localDateTimeFormat", DateTimeFormatter.ofPattern("dd/MM/yyyy HH:mm")); + + 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/webapp/WEB-INF/jsp/offers/offersRecordList.jsp b/src/main/webapp/WEB-INF/jsp/offers/offersRecordList.jsp new file mode 100644 index 000000000..22e141745 --- /dev/null +++ b/src/main/webapp/WEB-INF/jsp/offers/offersRecordList.jsp @@ -0,0 +1,74 @@ +<%@ 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" %> + + + +

Registro de Ofertas

+ +

No hay ninguna oferta creada.

+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
RestauranteTipo de oferta
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+
+
+
diff --git a/src/main/webapp/WEB-INF/tags/menu.tag b/src/main/webapp/WEB-INF/tags/menu.tag index 6a5cc797c..4ed9e3984 100644 --- a/src/main/webapp/WEB-INF/tags/menu.tag +++ b/src/main/webapp/WEB-INF/tags/menu.tag @@ -53,6 +53,13 @@ Usuarios + + + + + Registro de ofertas + +