Refactor checkout

This commit is contained in:
CodeSteak 2020-03-06 15:19:56 +01:00
parent 96e8b19f41
commit d7b9a08829
6 changed files with 51 additions and 7 deletions

View File

@ -9,6 +9,7 @@ import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.UUID;
@ -82,9 +83,13 @@ public class RequestController {
}
@PostMapping("/shop/articles/{id}")
public String shopArticlesByIdBuy(@RequestAttribute("customer") Boolean isCustomer, @PathVariable("id") Integer id) {
public String shopArticlesByIdBuy(@RequestAttribute("customer") Boolean isCustomer, @PathVariable("id") Integer id, @RequestParam("fastcheckout") Boolean fastcheckout ) {
if (isCustomer) {
return "redirect:/shop/checkout";
if (!fastcheckout) {
return "shop/articles/post_add";
} else {
return "shop/checkout";
}
} else {
return "redirect:/login?goto=%2Fshop%2Farticles%2F"+id;
}

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 8.1 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 8.1 KiB

View File

@ -32,6 +32,7 @@
</div>
<div class="s"></div>
<form class="s" method="POST">
<div class="detailgrid m">
<h2>50.28&nbsp;EUR</h2>
<div>
<label class="nolinebreak">Menge:</label>
@ -39,8 +40,10 @@
<option>2</option>
</select>
</div>
<h3 class="secondarytext">Auf Lager</h3>
<button>In den Einkaufswagen</button>
<h3 class="no-margin secondarytext">Auf Lager</h3>
<button class="no-margin secondary" name="fastcheckout" value="false">In den Einkaufswagen</button>
<button class="no-margin" name="fastcheckout" value="true">Schneller Checkout</button>
</div>
</form>
</div>
</div>

View File

@ -0,0 +1,34 @@
<!DOCTYPE html>
<html lang="de" dir="ltr" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=0.75, user-scalable=no">
<title>Sucherergebnisse</title>
<link rel="stylesheet" th:href="@{/css/ecom.css}" />
</head>
<body>
<!-- <nav th:replace="fragments/header :: header">Header</nav> -->
<main class="content-width modal">
<div class="detailgrid l " method="post">
<div class="s">
<h1 class="no-margin">Zum Warenkorb hinzugefügt</h1>
</div>
<div class="s">
<img th:src="@{/img/undraw_done_primary.svg}"/>
</div>
<div class="s">
<a th:href="@{__${#httpServletRequest.requestURI}__}" class="secondary button full-width no-margin">Weiter Einkaufen</a>
</div>
<div class="s">
<a th:href="@{/shop/checkout}" class="button full-width no-margin">Zum Warenkorb / Zur Kasse</a>
</div>
</div>
</main>
<footer th:replace="fragments/footer :: footer"></footer>
</body>
</html>

View File

@ -19,8 +19,8 @@
<nav></nav>
</div>
<!-- TODO: this is suboptimal on mobile -->
<main class="content-width sidebar-layout">
<div style="min-height: 100vh;">
<main class="content-width sidebar-layout" style="min-height: 100vh;">
<div style="max-width: 45em; width: 100%;">
<table>
<tr>
<th>Bild</th>
@ -116,7 +116,7 @@
</tr>
</table>
</div>
<form method="POST" th:action="@{/shop/checkoutFinish}">
<form method="POST" th:action="@{/shop/checkoutFinish}" style="min-width: 30em; max-width: 45em;">
<div class="detailflex hero">
<div>
<h1>Checkout</h1>