mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-23 07:45:49 +00:00
Merge branch 'develop' into 007-publicarOfertas-Abel
This commit is contained in:
commit
f9866c3c6e
60 changed files with 1256 additions and 485 deletions
|
@ -1,12 +0,0 @@
|
|||
mysql:
|
||||
image: mysql:5.7
|
||||
ports:
|
||||
- "3306:3306"
|
||||
environment:
|
||||
- MYSQL_ROOT_PASSWORD=
|
||||
- MYSQL_ALLOW_EMPTY_PASSWORD=true
|
||||
- MYSQL_USER=petclinic
|
||||
- MYSQL_PASSWORD=petclinic
|
||||
- MYSQL_DATABASE=petclinic
|
||||
volumes:
|
||||
- "./conf.d:/etc/mysql/conf.d:ro"
|
3
pom.xml
3
pom.xml
|
@ -135,7 +135,10 @@
|
|||
<artifactId>spring-boot-devtools</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
|
|
|
@ -20,7 +20,7 @@ import org.springframework.boot.SpringApplication;
|
|||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
/**
|
||||
* PetClinic Spring Boot Application.
|
||||
* Cheapy Spring Boot Application.
|
||||
*
|
||||
* @author Dave Syer
|
||||
*
|
||||
|
|
|
@ -20,9 +20,7 @@ import org.springframework.security.crypto.password.PasswordEncoder;
|
|||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @author japarejo
|
||||
*/
|
||||
|
||||
@Configuration
|
||||
@EnableWebSecurity
|
||||
public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
|
||||
|
@ -37,22 +35,32 @@ public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
|
|||
http.authorizeRequests().antMatchers("/resources/**", "/webjars/**", "/h2-console/**").permitAll()
|
||||
.antMatchers(HttpMethod.GET, "/", "/oups").permitAll()
|
||||
.antMatchers("/users/new").permitAll()
|
||||
|
||||
.antMatchers("/nuOffers/**").hasAnyAuthority("admin","client")
|
||||
.antMatchers("/timeOffers/**").hasAnyAuthority("admin","client")
|
||||
|
||||
.antMatchers("/login/**").anonymous()
|
||||
.antMatchers("/logout").permitAll()
|
||||
|
||||
.antMatchers("/usuarios/new").permitAll()
|
||||
.antMatchers("/admin/**").hasAnyAuthority("admin")
|
||||
.antMatchers("/speedOffers/**").hasAnyAuthority("admin", "client")
|
||||
.antMatchers("/foodOffers/**").hasAnyAuthority("admin", "client")
|
||||
.antMatchers("/owners/**").hasAnyAuthority("owner", "admin")
|
||||
|
||||
.antMatchers("/clients/new").permitAll()
|
||||
.antMatchers("/offers/**").hasAnyAuthority("admin")
|
||||
|
||||
.and().formLogin()
|
||||
/* .loginPage("/login") */
|
||||
.failureUrl("/login-error").and().logout().logoutSuccessUrl("/");
|
||||
.loginPage("/login").permitAll()
|
||||
.failureUrl("/login?error")
|
||||
.and().logout().logoutSuccessUrl("/login");
|
||||
|
||||
// Configuración para que funcione la consola de administración
|
||||
// de la BD H2 (deshabilitar las cabeceras de protección contra
|
||||
// ataques de tipo csrf y habilitar los framesets si su contenido
|
||||
// se sirve desde esta misma página.
|
||||
http.csrf().ignoringAntMatchers("/h2-console/**");
|
||||
//http.csrf().ignoringAntMatchers("/h2-console/**");
|
||||
http.headers().frameOptions().sameOrigin();
|
||||
}
|
||||
|
||||
|
@ -61,7 +69,7 @@ public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
|
|||
public void configure(final AuthenticationManagerBuilder auth) throws Exception {
|
||||
auth.jdbcAuthentication().dataSource(this.dataSource)
|
||||
//[login de admin,owner y vet] .usersByUsernameQuery("select username,password,enabled " + "from users " + "where username = ?")
|
||||
.usersByUsernameQuery("select username, password, enabled from users where username=?").authoritiesByUsernameQuery("select username, authority " + "from authorities " + "where username = ?") //[login de tallerespaco]
|
||||
.usersByUsernameQuery("select username, password, enabled from users where username=?").authoritiesByUsernameQuery("select username, authority " + "from authorities " + "where username = ?")
|
||||
.passwordEncoder(this.passwordEncoder());
|
||||
|
||||
}
|
||||
|
|
|
@ -6,5 +6,10 @@ import javax.persistence.Table;
|
|||
@Entity
|
||||
@Table(name = "administrators")
|
||||
public class Administrator extends User{
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
}
|
||||
|
|
|
@ -1,47 +1,58 @@
|
|||
package org.springframework.cheapy.model;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
import javax.validation.constraints.Size;
|
||||
|
||||
@Entity
|
||||
@Table(name = "authorities")
|
||||
public class Authorities extends BaseEntity{
|
||||
public class Authorities{
|
||||
|
||||
@Id
|
||||
String username;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "username")
|
||||
private Usuario user;
|
||||
|
||||
@Size(min = 3, max = 50)
|
||||
private String authority;
|
||||
|
||||
public Usuario getUser() {
|
||||
return user;
|
||||
String authority;
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
public void setUser(Usuario usern) {
|
||||
this.user = usern;
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public String getAuthority() {
|
||||
return authority;
|
||||
}
|
||||
|
||||
public void setAuthority(String authority) {
|
||||
this.authority = authority;
|
||||
}
|
||||
|
||||
public static long getSerialversionuid() {
|
||||
return serialVersionUID;
|
||||
}
|
||||
|
||||
|
||||
// @ManyToOne
|
||||
// @JoinColumn(name = "username")
|
||||
// private Usuario user;
|
||||
//
|
||||
// @Size(min = 3, max = 50)
|
||||
// private String authority;
|
||||
//
|
||||
// public Usuario getUser() {
|
||||
// return user;
|
||||
// }
|
||||
//
|
||||
// public void setUser(Usuario usern) {
|
||||
// this.user = usern;
|
||||
// }
|
||||
//
|
||||
// public String getAuthority() {
|
||||
// return authority;
|
||||
// }
|
||||
//
|
||||
// public void setAuthority(String authority) {
|
||||
// this.authority = authority;
|
||||
// }
|
||||
//
|
||||
// public static long getSerialversionuid() {
|
||||
// return serialVersionUID;
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,25 +1,43 @@
|
|||
package org.springframework.cheapy.model;
|
||||
|
||||
import java.time.LocalTime;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.persistence.CascadeType;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.JoinColumn;
|
||||
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 org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
@Entity
|
||||
@Table(name = "clients")
|
||||
public class Client extends User {
|
||||
|
||||
public class Client extends BaseEntity{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
// (id, email, address, init, finish, telephone, description, code, food, usuar)
|
||||
|
||||
@NotEmpty
|
||||
private String email;
|
||||
|
||||
@NotEmpty
|
||||
private String address;
|
||||
|
||||
@NotEmpty
|
||||
private String timetable;
|
||||
//@DateTimeFormat(pattern = "HH:mm")
|
||||
@NotBlank
|
||||
private String init;
|
||||
|
||||
//@DateTimeFormat(pattern = "HH:mm")
|
||||
@NotBlank
|
||||
private String finish;
|
||||
|
||||
@NotEmpty
|
||||
@Digits(fraction = 0, integer = 10)
|
||||
|
@ -34,6 +52,10 @@ public class Client extends User {
|
|||
@NotEmpty
|
||||
private String food;
|
||||
|
||||
@OneToOne(cascade = CascadeType.ALL)
|
||||
@JoinColumn(name = "username", referencedColumnName = "username")
|
||||
private User usuar;
|
||||
|
||||
@OneToMany
|
||||
private Set<FoodOffer> foodOffers;
|
||||
|
||||
|
@ -46,6 +68,8 @@ public class Client extends User {
|
|||
@OneToMany
|
||||
private Set<TimeOffer> timeOffers;
|
||||
|
||||
|
||||
|
||||
public String getEmail() {
|
||||
return email;
|
||||
}
|
||||
|
@ -62,12 +86,29 @@ public class Client extends User {
|
|||
this.address = address;
|
||||
}
|
||||
|
||||
public String getTimetable() {
|
||||
return timetable;
|
||||
|
||||
public String getInit() {
|
||||
return init;
|
||||
}
|
||||
|
||||
public void setTimetable(String timetable) {
|
||||
this.timetable = timetable;
|
||||
public void setInit(String init) {
|
||||
this.init = init;
|
||||
}
|
||||
|
||||
public String getFinish() {
|
||||
return finish;
|
||||
}
|
||||
|
||||
public void setFinish(String finish) {
|
||||
this.finish = finish;
|
||||
}
|
||||
|
||||
public User getUsername() {
|
||||
return usuar;
|
||||
}
|
||||
|
||||
public void setUsername(User username) {
|
||||
this.usuar = username;
|
||||
}
|
||||
|
||||
public String getTelephone() {
|
||||
|
@ -101,4 +142,37 @@ public class Client extends User {
|
|||
public void setFood(String food) {
|
||||
this.food = food;
|
||||
}
|
||||
|
||||
public Set<FoodOffer> getFoodOffers() {
|
||||
return foodOffers;
|
||||
}
|
||||
|
||||
public void setFoodOffers(Set<FoodOffer> foodOffers) {
|
||||
this.foodOffers = foodOffers;
|
||||
}
|
||||
|
||||
public Set<NuOffer> getNuOffers() {
|
||||
return nuOffers;
|
||||
}
|
||||
|
||||
public void setNuOffers(Set<NuOffer> nuOffers) {
|
||||
this.nuOffers = nuOffers;
|
||||
}
|
||||
|
||||
public Set<SpeedOffer> getSpeedOffers() {
|
||||
return speedOffers;
|
||||
}
|
||||
|
||||
public void setSpeedOffers(Set<SpeedOffer> speedOffers) {
|
||||
this.speedOffers = speedOffers;
|
||||
}
|
||||
|
||||
public Set<TimeOffer> getTimeOffers() {
|
||||
return timeOffers;
|
||||
}
|
||||
|
||||
public void setTimeOffers(Set<TimeOffer> timeOffers) {
|
||||
this.timeOffers = timeOffers;
|
||||
}
|
||||
|
||||
}
|
|
@ -23,7 +23,7 @@ import javax.validation.constraints.NotNull;
|
|||
@Entity
|
||||
@Table(name = "food_offers")
|
||||
public class FoodOffer extends Offer {
|
||||
|
||||
//Plato específico
|
||||
@NotBlank
|
||||
private String food;
|
||||
|
||||
|
|
|
@ -1,18 +1,3 @@
|
|||
/*
|
||||
* 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.model;
|
||||
|
||||
import javax.persistence.Column;
|
||||
|
|
|
@ -29,7 +29,7 @@ import org.springframework.format.annotation.DateTimeFormat;
|
|||
|
||||
@MappedSuperclass
|
||||
public class Offer extends BaseEntity {
|
||||
|
||||
//Clase padre
|
||||
@DateTimeFormat(pattern = "dd/MM/yyyy HH:mm")
|
||||
@NotNull
|
||||
@Future
|
||||
|
|
|
@ -1,18 +1,3 @@
|
|||
/*
|
||||
* 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.model;
|
||||
|
||||
import javax.persistence.Column;
|
||||
|
@ -25,6 +10,7 @@ import javax.validation.constraints.NotNull;
|
|||
@Table(name = "speed_offers")
|
||||
public class SpeedOffer extends Offer {
|
||||
|
||||
|
||||
@NotNull
|
||||
private Integer gold; // x minutos
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ import org.springframework.format.annotation.DateTimeFormat;
|
|||
@Entity
|
||||
@Table(name = "time_offers")
|
||||
public class TimeOffer extends Offer {
|
||||
|
||||
//Oferta por franja horaria
|
||||
@DateTimeFormat(pattern = "HH:mm")
|
||||
@NotNull
|
||||
private LocalTime init;
|
||||
|
|
|
@ -1,23 +1,12 @@
|
|||
package org.springframework.cheapy.model;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.persistence.CascadeType;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.MappedSuperclass;
|
||||
import javax.persistence.OneToMany;
|
||||
import javax.persistence.OneToOne;
|
||||
import javax.persistence.Table;
|
||||
import javax.validation.constraints.Email;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
|
||||
//@Entity
|
||||
//@Table(name = "users")
|
||||
@MappedSuperclass
|
||||
@Entity
|
||||
@Table(name = "users")
|
||||
//@MappedSuperclass
|
||||
public class User{
|
||||
|
||||
@Id
|
||||
|
@ -27,7 +16,12 @@ public class User{
|
|||
private String password;
|
||||
|
||||
boolean enabled;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
public String getUsername() {
|
||||
|
@ -46,11 +40,4 @@ public class User{
|
|||
this.password = password;
|
||||
}
|
||||
|
||||
// public Set<Authorities> getAuthority() {
|
||||
// return authorities;
|
||||
// }
|
||||
//
|
||||
// public void setAuthorities(Set<Authorities> authorities) {
|
||||
// this.authorities = authorities;
|
||||
// }
|
||||
}
|
||||
|
|
|
@ -5,22 +5,101 @@ import java.util.Set;
|
|||
import javax.persistence.CascadeType;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.OneToMany;
|
||||
import javax.persistence.OneToOne;
|
||||
import javax.persistence.Table;
|
||||
import javax.validation.constraints.Email;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
@Entity
|
||||
@Table(name = "users")
|
||||
public class Usuario extends User{
|
||||
@Table(name = "usuarios")
|
||||
public class Usuario extends BaseEntity{
|
||||
|
||||
@OneToMany(cascade = CascadeType.ALL, mappedBy = "user")
|
||||
private Set<Authorities> authorities;
|
||||
/** nombre, apellidos, dni, direccion, telefono, email, username
|
||||
* (id,nombre, apellidos, dni, direccion, telefono, email, usuar)
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public Set<Authorities> getAuthorities() {
|
||||
return authorities;
|
||||
@NotBlank
|
||||
private String nombre;
|
||||
|
||||
@NotBlank
|
||||
private String apellidos;
|
||||
|
||||
@NotBlank
|
||||
private String dni;
|
||||
|
||||
@NotBlank
|
||||
private String direccion;
|
||||
|
||||
@NotBlank
|
||||
//@Pattern(regexp = "([+][^0][\\d]{0,2})?[ ]?([(][\\d]{0,4}[)])?[ ]?([\\d]{6,10})$")
|
||||
private String telefono;
|
||||
|
||||
@Email
|
||||
@NotBlank
|
||||
private String email;
|
||||
|
||||
@OneToOne(cascade = CascadeType.ALL)
|
||||
@JoinColumn(name = "username", referencedColumnName = "username")
|
||||
private User usuar;
|
||||
|
||||
public String getNombre() {
|
||||
return nombre;
|
||||
}
|
||||
|
||||
public void setAuthorities(Set<Authorities> authorities) {
|
||||
this.authorities = authorities;
|
||||
public void setNombre(String nombre) {
|
||||
this.nombre = nombre;
|
||||
}
|
||||
|
||||
public String getApellidos() {
|
||||
return apellidos;
|
||||
}
|
||||
|
||||
public void setApellidos(String apellidos) {
|
||||
this.apellidos = apellidos;
|
||||
}
|
||||
|
||||
public String getDni() {
|
||||
return dni;
|
||||
}
|
||||
|
||||
public void setDni(String dni) {
|
||||
this.dni = dni;
|
||||
}
|
||||
|
||||
public String getDireccion() {
|
||||
return direccion;
|
||||
}
|
||||
|
||||
public void setDireccion(String direccion) {
|
||||
this.direccion = direccion;
|
||||
}
|
||||
|
||||
public String getTelefono() {
|
||||
return telefono;
|
||||
}
|
||||
|
||||
public void setTelefono(String telefono) {
|
||||
this.telefono = telefono;
|
||||
}
|
||||
|
||||
public String getEmail() {
|
||||
return email;
|
||||
}
|
||||
|
||||
public void setEmail(String email) {
|
||||
this.email = email;
|
||||
}
|
||||
|
||||
public User getUser() {
|
||||
return usuar;
|
||||
}
|
||||
|
||||
public void setUser(User username) {
|
||||
this.usuar = username;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,28 +1,20 @@
|
|||
/*
|
||||
* 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 org.springframework.cheapy.model.FoodOffer;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
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;
|
||||
|
||||
|
||||
public interface FoodOfferRepository extends Repository<FoodOffer, Integer> {
|
||||
|
||||
@Query("SELECT foodOffer FROM FoodOffer foodOffer")
|
||||
@Transactional(readOnly = true)
|
||||
List<FoodOffer> findAllFoodOffer();
|
||||
|
||||
@Query("SELECT foodOffer FROM FoodOffer foodOffer WHERE id =:id")
|
||||
@Transactional(readOnly = true)
|
||||
|
|
|
@ -1,7 +1,12 @@
|
|||
|
||||
package org.springframework.cheapy.repository;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import org.springframework.cheapy.model.NuOffer;
|
||||
import org.springframework.data.repository.Repository;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
|
||||
public interface NuOfferRepository extends Repository<NuOffer, Integer> {
|
||||
|
@ -11,6 +16,11 @@ public interface NuOfferRepository extends Repository<NuOffer, Integer> {
|
|||
|
||||
|
||||
NuOffer findNuOfferById(int nuOfferId);
|
||||
|
||||
@Query("SELECT nuOffer FROM NuOffer nuOffer")
|
||||
@Transactional(readOnly = true)
|
||||
List<NuOffer> findAllNuOffer();
|
||||
|
||||
|
||||
|
||||
void save(NuOffer nuOffer);
|
||||
|
|
|
@ -1,33 +1,28 @@
|
|||
/*
|
||||
* 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 java.util.List;
|
||||
import org.springframework.cheapy.model.SpeedOffer;
|
||||
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;
|
||||
|
||||
|
||||
public interface SpeedOfferRepository extends Repository<SpeedOffer, Integer> {
|
||||
|
||||
|
||||
@Query("SELECT speedOffer FROM SpeedOffer speedOffer WHERE id =:id")
|
||||
@Transactional(readOnly = true)
|
||||
SpeedOffer findById(@Param("id") Integer id);
|
||||
|
||||
@Query("SELECT speedOffer FROM SpeedOffer speedOffer")
|
||||
@Transactional(readOnly = true)
|
||||
List<SpeedOffer> findAllSpeedOffer();
|
||||
|
||||
|
||||
void save(SpeedOffer speedOffer);
|
||||
|
||||
}
|
||||
|
|
|
@ -1,7 +1,12 @@
|
|||
|
||||
package org.springframework.cheapy.repository;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import org.springframework.cheapy.model.TimeOffer;
|
||||
import org.springframework.data.repository.Repository;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
|
||||
public interface TimeOfferRepository extends Repository<TimeOffer, Integer> {
|
||||
|
@ -11,6 +16,11 @@ public interface TimeOfferRepository extends Repository<TimeOffer, Integer> {
|
|||
|
||||
|
||||
TimeOffer findTimeOfferById(int timeOfferId);
|
||||
|
||||
@Query("SELECT timeOffer FROM TimeOffer timeOffer")
|
||||
@Transactional(readOnly = true)
|
||||
List<TimeOffer> findAllTimeOffer();
|
||||
|
||||
|
||||
|
||||
void save(TimeOffer timeOffer);
|
||||
|
|
|
@ -7,6 +7,6 @@ import org.springframework.cheapy.model.Usuario;
|
|||
|
||||
public interface UsuarioRepository extends CrudRepository<Usuario, String> {
|
||||
|
||||
Usuario findByUsername(String currentPrincipalName);
|
||||
//Usuario findByUsername(String currentPrincipalName);
|
||||
|
||||
}
|
||||
|
|
|
@ -3,6 +3,8 @@ package org.springframework.cheapy.service;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cheapy.model.FoodOffer;
|
||||
import org.springframework.cheapy.repository.FoodOfferRepository;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import org.springframework.dao.DataAccessException;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
@ -19,8 +21,14 @@ public class FoodOfferService {
|
|||
public FoodOffer findFoodOfferById(final int id) {
|
||||
return this.foodOfferRepository.findById(id);
|
||||
}
|
||||
public List<FoodOffer> findAllFoodOffer() { //
|
||||
return this.foodOfferRepository.findAllFoodOffer();
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void saveFoodOffer(final FoodOffer foodOffer) throws DataAccessException {
|
||||
|
||||
this.foodOfferRepository.save(foodOffer);
|
||||
|
||||
}
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
package org.springframework.cheapy.service;
|
||||
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cheapy.model.NuOffer;
|
||||
import org.springframework.cheapy.repository.NuOfferRepository;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import org.springframework.dao.DataAccessException;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
@ -17,11 +20,17 @@ public class NuOfferService {
|
|||
}
|
||||
|
||||
public NuOffer findNuOfferById(final int id) {
|
||||
|
||||
return this.nuOfferRepository.findNuOfferById(id);
|
||||
}
|
||||
public List<NuOffer> findAllNuOffer() { //
|
||||
return this.nuOfferRepository.findAllNuOffer();
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void saveNuOffer(final NuOffer nuOffer) throws DataAccessException { //
|
||||
|
||||
this.nuOfferRepository.save(nuOffer);
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
package org.springframework.cheapy.service;
|
||||
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cheapy.model.SpeedOffer;
|
||||
import org.springframework.cheapy.repository.SpeedOfferRepository;
|
||||
|
@ -8,9 +11,10 @@ import org.springframework.stereotype.Service;
|
|||
|
||||
@Service
|
||||
public class SpeedOfferService {
|
||||
|
||||
|
||||
private SpeedOfferRepository speedOfferRepository;
|
||||
|
||||
|
||||
@Autowired
|
||||
public SpeedOfferService(final SpeedOfferRepository speedOfferRepository) {
|
||||
this.speedOfferRepository = speedOfferRepository;
|
||||
|
@ -19,8 +23,15 @@ public class SpeedOfferService {
|
|||
public SpeedOffer findSpeedOfferById(final int id) {
|
||||
return this.speedOfferRepository.findById(id);
|
||||
}
|
||||
|
||||
public List<SpeedOffer> findAllSpeedOffer() { //
|
||||
return this.speedOfferRepository.findAllSpeedOffer();
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void saveSpeedOffer(final SpeedOffer speedOffer) throws DataAccessException {
|
||||
|
||||
this.speedOfferRepository.save(speedOffer);
|
||||
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package org.springframework.cheapy.service;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cheapy.model.TimeOffer;
|
||||
import org.springframework.cheapy.repository.TimeOfferRepository;
|
||||
|
||||
import org.springframework.dao.DataAccessException;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
@ -19,10 +20,15 @@ public class TimeOfferService {
|
|||
public TimeOffer findTimeOfferById(final int id) {
|
||||
return this.timeOfferRepository.findTimeOfferById(id);
|
||||
}
|
||||
|
||||
public List<TimeOffer> findAllTimeOffer() { //
|
||||
return this.timeOfferRepository.findAllTimeOffer();
|
||||
}
|
||||
|
||||
|
||||
public void saveTimeOffer(final TimeOffer TimeOffer) throws DataAccessException { //
|
||||
this.timeOfferRepository.save(TimeOffer);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,64 +0,0 @@
|
|||
/*
|
||||
* Copyright 2002-2013 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
|
||||
*
|
||||
* http://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.service;
|
||||
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.dao.DataAccessException;
|
||||
import org.springframework.cheapy.model.User;
|
||||
import org.springframework.cheapy.repository.UsuarioRepository;
|
||||
import org.springframework.security.core.Authentication;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
|
||||
/**
|
||||
* Mostly used as a facade for all Petclinic controllers Also a placeholder
|
||||
* for @Transactional and @Cacheable annotations
|
||||
*
|
||||
* @author Michael Isvy
|
||||
*/
|
||||
|
||||
@Service
|
||||
public class UserService {
|
||||
/*
|
||||
private UserRepository userRepository;
|
||||
|
||||
@Autowired
|
||||
public UserService(UserRepository userRepository) {
|
||||
this.userRepository = userRepository;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void saveUser(User user) throws DataAccessException {
|
||||
userRepository.save(user);
|
||||
}
|
||||
|
||||
public Optional<User> findUser(String username) {
|
||||
return userRepository.findById(username);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public User getCurrentUser() throws DataAccessException {
|
||||
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
|
||||
String currentPrincipalName = authentication.getName(); //Obtiene el nombre del ususario actual
|
||||
return this.userRepository.findByUsername(currentPrincipalName); //Obtiene el usuario con ese nombre
|
||||
}
|
||||
*/
|
||||
}
|
|
@ -33,7 +33,7 @@ import org.springframework.context.annotation.Configuration;
|
|||
class CacheConfiguration {
|
||||
|
||||
@Bean
|
||||
public JCacheManagerCustomizer petclinicCacheConfigurationCustomizer() {
|
||||
public JCacheManagerCustomizer cheapyCacheConfigurationCustomizer() {
|
||||
return cm -> {
|
||||
cm.createCache("vets", cacheConfiguration());
|
||||
};
|
||||
|
|
|
@ -28,7 +28,7 @@ import org.springframework.web.bind.annotation.GetMapping;
|
|||
@Controller
|
||||
public class CrashController {
|
||||
|
||||
@GetMapping("/oups")
|
||||
@GetMapping(value="/oups")
|
||||
public String triggerException() {
|
||||
throw new RuntimeException(
|
||||
"Expected: controller used to showcase what " + "happens when an exception is thrown");
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
/*
|
||||
* 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.system;
|
||||
|
||||
import org.springframework.security.authentication.AnonymousAuthenticationToken;
|
||||
import org.springframework.security.core.Authentication;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
|
||||
@Controller
|
||||
class LoginController {
|
||||
|
||||
@GetMapping("/login")
|
||||
public String login() {
|
||||
Authentication authentication= SecurityContextHolder.getContext().getAuthentication();
|
||||
if(authentication==null || authentication instanceof AnonymousAuthenticationToken) {
|
||||
return "login";
|
||||
}
|
||||
return "redirect:/";
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -27,4 +27,6 @@ class WelcomeController {
|
|||
return "welcome";
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,24 +1,8 @@
|
|||
/*
|
||||
* 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 java.util.Map;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
import org.springframework.cheapy.model.Client;
|
||||
import org.springframework.cheapy.model.FoodOffer;
|
||||
import org.springframework.cheapy.model.StatusOffer;
|
||||
|
@ -86,4 +70,14 @@ public class FoodOfferController {
|
|||
}
|
||||
return "redirect:/foodOffers/";
|
||||
}
|
||||
@GetMapping("/offers/food/{foodOfferId}")
|
||||
public String processShowForm(@PathVariable("foodOfferId") int foodOfferId, Map<String, Object> model) {
|
||||
|
||||
FoodOffer foodOffer=this.foodOfferService.findFoodOfferById(foodOfferId);
|
||||
|
||||
model.put("foodOffer", foodOffer);
|
||||
|
||||
return "foodOffers/foodOffersShow";
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -81,5 +81,18 @@ public class NuOfferController {
|
|||
|
||||
|
||||
}
|
||||
|
||||
@GetMapping("/offers/nu/{nuOfferId}")
|
||||
public String processShowForm(@PathVariable("nuOfferId") int nuOfferId, Map<String, Object> model) {
|
||||
|
||||
NuOffer nuOffer=this.nuOfferService.findNuOfferById(nuOfferId);
|
||||
|
||||
model.put("nuOffer", nuOffer);
|
||||
|
||||
return "nuOffers/nuOffersShow";
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,109 @@
|
|||
/*
|
||||
* 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 java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.cheapy.model.FoodOffer;
|
||||
import org.springframework.cheapy.model.NuOffer;
|
||||
import org.springframework.cheapy.model.SpeedOffer;
|
||||
import org.springframework.cheapy.model.TimeOffer;
|
||||
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.validation.BindingResult;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
|
||||
|
||||
/**
|
||||
* @author Juergen Hoeller
|
||||
* @author Ken Krebs
|
||||
* @author Arjen Poutsma
|
||||
* @author Michael Isvy
|
||||
*/
|
||||
@Controller
|
||||
public class OfertaController {
|
||||
|
||||
//private static final String VIEWS_OWNER_CREATE_OR_UPDATE_FORM = "owners/createOrUpdateOwnerForm";
|
||||
|
||||
private final FoodOfferService foodOfferService;
|
||||
private final NuOfferService nuOfferService;
|
||||
private final SpeedOfferService speedOfferService;
|
||||
private final TimeOfferService timeOfferService;
|
||||
|
||||
|
||||
|
||||
public OfertaController(final FoodOfferService foodOfferService, final NuOfferService nuOfferService,
|
||||
final SpeedOfferService speedOfferService, final TimeOfferService timeOfferService) {
|
||||
this.foodOfferService = foodOfferService;
|
||||
this.nuOfferService = nuOfferService;
|
||||
this.speedOfferService = speedOfferService;
|
||||
this.timeOfferService = timeOfferService;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/offers")
|
||||
public String processFindForm( Map<String, Object> model) {
|
||||
|
||||
List<FoodOffer> foodOfferLs=this.foodOfferService.findAllFoodOffer();
|
||||
List<NuOffer> nuOfferLs=this.nuOfferService.findAllNuOffer();
|
||||
List<SpeedOffer> speedOfferLs=this.speedOfferService.findAllSpeedOffer();
|
||||
List<TimeOffer> timeOfferLs=this.timeOfferService.findAllTimeOffer();
|
||||
|
||||
model.put("foodOfferLs", foodOfferLs);
|
||||
model.put("nuOfferLs", nuOfferLs);
|
||||
model.put("speedOfferLs", speedOfferLs);
|
||||
model.put("timeOfferLs", timeOfferLs);
|
||||
|
||||
return "offers/offersList";
|
||||
|
||||
}
|
||||
|
||||
// @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;
|
||||
// }
|
||||
|
||||
|
||||
}
|
|
@ -15,6 +15,7 @@
|
|||
*/
|
||||
package org.springframework.cheapy.web;
|
||||
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
@ -86,4 +87,16 @@ public class SpeedOfferController {
|
|||
}
|
||||
return "redirect:/speedOffers/";
|
||||
}
|
||||
|
||||
@GetMapping("/offers/speed/{speedOfferId}")
|
||||
public String processShowForm(@PathVariable("speedOfferId") int speedOfferId, Map<String, Object> model) {
|
||||
|
||||
SpeedOffer speedOffer=this.speedOfferService.findSpeedOfferById(speedOfferId);
|
||||
|
||||
model.put("speedOffer", speedOffer);
|
||||
|
||||
return "speedOffers/speedOffersShow";
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package org.springframework.cheapy.web;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
import org.springframework.cheapy.model.Client;
|
||||
|
@ -81,5 +80,17 @@ public class TimeOfferController {
|
|||
|
||||
|
||||
}
|
||||
|
||||
@GetMapping("/offers/time/{timeOfferId}")
|
||||
public String processShowForm(@PathVariable("timeOfferId") int timeOfferId, Map<String, Object> model) {
|
||||
|
||||
TimeOffer timeOffer=this.timeOfferService.findTimeOfferById(timeOfferId);
|
||||
|
||||
model.put("timeOffer", timeOffer);
|
||||
|
||||
return "timeOffers/timeOffersShow";
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,154 +0,0 @@
|
|||
/*
|
||||
* Copyright 2002-2013 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
|
||||
*
|
||||
* http://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 javax.persistence.EntityNotFoundException;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cheapy.model.Authorities;
|
||||
import org.springframework.cheapy.model.User;
|
||||
import org.springframework.cheapy.service.AuthoritiesService;
|
||||
import org.springframework.cheapy.service.UserService;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.validation.BindingResult;
|
||||
import org.springframework.validation.FieldError;
|
||||
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.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
|
||||
/**
|
||||
* @author Juergen Hoeller
|
||||
* @author Ken Krebs
|
||||
* @author Arjen Poutsma
|
||||
* @author Michael Isvy
|
||||
*/
|
||||
@Controller
|
||||
public class UserController {
|
||||
|
||||
private UserService userService;
|
||||
|
||||
private AuthoritiesService authoritiesService;
|
||||
|
||||
// @Autowired
|
||||
// public UserController (UserService userService, AuthoritiesService authoritiesService,
|
||||
// ClienteService clienteService, FarmaceuticoService farmaceuticoService, ProveedorService proveedorService) {
|
||||
// this.userService = userService;
|
||||
// this.authoritiesService = authoritiesService;
|
||||
// this.clienteService = clienteService;
|
||||
// this.farmaceuticoService = farmaceuticoService;
|
||||
// this.proveedorService = proveedorService;
|
||||
// }
|
||||
//
|
||||
// @InitBinder
|
||||
// public void setAllowedFields(final WebDataBinder dataBinder) {
|
||||
// dataBinder.setDisallowedFields("id");
|
||||
// }
|
||||
//
|
||||
// @GetMapping("users")
|
||||
// private String showUserDetails(ModelMap model) {
|
||||
// User user = this.userService.getCurrentUser();
|
||||
// Authorities authority = this.authoritiesService.findAuthoritiyByUser(user);
|
||||
//
|
||||
// if(authority.getAuthority().equals("cliente")) {
|
||||
// Cliente cliente = this.clienteService.findClienteUser(user);
|
||||
// model.addAttribute("cliente", cliente);
|
||||
// }else if(authority.getAuthority().equals("proveedor")) {
|
||||
// Proveedor proveedor = this.proveedorService.findProveedorUser(user);
|
||||
// model.addAttribute("proveedor", proveedor);
|
||||
// }else if(authority.getAuthority().equals("farmaceutico")) {
|
||||
// Farmaceutico farmaceutico = this.farmaceuticoService.findFarmaceuticoByUser(user);
|
||||
// model.addAttribute("farmaceutico", farmaceutico);
|
||||
// }
|
||||
//
|
||||
// log.info("El usuario '" + user.getUsername() + "' ha mostrado su informacion personal");
|
||||
// return "users/userDetails";
|
||||
// }
|
||||
//
|
||||
// @GetMapping("/users/new")
|
||||
// public String newUser(ModelMap model) {
|
||||
// Cliente cliente = new Cliente();
|
||||
// model.addAttribute("cliente", cliente);
|
||||
// model.addAttribute("dni", new String());
|
||||
// return "users/userRegister";
|
||||
// }
|
||||
//
|
||||
// @PostMapping("/users/new")
|
||||
// public String creationUser(@ModelAttribute("cliente") Cliente cliente, final BindingResult result, ModelMap model) {
|
||||
// if (result.hasErrors()) {
|
||||
// return "users/userRegister";
|
||||
// } else if(cliente.getUser() == null) {
|
||||
// try {
|
||||
// cliente = this.clienteService.clienteDni(cliente.getDni());
|
||||
// }catch(EntityNotFoundException ex) {
|
||||
// result.rejectValue("dni", "clienteNotFound");
|
||||
// return "users/userRegister";
|
||||
// }
|
||||
// cliente.setUser(new User());
|
||||
// model.addAttribute("cliente", cliente);
|
||||
// return "users/userRegister";
|
||||
// }else {
|
||||
// this.userService.saveUser(cliente.getUser());
|
||||
// this.authoritiesService.saveAuthorities(cliente.getUser().getUsername(), "cliente");
|
||||
// this.clienteService.saveCliente(cliente);
|
||||
// log.info("El cliente con dni '" + cliente.getDni() + "' se ha registrado como usuario");
|
||||
// return "redirect:../";
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @GetMapping("/users/password")
|
||||
// public String initChangePassword(ModelMap model) {
|
||||
// User currentUser = this.userService.getCurrentUser();
|
||||
// UserValidate user = new UserValidate(currentUser.getUsername(), "");
|
||||
// model.addAttribute("user", user);
|
||||
// return "users/passwordEdit";
|
||||
// }
|
||||
//
|
||||
// @PostMapping("/users/password")
|
||||
// public String changePassword(@ModelAttribute("user") UserValidate user, final BindingResult result, ModelMap model) {
|
||||
// if(result.hasErrors()) {
|
||||
// return "users/passwordEdit";
|
||||
// }else {
|
||||
// User CurrentUser = this.userService.getCurrentUser();
|
||||
// if(CurrentUser.getPassword().equals(user.getPassword()) && user.getNewPassword().equals(user.getValidPassword())) {
|
||||
// if(!user.getNewPassword().isEmpty()) {
|
||||
// CurrentUser.setPassword(user.getNewPassword());
|
||||
// this.userService.saveUser(CurrentUser);
|
||||
// log.info("El usuario '" + CurrentUser.getUsername() + "' ha cambiado satisfactoriamente su contraseña");
|
||||
// return "redirect:../";
|
||||
// }else {
|
||||
// FieldError err = new FieldError("PassException", "newPassword", "Introduce una nueva contraseña");
|
||||
// result.addError(err);
|
||||
// log.warn("El usuario '" + CurrentUser.getUsername() + "' ha tenido un error 'PassException'");
|
||||
// return "users/passwordEdit";
|
||||
// }
|
||||
// }else if(!CurrentUser.getPassword().equals(user.getPassword())){
|
||||
// FieldError err = new FieldError("PassException", "password", "Contraseña incorrecta");
|
||||
// result.addError(err);
|
||||
// log.warn("El usuario '" + CurrentUser.getUsername() + "' ha tenido un error 'PassException'");
|
||||
// return "users/passwordEdit";
|
||||
// }else {
|
||||
// FieldError err = new FieldError("PassException", "newPassword", "Las contraseñas no coinciden");
|
||||
// result.addError(err);
|
||||
// log.warn("El usuario '" + CurrentUser.getUsername() + "' ha tenido un error 'PassException'");
|
||||
// return "users/passwordEdit";
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
================================================================================
|
||||
=== Spring PetClinic sample application - MySQL Configuration ===
|
||||
=== Spring Cheapy sample application - MySQL Configuration ===
|
||||
================================================================================
|
||||
|
||||
@author Sam Brannen
|
||||
|
@ -18,15 +18,15 @@
|
|||
mysql_1_eedb4818d817 | MySQL init process done. Ready for start up.
|
||||
...
|
||||
|
||||
2) (Once only) create the PetClinic database and user by executing the "db/mysql/user.sql"
|
||||
2) (Once only) create the Cheapy database and user by executing the "db/mysql/user.sql"
|
||||
scripts. You can connect to the database running in the docker container using
|
||||
`mysql -u root -h localhost --protocol tcp`, but you don't need to run the script there
|
||||
because the petclinic user is already set up if you use the provided `docker-compose.yaml`.
|
||||
because the cheapy user is already set up if you use the provided `docker-compose.yaml`.
|
||||
|
||||
3) Run the app with `spring.profiles.active=mysql` (e.g. as a System property via the command
|
||||
line, but any way that sets that property in a Spring Boot app should work).
|
||||
|
||||
N.B. the "petclinic" database has to exist for the app to work with the JDBC URL value
|
||||
N.B. the "cheapy" database has to exist for the app to work with the JDBC URL value
|
||||
as it is configured by default. This condition is taken care of automatically by the
|
||||
docker-compose configuration provided, or by the `user.sql` script if you run that as
|
||||
root.
|
||||
|
|
|
@ -14,7 +14,28 @@ INSERT INTO owners VALUES (10, 'Carlos', 'Estaban', '2335 Independence La.', 'Wa
|
|||
INSERT INTO food_offers(start, end, code, type, client_id, food, discount, units) VALUES ('2021-06-15 12:00:00', '2021-06-16 12:00:00', 'FO-1', 'active', null, 'macarrones', '15%', 10);
|
||||
INSERT INTO speed_offers(start, end, code, type, client_id, gold, discount_gold, silver, discount_silver, bronze, discount_bronze) VALUES ('2021-06-15 12:00:00', '2021-06-16 12:00:00', 'SP-1', 'active', null, 5, '15%', 10, '10%', 15, '5%');
|
||||
INSERT INTO time_offers(start, end, code, type, client_id, init, finish, discount) VALUES ('2021-06-15 12:00:00', '2021-06-16 12:00:00', 'jkhlljk', 'active', null, '12:00:00', '13:00:00', '10%');
|
||||
INSERT INTO speed_offers(start, end, code, type, client_id, gold, discount_gold, silver, discount_silver, bronze, discount_bronze) VALUES ('2021-06-15 12:00:00', '2021-06-16 12:00:00', 'jkhlljk', 'active', null,5,'25%',10,'15%',15,'10%' );
|
||||
INSERT INTO nu_offers(start, end, code, type, client_id, gold, discount_gold, silver, discount_silver, bronze, discount_bronze) VALUES ('2021-06-15 12:00:00', '2021-06-16 12:00:00', 'jkhlljk', 'active', null,15,'25%',10,'15%',5,'10%' );
|
||||
|
||||
|
||||
INSERT INTO users (dtype,username,password,enabled) VALUES ('user','admin','admin', TRUE );
|
||||
INSERT INTO authorities VALUES ('admin','admin');
|
||||
INSERT INTO users (dtype,username,password,enabled) VALUES ('user','manoli','manoli', TRUE );
|
||||
INSERT INTO authorities VALUES ('manoli','cliente');
|
||||
INSERT INTO users (dtype,username,password,enabled) VALUES ('user','david','david', TRUE );
|
||||
INSERT INTO authorities VALUES ('david','cliente');
|
||||
INSERT INTO users (dtype,username,password,enabled) VALUES ('user','paco','paco', TRUE );
|
||||
INSERT INTO authorities VALUES ('paco','usuario');
|
||||
INSERT INTO users (dtype,username,password,enabled) VALUES ('user','lolo','lolo', TRUE );
|
||||
INSERT INTO authorities VALUES ('lolo','usuario');
|
||||
INSERT INTO users (dtype,username,password,enabled) VALUES ('user','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 clients VALUES (1,'manoli@gmail.com','C/Betis','10:00','22:00','608726190', 'description 1', 'code1', 'ESPAÑOLA','manoli');
|
||||
INSERT INTO clients VALUES (2,'david@gmail.com','C/Sevilla','09:30','22:00','608726190', 'description 2', 'code2', 'americana','david');
|
||||
|
||||
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');
|
||||
|
|
BIN
src/main/resources/static/resources/images/bar3.jpg
Normal file
BIN
src/main/resources/static/resources/images/bar3.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 479 KiB |
15
src/main/webapp/WEB-INF/jsp/error.jsp
Normal file
15
src/main/webapp/WEB-INF/jsp/error.jsp
Normal file
|
@ -0,0 +1,15 @@
|
|||
<%@ page session="false" trimDirectiveWhitespaces="true" %>
|
||||
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
|
||||
<%@ taglib prefix="cheapy" tagdir="/WEB-INF/tags" %>
|
||||
|
||||
|
||||
<cheapy:layout pageName="error">
|
||||
|
||||
<h2>Algo malo ha pasado...</h2>
|
||||
|
||||
<spring:url value="/resources/images/Logo Cheapy.png" htmlEscape="true" var="cheapyImage"/>
|
||||
<img class="img-responsive" src="${cheapyImage}"/>
|
||||
|
||||
<p>${exception.message}</p>
|
||||
|
||||
</cheapy:layout>
|
|
@ -1,14 +0,0 @@
|
|||
<%@ page session="false" trimDirectiveWhitespaces="true" %>
|
||||
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
|
||||
<%@ taglib prefix="petclinic" tagdir="/WEB-INF/tags" %>
|
||||
|
||||
<petclinic:layout pageName="error">
|
||||
|
||||
<spring:url value="/resources/images/pets.png" var="petsImage"/>
|
||||
<img src="${petsImage}"/>
|
||||
|
||||
<h2>Something happened...</h2>
|
||||
|
||||
<p>${exception.message}</p>
|
||||
|
||||
</petclinic:layout>
|
44
src/main/webapp/WEB-INF/jsp/foodOffers/foodOffersShow.jsp
Normal file
44
src/main/webapp/WEB-INF/jsp/foodOffers/foodOffersShow.jsp
Normal file
|
@ -0,0 +1,44 @@
|
|||
<%@ page session="false" trimDirectiveWhitespaces="true" %>
|
||||
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
|
||||
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
|
||||
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
||||
<%@ taglib prefix="cheapy" tagdir="/WEB-INF/tags" %>
|
||||
|
||||
<cheapy:layout pageName="foodOffer">
|
||||
|
||||
<h2>Oferta por plato específico</h2>
|
||||
|
||||
|
||||
<table class="table table-striped">
|
||||
<tr>
|
||||
<th>Inicio de la oferta</th>
|
||||
<td><b><c:out value="${foodOffer.start}"/></b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Fin de la oferta</th>
|
||||
<td><c:out value="${foodOffer.end}"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Plato en oferta</th>
|
||||
<td><c:out value="${foodOffer.food}"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Descuento</th>
|
||||
<td><c:out value="${foodOffer.discount}"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Cantidad</th>
|
||||
<td><c:out value="${foodOffer.units}"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Codigo de la oferta</th>
|
||||
<td><c:out value="${foodOffer.code}"/></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<%-- <spring:url value="{ownerId}/edit" var="editUrl">
|
||||
<spring:param name="ownerId" value="${owner.id}"/>
|
||||
</spring:url>
|
||||
<a href="${fn:escapeXml(editUrl)}" class="btn btn-default">Edit Owner</a> --%>
|
||||
|
||||
</cheapy:layout>
|
302
src/main/webapp/WEB-INF/jsp/login.jsp
Normal file
302
src/main/webapp/WEB-INF/jsp/login.jsp
Normal file
|
@ -0,0 +1,302 @@
|
|||
<%@ 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="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'>
|
||||
<script src="//maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
|
||||
|
||||
<!-- %@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %-->
|
||||
|
||||
<style>
|
||||
|
||||
|
||||
body {
|
||||
font-family: "montserratregular", sans-serif;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #92badd;
|
||||
display:inline-block;
|
||||
text-decoration: none;
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
h2 {
|
||||
text-align: center;
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
text-transform: uppercase;
|
||||
display:inline-block;
|
||||
margin: 40px 8px 10px 8px;
|
||||
color: #cccccc;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* STRUCTURE */
|
||||
|
||||
.wrapper {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
width: 100%;
|
||||
min-height: 100%;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
#formContent {
|
||||
-webkit-border-radius: 10px 10px 10px 10px;
|
||||
border-radius: 10px 10px 10px 10px;
|
||||
background: #fff;
|
||||
padding: 30px;
|
||||
width: 90%;
|
||||
max-width: 450px;
|
||||
position: relative;
|
||||
padding: 0px;
|
||||
-webkit-box-shadow: 0 30px 60px 0 rgba(0,0,0,0.3);
|
||||
box-shadow: 0 30px 60px 0 rgba(0,0,0,0.3);
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
#formFooter {
|
||||
background-color: #f6f6f6;
|
||||
border-top: 1px solid #dce8f1;
|
||||
padding: 25px;
|
||||
text-align: center;
|
||||
-webkit-border-radius: 0 0 10px 10px;
|
||||
border-radius: 0 0 10px 10px;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* TABS */
|
||||
|
||||
h2.inactive {
|
||||
color: #cccccc;
|
||||
}
|
||||
|
||||
h2.active {
|
||||
color: #0d0d0d;
|
||||
border-bottom: 2px solid #5fbae9;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* FORM TYPOGRAPHY*/
|
||||
|
||||
input[type=button], input[type=submit], input[type=reset] {
|
||||
background-color: #56baed;
|
||||
border: none;
|
||||
color: white;
|
||||
padding: 15px 80px;
|
||||
text-align: center;
|
||||
text-decoration: none;
|
||||
display: inline-block;
|
||||
text-transform: uppercase;
|
||||
font-size: 13px;
|
||||
-webkit-box-shadow: 0 10px 30px 0 rgba(95,186,233,0.4);
|
||||
box-shadow: 0 10px 30px 0 rgba(95,186,233,0.4);
|
||||
-webkit-border-radius: 5px 5px 5px 5px;
|
||||
border-radius: 5px 5px 5px 5px;
|
||||
margin: 5px 20px 40px 20px;
|
||||
-webkit-transition: all 0.3s ease-in-out;
|
||||
-moz-transition: all 0.3s ease-in-out;
|
||||
-ms-transition: all 0.3s ease-in-out;
|
||||
-o-transition: all 0.3s ease-in-out;
|
||||
transition: all 0.3s ease-in-out;
|
||||
}
|
||||
|
||||
input[type=button]:hover, input[type=submit]:hover, input[type=reset]:hover {
|
||||
background-color: #39ace7;
|
||||
}
|
||||
|
||||
input[type=button]:active, input[type=submit]:active, input[type=reset]:active {
|
||||
-moz-transform: scale(0.95);
|
||||
-webkit-transform: scale(0.95);
|
||||
-o-transform: scale(0.95);
|
||||
-ms-transform: scale(0.95);
|
||||
transform: scale(0.95);
|
||||
}
|
||||
|
||||
input[type=text], input[type=password] {
|
||||
background-color: #f6f6f6;
|
||||
border: none;
|
||||
color: #0d0d0d;
|
||||
padding: 15px 32px;
|
||||
text-align: center;
|
||||
text-decoration: none;
|
||||
display: inline-block;
|
||||
font-size: 16px;
|
||||
margin: 5px;
|
||||
width: 85%;
|
||||
border: 2px solid #f6f6f6;
|
||||
-webkit-transition: all 0.5s ease-in-out;
|
||||
-moz-transition: all 0.5s ease-in-out;
|
||||
-ms-transition: all 0.5s ease-in-out;
|
||||
-o-transition: all 0.5s ease-in-out;
|
||||
transition: all 0.5s ease-in-out;
|
||||
-webkit-border-radius: 5px 5px 5px 5px;
|
||||
border-radius: 5px 5px 5px 5px;
|
||||
}
|
||||
|
||||
input[type=text]:focus {
|
||||
background-color: #fff;
|
||||
border-bottom: 2px solid #5fbae9;
|
||||
}
|
||||
|
||||
input[type=text]:placeholder {
|
||||
color: #cccccc;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* ANIMATIONS */
|
||||
|
||||
/* Simple CSS3 Fade-in-down Animation */
|
||||
.fadeInDown {
|
||||
-webkit-animation-name: fadeInDown;
|
||||
animation-name: fadeInDown;
|
||||
-webkit-animation-duration: 1s;
|
||||
animation-duration: 1s;
|
||||
-webkit-animation-fill-mode: both;
|
||||
animation-fill-mode: both;
|
||||
}
|
||||
|
||||
@-webkit-keyframes fadeInDown {
|
||||
0% {
|
||||
opacity: 0;
|
||||
-webkit-transform: translate3d(0, -100%, 0);
|
||||
transform: translate3d(0, -100%, 0);
|
||||
}
|
||||
100% {
|
||||
opacity: 1;
|
||||
-webkit-transform: none;
|
||||
transform: none;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes fadeInDown {
|
||||
0% {
|
||||
opacity: 0;
|
||||
-webkit-transform: translate3d(0, -100%, 0);
|
||||
transform: translate3d(0, -100%, 0);
|
||||
}
|
||||
100% {
|
||||
opacity: 1;
|
||||
-webkit-transform: none;
|
||||
transform: none;
|
||||
}
|
||||
}
|
||||
|
||||
/* Simple CSS3 Fade-in Animation */
|
||||
@-webkit-keyframes fadeIn { from { opacity:0; } to { opacity:1; } }
|
||||
@-moz-keyframes fadeIn { from { opacity:0; } to { opacity:1; } }
|
||||
@keyframes fadeIn { from { opacity:0; } to { opacity:1; } }
|
||||
|
||||
.fadeIn {
|
||||
opacity:0;
|
||||
-webkit-animation:fadeIn ease-in 1;
|
||||
-moz-animation:fadeIn ease-in 1;
|
||||
animation:fadeIn ease-in 1;
|
||||
|
||||
-webkit-animation-fill-mode:forwards;
|
||||
-moz-animation-fill-mode:forwards;
|
||||
animation-fill-mode:forwards;
|
||||
|
||||
-webkit-animation-duration:1s;
|
||||
-moz-animation-duration:1s;
|
||||
animation-duration:1s;
|
||||
}
|
||||
|
||||
.fadeIn.first {
|
||||
-webkit-animation-delay: 0.4s;
|
||||
-moz-animation-delay: 0.4s;
|
||||
animation-delay: 0.4s;
|
||||
}
|
||||
|
||||
.fadeIn.second {
|
||||
-webkit-animation-delay: 0.6s;
|
||||
-moz-animation-delay: 0.6s;
|
||||
animation-delay: 0.6s;
|
||||
}
|
||||
|
||||
.fadeIn.third {
|
||||
-webkit-animation-delay: 0.8s;
|
||||
-moz-animation-delay: 0.8s;
|
||||
animation-delay: 0.8s;
|
||||
}
|
||||
|
||||
.fadeIn.fourth {
|
||||
-webkit-animation-delay: 1s;
|
||||
-moz-animation-delay: 1s;
|
||||
animation-delay: 1s;
|
||||
}
|
||||
|
||||
/* Simple CSS3 Fade-in Animation */
|
||||
.underlineHover:after {
|
||||
display: block;
|
||||
left: 0;
|
||||
bottom: -10px;
|
||||
width: 0;
|
||||
height: 2px;
|
||||
background-color: #56baed;
|
||||
content: "";
|
||||
transition: width 0.2s;
|
||||
}
|
||||
|
||||
.underlineHover:hover {
|
||||
color: #0d0d0d;
|
||||
}
|
||||
|
||||
.underlineHover:hover:after{
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* OTHERS */
|
||||
|
||||
*:focus {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
#icon {
|
||||
width:60%;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<cheapy:layout pageName="login">
|
||||
|
||||
<div class="wrapper fadeInDown">
|
||||
<div id="formContent">
|
||||
<!-- Tabs Titles -->
|
||||
|
||||
<!-- Icon -->
|
||||
<div class="fadeIn first">
|
||||
<img src="/resources/images/Logo Cheapy.png" id="icon" />
|
||||
</div>
|
||||
<div th:if="${param.error}">
|
||||
<p class="text-danger"> Invalid username or password</p>
|
||||
</div>
|
||||
<!-- Login Form -->
|
||||
<form class='form-signin' action="/login" method='POST'>
|
||||
<input type="text" id="username" class="fadeIn second" name="username" placeholder="username" required autofocus>
|
||||
<input type="password" id="password" class="fadeIn third" name="password" placeholder="password" required>
|
||||
<sec:csrfInput />
|
||||
<input type="submit" class="fadeIn fourth" value="Login">
|
||||
</form>
|
||||
|
||||
<!-- Remind Passowrd -->
|
||||
<div id="formFooter">
|
||||
<a class="underlineHover" href="#">Forgot Password?</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</cheapy:layout>
|
56
src/main/webapp/WEB-INF/jsp/nuOffers/nuOffersShow.jsp
Normal file
56
src/main/webapp/WEB-INF/jsp/nuOffers/nuOffersShow.jsp
Normal file
|
@ -0,0 +1,56 @@
|
|||
<%@ page session="false" trimDirectiveWhitespaces="true" %>
|
||||
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
|
||||
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
|
||||
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
||||
<%@ taglib prefix="cheapy" tagdir="/WEB-INF/tags" %>
|
||||
|
||||
<cheapy:layout pageName="nuOffer">
|
||||
|
||||
<h2>Oferta por número de comensales</h2>
|
||||
|
||||
|
||||
<table class="table table-striped">
|
||||
<tr>
|
||||
<th>Inicio de la oferta</th>
|
||||
<td><b><c:out value="${nuOffer.start}"/></b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Fin de la oferta</th>
|
||||
<td><c:out value="${nuOffer.end}"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Meta oro</th>
|
||||
<td><c:out value="${nuOffer.gold}"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Descuento oro</th>
|
||||
<td><c:out value="${nuOffer.discountGold}"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Meta plata</th>
|
||||
<td><c:out value="${nuOffer.silver}"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Descuento plata</th>
|
||||
<td><c:out value="${nuOffer.discountSilver}"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Meta bronce</th>
|
||||
<td><c:out value="${nuOffer.bronze}"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Descuento bronce</th>
|
||||
<td><c:out value="${nuOffer.discountBronze}"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Codigo de la oferta</th>
|
||||
<td><c:out value="${nuOffer.code}"/></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<%-- <spring:url value="{ownerId}/edit" var="editUrl">
|
||||
<spring:param name="ownerId" value="${owner.id}"/>
|
||||
</spring:url>
|
||||
<a href="${fn:escapeXml(editUrl)}" class="btn btn-default">Edit Owner</a> --%>
|
||||
|
||||
</cheapy:layout>
|
141
src/main/webapp/WEB-INF/jsp/offers/offersList.jsp
Normal file
141
src/main/webapp/WEB-INF/jsp/offers/offersList.jsp
Normal file
|
@ -0,0 +1,141 @@
|
|||
<%@ 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" %>
|
||||
|
||||
<cheapy:layout pageName="owners">
|
||||
<h2>Ofertas por plato específico</h2>
|
||||
|
||||
<table id="foodOfferTable" class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<!-- <th style="width: 150px;">Restaurante</th> -->
|
||||
<th style="width: 150px;">Plato</th>
|
||||
<th style="width: 150px;">Fecha inicio</th>
|
||||
<th style="width: 200px;">Fecha fin</th>
|
||||
<th> </th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<c:forEach items="${foodOfferLs}" var="foodOffer">
|
||||
<tr>
|
||||
<td>
|
||||
<c:out value="${foodOffer.food}"/>
|
||||
</td>
|
||||
<td>
|
||||
<c:out value="${foodOffer.start}"/>
|
||||
</td>
|
||||
<td>
|
||||
<c:out value="${foodOffer.end}"/>
|
||||
</td>
|
||||
<td>
|
||||
<spring:url value="/offers/food/{foodOfferId}" var="foodOfferUrl">
|
||||
<spring:param name="foodOfferId" value="${foodOffer.id}"/>
|
||||
</spring:url>
|
||||
<a href="${fn:escapeXml(foodOfferUrl)}"/>Enlace</a>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
</c:forEach>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<h2>Ofertas por número de comensales</h2>
|
||||
|
||||
<table id="nuOfferTable" class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<!-- <th style="width: 150px;">Restaurante</th> -->
|
||||
<th style="width: 150px;">Fecha inicio</th>
|
||||
<th style="width: 200px;">Fecha fin</th>
|
||||
<th> </th>
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<c:forEach items="${nuOfferLs}" var="nuOffer">
|
||||
<tr>
|
||||
|
||||
<td>
|
||||
<c:out value="${nuOffer.start}"/>
|
||||
</td>
|
||||
<td>
|
||||
<c:out value="${nuOffer.end}"/>
|
||||
</td>
|
||||
<td>
|
||||
<spring:url value="/offers/nu/{nuOfferId}" var="nuOfferUrl">
|
||||
<spring:param name="nuOfferId" value="${nuOffer.id}"/>
|
||||
</spring:url>
|
||||
<a href="${fn:escapeXml(nuOfferUrl)}"/>Enlace</a>
|
||||
</td>
|
||||
</tr>
|
||||
</c:forEach>
|
||||
</tbody>
|
||||
</table>
|
||||
<h2>Ofertas rapidez comiendo</h2>
|
||||
|
||||
<table id="speedOfferTable" class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<!-- <th style="width: 150px;">Restaurante</th> -->
|
||||
<th style="width: 150px;">Fecha inicio</th>
|
||||
<th style="width: 200px;">Fecha fin</th>
|
||||
<th> </th>
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<c:forEach items="${speedOfferLs}" var="speedOffer">
|
||||
<tr>
|
||||
|
||||
<td>
|
||||
<c:out value="${speedOffer.start}"/>
|
||||
</td>
|
||||
<td>
|
||||
<c:out value="${speedOffer.end}"/>
|
||||
</td>
|
||||
<td>
|
||||
<spring:url value="/offers/speed/{speedOfferId}" var="speedOfferUrl">
|
||||
<spring:param name="speedOfferId" value="${speedOffer.id}"/>
|
||||
</spring:url>
|
||||
<a href="${fn:escapeXml(speedOfferUrl)}"/>Enlace</a>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
</c:forEach>
|
||||
</tbody>
|
||||
</table>
|
||||
<h2>Ofertas por franja horaria</h2>
|
||||
|
||||
<table id="timeOfferTable" class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<!-- <th style="width: 150px;">Restaurante</th> -->
|
||||
<th style="width: 150px;">Fecha inicio</th>
|
||||
<th style="width: 200px;">Fecha fin</th>
|
||||
<th> </th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<c:forEach items="${timeOfferLs}" var="timeOffer">
|
||||
<tr>
|
||||
|
||||
<td>
|
||||
<c:out value="${timeOffer.start}"/>
|
||||
</td>
|
||||
<td>
|
||||
<c:out value="${timeOffer.end}"/>
|
||||
</td>
|
||||
<td>
|
||||
<spring:url value="/offers/time/{timeOfferId}" var="timeOfferUrl">
|
||||
<spring:param name="timeOfferId" value="${timeOffer.id}"/>
|
||||
</spring:url>
|
||||
<a href="${fn:escapeXml(timeOfferUrl)}"/>Enlace</a>
|
||||
</td>
|
||||
</tr>
|
||||
</c:forEach>
|
||||
</tbody>
|
||||
</table>
|
||||
</cheapy:layout>
|
|
@ -2,21 +2,20 @@
|
|||
<%@ 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="petclinic" tagdir="/WEB-INF/tags" %>
|
||||
|
||||
<petclinic:layout pageName="owners">
|
||||
<%@ taglib prefix="cheapy" tagdir="/WEB-INF/tags" %>
|
||||
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
|
||||
<cheapy:layout pageName="owners">
|
||||
<h2>
|
||||
<c:if test="${owner['new']}">New </c:if> Owner
|
||||
</h2>
|
||||
<form:form modelAttribute="owner" class="form-horizontal" id="add-owner-form">
|
||||
<div class="form-group has-feedback">
|
||||
<petclinic:inputField label="First Name" name="firstName"/>
|
||||
<petclinic:inputField label="Last Name" name="lastName"/>
|
||||
<petclinic:inputField label="Address" name="address"/>
|
||||
<petclinic:inputField label="City" name="city"/>
|
||||
<petclinic:inputField label="Telephone" name="telephone"/>
|
||||
<cheapy:inputField label="First Name" name="firstName"/>
|
||||
<cheapy:inputField label="Last Name" name="lastName"/>
|
||||
<cheapy:inputField label="Address" name="address"/>
|
||||
<cheapy:inputField label="City" name="city"/>
|
||||
<cheapy:inputField label="Telephone" name="telephone"/>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-offset-2 col-sm-10">
|
||||
|
@ -31,4 +30,4 @@
|
|||
</div>
|
||||
</div>
|
||||
</form:form>
|
||||
</petclinic:layout>
|
||||
</cheapy:layout>
|
||||
|
|
|
@ -2,13 +2,12 @@
|
|||
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
|
||||
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
|
||||
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
|
||||
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
|
||||
<%@ taglib prefix="petclinic" tagdir="/WEB-INF/tags" %>
|
||||
<%@ taglib prefix="cheapy" tagdir="/WEB-INF/tags" %>
|
||||
<%@ taglib prefix="sec"
|
||||
uri="http://www.springframework.org/security/tags"%>
|
||||
<!-- >%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags"%-->
|
||||
|
||||
<petclinic:layout pageName="owners">
|
||||
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
|
||||
<cheapy:layout pageName="owners">
|
||||
|
||||
<h2>Find Owners</h2>
|
||||
|
||||
|
@ -37,4 +36,4 @@
|
|||
<a class="btn btn-default" href='<spring:url value="/owners/new" htmlEscape="true"/>'>Add Owner</a>
|
||||
</sec:authorize>
|
||||
|
||||
</petclinic:layout>
|
||||
</cheapy:layout>
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
<%@ page session="false" trimDirectiveWhitespaces="true" %>
|
||||
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
|
||||
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
|
||||
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
||||
<%@ taglib prefix="petclinic" tagdir="/WEB-INF/tags" %>
|
||||
|
||||
<petclinic:layout pageName="owners">
|
||||
<%@ taglib prefix="cheapy" tagdir="/WEB-INF/tags" %>
|
||||
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
|
||||
<cheapy:layout pageName="owners">
|
||||
|
||||
<h2>Owner Information</h2>
|
||||
|
||||
|
@ -33,4 +32,4 @@
|
|||
</spring:url>
|
||||
<a href="${fn:escapeXml(editUrl)}" class="btn btn-default">Edit Owner</a>
|
||||
|
||||
</petclinic:layout>
|
||||
</cheapy:layout>
|
||||
|
|
|
@ -2,10 +2,9 @@
|
|||
<%@ 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="cheapy" tagdir="/WEB-INF/tags" %>
|
||||
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
|
||||
<%@ taglib prefix="petclinic" tagdir="/WEB-INF/tags" %>
|
||||
|
||||
<petclinic:layout pageName="owners">
|
||||
<cheapy:layout pageName="owners">
|
||||
<h2>Owners</h2>
|
||||
|
||||
<table id="ownersTable" class="table table-striped">
|
||||
|
@ -41,4 +40,4 @@
|
|||
</c:forEach>
|
||||
</tbody>
|
||||
</table>
|
||||
</petclinic:layout>
|
||||
</cheapy:layout>
|
||||
|
|
56
src/main/webapp/WEB-INF/jsp/speedOffers/speedOffersShow.jsp
Normal file
56
src/main/webapp/WEB-INF/jsp/speedOffers/speedOffersShow.jsp
Normal file
|
@ -0,0 +1,56 @@
|
|||
<%@ page session="false" trimDirectiveWhitespaces="true" %>
|
||||
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
|
||||
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
|
||||
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
||||
<%@ taglib prefix="cheapy" tagdir="/WEB-INF/tags" %>
|
||||
|
||||
<cheapy:layout pageName="speedOffer">
|
||||
|
||||
<h2>Oferta por comer veloz</h2>
|
||||
|
||||
|
||||
<table class="table table-striped">
|
||||
<tr>
|
||||
<th>Inicio de la oferta</th>
|
||||
<td><b><c:out value="${speedOffer.start}"/></b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Fin de la oferta</th>
|
||||
<td><c:out value="${speedOffer.end}"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Meta oro</th>
|
||||
<td><c:out value="${speedOffer.gold}"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Descuento oro</th>
|
||||
<td><c:out value="${speedOffer.discountGold}"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Meta plata</th>
|
||||
<td><c:out value="${speedOffer.silver}"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Descuento plata</th>
|
||||
<td><c:out value="${speedOffer.discountSilver}"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Meta bronce</th>
|
||||
<td><c:out value="${speedOffer.bronze}"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Descuento bronce</th>
|
||||
<td><c:out value="${speedOffer.discountBronze}"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Codigo de la oferta</th>
|
||||
<td><c:out value="${speedOffer.code}"/></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<%-- <spring:url value="{ownerId}/edit" var="editUrl">
|
||||
<spring:param name="ownerId" value="${owner.id}"/>
|
||||
</spring:url>
|
||||
<a href="${fn:escapeXml(editUrl)}" class="btn btn-default">Edit Owner</a> --%>
|
||||
|
||||
</cheapy:layout>
|
31
src/main/webapp/WEB-INF/jsp/timeOffers/timeOffersShow.jsp
Normal file
31
src/main/webapp/WEB-INF/jsp/timeOffers/timeOffersShow.jsp
Normal file
|
@ -0,0 +1,31 @@
|
|||
<%@ page session="false" trimDirectiveWhitespaces="true" %>
|
||||
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
|
||||
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
|
||||
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
||||
<%@ taglib prefix="cheapy" tagdir="/WEB-INF/tags" %>
|
||||
|
||||
<cheapy:layout pageName="timeOffer">
|
||||
|
||||
<h2>Oferta por franja horária</h2>
|
||||
|
||||
|
||||
<table class="table table-striped">
|
||||
<tr>
|
||||
<th>Inicio de la oferta</th>
|
||||
<td><b><c:out value="${timeOffer.start}"/></b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Fin de la oferta</th>
|
||||
<td><c:out value="${timeOffer.end}"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Descuento</th>
|
||||
<td><c:out value="${timeOffer.discount}"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Codigo de la oferta</th>
|
||||
<td><c:out value="${timeOffer.code}"/></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</cheapy:layout>
|
|
@ -2,23 +2,22 @@
|
|||
<%@ 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="petclinic" tagdir="/WEB-INF/tags" %>
|
||||
|
||||
<petclinic:layout pageName="owners">
|
||||
<%@ taglib prefix="cheapy" tagdir="/WEB-INF/tags" %>
|
||||
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
|
||||
<cheapy:layout pageName="owners">
|
||||
<h2>
|
||||
<c:if test="${owner['new']}">New </c:if> Owner
|
||||
</h2>
|
||||
<form:form modelAttribute="owner" class="form-horizontal" id="add-owner-form">
|
||||
<div class="form-group has-feedback">
|
||||
<petclinic:inputField label="First Name" name="firstName"/>
|
||||
<petclinic:inputField label="Last Name" name="lastName"/>
|
||||
<petclinic:inputField label="Address" name="address"/>
|
||||
<petclinic:inputField label="City" name="city"/>
|
||||
<petclinic:inputField label="Telephone" name="telephone"/>
|
||||
<petclinic:inputField label="Username" name="user.username"/>
|
||||
<petclinic:inputField label="Password" name="user.password"/>
|
||||
<cheapy:inputField label="First Name" name="firstName"/>
|
||||
<cheapy:inputField label="Last Name" name="lastName"/>
|
||||
<cheapy:inputField label="Address" name="address"/>
|
||||
<cheapy:inputField label="City" name="city"/>
|
||||
<cheapy:inputField label="Telephone" name="telephone"/>
|
||||
<cheapy:inputField label="Username" name="user.username"/>
|
||||
<cheapy:inputField label="Password" name="user.password"/>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-offset-2 col-sm-10">
|
||||
|
@ -33,4 +32,4 @@
|
|||
</div>
|
||||
</div>
|
||||
</form:form>
|
||||
</petclinic:layout>
|
||||
</cheapy:layout>
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
<%@ 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="petclinic" tagdir="/WEB-INF/tags" %>
|
||||
<%@ taglib prefix="cheapy" tagdir="/WEB-INF/tags" %>
|
||||
<link href='https://fonts.googleapis.com/css?family=Lobster' rel='stylesheet'>
|
||||
<!-- %@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %-->
|
||||
|
||||
<petclinic:layout pageName="home">
|
||||
<cheapy:layout pageName="home">
|
||||
<h2 class="text-center" style="font-family: 'Lobster'; font-size: 50px; color: rgb(0, 64, 128); padding:20px"><fmt:message key="welcome"/></h2>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
|
@ -19,4 +19,4 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</petclinic:layout>
|
||||
</cheapy:layout>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
|
||||
<%@ taglib prefix="petclinic" tagdir="/WEB-INF/tags" %>
|
||||
<%@ taglib prefix="cheapy" tagdir="/WEB-INF/tags" %>
|
||||
|
||||
<%@ attribute name="menuName" required="true" rtexprvalue="true"
|
||||
description="Name of the active menu: home, owners, vets or error" %>
|
||||
description="Name of the active menu: home, ofertas, contactanos, login" %>
|
||||
|
||||
<petclinic:menu name="${menuName}"/>
|
||||
<cheapy:menu name="${menuName}"/>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
|
||||
|
||||
<%--
|
||||
PetClinic :: a Spring Framework demonstration
|
||||
Cheapy :: a Spring Framework demonstration
|
||||
--%>
|
||||
|
||||
<head>
|
||||
|
@ -17,8 +17,8 @@ PetClinic :: a Spring Framework demonstration
|
|||
<title>Cheapy : eat fast, eat cheapy</title>
|
||||
|
||||
<%-- CSS generated from LESS --%>
|
||||
<spring:url value="/resources/css/petclinic.css" var="petclinicCss"/>
|
||||
<link href="${petclinicCss}" rel="stylesheet"/>
|
||||
<spring:url value="/resources/css/cheapy.css" var="cheapyCss"/>
|
||||
<link href="${cheapyCss}" rel="stylesheet"/>
|
||||
|
||||
|
||||
<%-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries --%>
|
||||
|
|
|
@ -1,25 +1,25 @@
|
|||
<%@ tag trimDirectiveWhitespaces="true" %>
|
||||
<%@ taglib prefix="petclinic" tagdir="/WEB-INF/tags" %>
|
||||
<%@ taglib prefix="cheapy" tagdir="/WEB-INF/tags" %>
|
||||
|
||||
<%@ attribute name="pageName" required="true" %>
|
||||
<%@ attribute name="customScript" required="false" fragment="true"%>
|
||||
|
||||
<!doctype html>
|
||||
<html>
|
||||
<petclinic:htmlHeader/>
|
||||
<cheapy:htmlHeader/>
|
||||
|
||||
<body>
|
||||
<petclinic:bodyHeader menuName="${pageName}"/>
|
||||
<cheapy:bodyHeader menuName="${pageName}"/>
|
||||
|
||||
<div class="container-fluid">
|
||||
<div class="container xd-container">
|
||||
|
||||
<jsp:doBody/>
|
||||
|
||||
<petclinic:pivotal/>
|
||||
<cheapy:pivotal/>
|
||||
</div>
|
||||
</div>
|
||||
<petclinic:footer/>
|
||||
<cheapy:footer/>
|
||||
<jsp:invoke fragment="customScript" />
|
||||
|
||||
</body>
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
|
||||
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
|
||||
<%@ taglib prefix="petclinic" tagdir="/WEB-INF/tags"%>
|
||||
<%@ taglib prefix="cheapy" tagdir="/WEB-INF/tags"%>
|
||||
<%@ taglib prefix="sec"
|
||||
uri="http://www.springframework.org/security/tags"%>
|
||||
<!-- >%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags"%-->
|
||||
<%@ attribute name="name" required="true" rtexprvalue="true"
|
||||
description="Name of the active menu: home, owners, vets or error"%>
|
||||
description="Name of the active menu: home, ofertas, contactanos, login"%>
|
||||
|
||||
<nav class="navbar navbar-default" role="navigation">
|
||||
<div class="container">
|
||||
|
@ -22,30 +22,25 @@
|
|||
<div class="navbar-collapse collapse" id="main-navbar">
|
||||
<ul class="nav navbar-nav">
|
||||
|
||||
<petclinic:menuItem active="${name eq 'home'}" url="/"
|
||||
<cheapy:menuItem active="${name eq 'home'}" url="/"
|
||||
title="home page">
|
||||
<span class="glyphicon glyphicon-home" aria-hidden="true"></span>
|
||||
<span>Home</span>
|
||||
</petclinic:menuItem>
|
||||
</cheapy:menuItem>
|
||||
|
||||
<petclinic:menuItem active="${name eq 'ofertas'}" url="/ofertas"
|
||||
<cheapy:menuItem active="${name eq 'ofertas'}" url="/offers"
|
||||
title="ofertas">
|
||||
<span class="glyphicon glyphicon-cutlery" aria-hidden="true"></span>
|
||||
<span>Ver ofertas</span>
|
||||
</petclinic:menuItem>
|
||||
</cheapy:menuItem>
|
||||
|
||||
<petclinic:menuItem active="${name eq 'contactanos'}" url="/contactanos"
|
||||
<cheapy:menuItem active="${name eq 'contactanos'}" url="/contactanos"
|
||||
title="contactanos">
|
||||
<span class="glyphicon glyphicon-earphone" aria-hidden="true"></span>
|
||||
<span>Contáctanos</span>
|
||||
</petclinic:menuItem>
|
||||
</cheapy:menuItem>
|
||||
|
||||
|
||||
<petclinic:menuItem active="${name eq 'login'}" url="/login"
|
||||
title="login">
|
||||
<span class="glyphicon glyphicon-th-list" aria-hidden="true"></span>
|
||||
<span>Login</span>
|
||||
</petclinic:menuItem>
|
||||
|
||||
</ul>
|
||||
|
||||
|
@ -74,10 +69,10 @@
|
|||
<p class="text-left">
|
||||
<strong><sec:authentication property="name" /></strong>
|
||||
</p>
|
||||
<p class="text-left">
|
||||
<a href="<c:url value="/logout" />"
|
||||
class="btn btn-primary btn-block btn-sm">Logout</a>
|
||||
</p>
|
||||
<form action="/logout" method=post>
|
||||
<input type="hidden" name="${_csrf.parameterName}" value="${_csrf.token}"/>
|
||||
<input type="submit" value="logout">
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
|
||||
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
|
||||
|
||||
<%@ attribute name="active" required="true" rtexprvalue="true" %>
|
||||
<%@ attribute name="url" required="true" rtexprvalue="true" %>
|
||||
<%@ attribute name="title" required="false" rtexprvalue="true" %>
|
||||
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
|
||||
|
||||
<li class="${active ? 'active' : ''}">
|
||||
<a href="<spring:url value="${url}" htmlEscape="true" />"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<groups xmlns="http://www.isdc.ro/wro">
|
||||
<group name="petclinic">
|
||||
<group name="cheapy">
|
||||
<css>classpath:META-INF/resources/webjars/bootstrap/3.3.6/less/bootstrap.less</css>
|
||||
<css>/petclinic.less</css>
|
||||
<css>/cheapy.less</css>
|
||||
</group>
|
||||
</groups>
|
||||
|
|
|
@ -22,7 +22,7 @@ import org.springframework.boot.test.context.SpringBootTest;
|
|||
|
||||
|
||||
@SpringBootTest
|
||||
class PetclinicIntegrationTests {
|
||||
class CheapyIntegrationTests {
|
||||
|
||||
|
||||
}
|
|
@ -7,13 +7,13 @@
|
|||
<boolProp name="TestPlan.serialize_threadgroups">false</boolProp>
|
||||
<elementProp name="TestPlan.user_defined_variables" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="Variables pr<70>-d<>finies" enabled="true">
|
||||
<collectionProp name="Arguments.arguments">
|
||||
<elementProp name="PETCLINIC_HOST" elementType="Argument">
|
||||
<stringProp name="Argument.name">PETCLINIC_HOST</stringProp>
|
||||
<elementProp name="CHEAPY_HOST" elementType="Argument">
|
||||
<stringProp name="Argument.name">CHEAPY_HOST</stringProp>
|
||||
<stringProp name="Argument.value">localhost</stringProp>
|
||||
<stringProp name="Argument.metadata">=</stringProp>
|
||||
</elementProp>
|
||||
<elementProp name="PETCLINIC_PORT" elementType="Argument">
|
||||
<stringProp name="Argument.name">PETCLINIC_PORT</stringProp>
|
||||
<elementProp name="CHEAPY_PORT" elementType="Argument">
|
||||
<stringProp name="Argument.name">CHEAPY_PORT</stringProp>
|
||||
<stringProp name="Argument.value">8080</stringProp>
|
||||
<stringProp name="Argument.metadata">=</stringProp>
|
||||
</elementProp>
|
||||
|
@ -52,8 +52,8 @@
|
|||
<elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="Variables pr<70>-d<>finies" enabled="true">
|
||||
<collectionProp name="Arguments.arguments"/>
|
||||
</elementProp>
|
||||
<stringProp name="HTTPSampler.domain">${PETCLINIC_HOST}</stringProp>
|
||||
<stringProp name="HTTPSampler.port">${PETCLINIC_PORT}</stringProp>
|
||||
<stringProp name="HTTPSampler.domain">${CHEAPY_HOST}</stringProp>
|
||||
<stringProp name="HTTPSampler.port">${CHEAPY_PORT}</stringProp>
|
||||
<stringProp name="HTTPSampler.connect_timeout"></stringProp>
|
||||
<stringProp name="HTTPSampler.response_timeout"></stringProp>
|
||||
<stringProp name="HTTPSampler.protocol"></stringProp>
|
||||
|
@ -115,7 +115,7 @@
|
|||
<stringProp name="HTTPSampler.response_timeout"></stringProp>
|
||||
<stringProp name="HTTPSampler.protocol"></stringProp>
|
||||
<stringProp name="HTTPSampler.contentEncoding"></stringProp>
|
||||
<stringProp name="HTTPSampler.path">${CONTEXT_WEB}/resources/css/petclinic.css</stringProp>
|
||||
<stringProp name="HTTPSampler.path">${CONTEXT_WEB}/resources/css/cheapy.css</stringProp>
|
||||
<stringProp name="HTTPSampler.method">GET</stringProp>
|
||||
<boolProp name="HTTPSampler.follow_redirects">true</boolProp>
|
||||
<boolProp name="HTTPSampler.auto_redirects">false</boolProp>
|
Loading…
Reference in a new issue