7 Commits

19 changed files with 178 additions and 58 deletions

View File

@@ -25,6 +25,8 @@ public class GoalModel {
private Integer goalComplete; private Integer goalComplete;
private Integer achievementRate; // 達成率 private Integer achievementRate; // 達成率
private Integer currentAmount; // 現在の資産
public static GoalModel convertFrom(GoalEntity goalEntity) { public static GoalModel convertFrom(GoalEntity goalEntity) {
return new GoalModel( return new GoalModel(
@@ -34,7 +36,7 @@ public class GoalModel {
goalEntity.getTargetAmount(), goalEntity.getTargetAmount(),
goalEntity.getDeadline(), goalEntity.getDeadline(),
goalEntity.getGoalComplete(), goalEntity.getGoalComplete(),
null); null,null);
} }
public static GoalEntity convertTo(GoalModel goalModel) { public static GoalEntity convertTo(GoalModel goalModel) {
@@ -56,7 +58,7 @@ public class GoalModel {
goalForm.getTargetAmount(), goalForm.getTargetAmount(),
goalForm.getDeadline(), goalForm.getDeadline(),
goalForm.getGoalComplete() goalForm.getGoalComplete()
,null); ,null,null);
} }
} }

View File

@@ -4,6 +4,9 @@ import com.example.demo.app.domain.model.AnalysisModel;
public interface AnalysisService { public interface AnalysisService {
AnalysisModel getAnalysis(Long userId); AnalysisModel getAnalysis(
Long userId,
Integer year,
Integer month);
} }

View File

@@ -8,4 +8,6 @@ public interface CourseService {
public List<CourseModel> findAll(); public List<CourseModel> findAll();
public CourseModel findById(Long courseId);
} }

View File

@@ -30,7 +30,7 @@ public class AnalysisServiceImpl implements AnalysisService {
private final CategoryRepository categoryRepository; private final CategoryRepository categoryRepository;
@Override @Override
public AnalysisModel getAnalysis(Long userId) { public AnalysisModel getAnalysis(Long userId, Integer year, Integer month) {
// ユーザー情報取得、月別使用可能資金取得 // ユーザー情報取得、月別使用可能資金取得
UserEntity userEntity = userRepository.findById(userId).orElseThrow(() -> UserEntity userEntity = userRepository.findById(userId).orElseThrow(() ->
@@ -44,12 +44,15 @@ public class AnalysisServiceImpl implements AnalysisService {
Integer monthlyBudget =userEntity.getMonthlyBudget(); Integer monthlyBudget =userEntity.getMonthlyBudget();
// 今月の期間取得 // 今月の期間取得
LocalDate currentMonthStartDate = LocalDate.now().withDayOfMonth(1); LocalDate targetDate = LocalDate.of(year, month, 1);
LocalDate currentMonthEndDate = LocalDate.now().withDayOfMonth(LocalDate.now().lengthOfMonth()); LocalDate currentMonthStartDate = targetDate.withDayOfMonth(1);
LocalDate currentMonthEndDate = targetDate.withDayOfMonth(targetDate.lengthOfMonth());
// 前月の期間取得 // 前月の期間取得
LocalDate previousMonthStartDate = LocalDate.now().minusMonths(1).withDayOfMonth(1); LocalDate previousDate = targetDate.minusMonths(1);
LocalDate previousMonthEndDate = LocalDate.now().minusMonths(1).withDayOfMonth(LocalDate.now().minusMonths(1).lengthOfMonth());
LocalDate previousMonthStartDate = previousDate.withDayOfMonth(1);
LocalDate previousMonthEndDate = previousDate.withDayOfMonth(previousDate.lengthOfMonth());
// 今月の支出取得 // 今月の支出取得
Integer currentMonthTotalAmount = transactionRepository.findTotalExpense(currentMonthStartDate, currentMonthEndDate, userId); Integer currentMonthTotalAmount = transactionRepository.findTotalExpense(currentMonthStartDate, currentMonthEndDate, userId);

View File

@@ -21,4 +21,8 @@ public class CourseServiceImpl implements CourseService {
return CourseEntity.createCourseModelList(courseRepository.findAll()); return CourseEntity.createCourseModelList(courseRepository.findAll());
} }
public CourseModel findById(Long courseId) {
return CourseModel.convertFrom(courseRepository.findByCourseId(courseId));
}
} }

View File

@@ -56,7 +56,8 @@ public class GoalServiceImpl implements GoalService {
goalModel.getTargetAmount(), goalModel.getTargetAmount(),
goalModel.getDeadline(), goalModel.getDeadline(),
goalModel.getGoalComplete(), goalModel.getGoalComplete(),
achievementRate); achievementRate,
currentAmount);
} }
@Override @Override

View File

@@ -1,9 +1,14 @@
package com.example.demo.app.infra.repository; package com.example.demo.app.infra.repository;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import com.example.demo.app.infra.entity.CourseEntity; import com.example.demo.app.infra.entity.CourseEntity;
public interface CourseRepository extends JpaRepository<CourseEntity, Long> { public interface CourseRepository extends JpaRepository<CourseEntity, Long> {
@Query("SELECT c FROM CourseEntity c WHERE c.courseId = :courseId ")
public CourseEntity findByCourseId(Long courseId);
} }

View File

@@ -1,11 +1,15 @@
package com.example.demo.app.presentation.controller; package com.example.demo.app.presentation.controller;
import java.time.LocalDate;
import jakarta.servlet.http.HttpSession; import jakarta.servlet.http.HttpSession;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.ui.Model; import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import com.example.demo.aop.aspect.SessionCheck;
import com.example.demo.app.domain.model.AnalysisModel; import com.example.demo.app.domain.model.AnalysisModel;
import com.example.demo.app.domain.model.LoginModel; import com.example.demo.app.domain.model.LoginModel;
import com.example.demo.app.domain.service.AnalysisService; import com.example.demo.app.domain.service.AnalysisService;
@@ -20,19 +24,47 @@ public class AnalysisController {
private final AnalysisService analysisService; private final AnalysisService analysisService;
@SessionCheck
@GetMapping("/analysis") @GetMapping("/analysis")
public String showAnalysis(Model model, HttpSession session) { public String showAnalysis(
@RequestParam(required = false) Integer year,
@RequestParam(required = false) Integer month,
Model model,
HttpSession session) {
//ログインユーザーの取得(セッション) //ログインユーザーの取得(セッション)
LoginModel loginUser = (LoginModel) session.getAttribute("loginUser"); LoginModel loginUser = (LoginModel) session.getAttribute("loginUser");
//初期年月表示
LocalDate nowDate = LocalDate.now();
if (year == null) {
year = nowDate.getYear();
}
if (month == null) {
month = nowDate.getMonthValue();
}
//前月・翌月作成
LocalDate targetDate = LocalDate.of(year, month, 1);
LocalDate previousDate = targetDate.minusMonths(1);
LocalDate nextDate = targetDate.plusMonths(1);
//分析結果の取得(Service) //分析結果の取得(Service)
AnalysisModel analysisModel = analysisService.getAnalysis(loginUser.getUserId()); AnalysisModel analysisModel = analysisService.getAnalysis(loginUser.getUserId(), year, month);
AnalysisForm analysisForm = AnalysisForm.convertFrom(analysisModel); AnalysisForm analysisForm = AnalysisForm.convertFrom(analysisModel);
//model格納 //model格納
model.addAttribute("analysisForm", analysisForm); model.addAttribute("analysisForm", analysisForm);
model.addAttribute("year", year);
model.addAttribute("month", month);
model.addAttribute("previousYear", previousDate.getYear());
model.addAttribute("previousMonth", previousDate.getMonthValue());
model.addAttribute("nextYear", nextDate.getYear());
model.addAttribute("nextMonth", nextDate.getMonthValue());
return "analysis"; return "analysis";
} }

View File

@@ -7,6 +7,7 @@ import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import com.example.demo.aop.aspect.SessionCheck;
import com.example.demo.app.domain.model.AuthenticationModel; import com.example.demo.app.domain.model.AuthenticationModel;
import com.example.demo.app.domain.service.AuthenticationService; import com.example.demo.app.domain.service.AuthenticationService;
import com.example.demo.app.infra.repository.QuestionRepository; import com.example.demo.app.infra.repository.QuestionRepository;
@@ -21,6 +22,7 @@ public class AuthenticationController {
private final AuthenticationService authenticationService; private final AuthenticationService authenticationService;
private final QuestionRepository questionRepository; private final QuestionRepository questionRepository;
@SessionCheck
@GetMapping("/authentication") @GetMapping("/authentication")
public String showAuthentication(Model model) { public String showAuthentication(Model model) {
@@ -29,7 +31,8 @@ public class AuthenticationController {
return "authentication"; return "authentication";
} }
@SessionCheck
@PostMapping("/authentication") @PostMapping("/authentication")
public String authenticate( public String authenticate(
AuthenticationForm authenticationForm, AuthenticationForm authenticationForm,

View File

@@ -7,24 +7,25 @@ import jakarta.servlet.http.HttpSession;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.ui.Model; import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import com.example.demo.aop.aspect.SessionCheck;
import com.example.demo.app.domain.model.LoginModel; import com.example.demo.app.domain.model.LoginModel;
import com.example.demo.app.domain.model.UserModel;
import com.example.demo.app.domain.service.CourseInfoService; import com.example.demo.app.domain.service.CourseInfoService;
import com.example.demo.app.domain.service.CourseService; import com.example.demo.app.domain.service.CourseService;
import com.example.demo.app.domain.service.UserService; import com.example.demo.app.domain.service.UserService;
import com.example.demo.app.presentation.form.CourseForm; import com.example.demo.app.presentation.form.CourseForm;
import com.example.demo.app.presentation.form.CourseInfoForm; import com.example.demo.app.presentation.form.CourseInfoForm;
import com.example.demo.app.presentation.form.UserForm;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
@Controller @Controller
@RequestMapping("/course") //@RequestMapping("/course")
@RequiredArgsConstructor @RequiredArgsConstructor
public class CourseController { public class CourseController {
@@ -38,15 +39,18 @@ public class CourseController {
private final UserService userService; private final UserService userService;
@SessionCheck
@PostMapping("/select/register") @GetMapping("/course/select/register")
public String showSelectCourse(@ModelAttribute UserModel userModel, Model model) { public String showSelectCourse(@ModelAttribute UserForm userForm, Model model, HttpSession session) {
try { try {
System.out.println(userForm.getMailAddress());
model.addAttribute("mode", "select"); session.setAttribute("userForm", userForm);
model.addAttribute("mode", "regist");
model.addAttribute("courseList", CourseForm.convertFrom(courseService.findAll())); model.addAttribute("courseList", CourseForm.convertFrom(courseService.findAll()));
model.addAttribute("courseInfoList", CourseInfoForm.convertFrom(courseInfoService.findAll())); model.addAttribute("courseInfoList", CourseInfoForm.convertFrom(courseInfoService.findAll()));
return "select_course"; return "select_course";
@@ -63,7 +67,8 @@ public class CourseController {
} }
} }
@PostMapping("/select/change") @SessionCheck
@GetMapping("/select/change")
public String showChangeCourse(Model model) { public String showChangeCourse(Model model) {
try { try {
@@ -87,6 +92,7 @@ public class CourseController {
} }
} }
@SessionCheck
@PostMapping("/change") @PostMapping("/change")
public String changeCourse(@RequestParam Long courseId) { public String changeCourse(@RequestParam Long courseId) {

View File

@@ -9,6 +9,7 @@ import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import com.example.demo.aop.aspect.SessionCheck;
import com.example.demo.app.domain.model.GoalModel; import com.example.demo.app.domain.model.GoalModel;
import com.example.demo.app.domain.model.LoginModel; import com.example.demo.app.domain.model.LoginModel;
import com.example.demo.app.domain.service.GoalService; import com.example.demo.app.domain.service.GoalService;
@@ -23,6 +24,7 @@ public class GoalController {
private final GoalService goalService; private final GoalService goalService;
@SessionCheck
@GetMapping("") @GetMapping("")
public String getGoal(Model model, HttpSession session) { public String getGoal(Model model, HttpSession session) {
@@ -37,6 +39,7 @@ public class GoalController {
return "goal_view"; return "goal_view";
} }
@SessionCheck
@GetMapping("/edit") @GetMapping("/edit")
public String editGoal(Model model, HttpSession session) { public String editGoal(Model model, HttpSession session) {
@@ -50,6 +53,7 @@ public class GoalController {
return "goal_edit"; return "goal_edit";
} }
@SessionCheck
@PostMapping("/update") @PostMapping("/update")
public String updateGoal(@ModelAttribute GoalForm goalForm, HttpSession session) { public String updateGoal(@ModelAttribute GoalForm goalForm, HttpSession session) {

View File

@@ -8,6 +8,7 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import com.example.demo.aop.aspect.SessionCheck;
import com.example.demo.app.domain.model.LoginModel; import com.example.demo.app.domain.model.LoginModel;
import com.example.demo.app.domain.model.ProfileModel; import com.example.demo.app.domain.model.ProfileModel;
import com.example.demo.app.domain.service.ProfileService; import com.example.demo.app.domain.service.ProfileService;
@@ -21,6 +22,7 @@ import lombok.RequiredArgsConstructor;
public class ProfileController { public class ProfileController {
private final ProfileService profileService; private final ProfileService profileService;
@SessionCheck
@GetMapping("/profile") @GetMapping("/profile")
public String profile(Model model, HttpSession session) { public String profile(Model model, HttpSession session) {
LoginModel loginUser = (LoginModel) session.getAttribute("loginUser"); LoginModel loginUser = (LoginModel) session.getAttribute("loginUser");
@@ -33,6 +35,7 @@ public class ProfileController {
return "profile"; return "profile";
} }
@SessionCheck
@GetMapping("/profile/edit") @GetMapping("/profile/edit")
public String showEditProfile( public String showEditProfile(
Model model, Model model,
@@ -84,6 +87,7 @@ public class ProfileController {
return "redirect:/login"; return "redirect:/login";
} }
@PostMapping("/logout") @PostMapping("/logout")
public String logout(HttpSession session) { public String logout(HttpSession session) {
session.invalidate(); session.invalidate();

View File

@@ -17,6 +17,7 @@ import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import com.example.demo.aop.aspect.SessionCheck;
import com.example.demo.app.domain.model.LoginModel; import com.example.demo.app.domain.model.LoginModel;
import com.example.demo.app.domain.service.CategoryService; import com.example.demo.app.domain.service.CategoryService;
import com.example.demo.app.domain.service.GoalService; import com.example.demo.app.domain.service.GoalService;
@@ -41,6 +42,7 @@ public class TransactionController {
private final UserService userService; private final UserService userService;
// 一覧画面 // 一覧画面
@SessionCheck
@GetMapping("/transaction/list") @GetMapping("/transaction/list")
public String transactionList( public String transactionList(
@RequestParam(required = false, defaultValue = "0") String years, @RequestParam(required = false, defaultValue = "0") String years,
@@ -124,6 +126,7 @@ public class TransactionController {
} }
// 詳細画面 // 詳細画面
@SessionCheck
@GetMapping("/transaction/detail") @GetMapping("/transaction/detail")
public String findOne(@RequestParam(required = false) LocalDate todayDates, Model model, HttpSession session) { public String findOne(@RequestParam(required = false) LocalDate todayDates, Model model, HttpSession session) {
@@ -176,6 +179,7 @@ public class TransactionController {
return "transaction_detail"; return "transaction_detail";
} }
@SessionCheck
@GetMapping("/transaction/create") @GetMapping("/transaction/create")
public String createOneGet(@RequestParam(defaultValue = "") LocalDate today, public String createOneGet(@RequestParam(defaultValue = "") LocalDate today,
Model model) { Model model) {
@@ -200,6 +204,7 @@ public class TransactionController {
return "transaction_create"; return "transaction_create";
} }
@SessionCheck
@PostMapping("/transaction/create") @PostMapping("/transaction/create")
public String createOnePost(@ModelAttribute TransactionForm transactionForm, @RequestParam LocalDate today, public String createOnePost(@ModelAttribute TransactionForm transactionForm, @RequestParam LocalDate today,
Model model, Model model,
@@ -215,6 +220,7 @@ public class TransactionController {
} }
@SessionCheck
@GetMapping("/transaction/update") @GetMapping("/transaction/update")
public String updateOneGet(@RequestParam Long transactionId, @RequestParam(defaultValue = "") LocalDate today, public String updateOneGet(@RequestParam Long transactionId, @RequestParam(defaultValue = "") LocalDate today,
Model model) { Model model) {
@@ -246,6 +252,7 @@ public class TransactionController {
} }
@SessionCheck
@PostMapping("/transaction/update") @PostMapping("/transaction/update")
public String updateOnePost(@RequestParam Long transactionId, @ModelAttribute TransactionForm transactionForm, public String updateOnePost(@RequestParam Long transactionId, @ModelAttribute TransactionForm transactionForm,
@RequestParam LocalDate today, Model model, @RequestParam LocalDate today, Model model,
@@ -264,6 +271,7 @@ public class TransactionController {
} }
@SessionCheck
@PostMapping("/transaction/delete") @PostMapping("/transaction/delete")
public String deleteOne(@RequestParam Long transactionId, @RequestParam LocalDate today) { public String deleteOne(@RequestParam Long transactionId, @RequestParam LocalDate today) {
@@ -271,6 +279,7 @@ public class TransactionController {
return "redirect:/transaction/detail?todayDates=" + today; return "redirect:/transaction/detail?todayDates=" + today;
} }
@SessionCheck
@GetMapping("/menu") @GetMapping("/menu")
public String menu(HttpSession session, Model model, public String menu(HttpSession session, Model model,
@RequestParam(required = false, defaultValue = "0") String years, @RequestParam(required = false, defaultValue = "0") String years,
@@ -335,6 +344,8 @@ public class TransactionController {
UserForm userForm = UserForm.convertFrom(userService.findByUserId(loginUser.getUserId())); UserForm userForm = UserForm.convertFrom(userService.findByUserId(loginUser.getUserId()));
model.addAttribute("achievementRate", goalForm.getAchievementRate()); model.addAttribute("achievementRate", goalForm.getAchievementRate());
model.addAttribute("currentAmount", goalForm.getCurrentAmount());
model.addAttribute("targetAmount", goalForm.getTargetAmount()); model.addAttribute("targetAmount", goalForm.getTargetAmount());

View File

@@ -7,24 +7,45 @@ import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import com.example.demo.app.domain.service.CourseService;
import com.example.demo.app.presentation.form.UserForm; import com.example.demo.app.presentation.form.UserForm;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
@Controller @Controller
@RequiredArgsConstructor @RequiredArgsConstructor
public class UserController { public class UserController {
private final CourseService courseService;
@GetMapping("/user/register") @GetMapping("/user/register")
public String showRegister(Model model, HttpSession session) { public String showRegister(Model model, HttpSession session) {
UserForm userForm = new UserForm();
model.addAttribute("userForm", userForm);
return "user_register";
}
@PostMapping("/user/register/return")
public String showRegisterReturn(@RequestParam(required = false) Long courseId, Model model, HttpSession session) {
UserForm userForm = (UserForm) session.getAttribute("userForm"); UserForm userForm = (UserForm) session.getAttribute("userForm");
if(userForm == null) { if(userForm == null) {
userForm = new UserForm(); userForm = new UserForm();
userForm.setCourseId(courseId);
} }
if(courseId != null) {
model.addAttribute("selectedCourseName", courseService.findById(courseId).getCourseName());
}
model.addAttribute("courseId", courseId);
model.addAttribute("userForm", userForm); model.addAttribute("userForm", userForm);
return "user_register"; return "user_register";
} }

View File

@@ -29,6 +29,8 @@ public class GoalForm {
private Integer goalComplete; private Integer goalComplete;
private Integer achievementRate; // 達成率 private Integer achievementRate; // 達成率
private Integer currentAmount; // 現在の資産
public static GoalForm convertFrom(GoalModel goalModel) { public static GoalForm convertFrom(GoalModel goalModel) {
return new GoalForm( return new GoalForm(
@@ -38,7 +40,8 @@ public class GoalForm {
goalModel.getTargetAmount(), goalModel.getTargetAmount(),
goalModel.getDeadline(), goalModel.getDeadline(),
goalModel.getGoalComplete(), goalModel.getGoalComplete(),
goalModel.getAchievementRate()); goalModel.getAchievementRate(),
goalModel.getCurrentAmount());
} }
// public static List<GoalForm> convertFrom(List<GoalModel> goalModelList) { // public static List<GoalForm> convertFrom(List<GoalModel> goalModelList) {

View File

@@ -5,6 +5,7 @@
<title>分析画面</title> <title>分析画面</title>
<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 class="pb-5 pt-5">
<div th:replace="~{header :: header}"> <div th:replace="~{header :: header}">
@@ -13,6 +14,23 @@
<div class="container mt-4"> <div class="container mt-4">
<h2 class="text-center">支出分析</h2> <h2 class="text-center">支出分析</h2>
<div class="text-center">
<a class="month-button" th:href="@{/analysis(year=${previousYear}, month=${previousMonth})}">
←
</a>
<div class="calendar-date">
<span class="year" th:text="|${year}年|"></span>
<span class="month" th:text="|${month}月|"></span>
</div>
<a class="month-button" th:href="@{/analysis(year=${nextYear}, month=${nextMonth})}">
→
</a>
</div>
<table class="table text-center"> <table class="table text-center">
<thead> <thead>
<tr> <tr>

View File

@@ -14,7 +14,6 @@
<h1>目標詳細</h1> <h1>目標詳細</h1>
<table> <table>
<tr> <tr>
<th>目標名</th> <th>目標名</th>
<td th:text="${goalForm.goalTitle}"></td> <td th:text="${goalForm.goalTitle}"></td>

View File

@@ -118,6 +118,13 @@
<span th:text="${targetAmount}"></span> <span th:text="${targetAmount}"></span>
<span>円</span> <span>円</span>
</div> </div>
<div>
<span>現在高</span>
<span th:text="${currentAmount}"></span>
<span>円</span>
</div>
<div> <div>
<span>貯金額</span> <span>貯金額</span>
<span th:text="${saving}"></span> <span th:text="${saving}"></span>

View File

@@ -9,42 +9,34 @@
<body> <body>
<h1>コース選択</h1> <h1>コース選択</h1>
<form th:action="@{/user/register}" th:object="${userForm}" method="post">
<input type="hidden" th:field="*{userName}">
<input type="hidden" th:field="*{mailAddress}"> <form th:action="${mode == 'regist'} ? @{/user/register/return}: @{/change}" method="post">
<input type="hidden" th:field="*{birthDate}"> <button type="submit">確定</button>
<input type="hidden" th:field="*{password}"> <div class="accordion" id="accordionExample">
<input type="hidden" th:field="*{secretQuestionId}"> <div class="accordion-item" th:each="course:${courseList}">
<input type="hidden" th:field="*{secretAnswer}"> <h2 class="accordion-header d-flex align-items-center">
<input type="hidden" th:field="*{saving}"> <input type="radio" name="courseId" th:value="${course.courseId}" class="form-check-input ms-3 me-2">
<input type="hidden" th:field="*{annualIncome}"> <button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" th:data-bs-target="'#collapse' + ${course.courseId}" aria-expanded="false" aria-controls="'collapse' + ${course.courseId}">
<input type="hidden" th:field="*{monthlyBudget}"> <span th:text="${course.courseName}"></span>
<input type="hidden" th:field="*{targetAmount}"> </button>
<button type="submit">確定</button> </h2>
<div class="accordion" id="accordionExample"> <div th:id="'collapse' + ${course.courseId}" class="accordion-collapse collapse" data-bs-parent="#accordionExample">
<div class="accordion-item" th:each="course:${courseList}"> <div class="accordion-body">
<h2 class="accordion-header d-flex align-items-center"> <span th:text="${course.description}"></span>
<input type="radio" name="courseId" th:value="${course.courseId}" class="form-check-input ms-3 me-2"> <table border="1">
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" th:data-bs-target="'#collapse' + ${course.courseId}" aria-expanded="false" aria-controls="'collapse' + ${course.courseId}"> <tr>
<span th:text="${course.courseName}"></span> <th>カテゴリ名</th><th>配分(%)</th>
</button> </tr>
</h2> <tr th:each="courseInfo:${courseInfoList}" th:if="${course.courseId == courseInfo.courseId}">
<div th:id="'collapse' + ${course.courseId}" class="accordion-collapse collapse" data-bs-parent="#accordionExample"> <td th:text="${courseInfo.categoryName}"></td>
<div class="accordion-body"> <td th:text="${courseInfo.allocationRatio}"></td>
<span th:text="${course.description}"></span> </tr>
<table border="1"> </table>
<tr> </div>
<th>カテゴリ名</th><th>配分(%)</th> </div>
</tr> </div>
<tr th:each="courseInfo:${courseInfoList}" th:if="${course.courseId == courseInfo.courseId}"> </div>
<td th:text="${courseInfo.categoryName}"></td>
<td th:text="${courseInfo.allocationRatio}"></td>
</tr>
</table>
</div>
</div>
</div>
</div>
</form> </form>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.7/dist/js/bootstrap.bundle.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.7/dist/js/bootstrap.bundle.min.js"></script>