From d3be609d16f1191a38b5fb2a1cc303ffb2eb43f7 Mon Sep 17 00:00:00 2001 From: Seil0 Date: Wed, 15 Jan 2020 10:55:24 +0100 Subject: [PATCH] added customer account settings [Part 1] * moved footer Mapping to the bottom of RequestController() --- .../hso/ecommerce/app/RequestController.java | 76 ++++++++++++++---- .../src/main/resources/static/css/dialog.css | 19 +++++ .../templates/customerAccountSettings.html | 78 +++++++++++++++++++ .../resources/templates/fragments/header.html | 2 +- .../src/main/resources/templates/home.html | 2 +- .../main/resources/templates/register.html | 5 +- 6 files changed, 164 insertions(+), 18 deletions(-) create mode 100644 prototype/src/main/resources/static/css/dialog.css create mode 100644 prototype/src/main/resources/templates/customerAccountSettings.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 9a0e605..7ecbc04 100644 --- a/prototype/src/main/java/org/hso/ecommerce/app/RequestController.java +++ b/prototype/src/main/java/org/hso/ecommerce/app/RequestController.java @@ -11,6 +11,9 @@ import javax.servlet.http.HttpServletResponse; import java.util.List; import java.util.UUID; +/** + * TODO clean up this class + */ @Controller public class RequestController { @@ -38,28 +41,58 @@ public class RequestController { } @GetMapping("/articledetail") - public String articledetail() { return "articleDetail";} + public String articledetail() { + return "articleDetail"; + } @GetMapping("/searchresults") - public String searchresults() { return "searchResults";} + public String searchresults() { + return "searchResults"; + } @GetMapping("/employee/articles") - public String articles() { return "articles";} + public String articles() { + return "articles"; + } @GetMapping("/employee/listedarticles") - public String listedarticles() { return "listedArticles";} + public String listedarticles() { + return "listedArticles"; + } @GetMapping("/employee/listedarticlesedit") - public String listedarticlesedit() { return "listedArticlesEdit";} - - @GetMapping("/about") - public String about() { return "about";} - - @GetMapping("/terms") - public String terms() { return "terms";} - - @GetMapping("/privacy") - public String privacy() { return "privacy";} + public String listedarticlesedit() { + return "listedArticlesEdit"; + } + + @GetMapping("/customer/accountsettings") + public String customerAccountSettings(Model model) { + Customer customer = new Customer(); + customer.setFirstname("Max"); + customer.setLastname("Mustermann"); + customer.setUsername("Max.TestKunde"); + customer.setPassword("test123"); + model.addAttribute(customer); + + model.addAttribute("fullname", customer.getFirstname() + " " + customer.getLastname()); + model.addAttribute("email", "Test.User@ecommere.com"); + + model.addAttribute("street", "Musterstraße 42a"); + model.addAttribute("city", "Musterstadt"); + model.addAttribute("zipcode", "12345"); + model.addAttribute("country", "Musterland"); + + return "customerAccountSettings"; + } + + @RequestMapping(value="/updateAccountSettings", method=RequestMethod.POST, params="action=updateAccountSettings") + public String updateAccountSettings(@ModelAttribute Customer customer, HttpServletResponse response) { + // do the login magic and get a loginToken + System.out.println(customer.username); + System.out.println(customer.password); + + return "redirect:/customer/accountsettings"; + } @GetMapping("/login") public String login(@CookieValue(value = "loginToken", defaultValue = "") String loginToken, Model model) { @@ -126,4 +159,19 @@ public class RequestController { return "redirect:/home"; } + @GetMapping("/about") + public String about() { + return "about"; + } + + @GetMapping("/terms") + public String terms() { + return "terms"; + } + + @GetMapping("/privacy") + public String privacy() { + return "privacy"; + } + } diff --git a/prototype/src/main/resources/static/css/dialog.css b/prototype/src/main/resources/static/css/dialog.css new file mode 100644 index 0000000..114eb80 --- /dev/null +++ b/prototype/src/main/resources/static/css/dialog.css @@ -0,0 +1,19 @@ +.dialog { + display: none; /* Hidden by default */ + position: fixed; /* Stay in place */ + z-index: 1; + left: 0; + top: 0; + width: 100%; /* Full width */ + height: 100%; /* Full height */ + overflow: auto; /* Enable scroll if needed */ + padding-top: 60px; +} + +.dialog-content { + background-color: var(--c-black); + margin: 5% auto 15% auto; /* 5% from the top, 15% from the bottom and centered */ + border: 1px solid #888; + width: 50%; /* Could be more or less, depending on screen size */ + +} \ No newline at end of file diff --git a/prototype/src/main/resources/templates/customerAccountSettings.html b/prototype/src/main/resources/templates/customerAccountSettings.html new file mode 100644 index 0000000..e7288af --- /dev/null +++ b/prototype/src/main/resources/templates/customerAccountSettings.html @@ -0,0 +1,78 @@ + + + + + eCommerce - Account Settings + + + + + +
+
+

Account Settings

+ + +
+ +
+

General Settings

+

+ + +

+

+ + +

+

+ + +

+

+ + +

+
+ +
+

Shipment Settings

+

+ + +

+ +
+

+ + +

+

+ + +

+
+ +

+ + +

+
+ +
+

Payment Settings

+

TODO

+
+ +
+ +
+ + +
+
+
+
+ + + \ No newline at end of file diff --git a/prototype/src/main/resources/templates/fragments/header.html b/prototype/src/main/resources/templates/fragments/header.html index 8bc8fe2..15f92df 100644 --- a/prototype/src/main/resources/templates/fragments/header.html +++ b/prototype/src/main/resources/templates/fragments/header.html @@ -2,7 +2,7 @@ - e-commerce + eCommerce