mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-24 00:05:48 +00:00
#87 Actualizacion con Develop a 018.Paginacion
Actualizacion de rama con Develop
This commit is contained in:
commit
ca65afb304
57 changed files with 1814 additions and 822 deletions
|
@ -1,7 +1,5 @@
|
|||
package org.springframework.cheapy.configuration;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController;
|
||||
import org.springframework.web.bind.annotation.ControllerAdvice;
|
||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
@ -14,9 +12,6 @@ import javax.servlet.http.HttpServletRequest;
|
|||
@ControllerAdvice
|
||||
public class ExceptionHandlerConfiguration
|
||||
{
|
||||
@Autowired
|
||||
private BasicErrorController errorController;
|
||||
// add any exceptions/validations/binding problems
|
||||
|
||||
@ExceptionHandler(Exception.class)
|
||||
public String defaultErrorHandler(HttpServletRequest request, Exception ex) {
|
||||
|
|
|
@ -21,6 +21,7 @@ import org.springframework.security.crypto.password.PasswordEncoder;
|
|||
*/
|
||||
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Configuration
|
||||
@EnableWebSecurity
|
||||
public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
|
||||
|
@ -35,12 +36,17 @@ public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
|
|||
http.authorizeRequests().antMatchers("/resources/**", "/webjars/**", "/h2-console/**").permitAll()
|
||||
.antMatchers(HttpMethod.GET, "/", "/oups").permitAll()
|
||||
.antMatchers("/users/new").permitAll()
|
||||
|
||||
.antMatchers("/clients/new").permitAll()
|
||||
.antMatchers("/clients/edit").hasAnyAuthority("client")
|
||||
.antMatchers("/clients/disable").hasAnyAuthority("client")
|
||||
|
||||
.antMatchers("/login/**").anonymous()
|
||||
.antMatchers("/logout").authenticated()
|
||||
|
||||
.antMatchers("/usuarios/new").permitAll()
|
||||
.antMatchers("/admin/**").hasAnyAuthority("admin")
|
||||
.antMatchers("/usuarios/**").hasAnyAuthority("usuario")
|
||||
.antMatchers("/administrators/**").hasAnyAuthority("admin")
|
||||
|
||||
.antMatchers("/owners/**").hasAnyAuthority("owner", "admin")
|
||||
|
||||
|
@ -48,7 +54,6 @@ public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
|
|||
.antMatchers("/offers/**/new").hasAnyAuthority("admin", "client")
|
||||
.antMatchers("/offers/**/activate").hasAnyAuthority("admin","client")
|
||||
|
||||
.antMatchers("/clients/new").permitAll()
|
||||
.antMatchers("/offers").permitAll()
|
||||
.antMatchers("/offersCreate").hasAuthority("client")
|
||||
|
||||
|
|
|
@ -1,15 +1,29 @@
|
|||
package org.springframework.cheapy.model;
|
||||
|
||||
import javax.persistence.CascadeType;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.OneToOne;
|
||||
import javax.persistence.Table;
|
||||
|
||||
@Entity
|
||||
@Table(name = "administrators")
|
||||
public class Administrator extends User{
|
||||
public class Administrator extends BaseEntity{
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@OneToOne(cascade = CascadeType.ALL)
|
||||
@JoinColumn(name = "username", referencedColumnName = "username")
|
||||
private User usuar;
|
||||
|
||||
public User getUsuar() {
|
||||
return usuar;
|
||||
}
|
||||
|
||||
public void setUsuar(User usuar) {
|
||||
this.usuar = usuar;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package org.springframework.cheapy.model;
|
||||
|
||||
import java.time.LocalTime;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.persistence.CascadeType;
|
||||
import javax.persistence.Entity;
|
||||
|
@ -10,8 +10,10 @@ import javax.persistence.OneToMany;
|
|||
import javax.persistence.OneToOne;
|
||||
import javax.persistence.Table;
|
||||
import javax.validation.constraints.Digits;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
@Entity
|
||||
@Table(name = "clients")
|
||||
|
@ -32,12 +34,14 @@ public class Client extends BaseEntity {
|
|||
private String address;
|
||||
|
||||
// Hora de apertura del local
|
||||
@NotBlank
|
||||
private String init;
|
||||
@DateTimeFormat(pattern = "HH:mm")
|
||||
@NotNull(message = "Debe introducir una hora de apertura")
|
||||
private LocalTime init;
|
||||
|
||||
// Hora de cierre del local
|
||||
@NotBlank
|
||||
private String finish;
|
||||
@DateTimeFormat(pattern = "HH:mm")
|
||||
@NotNull(message = "Debe introducir una hora de cierre")
|
||||
private LocalTime finish;
|
||||
|
||||
@NotEmpty
|
||||
@Digits(fraction = 0, integer = 10)
|
||||
|
@ -93,19 +97,19 @@ public class Client extends BaseEntity {
|
|||
this.address = address;
|
||||
}
|
||||
|
||||
public String getInit() {
|
||||
public LocalTime getInit() {
|
||||
return init;
|
||||
}
|
||||
|
||||
public void setInit(String init) {
|
||||
public void setInit(LocalTime init) {
|
||||
this.init = init;
|
||||
}
|
||||
|
||||
public String getFinish() {
|
||||
public LocalTime getFinish() {
|
||||
return finish;
|
||||
}
|
||||
|
||||
public void setFinish(String finish) {
|
||||
public void setFinish(LocalTime finish) {
|
||||
this.finish = finish;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,69 +0,0 @@
|
|||
package org.springframework.cheapy.model;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Table;
|
||||
import javax.validation.constraints.Digits;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
|
||||
import org.springframework.core.style.ToStringCreator;
|
||||
|
||||
@Entity
|
||||
@Table(name = "owners")
|
||||
public class Owner extends Person {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Column(name = "address")
|
||||
@NotEmpty
|
||||
private String address;
|
||||
|
||||
@Column(name = "city")
|
||||
@NotEmpty
|
||||
private String city;
|
||||
|
||||
@Column(name = "telephone")
|
||||
@NotEmpty
|
||||
@Digits(fraction = 0, integer = 10)
|
||||
private String telephone;
|
||||
|
||||
|
||||
public String getAddress() {
|
||||
return this.address;
|
||||
}
|
||||
|
||||
public void setAddress(String address) {
|
||||
this.address = address;
|
||||
}
|
||||
|
||||
public String getCity() {
|
||||
return this.city;
|
||||
}
|
||||
|
||||
public void setCity(String city) {
|
||||
this.city = city;
|
||||
}
|
||||
|
||||
public String getTelephone() {
|
||||
return this.telephone;
|
||||
}
|
||||
|
||||
public void setTelephone(String telephone) {
|
||||
this.telephone = telephone;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringCreator(this)
|
||||
|
||||
.append("id", this.getId()).append("new", this.isNew()).append("lastName", this.getLastName())
|
||||
.append("firstName", this.getFirstName()).append("address", this.address).append("city", this.city)
|
||||
.append("telephone", this.telephone).toString();
|
||||
}
|
||||
|
||||
}
|
|
@ -36,4 +36,11 @@ public class User{
|
|||
this.password = password;
|
||||
}
|
||||
|
||||
public boolean getEnabled() {
|
||||
return enabled;
|
||||
}
|
||||
|
||||
public void setEnabled(boolean enabled) {
|
||||
this.enabled = enabled;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,9 +12,9 @@ import javax.validation.constraints.NotBlank;
|
|||
@Table(name = "usuarios")
|
||||
public class Usuario extends BaseEntity{
|
||||
|
||||
/** nombre, apellidos, dni, direccion, telefono, email, username
|
||||
* (id,nombre, apellidos, dni, direccion, telefono, email, usuar)
|
||||
*/
|
||||
/* nombre, apellidos, dni, direccion, telefono, email, username
|
||||
(id,nombre, apellidos, dni, direccion, telefono, email, usuar)*/
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@NotBlank
|
||||
|
@ -89,11 +89,11 @@ public class Usuario extends BaseEntity{
|
|||
this.email = email;
|
||||
}
|
||||
|
||||
public User getUser() {
|
||||
public User getUsuar() {
|
||||
return usuar;
|
||||
}
|
||||
|
||||
public void setUser(User username) {
|
||||
public void setUsuar(User username) {
|
||||
this.usuar = username;
|
||||
}
|
||||
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
package org.springframework.cheapy.model;
|
|
@ -1,8 +1,14 @@
|
|||
package org.springframework.cheapy.repository;
|
||||
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
import org.springframework.cheapy.model.Client;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
import org.springframework.data.repository.Repository;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
public interface ClientRepository extends CrudRepository<Client, String> {
|
||||
|
@ -10,5 +16,15 @@ public interface ClientRepository extends CrudRepository<Client, String> {
|
|||
@Query("SELECT client FROM Client client WHERE username =:username")
|
||||
@Transactional(readOnly = true)
|
||||
Client findByUsername(String username);
|
||||
|
||||
Optional<Client> findById(Integer id);
|
||||
|
||||
}
|
||||
|
||||
// void save(Client client);
|
||||
|
||||
@Query("SELECT client FROM Client client")
|
||||
@Transactional(readOnly = true)
|
||||
List<Client> findAllClient();
|
||||
|
||||
|
||||
}
|
|
@ -2,7 +2,6 @@ package org.springframework.cheapy.repository;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.cheapy.model.FoodOffer;
|
||||
import org.springframework.cheapy.model.NuOffer;
|
||||
import org.springframework.cheapy.model.StatusOffer;
|
||||
import org.springframework.data.repository.Repository;
|
||||
|
|
|
@ -1,65 +0,0 @@
|
|||
/*
|
||||
* Copyright 2012-2019 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.cheapy.repository;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import org.springframework.cheapy.model.Owner;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.Repository;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* Repository class for <code>Owner</code> domain objects All method names are compliant
|
||||
* with Spring Data naming conventions so this interface can easily be extended for Spring
|
||||
* Data. See:
|
||||
* https://docs.spring.io/spring-data/jpa/docs/current/reference/html/#repositories.query-methods.query-creation
|
||||
*
|
||||
* @author Ken Krebs
|
||||
* @author Juergen Hoeller
|
||||
* @author Sam Brannen
|
||||
* @author Michael Isvy
|
||||
*/
|
||||
public interface OwnerRepository extends Repository<Owner, Integer> {
|
||||
|
||||
/**
|
||||
* Retrieve {@link Owner}s from the data store by last name, returning all owners
|
||||
* whose last name <i>starts</i> with the given name.
|
||||
* @param lastName Value to search for
|
||||
* @return a Collection of matching {@link Owner}s (or an empty Collection if none
|
||||
* found)
|
||||
*/
|
||||
@Query("SELECT DISTINCT owner FROM Owner owner WHERE owner.lastName LIKE :lastName%")
|
||||
@Transactional(readOnly = true)
|
||||
Collection<Owner> findByLastName(@Param("lastName") String lastName);
|
||||
|
||||
/**
|
||||
* Retrieve an {@link Owner} from the data store by id.
|
||||
* @param id the id to search for
|
||||
* @return the {@link Owner} if found
|
||||
*/
|
||||
@Query("SELECT owner FROM Owner owner WHERE id =:id")
|
||||
@Transactional(readOnly = true)
|
||||
Owner findById(@Param("id") Integer id);
|
||||
|
||||
/**
|
||||
* Save an {@link Owner} to the data store, either inserting or updating it.
|
||||
* @param owner the {@link Owner} to save
|
||||
*/
|
||||
void save(Owner owner);
|
||||
|
||||
}
|
|
@ -2,7 +2,6 @@ package org.springframework.cheapy.repository;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.cheapy.model.FoodOffer;
|
||||
import org.springframework.cheapy.model.SpeedOffer;
|
||||
import org.springframework.cheapy.model.StatusOffer;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
package org.springframework.cheapy.repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.cheapy.model.Usuario;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.Repository;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
public interface UsuarioRepository extends Repository<Usuario, String> {
|
||||
|
||||
@Query("SELECT usuario FROM Usuario usuario WHERE username =:username")
|
||||
@Transactional(readOnly = true)
|
||||
Usuario findByUsername(String username);
|
||||
|
||||
@Query("SELECT usuario FROM Usuario usuario")
|
||||
@Transactional(readOnly = true)
|
||||
List<Usuario> findAllUsuario();
|
||||
|
||||
void save(Usuario usuario);
|
||||
|
||||
}
|
|
@ -15,16 +15,7 @@
|
|||
*/
|
||||
package org.springframework.cheapy.service;
|
||||
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.dao.DataAccessException;
|
||||
import org.springframework.cheapy.model.Authorities;
|
||||
import org.springframework.cheapy.model.User;
|
||||
import org.springframework.cheapy.repository.AuthoritiesRepository;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@Service
|
||||
public class AuthoritiesService {
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package org.springframework.cheapy.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cheapy.model.Client;
|
||||
import org.springframework.cheapy.repository.ClientRepository;
|
||||
|
@ -26,4 +28,16 @@ public class ClientService {
|
|||
return this.clientRepository.findByUsername(username);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public Client findByUsername(String username) throws DataAccessException {
|
||||
return this.clientRepository.findByUsername(username);
|
||||
}
|
||||
|
||||
public void saveClient(final Client client) throws DataAccessException {
|
||||
this.clientRepository.save(client);
|
||||
}
|
||||
@Transactional
|
||||
public List<Client> findAllClient() throws DataAccessException {
|
||||
return this.clientRepository.findAllClient();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,34 +0,0 @@
|
|||
package org.springframework.cheapy.service;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cheapy.model.Owner;
|
||||
import org.springframework.cheapy.repository.OwnerRepository;
|
||||
import org.springframework.dao.DataAccessException;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class OwnerService {
|
||||
private OwnerRepository ownerRepository;
|
||||
|
||||
|
||||
@Autowired
|
||||
public OwnerService(final OwnerRepository ownerRepository) {
|
||||
this.ownerRepository = ownerRepository;
|
||||
}
|
||||
|
||||
public Owner findOwnerById(final int id) {
|
||||
return this.ownerRepository.findById(id);
|
||||
}
|
||||
|
||||
public Collection<Owner> findByLastName(final String lastname) { //
|
||||
return this.ownerRepository.findByLastName(lastname);
|
||||
|
||||
}
|
||||
|
||||
public void saveOwner(final Owner owner) throws DataAccessException { //
|
||||
this.ownerRepository.save(owner);
|
||||
|
||||
}
|
||||
}
|
|
@ -4,10 +4,7 @@ import java.util.List;
|
|||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cheapy.model.Review;
|
||||
import org.springframework.cheapy.model.StatusOffer;
|
||||
import org.springframework.cheapy.model.TimeOffer;
|
||||
import org.springframework.cheapy.repository.ReviewRepository;
|
||||
import org.springframework.cheapy.repository.TimeOfferRepository;
|
||||
|
||||
import org.springframework.dao.DataAccessException;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
|
|
@ -3,7 +3,6 @@ package org.springframework.cheapy.service;
|
|||
|
||||
import java.util.List;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cheapy.model.NuOffer;
|
||||
import org.springframework.cheapy.model.SpeedOffer;
|
||||
import org.springframework.cheapy.model.StatusOffer;
|
||||
import org.springframework.cheapy.repository.SpeedOfferRepository;
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
|
||||
package org.springframework.cheapy.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cheapy.model.Usuario;
|
||||
import org.springframework.cheapy.repository.UsuarioRepository;
|
||||
import org.springframework.dao.DataAccessException;
|
||||
import org.springframework.security.core.Authentication;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@Service
|
||||
public class UsuarioService {
|
||||
|
||||
private UsuarioRepository usuarioRepository;
|
||||
|
||||
|
||||
@Autowired
|
||||
public UsuarioService(final UsuarioRepository usuarioRepository) {
|
||||
this.usuarioRepository = usuarioRepository;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public Usuario getCurrentUsuario() throws DataAccessException {
|
||||
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
|
||||
String username = authentication.getName();
|
||||
return this.usuarioRepository.findByUsername(username);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public Usuario findByUsername(String username) throws DataAccessException {
|
||||
return this.usuarioRepository.findByUsername(username);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public List<Usuario> findAllUsuario() throws DataAccessException {
|
||||
return this.usuarioRepository.findAllUsuario();
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void saveUsuario(final Usuario usuario) throws DataAccessException {
|
||||
this.usuarioRepository.save(usuario);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,92 @@
|
|||
package org.springframework.cheapy.web;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.springframework.cheapy.model.Client;
|
||||
import org.springframework.cheapy.model.Usuario;
|
||||
import org.springframework.cheapy.service.ClientService;
|
||||
import org.springframework.cheapy.service.UsuarioService;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
|
||||
@Controller
|
||||
public class AdministratorController {
|
||||
|
||||
private static final String VIEWS_USUARIO_CREATE_OR_UPDATE_FORM = "usuarios/createOrUpdateUsuarioForm";
|
||||
|
||||
private final UsuarioService usuarioService;
|
||||
private final ClientService clientService;
|
||||
|
||||
public AdministratorController(final UsuarioService usuarioService, ClientService clientService) {
|
||||
this.usuarioService = usuarioService;
|
||||
this.clientService=clientService;
|
||||
}
|
||||
|
||||
@GetMapping("/administrators/usuarios")
|
||||
public String processFindUsuariosForm(Map<String, Object> model) {
|
||||
List<Usuario> usuarioLs = this.usuarioService.findAllUsuario();
|
||||
model.put("usuarioLs", usuarioLs);
|
||||
return "usuarios/usuariosList";
|
||||
}
|
||||
|
||||
@GetMapping("/administrators/clients")
|
||||
public String processFindClientesForm(Map<String, Object> model) {
|
||||
List<Client> clientLs = this.clientService.findAllClient();
|
||||
model.put("clientLs", clientLs);
|
||||
return "clients/clientsList";
|
||||
}
|
||||
@GetMapping("/administrators/usuarios/{username}")
|
||||
public String processUsuarioShowForm(@PathVariable("username") String username, Map<String, Object> model) {
|
||||
Usuario usuario = this.usuarioService.findByUsername(username);
|
||||
model.put("usuario", usuario);
|
||||
return "usuarios/usuariosShow";
|
||||
}
|
||||
|
||||
@GetMapping("/administrators/clients/{username}")
|
||||
public String processClientShowForm(@PathVariable("username") String username, Map<String, Object> model) {
|
||||
Client client = this.clientService.findByUsername(username);
|
||||
model.put("client", client);
|
||||
return "clients/clientShow";
|
||||
}
|
||||
|
||||
@GetMapping(value = "/administrators/usuarios/{username}/disable")
|
||||
public String disableUsuario(@PathVariable("username") final String username, final ModelMap model) {
|
||||
|
||||
Usuario usuario = this.usuarioService.findByUsername(username);
|
||||
model.put("usuario", usuario);
|
||||
return "usuarios/usuariosDisable";
|
||||
}
|
||||
|
||||
|
||||
@PostMapping(value = "/administrators/usuarios/{username}/disable")
|
||||
public String disableUsuarioForm(@PathVariable("username") final String username, final ModelMap model, final HttpServletRequest request) {
|
||||
|
||||
Usuario usuario = this.usuarioService.findByUsername(username);
|
||||
usuario.getUsuar().setEnabled(false);
|
||||
this.usuarioService.saveUsuario(usuario);
|
||||
return "redirect:/administrators/usuarios";
|
||||
}
|
||||
|
||||
|
||||
@GetMapping(value = "/administrators/clients/{username}/disable")
|
||||
public String disableClient(@PathVariable("username") final String username, final ModelMap model) {
|
||||
|
||||
Client client = this.clientService.findByUsername(username);
|
||||
model.put("client", client);
|
||||
return "clients/clientDisable";
|
||||
}
|
||||
@PostMapping(value = "/administrators/clients/{username}/disable")
|
||||
public String disableClientForm(@PathVariable("username") final String username, final ModelMap model, final HttpServletRequest request) {
|
||||
|
||||
Client client = this.clientService.findByUsername(username);
|
||||
client.getUsuar().setEnabled(false);
|
||||
this.clientService.saveClient(client);
|
||||
return "redirect:/administrators/clients";
|
||||
}
|
||||
}
|
|
@ -0,0 +1,168 @@
|
|||
|
||||
package org.springframework.cheapy.web;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cheapy.model.Client;
|
||||
import org.springframework.cheapy.model.FoodOffer;
|
||||
import org.springframework.cheapy.model.NuOffer;
|
||||
import org.springframework.cheapy.model.SpeedOffer;
|
||||
import org.springframework.cheapy.model.StatusOffer;
|
||||
import org.springframework.cheapy.model.TimeOffer;
|
||||
import org.springframework.cheapy.repository.ClientRepository;
|
||||
import org.springframework.cheapy.service.ClientService;
|
||||
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.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
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;
|
||||
|
||||
@Controller
|
||||
public class ClientController {
|
||||
|
||||
private static final String VIEWS_CREATE_OR_UPDATE_CLIENT = "clients/createOrUpdateClientForm";
|
||||
|
||||
private final ClientService clientService;
|
||||
|
||||
private final FoodOfferService foodOfferService;
|
||||
|
||||
private final SpeedOfferService speedOfferService;
|
||||
|
||||
private final NuOfferService nuOfferService;
|
||||
|
||||
private final TimeOfferService timeOfferService;
|
||||
|
||||
@Autowired
|
||||
private ClientRepository clientRepo;
|
||||
|
||||
|
||||
public ClientController(final ClientService clientService, FoodOfferService foodOfferService,
|
||||
SpeedOfferService speedOfferService, NuOfferService nuOfferService, TimeOfferService timeOfferService) {
|
||||
this.clientService = clientService;
|
||||
this.foodOfferService=foodOfferService;
|
||||
this.speedOfferService=speedOfferService;
|
||||
this.nuOfferService=nuOfferService;
|
||||
this.timeOfferService=timeOfferService;
|
||||
}
|
||||
|
||||
|
||||
private boolean checkTimes(final Client client) {
|
||||
boolean res = false;
|
||||
if(client.getFinish()==null || client.getInit()==null || client.getFinish().isAfter(client.getInit())) {
|
||||
res = true;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/clients/show")
|
||||
public String processShowForm(Map<String, Object> model) {
|
||||
|
||||
Client client = this.clientService.getCurrentClient();
|
||||
|
||||
|
||||
model.put("client", client);
|
||||
return "clients/clientShow";
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@GetMapping(value = "/clients/edit")
|
||||
public String updateClient( final ModelMap model, HttpServletRequest request) {
|
||||
|
||||
Client client = this.clientService.getCurrentClient();
|
||||
|
||||
model.addAttribute("client", client);
|
||||
|
||||
return ClientController.VIEWS_CREATE_OR_UPDATE_CLIENT;
|
||||
}
|
||||
|
||||
@PostMapping(value = "/clients/edit")
|
||||
public String updateClient(@Valid final Client clientEdit, final BindingResult result,
|
||||
final ModelMap model, HttpServletRequest request) {
|
||||
|
||||
|
||||
Client clienteSesion = this.clientService.getCurrentClient();
|
||||
|
||||
if(!this.checkTimes(clientEdit)) {
|
||||
result.rejectValue("finish","" ,"La hora de cierre debe ser posterior a la hora de apertura");
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (result.hasErrors()) {
|
||||
model.addAttribute("client", clientEdit);
|
||||
return ClientController.VIEWS_CREATE_OR_UPDATE_CLIENT;
|
||||
}
|
||||
|
||||
BeanUtils.copyProperties(clienteSesion, clientEdit, "name", "email", "address","init", "finish","telephone", "description","food","usuar");
|
||||
clientEdit.getUsuar().setUsername(clienteSesion.getUsuar().getUsername());
|
||||
clientEdit.getUsuar().setEnabled(true);
|
||||
this.clientService.saveClient(clientEdit);
|
||||
return "redirect:/clients/show";
|
||||
|
||||
}
|
||||
|
||||
@GetMapping(value = "/clients/disable")
|
||||
public String disableClient(final ModelMap model) {
|
||||
|
||||
Client client = this.clientService.getCurrentClient();
|
||||
model.put("client", client);
|
||||
return "/clients/clientDisable";
|
||||
}
|
||||
|
||||
@PostMapping(value = "/clients/disable")
|
||||
public String disableClientForm(final ModelMap model, HttpServletRequest request) {
|
||||
|
||||
|
||||
Client client = this.clientService.getCurrentClient();
|
||||
|
||||
|
||||
|
||||
List<FoodOffer> foodOffers=this.foodOfferService.findFoodOfferByUserId(client.getId());
|
||||
List<SpeedOffer> speedOffers=this.speedOfferService.findSpeedOfferByUserId(client.getId());
|
||||
List<NuOffer> nuOffers=this.nuOfferService.findNuOfferByUserId(client.getId());
|
||||
List<TimeOffer> timeOffers=this.timeOfferService.findTimeOfferByUserId(client.getId());
|
||||
|
||||
foodOffers.stream().forEach(f->f.setStatus(StatusOffer.inactive));
|
||||
|
||||
speedOffers.stream().forEach(s->s.setStatus(StatusOffer.inactive));
|
||||
|
||||
nuOffers.stream().forEach(n->n.setStatus(StatusOffer.inactive));
|
||||
|
||||
timeOffers.stream().forEach(t->t.setStatus(StatusOffer.inactive));
|
||||
|
||||
|
||||
client.getUsuar().setEnabled(false);
|
||||
this.clientService.saveClient(client);
|
||||
|
||||
try {
|
||||
request.logout();
|
||||
} catch (ServletException e) {
|
||||
|
||||
}
|
||||
return "redirect:/login";
|
||||
|
||||
}
|
||||
@GetMapping(value = "/restaurant/{clientId}")
|
||||
public String showRestaurant(final ModelMap model, @PathVariable("clientId") Integer id) {
|
||||
|
||||
Client client = this.clientRepo.findById(id).get();
|
||||
System.out.println(client.getDescription());
|
||||
model.put("client", client);
|
||||
return "clients/restaurantShow";
|
||||
}
|
||||
}
|
|
@ -2,6 +2,7 @@
|
|||
package org.springframework.cheapy.web;
|
||||
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
@ -60,6 +61,15 @@ public class FoodOfferController {
|
|||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
@GetMapping("/offers/foodOfferList")
|
||||
public String processFindForm(Map<String, Object> model) {
|
||||
List<FoodOffer> foodOfferLs=this.foodOfferService.findActiveFoodOffer();
|
||||
model.put("foodOfferLs", foodOfferLs);
|
||||
model.put("localDateTimeFormat", DateTimeFormatter.ofPattern("dd/MM/yyyy HH:mm"));
|
||||
return "offers/food/foodOffersList";
|
||||
|
||||
}
|
||||
|
||||
@GetMapping("/offers/food/new")
|
||||
public String initCreationForm(Map<String, Object> model) {
|
||||
|
|
|
@ -2,6 +2,7 @@ package org.springframework.cheapy.web;
|
|||
|
||||
import java.security.Principal;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
@ -79,6 +80,15 @@ public class NuOfferController {
|
|||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
@GetMapping("/offers/nuOfferList")
|
||||
public String processFindForm(Map<String, Object> model) {
|
||||
List<NuOffer> foodOfferLs=this.nuOfferService.findActiveNuOffer();
|
||||
model.put("nuOfferLs", foodOfferLs);
|
||||
model.put("localDateTimeFormat", DateTimeFormatter.ofPattern("dd/MM/yyyy HH:mm"));
|
||||
return "offers/nu/nuOffersList";
|
||||
|
||||
}
|
||||
|
||||
@GetMapping("/offers/nu/new")
|
||||
public String initCreationForm(Map<String, Object> model) {
|
||||
|
|
|
@ -1,118 +0,0 @@
|
|||
package org.springframework.cheapy.web;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
import org.springframework.cheapy.model.Owner;
|
||||
import org.springframework.cheapy.service.OwnerService;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.validation.BindingResult;
|
||||
import org.springframework.web.bind.WebDataBinder;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.InitBinder;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
@Controller
|
||||
public class OwnerController {
|
||||
|
||||
private static final String VIEWS_OWNER_CREATE_OR_UPDATE_FORM = "owners/createOrUpdateOwnerForm";
|
||||
|
||||
private final OwnerService ownerService;
|
||||
|
||||
|
||||
|
||||
public OwnerController(final OwnerService ownerService) {
|
||||
this.ownerService = ownerService;
|
||||
|
||||
}
|
||||
|
||||
@InitBinder
|
||||
public void setAllowedFields(WebDataBinder dataBinder) {
|
||||
dataBinder.setDisallowedFields("id");
|
||||
}
|
||||
|
||||
@GetMapping("/owners/new")
|
||||
public String initCreationForm(Map<String, Object> model) {
|
||||
Owner owner = new Owner();
|
||||
model.put("owner", owner);
|
||||
return VIEWS_OWNER_CREATE_OR_UPDATE_FORM;
|
||||
}
|
||||
|
||||
@PostMapping("/owners/new")
|
||||
public String processCreationForm(@Valid Owner owner, BindingResult result) {
|
||||
if (result.hasErrors()) {
|
||||
return VIEWS_OWNER_CREATE_OR_UPDATE_FORM;
|
||||
}
|
||||
else {
|
||||
this.ownerService.saveOwner(owner);
|
||||
return "redirect:/owners/" + owner.getId();
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/owners/find")
|
||||
public String initFindForm(Map<String, Object> model) {
|
||||
model.put("owner", new Owner());
|
||||
return "owners/findOwners";
|
||||
}
|
||||
|
||||
@GetMapping("/owners")
|
||||
public String processFindForm(Owner owner, BindingResult result, Map<String, Object> model) {
|
||||
|
||||
// allow parameterless GET request for /owners to return all records
|
||||
if (owner.getLastName() == null) {
|
||||
owner.setLastName(""); // empty string signifies broadest possible search
|
||||
}
|
||||
|
||||
// find owners by last name
|
||||
Collection<Owner> results = this.ownerService.findByLastName(owner.getLastName());
|
||||
if (results.isEmpty()) {
|
||||
// no owners found
|
||||
result.rejectValue("lastName", "notFound", "not found");
|
||||
return "owners/findOwners";
|
||||
}
|
||||
else if (results.size() == 1) {
|
||||
// 1 owner found
|
||||
owner = results.iterator().next();
|
||||
return "redirect:/owners/" + owner.getId();
|
||||
}
|
||||
else {
|
||||
// multiple owners found
|
||||
model.put("selections", results);
|
||||
return "owners/ownersList";
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/owners/{ownerId}/edit")
|
||||
public String initUpdateOwnerForm(@PathVariable("ownerId") int ownerId, Model model) {
|
||||
Owner owner = this.ownerService.findOwnerById(ownerId);
|
||||
model.addAttribute(owner);
|
||||
return VIEWS_OWNER_CREATE_OR_UPDATE_FORM;
|
||||
}
|
||||
|
||||
@PostMapping("/owners/{ownerId}/edit")
|
||||
public String processUpdateOwnerForm(@Valid Owner owner, BindingResult result,
|
||||
@PathVariable("ownerId") int ownerId) {
|
||||
if (result.hasErrors()) {
|
||||
return VIEWS_OWNER_CREATE_OR_UPDATE_FORM;
|
||||
}
|
||||
else {
|
||||
owner.setId(ownerId);
|
||||
this.ownerService.saveOwner(owner);
|
||||
return "redirect:/owners/{ownerId}";
|
||||
}
|
||||
}
|
||||
@GetMapping("/owners/{ownerId}")
|
||||
public ModelAndView showOwner(@PathVariable("ownerId") int ownerId) {
|
||||
ModelAndView mav = new ModelAndView("owners/ownerDetails");
|
||||
Owner owner = this.ownerService.findOwnerById(ownerId);
|
||||
|
||||
mav.addObject(owner);
|
||||
return mav;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
package org.springframework.cheapy.web;
|
||||
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
@ -78,6 +79,15 @@ public class SpeedOfferController {
|
|||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
@GetMapping("/offers/speedOfferList")
|
||||
public String processFindForm(Map<String, Object> model) {
|
||||
List<SpeedOffer> speedOfferLs=this.speedOfferService.findActiveSpeedOffer();
|
||||
model.put("speedOfferLs", speedOfferLs);
|
||||
model.put("localDateTimeFormat", DateTimeFormatter.ofPattern("dd/MM/yyyy HH:mm"));
|
||||
return "offers/speed/speedOffersList";
|
||||
|
||||
}
|
||||
|
||||
@GetMapping("/offers/speed/new")
|
||||
public String initCreationForm(Map<String, Object> model) {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package org.springframework.cheapy.web;
|
||||
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
@ -66,6 +67,15 @@ public class TimeOfferController {
|
|||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
@GetMapping("/offers/timeOfferList")
|
||||
public String processFindForm(Map<String, Object> model) {
|
||||
List<TimeOffer> timeOfferLs=this.timeOfferService.findActiveTimeOffer();
|
||||
model.put("timeOfferLs", timeOfferLs);
|
||||
model.put("localDateTimeFormat", DateTimeFormatter.ofPattern("dd/MM/yyyy HH:mm"));
|
||||
return "offers/time/timeOffersList";
|
||||
|
||||
}
|
||||
|
||||
@GetMapping("/offers/time/new")
|
||||
public String initCreationForm(Map<String, Object> model) {
|
||||
|
|
|
@ -0,0 +1,83 @@
|
|||
package org.springframework.cheapy.web;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.cheapy.model.Usuario;
|
||||
import org.springframework.cheapy.service.UsuarioService;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.validation.BindingResult;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
|
||||
@Controller
|
||||
public class UsuarioController {
|
||||
|
||||
private static final String VIEWS_USUARIO_CREATE_OR_UPDATE_FORM = "usuarios/createOrUpdateUsuarioForm";
|
||||
|
||||
private final UsuarioService usuarioService;
|
||||
|
||||
public UsuarioController(final UsuarioService usuarioService) {
|
||||
this.usuarioService = usuarioService;
|
||||
}
|
||||
|
||||
@GetMapping("/usuarios/show")
|
||||
public String processShowForm(Map<String, Object> model) {
|
||||
Usuario usuario = this.usuarioService.getCurrentUsuario();
|
||||
model.put("usuario", usuario);
|
||||
return "usuarios/usuariosShow";
|
||||
}
|
||||
|
||||
@GetMapping(value = "/usuarios/edit")
|
||||
public String updateUsuario(final ModelMap model, HttpServletRequest request) {
|
||||
Usuario usuario = this.usuarioService.getCurrentUsuario();
|
||||
model.addAttribute("usuario", usuario);
|
||||
return UsuarioController.VIEWS_USUARIO_CREATE_OR_UPDATE_FORM;
|
||||
}
|
||||
|
||||
@PostMapping(value = "/usuarios/edit")
|
||||
public String updateUsuario(@Valid final Usuario usuarioEdit, final BindingResult result,
|
||||
final ModelMap model, HttpServletRequest request) {
|
||||
|
||||
Usuario usuario = this.usuarioService.getCurrentUsuario();
|
||||
BeanUtils.copyProperties(usuario, usuarioEdit, "nombre", "apellidos", "dni", "direccion", "telefono", "usuar");
|
||||
usuarioEdit.getUsuar().setUsername(usuario.getNombre());
|
||||
usuarioEdit.getUsuar().setEnabled(true);
|
||||
this.usuarioService.saveUsuario(usuarioEdit);
|
||||
return "redirect:/usuarios/show";
|
||||
}
|
||||
|
||||
@GetMapping(value = "/usuarios/disable")
|
||||
public String disableUsuario(final ModelMap model) {
|
||||
|
||||
Usuario usuario = this.usuarioService.getCurrentUsuario();
|
||||
model.put("usuario", usuario);
|
||||
return "usuarios/usuariosDisable";
|
||||
}
|
||||
|
||||
@PostMapping(value = "/usuarios/disable")
|
||||
public String disableUsuarioForm(final ModelMap model, final HttpServletRequest request) {
|
||||
|
||||
Usuario usuario = this.usuarioService.getCurrentUsuario();
|
||||
usuario.getUsuar().setEnabled(false);
|
||||
this.usuarioService.saveUsuario(usuario);
|
||||
|
||||
try {
|
||||
|
||||
request.logout();
|
||||
|
||||
} catch (ServletException e) {
|
||||
|
||||
e.printStackTrace();
|
||||
|
||||
}
|
||||
|
||||
return "redirect:/login";
|
||||
|
||||
}
|
||||
}
|
|
@ -216,9 +216,15 @@ img.img-responsive{
|
|||
padding: 20px;
|
||||
}
|
||||
|
||||
.btn-home{
|
||||
display: table;
|
||||
margin: 0 auto;
|
||||
.btn-block {
|
||||
display: block;
|
||||
width: 25%;
|
||||
}
|
||||
|
||||
.btn-home {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.btn-home button {
|
||||
|
@ -227,7 +233,6 @@ img.img-responsive{
|
|||
color: white;
|
||||
padding: 10px 24px;
|
||||
cursor: pointer;
|
||||
width: 100%;
|
||||
display: block;
|
||||
}
|
||||
|
||||
|
@ -240,9 +245,12 @@ img.img-responsive{
|
|||
background-color: rgb(40, 140, 215);
|
||||
}
|
||||
|
||||
.btn-home{
|
||||
display: table;
|
||||
margin: 0 auto;
|
||||
|
||||
.btn-home-max button {
|
||||
padding: 20px;
|
||||
margin-left:auto;
|
||||
margin-right: auto;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.btn-create button {
|
||||
|
@ -342,6 +350,13 @@ text-align: center;
|
|||
float:left;
|
||||
}
|
||||
|
||||
.btn-menu button {
|
||||
margin-left:auto;
|
||||
margin-right: auto;
|
||||
margin-bottom: 20px;
|
||||
margin-right: 20px;
|
||||
}
|
||||
|
||||
.btns-edit{
|
||||
display: table;
|
||||
margin: 0 auto;
|
||||
|
@ -356,10 +371,6 @@ text-align: center;
|
|||
cursor: pointer;
|
||||
}
|
||||
|
||||
.btns-edit button:not(:last-child) {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
|
||||
.btns-edit button:hover {
|
||||
background-color: rgb(40, 140, 215);
|
||||
|
@ -511,6 +522,38 @@ text-align: center;
|
|||
background-color: rgb(204, 128, 51);
|
||||
}
|
||||
|
||||
#clientTable th{
|
||||
width: 30%;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
#clientTable td{
|
||||
vertical-align:middle;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
#reviewTable th{
|
||||
width: 30%;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
#reviewTable td{
|
||||
vertical-align:middle;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
#usuarioTable th{
|
||||
width: 20%;
|
||||
text-align: center;
|
||||
vertical-align:middle;
|
||||
}
|
||||
|
||||
#usuarioTable td{
|
||||
width:20%;
|
||||
vertical-align:middle;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
#vacio {
|
||||
text-align:center;
|
||||
font-size: 120%;
|
||||
|
@ -518,6 +561,14 @@ text-align: center;
|
|||
color: rgb(29, 142, 226);
|
||||
}
|
||||
|
||||
.row-full{
|
||||
width: 100vw;
|
||||
position: relative;
|
||||
margin-left: -50vw;
|
||||
height: 100px;
|
||||
left: 50%;
|
||||
}
|
||||
|
||||
.alert-success {
|
||||
.alert-variant(fade(@alert-success-bg, 70%); @alert-success-border; @alert-success-text);
|
||||
}
|
||||
|
|
|
@ -38,4 +38,13 @@
|
|||
margin-bottom: 30px;
|
||||
}
|
||||
|
||||
.btn-home button {
|
||||
background-color: rgb(0, 64, 128);
|
||||
border: 1px solid rgb(0, 0, 160);
|
||||
color: white;
|
||||
padding: 10px 24px;
|
||||
cursor: pointer;
|
||||
width: 70%;
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,36 +1,26 @@
|
|||
INSERT INTO owners VALUES (1, 'Javi', 'Franklin', '110 W. Liberty St.', 'Madison', '6085551023');
|
||||
INSERT INTO owners VALUES (2, 'Betty', 'Davis', '638 Cardinal Ave.', 'Sun Prairie', '6085551749');
|
||||
INSERT INTO owners VALUES (3, 'Eduardo', 'Rodriquez', '2693 Commerce St.', 'McFarland', '6085558763');
|
||||
INSERT INTO owners VALUES (4, 'Harold', 'Davis', '563 Friendly St.', 'Windsor', '6085553198');
|
||||
INSERT INTO owners VALUES (5, 'Peter', 'McTavish', '2387 S. Fair Way', 'Madison', '6085552765');
|
||||
INSERT INTO owners VALUES (6, 'Jean', 'Coleman', '105 N. Lake St.', 'Monona', '6085552654');
|
||||
INSERT INTO owners VALUES (7, 'Jeff', 'Black', '1450 Oak Blvd.', 'Monona', '6085555387');
|
||||
INSERT INTO owners VALUES (8, 'Maria', 'Escobito', '345 Maple St.', 'Madison', '6085557683');
|
||||
INSERT INTO owners VALUES (9, 'David', 'Schroeder', '2749 Blackhawk Trail', 'Madison', '6085559435');
|
||||
INSERT INTO owners VALUES (10, 'Carlos', 'Estaban', '2335 Independence La.', 'Waunakee', '6085555487');
|
||||
|
||||
INSERT INTO users (dtype,username,password,enabled) VALUES ('User','admin','admin', TRUE );
|
||||
INSERT INTO users (username,password,enabled) VALUES ('admin','admin', TRUE );
|
||||
INSERT INTO authorities VALUES ('admin','admin');
|
||||
|
||||
INSERT INTO users (dtype,username,password,enabled) VALUES ('User','manoli','manoli', TRUE );
|
||||
INSERT INTO users (username,password,enabled) VALUES ('manoli','manoli', TRUE );
|
||||
INSERT INTO authorities VALUES ('manoli','client');
|
||||
INSERT INTO users (dtype,username,password,enabled) VALUES ('User','david','david', TRUE );
|
||||
INSERT INTO users (username,password,enabled) VALUES ('david','david', TRUE );
|
||||
INSERT INTO authorities VALUES ('david','client');
|
||||
|
||||
INSERT INTO users (dtype,username,password,enabled) VALUES ('User','paco','paco', TRUE );
|
||||
INSERT INTO users (username,password,enabled) VALUES ('paco','paco', TRUE );
|
||||
INSERT INTO authorities VALUES ('paco','usuario');
|
||||
INSERT INTO users (dtype,username,password,enabled) VALUES ('User','lolo','lolo', TRUE );
|
||||
INSERT INTO users (username,password,enabled) VALUES ('lolo','lolo', TRUE );
|
||||
INSERT INTO authorities VALUES ('lolo','usuario');
|
||||
INSERT INTO users (dtype,username,password,enabled) VALUES ('User','pepe','pepe', TRUE );
|
||||
INSERT INTO users (username,password,enabled) VALUES ('pepe','pepe', TRUE );
|
||||
INSERT INTO authorities VALUES ('pepe','usuario');
|
||||
|
||||
INSERT INTO usuarios VALUES (1, 'admin', 'admin', 'admin', 'C/admin', '000000000', 'admin@gmail.com','admin');
|
||||
INSERT INTO usuarios VALUES (2, 'Paco', 'Naranjo', '21154416G', 'C/Esperanza', '666973647', 'Paco@gmail.com','paco');
|
||||
INSERT INTO usuarios VALUES (3, 'Lolo', 'Lopez', '25486596L', 'C/Macarena', '690670547' ,'Lolo@gmail.com','lolo');
|
||||
INSERT INTO usuarios VALUES (4, 'Pepe', 'Lopez', '12456776V', 'C/Macarena', '690670547', 'Pepe@gmail.com','pepe');
|
||||
INSERT INTO administrators (id, username) VALUES (1, 'admin');
|
||||
|
||||
INSERT INTO clients (id, name, email, address, init, finish, telephone, description, code, food, username) VALUES (1,'bar manoli','manoli@gmail.com','C/Betis','10:00','22:00','608726190', 'description 1', 'code1', 'ESPAÑOLA','manoli');
|
||||
INSERT INTO clients (id, name, email, address, init, finish, telephone, description, code, food, username) VALUES (2,'bar david','david@gmail.com','C/Sevilla','09:30','22:00','608726190', 'description 2', 'code2', 'americana','david');
|
||||
INSERT INTO usuarios (id, nombre, apellidos, dni, direccion, telefono, email, username) VALUES (2, 'Paco', 'Naranjo', '21154416G', 'C/Esperanza', '666973647', 'Paco@gmail.com','paco');
|
||||
INSERT INTO usuarios (id, nombre, apellidos, dni, direccion, telefono, email, username) VALUES (3, 'Lolo', 'Lopez', '25486596L', 'C/Macarena', '690670547' ,'Lolo@gmail.com','lolo');
|
||||
INSERT INTO usuarios (id, nombre, apellidos, dni, direccion, telefono, email, username) VALUES (4, 'Pepe', 'Lopez', '12456776V', 'C/Macarena', '690670547', 'Pepe@gmail.com','pepe');
|
||||
|
||||
INSERT INTO clients (id, name, email, address, init, finish, telephone, description, code, food, username) VALUES (1,'bar manoli','manoli@gmail.com','C/Betis','10:00:00','22:00:00','608726190', 'description 1', 'code1', 'ESPAÑOLA','manoli');
|
||||
INSERT INTO clients (id, name, email, address, init, finish, telephone, description, code, food, username) VALUES (2,'bar david','david@gmail.com','C/Sevilla','09:30:00','22:00:00','608726190', 'description 2', 'code2', 'americana','david');
|
||||
|
||||
INSERT INTO food_offers(start, end, code, status, client_id, food, discount) VALUES ('2021-08-14 12:00:00', '2021-08-15 12:00:00', 'FO-1', 'inactive', 1, 'macarrones', 15);
|
||||
INSERT INTO food_offers(start, end, code, status, client_id, food, discount) VALUES ('2021-08-15 12:00:00', '2021-08-16 12:00:00', 'FO-2', 'active', 1, 'macarrones con tomate', 10);
|
||||
|
|
|
@ -1,9 +0,0 @@
|
|||
CREATE TABLE IF NOT EXISTS owners (
|
||||
id INT(4) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||
first_name VARCHAR(30),
|
||||
last_name VARCHAR(30),
|
||||
address VARCHAR(255),
|
||||
city VARCHAR(80),
|
||||
telephone VARCHAR(20),
|
||||
INDEX(last_name)
|
||||
) engine=InnoDB;
|
|
@ -48,10 +48,25 @@ createSpeedOffers= Crear ofertas por rapidez comiendo
|
|||
createTimeOffers= Crear ofertas por franja horaria
|
||||
init= Inicio del intervalo
|
||||
finishOffer= Fin del intervalo
|
||||
name= Nombre del restaurante
|
||||
name= Nombre del bar/restaurante
|
||||
status= Estado de oferta
|
||||
myOffers= Ver mis Ofertas
|
||||
typeMismatch=Debe ser del formato correcto
|
||||
typeMismatch.java.lang.Integer=Debe ser un número
|
||||
typeMismatch.java.time.LocalDateTime=Debe ser una fecha válida
|
||||
typeMismatch.java.time.LocalTime=Debe ser una hora válida
|
||||
clientShow= Información del bar/restaurante
|
||||
client= Cliente
|
||||
clients= Clientes
|
||||
email=Dirección de correo electrónico
|
||||
addressClient= Dirección del bar/restaurante
|
||||
addressUser= Dirección del usuario
|
||||
telephone= Número de teléfono
|
||||
descriptionClient= Descripción del bar/restaurante
|
||||
foodClient= Tipo de comida
|
||||
enabled= ¿Está activo el usuario?
|
||||
users=Usuarios
|
||||
nameUser=Nombre
|
||||
surname= Apellidos
|
||||
dni= DNI
|
||||
usuario=Usuario
|
25
src/main/webapp/WEB-INF/jsp/clients/clientDisable.jsp
Normal file
25
src/main/webapp/WEB-INF/jsp/clients/clientDisable.jsp
Normal file
|
@ -0,0 +1,25 @@
|
|||
<%@ page session="false" trimDirectiveWhitespaces="true"%>
|
||||
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
|
||||
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
|
||||
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
|
||||
<%@ taglib prefix="cheapy" tagdir="/WEB-INF/tags"%>
|
||||
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
|
||||
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
|
||||
|
||||
<cheapy:layout pageName="client">
|
||||
|
||||
<jsp:body>
|
||||
<h2 class="text-center" style="font-family: 'Lobster'; font-size: 30px; color: rgb(0, 64, 128); padding:30px"><em>¿Está seguro de que quiere eliminar su cuenta?</em></h2>
|
||||
|
||||
<form:form modelAttribute="client" class="form-horizontal">
|
||||
|
||||
<div class="btns-edit2">
|
||||
<button type="submit" style="font-family: 'Lobster'; font-size: 20px;">
|
||||
<span class="glyphicon glyphicon glyphicon-trash" aria-hidden="true" style="padding: 5px"> </span>
|
||||
Dar de baja</button>
|
||||
</div>
|
||||
</form:form>
|
||||
|
||||
</jsp:body>
|
||||
|
||||
</cheapy:layout>
|
87
src/main/webapp/WEB-INF/jsp/clients/clientShow.jsp
Normal file
87
src/main/webapp/WEB-INF/jsp/clients/clientShow.jsp
Normal file
|
@ -0,0 +1,87 @@
|
|||
<%@ 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="client">
|
||||
|
||||
<h2 style="text-align:center;padding:5px"><fmt:message key="client"/></h2>
|
||||
|
||||
|
||||
|
||||
<table class="table table-striped" id="clientTable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><fmt:message key="init"/></th>
|
||||
<td><c:out value="${client.init}h"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><fmt:message key="finishOffer"/></th>
|
||||
<td><c:out value="${client.finish}h"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><fmt:message key="name"/></th>
|
||||
<td><c:out value="${client.name}"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><fmt:message key="email"/></th>
|
||||
<td><c:out value="${client.email}"/> </td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th><fmt:message key="addressClient"/></th>
|
||||
<td><c:out value="${client.address}"/> </td>
|
||||
</tr><tr>
|
||||
<th><fmt:message key="telephone"/></th>
|
||||
<td><c:out value="${client.telephone}"/> </td>
|
||||
</tr><tr>
|
||||
<th><fmt:message key="descriptionClient"/></th>
|
||||
<td><c:out value="${client.description}"/> </td>
|
||||
</tr><tr>
|
||||
<th><fmt:message key="foodClient"/></th>
|
||||
<td><c:out value="${client.food}"/> </td>
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
</thead>
|
||||
</table>
|
||||
|
||||
<div class="btn-menu">
|
||||
|
||||
<sec:authorize access="hasAnyAuthority('client')">
|
||||
<sec:authentication var="principal" property="principal" />
|
||||
<div class="btns-edit">
|
||||
|
||||
<spring:url value="edit" var="editUrl"/>
|
||||
<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 cliente</button>
|
||||
|
||||
|
||||
<spring:url value="disable" var="disableUrl"/>
|
||||
<button type="button" role="link" onclick="window.location='${fn:escapeXml(disableUrl)}'" style="font-family: 'Lobster'; font-size: 20px;">
|
||||
<span class="glyphicon glyphicon glyphicon-edit" aria-hidden="true" style="padding: 5px"> </span>
|
||||
Borrar cliente</button>
|
||||
</div>
|
||||
</sec:authorize>
|
||||
<sec:authorize access="hasAnyAuthority('admin')">
|
||||
<sec:authentication var="principal" property="principal" />
|
||||
<div class="btns-edit">
|
||||
|
||||
<spring:url value="/administrators/clients/{username}/disable" var="deactivateUrl">
|
||||
<spring:param name="username" value="${client.usuar.username}"/>
|
||||
</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 cliente</button>
|
||||
</div>
|
||||
</sec:authorize>
|
||||
</div>
|
||||
|
||||
|
||||
</cheapy:layout>
|
55
src/main/webapp/WEB-INF/jsp/clients/clientsList.jsp
Normal file
55
src/main/webapp/WEB-INF/jsp/clients/clientsList.jsp
Normal file
|
@ -0,0 +1,55 @@
|
|||
<%@ 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="clients">
|
||||
<h2 style="text-align:center;padding:5px"><fmt:message key="clients"/></h2>
|
||||
|
||||
<c:if test="${empty clientLs }">
|
||||
<p id="vacio" >No hay ningun Cliente.</p>
|
||||
</c:if>
|
||||
<c:if test="${not empty clientLs }">
|
||||
<table id="clientTable" class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
|
||||
<th><fmt:message key="name"/></th>
|
||||
<th><fmt:message key="user"/></th>
|
||||
<th><fmt:message key="enabled"/></th>
|
||||
<th> </th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<c:forEach items="${clientLs}" var="client">
|
||||
<tr>
|
||||
|
||||
<td>
|
||||
<c:out value="${client.name}"/>
|
||||
</td>
|
||||
<td>
|
||||
<c:out value="${client.usuar.username}"/>
|
||||
</td>
|
||||
<td>
|
||||
<c:out value="${client.usuar.enabled}"/>
|
||||
</td>
|
||||
<td>
|
||||
<spring:url value="/administrators/clients/{username}" var="clientUrl">
|
||||
<spring:param name="username" value="${client.usuar.username}"/>
|
||||
</spring:url>
|
||||
<div class="btn-detalles">
|
||||
<button type="button" role="link" onclick="window.location='${fn:escapeXml(clientUrl)}'" style="font-family: 'Lobster'; font-size: 20px;">
|
||||
<span class="glyphicon glyphicon-info-sign" aria-hidden="true" style="padding: 5px"> </span>
|
||||
<fmt:message key="details"/></button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</c:forEach>
|
||||
</tbody>
|
||||
</table>
|
||||
</c:if>
|
||||
</cheapy:layout>
|
|
@ -0,0 +1,51 @@
|
|||
<%@ 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="clients">
|
||||
<h2 style="text-align:center;padding:5px">
|
||||
<fmt:message key="client"/>
|
||||
</h2>
|
||||
|
||||
<form:form modelAttribute="client" class="form-horizontal" id="add-client-form">
|
||||
<div class="form-group has-feedback">
|
||||
|
||||
<form:hidden path="code"/>
|
||||
<cheapy:inputField 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="telephone" placeholder="" name="telephone"/>
|
||||
<cheapy:inputField label="description" placeholder="" name="description"/>
|
||||
<cheapy:inputField label="food" placeholder="food" name="food"/>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-offset-2 col-sm-10">
|
||||
<div class="btn-mod">
|
||||
<c:choose>
|
||||
<c:when test="${client['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 cliente</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>
|
||||
|
||||
</cheapy:layout>
|
58
src/main/webapp/WEB-INF/jsp/clients/restaurantShow.jsp
Normal file
58
src/main/webapp/WEB-INF/jsp/clients/restaurantShow.jsp
Normal file
|
@ -0,0 +1,58 @@
|
|||
<%@ 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="client">
|
||||
|
||||
<h2 style="text-align:center;padding:5px"><fmt:message key="client"/></h2>
|
||||
|
||||
|
||||
|
||||
<table class="table table-striped" id="clientTable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><fmt:message key="clientInit"/></th>
|
||||
<td><c:out value="${client.init}"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><fmt:message key="clientFinish"/></th>
|
||||
<td><c:out value="${client.finish}"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><fmt:message key="nameClient"/></th>
|
||||
<td><c:out value="${client.name}"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><fmt:message key="emailClient"/></th>
|
||||
<td><c:out value="${client.email}%"/> </td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th><fmt:message key="addressClient"/></th>
|
||||
<td><c:out value="${client.address}%"/> </td>
|
||||
</tr><tr>
|
||||
<th><fmt:message key="telephoneClient"/></th>
|
||||
<td><c:out value="${client.telephone}%"/> </td>
|
||||
</tr><tr>
|
||||
<th><fmt:message key="descriptionClient"/></th>
|
||||
<td><c:out value="${client.description}%"/> </td>
|
||||
</tr><tr>
|
||||
<th><fmt:message key="foodClient"/></th>
|
||||
<td><c:out value="${client.food}%"/> </td>
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
</thead>
|
||||
</table>
|
||||
|
||||
<div class="btn-menu">
|
||||
</div>
|
||||
|
||||
|
||||
</cheapy:layout>
|
|
@ -94,7 +94,7 @@
|
|||
background-color: #56baed;
|
||||
border: none;
|
||||
color: white;
|
||||
padding: 15px 80px;
|
||||
padding: 15px;
|
||||
text-align: center;
|
||||
text-decoration: none;
|
||||
display: inline-block;
|
||||
|
@ -110,6 +110,7 @@
|
|||
-ms-transition: all 0.3s ease-in-out;
|
||||
-o-transition: all 0.3s ease-in-out;
|
||||
transition: all 0.3s ease-in-out;
|
||||
width: 60%;
|
||||
}
|
||||
|
||||
input[type=button]:hover, input[type=submit]:hover, input[type=reset]:hover {
|
||||
|
@ -143,6 +144,7 @@
|
|||
transition: all 0.5s ease-in-out;
|
||||
-webkit-border-radius: 5px 5px 5px 5px;
|
||||
border-radius: 5px 5px 5px 5px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
input[type=text]:focus {
|
||||
|
@ -292,7 +294,9 @@
|
|||
<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="Iniciar sesión">
|
||||
<div style="text-align: center;">
|
||||
<input type="submit" class="fadeIn fourth" value="Iniciar sesión">
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<!-- Remind Passowrd
|
||||
|
|
85
src/main/webapp/WEB-INF/jsp/offers/food/foodOffersList.jsp
Normal file
85
src/main/webapp/WEB-INF/jsp/offers/food/foodOffersList.jsp
Normal file
|
@ -0,0 +1,85 @@
|
|||
<%@ page session="false" trimDirectiveWhitespaces="true" %>
|
||||
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
|
||||
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
|
||||
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
||||
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
|
||||
<%@ taglib prefix="cheapy" tagdir="/WEB-INF/tags" %>
|
||||
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>
|
||||
<link href='https://fonts.googleapis.com/css?family=Lobster' rel='stylesheet'>
|
||||
|
||||
<cheapy:layout pageName="ofertas de plato especifico">
|
||||
|
||||
<spring:url value="/offers/nuOfferList" var="nuOfferUrl">
|
||||
</spring:url>
|
||||
<button type="button" role="link" onclick="window.location='/offers/nuOfferList'" style="font-family: 'Lobster'; font-size: 20px;">
|
||||
<span class="glyphicon glyphicon glyphicon-edit" aria-hidden="true" style="padding: 5px"> </span>
|
||||
Ofertas por número de comensales</button>
|
||||
|
||||
<spring:url value="/offers/speedOfferList" var="speedOfferUrl">
|
||||
</spring:url>
|
||||
<button type="button" role="link" onclick="window.location='/offers/speedOfferList'" style="font-family: 'Lobster'; font-size: 20px;">
|
||||
<span class="glyphicon glyphicon glyphicon-edit" aria-hidden="true" style="padding: 5px"> </span>
|
||||
Ofertas de velocidad</button>
|
||||
|
||||
<spring:url value="/offers/timeOfferList" var="timeOfferUrl">
|
||||
</spring:url>
|
||||
<button type="button" role="link" onclick="window.location='/offers/timeOfferList'" style="font-family: 'Lobster'; font-size: 20px;">
|
||||
<span class="glyphicon glyphicon glyphicon-edit" aria-hidden="true" style="padding: 5px"> </span>
|
||||
Ofertas de franja horaria</button>
|
||||
|
||||
<h2 style="text-align:center;padding:5px"><fmt:message key="foodOffers"/></h2>
|
||||
|
||||
<c:if test="${empty foodOfferLs }">
|
||||
<p id="vacio" >No hay ninguna oferta por plato específico activa.</p>
|
||||
</c:if>
|
||||
<c:if test="${not empty foodOfferLs }">
|
||||
<table id="foodOfferTable" class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<!-- <th style="width: 150px;">Restaurante</th> -->
|
||||
<th><fmt:message key="name"/></th>
|
||||
<th><fmt:message key="food"/></th>
|
||||
<th><fmt:message key="discount"/></th>
|
||||
<th><fmt:message key="startDate"/></th>
|
||||
<th><fmt:message key="endDate"/></th>
|
||||
|
||||
<th> </th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<c:forEach items="${foodOfferLs}" var="foodOffer">
|
||||
<tr>
|
||||
<td>
|
||||
<c:out value="${foodOffer.client.name}"/>
|
||||
</td>
|
||||
<td>
|
||||
<c:out value="${foodOffer.food}"/>
|
||||
</td>
|
||||
<td>
|
||||
<c:out value="${foodOffer.discount}%"/>
|
||||
</td>
|
||||
<td>
|
||||
<c:out value="${localDateTimeFormat.format(foodOffer.start)}"/>
|
||||
</td>
|
||||
<td>
|
||||
<c:out value="${localDateTimeFormat.format(foodOffer.end)}"/>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<spring:url value="/offers/food/{foodOfferId}" var="foodOfferUrl">
|
||||
<spring:param name="foodOfferId" value="${foodOffer.id}"/>
|
||||
</spring:url>
|
||||
<div class="btn-detalles">
|
||||
<button type="button" role="link" onclick="window.location='${fn:escapeXml(foodOfferUrl)}'" style="font-family: 'Lobster'; font-size: 20px;">
|
||||
<span class="glyphicon glyphicon-info-sign" aria-hidden="true" style="padding: 5px"> </span>
|
||||
<fmt:message key="details"/></button>
|
||||
</div>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
</c:forEach>
|
||||
</tbody>
|
||||
</table>
|
||||
</c:if>
|
||||
|
||||
</cheapy:layout>
|
|
@ -12,95 +12,99 @@
|
|||
<p id="vacio" >No hay ninguna oferta por plato específico creada.</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="startDate"/></th>
|
||||
<th><fmt:message key="endDate"/></th>
|
||||
<th><fmt:message key="status"/></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>
|
||||
<c:forEach items="${foodOfferLs}" var="foodOffer">
|
||||
<tr>
|
||||
<td>
|
||||
<c:out value="${foodOffer.food}"/>
|
||||
</td>
|
||||
<td>
|
||||
<c:out value="${localDateTimeFormat.format(foodOffer.start)}"/>
|
||||
</td>
|
||||
<td>
|
||||
<c:out value="${localDateTimeFormat.format(foodOffer.end)}"/>
|
||||
</td>
|
||||
<td>
|
||||
<c:out value="${foodOffer.status}"/>
|
||||
</td>
|
||||
<td>
|
||||
<spring:url value="/offers/food/{foodOfferId}" var="foodOfferUrl">
|
||||
<spring:param name="foodOfferId" value="${foodOffer.id}"/>
|
||||
</spring:url>
|
||||
<div class="btn-detalles">
|
||||
<button type="button" role="link" onclick="window.location='${fn:escapeXml(foodOfferUrl)}'" style="font-family: 'Lobster'; font-size: 20px;">
|
||||
<span class="glyphicon glyphicon-info-sign" aria-hidden="true" style="padding: 5px"> </span>
|
||||
<fmt:message key="details"/></button>
|
||||
</div>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
</c:forEach>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="table-responsive">
|
||||
<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="startDate"/></th>
|
||||
<th><fmt:message key="endDate"/></th>
|
||||
<th><fmt:message key="status"/></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>
|
||||
<c:forEach items="${foodOfferLs}" var="foodOffer">
|
||||
<tr>
|
||||
<td>
|
||||
<c:out value="${foodOffer.food}"/>
|
||||
</td>
|
||||
<td>
|
||||
<c:out value="${localDateTimeFormat.format(foodOffer.start)}"/>
|
||||
</td>
|
||||
<td>
|
||||
<c:out value="${localDateTimeFormat.format(foodOffer.end)}"/>
|
||||
</td>
|
||||
<td>
|
||||
<c:out value="${foodOffer.status}"/>
|
||||
</td>
|
||||
<td>
|
||||
<spring:url value="/offers/food/{foodOfferId}" var="foodOfferUrl">
|
||||
<spring:param name="foodOfferId" value="${foodOffer.id}"/>
|
||||
</spring:url>
|
||||
<div class="btn-detalles">
|
||||
<button type="button" role="link" onclick="window.location='${fn:escapeXml(foodOfferUrl)}'" style="font-family: 'Lobster'; font-size: 20px;">
|
||||
<span class="glyphicon glyphicon-info-sign" aria-hidden="true" style="padding: 5px"> </span>
|
||||
<fmt:message key="details"/></button>
|
||||
</div>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
</c:forEach>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</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 número de comensales creada.</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="status"/></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>
|
||||
<tbody>
|
||||
<c:forEach items="${nuOfferLs}" var="nuOffer">
|
||||
<tr>
|
||||
|
||||
<td>
|
||||
<c:out value="${localDateTimeFormat.format(nuOffer.start)}"/>
|
||||
</td>
|
||||
<td>
|
||||
<c:out value="${localDateTimeFormat.format(nuOffer.end)}"/>
|
||||
</td>
|
||||
<td>
|
||||
<c:out value="${nuOffer.status}"/>
|
||||
</td>
|
||||
<td>
|
||||
<spring:url value="/offers/nu/{nuOfferId}" var="nuOfferUrl">
|
||||
<spring:param name="nuOfferId" value="${nuOffer.id}"/>
|
||||
</spring:url>
|
||||
<div class="btn-detalles">
|
||||
<button type="button" role="link" onclick="window.location='${fn:escapeXml(nuOfferUrl)}'" class="btn-detalles" style="font-family: 'Lobster'; font-size: 20px;">
|
||||
<span class="glyphicon glyphicon-info-sign" aria-hidden="true" style="padding: 5px"> </span>
|
||||
<fmt:message key="details"/> </button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</c:forEach>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="table-responsive">
|
||||
<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="status"/></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>
|
||||
<tbody>
|
||||
<c:forEach items="${nuOfferLs}" var="nuOffer">
|
||||
<tr>
|
||||
|
||||
<td>
|
||||
<c:out value="${localDateTimeFormat.format(nuOffer.start)}"/>
|
||||
</td>
|
||||
<td>
|
||||
<c:out value="${localDateTimeFormat.format(nuOffer.end)}"/>
|
||||
</td>
|
||||
<td>
|
||||
<c:out value="${nuOffer.status}"/>
|
||||
</td>
|
||||
<td>
|
||||
<spring:url value="/offers/nu/{nuOfferId}" var="nuOfferUrl">
|
||||
<spring:param name="nuOfferId" value="${nuOffer.id}"/>
|
||||
</spring:url>
|
||||
<div class="btn-detalles">
|
||||
<button type="button" role="link" onclick="window.location='${fn:escapeXml(nuOfferUrl)}'" class="btn-detalles" style="font-family: 'Lobster'; font-size: 20px;">
|
||||
<span class="glyphicon glyphicon-info-sign" aria-hidden="true" style="padding: 5px"> </span>
|
||||
<fmt:message key="details"/> </button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</c:forEach>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</c:if>
|
||||
|
||||
<h2 style="text-align:center;padding:5px"><fmt:message key="speedOffers"/></h2>
|
||||
|
@ -108,47 +112,49 @@
|
|||
<p id="vacio" >No hay ninguna oferta por tiempo empleado en comer creada.</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="status"/></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>
|
||||
<tbody>
|
||||
<c:forEach items="${speedOfferLs}" var="speedOffer">
|
||||
<tr>
|
||||
|
||||
<td>
|
||||
<c:out value="${localDateTimeFormat.format(speedOffer.start)}"/>
|
||||
</td>
|
||||
<td>
|
||||
<c:out value="${localDateTimeFormat.format(speedOffer.end)}"/>
|
||||
</td>
|
||||
<td>
|
||||
<c:out value="${speedOffer.status}"/>
|
||||
</td>
|
||||
<td>
|
||||
<spring:url value="/offers/speed/{speedOfferId}" var="speedOfferUrl">
|
||||
<spring:param name="speedOfferId" value="${speedOffer.id}"/>
|
||||
</spring:url>
|
||||
<div class="btn-detalles">
|
||||
<button type="button" role="link" onclick="window.location='${fn:escapeXml(speedOfferUrl)}'" class="btn-detalles" style="font-family: 'Lobster'; font-size: 20px;">
|
||||
<span class="glyphicon glyphicon-info-sign" aria-hidden="true" style="padding: 5px"> </span>
|
||||
<fmt:message key="details"/> </button>
|
||||
</div>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
</c:forEach>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="table-responsive">
|
||||
<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="status"/></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>
|
||||
<tbody>
|
||||
<c:forEach items="${speedOfferLs}" var="speedOffer">
|
||||
<tr>
|
||||
|
||||
<td>
|
||||
<c:out value="${localDateTimeFormat.format(speedOffer.start)}"/>
|
||||
</td>
|
||||
<td>
|
||||
<c:out value="${localDateTimeFormat.format(speedOffer.end)}"/>
|
||||
</td>
|
||||
<td>
|
||||
<c:out value="${speedOffer.status}"/>
|
||||
</td>
|
||||
<td>
|
||||
<spring:url value="/offers/speed/{speedOfferId}" var="speedOfferUrl">
|
||||
<spring:param name="speedOfferId" value="${speedOffer.id}"/>
|
||||
</spring:url>
|
||||
<div class="btn-detalles">
|
||||
<button type="button" role="link" onclick="window.location='${fn:escapeXml(speedOfferUrl)}'" class="btn-detalles" style="font-family: 'Lobster'; font-size: 20px;">
|
||||
<span class="glyphicon glyphicon-info-sign" aria-hidden="true" style="padding: 5px"> </span>
|
||||
<fmt:message key="details"/> </button>
|
||||
</div>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
</c:forEach>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</c:if>
|
||||
|
||||
<h2 style="text-align:center;padding:5px"><fmt:message key="timeOffers"/></h2>
|
||||
|
@ -156,44 +162,46 @@
|
|||
<p id="vacio" >No hay ninguna oferta por franja horaria creada.</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="status"/></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>
|
||||
<c:forEach items="${timeOfferLs}" var="timeOffer">
|
||||
<tr>
|
||||
|
||||
<td>
|
||||
<c:out value="${localDateTimeFormat.format(timeOffer.start)}"/>
|
||||
</td>
|
||||
<td>
|
||||
<c:out value="${localDateTimeFormat.format(timeOffer.end)}"/>
|
||||
</td>
|
||||
<td>
|
||||
<c:out value="${timeOffer.status}"/>
|
||||
</td>
|
||||
<td>
|
||||
<spring:url value="/offers/time/{timeOfferId}" var="timeOfferUrl">
|
||||
<spring:param name="timeOfferId" value="${timeOffer.id}"/>
|
||||
</spring:url>
|
||||
<div class="btn-detalles">
|
||||
<button type="button" role="link" onclick="window.location='${fn:escapeXml(timeOfferUrl)}'" class="btn-detalles" style="font-family: 'Lobster'; font-size: 20px;">
|
||||
<span class="glyphicon glyphicon-info-sign" aria-hidden="true" style="padding: 5px"> </span>
|
||||
<fmt:message key="details"/> </button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</c:forEach>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="table-responsive">
|
||||
<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="status"/></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>
|
||||
<c:forEach items="${timeOfferLs}" var="timeOffer">
|
||||
<tr>
|
||||
|
||||
<td>
|
||||
<c:out value="${localDateTimeFormat.format(timeOffer.start)}"/>
|
||||
</td>
|
||||
<td>
|
||||
<c:out value="${localDateTimeFormat.format(timeOffer.end)}"/>
|
||||
</td>
|
||||
<td>
|
||||
<c:out value="${timeOffer.status}"/>
|
||||
</td>
|
||||
<td>
|
||||
<spring:url value="/offers/time/{timeOfferId}" var="timeOfferUrl">
|
||||
<spring:param name="timeOfferId" value="${timeOffer.id}"/>
|
||||
</spring:url>
|
||||
<div class="btn-detalles">
|
||||
<button type="button" role="link" onclick="window.location='${fn:escapeXml(timeOfferUrl)}'" class="btn-detalles" style="font-family: 'Lobster'; font-size: 20px;">
|
||||
<span class="glyphicon glyphicon-info-sign" aria-hidden="true" style="padding: 5px"> </span>
|
||||
<fmt:message key="details"/> </button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</c:forEach>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</c:if>
|
||||
</cheapy:layout>
|
||||
|
|
82
src/main/webapp/WEB-INF/jsp/offers/nu/nuOffersList.jsp
Normal file
82
src/main/webapp/WEB-INF/jsp/offers/nu/nuOffersList.jsp
Normal file
|
@ -0,0 +1,82 @@
|
|||
<%@ page session="false" trimDirectiveWhitespaces="true" %>
|
||||
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
|
||||
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
|
||||
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
||||
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
|
||||
<%@ taglib prefix="cheapy" tagdir="/WEB-INF/tags" %>
|
||||
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>
|
||||
<link href='https://fonts.googleapis.com/css?family=Lobster' rel='stylesheet'>
|
||||
|
||||
<cheapy:layout pageName="ofertas">
|
||||
|
||||
<spring:url value="/offers/foodOfferList" var="foodOfferUrl">
|
||||
</spring:url>
|
||||
<button type="button" role="link" onclick="window.location='/offers/foodOfferList'" style="font-family: 'Lobster'; font-size: 20px;">
|
||||
<span class="glyphicon glyphicon glyphicon-edit" aria-hidden="true" style="padding: 5px"> </span>
|
||||
Ofertas de plato especifico</button>
|
||||
|
||||
<spring:url value="/offers/speedOfferList" var="speedOfferUrl">
|
||||
</spring:url>
|
||||
<button type="button" role="link" onclick="window.location='/offers/speedOfferList'" style="font-family: 'Lobster'; font-size: 20px;">
|
||||
<span class="glyphicon glyphicon glyphicon-edit" aria-hidden="true" style="padding: 5px"> </span>
|
||||
Ofertas de velocidad</button>
|
||||
|
||||
<spring:url value="/offers/timeOfferList" var="timeOfferUrl">
|
||||
</spring:url>
|
||||
<button type="button" role="link" onclick="window.location='/offers/timeOfferList'" style="font-family: 'Lobster'; font-size: 20px;">
|
||||
<span class="glyphicon glyphicon glyphicon-edit" aria-hidden="true" style="padding: 5px"> </span>
|
||||
Ofertas de franja horaria</button>
|
||||
|
||||
<h2 style="text-align:center;padding:5px"><fmt:message key="nuOffers"/></h2>
|
||||
<c:if test="${empty nuOfferLs }">
|
||||
<p id="vacio" >No hay ninguna oferta por número de comensales activa.</p>
|
||||
</c:if>
|
||||
<c:if test="${not empty nuOfferLs }">
|
||||
<table id="nuOfferTable" class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<!-- <th style="width: 150px;">Restaurante</th> -->
|
||||
<th><fmt:message key="name"/></th>
|
||||
<th><fmt:message key="startDate"/></th>
|
||||
<th><fmt:message key="endDate"/></th>
|
||||
<th><fmt:message key="goldGoal"/></th>
|
||||
<th><fmt:message key="goldDiscount"/></th>
|
||||
<th> </th>
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<c:forEach items="${nuOfferLs}" var="nuOffer">
|
||||
<tr>
|
||||
<td>
|
||||
<c:out value="${nuOffer.client.name}"/>
|
||||
</td>
|
||||
<td>
|
||||
<c:out value="${localDateTimeFormat.format(nuOffer.start)}"/>
|
||||
</td>
|
||||
<td>
|
||||
<c:out value="${localDateTimeFormat.format(nuOffer.end)}"/>
|
||||
</td>
|
||||
<td>
|
||||
<c:out value="${nuOffer.gold} comensales"/>
|
||||
</td>
|
||||
<td>
|
||||
<c:out value="${nuOffer.discountGold}%"/>
|
||||
</td>
|
||||
<td>
|
||||
<spring:url value="/offers/nu/{nuOfferId}" var="nuOfferUrl">
|
||||
<spring:param name="nuOfferId" value="${nuOffer.id}"/>
|
||||
</spring:url>
|
||||
<div class="btn-detalles">
|
||||
<button type="button" role="link" onclick="window.location='${fn:escapeXml(nuOfferUrl)}'" class="btn-detalles" style="font-family: 'Lobster'; font-size: 20px;">
|
||||
<span class="glyphicon glyphicon-info-sign" aria-hidden="true" style="padding: 5px"> </span>
|
||||
<fmt:message key="details"/> </button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</c:forEach>
|
||||
</tbody>
|
||||
</table>
|
||||
</c:if>
|
||||
|
||||
</cheapy:layout>
|
|
@ -8,12 +8,39 @@
|
|||
<link href='https://fonts.googleapis.com/css?family=Lobster' rel='stylesheet'>
|
||||
|
||||
<cheapy:layout pageName="ofertas">
|
||||
|
||||
<spring:url value="/offers/foodOfferList" var="foodOfferUrl">
|
||||
</spring:url>
|
||||
<button type="button" role="link" onclick="window.location='/offers/foodOfferList'" style="font-family: 'Lobster'; font-size: 20px;">
|
||||
<span class="glyphicon glyphicon glyphicon-edit" aria-hidden="true" style="padding: 5px"> </span>
|
||||
Ofertas de plato especifico</button>
|
||||
|
||||
<spring:url value="/offers/nuOfferList" var="nuOfferUrl">
|
||||
</spring:url>
|
||||
<button type="button" role="link" onclick="window.location='/offers/nuOfferList'" style="font-family: 'Lobster'; font-size: 20px;">
|
||||
<span class="glyphicon glyphicon glyphicon-edit" aria-hidden="true" style="padding: 5px"> </span>
|
||||
Ofertas por número de comensales</button>
|
||||
|
||||
<spring:url value="/offers/speedOfferList" var="speedOfferUrl">
|
||||
</spring:url>
|
||||
<button type="button" role="link" onclick="window.location='/offers/speedOfferList'" style="font-family: 'Lobster'; font-size: 20px;">
|
||||
<span class="glyphicon glyphicon glyphicon-edit" aria-hidden="true" style="padding: 5px"> </span>
|
||||
Ofertas de velocidad</button>
|
||||
|
||||
<spring:url value="/offers/timeOfferList" var="timeOfferUrl">
|
||||
</spring:url>
|
||||
<button type="button" role="link" onclick="window.location='/offers/timeOfferList'" style="font-family: 'Lobster'; font-size: 20px;">
|
||||
<span class="glyphicon glyphicon glyphicon-edit" aria-hidden="true" style="padding: 5px"> </span>
|
||||
Ofertas de franja horaria</button>
|
||||
|
||||
<h2 style="text-align:center;padding:5px"><fmt:message key="foodOffers"/></h2>
|
||||
|
||||
<c:if test="${empty foodOfferLs }">
|
||||
<p id="vacio" >No hay ninguna oferta por plato específico activa.</p>
|
||||
<p id="vacio" >No hay ninguna oferta por plato especÃfico activa.</p>
|
||||
</c:if>
|
||||
<c:if test="${not empty foodOfferLs }">
|
||||
|
||||
<div class="table-responsive">
|
||||
<table id="foodOfferTable" class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
|
@ -31,7 +58,7 @@
|
|||
<c:forEach items="${foodOfferLs}" var="foodOffer">
|
||||
<tr>
|
||||
<td>
|
||||
<c:out value="${foodOffer.client.name}"/>
|
||||
<a href="/restaurant/${foodOffer.client.id}"><c:out value="${foodOffer.client.name}"/></a>
|
||||
</td>
|
||||
<td>
|
||||
<c:out value="${foodOffer.food}"/>
|
||||
|
@ -61,12 +88,16 @@
|
|||
</c:forEach>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
</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 número de comensales activa.</p>
|
||||
<p id="vacio" >No hay ninguna oferta por número de comensales activa.</p>
|
||||
</c:if>
|
||||
<c:if test="${not empty nuOfferLs }">
|
||||
|
||||
<div class="table-responsive">
|
||||
<table id="nuOfferTable" class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
|
@ -84,7 +115,7 @@
|
|||
<c:forEach items="${nuOfferLs}" var="nuOffer">
|
||||
<tr>
|
||||
<td>
|
||||
<c:out value="${nuOffer.client.name}"/>
|
||||
<a href="/restaurant/${nuOffer.client.id}"><c:out value="${nuOffer.client.name}"/></a>
|
||||
</td>
|
||||
<td>
|
||||
<c:out value="${localDateTimeFormat.format(nuOffer.start)}"/>
|
||||
|
@ -112,6 +143,8 @@
|
|||
</c:forEach>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
</c:if>
|
||||
|
||||
<h2 style="text-align:center;padding:5px"><fmt:message key="speedOffers"/></h2>
|
||||
|
@ -119,52 +152,56 @@
|
|||
<p id="vacio" >No hay ninguna oferta por tiempo empleado en comer activa.</p>
|
||||
</c:if>
|
||||
<c:if test="${not empty speedOfferLs }">
|
||||
<table id="speedOfferTable" class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<!-- <th style="width: 150px;">Restaurante</th> -->
|
||||
<th><fmt:message key="name"/></th>
|
||||
<th><fmt:message key="startDate"/></th>
|
||||
<th><fmt:message key="endDate"/></th>
|
||||
<th><fmt:message key="goldGoal"/></th>
|
||||
<th><fmt:message key="goldDiscount"/></th>
|
||||
<th> </th>
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<c:forEach items="${speedOfferLs}" var="speedOffer">
|
||||
<tr>
|
||||
<td>
|
||||
<c:out value="${speedOffer.client.name}"/>
|
||||
</td>
|
||||
<td>
|
||||
<c:out value="${localDateTimeFormat.format(speedOffer.start)}"/>
|
||||
</td>
|
||||
<td>
|
||||
<c:out value="${localDateTimeFormat.format(speedOffer.end)}"/>
|
||||
</td>
|
||||
<td>
|
||||
<c:out value="${speedOffer.gold} minutos"/>
|
||||
</td>
|
||||
<td>
|
||||
<c:out value="${speedOffer.discountGold}%"/>
|
||||
</td>
|
||||
<td>
|
||||
<spring:url value="/offers/speed/{speedOfferId}" var="speedOfferUrl">
|
||||
<spring:param name="speedOfferId" value="${speedOffer.id}"/>
|
||||
</spring:url>
|
||||
<div class="btn-detalles">
|
||||
<button type="button" role="link" onclick="window.location='${fn:escapeXml(speedOfferUrl)}'" class="btn-detalles" style="font-family: 'Lobster'; font-size: 20px;">
|
||||
<span class="glyphicon glyphicon-info-sign" aria-hidden="true" style="padding: 5px"> </span>
|
||||
<fmt:message key="details"/> </button>
|
||||
</div>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
</c:forEach>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div class="table-responsive">
|
||||
<table id="speedOfferTable" class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<!-- <th style="width: 150px;">Restaurante</th> -->
|
||||
<th><fmt:message key="name"/></th>
|
||||
<th><fmt:message key="startDate"/></th>
|
||||
<th><fmt:message key="endDate"/></th>
|
||||
<th><fmt:message key="goldGoal"/></th>
|
||||
<th><fmt:message key="goldDiscount"/></th>
|
||||
<th> </th>
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<c:forEach items="${speedOfferLs}" var="speedOffer">
|
||||
<tr>
|
||||
<td>
|
||||
<a href="/restaurant/${speedOffer.client.id}"><c:out value="${speedOffer.client.name}"/></a>
|
||||
</td>
|
||||
<td>
|
||||
<c:out value="${localDateTimeFormat.format(speedOffer.start)}"/>
|
||||
</td>
|
||||
<td>
|
||||
<c:out value="${localDateTimeFormat.format(speedOffer.end)}"/>
|
||||
</td>
|
||||
<td>
|
||||
<c:out value="${speedOffer.gold} minutos"/>
|
||||
</td>
|
||||
<td>
|
||||
<c:out value="${speedOffer.discountGold}%"/>
|
||||
</td>
|
||||
<td>
|
||||
<spring:url value="/offers/speed/{speedOfferId}" var="speedOfferUrl">
|
||||
<spring:param name="speedOfferId" value="${speedOffer.id}"/>
|
||||
</spring:url>
|
||||
<div class="btn-detalles">
|
||||
<button type="button" role="link" onclick="window.location='${fn:escapeXml(speedOfferUrl)}'" class="btn-detalles" style="font-family: 'Lobster'; font-size: 20px;">
|
||||
<span class="glyphicon glyphicon-info-sign" aria-hidden="true" style="padding: 5px"> </span>
|
||||
<fmt:message key="details"/> </button>
|
||||
</div>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
</c:forEach>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
</c:if>
|
||||
|
||||
<h2 style="text-align:center;padding:5px"><fmt:message key="timeOffers"/></h2>
|
||||
|
@ -172,51 +209,54 @@
|
|||
<p id="vacio" >No hay ninguna oferta por franja horaria activa.</p>
|
||||
</c:if>
|
||||
<c:if test="${not empty timeOfferLs }">
|
||||
<table id="timeOfferTable" class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<!-- <th style="width: 150px;">Restaurante</th> -->
|
||||
<th><fmt:message key="name"/></th>
|
||||
<th><fmt:message key="startDate"/></th>
|
||||
<th><fmt:message key="endDate"/></th>
|
||||
<th><fmt:message key="init"/></th>
|
||||
<th><fmt:message key="finishOffer"/></th>
|
||||
<th> </th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<c:forEach items="${timeOfferLs}" var="timeOffer">
|
||||
<tr>
|
||||
<td>
|
||||
<c:out value="${timeOffer.client.name}"/>
|
||||
</td>
|
||||
<td>
|
||||
<c:out value="${localDateTimeFormat.format(timeOffer.start)}"/>
|
||||
</td>
|
||||
<td>
|
||||
<c:out value="${localDateTimeFormat.format(timeOffer.end)}"/>
|
||||
</td>
|
||||
<td>
|
||||
<c:out value="${timeOffer.init}h"/>
|
||||
</td>
|
||||
<td>
|
||||
<c:out value="${timeOffer.finish}h"/>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<spring:url value="/offers/time/{timeOfferId}" var="timeOfferUrl">
|
||||
<spring:param name="timeOfferId" value="${timeOffer.id}"/>
|
||||
</spring:url>
|
||||
<div class="btn-detalles">
|
||||
<button type="button" role="link" onclick="window.location='${fn:escapeXml(timeOfferUrl)}'" class="btn-detalles" style="font-family: 'Lobster'; font-size: 20px;">
|
||||
<span class="glyphicon glyphicon-info-sign" aria-hidden="true" style="padding: 5px"> </span>
|
||||
<fmt:message key="details"/> </button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</c:forEach>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div class="table-responsive">
|
||||
<table id="timeOfferTable" class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<!-- <th style="width: 150px;">Restaurante</th> -->
|
||||
<th><fmt:message key="name"/></th>
|
||||
<th><fmt:message key="startDate"/></th>
|
||||
<th><fmt:message key="endDate"/></th>
|
||||
<th><fmt:message key="init"/></th>
|
||||
<th><fmt:message key="finishOffer"/></th>
|
||||
<th> </th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<c:forEach items="${timeOfferLs}" var="timeOffer">
|
||||
<tr>
|
||||
<td>
|
||||
<a href="/restaurant/${timeOffer.client.id}"><c:out value="${timeOffer.client.name}"/></a>
|
||||
</td>
|
||||
<td>
|
||||
<c:out value="${localDateTimeFormat.format(timeOffer.start)}"/>
|
||||
</td>
|
||||
<td>
|
||||
<c:out value="${localDateTimeFormat.format(timeOffer.end)}"/>
|
||||
</td>
|
||||
<td>
|
||||
<c:out value="${timeOffer.init}h"/>
|
||||
</td>
|
||||
<td>
|
||||
<c:out value="${timeOffer.finish}h"/>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<spring:url value="/offers/time/{timeOfferId}" var="timeOfferUrl">
|
||||
<spring:param name="timeOfferId" value="${timeOffer.id}"/>
|
||||
</spring:url>
|
||||
<div class="btn-detalles">
|
||||
<button type="button" role="link" onclick="window.location='${fn:escapeXml(timeOfferUrl)}'" class="btn-detalles" style="font-family: 'Lobster'; font-size: 20px;">
|
||||
<span class="glyphicon glyphicon-info-sign" aria-hidden="true" style="padding: 5px"> </span>
|
||||
<fmt:message key="details"/> </button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</c:forEach>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</c:if>
|
||||
|
||||
|
||||
|
|
82
src/main/webapp/WEB-INF/jsp/offers/speed/speedOffersList.jsp
Normal file
82
src/main/webapp/WEB-INF/jsp/offers/speed/speedOffersList.jsp
Normal file
|
@ -0,0 +1,82 @@
|
|||
<%@ page session="false" trimDirectiveWhitespaces="true" %>
|
||||
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
|
||||
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
|
||||
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
||||
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
|
||||
<%@ taglib prefix="cheapy" tagdir="/WEB-INF/tags" %>
|
||||
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>
|
||||
<link href='https://fonts.googleapis.com/css?family=Lobster' rel='stylesheet'>
|
||||
|
||||
<cheapy:layout pageName="ofertas">
|
||||
|
||||
<spring:url value="/offers/foodOfferList" var="foodOfferUrl">
|
||||
</spring:url>
|
||||
<button type="button" role="link" onclick="window.location='/offers/foodOfferList'" style="font-family: 'Lobster'; font-size: 20px;">
|
||||
<span class="glyphicon glyphicon glyphicon-edit" aria-hidden="true" style="padding: 5px"> </span>
|
||||
Ofertas de plato especifico</button>
|
||||
|
||||
<spring:url value="/offers/nuOfferList" var="nuOfferUrl">
|
||||
</spring:url>
|
||||
<button type="button" role="link" onclick="window.location='/offers/nuOfferList'" style="font-family: 'Lobster'; font-size: 20px;">
|
||||
<span class="glyphicon glyphicon glyphicon-edit" aria-hidden="true" style="padding: 5px"> </span>
|
||||
Ofertas por número de comensales</button>
|
||||
|
||||
<spring:url value="/offers/timeOfferList" var="timeOfferUrl">
|
||||
</spring:url>
|
||||
<button type="button" role="link" onclick="window.location='/offers/timeOfferList'" style="font-family: 'Lobster'; font-size: 20px;">
|
||||
<span class="glyphicon glyphicon glyphicon-edit" aria-hidden="true" style="padding: 5px"> </span>
|
||||
Ofertas de franja horaria</button>
|
||||
|
||||
<h2 style="text-align:center;padding:5px"><fmt:message key="speedOffers"/></h2>
|
||||
<c:if test="${empty speedOfferLs }">
|
||||
<p id="vacio" >No hay ninguna oferta por tiempo empleado en comer activa.</p>
|
||||
</c:if>
|
||||
<c:if test="${not empty speedOfferLs }">
|
||||
<table id="speedOfferTable" class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<!-- <th style="width: 150px;">Restaurante</th> -->
|
||||
<th><fmt:message key="name"/></th>
|
||||
<th><fmt:message key="startDate"/></th>
|
||||
<th><fmt:message key="endDate"/></th>
|
||||
<th><fmt:message key="goldGoal"/></th>
|
||||
<th><fmt:message key="goldDiscount"/></th>
|
||||
<th> </th>
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<c:forEach items="${speedOfferLs}" var="speedOffer">
|
||||
<tr>
|
||||
<td>
|
||||
<c:out value="${speedOffer.client.name}"/>
|
||||
</td>
|
||||
<td>
|
||||
<c:out value="${localDateTimeFormat.format(speedOffer.start)}"/>
|
||||
</td>
|
||||
<td>
|
||||
<c:out value="${localDateTimeFormat.format(speedOffer.end)}"/>
|
||||
</td>
|
||||
<td>
|
||||
<c:out value="${speedOffer.gold} minutos"/>
|
||||
</td>
|
||||
<td>
|
||||
<c:out value="${speedOffer.discountGold}%"/>
|
||||
</td>
|
||||
<td>
|
||||
<spring:url value="/offers/speed/{speedOfferId}" var="speedOfferUrl">
|
||||
<spring:param name="speedOfferId" value="${speedOffer.id}"/>
|
||||
</spring:url>
|
||||
<div class="btn-detalles">
|
||||
<button type="button" role="link" onclick="window.location='${fn:escapeXml(speedOfferUrl)}'" class="btn-detalles" style="font-family: 'Lobster'; font-size: 20px;">
|
||||
<span class="glyphicon glyphicon-info-sign" aria-hidden="true" style="padding: 5px"> </span>
|
||||
<fmt:message key="details"/> </button>
|
||||
</div>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
</c:forEach>
|
||||
</tbody>
|
||||
</table>
|
||||
</c:if>
|
||||
</cheapy:layout>
|
82
src/main/webapp/WEB-INF/jsp/offers/time/timeOffersList.jsp
Normal file
82
src/main/webapp/WEB-INF/jsp/offers/time/timeOffersList.jsp
Normal file
|
@ -0,0 +1,82 @@
|
|||
<%@ page session="false" trimDirectiveWhitespaces="true" %>
|
||||
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
|
||||
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
|
||||
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
||||
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
|
||||
<%@ taglib prefix="cheapy" tagdir="/WEB-INF/tags" %>
|
||||
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>
|
||||
<link href='https://fonts.googleapis.com/css?family=Lobster' rel='stylesheet'>
|
||||
|
||||
<cheapy:layout pageName="ofertas">
|
||||
|
||||
<spring:url value="/offers/foodOfferList" var="foodOfferUrl">
|
||||
</spring:url>
|
||||
<button type="button" role="link" onclick="window.location='/offers/foodOfferList'" style="font-family: 'Lobster'; font-size: 20px;">
|
||||
<span class="glyphicon glyphicon glyphicon-edit" aria-hidden="true" style="padding: 5px"> </span>
|
||||
Ofertas de plato especifico</button>
|
||||
|
||||
<spring:url value="/offers/nuOfferList" var="nuOfferUrl">
|
||||
</spring:url>
|
||||
<button type="button" role="link" onclick="window.location='/offers/nuOfferList'" style="font-family: 'Lobster'; font-size: 20px;">
|
||||
<span class="glyphicon glyphicon glyphicon-edit" aria-hidden="true" style="padding: 5px"> </span>
|
||||
Ofertas por número de comensales</button>
|
||||
|
||||
<spring:url value="/offers/speedOfferList" var="speedOfferUrl">
|
||||
</spring:url>
|
||||
<button type="button" role="link" onclick="window.location='/offers/speedOfferList'" style="font-family: 'Lobster'; font-size: 20px;">
|
||||
<span class="glyphicon glyphicon glyphicon-edit" aria-hidden="true" style="padding: 5px"> </span>
|
||||
Ofertas de velocidad</button>
|
||||
|
||||
<h2 style="text-align:center;padding:5px"><fmt:message key="timeOffers"/></h2>
|
||||
<c:if test="${empty timeOfferLs }">
|
||||
<p id="vacio" >No hay ninguna oferta por franja horaria activa.</p>
|
||||
</c:if>
|
||||
<c:if test="${not empty timeOfferLs }">
|
||||
<table id="timeOfferTable" class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<!-- <th style="width: 150px;">Restaurante</th> -->
|
||||
<th><fmt:message key="name"/></th>
|
||||
<th><fmt:message key="startDate"/></th>
|
||||
<th><fmt:message key="endDate"/></th>
|
||||
<th><fmt:message key="init"/></th>
|
||||
<th><fmt:message key="finishOffer"/></th>
|
||||
<th> </th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<c:forEach items="${timeOfferLs}" var="timeOffer">
|
||||
<tr>
|
||||
<td>
|
||||
<c:out value="${timeOffer.client.name}"/>
|
||||
</td>
|
||||
<td>
|
||||
<c:out value="${localDateTimeFormat.format(timeOffer.start)}"/>
|
||||
</td>
|
||||
<td>
|
||||
<c:out value="${localDateTimeFormat.format(timeOffer.end)}"/>
|
||||
</td>
|
||||
<td>
|
||||
<c:out value="${timeOffer.init}h"/>
|
||||
</td>
|
||||
<td>
|
||||
<c:out value="${timeOffer.finish}h"/>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<spring:url value="/offers/time/{timeOfferId}" var="timeOfferUrl">
|
||||
<spring:param name="timeOfferId" value="${timeOffer.id}"/>
|
||||
</spring:url>
|
||||
<div class="btn-detalles">
|
||||
<button type="button" role="link" onclick="window.location='${fn:escapeXml(timeOfferUrl)}'" class="btn-detalles" style="font-family: 'Lobster'; font-size: 20px;">
|
||||
<span class="glyphicon glyphicon-info-sign" aria-hidden="true" style="padding: 5px"> </span>
|
||||
<fmt:message key="details"/> </button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</c:forEach>
|
||||
</tbody>
|
||||
</table>
|
||||
</c:if>
|
||||
|
||||
</cheapy:layout>
|
|
@ -0,0 +1,45 @@
|
|||
<%@ 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="usuarios">
|
||||
<h2 style="text-align:center;padding:5px">
|
||||
<c:if test="${usuario['new']}"><fmt:message key="new"/> </c:if> <fmt:message key="usuario"/>
|
||||
</h2>
|
||||
|
||||
<form:form modelAttribute="usuario" class="form-horizontal" id="add-usuario-form">
|
||||
<div class="form-group has-feedback">
|
||||
<cheapy:inputField label="Nombre" name="nombre"/>
|
||||
<cheapy:inputField label="Apellidos" name="apellidos"/>
|
||||
<cheapy:inputField label="DNI" name="dni"/>
|
||||
<cheapy:inputField label="Direccion" name="direccion"/>
|
||||
<cheapy:inputField label="Telefono" name="telefono"/>
|
||||
<cheapy:inputField label="Email" name="email"/>
|
||||
<cheapy:inputField label="Password" name="usuar.password"/>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-offset-2 col-sm-10">
|
||||
<div class="btn-mod">
|
||||
<c:choose>
|
||||
<c:when test="${usuario['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 usuario</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>
|
||||
|
||||
</cheapy:layout>
|
26
src/main/webapp/WEB-INF/jsp/usuarios/usuariosDisable.jsp
Normal file
26
src/main/webapp/WEB-INF/jsp/usuarios/usuariosDisable.jsp
Normal file
|
@ -0,0 +1,26 @@
|
|||
<%@ page session="false" trimDirectiveWhitespaces="true"%>
|
||||
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
|
||||
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
|
||||
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
|
||||
<%@ taglib prefix="cheapy" tagdir="/WEB-INF/tags"%>
|
||||
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
|
||||
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
|
||||
|
||||
<cheapy:layout pageName="usuario">
|
||||
|
||||
<jsp:body>
|
||||
<h2 class="text-center" style="font-family: 'Lobster'; font-size: 30px; color: rgb(0, 64, 128); padding:30px"><em>¿Está seguro de que quiere eliminar su cuenta?</em></h2>
|
||||
|
||||
<form:form modelAttribute="usuario" class="form-horizontal">
|
||||
|
||||
<div class="btns-edit2">
|
||||
|
||||
<button type="submit" style="font-family: 'Lobster'; font-size: 20px;">
|
||||
<span class="glyphicon glyphicon glyphicon-trash" aria-hidden="true" style="padding: 5px"> </span>
|
||||
Dar de baja</button>
|
||||
</div>
|
||||
</form:form>
|
||||
|
||||
|
||||
</jsp:body>
|
||||
</cheapy:layout>
|
57
src/main/webapp/WEB-INF/jsp/usuarios/usuariosList.jsp
Normal file
57
src/main/webapp/WEB-INF/jsp/usuarios/usuariosList.jsp
Normal file
|
@ -0,0 +1,57 @@
|
|||
<%@ 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="usuarios">
|
||||
<h2 style="text-align:center;padding:5px"><fmt:message key="users"/></h2>
|
||||
|
||||
<c:if test="${empty usuarioLs }">
|
||||
<p id="vacio" >No hay ningún usuario.</p>
|
||||
</c:if>
|
||||
<c:if test="${not empty usuarioLs }">
|
||||
<table id="usuarioTable" class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><fmt:message key="nameUser"/></th>
|
||||
<th><fmt:message key="surname"/></th>
|
||||
<th><fmt:message key="user"/></th>
|
||||
<th><fmt:message key="enabled"/></th>
|
||||
<th> </th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<c:forEach items="${usuarioLs}" var="usuario">
|
||||
<tr>
|
||||
<td>
|
||||
<c:out value="${usuario.nombre}"/>
|
||||
</td>
|
||||
<td>
|
||||
<c:out value="${usuario.apellidos}"/>
|
||||
</td>
|
||||
<td>
|
||||
<c:out value="${usuario.usuar.username}"/>
|
||||
</td>
|
||||
<td>
|
||||
<c:out value="${usuario.usuar.enabled}"/>
|
||||
</td>
|
||||
<td>
|
||||
<spring:url value="/administrators/usuarios/{username}" var="usuarioUrl">
|
||||
<spring:param name="username" value="${usuario.usuar.username}"/>
|
||||
</spring:url>
|
||||
<div class="btn-detalles">
|
||||
<button type="button" role="link" onclick="window.location='${fn:escapeXml(usuarioUrl)}'" style="font-family: 'Lobster'; font-size: 20px;">
|
||||
<span class="glyphicon glyphicon-info-sign" aria-hidden="true" style="padding: 5px"> </span>
|
||||
<fmt:message key="details"/></button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</c:forEach>
|
||||
</tbody>
|
||||
</table>
|
||||
</c:if>
|
||||
</cheapy:layout>
|
74
src/main/webapp/WEB-INF/jsp/usuarios/usuariosShow.jsp
Normal file
74
src/main/webapp/WEB-INF/jsp/usuarios/usuariosShow.jsp
Normal file
|
@ -0,0 +1,74 @@
|
|||
<%@ 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="usuario">
|
||||
|
||||
<h2 style="text-align:center;padding:5px"><fmt:message key="usuario"/></h2>
|
||||
|
||||
<table class="table table-striped" id="usuarioTable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><fmt:message key="nameUser"/></th>
|
||||
<td><c:out value="${usuario.nombre}"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><fmt:message key="surname"/></th>
|
||||
<td><c:out value="${usuario.apellidos}"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><fmt:message key="dni"/></th>
|
||||
<td><c:out value="${usuario.dni}"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><fmt:message key="addressUser"/></th>
|
||||
<td><c:out value="${usuario.direccion}"/> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><fmt:message key="telephone"/></th>
|
||||
<td><c:out value="${usuario.telefono}"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><fmt:message key="email"/></th>
|
||||
<td><c:out value="${usuario.email}"/></td>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
|
||||
<div class="btn-menu">
|
||||
|
||||
<sec:authorize access="hasAnyAuthority('usuario')">
|
||||
<sec:authentication var="principal" property="principal" />
|
||||
<div class="btns-edit">
|
||||
<spring:url value="edit" var="editUrl"/>
|
||||
<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 usuario</button>
|
||||
|
||||
<spring:url value="disable" var="deactivateUrl"/>
|
||||
<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 usuario</button>
|
||||
</div>
|
||||
</sec:authorize>
|
||||
<sec:authorize access="hasAnyAuthority('admin')">
|
||||
<sec:authentication var="principal" property="principal" />
|
||||
<div class="btns-edit">
|
||||
|
||||
<spring:url value="/administrators/usuarios/{username}/disable" var="deactivateUrl">
|
||||
<spring:param name="username" value="${usuario.usuar.username}"/>
|
||||
</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 usuario</button>
|
||||
</div>
|
||||
</sec:authorize>
|
||||
</div>
|
||||
|
||||
|
||||
</cheapy:layout>
|
|
@ -9,32 +9,49 @@
|
|||
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>
|
||||
|
||||
<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: 300%; color: rgb(0, 64, 128); padding:30px"><fmt:message key="welcome"/></h2>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="img-home">
|
||||
<spring:url value="/resources/images/Logo Cheapy.png" htmlEscape="true" var="cheapyImage"/>
|
||||
<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;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='/myOffers'" style="font-family: 'Lobster'; font-size: 20px;margin:5px;">
|
||||
<span class="glyphicon glyphicon-cutlery" aria-hidden="true" style="padding: 5px"> </span>
|
||||
<fmt:message key="myOffers"/> </button>
|
||||
</div>
|
||||
<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 class="btn-home-max">
|
||||
<div class="btn-home">
|
||||
<button type="button" role="link" onclick="window.location='/offers'" 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="listOffers"/> </button>
|
||||
</div>
|
||||
|
||||
<sec:authorize access="hasAnyAuthority('client')">
|
||||
<div class="btn-home">
|
||||
<button type="button" role="link" onclick="window.location='/myOffers'" 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="myOffers"/> </button>
|
||||
</div>
|
||||
<div class="btn-home">
|
||||
<button type="button" role="link" onclick="window.location='/offersCreate'" 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="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>
|
||||
</cheapy:layout>
|
||||
</cheapy:layout>
|
|
@ -39,6 +39,20 @@
|
|||
<span>Mis ofertas</span>
|
||||
</cheapy:menuItem>
|
||||
</sec:authorize>
|
||||
|
||||
<sec:authorize access="hasAnyAuthority('admin')">
|
||||
<cheapy:menuItem active="${name eq 'clientes'}" url="/administrators/clients" title="clients">
|
||||
<span class="glyphicon " aria-hidden="true"></span>
|
||||
<span>Clientes</span>
|
||||
</cheapy:menuItem>
|
||||
</sec:authorize>
|
||||
|
||||
<sec:authorize access="hasAnyAuthority('admin')">
|
||||
<cheapy:menuItem active="${name eq 'usuarios'}" url="/administrators/usuarios" title="usuarios">
|
||||
<span class="glyphicon " aria-hidden="true"></span>
|
||||
<span>Usuarios</span>
|
||||
</cheapy:menuItem>
|
||||
</sec:authorize>
|
||||
<!--
|
||||
<cheapy:menuItem active="${name eq 'contactanos'}" url="/contactanos"
|
||||
title="contactanos">
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
<br/>
|
||||
<br/>
|
||||
<div class="container">
|
||||
<div class="row-full">
|
||||
<div class="row">
|
||||
<div class="col-12 text-center"><img src="<spring:url value="/resources/images/eslogan.png" htmlEscape="true" />"
|
||||
alt="Eat fast, eat cheapy"/></div>
|
||||
|
|
|
@ -16,8 +16,6 @@
|
|||
|
||||
package org.springframework.cheapy.integration;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
|
|||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.view;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalTime;
|
||||
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
@ -58,8 +59,8 @@ class FoodOfferControllerTest {
|
|||
client1.setName("client1");
|
||||
client1.setEmail("client1");
|
||||
client1.setAddress("client1");
|
||||
client1.setInit("01:00");
|
||||
client1.setFinish("01:01");
|
||||
client1.setInit(LocalTime.of(01, 00));
|
||||
client1.setFinish(LocalTime.of(01, 01));
|
||||
client1.setTelephone("123456789");
|
||||
client1.setDescription("client1");
|
||||
client1.setCode("client1");
|
||||
|
|
|
@ -8,6 +8,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
|
|||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.view;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalTime;
|
||||
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
@ -57,8 +58,8 @@ class NuOfferControllerTest {
|
|||
client1.setName("client1");
|
||||
client1.setEmail("client1");
|
||||
client1.setAddress("client1");
|
||||
client1.setInit("01:00");
|
||||
client1.setFinish("01:01");
|
||||
client1.setInit(LocalTime.of(01, 00));
|
||||
client1.setFinish(LocalTime.of(01, 01));
|
||||
client1.setTelephone("123456789");
|
||||
client1.setDescription("client1");
|
||||
client1.setCode("client1");
|
||||
|
|
|
@ -1,162 +0,0 @@
|
|||
/*
|
||||
* Copyright 2012-2019 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/*
|
||||
package org.springframework.cheapy.web;
|
||||
|
||||
import static org.hamcrest.Matchers.hasProperty;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
import static org.mockito.BDDMockito.given;
|
||||
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
|
||||
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.model;
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.view;
|
||||
|
||||
import org.assertj.core.util.Lists;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
|
||||
import org.springframework.boot.test.mock.mockito.MockBean;
|
||||
import org.springframework.cheapy.model.Owner;
|
||||
import org.springframework.cheapy.service.OwnerService;
|
||||
import org.springframework.test.web.servlet.MockMvc;
|
||||
|
||||
/**
|
||||
* Test class for {@link OwnerController}
|
||||
*
|
||||
* @author Colin But
|
||||
*/
|
||||
/*
|
||||
@WebMvcTest(OwnerController.class)
|
||||
class OwnerControllerTests {
|
||||
|
||||
/*private static final int TEST_OWNER_ID = 1;
|
||||
|
||||
@Autowired
|
||||
private MockMvc mockMvc;
|
||||
|
||||
@MockBean
|
||||
private OwnerService ownerService;
|
||||
|
||||
|
||||
private Owner george;
|
||||
|
||||
@BeforeEach
|
||||
void setup() {
|
||||
george = new Owner();
|
||||
george.setId(TEST_OWNER_ID);
|
||||
george.setFirstName("George");
|
||||
george.setLastName("Franklin");
|
||||
george.setAddress("110 W. Liberty St.");
|
||||
george.setCity("Madison");
|
||||
george.setTelephone("6085551023");
|
||||
|
||||
given(this.ownerService.findOwnerById(TEST_OWNER_ID)).willReturn(george);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
void testInitCreationForm() throws Exception {
|
||||
mockMvc.perform(get("/owners/new")).andExpect(status().isOk()).andExpect(model().attributeExists("owner"))
|
||||
.andExpect(view().name("owners/createOrUpdateOwnerForm"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void testProcessCreationFormSuccess() throws Exception {
|
||||
mockMvc.perform(post("/owners/new").param("firstName", "Joe").param("lastName", "Bloggs")
|
||||
.param("address", "123 Caramel Street").param("city", "London").param("telephone", "01316761638"))
|
||||
.andExpect(status().is3xxRedirection());
|
||||
}
|
||||
|
||||
@Test
|
||||
void testProcessCreationFormHasErrors() throws Exception {
|
||||
mockMvc.perform(
|
||||
post("/owners/new").param("firstName", "Joe").param("lastName", "Bloggs").param("city", "London"))
|
||||
.andExpect(status().isOk()).andExpect(model().attributeHasErrors("owner"))
|
||||
.andExpect(model().attributeHasFieldErrors("owner", "address"))
|
||||
.andExpect(model().attributeHasFieldErrors("owner", "telephone"))
|
||||
.andExpect(view().name("owners/createOrUpdateOwnerForm"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void testInitFindForm() throws Exception {
|
||||
mockMvc.perform(get("/owners/find")).andExpect(status().isOk()).andExpect(model().attributeExists("owner"))
|
||||
.andExpect(view().name("owners/findOwners"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void testProcessFindFormSuccess() throws Exception {
|
||||
given(this.ownerService.findByLastName("")).willReturn(Lists.newArrayList(george, new Owner()));
|
||||
mockMvc.perform(get("/owners")).andExpect(status().isOk()).andExpect(view().name("owners/ownersList"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void testProcessFindFormByLastName() throws Exception {
|
||||
given(this.ownerService.findByLastName(george.getLastName())).willReturn(Lists.newArrayList(george));
|
||||
mockMvc.perform(get("/owners").param("lastName", "Franklin")).andExpect(status().is3xxRedirection())
|
||||
.andExpect(view().name("redirect:/owners/" + TEST_OWNER_ID));
|
||||
}
|
||||
|
||||
@Test
|
||||
void testProcessFindFormNoOwnersFound() throws Exception {
|
||||
mockMvc.perform(get("/owners").param("lastName", "Unknown Surname")).andExpect(status().isOk())
|
||||
.andExpect(model().attributeHasFieldErrors("owner", "lastName"))
|
||||
.andExpect(model().attributeHasFieldErrorCode("owner", "lastName", "notFound"))
|
||||
.andExpect(view().name("owners/findOwners"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void testInitUpdateOwnerForm() throws Exception {
|
||||
mockMvc.perform(get("/owners/{ownerId}/edit", TEST_OWNER_ID)).andExpect(status().isOk())
|
||||
.andExpect(model().attributeExists("owner"))
|
||||
.andExpect(model().attribute("owner", hasProperty("lastName", is("Franklin"))))
|
||||
.andExpect(model().attribute("owner", hasProperty("firstName", is("George"))))
|
||||
.andExpect(model().attribute("owner", hasProperty("address", is("110 W. Liberty St."))))
|
||||
.andExpect(model().attribute("owner", hasProperty("city", is("Madison"))))
|
||||
.andExpect(model().attribute("owner", hasProperty("telephone", is("6085551023"))))
|
||||
.andExpect(view().name("owners/createOrUpdateOwnerForm"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void testProcessUpdateOwnerFormSuccess() throws Exception {
|
||||
mockMvc.perform(post("/owners/{ownerId}/edit", TEST_OWNER_ID).param("firstName", "Joe")
|
||||
.param("lastName", "Bloggs").param("address", "123 Caramel Street").param("city", "London")
|
||||
.param("telephone", "01616291589")).andExpect(status().is3xxRedirection())
|
||||
.andExpect(view().name("redirect:/owners/{ownerId}"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void testProcessUpdateOwnerFormHasErrors() throws Exception {
|
||||
mockMvc.perform(post("/owners/{ownerId}/edit", TEST_OWNER_ID).param("firstName", "Joe")
|
||||
.param("lastName", "Bloggs").param("city", "London")).andExpect(status().isOk())
|
||||
.andExpect(model().attributeHasErrors("owner"))
|
||||
.andExpect(model().attributeHasFieldErrors("owner", "address"))
|
||||
.andExpect(model().attributeHasFieldErrors("owner", "telephone"))
|
||||
.andExpect(view().name("owners/createOrUpdateOwnerForm"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void testShowOwner() throws Exception {
|
||||
mockMvc.perform(get("/owners/{ownerId}", TEST_OWNER_ID)).andExpect(status().isOk())
|
||||
.andExpect(model().attribute("owner", hasProperty("lastName", is("Franklin"))))
|
||||
.andExpect(model().attribute("owner", hasProperty("firstName", is("George"))))
|
||||
.andExpect(model().attribute("owner", hasProperty("address", is("110 W. Liberty St."))))
|
||||
.andExpect(model().attribute("owner", hasProperty("city", is("Madison"))))
|
||||
.andExpect(model().attribute("owner", hasProperty("telephone", is("6085551023"))))
|
||||
.andExpect(view().name("owners/ownerDetails"));
|
||||
}*/
|
|
@ -8,6 +8,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
|
|||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.view;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalTime;
|
||||
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
@ -58,8 +59,8 @@ class SpeedOfferControllerTest {
|
|||
client1.setName("client1");
|
||||
client1.setEmail("client1");
|
||||
client1.setAddress("client1");
|
||||
client1.setInit("01:00");
|
||||
client1.setFinish("01:01");
|
||||
client1.setInit(LocalTime.of(01, 00));
|
||||
client1.setFinish(LocalTime.of(01, 01));
|
||||
client1.setTelephone("123456789");
|
||||
client1.setDescription("client1");
|
||||
client1.setCode("client1");
|
||||
|
|
|
@ -58,8 +58,8 @@ class TimeOfferControllerTest {
|
|||
client1.setName("client1");
|
||||
client1.setEmail("client1");
|
||||
client1.setAddress("client1");
|
||||
client1.setInit("01:00");
|
||||
client1.setFinish("01:01");
|
||||
client1.setInit(LocalTime.of(12, 00));
|
||||
client1.setFinish(LocalTime.of(01, 01));
|
||||
client1.setTelephone("123456789");
|
||||
client1.setDescription("client1");
|
||||
client1.setCode("client1");
|
||||
|
|
Loading…
Reference in a new issue