Merge branch 'develop' into 011-pruebas-unitarias-publicar-ofertas-abel

This commit is contained in:
abemorcardc 2021-04-03 19:06:41 +02:00 committed by GitHub
commit e6bbb7a26a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
38 changed files with 270 additions and 235 deletions

View file

@ -3,12 +3,20 @@ language: java
jdk: oraclejdk8
services:
- mysql
install:
- ./mvnw install -DskipTests=true -Dmaven.javadoc.skip=true -B -V
cache:
directories:
- "$HOME/.m2"
before_cache:
- rm -rf $HOME/.m2/repository/com/autentia/traviscodacy
before_install:
- chmod +x mvnw
- mysql -e 'CREATE DATABASE cheapy;'
- sudo apt-get update
script:
- mvn test -Dspring.profiles.active=mysql-travis
- sudo apt-get install jq
- wget -O ~/codacy-coverage-reporter-assembly-latest.jar $(curl https://api.github.com/repos/codacy/codacy-coverage-reporter/releases/latest | jq -r .assets[0].browser_download_url)
- chmod +x mvnw
- mysql -e 'CREATE DATABASE cheapy;'
- sudo apt-get update
after_success:
- ls
- ls target
- ls target/jacoco
- java -jar ~/codacy-coverage-reporter-assembly-latest.jar report -l Java -r target/jacoco/jacoco.xml

27
pom.xml
View file

@ -28,6 +28,11 @@
<wro4j.version>1.8.0</wro4j.version>
<jacoco.version>0.8.5</jacoco.version>
<jacoco.utreportpath>${project.build.directory}/jacoco</jacoco.utreportpath>
<jacoco.utreportfile>${project.build.directory}/jacoco.exec</jacoco.utreportfile>
<jacoco.itreportpath>${project.build.directory}/jacoco</jacoco.itreportpath>
<jacoco.itreportfile>${jacoco.itreportpath}/jacoco-it.exec</jacoco.itreportfile>
<nohttp-checkstyle.version>0.0.4.RELEASE</nohttp-checkstyle.version>
<spring-format.version>0.0.25</spring-format.version>
</properties>
@ -140,7 +145,11 @@
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<scope>runtime</scope>
</dependency>
</dependencies>
@ -178,6 +187,7 @@
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>report</id>
@ -185,6 +195,21 @@
<goals>
<goal>report</goal>
</goals>
<configuration>
<outputDirectory>${jacoco.utreportpath}</outputDirectory>
<dataFile>${jacoco.utreportfile}</dataFile>
</configuration>
</execution>
<execution>
<id>test</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
<configuration>
<outputDirectory>${jacoco.utreportpath}</outputDirectory>
<dataFile>${jacoco.utreportfile}</dataFile>
</configuration>
</execution>
</executions>
</plugin>

View file

@ -6,10 +6,11 @@ import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import org.hibernate.validator.constraints.Range;
import com.sun.istack.NotNull;
@Entity
@Table(name = "review")
@ -21,8 +22,8 @@ public class Review extends BaseEntity{
@Column(length=16777215)
private String opinion;
@NotNull
@Range(min = 1, max = 5)
@NotNull(message= "Por favor rellene este campo")
@Range(min = 1, max = 5,message="Las estrellas deben ir entre 1 y 5")
private Integer stars;
@ManyToOne

View file

@ -28,4 +28,8 @@ public interface FoodOfferRepository extends Repository<FoodOffer, Integer> {
@Query("SELECT foodOffer FROM FoodOffer foodOffer WHERE foodOffer.client.id =:id")
@Transactional(readOnly = true)
List<FoodOffer> findByUserId(@Param("id") Integer id);
@Query("SELECT foodOffer FROM FoodOffer foodOffer WHERE foodOffer.client.id =:id AND foodOffer.status!= 'inactive'")
@Transactional(readOnly = true)
List<FoodOffer> findFoodOfferActOclByUserId(@Param("id") Integer id);
}

View file

@ -27,4 +27,8 @@ public interface NuOfferRepository extends Repository<NuOffer, Integer> {
@Query("SELECT nuOffer FROM NuOffer nuOffer WHERE nuOffer.client.id =:id")
@Transactional(readOnly = true)
List<NuOffer> findByUserId(@Param("id") Integer id);
@Query("SELECT nuOffer FROM NuOffer nuOffer WHERE nuOffer.client.id =:id AND nuOffer.status!= 'inactive'")
@Transactional(readOnly = true)
List<NuOffer> findNuOfferActOclByUserId(@Param("id") Integer id);
}

View file

@ -29,4 +29,8 @@ public interface SpeedOfferRepository extends Repository<SpeedOffer, Integer> {
@Query("SELECT speedOffer FROM SpeedOffer speedOffer WHERE speedOffer.client.id =:id")
@Transactional(readOnly = true)
List<SpeedOffer> findByUserId(@Param("id") Integer id);
@Query("SELECT speedOffer FROM SpeedOffer speedOffer WHERE speedOffer.client.id =:id AND speedOffer.status!= 'inactive'")
@Transactional(readOnly = true)
List<SpeedOffer> findSpeedOfferActOclByUserId(@Param("id") Integer id);
}

View file

@ -26,4 +26,8 @@ public interface TimeOfferRepository extends Repository<TimeOffer, Integer> {
@Query("SELECT timeOffer FROM TimeOffer timeOffer WHERE timeOffer.client.id =:id")
@Transactional(readOnly = true)
List<TimeOffer> findByUserId(@Param("id") Integer id);
@Query("SELECT timeOffer FROM TimeOffer timeOffer WHERE timeOffer.client.id =:id AND timeOffer.status!= 'inactive'")
@Transactional(readOnly = true)
List<TimeOffer> findTimeOfferActOclByUserId(@Param("id") Integer id);
}

View file

@ -37,4 +37,8 @@ public class FoodOfferService {
public List<FoodOffer> findFoodOfferByUserId(final int id) {
return this.foodOfferRepository.findByUserId(id);
}
public List<FoodOffer> findFoodOfferActOclByUserId(final int id) {
return this.foodOfferRepository.findFoodOfferActOclByUserId(id);
}
}

View file

@ -47,4 +47,8 @@ public class NuOfferService {
public List<NuOffer> findNuOfferByUserId(final int id) {
return this.nuOfferRepository.findByUserId(id);
}
public List<NuOffer> findNuOfferActOclByUserId(final int id) {
return this.nuOfferRepository.findNuOfferActOclByUserId(id);
}
}

View file

@ -44,4 +44,8 @@ public class SpeedOfferService {
public List<SpeedOffer> findSpeedOfferByUserId(final int id) {
return this.speedOfferRepository.findByUserId(id);
}
public List<SpeedOffer> findSpeedOfferActOclByUserId(final int id) {
return this.speedOfferRepository.findSpeedOfferActOclByUserId(id);
}
}

View file

@ -40,4 +40,8 @@ public class TimeOfferService {
public List<TimeOffer> findTimeOfferByUserId(final int id) {
return this.timeOfferRepository.findByUserId(id);
}
public List<TimeOffer> findTimeOfferActOclByUserId(final int id) {
return this.timeOfferRepository.findTimeOfferActOclByUserId(id);
}
}

View file

@ -105,13 +105,15 @@ public class FoodOfferController {
public String processShowForm(@PathVariable("foodOfferId") int foodOfferId, Map<String, Object> model) {
FoodOffer foodOffer = this.foodOfferService.findFoodOfferById(foodOfferId);
if(!foodOffer.getStatus().equals(StatusOffer.active)) {
return "error";
}else {
model.put("foodOffer", foodOffer);
model.put("localDateTimeFormat", DateTimeFormatter.ofPattern("dd/MM/yyyy HH:mm"));
return "offers/food/foodOffersShow";
}
}
@GetMapping(value = "/offers/food/{foodOfferId}/edit")

View file

@ -136,10 +136,14 @@ public class NuOfferController {
@GetMapping("/offers/nu/{nuOfferId}")
public String processShowForm(@PathVariable("nuOfferId") int nuOfferId, Map<String, Object> model) {
NuOffer nuOffer = this.nuOfferService.findNuOfferById(nuOfferId);
if(!nuOffer.getStatus().equals(StatusOffer.active)) {
return "error";
}else {
model.put("nuOffer", nuOffer);
model.put("localDateTimeFormat", DateTimeFormatter.ofPattern("dd/MM/yyyy HH:mm"));
return "offers/nu/nuOffersShow";
}
}

View file

@ -64,10 +64,10 @@ public class OfertaController {
int actual = this.clientService.getCurrentClient().getId();
List<FoodOffer> foodOfferLs = this.foodOfferService.findFoodOfferByUserId(actual);
List<NuOffer> nuOfferLs = this.nuOfferService.findNuOfferByUserId(actual);
List<SpeedOffer> speedOfferLs = this.speedOfferService.findSpeedOfferByUserId(actual);
List<TimeOffer> timeOfferLs = this.timeOfferService.findTimeOfferByUserId(actual);
List<FoodOffer> foodOfferLs = this.foodOfferService.findFoodOfferActOclByUserId(actual);
List<NuOffer> nuOfferLs = this.nuOfferService.findNuOfferActOclByUserId(actual);
List<SpeedOffer> speedOfferLs = this.speedOfferService.findSpeedOfferActOclByUserId(actual);
List<TimeOffer> timeOfferLs = this.timeOfferService.findTimeOfferActOclByUserId(actual);
model.put("foodOfferLs", foodOfferLs);
model.put("nuOfferLs", nuOfferLs);

View file

@ -130,12 +130,15 @@ public class SpeedOfferController {
@GetMapping("/offers/speed/{speedOfferId}")
public String processShowForm(@PathVariable("speedOfferId") int speedOfferId, Map<String, Object> model) {
SpeedOffer speedOffer = this.speedOfferService.findSpeedOfferById(speedOfferId);
if(!speedOffer.getStatus().equals(StatusOffer.active)) {
return "error";
}else {
model.put("speedOffer", speedOffer);
model.put("localDateTimeFormat", DateTimeFormatter.ofPattern("dd/MM/yyyy HH:mm"));
return "offers/speed/speedOffersShow";
}
}
@GetMapping(value = "/offers/speed/{speedOfferId}/edit")

View file

@ -122,12 +122,15 @@ public class TimeOfferController {
public String processShowForm(@PathVariable("timeOfferId") int timeOfferId, Map<String, Object> model) {
TimeOffer timeOffer = this.timeOfferService.findTimeOfferById(timeOfferId);
if(!timeOffer.getStatus().equals(StatusOffer.active)) {
return "error";
}else {
model.put("timeOffer", timeOffer);
model.put("localDateTimeFormat", DateTimeFormatter.ofPattern("dd/MM/yyyy HH:mm"));
return "offers/time/timeOffersShow";
}
}

View file

@ -297,23 +297,23 @@ img.img-responsive{
}
#foodOfferTable th {
width: 25%;
width: 20%;
text-align: center;
}
#nuOfferTable th {
width: 25%;
width: 20%;
text-align: center;
}
#speedOfferTable th {
width: 25%;
width: 20%;
text-align: center;
}
#timeOfferTable th {
width: 25%;
width: 20%;
text-align: center;
}
@ -365,6 +365,29 @@ text-align: center;
background-color: rgb(40, 140, 215);
}
.btns-edit2{
display: table;
margin:auto;
}
.btns-edit2 button{
background-color: rgb(0, 64, 128);
border: 1px solid rgb(0, 0, 160);
color: white;
padding: 10px 24px;
cursor: pointer;
}
.btns-edit2 button:not(:last-child) {
border-bottom: none;
}
.btns-edit2 button:hover {
background-color: rgb(40, 140, 215);
}
.btns-delete{
display: table;
margin: 0 auto;

View file

@ -1,12 +1,11 @@
# database init, supports mysql too
database=mysql
spring.datasource.url=${MYSQL_URL:jdbc:mysql://localhost/cheapy?serverTimezone=UTC}
#spring.datasource.url=${MYSQL_URL:jdbc:mysql://localhost/cheapy?serverTimezone=UTC}
spring.datasource.username=${MYSQL_USER:cheapy}
spring.datasource.password=${MYSQL_PASS:cheapy}
# SQL is written to be idempotent so this is safe
spring.datasource.initialization-mode=always
spring.jpa.hibernate.naming-strategy = org.hibernate.cfg.ImprovedNamingStrategy
spring.jpa.properties.javax.persistence.schema-generation.drop-source=metadata
# Naming strategy
spring.jpa.hibernate.naming-strategy = org.hibernate.cfg.ImprovedNamingStrategy

View file

@ -4,6 +4,8 @@ database=mysql
spring.datasource.data=classpath*:db/${database}/data.sql
spring.h2.console.enabled=true
spring.profiles.active=mysql
spring.datasource.url=${MYSQL_URL:jdbc:mysql://localhost/cheapy?serverTimezone=UTC}
spring.datasource.driver-class-name=org.postgresql.Driver
# Web
spring.thymeleaf.mode=HTML

View file

@ -48,3 +48,7 @@ createSpeedOffers= Crear ofertas por rapidez comiendo
createTimeOffers= Crear ofertas por franja horaria
init= Inicio del intervalo
finishOffer= Fin del intervalo
name= Nombre del restaurante
status= Estado de oferta
myOffers= Ver mis Ofertas

View file

@ -42,15 +42,4 @@
</div>
</form:form>
<div class="btn-return">
<button type="button" role="link" onclick="goBack()" style="font-family: 'Lobster'; font-size: 20px;">
<span class="glyphicon glyphicon-arrow-left" aria-hidden="true" style="padding: 5px"> </span>
<fmt:message key="return"/> </button>
</div>
<script>
function goBack() {
window.history.back()
}
</script>
</cheapy:layout>

View file

@ -9,27 +9,17 @@
<cheapy:layout pageName="foodOffer">
<jsp:body>
<h2 class="text-center" style="font-family: 'Lobster'; font-size: 30px; color: rgb(0, 64, 128); padding:30px"><em>¿Está seguro de que quiere eliminar su oferta?</em></h2>
<h2 class="text-center" style="font-family: 'Lobster'; font-size: 30px; color: rgb(0, 64, 128); padding:30px"><em>¿Está seguro de que quiere eliminar su oferta?</em></h2>
<form:form modelAttribute="foodOffer" class="form-horizontal">
<div class="btns-edit">
<div class="btns-edit2">
<button type="submit" style="font-family: 'Lobster'; font-size: 20px;">
<span class="glyphicon glyphicon glyphicon-trash" aria-hidden="true" style="padding: 5px"> </span>
Dar de baja</button>
</div>
</form:form>
<div class="btn-return">
<button type="button" role="link" onclick="goBack()" style="font-family: 'Lobster'; font-size: 20px;">
<span class="glyphicon glyphicon-arrow-left" aria-hidden="true" style="padding: 5px"> </span>
<fmt:message key="return"/> </button>
</div>
<script>
function goBack() {
window.history.back()
}
</script>
</jsp:body>
</cheapy:layout>

View file

@ -12,7 +12,7 @@
<h2 style="text-align:center;padding:5px"><fmt:message key="foodOffer"/></h2>
<table class="table table-striped" id="foodOfferTable">
<thead>
<tr>
@ -40,44 +40,42 @@
</table>
<div class="btn-menu">
<div class="btn-return">
<button type="button" role="link" onclick="goBack()" style="font-family: 'Lobster'; font-size: 20px;">
<span class="glyphicon glyphicon-arrow-left" aria-hidden="true" style="padding: 5px"> </span>
<fmt:message key="return"/> </button>
</div>
<sec:authorize access="hasAnyAuthority('client')">
<sec:authentication var="principal" property="principal" />
<div class="btns-edit">
<spring:url value="{foodOfferId}/edit" var="editUrl">
<spring:param name="foodOfferId" value="${foodOffer.id}"/>
</spring:url>
<button type="button" role="link" onclick="window.location='${fn:escapeXml(editUrl)}'" style="font-family: 'Lobster'; font-size: 20px;">
<span class="glyphicon glyphicon glyphicon-edit" aria-hidden="true" style="padding: 5px"> </span>
Editar oferta</button>
<c:if test="${ principal.username eq foodOffer.client.usuar.username}">
<c:if test="${foodOffer.status eq 'active' || foodOffer.status eq 'hidden' }">
<spring:url value="{foodOfferId}/edit" var="editUrl">
<spring:param name="foodOfferId" value="${foodOffer.id}"/>
</spring:url>
<button type="button" role="link" onclick="window.location='${fn:escapeXml(editUrl)}'" style="font-family: 'Lobster'; font-size: 20px;">
<span class="glyphicon glyphicon glyphicon-edit" aria-hidden="true" style="padding: 5px"> </span>
Editar oferta</button>
</c:if>
<c:if test="${foodOffer.status eq 'hidden' }">
<spring:url value="{foodOfferId}/activate" var="activateUrl">
<spring:param name="foodOfferId" value="${foodOffer.id}"/>
</spring:url>
<button type="button" role="link" onclick="window.location='${fn:escapeXml(activateUrl)}'" style="font-family: 'Lobster'; font-size: 20px;">
<span class="glyphicon glyphicon glyphicon-edit" aria-hidden="true" style="padding: 5px"> </span>
Activar oferta</button>
<spring:url value="{foodOfferId}/activate" var="activateUrl">
<spring:param name="foodOfferId" value="${foodOffer.id}"/>
</spring:url>
<button type="button" role="link" onclick="window.location='${fn:escapeXml(activateUrl)}'" style="font-family: 'Lobster'; font-size: 20px;">
<span class="glyphicon glyphicon glyphicon-edit" aria-hidden="true" style="padding: 5px"> </span>
Activar oferta</button>
</c:if>
<c:if test="${foodOffer.status eq 'active' }">
<spring:url value="{foodOfferId}/disable" var="deactivateUrl">
<spring:param name="foodOfferId" value="${foodOffer.id}"/>
</spring:url>
<button type="button" role="link" onclick="window.location='${fn:escapeXml(deactivateUrl)}'" style="font-family: 'Lobster'; font-size: 20px;">
<span class="glyphicon glyphicon glyphicon-trash" aria-hidden="true" style="padding: 5px"> </span>
Desactivar oferta</button>
<spring:url value="{foodOfferId}/disable" var="deactivateUrl">
<spring:param name="foodOfferId" value="${foodOffer.id}"/>
</spring:url>
<button type="button" role="link" onclick="window.location='${fn:escapeXml(deactivateUrl)}'" style="font-family: 'Lobster'; font-size: 20px;">
<span class="glyphicon glyphicon glyphicon-trash" aria-hidden="true" style="padding: 5px"> </span>
Desactivar oferta</button>
</c:if>
</c:if>
</div>
</sec:authorize>
</div>
<script>
function goBack() {
window.history.back()
}
</script>
</cheapy:layout>

View file

@ -9,7 +9,7 @@
<cheapy:layout pageName="ofertasM">
<h2 style="text-align:center;padding:5px"><fmt:message key="foodOffers"/></h2>
<c:if test="${empty foodOfferLs }">
<p id="vacio" >No hay ninguna oferta por plato específico activa.</p>
<p id="vacio" >No hay ninguna oferta por plato específico creada.</p>
</c:if>
<c:if test="${not empty foodOfferLs }">
<table id="foodOfferTable" class="table table-striped">
@ -19,6 +19,7 @@
<th><fmt:message key="food"/></th>
<th><fmt:message key="startDate"/></th>
<th><fmt:message key="endDate"/></th>
<th><fmt:message key="status"/></th>
<th> <spring:url value="/offers/food/new" var="newFoodUrl">
</spring:url>
<!-- <a href="${fn:escapeXml(newFoodUrl)}" class="btn btn-default">Nueva oferta</a></th>-->
@ -36,6 +37,9 @@
<td>
<c:out value="${localDateTimeFormat.format(foodOffer.end)}"/>
</td>
<td>
<c:out value="${foodOffer.status}"/>
</td>
<td>
<spring:url value="/offers/food/{foodOfferId}" var="foodOfferUrl">
<spring:param name="foodOfferId" value="${foodOffer.id}"/>
@ -54,7 +58,7 @@
</c:if>
<h2 style="text-align:center;padding:5px"><fmt:message key="nuOffers"/></h2>
<c:if test="${empty nuOfferLs }">
<p id="vacio" >No hay ninguna oferta por plato específico activa.</p>
<p id="vacio" >No hay ninguna oferta por número de comensales creada.</p>
</c:if>
<c:if test="${not empty nuOfferLs }">
<table id="nuOfferTable" class="table table-striped">
@ -63,6 +67,7 @@
<!-- <th style="width: 150px;">Restaurante</th> -->
<th><fmt:message key="startDate"/></th>
<th><fmt:message key="endDate"/></th>
<th><fmt:message key="status"/></th>
<th> <spring:url value="/offers/nu/new" var="newNuUrl">
</spring:url>
<!-- <a href="${fn:escapeXml(newNuUrl)}" class="btn btn-default">Nueva oferta</a></th>-->
@ -79,6 +84,9 @@
<td>
<c:out value="${localDateTimeFormat.format(nuOffer.end)}"/>
</td>
<td>
<c:out value="${nuOffer.status}"/>
</td>
<td>
<spring:url value="/offers/nu/{nuOfferId}" var="nuOfferUrl">
<spring:param name="nuOfferId" value="${nuOffer.id}"/>
@ -96,8 +104,8 @@
</c:if>
<h2 style="text-align:center;padding:5px"><fmt:message key="speedOffers"/></h2>
<c:if test="${empty foodOfferLs }">
<p id="vacio" >No hay ninguna oferta por plato específico activa.</p>
<c:if test="${empty speedOfferLs }">
<p id="vacio" >No hay ninguna oferta por tiempo empleado en comer creada.</p>
</c:if>
<c:if test="${not empty speedOfferLs }">
<table id="speedOfferTable" class="table table-striped">
@ -106,6 +114,7 @@
<!-- <th style="width: 150px;">Restaurante</th> -->
<th><fmt:message key="startDate"/></th>
<th><fmt:message key="endDate"/></th>
<th><fmt:message key="status"/></th>
<th> <spring:url value="/offers/speed/new" var="newSpeedUrl">
</spring:url>
<!-- <a href="${fn:escapeXml(newSpeedUrl)}" class="btn btn-default">Nueva oferta</a></th>-->
@ -122,6 +131,9 @@
<td>
<c:out value="${localDateTimeFormat.format(speedOffer.end)}"/>
</td>
<td>
<c:out value="${speedOffer.status}"/>
</td>
<td>
<spring:url value="/offers/speed/{speedOfferId}" var="speedOfferUrl">
<spring:param name="speedOfferId" value="${speedOffer.id}"/>
@ -141,7 +153,7 @@
<h2 style="text-align:center;padding:5px"><fmt:message key="timeOffers"/></h2>
<c:if test="${empty timeOfferLs }">
<p id="vacio" >No hay ninguna oferta por plato específico activa.</p>
<p id="vacio" >No hay ninguna oferta por franja horaria creada.</p>
</c:if>
<c:if test="${not empty timeOfferLs }">
<table id="timeOfferTable" class="table table-striped">
@ -150,6 +162,7 @@
<!-- <th style="width: 150px;">Restaurante</th> -->
<th><fmt:message key="startDate"/></th>
<th><fmt:message key="endDate"/></th>
<th><fmt:message key="status"/></th>
<th><spring:url value="/offers/time/new" var="newTimeUrl">
</spring:url>
<!--<a href="${fn:escapeXml(newTimeUrl)}" class="btn btn-default">Nueva oferta</a> </th>-->
@ -165,6 +178,9 @@
<td>
<c:out value="${localDateTimeFormat.format(timeOffer.end)}"/>
</td>
<td>
<c:out value="${timeOffer.status}"/>
</td>
<td>
<spring:url value="/offers/time/{timeOfferId}" var="timeOfferUrl">
<spring:param name="timeOfferId" value="${timeOffer.id}"/>

View file

@ -47,15 +47,5 @@
</div>
</form:form>
<div class="btn-return">
<button type="button" role="link" onclick="goBack()" style="font-family: 'Lobster'; font-size: 20px;">
<span class="glyphicon glyphicon-arrow-left" aria-hidden="true" style="padding: 5px"> </span>
<fmt:message key="return"/> </button>
</div>
<script>
function goBack() {
window.history.back()
}
</script>
</cheapy:layout>

View file

@ -13,23 +13,13 @@
<form:form modelAttribute="nuOffer" class="form-horizontal">
<div class="btns-edit">
<div class="btns-edit2">
<button type="submit" style="font-family: 'Lobster'; font-size: 20px;">
<span class="glyphicon glyphicon glyphicon-trash" aria-hidden="true" style="padding: 5px"> </span>
Dar de baja</button>
</div>
</form:form>
<div class="btn-return">
<button type="button" role="link" onclick="goBack()" style="font-family: 'Lobster'; font-size: 20px;">
<span class="glyphicon glyphicon-arrow-left" aria-hidden="true" style="padding: 5px"> </span>
<fmt:message key="return"/> </button>
</div>
<script>
function goBack() {
window.history.back()
}
</script>
</jsp:body>
</cheapy:layout>

View file

@ -53,19 +53,19 @@
</table>
<div class="btn-menu">
<div class="btn-return">
<button type="button" role="link" onclick="goBack()" style="font-family: 'Lobster'; font-size: 20px;">
<span class="glyphicon glyphicon-arrow-left" aria-hidden="true" style="padding: 5px"> </span>
<fmt:message key="return"/> </button>
</div>
<sec:authorize access="hasAnyAuthority('client')">
<sec:authentication var="principal" property="principal" />
<div class="btns-edit">
<spring:url value="{nuOfferId}/edit" var="editUrl">
<spring:param name="nuOfferId" value="${nuOffer.id}"/>
</spring:url>
<button type="button" role="link" onclick="window.location='${fn:escapeXml(editUrl)}'" style="font-family: 'Lobster'; font-size: 20px;">
<span class="glyphicon glyphicon glyphicon-edit" aria-hidden="true" style="padding: 5px"> </span>
Editar oferta</button>
<c:if test="${ principal.username eq nuOffer.client.usuar.username}">
<c:if test="${nuOffer.status eq 'active' || nuOffer.status eq 'hidden' }">
<spring:url value="{nuOfferId}/edit" var="editUrl">
<spring:param name="nuOfferId" value="${nuOffer.id}"/>
</spring:url>
<button type="button" role="link" onclick="window.location='${fn:escapeXml(editUrl)}'" style="font-family: 'Lobster'; font-size: 20px;">
<span class="glyphicon glyphicon glyphicon-edit" aria-hidden="true" style="padding: 5px"> </span>
Editar oferta</button>
</c:if>
<c:if test="${nuOffer.status eq 'hidden' }">
<spring:url value="{nuOfferId}/activate" var="activateUrl">
<spring:param name="nuOfferId" value="${nuOffer.id}"/>
@ -83,13 +83,11 @@
<span class="glyphicon glyphicon glyphicon-trash" aria-hidden="true" style="padding: 5px"> </span>
Desactivar oferta</button>
</c:if>
</c:if>
</div>
</sec:authorize>
</div>
<script>
function goBack() {
window.history.back()
}
</script>
</cheapy:layout>

View file

@ -33,14 +33,5 @@
</div>
</div>
<div class="btn-return">
<button type="button" role="link" onclick="goBack()" style="font-family: 'Lobster'; font-size: 20px;">
<span class="glyphicon glyphicon-arrow-left" aria-hidden="true" style="padding: 5px"> </span>
<fmt:message key="return"/> </button>
</div>
<script>
function goBack() {
window.history.back()
}
</script>
</cheapy:layout>

View file

@ -4,10 +4,12 @@
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="cheapy" tagdir="/WEB-INF/tags" %>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>
<link href='https://fonts.googleapis.com/css?family=Lobster' rel='stylesheet'>
<cheapy:layout pageName="ofertas">
<h2 style="text-align:center;padding:5px"><fmt:message key="foodOffers"/></h2>
<c:if test="${empty foodOfferLs }">
<p id="vacio" >No hay ninguna oferta por plato específico activa.</p>
</c:if>
@ -16,16 +18,21 @@
<thead>
<tr>
<!-- <th style="width: 150px;">Restaurante</th> -->
<th><fmt:message key="name"/></th>
<th><fmt:message key="food"/></th>
<th><fmt:message key="discount"/></th>
<th><fmt:message key="startDate"/></th>
<th><fmt:message key="endDate"/></th>
<th> </th>
</tr>
</thead>
<tbody>
<c:forEach items="${foodOfferLs}" var="foodOffer">
<tr>
<td>
<c:out value="${foodOffer.client.name}"/>
</td>
<td>
<c:out value="${foodOffer.food}"/>
</td>
@ -38,6 +45,7 @@
<td>
<c:out value="${localDateTimeFormat.format(foodOffer.end)}"/>
</td>
<td>
<spring:url value="/offers/food/{foodOfferId}" var="foodOfferUrl">
<spring:param name="foodOfferId" value="${foodOffer.id}"/>
@ -56,13 +64,14 @@
</c:if>
<h2 style="text-align:center;padding:5px"><fmt:message key="nuOffers"/></h2>
<c:if test="${empty nuOfferLs }">
<p id="vacio" >No hay ninguna oferta por plato específico activa.</p>
<p id="vacio" >No hay ninguna oferta por número de comensales activa.</p>
</c:if>
<c:if test="${not empty nuOfferLs }">
<table id="nuOfferTable" class="table table-striped">
<thead>
<tr>
<!-- <th style="width: 150px;">Restaurante</th> -->
<th><fmt:message key="name"/></th>
<th><fmt:message key="startDate"/></th>
<th><fmt:message key="endDate"/></th>
<th><fmt:message key="goldGoal"/></th>
@ -74,7 +83,9 @@
<tbody>
<c:forEach items="${nuOfferLs}" var="nuOffer">
<tr>
<td>
<c:out value="${nuOffer.client.name}"/>
</td>
<td>
<c:out value="${localDateTimeFormat.format(nuOffer.start)}"/>
</td>
@ -105,13 +116,14 @@
<h2 style="text-align:center;padding:5px"><fmt:message key="speedOffers"/></h2>
<c:if test="${empty speedOfferLs }">
<p id="vacio" >No hay ninguna oferta por plato específico activa.</p>
<p id="vacio" >No hay ninguna oferta por tiempo empleado en comer activa.</p>
</c:if>
<c:if test="${not empty speedOfferLs }">
<table id="speedOfferTable" class="table table-striped">
<thead>
<tr>
<!-- <th style="width: 150px;">Restaurante</th> -->
<th><fmt:message key="name"/></th>
<th><fmt:message key="startDate"/></th>
<th><fmt:message key="endDate"/></th>
<th><fmt:message key="goldGoal"/></th>
@ -123,7 +135,9 @@
<tbody>
<c:forEach items="${speedOfferLs}" var="speedOffer">
<tr>
<td>
<c:out value="${speedOffer.client.name}"/>
</td>
<td>
<c:out value="${localDateTimeFormat.format(speedOffer.start)}"/>
</td>
@ -155,13 +169,14 @@
<h2 style="text-align:center;padding:5px"><fmt:message key="timeOffers"/></h2>
<c:if test="${empty timeOfferLs }">
<p id="vacio" >No hay ninguna oferta por plato específico activa.</p>
<p id="vacio" >No hay ninguna oferta por franja horaria activa.</p>
</c:if>
<c:if test="${not empty timeOfferLs }">
<table id="timeOfferTable" class="table table-striped">
<thead>
<tr>
<!-- <th style="width: 150px;">Restaurante</th> -->
<th><fmt:message key="name"/></th>
<th><fmt:message key="startDate"/></th>
<th><fmt:message key="endDate"/></th>
<th><fmt:message key="init"/></th>
@ -172,7 +187,9 @@
<tbody>
<c:forEach items="${timeOfferLs}" var="timeOffer">
<tr>
<td>
<c:out value="${timeOffer.client.name}"/>
</td>
<td>
<c:out value="${localDateTimeFormat.format(timeOffer.start)}"/>
</td>
@ -201,15 +218,6 @@
</tbody>
</table>
</c:if>
<div class="btn-return">
<button type="button" role="link" onclick="goBack()" style="font-family: 'Lobster'; font-size: 20px;">
<span class="glyphicon glyphicon-arrow-left" aria-hidden="true" style="padding: 5px"> </span>
<fmt:message key="return"/> </button>
</div>
<script>
function goBack() {
window.history.back()
}
</script>
</cheapy:layout>

View file

@ -44,16 +44,6 @@
</div>
</div>
</form:form>
<div class="btn-return">
<button type="button" role="link" onclick="goBack()" style="font-family: 'Lobster'; font-size: 20px;">
<span class="glyphicon glyphicon-arrow-left" aria-hidden="true" style="padding: 5px"> </span>
<fmt:message key="return"/> </button>
</div>
<script>
function goBack() {
window.history.back()
}
</script>
</cheapy:layout>

View file

@ -9,27 +9,18 @@
<cheapy:layout pageName="speedOffer">
<jsp:body>
<h2 class="text-center" style="font-family: 'Lobster'; font-size: 30px; color: rgb(0, 64, 128); padding:30px"><em>¿Está seguro de que quiere eliminar su oferta?</em></h2>
<h2 class="text-center" style="font-family: 'Lobster'; font-size: 30px; color: rgb(0, 64, 128); padding:30px"><em>¿Está seguro de que quiere eliminar su oferta?</em></h2>
<form:form modelAttribute="speedOffer" class="form-horizontal">
<div class="btns-edit">
<div class="btns-edit2">
<button type="submit" style="font-family: 'Lobster'; font-size: 20px;">
<span class="glyphicon glyphicon glyphicon-trash" aria-hidden="true" style="padding: 5px"> </span>
Dar de baja</button>
</div>
</form:form>
<div class="btn-return">
<button type="button" role="link" onclick="goBack()" style="font-family: 'Lobster'; font-size: 20px;">
<span class="glyphicon glyphicon-arrow-left" aria-hidden="true" style="padding: 5px"> </span>
<fmt:message key="return"/> </button>
</div>
<script>
function goBack() {
window.history.back()
}
</script>
</jsp:body>
</cheapy:layout>

View file

@ -53,19 +53,19 @@
</table>
<div class="btn-menu">
<div class="btn-return">
<button type="button" role="link" onclick="goBack()" style="font-family: 'Lobster'; font-size: 20px;">
<span class="glyphicon glyphicon-arrow-left" aria-hidden="true" style="padding: 5px"> </span>
<fmt:message key="return"/> </button>
</div>
<sec:authorize access="hasAnyAuthority('client')">
<sec:authentication var="principal" property="principal" />
<div class="btns-edit">
<spring:url value="{speedOfferId}/edit" var="editUrl">
<spring:param name="speedOfferId" value="${speedOffer.id}"/>
</spring:url>
<button type="button" role="link" onclick="window.location='${fn:escapeXml(editUrl)}'" style="font-family: 'Lobster'; font-size: 20px;">
<span class="glyphicon glyphicon glyphicon-edit" aria-hidden="true" style="padding: 5px"> </span>
Editar oferta</button>
<c:if test="${ principal.username eq speedOffer.client.usuar.username}">
<c:if test="${speedOffer.status eq 'active' || speedOffer.status eq 'hidden' }">
<spring:url value="{speedOfferId}/edit" var="editUrl">
<spring:param name="speedOfferId" value="${speedOffer.id}"/>
</spring:url>
<button type="button" role="link" onclick="window.location='${fn:escapeXml(editUrl)}'" style="font-family: 'Lobster'; font-size: 20px;">
<span class="glyphicon glyphicon glyphicon-edit" aria-hidden="true" style="padding: 5px"> </span>
Editar oferta</button>
</c:if>
<c:if test="${speedOffer.status eq 'hidden' }">
<spring:url value="{speedOfferId}/activate" var="activateUrl">
@ -84,14 +84,12 @@
<span class="glyphicon glyphicon glyphicon-trash" aria-hidden="true" style="padding: 5px"> </span>
Desactivar oferta</button>
</c:if>
</c:if>
</div>
</sec:authorize>
</div>
<script>
function goBack() {
window.history.back()
}
</script>
</cheapy:layout>

View file

@ -45,15 +45,6 @@
</div>
</form:form>
<div class="btn-return">
<button type="button" role="link" onclick="goBack()" style="font-family: 'Lobster'; font-size: 20px;">
<span class="glyphicon glyphicon-arrow-left" aria-hidden="true" style="padding: 5px"> </span>
<fmt:message key="return"/> </button>
</div>
<script>
function goBack() {
window.history.back()
}
</script>
</cheapy:layout>

View file

@ -13,23 +13,13 @@
<form:form modelAttribute="timeOffer" class="form-horizontal">
<div class="btns-edit">
<div class="btns-edit2">
<button type="submit" style="font-family: 'Lobster'; font-size: 20px;">
<span class="glyphicon glyphicon glyphicon-trash" aria-hidden="true" style="padding: 5px"> </span>
Dar de baja</button>
</div>
</form:form>
<div class="btn-return">
<button type="button" role="link" onclick="goBack()" style="font-family: 'Lobster'; font-size: 20px;">
<span class="glyphicon glyphicon-arrow-left" aria-hidden="true" style="padding: 5px"> </span>
<fmt:message key="return"/> </button>
</div>
<script>
function goBack() {
window.history.back()
}
</script>
</jsp:body>
</cheapy:layout>

View file

@ -42,20 +42,19 @@
</table>
<div class="btn-menu">
<div class="btn-return">
<button type="button" role="link" onclick="goBack()" style="font-family: 'Lobster'; font-size: 20px;">
<span class="glyphicon glyphicon-arrow-left" aria-hidden="true" style="padding: 5px"> </span>
<fmt:message key="return"/> </button>
</div>
<sec:authorize access="hasAnyAuthority('client')">
<sec:authentication var="principal" property="principal" />
<div class="btns-edit">
<spring:url value="{timeOfferId}/edit" var="editUrl">
<spring:param name="timeOfferId" value="${timeOffer.id}"/>
</spring:url>
<button type="button" role="link" onclick="window.location='${fn:escapeXml(editUrl)}'" style="font-family: 'Lobster'; font-size: 20px;">
<span class="glyphicon glyphicon glyphicon-edit" aria-hidden="true" style="padding: 5px"> </span>
Editar oferta</button>
<c:if test="${ principal.username eq timeOffer.client.usuar.username}">
<c:if test="${timeOffer.status eq 'active' || timeOffer.status eq 'hidden' }">
<spring:url value="{timeOfferId}/edit" var="editUrl">
<spring:param name="timeOfferId" value="${timeOffer.id}"/>
</spring:url>
<button type="button" role="link" onclick="window.location='${fn:escapeXml(editUrl)}'" style="font-family: 'Lobster'; font-size: 20px;">
<span class="glyphicon glyphicon glyphicon-edit" aria-hidden="true" style="padding: 5px"> </span>
Editar oferta</button>
</c:if>
<c:if test="${timeOffer.status eq 'hidden' }">
<spring:url value="{timeOfferId}/activate" var="activateUrl">
<spring:param name="timeOfferId" value="${timeOffer.id}"/>
@ -73,15 +72,11 @@
<span class="glyphicon glyphicon glyphicon-trash" aria-hidden="true" style="padding: 5px"> </span>
Desactivar oferta</button>
</c:if>
</c:if>
</div>
</sec:authorize>
</div>
<script>
function goBack() {
window.history.back()
}
</script>
</cheapy:layout>

View file

@ -18,15 +18,22 @@
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<div class="btn-mod">
<c:choose>
<c:when test="${review['new']}">
<button class="btn btn-default" type="submit">Crear Reseña</button>
<button class="btn btn-default" type="submit" style="font-family: 'Lobster'; font-size: 20px;">
<span class="glyphicon glyphicon-floppy-save" aria-hidden="true" style="padding: 5px"> </span>
Crear reseña</button>
</c:when>
<c:otherwise>
<button class="btn btn-default" type="submit">Modificar Reseña</button>
</c:otherwise>
</c:choose>
</div>
</div>
</div>
</form:form>
</cheapy:layout>

View file

@ -24,11 +24,7 @@
</table>
<div class="btn-return">
<button type="button" role="link" onclick="goBack()" style="font-family: 'Lobster'; font-size: 20px;">
<span class="glyphicon glyphicon-arrow-left" aria-hidden="true" style="padding: 5px"> </span>
<fmt:message key="return"/> </button>
</div>
<sec:authentication var="principal" property="principal" />
<div class="btns-edit">
@ -42,10 +38,6 @@
Editar opinión</button>
</c:if>
</div>
<script>
function goBack() {
window.history.back()
}
</script>
</cheapy:layout>

View file

@ -23,6 +23,11 @@
</div>
<sec:authorize access="hasAnyAuthority('client')">
<div class="btn-home">
<button type="button" role="link" onclick="window.location='/myOffers'" style="font-family: 'Lobster'; font-size: 20px;margin:5px;">
<span class="glyphicon glyphicon-cutlery" aria-hidden="true" style="padding: 5px"> </span>
<fmt:message key="myOffers"/> </button>
</div>
<div class="btn-home">
<button type="button" role="link" onclick="window.location='/offersCreate'" style="font-family: 'Lobster'; font-size: 20px;margin:5px;">
<span class="glyphicon glyphicon-cutlery" aria-hidden="true" style="padding: 5px"> </span>