mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-23 15:55:49 +00:00
Modificar y eliminar ofertas de nuOffers y speedOffers, queda revisarlo
This commit is contained in:
parent
5a55aa8084
commit
a75a5adc70
12 changed files with 311 additions and 16 deletions
|
@ -19,26 +19,27 @@ import javax.persistence.Column;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
import javax.validation.constraints.NotBlank;
|
import javax.validation.constraints.NotBlank;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "nu_offers")
|
@Table(name = "nu_offers")
|
||||||
public class NuOffer extends Offer {
|
public class NuOffer extends Offer {
|
||||||
//Oferta por numero de comensales
|
//Oferta por numero de comensales
|
||||||
@NotBlank
|
@NotNull
|
||||||
private Integer gold;
|
private Integer gold;
|
||||||
|
|
||||||
@Column(name = "discount_gold")
|
@Column(name = "discount_gold")
|
||||||
@NotBlank
|
@NotBlank
|
||||||
private String discountGold;
|
private String discountGold;
|
||||||
|
|
||||||
@NotBlank
|
@NotNull
|
||||||
private Integer silver;
|
private Integer silver;
|
||||||
|
|
||||||
@Column(name = "discount_silver")
|
@Column(name = "discount_silver")
|
||||||
@NotBlank
|
@NotBlank
|
||||||
private String discountSilver;
|
private String discountSilver;
|
||||||
|
|
||||||
@NotBlank
|
@NotNull
|
||||||
private Integer bronze;
|
private Integer bronze;
|
||||||
|
|
||||||
@Column(name = "discount_bronze")
|
@Column(name = "discount_bronze")
|
||||||
|
|
|
@ -26,6 +26,7 @@ import javax.persistence.MappedSuperclass;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
import javax.validation.constraints.Future;
|
import javax.validation.constraints.Future;
|
||||||
import javax.validation.constraints.NotBlank;
|
import javax.validation.constraints.NotBlank;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
@ -33,12 +34,12 @@ import org.springframework.format.annotation.DateTimeFormat;
|
||||||
public class Offer extends BaseEntity {
|
public class Offer extends BaseEntity {
|
||||||
//Clase padre
|
//Clase padre
|
||||||
@DateTimeFormat(pattern = "dd/MM/yyyy HH:mm")
|
@DateTimeFormat(pattern = "dd/MM/yyyy HH:mm")
|
||||||
@NotBlank
|
@NotNull
|
||||||
@Future
|
@Future
|
||||||
private LocalDateTime start;
|
private LocalDateTime start;
|
||||||
|
|
||||||
@DateTimeFormat(pattern = "dd/MM/yyyy HH:mm")
|
@DateTimeFormat(pattern = "dd/MM/yyyy HH:mm")
|
||||||
@NotBlank
|
@NotNull
|
||||||
@Future
|
@Future
|
||||||
private LocalDateTime end;
|
private LocalDateTime end;
|
||||||
|
|
||||||
|
|
|
@ -19,26 +19,27 @@ import javax.persistence.Column;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
import javax.validation.constraints.NotBlank;
|
import javax.validation.constraints.NotBlank;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "speed_offers")
|
@Table(name = "speed_offers")
|
||||||
public class SpeedOffer extends Offer {
|
public class SpeedOffer extends Offer {
|
||||||
//Ofertar por rapidez comiendo
|
//Ofertar por rapidez comiendo
|
||||||
@NotBlank
|
@NotNull
|
||||||
private Integer gold; // x minutos
|
private Integer gold; // x minutos
|
||||||
|
|
||||||
@Column(name = "discount_gold")
|
@Column(name = "discount_gold")
|
||||||
@NotBlank
|
@NotBlank
|
||||||
private String discountGold;
|
private String discountGold;
|
||||||
|
|
||||||
@NotBlank
|
@NotNull
|
||||||
private Integer silver;
|
private Integer silver;
|
||||||
|
|
||||||
@Column(name = "discount_silver")
|
@Column(name = "discount_silver")
|
||||||
@NotBlank
|
@NotBlank
|
||||||
private String discountSilver;
|
private String discountSilver;
|
||||||
|
|
||||||
@NotBlank
|
@NotNull
|
||||||
private Integer bronze;
|
private Integer bronze;
|
||||||
|
|
||||||
@Column(name = "discount_bronze")
|
@Column(name = "discount_bronze")
|
||||||
|
|
|
@ -30,7 +30,7 @@ public class NuOfferService {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void saveOwner(final NuOffer nuOffer) throws DataAccessException { //
|
public void saveNuOffer(final NuOffer nuOffer) throws DataAccessException { //
|
||||||
this.nuOfferRepository.save(nuOffer);
|
this.nuOfferRepository.save(nuOffer);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@ public class SpeedOfferService {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void saveOwner(final SpeedOffer speedOffer) throws DataAccessException { //
|
public void saveSpeedOffer(final SpeedOffer speedOffer) throws DataAccessException { //
|
||||||
this.speedOfferRepository.save(speedOffer);
|
this.speedOfferRepository.save(speedOffer);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,22 +15,29 @@
|
||||||
*/
|
*/
|
||||||
package org.springframework.cheapy.web;
|
package org.springframework.cheapy.web;
|
||||||
|
|
||||||
|
import java.security.Principal;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import javax.validation.Valid;
|
||||||
|
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.cheapy.model.FoodOffer;
|
import org.springframework.cheapy.model.FoodOffer;
|
||||||
import org.springframework.cheapy.model.NuOffer;
|
import org.springframework.cheapy.model.NuOffer;
|
||||||
import org.springframework.cheapy.model.SpeedOffer;
|
import org.springframework.cheapy.model.SpeedOffer;
|
||||||
|
import org.springframework.cheapy.model.StatusOffer;
|
||||||
import org.springframework.cheapy.model.TimeOffer;
|
import org.springframework.cheapy.model.TimeOffer;
|
||||||
import org.springframework.cheapy.service.FoodOfferService;
|
import org.springframework.cheapy.service.FoodOfferService;
|
||||||
import org.springframework.cheapy.service.NuOfferService;
|
import org.springframework.cheapy.service.NuOfferService;
|
||||||
import org.springframework.cheapy.service.SpeedOfferService;
|
import org.springframework.cheapy.service.SpeedOfferService;
|
||||||
import org.springframework.cheapy.service.TimeOfferService;
|
import org.springframework.cheapy.service.TimeOfferService;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.ModelMap;
|
||||||
import org.springframework.validation.BindingResult;
|
import org.springframework.validation.BindingResult;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -42,7 +49,7 @@ import org.springframework.web.bind.annotation.PathVariable;
|
||||||
@Controller
|
@Controller
|
||||||
public class NuOfferController {
|
public class NuOfferController {
|
||||||
|
|
||||||
//private static final String VIEWS_OWNER_CREATE_OR_UPDATE_FORM = "owners/createOrUpdateOwnerForm";
|
private static final String VIEWS_NU_OFFER_CREATE_OR_UPDATE_FORM = "nuOffers/createOrUpdateNuOfferForm";
|
||||||
|
|
||||||
private final FoodOfferService foodOfferService;
|
private final FoodOfferService foodOfferService;
|
||||||
private final NuOfferService nuOfferService;
|
private final NuOfferService nuOfferService;
|
||||||
|
@ -101,4 +108,80 @@ public class NuOfferController {
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping(value = "/offers/nu/{nuOfferId}/edit")
|
||||||
|
public String updateNuOffer(@PathVariable("nuOfferId") final int nuOfferId, final Principal principal, final ModelMap model) {
|
||||||
|
|
||||||
|
// if (!this.comprobarIdentidad(principal, vehiculoId)) {
|
||||||
|
// return "exception";
|
||||||
|
// }
|
||||||
|
|
||||||
|
NuOffer nuOffer=this.nuOfferService.findNuOfferById(nuOfferId);
|
||||||
|
model.put("nuOffer", nuOffer);
|
||||||
|
return VIEWS_NU_OFFER_CREATE_OR_UPDATE_FORM;
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping(value = "/offers/nu/{nuOfferId}/edit")
|
||||||
|
public String updateNuOffer(@Valid final NuOffer nuOfferEdit, final BindingResult result, @PathVariable("nuOfferId") final int nuOfferId, final Principal principal, final ModelMap model) {
|
||||||
|
|
||||||
|
// if (!this.comprobarIdentidad(principal, vehiculoId)) {
|
||||||
|
// return "exception";
|
||||||
|
// }
|
||||||
|
|
||||||
|
if (result.hasErrors()) {
|
||||||
|
model.put("nuOffer", nuOfferEdit);
|
||||||
|
return VIEWS_NU_OFFER_CREATE_OR_UPDATE_FORM;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
NuOffer nuOfferOld=this.nuOfferService.findNuOfferById(nuOfferId);
|
||||||
|
|
||||||
|
BeanUtils.copyProperties(nuOfferEdit, nuOfferOld, "id", "client_id");
|
||||||
|
|
||||||
|
this.nuOfferService.saveNuOffer(nuOfferOld);
|
||||||
|
|
||||||
|
return "redirect:";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping(value = "/offers/nu/{nuOfferId}/disable")
|
||||||
|
public String disableNuOffer(@PathVariable("nuOfferId") final int nuOfferId, final Principal principal, final ModelMap model) {
|
||||||
|
|
||||||
|
// if (!this.comprobarIdentidad(principal, vehiculoId)) {
|
||||||
|
// return "exception";
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// if (this.tieneCitasAceptadasYPendientes(vehiculoId)) {
|
||||||
|
// model.addAttribute("x", true);
|
||||||
|
//
|
||||||
|
// } else {
|
||||||
|
// model.addAttribute("x", false);
|
||||||
|
// }
|
||||||
|
|
||||||
|
NuOffer nuOffer=this.nuOfferService.findNuOfferById(nuOfferId);
|
||||||
|
model.put("nuOffer", nuOffer);
|
||||||
|
return "nuOffers/nuOffersDisable";
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping(value = "/offers/nu/{nuOfferId}/disable")
|
||||||
|
public String disableNuOfferForm(@PathVariable("nuOfferId") final int nuOfferId, final Principal principal, final ModelMap model) {
|
||||||
|
|
||||||
|
// if (!this.comprobarIdentidad(principal, vehiculoId)) {
|
||||||
|
// return "exception";
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// if (this.tieneCitasAceptadasYPendientes(vehiculoId)) {
|
||||||
|
// return "redirect:/cliente/vehiculos/{vehiculoId}/disable";
|
||||||
|
//
|
||||||
|
// } else {
|
||||||
|
NuOffer nuOffer=this.nuOfferService.findNuOfferById(nuOfferId);
|
||||||
|
|
||||||
|
nuOffer.setType(StatusOffer.inactive);
|
||||||
|
|
||||||
|
this.nuOfferService.saveNuOffer(nuOffer);
|
||||||
|
|
||||||
|
return "redirect:";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,22 +15,29 @@
|
||||||
*/
|
*/
|
||||||
package org.springframework.cheapy.web;
|
package org.springframework.cheapy.web;
|
||||||
|
|
||||||
|
import java.security.Principal;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import javax.validation.Valid;
|
||||||
|
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.cheapy.model.FoodOffer;
|
import org.springframework.cheapy.model.FoodOffer;
|
||||||
import org.springframework.cheapy.model.NuOffer;
|
import org.springframework.cheapy.model.NuOffer;
|
||||||
import org.springframework.cheapy.model.SpeedOffer;
|
import org.springframework.cheapy.model.SpeedOffer;
|
||||||
|
import org.springframework.cheapy.model.StatusOffer;
|
||||||
import org.springframework.cheapy.model.TimeOffer;
|
import org.springframework.cheapy.model.TimeOffer;
|
||||||
import org.springframework.cheapy.service.FoodOfferService;
|
import org.springframework.cheapy.service.FoodOfferService;
|
||||||
import org.springframework.cheapy.service.NuOfferService;
|
import org.springframework.cheapy.service.NuOfferService;
|
||||||
import org.springframework.cheapy.service.SpeedOfferService;
|
import org.springframework.cheapy.service.SpeedOfferService;
|
||||||
import org.springframework.cheapy.service.TimeOfferService;
|
import org.springframework.cheapy.service.TimeOfferService;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.ModelMap;
|
||||||
import org.springframework.validation.BindingResult;
|
import org.springframework.validation.BindingResult;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -42,7 +49,7 @@ import org.springframework.web.bind.annotation.PathVariable;
|
||||||
@Controller
|
@Controller
|
||||||
public class SpeedOfferController {
|
public class SpeedOfferController {
|
||||||
|
|
||||||
//private static final String VIEWS_OWNER_CREATE_OR_UPDATE_FORM = "owners/createOrUpdateOwnerForm";
|
private static final String VIEWS_SPEED_OFFER_CREATE_OR_UPDATE_FORM = "speedOffers/createOrUpdateSpeedOfferForm";
|
||||||
|
|
||||||
private final FoodOfferService foodOfferService;
|
private final FoodOfferService foodOfferService;
|
||||||
private final NuOfferService nuOfferService;
|
private final NuOfferService nuOfferService;
|
||||||
|
@ -100,5 +107,81 @@ public class SpeedOfferController {
|
||||||
// return mav;
|
// return mav;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
@GetMapping(value = "/offers/speed/{speedOfferId}/edit")
|
||||||
|
public String updateNuOffer(@PathVariable("speedOfferId") final int speedOfferId, final Principal principal, final ModelMap model) {
|
||||||
|
|
||||||
|
// if (!this.comprobarIdentidad(principal, vehiculoId)) {
|
||||||
|
// return "exception";
|
||||||
|
// }
|
||||||
|
|
||||||
|
SpeedOffer speedOffer=this.speedOfferService.findSpeedOfferById(speedOfferId);
|
||||||
|
model.put("speedOffer", speedOffer);
|
||||||
|
return VIEWS_SPEED_OFFER_CREATE_OR_UPDATE_FORM;
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping(value = "/offers/speed/{speedOfferId}/edit")
|
||||||
|
public String updateNuOffer(@Valid final SpeedOffer speedOfferEdit, final BindingResult result, @PathVariable("speedOfferId") final int speedOfferId, final Principal principal, final ModelMap model) {
|
||||||
|
|
||||||
|
// if (!this.comprobarIdentidad(principal, vehiculoId)) {
|
||||||
|
// return "exception";
|
||||||
|
// }
|
||||||
|
|
||||||
|
if (result.hasErrors()) {
|
||||||
|
model.put("speedOffer", speedOfferEdit);
|
||||||
|
return VIEWS_SPEED_OFFER_CREATE_OR_UPDATE_FORM;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
SpeedOffer speedOfferOld=this.speedOfferService.findSpeedOfferById(speedOfferId);
|
||||||
|
|
||||||
|
BeanUtils.copyProperties(speedOfferEdit, speedOfferOld, "id", "client_id");
|
||||||
|
|
||||||
|
this.speedOfferService.saveSpeedOffer(speedOfferOld);
|
||||||
|
|
||||||
|
return "redirect:";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping(value = "/offers/speed/{speedOfferId}/disable")
|
||||||
|
public String disableSpeedOffer(@PathVariable("speedOfferId") final int speedOfferId, final Principal principal, final ModelMap model) {
|
||||||
|
|
||||||
|
// if (!this.comprobarIdentidad(principal, vehiculoId)) {
|
||||||
|
// return "exception";
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// if (this.tieneCitasAceptadasYPendientes(vehiculoId)) {
|
||||||
|
// model.addAttribute("x", true);
|
||||||
|
//
|
||||||
|
// } else {
|
||||||
|
// model.addAttribute("x", false);
|
||||||
|
// }
|
||||||
|
|
||||||
|
SpeedOffer speedOffer=this.speedOfferService.findSpeedOfferById(speedOfferId);
|
||||||
|
model.put("speedOffer", speedOffer);
|
||||||
|
return "speedOffers/speedOffersDisable";
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping(value = "/offers/speed/{speedOfferId}/disable")
|
||||||
|
public String disableNuOfferForm(@PathVariable("speedOfferId") final int speedOfferId, final Principal principal, final ModelMap model) {
|
||||||
|
|
||||||
|
// if (!this.comprobarIdentidad(principal, vehiculoId)) {
|
||||||
|
// return "exception";
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// if (this.tieneCitasAceptadasYPendientes(vehiculoId)) {
|
||||||
|
// return "redirect:/cliente/vehiculos/{vehiculoId}/disable";
|
||||||
|
//
|
||||||
|
// } else {
|
||||||
|
SpeedOffer speedOffer=this.speedOfferService.findSpeedOfferById(speedOfferId);
|
||||||
|
|
||||||
|
speedOffer.setType(StatusOffer.inactive);
|
||||||
|
|
||||||
|
this.speedOfferService.saveSpeedOffer(speedOffer);
|
||||||
|
|
||||||
|
return "redirect:";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,14 +11,10 @@ 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', 'jkhlljk', 'active', null, 'macarrones', '15%', 10);
|
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', 'jkhlljk', 'active', null, 'macarrones', '15%', 10);
|
||||||
|
|
||||||
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 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 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 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 usuarios(username, password, enabled) values ('admin3', 'admin', true);
|
|
||||||
--insert into authorities(id ,usuario, authority) values (42,'admin3', 'admin');
|
|
||||||
|
|
||||||
INSERT INTO users(username,password,enabled) VALUES ('admin1','4dm1n',TRUE);
|
INSERT INTO users(username,password,enabled) VALUES ('admin1','4dm1n',TRUE);
|
||||||
INSERT INTO authorities(id,username,authority) VALUES (1,'admin1','admin');
|
INSERT INTO authorities(id,username,authority) VALUES (1,'admin1','admin');
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,39 @@
|
||||||
|
<%@ page session="false" trimDirectiveWhitespaces="true" %>
|
||||||
|
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
|
||||||
|
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
|
||||||
|
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
||||||
|
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
|
||||||
|
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
|
||||||
|
<%@ taglib prefix="petclinic" tagdir="/WEB-INF/tags" %>
|
||||||
|
|
||||||
|
<petclinic:layout pageName="NumOffers">
|
||||||
|
<h2>
|
||||||
|
<c:if test="${nuOffer['new']}">New </c:if> NuOffer
|
||||||
|
</h2>
|
||||||
|
<form:form modelAttribute="nuOffer" class="form-horizontal" id="add-nuOffer-form">
|
||||||
|
<div class="form-group has-feedback">
|
||||||
|
<petclinic:inputField label="Fecha de inicio" name="start"/>
|
||||||
|
<petclinic:inputField label="Fecha de fin" name="end"/>
|
||||||
|
|
||||||
|
<petclinic:inputField label="Oro" name="gold"/>
|
||||||
|
<petclinic:inputField label="descuento de oro" name="discountGold"/>
|
||||||
|
<petclinic:inputField label="Plata" name="silver"/>
|
||||||
|
<petclinic:inputField label="Descuento de plata" name="discountSilver"/>
|
||||||
|
<petclinic:inputField label="Bronce" name="bronze"/>
|
||||||
|
<petclinic:inputField label="Descuento de bronce" name="discountBronze"/>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="col-sm-offset-2 col-sm-10">
|
||||||
|
<c:choose>
|
||||||
|
<c:when test="${nuOffer['new']}">
|
||||||
|
<button class="btn btn-default" type="submit">Add Offer</button>
|
||||||
|
</c:when>
|
||||||
|
<c:otherwise>
|
||||||
|
<button class="btn btn-default" type="submit">Update Offer</button>
|
||||||
|
</c:otherwise>
|
||||||
|
</c:choose>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form:form>
|
||||||
|
</petclinic:layout>
|
27
src/main/webapp/WEB-INF/jsp/nuOffers/nuOffersDisable.jsp
Normal file
27
src/main/webapp/WEB-INF/jsp/nuOffers/nuOffersDisable.jsp
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
<%@ page session="false" trimDirectiveWhitespaces="true"%>
|
||||||
|
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
|
||||||
|
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
|
||||||
|
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
|
||||||
|
<%@ taglib prefix="petclinic" tagdir="/WEB-INF/tags"%>
|
||||||
|
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
|
||||||
|
|
||||||
|
<petclinic:layout pageName="nuOffer">
|
||||||
|
|
||||||
|
<jsp:body>
|
||||||
|
<h2> ¿Esta seguro de que quiere dar de baja su offer? </h2>
|
||||||
|
|
||||||
|
<form:form modelAttribute="nuOffer" class="form-horizontal">
|
||||||
|
<input type="hidden" name="gold" value="${nu_offer.gold}" />
|
||||||
|
<input type="hidden" name="discountGold" value="${nu_offer.discount_gold}" />
|
||||||
|
<input type="hidden" name="silver" value="${nu_offer.silver}" />
|
||||||
|
<input type="hidden" name="discountSilver" value="${nu_offer.discount_silver}" />
|
||||||
|
<input type="hidden" name="bronze" value="${nu_offer.bronze}" />
|
||||||
|
<input type="hidden" name="discountBronze" value="${nu_offer.discount_bronze}" />
|
||||||
|
|
||||||
|
<button class="btn btn-default" type="submit">Dar de baja</button>
|
||||||
|
</form:form>
|
||||||
|
|
||||||
|
<a class="btn btn-default" href='<spring:url value="/offers" htmlEscape="true"/>'>Volver</a>
|
||||||
|
|
||||||
|
</jsp:body>
|
||||||
|
</petclinic:layout>
|
|
@ -0,0 +1,37 @@
|
||||||
|
<%@ page session="false" trimDirectiveWhitespaces="true" %>
|
||||||
|
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
|
||||||
|
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
|
||||||
|
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
||||||
|
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
|
||||||
|
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
|
||||||
|
<%@ taglib prefix="petclinic" tagdir="/WEB-INF/tags" %>
|
||||||
|
|
||||||
|
<petclinic:layout pageName="speedOffers">
|
||||||
|
<h2>
|
||||||
|
<c:if test="${speedOffer['new']}">New </c:if> SpeedOffer
|
||||||
|
</h2>
|
||||||
|
<form:form modelAttribute="speedOffer" class="form-horizontal" id="add-speedOffer-form">
|
||||||
|
<div class="form-group has-feedback">
|
||||||
|
<petclinic:inputField label="Start Date" name="start"/>
|
||||||
|
<petclinic:inputField label="End Date" name="end"/>
|
||||||
|
<petclinic:inputField label="Gold" name="gold"/>
|
||||||
|
<petclinic:inputField label="Gold Discount" name="discountGold"/>
|
||||||
|
<petclinic:inputField label="Silver" name="silver"/>
|
||||||
|
<petclinic:inputField label="Silver Discount" name="discountSilver"/>
|
||||||
|
<petclinic:inputField label="Bronze" name="bronze"/>
|
||||||
|
<petclinic:inputField label="Bronze Discount" name="discountBronze"/>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="col-sm-offset-2 col-sm-10">
|
||||||
|
<c:choose>
|
||||||
|
<c:when test="${speedOffer['new']}">
|
||||||
|
<button class="btn btn-default" type="submit">Add Speed Offer</button>
|
||||||
|
</c:when>
|
||||||
|
<c:otherwise>
|
||||||
|
<button class="btn btn-default" type="submit">Update Offer</button>
|
||||||
|
</c:otherwise>
|
||||||
|
</c:choose>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form:form>
|
||||||
|
</petclinic:layout>
|
|
@ -0,0 +1,27 @@
|
||||||
|
<%@ page session="false" trimDirectiveWhitespaces="true"%>
|
||||||
|
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
|
||||||
|
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
|
||||||
|
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
|
||||||
|
<%@ taglib prefix="petclinic" tagdir="/WEB-INF/tags"%>
|
||||||
|
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
|
||||||
|
|
||||||
|
<petclinic:layout pageName="speedOffer">
|
||||||
|
|
||||||
|
<jsp:body>
|
||||||
|
<h2> ¿Esta seguro de que quiere dar de baja su offer? </h2>
|
||||||
|
|
||||||
|
<form:form modelAttribute="speedOffer" class="form-horizontal">
|
||||||
|
<input type="hidden" name="gold" value="${nu_offer.gold}" />
|
||||||
|
<input type="hidden" name="discountGold" value="${nu_offer.discount_gold}" />
|
||||||
|
<input type="hidden" name="silver" value="${nu_offer.silver}" />
|
||||||
|
<input type="hidden" name="discountSilver" value="${nu_offer.discount_silver}" />
|
||||||
|
<input type="hidden" name="bronze" value="${nu_offer.bronze}" />
|
||||||
|
<input type="hidden" name="discountBronze" value="${nu_offer.discount_bronze}" />
|
||||||
|
|
||||||
|
<button class="btn btn-default" type="submit">Dar de baja</button>
|
||||||
|
</form:form>
|
||||||
|
|
||||||
|
<a class="btn btn-default" href='<spring:url value="/offers" htmlEscape="true"/>'>Volver</a>
|
||||||
|
|
||||||
|
</jsp:body>
|
||||||
|
</petclinic:layout>
|
Loading…
Reference in a new issue