mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-23 07:45:49 +00:00
Añadido placeholders a los formularios, arreglo del login y más cambios
This commit is contained in:
parent
e3c9228185
commit
d5ded1d809
13 changed files with 150 additions and 49 deletions
|
@ -47,10 +47,10 @@ public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
|
|||
.antMatchers("/offers/speed/**").hasAnyAuthority("admin", "cliente")
|
||||
.antMatchers("/offers/food/**").hasAnyAuthority("admin", "cliente")
|
||||
.antMatchers("/owners/**").hasAnyAuthority("owner", "admin")
|
||||
|
||||
|
||||
.antMatchers("/clients/new").permitAll()
|
||||
.antMatchers("/offers").permitAll()
|
||||
|
||||
.antMatchers("/offersCreate").hasAuthority("cliente")
|
||||
|
||||
|
||||
.and().formLogin()
|
||||
|
|
|
@ -12,6 +12,9 @@ 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;
|
||||
|
||||
|
@ -50,6 +53,12 @@ public class OfertaController {
|
|||
return "offers/offersList";
|
||||
|
||||
}
|
||||
|
||||
@GetMapping("/offersCreate")
|
||||
public String createOffers() {
|
||||
|
||||
return "offers/offersCreate";
|
||||
}
|
||||
|
||||
// @GetMapping("/owners/{ownerId}/edit")
|
||||
// public String initUpdateOwnerForm(@PathVariable("ownerId") int ownerId, Model model) {
|
||||
|
|
|
@ -240,6 +240,38 @@ 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;
|
||||
|
|
|
@ -4,10 +4,11 @@ deleteOffer=Eliminar Oferta
|
|||
cancel=Cancelar
|
||||
deleteOfferMessage=Confirme que quiere eliminar su oferta
|
||||
listOffers=Ver Ofertas
|
||||
foodOffers=Ofertas por plato especifico
|
||||
foodOffer=Oferta por plato especifico
|
||||
nuOffers=Ofertas por numero de comensales
|
||||
nuOffer=Oferta por numero de comensales
|
||||
createOffers=Crear Ofertas
|
||||
foodOffers=Ofertas por plato específico
|
||||
foodOffer=Oferta por plato específico
|
||||
nuOffers=Ofertas por número de comensales
|
||||
nuOffer=Oferta por número de comensales
|
||||
speedOffers=Ofertas rapidez comiendo
|
||||
speedOffer=Oferta por comer veloz
|
||||
timeOffers=Ofertas por franja horaria
|
||||
|
@ -27,12 +28,16 @@ offerBeginning=Inicio de la oferta
|
|||
endDate=Fecha fin
|
||||
offerEnding=Fin de la oferta
|
||||
details=Detalles
|
||||
offerCode=Codigo de la oferta
|
||||
offerCode=Código de la oferta
|
||||
return=Volver
|
||||
required=Es requeridOfertas por franja horariao
|
||||
required=Es requerido Ofertas por franja horaria
|
||||
notFound=No ha sido encontrado
|
||||
duplicate=Ya se encuentra en uso
|
||||
nonNumeric=Sólo debe contener numeros
|
||||
duplicateFormSubmission=No se permite el envío de formularios duplicados
|
||||
typeMismatch.date=Fecha invalida
|
||||
typeMismatch.birthDate=Fecha invalida
|
||||
nonNumeric=Sólo debe contener números
|
||||
duplicateFormSubmission=No se permite el envío de formularios duplicados
|
||||
typeMismatch.date=Fecha inválida
|
||||
typeMismatch.birthDate=Fecha inválida
|
||||
createFoodOffers= Crear ofertas por plato específico
|
||||
createNuOffers= Crear ofertas por número de comensales
|
||||
createSpeedOffers= Crear ofertas por rapidez comiendo
|
||||
createTimeOffers= Crear ofertas por franja horaria
|
|
@ -16,10 +16,10 @@
|
|||
<form:hidden path="id"/>
|
||||
<form:hidden path="code"/>
|
||||
<form:hidden path="status"/>
|
||||
<petclinic:inputField label="Start Date" name="start"/>
|
||||
<petclinic:inputField label="End Date" name="end"/>
|
||||
<petclinic:inputField label="Food" name="food"/>
|
||||
<petclinic:inputField label="Discount" name="discount"/>
|
||||
<petclinic:inputField label="Fecha de Inicio" placeholder="dd/MM/yyyy HH:mm" name="start"/>
|
||||
<petclinic:inputField label="Fecha de Fin" placeholder="dd/MM/yyyy HH:mm" name="end"/>
|
||||
<petclinic:inputField label="Plato" placeholder="Ej. Macarrones" name="food"/>
|
||||
<petclinic:inputField label="Descuento" placeholder="Ej. 50" name="discount"/>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-offset-2 col-sm-10">
|
||||
|
|
|
@ -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,20 +277,23 @@
|
|||
<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"> Invalid username or password</p>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- Login Form -->
|
||||
<form class='form-signin' action="/login" method='POST'>
|
||||
<input type="text" id="username" class="fadeIn second" name="username" placeholder="username" required autofocus>
|
||||
<input type="password" id="password" class="fadeIn third" name="password" placeholder="password" required>
|
||||
<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="Contraseña" required>
|
||||
<sec:csrfInput />
|
||||
<input type="submit" class="fadeIn fourth" value="Login">
|
||||
<input type="submit" class="fadeIn fourth" value="Iniciar sesión">
|
||||
</form>
|
||||
|
||||
<!-- Remind Passowrd -->
|
||||
|
|
|
@ -16,15 +16,15 @@
|
|||
<form:hidden path="id"/>
|
||||
<form:hidden path="code"/>
|
||||
<form:hidden path="status"/>
|
||||
<petclinic:inputField label="Fecha de inicio" name="start"/>
|
||||
<petclinic:inputField label="Fecha de fin" name="end"/>
|
||||
<petclinic:inputField label="Fecha de Inicio" placeholder="dd/MM/yyyy HH:mm" name="start"/>
|
||||
<petclinic:inputField label="Fecha de Fin" placeholder="dd/MM/yyyy HH:mm" name="end"/>
|
||||
|
||||
<petclinic:inputField label="Oro" name="gold"/>
|
||||
<petclinic:inputField label="descuento de oro" name="discountGold"/>
|
||||
<petclinic:inputField label="Plata" name="silver"/>
|
||||
<petclinic:inputField label="Descuento de plata" name="discountSilver"/>
|
||||
<petclinic:inputField label="Bronce" name="bronze"/>
|
||||
<petclinic:inputField label="Descuento de bronce" name="discountBronze"/>
|
||||
<petclinic:inputField label="Número de comensales (nivel Oro)" placeholder="XX (Ej. 6)" name="gold"/>
|
||||
<petclinic:inputField label="Descuento de nivel oro" placeholder="XX% (Ej. 30)" name="discountGold"/>
|
||||
<petclinic:inputField label="Número de comensales (nivel Plata)" placeholder="XX (Ej. 4)" name="silver"/>
|
||||
<petclinic:inputField label="Descuento de plata" placeholder="XX% (Ej. 15)" name="discountSilver"/>
|
||||
<petclinic:inputField label="Número de comensales (nivel Bronce)" placeholder="XX (Ej. 2)" name="bronze"/>
|
||||
<petclinic:inputField label="Descuento de bronce" placeholder="XX% (Ej. 5)" name="discountBronze"/>
|
||||
|
||||
</div>
|
||||
<div class="form-group">
|
||||
|
|
36
src/main/webapp/WEB-INF/jsp/offers/offersCreate.jsp
Normal file
36
src/main/webapp/WEB-INF/jsp/offers/offersCreate.jsp
Normal file
|
@ -0,0 +1,36 @@
|
|||
<%@ 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>
|
||||
</cheapy:layout>
|
|
@ -16,14 +16,14 @@
|
|||
<form:hidden path="id"/>
|
||||
<form:hidden path="code"/>
|
||||
<form:hidden path="status"/>
|
||||
<petclinic:inputField label="Start Date" name="start"/>
|
||||
<petclinic:inputField label="End Date" name="end"/>
|
||||
<petclinic:inputField label="Gold" name="gold"/>
|
||||
<petclinic:inputField label="Gold Discount" name="discountGold"/>
|
||||
<petclinic:inputField label="Silver" name="silver"/>
|
||||
<petclinic:inputField label="Silver Discount" name="discountSilver"/>
|
||||
<petclinic:inputField label="Bronze" name="bronze"/>
|
||||
<petclinic:inputField label="Bronze Discount" name="discountBronze"/>
|
||||
<petclinic:inputField label="Fecha de Inicio" placeholder="dd/MM/yyyy HH:mm" name="start"/>
|
||||
<petclinic:inputField label="Fecha de Fin" placeholder="dd/MM/yyyy HH:mm" name="end"/>
|
||||
<petclinic:inputField label="Tiempo para comer (nivel Oro)" placeholder="XX minutos (Ej. 5)" name="gold"/>
|
||||
<petclinic:inputField label="Descuento nivel Oro" placeholder="XX% (Ej. 35)" name="discountGold"/>
|
||||
<petclinic:inputField label="Tiempo para comer (nivel Plata)" placeholder="XX minutos (Ej. 10)" name="silver"/>
|
||||
<petclinic:inputField label="Descuento nivel Plata" placeholder="XX% (Ej. 15)" name="discountSilver"/>
|
||||
<petclinic:inputField label="Tiempo para comer (nivel Bronce)" placeholder="XX minutos (Ej. 20)" name="bronze"/>
|
||||
<petclinic: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">
|
||||
|
|
|
@ -16,12 +16,12 @@
|
|||
<form:hidden path="id"/>
|
||||
<form:hidden path="code"/>
|
||||
<form:hidden path="status"/>
|
||||
<petclinic:inputField label="Fecha de inicio" name="start"/>
|
||||
<petclinic:inputField label="Fecha de fin" name="end"/>
|
||||
<petclinic:inputField label="Fecha de inicio" placeholder="dd/MM/yyyy HH:mm" name="start"/>
|
||||
<petclinic:inputField label="Fecha de fin" placeholder="dd/MM/yyyy HH:mm" name="end"/>
|
||||
|
||||
<petclinic:inputField label="Hora de inicio" name="init"/>
|
||||
<petclinic:inputField label="Hora de final" name="finish"/>
|
||||
<petclinic:inputField label="Decuento" name="discount"/>
|
||||
<petclinic:inputField label="Hora de inicio" placeholder="HH:mm" name="init"/>
|
||||
<petclinic:inputField label="Hora de final" placeholder="HH:mm" name="finish"/>
|
||||
<petclinic:inputField label="Descuento" placeholder="XX% (Ej.15)" name="discount"/>
|
||||
|
||||
</div>
|
||||
<div class="form-group">
|
||||
|
|
|
@ -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('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>
|
||||
</cheapy:layout>
|
||||
|
|
|
@ -5,15 +5,17 @@
|
|||
description="Name of corresponding property in bean object" %>
|
||||
<%@ attribute name="label" required="true" rtexprvalue="true"
|
||||
description="Label appears in red color if input is considered as invalid after submission" %>
|
||||
<%@ attribute name="placeholder" required="false" rtexprvalue="true"
|
||||
description="Placeholder para los campos en los input fields" %>
|
||||
|
||||
<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>
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
<cheapy:menuItem active="${name eq 'home'}" url="/"
|
||||
title="home page">
|
||||
<span class="glyphicon glyphicon-home" aria-hidden="true"></span>
|
||||
<span>Home</span>
|
||||
<span>Inicio</span>
|
||||
</cheapy:menuItem>
|
||||
|
||||
<cheapy:menuItem active="${name eq 'ofertas'}" url="/offers"
|
||||
|
|
Loading…
Reference in a new issue