Commit 5f73c2ba authored by keita.onoguchi's avatar keita.onoguchi

Merge branch 'カート編集' into 'master'

カート編集

See merge request !65
parents f7a017cb 5981258d
......@@ -129,6 +129,11 @@ public class EcsiteRestController {
}else {
cart.put(id , itemsService.findOne(data.getShoesId(),data.getQuantity()));
}
if(cart.size() == 0) {
session.removeAttribute("cart");
session.removeAttribute("cartValue");
return cart;
}
session.setAttribute("cart", cart);
return cart;
}
......
......@@ -131,13 +131,13 @@ public class EcsiteController {
public String history (@PathVariable Integer id, Model model, SalesLog salesLog, @AuthenticationPrincipal LoginUser userDetails) {
User user = userDetails.getUser();
model.addAttribute("user", user);
List<SalesLog> list = salesLogService.history(id);
model.addAttribute("log", list);
if(session.getAttribute("cartValue") == null) {
model.addAttribute("cartValue", 0);
}else {
model.addAttribute("cartValue",session.getAttribute("cartValue"));
}
List<SalesLog> list = salesLogService.history(id);
model.addAttribute("log", list);
return "log";
}
......@@ -146,16 +146,16 @@ public class EcsiteController {
public String historyDetails (@PathVariable Date created, Model model, @AuthenticationPrincipal LoginUser userDetails) {
User user = userDetails.getUser();
model.addAttribute("user", user);
if(salesLogService.historyDetails(created, user.getId()) == null){
return "logDetails";
}
List<SalesLog> list = salesLogService.historyDetails(created, user.getId());
model.addAttribute("logDetails", list);
if(session.getAttribute("cartValue") == null) {
model.addAttribute("cartValue", 0);
}else {
model.addAttribute("cartValue",session.getAttribute("cartValue"));
}
if(salesLogService.historyDetails(created, user.getId()) == null){
return "logDetails";
}
List<SalesLog> list = salesLogService.historyDetails(created, user.getId());
model.addAttribute("logDetails", list);
return "logDetails";
}
......
......@@ -115,7 +115,7 @@
<td class="tdCart"><p th:text= "${cart.shoesName}" class="textP">Convers All Star</p></td>
<td class="tdCart"><input type="number" min="0" th:value="${cart.quantity}" class="textP itemCount"></input></td>
<td class="tdCart"><p th:text= "${cart.price}" class="textP">&yen;10000</p></td>
<td class="tdCart"><button type="button" class="itemCountChange">数変更確定</button></td>
<td class="tdCart"><button type="button" class="itemCountChange">Change</button></td>
</tr>
</div>
</tbody>
......
<!doctype html>
<html class="no-js" lang="en" xmlns:th="http://www.thymeleaf.org">
<html class="no-js" lang="ja" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="utf-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
......@@ -70,8 +70,8 @@
</ul>
<ul class="nav navbar-nav navbar-right cart-menu">
<li><a class="search-btn"><i class="fa fa-search" aria-hidden="true"></i></a></li>
<li><a th:href="@{/limited/cart}"><span> Cart</span> <span class="shoping-cart" th:text="${cartValue}">0</span></a></li>
</ul>
<li><a th:href="@{/limited/cart}"><span> Cart</span> <span class="shoping-cart" id="shoping-cart-span" th:text="${cartValue}">0</span></a></li>
</ul>
</div><!-- /.navbar-collapse -->
</div><!-- /.container -->
</nav>
......@@ -79,7 +79,7 @@
<!-- ログインフォーム -->
<div class="container">
<p id="log-p-text"><span id="log-text">Purchase History</span></p>
<p id="log-p-text"><span id="log-text" >Purchase History</span></p>
<!--<form id="login-form" method="post" th:action="@{/login}">
<div id="email-form">
<label for="login-email">Email</label>
......
......@@ -70,7 +70,7 @@
</ul>
<ul class="nav navbar-nav navbar-right cart-menu">
<li><a class="search-btn"><i class="fa fa-search" aria-hidden="true"></i></a></li>
<li><a th:href="@{/limited/cart}"><span> Cart</span> <span class="shoping-cart" th:text="${cartValue}">0</span></a></li>
<li class="active"><a th:href="@{/limited/cart}"><span> Cart</span> <span class="shoping-cart" th:text="${cartValue}">0</span></a></li>
</ul>
</div><!-- /.navbar-collapse -->
</div><!-- /.container -->
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment