Merge branch 'develop' into 013-validaciones

This commit is contained in:
Thiloparn 2021-04-02 20:31:43 +02:00 committed by GitHub
commit 52b8e62f57
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
22 changed files with 863 additions and 412 deletions

View file

@ -44,11 +44,14 @@ public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
.antMatchers("/owners/**").hasAnyAuthority("owner", "admin")
.antMatchers("/offers/**/edit").hasAnyAuthority("admin", "client")
.antMatchers("/offers/**/new").hasAnyAuthority("admin", "client")
.antMatchers("/offers/**/activate").hasAnyAuthority("admin","client")
.antMatchers("/clients/new").permitAll()
.antMatchers("/offers/**").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());
}

View file

@ -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<NuOffer> nuOfferLs=this.nuOfferService.findActiveNuOffer();
List<SpeedOffer> speedOfferLs=this.speedOfferService.findActiveSpeedOffer();
List<TimeOffer> 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<String, Object> model) {
int actual = this.clientService.getCurrentClient().getId();
List<FoodOffer> foodOfferLs = this.foodOfferService.findFoodOfferByUserId(actual);
List<NuOffer> nuOfferLs = this.nuOfferService.findNuOfferByUserId(actual);
List<SpeedOffer> speedOfferLs = this.speedOfferService.findSpeedOfferByUserId(actual);
List<TimeOffer> 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;
// }
}

View file

@ -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){
@ -364,6 +488,13 @@ img.img-responsive{
background-color: rgb(204, 128, 51);
}
#vacio {
text-align:center;
font-size: 120%;
padding:10px;
color: rgb(29, 142, 226);
}
.alert-success {
.alert-variant(fade(@alert-success-bg, 70%); @alert-success-border; @alert-success-text);
}

View file

@ -1,5 +1,10 @@
welcome=Bienvenido a
new=Nueva
deleteOffer=Eliminar Oferta
cancel=Cancelar
deleteOfferMessage=Confirme que quiere eliminar su oferta
listOffers=Ver Ofertas
createOffers=Crear Ofertas
foodOffers=Ofertas por plato específico
foodOffer=Oferta por plato específico
nuOffers=Ofertas por número de comensales
@ -31,4 +36,10 @@ duplicate=Ya se encuentra en uso
nonNumeric=Solo debe contener números
duplicateFormSubmission=No se permite el envío de formularios duplicados
typeMismatch.date=Fecha inválida
typeMismatch.birthDate=Fecha inválida
typeMismatch.birthDate=Fecha inválida
createFoodOffers= Crear ofertas por plato espec<65>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

View file

@ -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" %>
<link href='https://fonts.googleapis.com/css?family=Lobster' rel='stylesheet'>
@ -275,25 +277,29 @@
<div class="wrapper fadeInDown">
<div id="formContent">
<!-- Tabs Titles -->
<!-- Icon -->
<div class="fadeIn first">
<img src="/resources/images/Logo Cheapy.png" id="icon" />
<c:if test= "${not empty param}" >
<p class="text-danger"> El usuario y/o la contraseña son incorrectos </p>
</c:if>
</div>
<div th:if="${param.error}">
<p class="text-danger">Nombre de usuario o contraseña inválido</p>
<p class="text-danger">Nombre de usuario o contraseña inválido</p>
</div>
<!-- Login Form -->
<form class='form-signin' action="/login" method='POST'>
<input type="text" id="username" class="fadeIn second" name="username" placeholder="nombre de usuario" required autofocus>
<input type="password" id="password" class="fadeIn third" name="password" placeholder="contraseña" required>
<input type="password" id="password" class="fadeIn third" name="password" placeholder="contraseña" required>
<sec:csrfInput />
<input type="submit" class="fadeIn fourth" value="Acceder">
</form>
<!-- Remind Passowrd -->
<!-- Remind Passowrd
<div id="formFooter">
<a class="underlineHover" href="#">¿Olvidó su contraseña?</a>
<a class="underlineHover" href="#">¿Olvidó su contraseña?</a>
</div>
</div>

View file

@ -5,10 +5,11 @@
<%@ 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" %>
<link href='https://fonts.googleapis.com/css?family=Lobster' rel='stylesheet'>
<cheapy:layout pageName="foodOffers">
<h2>
<c:if test="${foodOffer['new']}">Nueva </c:if> Oferta de plato específico
<h2 style="text-align:center;padding:5px">
<c:if test="${foodOffer['new']}"><fmt:message key="new"/> </c:if> <fmt:message key="foodOffer"/>
</h2>
<form:form modelAttribute="foodOffer" class="form-horizontal" id="add-foodOffer-form">
@ -16,22 +17,40 @@
<form:hidden path="id"/>
<form:hidden path="code"/>
<form:hidden path="status"/>
<cheapy:inputField label="Fecha de inicio" placeholder="15/06/2021 14:00" name="start"/>
<cheapy:inputField label="Fecha de fin" placeholder="15/06/2021 16:00" name="end"/>
<cheapy:inputField label="Comida" name="food"/>
<cheapy:inputField label="Descuento" name="discount"/>
<cheapy:inputField label="Fecha de Inicio" placeholder="dd/MM/yyyy HH:mm" name="start"/>
<cheapy:inputField label="Fecha de Fin" placeholder="dd/MM/yyyy HH:mm" name="end"/>
<cheapy:inputField label="Plato" placeholder="Ej. Macarrones" name="food"/>
<cheapy:inputField label="Descuento" placeholder="Ej. 50" name="discount"/>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<c:choose>
<c:when test="${foodOffer['new']}">
<button class="btn btn-default" type="submit">Crear oferta</button>
</c:when>
<c:otherwise>
<button class="btn btn-default" type="submit">Modificar</button>
</c:otherwise>
</c:choose>
<div class="btn-mod">
<c:choose>
<c:when test="${foodOffer['new']}">
<button class="btn btn-default" type="submit" style="font-family: 'Lobster'; font-size: 20px;">
<span class="glyphicon glyphicon-floppy-save" aria-hidden="true" style="padding: 5px"> </span>
Crear oferta</button>
</c:when>
<c:otherwise>
<button class="btn btn-default" type="submit" style="font-family: 'Lobster'; font-size: 20px;">
<span class="glyphicon glyphicon-floppy-save" aria-hidden="true" style="padding: 5px"> </span>
Modificar</button>
</c:otherwise>
</c:choose>
</div>
</div>
</div>
</form:form>
<div class="btn-return">
<button type="button" role="link" onclick="goBack()" style="font-family: 'Lobster'; font-size: 20px;">
<span class="glyphicon glyphicon-arrow-left" aria-hidden="true" style="padding: 5px"> </span>
<fmt:message key="return"/> </button>
</div>
<script>
function goBack() {
window.history.back()
}
</script>
</cheapy:layout>

View file

@ -8,9 +8,13 @@
<cheapy:layout pageName="foodOffer">
<jsp:body>
<h2> ¿Está seguro de que quiere eliminar su oferta? </h2>
<h2> ¿Está seguro de que quiere eliminar su oferta? </h2>
<form:form modelAttribute="foodOffer" class="form-horizontal">
<input type="hidden" name="food" value="${foodOffer.food}" />
<input type="hidden" name="discount" value="${foodOffer.discount}" />
<button class="btn btn-default" type="submit">Eliminar Oferta</button>
</form:form>

View file

@ -1,73 +1,84 @@
<%@ 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'>
<%@ 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="foodOffer">
<h2 style="text-align: center; padding: 5px">
<fmt:message key="foodOffer" />
</h2>
<h2 style="text-align:center;padding:5px"><fmt:message key="foodOffer"/></h2>
<table class="table table-striped" id="foodOfferTable">
<thead>
<tr>
<th><fmt:message key="offerBeginning" /></th>
<td><c:out
value="${localDateTimeFormat.format(foodOffer.start)}" /></td>
</tr>
<tr>
<th><fmt:message key="offerEnding" /></th>
<td><c:out value="${localDateTimeFormat.format(foodOffer.end)}" /></td>
</tr>
<tr>
<th><fmt:message key="foodInOffer" /></th>
<td><c:out value="${foodOffer.food}" /></td>
</tr>
<tr>
<th><fmt:message key="discount" /></th>
<td><c:out value="${foodOffer.discount} %" /></td>
</tr>
<table class="table table-striped" id="foodOfferTable">
<thead>
<tr>
<th><fmt:message key="offerBeginning"/></th>
<td><c:out value="${localDateTimeFormat.format(foodOffer.start)}"/></td>
</tr>
<tr>
<th><fmt:message key="offerEnding"/></th>
<td><c:out value="${localDateTimeFormat.format(foodOffer.end)}"/></td>
</tr>
<tr>
<th><fmt:message key="foodInOffer"/></th>
<td><c:out value="${foodOffer.food}"/></td>
</tr>
<tr>
<th><fmt:message key="discount"/></th>
<td><c:out value="${foodOffer.discount}%"/> </td>
</tr>
<tr>
<th><fmt:message key="offerCode" /></th>
<td><c:out value="${foodOffer.code}" /></td>
</tr>
</thead>
</table>
<div class="btn-return">
<button type="button" role="link" onclick="window.location='/offers'"
style="font-family: 'Lobster'; font-size: 20px;">
<span class="glyphicon glyphicon-arrow-left" aria-hidden="true"
style="padding: 5px"> </span>
<fmt:message key="return" />
</button>
</div>
<tr>
<th><fmt:message key="offerCode"/></th>
<td><c:out value="${foodOffer.code}"/></td>
</tr>
</thead>
</table>
<div class="btn-menu">
<div class="btn-return">
<button type="button" role="link" onclick="goBack()" style="font-family: 'Lobster'; font-size: 20px;">
<span class="glyphicon glyphicon-arrow-left" aria-hidden="true" style="padding: 5px"> </span>
<fmt:message key="return"/> </button>
</div>
<sec:authorize access="hasAnyAuthority('client')">
<spring:url value="{foodOfferId}/edit" var="editUrl">
<spring:param name="foodOfferId" value="${foodOffer.id}" />
</spring:url>
<a href="${fn:escapeXml(editUrl)}" class="btn btn-default">Editar
oferta</a>
</sec:authorize>
<sec:authorize access="hasAnyAuthority('client')">
<spring:url value="{foodOfferId}/disable" var="editUrl">
<spring:param name="foodOfferId" value="${foodOffer.id}" />
</spring:url>
<a href="${fn:escapeXml(editUrl)}" class="btn btn-default">Desactivar
oferta</a>
<div class="btns-edit">
<spring:url value="{foodOfferId}/edit" var="editUrl">
<spring:param name="foodOfferId" value="${foodOffer.id}"/>
</spring:url>
<button type="button" role="link" onclick="window.location='${fn:escapeXml(editUrl)}'" style="font-family: 'Lobster'; font-size: 20px;">
<span class="glyphicon glyphicon glyphicon-edit" aria-hidden="true" style="padding: 5px"> </span>
Editar oferta</button>
<c:if test="${foodOffer.status eq 'inactive' }">
<spring:url value="{foodOfferId}/activate" var="activateUrl">
<spring:param name="foodOfferId" value="${foodOffer.id}"/>
</spring:url>
<button type="button" role="link" onclick="window.location='${fn:escapeXml(activateUrl)}'" style="font-family: 'Lobster'; font-size: 20px;">
<span class="glyphicon glyphicon glyphicon-edit" aria-hidden="true" style="padding: 5px"> </span>
Activar oferta</button>
</c:if>
<c:if test="${foodOffer.status eq 'active' }">
<spring:url value="{foodOfferId}/disable" var="deactivateUrl">
<spring:param name="foodOfferId" value="${foodOffer.id}"/>
</spring:url>
<button type="button" role="link" onclick="window.location='${fn:escapeXml(deactivateUrl)}'" style="font-family: 'Lobster'; font-size: 20px;">
<span class="glyphicon glyphicon glyphicon-trash" aria-hidden="true" style="padding: 5px"> </span>
Desactivar oferta</button>
</c:if>
</div>
</div>
</sec:authorize>
<script>
function goBack() {
window.history.back()
}
</script>
</cheapy:layout>

View file

@ -8,7 +8,10 @@
<cheapy:layout pageName="myOffers">
<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>
@ -16,7 +19,9 @@
<th><fmt:message key="food"/></th>
<th><fmt:message key="startDate"/></th>
<th><fmt:message key="endDate"/></th>
<th> </th>
<th> <spring:url value="/offers/food/new" var="newFoodUrl">
</spring:url>
<!-- <a href="${fn:escapeXml(newFoodUrl)}" class="btn btn-default">Nueva oferta</a></th>-->
</tr>
</thead>
<tbody>
@ -46,16 +51,21 @@
</c:forEach>
</tbody>
</table>
</c:if>
<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 plato específico 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="startDate"/></th>
<th><fmt:message key="endDate"/></th>
<th> </th>
<th> <spring:url value="/offers/nu/new" var="newNuUrl">
</spring:url>
<!-- <a href="${fn:escapeXml(newNuUrl)}" class="btn btn-default">Nueva oferta</a></th>-->
</tr>
</thead>
@ -83,15 +93,22 @@
</c:forEach>
</tbody>
</table>
</c:if>
<h2 style="text-align:center;padding:5px"><fmt:message key="speedOffers"/></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 speedOfferLs }">
<table id="speedOfferTable" class="table table-striped">
<thead>
<tr>
<!-- <th style="width: 150px;">Restaurante</th> -->
<th><fmt:message key="startDate"/></th>
<th><fmt:message key="endDate"/></th>
<th> </th>
<th> <spring:url value="/offers/speed/new" var="newSpeedUrl">
</spring:url>
<!-- <a href="${fn:escapeXml(newSpeedUrl)}" class="btn btn-default">Nueva oferta</a></th>-->
</tr>
</thead>
@ -120,15 +137,22 @@
</c:forEach>
</tbody>
</table>
</c:if>
<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 plato específico 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="startDate"/></th>
<th><fmt:message key="endDate"/></th>
<th> </th>
<th><spring:url value="/offers/time/new" var="newTimeUrl">
</spring:url>
<!--<a href="${fn:escapeXml(newTimeUrl)}" class="btn btn-default">Nueva oferta</a> </th>-->
</tr>
</thead>
<tbody>
@ -155,4 +179,5 @@
</c:forEach>
</tbody>
</table>
</c:if>
</cheapy:layout>

View file

@ -1,48 +1,61 @@
<%@ 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="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib prefix="cheapy" tagdir="/WEB-INF/tags"%>
<%@ 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="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib prefix="cheapy" tagdir="/WEB-INF/tags" %>
<link href='https://fonts.googleapis.com/css?family=Lobster' rel='stylesheet'>
<cheapy:layout pageName="NumOffers">
<h2>
<c:if test="${nuOffer['new']}">Nueva </c:if>
Oferta por número de comensales
</h2>
<form:form modelAttribute="nuOffer" class="form-horizontal"
id="add-nuOffer-form">
<div class="form-group has-feedback">
<form:hidden path="id" />
<form:hidden path="code" />
<form:hidden path="status" />
<h2 style="text-align:center;padding:5px">
<c:if test="${nuOffer['new']}"><fmt:message key="new"/> </c:if> <fmt:message key="nuOffer"/>
</h2>
<form:form modelAttribute="nuOffer" class="form-horizontal" id="add-nuOffer-form">
<div class="form-group has-feedback">
<form:hidden path="id"/>
<form:hidden path="code"/>
<form:hidden path="status"/>
<cheapy:inputField label="Fecha de Inicio" placeholder="dd/MM/yyyy HH:mm" name="start"/>
<cheapy:inputField label="Fecha de Fin" placeholder="dd/MM/yyyy HH:mm" name="end"/>
<cheapy:inputField label="Número de comensales (nivel Oro)" placeholder="XX (Ej. 6)" name="gold"/>
<cheapy:inputField label="Descuento de nivel oro" placeholder="XX% (Ej. 30)" name="discountGold"/>
<cheapy:inputField label="Número de comensales (nivel Plata)" placeholder="XX (Ej. 4)" name="silver"/>
<cheapy:inputField label="Descuento de plata" placeholder="XX% (Ej. 15)" name="discountSilver"/>
<cheapy:inputField label="Número de comensales (nivel Bronce)" placeholder="XX (Ej. 2)" name="bronze"/>
<cheapy:inputField label="Descuento de bronce" placeholder="XX% (Ej. 5)" name="discountBronze"/>
<cheapy:inputField label="Fecha de inicio"
placeholder="15/06/2021 14:00" name="start" />
<cheapy:inputField label="Fecha de fin"
placeholder="15/06/2021 16:00" name="end" />
<cheapy:inputField label="Oro" name="gold" />
<cheapy:inputField label="Descuento de oro" name="discountGold" />
<cheapy:inputField label="Plata" name="silver" />
<cheapy:inputField label="Descuento de plata" name="discountSilver" />
<cheapy:inputField label="Bronce" name="bronze" />
<cheapy:inputField label="Descuento de bronce" name="discountBronze" />
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<c:choose>
<c:when test="${nuOffer['new']}">
<button class="btn btn-default" type="submit">Crear
oferta</button>
</c:when>
<c:otherwise>
<button class="btn btn-default" type="submit">Modificar</button>
</c:otherwise>
</c:choose>
</div>
</div>
</form:form>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<div class="btn-mod">
<c:choose>
<c:when test="${nuOffer['new']}">
<button class="btn btn-default" type="submit" style="font-family: 'Lobster'; font-size: 20px;">
<span class="glyphicon glyphicon-floppy-save" aria-hidden="true" style="padding: 5px"> </span>
Crear oferta</button>
</c:when>
<c:otherwise>
<button class="btn btn-default" type="submit" style="font-family: 'Lobster'; font-size: 20px;">
<span class="glyphicon glyphicon-floppy-save" aria-hidden="true" style="padding: 5px"> </span>
Modificar</button>
</c:otherwise>
</c:choose>
</div>
</div>
</div>
</form:form>
<div class="btn-return">
<button type="button" role="link" onclick="goBack()" style="font-family: 'Lobster'; font-size: 20px;">
<span class="glyphicon glyphicon-arrow-left" aria-hidden="true" style="padding: 5px"> </span>
<fmt:message key="return"/> </button>
</div>
<script>
function goBack() {
window.history.back()
}
</script>
</cheapy:layout>

View file

@ -5,12 +5,19 @@
<%@ taglib prefix="cheapy" tagdir="/WEB-INF/tags"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<cheapy:layout pageName="nuOffer">
<petclinic:layout pageName="nuOfferDisable">
<jsp:body>
<h2> ¿Está seguro de que quiere dar de baja su oferta? </h2>
<h2> ¿Está seguro de que quiere dar de baja su offer? </h2>
<form:form modelAttribute="nuOffer" class="form-horizontal">
<input type="hidden" name="gold" value="${nuOffer.gold}" />
<input type="hidden" name="discountGold" value="${nuOffer.discountGold}" />
<input type="hidden" name="silver" value="${nuOffer.silver}" />
<input type="hidden" name="discountSilver" value="${nuOffer.discountSilver}" />
<input type="hidden" name="bronze" value="${nuOffer.bronze}" />
<input type="hidden" name="discountBronze" value="${nuOffer.discountBronze}" />
<button class="btn btn-default" type="submit">Dar de baja</button>
</form:form>

View file

@ -1,13 +1,11 @@
<%@ page session="false" trimDirectiveWhitespaces="true"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="cheapy" tagdir="/WEB-INF/tags"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="sec"
uri="http://www.springframework.org/security/tags"%>
<link href='https://fonts.googleapis.com/css?family=Lobster'
rel='stylesheet'>
<%@ page session="false" trimDirectiveWhitespaces="true" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="cheapy" tagdir="/WEB-INF/tags" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>
<link href='https://fonts.googleapis.com/css?family=Lobster' rel='stylesheet'>
<cheapy:layout pageName="nuOffer">
@ -15,69 +13,83 @@
<fmt:message key="nuOffer" />
</h2>
<table class="table table-striped" id="nuOffer-table">
<tr>
<th><fmt:message key="offerBeginning"/></th>
<td><c:out value="${localDateTimeFormat.format(nuOffer.start)}"/></td>
</tr>
<tr>
<th><fmt:message key="offerEnding"/></th>
<td><c:out value="${localDateTimeFormat.format(nuOffer.end)}"/></td>
</tr>
<tr>
<th><fmt:message key="goldGoal"/></th>
<td><c:out value="${nuOffer.gold} comensales" /></td>
</tr>
<tr>
<th><fmt:message key="goldDiscount"/></th>
<td><c:out value="${nuOffer.discountGold}%"/></td>
</tr>
<tr>
<th><fmt:message key="silverGoal"/></th>
<td><c:out value="${nuOffer.silver} comensales"/></td>
</tr>
<tr>
<th><fmt:message key="silverDiscount"/></th>
<td><c:out value="${nuOffer.discountSilver}%"/></td>
</tr>
<tr>
<th>Meta bronce</th>
<td><c:out value="${nuOffer.bronze} comensales"/></td>
</tr>
<tr>
<th><fmt:message key="bronzeDiscount"/></th>
<td><c:out value="${nuOffer.discountBronze}%"/></td>
</tr>
<tr>
<th><fmt:message key="offerCode"/></th>
<td><c:out value="${nuOffer.code}"/></td>
</tr>
</table>
<table class="table table-striped" id="nuOffer-table">
<tr>
<th><fmt:message key="offerBeginning" /></th>
<td><c:out value="${localDateTimeFormat.format(nuOffer.start)}" /></td>
</tr>
<tr>
<th><fmt:message key="offerEnding" /></th>
<td><c:out value="${localDateTimeFormat.format(nuOffer.end)}" /></td>
</tr>
<tr>
<th><fmt:message key="goldGoal" /></th>
<td><c:out value="${nuOffer.gold}" /></td>
</tr>
<tr>
<th><fmt:message key="goldDiscount" /></th>
<td><c:out value="${nuOffer.discountGold} %" /></td>
</tr>
<tr>
<th><fmt:message key="silverGoal" /></th>
<td><c:out value="${nuOffer.silver}" /></td>
</tr>
<tr>
<th><fmt:message key="silverDiscount" /></th>
<td><c:out value="${nuOffer.discountSilver} %" /></td>
</tr>
<tr>
<th><fmt:message key="bronzeGoal" /></th>
<td><c:out value="${nuOffer.bronze}" /></td>
</tr>
<tr>
<th><fmt:message key="bronzeDiscount" /></th>
<td><c:out value="${nuOffer.discountBronze} %" /></td>
</tr>
<tr>
<th><fmt:message key="offerCode" /></th>
<td><c:out value="${nuOffer.code}" /></td>
</tr>
</table>
<div class="btn-return">
<button type="button" role="link" onclick="window.location='/offers'"
style="font-family: 'Lobster'; font-size: 20px;">
<span class="glyphicon glyphicon-arrow-left" aria-hidden="true"
style="padding: 5px"> </span>
<fmt:message key="return" />
</button>
</div>
<div class="btn-menu">
<div class="btn-return">
<button type="button" role="link" onclick="goBack()" style="font-family: 'Lobster'; font-size: 20px;">
<span class="glyphicon glyphicon-arrow-left" aria-hidden="true" style="padding: 5px"> </span>
<fmt:message key="return"/> </button>
</div>
<sec:authorize access="hasAnyAuthority('client')">
<spring:url value="{nuOfferId}/edit" var="editUrl">
<spring:param name="nuOfferId" value="${nuOffer.id}" />
</spring:url>
<a href="${fn:escapeXml(editUrl)}" class="btn btn-default">Editar
oferta</a>
</sec:authorize>
<sec:authorize access="hasAnyAuthority('client')">
<spring:url value="{nuOfferId}/disable" var="editUrl">
<spring:param name="nuOfferId" value="${nuOffer.id}" />
</spring:url>
<a href="${fn:escapeXml(editUrl)}" class="btn btn-default">Desactivar
oferta</a>
<div class="btns-edit">
<spring:url value="{nuOfferId}/edit" var="editUrl">
<spring:param name="nuOfferId" value="${nuOffer.id}"/>
</spring:url>
<button type="button" role="link" onclick="window.location='${fn:escapeXml(editUrl)}'" style="font-family: 'Lobster'; font-size: 20px;">
<span class="glyphicon glyphicon glyphicon-edit" aria-hidden="true" style="padding: 5px"> </span>
Editar oferta</button>
<c:if test="${nuOffer.status eq 'inactive' }">
<spring:url value="{nuOfferId}/activate" var="activateUrl">
<spring:param name="nuOfferId" value="${nuOffer.id}"/>
</spring:url>
<button type="button" role="link" onclick="window.location='${fn:escapeXml(activateUrl)}'" style="font-family: 'Lobster'; font-size: 20px;">
<span class="glyphicon glyphicon glyphicon-edit" aria-hidden="true" style="padding: 5px"> </span>
Activar oferta</button>
</c:if>
<c:if test="${nuOffer.status eq 'active' }">
<spring:url value="{nuOfferId}/disable" var="deactivateUrl">
<spring:param name="nuOfferId" value="${nuOffer.id}"/>
</spring:url>
<button type="button" role="link" onclick="window.location='${fn:escapeXml(deactivateUrl)}'" style="font-family: 'Lobster'; font-size: 20px;">
<span class="glyphicon glyphicon glyphicon-trash" aria-hidden="true" style="padding: 5px"> </span>
Desactivar oferta</button>
</c:if>
</div>
</div>
</sec:authorize>
<script>
function goBack() {
window.history.back()
}
</script>
</cheapy:layout>

View file

@ -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" %>
<link href='https://fonts.googleapis.com/css?family=Lobster' rel='stylesheet'>
<cheapy:layout pageName="crearOfertas">
<div class="btn-create-max">
<div class="btn-create">
<button type="button" role="link" onclick="window.location='/offers/food/new'" style="font-family: 'Lobster'; font-size: 20px;">
<span class="glyphicon glyphicon-cutlery" aria-hidden="true" style="padding: 5px"> </span>
<fmt:message key="createFoodOffers"/> </button>
</div>
<div class="btn-create">
<button type="button" role="link" onclick="window.location='/offers/nu/new'" style="font-family: 'Lobster'; font-size: 20px;">
<span class="glyphicon glyphicon-cutlery" aria-hidden="true" style="padding: 5px"> </span>
<fmt:message key="createNuOffers"/> </button>
</div>
<div class="btn-create">
<button type="button" role="link" onclick="window.location='/offers/speed/new'" style="font-family: 'Lobster'; font-size: 20px;">
<span class="glyphicon glyphicon-cutlery" aria-hidden="true" style="padding: 5px"> </span>
<fmt:message key="createSpeedOffers"/> </button>
</div>
<div class="btn-create">
<button type="button" role="link" onclick="window.location='/offers/time/new'" style="font-family: 'Lobster'; font-size: 20px;">
<span class="glyphicon glyphicon-cutlery" aria-hidden="true" style="padding: 5px"> </span>
<fmt:message key="createTimeOffers"/> </button>
</div>
</div>
<div class="btn-return">
<button type="button" role="link" onclick="goBack()" style="font-family: 'Lobster'; font-size: 20px;">
<span class="glyphicon glyphicon-arrow-left" aria-hidden="true" style="padding: 5px"> </span>
<fmt:message key="return"/> </button>
</div>
<script>
function goBack() {
window.history.back()
}
</script>
</cheapy:layout>

View file

@ -8,12 +8,16 @@
<cheapy:layout pageName="ofertas">
<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="food"/></th>
<th><fmt:message key="discount"/></th>
<th><fmt:message key="startDate"/></th>
<th><fmt:message key="endDate"/></th>
<th> </th>
@ -25,6 +29,9 @@
<td>
<c:out value="${foodOffer.food}"/>
</td>
<td>
<c:out value="${foodOffer.discount}%"/>
</td>
<td>
<c:out value="${localDateTimeFormat.format(foodOffer.start)}"/>
</td>
@ -46,15 +53,20 @@
</c:forEach>
</tbody>
</table>
</c:if>
<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 plato específico 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="startDate"/></th>
<th><fmt:message key="endDate"/></th>
<th><fmt:message key="goldGoal"/></th>
<th><fmt:message key="goldDiscount"/></th>
<th> </th>
</tr>
@ -69,6 +81,12 @@
<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}"/>
@ -83,14 +101,21 @@
</c:forEach>
</tbody>
</table>
</c:if>
<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 plato específico 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="startDate"/></th>
<th><fmt:message key="endDate"/></th>
<th><fmt:message key="goldGoal"/></th>
<th><fmt:message key="goldDiscount"/></th>
<th> </th>
</tr>
@ -105,6 +130,12 @@
<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}"/>
@ -120,14 +151,21 @@
</c:forEach>
</tbody>
</table>
</c:if>
<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 plato específico 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="startDate"/></th>
<th><fmt:message key="endDate"/></th>
<th><fmt:message key="init"/></th>
<th><fmt:message key="finish"/></th>
<th> </th>
</tr>
</thead>
@ -141,6 +179,13 @@
<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}"/>
@ -155,4 +200,16 @@
</c:forEach>
</tbody>
</table>
</c:if>
<div class="btn-return">
<button type="button" role="link" onclick="goBack()" style="font-family: 'Lobster'; font-size: 20px;">
<span class="glyphicon glyphicon-arrow-left" aria-hidden="true" style="padding: 5px"> </span>
<fmt:message key="return"/> </button>
</div>
<script>
function goBack() {
window.history.back()
}
</script>
</cheapy:layout>

View file

@ -5,36 +5,55 @@
<%@ 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" %>
<link href='https://fonts.googleapis.com/css?family=Lobster' rel='stylesheet'>
<cheapy:layout pageName="speedOffers">
<h2>
<c:if test="${speedOffer['new']}">Nueva </c:if> Oferta por velocidad
<h2 style="text-align:center;padding:5px">
<c:if test="${speedOffer['new']}"><fmt:message key="new"/> </c:if> <fmt:message key="speedOffer"/>
</h2>
<form:form modelAttribute="speedOffer" class="form-horizontal" id="add-speedOffer-form">
<div class="form-group has-feedback">
<form:hidden path="id"/>
<form:hidden path="code"/>
<form:hidden path="status"/>
<cheapy:inputField label="Fecha de inicio" placeholder="15/06/2021 14:00" name="start"/>
<cheapy:inputField label="Fecha de fin" placeholder="15/06/2021 16:00" name="end"/>
<cheapy:inputField label="Oro" name="gold"/>
<cheapy:inputField label="Descuento oro" name="discountGold"/>
<cheapy:inputField label="Plata" name="silver"/>
<cheapy:inputField label="Descuento plata" name="discountSilver"/>
<cheapy:inputField label="Bronce" name="bronze"/>
<cheapy:inputField label="Descuento bronce" name="discountBronze"/>
<cheapy:inputField label="Fecha de Inicio" placeholder="dd/MM/yyyy HH:mm" name="start"/>
<cheapy:inputField label="Fecha de Fin" placeholder="dd/MM/yyyy HH:mm" name="end"/>
<cheapy:inputField label="Tiempo para comer (nivel Oro)" placeholder="XX minutos (Ej. 5)" name="gold"/>
<cheapy:inputField label="Descuento nivel Oro" placeholder="XX% (Ej. 35)" name="discountGold"/>
<cheapy:inputField label="Tiempo para comer (nivel Plata)" placeholder="XX minutos (Ej. 10)" name="silver"/>
<cheapy:inputField label="Descuento nivel Plata" placeholder="XX% (Ej. 15)" name="discountSilver"/>
<cheapy:inputField label="Tiempo para comer (nivel Bronce)" placeholder="XX minutos (Ej. 20)" name="bronze"/>
<cheapy:inputField label="Descuento nivel Bronce" placeholder="XX% (Ej. 5)" name="discountBronze"/>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<c:choose>
<c:when test="${speedOffer['new']}">
<button class="btn btn-default" type="submit">Crear oferta</button>
</c:when>
<c:otherwise>
<button class="btn btn-default" type="submit">Modificar</button>
</c:otherwise>
</c:choose>
<div class="btn-mod">
<c:choose>
<c:when test="${speedOffer['new']}">
<button class="btn btn-default" type="submit" style="font-family: 'Lobster'; font-size: 20px;">
<span class="glyphicon glyphicon-floppy-save" aria-hidden="true" style="padding: 5px"> </span>
Crear oferta</button>
</c:when>
<c:otherwise>
<button class="btn btn-default" type="submit" style="font-family: 'Lobster'; font-size: 20px;">
<span class="glyphicon glyphicon-floppy-save" aria-hidden="true" style="padding: 5px"> </span>
Modificar</button>
</c:otherwise>
</c:choose>
</div>
</div>
</div>
</form:form>
<div class="btn-return">
<button type="button" role="link" onclick="goBack()" style="font-family: 'Lobster'; font-size: 20px;">
<span class="glyphicon glyphicon-arrow-left" aria-hidden="true" style="padding: 5px"> </span>
<fmt:message key="return"/> </button>
</div>
<script>
function goBack() {
window.history.back()
}
</script>
</cheapy:layout>

View file

@ -8,9 +8,17 @@
<cheapy:layout pageName="speedOffer">
<jsp:body>
<h2> ¿Está seguro de que quiere dar de baja su oferta? </h2>
<h2> <EFBFBD>Est<EFBFBD> seguro de que quiere dar de baja su oferta? </h2>
<form:form modelAttribute="speedOffer" class="form-horizontal">
<input type="hidden" name="gold" value="${speedOffer.gold}" />
<input type="hidden" name="discountGold" value="${speedOffer.discountGold}" />
<input type="hidden" name="silver" value="${speedOffer.silver}" />
<input type="hidden" name="discountSilver" value="${speedOffer.discountSilver}" />
<input type="hidden" name="bronze" value="${speedOffer.bronze}" />
<input type="hidden" name="discountBronze" value="${speedOffer.discountBronze}" />
<button class="btn btn-default" type="submit">Dar de baja</button>
</form:form>

View file

@ -1,13 +1,11 @@
<%@ page session="false" trimDirectiveWhitespaces="true"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="cheapy" tagdir="/WEB-INF/tags"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="sec"
uri="http://www.springframework.org/security/tags"%>
<link href='https://fonts.googleapis.com/css?family=Lobster'
rel='stylesheet'>
<%@ page session="false" trimDirectiveWhitespaces="true" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="cheapy" tagdir="/WEB-INF/tags" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>
<link href='https://fonts.googleapis.com/css?family=Lobster' rel='stylesheet'>
<cheapy:layout pageName="speedOffer">
@ -15,70 +13,84 @@
<fmt:message key="speedOffer" />
</h2>
<table class="table table-striped" id="speedOffer-table">
<tr>
<th><fmt:message key="offerBeginning"/></th>
<td><c:out value="${localDateTimeFormat.format(speedOffer.start)}"/></td>
</tr>
<tr>
<th><fmt:message key="offerEnding"/></th>
<td><c:out value="${localDateTimeFormat.format(speedOffer.end)}"/></td>
</tr>
<tr>
<th><fmt:message key="goldGoal"/></th>
<td><c:out value="${speedOffer.gold} minutos"/></td>
</tr>
<tr>
<th><fmt:message key="goldDiscount"/></th>
<td><c:out value="${speedOffer.discountGold}%"/></td>
</tr>
<tr>
<th><fmt:message key="silverGoal"/></th>
<td><c:out value="${speedOffer.silver} minutos"/></td>
</tr>
<tr>
<th><fmt:message key="silverDiscount"/></th>
<td><c:out value="${speedOffer.discountSilver}%"/></td>
</tr>
<tr>
<th><fmt:message key="bronzeGoal"/></th>
<td><c:out value="${speedOffer.bronze} minutos"/></td>
</tr>
<tr>
<th><fmt:message key="bronzeDiscount"/></th>
<td><c:out value="${speedOffer.discountBronze}%"/></td>
</tr>
<tr>
<th><fmt:message key="offerCode"/></th>
<td><c:out value="${speedOffer.code}"/></td>
</tr>
</table>
<table class="table table-striped" id="speedOffer-table">
<tr>
<th><fmt:message key="offerBeginning" /></th>
<td><c:out
value="${localDateTimeFormat.format(speedOffer.start)}" /></td>
</tr>
<tr>
<th><fmt:message key="offerEnding" /></th>
<td><c:out value="${localDateTimeFormat.format(speedOffer.end)}" /></td>
</tr>
<tr>
<th><fmt:message key="goldGoal" /></th>
<td><c:out value="${speedOffer.gold}" /></td>
</tr>
<tr>
<th><fmt:message key="goldDiscount" /></th>
<td><c:out value="${speedOffer.discountGold} %" /></td>
</tr>
<tr>
<th><fmt:message key="silverGoal" /></th>
<td><c:out value="${speedOffer.silver}" /></td>
</tr>
<tr>
<th><fmt:message key="silverDiscount" /></th>
<td><c:out value="${speedOffer.discountSilver} %" /></td>
</tr>
<tr>
<th><fmt:message key="bronzeGoal" /></th>
<td><c:out value="${speedOffer.bronze}" /></td>
</tr>
<tr>
<th><fmt:message key="bronzeDiscount" /></th>
<td><c:out value="${speedOffer.discountBronze} %" /></td>
</tr>
<tr>
<th><fmt:message key="offerCode" /></th>
<td><c:out value="${speedOffer.code}" /></td>
</tr>
</table>
<div class="btn-return">
<button type="button" role="link" onclick="window.location='/offers'"
style="font-family: 'Lobster'; font-size: 20px;">
<span class="glyphicon glyphicon-arrow-left" aria-hidden="true"
style="padding: 5px"> </span>
<fmt:message key="return" />
</button>
</div>
<div class="btn-menu">
<div class="btn-return">
<button type="button" role="link" onclick="goBack()" style="font-family: 'Lobster'; font-size: 20px;">
<span class="glyphicon glyphicon-arrow-left" aria-hidden="true" style="padding: 5px"> </span>
<fmt:message key="return"/> </button>
</div>
<sec:authorize access="hasAnyAuthority('client')">
<spring:url value="{speedOfferId}/edit" var="editUrl">
<spring:param name="speedOfferId" value="${speedOffer.id}" />
</spring:url>
<a href="${fn:escapeXml(editUrl)}" class="btn btn-default">Editar
oferta</a>
</sec:authorize>
<div class="btns-edit">
<spring:url value="{speedOfferId}/edit" var="editUrl">
<spring:param name="speedOfferId" value="${speedOffer.id}"/>
</spring:url>
<button type="button" role="link" onclick="window.location='${fn:escapeXml(editUrl)}'" style="font-family: 'Lobster'; font-size: 20px;">
<span class="glyphicon glyphicon glyphicon-edit" aria-hidden="true" style="padding: 5px"> </span>
Editar oferta</button>
<sec:authorize access="hasAnyAuthority('client')">
<spring:url value="{speedOfferId}/disable" var="editUrl">
<spring:param name="speedOfferId" value="${speedOffer.id}" />
</spring:url>
<a href="${fn:escapeXml(editUrl)}" class="btn btn-default">Desactivar
oferta</a>
<c:if test="${speedOffer.status eq 'inactive' }">
<spring:url value="{speedOfferId}/activate" var="activateUrl">
<spring:param name="speedOfferId" value="${speedOffer.id}"/>
</spring:url>
<button type="button" role="link" onclick="window.location='${fn:escapeXml(activateUrl)}'" style="font-family: 'Lobster'; font-size: 20px;">
<span class="glyphicon glyphicon glyphicon-edit" aria-hidden="true" style="padding: 5px"> </span>
Activar oferta</button>
</c:if>
<c:if test="${speedOffer.status eq 'active' }">
<spring:url value="{speedOfferId}/disable" var="deactivateUrl">
<spring:param name="speedOfferId" value="${speedOffer.id}"/>
</spring:url>
<button type="button" role="link" onclick="window.location='${fn:escapeXml(deactivateUrl)}'" style="font-family: 'Lobster'; font-size: 20px;">
<span class="glyphicon glyphicon glyphicon-trash" aria-hidden="true" style="padding: 5px"> </span>
Desactivar oferta</button>
</c:if>
</div>
</div>
</sec:authorize>
<script>
function goBack() {
window.history.back()
}
</script>
</cheapy:layout>

View file

@ -5,36 +5,55 @@
<%@ 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" %>
<link href='https://fonts.googleapis.com/css?family=Lobster' rel='stylesheet'>
<cheapy:layout pageName="TimeOffers">
<h2>
<c:if test="${timeOffer['new']}">Nueva </c:if> Oferta por tiempo
<h2 style="text-align:center;padding:5px">
<c:if test="${timeOffer['new']}"><fmt:message key="new"/> </c:if> <fmt:message key="timeOffer"/>
</h2>
<form:form modelAttribute="timeOffer" class="form-horizontal" id="add-timeOffer-form">
<div class="form-group has-feedback">
<form:hidden path="id"/>
<form:hidden path="code"/>
<form:hidden path="status"/>
<cheapy:inputField label="Fecha de inicio" placeholder="15/06/2021 14:00" name="start"/>
<cheapy:inputField label="Fecha de fin" placeholder="15/06/2021 16:00" name="end"/>
<cheapy:inputField label="Hora de inicio" name="init"/>
<cheapy:inputField label="Hora de final" name="finish"/>
<cheapy:inputField label="Descuento" name="discount"/>
<cheapy:inputField label="Fecha de inicio" placeholder="dd/MM/yyyy HH:mm" name="start"/>
<cheapy:inputField label="Fecha de fin" placeholder="dd/MM/yyyy HH:mm" name="end"/>
<cheapy:inputField label="Hora de inicio" placeholder="HH:mm" name="init"/>
<cheapy:inputField label="Hora de final" placeholder="HH:mm" name="finish"/>
<cheapy:inputField label="Descuento" placeholder="XX% (Ej.15)" name="discount"/>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<c:choose>
<c:when test="${timeOffer['new']}">
<button class="btn btn-default" type="submit">Añadir oferta</button>
</c:when>
<c:otherwise>
<button class="btn btn-default" type="submit">Actualizar oferta</button>
</c:otherwise>
</c:choose>
<div class="btn-mod">
<c:choose>
<c:when test="${timeOffer['new']}">
<button class="btn btn-default" type="submit" style="font-family: 'Lobster'; font-size: 20px;">
<span class="glyphicon glyphicon-floppy-save" aria-hidden="true" style="padding: 5px"> </span>
Crear oferta</button>
</c:when>
<c:otherwise>
<button class="btn btn-default" type="submit" style="font-family: 'Lobster'; font-size: 20px;">
<span class="glyphicon glyphicon-floppy-save" aria-hidden="true" style="padding: 5px"> </span>
Modificar</button>
</c:otherwise>
</c:choose>
</div>
</div>
</div>
</form:form>
<div class="btn-return">
<button type="button" role="link" onclick="goBack()" style="font-family: 'Lobster'; font-size: 20px;">
<span class="glyphicon glyphicon-arrow-left" aria-hidden="true" style="padding: 5px"> </span>
<fmt:message key="return"/> </button>
</div>
<script>
function goBack() {
window.history.back()
}
</script>
</cheapy:layout>

View file

@ -5,12 +5,16 @@
<%@ taglib prefix="cheapy" tagdir="/WEB-INF/tags"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<cheapy:layout pageName="foodOffer">
<petclinic:layout pageName="timeOffer">
<jsp:body>
<h2> ¿Está seguro de que quiere eliminar su oferta? </h2>
<h2> <EFBFBD>Est<EFBFBD> seguro de que quiere eliminar su oferta? </h2>
<form:form modelAttribute="foodOffer" class="form-horizontal">
<form:form modelAttribute="timeOffer" class="form-horizontal">
<input type="hidden" name="init" value="${timeOffer.init}" />
<input type="hidden" name="finish" value="${timeOffer.finish}" />
<input type="hidden" name="discount" value="${timeOffer.discount}" />
<button class="btn btn-default" type="submit">Eliminar Oferta</button>
</form:form>

View file

@ -1,66 +1,86 @@
<%@ page session="false" trimDirectiveWhitespaces="true"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="cheapy" tagdir="/WEB-INF/tags"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="sec"
uri="http://www.springframework.org/security/tags"%>
<link href='https://fonts.googleapis.com/css?family=Lobster'
rel='stylesheet'>
<%@ page session="false" trimDirectiveWhitespaces="true" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="cheapy" tagdir="/WEB-INF/tags" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>
<link href='https://fonts.googleapis.com/css?family=Lobster' rel='stylesheet'>
<cheapy:layout pageName="timeOffer">
<h2 style="text-align: center; padding: 5px">
<fmt:message key="timeOffer" />
</h2>
<h2 style="text-align:center;padding:5px"><fmt:message key="timeOffer"/></h2>
<table class="table table-striped">
<thead>
<tr>
<th><fmt:message key="offerBeginning" /></th>
<td><c:out
value="${localDateTimeFormat.format(timeOffer.start)}" /></td>
</tr>
<tr>
<th><fmt:message key="offerEnding" /></th>
<td><c:out value="${localDateTimeFormat.format(timeOffer.end)}" /></td>
</tr>
<tr>
<th><fmt:message key="discount" /></th>
<td><c:out value="${timeOffer.discount} %" /></td>
</tr>
<tr>
<th><fmt:message key="offerCode" /></th>
<td><c:out value="${timeOffer.code}" /></td>
</tr>
</thead>
</table>
<table id="timeOfferTable" class="table table-striped">
<thead>
<tr>
<th><fmt:message key="offerBeginning"/></th>
<td><c:out value="${localDateTimeFormat.format(timeOffer.start)}"/></td>
</tr>
<tr>
<th><fmt:message key="offerEnding"/></th>
<td><c:out value="${localDateTimeFormat.format(timeOffer.end)}"/></td>
</tr>
<tr>
<th><fmt:message key="init"/></th>
<td><c:out value="${timeOffer.init}h"/></td>
</tr>
<tr>
<th><fmt:message key="finish"/></th>
<td><c:out value="${timeOffer.finish}h"/></td>
</tr>
<tr>
<th><fmt:message key="discount"/></th>
<td><c:out value="${timeOffer.discount}%"/></td>
</tr>
<tr>
<th><fmt:message key="offerCode"/></th>
<td><c:out value="${timeOffer.code}"/></td>
</tr>
</thead>
</table>
<div class="btn-menu">
<div class="btn-return">
<button type="button" role="link" onclick="goBack()" style="font-family: 'Lobster'; font-size: 20px;">
<span class="glyphicon glyphicon-arrow-left" aria-hidden="true" style="padding: 5px"> </span>
<fmt:message key="return"/> </button>
</div>
<sec:authorize access="hasAnyAuthority('client')">
<spring:url value="{timeOfferId}/edit" var="editUrl">
<spring:param name="timeOfferId" value="${timeOffer.id}" />
</spring:url>
<a href="${fn:escapeXml(editUrl)}" class="btn btn-default">Editar
oferta</a>
</sec:authorize>
<div class="btns-edit">
<spring:url value="{timeOfferId}/edit" var="editUrl">
<spring:param name="timeOfferId" value="${timeOffer.id}"/>
</spring:url>
<button type="button" role="link" onclick="window.location='${fn:escapeXml(editUrl)}'" style="font-family: 'Lobster'; font-size: 20px;">
<span class="glyphicon glyphicon glyphicon-edit" aria-hidden="true" style="padding: 5px"> </span>
Editar oferta</button>
<sec:authorize access="hasAnyAuthority('client')">
<spring:url value="{timeOfferId}/disable" var="editUrl">
<spring:param name="timeOfferId" value="${timeOffer.id}" />
</spring:url>
<a href="${fn:escapeXml(editUrl)}" class="btn btn-default">Desactivar
oferta</a>
<c:if test="${timeOffer.status eq 'inactive' }">
<spring:url value="{timeOfferId}/activate" var="activateUrl">
<spring:param name="timeOfferId" value="${timeOffer.id}"/>
</spring:url>
<button type="button" role="link" onclick="window.location='${fn:escapeXml(activateUrl)}'" style="font-family: 'Lobster'; font-size: 20px;">
<span class="glyphicon glyphicon glyphicon-edit" aria-hidden="true" style="padding: 5px"> </span>
Activar oferta</button>
</c:if>
<c:if test="${timeOffer.status eq 'active' }">
<spring:url value="{timeOfferId}/disable" var="deactivateUrl">
<spring:param name="timeOfferId" value="${timeOffer.id}"/>
</spring:url>
<button type="button" role="link" onclick="window.location='${fn:escapeXml(deactivateUrl)}'" style="font-family: 'Lobster'; font-size: 20px;">
<span class="glyphicon glyphicon glyphicon-trash" aria-hidden="true" style="padding: 5px"> </span>
Desactivar oferta</button>
</c:if>
</div>
</div>
</sec:authorize>
<div class="btn-return">
<button type="button" role="link" onclick="window.location='/offers'"
style="font-family: 'Lobster'; font-size: 20px;">
<span class="glyphicon glyphicon-arrow-left" aria-hidden="true"
style="padding: 5px"> </span>
<fmt:message key="return" />
</button>
</div>
<script>
function goBack() {
window.history.back()
}
</script>
</cheapy:layout>

View file

@ -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" %>
<link href='https://fonts.googleapis.com/css?family=Lobster' rel='stylesheet'>
<!-- %@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %-->
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>
<cheapy:layout pageName="home">
<cheapy:layout pageName="home">
<h2 class="text-center" style="font-family: 'Lobster'; font-size: 60px; color: rgb(0, 64, 128); padding:30px"><fmt:message key="welcome"/></h2>
<div class="row">
<div class="col-md-12">
@ -14,10 +17,19 @@
<img class="img-responsive" src="${cheapyImage}"/>
</div>
<div class="btn-home">
<button type="button" role="link" onclick="window.location='/offers'" style="font-family: 'Lobster'; font-size: 20px;">
<button type="button" role="link" onclick="window.location='/offers'" style="font-family: 'Lobster'; font-size: 20px;margin:5px;">
<span class="glyphicon glyphicon-cutlery" aria-hidden="true" style="padding: 5px"> </span>
<fmt:message key="listOffers"/> </button>
</div>
<sec:authorize access="hasAnyAuthority('client')">
<div class="btn-home">
<button type="button" role="link" onclick="window.location='/offersCreate'" style="font-family: 'Lobster'; font-size: 20px;margin:5px;">
<span class="glyphicon glyphicon-cutlery" aria-hidden="true" style="padding: 5px"> </span>
<fmt:message key="createOffers"/> </button>
</div>
</sec:authorize>
</div>
</div>
</cheapy:layout>

View file

@ -6,16 +6,16 @@
<%@ 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" %>
description="Placeholder para los campos en los input fields" %>
<spring:bind path="${name}">
<c:set var="cssGroup" value="form-group ${status.error ? 'has-error' : '' }"/>
<c:set var="valid" value="${not status.error and not empty status.actualValue}"/>
<div class="${cssGroup}">
<label class="col-sm-2 control-label">${label}</label>
<div class="col-sm-10">
<form:input class="form-control" path="${name}"/>
<form:input class="form-control" placeholder="${placeholder }" path="${name}"/>
<c:if test="${valid}">
<span class="glyphicon glyphicon-ok form-control-feedback" aria-hidden="true"></span>
</c:if>