9 Commits

9 changed files with 23 additions and 13 deletions

View File

@ -1,6 +1,5 @@
package org.hso.ecommerce.components; package org.hso.ecommerce.components;
import org.hso.ecommerce.entities.booking.PaymentMethod;
import org.hso.ecommerce.entities.shop.Address; import org.hso.ecommerce.entities.shop.Address;
import org.hso.ecommerce.entities.user.User; import org.hso.ecommerce.entities.user.User;
import org.hso.ecommerce.repos.user.UserRepository; import org.hso.ecommerce.repos.user.UserRepository;
@ -26,8 +25,7 @@ public class AdminInitializer {
firstAdmin.created = new Timestamp(System.currentTimeMillis()); firstAdmin.created = new Timestamp(System.currentTimeMillis());
firstAdmin.defaultDeliveryAddress = new Address(); firstAdmin.defaultDeliveryAddress = new Address();
firstAdmin.defaultDeliveryAddress.name = "admin"; firstAdmin.defaultDeliveryAddress.name = "admin";
firstAdmin.defaultPayment = new PaymentMethod(); firstAdmin.defaultPayment = null;
firstAdmin.defaultPayment.creditCardNumber = ""; //set empty number
firstAdmin.email = "admin"; firstAdmin.email = "admin";
firstAdmin.isActive = true; firstAdmin.isActive = true;
firstAdmin.isEmployee = true; firstAdmin.isEmployee = true;

View File

@ -1,6 +1,5 @@
package org.hso.ecommerce.controller; package org.hso.ecommerce.controller;
import org.hso.ecommerce.entities.booking.PaymentMethod;
import org.hso.ecommerce.entities.shop.Address; import org.hso.ecommerce.entities.shop.Address;
import org.hso.ecommerce.entities.user.User; import org.hso.ecommerce.entities.user.User;
import org.hso.ecommerce.repos.user.UserRepository; import org.hso.ecommerce.repos.user.UserRepository;
@ -47,7 +46,7 @@ public class RegisterController {
newUser.email = username; newUser.email = username;
newUser.isEmployee = false; newUser.isEmployee = false;
newUser.salutation = salutation; newUser.salutation = salutation;
newUser.defaultPayment = PaymentMethod.fromCreditCardNumber(""); newUser.defaultPayment = null;
newUser.isActive = true; newUser.isActive = true;
newUser.created = new java.sql.Timestamp(System.currentTimeMillis()); newUser.created = new java.sql.Timestamp(System.currentTimeMillis());

View File

@ -140,6 +140,11 @@ public class ShopCheckoutController {
bookingRepository.saveAll(result.bookings); bookingRepository.saveAll(result.bookings);
warehouseBookingRepository.save(result.warehouseBooking); warehouseBookingRepository.save(result.warehouseBooking);
if (user.defaultPayment == null) {
user.defaultPayment = PaymentMethod.fromCreditCardNumber(cardnumber);
userRepository.save(user);
}
shoppingCart.clear(); shoppingCart.clear();
} catch (CreateOrderAction.ArticleNotInStockException e) { } catch (CreateOrderAction.ArticleNotInStockException e) {

View File

@ -42,9 +42,8 @@ public class ShopSearchController {
List<Article> articles = articleRepository.getArticlesByCategory(category); //search by Category List<Article> articles = articleRepository.getArticlesByCategory(category); //search by Category
model.addAttribute("articles", articles); model.addAttribute("articles", articles);
} else { } else {
request.setAttribute("error", "Es wurden keine Suchparameter angegeben."); List<Article> articles = SearchByTermAction.searchByTerm("", articleRepository);
response.setStatus(HttpServletResponse.SC_NOT_FOUND); model.addAttribute("articles", articles);
return "error/404";
} }
// Show term in search box // Show term in search box

View File

@ -14,6 +14,7 @@ spring.jpa.show-sql=true
#spring.session.jdbc.schema=classpath:org/springframework/session/jdbc/schema-@@platform@@.sql #spring.session.jdbc.schema=classpath:org/springframework/session/jdbc/schema-@@platform@@.sql
#spring.session.jdbc.table-name=SPRING_SESSION #spring.session.jdbc.table-name=SPRING_SESSION
#server.servlet.session.persistent=true #server.servlet.session.persistent=true
server.servlet.session.timeout=48h
# ---------------------------------------- # ----------------------------------------
# WEB PROPERTIES # WEB PROPERTIES
spring.servlet.multipart.max-file-size=10MB spring.servlet.multipart.max-file-size=10MB

View File

@ -19,7 +19,8 @@
</div> </div>
<div> <div>
<label for="username">Email Adresse</label> <label for="username">Email Adresse</label>
<input class="full-width" type="text" name="username" placeholder="Email Adresse" id="username" required> <input class="full-width" type="text" name="username" placeholder="Email Adresse" id="username"
pattern="[^@\s]+@[^\.\s]+\.[^\s]+" required>
</div> </div>
<div> <div>
<label for="password">Passwort</label> <label for="password">Passwort</label>

View File

@ -97,6 +97,12 @@ Musterstraße 4
th:value="${user.defaultPayment != null ? user.defaultPayment.creditCardNumber : ''}" th:value="${user.defaultPayment != null ? user.defaultPayment.creditCardNumber : ''}"
pattern="[0-9]{6,16}" pattern="[0-9]{6,16}"
required/> required/>
<p th:if="${user.defaultPayment == null}" class="secondary card">
Da dies Ihre erste Bestellung ist, wird die Kreditkarte als Standartzahlungsmittel hinterlegt.
Sie kann unter den Nutzereinstellungen gelöscht oder geändert werden.
</p>
<small th:if="${user.defaultPayment != null}" class="no-padding">Die Standardkreditkarte kann unter
den <a href="/user/settings">Nutzereinstellungen</a> gelöscht oder geändert werden.</small>
</fieldset> </fieldset>
</div> </div>
<div> <div>

View File

@ -21,13 +21,14 @@
<main class="sidebar-layout content-width"> <main class="sidebar-layout content-width">
<nav th:replace="fragments/customer :: sidebar"></nav> <nav th:replace="fragments/customer :: sidebar"></nav>
<div class="content-width"> <div class="content-width">
<form method="POST" th:action="@{/user/settings/changeMail}"> <form class="detailflex" method="POST" th:action="@{/user/settings/changeMail}">
<div> <div>
<h2> Login Daten </h2> <h2> Login Daten </h2>
</div> </div>
<div> <div>
<div class="input-icon"> <div class="input-icon">
<input class="full-width" type="text" name="email" th:value="${user.email}" required/> <input class="full-width" type="text" name="email" th:value="${user.email}"
pattern="[^@\s]+@[^\.\s]+\.[^\s]+" required/>
<button> Email-Adresse ändern</button> <button> Email-Adresse ändern</button>
</div> </div>
</div> </div>

View File

@ -31,7 +31,7 @@
"shouldBeAdvertised": false "shouldBeAdvertised": false
}, },
{ {
"title": "Aeroheat CYLON PC-Geh<EFBFBD>use", "title": "Aeroheat CYLON PC-Gehäuse",
"manufacturer": "Aeroheat", "manufacturer": "Aeroheat",
"articleNumber": "acpcg", "articleNumber": "acpcg",
"vatPercent": 19, "vatPercent": 19,
@ -55,4 +55,4 @@
"shouldBeAdvertised": false "shouldBeAdvertised": false
} }
] ]
} }