added customer account settings [Part 1]
* moved footer Mapping to the bottom of RequestController()
This commit is contained in:
parent
9fd050edab
commit
d3be609d16
@ -11,6 +11,9 @@ import javax.servlet.http.HttpServletResponse;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TODO clean up this class
|
||||||
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
public class RequestController {
|
public class RequestController {
|
||||||
|
|
||||||
@ -38,28 +41,58 @@ public class RequestController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/articledetail")
|
@GetMapping("/articledetail")
|
||||||
public String articledetail() { return "articleDetail";}
|
public String articledetail() {
|
||||||
|
return "articleDetail";
|
||||||
|
}
|
||||||
|
|
||||||
@GetMapping("/searchresults")
|
@GetMapping("/searchresults")
|
||||||
public String searchresults() { return "searchResults";}
|
public String searchresults() {
|
||||||
|
return "searchResults";
|
||||||
|
}
|
||||||
|
|
||||||
@GetMapping("/employee/articles")
|
@GetMapping("/employee/articles")
|
||||||
public String articles() { return "articles";}
|
public String articles() {
|
||||||
|
return "articles";
|
||||||
|
}
|
||||||
|
|
||||||
@GetMapping("/employee/listedarticles")
|
@GetMapping("/employee/listedarticles")
|
||||||
public String listedarticles() { return "listedArticles";}
|
public String listedarticles() {
|
||||||
|
return "listedArticles";
|
||||||
|
}
|
||||||
|
|
||||||
@GetMapping("/employee/listedarticlesedit")
|
@GetMapping("/employee/listedarticlesedit")
|
||||||
public String listedarticlesedit() { return "listedArticlesEdit";}
|
public String listedarticlesedit() {
|
||||||
|
return "listedArticlesEdit";
|
||||||
|
}
|
||||||
|
|
||||||
@GetMapping("/about")
|
@GetMapping("/customer/accountsettings")
|
||||||
public String about() { return "about";}
|
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);
|
||||||
|
|
||||||
@GetMapping("/terms")
|
model.addAttribute("fullname", customer.getFirstname() + " " + customer.getLastname());
|
||||||
public String terms() { return "terms";}
|
model.addAttribute("email", "Test.User@ecommere.com");
|
||||||
|
|
||||||
@GetMapping("/privacy")
|
model.addAttribute("street", "Musterstraße 42a");
|
||||||
public String privacy() { return "privacy";}
|
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")
|
@GetMapping("/login")
|
||||||
public String login(@CookieValue(value = "loginToken", defaultValue = "") String loginToken, Model model) {
|
public String login(@CookieValue(value = "loginToken", defaultValue = "") String loginToken, Model model) {
|
||||||
@ -126,4 +159,19 @@ public class RequestController {
|
|||||||
return "redirect:/home";
|
return "redirect:/home";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/about")
|
||||||
|
public String about() {
|
||||||
|
return "about";
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/terms")
|
||||||
|
public String terms() {
|
||||||
|
return "terms";
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/privacy")
|
||||||
|
public String privacy() {
|
||||||
|
return "privacy";
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
19
prototype/src/main/resources/static/css/dialog.css
Normal file
19
prototype/src/main/resources/static/css/dialog.css
Normal file
@ -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 */
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,78 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="de" dir="ltr" xmlns:th="http://www.thymeleaf.org">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>eCommerce - Account Settings</title>
|
||||||
|
<link rel="stylesheet" th:href="@{/css/ecom.css}"/>
|
||||||
|
<link rel="stylesheet" th:href="@{/css/listedArticles.css}" />
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<nav th:replace="fragments/header :: header">Header</nav>
|
||||||
|
<main class='content-width'>
|
||||||
|
<div class="content-width">
|
||||||
|
<h1> Account Settings </h1>
|
||||||
|
|
||||||
|
|
||||||
|
<form class="formgrid" th:action="@{/updateAccountSettings}" th:object="${customer}" method="post">
|
||||||
|
|
||||||
|
<div class="l">
|
||||||
|
<h2>General Settings</h2>
|
||||||
|
<p class="l">
|
||||||
|
<label for="username">Username *</label>
|
||||||
|
<input class="linestyle full-width" type="text" id="username" th:field="*{username}" th:value="${username}" />
|
||||||
|
</p>
|
||||||
|
<p class="l">
|
||||||
|
<label for="fullname">Full Name *</label>
|
||||||
|
<input class="linestyle full-width" type="text" id="fullname" th:value="${fullname}" />
|
||||||
|
</p>
|
||||||
|
<p class="l">
|
||||||
|
<label for="email">Email Address *</label>
|
||||||
|
<input class="linestyle full-width" type="text" id="email" th:value="${email}" />
|
||||||
|
</p>
|
||||||
|
<p class="l">
|
||||||
|
<label for="password">Password *</label>
|
||||||
|
<input class="linestyle full-width" type="password" id="password" th:field="*{password}" th:value="${password}" />
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="l">
|
||||||
|
<h2>Shipment Settings</h2>
|
||||||
|
<p class="l">
|
||||||
|
<label for="street">Street + Hous No. *</label>
|
||||||
|
<input class="linestyle full-width" type="text" id="street" th:value="${street}" />
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<div class="l">
|
||||||
|
<p class="m">
|
||||||
|
<label for="city">City *</label>
|
||||||
|
<input class="linestyle full-width" type="text" id="city" th:value="${city}" />
|
||||||
|
</p>
|
||||||
|
<p class="s">
|
||||||
|
<label for="zipcode">ZIP Code *</label>
|
||||||
|
<input class="linestyle full-width" type="text" id="zipcode" th:value="${zipcode}" />
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p class="l">
|
||||||
|
<label for="country">Country *</label>
|
||||||
|
<input class="linestyle full-width" type="text" id="country" th:value="${country}" />
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="l">
|
||||||
|
<h2>Payment Settings</h2>
|
||||||
|
<h3>TODO</h3>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="spacer"></div>
|
||||||
|
|
||||||
|
<div class="l">
|
||||||
|
<button type="submit" name="action" value="updateAccountSettings">Änderungen speichern</button>
|
||||||
|
<button type="reset">Zurücksetzen</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
<footer th:replace="fragments/footer :: footer"></footer>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -2,7 +2,7 @@
|
|||||||
<html lang="de" dir="ltr" xmlns:th="http://www.thymeleaf.org">
|
<html lang="de" dir="ltr" xmlns:th="http://www.thymeleaf.org">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<title>e-commerce</title>
|
<title>eCommerce</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<nav class='hero' th:fragment="header">
|
<nav class='hero' th:fragment="header">
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<html lang="de" dir="ltr" xmlns:th="http://www.thymeleaf.org">
|
<html lang="de" dir="ltr" xmlns:th="http://www.thymeleaf.org">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<title>e-commerce</title>
|
<title>eCommerce</title>
|
||||||
<link href="../static/css/ecom.css" rel="stylesheet" th:href="@{/css/ecom.css}"/>
|
<link href="../static/css/ecom.css" rel="stylesheet" th:href="@{/css/ecom.css}"/>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
@ -4,14 +4,15 @@
|
|||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<title>e-commerce</title>
|
<title>e-commerce</title>
|
||||||
<link href="../static/css/ecom.css" rel="stylesheet" th:href="@{/css/ecom.css}"/>
|
<link href="../static/css/ecom.css" rel="stylesheet" th:href="@{/css/ecom.css}"/>
|
||||||
|
<link href="../static/css/dialog.css" rel="stylesheet" th:href="@{/css/dialog.css}"/>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<nav th:replace="fragments/header :: header">Header</nav>
|
<nav th:replace="fragments/header :: header">Header</nav>
|
||||||
<main>
|
<main>
|
||||||
<form class="dialog-content" th:action="@{/register}" th:object="${customer}" method="post">
|
<form class="dialog-content" th:action="@{/register}" th:object="${customer}" method="post">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<label><b>Username</b></label>
|
<label for="username">Username</label>
|
||||||
<input type="text" th:field="*{username}" placeholder="Enter Username" name="uname" required>
|
<input type="text" th:field="*{username}" placeholder="Enter Username" id="username" required>
|
||||||
|
|
||||||
<label><b>Password</b></label>
|
<label><b>Password</b></label>
|
||||||
<input type="password" th:field="*{password}" placeholder="Enter Password" name="pwd" required>
|
<input type="password" th:field="*{password}" placeholder="Enter Password" name="pwd" required>
|
||||||
|
Reference in New Issue
Block a user