Filtros por tipo de oferta

This commit is contained in:
Javier 2021-04-08 20:20:22 +02:00
parent 54cdcb0546
commit fd402a182c
9 changed files with 396 additions and 0 deletions

View file

@ -2,6 +2,7 @@
package org.springframework.cheapy.web;
import java.time.format.DateTimeFormatter;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
@ -60,6 +61,15 @@ public class FoodOfferController {
}
return res;
}
@GetMapping("/offers/foodOfferList")
public String processFindForm(Map<String, Object> model) {
List<FoodOffer> foodOfferLs=this.foodOfferService.findActiveFoodOffer();
model.put("foodOfferLs", foodOfferLs);
model.put("localDateTimeFormat", DateTimeFormatter.ofPattern("dd/MM/yyyy HH:mm"));
return "offers/food/foodOffersList";
}
@GetMapping("/offers/food/new")
public String initCreationForm(Map<String, Object> model) {

View file

@ -2,6 +2,7 @@ package org.springframework.cheapy.web;
import java.security.Principal;
import java.time.format.DateTimeFormatter;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
@ -79,6 +80,15 @@ public class NuOfferController {
}
return res;
}
@GetMapping("/offers/nuOfferList")
public String processFindForm(Map<String, Object> model) {
List<NuOffer> foodOfferLs=this.nuOfferService.findActiveNuOffer();
model.put("nuOfferLs", foodOfferLs);
model.put("localDateTimeFormat", DateTimeFormatter.ofPattern("dd/MM/yyyy HH:mm"));
return "offers/nu/nuOffersList";
}
@GetMapping("/offers/nu/new")
public String initCreationForm(Map<String, Object> model) {

View file

@ -1,6 +1,7 @@
package org.springframework.cheapy.web;
import java.time.format.DateTimeFormatter;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
@ -78,6 +79,15 @@ public class SpeedOfferController {
}
return res;
}
@GetMapping("/offers/speedOfferList")
public String processFindForm(Map<String, Object> model) {
List<SpeedOffer> speedOfferLs=this.speedOfferService.findActiveSpeedOffer();
model.put("speedOfferLs", speedOfferLs);
model.put("localDateTimeFormat", DateTimeFormatter.ofPattern("dd/MM/yyyy HH:mm"));
return "offers/speed/speedOffersList";
}
@GetMapping("/offers/speed/new")
public String initCreationForm(Map<String, Object> model) {

View file

@ -1,6 +1,7 @@
package org.springframework.cheapy.web;
import java.time.format.DateTimeFormatter;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
@ -66,6 +67,15 @@ public class TimeOfferController {
}
return res;
}
@GetMapping("/offers/timeOfferList")
public String processFindForm(Map<String, Object> model) {
List<TimeOffer> timeOfferLs=this.timeOfferService.findActiveTimeOffer();
model.put("timeOfferLs", timeOfferLs);
model.put("localDateTimeFormat", DateTimeFormatter.ofPattern("dd/MM/yyyy HH:mm"));
return "offers/time/timeOffersList";
}
@GetMapping("/offers/time/new")
public String initCreationForm(Map<String, Object> model) {

View file

@ -0,0 +1,85 @@
<%@ 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" %>
<link href='https://fonts.googleapis.com/css?family=Lobster' rel='stylesheet'>
<cheapy:layout pageName="ofertas de plato especifico">
<spring:url value="/offers/nuOfferList" var="nuOfferUrl">
</spring:url>
<button type="button" role="link" onclick="window.location='/offers/nuOfferList'" style="font-family: 'Lobster'; font-size: 20px;">
<span class="glyphicon glyphicon glyphicon-edit" aria-hidden="true" style="padding: 5px"> </span>
Ofertas por número de comensales</button>
<spring:url value="/offers/speedOfferList" var="speedOfferUrl">
</spring:url>
<button type="button" role="link" onclick="window.location='/offers/speedOfferList'" style="font-family: 'Lobster'; font-size: 20px;">
<span class="glyphicon glyphicon glyphicon-edit" aria-hidden="true" style="padding: 5px"> </span>
Ofertas de velocidad</button>
<spring:url value="/offers/timeOfferList" var="timeOfferUrl">
</spring:url>
<button type="button" role="link" onclick="window.location='/offers/timeOfferList'" style="font-family: 'Lobster'; font-size: 20px;">
<span class="glyphicon glyphicon glyphicon-edit" aria-hidden="true" style="padding: 5px"> </span>
Ofertas de franja horaria</button>
<h2 style="text-align:center;padding:5px"><fmt:message key="foodOffers"/></h2>
<c:if test="${empty foodOfferLs }">
<p id="vacio" >No hay ninguna oferta por plato específico activa.</p>
</c:if>
<c:if test="${not empty foodOfferLs }">
<table id="foodOfferTable" class="table table-striped">
<thead>
<tr>
<!-- <th style="width: 150px;">Restaurante</th> -->
<th><fmt:message key="name"/></th>
<th><fmt:message key="food"/></th>
<th><fmt:message key="discount"/></th>
<th><fmt:message key="startDate"/></th>
<th><fmt:message key="endDate"/></th>
<th> </th>
</tr>
</thead>
<tbody>
<c:forEach items="${foodOfferLs}" var="foodOffer">
<tr>
<td>
<c:out value="${foodOffer.client.name}"/>
</td>
<td>
<c:out value="${foodOffer.food}"/>
</td>
<td>
<c:out value="${foodOffer.discount}%"/>
</td>
<td>
<c:out value="${localDateTimeFormat.format(foodOffer.start)}"/>
</td>
<td>
<c:out value="${localDateTimeFormat.format(foodOffer.end)}"/>
</td>
<td>
<spring:url value="/offers/food/{foodOfferId}" var="foodOfferUrl">
<spring:param name="foodOfferId" value="${foodOffer.id}"/>
</spring:url>
<div class="btn-detalles">
<button type="button" role="link" onclick="window.location='${fn:escapeXml(foodOfferUrl)}'" style="font-family: 'Lobster'; font-size: 20px;">
<span class="glyphicon glyphicon-info-sign" aria-hidden="true" style="padding: 5px"> </span>
<fmt:message key="details"/></button>
</div>
</td>
</tr>
</c:forEach>
</tbody>
</table>
</c:if>
</cheapy:layout>

View file

@ -0,0 +1,82 @@
<%@ 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" %>
<link href='https://fonts.googleapis.com/css?family=Lobster' rel='stylesheet'>
<cheapy:layout pageName="ofertas">
<spring:url value="/offers/foodOfferList" var="foodOfferUrl">
</spring:url>
<button type="button" role="link" onclick="window.location='/offers/foodOfferList'" style="font-family: 'Lobster'; font-size: 20px;">
<span class="glyphicon glyphicon glyphicon-edit" aria-hidden="true" style="padding: 5px"> </span>
Ofertas de plato especifico</button>
<spring:url value="/offers/speedOfferList" var="speedOfferUrl">
</spring:url>
<button type="button" role="link" onclick="window.location='/offers/speedOfferList'" style="font-family: 'Lobster'; font-size: 20px;">
<span class="glyphicon glyphicon glyphicon-edit" aria-hidden="true" style="padding: 5px"> </span>
Ofertas de velocidad</button>
<spring:url value="/offers/timeOfferList" var="timeOfferUrl">
</spring:url>
<button type="button" role="link" onclick="window.location='/offers/timeOfferList'" style="font-family: 'Lobster'; font-size: 20px;">
<span class="glyphicon glyphicon glyphicon-edit" aria-hidden="true" style="padding: 5px"> </span>
Ofertas de franja horaria</button>
<h2 style="text-align:center;padding:5px"><fmt:message key="nuOffers"/></h2>
<c:if test="${empty nuOfferLs }">
<p id="vacio" >No hay ninguna oferta por número de comensales activa.</p>
</c:if>
<c:if test="${not empty nuOfferLs }">
<table id="nuOfferTable" class="table table-striped">
<thead>
<tr>
<!-- <th style="width: 150px;">Restaurante</th> -->
<th><fmt:message key="name"/></th>
<th><fmt:message key="startDate"/></th>
<th><fmt:message key="endDate"/></th>
<th><fmt:message key="goldGoal"/></th>
<th><fmt:message key="goldDiscount"/></th>
<th> </th>
</tr>
</thead>
<tbody>
<c:forEach items="${nuOfferLs}" var="nuOffer">
<tr>
<td>
<c:out value="${nuOffer.client.name}"/>
</td>
<td>
<c:out value="${localDateTimeFormat.format(nuOffer.start)}"/>
</td>
<td>
<c:out value="${localDateTimeFormat.format(nuOffer.end)}"/>
</td>
<td>
<c:out value="${nuOffer.gold} comensales"/>
</td>
<td>
<c:out value="${nuOffer.discountGold}%"/>
</td>
<td>
<spring:url value="/offers/nu/{nuOfferId}" var="nuOfferUrl">
<spring:param name="nuOfferId" value="${nuOffer.id}"/>
</spring:url>
<div class="btn-detalles">
<button type="button" role="link" onclick="window.location='${fn:escapeXml(nuOfferUrl)}'" class="btn-detalles" style="font-family: 'Lobster'; font-size: 20px;">
<span class="glyphicon glyphicon-info-sign" aria-hidden="true" style="padding: 5px"> </span>
<fmt:message key="details"/> </button>
</div>
</td>
</tr>
</c:forEach>
</tbody>
</table>
</c:if>
</cheapy:layout>

View file

@ -8,6 +8,31 @@
<link href='https://fonts.googleapis.com/css?family=Lobster' rel='stylesheet'>
<cheapy:layout pageName="ofertas">
<spring:url value="/offers/foodOfferList" var="foodOfferUrl">
</spring:url>
<button type="button" role="link" onclick="window.location='/offers/foodOfferList'" style="font-family: 'Lobster'; font-size: 20px;">
<span class="glyphicon glyphicon glyphicon-edit" aria-hidden="true" style="padding: 5px"> </span>
Ofertas de plato especifico</button>
<spring:url value="/offers/nuOfferList" var="nuOfferUrl">
</spring:url>
<button type="button" role="link" onclick="window.location='/offers/nuOfferList'" style="font-family: 'Lobster'; font-size: 20px;">
<span class="glyphicon glyphicon glyphicon-edit" aria-hidden="true" style="padding: 5px"> </span>
Ofertas por número de comensales</button>
<spring:url value="/offers/speedOfferList" var="speedOfferUrl">
</spring:url>
<button type="button" role="link" onclick="window.location='/offers/speedOfferList'" style="font-family: 'Lobster'; font-size: 20px;">
<span class="glyphicon glyphicon glyphicon-edit" aria-hidden="true" style="padding: 5px"> </span>
Ofertas de velocidad</button>
<spring:url value="/offers/timeOfferList" var="timeOfferUrl">
</spring:url>
<button type="button" role="link" onclick="window.location='/offers/timeOfferList'" style="font-family: 'Lobster'; font-size: 20px;">
<span class="glyphicon glyphicon glyphicon-edit" aria-hidden="true" style="padding: 5px"> </span>
Ofertas de franja horaria</button>
<h2 style="text-align:center;padding:5px"><fmt:message key="foodOffers"/></h2>
<c:if test="${empty foodOfferLs }">

View file

@ -0,0 +1,82 @@
<%@ 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" %>
<link href='https://fonts.googleapis.com/css?family=Lobster' rel='stylesheet'>
<cheapy:layout pageName="ofertas">
<spring:url value="/offers/foodOfferList" var="foodOfferUrl">
</spring:url>
<button type="button" role="link" onclick="window.location='/offers/foodOfferList'" style="font-family: 'Lobster'; font-size: 20px;">
<span class="glyphicon glyphicon glyphicon-edit" aria-hidden="true" style="padding: 5px"> </span>
Ofertas de plato especifico</button>
<spring:url value="/offers/nuOfferList" var="nuOfferUrl">
</spring:url>
<button type="button" role="link" onclick="window.location='/offers/nuOfferList'" style="font-family: 'Lobster'; font-size: 20px;">
<span class="glyphicon glyphicon glyphicon-edit" aria-hidden="true" style="padding: 5px"> </span>
Ofertas por número de comensales</button>
<spring:url value="/offers/timeOfferList" var="timeOfferUrl">
</spring:url>
<button type="button" role="link" onclick="window.location='/offers/timeOfferList'" style="font-family: 'Lobster'; font-size: 20px;">
<span class="glyphicon glyphicon glyphicon-edit" aria-hidden="true" style="padding: 5px"> </span>
Ofertas de franja horaria</button>
<h2 style="text-align:center;padding:5px"><fmt:message key="speedOffers"/></h2>
<c:if test="${empty speedOfferLs }">
<p id="vacio" >No hay ninguna oferta por tiempo empleado en comer activa.</p>
</c:if>
<c:if test="${not empty speedOfferLs }">
<table id="speedOfferTable" class="table table-striped">
<thead>
<tr>
<!-- <th style="width: 150px;">Restaurante</th> -->
<th><fmt:message key="name"/></th>
<th><fmt:message key="startDate"/></th>
<th><fmt:message key="endDate"/></th>
<th><fmt:message key="goldGoal"/></th>
<th><fmt:message key="goldDiscount"/></th>
<th> </th>
</tr>
</thead>
<tbody>
<c:forEach items="${speedOfferLs}" var="speedOffer">
<tr>
<td>
<c:out value="${speedOffer.client.name}"/>
</td>
<td>
<c:out value="${localDateTimeFormat.format(speedOffer.start)}"/>
</td>
<td>
<c:out value="${localDateTimeFormat.format(speedOffer.end)}"/>
</td>
<td>
<c:out value="${speedOffer.gold} minutos"/>
</td>
<td>
<c:out value="${speedOffer.discountGold}%"/>
</td>
<td>
<spring:url value="/offers/speed/{speedOfferId}" var="speedOfferUrl">
<spring:param name="speedOfferId" value="${speedOffer.id}"/>
</spring:url>
<div class="btn-detalles">
<button type="button" role="link" onclick="window.location='${fn:escapeXml(speedOfferUrl)}'" class="btn-detalles" style="font-family: 'Lobster'; font-size: 20px;">
<span class="glyphicon glyphicon-info-sign" aria-hidden="true" style="padding: 5px"> </span>
<fmt:message key="details"/> </button>
</div>
</td>
</tr>
</c:forEach>
</tbody>
</table>
</c:if>
</cheapy:layout>

View file

@ -0,0 +1,82 @@
<%@ 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" %>
<link href='https://fonts.googleapis.com/css?family=Lobster' rel='stylesheet'>
<cheapy:layout pageName="ofertas">
<spring:url value="/offers/foodOfferList" var="foodOfferUrl">
</spring:url>
<button type="button" role="link" onclick="window.location='/offers/foodOfferList'" style="font-family: 'Lobster'; font-size: 20px;">
<span class="glyphicon glyphicon glyphicon-edit" aria-hidden="true" style="padding: 5px"> </span>
Ofertas de plato especifico</button>
<spring:url value="/offers/nuOfferList" var="nuOfferUrl">
</spring:url>
<button type="button" role="link" onclick="window.location='/offers/nuOfferList'" style="font-family: 'Lobster'; font-size: 20px;">
<span class="glyphicon glyphicon glyphicon-edit" aria-hidden="true" style="padding: 5px"> </span>
Ofertas por número de comensales</button>
<spring:url value="/offers/speedOfferList" var="speedOfferUrl">
</spring:url>
<button type="button" role="link" onclick="window.location='/offers/speedOfferList'" style="font-family: 'Lobster'; font-size: 20px;">
<span class="glyphicon glyphicon glyphicon-edit" aria-hidden="true" style="padding: 5px"> </span>
Ofertas de velocidad</button>
<h2 style="text-align:center;padding:5px"><fmt:message key="timeOffers"/></h2>
<c:if test="${empty timeOfferLs }">
<p id="vacio" >No hay ninguna oferta por franja horaria activa.</p>
</c:if>
<c:if test="${not empty timeOfferLs }">
<table id="timeOfferTable" class="table table-striped">
<thead>
<tr>
<!-- <th style="width: 150px;">Restaurante</th> -->
<th><fmt:message key="name"/></th>
<th><fmt:message key="startDate"/></th>
<th><fmt:message key="endDate"/></th>
<th><fmt:message key="init"/></th>
<th><fmt:message key="finishOffer"/></th>
<th> </th>
</tr>
</thead>
<tbody>
<c:forEach items="${timeOfferLs}" var="timeOffer">
<tr>
<td>
<c:out value="${timeOffer.client.name}"/>
</td>
<td>
<c:out value="${localDateTimeFormat.format(timeOffer.start)}"/>
</td>
<td>
<c:out value="${localDateTimeFormat.format(timeOffer.end)}"/>
</td>
<td>
<c:out value="${timeOffer.init}h"/>
</td>
<td>
<c:out value="${timeOffer.finish}h"/>
</td>
<td>
<spring:url value="/offers/time/{timeOfferId}" var="timeOfferUrl">
<spring:param name="timeOfferId" value="${timeOffer.id}"/>
</spring:url>
<div class="btn-detalles">
<button type="button" role="link" onclick="window.location='${fn:escapeXml(timeOfferUrl)}'" class="btn-detalles" style="font-family: 'Lobster'; font-size: 20px;">
<span class="glyphicon glyphicon-info-sign" aria-hidden="true" style="padding: 5px"> </span>
<fmt:message key="details"/> </button>
</div>
</td>
</tr>
</c:forEach>
</tbody>
</table>
</c:if>
</cheapy:layout>