Compare commits
69 Commits
573b7969b7
...
s-morimto
| Author | SHA1 | Date | |
|---|---|---|---|
| acd7534fdb | |||
|
|
add6a85c64 | ||
|
|
fd74dee965 | ||
|
|
7aa8e31bfd | ||
|
|
e3af89a694 | ||
|
|
efdaacbb27 | ||
| 154e6787d4 | |||
| 75f2f7c8d0 | |||
| ac101172d2 | |||
| ee5ec5009d | |||
|
|
d7a0aac355 | ||
|
|
a45045d008 | ||
|
|
17074c3132 | ||
| 7604e9ee76 | |||
|
|
34172aecc9 | ||
|
|
e5af64b53b | ||
|
|
b76be8f38a | ||
|
|
47185d8f26 | ||
|
|
0f800da9a3 | ||
|
|
546206317d | ||
|
|
d764da2ebf | ||
|
|
b83f360781 | ||
|
|
42c4d7c273 | ||
|
|
cfbf56cf4e | ||
|
|
503ac3f3db | ||
|
|
d5b18ae3ad | ||
|
|
efe93e010d | ||
| 26fa2365e8 | |||
|
|
054eeb7f7a | ||
|
|
5be30572cb | ||
|
|
6d0cad2454 | ||
|
|
04a6b6dedb | ||
|
|
2c445c1904 | ||
|
|
cd4321ef8c | ||
|
|
65bab96432 | ||
|
|
d911334107 | ||
|
|
b9bf0da507 | ||
|
|
2b3cecf55d | ||
|
|
9872405377 | ||
|
|
b9742d87c0 | ||
|
|
cdc5ea21c7 | ||
|
|
ff21efa943 | ||
|
|
a0ef7145d2 | ||
|
|
29749c444a | ||
|
|
073ee12f03 | ||
|
|
1438c94406 | ||
|
|
65290c0189 | ||
| 5adb527d7a | |||
|
|
e0759c0f6b | ||
| e54e0133f7 | |||
|
|
d526dc2e60 | ||
| c3dae348bf | |||
| ea1e18ad93 | |||
| bb3b8965b2 | |||
| 3b239d07bd | |||
|
|
d7c9346b88 | ||
|
|
18eeb82cac | ||
|
|
b18ee5ee82 | ||
| 0c54a42b97 | |||
|
|
6fda1af754 | ||
|
|
90c5dbe8b2 | ||
|
|
29d879e3b7 | ||
|
|
f33d4412a7 | ||
| 907b7c1f9b | |||
| 3dba5e5322 | |||
| e0b0109a2b | |||
| bcafdbe067 | |||
| 3760bf352d | |||
| 76e91f0bf0 |
5
pom.xml
5
pom.xml
@@ -83,6 +83,11 @@
|
||||
<artifactId>spring-boot-starter-webmvc-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mindrot</groupId>
|
||||
<artifactId>jbcrypt</artifactId>
|
||||
<version>0.4</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
||||
@@ -4,6 +4,8 @@ package com.example.demo.aop.handler;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import jakarta.servlet.http.HttpSession;
|
||||
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.HttpRequestMethodNotSupportedException;
|
||||
@@ -32,12 +34,12 @@ public class GlobalExceptionHandler {
|
||||
"システムエラーが発生しました。"
|
||||
+ "初めからやり直してください。");
|
||||
|
||||
return "error";
|
||||
return "redirect:/login";
|
||||
|
||||
}
|
||||
|
||||
@ExceptionHandler(HttpRequestMethodNotSupportedException.class)
|
||||
public String handleBadRequestException(Model model, Exception e) {
|
||||
public String handleBadRequestException(Model model, Exception e, HttpSession session) {
|
||||
model.addAttribute("error", SEVERE_ERROR_MESSAGE_BAD_REQUEST);
|
||||
model.addAttribute("status", HttpStatus.BAD_REQUEST.value());
|
||||
|
||||
@@ -45,17 +47,23 @@ public class GlobalExceptionHandler {
|
||||
|
||||
LOGGER.log(Level.SEVERE, SEVERE_ERROR_MESSAGE_ILLEGAL_TRANSITION, e);
|
||||
|
||||
System.out.println("session invalidated");
|
||||
session.invalidate();
|
||||
|
||||
return "error";
|
||||
}
|
||||
|
||||
@ExceptionHandler(Exception.class)
|
||||
public String AllException(Model model, Exception e) {
|
||||
public String AllException(Model model, Exception e, HttpSession session) {
|
||||
model.addAttribute("error", SEVERE_ERROR_MESSAGE_BAD_REQUEST);
|
||||
|
||||
e.printStackTrace();
|
||||
|
||||
LOGGER.log(Level.SEVERE, SEVERE_ERROR_MESSAGE_ILLEGAL_TRANSITION, e);
|
||||
|
||||
System.out.println("session invalidated");
|
||||
session.invalidate();
|
||||
|
||||
return "error";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ package com.example.demo.app.domain.model;
|
||||
import java.util.List;
|
||||
|
||||
import com.example.demo.app.infra.entity.CourseEntity;
|
||||
import com.example.demo.app.infra.entity.UserEntity;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
@@ -27,11 +26,10 @@ public class CourseModel {
|
||||
return courseEntityList.stream().map(CourseModel::convertFrom).toList();
|
||||
}
|
||||
|
||||
public static CourseEntity convertTo(CourseModel courseModel, List<UserEntity> userEntityList) {
|
||||
public static CourseEntity convertTo(CourseModel courseModel) {
|
||||
return new CourseEntity(
|
||||
courseModel.getCourseId(),
|
||||
courseModel.getCourseName(),
|
||||
courseModel.getDescription(),
|
||||
userEntityList);
|
||||
courseModel.getDescription());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,4 +13,11 @@ public interface CourseService {
|
||||
public Long findByName(String courName);
|
||||
|
||||
public CourseModel save(CourseModel courseModel, Long userId);
|
||||
|
||||
public List<CourseModel> findAllByUserId(Long userId);
|
||||
|
||||
public List<CourseModel> findAllByNull();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -18,6 +18,8 @@ public interface GoalService {
|
||||
|
||||
public void updateGoalComplete(Long userId);
|
||||
|
||||
public int getCurrentAmount(Long userId);
|
||||
|
||||
// void deleteGoal(Long goalId);
|
||||
|
||||
}
|
||||
@@ -5,7 +5,7 @@ import com.example.demo.app.presentation.form.UserForm;
|
||||
|
||||
public interface UserService {
|
||||
|
||||
public void register(UserForm userForm, Long courseId, Long userId);
|
||||
public void register(UserForm userForm, Long courseId);
|
||||
|
||||
public void updateCourse(Long userId, Long courseId);
|
||||
|
||||
|
||||
@@ -3,12 +3,16 @@ package com.example.demo.app.domain.service.impl;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import jakarta.transaction.Transactional;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.example.demo.app.domain.model.CourseModel;
|
||||
import com.example.demo.app.domain.service.CourseService;
|
||||
import com.example.demo.app.infra.entity.CourseEntity;
|
||||
import com.example.demo.app.infra.entity.CourseOwnerEntity;
|
||||
import com.example.demo.app.infra.entity.UserEntity;
|
||||
import com.example.demo.app.infra.repository.CourseOwnerRepository;
|
||||
import com.example.demo.app.infra.repository.CourseRepository;
|
||||
import com.example.demo.app.infra.repository.UserRepository;
|
||||
|
||||
@@ -20,12 +24,22 @@ public class CourseServiceImpl implements CourseService {
|
||||
|
||||
private final CourseRepository courseRepository;
|
||||
private final UserRepository userRepository;
|
||||
private final CourseOwnerRepository courseOwnerRepository;
|
||||
|
||||
public List<CourseModel> findAll(){
|
||||
|
||||
return CourseEntity.createCourseModelList(courseRepository.findAll());
|
||||
}
|
||||
|
||||
public List<CourseModel> findAllByUserId(Long userId) {
|
||||
|
||||
return CourseModel.convertFrom(courseRepository.findAllByUserId(userId));
|
||||
}
|
||||
|
||||
public List<CourseModel> findAllByNull() {
|
||||
return CourseModel.convertFrom(courseRepository.findAllByNull());
|
||||
}
|
||||
|
||||
public CourseModel findById(Long courseId) {
|
||||
return CourseModel.convertFrom(courseRepository.findByCourseId(courseId));
|
||||
}
|
||||
@@ -34,12 +48,27 @@ public class CourseServiceImpl implements CourseService {
|
||||
return courseRepository.findByCourseName(courseName).getCourseId();
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public CourseModel save(CourseModel courseModel, Long userId) {
|
||||
|
||||
List<UserEntity> userEntityList = new ArrayList<>();
|
||||
userEntityList.add(userRepository.findById(userId).get());
|
||||
CourseEntity result = courseRepository.save( CourseModel.convertTo(courseModel));
|
||||
|
||||
UserEntity user = userRepository.findById(userId).orElse(null);
|
||||
|
||||
user.setCourseEntity(result);
|
||||
|
||||
UserEntity userResult = userRepository.save(user);
|
||||
|
||||
CourseOwnerEntity courseOwnerEntity = new CourseOwnerEntity();
|
||||
courseOwnerEntity.setUserEntity(userResult);
|
||||
courseOwnerEntity.setCourseEntity(result);
|
||||
|
||||
courseOwnerRepository.save(courseOwnerEntity);
|
||||
|
||||
return CourseModel.convertFrom(result);
|
||||
|
||||
return CourseModel.convertFrom( courseRepository.save( CourseModel.convertTo(courseModel, userEntityList)));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,13 +59,28 @@ public class GoalServiceImpl implements GoalService {
|
||||
: (int) ((currentAmount * 100.0) / goalEntity.getTargetAmount()),
|
||||
currentAmount)));
|
||||
|
||||
|
||||
return goalModelList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public GoalModel createGoal(GoalModel goalModel, Long userId) {
|
||||
|
||||
UserEntity userEntity = userRepository.findById(userId).orElseThrow();
|
||||
|
||||
int transactionTotal = userEntity.getTransactionEntityList().stream()
|
||||
.mapToInt(t -> {
|
||||
int sign = t.getCategoryEntity().getTransactionType() == 1 ? 1 : -1;
|
||||
return sign * t.getAmount();
|
||||
})
|
||||
.sum();
|
||||
|
||||
// 現在の資産 = 貯蓄金 + 収支合計
|
||||
int currentAmount = userEntity.getSaving() + transactionTotal;
|
||||
|
||||
if (currentAmount >= goalModel.getTargetAmount()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
GoalEntity goalEntity = GoalModel.convertTo(goalModel, userRepository.findById(userId).get());
|
||||
|
||||
GoalEntity savedGoalEntity = goalRepository.save(goalEntity);
|
||||
@@ -108,4 +123,21 @@ public class GoalServiceImpl implements GoalService {
|
||||
});
|
||||
}
|
||||
|
||||
public int getCurrentAmount(Long userId) {
|
||||
|
||||
UserEntity userEntity = userRepository.findById(userId).orElseThrow();
|
||||
|
||||
int transactionTotal = userEntity.getTransactionEntityList().stream()
|
||||
.mapToInt(t -> {
|
||||
int sign = t.getCategoryEntity().getTransactionType() == 1 ? 1 : -1;
|
||||
return sign * t.getAmount();
|
||||
})
|
||||
.sum();
|
||||
|
||||
int currentAmount = userEntity.getSaving() + transactionTotal;
|
||||
|
||||
return currentAmount;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.example.demo.app.domain.service.impl;
|
||||
|
||||
import org.mindrot.jbcrypt.BCrypt;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.example.demo.app.domain.model.LoginModel;
|
||||
@@ -13,19 +14,41 @@ import lombok.RequiredArgsConstructor;
|
||||
@RequiredArgsConstructor
|
||||
public class LoginServiceImpl implements LoginService {
|
||||
|
||||
private final UserRepository userRepository;
|
||||
private final UserRepository userRepository;
|
||||
|
||||
@Override
|
||||
public LoginModel login(String mailAddress, String password) {
|
||||
@Override
|
||||
public LoginModel login(String mailAddress, String password) {
|
||||
|
||||
UserEntity userEntity = userRepository.findByMailAddressAndPassword(
|
||||
mailAddress,
|
||||
password).orElse(null);
|
||||
UserEntity userEntity = userRepository
|
||||
.findByMailAddress(mailAddress)
|
||||
.orElse(null);
|
||||
|
||||
if (userEntity == null) {
|
||||
return null;
|
||||
}
|
||||
if (userEntity == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
boolean isValidPassword = false;
|
||||
if (userEntity.getPassword().length() <= 24) {
|
||||
if (userEntity.getPassword().equals(password)) {
|
||||
|
||||
userEntity.setPassword(BCrypt.hashpw(password, BCrypt.gensalt()));
|
||||
userRepository.save(userEntity);
|
||||
isValidPassword = true;
|
||||
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
isValidPassword = BCrypt.checkpw(password, userEntity.getPassword());
|
||||
}
|
||||
|
||||
if (!isValidPassword) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return new LoginModel(userEntity.getUserId());
|
||||
}
|
||||
|
||||
return new LoginModel(userEntity.getUserId());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.example.demo.app.domain.service.impl;
|
||||
|
||||
import org.mindrot.jbcrypt.BCrypt;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.example.demo.app.domain.service.PasswordResetService;
|
||||
@@ -13,30 +14,31 @@ import lombok.RequiredArgsConstructor;
|
||||
@RequiredArgsConstructor
|
||||
public class PasswordResetServiceImpl implements PasswordResetService {
|
||||
|
||||
private final UserRepository userRepository;
|
||||
private final UserRepository userRepository;
|
||||
|
||||
@Override
|
||||
public boolean resetPassword(
|
||||
Long userId,
|
||||
PasswordResetForm passwordResetForm) {
|
||||
@Override
|
||||
public boolean resetPassword(
|
||||
Long userId,
|
||||
PasswordResetForm passwordResetForm) {
|
||||
|
||||
if (!passwordResetForm.getPassword()
|
||||
.equals(passwordResetForm.getPasswordConfirm())) {
|
||||
return false;
|
||||
}
|
||||
if (!passwordResetForm.getPassword()
|
||||
.equals(passwordResetForm.getPasswordConfirm())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
UserEntity userEntity =
|
||||
userRepository.findById(userId).orElse(null);
|
||||
UserEntity userEntity = userRepository.findById(userId).orElse(null);
|
||||
|
||||
if (userEntity == null) {
|
||||
return false;
|
||||
}
|
||||
if (userEntity == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
userEntity.setPassword(
|
||||
passwordResetForm.getPassword());
|
||||
String passwordHashed = BCrypt.hashpw(passwordResetForm.getPassword(), BCrypt.gensalt());
|
||||
|
||||
userRepository.save(userEntity);
|
||||
userEntity.setPassword(
|
||||
passwordHashed);
|
||||
|
||||
return true;
|
||||
}
|
||||
userRepository.save(userEntity);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -58,6 +58,7 @@ public class ProfileServiceImpl implements ProfileService{
|
||||
userEntity.setSaving(profileEditForm.getSaving());
|
||||
userEntity.setAnnualIncome(profileEditForm.getAnnualIncome());
|
||||
userEntity.setMonthlyBudget(profileEditForm.getMonthlyBudget());
|
||||
userEntity.setBirthDate(profileEditForm.getBirthDate());
|
||||
userRepository.save(userEntity);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.example.demo.app.domain.service.impl;
|
||||
|
||||
import org.mindrot.jbcrypt.BCrypt;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.example.demo.app.domain.model.UserModel;
|
||||
@@ -25,13 +26,16 @@ public class UserServiceImpl implements UserService {
|
||||
private final CourseRepository courseRepository;
|
||||
|
||||
@Override
|
||||
public void register(UserForm userForm, Long courseId, Long userId) {
|
||||
public void register(UserForm userForm, Long courseId) {
|
||||
|
||||
UserEntity userEntity = new UserEntity();
|
||||
|
||||
userEntity.setUserName(userForm.getUserName());
|
||||
userEntity.setMailAddress(userForm.getMailAddress());
|
||||
userEntity.setPassword(userForm.getPassword());
|
||||
|
||||
String passwordHashed = BCrypt.hashpw(userForm.getPassword(), BCrypt.gensalt());
|
||||
|
||||
userEntity.setPassword(passwordHashed);
|
||||
userEntity.setSecretQuestionAnswer(userForm.getSecretAnswer());
|
||||
userEntity.setBirthDate(userForm.getBirthDate());
|
||||
userEntity.setSaving(userForm.getSaving());
|
||||
@@ -44,11 +48,13 @@ public class UserServiceImpl implements UserService {
|
||||
|
||||
GoalEntity goalEntity = new GoalEntity();
|
||||
goalEntity.setTargetAmount(Integer.parseInt(String.valueOf(userForm.getGoalId())));
|
||||
goalEntity.setUserEntity(userRepository.findById(userId).get());
|
||||
|
||||
CourseEntity courseEntity = courseRepository.findById(courseId).orElse(null);
|
||||
|
||||
userEntity.setQuestionEntity(questionEntity);
|
||||
|
||||
|
||||
|
||||
userEntity.setCourseEntity(courseEntity);
|
||||
|
||||
userEntity.setDeleteFlag(0);
|
||||
|
||||
@@ -7,7 +7,6 @@ import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.GeneratedValue;
|
||||
import jakarta.persistence.GenerationType;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.OneToMany;
|
||||
import jakarta.persistence.Table;
|
||||
|
||||
import com.example.demo.app.domain.model.CourseModel;
|
||||
@@ -35,9 +34,6 @@ public class CourseEntity {
|
||||
@Column(name = "description", nullable = false)
|
||||
private String description;
|
||||
|
||||
@OneToMany(mappedBy = "courseEntity")
|
||||
private List<UserEntity> userEntity;
|
||||
|
||||
public static List<CourseModel> createCourseModelList(List<CourseEntity> courseEntityList) {
|
||||
|
||||
return courseEntityList
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.example.demo.app.infra.entity;
|
||||
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.FetchType;
|
||||
import jakarta.persistence.GeneratedValue;
|
||||
import jakarta.persistence.GenerationType;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.JoinColumn;
|
||||
import jakarta.persistence.ManyToOne;
|
||||
import jakarta.persistence.OneToOne;
|
||||
import jakarta.persistence.Table;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Entity
|
||||
@Table(name = "course_owner_t")
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class CourseOwnerEntity {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long courseOwnerId;
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "user_id")
|
||||
private UserEntity userEntity;
|
||||
|
||||
@OneToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "course_id")
|
||||
private CourseEntity courseEntity;
|
||||
|
||||
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
package com.example.demo.app.infra.entity;
|
||||
|
||||
public class TestController6 {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.example.demo.app.infra.repository;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
import com.example.demo.app.infra.entity.CourseOwnerEntity;
|
||||
|
||||
public interface CourseOwnerRepository extends JpaRepository<CourseOwnerEntity, Long>{
|
||||
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.example.demo.app.infra.repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
|
||||
@@ -13,5 +15,10 @@ public interface CourseRepository extends JpaRepository<CourseEntity, Long> {
|
||||
@Query("SELECT c FROM CourseEntity c WHERE c.courseName = :courseName ")
|
||||
public CourseEntity findByCourseName(String courseName);
|
||||
|
||||
@Query("select c from CourseEntity c inner join CourseOwnerEntity o on c.courseId = o.courseEntity.courseId inner join UserEntity u on o.userEntity.userId = u.userId where u.userId = :userId")
|
||||
public List<CourseEntity> findAllByUserId(Long userId);
|
||||
|
||||
@Query("select c from CourseEntity c where c.courseId between 1 and 6")
|
||||
public List<CourseEntity> findAllByNull();
|
||||
|
||||
}
|
||||
|
||||
@@ -13,6 +13,9 @@ import com.example.demo.aop.aspect.SessionCheck;
|
||||
import com.example.demo.app.domain.model.AnalysisModel;
|
||||
import com.example.demo.app.domain.model.LoginModel;
|
||||
import com.example.demo.app.domain.service.AnalysisService;
|
||||
import com.example.demo.app.presentation.controller.pageproperty.PageReturnAttributeKeyword;
|
||||
import com.example.demo.app.presentation.controller.pageproperty.SessionKeyword;
|
||||
import com.example.demo.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword;
|
||||
import com.example.demo.app.presentation.form.AnalysisForm;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -25,7 +28,7 @@ public class AnalysisController {
|
||||
private final AnalysisService analysisService;
|
||||
|
||||
@SessionCheck
|
||||
@GetMapping("/analysis")
|
||||
@GetMapping(TransitionTargetPageNameKeyword.ANALYSIS)
|
||||
public String showAnalysis(
|
||||
@RequestParam(required = false) Integer year,
|
||||
@RequestParam(required = false) Integer month,
|
||||
@@ -33,7 +36,7 @@ public class AnalysisController {
|
||||
HttpSession session) {
|
||||
|
||||
//ログインユーザーの取得(セッション)
|
||||
LoginModel loginUser = (LoginModel) session.getAttribute("loginUser");
|
||||
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
|
||||
|
||||
//初期年月表示
|
||||
LocalDate nowDate = LocalDate.now();
|
||||
@@ -58,15 +61,15 @@ public class AnalysisController {
|
||||
AnalysisForm analysisForm = AnalysisForm.convertFrom(analysisModel);
|
||||
|
||||
//model格納
|
||||
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());
|
||||
model.addAttribute(PageReturnAttributeKeyword.ANALYSIS_FORM, analysisForm);
|
||||
model.addAttribute(PageReturnAttributeKeyword.YEAR, year);
|
||||
model.addAttribute(PageReturnAttributeKeyword.MONTH, month);
|
||||
model.addAttribute(PageReturnAttributeKeyword.PREVIOUS_YEAR, previousDate.getYear());
|
||||
model.addAttribute(PageReturnAttributeKeyword.PREVIOUS_MONTH, previousDate.getMonthValue());
|
||||
model.addAttribute(PageReturnAttributeKeyword.NEXT_YEAR, nextDate.getYear());
|
||||
model.addAttribute(PageReturnAttributeKeyword.NEXT_MONTH, nextDate.getMonthValue());
|
||||
|
||||
return "analysis";
|
||||
return TransitionTargetPageNameKeyword.ANALYSIS_HTML;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -10,6 +10,8 @@ import org.springframework.web.bind.annotation.PostMapping;
|
||||
import com.example.demo.app.domain.model.AuthenticationModel;
|
||||
import com.example.demo.app.domain.service.AuthenticationService;
|
||||
import com.example.demo.app.infra.repository.QuestionRepository;
|
||||
import com.example.demo.app.presentation.controller.pageproperty.PageReturnAttributeKeyword;
|
||||
import com.example.demo.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword;
|
||||
import com.example.demo.app.presentation.form.AuthenticationForm;
|
||||
import com.example.demo.app.presentation.form.PasswordResetForm;
|
||||
|
||||
@@ -22,16 +24,16 @@ public class AuthenticationController {
|
||||
private final AuthenticationService authenticationService;
|
||||
private final QuestionRepository questionRepository;
|
||||
|
||||
@GetMapping("/authentication")
|
||||
@GetMapping(TransitionTargetPageNameKeyword.AUTHENTICATION)
|
||||
public String showAuthentication(Model model) {
|
||||
|
||||
model.addAttribute("authenticationForm", new AuthenticationForm());
|
||||
model.addAttribute("questionList", questionRepository.findAll());
|
||||
model.addAttribute(PageReturnAttributeKeyword.AUTHENTICATION_FORM, new AuthenticationForm());
|
||||
model.addAttribute(PageReturnAttributeKeyword.QUESTION_LIST, questionRepository.findAll());
|
||||
|
||||
return "authentication";
|
||||
return TransitionTargetPageNameKeyword.AUTHENTICATION_HTML;
|
||||
}
|
||||
|
||||
@PostMapping("/authentication")
|
||||
@PostMapping(TransitionTargetPageNameKeyword.AUTHENTICATION)
|
||||
public String authenticate(
|
||||
AuthenticationForm authenticationForm,
|
||||
Model model,
|
||||
@@ -41,21 +43,21 @@ public class AuthenticationController {
|
||||
authenticationService.authenticate(authenticationForm);
|
||||
|
||||
if (authenticationModel == null) {
|
||||
model.addAttribute("errorMessage", "認証情報が正しくありません。");
|
||||
model.addAttribute("questionList", questionRepository.findAll());
|
||||
model.addAttribute(PageReturnAttributeKeyword.ERROR_MESSAGE, "認証情報が正しくありません。");
|
||||
model.addAttribute(PageReturnAttributeKeyword.QUESTION_LIST, questionRepository.findAll());
|
||||
|
||||
return "authentication";
|
||||
return TransitionTargetPageNameKeyword.AUTHENTICATION_HTML;
|
||||
}
|
||||
|
||||
session.setAttribute(
|
||||
"passwordResetUserId",
|
||||
PageReturnAttributeKeyword.PASSWOR_RESET_USER_ID,
|
||||
authenticationModel.getUserId());
|
||||
|
||||
model.addAttribute(
|
||||
"passwordResetForm",
|
||||
PageReturnAttributeKeyword.PASSWOR_RESET_FORM,
|
||||
new PasswordResetForm());
|
||||
|
||||
return "password_reset";
|
||||
return TransitionTargetPageNameKeyword.PASSWORD_RESET_HTML;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,9 @@ import org.springframework.web.bind.annotation.PostMapping;
|
||||
|
||||
import com.example.demo.app.domain.model.LoginModel;
|
||||
import com.example.demo.app.domain.service.CategoryService;
|
||||
import com.example.demo.app.presentation.controller.pageproperty.PageReturnAttributeKeyword;
|
||||
import com.example.demo.app.presentation.controller.pageproperty.SessionKeyword;
|
||||
import com.example.demo.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword;
|
||||
import com.example.demo.app.presentation.form.CategoryForm;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -23,64 +26,64 @@ public class CategoryController {
|
||||
private final CategoryService categoryService;
|
||||
|
||||
|
||||
@GetMapping("/category/list")
|
||||
@GetMapping(TransitionTargetPageNameKeyword.CATEGORY_LIST)
|
||||
public String categoryListGet(Model model, HttpSession session) {
|
||||
|
||||
LoginModel loginUser = (LoginModel) session.getAttribute("loginUser");
|
||||
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
|
||||
|
||||
List<CategoryForm> categoryFormList = CategoryForm.convertFrom(categoryService.findAllByuserId(loginUser.getUserId()));
|
||||
|
||||
model.addAttribute("categoryFormList", categoryFormList);
|
||||
model.addAttribute(PageReturnAttributeKeyword.CATEGORY_FORM_LIST, categoryFormList);
|
||||
|
||||
return "category-list";
|
||||
return TransitionTargetPageNameKeyword.CATEGORY_LIST_HTML;
|
||||
}
|
||||
|
||||
@GetMapping("/category/create")
|
||||
@GetMapping(TransitionTargetPageNameKeyword.CATEGORY_CREATE)
|
||||
public String categoryCreateGet(@ModelAttribute CategoryForm categoryForm) {
|
||||
|
||||
return "category-create";
|
||||
return TransitionTargetPageNameKeyword.CATEGORY_CREATE_HTML;
|
||||
}
|
||||
|
||||
@PostMapping("/category/create")
|
||||
@PostMapping(TransitionTargetPageNameKeyword.CATEGORY_CREATE)
|
||||
public String categoryCreatePost(@ModelAttribute CategoryForm categoryForm, HttpSession session) {
|
||||
|
||||
LoginModel loginUser = (LoginModel) session.getAttribute("loginUser");
|
||||
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
|
||||
|
||||
|
||||
categoryService.save(CategoryForm.convertTo(categoryForm), loginUser.getUserId());
|
||||
|
||||
return "redirect:/category/list";
|
||||
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.CATEGORY_LIST;
|
||||
}
|
||||
|
||||
@GetMapping("/category/update")
|
||||
@GetMapping(TransitionTargetPageNameKeyword.CATEGORY_UPDATE)
|
||||
public String categoryUpdateGet(Model model, Long categoryId) {
|
||||
|
||||
CategoryForm categoryForm = CategoryForm.convertFrom(categoryService.findOne(categoryId));
|
||||
|
||||
model.addAttribute("categoryId", categoryId);
|
||||
model.addAttribute("categoryForm", categoryForm);
|
||||
model.addAttribute(PageReturnAttributeKeyword.CATEGORY_ID, categoryId);
|
||||
model.addAttribute(PageReturnAttributeKeyword.CATEGORY_FORM, categoryForm);
|
||||
|
||||
return "category-update";
|
||||
return TransitionTargetPageNameKeyword.CATEGORY_UPDATE_HTML;
|
||||
}
|
||||
|
||||
@PostMapping("/category/update")
|
||||
@PostMapping(TransitionTargetPageNameKeyword.CATEGORY_UPDATE)
|
||||
public String categoryUpdatePost(@ModelAttribute CategoryForm categoryForm, HttpSession session, Long categoryId) {
|
||||
|
||||
LoginModel loginUser = (LoginModel) session.getAttribute("loginUser");
|
||||
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
|
||||
|
||||
categoryForm.setCategoryId(categoryId);
|
||||
|
||||
categoryService.save(CategoryForm.convertTo(categoryForm), loginUser.getUserId());
|
||||
|
||||
return "redirect:/category/list";
|
||||
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.CATEGORY_LIST;
|
||||
}
|
||||
|
||||
@PostMapping("/category/delete")
|
||||
@PostMapping(TransitionTargetPageNameKeyword.CATEGORY_DELETE)
|
||||
public String categoryDeletePost(Long categoryId) {
|
||||
|
||||
categoryService.delete(categoryId);
|
||||
|
||||
return "redirect:/category/list";
|
||||
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.CATEGORY_LIST;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -14,11 +14,15 @@ import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import com.example.demo.aop.aspect.SessionCheck;
|
||||
import com.example.demo.app.domain.model.AllocationModel;
|
||||
import com.example.demo.app.domain.model.CourseModel;
|
||||
import com.example.demo.app.domain.model.LoginModel;
|
||||
import com.example.demo.app.domain.service.AllocationService;
|
||||
import com.example.demo.app.domain.service.CourseInfoService;
|
||||
import com.example.demo.app.domain.service.CourseService;
|
||||
import com.example.demo.app.domain.service.UserService;
|
||||
import com.example.demo.app.presentation.controller.pageproperty.PageReturnAttributeKeyword;
|
||||
import com.example.demo.app.presentation.controller.pageproperty.SessionKeyword;
|
||||
import com.example.demo.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword;
|
||||
import com.example.demo.app.presentation.form.AllocationFormList;
|
||||
import com.example.demo.app.presentation.form.CourseForm;
|
||||
import com.example.demo.app.presentation.form.CourseInfoForm;
|
||||
@@ -35,91 +39,129 @@ public class CourseController {
|
||||
private final UserService userService;
|
||||
private final AllocationService allocationService;
|
||||
|
||||
|
||||
@PostMapping("/user/register/course")
|
||||
@PostMapping(TransitionTargetPageNameKeyword.SHOW_SELECT_COURSE)
|
||||
public String showSelectCourse(@ModelAttribute UserForm userForm, Model model, HttpSession session) {
|
||||
|
||||
session.setAttribute("userForm", userForm);
|
||||
model.addAttribute("mode", "regist");
|
||||
model.addAttribute("currentCourseId", courseService.findByName("バランスコース"));
|
||||
model.addAttribute("courseList", CourseForm.convertFrom(courseService.findAll()));
|
||||
model.addAttribute("courseInfoList", CourseInfoForm.convertFrom(courseInfoService.findAll()));
|
||||
final String MODE = "regist";
|
||||
final String DEFAULT = "バランスコース";
|
||||
|
||||
return "select_course";
|
||||
session.setAttribute(PageReturnAttributeKeyword.USER_FORM, userForm);
|
||||
model.addAttribute(PageReturnAttributeKeyword.MODE, MODE);
|
||||
model.addAttribute(PageReturnAttributeKeyword.CURRENT_COURSE_ID, courseService.findByName(DEFAULT));
|
||||
|
||||
model.addAttribute(PageReturnAttributeKeyword.COURSE_LIST,
|
||||
CourseForm.convertFrom(courseService.findAllByNull()));
|
||||
model.addAttribute(PageReturnAttributeKeyword.COURSE_INFO_LIST,
|
||||
CourseInfoForm.convertFrom(courseInfoService.findAll()));
|
||||
|
||||
return TransitionTargetPageNameKeyword.SELECT_COURSE_HTML;
|
||||
|
||||
}
|
||||
|
||||
@SessionCheck
|
||||
@GetMapping("/course")
|
||||
@GetMapping(TransitionTargetPageNameKeyword.COURSE)
|
||||
public String showChangeCourse(Model model, HttpSession session) {
|
||||
|
||||
LoginModel loginUser = (LoginModel) session.getAttribute("loginUser");
|
||||
final String MODE = "change";
|
||||
|
||||
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
|
||||
Long userId = loginUser.getUserId();
|
||||
|
||||
Long currentCourseId = userService.findByUserId(userId).getCourseId();
|
||||
model.addAttribute("mode", "change");
|
||||
model.addAttribute("currentCourseId", currentCourseId);
|
||||
model.addAttribute("courseList", CourseForm.convertFrom(courseService.findAll()));
|
||||
model.addAttribute("courseInfoList", CourseInfoForm.convertFrom(courseInfoService.findAll()));
|
||||
|
||||
return "select_course";
|
||||
List<CourseModel> courseModelList = new ArrayList<>(courseService.findAllByNull());
|
||||
|
||||
List<CourseModel> tempList = courseService.findAllByUserId(userId);
|
||||
|
||||
tempList.forEach(courseModelList::add);
|
||||
|
||||
model.addAttribute(PageReturnAttributeKeyword.MODE, MODE);
|
||||
model.addAttribute(PageReturnAttributeKeyword.CURRENT_COURSE_ID, currentCourseId);
|
||||
model.addAttribute(PageReturnAttributeKeyword.COURSE_LIST, CourseForm.convertFrom(courseModelList));
|
||||
model.addAttribute(PageReturnAttributeKeyword.COURSE_INFO_LIST,
|
||||
CourseInfoForm.convertFrom(courseInfoService.findAll()));
|
||||
|
||||
return TransitionTargetPageNameKeyword.SELECT_COURSE_HTML;
|
||||
|
||||
}
|
||||
|
||||
@SessionCheck
|
||||
@PostMapping("/change")
|
||||
@PostMapping(TransitionTargetPageNameKeyword.CHANGE)
|
||||
public String changeCourse(@RequestParam Long courseId, HttpSession httpSession) {
|
||||
|
||||
LoginModel loginUser = (LoginModel) httpSession.getAttribute("loginUser");
|
||||
LoginModel loginUser = (LoginModel) httpSession.getAttribute(SessionKeyword.LOGIN_USER);
|
||||
|
||||
userService.updateCourse(loginUser.getUserId(), courseId);
|
||||
|
||||
return "redirect:/menu";
|
||||
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.MENU;
|
||||
}
|
||||
|
||||
@SessionCheck
|
||||
@GetMapping("/course/create")
|
||||
@GetMapping(TransitionTargetPageNameKeyword.COURSE_CREATE)
|
||||
public String createCourseGet(@ModelAttribute CourseForm courseForm, HttpSession session) {
|
||||
|
||||
return "course_create";
|
||||
return TransitionTargetPageNameKeyword.COURSE_CREATE_HTML;
|
||||
}
|
||||
|
||||
@SessionCheck
|
||||
@PostMapping("/course/create/ratio")
|
||||
public String createCourse(@ModelAttribute CourseForm courseForm, @ModelAttribute AllocationFormList allocationFormList,
|
||||
@PostMapping(TransitionTargetPageNameKeyword.COURSE_CREATE_RATIO)
|
||||
public String createCourse(@ModelAttribute CourseForm courseForm,
|
||||
@ModelAttribute AllocationFormList allocationFormList,
|
||||
HttpSession session, Model model) {
|
||||
|
||||
LoginModel loginUser = (LoginModel) session.getAttribute("loginUser");
|
||||
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
|
||||
|
||||
CourseForm form = CourseForm.convertFrom(courseService.save(CourseForm.convertTo(courseForm), loginUser.getUserId()));
|
||||
CourseForm form = CourseForm
|
||||
.convertFrom(courseService.save(CourseForm.convertTo(courseForm), loginUser.getUserId()));
|
||||
|
||||
session.setAttribute("courseId", form.getCourseId());
|
||||
session.setAttribute(PageReturnAttributeKeyword.COURSE_ID, form.getCourseId());
|
||||
|
||||
return "course_create_ratio";
|
||||
return TransitionTargetPageNameKeyword.COURSE_CREATE_RATIO_HTML;
|
||||
}
|
||||
|
||||
@SessionCheck
|
||||
@PostMapping("/course/create")
|
||||
@PostMapping(TransitionTargetPageNameKeyword.COURSE_CREATE)
|
||||
public String createCoursePost(@ModelAttribute AllocationFormList allocationFormList, HttpSession session) {
|
||||
|
||||
|
||||
List<AllocationModel> allocationModelList = new ArrayList<>();
|
||||
|
||||
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId1(), (Long) session.getAttribute("courseId"), allocationFormList.getAllocationRatio1()));
|
||||
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId2(), (Long) session.getAttribute("courseId"), allocationFormList.getAllocationRatio2()));
|
||||
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId3(), (Long) session.getAttribute("courseId"), allocationFormList.getAllocationRatio3()));
|
||||
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId4(), (Long) session.getAttribute("courseId"), allocationFormList.getAllocationRatio4()));
|
||||
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId5(), (Long) session.getAttribute("courseId"), allocationFormList.getAllocationRatio5()));
|
||||
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId6(), (Long) session.getAttribute("courseId"), allocationFormList.getAllocationRatio6()));
|
||||
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId7(), (Long) session.getAttribute("courseId"), allocationFormList.getAllocationRatio7()));
|
||||
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId8(), (Long) session.getAttribute("courseId"), allocationFormList.getAllocationRatio8()));
|
||||
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId9(), (Long) session.getAttribute("courseId"), allocationFormList.getAllocationRatio9()));
|
||||
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId10(), (Long) session.getAttribute("courseId"), allocationFormList.getAllocationRatio10()));
|
||||
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId11(), (Long) session.getAttribute("courseId"), allocationFormList.getAllocationRatio11()));
|
||||
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId1(),
|
||||
(Long) session.getAttribute(PageReturnAttributeKeyword.COURSE_ID),
|
||||
allocationFormList.getAllocationRatio1()));
|
||||
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId2(),
|
||||
(Long) session.getAttribute(PageReturnAttributeKeyword.COURSE_ID),
|
||||
allocationFormList.getAllocationRatio2()));
|
||||
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId3(),
|
||||
(Long) session.getAttribute(PageReturnAttributeKeyword.COURSE_ID),
|
||||
allocationFormList.getAllocationRatio3()));
|
||||
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId4(),
|
||||
(Long) session.getAttribute(PageReturnAttributeKeyword.COURSE_ID),
|
||||
allocationFormList.getAllocationRatio4()));
|
||||
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId5(),
|
||||
(Long) session.getAttribute(PageReturnAttributeKeyword.COURSE_ID),
|
||||
allocationFormList.getAllocationRatio5()));
|
||||
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId6(),
|
||||
(Long) session.getAttribute(PageReturnAttributeKeyword.COURSE_ID),
|
||||
allocationFormList.getAllocationRatio6()));
|
||||
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId7(),
|
||||
(Long) session.getAttribute(PageReturnAttributeKeyword.COURSE_ID),
|
||||
allocationFormList.getAllocationRatio7()));
|
||||
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId8(),
|
||||
(Long) session.getAttribute(PageReturnAttributeKeyword.COURSE_ID),
|
||||
allocationFormList.getAllocationRatio8()));
|
||||
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId9(),
|
||||
(Long) session.getAttribute(PageReturnAttributeKeyword.COURSE_ID),
|
||||
allocationFormList.getAllocationRatio9()));
|
||||
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId10(),
|
||||
(Long) session.getAttribute(PageReturnAttributeKeyword.COURSE_ID),
|
||||
allocationFormList.getAllocationRatio10()));
|
||||
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId11(),
|
||||
(Long) session.getAttribute(PageReturnAttributeKeyword.COURSE_ID),
|
||||
allocationFormList.getAllocationRatio11()));
|
||||
|
||||
allocationService.save(allocationModelList);
|
||||
|
||||
return "redirect:/course";
|
||||
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.COURSE;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,10 +3,12 @@ package com.example.demo.app.presentation.controller;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
|
||||
import com.example.demo.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword;
|
||||
|
||||
@Controller
|
||||
public class ErrorController {
|
||||
@GetMapping("/error")
|
||||
@GetMapping(TransitionTargetPageNameKeyword.ERROR)
|
||||
public String showError() {
|
||||
return "error";
|
||||
return TransitionTargetPageNameKeyword.ERROR_HTML;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,9 @@ import com.example.demo.aop.aspect.SessionCheck;
|
||||
import com.example.demo.app.domain.model.LoginModel;
|
||||
import com.example.demo.app.domain.service.CategoryService;
|
||||
import com.example.demo.app.domain.service.FixedCostService;
|
||||
import com.example.demo.app.presentation.controller.pageproperty.PageReturnAttributeKeyword;
|
||||
import com.example.demo.app.presentation.controller.pageproperty.SessionKeyword;
|
||||
import com.example.demo.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword;
|
||||
import com.example.demo.app.presentation.form.CategoryForm;
|
||||
import com.example.demo.app.presentation.form.FixedCostForm;
|
||||
|
||||
@@ -29,30 +32,30 @@ public class FixedCostController {
|
||||
private final CategoryService categoryService;
|
||||
|
||||
@SessionCheck
|
||||
@GetMapping("/fixed-cost/list")
|
||||
@GetMapping(TransitionTargetPageNameKeyword.FIXED_COST_LIST)
|
||||
public String getFixedCostList(
|
||||
HttpSession session, Model model, LocalDate today) {
|
||||
|
||||
LoginModel loginUser = (LoginModel) session.getAttribute("loginUser");
|
||||
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
|
||||
|
||||
if (today == null) {
|
||||
today = (LocalDate) session.getAttribute("today");
|
||||
today = (LocalDate) session.getAttribute(PageReturnAttributeKeyword.TODAY);
|
||||
}
|
||||
|
||||
List<FixedCostForm> fixedCostFormList = FixedCostForm.convertFrom(fixedCostService.findAllByUserId(loginUser.getUserId()));
|
||||
|
||||
fixedCostFormList.forEach(fixedCostForm -> fixedCostForm.setCategoryName(categoryService.findOne(fixedCostForm.getCategoryId()).getCategoryName()));
|
||||
|
||||
model.addAttribute("fixedCostFormList", fixedCostFormList);
|
||||
model.addAttribute(PageReturnAttributeKeyword.FIXED_COST_FORM_LIST, fixedCostFormList);
|
||||
|
||||
model.addAttribute("today", today);
|
||||
model.addAttribute(PageReturnAttributeKeyword.TODAY, today);
|
||||
|
||||
return "fixed_cost";
|
||||
return TransitionTargetPageNameKeyword.FIXED_COST_HTML;
|
||||
}
|
||||
|
||||
|
||||
@SessionCheck
|
||||
@GetMapping("/fixed-cost/create")
|
||||
@GetMapping(TransitionTargetPageNameKeyword.FIXED_COST_CREATE)
|
||||
public String getFixedCostCreate(
|
||||
HttpSession session, @ModelAttribute FixedCostForm fixedCostForm, Model model, LocalDate today) {
|
||||
|
||||
@@ -72,42 +75,42 @@ public class FixedCostController {
|
||||
|
||||
}
|
||||
|
||||
model.addAttribute("expenseList", expenseList);
|
||||
model.addAttribute("incomeList", incomeList);
|
||||
model.addAttribute("today", today);
|
||||
model.addAttribute(PageReturnAttributeKeyword.EXPENSE_LIST, expenseList);
|
||||
model.addAttribute(PageReturnAttributeKeyword.INCOME_LIST, incomeList);
|
||||
model.addAttribute(PageReturnAttributeKeyword.TODAY, today);
|
||||
|
||||
|
||||
return "fixed_cost_create";
|
||||
return TransitionTargetPageNameKeyword.FIXED_COST_CREATE_HTML;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@SessionCheck
|
||||
@PostMapping("/fixed-cost/create")
|
||||
@PostMapping(TransitionTargetPageNameKeyword.FIXED_COST_CREATE)
|
||||
public String postFixedCostCreate(
|
||||
HttpSession session, @ModelAttribute FixedCostForm fixedCostForm, Model model, LocalDate today) {
|
||||
|
||||
LoginModel loginUser = (LoginModel) session.getAttribute("loginUser");
|
||||
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
|
||||
|
||||
fixedCostForm.setUserId(loginUser.getUserId());
|
||||
|
||||
fixedCostService.save(FixedCostForm.convertTo(fixedCostForm));
|
||||
|
||||
session.setAttribute("today", today);
|
||||
session.setAttribute(PageReturnAttributeKeyword.TODAY, today);
|
||||
|
||||
return "redirect:/fixed-cost/list";
|
||||
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.FIXED_COST_LIST;
|
||||
}
|
||||
|
||||
|
||||
@SessionCheck
|
||||
@PostMapping("/fixed-cost/delete")
|
||||
@PostMapping(TransitionTargetPageNameKeyword.FIXED_COST_DELETE)
|
||||
public String postFixedCostDelete(Long fixedCostId, LocalDate today, HttpSession session) {
|
||||
|
||||
fixedCostService.delete(fixedCostId);
|
||||
|
||||
session.setAttribute("today", today);
|
||||
session.setAttribute(PageReturnAttributeKeyword.TODAY, today);
|
||||
|
||||
return "redirect:/fixed-cost/list";
|
||||
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.FIXED_COST_LIST;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -25,6 +25,9 @@ import com.example.demo.app.domain.service.CategoryService;
|
||||
import com.example.demo.app.domain.service.GoalService;
|
||||
import com.example.demo.app.domain.service.TransactionService;
|
||||
import com.example.demo.app.domain.service.UserService;
|
||||
import com.example.demo.app.presentation.controller.pageproperty.PageReturnAttributeKeyword;
|
||||
import com.example.demo.app.presentation.controller.pageproperty.SessionKeyword;
|
||||
import com.example.demo.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword;
|
||||
import com.example.demo.app.presentation.form.CategoryForm;
|
||||
import com.example.demo.app.presentation.form.GoalForm;
|
||||
import com.example.demo.app.presentation.form.MonthlyAchievementForm;
|
||||
@@ -35,7 +38,7 @@ import lombok.RequiredArgsConstructor;
|
||||
|
||||
@Controller
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/goal")
|
||||
@RequestMapping(TransitionTargetPageNameKeyword.GOAL)
|
||||
public class GoalController {
|
||||
|
||||
private final GoalService goalService;
|
||||
@@ -50,10 +53,12 @@ public class GoalController {
|
||||
HttpSession session,
|
||||
Long goalId) {
|
||||
|
||||
LoginModel loginUser = (LoginModel) session.getAttribute("loginUser");
|
||||
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
|
||||
|
||||
Long userId = loginUser.getUserId();
|
||||
|
||||
goalService.updateGoalComplete(userId);
|
||||
|
||||
List<GoalModel> goalModelList = goalService.getGoalByUserId(userId);
|
||||
|
||||
List<GoalForm> goalFormList1 = GoalForm.convertFrom(goalModelList);
|
||||
@@ -63,11 +68,15 @@ public class GoalController {
|
||||
.collect(Collectors.toList());
|
||||
|
||||
model.addAttribute(
|
||||
"goalFormList",
|
||||
PageReturnAttributeKeyword.GOAL_FORM_LIST,
|
||||
goalFormList);
|
||||
|
||||
model.addAttribute(
|
||||
PageReturnAttributeKeyword.ACHIEVEMENT_LIST,
|
||||
new ArrayList<MonthlyAchievementForm>());
|
||||
|
||||
if (goalFormList.isEmpty()) {
|
||||
return "goal_view";
|
||||
return TransitionTargetPageNameKeyword.GOAL_VIEW_HTML;
|
||||
}
|
||||
|
||||
GoalForm graphGoal;
|
||||
@@ -86,7 +95,7 @@ public class GoalController {
|
||||
}
|
||||
|
||||
model.addAttribute(
|
||||
"graphGoal",
|
||||
PageReturnAttributeKeyword.GRAPH_GOAL,
|
||||
graphGoal);
|
||||
|
||||
int currentAmount = graphGoal.getCurrentAmount();
|
||||
@@ -188,7 +197,8 @@ public class GoalController {
|
||||
month = month.minusMonths(1);
|
||||
}
|
||||
|
||||
Collections.reverse(monthlySavingList);
|
||||
Collections.reverse(
|
||||
monthlySavingList);
|
||||
|
||||
List<MonthlyAchievementForm> achievementList = new ArrayList<>();
|
||||
|
||||
@@ -213,30 +223,32 @@ public class GoalController {
|
||||
}
|
||||
|
||||
model.addAttribute(
|
||||
"achievementList",
|
||||
PageReturnAttributeKeyword.ACHIEVEMENT_LIST,
|
||||
achievementList);
|
||||
|
||||
return "goal_view";
|
||||
return TransitionTargetPageNameKeyword.GOAL_VIEW_HTML;
|
||||
}
|
||||
|
||||
@SessionCheck
|
||||
@GetMapping("/edit")
|
||||
@GetMapping(TransitionTargetPageNameKeyword.EDIT)
|
||||
public String editGoal(Model model, HttpSession session, Long goalId) {
|
||||
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
|
||||
|
||||
LoginModel loginUser = (LoginModel) session.getAttribute("loginUser");
|
||||
Long userId = loginUser.getUserId();
|
||||
|
||||
GoalForm goalForm = GoalForm.convertFrom(goalService.getGoalById(goalId));
|
||||
|
||||
model.addAttribute("goalForm", goalForm);
|
||||
return "goal_edit";
|
||||
|
||||
model.addAttribute(PageReturnAttributeKeyword.GOAL_FORM, goalForm);
|
||||
return TransitionTargetPageNameKeyword.GOAL_EDIT_HTML;
|
||||
|
||||
}
|
||||
|
||||
@SessionCheck
|
||||
@PostMapping("/update")
|
||||
@PostMapping(TransitionTargetPageNameKeyword.UPDATE)
|
||||
public String updateGoal(@ModelAttribute GoalForm goalForm, HttpSession session) {
|
||||
|
||||
LoginModel loginUser = (LoginModel) session.getAttribute("loginUser");
|
||||
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
|
||||
|
||||
Long userId = loginUser.getUserId();
|
||||
|
||||
@@ -250,48 +262,59 @@ public class GoalController {
|
||||
GoalModel goalModel = GoalModel.convertFrom(goalForm);
|
||||
goalService.updateGoal(goalModel, userId);
|
||||
|
||||
return "redirect:/goal";
|
||||
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.GOAL;
|
||||
}
|
||||
|
||||
@SessionCheck
|
||||
@GetMapping("/create")
|
||||
public String createGoalGet(@ModelAttribute GoalForm goalForm, HttpSession session) {
|
||||
@GetMapping(TransitionTargetPageNameKeyword.CREATE)
|
||||
public String createGoalGet(@ModelAttribute GoalForm goalForm, HttpSession session, Model model) {
|
||||
|
||||
return "goal_create";
|
||||
}
|
||||
|
||||
@SessionCheck
|
||||
@PostMapping("/create")
|
||||
public String createGoalPost(@ModelAttribute GoalForm goalForm, HttpSession session) {
|
||||
|
||||
LoginModel loginUser = (LoginModel) session.getAttribute("loginUser");
|
||||
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
|
||||
|
||||
Long userId = loginUser.getUserId();
|
||||
|
||||
goalService.createGoal(GoalModel.convertFrom(goalForm), userId);
|
||||
int currentAmount = goalService.getCurrentAmount(userId);
|
||||
|
||||
return "redirect:/goal";
|
||||
model.addAttribute("currentAmount", currentAmount);
|
||||
|
||||
return TransitionTargetPageNameKeyword.GOAL_CREATE_HTML;
|
||||
}
|
||||
|
||||
@SessionCheck
|
||||
@PostMapping("/delete") // フラグ考慮してないため、今度修正必要
|
||||
@PostMapping(TransitionTargetPageNameKeyword.CREATE)
|
||||
public String createGoalPost(@ModelAttribute GoalForm goalForm, HttpSession session, Model model) {
|
||||
|
||||
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
|
||||
|
||||
Long userId = loginUser.getUserId();
|
||||
|
||||
if (goalService.createGoal(GoalModel.convertFrom(goalForm), userId) == null) {
|
||||
model.addAttribute(PageReturnAttributeKeyword.MESSAGE, "現在所持金より高い金額を設定してください。");
|
||||
return TransitionTargetPageNameKeyword.GOAL_CREATE_HTML;
|
||||
}
|
||||
|
||||
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.GOAL;
|
||||
}
|
||||
|
||||
@SessionCheck
|
||||
@PostMapping(TransitionTargetPageNameKeyword.DELETE) // フラグ考慮してないため、今度修正必要
|
||||
public String deleteGoal(Long goalId, Long record) {
|
||||
|
||||
goalService.delete(goalId);
|
||||
|
||||
if (record == null) {
|
||||
return "redirect:/goal";
|
||||
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.GOAL;
|
||||
} else {
|
||||
return "redirect:/goal/record";
|
||||
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.GOAL + TransitionTargetPageNameKeyword.RECORD;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@SessionCheck
|
||||
@GetMapping("/record")
|
||||
@GetMapping(TransitionTargetPageNameKeyword.RECORD)
|
||||
public String getRecord(HttpSession session, Model model) {
|
||||
|
||||
LoginModel loginUser = (LoginModel) session.getAttribute("loginUser");
|
||||
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
|
||||
|
||||
Long userId = loginUser.getUserId();
|
||||
goalService.updateGoalComplete(userId);
|
||||
@@ -308,10 +331,10 @@ public class GoalController {
|
||||
});
|
||||
|
||||
model.addAttribute(
|
||||
"goalCompleteFormList",
|
||||
PageReturnAttributeKeyword.GOAL_COMPLETE_FORM_LIST,
|
||||
goalCompleteFormList);
|
||||
|
||||
return "goal_record";
|
||||
return TransitionTargetPageNameKeyword.GOAL_RECORD_HTML;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -10,6 +10,9 @@ import org.springframework.web.bind.annotation.PostMapping;
|
||||
|
||||
import com.example.demo.app.domain.model.LoginModel;
|
||||
import com.example.demo.app.domain.service.LoginService;
|
||||
import com.example.demo.app.presentation.controller.pageproperty.PageReturnAttributeKeyword;
|
||||
import com.example.demo.app.presentation.controller.pageproperty.SessionKeyword;
|
||||
import com.example.demo.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword;
|
||||
import com.example.demo.app.presentation.form.LoginForm;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -18,35 +21,40 @@ import lombok.RequiredArgsConstructor;
|
||||
@RequiredArgsConstructor
|
||||
public class LoginController {
|
||||
|
||||
private final LoginService loginService;
|
||||
private final LoginService loginService;
|
||||
|
||||
@GetMapping("/login")
|
||||
public String showLogin(@ModelAttribute LoginForm loginForm) {
|
||||
@GetMapping(TransitionTargetPageNameKeyword.LOGIN)
|
||||
public String showLogin(@ModelAttribute LoginForm loginForm, HttpSession session) {
|
||||
|
||||
return "login";
|
||||
}
|
||||
if (session.getAttribute(SessionKeyword.LOGIN_USER) != null) {
|
||||
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.MENU;
|
||||
}
|
||||
|
||||
@PostMapping("/login")
|
||||
public String login(
|
||||
@ModelAttribute LoginForm loginForm,
|
||||
Model model,
|
||||
HttpSession session) {
|
||||
return TransitionTargetPageNameKeyword.LOGIN_HTML;
|
||||
|
||||
LoginModel loginModel = loginService.login(
|
||||
loginForm.getMailAddress(),
|
||||
loginForm.getPassword());
|
||||
}
|
||||
|
||||
if (loginModel == null) {
|
||||
model.addAttribute(
|
||||
"errorMessage",
|
||||
"Email address or password is incorrect.");
|
||||
@PostMapping(TransitionTargetPageNameKeyword.LOGIN)
|
||||
public String login(
|
||||
@ModelAttribute LoginForm loginForm,
|
||||
Model model,
|
||||
HttpSession session) {
|
||||
|
||||
return "login";
|
||||
}
|
||||
LoginModel loginModel = loginService.login(
|
||||
loginForm.getMailAddress(),
|
||||
loginForm.getPassword());
|
||||
|
||||
session.setAttribute("loginUser", loginModel);
|
||||
if (loginModel == null) {
|
||||
model.addAttribute(
|
||||
PageReturnAttributeKeyword.ERROR_MESSAGE,
|
||||
"IDまたはパスワードが間違っています.");
|
||||
|
||||
return "redirect:/menu";
|
||||
}
|
||||
return TransitionTargetPageNameKeyword.LOGIN_HTML;
|
||||
}
|
||||
|
||||
session.setAttribute(SessionKeyword.LOGIN_USER, loginModel);
|
||||
|
||||
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.MENU;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -9,6 +9,9 @@ import org.springframework.web.bind.annotation.PostMapping;
|
||||
|
||||
import com.example.demo.app.domain.model.LoginModel;
|
||||
import com.example.demo.app.domain.service.PasswordResetService;
|
||||
import com.example.demo.app.presentation.controller.pageproperty.PageReturnAttributeKeyword;
|
||||
import com.example.demo.app.presentation.controller.pageproperty.SessionKeyword;
|
||||
import com.example.demo.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword;
|
||||
import com.example.demo.app.presentation.form.PasswordResetForm;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -18,53 +21,50 @@ import lombok.RequiredArgsConstructor;
|
||||
public class PasswordResetController {
|
||||
private final PasswordResetService passwordResetService;
|
||||
|
||||
@GetMapping("/password/reset")
|
||||
@GetMapping(TransitionTargetPageNameKeyword.PASSWORD_RESET)
|
||||
public String showPasswordReset(Model model) {
|
||||
model.addAttribute("passwordResetForm", new PasswordResetForm());
|
||||
return "password_reset";
|
||||
model.addAttribute(PageReturnAttributeKeyword.PASSWOR_RESET_FORM, new PasswordResetForm());
|
||||
return TransitionTargetPageNameKeyword.PASSWORD_RESET_HTML;
|
||||
}
|
||||
|
||||
@PostMapping("/password/reset")
|
||||
@PostMapping(TransitionTargetPageNameKeyword.PASSWORD_RESET)
|
||||
public String resetPassword(
|
||||
PasswordResetForm passwordResetForm,
|
||||
Model model,
|
||||
HttpSession session){
|
||||
PasswordResetForm passwordResetForm,
|
||||
Model model,
|
||||
HttpSession session) {
|
||||
|
||||
Long userId =
|
||||
(Long) session.getAttribute("passwordResetUserId");
|
||||
Long userId = (Long) session.getAttribute(PageReturnAttributeKeyword.PASSWOR_RESET_USER_ID);
|
||||
|
||||
if (userId == null) {
|
||||
LoginModel loginUser =
|
||||
(LoginModel) session.getAttribute("loginUser");
|
||||
if (userId == null) {
|
||||
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
|
||||
|
||||
if (loginUser != null) {
|
||||
userId = loginUser.getUserId();
|
||||
}
|
||||
}
|
||||
if (loginUser != null) {
|
||||
userId = loginUser.getUserId();
|
||||
}
|
||||
}
|
||||
|
||||
if (userId == null) {
|
||||
return "redirect:/login";
|
||||
}
|
||||
if (userId == null) {
|
||||
return TransitionTargetPageNameKeyword.REDIRECT +
|
||||
TransitionTargetPageNameKeyword.LOGIN;
|
||||
}
|
||||
|
||||
boolean isReset =
|
||||
passwordResetService.resetPassword(userId, passwordResetForm);
|
||||
boolean isReset = passwordResetService.resetPassword(userId, passwordResetForm);
|
||||
|
||||
System.out.println("isReset=" + isReset);
|
||||
if (!isReset) {
|
||||
model.addAttribute(PageReturnAttributeKeyword.MESSAGE, "パスワードが一致しません。");
|
||||
return TransitionTargetPageNameKeyword.PASSWORD_RESET_HTML;
|
||||
}
|
||||
|
||||
if(!isReset) {
|
||||
model.addAttribute("Message", "パスワードが一致しません。");
|
||||
return "password_reset";
|
||||
}
|
||||
session.removeAttribute(PageReturnAttributeKeyword.PASSWOR_RESET_USER_ID);
|
||||
|
||||
session.removeAttribute("passwordResetUserId");
|
||||
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
|
||||
|
||||
LoginModel loginUser =
|
||||
(LoginModel) session.getAttribute("loginUser");
|
||||
if (loginUser != null) {
|
||||
return TransitionTargetPageNameKeyword.REDIRECT +
|
||||
TransitionTargetPageNameKeyword.PROFILE;
|
||||
}
|
||||
|
||||
if (loginUser != null) {
|
||||
return "redirect:/menu";
|
||||
}
|
||||
|
||||
return "redirect:/login";
|
||||
return TransitionTargetPageNameKeyword.REDIRECT +
|
||||
TransitionTargetPageNameKeyword.LOGIN;
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,9 @@ import com.example.demo.aop.aspect.SessionCheck;
|
||||
import com.example.demo.app.domain.model.LoginModel;
|
||||
import com.example.demo.app.domain.model.ProfileModel;
|
||||
import com.example.demo.app.domain.service.ProfileService;
|
||||
import com.example.demo.app.presentation.controller.pageproperty.PageReturnAttributeKeyword;
|
||||
import com.example.demo.app.presentation.controller.pageproperty.SessionKeyword;
|
||||
import com.example.demo.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword;
|
||||
import com.example.demo.app.presentation.form.ProfileEditForm;
|
||||
import com.example.demo.app.presentation.form.ProfileForm;
|
||||
|
||||
@@ -23,26 +26,26 @@ public class ProfileController {
|
||||
private final ProfileService profileService;
|
||||
|
||||
@SessionCheck
|
||||
@GetMapping("/profile")
|
||||
@GetMapping(TransitionTargetPageNameKeyword.PROFILE)
|
||||
public String profile(Model model, HttpSession session) {
|
||||
LoginModel loginUser = (LoginModel) session.getAttribute("loginUser");
|
||||
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
|
||||
|
||||
ProfileModel profileModel = profileService.findOne(loginUser.getUserId());
|
||||
|
||||
ProfileForm profileForm = ProfileForm.convertForm(profileModel);
|
||||
|
||||
model.addAttribute("profileForm", profileForm);
|
||||
return "profile";
|
||||
model.addAttribute(PageReturnAttributeKeyword.PROFILE_FORM, profileForm);
|
||||
return TransitionTargetPageNameKeyword.PROFILE_HTML;
|
||||
}
|
||||
|
||||
@SessionCheck
|
||||
@GetMapping("/profile/edit")
|
||||
@GetMapping(TransitionTargetPageNameKeyword.PROFILE_EDIT)
|
||||
public String showEditProfile(
|
||||
Model model,
|
||||
HttpSession session) {
|
||||
|
||||
LoginModel loginUser =
|
||||
(LoginModel) session.getAttribute("loginUser");
|
||||
(LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
|
||||
|
||||
ProfileModel profileModel =
|
||||
profileService.findOne(loginUser.getUserId());
|
||||
@@ -51,46 +54,48 @@ public class ProfileController {
|
||||
new ProfileEditForm(
|
||||
profileModel.getUserName(),
|
||||
profileModel.getMailAddress(),
|
||||
profileModel.getBirthDate(),
|
||||
profileModel.getSaving(),
|
||||
profileModel.getAnnualIncome(),
|
||||
profileModel.getMonthlyBudget());
|
||||
profileModel.getMonthlyBudget(),
|
||||
profileModel.getBirthDate());
|
||||
|
||||
model.addAttribute("profileEditForm", profileEditForm);
|
||||
return "profile_edit";
|
||||
model.addAttribute(PageReturnAttributeKeyword.PROFILE_EDIT_FORM, profileEditForm);
|
||||
return TransitionTargetPageNameKeyword.PROFILE_EDIT_HTML;
|
||||
}
|
||||
|
||||
@PostMapping("/profile/edit")
|
||||
@PostMapping(TransitionTargetPageNameKeyword.PROFILE_EDIT)
|
||||
public String updateProfile(
|
||||
@ModelAttribute ProfileEditForm profileEditForm,
|
||||
HttpSession session) {
|
||||
|
||||
LoginModel loginUser =
|
||||
(LoginModel) session.getAttribute("loginUser");
|
||||
(LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
|
||||
|
||||
profileService.update(
|
||||
loginUser.getUserId(),
|
||||
profileEditForm);
|
||||
|
||||
return "redirect:/profile";
|
||||
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.PROFILE;
|
||||
}
|
||||
|
||||
@PostMapping("/withdraw")
|
||||
@PostMapping(TransitionTargetPageNameKeyword.WITHDRAW)
|
||||
public String withdraw(HttpSession session) {
|
||||
|
||||
LoginModel loginUser =
|
||||
(LoginModel) session.getAttribute("loginUser");
|
||||
(LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
|
||||
|
||||
profileService.withdraw(loginUser.getUserId());
|
||||
|
||||
session.invalidate();
|
||||
|
||||
return "redirect:/login";
|
||||
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.LOGIN;
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/logout")
|
||||
@PostMapping(TransitionTargetPageNameKeyword.LOGOUT)
|
||||
public String logout(HttpSession session) {
|
||||
session.invalidate();
|
||||
return "redirect:/login";
|
||||
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.LOGIN;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,9 +25,13 @@ import com.example.demo.app.domain.service.FixedCostService;
|
||||
import com.example.demo.app.domain.service.GoalService;
|
||||
import com.example.demo.app.domain.service.TransactionService;
|
||||
import com.example.demo.app.domain.service.UserService;
|
||||
import com.example.demo.app.presentation.controller.pageproperty.PageReturnAttributeKeyword;
|
||||
import com.example.demo.app.presentation.controller.pageproperty.SessionKeyword;
|
||||
import com.example.demo.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword;
|
||||
import com.example.demo.app.presentation.form.CategoryForm;
|
||||
import com.example.demo.app.presentation.form.Expense;
|
||||
import com.example.demo.app.presentation.form.FixedCostForm;
|
||||
import com.example.demo.app.presentation.form.GoalForm;
|
||||
import com.example.demo.app.presentation.form.Income;
|
||||
import com.example.demo.app.presentation.form.TransactionForm;
|
||||
import com.example.demo.app.presentation.form.UserForm;
|
||||
@@ -46,14 +50,14 @@ public class TransactionController {
|
||||
|
||||
// 一覧画面
|
||||
@SessionCheck
|
||||
@GetMapping("/transaction/list")
|
||||
@GetMapping(TransitionTargetPageNameKeyword.TRANSACTION_LIST)
|
||||
public String transactionList(
|
||||
@RequestParam(required = false, defaultValue = "0") String years,
|
||||
@RequestParam(required = false, defaultValue = "0") String months,
|
||||
Model model,
|
||||
HttpSession session) {
|
||||
|
||||
LoginModel loginUser = (LoginModel) session.getAttribute("loginUser");
|
||||
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
|
||||
|
||||
LocalDate today = LocalDate.now();
|
||||
|
||||
@@ -114,28 +118,28 @@ public class TransactionController {
|
||||
transactionFormMap.put(date, transactionFormList);
|
||||
});
|
||||
|
||||
model.addAttribute("year", year);
|
||||
model.addAttribute("month", month);
|
||||
model.addAttribute(PageReturnAttributeKeyword.YEAR, year);
|
||||
model.addAttribute(PageReturnAttributeKeyword.MONTH, month);
|
||||
|
||||
model.addAttribute("previousYear", previousYear);
|
||||
model.addAttribute("previousMonth", previousMonth);
|
||||
model.addAttribute(PageReturnAttributeKeyword.PREVIOUS_YEAR, previousYear);
|
||||
model.addAttribute(PageReturnAttributeKeyword.PREVIOUS_MONTH, previousMonth);
|
||||
|
||||
model.addAttribute("nextYear", nextYear);
|
||||
model.addAttribute("nextMonth", nextMonth);
|
||||
model.addAttribute(PageReturnAttributeKeyword.NEXT_YEAR, nextYear);
|
||||
model.addAttribute(PageReturnAttributeKeyword.NEXT_MONTH, nextMonth);
|
||||
|
||||
model.addAttribute("transactionFormMap", transactionFormMap);
|
||||
model.addAttribute(PageReturnAttributeKeyword.TRANSACTION_FORM_MAP, transactionFormMap);
|
||||
|
||||
return "transaction_list";
|
||||
return TransitionTargetPageNameKeyword.TRANSACTION_LIST_HTML;
|
||||
}
|
||||
|
||||
// 詳細画面
|
||||
@SessionCheck
|
||||
@GetMapping("/transaction/detail")
|
||||
@GetMapping(TransitionTargetPageNameKeyword.TRANSACTION_DETAIL)
|
||||
public String findOne(@RequestParam(required = false) LocalDate todayDates, Model model, HttpSession session) {
|
||||
|
||||
LocalDate todayDate = (todayDates == null) ? LocalDate.now() : todayDates;
|
||||
|
||||
LoginModel loginUser = (LoginModel) session.getAttribute("loginUser");
|
||||
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
|
||||
|
||||
List<TransactionForm> transactionFormList = transactionService
|
||||
.findByUserIdAndDate(todayDate, loginUser.getUserId()).stream()
|
||||
@@ -176,19 +180,19 @@ public class TransactionController {
|
||||
return transactionForm;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
model.addAttribute("today", todayDate);
|
||||
model.addAttribute("transactionFormList", transactionFormList);
|
||||
model.addAttribute(PageReturnAttributeKeyword.TODAY, todayDate);
|
||||
model.addAttribute(PageReturnAttributeKeyword.TRANSACTION_FORM_LIST, transactionFormList);
|
||||
|
||||
return "transaction_detail";
|
||||
return TransitionTargetPageNameKeyword.TRANSACTION_DETAIL_HTML;
|
||||
}
|
||||
|
||||
@SessionCheck
|
||||
@GetMapping("/transaction/create")
|
||||
@GetMapping(TransitionTargetPageNameKeyword.TRANSACTION_CREATE)
|
||||
public String createOneGet(@RequestParam(defaultValue = "") LocalDate today,
|
||||
Long fixedCostId,
|
||||
Model model, HttpSession session) {
|
||||
|
||||
LoginModel loginUser = (LoginModel) session.getAttribute("loginUser");
|
||||
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
|
||||
if (today == null) {
|
||||
today = LocalDate.now();
|
||||
}
|
||||
@@ -214,39 +218,62 @@ public class TransactionController {
|
||||
}
|
||||
}
|
||||
|
||||
System.out.println(transactionForm.getCategoryName() + " " + transactionForm.getAmount());
|
||||
|
||||
model.addAttribute("transactionForm", transactionForm);
|
||||
List<CategoryForm> expenseList = new ArrayList<CategoryForm>();
|
||||
|
||||
model.addAttribute("categoryFormList", categoryFormList);
|
||||
List<CategoryForm> incomeList = new ArrayList<CategoryForm>();
|
||||
|
||||
model.addAttribute("today", today.format(DateTimeFormatter.ISO_LOCAL_DATE));
|
||||
for (CategoryForm categoryForm : categoryFormList) {
|
||||
|
||||
return "transaction_create";
|
||||
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_FORM, transactionForm);
|
||||
|
||||
session.setAttribute("tType", String.valueOf(transactionForm.getTransactionType()));
|
||||
|
||||
model.addAttribute(PageReturnAttributeKeyword.CATEGORY_FORM_LIST, categoryFormList);
|
||||
|
||||
model.addAttribute(PageReturnAttributeKeyword.TODAY, today.format(DateTimeFormatter.ISO_LOCAL_DATE));
|
||||
|
||||
return TransitionTargetPageNameKeyword.TRANSACTION_CREATE_HTML;
|
||||
}
|
||||
|
||||
@SessionCheck
|
||||
@PostMapping("/transaction/create")
|
||||
@PostMapping(TransitionTargetPageNameKeyword.TRANSACTION_CREATE)
|
||||
public String createOnePost(@ModelAttribute TransactionForm transactionForm, @RequestParam LocalDate today,
|
||||
Model model,
|
||||
HttpSession session) {
|
||||
|
||||
LoginModel loginUser = (LoginModel) session.getAttribute("loginUser");
|
||||
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
|
||||
transactionForm.setUserId(loginUser.getUserId());
|
||||
if (transactionService.createTransaction(TransactionForm.convertTo(transactionForm)) != 0) {
|
||||
return "error";
|
||||
return TransitionTargetPageNameKeyword.ERROR_HTML;
|
||||
}
|
||||
|
||||
return "redirect:/transaction/detail?todayDates=" + transactionForm.getTransactionDate();
|
||||
return TransitionTargetPageNameKeyword.REDIRECT +
|
||||
TransitionTargetPageNameKeyword.TRANSACTION_DETAIL +
|
||||
TransitionTargetPageNameKeyword.INTERROGATION +
|
||||
TransitionTargetPageNameKeyword.TODAY_DATES +
|
||||
TransitionTargetPageNameKeyword.EQUAL +
|
||||
transactionForm.getTransactionDate();
|
||||
|
||||
}
|
||||
|
||||
@SessionCheck
|
||||
@GetMapping("/transaction/update")
|
||||
@GetMapping(TransitionTargetPageNameKeyword.TRANSACTION_UPDATE)
|
||||
public String updateOneGet(@RequestParam Long transactionId, @RequestParam(defaultValue = "") LocalDate today,
|
||||
Model model, HttpSession session) {
|
||||
|
||||
LoginModel loginUser = (LoginModel) session.getAttribute("loginUser");
|
||||
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
|
||||
if (today == null) {
|
||||
today = LocalDate.now();
|
||||
}
|
||||
@@ -270,54 +297,62 @@ public class TransactionController {
|
||||
transactionService.findMoneyRecord(transactionId),
|
||||
CategoryForm.convertFrom(categoryService.findByTransactionId(transactionId)).getTransactionType());
|
||||
|
||||
System.out.println("category: " + transactionForm.getCategoryId() + "金額: " + transactionForm.getAmount());
|
||||
model.addAttribute(PageReturnAttributeKeyword.TRANSACTION_ID, transactionId);
|
||||
|
||||
model.addAttribute("transactionId", transactionId);
|
||||
model.addAttribute(PageReturnAttributeKeyword.TRANSACTION_FORM, transactionForm);
|
||||
|
||||
model.addAttribute("transactionForm", transactionForm);
|
||||
model.addAttribute(PageReturnAttributeKeyword.CATEGORY_FORM_LIST, categoryFormList);
|
||||
|
||||
model.addAttribute("categoryFormList", categoryFormList);
|
||||
model.addAttribute(PageReturnAttributeKeyword.TODAY, today);
|
||||
|
||||
model.addAttribute("today", today);
|
||||
|
||||
return "transaction_update";
|
||||
return TransitionTargetPageNameKeyword.TRANSACTION_UPDATE_HTML;
|
||||
|
||||
}
|
||||
|
||||
@SessionCheck
|
||||
@PostMapping("/transaction/update")
|
||||
@PostMapping(TransitionTargetPageNameKeyword.TRANSACTION_UPDATE)
|
||||
public String updateOnePost(@RequestParam Long transactionId, @ModelAttribute TransactionForm transactionForm,
|
||||
@RequestParam LocalDate today, Model model,
|
||||
HttpSession session) {
|
||||
|
||||
LoginModel loginUser = (LoginModel) session.getAttribute("loginUser");
|
||||
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
|
||||
|
||||
transactionForm.setUserId(loginUser.getUserId());
|
||||
transactionForm.setTransactionId(transactionId);
|
||||
|
||||
if (transactionService.updateTransaction(TransactionForm.convertTo(transactionForm)) != 0) {
|
||||
return "error";
|
||||
return TransitionTargetPageNameKeyword.ERROR_HTML;
|
||||
}
|
||||
|
||||
return "redirect:/transaction/detail?todayDates=" + transactionForm.getTransactionDate();
|
||||
return TransitionTargetPageNameKeyword.REDIRECT +
|
||||
TransitionTargetPageNameKeyword.TRANSACTION_DETAIL +
|
||||
TransitionTargetPageNameKeyword.INTERROGATION +
|
||||
TransitionTargetPageNameKeyword.TODAY_DATES +
|
||||
TransitionTargetPageNameKeyword.EQUAL +
|
||||
transactionForm.getTransactionDate();
|
||||
|
||||
}
|
||||
|
||||
@SessionCheck
|
||||
@PostMapping("/transaction/delete")
|
||||
@PostMapping(TransitionTargetPageNameKeyword.TRANSACTION_DELETE)
|
||||
public String deleteOne(@RequestParam Long transactionId, @RequestParam LocalDate today) {
|
||||
|
||||
transactionService.deleteTransaction(transactionId);
|
||||
return "redirect:/transaction/detail?todayDates=" + today;
|
||||
return TransitionTargetPageNameKeyword.REDIRECT +
|
||||
TransitionTargetPageNameKeyword.TRANSACTION_DETAIL +
|
||||
TransitionTargetPageNameKeyword.INTERROGATION +
|
||||
TransitionTargetPageNameKeyword.TODAY_DATES +
|
||||
TransitionTargetPageNameKeyword.EQUAL +
|
||||
today;
|
||||
}
|
||||
|
||||
@SessionCheck
|
||||
@GetMapping("/menu")
|
||||
@GetMapping(TransitionTargetPageNameKeyword.MENU)
|
||||
public String menu(HttpSession session, Model model,
|
||||
@RequestParam(required = false, defaultValue = "0") String years,
|
||||
@RequestParam(required = false, defaultValue = "0") String months) {
|
||||
|
||||
LoginModel loginUser = (LoginModel) session.getAttribute("loginUser");
|
||||
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
|
||||
|
||||
LocalDate today = LocalDate.now();
|
||||
|
||||
@@ -341,18 +376,18 @@ public class TransactionController {
|
||||
int nextYear = nextYearMonth.getYear();
|
||||
int nextMonth = nextYearMonth.getMonthValue();
|
||||
|
||||
model.addAttribute("year", year);
|
||||
model.addAttribute("month", month);
|
||||
model.addAttribute("day", today.getDayOfMonth());
|
||||
model.addAttribute(PageReturnAttributeKeyword.YEAR, year);
|
||||
model.addAttribute(PageReturnAttributeKeyword.MONTH, month);
|
||||
model.addAttribute(PageReturnAttributeKeyword.DAY, today.getDayOfMonth());
|
||||
|
||||
model.addAttribute("lastDay", lastDay);
|
||||
model.addAttribute("firstDayOfWeek", firstDayOfWeek);
|
||||
model.addAttribute(PageReturnAttributeKeyword.LAST_DAY, lastDay);
|
||||
model.addAttribute(PageReturnAttributeKeyword.FIRST_DAY_OF_WEEK, firstDayOfWeek);
|
||||
|
||||
model.addAttribute("previousYear", previousYear);
|
||||
model.addAttribute("previousMonth", previousMonth);
|
||||
model.addAttribute(PageReturnAttributeKeyword.PREVIOUS_YEAR, previousYear);
|
||||
model.addAttribute(PageReturnAttributeKeyword.PREVIOUS_MONTH, previousMonth);
|
||||
|
||||
model.addAttribute("nextYear", nextYear);
|
||||
model.addAttribute("nextMonth", nextMonth);
|
||||
model.addAttribute(PageReturnAttributeKeyword.NEXT_YEAR, nextYear);
|
||||
model.addAttribute(PageReturnAttributeKeyword.NEXT_MONTH, nextMonth);
|
||||
|
||||
LocalDate startDate = yearMonth.atDay(1);
|
||||
LocalDate endDate = yearMonth.atEndOfMonth();
|
||||
@@ -361,31 +396,51 @@ public class TransactionController {
|
||||
|
||||
List<Expense> expenseList = transactionService.findTotalExpenseList(startDate, endDate, loginUser.getUserId());
|
||||
|
||||
model.addAttribute("incomeList", incomeList);
|
||||
model.addAttribute("expenseList", expenseList);
|
||||
model.addAttribute(PageReturnAttributeKeyword.INCOME_LIST, incomeList);
|
||||
model.addAttribute(PageReturnAttributeKeyword.EXPENSE_LIST, expenseList);
|
||||
|
||||
int totalIncome = transactionService.findTotalIncome(startDate, endDate, loginUser.getUserId());
|
||||
|
||||
int totalExpense = transactionService.findTotalExpense(startDate, endDate, loginUser.getUserId());
|
||||
|
||||
model.addAttribute("totalIncome", totalIncome);
|
||||
model.addAttribute("totalExpense", totalExpense);
|
||||
model.addAttribute(PageReturnAttributeKeyword.TOTAL_INCOME, totalIncome);
|
||||
model.addAttribute(PageReturnAttributeKeyword.TOTAL_EXPENSE, totalExpense);
|
||||
|
||||
// List<GoalForm> goalForm = GoalForm.convertFrom(goalService.getGoalByUserId(loginUser.getUserId()));
|
||||
List<GoalForm> goalForm = GoalForm.convertFrom(goalService.getGoalByUserId(loginUser.getUserId()));
|
||||
|
||||
UserForm userForm = UserForm.convertFrom(userService.findByUserId(loginUser.getUserId()));
|
||||
|
||||
// model.addAttribute("achievementRate", goalForm.getAchievementRate());
|
||||
//
|
||||
// model.addAttribute("currentAmount", goalForm.getCurrentAmount());
|
||||
//
|
||||
// model.addAttribute("targetAmount", goalForm.getTargetAmount());
|
||||
List<GoalForm> resultList = goalForm.stream().filter(goal -> goal.getGoalComplete() == 0)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
model.addAttribute("saving", userForm.getSaving());
|
||||
if (!resultList.isEmpty()) {
|
||||
GoalForm result = resultList.getFirst();
|
||||
|
||||
// model.addAttribute("deadline", goalForm.getDeadline());
|
||||
model.addAttribute(PageReturnAttributeKeyword.ACHIEVEMENT_RATE, result.getAchievementRate());
|
||||
|
||||
return "menu";
|
||||
model.addAttribute(PageReturnAttributeKeyword.CURRENT_AMOUNT, result.getCurrentAmount());
|
||||
|
||||
model.addAttribute(PageReturnAttributeKeyword.TARGET_AMOUNT, result.getTargetAmount());
|
||||
|
||||
model.addAttribute(PageReturnAttributeKeyword.SAVING, userForm.getSaving());
|
||||
|
||||
model.addAttribute(PageReturnAttributeKeyword.DEADLINE, result.getDeadline());
|
||||
|
||||
} else {
|
||||
final String MESSAGE = "目標を設定してください";
|
||||
|
||||
model.addAttribute(PageReturnAttributeKeyword.ACHIEVEMENT_RATE, MESSAGE);
|
||||
|
||||
model.addAttribute(PageReturnAttributeKeyword.CURRENT_AMOUNT, MESSAGE);
|
||||
|
||||
model.addAttribute(PageReturnAttributeKeyword.TARGET_AMOUNT, MESSAGE);
|
||||
|
||||
model.addAttribute(PageReturnAttributeKeyword.SAVING, userForm.getSaving());
|
||||
|
||||
model.addAttribute(PageReturnAttributeKeyword.DEADLINE, MESSAGE);
|
||||
}
|
||||
|
||||
return TransitionTargetPageNameKeyword.MENU_HTML;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -11,11 +11,12 @@ import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import com.example.demo.app.domain.model.LoginModel;
|
||||
import com.example.demo.app.domain.service.CourseService;
|
||||
import com.example.demo.app.domain.service.QuestionService;
|
||||
import com.example.demo.app.domain.service.UserService;
|
||||
import com.example.demo.app.infra.entity.QuestionEntity;
|
||||
import com.example.demo.app.presentation.controller.pageproperty.PageReturnAttributeKeyword;
|
||||
import com.example.demo.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword;
|
||||
import com.example.demo.app.presentation.form.UserForm;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -31,24 +32,22 @@ public class UserController {
|
||||
private final QuestionService questionService;
|
||||
|
||||
|
||||
@GetMapping("/user/register")
|
||||
@GetMapping(TransitionTargetPageNameKeyword.USER_RESISTER)
|
||||
public String showRegister(Model model, HttpSession session) {
|
||||
UserForm userForm = new UserForm();
|
||||
|
||||
List<QuestionEntity> questionList = questionService.findAll();
|
||||
|
||||
session.setAttribute("questionList", questionList);
|
||||
session.setAttribute(PageReturnAttributeKeyword.QUESTION_LIST, questionList);
|
||||
|
||||
model.addAttribute("userForm", userForm);
|
||||
return "user_register";
|
||||
model.addAttribute(PageReturnAttributeKeyword.USER_FORM, userForm);
|
||||
return TransitionTargetPageNameKeyword.USER_RESISTER_HTML;
|
||||
}
|
||||
|
||||
@PostMapping("/user/register/return")
|
||||
@PostMapping(TransitionTargetPageNameKeyword.USER_RESISTER_RETURN)
|
||||
public String showRegisterReturn(@RequestParam(required = false) Long courseId, Model model, HttpSession session) {
|
||||
|
||||
UserForm userForm = (UserForm) session.getAttribute("userForm");
|
||||
System.out.println(
|
||||
"######################################################################3" + userForm.getBirthDate());
|
||||
UserForm userForm = (UserForm) session.getAttribute(PageReturnAttributeKeyword.USER_FORM);
|
||||
|
||||
if (userForm.getUserName().equals("")) {
|
||||
userForm = new UserForm();
|
||||
@@ -56,41 +55,48 @@ public class UserController {
|
||||
}
|
||||
|
||||
if (courseId != null) {
|
||||
model.addAttribute("selectedCourseName", courseService.findById(courseId).getCourseName());
|
||||
model.addAttribute(PageReturnAttributeKeyword.SELECTED_COURSE_NAME, courseService.findById(courseId).getCourseName());
|
||||
}
|
||||
|
||||
session.setAttribute("selectedCourseName", courseService.findById(courseId).getCourseName());
|
||||
model.addAttribute("courseId", courseId);
|
||||
System.out.println(
|
||||
"######################################################################3" + userForm.getBirthDate());
|
||||
model.addAttribute("userForm", userForm);
|
||||
session.setAttribute(PageReturnAttributeKeyword.SELECTED_COURSE_NAME, courseService.findById(courseId).getCourseName());
|
||||
model.addAttribute(PageReturnAttributeKeyword.COURSE_ID, courseId);
|
||||
model.addAttribute(PageReturnAttributeKeyword.USER_FORM, userForm);
|
||||
|
||||
return "user_register_return";
|
||||
return TransitionTargetPageNameKeyword.USER_RESISTER_RETURN_HTML;
|
||||
}
|
||||
|
||||
@GetMapping("/user/register/confirm")
|
||||
@GetMapping(TransitionTargetPageNameKeyword.USER_RESISTER_CONFIRM)
|
||||
public String confirmRegisterGet(@ModelAttribute UserForm userForm,
|
||||
String selectedCourseName, Model model,
|
||||
HttpSession session) {
|
||||
|
||||
model.addAttribute("selectedCourseName", (String) session.getAttribute("selectedCourseName"));
|
||||
return "user_register_confirm";
|
||||
model.addAttribute(PageReturnAttributeKeyword.SELECTED_COURSE_NAME, (String) session.getAttribute("selectedCourseName"));
|
||||
|
||||
session.setAttribute("questionId", userForm.getSecretQuestionId());
|
||||
|
||||
System.out.println("return questionId: ****************************:" + userForm.getSecretQuestionId());
|
||||
|
||||
return TransitionTargetPageNameKeyword.USER_RESISTER_CONFIRM_HTML;
|
||||
|
||||
}
|
||||
|
||||
@PostMapping("/user/register/complete")
|
||||
@PostMapping(TransitionTargetPageNameKeyword.USER_RESISTER_COMPLETE)
|
||||
public String confirmRegister(
|
||||
@ModelAttribute UserForm userForm,
|
||||
Model model,
|
||||
HttpSession session) {
|
||||
|
||||
LoginModel loginUser = (LoginModel) session.getAttribute("loginUser");
|
||||
Long courseId = courseService.findByName((String) session.getAttribute(PageReturnAttributeKeyword.SELECTED_COURSE_NAME));
|
||||
|
||||
Long courseId = courseService.findByName((String) session.getAttribute("selectedCourseName"));
|
||||
Long questionId = (Long) session.getAttribute("questionId");
|
||||
|
||||
userService.register(userForm, courseId, loginUser.getUserId());
|
||||
System.out.println("confirm questionId: ****************************:" + questionId);
|
||||
|
||||
return "redirect:/login";
|
||||
userForm.setSecretQuestionId(questionId);
|
||||
|
||||
userService.register(userForm, courseId);
|
||||
|
||||
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.LOGIN;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
package com.example.demo.app.presentation.controller.pageproperty;
|
||||
|
||||
public class PageReturnAttributeKeyword {
|
||||
|
||||
public static final String ERROR_MESSAGE = "errorMessage";
|
||||
public static final String MESSAGE = "message";
|
||||
|
||||
|
||||
public static final String QUESTION_LIST = "questionList";
|
||||
public static final String USER_FORM = "userForm";
|
||||
public static final String SELECTED_COURSE_NAME = "selectedCourseName";
|
||||
public static final String COURSE_ID = "courseId";
|
||||
|
||||
public static final String PASSWOR_RESET_FORM = "passwordResetForm";
|
||||
public static final String PASSWOR_RESET_USER_ID = "passwordResetUserId";
|
||||
|
||||
public static final String AUTHENTICATION_FORM = "authenticationForm";
|
||||
|
||||
public static final String PROFILE_FORM = "profileForm";
|
||||
public static final String PROFILE_EDIT_FORM = "profileEditForm";
|
||||
|
||||
public static final String MODE = "mode";
|
||||
public static final String CURRENT_COURSE_ID = "currentCourseId";
|
||||
public static final String COURSE_LIST = "courseList";
|
||||
public static final String COURSE_INFO_LIST = "courseInfoList";
|
||||
|
||||
public static final String YEAR = "year";
|
||||
public static final String MONTH = "month";
|
||||
public static final String DAY = "day";
|
||||
public static final String PREVIOUS_YEAR = "previousYear";
|
||||
public static final String PREVIOUS_MONTH = "previousMonth";
|
||||
public static final String LAST_DAY = "lastDay";
|
||||
public static final String FIRST_DAY_OF_WEEK = "firstDayOfWeek";
|
||||
public static final String NEXT_YEAR = "nextYear";
|
||||
public static final String NEXT_MONTH = "nextMonth";
|
||||
public static final String TODAY = "today";
|
||||
public static final String TRANSACTION_FORM_MAP = "transactionFormMap";
|
||||
public static final String TRANSACTION_FORM_LIST = "transactionFormList";
|
||||
public static final String TRANSACTION_FORM = "transactionForm";
|
||||
public static final String TRANSACTION_ID = "transactionId";
|
||||
public static final String CATEGORY_FORM_LIST = "categoryFormList";
|
||||
public static final String INCOME_LIST = "incomeList";
|
||||
public static final String EXPENSE_LIST = "expenseList";
|
||||
public static final String TOTAL_INCOME = "totalIncome";
|
||||
public static final String TOTAL_EXPENSE = "totalExpense";
|
||||
public static final String ACHIEVEMENT_RATE = "achievementRate";
|
||||
public static final String CURRENT_AMOUNT = "currentAmount";
|
||||
public static final String TARGET_AMOUNT = "targetAmount";
|
||||
public static final String SAVING = "saving";
|
||||
public static final String DEADLINE = "deadline";
|
||||
|
||||
public static final String ANALYSIS_FORM = "analysisForm";
|
||||
|
||||
public static final String GOAL_FORM = "goalForm";
|
||||
public static final String GOAL_FORM_LIST = "goalFormList";
|
||||
public static final String ACHIEVEMENT_LIST = "achievementList";
|
||||
public static final String GRAPH_GOAL = "graphGoal";
|
||||
public static final String GOAL_COMPLETE_FORM_LIST = "goalCompleteFormList";
|
||||
|
||||
public static final String CATEGORY_ID = "categoryId";
|
||||
public static final String CATEGORY_FORM = "categoryForm";
|
||||
|
||||
public static final String FIXED_COST_FORM_LIST = "fixedCostFormList";
|
||||
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package com.example.demo.app.presentation.controller.pageproperty;
|
||||
|
||||
public class SessionKeyword {
|
||||
// SESSION情報として格納したいログイン者の情報
|
||||
public static final String LOGIN_USER = "loginUser";
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
package com.example.demo.app.presentation.controller.pageproperty;
|
||||
|
||||
public class TransitionTargetPageNameKeyword {
|
||||
|
||||
// HTML
|
||||
public static final String ERROR_HTML = "error";
|
||||
|
||||
public static final String USER_RESISTER_HTML = "user_register";
|
||||
public static final String USER_RESISTER_RETURN_HTML = "user_register_return";
|
||||
public static final String USER_RESISTER_CONFIRM_HTML = "user_register_confirm";
|
||||
|
||||
public static final String LOGIN_HTML = "login";
|
||||
|
||||
public static final String PASSWORD_RESET_HTML = "password_reset";
|
||||
|
||||
public static final String AUTHENTICATION_HTML = "authentication";
|
||||
|
||||
public static final String MENU_HTML = "menu";
|
||||
|
||||
public static final String PROFILE_HTML = "profile";
|
||||
public static final String PROFILE_EDIT_HTML = "profile_edit";
|
||||
|
||||
public static final String SELECT_COURSE_HTML = "select_course";
|
||||
public static final String COURSE_CREATE_HTML = "course_create";
|
||||
public static final String COURSE_CREATE_RATIO_HTML = "course_create_ratio";
|
||||
|
||||
public static final String TRANSACTION_LIST_HTML = "transaction_list";
|
||||
public static final String TRANSACTION_DETAIL_HTML = "transaction_detail";
|
||||
public static final String TRANSACTION_CREATE_HTML = "transaction_create";
|
||||
public static final String TRANSACTION_UPDATE_HTML = "transaction_update";
|
||||
|
||||
public static final String ANALYSIS_HTML = "analysis";
|
||||
|
||||
public static final String GOAL_VIEW_HTML = "goal_view";
|
||||
public static final String GOAL_EDIT_HTML = "goal_edit";
|
||||
public static final String GOAL_CREATE_HTML = "goal_create";
|
||||
public static final String GOAL_RECORD_HTML = "goal_record";
|
||||
|
||||
public static final String CATEGORY_LIST_HTML = "category_list";
|
||||
public static final String CATEGORY_CREATE_HTML = "category_create";
|
||||
public static final String CATEGORY_UPDATE_HTML = "category_update";
|
||||
|
||||
public static final String FIXED_COST_HTML = "fixed_cost";
|
||||
public static final String FIXED_COST_CREATE_HTML = "fixed_cost_create";
|
||||
|
||||
// Countroller
|
||||
public static final String ERROR = "/error";
|
||||
|
||||
public static final String USER_RESISTER = "/user/register";
|
||||
public static final String USER_RESISTER_RETURN = "/user/register/return";
|
||||
public static final String USER_RESISTER_CONFIRM = "/user/register/confirm";
|
||||
public static final String USER_RESISTER_COMPLETE = "/user/register/complete";
|
||||
|
||||
|
||||
public static final String REDIRECT = "redirect:";
|
||||
public static final String LOGIN = "/login";
|
||||
public static final String LOGOUT = "/logout";
|
||||
|
||||
public static final String AUTHENTICATION = "/authentication";
|
||||
|
||||
public static final String PASSWORD_RESET = "/password/reset";
|
||||
|
||||
public static final String MENU = "/menu";
|
||||
|
||||
public static final String PROFILE = "/profile";
|
||||
public static final String PROFILE_EDIT = "/profile/edit";
|
||||
public static final String WITHDRAW = "/withdraw";
|
||||
|
||||
public static final String SHOW_SELECT_COURSE = "/user/register/course";
|
||||
public static final String COURSE = "/course";
|
||||
public static final String CHANGE = "/change";
|
||||
public static final String COURSE_CREATE = "/course/create";
|
||||
public static final String COURSE_CREATE_RATIO = "/course/create/ratio";
|
||||
|
||||
|
||||
public static final String INTERROGATION = "?";
|
||||
public static final String EQUAL = "=";
|
||||
public static final String TRANSACTION_LIST = "/transaction/list";
|
||||
public static final String TRANSACTION_DETAIL = "/transaction/detail";
|
||||
public static final String TRANSACTION_CREATE = "/transaction/create";
|
||||
public static final String TRANSACTION_UPDATE = "/transaction/update";
|
||||
public static final String TRANSACTION_DELETE = "/transaction/delete";
|
||||
public static final String TODAY_DATES = "todayDates";
|
||||
|
||||
public static final String ANALYSIS = "/analysis";
|
||||
|
||||
public static final String GOAL = "/goal";
|
||||
public static final String EDIT = "/edit";
|
||||
public static final String UPDATE = "/update";
|
||||
public static final String CREATE = "/create";
|
||||
public static final String DELETE = "/delete";
|
||||
public static final String RECORD = "/record";
|
||||
|
||||
public static final String CATEGORY_LIST = "/category/list";
|
||||
public static final String CATEGORY_CREATE = "/category/create";
|
||||
public static final String CATEGORY_UPDATE = "/category/update";
|
||||
public static final String CATEGORY_DELETE = "/category/delete";
|
||||
|
||||
public static final String FIXED_COST_LIST = "/fixed-cost/list";
|
||||
public static final String FIXED_COST_CREATE = "/fixed-cost/create";
|
||||
public static final String FIXED_COST_DELETE = "/fixed-cost/delete";
|
||||
|
||||
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.example.demo.app.presentation.form;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
@@ -10,7 +12,9 @@ import lombok.NoArgsConstructor;
|
||||
public class ProfileEditForm {
|
||||
private String userName;
|
||||
private String mailAddress;
|
||||
private LocalDate birthDate;
|
||||
private Integer saving;
|
||||
private Integer annualIncome;
|
||||
private Integer monthlyBudget;
|
||||
private LocalDate birthDate;
|
||||
}
|
||||
|
||||
@@ -1,52 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Insert title here</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">
|
||||
</head>
|
||||
|
||||
<body class="pb-5 pt-5">
|
||||
|
||||
<div th:replace="~{header :: header}"></div>
|
||||
|
||||
<h1>カテゴリ登録</h1>
|
||||
|
||||
<form th:action="@{/category/create}" th:object="${categoryForm}" method="post">
|
||||
|
||||
|
||||
<div>
|
||||
<label for="categoryName">カテゴリ名</label>
|
||||
|
||||
<input type="text" id="categoryName" th:field="*{categoryName}">
|
||||
</div>
|
||||
|
||||
<br>
|
||||
|
||||
<div>
|
||||
<label for="transactionType">収入・支出</label>
|
||||
|
||||
<select id="transactionType" th:field="*{transactionType}">
|
||||
|
||||
<option value="">選択してください</option>
|
||||
<option value="0">支出</option>
|
||||
<option value="1">収入</option>
|
||||
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<br>
|
||||
|
||||
<button type="submit">登録</button>
|
||||
|
||||
</form>
|
||||
|
||||
<div th:replace="~{footer :: footer}"></div>
|
||||
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -1,63 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html xmlns:th="http://www.thymeleaf.org">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>カテゴリ一覧</title>
|
||||
<link rel="stylesheet" th:href="@{/css/transaction_detail.css}">
|
||||
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
</head>
|
||||
|
||||
<body class="pb-5 pt-5">
|
||||
|
||||
<div th:replace="~{header :: header}"></div>
|
||||
|
||||
<div>
|
||||
<ul>
|
||||
<li th:each="categoryForm : ${categoryFormList}" class="transaction-item">
|
||||
|
||||
<div>
|
||||
<p>
|
||||
カテゴリ名:
|
||||
<span th:text="${categoryForm.categoryName}"></span>
|
||||
<br>
|
||||
収支区分:
|
||||
<span th:if="${categoryForm.transactionType == 0}" th:text="|支出|"></span>
|
||||
<span th:if="${categoryForm.transactionType == 1}" th:text="|収入|"></span>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="transaction-buttons">
|
||||
|
||||
<form th:action="@{/category/delete}" method="post">
|
||||
<input type="hidden" name="today" th:value="${today}">
|
||||
<input type="hidden" name="categoryId" th:value="${categoryForm.categoryId}">
|
||||
<button type="submit">削除</button>
|
||||
</form>
|
||||
|
||||
<form th:action="@{/category/update}" method="get">
|
||||
<input type="hidden" name="today" th:value="${today}">
|
||||
<input type="hidden" name="categoryId" th:value="${categoryForm.categoryId}">
|
||||
<button type="submit">編集</button>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
<hr>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<form th:action="@{/category/create}" method="get">
|
||||
<input type="hidden" name="today" id="today" th:value="${today}">
|
||||
<button type="submit">新規登録</button>
|
||||
</form>
|
||||
|
||||
<div th:replace="~{footer :: footer}"></div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -1,54 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Insert title here</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">
|
||||
</head>
|
||||
|
||||
<body class="pb-5 pt-5">
|
||||
|
||||
<div th:replace="~{header :: header}"></div>
|
||||
|
||||
<h1>カテゴリ編集</h1>
|
||||
|
||||
<form th:action="@{/category/update}" th:object="${categoryForm}" method="post">
|
||||
|
||||
|
||||
<div>
|
||||
<label for="categoryName">カテゴリ名</label>
|
||||
|
||||
<input type="text" id="categoryName" th:field="*{categoryName}">
|
||||
</div>
|
||||
|
||||
<br>
|
||||
|
||||
<div>
|
||||
<label for="transactionType">収入・支出</label>
|
||||
|
||||
<select id="transactionType" th:field="*{transactionType}">
|
||||
|
||||
<option value="">選択してください</option>
|
||||
<option value="0">支出</option>
|
||||
<option value="1">収入</option>
|
||||
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<br>
|
||||
|
||||
<input type="hidden" name="categoryId" th:value="${categoryId}">
|
||||
|
||||
<button type="submit">登録</button>
|
||||
|
||||
</form>
|
||||
|
||||
<div th:replace="~{footer :: footer}"></div>
|
||||
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
59
src/main/resources/templates/category_create.html
Normal file
59
src/main/resources/templates/category_create.html
Normal file
@@ -0,0 +1,59 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<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">
|
||||
</head>
|
||||
|
||||
<body style="padding-top:80px; padding-bottom:80px;">
|
||||
|
||||
<div th:replace="~{header :: header}"></div>
|
||||
|
||||
<div class="main-container">
|
||||
<h1 class="page-title">カテゴリ登録</h1>
|
||||
|
||||
<div class="card shadow-sm">
|
||||
<div class="card-body">
|
||||
|
||||
<form th:action="@{/category/create}" th:object="${categoryForm}" method="post">
|
||||
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label" for="categoryName">カテゴリ名</label>
|
||||
|
||||
<input class="form-control" type="text" id="categoryName" th:field="*{categoryName}">
|
||||
</div>
|
||||
|
||||
<br>
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label" for="transactionType">収入・支出</label>
|
||||
|
||||
<select class="form-select" id="transactionType" th:field="*{transactionType}">
|
||||
|
||||
<option value="">選択してください</option>
|
||||
<option value="0">支出</option>
|
||||
<option value="1">収入</option>
|
||||
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<br>
|
||||
<div class="d-grid">
|
||||
<button type="submit" class="btn btn-primary">登録</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div th:replace="~{footer :: footer}"></div>
|
||||
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
69
src/main/resources/templates/category_list.html
Normal file
69
src/main/resources/templates/category_list.html
Normal file
@@ -0,0 +1,69 @@
|
||||
<!DOCTYPE html>
|
||||
<html xmlns:th="http://www.thymeleaf.org">
|
||||
|
||||
<head>
|
||||
<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/transaction_detail.css}">
|
||||
<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">
|
||||
</head>
|
||||
|
||||
<body class="pb-5 pt-5">
|
||||
|
||||
<div th:replace="~{header :: header}"></div>
|
||||
<div class="main-container">
|
||||
|
||||
<div>
|
||||
<ul>
|
||||
<li class="card shadow-sm mb-3" th:each="categoryForm : ${categoryFormList}">
|
||||
<div class="card-body">
|
||||
<div class="d-flex justify-content-between">
|
||||
<p>
|
||||
カテゴリ名:
|
||||
<span class="fw-bold" th:text="${categoryForm.categoryName}"></span>
|
||||
<br>
|
||||
収支区分:
|
||||
<span class="fw-bold" th:if="${categoryForm.transactionType == 0}"
|
||||
th:text="|支出|"></span>
|
||||
<span class="fw-bold" th:if="${categoryForm.transactionType == 1}"
|
||||
th:text="|収入|"></span>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="d-flex justify-content-end gap-2 mt-3">
|
||||
|
||||
<form th:action="@{/category/update}" method="get">
|
||||
<input type="hidden" name="today" th:value="${today}">
|
||||
<input type="hidden" name="categoryId" th:value="${categoryForm.categoryId}">
|
||||
<button type="submit" class="btn btn-sm btn-primary">編集</button>
|
||||
</form>
|
||||
|
||||
<form th:action="@{/category/delete}" method="post">
|
||||
<input type="hidden" name="today" th:value="${today}">
|
||||
<input type="hidden" name="categoryId" th:value="${categoryForm.categoryId}">
|
||||
<button type="submit" class="btn btn-sm btn-danger">削除</button>
|
||||
</form>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
<hr>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<form th:action="@{/category/create}" method="get">
|
||||
<input type="hidden" name="today" id="today" th:value="${today}">
|
||||
<button type="submit">新規登録</button>
|
||||
</form>
|
||||
|
||||
<div th:replace="~{footer :: footer}"></div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
62
src/main/resources/templates/category_update.html
Normal file
62
src/main/resources/templates/category_update.html
Normal file
@@ -0,0 +1,62 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<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">
|
||||
</head>
|
||||
|
||||
<body style="padding-top:80px; padding-bottom:80px;">
|
||||
|
||||
<div th:replace="~{header :: header}"></div>
|
||||
|
||||
<div class="main-container">
|
||||
<h1 class="page-title">カテゴリ編集</h1>
|
||||
|
||||
<div class="card shadow-sm">
|
||||
<div class="card-body">
|
||||
|
||||
<form th:action="@{/category/update}" th:object="${categoryForm}" method="post">
|
||||
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label" for="categoryName">カテゴリ名</label>
|
||||
|
||||
<input class="form-control" type="text" id="categoryName" th:field="*{categoryName}">
|
||||
</div>
|
||||
|
||||
<br>
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label" for="transactionType">収入・支出</label>
|
||||
|
||||
<select class="form-select" id="transactionType" th:field="*{transactionType}">
|
||||
|
||||
<option value="">選択してください</option>
|
||||
<option value="0">支出</option>
|
||||
<option value="1">収入</option>
|
||||
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<br>
|
||||
|
||||
<input type="hidden" name="categoryId" th:value="${categoryId}">
|
||||
|
||||
<div class="d-grid">
|
||||
<button type="submit" class="btn btn-primary">登録</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div th:replace="~{footer :: footer}"></div>
|
||||
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -2,43 +2,49 @@
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Insert title here</title>
|
||||
<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">
|
||||
</head>
|
||||
|
||||
<body class="pb-5 pt-5">
|
||||
<body style="padding-top:80px; padding-bottom:80px;">
|
||||
|
||||
<div th:replace="~{header :: header}"></div>
|
||||
<div class="main-container">
|
||||
<h1 class="page-title">コース登録</h1>
|
||||
|
||||
<h1>コース登録</h1>
|
||||
|
||||
<form th:action="@{/course/create/ratio}" th:object="${courseForm}" method="post">
|
||||
<div class="card shadow-sm">
|
||||
<div class="card-body">
|
||||
<form th:action="@{/course/create/ratio}" th:object="${courseForm}" method="post">
|
||||
|
||||
|
||||
<div>
|
||||
<label for="courseName">コース名</label>
|
||||
<div class="mb-3">
|
||||
<label class="form-label" for="courseName">コース名</label>
|
||||
|
||||
<input type="text" id="courseName" th:field="*{courseName}">
|
||||
</div>
|
||||
<input class="form-control" type="text" id="courseName" th:field="*{courseName}">
|
||||
</div>
|
||||
|
||||
<br>
|
||||
<br>
|
||||
|
||||
<div>
|
||||
<label for="description">説明</label>
|
||||
<div class="mb-3">
|
||||
<label class="form-label" for="description">説明</label>
|
||||
|
||||
<textarea id="description" th:field="*{description}" placeholder="説明を入力してください">
|
||||
<textarea class="form-control" id="description" th:field="*{description}"
|
||||
placeholder="説明を入力してください">
|
||||
</textarea>
|
||||
</div>
|
||||
|
||||
<br>
|
||||
|
||||
<div class="d-grid">
|
||||
<button type="submit" class="btn btn-primary">登録</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<br>
|
||||
|
||||
|
||||
<button type="submit">登録</button>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div th:replace="~{footer :: footer}"></div>
|
||||
|
||||
|
||||
@@ -2,104 +2,112 @@
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Insert title here</title>
|
||||
<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">
|
||||
</head>
|
||||
|
||||
<body class="pb-5 pt-5">
|
||||
<body style="padding-top:80px; padding-bottom:120px;">
|
||||
|
||||
<div th:replace="~{header :: header}"></div>
|
||||
|
||||
<h1>コース登録</h1>
|
||||
<div class="main-container">
|
||||
|
||||
<form th:action="@{/course/create}" th:object="${allocationFormList}" method="post">
|
||||
<h1 class="page-title">コース登録</h1>
|
||||
|
||||
<div class="card shadow-sm">
|
||||
<div class="card-body">
|
||||
<form th:action="@{/course/create}" th:object="${allocationFormList}" method="post">
|
||||
|
||||
|
||||
<div>
|
||||
<label for="allocationRatio1">給与</label>
|
||||
<input type="number" id="allocationRatio1" th:field="*{allocationRatio1}">
|
||||
<div class="mb-3">
|
||||
<label class="form-label" for="allocationRatio1">給与</label>
|
||||
<input class="form-control" type="number" id="allocationRatio1" th:field="*{allocationRatio1}">
|
||||
</div>
|
||||
|
||||
<br>
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label" for="allocationRatio2">賞与</label>
|
||||
<input class="form-control" type="number" id="allocationRatio2" th:field="*{allocationRatio2}">
|
||||
</div>
|
||||
|
||||
<br>
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label" for="allocationRatio3">その他</label>
|
||||
<input class="form-control" type="number" id="allocationRatio3" th:field="*{allocationRatio3}">
|
||||
</div>
|
||||
|
||||
<br>
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label" for="allocationRatio4">固定費</label>
|
||||
<input class="form-control" type="number" id="allocationRatio4" th:field="*{allocationRatio4}">
|
||||
</div>
|
||||
|
||||
<br>
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label" for="allocationRatio5">食費</label>
|
||||
<input class="form-control" type="number" id="allocationRatio5" th:field="*{allocationRatio5}">
|
||||
</div>
|
||||
|
||||
<br>
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label" for="allocationRatio6">交通費</label>
|
||||
<input class="form-control" type="number" id="allocationRatio6" th:field="*{allocationRatio6}">
|
||||
</div>
|
||||
|
||||
<br>
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label" for="allocationRatio7">日用品費</label>
|
||||
<input class="form-control" type="number" id="allocationRatio7" th:field="*{allocationRatio7}">
|
||||
</div>
|
||||
|
||||
<br>
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label" for="allocationRatio8">被服/美容費</label>
|
||||
<input class="form-control" type="number" id="allocationRatio8" th:field="*{allocationRatio8}">
|
||||
</div>
|
||||
|
||||
<br>
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label" for="allocationRatio9">医療費</label>
|
||||
<input class="form-control" type="number" id="allocationRatio9" th:field="*{allocationRatio9}">
|
||||
</div>
|
||||
|
||||
<br>
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label" for="allocationRatio10">趣味/娯楽費</label>
|
||||
<input class="form-control" type="number" id="allocationRatio10"
|
||||
th:field="*{allocationRatio10}">
|
||||
</div>
|
||||
|
||||
<br>
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label" for="allocationRatio11">その他</label>
|
||||
<input class="form-control" type="number" id="allocationRatio11"
|
||||
th:field="*{allocationRatio11}">
|
||||
</div>
|
||||
|
||||
<br>
|
||||
<div class="d-grid">
|
||||
<button type="submit" class="btn btn-primary">登録</button>
|
||||
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<br>
|
||||
|
||||
<div>
|
||||
<label for="allocationRatio2">賞与</label>
|
||||
<input type="number" id="allocationRatio2" th:field="*{allocationRatio2}">
|
||||
</div>
|
||||
|
||||
<br>
|
||||
|
||||
<div>
|
||||
<label for="allocationRatio3">その他</label>
|
||||
<input type="number" id="allocationRatio3" th:field="*{allocationRatio3}">
|
||||
</div>
|
||||
|
||||
<br>
|
||||
|
||||
<div>
|
||||
<label for="allocationRatio4">固定費</label>
|
||||
<input type="number" id="allocationRatio4" th:field="*{allocationRatio4}">
|
||||
</div>
|
||||
|
||||
<br>
|
||||
|
||||
<div>
|
||||
<label for="allocationRatio5">食費</label>
|
||||
<input type="number" id="allocationRatio5" th:field="*{allocationRatio5}">
|
||||
</div>
|
||||
|
||||
<br>
|
||||
|
||||
<div>
|
||||
<label for="allocationRatio6">交通費</label>
|
||||
<input type="number" id="allocationRatio6" th:field="*{allocationRatio6}">
|
||||
</div>
|
||||
|
||||
<br>
|
||||
|
||||
<div>
|
||||
<label for="allocationRatio7">日用品費</label>
|
||||
<input type="number" id="allocationRatio7" th:field="*{allocationRatio7}">
|
||||
</div>
|
||||
|
||||
<br>
|
||||
|
||||
<div>
|
||||
<label for="allocationRatio8">被服/美容費</label>
|
||||
<input type="number" id="allocationRatio8" th:field="*{allocationRatio8}">
|
||||
</div>
|
||||
|
||||
<br>
|
||||
|
||||
<div>
|
||||
<label for="allocationRatio9">医療費</label>
|
||||
<input type="number" id="allocationRatio9" th:field="*{allocationRatio9}">
|
||||
</div>
|
||||
|
||||
<br>
|
||||
|
||||
<div>
|
||||
<label for="allocationRatio10">趣味/娯楽費</label>
|
||||
<input type="number" id="allocationRatio10" th:field="*{allocationRatio10}">
|
||||
</div>
|
||||
|
||||
<br>
|
||||
|
||||
<div>
|
||||
<label for="allocationRatio11">その他</label>
|
||||
<input type="number" id="allocationRatio11" th:field="*{allocationRatio11}">
|
||||
</div>
|
||||
|
||||
<br>
|
||||
|
||||
<button type="submit">登録</button>
|
||||
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
||||
|
||||
<div th:replace="~{footer :: footer}"></div>
|
||||
|
||||
|
||||
@@ -7,12 +7,6 @@
|
||||
</head>
|
||||
<body class="pb-5 pt-5">
|
||||
|
||||
<div th:replace="~{header :: header}">
|
||||
</div>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div th:replace="~{header :: header}">
|
||||
</div>
|
||||
|
||||
|
||||
@@ -2,54 +2,61 @@
|
||||
<html xmlns:th="http://www.thymeleaf.org">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<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/transaction_detail.css}">
|
||||
|
||||
<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>
|
||||
|
||||
<body class="pb-5 pt-5">
|
||||
|
||||
<div th:replace="~{header :: header}"></div>
|
||||
<h1 th:text="${today}"></h1>
|
||||
<div class="main-container">
|
||||
|
||||
<div>
|
||||
<ul>
|
||||
<li th:each="fixedCostForm : ${fixedCostFormList}" class="transaction-item">
|
||||
|
||||
<div>
|
||||
<p>
|
||||
カテゴリ名:
|
||||
<span th:text="${fixedCostForm.categoryName}"></span>
|
||||
<br>
|
||||
固定費名:
|
||||
<span th:text="${fixedCostForm.fixedCostName}"></span>
|
||||
<br>
|
||||
金額:
|
||||
<span th:text="${fixedCostForm.amount}"></span>
|
||||
</p>
|
||||
</div>
|
||||
<h2 class="page-title" th:text="${today}"></h2>
|
||||
|
||||
<div class="transaction-buttons">
|
||||
<div>
|
||||
<ul>
|
||||
<li th:each="fixedCostForm : ${fixedCostFormList}" class="card shadow-sm mb-3">
|
||||
|
||||
<form th:action="@{/transaction/create}" method="get">
|
||||
<input type="hidden" name="fixedCostId" th:value="${fixedCostForm.fixedCostId}">
|
||||
<input type="hidden" name="today" th:value="${today}">
|
||||
<button type="submit">登録</button>
|
||||
</form>
|
||||
<div class="card-body">
|
||||
<div class="d-flex justify-content-between">
|
||||
<p>
|
||||
カテゴリ名:
|
||||
<span class="fw-bold" th:text="${fixedCostForm.categoryName}"></span>
|
||||
<br>
|
||||
固定費名:
|
||||
<span class="fw-bold" th:text="${fixedCostForm.fixedCostName}"></span>
|
||||
<br>
|
||||
金額:
|
||||
<span class="fw-bold" th:text="${fixedCostForm.amount}"></span>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<form th:action="@{/fixed-cost/delete}" method="post">
|
||||
<input type="hidden" name="fixedCostId" th:value="${fixedCostForm.fixedCostId}">
|
||||
<input type="hidden" name="today" th:value="${today}">
|
||||
<button type="submit">削除</button>
|
||||
</form>
|
||||
<div class="d-flex justify-content-end gap-2 mt-3">
|
||||
|
||||
</div>
|
||||
<form th:action="@{/transaction/create}" method="get">
|
||||
<input type="hidden" name="fixedCostId" th:value="${fixedCostForm.fixedCostId}">
|
||||
<input type="hidden" name="today" th:value="${today}">
|
||||
<button type="submit" class="btn btn-sm btn-primary">登録</button>
|
||||
</form>
|
||||
|
||||
<hr>
|
||||
<hr>
|
||||
</li>
|
||||
<form th:action="@{/fixed-cost/delete}" method="post">
|
||||
<input type="hidden" name="fixedCostId" th:value="${fixedCostForm.fixedCostId}">
|
||||
<input type="hidden" name="today" th:value="${today}">
|
||||
<button type="submit" class="btn btn-sm btn-danger">削除</button>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
<hr>
|
||||
</div>
|
||||
</li>
|
||||
</div>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -2,124 +2,132 @@
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Insert title here</title>
|
||||
<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">
|
||||
|
||||
</head>
|
||||
|
||||
<body class="pb-5 pt-5">
|
||||
<body style="padding-top:80px; padding-bottom:80px;">
|
||||
|
||||
<div th:replace="~{header :: header}"></div>
|
||||
|
||||
<h1>取引登録</h1>
|
||||
<div class="main-container">
|
||||
|
||||
<form th:action="@{/fixed-cost/create}" th:object="${fixedCostForm}" method="post">
|
||||
<h1 class="page-title">
|
||||
固定費登録
|
||||
</h1>
|
||||
|
||||
<div class="card shadow-sm">
|
||||
|
||||
<div class="card-body">
|
||||
|
||||
<form th:action="@{/fixed-cost/create}" th:object="${fixedCostForm}" method="post">
|
||||
|
||||
|
||||
<div>
|
||||
<label for="fixedCostName">固定費名</label>
|
||||
<div class="mb-3">
|
||||
<label class="form-label" for="fixedCostName">固定費名</label>
|
||||
|
||||
<input type="text" id="fixedCostName" th:field="*{fixedCostName}" required>
|
||||
</div>
|
||||
|
||||
<br>
|
||||
<input class="form-control" type="text" id="fixedCostName" th:field="*{fixedCostName}" required>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label" for="transactionType">収入・支出</label>
|
||||
|
||||
<div>
|
||||
<label for="transactionType">収入・支出</label>
|
||||
<select class="form-select" id="transactionType">
|
||||
|
||||
<select id="transactionType">
|
||||
<option value="">選択してください</option>
|
||||
<option value="1">支出</option>
|
||||
<option value="2">収入</option>
|
||||
|
||||
<option value="">選択してください</option>
|
||||
<option value="1">支出</option>
|
||||
<option value="2">収入</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
</select>
|
||||
</div>
|
||||
<br>
|
||||
|
||||
<br>
|
||||
<div class="mb-3">
|
||||
<label class="form-label" for="categoryId">カテゴリ</label>
|
||||
|
||||
<div>
|
||||
<label for="categoryId">カテゴリ</label>
|
||||
<select class="form-select" id="categoryId" th:field="*{categoryId}">
|
||||
<option value="">選択してください</option>
|
||||
|
||||
<select id="categoryId" th:field="*{categoryId}">
|
||||
<option value="">選択してください</option>
|
||||
<option class="expenseListClass" th:each="category : ${expenseList}"
|
||||
th:value="${category.categoryId}" th:text="${category.categoryName}">
|
||||
</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>
|
||||
|
||||
<option class="incomeListClass" th:each="category : ${incomeList}" th:value="${category.categoryId}"
|
||||
th:text="${category.categoryName}">
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<br>
|
||||
|
||||
<br>
|
||||
<div class="mb-3">
|
||||
<label class="form-label" for="amount">金額</label>
|
||||
|
||||
<div>
|
||||
<label for="amount">金額</label>
|
||||
<input class="form-control" type="number" id="amount" th:field="*{amount}" min="0" placeholder="金額を入力してください"
|
||||
required>
|
||||
</div>
|
||||
|
||||
<input type="number" id="amount" th:field="*{amount}" min="0" placeholder="金額を入力してください" required>
|
||||
</div>
|
||||
<br>
|
||||
<input type="hidden" name="today" id="today" th:value="${today}">
|
||||
<div class="d-grid">
|
||||
<button class="btn btn-primary" type="submit">登録</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<br>
|
||||
<input type="hidden" name="today" id="today" th:value="${today}">
|
||||
<div th:replace="~{footer :: footer}"></div>
|
||||
|
||||
<button type="submit">登録</button>
|
||||
|
||||
</form>
|
||||
<script>
|
||||
const transactionType = document.getElementById("transactionType");
|
||||
const categoryId = document.getElementById("categoryId");
|
||||
|
||||
<div th:replace="~{footer :: footer}"></div>
|
||||
const expenseList = document.getElementsByClassName("expenseListClass");
|
||||
const incomeList = document.getElementsByClassName("incomeListClass");
|
||||
|
||||
<script>
|
||||
const transactionType = document.getElementById("transactionType");
|
||||
const categoryId = document.getElementById("categoryId");
|
||||
|
||||
const expenseList = document.getElementsByClassName("expenseListClass");
|
||||
const incomeList = document.getElementsByClassName("incomeListClass");
|
||||
transactionType.addEventListener("change", function () {
|
||||
|
||||
transactionType.addEventListener("change", function () {
|
||||
if (this.value === "1") {
|
||||
|
||||
if (this.value === "1") {
|
||||
for (let i = 0; i < expenseList.length; i++) {
|
||||
expenseList[i].style.display = "";
|
||||
}
|
||||
|
||||
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";
|
||||
}
|
||||
|
||||
for (let i = 0; i < incomeList.length; i++) {
|
||||
incomeList[i].style.display = "none";
|
||||
}
|
||||
} else if (this.value === "2") {
|
||||
|
||||
} else if (this.value === "2") {
|
||||
for (let i = 0; i < expenseList.length; i++) {
|
||||
expenseList[i].style.display = "none";
|
||||
}
|
||||
|
||||
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 = "";
|
||||
}
|
||||
|
||||
for (let i = 0; i < incomeList.length; i++) {
|
||||
incomeList[i].style.display = "";
|
||||
}
|
||||
} else {
|
||||
|
||||
} else {
|
||||
for (let i = 0; i < expenseList.length; i++) {
|
||||
expenseList[i].style.display = "none";
|
||||
}
|
||||
|
||||
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";
|
||||
}
|
||||
}
|
||||
|
||||
for (let i = 0; i < incomeList.length; i++) {
|
||||
incomeList[i].style.display = "none";
|
||||
}
|
||||
}
|
||||
|
||||
categoryId.value = "";
|
||||
});
|
||||
</script>
|
||||
categoryId.value = "";
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,46 +1,60 @@
|
||||
<!DOCTYPE html>
|
||||
<html xmlns:th="http://www.thymeleaf.org">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta charset="UTF-8" name="viewport" content="width=device-width, initial-scale=1" http-equiv="Content-Type">
|
||||
<title>目標作成</title>
|
||||
|
||||
<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>
|
||||
<body class="pb-5 pt-5">
|
||||
|
||||
<body style="padding-top:80px; padding-bottom:80px;">
|
||||
|
||||
<div th:replace="~{header :: header}"></div>
|
||||
|
||||
<h1>目標作成</h1>
|
||||
<div class="main-container">
|
||||
|
||||
<form th:action="@{/goal/create}" th:object="${goalForm}" method="post">
|
||||
<input type="hidden" th:field="*{goalId}">
|
||||
<h1 class="page-title">目標作成</h1>
|
||||
|
||||
<div>
|
||||
<label>目標名</label>
|
||||
<input type="text" th:field="*{goalTitle}" required>
|
||||
</div>
|
||||
<div class="card shadow-sm">
|
||||
|
||||
<div>
|
||||
<label>目標説明</label>
|
||||
<textarea th:field="*{goalSubtitle}" required></textarea>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
|
||||
<div>
|
||||
<label>目標金額</label>
|
||||
<input type="number" th:field="*{targetAmount}" required min="1">
|
||||
</div>
|
||||
<form th:action="@{/goal/create}" th:object="${goalForm}" method="post">
|
||||
<input type="hidden" th:field="*{goalId}">
|
||||
|
||||
<div>
|
||||
<label>目標達成期限</label>
|
||||
<input type="date" th:field="*{deadline}" th:min="${#temporals.format(#temporals.createNow(), 'yyyy-MM-dd')}" required>
|
||||
</div>
|
||||
<button type="submit">更新する</button>
|
||||
<div>
|
||||
<label>目標名</label>
|
||||
<input type="text" th:field="*{goalTitle}" required>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
<div>
|
||||
<label>目標説明</label>
|
||||
<textarea th:field="*{goalSubtitle}" required></textarea>
|
||||
</div>
|
||||
|
||||
<div th:replace="~{footer :: footer}"></div>
|
||||
<div>
|
||||
<label>目標金額</label>
|
||||
<input type="number" th:field="*{targetAmount}" required min="1">
|
||||
<span th:text="|所持金:${currentAmount}円|"></span>
|
||||
<span th:if="${message != null}">
|
||||
<span th:text="${message}" style="color: red;"></span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label>目標達成期限</label>
|
||||
<input type="date" th:field="*{deadline}"
|
||||
th:min="${#temporals.format(#temporals.createNow(), 'yyyy-MM-dd')}" required>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-sm btn-primary w-100">登録</button>
|
||||
|
||||
</form>
|
||||
|
||||
<div th:replace="~{footer :: footer}"></div>
|
||||
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -24,17 +24,17 @@
|
||||
|
||||
<div>
|
||||
<label>目標名</label>
|
||||
<input type="text" th:field="*{goalTitle}" required>
|
||||
<input type="text" th:field="*{goalTitle}">
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label>目標説明</label>
|
||||
<textarea th:field="*{goalSubtitle}" required></textarea>
|
||||
<textarea th:field="*{goalSubtitle}"></textarea>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label>目標金額</label>
|
||||
<input type="number" th:field="*{targetAmount}" min="0" max="1000000000" required>
|
||||
<input type="number" th:field="*{targetAmount}" min="1" max="1000000000" required>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
@@ -42,12 +42,17 @@
|
||||
<input type="date" th:field="*{deadline}" th:min="${#temporals.format(#temporals.createNow(), 'yyyy-MM-dd')}" required>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<input type="hidden" th:field="*{goalComplete}">
|
||||
</div>
|
||||
|
||||
<button type="submit" class="btn btn-sm btn-primary w-100">更新する</button>
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button type="submit" class="btn btn-sm btn-primary w-100">更新する</button>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
<html xmlns:th="http://www.thymeleaf.org">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<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/style.css}">
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
</head>
|
||||
|
||||
@@ -12,75 +12,80 @@
|
||||
|
||||
<div th:replace="~{header :: header}"></div>
|
||||
|
||||
<h1>目標履歴</h1>
|
||||
<div class="main-container">
|
||||
|
||||
<h2 class="page-title">目標履歴</h2>
|
||||
|
||||
|
||||
<div>
|
||||
<ul>
|
||||
<li th:each="goalForm : ${goalCompleteFormList}" class="transaction-item">
|
||||
<div>
|
||||
<p>
|
||||
目標名:
|
||||
<span th:text="${goalForm.goalTitle}">
|
||||
</span>
|
||||
<div class="card shadow-sm mb-3">
|
||||
<div class="card-body">
|
||||
<ul>
|
||||
<li th:each="goalForm : ${goalCompleteFormList}" class="transaction-item">
|
||||
<div class="d-flex justify-content-between">
|
||||
<p>
|
||||
目標名:
|
||||
<span class="fw-bold" th:text="${goalForm.goalTitle}">
|
||||
</span>
|
||||
|
||||
<br>
|
||||
<br>
|
||||
|
||||
目標説明:
|
||||
<span th:text="${goalForm.goalSubtitle}">
|
||||
</span>
|
||||
目標説明:
|
||||
<span class="fw-bold" th:text="${goalForm.goalSubtitle}">
|
||||
</span>
|
||||
|
||||
<br>
|
||||
<br>
|
||||
|
||||
目標金額:
|
||||
<span th:text="${goalForm.targetAmount}">
|
||||
</span>
|
||||
目標金額:
|
||||
<span class="fw-bold" th:text="${goalForm.targetAmount}">
|
||||
</span>
|
||||
|
||||
<br>
|
||||
<br>
|
||||
|
||||
目標達成期限:
|
||||
<span th:text="${goalForm.deadline}">
|
||||
</span>
|
||||
目標達成期限:
|
||||
<span class="fw-bold" th:text="${goalForm.deadline}">
|
||||
</span>
|
||||
|
||||
<br>
|
||||
<br>
|
||||
|
||||
</p>
|
||||
</p>
|
||||
|
||||
</form>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="transaction-buttons">
|
||||
<div class="d-flex justify-content-end gap-2 mt-3">
|
||||
|
||||
<form th:action="@{/goal/delete}" method="post">
|
||||
<form th:action="@{/goal/delete}" method="post">
|
||||
|
||||
<input type="hidden" name="goalId" th:value="${goalForm.goalId}">
|
||||
<input type="hidden" name="record" th:value="1">
|
||||
<input type="hidden" name="goalId" th:value="${goalForm.goalId}">
|
||||
<input type="hidden" name="record" th:value="1">
|
||||
|
||||
<button type="submit">
|
||||
削除
|
||||
</button>
|
||||
<button class="btn btn-sm btn-danger" type="submit">
|
||||
削除
|
||||
</button>
|
||||
|
||||
</form>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</li>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</ul>
|
||||
|
||||
</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>
|
||||
|
||||
<form th:action="@{/goal}" method="get">
|
||||
|
||||
<button type="submit">
|
||||
戻る
|
||||
</button>
|
||||
|
||||
</form>
|
||||
|
||||
|
||||
<div th:replace="~{footer :: footer}"></div>
|
||||
|
||||
</body>
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8" name="viewport" content="width=device-width, initial-scale=1" http-equiv="Content-Type">
|
||||
|
||||
<title>目標詳細</title>
|
||||
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
@@ -11,14 +12,13 @@
|
||||
</head>
|
||||
|
||||
<body style="padding-top:80px; padding-bottom:80px;">
|
||||
<div th:replace="~{header :: header}"></div>
|
||||
|
||||
<div th:replace="~{header :: header}"></div>
|
||||
|
||||
<div class="main-container">
|
||||
|
||||
<h1 class="page-title">目標詳細</h1>
|
||||
|
||||
<!-- -->
|
||||
<div th:if="${graphGoal != null}">
|
||||
|
||||
<h2 th:text="${graphGoal.goalTitle}"></h2>
|
||||
@@ -30,28 +30,28 @@
|
||||
|
||||
</div>
|
||||
|
||||
<div class="card shadow-sm mb-3">
|
||||
|
||||
<div style="height: 400px;">
|
||||
<canvas id="myChart"></canvas>
|
||||
</div>
|
||||
|
||||
<div style="width: 600px; height: 300px;">
|
||||
<canvas id="myChart"></canvas>
|
||||
</div>
|
||||
|
||||
|
||||
<script th:inline="javascript">
|
||||
|
||||
const months =
|
||||
/*[[${achievementList.![month.monthValue]}]]*/[];
|
||||
/*[[${achievementList.![month.monthValue]}]]*/[];
|
||||
|
||||
const achievementRates =
|
||||
/*[[${achievementList.![achievementRate]}]]*/[];
|
||||
/*[[${achievementList.![achievementRate]}]]*/[];
|
||||
|
||||
const labels =
|
||||
months.map(month => month + '月');
|
||||
|
||||
|
||||
const myCt =
|
||||
document.getElementById('myChart');
|
||||
|
||||
|
||||
const myChart =
|
||||
new Chart(myCt, {
|
||||
|
||||
@@ -82,40 +82,50 @@
|
||||
|
||||
responsive: true,
|
||||
|
||||
maintainAspectRatio: false,
|
||||
|
||||
scales: {
|
||||
|
||||
y: {
|
||||
|
||||
beginAtZero: true,
|
||||
|
||||
max: 100,
|
||||
|
||||
ticks: {
|
||||
|
||||
callback: function (value) {
|
||||
return value + '%';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
<!-- -->
|
||||
|
||||
<div>
|
||||
<ul>
|
||||
|
||||
<ul>
|
||||
<li th:each="goalForm : ${goalFormList}">
|
||||
|
||||
<li th:each="goalForm : ${goalFormList}" class="transaction-item">
|
||||
<div class="d-flex justify-content-between">
|
||||
|
||||
<div>
|
||||
<form th:action="@{/goal}" method="get" class="w-100">
|
||||
|
||||
<div class="table-responsive">
|
||||
|
||||
<form th:action="@{/goal}" method="get">
|
||||
<table class="table">
|
||||
<table class="table mb-0">
|
||||
|
||||
<input type="radio" name="goalId" th:value="${goalForm.goalId}"
|
||||
th:checked="${graphGoal != null and graphGoal.goalId == goalForm.goalId}"
|
||||
onchange="this.form.submit()">
|
||||
|
||||
<tr>
|
||||
<th>目標名</th>
|
||||
<td th:text="${goalForm.goalTitle}"></td>
|
||||
@@ -125,10 +135,12 @@
|
||||
<th>目標説明</th>
|
||||
<td th:text="${goalForm.goalSubtitle}"></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th>目標金額</th>
|
||||
<td th:text="${goalForm.targetAmount}"></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th>目標達成期限</th>
|
||||
<td th:text="${goalForm.deadline}"></td>
|
||||
@@ -138,61 +150,62 @@
|
||||
<th>達成率</th>
|
||||
<td th:text="${goalForm.achievementRate} + '%'"></td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
<div class="transaction-buttons">
|
||||
</div>
|
||||
|
||||
<form th:action="@{/goal/edit}" method="get">
|
||||
<div class="d-flex justify-content-end gap-2 mt-3">
|
||||
|
||||
<input type="hidden" name="goalId" th:value="${goalForm.goalId}">
|
||||
<form th:action="@{/goal/edit}" method="get">
|
||||
|
||||
<button type="submit" class="btn btn-sm btn-primary w-100">
|
||||
編集
|
||||
</button>
|
||||
<input type="hidden" name="goalId" th:value="${goalForm.goalId}">
|
||||
|
||||
</form>
|
||||
<button type="submit" class="btn btn-sm btn-primary">
|
||||
編集
|
||||
</button>
|
||||
|
||||
</form>
|
||||
|
||||
<form th:action="@{/goal/delete}" method="post">
|
||||
<form th:action="@{/goal/delete}" method="post">
|
||||
|
||||
<input type="hidden" name="goalId" th:value="${goalForm.goalId}">
|
||||
<input type="hidden" name="goalId" th:value="${goalForm.goalId}">
|
||||
|
||||
<button type="submit" class="btn btn-sm btn-primary w-100">
|
||||
削除
|
||||
</button>
|
||||
<button type="submit" class="btn btn-sm btn-danger">
|
||||
削除
|
||||
</button>
|
||||
|
||||
</form>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</li>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<form th:action="@{/goal/create}" method="get">
|
||||
|
||||
<form th:action="@{/goal/create}" method="get">
|
||||
<button type="submit" class="btn btn-success w-100">
|
||||
新規登録
|
||||
</button>
|
||||
|
||||
<button type="submit" class="btn btn-sm btn-primary w-100">
|
||||
新規登録
|
||||
</button>
|
||||
</form>
|
||||
|
||||
</form>
|
||||
<form th:action="@{/goal/record}" method="get">
|
||||
<form th:action="@{/goal/record}" method="get">
|
||||
|
||||
<button type="submit" class="btn btn-sm btn-primary w-100">
|
||||
履歴
|
||||
</button>
|
||||
<button type="submit" class="btn btn-sm btn-primary w-100">
|
||||
履歴
|
||||
</button>
|
||||
|
||||
</form>
|
||||
</form>
|
||||
|
||||
|
||||
<div th:replace="~{footer :: footer}"></div>
|
||||
<div th:replace="~{footer :: footer}"></div>
|
||||
|
||||
</body>
|
||||
|
||||
|
||||
@@ -1,30 +1,34 @@
|
||||
<!DOCTYPE html>
|
||||
<html xmlns:th="http://www.thymeleaf.org">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8" name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>ヘッダー</title>
|
||||
<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}">
|
||||
<meta charset="UTF-8" name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>ヘッダー</title>
|
||||
<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>
|
||||
|
||||
<body>
|
||||
|
||||
<header th:fragment="header" class="fixed-top">
|
||||
|
||||
<nav class="navbar app-header" style="background-color: #e3f2fd;" data-bs-theme="light">
|
||||
<div class="container-fluid">
|
||||
<a th:href="@{/menu}" class="navbar-brand fw-bold">Monegement</a>
|
||||
<div class="d-flex gap-2">
|
||||
<a class="btn btn-outline-primary btn-sm" th:href="@{/course}">
|
||||
コース
|
||||
</a>
|
||||
<a class="btn btn-outline-secondary btn-sm" th:href="@{/profile}">
|
||||
プロフィール
|
||||
</a>
|
||||
<div class="container-fluid">
|
||||
<a th:href="@{/menu}" class="navbar-brand fw-bold">Monegement</a>
|
||||
<div class="d-flex gap-2" th:if="${session.loginUser != null}">
|
||||
<a class="btn btn-outline-primary btn-sm" th:href="@{/course}">
|
||||
コース
|
||||
</a>
|
||||
<a class="btn btn-outline-secondary btn-sm" th:href="@{/profile}">
|
||||
プロフィール
|
||||
</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
</header>
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.7/dist/js/bootstrap.bundle.min.js"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -138,6 +138,8 @@
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="card shadow-sm">
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
class="form-control"
|
||||
th:field="*{password}"
|
||||
minlength="8"
|
||||
maxlength="255"
|
||||
maxlength="24"
|
||||
required>
|
||||
|
||||
</div>
|
||||
@@ -55,11 +55,15 @@
|
||||
class="form-control"
|
||||
th:field="*{passwordConfirm}"
|
||||
minlength="8"
|
||||
maxlength="255"
|
||||
maxlength="24"
|
||||
required>
|
||||
|
||||
</div>
|
||||
|
||||
<span th:if="${message != null}">
|
||||
<h4 th:text="${message}" style="color: red;"></h4>
|
||||
</span>
|
||||
|
||||
<div class="d-grid">
|
||||
|
||||
<button type="submit"
|
||||
|
||||
@@ -52,13 +52,15 @@
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label">
|
||||
パスワード
|
||||
生年月日
|
||||
</label>
|
||||
|
||||
<input type="password"
|
||||
<input type="date"
|
||||
class="form-control"
|
||||
value="********"
|
||||
disabled>
|
||||
id="birthDate"
|
||||
name="birthDate"
|
||||
th:value="*{birthDate}"
|
||||
required>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
@@ -105,7 +107,7 @@
|
||||
<div class="d-grid">
|
||||
<button type="submit"
|
||||
class="btn btn-primary">
|
||||
確認
|
||||
確定
|
||||
</button>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -8,10 +8,10 @@
|
||||
<title>コース選択</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<body style="padding-bottom: 120px">
|
||||
<div th:replace="~{header :: header}"></div>
|
||||
|
||||
<h1>コース選択</h1>
|
||||
<h1 class="page-title">コース選択</h1>
|
||||
|
||||
<th:block th:if="${mode == 'change'}">
|
||||
<form th:action="@{/course/create}" method="get">
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
</th:block>
|
||||
<form th:action="${mode == 'regist'} ? @{/user/register/return}: @{/change}" method="post">
|
||||
<button type="submit">確定</button>
|
||||
<button type="submit" class="btn btn-primary w-100">確定</button>
|
||||
|
||||
<div class="accordion" id="accordionExample">
|
||||
<div class="accordion-item" th:each="course:${courseList}">
|
||||
@@ -35,10 +35,10 @@
|
||||
</button>
|
||||
</h2>
|
||||
<div th:id="'collapse' + ${course.courseId}" class="accordion-collapse collapse"
|
||||
data-bs-parent="#accordionExample">
|
||||
data-bs-parent="#accordionExample" style="padding-bottom: 120px;">
|
||||
<div class="accordion-body">
|
||||
<span th:text="${course.description}"></span>
|
||||
<table border="1">
|
||||
<table class="table table-bordered">
|
||||
<tr>
|
||||
<th>カテゴリ名</th>
|
||||
<th>配分(%)</th>
|
||||
|
||||
@@ -3,11 +3,10 @@
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8" name="viewport" content="width=device-width, initial-scale=1" http-equiv="Content-Type">
|
||||
<title>Insert title here</title>
|
||||
<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 rel="stylesheet" th:href="@{/css/style.css}">
|
||||
</head>
|
||||
|
||||
<body style="padding-top:80px; padding-bottom:80px;">
|
||||
@@ -16,129 +15,158 @@
|
||||
|
||||
<div class="main-container">
|
||||
|
||||
<h1 class="page-title">
|
||||
取引登録
|
||||
</h1>
|
||||
<h1 class="page-title">
|
||||
取引登録
|
||||
</h1>
|
||||
|
||||
<div class="card shadow-sm">
|
||||
<div class="card shadow-sm">
|
||||
|
||||
<div class="card-body">
|
||||
<div class="card-body">
|
||||
|
||||
<form th:action="@{/transaction/create}"
|
||||
th:object="${transactionForm}"
|
||||
method="post">
|
||||
<form th:action="@{/transaction/create}" th:object="${transactionForm}" method="post">
|
||||
|
||||
<div class="mb-3">
|
||||
<div class="mb-3">
|
||||
<label for="transactionDate" class="form-label">
|
||||
日付
|
||||
</label>
|
||||
<input type="date" id="transactionDate" class="form-select" name="transactionDate"
|
||||
th:value="*{transactionDate}" required>
|
||||
</div>
|
||||
|
||||
<label for="transactionDate"
|
||||
class="form-label">
|
||||
日付
|
||||
</label>
|
||||
<div class="mb-3">
|
||||
|
||||
<input type="date"
|
||||
id="transactionDate"
|
||||
class="form-control"
|
||||
th:value="*{transactionDate}"
|
||||
required>
|
||||
<label for="transactionType" class="form-label">
|
||||
収入・支出
|
||||
</label>
|
||||
|
||||
</div>
|
||||
<select id="transactionType" class="form-select" name="transactionType" required>
|
||||
|
||||
<div class="mb-3">
|
||||
<option value="">
|
||||
選択してください
|
||||
</option>
|
||||
|
||||
<label for="transactionType"
|
||||
class="form-label">
|
||||
収入・支出
|
||||
</label>
|
||||
<option value="1">
|
||||
支出
|
||||
</option>
|
||||
|
||||
<select id="transactionType"
|
||||
class="form-select"
|
||||
th:field="*{transactionType}"
|
||||
required>
|
||||
<option value="2">
|
||||
収入
|
||||
</option>
|
||||
|
||||
<option value="">
|
||||
選択してください
|
||||
</option>
|
||||
</select>
|
||||
|
||||
<option value="1">
|
||||
支出
|
||||
</option>
|
||||
</div>
|
||||
|
||||
<option value="2">
|
||||
収入
|
||||
</option>
|
||||
<div class="mb-3">
|
||||
|
||||
</select>
|
||||
<label for="categoryId" class="form-label">
|
||||
カテゴリ
|
||||
</label>
|
||||
|
||||
</div>
|
||||
<select id="categoryId" class="form-select" th:field="*{categoryId}" required>
|
||||
|
||||
<div class="mb-3">
|
||||
<option value="">
|
||||
選択してください
|
||||
</option>
|
||||
|
||||
<label for="categoryId"
|
||||
class="form-label">
|
||||
カテゴリ
|
||||
</label>
|
||||
<option class="expenseListClass" th:each="category : ${expenseList}"
|
||||
th:value="${category.categoryId}" th:text="${category.categoryName}">
|
||||
</option>
|
||||
|
||||
<select id="categoryId"
|
||||
class="form-select"
|
||||
th:field="*{categoryId}"
|
||||
required>
|
||||
<option class="incomeListClass" th:each="category : ${incomeList}"
|
||||
th:value="${category.categoryId}" th:text="${category.categoryName}">
|
||||
</option>
|
||||
|
||||
<option value="">
|
||||
選択してください
|
||||
</option>
|
||||
</select>
|
||||
|
||||
<option th:each="category : ${categoryFormList}"
|
||||
th:value="${category.categoryId}"
|
||||
th:text="${category.categoryName}">
|
||||
</option>
|
||||
</div>
|
||||
|
||||
</select>
|
||||
<div class="mb-3">
|
||||
|
||||
</div>
|
||||
<label for="amount" class="form-label">
|
||||
金額
|
||||
</label>
|
||||
|
||||
<div class="mb-3">
|
||||
<input type="number" id="amount" class="form-control" th:field="*{amount}" min="1"
|
||||
max="100000000" placeholder="金額を入力してください" required>
|
||||
|
||||
<label for="amount"
|
||||
class="form-label">
|
||||
金額
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<input type="number"
|
||||
id="amount"
|
||||
class="form-control"
|
||||
th:field="*{amount}"
|
||||
min="0"
|
||||
max="100000000"
|
||||
placeholder="金額を入力してください"
|
||||
required>
|
||||
<input type="hidden" name="today" th:value="${today}">
|
||||
|
||||
</div>
|
||||
<div class="d-grid">
|
||||
|
||||
<input type="hidden"
|
||||
name="today"
|
||||
th:value="${today}">
|
||||
<button type="submit" class="btn btn-primary">
|
||||
|
||||
<div class="d-grid">
|
||||
登録
|
||||
|
||||
<button type="submit"
|
||||
class="btn btn-primary">
|
||||
</button>
|
||||
|
||||
登録
|
||||
</div>
|
||||
|
||||
</button>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div th:replace="~{footer :: footer}"></div>
|
||||
|
||||
<script 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}]]';
|
||||
|
||||
if (tType == "0") {
|
||||
transactionType.value = 1;
|
||||
} else {
|
||||
transactionType.value = 2;
|
||||
}
|
||||
|
||||
|
||||
transactionType.addEventListener("change", function () {
|
||||
|
||||
if (this.value === "1") {
|
||||
|
||||
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 (this.value === "2") {
|
||||
|
||||
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";
|
||||
}
|
||||
}
|
||||
|
||||
categoryId.value = "";
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
</body>
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<link rel="stylesheet" th:href="@{/css/style.css}">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<body style="padding-top:80px; padding-bottom:80px;">
|
||||
|
||||
<div th:replace="~{header :: header}"></div>
|
||||
<div class="main-container">
|
||||
@@ -90,6 +90,7 @@
|
||||
|
||||
<input type="hidden"
|
||||
name="today"
|
||||
id="today"
|
||||
th:value="${today}">
|
||||
|
||||
<button class="btn btn-success w-100"
|
||||
@@ -103,22 +104,49 @@
|
||||
|
||||
</div>
|
||||
|
||||
<div class="d-grid mt-4">
|
||||
|
||||
<form th:action="@{/fixed-cost/list}" method="get">
|
||||
|
||||
<input type="hidden"
|
||||
name="today"
|
||||
id="today"
|
||||
th:value="${today}">
|
||||
|
||||
<button class="btn btn-dark w-100"
|
||||
type="submit">
|
||||
|
||||
固定費一覧
|
||||
|
||||
</button>
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="d-grid mt-4">
|
||||
|
||||
<form th:action="@{/category/list}"
|
||||
method="get">
|
||||
|
||||
<input type="hidden"
|
||||
name="today"
|
||||
id="today"
|
||||
th:value="${today}">
|
||||
|
||||
<button class="btn btn-dark w-100"
|
||||
type="submit">
|
||||
|
||||
カテゴリ一覧
|
||||
|
||||
</button>
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<form th:action="@{/transaction/create}" method="get">
|
||||
<input type="hidden" name="today" id="today" th:value="${today}">
|
||||
<button type="submit">新規登録</button>
|
||||
</form>
|
||||
<form th:action="@{/fixed-cost/list}" method="get">
|
||||
<input type="hidden" name="today" th:value="${today}">
|
||||
<button type="submit">固定費一覧</button>
|
||||
</form>
|
||||
<form th:action="@{/category/list}" method="get">
|
||||
<input type="hidden" name="today" th:value="${today}">
|
||||
<button type="submit">カテゴリ一覧</button>
|
||||
</form>
|
||||
|
||||
<div th:replace="~{footer :: footer}"></div>
|
||||
</body>
|
||||
|
||||
|
||||
@@ -2,229 +2,192 @@
|
||||
<html lang="ja" xmlns:th="http://www.thymeleaf.org">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport"
|
||||
content="width=device-width, initial-scale=1">
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
||||
<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">
|
||||
|
||||
<link rel="stylesheet"
|
||||
th:href="@{/css/style.css}">
|
||||
<link rel="stylesheet" th:href="@{/css/style.css}">
|
||||
</head>
|
||||
|
||||
<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">
|
||||
|
||||
<h1 class="page-title">
|
||||
新規会員登録
|
||||
</h1>
|
||||
<h1 class="page-title">
|
||||
新規会員登録
|
||||
</h1>
|
||||
|
||||
<div class="card shadow-sm">
|
||||
<div class="card shadow-sm">
|
||||
|
||||
<div class="card-body">
|
||||
<div class="card-body">
|
||||
|
||||
<form th:action="@{/user/register/course}"
|
||||
th:object="${userForm}"
|
||||
method="post">
|
||||
<form th:action="@{/user/register/course}" th:object="${userForm}" method="post">
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="userName"
|
||||
class="form-label">
|
||||
氏名
|
||||
</label>
|
||||
<div class="mb-3">
|
||||
<label for="userName" class="form-label">
|
||||
氏名
|
||||
</label>
|
||||
|
||||
<input type="text"
|
||||
id="userName"
|
||||
class="form-control"
|
||||
th:field="*{userName}"
|
||||
maxlength="100"
|
||||
required>
|
||||
</div>
|
||||
<input type="text" id="userName" class="form-control" th:field="*{userName}" maxlength="100"
|
||||
required>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="mailAddress"
|
||||
class="form-label">
|
||||
メールアドレス
|
||||
</label>
|
||||
<div class="mb-3">
|
||||
<label for="mailAddress" class="form-label">
|
||||
メールアドレス
|
||||
</label>
|
||||
|
||||
<input type="email"
|
||||
id="mailAddress"
|
||||
class="form-control"
|
||||
th:field="*{mailAddress}"
|
||||
maxlength="255"
|
||||
required>
|
||||
</div>
|
||||
<input type="email" id="mailAddress" class="form-control" th:field="*{mailAddress}"
|
||||
maxlength="255" required>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="birthDate"
|
||||
class="form-label">
|
||||
生年月日
|
||||
</label>
|
||||
<div class="mb-3">
|
||||
<label for="birthDate" class="form-label">
|
||||
生年月日
|
||||
</label>
|
||||
|
||||
<input type="date"
|
||||
id="birthDate"
|
||||
class="form-control"
|
||||
th:field="*{birthDate}"
|
||||
required>
|
||||
</div>
|
||||
<input type="date" id="birthDate" class="form-control" th:field="*{birthDate}" required>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="password"
|
||||
class="form-label">
|
||||
パスワード
|
||||
</label>
|
||||
<div class="mb-3">
|
||||
<label for="password" class="form-label">
|
||||
パスワード
|
||||
</label>
|
||||
|
||||
<input type="password"
|
||||
id="password"
|
||||
class="form-control"
|
||||
th:field="*{password}"
|
||||
minlength="8"
|
||||
maxlength="255"
|
||||
required>
|
||||
</div>
|
||||
<input type="password" id="password" class="form-control" th:field="*{password}" minlength="8"
|
||||
maxlength="24" required>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="secretQuestionId"
|
||||
class="form-label">
|
||||
秘密の質問
|
||||
</label>
|
||||
<div class="mb-3">
|
||||
<label for="secretQuestionId" class="form-label">
|
||||
秘密の質問
|
||||
</label>
|
||||
|
||||
<select id="secretQuestionId"
|
||||
class="form-select"
|
||||
th:field="*{secretQuestionId}"
|
||||
required>
|
||||
<select id="secretQuestionId" class="form-select" th:field="*{secretQuestionId}" required>
|
||||
|
||||
<option value="">
|
||||
選択してください
|
||||
</option>
|
||||
<option value="">
|
||||
選択してください
|
||||
</option>
|
||||
|
||||
<option th:each="question : ${session.questionList}"
|
||||
th:value="${question.secretQuestionId}"
|
||||
th:text="${question.questionText}">
|
||||
</option>
|
||||
<option th:each="question : ${session.questionList}" th:value="${question.secretQuestionId}"
|
||||
th:text="${question.questionText}">
|
||||
</option>
|
||||
|
||||
</select>
|
||||
</div>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="secretAnswer"
|
||||
class="form-label">
|
||||
秘密の質問の回答
|
||||
</label>
|
||||
<div class="mb-3">
|
||||
<label for="secretAnswer" class="form-label">
|
||||
秘密の質問の回答
|
||||
</label>
|
||||
|
||||
<input type="text"
|
||||
id="secretAnswer"
|
||||
class="form-control"
|
||||
th:field="*{secretAnswer}"
|
||||
maxlength="100"
|
||||
required>
|
||||
</div>
|
||||
<input type="text" id="secretAnswer" class="form-control" th:field="*{secretAnswer}"
|
||||
maxlength="100" required>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="saving"
|
||||
class="form-label">
|
||||
貯蓄金
|
||||
</label>
|
||||
<div class="mb-3">
|
||||
<label for="saving" class="form-label">
|
||||
貯蓄金
|
||||
</label>
|
||||
|
||||
<input type="number"
|
||||
id="saving"
|
||||
class="form-control"
|
||||
th:field="*{saving}"
|
||||
min="0"
|
||||
max="1000000000"
|
||||
required>
|
||||
</div>
|
||||
<input type="number" id="saving" class="form-control" th:field="*{saving}" min="0"
|
||||
max="1000000000" required>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="annualIncome"
|
||||
class="form-label">
|
||||
年収
|
||||
</label>
|
||||
<div class="mb-3">
|
||||
<label for="annualIncome" class="form-label">
|
||||
年収
|
||||
</label>
|
||||
|
||||
<input type="number"
|
||||
id="annualIncome"
|
||||
class="form-control"
|
||||
th:field="*{annualIncome}"
|
||||
min="0"
|
||||
max="100000000"
|
||||
required>
|
||||
</div>
|
||||
<input type="number" id="annualIncome" class="form-control" th:field="*{annualIncome}" min="0"
|
||||
max="100000000" required>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="monthlyBudget"
|
||||
class="form-label">
|
||||
月別使用可能金額
|
||||
</label>
|
||||
<div class="mb-3">
|
||||
<label for="monthlyBudget" class="form-label">
|
||||
月別使用可能金額
|
||||
</label>
|
||||
|
||||
<input type="number"
|
||||
id="monthlyBudget"
|
||||
class="form-control"
|
||||
th:field="*{monthlyBudget}"
|
||||
min="0"
|
||||
max="10000000"
|
||||
required>
|
||||
</div>
|
||||
<input type="number" id="monthlyBudget" class="form-control" th:field="*{monthlyBudget}" min="0"
|
||||
max="10000000" required>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="goalId"
|
||||
class="form-label">
|
||||
目標貯金額
|
||||
</label>
|
||||
<div class="mb-3">
|
||||
<label for="goalId" class="form-label">
|
||||
目標貯金額
|
||||
</label>
|
||||
|
||||
<input type="number"
|
||||
id="goalId"
|
||||
class="form-control"
|
||||
th:field="*{goalId}"
|
||||
min="0"
|
||||
max="1000000000"
|
||||
required>
|
||||
</div>
|
||||
<input type="number" id="goalId" class="form-control" th:field="*{goalId}" min="0"
|
||||
max="1000000000" required>
|
||||
</div>
|
||||
|
||||
<input type="hidden"
|
||||
th:field="*{courseId}">
|
||||
<input type="hidden" th:field="*{courseId}">
|
||||
|
||||
<div class="d-grid gap-2 mt-4">
|
||||
<div class="d-grid gap-2 mt-4">
|
||||
|
||||
<button type="submit"
|
||||
class="btn btn-outline-primary">
|
||||
コース選択
|
||||
</button>
|
||||
<button type="submit" class="btn btn-outline-primary">
|
||||
コース選択
|
||||
</button>
|
||||
|
||||
<button type="submit"
|
||||
class="btn btn-primary">
|
||||
作成
|
||||
</button>
|
||||
<button type="submit" class="btn btn-primary">
|
||||
作成
|
||||
</button>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="d-grid mt-3">
|
||||
<div class="d-grid mt-3">
|
||||
|
||||
<form th:action="@{/login}"
|
||||
method="get">
|
||||
<form th:action="@{/login}" method="get">
|
||||
|
||||
<button type="submit"
|
||||
class="btn btn-outline-secondary">
|
||||
戻る
|
||||
</button>
|
||||
<button type="submit" class="btn btn-outline-secondary">
|
||||
戻る
|
||||
</button>
|
||||
|
||||
</form>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
const date = new Date();
|
||||
|
||||
const year = date.getFullYear();
|
||||
const month = date.getMonth() + 1;
|
||||
const day = date.getDate();
|
||||
|
||||
const birthDate = document.getElementById("birthDate");
|
||||
|
||||
if (month < 10) {
|
||||
if (day < 10) {
|
||||
birthDate.setAttribute("max", year + "-0" + month + "-0" + day);
|
||||
} else {
|
||||
birthDate.setAttribute("max", year + "-0" + month + "-" + day);
|
||||
}
|
||||
|
||||
} else {
|
||||
if (day < 10) {
|
||||
birthDate.setAttribute("max", year + "-" + month + "-0" + day);
|
||||
} else {
|
||||
birthDate.setAttribute("max", year + "-" + month + "-" + day);
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
</body>
|
||||
|
||||
|
||||
@@ -39,15 +39,15 @@
|
||||
<div class="mb-3">
|
||||
<label for="password" class="form-label">パスワード</label>
|
||||
<input type="password" id="password" class="form-control" name="password" th:value="*{password}" minlength="8"
|
||||
maxlength="255" required readonly>
|
||||
maxlength="24" required readonly>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="secretQuestionId" class="form-label">秘密の質問</label>
|
||||
<select id="secretQuestionId" th:field="*{secretQuestionId}" required readonly>
|
||||
<option value="">選択してください</option>
|
||||
<select id="secretQuestionId" th:field="*{secretQuestionId}" required disabled>
|
||||
<option value="" readonly>選択してください</option>
|
||||
<option th:each="question : ${session.questionList}" th:value="${question.secretQuestionId}"
|
||||
th:text="${question.questionText}">
|
||||
th:text="${question.questionText}" readonly>
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
@@ -82,7 +82,7 @@
|
||||
<div class="d-flex justify-content-between align-items-center">
|
||||
<input type="hidden" class="form-control" th:field="*{courseId}">
|
||||
<span th:text="${selectedCourseName}">未選択</span>
|
||||
<button type="submit" class="btn btn-outline-primary btn-sm">コース選択</button>
|
||||
<button type="submit" class="btn btn-outline-primary btn-sm" disabled>コース選択</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -1,15 +1,17 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="ja"xmlns:th="http://www.thymeleaf.org">
|
||||
<html lang="ja" xmlns:th="http://www.thymeleaf.org">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8" name="viewport" content="width=device-width, initial-scale=1" http-equiv="Content-Type">
|
||||
<title>新規会員登録</title>
|
||||
<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}">
|
||||
<meta charset="UTF-8" name="viewport" content="width=device-width, initial-scale=1" http-equiv="Content-Type">
|
||||
<title>新規会員登録</title>
|
||||
<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>
|
||||
|
||||
<body>
|
||||
<div th:replace="~{header :: header}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="main-container">
|
||||
|
||||
@@ -17,137 +19,127 @@
|
||||
|
||||
<div class="card shadow-sm">
|
||||
|
||||
<div class="card-body">
|
||||
<div class="card-body">
|
||||
|
||||
<form th:action="@{/user/register/confirm}" th:object="${userForm}" method="get">
|
||||
<div class="mb-3">
|
||||
<label for="userName" class="form-label">氏名</label>
|
||||
<input type="text"
|
||||
id="userName"
|
||||
class="form-control"
|
||||
th:field="*{userName}"
|
||||
maxlength="100"
|
||||
required>
|
||||
</div>
|
||||
<form th:action="@{/user/register/confirm}" th:object="${userForm}" method="get">
|
||||
<div class="mb-3">
|
||||
<label for="userName" class="form-label">氏名</label>
|
||||
<input type="text" id="userName" class="form-control" th:field="*{userName}" maxlength="100"
|
||||
required>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="mailAddress" class="form-label">メールアドレス</label>
|
||||
<input type="email"
|
||||
id="mailAddress"
|
||||
class="form-control"
|
||||
th:field="*{mailAddress}"
|
||||
maxlength="255"
|
||||
required>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="mailAddress" class="form-label">メールアドレス</label>
|
||||
<input type="email" id="mailAddress" class="form-control" th:field="*{mailAddress}"
|
||||
maxlength="255" required>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="birthDate" class="form-label">生年月日</label>
|
||||
<input type="date" id="birthDate" name="birthDate" class="form-control" th:value="*{birthDate}"
|
||||
required>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="password" class="form-label">パスワード</label>
|
||||
<input type="password" id="password" name="password" class="form-control" th:value="*{password}"
|
||||
minlength="8" maxlength="24" required>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="secretQuestionId" class="form-label">秘密の質問</label>
|
||||
<select id="secretQuestionId" th:field="*{secretQuestionId}" required>
|
||||
<option value="">選択してください</option>
|
||||
<option th:each="question : ${session.questionList}" th:value="${question.secretQuestionId}"
|
||||
th:text="${question.questionText}">
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="secretAnswer" class="form-label">秘密の質問の回答</label>
|
||||
<input type="text" id="secretAnswer" class="form-control" th:field="*{secretAnswer}"
|
||||
maxlength="100" required>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="saving" class="form-label">貯蓄金</label>
|
||||
<input type="number" id="saving" class="form-control" th:field="*{saving}" min="0" required>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="annualIncome" class="form-label">年収</label>
|
||||
<input type="number" id="annualIncome" class="form-control" th:field="*{annualIncome}" min="0"
|
||||
required>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="monthlyBudget" class="form-label">月別使用可能金額</label>
|
||||
<input type="number" id="monthlyBudget" class="form-control" th:field="*{monthlyBudget}" min="0"
|
||||
required>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="goalId" class="form-label">目標</label>
|
||||
<input type="number" id="goalId" class="form-control" th:field="*{goalId}" min="0" required>
|
||||
</div>
|
||||
|
||||
<div class="mb-4">
|
||||
<label class="form-label">コース</label>
|
||||
<div class="d-flex justify-content-between align-items-center">
|
||||
<input type="hidden" th:field="*{courseId}">
|
||||
<span th:text="${selectedCourseName}">未選択</span>
|
||||
<button class="btn btn-outline-primary btn-sm" disabled>
|
||||
コース選択
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="d-grid">
|
||||
<button type="submit" class="btn btn-primary">作成</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="birthDate" class="form-label">生年月日</label>
|
||||
<input type="date" id="birthDate" name="birthDate" class="form-control" th:value="*{birthDate}"
|
||||
required>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="password" class="form-label">パスワード</label>
|
||||
<input type="password"
|
||||
id="password"
|
||||
name="password"
|
||||
class="form-control"
|
||||
th:value="*{password}"
|
||||
minlength="8"
|
||||
maxlength="255"
|
||||
required>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="secretQuestionId" class="form-label">秘密の質問</label>
|
||||
<select id="secretQuestionId"
|
||||
th:field="*{secretQuestionId}"
|
||||
required>
|
||||
<option value="">選択してください</option>
|
||||
<option th:each="question : ${session.questionList}"
|
||||
th:value="${question.secretQuestionId}"
|
||||
th:text="${question.questionText}">
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="secretAnswer" class="form-label">秘密の質問の回答</label>
|
||||
<input type="text"
|
||||
id="secretAnswer"
|
||||
class="form-control"
|
||||
th:field="*{secretAnswer}"
|
||||
maxlength="100"
|
||||
required>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="saving" class="form-label">貯蓄金</label>
|
||||
<input type="number"
|
||||
id="saving"
|
||||
class="form-control"
|
||||
th:field="*{saving}"
|
||||
min="0"
|
||||
required>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="annualIncome" class="form-label">年収</label>
|
||||
<input type="number"
|
||||
id="annualIncome"
|
||||
class="form-control"
|
||||
th:field="*{annualIncome}"
|
||||
min="0"
|
||||
required>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="monthlyBudget" class="form-label">月別使用可能金額</label>
|
||||
<input type="number"
|
||||
id="monthlyBudget"
|
||||
class="form-control"
|
||||
th:field="*{monthlyBudget}"
|
||||
min="0"
|
||||
required>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="goalId" class="form-label">目標</label>
|
||||
<input type="number"
|
||||
id="goalId"
|
||||
class="form-control"
|
||||
th:field="*{goalId}"
|
||||
min="0"
|
||||
required>
|
||||
</div>
|
||||
|
||||
<div class="mb-4">
|
||||
<label class="form-label">コース</label>
|
||||
<div class="d-flex justify-content-between align-items-center">
|
||||
<input type="hidden" th:field="*{courseId}">
|
||||
<span th:text="${selectedCourseName}">未選択</span>
|
||||
<button type="submit" class="btn btn-outline-primary btn-sm">
|
||||
コース選択
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="d-grid">
|
||||
<button type="submit" class="btn btn-primary">作成</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="d-grid mt-3">
|
||||
<form th:action="@{/login}" method="get">
|
||||
<button type="submit" class="btn btn-outline-secondary">戻る</button>
|
||||
</form>
|
||||
<form th:action="@{/login}" method="get">
|
||||
<button type="submit" class="btn btn-outline-secondary">戻る</button>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<script>
|
||||
|
||||
const date = new Date();
|
||||
|
||||
const year = date.getFullYear();
|
||||
const month = date.getMonth() + 1;
|
||||
const day = date.getDate();
|
||||
|
||||
const birthDate = document.getElementById("birthDate");
|
||||
|
||||
if (month < 10) {
|
||||
if (day < 10) {
|
||||
birthDate.setAttribute("max", year + "-0" + month + "-0" + day);
|
||||
} else {
|
||||
birthDate.setAttribute("max", year + "-0" + month + "-" + day);
|
||||
}
|
||||
|
||||
} else {
|
||||
if (day < 10) {
|
||||
birthDate.setAttribute("max", year + "-" + month + "-0" + day);
|
||||
} else {
|
||||
birthDate.setAttribute("max", year + "-" + month + "-" + day);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
Reference in New Issue
Block a user