Merge pull request #28 from cheapy-ispp/publicarFixed

Publicar ofertas arreglado
This commit is contained in:
MartínAGR 2021-03-25 23:56:56 +01:00 committed by GitHub
commit bd58ac2abb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
31 changed files with 84 additions and 292 deletions

View file

@ -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 java.io.Serializable;
@ -22,16 +7,14 @@ import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;
/**
* Simple JavaBean domain object with an id property. Used as a base class for objects
* needing this property.
*
* @author Ken Krebs
* @author Juergen Hoeller
*/
@MappedSuperclass
public class BaseEntity implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;

View file

@ -1,6 +1,5 @@
package org.springframework.cheapy.model;
import java.time.LocalTime;
import java.util.Set;
import javax.persistence.CascadeType;
@ -13,8 +12,6 @@ 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 BaseEntity{

View file

@ -23,7 +23,13 @@ import javax.validation.constraints.NotNull;
@Entity
@Table(name = "food_offers")
public class FoodOffer extends Offer {
//Plato específico
/**
*
*/
private static final long serialVersionUID = 1L;
//Plato específico
@NotBlank
private String food;

View file

@ -1,33 +1,16 @@
/*
* 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;
import javax.persistence.MappedSuperclass;
/**
* Simple JavaBean domain object adds a name property to <code>BaseEntity</code>. Used as
* a base class for objects needing these properties.
*
* @author Ken Krebs
* @author Juergen Hoeller
*/
@MappedSuperclass
public class NamedEntity extends BaseEntity {
/**
*
*/
private static final long serialVersionUID = 1L;
@Column(name = "name")
private String name;

View file

@ -10,6 +10,11 @@ import javax.validation.constraints.NotNull;
@Table(name = "nu_offers")
public class NuOffer extends Offer {
/**
*
*/
private static final long serialVersionUID = 1L;
@NotNull
private Integer gold;

View file

@ -29,7 +29,13 @@ import org.springframework.format.annotation.DateTimeFormat;
@MappedSuperclass
public class Offer extends BaseEntity {
//Clase padre
/**
*
*/
private static final long serialVersionUID = 1L;
//Clase padre
@DateTimeFormat(pattern = "dd/MM/yyyy HH:mm")
@NotNull
@Future

View file

@ -1,50 +1,22 @@
/*
* 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 java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.Digits;
import javax.validation.constraints.NotEmpty;
import org.springframework.beans.support.MutableSortDefinition;
import org.springframework.beans.support.PropertyComparator;
import org.springframework.core.style.ToStringCreator;
/**
* Simple JavaBean domain object representing an owner.
*
* @author Ken Krebs
* @author Juergen Hoeller
* @author Sam Brannen
* @author Michael Isvy
*/
@Entity
@Table(name = "owners")
public class Owner extends Person {
/**
*
*/
private static final long serialVersionUID = 1L;
@Column(name = "address")
@NotEmpty
private String address;

View file

@ -1,32 +1,17 @@
/*
* 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;
import javax.persistence.MappedSuperclass;
import javax.validation.constraints.NotEmpty;
/**
* Simple JavaBean domain object representing an person.
*
* @author Ken Krebs
*/
@MappedSuperclass
public class Person extends BaseEntity {
/**
*
*/
private static final long serialVersionUID = 1L;
@Column(name = "first_name")
@NotEmpty
private String firstName;

View file

@ -10,6 +10,10 @@ import javax.validation.constraints.NotNull;
@Table(name = "speed_offers")
public class SpeedOffer extends Offer {
/**
*
*/
private static final long serialVersionUID = 1L;
@NotNull
private Integer gold; // x minutos

View file

@ -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 java.time.LocalTime;
@ -27,7 +12,13 @@ import org.springframework.format.annotation.DateTimeFormat;
@Entity
@Table(name = "time_offers")
public class TimeOffer extends Offer {
//Oferta por franja horaria
/**
*
*/
private static final long serialVersionUID = 1L;
//Oferta por franja horaria
@DateTimeFormat(pattern = "HH:mm")
@NotNull
private LocalTime init;
@ -39,8 +30,6 @@ public class TimeOffer extends Offer {
@NotBlank
private String discount;
public LocalTime getInit() {
return init;
}

View file

@ -1,8 +1,9 @@
package org.springframework.cheapy.model;
import javax.persistence.JoinColumn;
import javax.persistence.MappedSuperclass;
import javax.persistence.OneToOne;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.validation.constraints.NotBlank;
@Entity
@Table(name = "users")

View file

@ -1,12 +1,8 @@
package org.springframework.cheapy.model;
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;

View file

@ -1,20 +1 @@
/*
* 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.
*/
/**
* The classes in this package represent utilities used by the domain.
*/
package org.springframework.cheapy.model;

View file

@ -2,8 +2,6 @@ package org.springframework.cheapy.repository;
import org.springframework.data.repository.CrudRepository;
import org.springframework.cheapy.model.Authorities;
import org.springframework.cheapy.model.User;
public interface AuthoritiesRepository extends CrudRepository<Authorities, Integer>{

View file

@ -1,13 +1,14 @@
package org.springframework.cheapy.repository;
import org.springframework.cheapy.model.Client;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.transaction.annotation.Transactional;
public interface ClientRepository extends CrudRepository<Client, String> {
@Query("SELECT client FROM Client client WHERE username =:username")
@Transactional(readOnly = true)
Client findByUsername(String username);
}

View file

@ -1,18 +1,15 @@
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")
@Query("SELECT foodOffer FROM FoodOffer foodOffer")
@Transactional(readOnly = true)
List<FoodOffer> findAllFoodOffer();

View file

@ -1,28 +1,19 @@
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> {
NuOffer findNuOfferById(int nuOfferId);
@Query("SELECT nuOffer FROM NuOffer nuOffer")
@Query("SELECT nuOffer FROM NuOffer nuOffer")
@Transactional(readOnly = true)
List<NuOffer> findAllNuOffer();
void save(NuOffer nuOffer);
}

View file

@ -1,8 +1,5 @@
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;
@ -10,19 +7,16 @@ 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")
@Query("SELECT speedOffer FROM SpeedOffer speedOffer")
@Transactional(readOnly = true)
List<SpeedOffer> findAllSpeedOffer();
void save(SpeedOffer speedOffer);
}

View file

@ -1,28 +1,19 @@
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> {
TimeOffer findTimeOfferById(int timeOfferId);
@Query("SELECT timeOffer FROM TimeOffer timeOffer")
@Query("SELECT timeOffer FROM TimeOffer timeOffer")
@Transactional(readOnly = true)
List<TimeOffer> findAllTimeOffer();
void save(TimeOffer timeOffer);
}

View file

@ -2,7 +2,6 @@
package org.springframework.cheapy.repository;
import org.springframework.data.repository.CrudRepository;
import org.springframework.cheapy.model.User;
import org.springframework.cheapy.model.Usuario;
public interface UsuarioRepository extends CrudRepository<Usuario, String> {

View file

@ -1,21 +1,5 @@
/*
* 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 org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cheapy.model.Client;
import org.springframework.cheapy.repository.ClientRepository;
@ -25,8 +9,6 @@ import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@Service
public class ClientService {
@ -37,13 +19,11 @@ public class ClientService {
this.clientRepository = clientRepository;
}
@Transactional
public Client getCurrentClient() throws DataAccessException {
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
String username = authentication.getName();
String username = authentication.getName();
return this.clientRepository.findByUsername(username);
}
}

View file

@ -3,16 +3,15 @@ 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;
@Service
public class FoodOfferService {
private FoodOfferRepository foodOfferRepository;
@Autowired
public FoodOfferService(final FoodOfferRepository foodOfferRepository) {
this.foodOfferRepository = foodOfferRepository;
@ -23,12 +22,9 @@ public class FoodOfferService {
}
public List<FoodOffer> findAllFoodOffer() { //
return this.foodOfferRepository.findAllFoodOffer();
}
public void saveFoodOffer(final FoodOffer foodOffer) throws DataAccessException {
this.foodOfferRepository.save(foodOffer);
}

View file

@ -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.TimeOffer;
import org.springframework.cheapy.repository.TimeOfferRepository;
@ -21,12 +23,12 @@ public class TimeOfferService {
return this.timeOfferRepository.findTimeOfferById(id);
}
public List<TimeOffer> findAllTimeOffer() { //
public List<TimeOffer> findAllTimeOffer() {
return this.timeOfferRepository.findAllTimeOffer();
}
public void saveTimeOffer(final TimeOffer TimeOffer) throws DataAccessException { //
public void saveTimeOffer(final TimeOffer TimeOffer) throws DataAccessException {
this.timeOfferRepository.save(TimeOffer);

View file

@ -49,7 +49,7 @@ public class FoodOfferController {
return VIEWS_FOOD_OFFER_CREATE_OR_UPDATE_FORM;
}
else {
Client client = this.clientService.getCurrentclient();
Client client = this.clientService.getCurrentClient();
foodOffer.setClient(client);
foodOffer.setType(StatusOffer.hidden);
this.foodOfferService.saveFoodOffer(foodOffer);
@ -60,7 +60,7 @@ public class FoodOfferController {
@GetMapping(value = "/foodOffers/{foodOfferId}/activate")
public String activateFoodOffer(@PathVariable("foodOfferId") final int foodOfferId, ModelMap modelMap) {
FoodOffer foodOffer = this.foodOfferService.findFoodOfferById(foodOfferId);
Client client = this.clientService.getCurrentclient();
Client client = this.clientService.getCurrentClient();
if(foodOffer.getClient().equals(client)) {
foodOffer.setType(StatusOffer.active);
foodOffer.setCode("FO-"+foodOfferId);

View file

@ -1,21 +1,5 @@
/*
* 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;
@ -28,38 +12,24 @@ 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) {

View file

@ -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.web;
import java.util.Collection;
@ -21,7 +6,6 @@ import java.util.Map;
import javax.validation.Valid;
import org.springframework.cheapy.model.Owner;
import org.springframework.cheapy.repository.OwnerRepository;
import org.springframework.cheapy.service.OwnerService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
@ -33,12 +17,6 @@ import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.servlet.ModelAndView;
/**
* @author Juergen Hoeller
* @author Ken Krebs
* @author Arjen Poutsma
* @author Michael Isvy
*/
@Controller
public class OwnerController {
@ -137,5 +115,4 @@ public class OwnerController {
return mav;
}
}

View file

@ -45,7 +45,6 @@ public class SpeedOfferController {
public SpeedOfferController(final SpeedOfferService speedOfferService, final ClientService clientService) {
this.speedOfferService = speedOfferService;
this.clientService = clientService;
}
@InitBinder
@ -66,7 +65,7 @@ public class SpeedOfferController {
return VIEWS_SPEED_OFFER_CREATE_OR_UPDATE_FORM;
}
else {
Client client = this.clientService.getCurrentclient();
Client client = this.clientService.getCurrentClient();
speedOffer.setClient(client);
speedOffer.setType(StatusOffer.hidden);
this.speedOfferService.saveSpeedOffer(speedOffer);
@ -77,7 +76,7 @@ public class SpeedOfferController {
@GetMapping(value = "/speedOffers/{speedOfferId}/activate")
public String activateSpeedOffer(@PathVariable("speedOfferId") final int speedOfferId, ModelMap modelMap) {
SpeedOffer speedOffer = this.speedOfferService.findSpeedOfferById(speedOfferId);
Client client = this.clientService.getCurrentclient();
Client client = this.clientService.getCurrentClient();
if(speedOffer.getClient().equals(client)) {
speedOffer.setType(StatusOffer.active);
speedOffer.setCode("SP-"+speedOfferId);
@ -92,11 +91,7 @@ public class SpeedOfferController {
public String processShowForm(@PathVariable("speedOfferId") int speedOfferId, Map<String, Object> model) {
SpeedOffer speedOffer=this.speedOfferService.findSpeedOfferById(speedOfferId);
model.put("speedOffer", speedOffer);
return "speedOffers/speedOffersShow";
}
}

View file

@ -9,15 +9,6 @@ INSERT INTO owners VALUES (8, 'Maria', 'Escobito', '345 Maple St.', 'Madison', '
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 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 );
@ -32,10 +23,15 @@ INSERT INTO users (dtype,username,password,enabled) VALUES ('user','pepe','pepe'
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 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');
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%' );

View file

@ -5,7 +5,7 @@
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="cheapy" tagdir="/WEB-INF/tags" %>
<cheapy:layout pageName="owners">
<cheapy:layout pageName="ofertas">
<h2>Ofertas por plato específico</h2>
<table id="foodOfferTable" class="table table-striped">

View file

@ -6,7 +6,7 @@
<!-- %@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %-->
<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>
<h2 class="text-center" style="font-family: 'Lobster'; font-size: 60px; color: rgb(0, 64, 128); padding:30px"><fmt:message key="welcome"/></h2>
<div class="row">
<div class="col-md-12">
<div class="img-home">
@ -14,8 +14,8 @@
<img class="img-responsive" src="${cheapyImage}"/>
</div>
<div class="btn-home">
<button type="button"><span class="glyphicon glyphicon-cutlery" aria-hidden="true" style="padding: 5px"></span> Ver Ofertas</button>
<a href="/offers"><button type="button" style="font-family: 'Lobster'; font-size: 20px;">
<span class="glyphicon glyphicon-cutlery" aria-hidden="true" style="margin-right:8px"></span>Ver Ofertas</button></a>
</div>
</div>
</div>

View file

@ -160,6 +160,3 @@ class OwnerControllerTests {
.andExpect(model().attribute("owner", hasProperty("telephone", is("6085551023"))))
.andExpect(view().name("owners/ownerDetails"));
}*/
}
*/