From d7b9a088297f5a37fe4804cd0f0d71e0671fd605 Mon Sep 17 00:00:00 2001 From: CodeSteak Date: Fri, 6 Mar 2020 15:19:56 +0100 Subject: [PATCH] Refactor checkout --- .../hso/ecommerce/app/RequestController.java | 9 +++-- .../static/img/undraw_done_primary.svg | 1 + .../static/img/undraw_done_secondary.svg | 1 + .../resources/templates/shop/articles/id.html | 7 ++-- .../templates/shop/articles/post_add.html | 34 +++++++++++++++++++ .../resources/templates/shop/checkout.html | 6 ++-- 6 files changed, 51 insertions(+), 7 deletions(-) create mode 100644 prototype/src/main/resources/static/img/undraw_done_primary.svg create mode 100644 prototype/src/main/resources/static/img/undraw_done_secondary.svg create mode 100644 prototype/src/main/resources/templates/shop/articles/post_add.html diff --git a/prototype/src/main/java/org/hso/ecommerce/app/RequestController.java b/prototype/src/main/java/org/hso/ecommerce/app/RequestController.java index af1f387..f16f5d2 100644 --- a/prototype/src/main/java/org/hso/ecommerce/app/RequestController.java +++ b/prototype/src/main/java/org/hso/ecommerce/app/RequestController.java @@ -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; } diff --git a/prototype/src/main/resources/static/img/undraw_done_primary.svg b/prototype/src/main/resources/static/img/undraw_done_primary.svg new file mode 100644 index 0000000..1069aec --- /dev/null +++ b/prototype/src/main/resources/static/img/undraw_done_primary.svg @@ -0,0 +1 @@ +done \ No newline at end of file diff --git a/prototype/src/main/resources/static/img/undraw_done_secondary.svg b/prototype/src/main/resources/static/img/undraw_done_secondary.svg new file mode 100644 index 0000000..1364843 --- /dev/null +++ b/prototype/src/main/resources/static/img/undraw_done_secondary.svg @@ -0,0 +1 @@ +done \ No newline at end of file diff --git a/prototype/src/main/resources/templates/shop/articles/id.html b/prototype/src/main/resources/templates/shop/articles/id.html index 4c97a53..d35ca71 100644 --- a/prototype/src/main/resources/templates/shop/articles/id.html +++ b/prototype/src/main/resources/templates/shop/articles/id.html @@ -32,6 +32,7 @@
+

50.28 EUR

@@ -39,8 +40,10 @@
-

Auf Lager

- +

Auf Lager

+ + +
diff --git a/prototype/src/main/resources/templates/shop/articles/post_add.html b/prototype/src/main/resources/templates/shop/articles/post_add.html new file mode 100644 index 0000000..837fad4 --- /dev/null +++ b/prototype/src/main/resources/templates/shop/articles/post_add.html @@ -0,0 +1,34 @@ + + + + + + + + Sucherergebnisse + + + + + +
+
+
+

Zum Warenkorb hinzugefügt

+
+
+ +
+ + + +
+
+ + + + diff --git a/prototype/src/main/resources/templates/shop/checkout.html b/prototype/src/main/resources/templates/shop/checkout.html index ea65727..d778354 100644 --- a/prototype/src/main/resources/templates/shop/checkout.html +++ b/prototype/src/main/resources/templates/shop/checkout.html @@ -19,8 +19,8 @@ -
-
+
+
@@ -116,7 +116,7 @@
Bild
-
+

Checkout