add bonuspoint option for checkout

This commit is contained in:
CodeSteak 2020-01-26 13:55:23 +01:00
parent b25a9842e4
commit 62324e4760
2 changed files with 24 additions and 26 deletions

View File

@ -29,16 +29,9 @@ public class RequestController {
}
@PostMapping("/login")
public String loginPost(HttpServletResponse response, @RequestParam(value = "goto", required = false) String gto) {
public String loginPost(HttpServletResponse response) {
response.addCookie(new Cookie("login", "true"));
System.out.println(gto);
if (gto != null && gto.startsWith("/")) {
return "redirect:" + gto;
} else {
return "redirect:/";
}
return "redirect:/";
}
@PostMapping("/logout")
@ -82,12 +75,8 @@ public class RequestController {
}
@PostMapping("/shop/articles/{id}")
public String shopArticlesByIdBuy(@RequestAttribute("customer") Boolean isCustomer, @PathVariable("id") Integer id) {
if (isCustomer) {
return "redirect:/shop/checkout";
} else {
return "redirect:/login?goto=%2Fshop%2Farticles%2F"+id;
}
public String shopArticlesByIdBuy(HttpServletResponse response) {
return "redirect:/shop/checkout";
}
@GetMapping("/user/")

View File

@ -30,8 +30,8 @@
<th></th>
</tr>
<tr>
<td><a th:href="@{/shop/articles/4151}"><img th:src="@{/img/product-1.jpg}" class="s" /><a/></td>
<td><a th:href="@{/shop/articles/4151}">Kamera<a/></td>
<td><a th:href="@{/shop/articles/4151}"><img th:src="@{/img/product-1.jpg}" class="s" /><a /></td>
<td><a th:href="@{/shop/articles/4151}">Kamera<a /></td>
<td>100,50 €</td>
<td>
<select size="1">
@ -47,8 +47,8 @@
</td>
</tr>
<tr>
<td><a th:href="@{/shop/articles/4151}"><img th:src="@{/img/product-2.jpg}" class="s" /><a/></td>
<td><a th:href="@{/shop/articles/4151}">Earbuds<a/></td>
<td><a th:href="@{/shop/articles/4151}"><img th:src="@{/img/product-2.jpg}" class="s" /><a /></td>
<td><a th:href="@{/shop/articles/4151}">Earbuds<a /></td>
<td>63,95 €</td>
<td>
<select size="1">
@ -64,8 +64,8 @@
</td>
</tr>
<tr>
<td><a th:href="@{/shop/articles/4151}"><img th:src="@{/img/product-3.jpg}" class="s" /><a/></td>
<td><a th:href="@{/shop/articles/4151}">USB-Magic Light<a/></td>
<td><a th:href="@{/shop/articles/4151}"><img th:src="@{/img/product-3.jpg}" class="s" /><a /></td>
<td><a th:href="@{/shop/articles/4151}">USB-Magic Light<a /></td>
<td>11,90 €</td>
<td>
<select size="1">
@ -81,8 +81,8 @@
</td>
</tr>
<tr>
<td><a th:href="@{/shop/articles/4151}"><img th:src="@{/img/product-4.jpg}" class="s" /><a/></td>
<td><a th:href="@{/shop/articles/4151}">3D Magic Stativ<a/></td>
<td><a th:href="@{/shop/articles/4151}"><img th:src="@{/img/product-4.jpg}" class="s" /><a /></td>
<td><a th:href="@{/shop/articles/4151}">3D Magic Stativ<a /></td>
<td>15,99 €</td>
<td>
<select size="1">
@ -98,8 +98,8 @@
</td>
</tr>
<tr>
<td><a th:href="@{/shop/articles/4151}"><img th:src="@{/img/product-5.jpg}" class="s" /><a/></td>
<td><a th:href="@{/shop/articles/4151}">Ersatzfernbedinung<a/></td>
<td><a th:href="@{/shop/articles/4151}"><img th:src="@{/img/product-5.jpg}" class="s" /><a /></td>
<td><a th:href="@{/shop/articles/4151}">Ersatzfernbedinung<a /></td>
<td>7,95 €</td>
<td>
<select size="1">
@ -132,10 +132,14 @@ Musterstraße 42
<div>
<h2>Zahlung:</h2>
<fieldset>
<input type="radio" name="type" value="priv" id="payment-card" required selected>
<input type="radio" name="type" value="priv" id="payment-card" required checked>
<label for="payment-card">Kartenzahlung</label> <br />
<input class="full-width" type="text" id="cardnumber" name="cardnumber" placeholder="Kartennummer" required />
</fieldset>
<fieldset>
<input class="" type="checkbox" id="bonus" name="bonus" checked/>
<label for="bonus"><h3>10 gesammelte Bonuspunkte verwenden</h3></label>
</fieldset>
</div>
<div>
<h2>Bestellübersicht</h2>
@ -145,6 +149,10 @@ Musterstraße 42
<th>Artikel (Netto)</th>
<th>200,29 €</th>
</tr>
<tr>
<th>Bonuspunkte</th>
<th>-5,00 €</th>
</tr>
<tr>
<th>Umsatzsteuer (19%)</th>
<th>35,00 €</th>
@ -168,4 +176,5 @@ Musterstraße 42
<footer th:replace="/fragments/footer :: footer"></footer>
</body>
</html>