Merge branch '009-cambiarVistas' into develop

This commit is contained in:
David 2021-04-02 14:29:22 +02:00
commit 7124228491
17 changed files with 625 additions and 222 deletions

View file

@ -44,11 +44,14 @@ public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
.antMatchers("/owners/**").hasAnyAuthority("owner", "admin") .antMatchers("/owners/**").hasAnyAuthority("owner", "admin")
.antMatchers("/offers/**/new").hasAnyAuthority("admin", "client") .antMatchers("/offers/**/new").hasAnyAuthority("admin", "client")
.antMatchers("/offers/**/activate").hasAnyAuthority("admin","client") .antMatchers("/offers/**/activate").hasAnyAuthority("admin","client")
.antMatchers("/clients/new").permitAll() .antMatchers("/clients/new").permitAll()
.antMatchers("/offers/**").permitAll() .antMatchers("/offers/**").permitAll()
.antMatchers("/offersCreate").hasAuthority("client")
.and().formLogin() .and().formLogin()
@ -69,7 +72,7 @@ public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
public void configure(final AuthenticationManagerBuilder auth) throws Exception { public void configure(final AuthenticationManagerBuilder auth) throws Exception {
auth.jdbcAuthentication().dataSource(this.dataSource) auth.jdbcAuthentication().dataSource(this.dataSource)
//[login de admin,owner y vet] .usersByUsernameQuery("select username,password,enabled " + "from users " + "where username = ?") //[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()); .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.NuOfferService;
import org.springframework.cheapy.service.SpeedOfferService; import org.springframework.cheapy.service.SpeedOfferService;
import org.springframework.cheapy.service.TimeOfferService; 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.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
@Controller @Controller
public class OfertaController { public class OfertaController {
private final ClientService clientService; private final ClientService clientService;
private final FoodOfferService foodOfferService; private final FoodOfferService foodOfferService;
private final NuOfferService nuOfferService; private final NuOfferService nuOfferService;
private final SpeedOfferService speedOfferService; private final SpeedOfferService speedOfferService;
private final TimeOfferService timeOfferService; private final TimeOfferService timeOfferService;
@ -42,40 +45,49 @@ public class OfertaController {
List<NuOffer> nuOfferLs=this.nuOfferService.findActiveNuOffer(); List<NuOffer> nuOfferLs=this.nuOfferService.findActiveNuOffer();
List<SpeedOffer> speedOfferLs=this.speedOfferService.findActiveSpeedOffer(); List<SpeedOffer> speedOfferLs=this.speedOfferService.findActiveSpeedOffer();
List<TimeOffer> timeOfferLs=this.timeOfferService.findActiveTimeOffer(); List<TimeOffer> timeOfferLs=this.timeOfferService.findActiveTimeOffer();
model.put("foodOfferLs", foodOfferLs); model.put("foodOfferLs", foodOfferLs);
model.put("nuOfferLs", nuOfferLs); model.put("nuOfferLs", nuOfferLs);
model.put("speedOfferLs", speedOfferLs); model.put("speedOfferLs", speedOfferLs);
model.put("timeOfferLs", timeOfferLs); 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")); model.put("localDateTimeFormat", DateTimeFormatter.ofPattern("dd/MM/yyyy HH:mm"));
return "offers/offersList"; return "offers/offersList";
} }
@GetMapping("/myOffers") @GetMapping("/myOffers")
public String processMyOffersForm( Map<String, Object> model) { public String processMyOffersForm( Map<String, Object> model) {
int actual = this.clientService.getCurrentClient().getId(); int actual = this.clientService.getCurrentClient().getId();
List<FoodOffer> foodOfferLs = this.foodOfferService.findFoodOfferByUserId(actual); List<FoodOffer> foodOfferLs = this.foodOfferService.findFoodOfferByUserId(actual);
List<NuOffer> nuOfferLs = this.nuOfferService.findNuOfferByUserId(actual); List<NuOffer> nuOfferLs = this.nuOfferService.findNuOfferByUserId(actual);
List<SpeedOffer> speedOfferLs = this.speedOfferService.findSpeedOfferByUserId(actual); List<SpeedOffer> speedOfferLs = this.speedOfferService.findSpeedOfferByUserId(actual);
List<TimeOffer> timeOfferLs = this.timeOfferService.findTimeOfferByUserId(actual); List<TimeOffer> timeOfferLs = this.timeOfferService.findTimeOfferByUserId(actual);
model.put("foodOfferLs", foodOfferLs); model.put("foodOfferLs", foodOfferLs);
model.put("nuOfferLs", nuOfferLs); model.put("nuOfferLs", nuOfferLs);
model.put("speedOfferLs", speedOfferLs); model.put("speedOfferLs", speedOfferLs);
model.put("timeOfferLs", timeOfferLs); 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") // @GetMapping("/owners/{ownerId}/edit")
// public String initUpdateOwnerForm(@PathVariable("ownerId") int ownerId, Model model) { // public String initUpdateOwnerForm(@PathVariable("ownerId") int ownerId, Model model) {
// Owner owner = this.ownerService.findOwnerById(ownerId); // Owner owner = this.ownerService.findOwnerById(ownerId);
@ -99,10 +111,10 @@ public class OfertaController {
// public ModelAndView showOwner(@PathVariable("ownerId") int ownerId) { // public ModelAndView showOwner(@PathVariable("ownerId") int ownerId) {
// ModelAndView mav = new ModelAndView("owners/ownerDetails"); // ModelAndView mav = new ModelAndView("owners/ownerDetails");
// Owner owner = this.ownerService.findOwnerById(ownerId); // Owner owner = this.ownerService.findOwnerById(ownerId);
// //
// mav.addObject(owner); // mav.addObject(owner);
// return mav; // return mav;
// } // }
} }

View file

@ -56,7 +56,7 @@
.table-filter { .table-filter {
background-color: @spring-brown; background-color: @spring-brown;
padding: 9px 12px; padding: 5px 12px;
} }
.nav > li > a { .nav > li > a {
@ -240,20 +240,81 @@ img.img-responsive{
background-color: rgb(40, 140, 215); 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 { #foodOfferTable th {
width: 25%; width: 25%;
text-align: center;
} }
#nuOfferTable th { #nuOfferTable th {
width: 33%; width: 25%;
text-align: center;
} }
#speedOfferTable th { #speedOfferTable th {
width: 33%; width: 25%;
text-align: center;
} }
#timeOfferTable th { #timeOfferTable th {
width: 33%; width: 25%;
text-align: center;
} }
.btn-detalles button { .btn-detalles button {
@ -278,7 +339,52 @@ img.img-responsive{
.btn-return{ .btn-return{
display: table; display: table;
margin: 0 auto; 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 { .btn-return button {
@ -288,32 +394,50 @@ img.img-responsive{
padding: 10px 24px; padding: 10px 24px;
cursor: pointer; cursor: pointer;
display: block; display: block;
left: 0%;
} }
.btn-return button:not(:last-child) { .btn-return button:not(:last-child) {
border-bottom: none; border-bottom: none;
} }
.btn-return button:hover { .btn-return button:hover {
background-color: rgb(40, 140, 215); background-color: rgb(40, 140, 215);
} }
#foodOfferTable td{ #foodOfferTable td{
vertical-align:middle; vertical-align:middle;
text-align: center;
} }
#nuOfferTable td{ #nuOfferTable td{
vertical-align:middle; vertical-align:middle;
text-align: center;
} }
#speedOfferTable td{ #speedOfferTable td{
vertical-align:middle; vertical-align:middle;
text-align: center;
} }
#timeOfferTable td{ #timeOfferTable td{
vertical-align:middle; 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){ #nuOffer-table tr:nth-child(3){

View file

@ -1,9 +1,14 @@
welcome=Bienvenido a welcome=Bienvenido a
new=Nueva
deleteOffer=Eliminar Oferta
cancel=Cancelar
deleteOfferMessage=Confirme que quiere eliminar su oferta
listOffers=Ver Ofertas listOffers=Ver Ofertas
foodOffers=Ofertas por plato especifico createOffers=Crear Ofertas
foodOffer=Oferta por plato especifico foodOffers=Ofertas por plato espec<65>fico
nuOffers=Ofertas por numero de comensales foodOffer=Oferta por plato espec<65>fico
nuOffer=Oferta por numero de comensales nuOffers=Ofertas por n<>mero de comensales
nuOffer=Oferta por n<>mero de comensales
speedOffers=Ofertas rapidez comiendo speedOffers=Ofertas rapidez comiendo
speedOffer=Oferta por comer veloz speedOffer=Oferta por comer veloz
timeOffers=Ofertas por franja horaria timeOffers=Ofertas por franja horaria
@ -23,12 +28,18 @@ offerBeginning=Inicio de la oferta
endDate=Fecha fin endDate=Fecha fin
offerEnding=Fin de la oferta offerEnding=Fin de la oferta
details=Detalles details=Detalles
offerCode=Codigo de la oferta offerCode=C<EFBFBD>digo de la oferta
return=Volver return=Volver
required=Es requeridOfertas por franja horariao required=Es requerido Ofertas por franja horaria
notFound=No ha sido encontrado notFound=No ha sido encontrado
duplicate=Ya se encuentra en uso duplicate=Ya se encuentra en uso
nonNumeric=Sólo debe contener numeros nonNumeric=S<EFBFBD>lo debe contener n<>meros
duplicateFormSubmission=No se permite el envío de formularios duplicados duplicateFormSubmission=No se permite el env<6E>o de formularios duplicados
typeMismatch.date=Fecha invalida typeMismatch.date=Fecha inv<6E>lida
typeMismatch.birthDate=Fecha invalida typeMismatch.birthDate=Fecha inv<6E>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" %> <%@ page session="false" trimDirectiveWhitespaces="true" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %> <%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> <%@ 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="cheapy" tagdir="/WEB-INF/tags" %>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %> <%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>
<link href='https://fonts.googleapis.com/css?family=Lobster' rel='stylesheet'> <link href='https://fonts.googleapis.com/css?family=Lobster' rel='stylesheet'>
@ -275,26 +277,29 @@
<div class="wrapper fadeInDown"> <div class="wrapper fadeInDown">
<div id="formContent"> <div id="formContent">
<!-- Tabs Titles --> <!-- Tabs Titles -->
<!-- Icon --> <!-- Icon -->
<div class="fadeIn first"> <div class="fadeIn first">
<img src="/resources/images/Logo Cheapy.png" id="icon" /> <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>
<div th:if="${param.error}">
<p class="text-danger"> Invalid username or password</p>
</div>
<!-- Login Form --> <!-- Login Form -->
<form class='form-signin' action="/login" method='POST'> <form class='form-signin' action="/login" method='POST'>
<input type="text" id="username" class="fadeIn second" name="username" placeholder="username" required autofocus> <input type="text" id="username" class="fadeIn second" name="username" placeholder="Usuario" required autofocus>
<input type="password" id="password" class="fadeIn third" name="password" placeholder="password" required> <input type="password" id="password" class="fadeIn third" name="password" placeholder="Contraseña" required>
<sec:csrfInput /> <sec:csrfInput />
<input type="submit" class="fadeIn fourth" value="Login"> <input type="submit" class="fadeIn fourth" value="Iniciar sesión">
</form> </form>
<!-- Remind Passowrd --> <!-- Remind Passowrd
<div id="formFooter"> <div id="formFooter">
<a class="underlineHover" href="#">Forgot Password?</a> <a class="underlineHover" href="#">Forgot Password?</a>
</div> </div> -->
</div> </div>
</div> </div>

View file

@ -4,33 +4,52 @@
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %> <%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib prefix="petclinic" tagdir="/WEB-INF/tags" %> <%@ taglib prefix="cheapy" tagdir="/WEB-INF/tags" %>
<link href='https://fonts.googleapis.com/css?family=Lobster' rel='stylesheet'>
<petclinic:layout pageName="foodOffers"> <cheapy:layout pageName="foodOffers">
<h2> <h2 style="text-align:center;padding:5px">
<c:if test="${foodOffer['new']}">New </c:if> FoodOffer <c:if test="${foodOffer['new']}"><fmt:message key="new"/> </c:if> <fmt:message key="foodOffer"/>
</h2> </h2>
<form:form modelAttribute="foodOffer" class="form-horizontal" id="add-foodOffer-form"> <form:form modelAttribute="foodOffer" class="form-horizontal" id="add-foodOffer-form">
<div class="form-group has-feedback"> <div class="form-group has-feedback">
<form:hidden path="id"/> <form:hidden path="id"/>
<form:hidden path="code"/> <form:hidden path="code"/>
<form:hidden path="status"/> <form:hidden path="status"/>
<petclinic:inputField label="Start Date" name="start"/> <cheapy:inputField label="Fecha de Inicio" placeholder="dd/MM/yyyy HH:mm" name="start"/>
<petclinic:inputField label="End Date" name="end"/> <cheapy:inputField label="Fecha de Fin" placeholder="dd/MM/yyyy HH:mm" name="end"/>
<petclinic:inputField label="Food" name="food"/> <cheapy:inputField label="Plato" placeholder="Ej. Macarrones" name="food"/>
<petclinic:inputField label="Discount" name="discount"/> <cheapy:inputField label="Descuento" placeholder="Ej. 50" name="discount"/>
</div> </div>
<div class="form-group"> <div class="form-group">
<div class="col-sm-offset-2 col-sm-10"> <div class="col-sm-offset-2 col-sm-10">
<c:choose> <div class="btn-mod">
<c:when test="${foodOffer['new']}"> <c:choose>
<button class="btn btn-default" type="submit">Crear oferta</button> <c:when test="${foodOffer['new']}">
</c:when> <button class="btn btn-default" type="submit" style="font-family: 'Lobster'; font-size: 20px;">
<c:otherwise> <span class="glyphicon glyphicon-floppy-save" aria-hidden="true" style="padding: 5px"> </span>
<button class="btn btn-default" type="submit">Modificar</button> Crear oferta</button>
</c:otherwise> </c:when>
</c:choose> <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>
</div> </div>
</form:form> </form:form>
</petclinic:layout>
<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

@ -29,7 +29,7 @@
</tr> </tr>
<tr> <tr>
<th><fmt:message key="discount"/></th> <th><fmt:message key="discount"/></th>
<td><c:out value="${foodOffer.discount}"/></td> <td><c:out value="${foodOffer.discount}%"/> </td>
</tr> </tr>
<tr> <tr>
@ -38,26 +38,42 @@
</tr> </tr>
</thead> </thead>
</table> </table>
<div class="btn-return"> <div class="btn-menu">
<button type="button" role="link" onclick="window.location='/offers'" style="font-family: 'Lobster'; font-size: 20px;"> <div class="btn-return">
<span class="glyphicon glyphicon-arrow-left" aria-hidden="true" style="padding: 5px"> </span> <button type="button" role="link" onclick="goBack()" style="font-family: 'Lobster'; font-size: 20px;">
<fmt:message key="return"/> </button> <span class="glyphicon glyphicon-arrow-left" aria-hidden="true" style="padding: 5px"> </span>
<fmt:message key="return"/> </button>
</div>
<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>
<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>
<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>
</div>
</div> </div>
<spring:url value="{foodOfferId}/edit" var="editUrl"> <script>
<spring:param name="foodOfferId" value="${foodOffer.id}"/> function goBack() {
</spring:url> window.history.back()
<a href="${fn:escapeXml(editUrl)}" class="btn btn-default">Editar oferta</a> }
</script>
<spring:url value="{foodOfferId}/activate" var="activateUrl">
<spring:param name="foodOfferId" value="${foodOffer.id}"/>
</spring:url>
<a href="${fn:escapeXml(activateUrl)}" class="btn btn-default">Activar oferta</a>
<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>
</cheapy:layout> </cheapy:layout>

View file

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

@ -22,53 +22,69 @@
</tr> </tr>
<tr> <tr>
<th><fmt:message key="goldGoal"/></th> <th><fmt:message key="goldGoal"/></th>
<td><c:out value="${nuOffer.gold}"/></td> <td><c:out value="${nuOffer.gold} comensales" /></td>
</tr> </tr>
<tr> <tr>
<th><fmt:message key="goldDiscount"/></th> <th><fmt:message key="goldDiscount"/></th>
<td><c:out value="${nuOffer.discountGold}"/></td> <td><c:out value="${nuOffer.discountGold}%"/></td>
</tr> </tr>
<tr> <tr>
<th><fmt:message key="silverGoal"/></th> <th><fmt:message key="silverGoal"/></th>
<td><c:out value="${nuOffer.silver}"/></td> <td><c:out value="${nuOffer.silver} comensales"/></td>
</tr> </tr>
<tr> <tr>
<th><fmt:message key="silverDiscount"/></th> <th><fmt:message key="silverDiscount"/></th>
<td><c:out value="${nuOffer.discountSilver}"/></td> <td><c:out value="${nuOffer.discountSilver}%"/></td>
</tr> </tr>
<tr> <tr>
<th>Meta bronce</th> <th>Meta bronce</th>
<td><c:out value="${nuOffer.bronze}"/></td> <td><c:out value="${nuOffer.bronze} comensales"/></td>
</tr> </tr>
<tr> <tr>
<th><fmt:message key="bronzeDiscount"/></th> <th><fmt:message key="bronzeDiscount"/></th>
<td><c:out value="${nuOffer.discountBronze}"/></td> <td><c:out value="${nuOffer.discountBronze}%"/></td>
</tr> </tr>
<tr> <tr>
<th><fmt:message key="offerCode"/></th> <th><fmt:message key="offerCode"/></th>
<td><c:out value="${nuOffer.code}"/></td> <td><c:out value="${nuOffer.code}"/></td>
</tr> </tr>
</table> </table>
<div class="btn-return"> <div class="btn-menu">
<button type="button" role="link" onclick="window.location='/offers'" style="font-family: 'Lobster'; font-size: 20px;"> <div class="btn-return">
<span class="glyphicon glyphicon-arrow-left" aria-hidden="true" style="padding: 5px"> </span> <button type="button" role="link" onclick="goBack()" style="font-family: 'Lobster'; font-size: 20px;">
<fmt:message key="return"/> </button> <span class="glyphicon glyphicon-arrow-left" aria-hidden="true" style="padding: 5px"> </span>
<fmt:message key="return"/> </button>
</div>
<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>
<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>
<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>
</div>
</div> </div>
<spring:url value="{nuOfferId}/edit" var="editUrl"> <script>
<spring:param name="nuOfferId" value="${nuOffer.id}"/> function goBack() {
</spring:url> window.history.back()
<a href="${fn:escapeXml(editUrl)}" class="btn btn-default">Editar oferta</a> }
</script>
<spring:url value="{nuOfferId}/activate" var="activateUrl">
<spring:param name="nuOfferId" value="${nuOffer.id}"/>
</spring:url>
<a href="${fn:escapeXml(activateUrl)}" class="btn btn-default">Activar oferta</a>
<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>
</cheapy:layout> </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='/foodOffers/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='/nuOffers/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='/speedOffers/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='/timeOffers/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

@ -14,6 +14,7 @@
<tr> <tr>
<!-- <th style="width: 150px;">Restaurante</th> --> <!-- <th style="width: 150px;">Restaurante</th> -->
<th><fmt:message key="food"/></th> <th><fmt:message key="food"/></th>
<th><fmt:message key="discount"/></th>
<th><fmt:message key="startDate"/></th> <th><fmt:message key="startDate"/></th>
<th><fmt:message key="endDate"/></th> <th><fmt:message key="endDate"/></th>
<th> </th> <th> </th>
@ -25,6 +26,9 @@
<td> <td>
<c:out value="${foodOffer.food}"/> <c:out value="${foodOffer.food}"/>
</td> </td>
<td>
<c:out value="${foodOffer.discount}%"/>
</td>
<td> <td>
<c:out value="${localDateTimeFormat.format(foodOffer.start)}"/> <c:out value="${localDateTimeFormat.format(foodOffer.start)}"/>
</td> </td>
@ -55,6 +59,8 @@
<!-- <th style="width: 150px;">Restaurante</th> --> <!-- <th style="width: 150px;">Restaurante</th> -->
<th><fmt:message key="startDate"/></th> <th><fmt:message key="startDate"/></th>
<th><fmt:message key="endDate"/></th> <th><fmt:message key="endDate"/></th>
<th><fmt:message key="goldGoal"/></th>
<th><fmt:message key="goldDiscount"/></th>
<th> </th> <th> </th>
</tr> </tr>
@ -69,6 +75,12 @@
<td> <td>
<c:out value="${localDateTimeFormat.format(nuOffer.end)}"/> <c:out value="${localDateTimeFormat.format(nuOffer.end)}"/>
</td> </td>
<td>
<c:out value="${nuOffer.gold} comensales"/>
</td>
<td>
<c:out value="${nuOffer.discountGold}%"/>
</td>
<td> <td>
<spring:url value="/offers/nu/{nuOfferId}" var="nuOfferUrl"> <spring:url value="/offers/nu/{nuOfferId}" var="nuOfferUrl">
<spring:param name="nuOfferId" value="${nuOffer.id}"/> <spring:param name="nuOfferId" value="${nuOffer.id}"/>
@ -91,6 +103,8 @@
<!-- <th style="width: 150px;">Restaurante</th> --> <!-- <th style="width: 150px;">Restaurante</th> -->
<th><fmt:message key="startDate"/></th> <th><fmt:message key="startDate"/></th>
<th><fmt:message key="endDate"/></th> <th><fmt:message key="endDate"/></th>
<th><fmt:message key="goldGoal"/></th>
<th><fmt:message key="goldDiscount"/></th>
<th> </th> <th> </th>
</tr> </tr>
@ -105,6 +119,12 @@
<td> <td>
<c:out value="${localDateTimeFormat.format(speedOffer.end)}"/> <c:out value="${localDateTimeFormat.format(speedOffer.end)}"/>
</td> </td>
<td>
<c:out value="${speedOffer.gold} minutos"/>
</td>
<td>
<c:out value="${speedOffer.discountGold}%"/>
</td>
<td> <td>
<spring:url value="/offers/speed/{speedOfferId}" var="speedOfferUrl"> <spring:url value="/offers/speed/{speedOfferId}" var="speedOfferUrl">
<spring:param name="speedOfferId" value="${speedOffer.id}"/> <spring:param name="speedOfferId" value="${speedOffer.id}"/>
@ -128,6 +148,8 @@
<!-- <th style="width: 150px;">Restaurante</th> --> <!-- <th style="width: 150px;">Restaurante</th> -->
<th><fmt:message key="startDate"/></th> <th><fmt:message key="startDate"/></th>
<th><fmt:message key="endDate"/></th> <th><fmt:message key="endDate"/></th>
<th><fmt:message key="init"/></th>
<th><fmt:message key="finish"/></th>
<th> </th> <th> </th>
</tr> </tr>
</thead> </thead>
@ -141,6 +163,13 @@
<td> <td>
<c:out value="${localDateTimeFormat.format(timeOffer.end)}"/> <c:out value="${localDateTimeFormat.format(timeOffer.end)}"/>
</td> </td>
<td>
<c:out value="${timeOffer.init}h"/>
</td>
<td>
<c:out value="${timeOffer.finish}h"/>
</td>
<td> <td>
<spring:url value="/offers/time/{timeOfferId}" var="timeOfferUrl"> <spring:url value="/offers/time/{timeOfferId}" var="timeOfferUrl">
<spring:param name="timeOfferId" value="${timeOffer.id}"/> <spring:param name="timeOfferId" value="${timeOffer.id}"/>
@ -155,4 +184,14 @@
</c:forEach> </c:forEach>
</tbody> </tbody>
</table> </table>
<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> </cheapy:layout>

View file

@ -4,37 +4,56 @@
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %> <%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib prefix="petclinic" tagdir="/WEB-INF/tags" %> <%@ taglib prefix="cheapy" tagdir="/WEB-INF/tags" %>
<link href='https://fonts.googleapis.com/css?family=Lobster' rel='stylesheet'>
<petclinic:layout pageName="speedOffers"> <cheapy:layout pageName="speedOffers">
<h2> <h2 style="text-align:center;padding:5px">
<c:if test="${speedOffer['new']}">New </c:if> SpeedOffer <c:if test="${speedOffer['new']}"><fmt:message key="new"/> </c:if> <fmt:message key="speedOffer"/>
</h2> </h2>
<form:form modelAttribute="speedOffer" class="form-horizontal" id="add-speedOffer-form"> <form:form modelAttribute="speedOffer" class="form-horizontal" id="add-speedOffer-form">
<div class="form-group has-feedback"> <div class="form-group has-feedback">
<form:hidden path="id"/> <form:hidden path="id"/>
<form:hidden path="code"/> <form:hidden path="code"/>
<form:hidden path="status"/> <form:hidden path="status"/>
<petclinic:inputField label="Start Date" name="start"/> <cheapy:inputField label="Fecha de Inicio" placeholder="dd/MM/yyyy HH:mm" name="start"/>
<petclinic:inputField label="End Date" name="end"/> <cheapy:inputField label="Fecha de Fin" placeholder="dd/MM/yyyy HH:mm" name="end"/>
<petclinic:inputField label="Gold" name="gold"/> <cheapy:inputField label="Tiempo para comer (nivel Oro)" placeholder="XX minutos (Ej. 5)" name="gold"/>
<petclinic:inputField label="Gold Discount" name="discountGold"/> <cheapy:inputField label="Descuento nivel Oro" placeholder="XX% (Ej. 35)" name="discountGold"/>
<petclinic:inputField label="Silver" name="silver"/> <cheapy:inputField label="Tiempo para comer (nivel Plata)" placeholder="XX minutos (Ej. 10)" name="silver"/>
<petclinic:inputField label="Silver Discount" name="discountSilver"/> <cheapy:inputField label="Descuento nivel Plata" placeholder="XX% (Ej. 15)" name="discountSilver"/>
<petclinic:inputField label="Bronze" name="bronze"/> <cheapy:inputField label="Tiempo para comer (nivel Bronce)" placeholder="XX minutos (Ej. 20)" name="bronze"/>
<petclinic:inputField label="Bronze Discount" name="discountBronze"/> <cheapy:inputField label="Descuento nivel Bronce" placeholder="XX% (Ej. 5)" name="discountBronze"/>
</div> </div>
<div class="form-group"> <div class="form-group">
<div class="col-sm-offset-2 col-sm-10"> <div class="col-sm-offset-2 col-sm-10">
<c:choose> <div class="btn-mod">
<c:when test="${speedOffer['new']}"> <c:choose>
<button class="btn btn-default" type="submit">Crear oferta</button> <c:when test="${speedOffer['new']}">
</c:when> <button class="btn btn-default" type="submit" style="font-family: 'Lobster'; font-size: 20px;">
<c:otherwise> <span class="glyphicon glyphicon-floppy-save" aria-hidden="true" style="padding: 5px"> </span>
<button class="btn btn-default" type="submit">Modificar</button> Crear oferta</button>
</c:otherwise> </c:when>
</c:choose> <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>
</div> </div>
</form:form> </form:form>
</petclinic:layout>
<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

@ -22,53 +22,69 @@
</tr> </tr>
<tr> <tr>
<th><fmt:message key="goldGoal"/></th> <th><fmt:message key="goldGoal"/></th>
<td><c:out value="${speedOffer.gold}"/></td> <td><c:out value="${speedOffer.gold} minutos"/></td>
</tr> </tr>
<tr> <tr>
<th><fmt:message key="goldDiscount"/></th> <th><fmt:message key="goldDiscount"/></th>
<td><c:out value="${speedOffer.discountGold}"/></td> <td><c:out value="${speedOffer.discountGold}%"/></td>
</tr> </tr>
<tr> <tr>
<th><fmt:message key="silverGoal"/></th> <th><fmt:message key="silverGoal"/></th>
<td><c:out value="${speedOffer.silver}"/></td> <td><c:out value="${speedOffer.silver} minutos"/></td>
</tr> </tr>
<tr> <tr>
<th><fmt:message key="silverDiscount"/></th> <th><fmt:message key="silverDiscount"/></th>
<td><c:out value="${speedOffer.discountSilver}"/></td> <td><c:out value="${speedOffer.discountSilver}%"/></td>
</tr> </tr>
<tr> <tr>
<th><fmt:message key="bronzeGoal"/></th> <th><fmt:message key="bronzeGoal"/></th>
<td><c:out value="${speedOffer.bronze}"/></td> <td><c:out value="${speedOffer.bronze} minutos"/></td>
</tr> </tr>
<tr> <tr>
<th><fmt:message key="bronzeDiscount"/></th> <th><fmt:message key="bronzeDiscount"/></th>
<td><c:out value="${speedOffer.discountBronze}"/></td> <td><c:out value="${speedOffer.discountBronze}%"/></td>
</tr> </tr>
<tr> <tr>
<th><fmt:message key="offerCode"/></th> <th><fmt:message key="offerCode"/></th>
<td><c:out value="${speedOffer.code}"/></td> <td><c:out value="${speedOffer.code}"/></td>
</tr> </tr>
</table> </table>
<div class="btn-return"> <div class="btn-menu">
<button type="button" role="link" onclick="window.location='/offers'" style="font-family: 'Lobster'; font-size: 20px;"> <div class="btn-return">
<span class="glyphicon glyphicon-arrow-left" aria-hidden="true" style="padding: 5px"> </span> <button type="button" role="link" onclick="goBack()" style="font-family: 'Lobster'; font-size: 20px;">
<fmt:message key="return"/> </button> <span class="glyphicon glyphicon-arrow-left" aria-hidden="true" style="padding: 5px"> </span>
<fmt:message key="return"/> </button>
</div>
<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>
<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>
<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>
</div>
</div> </div>
<spring:url value="{speedOfferId}/edit" var="editUrl"> <script>
<spring:param name="speedOfferId" value="${speedOffer.id}"/> function goBack() {
</spring:url> window.history.back()
<a href="${fn:escapeXml(editUrl)}" class="btn btn-default">Editar oferta</a> }
</script>
<spring:url value="{speedOfferId}/activate" var="activateUrl">
<spring:param name="speedOfferId" value="${speedOffer.id}"/>
</spring:url>
<a href="${fn:escapeXml(activateUrl)}" class="btn btn-default">Activar oferta</a>
<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>
</cheapy:layout> </cheapy:layout>

View file

@ -4,37 +4,56 @@
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %> <%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib prefix="petclinic" tagdir="/WEB-INF/tags" %> <%@ taglib prefix="cheapy" tagdir="/WEB-INF/tags" %>
<link href='https://fonts.googleapis.com/css?family=Lobster' rel='stylesheet'>
<petclinic:layout pageName="TimeOffers"> <cheapy:layout pageName="TimeOffers">
<h2> <h2 style="text-align:center;padding:5px">
<c:if test="${timeOffer['new']}">New </c:if> TimeOffer <c:if test="${timeOffer['new']}"><fmt:message key="new"/> </c:if> <fmt:message key="timeOffer"/>
</h2> </h2>
<form:form modelAttribute="timeOffer" class="form-horizontal" id="add-timeOffer-form"> <form:form modelAttribute="timeOffer" class="form-horizontal" id="add-timeOffer-form">
<div class="form-group has-feedback"> <div class="form-group has-feedback">
<form:hidden path="id"/> <form:hidden path="id"/>
<form:hidden path="code"/> <form:hidden path="code"/>
<form:hidden path="status"/> <form:hidden path="status"/>
<petclinic:inputField label="Fecha de inicio" name="start"/> <cheapy:inputField label="Fecha de inicio" placeholder="dd/MM/yyyy HH:mm" name="start"/>
<petclinic:inputField label="Fecha de fin" name="end"/> <cheapy:inputField label="Fecha de fin" placeholder="dd/MM/yyyy HH:mm" name="end"/>
<petclinic:inputField label="Hora de inicio" name="init"/> <cheapy:inputField label="Hora de inicio" placeholder="HH:mm" name="init"/>
<petclinic:inputField label="Hora de final" name="finish"/> <cheapy:inputField label="Hora de final" placeholder="HH:mm" name="finish"/>
<petclinic:inputField label="Descuento" name="discount"/> <cheapy:inputField label="Descuento" placeholder="XX% (Ej.15)" name="discount"/>
</div> </div>
<div class="form-group"> <div class="form-group">
<div class="col-sm-offset-2 col-sm-10"> <div class="col-sm-offset-2 col-sm-10">
<c:choose> <div class="btn-mod">
<c:when test="${timeOffer['new']}"> <c:choose>
<button class="btn btn-default" type="submit">Add Offer</button> <c:when test="${timeOffer['new']}">
</c:when> <button class="btn btn-default" type="submit" style="font-family: 'Lobster'; font-size: 20px;">
<c:otherwise> <span class="glyphicon glyphicon-floppy-save" aria-hidden="true" style="padding: 5px"> </span>
<button class="btn btn-default" type="submit">Update Offer</button> Crear oferta</button>
</c:otherwise> </c:when>
</c:choose> <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>
</div> </div>
</form:form> </form:form>
</petclinic:layout>
<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

@ -11,7 +11,7 @@
<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"> <table id="timeOfferTable" class="table table-striped">
<thead> <thead>
<tr> <tr>
<th><fmt:message key="offerBeginning"/></th> <th><fmt:message key="offerBeginning"/></th>
@ -21,9 +21,17 @@
<th><fmt:message key="offerEnding"/></th> <th><fmt:message key="offerEnding"/></th>
<td><c:out value="${localDateTimeFormat.format(timeOffer.end)}"/></td> <td><c:out value="${localDateTimeFormat.format(timeOffer.end)}"/></td>
</tr> </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> <tr>
<th><fmt:message key="discount"/></th> <th><fmt:message key="discount"/></th>
<td><c:out value="${timeOffer.discount}"/></td> <td><c:out value="${timeOffer.discount}%"/></td>
</tr> </tr>
<tr> <tr>
<th><fmt:message key="offerCode"/></th> <th><fmt:message key="offerCode"/></th>
@ -32,25 +40,42 @@
</thead> </thead>
</table> </table>
<spring:url value="{timeOfferId}/edit" var="editUrl"> <div class="btn-menu">
<spring:param name="timeOfferId" value="${timeOffer.id}"/> <div class="btn-return">
</spring:url> <button type="button" role="link" onclick="goBack()" style="font-family: 'Lobster'; font-size: 20px;">
<a href="${fn:escapeXml(editUrl)}" class="btn btn-default">Editar oferta</a> <span class="glyphicon glyphicon-arrow-left" aria-hidden="true" style="padding: 5px"> </span>
<fmt:message key="return"/> </button>
<spring:url value="{timeOfferId}/activate" var="activateUrl"> </div>
<spring:param name="timeOfferId" value="${timeOffer.id}"/>
</spring:url>
<a href="${fn:escapeXml(activateUrl)}" class="btn btn-default">Activar oferta</a>
<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>
<div class="btn-return"> <div class="btns-edit">
<button type="button" role="link" onclick="window.location='/offers'" style="font-family: 'Lobster'; font-size: 20px;"> <spring:url value="{timeOfferId}/edit" var="editUrl">
<span class="glyphicon glyphicon-arrow-left" aria-hidden="true" style="padding: 5px"> </span> <spring:param name="timeOfferId" value="${timeOffer.id}"/>
<fmt:message key="return"/> </button> </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>
<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>
<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>
</div>
</div> </div>
<script>
function goBack() {
window.history.back()
}
</script>
</cheapy:layout> </cheapy:layout>

View file

@ -1,11 +1,14 @@
<%@ page session="false" trimDirectiveWhitespaces="true" %> <%@ page session="false" trimDirectiveWhitespaces="true" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %> <%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> <%@ 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="cheapy" tagdir="/WEB-INF/tags" %>
<link href='https://fonts.googleapis.com/css?family=Lobster' rel='stylesheet'> <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" %-->
<%@ 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> <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="row">
<div class="col-md-12"> <div class="col-md-12">
@ -14,10 +17,19 @@
<img class="img-responsive" src="${cheapyImage}"/> <img class="img-responsive" src="${cheapyImage}"/>
</div> </div>
<div class="btn-home"> <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> <span class="glyphicon glyphicon-cutlery" aria-hidden="true" style="padding: 5px"> </span>
<fmt:message key="listOffers"/> </button> <fmt:message key="listOffers"/> </button>
</div> </div>
<sec:authorize access="hasAnyAuthority('cliente')">
<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>
</div> </div>
</cheapy:layout> </cheapy:layout>

View file

@ -5,15 +5,17 @@
description="Name of corresponding property in bean object" %> description="Name of corresponding property in bean object" %>
<%@ attribute name="label" required="true" rtexprvalue="true" <%@ attribute name="label" required="true" rtexprvalue="true"
description="Label appears in red color if input is considered as invalid after submission" %> 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" %>
<spring:bind path="${name}"> <spring:bind path="${name}">
<c:set var="cssGroup" value="form-group ${status.error ? 'has-error' : '' }"/> <c:set var="cssGroup" value="form-group ${status.error ? 'has-error' : '' }"/>
<c:set var="valid" value="${not status.error and not empty status.actualValue}"/> <c:set var="valid" value="${not status.error and not empty status.actualValue}"/>
<div class="${cssGroup}"> <div class="${cssGroup}">
<label class="col-sm-2 control-label">${label}</label> <label class="col-sm-2 control-label">${label}</label>
<div class="col-sm-10"> <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}"> <c:if test="${valid}">
<span class="glyphicon glyphicon-ok form-control-feedback" aria-hidden="true"></span> <span class="glyphicon glyphicon-ok form-control-feedback" aria-hidden="true"></span>
</c:if> </c:if>