Compare commits
39 Commits
65b4a9e54a
...
k-oshita
| Author | SHA1 | Date | |
|---|---|---|---|
| 6b207018db | |||
|
|
c470cc1970 | ||
|
|
edadbf86ec | ||
| 546a2927eb | |||
|
|
129d74a4df | ||
|
|
d3b76fb2cd | ||
|
|
67cc89d2a8 | ||
| 31b5e54023 | |||
| 1d34a2189d | |||
|
|
bbee55f58f | ||
|
|
f319fcb9f8 | ||
| c484d86c59 | |||
| 78d3042299 | |||
| ead133ba65 | |||
| 00c3041d95 | |||
| d27d8afbb3 | |||
|
|
d291306599 | ||
| 4ef6079004 | |||
| 04b15c4397 | |||
|
|
5c87473e55 | ||
| e6b1e676a6 | |||
| cbfd8d34b4 | |||
| b666b32214 | |||
| fd469405bc | |||
| a995a41656 | |||
|
|
fd1b098e3c | ||
|
|
0b9eff82c5 | ||
| 2a563d335c | |||
| 150b6287c4 | |||
|
|
000c1fa464 | ||
|
|
81b426b579 | ||
| 438ff59bc2 | |||
| 94b526a045 | |||
| 4a9a1d0898 | |||
| 759df536a5 | |||
| 98ebb86673 | |||
| 3a825196e1 | |||
| 718b90cee6 | |||
| 74b7032ffc |
@@ -10,6 +10,7 @@ import org.aspectj.lang.annotation.Pointcut;
|
|||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import com.example.demo.app.presentation.controller.pageproperty.SessionKeyword;
|
||||||
import com.example.demo.exception.NoSessionException;
|
import com.example.demo.exception.NoSessionException;
|
||||||
|
|
||||||
|
|
||||||
@@ -32,7 +33,7 @@ public class SessionCheckAspect {
|
|||||||
public void checkSession() {
|
public void checkSession() {
|
||||||
HttpSession session = request.getSession(false);
|
HttpSession session = request.getSession(false);
|
||||||
|
|
||||||
if (session == null || session.getAttribute("loginUser") == null) {
|
if (session == null || session.getAttribute(SessionKeyword.LOGIN_USER) == null) {
|
||||||
throw new NoSessionException("不正なログインです");
|
throw new NoSessionException("不正なログインです");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,8 @@ import org.springframework.web.HttpRequestMethodNotSupportedException;
|
|||||||
import org.springframework.web.bind.annotation.ControllerAdvice;
|
import org.springframework.web.bind.annotation.ControllerAdvice;
|
||||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||||
|
|
||||||
|
import com.example.demo.app.presentation.controller.pageproperty.PageReturnAttributeKeyword;
|
||||||
|
import com.example.demo.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword;
|
||||||
import com.example.demo.exception.NoSessionException;
|
import com.example.demo.exception.NoSessionException;
|
||||||
|
|
||||||
@ControllerAdvice
|
@ControllerAdvice
|
||||||
@@ -30,18 +32,18 @@ public class GlobalExceptionHandler {
|
|||||||
LOGGER.log(Level.SEVERE, SEVERE_ERROR_MESSAGE_ILLEGAL_TRANSITION, e);
|
LOGGER.log(Level.SEVERE, SEVERE_ERROR_MESSAGE_ILLEGAL_TRANSITION, e);
|
||||||
|
|
||||||
model.addAttribute(
|
model.addAttribute(
|
||||||
"errorMessage",
|
PageReturnAttributeKeyword.ERROR_MESSAGE,
|
||||||
"システムエラーが発生しました。"
|
"システムエラーが発生しました。"
|
||||||
+ "初めからやり直してください。");
|
+ "初めからやり直してください。");
|
||||||
|
|
||||||
return "redirect:/login";
|
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.LOGIN;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ExceptionHandler(HttpRequestMethodNotSupportedException.class)
|
@ExceptionHandler(HttpRequestMethodNotSupportedException.class)
|
||||||
public String handleBadRequestException(Model model, Exception e, HttpSession session) {
|
public String handleBadRequestException(Model model, Exception e, HttpSession session) {
|
||||||
model.addAttribute("error", SEVERE_ERROR_MESSAGE_BAD_REQUEST);
|
model.addAttribute(PageReturnAttributeKeyword.ERROR, SEVERE_ERROR_MESSAGE_BAD_REQUEST);
|
||||||
model.addAttribute("status", HttpStatus.BAD_REQUEST.value());
|
model.addAttribute(PageReturnAttributeKeyword.STATUS, HttpStatus.BAD_REQUEST.value());
|
||||||
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|
||||||
@@ -50,7 +52,7 @@ public class GlobalExceptionHandler {
|
|||||||
System.out.println("session invalidated");
|
System.out.println("session invalidated");
|
||||||
session.invalidate();
|
session.invalidate();
|
||||||
|
|
||||||
return "error";
|
return TransitionTargetPageNameKeyword.ERROR_HTML;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ExceptionHandler(Exception.class)
|
@ExceptionHandler(Exception.class)
|
||||||
@@ -60,6 +62,6 @@ public class GlobalExceptionHandler {
|
|||||||
|
|
||||||
System.out.println("session invalidated exception");
|
System.out.println("session invalidated exception");
|
||||||
session.invalidate();
|
session.invalidate();
|
||||||
return "error";
|
return TransitionTargetPageNameKeyword.ERROR_HTML;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -133,6 +133,8 @@ public class CourseServiceImpl implements CourseService {
|
|||||||
System.out.println("***********************ここでエラー1");
|
System.out.println("***********************ここでエラー1");
|
||||||
if (userEntity.getCourseEntity().getCourseId() == courseId) {
|
if (userEntity.getCourseEntity().getCourseId() == courseId) {
|
||||||
return "selected";
|
return "selected";
|
||||||
|
} else if (courseId <= 6) {
|
||||||
|
return "original";
|
||||||
}
|
}
|
||||||
System.out.println("***********************ここでエラー2");
|
System.out.println("***********************ここでエラー2");
|
||||||
allocationRepository.deleteByCourseId(courseId);
|
allocationRepository.deleteByCourseId(courseId);
|
||||||
|
|||||||
@@ -141,6 +141,10 @@ public class CourseController {
|
|||||||
|
|
||||||
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.COURSE;
|
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.COURSE;
|
||||||
|
|
||||||
|
} else if (condition.equals("original")) {
|
||||||
|
model.addAttribute("message", "既存のデータは削除できません");
|
||||||
|
|
||||||
|
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.COURSE;
|
||||||
} else if (condition.equals("ok")) {
|
} else if (condition.equals("ok")) {
|
||||||
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.COURSE;
|
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.COURSE;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,6 +57,8 @@ public class GoalController {
|
|||||||
|
|
||||||
Long userId = loginUser.getUserId();
|
Long userId = loginUser.getUserId();
|
||||||
|
|
||||||
|
LocalDate today = LocalDate.now();
|
||||||
|
|
||||||
goalService.updateGoalComplete(userId);
|
goalService.updateGoalComplete(userId);
|
||||||
|
|
||||||
List<GoalModel> goalModelList = goalService.getGoalByUserId(userId);
|
List<GoalModel> goalModelList = goalService.getGoalByUserId(userId);
|
||||||
@@ -64,7 +66,8 @@ public class GoalController {
|
|||||||
List<GoalForm> goalFormList1 = GoalForm.convertFrom(goalModelList);
|
List<GoalForm> goalFormList1 = GoalForm.convertFrom(goalModelList);
|
||||||
|
|
||||||
List<GoalForm> goalFormList = goalFormList1.stream()
|
List<GoalForm> goalFormList = goalFormList1.stream()
|
||||||
.filter(goalForm -> goalForm.getGoalComplete() == 0)
|
.filter(goalForm -> goalForm.getGoalComplete() == 0
|
||||||
|
&& !goalForm.getDeadline().isBefore(today))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
model.addAttribute(
|
model.addAttribute(
|
||||||
@@ -107,8 +110,6 @@ public class GoalController {
|
|||||||
1,
|
1,
|
||||||
1);
|
1);
|
||||||
|
|
||||||
LocalDate today = LocalDate.now();
|
|
||||||
|
|
||||||
Map<LocalDate, List<TransactionForm>> transactionFormMap = new HashMap<>();
|
Map<LocalDate, List<TransactionForm>> transactionFormMap = new HashMap<>();
|
||||||
|
|
||||||
transactionService
|
transactionService
|
||||||
@@ -238,7 +239,6 @@ public class GoalController {
|
|||||||
|
|
||||||
GoalForm goalForm = GoalForm.convertFrom(goalService.getGoalById(goalId));
|
GoalForm goalForm = GoalForm.convertFrom(goalService.getGoalById(goalId));
|
||||||
|
|
||||||
|
|
||||||
model.addAttribute(PageReturnAttributeKeyword.GOAL_FORM, goalForm);
|
model.addAttribute(PageReturnAttributeKeyword.GOAL_FORM, goalForm);
|
||||||
return TransitionTargetPageNameKeyword.GOAL_EDIT_HTML;
|
return TransitionTargetPageNameKeyword.GOAL_EDIT_HTML;
|
||||||
|
|
||||||
@@ -275,7 +275,9 @@ public class GoalController {
|
|||||||
|
|
||||||
int currentAmount = goalService.getCurrentAmount(userId);
|
int currentAmount = goalService.getCurrentAmount(userId);
|
||||||
|
|
||||||
model.addAttribute("currentAmount", currentAmount);
|
System.out.println("************************currentAmount : " + currentAmount);
|
||||||
|
|
||||||
|
session.setAttribute(PageReturnAttributeKeyword.CURRENT_AMOUNT, currentAmount);
|
||||||
|
|
||||||
return TransitionTargetPageNameKeyword.GOAL_CREATE_HTML;
|
return TransitionTargetPageNameKeyword.GOAL_CREATE_HTML;
|
||||||
}
|
}
|
||||||
@@ -305,7 +307,8 @@ public class GoalController {
|
|||||||
if (record == null) {
|
if (record == null) {
|
||||||
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.GOAL;
|
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.GOAL;
|
||||||
} else {
|
} else {
|
||||||
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.GOAL + TransitionTargetPageNameKeyword.RECORD;
|
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.GOAL
|
||||||
|
+ TransitionTargetPageNameKeyword.RECORD;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -314,6 +317,8 @@ public class GoalController {
|
|||||||
@GetMapping(TransitionTargetPageNameKeyword.RECORD)
|
@GetMapping(TransitionTargetPageNameKeyword.RECORD)
|
||||||
public String getRecord(HttpSession session, Model model) {
|
public String getRecord(HttpSession session, Model model) {
|
||||||
|
|
||||||
|
LocalDate today = LocalDate.now();
|
||||||
|
|
||||||
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
|
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
|
||||||
|
|
||||||
Long userId = loginUser.getUserId();
|
Long userId = loginUser.getUserId();
|
||||||
@@ -325,7 +330,13 @@ public class GoalController {
|
|||||||
List<GoalForm> goalCompleteFormList = new ArrayList<>();
|
List<GoalForm> goalCompleteFormList = new ArrayList<>();
|
||||||
|
|
||||||
goalFormList.stream().forEach(goalForm -> {
|
goalFormList.stream().forEach(goalForm -> {
|
||||||
if (goalForm.getGoalComplete() == 1) {
|
if (goalForm.getGoalComplete() == 1 || goalForm.getDeadline().isBefore(today)) {
|
||||||
|
|
||||||
|
goalForm.setStatus(
|
||||||
|
goalForm.getGoalComplete() == 1
|
||||||
|
? "達成"
|
||||||
|
: "未達成");
|
||||||
|
|
||||||
goalCompleteFormList.add(goalForm);
|
goalCompleteFormList.add(goalForm);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -297,6 +297,23 @@ public class TransactionController {
|
|||||||
transactionService.findMoneyRecord(transactionId),
|
transactionService.findMoneyRecord(transactionId),
|
||||||
CategoryForm.convertFrom(categoryService.findByTransactionId(transactionId)).getTransactionType());
|
CategoryForm.convertFrom(categoryService.findByTransactionId(transactionId)).getTransactionType());
|
||||||
|
|
||||||
|
List<CategoryForm> expenseList = new ArrayList<CategoryForm>();
|
||||||
|
|
||||||
|
List<CategoryForm> incomeList = new ArrayList<CategoryForm>();
|
||||||
|
|
||||||
|
for (CategoryForm categoryForm : categoryFormList) {
|
||||||
|
|
||||||
|
if (categoryForm.getTransactionType() == 0) {
|
||||||
|
expenseList.add(categoryForm);
|
||||||
|
} else {
|
||||||
|
incomeList.add(categoryForm);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
model.addAttribute(PageReturnAttributeKeyword.EXPENSE_LIST, expenseList);
|
||||||
|
model.addAttribute(PageReturnAttributeKeyword.INCOME_LIST, incomeList);
|
||||||
|
|
||||||
model.addAttribute(PageReturnAttributeKeyword.TRANSACTION_ID, transactionId);
|
model.addAttribute(PageReturnAttributeKeyword.TRANSACTION_ID, transactionId);
|
||||||
|
|
||||||
model.addAttribute(PageReturnAttributeKeyword.TRANSACTION_FORM, transactionForm);
|
model.addAttribute(PageReturnAttributeKeyword.TRANSACTION_FORM, transactionForm);
|
||||||
@@ -305,6 +322,8 @@ public class TransactionController {
|
|||||||
|
|
||||||
model.addAttribute(PageReturnAttributeKeyword.TODAY, today);
|
model.addAttribute(PageReturnAttributeKeyword.TODAY, today);
|
||||||
|
|
||||||
|
session.setAttribute(SessionKeyword.T_TYPE, transactionForm.getTransactionType());
|
||||||
|
|
||||||
return TransitionTargetPageNameKeyword.TRANSACTION_UPDATE_HTML;
|
return TransitionTargetPageNameKeyword.TRANSACTION_UPDATE_HTML;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -410,7 +429,7 @@ public class TransactionController {
|
|||||||
|
|
||||||
UserForm userForm = UserForm.convertFrom(userService.findByUserId(loginUser.getUserId()));
|
UserForm userForm = UserForm.convertFrom(userService.findByUserId(loginUser.getUserId()));
|
||||||
|
|
||||||
List<GoalForm> resultList = goalForm.stream().filter(goal -> goal.getGoalComplete() == 0)
|
List<GoalForm> resultList = goalForm.stream().filter(goal -> goal.getGoalComplete() == 0 && goal.getDeadline().isAfter(today) )
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
if (!resultList.isEmpty()) {
|
if (!resultList.isEmpty()) {
|
||||||
|
|||||||
@@ -4,7 +4,8 @@ public class PageReturnAttributeKeyword {
|
|||||||
|
|
||||||
public static final String ERROR_MESSAGE = "errorMessage";
|
public static final String ERROR_MESSAGE = "errorMessage";
|
||||||
public static final String MESSAGE = "message";
|
public static final String MESSAGE = "message";
|
||||||
|
public static final String ERROR = "error";
|
||||||
|
public static final String STATUS = "status";
|
||||||
|
|
||||||
public static final String QUESTION_LIST = "questionList";
|
public static final String QUESTION_LIST = "questionList";
|
||||||
public static final String USER_FORM = "userForm";
|
public static final String USER_FORM = "userForm";
|
||||||
|
|||||||
@@ -29,6 +29,8 @@ public class GoalForm {
|
|||||||
|
|
||||||
private Integer goalComplete;
|
private Integer goalComplete;
|
||||||
|
|
||||||
|
private String status;
|
||||||
|
|
||||||
private Integer achievementRate; // 達成率
|
private Integer achievementRate; // 達成率
|
||||||
|
|
||||||
private Integer currentAmount; // 現在の資産
|
private Integer currentAmount; // 現在の資産
|
||||||
@@ -43,6 +45,7 @@ public class GoalForm {
|
|||||||
goalModel.getTargetAmount(),
|
goalModel.getTargetAmount(),
|
||||||
goalModel.getDeadline(),
|
goalModel.getDeadline(),
|
||||||
goalModel.getGoalComplete(),
|
goalModel.getGoalComplete(),
|
||||||
|
null,
|
||||||
goalModel.getAchievementRate(),
|
goalModel.getAchievementRate(),
|
||||||
goalModel.getCurrentAmount(),
|
goalModel.getCurrentAmount(),
|
||||||
goalModel.getUserId());
|
goalModel.getUserId());
|
||||||
|
|||||||
@@ -46,6 +46,10 @@ body {
|
|||||||
border-top: 1px solid #d0d7de;
|
border-top: 1px solid #d0d7de;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.a-footer {
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
/* =======================
|
/* =======================
|
||||||
カード
|
カード
|
||||||
======================= */
|
======================= */
|
||||||
@@ -178,6 +182,10 @@ td:hover {
|
|||||||
text-align: right;
|
text-align: right;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.a-calender {
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
/* =======================
|
/* =======================
|
||||||
金額表示
|
金額表示
|
||||||
======================= */
|
======================= */
|
||||||
@@ -206,6 +214,10 @@ td:hover {
|
|||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.goal {
|
||||||
|
min-width: 300px;
|
||||||
|
}
|
||||||
|
|
||||||
/* =======================
|
/* =======================
|
||||||
ボタン
|
ボタン
|
||||||
======================= */
|
======================= */
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
<table class="table text-center">
|
<table class="table text-center">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="col">カテゴリ別</th>
|
<th scope="col"></th>
|
||||||
<th scope="col">支出</th>
|
<th scope="col">支出</th>
|
||||||
<th scope="col">前月比</th>
|
<th scope="col">前月比</th>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -47,7 +47,7 @@
|
|||||||
0
|
0
|
||||||
</td>
|
</td>
|
||||||
<td th:text="${analysisForm.totalDifferenceAmount >= 0}
|
<td th:text="${analysisForm.totalDifferenceAmount >= 0}
|
||||||
? '+' + ${analysisForm.totalDifferenceAmount}
|
? '+' + ${analysisForm.totalDifferenceAmount}
|
||||||
: ${analysisForm.totalDifferenceAmount}"
|
: ${analysisForm.totalDifferenceAmount}"
|
||||||
th:class="${analysisForm.totalDifferenceAmount >= 0}
|
th:class="${analysisForm.totalDifferenceAmount >= 0}
|
||||||
? 'text-danger'
|
? 'text-danger'
|
||||||
@@ -73,16 +73,14 @@
|
|||||||
|
|
||||||
<th scope="row"
|
<th scope="row"
|
||||||
th:text="${category.categoryName}">
|
th:text="${category.categoryName}">
|
||||||
食費
|
|
||||||
</th>
|
</th>
|
||||||
|
|
||||||
<td th:text="'¥' + ${category.currentMonthAmount}">
|
<td th:text="'¥' + ${category.currentMonthAmount}">
|
||||||
0
|
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
<span th:text="${category.monthDifferenceAmount >= 0}
|
<span th:text="${category.monthDifferenceAmount >= 0}
|
||||||
? '+' + ${category.monthDifferenceAmount}
|
? '+' + ${category.monthDifferenceAmount}
|
||||||
: ${category.monthDifferenceAmount}"
|
: ${category.monthDifferenceAmount}"
|
||||||
th:class="${category.monthDifferenceAmount >= 0}
|
th:class="${category.monthDifferenceAmount >= 0}
|
||||||
? 'text-danger'
|
? 'text-danger'
|
||||||
@@ -90,7 +88,7 @@
|
|||||||
</span>
|
</span>
|
||||||
<br>
|
<br>
|
||||||
<span th:text="${category.courseDifferenceAmount >= 0}
|
<span th:text="${category.courseDifferenceAmount >= 0}
|
||||||
? '+' + ${category.courseDifferenceAmount}
|
? '+' + ${category.courseDifferenceAmount}
|
||||||
: ${category.courseDifferenceAmount}"
|
: ${category.courseDifferenceAmount}"
|
||||||
th:class="${category.courseDifferenceAmount >= 0}
|
th:class="${category.courseDifferenceAmount >= 0}
|
||||||
? 'text-danger'
|
? 'text-danger'
|
||||||
|
|||||||
@@ -9,13 +9,13 @@
|
|||||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body class="pb-5 pt-5">
|
<body style="padding-top:80px; padding-bottom:80px;">
|
||||||
|
|
||||||
<div th:replace="~{header :: header}"></div>
|
<div th:replace="~{header :: header}"></div>
|
||||||
<div class="main-container">
|
<div class="main-container">
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<ul>
|
<ul class="list-unstyled p-0 m-0">
|
||||||
<li class="card shadow-sm mb-3" th:each="categoryForm : ${categoryFormList}">
|
<li class="card shadow-sm mb-3" th:each="categoryForm : ${categoryFormList}">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<div class="d-flex justify-content-between">
|
<div class="d-flex justify-content-between">
|
||||||
@@ -49,19 +49,29 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<hr>
|
|
||||||
<hr>
|
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="d-grid mt-4">
|
||||||
|
|
||||||
|
<form th:action="@{/category/create}" method="get">
|
||||||
|
|
||||||
<form th:action="@{/category/create}" method="get">
|
<input type="hidden"
|
||||||
<input type="hidden" name="today" id="today" th:value="${today}">
|
name="today"
|
||||||
<button type="submit">新規登録</button>
|
id="today"
|
||||||
</form>
|
th:value="${today}">
|
||||||
|
|
||||||
|
<button class="btn btn-success w-100" type="submit">
|
||||||
|
新規登録
|
||||||
|
</button>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
<div th:replace="~{footer :: footer}"></div>
|
<div th:replace="~{footer :: footer}"></div>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@@ -47,7 +47,7 @@
|
|||||||
<input type="hidden" name="categoryId" th:value="${categoryId}">
|
<input type="hidden" name="categoryId" th:value="${categoryId}">
|
||||||
|
|
||||||
<div class="d-grid">
|
<div class="d-grid">
|
||||||
<button type="submit" class="btn btn-primary">登録</button>
|
<button type="submit" class="btn btn-primary">更新</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
<link rel="stylesheet" th:href="@{/css/style.css}">
|
<link rel="stylesheet" th:href="@{/css/style.css}">
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body class="pb-5 pt-5">
|
<body style="padding-top:80px; padding-bottom:80px;">
|
||||||
|
|
||||||
<div th:replace="~{header :: header}"></div>
|
<div th:replace="~{header :: header}"></div>
|
||||||
<div class="main-container">
|
<div class="main-container">
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
<h2 class="page-title" th:text="${today}"></h2>
|
<h2 class="page-title" th:text="${today}"></h2>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<ul>
|
<ul class="list-unstyled p-0 m-0">
|
||||||
<li th:each="fixedCostForm : ${fixedCostFormList}" class="card shadow-sm mb-3">
|
<li th:each="fixedCostForm : ${fixedCostFormList}" class="card shadow-sm mb-3">
|
||||||
|
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
@@ -52,21 +52,29 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<hr>
|
|
||||||
<hr>
|
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</ul>
|
<div class="d-grid mt-4">
|
||||||
|
|
||||||
|
<form th:action="@{/fixed-cost/create}" method="get">
|
||||||
|
|
||||||
|
<input type="hidden"
|
||||||
|
name="today"
|
||||||
|
id="today"
|
||||||
|
th:value="${today}">
|
||||||
|
|
||||||
|
<button class="btn btn-success w-100" type="submit">
|
||||||
|
新規登録
|
||||||
|
</button>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<form th:action="@{/fixed-cost/create}" method="get">
|
|
||||||
<input type="hidden" name="today" id="today" th:value="${today}">
|
|
||||||
<button type="submit">新規登録</button>
|
|
||||||
</form>
|
|
||||||
|
|
||||||
<div th:replace="~{footer :: footer}"></div>
|
<div th:replace="~{footer :: footer}"></div>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,7 @@
|
|||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label" for="transactionType">収入・支出</label>
|
<label class="form-label" for="transactionType">収入・支出</label>
|
||||||
|
|
||||||
<select class="form-select" id="transactionType">
|
<select class="form-select" id="transactionType" required>
|
||||||
|
|
||||||
<option value="">選択してください</option>
|
<option value="">選択してください</option>
|
||||||
<option value="0">支出</option>
|
<option value="0">支出</option>
|
||||||
@@ -51,7 +51,7 @@
|
|||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label" for="categoryId">カテゴリ</label>
|
<label class="form-label" for="categoryId">カテゴリ</label>
|
||||||
|
|
||||||
<select class="form-select" id="categoryId" th:field="*{categoryId}">
|
<select class="form-select" id="categoryId" th:field="*{categoryId}" required>
|
||||||
<option value="">選択してください</option>
|
<option value="">選択してください</option>
|
||||||
|
|
||||||
<option class="expenseListClass" th:each="category : ${expenseList}"
|
<option class="expenseListClass" th:each="category : ${expenseList}"
|
||||||
|
|||||||
@@ -15,22 +15,22 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col border-end">
|
<div class="col border-end">
|
||||||
<button type="button" class="btn btn-link text-black text-decoration-none">
|
<button type="button" class="btn btn-link text-black text-decoration-none">
|
||||||
<a th:href="@{/transaction/create}">入力</a>
|
<a th:href="@{/transaction/create}" class="a-footer">入力</a>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="col border-end">
|
<div class="col border-end">
|
||||||
<button type="button" class="btn btn-link text-black text-decoration-none">
|
<button type="button" class="btn btn-link text-black text-decoration-none">
|
||||||
<a th:href="@{/transaction/list}">一覧</a>
|
<a th:href="@{/transaction/list}" class="a-footer">一覧</a>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="col border-end">
|
<div class="col border-end">
|
||||||
<button type="button" class="btn btn-link text-black text-decoration-none">
|
<button type="button" class="btn btn-link text-black text-decoration-none">
|
||||||
<a th:href="@{/analysis}">分析</a>
|
<a th:href="@{/analysis}" class="a-footer">分析</a>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="col border-end">
|
<div class="col border-end">
|
||||||
<button type="button" class="btn btn-link text-black text-decoration-none">
|
<button type="button" class="btn btn-link text-black text-decoration-none">
|
||||||
<a th:href="@{/goal}">目標</a>
|
<a th:href="@{/goal}" class="a-footer">目標</a>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -37,7 +37,9 @@
|
|||||||
<div>
|
<div>
|
||||||
<label>目標金額</label>
|
<label>目標金額</label>
|
||||||
<input type="number" th:field="*{targetAmount}" required min="1">
|
<input type="number" th:field="*{targetAmount}" required min="1">
|
||||||
<span th:text="|所持金:${currentAmount}円|"></span>
|
<br>
|
||||||
|
<span th:text="|所持金:${session.currentAmount}円|"></span>
|
||||||
|
<input type="hidden" name="currentAmount" th:value="${currentAmount}">
|
||||||
<span th:if="${message != null}">
|
<span th:if="${message != null}">
|
||||||
<span th:text="${message}" style="color: red;"></span>
|
<span th:text="${message}" style="color: red;"></span>
|
||||||
</span>
|
</span>
|
||||||
@@ -52,8 +54,11 @@
|
|||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<div th:replace="~{footer :: footer}"></div>
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div th:replace="~{footer :: footer}"></div>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body class="pb-5 pt-5">
|
<body style="padding-top:80px; padding-bottom:80px;">
|
||||||
|
|
||||||
<div th:replace="~{header :: header}"></div>
|
<div th:replace="~{header :: header}"></div>
|
||||||
|
|
||||||
@@ -47,6 +47,12 @@
|
|||||||
|
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
|
状態:
|
||||||
|
<span class="fw-bold" th:text="${goalForm.status}">
|
||||||
|
</span>
|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
@@ -74,16 +80,16 @@
|
|||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="d-grid mt-4">
|
|
||||||
<form th:action="@{/goal}" method="get">
|
|
||||||
|
|
||||||
<button class="btn btn-success w-100" type="submit">
|
|
||||||
戻る
|
|
||||||
</button>
|
|
||||||
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="d-grid mt-4">
|
||||||
|
<form th:action="@{/goal}" method="get">
|
||||||
|
<button class="btn btn-success w-100" type="submit">
|
||||||
|
戻る
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div th:replace="~{footer :: footer}"></div>
|
<div th:replace="~{footer :: footer}"></div>
|
||||||
|
|||||||
@@ -128,27 +128,32 @@
|
|||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<th>目標名</th>
|
<th>目標名</th>
|
||||||
<td th:text="${goalForm.goalTitle}"></td>
|
<td th:text="${goalForm.goalTitle}"
|
||||||
|
class="goal"></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<th>目標説明</th>
|
<th>目標説明</th >
|
||||||
<td th:text="${goalForm.goalSubtitle}"></td>
|
<td th:text="${goalForm.goalSubtitle}"
|
||||||
|
class="goal"></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<th>目標金額</th>
|
<th>目標金額</th>
|
||||||
<td th:text="${goalForm.targetAmount}"></td>
|
<td th:text="${goalForm.targetAmount}"
|
||||||
|
class="goal"></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<th>目標達成期限</th>
|
<th>目標達成期限</th>
|
||||||
<td th:text="${goalForm.deadline}"></td>
|
<td th:text="${goalForm.deadline}"
|
||||||
|
class="goal"></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<th>達成率</th>
|
<th>達成率</th>
|
||||||
<td th:text="${goalForm.achievementRate} + '%'"></td>
|
<td th:text="${goalForm.achievementRate} + '%'"
|
||||||
|
class="goal"></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
</table>
|
</table>
|
||||||
@@ -189,6 +194,8 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="d-grid gap-2 mt-4">
|
||||||
|
|
||||||
<form th:action="@{/goal/create}" method="get">
|
<form th:action="@{/goal/create}" method="get">
|
||||||
|
|
||||||
<button type="submit" class="btn btn-success w-100">
|
<button type="submit" class="btn btn-success w-100">
|
||||||
@@ -205,6 +212,8 @@
|
|||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
<div th:replace="~{footer :: footer}"></div>
|
<div th:replace="~{footer :: footer}"></div>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@@ -8,10 +8,9 @@
|
|||||||
|
|
||||||
<title>Calendar</title>
|
<title>Calendar</title>
|
||||||
|
|
||||||
<link rel="stylesheet" th:href="@{/css/style.css}">
|
|
||||||
|
|
||||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
|
|
||||||
|
<link rel="stylesheet" th:href="@{/css/style.css}">
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
@@ -64,7 +63,7 @@
|
|||||||
<a th:if="${week * 7 + weekDay - firstDayOfWeek + 1 >= 1
|
<a th:if="${week * 7 + weekDay - firstDayOfWeek + 1 >= 1
|
||||||
and week * 7 + weekDay - firstDayOfWeek + 1 <= lastDay}" th:href="@{/transaction/detail(
|
and week * 7 + weekDay - firstDayOfWeek + 1 <= lastDay}" th:href="@{/transaction/detail(
|
||||||
todayDates=${T(java.time.LocalDate).of(year, month, week * 7 + weekDay - firstDayOfWeek + 1)}
|
todayDates=${T(java.time.LocalDate).of(year, month, week * 7 + weekDay - firstDayOfWeek + 1)}
|
||||||
)}">
|
)}" class="a-footer">
|
||||||
|
|
||||||
|
|
||||||
<div
|
<div
|
||||||
|
|||||||
@@ -102,14 +102,14 @@
|
|||||||
required>
|
required>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
<div class="d-grid">
|
||||||
|
<button type="submit"
|
||||||
|
class="btn btn-primary">
|
||||||
|
編集
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="d-grid">
|
</div>
|
||||||
<button type="submit"
|
|
||||||
class="btn btn-primary">
|
|
||||||
確定
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
|||||||
@@ -5,17 +5,22 @@
|
|||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
|
<link rel="stylesheet" th:href="@{/css/style.css}">
|
||||||
<title>コース選択</title>
|
<title>コース選択</title>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body style="padding-bottom: 120px; padding-top: 60px;">
|
<body style="padding-bottom: 120px; padding-top: 80px;">
|
||||||
<div th:replace="~{header :: header}"></div>
|
<div th:replace="~{header :: header}"></div>
|
||||||
<h1 class="page-title">コース選択</h1>
|
<h1 class="page-title">コース選択</h1>
|
||||||
|
|
||||||
<th:block th:if="${mode == 'change'}">
|
<div class="d-grid gap-2 mt-4">
|
||||||
<form th:action="@{/course/create}" method="get">
|
<th:block th:if="${mode == 'change'}">
|
||||||
<button type="submit">新規登録</button>
|
<form th:action="@{/course/create}" method="get">
|
||||||
</form>
|
<button class="btn btn-success w-100" type="submit">
|
||||||
|
新規登録
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
</th:block>
|
||||||
|
|
||||||
</th:block>
|
</th:block>
|
||||||
<form th:action="${mode == 'regist'} ? @{/user/register/return}: @{/change}" id="totalForm" method="post">
|
<form th:action="${mode == 'regist'} ? @{/user/register/return}: @{/change}" id="totalForm" method="post">
|
||||||
@@ -31,7 +36,8 @@
|
|||||||
aria-controls="'collapse' + ${course.courseId}">
|
aria-controls="'collapse' + ${course.courseId}">
|
||||||
<span th:text="${course.courseName}"></span>
|
<span th:text="${course.courseName}"></span>
|
||||||
</button>
|
</button>
|
||||||
<p style="width: 120px;"><button type="button" class="btn btn-danger w-100"
|
|
||||||
|
<p th:if="${course.courseId > 6}" style="width: 120px;"><button type="button" class="btn btn-danger w-100"
|
||||||
th:attr="data-course-id=${course.courseId}" onclick="deleteCourse(this)">削除</button></p>
|
th:attr="data-course-id=${course.courseId}" onclick="deleteCourse(this)">削除</button></p>
|
||||||
</h2>
|
</h2>
|
||||||
<div th:id="'collapse' + ${course.courseId}" class="accordion-collapse collapse"
|
<div th:id="'collapse' + ${course.courseId}" class="accordion-collapse collapse"
|
||||||
@@ -54,6 +60,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
</div>
|
||||||
|
|
||||||
<th:block th:if="${mode=='change'}">
|
<th:block th:if="${mode=='change'}">
|
||||||
<div th:replace="~{footer :: footer}"></div>
|
<div th:replace="~{footer :: footer}"></div>
|
||||||
|
|||||||
@@ -3,10 +3,9 @@
|
|||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" name="viewport" content="width=device-width, initial-scale=1" http-equiv="Content-Type">
|
<meta charset="UTF-8" name="viewport" content="width=device-width, initial-scale=1" http-equiv="Content-Type">
|
||||||
<title>取引登録</title>
|
|
||||||
<link rel="stylesheet" th:href="@{/css/menu.css}">
|
|
||||||
|
|
||||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
|
<link rel="stylesheet" th:href="@{/css/style.css}">
|
||||||
|
<title>取引登録</title>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body style="padding-top:80px; padding-bottom:80px;">
|
<body style="padding-top:80px; padding-bottom:80px;">
|
||||||
@@ -114,58 +113,70 @@
|
|||||||
|
|
||||||
<div th:replace="~{footer :: footer}"></div>
|
<div th:replace="~{footer :: footer}"></div>
|
||||||
|
|
||||||
<script inline="javascript">
|
<script th:inline="javascript">
|
||||||
const transactionType = document.getElementById("transactionType");
|
const transactionType = document.getElementById("transactionType");
|
||||||
const categoryId = document.getElementById("categoryId");
|
const categoryId = document.getElementById("categoryId");
|
||||||
|
|
||||||
const expenseList = document.getElementsByClassName("expenseListClass");
|
const expenseList = document.getElementsByClassName("expenseListClass");
|
||||||
const incomeList = document.getElementsByClassName("incomeListClass");
|
const incomeList = document.getElementsByClassName("incomeListClass");
|
||||||
|
|
||||||
const tType = '[[${session.tType}]]';
|
const tType = '[[${session.tType}]]';
|
||||||
|
|
||||||
if (tType == "0") {
|
console.log("tType: " + tType);
|
||||||
transactionType.value = 0;
|
|
||||||
} else {
|
if (tType.includes("0")) {
|
||||||
transactionType.value = 1;
|
console.log("okokokokokokokkkokokokoko");
|
||||||
}
|
transactionType.value = "0";
|
||||||
|
} else if (tType.includes("1")) {
|
||||||
|
transactionType.value = "1";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
transactionType.addEventListener("change", function () {
|
function toggleCategory() {
|
||||||
|
|
||||||
if (this.value === "0") {
|
if (transactionType.value === "0") {
|
||||||
|
|
||||||
for (let i = 0; i < expenseList.length; i++) {
|
for (let i = 0; i < expenseList.length; i++) {
|
||||||
expenseList[i].style.display = "";
|
expenseList[i].style.display = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
for (let i = 0; i < incomeList.length; i++) {
|
for (let i = 0; i < incomeList.length; i++) {
|
||||||
incomeList[i].style.display = "none";
|
incomeList[i].style.display = "none";
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (this.value === "1") {
|
} else if (transactionType.value === "1") {
|
||||||
|
|
||||||
for (let i = 0; i < expenseList.length; i++) {
|
for (let i = 0; i < expenseList.length; i++) {
|
||||||
expenseList[i].style.display = "none";
|
expenseList[i].style.display = "none";
|
||||||
}
|
}
|
||||||
|
|
||||||
for (let i = 0; i < incomeList.length; i++) {
|
for (let i = 0; i < incomeList.length; i++) {
|
||||||
incomeList[i].style.display = "";
|
incomeList[i].style.display = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
for (let i = 0; i < expenseList.length; i++) {
|
for (let i = 0; i < expenseList.length; i++) {
|
||||||
expenseList[i].style.display = "none";
|
expenseList[i].style.display = "none";
|
||||||
}
|
}
|
||||||
|
|
||||||
for (let i = 0; i < incomeList.length; i++) {
|
for (let i = 0; i < incomeList.length; i++) {
|
||||||
incomeList[i].style.display = "none";
|
incomeList[i].style.display = "none";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
categoryId.value = "";
|
transactionType.addEventListener("change", function () {
|
||||||
});
|
|
||||||
</script>
|
toggleCategory();
|
||||||
|
|
||||||
|
categoryId.value = "";
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
toggleCategory();
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@@ -83,21 +83,36 @@
|
|||||||
カテゴリ
|
カテゴリ
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<select id="categoryId"
|
<!-- <select id="categoryId"-->
|
||||||
class="form-select"
|
<!-- class="form-select"-->
|
||||||
th:field="*{categoryId}"
|
<!-- th:field="*{categoryId}"-->
|
||||||
required>
|
<!-- required>-->
|
||||||
|
|
||||||
<option value="">
|
<!-- <option value="">-->
|
||||||
選択してください
|
<!-- 選択してください-->
|
||||||
</option>
|
<!-- </option>-->
|
||||||
|
|
||||||
<option th:each="category : ${categoryFormList}"
|
<!-- <option th:each="category : ${categoryFormList}"-->
|
||||||
th:value="${category.categoryId}"
|
<!-- th:value="${category.categoryId}"-->
|
||||||
th:text="${category.categoryName}">
|
<!-- th:text="${category.categoryName}">-->
|
||||||
</option>
|
<!-- </option>-->
|
||||||
|
|
||||||
</select>
|
<!-- </select>-->
|
||||||
|
<select id="categoryId" class="form-select" th:field="*{categoryId}" required>
|
||||||
|
|
||||||
|
<option value="">
|
||||||
|
選択してください
|
||||||
|
</option>
|
||||||
|
|
||||||
|
<option class="expenseListClass" th:each="category : ${expenseList}"
|
||||||
|
th:value="${category.categoryId}" th:text="${category.categoryName}">
|
||||||
|
</option>
|
||||||
|
|
||||||
|
<option class="incomeListClass" th:each="category : ${incomeList}"
|
||||||
|
th:value="${category.categoryId}" th:text="${category.categoryName}">
|
||||||
|
</option>
|
||||||
|
|
||||||
|
</select>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -141,6 +156,68 @@
|
|||||||
<div th:replace="~{footer :: footer}">
|
<div th:replace="~{footer :: footer}">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<script th:inline="javascript">
|
||||||
|
const transactionType = document.getElementById("transactionType");
|
||||||
|
const categoryId = document.getElementById("categoryId");
|
||||||
|
|
||||||
|
const expenseList = document.getElementsByClassName("expenseListClass");
|
||||||
|
const incomeList = document.getElementsByClassName("incomeListClass");
|
||||||
|
|
||||||
|
const tType = '[[${session.tType}]]';
|
||||||
|
|
||||||
|
function toggleCategory() {
|
||||||
|
|
||||||
|
if (transactionType.value === "0") {
|
||||||
|
|
||||||
|
for (let i = 0; i < expenseList.length; i++) {
|
||||||
|
expenseList[i].style.display = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
for (let i = 0; i < incomeList.length; i++) {
|
||||||
|
incomeList[i].style.display = "none";
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (transactionType.value === "1") {
|
||||||
|
|
||||||
|
for (let i = 0; i < expenseList.length; i++) {
|
||||||
|
expenseList[i].style.display = "none";
|
||||||
|
}
|
||||||
|
|
||||||
|
for (let i = 0; i < incomeList.length; i++) {
|
||||||
|
incomeList[i].style.display = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
for (let i = 0; i < expenseList.length; i++) {
|
||||||
|
expenseList[i].style.display = "none";
|
||||||
|
}
|
||||||
|
|
||||||
|
for (let i = 0; i < incomeList.length; i++) {
|
||||||
|
incomeList[i].style.display = "none";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
transactionType.addEventListener("change", function () {
|
||||||
|
|
||||||
|
toggleCategory();
|
||||||
|
|
||||||
|
categoryId.value = "";
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
if (tType == "0") {
|
||||||
|
transactionType.value = "0";
|
||||||
|
} else if (tType == "1") {
|
||||||
|
transactionType.value = "1";
|
||||||
|
}
|
||||||
|
|
||||||
|
toggleCategory();
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
Reference in New Issue
Block a user