mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-23 15:55:49 +00:00
Merge pull request #107 from cheapy-ispp/025-cambiar-vistas-sprint2
025 cambiar vistas sprint2
This commit is contained in:
commit
0c03b0b737
9 changed files with 137 additions and 28 deletions
|
@ -36,12 +36,10 @@ public class Offer extends BaseEntity {
|
|||
|
||||
@DateTimeFormat(pattern = "dd/MM/yyyy HH:mm")
|
||||
@NotNull(message = "Debe introducir una fecha de inicio")
|
||||
@Future(message = "La fecha debe debe ser futura")
|
||||
private LocalDateTime start;
|
||||
|
||||
@DateTimeFormat(pattern = "dd/MM/yyyy HH:mm")
|
||||
@NotNull(message = "Debe introducir una fecha de fin")
|
||||
@Future(message = "La fecha debe debe ser futura")
|
||||
private LocalDateTime end;
|
||||
|
||||
private String code;
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
package org.springframework.cheapy.web;
|
||||
|
||||
import java.security.Principal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -23,6 +24,7 @@ import org.springframework.validation.BindingResult;
|
|||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
@Controller
|
||||
public class NuOfferController {
|
||||
|
|
|
@ -14,15 +14,13 @@
|
|||
|
||||
<form:form modelAttribute="client" class="form-horizontal" id="add-client-form">
|
||||
<div class="form-group has-feedback">
|
||||
|
||||
<cheapy:inputField label="Contraseña" placeholder="Restaurante pepito" name="usuar.password"/>
|
||||
|
||||
|
||||
|
||||
<cheapy:passwordField label="Contraseña" placeholder="Restaurante pepito" name="usuar.password"/>
|
||||
<cheapy:inputField label="Hora de inicio" placeholder="HH:mm" name="init"/>
|
||||
<cheapy:inputField label="Hora de fin" placeholder="HH:mm" name="finish"/>
|
||||
<cheapy:inputField label="Name" placeholder="Restaurante pepito" name="name"/>
|
||||
<cheapy:inputField label="Email" placeholder="" name="email"/>
|
||||
<cheapy:inputField label="Dirección" placeholder="" name="address"/>
|
||||
<cheapy:inputField label="Dirección" placeholder="" name="address"/>
|
||||
<div class="form-group">
|
||||
<label>Municipio: </label>
|
||||
<select name="municipio">
|
||||
|
|
|
@ -5,27 +5,79 @@
|
|||
<%@ 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'>
|
||||
|
||||
<!-- <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.47/css/bootstrap-datetimepicker.css">
|
||||
|
||||
-->
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
|
||||
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
|
||||
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.10.3/moment-with-locales.js"></script>
|
||||
|
||||
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
|
||||
|
||||
<script src="http://cdn.rawgit.com/Eonasdan/bootstrap-datetimepicker/a549aa8780dbda16f6cff545aeabc3d71073911e/src/js/bootstrap-datetimepicker.js"></script>
|
||||
|
||||
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"/>
|
||||
|
||||
<link href="http://cdn.rawgit.com/Eonasdan/bootstrap-datetimepicker/a549aa8780dbda16f6cff545aeabc3d71073911e/build/css/bootstrap-datetimepicker.css" rel="stylesheet"/>
|
||||
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
|
||||
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.10.3/moment.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/2.4.4/js/bootstrap-datetimepicker.min.js"></script>
|
||||
|
||||
<cheapy:layout pageName="NumOffers">
|
||||
<h2 style="text-align:center;padding:5px">
|
||||
<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">
|
||||
<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"/>
|
||||
|
||||
<!-- <div class="container">
|
||||
<div class="row">
|
||||
<div class='col-sm-6'>
|
||||
<div class="form-group">
|
||||
<div class='input-group date' id='datetimepicker1'>
|
||||
<input type='text' class="form-control" />
|
||||
<span class="input-group-addon">
|
||||
<span class="glyphicon glyphicon-calendar"></span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
$('#datetimepicker1').datetimepicker();
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
-->
|
||||
|
||||
|
||||
<cheapy:dateField label="Fecha de Inicio" name="start"></cheapy:dateField>
|
||||
<script>
|
||||
|
||||
var date= document.getElementsByName("start")
|
||||
date.replace('T', ' ');
|
||||
|
||||
</script>
|
||||
<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"/>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-offset-2 col-sm-10">
|
||||
|
@ -45,7 +97,8 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form:form>
|
||||
|
||||
|
||||
|
||||
</cheapy:layout>
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
</div>
|
||||
<cheapy:inputField label="Direccion" name="direccion"/>
|
||||
<cheapy:inputField label="Email" name="email"/>
|
||||
<cheapy:inputField label="Password" name="usuar.password"/>
|
||||
<cheapy:passwordField label="Password" name="usuar.password"/>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-offset-2 col-sm-10">
|
||||
|
|
|
@ -34,23 +34,11 @@
|
|||
<span class="glyphicon glyphicon-cutlery" aria-hidden="true" style="padding: 5px"> </span>
|
||||
<fmt:message key="createOffers"/> </button>
|
||||
</div>
|
||||
<div class="btn-home">
|
||||
<button type="button" role="link" onclick="window.location='/clients/show'" style="font-family: 'Lobster'; font-size: 20px;margin:5px;" class="btn-block">
|
||||
<span class="glyphicon glyphicon-cutlery" aria-hidden="true" style="padding: 5px"> </span>
|
||||
<fmt:message key="clientShow"/> </button>
|
||||
</div>
|
||||
|
||||
|
||||
</sec:authorize>
|
||||
</div>
|
||||
<sec:authorize access="hasAnyAuthority('usuario')">
|
||||
<div class="btn-home-max">
|
||||
<div class="btn-home">
|
||||
<button type="button" role="link" onclick="window.location='/usuarios/show'" style="font-family: 'Lobster'; font-size: 20px;margin:5px;">
|
||||
<span class="glyphicon glyphicon-cutlery" aria-hidden="true" style="padding: 5px"> </span>
|
||||
<fmt:message key="showUsuario"/> </button>
|
||||
</div>
|
||||
</div>
|
||||
</sec:authorize>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
|
29
src/main/webapp/WEB-INF/tags/dateField.tag
Normal file
29
src/main/webapp/WEB-INF/tags/dateField.tag
Normal file
|
@ -0,0 +1,29 @@
|
|||
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
|
||||
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
||||
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
|
||||
<%@ attribute name="name" required="true" rtexprvalue="true"
|
||||
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 type="datetime-local" class="form-control" path="${name}"/>
|
||||
|
||||
<c:if test="${valid}">
|
||||
<span class="glyphicon glyphicon-ok form-control-feedback" aria-hidden="true"></span>
|
||||
</c:if>
|
||||
<c:if test="${status.error}">
|
||||
<span class="glyphicon glyphicon-remove form-control-feedback" aria-hidden="true"></span>
|
||||
<span class="help-inline">${status.errorMessage}</span>
|
||||
</c:if>
|
||||
</div>
|
||||
</div>
|
||||
</spring:bind>
|
|
@ -71,8 +71,21 @@
|
|||
</cheapy:menuItem>
|
||||
</sec:authorize>
|
||||
</ul>
|
||||
|
||||
|
||||
<ul class="nav navbar-nav navbar-right">
|
||||
|
||||
<sec:authorize access="hasAnyAuthority('client')">
|
||||
<cheapy:menuItem active="${name eq 'miPerfil'}" url="/clients/show" title="miPerfil">
|
||||
<span class="glyphicon glyphicon-user" aria-hidden="true"></span>
|
||||
<span>Mi perfil</span>
|
||||
</cheapy:menuItem>
|
||||
</sec:authorize>
|
||||
<sec:authorize access="hasAnyAuthority('usuario')">
|
||||
<cheapy:menuItem active="${name eq 'miPerfil'}" url="/usuarios/show" title="miPerfil">
|
||||
<span class="glyphicon glyphicon-user" aria-hidden="true"></span>
|
||||
<span>Mi perfil</span>
|
||||
</cheapy:menuItem>
|
||||
</sec:authorize>
|
||||
<sec:authorize access="!isAuthenticated()">
|
||||
<li><a href="<c:url value="/login" />">Iniciar sesión</a></li>
|
||||
<!--<li><a href="<c:url value="/users/new" />">Register</a></li>-->
|
||||
|
|
28
src/main/webapp/WEB-INF/tags/passwordField.tag
Normal file
28
src/main/webapp/WEB-INF/tags/passwordField.tag
Normal file
|
@ -0,0 +1,28 @@
|
|||
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
|
||||
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
||||
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
|
||||
<%@ attribute name="name" required="true" rtexprvalue="true"
|
||||
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 type="password" 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>
|
||||
<c:if test="${status.error}">
|
||||
<span class="glyphicon glyphicon-remove form-control-feedback" aria-hidden="true"></span>
|
||||
<span class="help-inline">${status.errorMessage}</span>
|
||||
</c:if>
|
||||
</div>
|
||||
</div>
|
||||
</spring:bind>
|
Loading…
Reference in a new issue