Compare commits
7 Commits
n-kawahito
...
5adb527d7a
| Author | SHA1 | Date | |
|---|---|---|---|
| 5adb527d7a | |||
| e54e0133f7 | |||
| c3dae348bf | |||
| ea1e18ad93 | |||
| bb3b8965b2 | |||
| 3b239d07bd | |||
| 0c54a42b97 |
5
pom.xml
5
pom.xml
@@ -83,11 +83,6 @@
|
|||||||
<artifactId>spring-boot-starter-webmvc-test</artifactId>
|
<artifactId>spring-boot-starter-webmvc-test</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>org.mindrot</groupId>
|
|
||||||
<artifactId>jbcrypt</artifactId>
|
|
||||||
<version>0.4</version>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ import org.aspectj.lang.annotation.Pointcut;
|
|||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import com.example.demo.app.presentation.controller.pageproperty.SessionKeyword;
|
|
||||||
import com.example.demo.exception.NoSessionException;
|
import com.example.demo.exception.NoSessionException;
|
||||||
|
|
||||||
|
|
||||||
@@ -33,7 +32,7 @@ public class SessionCheckAspect {
|
|||||||
public void checkSession() {
|
public void checkSession() {
|
||||||
HttpSession session = request.getSession(false);
|
HttpSession session = request.getSession(false);
|
||||||
|
|
||||||
if (session == null || session.getAttribute(SessionKeyword.LOGIN_USER) == null) {
|
if (session == null || session.getAttribute("loginUser") == null) {
|
||||||
throw new NoSessionException("不正なログインです");
|
throw new NoSessionException("不正なログインです");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,16 +4,12 @@ package com.example.demo.aop.handler;
|
|||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import jakarta.servlet.http.HttpSession;
|
|
||||||
|
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.ui.Model;
|
import org.springframework.ui.Model;
|
||||||
import org.springframework.web.HttpRequestMethodNotSupportedException;
|
import org.springframework.web.HttpRequestMethodNotSupportedException;
|
||||||
import org.springframework.web.bind.annotation.ControllerAdvice;
|
import org.springframework.web.bind.annotation.ControllerAdvice;
|
||||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||||
|
|
||||||
import com.example.demo.app.presentation.controller.pageproperty.PageReturnAttributeKeyword;
|
|
||||||
import com.example.demo.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword;
|
|
||||||
import com.example.demo.exception.NoSessionException;
|
import com.example.demo.exception.NoSessionException;
|
||||||
|
|
||||||
@ControllerAdvice
|
@ControllerAdvice
|
||||||
@@ -32,36 +28,34 @@ public class GlobalExceptionHandler {
|
|||||||
LOGGER.log(Level.SEVERE, SEVERE_ERROR_MESSAGE_ILLEGAL_TRANSITION, e);
|
LOGGER.log(Level.SEVERE, SEVERE_ERROR_MESSAGE_ILLEGAL_TRANSITION, e);
|
||||||
|
|
||||||
model.addAttribute(
|
model.addAttribute(
|
||||||
PageReturnAttributeKeyword.ERROR_MESSAGE,
|
"errorMessage",
|
||||||
"システムエラーが発生しました。"
|
"システムエラーが発生しました。"
|
||||||
+ "初めからやり直してください。");
|
+ "初めからやり直してください。");
|
||||||
|
|
||||||
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.LOGIN;
|
return "redirect:/login";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ExceptionHandler(HttpRequestMethodNotSupportedException.class)
|
@ExceptionHandler(HttpRequestMethodNotSupportedException.class)
|
||||||
public String handleBadRequestException(Model model, Exception e, HttpSession session) {
|
public String handleBadRequestException(Model model, Exception e) {
|
||||||
model.addAttribute(PageReturnAttributeKeyword.ERROR, SEVERE_ERROR_MESSAGE_BAD_REQUEST);
|
model.addAttribute("error", SEVERE_ERROR_MESSAGE_BAD_REQUEST);
|
||||||
model.addAttribute(PageReturnAttributeKeyword.STATUS, HttpStatus.BAD_REQUEST.value());
|
model.addAttribute("status", HttpStatus.BAD_REQUEST.value());
|
||||||
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|
||||||
LOGGER.log(Level.SEVERE, SEVERE_ERROR_MESSAGE_ILLEGAL_TRANSITION, e);
|
LOGGER.log(Level.SEVERE, SEVERE_ERROR_MESSAGE_ILLEGAL_TRANSITION, e);
|
||||||
|
|
||||||
System.out.println("session invalidated");
|
|
||||||
session.invalidate();
|
|
||||||
|
|
||||||
return TransitionTargetPageNameKeyword.ERROR_HTML;
|
return "error";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ExceptionHandler(Exception.class)
|
@ExceptionHandler(Exception.class)
|
||||||
public String AllException(Model model, Exception e, HttpSession session) {
|
public String AllException(Model model, Exception e) {
|
||||||
|
model.addAttribute("error", SEVERE_ERROR_MESSAGE_BAD_REQUEST);
|
||||||
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|
||||||
System.out.println("session invalidated exception");
|
LOGGER.log(Level.SEVERE, SEVERE_ERROR_MESSAGE_ILLEGAL_TRANSITION, e);
|
||||||
// session.invalidate();
|
|
||||||
return TransitionTargetPageNameKeyword.ERROR_HTML;
|
return "error";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package com.example.demo.app.domain.model;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.example.demo.app.infra.entity.CourseEntity;
|
import com.example.demo.app.infra.entity.CourseEntity;
|
||||||
|
import com.example.demo.app.infra.entity.UserEntity;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
@@ -26,10 +27,11 @@ public class CourseModel {
|
|||||||
return courseEntityList.stream().map(CourseModel::convertFrom).toList();
|
return courseEntityList.stream().map(CourseModel::convertFrom).toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static CourseEntity convertTo(CourseModel courseModel) {
|
public static CourseEntity convertTo(CourseModel courseModel, List<UserEntity> userEntityList) {
|
||||||
return new CourseEntity(
|
return new CourseEntity(
|
||||||
courseModel.getCourseId(),
|
courseModel.getCourseId(),
|
||||||
courseModel.getCourseName(),
|
courseModel.getCourseName(),
|
||||||
courseModel.getDescription());
|
courseModel.getDescription(),
|
||||||
|
userEntityList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ public class GoalModel {
|
|||||||
goalModel.getTargetAmount(),
|
goalModel.getTargetAmount(),
|
||||||
goalModel.getDeadline(),
|
goalModel.getDeadline(),
|
||||||
0,
|
0,
|
||||||
userEntity);
|
userEntity, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static GoalModel convertFrom(GoalForm goalForm) {
|
public static GoalModel convertFrom(GoalForm goalForm) {
|
||||||
|
|||||||
@@ -8,4 +8,6 @@ public interface AllocationService {
|
|||||||
|
|
||||||
public List<AllocationModel> findAll();
|
public List<AllocationModel> findAll();
|
||||||
|
|
||||||
|
public List<AllocationModel> save(List<AllocationModel> allocationModelList);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package com.example.demo.app.domain.service;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.example.demo.app.domain.model.CourseModel;
|
import com.example.demo.app.domain.model.CourseModel;
|
||||||
import com.example.demo.app.presentation.form.AllocationFormList;
|
|
||||||
|
|
||||||
public interface CourseService {
|
public interface CourseService {
|
||||||
|
|
||||||
@@ -13,14 +12,5 @@ public interface CourseService {
|
|||||||
|
|
||||||
public Long findByName(String courName);
|
public Long findByName(String courName);
|
||||||
|
|
||||||
public CourseModel save(CourseModel courseModel, Long userId, AllocationFormList allocationFormList);
|
public CourseModel save(CourseModel courseModel, Long userId);
|
||||||
|
|
||||||
public List<CourseModel> findAllByUserId(Long userId);
|
|
||||||
|
|
||||||
public List<CourseModel> findAllByNull();
|
|
||||||
|
|
||||||
public String deleteCourse(Long courseId, Long userId);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -18,8 +18,6 @@ public interface GoalService {
|
|||||||
|
|
||||||
public void updateGoalComplete(Long userId);
|
public void updateGoalComplete(Long userId);
|
||||||
|
|
||||||
public int getCurrentAmount(Long userId);
|
|
||||||
|
|
||||||
// void deleteGoal(Long goalId);
|
// void deleteGoal(Long goalId);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -5,7 +5,7 @@ import com.example.demo.app.presentation.form.UserForm;
|
|||||||
|
|
||||||
public interface UserService {
|
public interface UserService {
|
||||||
|
|
||||||
public void register(UserForm userForm, Long courseId);
|
public void register(UserForm userForm, Long courseId, Long userId);
|
||||||
|
|
||||||
public void updateCourse(Long userId, Long courseId);
|
public void updateCourse(Long userId, Long courseId);
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.example.demo.app.domain.service.impl;
|
package com.example.demo.app.domain.service.impl;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@@ -25,5 +26,26 @@ public class AllocationServiceImpl implements AllocationService {
|
|||||||
return AllocationEntity.createAllocationModelList(allocationRepository.findAll());
|
return AllocationEntity.createAllocationModelList(allocationRepository.findAll());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<AllocationModel> save(List<AllocationModel> allocationModelList) {
|
||||||
|
|
||||||
|
List<AllocationEntity> allocationEntityList = new ArrayList<>();
|
||||||
|
|
||||||
|
allocationModelList.forEach(allocationModel -> {
|
||||||
|
allocationEntityList.add(
|
||||||
|
AllocationModel.convertTo(
|
||||||
|
categoryRepository.findById(allocationModel.getCategoryId()).get(),
|
||||||
|
courseRepository.findById(allocationModel.getCourseId()).get(),
|
||||||
|
allocationModel.getAllocationRatio()));
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
List<AllocationModel> result = new ArrayList<>();
|
||||||
|
for (AllocationEntity allocationEntity : allocationEntityList) {
|
||||||
|
result.add(AllocationModel.convertFrom(allocationRepository.save(allocationEntity)));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,23 +3,14 @@ package com.example.demo.app.domain.service.impl;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import jakarta.transaction.Transactional;
|
|
||||||
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import com.example.demo.app.domain.model.AllocationModel;
|
|
||||||
import com.example.demo.app.domain.model.CourseModel;
|
import com.example.demo.app.domain.model.CourseModel;
|
||||||
import com.example.demo.app.domain.service.CourseService;
|
import com.example.demo.app.domain.service.CourseService;
|
||||||
import com.example.demo.app.infra.entity.AllocationEntity;
|
|
||||||
import com.example.demo.app.infra.entity.CourseEntity;
|
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.entity.UserEntity;
|
||||||
import com.example.demo.app.infra.repository.AllocationRepository;
|
|
||||||
import com.example.demo.app.infra.repository.CategoryRepository;
|
|
||||||
import com.example.demo.app.infra.repository.CourseOwnerRepository;
|
|
||||||
import com.example.demo.app.infra.repository.CourseRepository;
|
import com.example.demo.app.infra.repository.CourseRepository;
|
||||||
import com.example.demo.app.infra.repository.UserRepository;
|
import com.example.demo.app.infra.repository.UserRepository;
|
||||||
import com.example.demo.app.presentation.form.AllocationFormList;
|
|
||||||
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
||||||
@@ -27,118 +18,28 @@ import lombok.RequiredArgsConstructor;
|
|||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class CourseServiceImpl implements CourseService {
|
public class CourseServiceImpl implements CourseService {
|
||||||
|
|
||||||
private final AllocationRepository allocationRepository;
|
|
||||||
|
|
||||||
private final CourseRepository courseRepository;
|
private final CourseRepository courseRepository;
|
||||||
private final UserRepository userRepository;
|
private final UserRepository userRepository;
|
||||||
private final CourseOwnerRepository courseOwnerRepository;
|
|
||||||
private final CategoryRepository categoryRepository;
|
public List<CourseModel> findAll(){
|
||||||
|
|
||||||
public List<CourseModel> findAll() {
|
|
||||||
|
|
||||||
return CourseEntity.createCourseModelList(courseRepository.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) {
|
public CourseModel findById(Long courseId) {
|
||||||
return CourseModel.convertFrom(courseRepository.findByCourseId(courseId));
|
return CourseModel.convertFrom(courseRepository.findByCourseId(courseId));
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long findByName(String courseName) {
|
public Long findByName(String courseName) {
|
||||||
return courseRepository.findByCourseName(courseName).getCourseId();
|
return courseRepository.findByCourseName(courseName).getCourseId();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
public CourseModel save(CourseModel courseModel, Long userId) {
|
||||||
public CourseModel save(CourseModel courseModel, Long userId, AllocationFormList allocationFormList) {
|
|
||||||
|
List<UserEntity> userEntityList = new ArrayList<>();
|
||||||
List<UserEntity> userEntityList = new ArrayList<>();
|
userEntityList.add(userRepository.findById(userId).get());
|
||||||
userEntityList.add(userRepository.findById(userId).get());
|
|
||||||
CourseEntity result = courseRepository.save(CourseModel.convertTo(courseModel));
|
return CourseModel.convertFrom( courseRepository.save( CourseModel.convertTo(courseModel, userEntityList)));
|
||||||
|
|
||||||
List<AllocationModel> allocationModelList = new ArrayList<>();
|
|
||||||
|
|
||||||
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId4(),
|
|
||||||
result.getCourseId(),
|
|
||||||
allocationFormList.getAllocationRatio4()));
|
|
||||||
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId5(),
|
|
||||||
result.getCourseId(),
|
|
||||||
allocationFormList.getAllocationRatio5()));
|
|
||||||
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId6(),
|
|
||||||
result.getCourseId(),
|
|
||||||
allocationFormList.getAllocationRatio6()));
|
|
||||||
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId7(),
|
|
||||||
result.getCourseId(),
|
|
||||||
allocationFormList.getAllocationRatio7()));
|
|
||||||
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId8(),
|
|
||||||
result.getCourseId(),
|
|
||||||
allocationFormList.getAllocationRatio8()));
|
|
||||||
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId9(),
|
|
||||||
result.getCourseId(),
|
|
||||||
allocationFormList.getAllocationRatio9()));
|
|
||||||
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId10(),
|
|
||||||
result.getCourseId(),
|
|
||||||
allocationFormList.getAllocationRatio10()));
|
|
||||||
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId11(),
|
|
||||||
result.getCourseId(),
|
|
||||||
allocationFormList.getAllocationRatio11()));
|
|
||||||
|
|
||||||
allocationModelList.stream().forEach(allocation -> {
|
|
||||||
System.out.println(allocation.getCourseId());
|
|
||||||
});
|
|
||||||
|
|
||||||
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);
|
|
||||||
|
|
||||||
List<AllocationEntity> allocationEntityList = new ArrayList<>();
|
|
||||||
|
|
||||||
allocationModelList.forEach(allocationModel -> {
|
|
||||||
allocationEntityList.add(
|
|
||||||
AllocationModel.convertTo(
|
|
||||||
categoryRepository.findById(allocationModel.getCategoryId()).get(),
|
|
||||||
courseRepository.findById(allocationModel.getCourseId()).get(),
|
|
||||||
allocationModel.getAllocationRatio()));
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
List<AllocationModel> resultList = new ArrayList<>();
|
|
||||||
for (AllocationEntity allocationEntity : allocationEntityList) {
|
|
||||||
resultList.add(AllocationModel.convertFrom(allocationRepository.save(allocationEntity)));
|
|
||||||
}
|
|
||||||
|
|
||||||
return CourseModel.convertFrom(result);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Transactional
|
|
||||||
public String deleteCourse(Long courseId, Long userId) {
|
|
||||||
|
|
||||||
UserEntity userEntity = userRepository.findById(userId).orElse(null);
|
|
||||||
if (userEntity.getCourseEntity().getCourseId() == courseId) {
|
|
||||||
return "selected";
|
|
||||||
} else if (courseId <= 6) {
|
|
||||||
return "original";
|
|
||||||
}
|
|
||||||
allocationRepository.deleteByCourseId(courseId);
|
|
||||||
courseOwnerRepository.deleteByCourseId(courseId);
|
|
||||||
courseRepository.deleteById(courseId);
|
|
||||||
return "ok";
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ public class GoalServiceImpl implements GoalService {
|
|||||||
|
|
||||||
// 現在の資産 = 貯蓄金 + 収支合計
|
// 現在の資産 = 貯蓄金 + 収支合計
|
||||||
int currentAmount = userEntity.getSaving() + transactionTotal;
|
int currentAmount = userEntity.getSaving() + transactionTotal;
|
||||||
|
|
||||||
// 達成率(%) = 現在の資産 ÷ 目標金額 × 100
|
// 達成率(%) = 現在の資産 ÷ 目標金額 × 100
|
||||||
|
|
||||||
List<GoalModel> goalModelList = new ArrayList<GoalModel>();
|
List<GoalModel> goalModelList = new ArrayList<GoalModel>();
|
||||||
@@ -59,28 +59,13 @@ public class GoalServiceImpl implements GoalService {
|
|||||||
: (int) ((currentAmount * 100.0) / goalEntity.getTargetAmount()),
|
: (int) ((currentAmount * 100.0) / goalEntity.getTargetAmount()),
|
||||||
currentAmount)));
|
currentAmount)));
|
||||||
|
|
||||||
|
|
||||||
return goalModelList;
|
return goalModelList;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public GoalModel createGoal(GoalModel goalModel, Long userId) {
|
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 goalEntity = GoalModel.convertTo(goalModel, userRepository.findById(userId).get());
|
||||||
|
|
||||||
GoalEntity savedGoalEntity = goalRepository.save(goalEntity);
|
GoalEntity savedGoalEntity = goalRepository.save(goalEntity);
|
||||||
@@ -97,7 +82,7 @@ public class GoalServiceImpl implements GoalService {
|
|||||||
|
|
||||||
return GoalModel.convertFrom(updatedGoalEntity, 0, 0);
|
return GoalModel.convertFrom(updatedGoalEntity, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void delete(Long goalId) {
|
public void delete(Long goalId) {
|
||||||
goalRepository.deleteById(goalId);
|
goalRepository.deleteById(goalId);
|
||||||
}
|
}
|
||||||
@@ -115,29 +100,12 @@ public class GoalServiceImpl implements GoalService {
|
|||||||
.sum();
|
.sum();
|
||||||
|
|
||||||
int currentAmount = userEntity.getSaving() + transactionTotal;
|
int currentAmount = userEntity.getSaving() + transactionTotal;
|
||||||
|
|
||||||
goalEntityList.stream().forEach(goalEntity -> {
|
goalEntityList.stream().forEach(goalEntity -> {
|
||||||
if (goalEntity.getTargetAmount() <= currentAmount) {
|
if (goalEntity.getTargetAmount() <= currentAmount) {
|
||||||
goalRepository.updateCompleteByGoalId(goalEntity.getGoalId());
|
goalRepository.updateCompleteByGoalId(goalEntity.getGoalId());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
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,6 +1,5 @@
|
|||||||
package com.example.demo.app.domain.service.impl;
|
package com.example.demo.app.domain.service.impl;
|
||||||
|
|
||||||
import org.mindrot.jbcrypt.BCrypt;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import com.example.demo.app.domain.model.LoginModel;
|
import com.example.demo.app.domain.model.LoginModel;
|
||||||
@@ -14,43 +13,19 @@ import lombok.RequiredArgsConstructor;
|
|||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class LoginServiceImpl implements LoginService {
|
public class LoginServiceImpl implements LoginService {
|
||||||
|
|
||||||
private final UserRepository userRepository;
|
private final UserRepository userRepository;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LoginModel login(String mailAddress, String password) {
|
public LoginModel login(String mailAddress, String password) {
|
||||||
|
|
||||||
UserEntity userEntity = userRepository
|
UserEntity userEntity = userRepository.findByMailAddressAndPassword(
|
||||||
.findByMailAddress(mailAddress)
|
mailAddress,
|
||||||
.orElse(null);
|
password).orElse(null);
|
||||||
|
|
||||||
if (userEntity == null) {
|
if (userEntity == null) {
|
||||||
return null;
|
return null;
|
||||||
} else if (userEntity.getDeleteFlag() == 1) {
|
}
|
||||||
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,6 +1,5 @@
|
|||||||
package com.example.demo.app.domain.service.impl;
|
package com.example.demo.app.domain.service.impl;
|
||||||
|
|
||||||
import org.mindrot.jbcrypt.BCrypt;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import com.example.demo.app.domain.service.PasswordResetService;
|
import com.example.demo.app.domain.service.PasswordResetService;
|
||||||
@@ -14,31 +13,30 @@ import lombok.RequiredArgsConstructor;
|
|||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class PasswordResetServiceImpl implements PasswordResetService {
|
public class PasswordResetServiceImpl implements PasswordResetService {
|
||||||
|
|
||||||
private final UserRepository userRepository;
|
private final UserRepository userRepository;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean resetPassword(
|
public boolean resetPassword(
|
||||||
Long userId,
|
Long userId,
|
||||||
PasswordResetForm passwordResetForm) {
|
PasswordResetForm passwordResetForm) {
|
||||||
|
|
||||||
if (!passwordResetForm.getPassword()
|
if (!passwordResetForm.getPassword()
|
||||||
.equals(passwordResetForm.getPasswordConfirm())) {
|
.equals(passwordResetForm.getPasswordConfirm())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
UserEntity userEntity = userRepository.findById(userId).orElse(null);
|
UserEntity userEntity =
|
||||||
|
userRepository.findById(userId).orElse(null);
|
||||||
|
|
||||||
if (userEntity == null) {
|
if (userEntity == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
String passwordHashed = BCrypt.hashpw(passwordResetForm.getPassword(), BCrypt.gensalt());
|
userEntity.setPassword(
|
||||||
|
passwordResetForm.getPassword());
|
||||||
|
|
||||||
userEntity.setPassword(
|
userRepository.save(userEntity);
|
||||||
passwordHashed);
|
|
||||||
|
|
||||||
userRepository.save(userEntity);
|
return true;
|
||||||
|
}
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -58,7 +58,6 @@ public class ProfileServiceImpl implements ProfileService{
|
|||||||
userEntity.setSaving(profileEditForm.getSaving());
|
userEntity.setSaving(profileEditForm.getSaving());
|
||||||
userEntity.setAnnualIncome(profileEditForm.getAnnualIncome());
|
userEntity.setAnnualIncome(profileEditForm.getAnnualIncome());
|
||||||
userEntity.setMonthlyBudget(profileEditForm.getMonthlyBudget());
|
userEntity.setMonthlyBudget(profileEditForm.getMonthlyBudget());
|
||||||
userEntity.setBirthDate(profileEditForm.getBirthDate());
|
|
||||||
userRepository.save(userEntity);
|
userRepository.save(userEntity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package com.example.demo.app.domain.service.impl;
|
package com.example.demo.app.domain.service.impl;
|
||||||
|
|
||||||
import org.mindrot.jbcrypt.BCrypt;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import com.example.demo.app.domain.model.UserModel;
|
import com.example.demo.app.domain.model.UserModel;
|
||||||
@@ -25,17 +24,14 @@ public class UserServiceImpl implements UserService {
|
|||||||
private final GoalRepository goalRepository;
|
private final GoalRepository goalRepository;
|
||||||
private final CourseRepository courseRepository;
|
private final CourseRepository courseRepository;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void register(UserForm userForm, Long courseId) {
|
public void register(UserForm userForm, Long courseId, Long userId) {
|
||||||
|
|
||||||
UserEntity userEntity = new UserEntity();
|
UserEntity userEntity = new UserEntity();
|
||||||
|
|
||||||
userEntity.setUserName(userForm.getUserName());
|
userEntity.setUserName(userForm.getUserName());
|
||||||
userEntity.setMailAddress(userForm.getMailAddress());
|
userEntity.setMailAddress(userForm.getMailAddress());
|
||||||
|
userEntity.setPassword(userForm.getPassword());
|
||||||
String passwordHashed = BCrypt.hashpw(userForm.getPassword(), BCrypt.gensalt());
|
|
||||||
|
|
||||||
userEntity.setPassword(passwordHashed);
|
|
||||||
userEntity.setSecretQuestionAnswer(userForm.getSecretAnswer());
|
userEntity.setSecretQuestionAnswer(userForm.getSecretAnswer());
|
||||||
userEntity.setBirthDate(userForm.getBirthDate());
|
userEntity.setBirthDate(userForm.getBirthDate());
|
||||||
userEntity.setSaving(userForm.getSaving());
|
userEntity.setSaving(userForm.getSaving());
|
||||||
@@ -48,18 +44,16 @@ public class UserServiceImpl implements UserService {
|
|||||||
|
|
||||||
GoalEntity goalEntity = new GoalEntity();
|
GoalEntity goalEntity = new GoalEntity();
|
||||||
goalEntity.setTargetAmount(Integer.parseInt(String.valueOf(userForm.getGoalId())));
|
goalEntity.setTargetAmount(Integer.parseInt(String.valueOf(userForm.getGoalId())));
|
||||||
|
goalEntity.setUserEntity(userRepository.findById(userId).get());
|
||||||
|
|
||||||
CourseEntity courseEntity = courseRepository.findById(courseId).orElse(null);
|
CourseEntity courseEntity = courseRepository.findById(courseId).orElse(null);
|
||||||
|
|
||||||
userEntity.setQuestionEntity(questionEntity);
|
userEntity.setQuestionEntity(questionEntity);
|
||||||
|
|
||||||
userEntity.setCourseEntity(courseEntity);
|
userEntity.setCourseEntity(courseEntity);
|
||||||
|
|
||||||
userEntity.setDeleteFlag(0);
|
userEntity.setDeleteFlag(0);
|
||||||
|
|
||||||
goalEntity.setUserEntity(userRepository.save(userEntity));
|
userRepository.save(userEntity);
|
||||||
|
|
||||||
goalRepository.save(goalEntity);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ public class CategoryEntity {
|
|||||||
@Column(name = "category_id")
|
@Column(name = "category_id")
|
||||||
private Long categoryId;
|
private Long categoryId;
|
||||||
|
|
||||||
@Column(name = "category_name", nullable = false, length = 50)
|
@Column(name = "category_name", nullable = false)
|
||||||
private String categoryName;
|
private String categoryName;
|
||||||
|
|
||||||
@Column(name = "transaction_type", nullable = false)
|
@Column(name = "transaction_type", nullable = false)
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import jakarta.persistence.Entity;
|
|||||||
import jakarta.persistence.GeneratedValue;
|
import jakarta.persistence.GeneratedValue;
|
||||||
import jakarta.persistence.GenerationType;
|
import jakarta.persistence.GenerationType;
|
||||||
import jakarta.persistence.Id;
|
import jakarta.persistence.Id;
|
||||||
|
import jakarta.persistence.OneToMany;
|
||||||
import jakarta.persistence.Table;
|
import jakarta.persistence.Table;
|
||||||
|
|
||||||
import com.example.demo.app.domain.model.CourseModel;
|
import com.example.demo.app.domain.model.CourseModel;
|
||||||
@@ -27,13 +28,16 @@ public class CourseEntity {
|
|||||||
@Column(name = "course_id")
|
@Column(name = "course_id")
|
||||||
private Long courseId;
|
private Long courseId;
|
||||||
|
|
||||||
@Column(name = "course_name", nullable = false, length = 50)
|
@Column(name = "course_name", nullable = false)
|
||||||
private String courseName;
|
private String courseName;
|
||||||
|
|
||||||
|
|
||||||
@Column(name = "description", nullable = false)
|
@Column(name = "description", nullable = false)
|
||||||
private String description;
|
private String description;
|
||||||
|
|
||||||
|
@OneToMany(mappedBy = "courseEntity")
|
||||||
|
private List<UserEntity> userEntity;
|
||||||
|
|
||||||
public static List<CourseModel> createCourseModelList(List<CourseEntity> courseEntityList) {
|
public static List<CourseModel> createCourseModelList(List<CourseEntity> courseEntityList) {
|
||||||
|
|
||||||
return courseEntityList
|
return courseEntityList
|
||||||
|
|||||||
@@ -1,37 +0,0 @@
|
|||||||
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;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -34,7 +34,7 @@ public class FixedCostEntity {
|
|||||||
@JoinColumn(name = "category_id")
|
@JoinColumn(name = "category_id")
|
||||||
private CategoryEntity categoryEntity;
|
private CategoryEntity categoryEntity;
|
||||||
|
|
||||||
@Column(name = "fixed_cost_name", nullable = false, length = 50)
|
@Column(name = "fixed_cost_name", nullable = false)
|
||||||
private String fixedCostName;
|
private String fixedCostName;
|
||||||
|
|
||||||
@Column(name = "amount", nullable = false)
|
@Column(name = "amount", nullable = false)
|
||||||
|
|||||||
@@ -29,10 +29,10 @@ public class GoalEntity {
|
|||||||
private Long goalId;
|
private Long goalId;
|
||||||
|
|
||||||
@Column(name = "goal_title", nullable = true)
|
@Column(name = "goal_title", nullable = true)
|
||||||
private String goalTitle = "名前を設定してください";
|
private String goalTitle;
|
||||||
|
|
||||||
@Column(name = "goal_subtitle", nullable = true)
|
@Column(name = "goal_subtitle", nullable = true)
|
||||||
private String goalSubtitle = "説明を書いてください";
|
private String goalSubtitle;
|
||||||
|
|
||||||
@Column(name = "target_amount", nullable = true)
|
@Column(name = "target_amount", nullable = true)
|
||||||
private Integer targetAmount;
|
private Integer targetAmount;
|
||||||
@@ -46,5 +46,7 @@ public class GoalEntity {
|
|||||||
@ManyToOne(fetch = FetchType.LAZY)
|
@ManyToOne(fetch = FetchType.LAZY)
|
||||||
@JoinColumn(name = "user_id")
|
@JoinColumn(name = "user_id")
|
||||||
private UserEntity userEntity;
|
private UserEntity userEntity;
|
||||||
|
|
||||||
|
private Integer deleteFlag;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
package com.example.demo.app.infra.entity;
|
|
||||||
|
|
||||||
public class TestController6 {
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -30,7 +30,7 @@ public class UserEntity {
|
|||||||
@Column(name = "user_id")
|
@Column(name = "user_id")
|
||||||
private Long userId;
|
private Long userId;
|
||||||
|
|
||||||
@Column(name = "user_name", nullable = false, length = 100)
|
@Column(name = "user_name", nullable = false)
|
||||||
private String userName;
|
private String userName;
|
||||||
|
|
||||||
@Column(name = "mail_address", nullable = false)
|
@Column(name = "mail_address", nullable = false)
|
||||||
@@ -39,7 +39,7 @@ public class UserEntity {
|
|||||||
@Column(name = "password", nullable = false)
|
@Column(name = "password", nullable = false)
|
||||||
private String password;
|
private String password;
|
||||||
|
|
||||||
@Column(name = "secret_answer", nullable = false, length = 100)
|
@Column(name = "secret_answer", nullable = false)
|
||||||
private String secretQuestionAnswer;
|
private String secretQuestionAnswer;
|
||||||
|
|
||||||
@Column(name = "birth_date", nullable = false)
|
@Column(name = "birth_date", nullable = false)
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package com.example.demo.app.infra.repository;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
import org.springframework.data.jpa.repository.Modifying;
|
|
||||||
import org.springframework.data.jpa.repository.Query;
|
import org.springframework.data.jpa.repository.Query;
|
||||||
|
|
||||||
import com.example.demo.app.domain.model.CourseInfoModel;
|
import com.example.demo.app.domain.model.CourseInfoModel;
|
||||||
@@ -29,9 +28,5 @@ public interface AllocationRepository extends JpaRepository<AllocationEntity, Al
|
|||||||
+ " ORDER BY a.courseEntity.courseId ASC, "
|
+ " ORDER BY a.courseEntity.courseId ASC, "
|
||||||
+ " a.categoryEntity.categoryId ASC ")
|
+ " a.categoryEntity.categoryId ASC ")
|
||||||
List<CourseInfoModel> findAllJoinedAllocation();
|
List<CourseInfoModel> findAllJoinedAllocation();
|
||||||
|
|
||||||
@Modifying
|
|
||||||
@Query("delete from AllocationEntity a where a.courseEntity.courseId = :courseId")
|
|
||||||
void deleteByCourseId(Long courseId);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,15 +0,0 @@
|
|||||||
package com.example.demo.app.infra.repository;
|
|
||||||
|
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
|
||||||
import org.springframework.data.jpa.repository.Modifying;
|
|
||||||
import org.springframework.data.jpa.repository.Query;
|
|
||||||
|
|
||||||
import com.example.demo.app.infra.entity.CourseOwnerEntity;
|
|
||||||
|
|
||||||
public interface CourseOwnerRepository extends JpaRepository<CourseOwnerEntity, Long>{
|
|
||||||
|
|
||||||
@Modifying
|
|
||||||
@Query("delete from CourseOwnerEntity c where c.courseEntity.courseId = :courseId")
|
|
||||||
public void deleteByCourseId(Long courseId);
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,24 +1,17 @@
|
|||||||
package com.example.demo.app.infra.repository;
|
package com.example.demo.app.infra.repository;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
import org.springframework.data.jpa.repository.Query;
|
import org.springframework.data.jpa.repository.Query;
|
||||||
|
|
||||||
import com.example.demo.app.infra.entity.CourseEntity;
|
import com.example.demo.app.infra.entity.CourseEntity;
|
||||||
|
|
||||||
public interface CourseRepository extends JpaRepository<CourseEntity, Long> {
|
public interface CourseRepository extends JpaRepository<CourseEntity, Long> {
|
||||||
|
|
||||||
@Query("SELECT c FROM CourseEntity c WHERE c.courseId = :courseId ")
|
@Query("SELECT c FROM CourseEntity c WHERE c.courseId = :courseId ")
|
||||||
public CourseEntity findByCourseId(Long courseId);
|
public CourseEntity findByCourseId(Long courseId);
|
||||||
|
|
||||||
@Query("SELECT c FROM CourseEntity c WHERE c.courseName = :courseName ")
|
@Query("SELECT c FROM CourseEntity c WHERE c.courseName = :courseName ")
|
||||||
public CourseEntity findByCourseName(String 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,9 +13,6 @@ import com.example.demo.aop.aspect.SessionCheck;
|
|||||||
import com.example.demo.app.domain.model.AnalysisModel;
|
import com.example.demo.app.domain.model.AnalysisModel;
|
||||||
import com.example.demo.app.domain.model.LoginModel;
|
import com.example.demo.app.domain.model.LoginModel;
|
||||||
import com.example.demo.app.domain.service.AnalysisService;
|
import com.example.demo.app.domain.service.AnalysisService;
|
||||||
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 com.example.demo.app.presentation.form.AnalysisForm;
|
||||||
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
@@ -28,7 +25,7 @@ public class AnalysisController {
|
|||||||
private final AnalysisService analysisService;
|
private final AnalysisService analysisService;
|
||||||
|
|
||||||
@SessionCheck
|
@SessionCheck
|
||||||
@GetMapping(TransitionTargetPageNameKeyword.ANALYSIS)
|
@GetMapping("/analysis")
|
||||||
public String showAnalysis(
|
public String showAnalysis(
|
||||||
@RequestParam(required = false) Integer year,
|
@RequestParam(required = false) Integer year,
|
||||||
@RequestParam(required = false) Integer month,
|
@RequestParam(required = false) Integer month,
|
||||||
@@ -36,7 +33,7 @@ public class AnalysisController {
|
|||||||
HttpSession session) {
|
HttpSession session) {
|
||||||
|
|
||||||
//ログインユーザーの取得(セッション)
|
//ログインユーザーの取得(セッション)
|
||||||
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
|
LoginModel loginUser = (LoginModel) session.getAttribute("loginUser");
|
||||||
|
|
||||||
//初期年月表示
|
//初期年月表示
|
||||||
LocalDate nowDate = LocalDate.now();
|
LocalDate nowDate = LocalDate.now();
|
||||||
@@ -61,15 +58,15 @@ public class AnalysisController {
|
|||||||
AnalysisForm analysisForm = AnalysisForm.convertFrom(analysisModel);
|
AnalysisForm analysisForm = AnalysisForm.convertFrom(analysisModel);
|
||||||
|
|
||||||
//model格納
|
//model格納
|
||||||
model.addAttribute(PageReturnAttributeKeyword.ANALYSIS_FORM, analysisForm);
|
model.addAttribute("analysisForm", analysisForm);
|
||||||
model.addAttribute(PageReturnAttributeKeyword.YEAR, year);
|
model.addAttribute("year", year);
|
||||||
model.addAttribute(PageReturnAttributeKeyword.MONTH, month);
|
model.addAttribute("month", month);
|
||||||
model.addAttribute(PageReturnAttributeKeyword.PREVIOUS_YEAR, previousDate.getYear());
|
model.addAttribute("previousYear", previousDate.getYear());
|
||||||
model.addAttribute(PageReturnAttributeKeyword.PREVIOUS_MONTH, previousDate.getMonthValue());
|
model.addAttribute("previousMonth", previousDate.getMonthValue());
|
||||||
model.addAttribute(PageReturnAttributeKeyword.NEXT_YEAR, nextDate.getYear());
|
model.addAttribute("nextYear", nextDate.getYear());
|
||||||
model.addAttribute(PageReturnAttributeKeyword.NEXT_MONTH, nextDate.getMonthValue());
|
model.addAttribute("nextMonth", nextDate.getMonthValue());
|
||||||
|
|
||||||
return TransitionTargetPageNameKeyword.ANALYSIS_HTML;
|
return "analysis";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,8 +10,6 @@ import org.springframework.web.bind.annotation.PostMapping;
|
|||||||
import com.example.demo.app.domain.model.AuthenticationModel;
|
import com.example.demo.app.domain.model.AuthenticationModel;
|
||||||
import com.example.demo.app.domain.service.AuthenticationService;
|
import com.example.demo.app.domain.service.AuthenticationService;
|
||||||
import com.example.demo.app.infra.repository.QuestionRepository;
|
import com.example.demo.app.infra.repository.QuestionRepository;
|
||||||
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.AuthenticationForm;
|
||||||
import com.example.demo.app.presentation.form.PasswordResetForm;
|
import com.example.demo.app.presentation.form.PasswordResetForm;
|
||||||
|
|
||||||
@@ -24,16 +22,16 @@ public class AuthenticationController {
|
|||||||
private final AuthenticationService authenticationService;
|
private final AuthenticationService authenticationService;
|
||||||
private final QuestionRepository questionRepository;
|
private final QuestionRepository questionRepository;
|
||||||
|
|
||||||
@GetMapping(TransitionTargetPageNameKeyword.AUTHENTICATION)
|
@GetMapping("/authentication")
|
||||||
public String showAuthentication(Model model) {
|
public String showAuthentication(Model model) {
|
||||||
|
|
||||||
model.addAttribute(PageReturnAttributeKeyword.AUTHENTICATION_FORM, new AuthenticationForm());
|
model.addAttribute("authenticationForm", new AuthenticationForm());
|
||||||
model.addAttribute(PageReturnAttributeKeyword.QUESTION_LIST, questionRepository.findAll());
|
model.addAttribute("questionList", questionRepository.findAll());
|
||||||
|
|
||||||
return TransitionTargetPageNameKeyword.AUTHENTICATION_HTML;
|
return "authentication";
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping(TransitionTargetPageNameKeyword.AUTHENTICATION)
|
@PostMapping("/authentication")
|
||||||
public String authenticate(
|
public String authenticate(
|
||||||
AuthenticationForm authenticationForm,
|
AuthenticationForm authenticationForm,
|
||||||
Model model,
|
Model model,
|
||||||
@@ -43,21 +41,21 @@ public class AuthenticationController {
|
|||||||
authenticationService.authenticate(authenticationForm);
|
authenticationService.authenticate(authenticationForm);
|
||||||
|
|
||||||
if (authenticationModel == null) {
|
if (authenticationModel == null) {
|
||||||
model.addAttribute(PageReturnAttributeKeyword.ERROR_MESSAGE, "認証情報が正しくありません。");
|
model.addAttribute("errorMessage", "認証情報が正しくありません。");
|
||||||
model.addAttribute(PageReturnAttributeKeyword.QUESTION_LIST, questionRepository.findAll());
|
model.addAttribute("questionList", questionRepository.findAll());
|
||||||
|
|
||||||
return TransitionTargetPageNameKeyword.AUTHENTICATION_HTML;
|
return "authentication";
|
||||||
}
|
}
|
||||||
|
|
||||||
session.setAttribute(
|
session.setAttribute(
|
||||||
PageReturnAttributeKeyword.PASSWOR_RESET_USER_ID,
|
"passwordResetUserId",
|
||||||
authenticationModel.getUserId());
|
authenticationModel.getUserId());
|
||||||
|
|
||||||
model.addAttribute(
|
model.addAttribute(
|
||||||
PageReturnAttributeKeyword.PASSWOR_RESET_FORM,
|
"passwordResetForm",
|
||||||
new PasswordResetForm());
|
new PasswordResetForm());
|
||||||
|
|
||||||
return TransitionTargetPageNameKeyword.PASSWORD_RESET_HTML;
|
return "password_reset";
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,9 +12,6 @@ import org.springframework.web.bind.annotation.PostMapping;
|
|||||||
|
|
||||||
import com.example.demo.app.domain.model.LoginModel;
|
import com.example.demo.app.domain.model.LoginModel;
|
||||||
import com.example.demo.app.domain.service.CategoryService;
|
import com.example.demo.app.domain.service.CategoryService;
|
||||||
import com.example.demo.app.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.CategoryForm;
|
||||||
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
@@ -26,64 +23,64 @@ public class CategoryController {
|
|||||||
private final CategoryService categoryService;
|
private final CategoryService categoryService;
|
||||||
|
|
||||||
|
|
||||||
@GetMapping(TransitionTargetPageNameKeyword.CATEGORY_LIST)
|
@GetMapping("/category/list")
|
||||||
public String categoryListGet(Model model, HttpSession session) {
|
public String categoryListGet(Model model, HttpSession session) {
|
||||||
|
|
||||||
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
|
LoginModel loginUser = (LoginModel) session.getAttribute("loginUser");
|
||||||
|
|
||||||
List<CategoryForm> categoryFormList = CategoryForm.convertFrom(categoryService.findAllByuserId(loginUser.getUserId()));
|
List<CategoryForm> categoryFormList = CategoryForm.convertFrom(categoryService.findAllByuserId(loginUser.getUserId()));
|
||||||
|
|
||||||
model.addAttribute(PageReturnAttributeKeyword.CATEGORY_FORM_LIST, categoryFormList);
|
model.addAttribute("categoryFormList", categoryFormList);
|
||||||
|
|
||||||
return TransitionTargetPageNameKeyword.CATEGORY_LIST_HTML;
|
return "category-list";
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping(TransitionTargetPageNameKeyword.CATEGORY_CREATE)
|
@GetMapping("/category/create")
|
||||||
public String categoryCreateGet(@ModelAttribute CategoryForm categoryForm) {
|
public String categoryCreateGet(@ModelAttribute CategoryForm categoryForm) {
|
||||||
|
|
||||||
return TransitionTargetPageNameKeyword.CATEGORY_CREATE_HTML;
|
return "category-create";
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping(TransitionTargetPageNameKeyword.CATEGORY_CREATE)
|
@PostMapping("/category/create")
|
||||||
public String categoryCreatePost(@ModelAttribute CategoryForm categoryForm, HttpSession session) {
|
public String categoryCreatePost(@ModelAttribute CategoryForm categoryForm, HttpSession session) {
|
||||||
|
|
||||||
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
|
LoginModel loginUser = (LoginModel) session.getAttribute("loginUser");
|
||||||
|
|
||||||
|
|
||||||
categoryService.save(CategoryForm.convertTo(categoryForm), loginUser.getUserId());
|
categoryService.save(CategoryForm.convertTo(categoryForm), loginUser.getUserId());
|
||||||
|
|
||||||
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.CATEGORY_LIST;
|
return "redirect:/category/list";
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping(TransitionTargetPageNameKeyword.CATEGORY_UPDATE)
|
@GetMapping("/category/update")
|
||||||
public String categoryUpdateGet(Model model, Long categoryId) {
|
public String categoryUpdateGet(Model model, Long categoryId) {
|
||||||
|
|
||||||
CategoryForm categoryForm = CategoryForm.convertFrom(categoryService.findOne(categoryId));
|
CategoryForm categoryForm = CategoryForm.convertFrom(categoryService.findOne(categoryId));
|
||||||
|
|
||||||
model.addAttribute(PageReturnAttributeKeyword.CATEGORY_ID, categoryId);
|
model.addAttribute("categoryId", categoryId);
|
||||||
model.addAttribute(PageReturnAttributeKeyword.CATEGORY_FORM, categoryForm);
|
model.addAttribute("categoryForm", categoryForm);
|
||||||
|
|
||||||
return TransitionTargetPageNameKeyword.CATEGORY_UPDATE_HTML;
|
return "category-update";
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping(TransitionTargetPageNameKeyword.CATEGORY_UPDATE)
|
@PostMapping("/category/update")
|
||||||
public String categoryUpdatePost(@ModelAttribute CategoryForm categoryForm, HttpSession session, Long categoryId) {
|
public String categoryUpdatePost(@ModelAttribute CategoryForm categoryForm, HttpSession session, Long categoryId) {
|
||||||
|
|
||||||
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
|
LoginModel loginUser = (LoginModel) session.getAttribute("loginUser");
|
||||||
|
|
||||||
categoryForm.setCategoryId(categoryId);
|
categoryForm.setCategoryId(categoryId);
|
||||||
|
|
||||||
categoryService.save(CategoryForm.convertTo(categoryForm), loginUser.getUserId());
|
categoryService.save(CategoryForm.convertTo(categoryForm), loginUser.getUserId());
|
||||||
|
|
||||||
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.CATEGORY_LIST;
|
return "redirect:/category/list";
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping(TransitionTargetPageNameKeyword.CATEGORY_DELETE)
|
@PostMapping("/category/delete")
|
||||||
public String categoryDeletePost(Long categoryId) {
|
public String categoryDeletePost(Long categoryId) {
|
||||||
|
|
||||||
categoryService.delete(categoryId);
|
categoryService.delete(categoryId);
|
||||||
|
|
||||||
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.CATEGORY_LIST;
|
return "redirect:/category/list";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -13,15 +13,12 @@ import org.springframework.web.bind.annotation.PostMapping;
|
|||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
import com.example.demo.aop.aspect.SessionCheck;
|
import com.example.demo.aop.aspect.SessionCheck;
|
||||||
import com.example.demo.app.domain.model.CourseModel;
|
import com.example.demo.app.domain.model.AllocationModel;
|
||||||
import com.example.demo.app.domain.model.LoginModel;
|
import com.example.demo.app.domain.model.LoginModel;
|
||||||
import com.example.demo.app.domain.service.AllocationService;
|
import com.example.demo.app.domain.service.AllocationService;
|
||||||
import com.example.demo.app.domain.service.CourseInfoService;
|
import com.example.demo.app.domain.service.CourseInfoService;
|
||||||
import com.example.demo.app.domain.service.CourseService;
|
import com.example.demo.app.domain.service.CourseService;
|
||||||
import com.example.demo.app.domain.service.UserService;
|
import com.example.demo.app.domain.service.UserService;
|
||||||
import com.example.demo.app.presentation.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.AllocationFormList;
|
||||||
import com.example.demo.app.presentation.form.CourseForm;
|
import com.example.demo.app.presentation.form.CourseForm;
|
||||||
import com.example.demo.app.presentation.form.CourseInfoForm;
|
import com.example.demo.app.presentation.form.CourseInfoForm;
|
||||||
@@ -37,121 +34,92 @@ public class CourseController {
|
|||||||
private final CourseInfoService courseInfoService;
|
private final CourseInfoService courseInfoService;
|
||||||
private final UserService userService;
|
private final UserService userService;
|
||||||
private final AllocationService allocationService;
|
private final AllocationService allocationService;
|
||||||
|
|
||||||
|
|
||||||
@PostMapping(TransitionTargetPageNameKeyword.SHOW_SELECT_COURSE)
|
@PostMapping("/user/register/course")
|
||||||
public String showSelectCourse(@ModelAttribute UserForm userForm, Model model, HttpSession session) {
|
public String showSelectCourse(@ModelAttribute UserForm userForm, Model model, HttpSession session) {
|
||||||
|
|
||||||
final String MODE = "regist";
|
session.setAttribute("userForm", userForm);
|
||||||
final String DEFAULT = "バランスコース";
|
model.addAttribute("mode", "regist");
|
||||||
|
model.addAttribute("currentCourseId", courseService.findByName("バランスコース"));
|
||||||
|
model.addAttribute("courseList", CourseForm.convertFrom(courseService.findAll()));
|
||||||
|
model.addAttribute("courseInfoList", CourseInfoForm.convertFrom(courseInfoService.findAll()));
|
||||||
|
|
||||||
session.setAttribute(PageReturnAttributeKeyword.USER_FORM, userForm);
|
return "select_course";
|
||||||
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
|
@SessionCheck
|
||||||
@GetMapping(TransitionTargetPageNameKeyword.COURSE)
|
@GetMapping("/course")
|
||||||
public String showChangeCourse(Model model, HttpSession session) {
|
public String showChangeCourse(Model model, HttpSession session) {
|
||||||
|
|
||||||
final String MODE = "change";
|
LoginModel loginUser = (LoginModel) session.getAttribute("loginUser");
|
||||||
|
|
||||||
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
|
|
||||||
Long userId = loginUser.getUserId();
|
Long userId = loginUser.getUserId();
|
||||||
|
|
||||||
Long currentCourseId = userService.findByUserId(userId).getCourseId();
|
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()));
|
||||||
|
|
||||||
List<CourseModel> courseModelList = new ArrayList<>(courseService.findAllByNull());
|
return "select_course";
|
||||||
|
|
||||||
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
|
@SessionCheck
|
||||||
@PostMapping(TransitionTargetPageNameKeyword.CHANGE)
|
@PostMapping("/change")
|
||||||
public String changeCourse(@RequestParam Long courseId, HttpSession httpSession) {
|
public String changeCourse(@RequestParam Long courseId, HttpSession httpSession) {
|
||||||
|
|
||||||
LoginModel loginUser = (LoginModel) httpSession.getAttribute(SessionKeyword.LOGIN_USER);
|
LoginModel loginUser = (LoginModel) httpSession.getAttribute("loginUser");
|
||||||
|
|
||||||
userService.updateCourse(loginUser.getUserId(), courseId);
|
userService.updateCourse(loginUser.getUserId(), courseId);
|
||||||
|
|
||||||
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.MENU;
|
return "redirect:/menu";
|
||||||
}
|
}
|
||||||
|
|
||||||
@SessionCheck
|
@SessionCheck
|
||||||
@GetMapping(TransitionTargetPageNameKeyword.COURSE_CREATE)
|
@GetMapping("/course/create")
|
||||||
public String createCourseGet(@ModelAttribute CourseForm courseForm, HttpSession session) {
|
public String createCourseGet(@ModelAttribute CourseForm courseForm, HttpSession session) {
|
||||||
|
|
||||||
return TransitionTargetPageNameKeyword.COURSE_CREATE_HTML;
|
return "course_create";
|
||||||
}
|
}
|
||||||
|
|
||||||
@SessionCheck
|
@SessionCheck
|
||||||
@PostMapping(TransitionTargetPageNameKeyword.COURSE_CREATE_RATIO)
|
@PostMapping("/course/create/ratio")
|
||||||
public String createCourse(@ModelAttribute CourseForm courseForm,
|
public String createCourse(@ModelAttribute CourseForm courseForm, @ModelAttribute AllocationFormList allocationFormList,
|
||||||
@ModelAttribute AllocationFormList allocationFormList,
|
|
||||||
HttpSession session, Model model) {
|
HttpSession session, Model model) {
|
||||||
|
|
||||||
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
|
LoginModel loginUser = (LoginModel) session.getAttribute("loginUser");
|
||||||
|
|
||||||
model.addAttribute("courseForm", courseForm);
|
CourseForm form = CourseForm.convertFrom(courseService.save(CourseForm.convertTo(courseForm), loginUser.getUserId()));
|
||||||
|
|
||||||
return TransitionTargetPageNameKeyword.COURSE_CREATE_RATIO_HTML;
|
session.setAttribute("courseId", form.getCourseId());
|
||||||
|
|
||||||
|
return "course_create_ratio";
|
||||||
}
|
}
|
||||||
|
|
||||||
@SessionCheck
|
@SessionCheck
|
||||||
@PostMapping(TransitionTargetPageNameKeyword.COURSE_CREATE)
|
@PostMapping("/course/create")
|
||||||
public String createCoursePost(@ModelAttribute CourseForm courseForm,
|
public String createCoursePost(@ModelAttribute AllocationFormList allocationFormList, HttpSession session) {
|
||||||
@ModelAttribute AllocationFormList allocationFormList, HttpSession session) {
|
|
||||||
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
|
|
||||||
|
|
||||||
courseService.save(CourseForm.convertTo(courseForm), loginUser.getUserId(), allocationFormList);
|
|
||||||
|
|
||||||
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.COURSE;
|
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()));
|
||||||
|
|
||||||
|
allocationService.save(allocationModelList);
|
||||||
|
|
||||||
|
return "redirect:/course";
|
||||||
}
|
}
|
||||||
|
|
||||||
@SessionCheck
|
}
|
||||||
@PostMapping("/course/delete")
|
|
||||||
public String createCoursePost(@RequestParam Long courseId, HttpSession session, Model model) {
|
|
||||||
|
|
||||||
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
|
|
||||||
|
|
||||||
// System.out.println("**********************cousrId: " + courseId);
|
|
||||||
String condition = courseService.deleteCourse(courseId, loginUser.getUserId());
|
|
||||||
|
|
||||||
if (condition.equals("selected")) {
|
|
||||||
|
|
||||||
model.addAttribute("message", "適用中のコースは選べません");
|
|
||||||
|
|
||||||
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.COURSE;
|
|
||||||
|
|
||||||
} else if (condition.equals("original")) {
|
|
||||||
model.addAttribute("message", "既存のデータは削除できません");
|
|
||||||
|
|
||||||
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.COURSE;
|
|
||||||
} else if (condition.equals("ok")) {
|
|
||||||
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.COURSE;
|
|
||||||
}
|
|
||||||
model.addAttribute("message", "エラーが発生しました");
|
|
||||||
|
|
||||||
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.COURSE;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -3,13 +3,10 @@ package com.example.demo.app.presentation.controller;
|
|||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
|
||||||
import com.example.demo.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword;
|
|
||||||
|
|
||||||
@Controller
|
@Controller
|
||||||
public class ErrorController {
|
public class ErrorController {
|
||||||
@GetMapping(TransitionTargetPageNameKeyword.ERROR)
|
@GetMapping("/error")
|
||||||
public String showError() {
|
public String showError() {
|
||||||
return TransitionTargetPageNameKeyword.ERROR_HTML;
|
return "error";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,9 +16,6 @@ import com.example.demo.aop.aspect.SessionCheck;
|
|||||||
import com.example.demo.app.domain.model.LoginModel;
|
import com.example.demo.app.domain.model.LoginModel;
|
||||||
import com.example.demo.app.domain.service.CategoryService;
|
import com.example.demo.app.domain.service.CategoryService;
|
||||||
import com.example.demo.app.domain.service.FixedCostService;
|
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.CategoryForm;
|
||||||
import com.example.demo.app.presentation.form.FixedCostForm;
|
import com.example.demo.app.presentation.form.FixedCostForm;
|
||||||
|
|
||||||
@@ -32,30 +29,30 @@ public class FixedCostController {
|
|||||||
private final CategoryService categoryService;
|
private final CategoryService categoryService;
|
||||||
|
|
||||||
@SessionCheck
|
@SessionCheck
|
||||||
@GetMapping(TransitionTargetPageNameKeyword.FIXED_COST_LIST)
|
@GetMapping("/fixed-cost/list")
|
||||||
public String getFixedCostList(
|
public String getFixedCostList(
|
||||||
HttpSession session, Model model, LocalDate today) {
|
HttpSession session, Model model, LocalDate today) {
|
||||||
|
|
||||||
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
|
LoginModel loginUser = (LoginModel) session.getAttribute("loginUser");
|
||||||
|
|
||||||
if (today == null) {
|
if (today == null) {
|
||||||
today = (LocalDate) session.getAttribute(PageReturnAttributeKeyword.TODAY);
|
today = (LocalDate) session.getAttribute("today");
|
||||||
}
|
}
|
||||||
|
|
||||||
List<FixedCostForm> fixedCostFormList = FixedCostForm.convertFrom(fixedCostService.findAllByUserId(loginUser.getUserId()));
|
List<FixedCostForm> fixedCostFormList = FixedCostForm.convertFrom(fixedCostService.findAllByUserId(loginUser.getUserId()));
|
||||||
|
|
||||||
fixedCostFormList.forEach(fixedCostForm -> fixedCostForm.setCategoryName(categoryService.findOne(fixedCostForm.getCategoryId()).getCategoryName()));
|
fixedCostFormList.forEach(fixedCostForm -> fixedCostForm.setCategoryName(categoryService.findOne(fixedCostForm.getCategoryId()).getCategoryName()));
|
||||||
|
|
||||||
model.addAttribute(PageReturnAttributeKeyword.FIXED_COST_FORM_LIST, fixedCostFormList);
|
model.addAttribute("fixedCostFormList", fixedCostFormList);
|
||||||
|
|
||||||
model.addAttribute(PageReturnAttributeKeyword.TODAY, today);
|
model.addAttribute("today", today);
|
||||||
|
|
||||||
return TransitionTargetPageNameKeyword.FIXED_COST_HTML;
|
return "fixed_cost";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@SessionCheck
|
@SessionCheck
|
||||||
@GetMapping(TransitionTargetPageNameKeyword.FIXED_COST_CREATE)
|
@GetMapping("/fixed-cost/create")
|
||||||
public String getFixedCostCreate(
|
public String getFixedCostCreate(
|
||||||
HttpSession session, @ModelAttribute FixedCostForm fixedCostForm, Model model, LocalDate today) {
|
HttpSession session, @ModelAttribute FixedCostForm fixedCostForm, Model model, LocalDate today) {
|
||||||
|
|
||||||
@@ -75,42 +72,42 @@ public class FixedCostController {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
model.addAttribute(PageReturnAttributeKeyword.EXPENSE_LIST, expenseList);
|
model.addAttribute("expenseList", expenseList);
|
||||||
model.addAttribute(PageReturnAttributeKeyword.INCOME_LIST, incomeList);
|
model.addAttribute("incomeList", incomeList);
|
||||||
model.addAttribute(PageReturnAttributeKeyword.TODAY, today);
|
model.addAttribute("today", today);
|
||||||
|
|
||||||
|
|
||||||
return TransitionTargetPageNameKeyword.FIXED_COST_CREATE_HTML;
|
return "fixed_cost_create";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@SessionCheck
|
@SessionCheck
|
||||||
@PostMapping(TransitionTargetPageNameKeyword.FIXED_COST_CREATE)
|
@PostMapping("/fixed-cost/create")
|
||||||
public String postFixedCostCreate(
|
public String postFixedCostCreate(
|
||||||
HttpSession session, @ModelAttribute FixedCostForm fixedCostForm, Model model, LocalDate today) {
|
HttpSession session, @ModelAttribute FixedCostForm fixedCostForm, Model model, LocalDate today) {
|
||||||
|
|
||||||
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
|
LoginModel loginUser = (LoginModel) session.getAttribute("loginUser");
|
||||||
|
|
||||||
fixedCostForm.setUserId(loginUser.getUserId());
|
fixedCostForm.setUserId(loginUser.getUserId());
|
||||||
|
|
||||||
fixedCostService.save(FixedCostForm.convertTo(fixedCostForm));
|
fixedCostService.save(FixedCostForm.convertTo(fixedCostForm));
|
||||||
|
|
||||||
session.setAttribute(PageReturnAttributeKeyword.TODAY, today);
|
session.setAttribute("today", today);
|
||||||
|
|
||||||
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.FIXED_COST_LIST;
|
return "redirect:/fixed-cost/list";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@SessionCheck
|
@SessionCheck
|
||||||
@PostMapping(TransitionTargetPageNameKeyword.FIXED_COST_DELETE)
|
@PostMapping("/fixed-cost/delete")
|
||||||
public String postFixedCostDelete(Long fixedCostId, LocalDate today, HttpSession session) {
|
public String postFixedCostDelete(Long fixedCostId, LocalDate today, HttpSession session) {
|
||||||
|
|
||||||
fixedCostService.delete(fixedCostId);
|
fixedCostService.delete(fixedCostId);
|
||||||
|
|
||||||
session.setAttribute(PageReturnAttributeKeyword.TODAY, today);
|
session.setAttribute("today", today);
|
||||||
|
|
||||||
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.FIXED_COST_LIST;
|
return "redirect:/fixed-cost/list";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -25,9 +25,6 @@ import com.example.demo.app.domain.service.CategoryService;
|
|||||||
import com.example.demo.app.domain.service.GoalService;
|
import com.example.demo.app.domain.service.GoalService;
|
||||||
import com.example.demo.app.domain.service.TransactionService;
|
import com.example.demo.app.domain.service.TransactionService;
|
||||||
import com.example.demo.app.domain.service.UserService;
|
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.CategoryForm;
|
||||||
import com.example.demo.app.presentation.form.GoalForm;
|
import com.example.demo.app.presentation.form.GoalForm;
|
||||||
import com.example.demo.app.presentation.form.MonthlyAchievementForm;
|
import com.example.demo.app.presentation.form.MonthlyAchievementForm;
|
||||||
@@ -38,7 +35,7 @@ import lombok.RequiredArgsConstructor;
|
|||||||
|
|
||||||
@Controller
|
@Controller
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@RequestMapping(TransitionTargetPageNameKeyword.GOAL)
|
@RequestMapping("/goal")
|
||||||
public class GoalController {
|
public class GoalController {
|
||||||
|
|
||||||
private final GoalService goalService;
|
private final GoalService goalService;
|
||||||
@@ -52,34 +49,25 @@ public class GoalController {
|
|||||||
Model model,
|
Model model,
|
||||||
HttpSession session,
|
HttpSession session,
|
||||||
Long goalId) {
|
Long goalId) {
|
||||||
|
|
||||||
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
|
LoginModel loginUser = (LoginModel) session.getAttribute("loginUser");
|
||||||
|
|
||||||
Long userId = loginUser.getUserId();
|
Long userId = loginUser.getUserId();
|
||||||
|
|
||||||
LocalDate today = LocalDate.now();
|
|
||||||
|
|
||||||
goalService.updateGoalComplete(userId);
|
goalService.updateGoalComplete(userId);
|
||||||
|
|
||||||
List<GoalModel> goalModelList = goalService.getGoalByUserId(userId);
|
List<GoalModel> goalModelList = goalService.getGoalByUserId(userId);
|
||||||
|
|
||||||
List<GoalForm> goalFormList1 = GoalForm.convertFrom(goalModelList);
|
List<GoalForm> goalFormList1 = GoalForm.convertFrom(goalModelList);
|
||||||
|
|
||||||
List<GoalForm> goalFormList = goalFormList1.stream()
|
List<GoalForm> goalFormList = goalFormList1.stream()
|
||||||
.filter(goalForm -> goalForm.getGoalComplete() == 0
|
.filter(goalForm -> goalForm.getGoalComplete() == 0)
|
||||||
&& !goalForm.getDeadline().isBefore(today))
|
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
model.addAttribute(
|
model.addAttribute(
|
||||||
PageReturnAttributeKeyword.GOAL_FORM_LIST,
|
"goalFormList",
|
||||||
goalFormList);
|
goalFormList);
|
||||||
|
|
||||||
model.addAttribute(
|
|
||||||
PageReturnAttributeKeyword.ACHIEVEMENT_LIST,
|
|
||||||
new ArrayList<MonthlyAchievementForm>());
|
|
||||||
|
|
||||||
if (goalFormList.isEmpty()) {
|
if (goalFormList.isEmpty()) {
|
||||||
return TransitionTargetPageNameKeyword.GOAL_VIEW_HTML;
|
return "goal_view";
|
||||||
}
|
}
|
||||||
|
|
||||||
GoalForm graphGoal;
|
GoalForm graphGoal;
|
||||||
@@ -98,7 +86,7 @@ public class GoalController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
model.addAttribute(
|
model.addAttribute(
|
||||||
PageReturnAttributeKeyword.GRAPH_GOAL,
|
"graphGoal",
|
||||||
graphGoal);
|
graphGoal);
|
||||||
|
|
||||||
int currentAmount = graphGoal.getCurrentAmount();
|
int currentAmount = graphGoal.getCurrentAmount();
|
||||||
@@ -110,6 +98,8 @@ public class GoalController {
|
|||||||
1,
|
1,
|
||||||
1);
|
1);
|
||||||
|
|
||||||
|
LocalDate today = LocalDate.now();
|
||||||
|
|
||||||
Map<LocalDate, List<TransactionForm>> transactionFormMap = new HashMap<>();
|
Map<LocalDate, List<TransactionForm>> transactionFormMap = new HashMap<>();
|
||||||
|
|
||||||
transactionService
|
transactionService
|
||||||
@@ -198,8 +188,7 @@ public class GoalController {
|
|||||||
month = month.minusMonths(1);
|
month = month.minusMonths(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
Collections.reverse(
|
Collections.reverse(monthlySavingList);
|
||||||
monthlySavingList);
|
|
||||||
|
|
||||||
List<MonthlyAchievementForm> achievementList = new ArrayList<>();
|
List<MonthlyAchievementForm> achievementList = new ArrayList<>();
|
||||||
|
|
||||||
@@ -224,31 +213,30 @@ public class GoalController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
model.addAttribute(
|
model.addAttribute(
|
||||||
PageReturnAttributeKeyword.ACHIEVEMENT_LIST,
|
"achievementList",
|
||||||
achievementList);
|
achievementList);
|
||||||
|
|
||||||
return TransitionTargetPageNameKeyword.GOAL_VIEW_HTML;
|
return "goal_view";
|
||||||
}
|
}
|
||||||
|
|
||||||
@SessionCheck
|
@SessionCheck
|
||||||
@GetMapping(TransitionTargetPageNameKeyword.EDIT)
|
@GetMapping("/edit")
|
||||||
public String editGoal(Model model, HttpSession session, Long goalId) {
|
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();
|
Long userId = loginUser.getUserId();
|
||||||
|
|
||||||
GoalForm goalForm = GoalForm.convertFrom(goalService.getGoalById(goalId));
|
GoalForm goalForm = GoalForm.convertFrom(goalService.getGoalById(goalId));
|
||||||
|
|
||||||
model.addAttribute(PageReturnAttributeKeyword.GOAL_FORM, goalForm);
|
model.addAttribute("goalForm", goalForm);
|
||||||
return TransitionTargetPageNameKeyword.GOAL_EDIT_HTML;
|
return "goal_edit";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SessionCheck
|
@SessionCheck
|
||||||
@PostMapping(TransitionTargetPageNameKeyword.UPDATE)
|
@PostMapping("/update")
|
||||||
public String updateGoal(@ModelAttribute GoalForm goalForm, HttpSession session) {
|
public String updateGoal(@ModelAttribute GoalForm goalForm, HttpSession session) {
|
||||||
|
|
||||||
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
|
LoginModel loginUser = (LoginModel) session.getAttribute("loginUser");
|
||||||
|
|
||||||
Long userId = loginUser.getUserId();
|
Long userId = loginUser.getUserId();
|
||||||
|
|
||||||
@@ -262,64 +250,48 @@ public class GoalController {
|
|||||||
GoalModel goalModel = GoalModel.convertFrom(goalForm);
|
GoalModel goalModel = GoalModel.convertFrom(goalForm);
|
||||||
goalService.updateGoal(goalModel, userId);
|
goalService.updateGoal(goalModel, userId);
|
||||||
|
|
||||||
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.GOAL;
|
return "redirect:/goal";
|
||||||
}
|
}
|
||||||
|
|
||||||
@SessionCheck
|
@SessionCheck
|
||||||
@GetMapping(TransitionTargetPageNameKeyword.CREATE)
|
@GetMapping("/create")
|
||||||
public String createGoalGet(@ModelAttribute GoalForm goalForm, HttpSession session, Model model) {
|
public String createGoalGet(@ModelAttribute GoalForm goalForm, HttpSession session) {
|
||||||
|
|
||||||
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
|
return "goal_create";
|
||||||
|
}
|
||||||
|
|
||||||
|
@SessionCheck
|
||||||
|
@PostMapping("/create")
|
||||||
|
public String createGoalPost(@ModelAttribute GoalForm goalForm, HttpSession session) {
|
||||||
|
|
||||||
|
LoginModel loginUser = (LoginModel) session.getAttribute("loginUser");
|
||||||
|
|
||||||
Long userId = loginUser.getUserId();
|
Long userId = loginUser.getUserId();
|
||||||
|
|
||||||
int currentAmount = goalService.getCurrentAmount(userId);
|
goalService.createGoal(GoalModel.convertFrom(goalForm), userId);
|
||||||
|
|
||||||
// System.out.println("************************currentAmount : " + currentAmount);
|
return "redirect:/goal";
|
||||||
|
|
||||||
session.setAttribute(PageReturnAttributeKeyword.CURRENT_AMOUNT, currentAmount);
|
|
||||||
|
|
||||||
return TransitionTargetPageNameKeyword.GOAL_CREATE_HTML;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SessionCheck
|
@SessionCheck
|
||||||
@PostMapping(TransitionTargetPageNameKeyword.CREATE)
|
@PostMapping("/delete") // フラグ考慮してないため、今度修正必要
|
||||||
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) {
|
public String deleteGoal(Long goalId, Long record) {
|
||||||
|
|
||||||
goalService.delete(goalId);
|
goalService.delete(goalId);
|
||||||
|
|
||||||
if (record == null) {
|
if (record == null) {
|
||||||
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.GOAL;
|
return "redirect:/goal";
|
||||||
} else {
|
} else {
|
||||||
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.GOAL
|
return "redirect:/goal/record";
|
||||||
+ TransitionTargetPageNameKeyword.RECORD;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SessionCheck
|
@SessionCheck
|
||||||
@GetMapping(TransitionTargetPageNameKeyword.RECORD)
|
@GetMapping("/record")
|
||||||
public String getRecord(HttpSession session, Model model) {
|
public String getRecord(HttpSession session, Model model) {
|
||||||
|
|
||||||
LocalDate today = LocalDate.now();
|
LoginModel loginUser = (LoginModel) session.getAttribute("loginUser");
|
||||||
|
|
||||||
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
|
|
||||||
|
|
||||||
Long userId = loginUser.getUserId();
|
Long userId = loginUser.getUserId();
|
||||||
goalService.updateGoalComplete(userId);
|
goalService.updateGoalComplete(userId);
|
||||||
@@ -330,22 +302,16 @@ public class GoalController {
|
|||||||
List<GoalForm> goalCompleteFormList = new ArrayList<>();
|
List<GoalForm> goalCompleteFormList = new ArrayList<>();
|
||||||
|
|
||||||
goalFormList.stream().forEach(goalForm -> {
|
goalFormList.stream().forEach(goalForm -> {
|
||||||
if (goalForm.getGoalComplete() == 1 || goalForm.getDeadline().isBefore(today)) {
|
if (goalForm.getGoalComplete() == 1) {
|
||||||
|
|
||||||
goalForm.setStatus(
|
|
||||||
goalForm.getGoalComplete() == 1
|
|
||||||
? "達成"
|
|
||||||
: "未達成");
|
|
||||||
|
|
||||||
goalCompleteFormList.add(goalForm);
|
goalCompleteFormList.add(goalForm);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
model.addAttribute(
|
model.addAttribute(
|
||||||
PageReturnAttributeKeyword.GOAL_COMPLETE_FORM_LIST,
|
"goalCompleteFormList",
|
||||||
goalCompleteFormList);
|
goalCompleteFormList);
|
||||||
|
|
||||||
return TransitionTargetPageNameKeyword.GOAL_RECORD_HTML;
|
return "goal_record";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -10,9 +10,6 @@ import org.springframework.web.bind.annotation.PostMapping;
|
|||||||
|
|
||||||
import com.example.demo.app.domain.model.LoginModel;
|
import com.example.demo.app.domain.model.LoginModel;
|
||||||
import com.example.demo.app.domain.service.LoginService;
|
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 com.example.demo.app.presentation.form.LoginForm;
|
||||||
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
@@ -21,40 +18,35 @@ import lombok.RequiredArgsConstructor;
|
|||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class LoginController {
|
public class LoginController {
|
||||||
|
|
||||||
private final LoginService loginService;
|
private final LoginService loginService;
|
||||||
|
|
||||||
@GetMapping(TransitionTargetPageNameKeyword.LOGIN)
|
@GetMapping("/login")
|
||||||
public String showLogin(@ModelAttribute LoginForm loginForm, HttpSession session) {
|
public String showLogin(@ModelAttribute LoginForm loginForm) {
|
||||||
|
|
||||||
if (session.getAttribute(SessionKeyword.LOGIN_USER) != null) {
|
return "login";
|
||||||
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.MENU;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return TransitionTargetPageNameKeyword.LOGIN_HTML;
|
@PostMapping("/login")
|
||||||
|
public String login(
|
||||||
|
@ModelAttribute LoginForm loginForm,
|
||||||
|
Model model,
|
||||||
|
HttpSession session) {
|
||||||
|
|
||||||
}
|
LoginModel loginModel = loginService.login(
|
||||||
|
loginForm.getMailAddress(),
|
||||||
|
loginForm.getPassword());
|
||||||
|
|
||||||
@PostMapping(TransitionTargetPageNameKeyword.LOGIN)
|
if (loginModel == null) {
|
||||||
public String login(
|
model.addAttribute(
|
||||||
@ModelAttribute LoginForm loginForm,
|
"errorMessage",
|
||||||
Model model,
|
"Email address or password is incorrect.");
|
||||||
HttpSession session) {
|
|
||||||
|
|
||||||
LoginModel loginModel = loginService.login(
|
return "login";
|
||||||
loginForm.getMailAddress(),
|
}
|
||||||
loginForm.getPassword());
|
|
||||||
|
|
||||||
if (loginModel == null) {
|
session.setAttribute("loginUser", loginModel);
|
||||||
model.addAttribute(
|
|
||||||
PageReturnAttributeKeyword.ERROR_MESSAGE,
|
|
||||||
"IDまたはパスワードが間違っています.");
|
|
||||||
|
|
||||||
return TransitionTargetPageNameKeyword.LOGIN_HTML;
|
|
||||||
}
|
|
||||||
|
|
||||||
session.setAttribute(SessionKeyword.LOGIN_USER, loginModel);
|
|
||||||
|
|
||||||
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.MENU;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
return "redirect:/menu";
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,9 +9,6 @@ import org.springframework.web.bind.annotation.PostMapping;
|
|||||||
|
|
||||||
import com.example.demo.app.domain.model.LoginModel;
|
import com.example.demo.app.domain.model.LoginModel;
|
||||||
import com.example.demo.app.domain.service.PasswordResetService;
|
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 com.example.demo.app.presentation.form.PasswordResetForm;
|
||||||
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
@@ -20,51 +17,54 @@ import lombok.RequiredArgsConstructor;
|
|||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class PasswordResetController {
|
public class PasswordResetController {
|
||||||
private final PasswordResetService passwordResetService;
|
private final PasswordResetService passwordResetService;
|
||||||
|
|
||||||
@GetMapping(TransitionTargetPageNameKeyword.PASSWORD_RESET)
|
@GetMapping("/password/reset")
|
||||||
public String showPasswordReset(Model model) {
|
public String showPasswordReset(Model model) {
|
||||||
model.addAttribute(PageReturnAttributeKeyword.PASSWOR_RESET_FORM, new PasswordResetForm());
|
model.addAttribute("passwordResetForm", new PasswordResetForm());
|
||||||
return TransitionTargetPageNameKeyword.PASSWORD_RESET_HTML;
|
return "password_reset";
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping(TransitionTargetPageNameKeyword.PASSWORD_RESET)
|
@PostMapping("/password/reset")
|
||||||
public String resetPassword(
|
public String resetPassword(
|
||||||
PasswordResetForm passwordResetForm,
|
PasswordResetForm passwordResetForm,
|
||||||
Model model,
|
Model model,
|
||||||
HttpSession session) {
|
HttpSession session){
|
||||||
|
|
||||||
Long userId = (Long) session.getAttribute(PageReturnAttributeKeyword.PASSWOR_RESET_USER_ID);
|
Long userId =
|
||||||
|
(Long) session.getAttribute("passwordResetUserId");
|
||||||
|
|
||||||
if (userId == null) {
|
if (userId == null) {
|
||||||
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
|
LoginModel loginUser =
|
||||||
|
(LoginModel) session.getAttribute("loginUser");
|
||||||
|
|
||||||
if (loginUser != null) {
|
if (loginUser != null) {
|
||||||
userId = loginUser.getUserId();
|
userId = loginUser.getUserId();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (userId == null) {
|
||||||
|
return "redirect:/login";
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean isReset =
|
||||||
|
passwordResetService.resetPassword(userId, passwordResetForm);
|
||||||
|
|
||||||
if (userId == null) {
|
System.out.println("isReset=" + isReset);
|
||||||
return TransitionTargetPageNameKeyword.REDIRECT +
|
|
||||||
TransitionTargetPageNameKeyword.LOGIN;
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean isReset = passwordResetService.resetPassword(userId, passwordResetForm);
|
if(!isReset) {
|
||||||
|
model.addAttribute("message", "パスワードが一致しません。");
|
||||||
|
return "password_reset";
|
||||||
|
}
|
||||||
|
|
||||||
if (!isReset) {
|
session.removeAttribute("passwordResetUserId");
|
||||||
model.addAttribute(PageReturnAttributeKeyword.MESSAGE, "パスワードが一致しません。");
|
|
||||||
return TransitionTargetPageNameKeyword.PASSWORD_RESET_HTML;
|
|
||||||
}
|
|
||||||
|
|
||||||
session.removeAttribute(PageReturnAttributeKeyword.PASSWOR_RESET_USER_ID);
|
LoginModel loginUser =
|
||||||
|
(LoginModel) session.getAttribute("loginUser");
|
||||||
|
|
||||||
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
|
if (loginUser != null) {
|
||||||
|
return "redirect:/menu";
|
||||||
|
}
|
||||||
|
|
||||||
if (loginUser != null) {
|
return "redirect:/login";
|
||||||
return TransitionTargetPageNameKeyword.REDIRECT +
|
|
||||||
TransitionTargetPageNameKeyword.PROFILE;
|
|
||||||
}
|
|
||||||
|
|
||||||
return TransitionTargetPageNameKeyword.REDIRECT +
|
|
||||||
TransitionTargetPageNameKeyword.LOGIN;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -12,9 +12,6 @@ import com.example.demo.aop.aspect.SessionCheck;
|
|||||||
import com.example.demo.app.domain.model.LoginModel;
|
import com.example.demo.app.domain.model.LoginModel;
|
||||||
import com.example.demo.app.domain.model.ProfileModel;
|
import com.example.demo.app.domain.model.ProfileModel;
|
||||||
import com.example.demo.app.domain.service.ProfileService;
|
import com.example.demo.app.domain.service.ProfileService;
|
||||||
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.ProfileEditForm;
|
||||||
import com.example.demo.app.presentation.form.ProfileForm;
|
import com.example.demo.app.presentation.form.ProfileForm;
|
||||||
|
|
||||||
@@ -26,26 +23,26 @@ public class ProfileController {
|
|||||||
private final ProfileService profileService;
|
private final ProfileService profileService;
|
||||||
|
|
||||||
@SessionCheck
|
@SessionCheck
|
||||||
@GetMapping(TransitionTargetPageNameKeyword.PROFILE)
|
@GetMapping("/profile")
|
||||||
public String profile(Model model, HttpSession session) {
|
public String profile(Model model, HttpSession session) {
|
||||||
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
|
LoginModel loginUser = (LoginModel) session.getAttribute("loginUser");
|
||||||
|
|
||||||
ProfileModel profileModel = profileService.findOne(loginUser.getUserId());
|
ProfileModel profileModel = profileService.findOne(loginUser.getUserId());
|
||||||
|
|
||||||
ProfileForm profileForm = ProfileForm.convertForm(profileModel);
|
ProfileForm profileForm = ProfileForm.convertForm(profileModel);
|
||||||
|
|
||||||
model.addAttribute(PageReturnAttributeKeyword.PROFILE_FORM, profileForm);
|
model.addAttribute("profileForm", profileForm);
|
||||||
return TransitionTargetPageNameKeyword.PROFILE_HTML;
|
return "profile";
|
||||||
}
|
}
|
||||||
|
|
||||||
@SessionCheck
|
@SessionCheck
|
||||||
@GetMapping(TransitionTargetPageNameKeyword.PROFILE_EDIT)
|
@GetMapping("/profile/edit")
|
||||||
public String showEditProfile(
|
public String showEditProfile(
|
||||||
Model model,
|
Model model,
|
||||||
HttpSession session) {
|
HttpSession session) {
|
||||||
|
|
||||||
LoginModel loginUser =
|
LoginModel loginUser =
|
||||||
(LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
|
(LoginModel) session.getAttribute("loginUser");
|
||||||
|
|
||||||
ProfileModel profileModel =
|
ProfileModel profileModel =
|
||||||
profileService.findOne(loginUser.getUserId());
|
profileService.findOne(loginUser.getUserId());
|
||||||
@@ -54,47 +51,46 @@ public class ProfileController {
|
|||||||
new ProfileEditForm(
|
new ProfileEditForm(
|
||||||
profileModel.getUserName(),
|
profileModel.getUserName(),
|
||||||
profileModel.getMailAddress(),
|
profileModel.getMailAddress(),
|
||||||
profileModel.getBirthDate(),
|
|
||||||
profileModel.getSaving(),
|
profileModel.getSaving(),
|
||||||
profileModel.getAnnualIncome(),
|
profileModel.getAnnualIncome(),
|
||||||
profileModel.getMonthlyBudget());
|
profileModel.getMonthlyBudget());
|
||||||
|
|
||||||
model.addAttribute(PageReturnAttributeKeyword.PROFILE_EDIT_FORM, profileEditForm);
|
model.addAttribute("profileEditForm", profileEditForm);
|
||||||
return TransitionTargetPageNameKeyword.PROFILE_EDIT_HTML;
|
return "profile_edit";
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping(TransitionTargetPageNameKeyword.PROFILE_EDIT)
|
@PostMapping("/profile/edit")
|
||||||
public String updateProfile(
|
public String updateProfile(
|
||||||
@ModelAttribute ProfileEditForm profileEditForm,
|
@ModelAttribute ProfileEditForm profileEditForm,
|
||||||
HttpSession session) {
|
HttpSession session) {
|
||||||
|
|
||||||
LoginModel loginUser =
|
LoginModel loginUser =
|
||||||
(LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
|
(LoginModel) session.getAttribute("loginUser");
|
||||||
|
|
||||||
profileService.update(
|
profileService.update(
|
||||||
loginUser.getUserId(),
|
loginUser.getUserId(),
|
||||||
profileEditForm);
|
profileEditForm);
|
||||||
|
|
||||||
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.PROFILE;
|
return "redirect:/profile";
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping(TransitionTargetPageNameKeyword.WITHDRAW)
|
@PostMapping("/withdraw")
|
||||||
public String withdraw(HttpSession session) {
|
public String withdraw(HttpSession session) {
|
||||||
|
|
||||||
LoginModel loginUser =
|
LoginModel loginUser =
|
||||||
(LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
|
(LoginModel) session.getAttribute("loginUser");
|
||||||
|
|
||||||
profileService.withdraw(loginUser.getUserId());
|
profileService.withdraw(loginUser.getUserId());
|
||||||
|
|
||||||
session.invalidate();
|
session.invalidate();
|
||||||
|
|
||||||
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.LOGIN;
|
return "redirect:/login";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@PostMapping(TransitionTargetPageNameKeyword.LOGOUT)
|
@PostMapping("/logout")
|
||||||
public String logout(HttpSession session) {
|
public String logout(HttpSession session) {
|
||||||
session.invalidate();
|
session.invalidate();
|
||||||
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.LOGIN;
|
return "redirect:/login";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,9 +25,6 @@ import com.example.demo.app.domain.service.FixedCostService;
|
|||||||
import com.example.demo.app.domain.service.GoalService;
|
import com.example.demo.app.domain.service.GoalService;
|
||||||
import com.example.demo.app.domain.service.TransactionService;
|
import com.example.demo.app.domain.service.TransactionService;
|
||||||
import com.example.demo.app.domain.service.UserService;
|
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.CategoryForm;
|
||||||
import com.example.demo.app.presentation.form.Expense;
|
import com.example.demo.app.presentation.form.Expense;
|
||||||
import com.example.demo.app.presentation.form.FixedCostForm;
|
import com.example.demo.app.presentation.form.FixedCostForm;
|
||||||
@@ -50,14 +47,14 @@ public class TransactionController {
|
|||||||
|
|
||||||
// 一覧画面
|
// 一覧画面
|
||||||
@SessionCheck
|
@SessionCheck
|
||||||
@GetMapping(TransitionTargetPageNameKeyword.TRANSACTION_LIST)
|
@GetMapping("/transaction/list")
|
||||||
public String transactionList(
|
public String transactionList(
|
||||||
@RequestParam(required = false, defaultValue = "0") String years,
|
@RequestParam(required = false, defaultValue = "0") String years,
|
||||||
@RequestParam(required = false, defaultValue = "0") String months,
|
@RequestParam(required = false, defaultValue = "0") String months,
|
||||||
Model model,
|
Model model,
|
||||||
HttpSession session) {
|
HttpSession session) {
|
||||||
|
|
||||||
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
|
LoginModel loginUser = (LoginModel) session.getAttribute("loginUser");
|
||||||
|
|
||||||
LocalDate today = LocalDate.now();
|
LocalDate today = LocalDate.now();
|
||||||
|
|
||||||
@@ -118,28 +115,28 @@ public class TransactionController {
|
|||||||
transactionFormMap.put(date, transactionFormList);
|
transactionFormMap.put(date, transactionFormList);
|
||||||
});
|
});
|
||||||
|
|
||||||
model.addAttribute(PageReturnAttributeKeyword.YEAR, year);
|
model.addAttribute("year", year);
|
||||||
model.addAttribute(PageReturnAttributeKeyword.MONTH, month);
|
model.addAttribute("month", month);
|
||||||
|
|
||||||
model.addAttribute(PageReturnAttributeKeyword.PREVIOUS_YEAR, previousYear);
|
model.addAttribute("previousYear", previousYear);
|
||||||
model.addAttribute(PageReturnAttributeKeyword.PREVIOUS_MONTH, previousMonth);
|
model.addAttribute("previousMonth", previousMonth);
|
||||||
|
|
||||||
model.addAttribute(PageReturnAttributeKeyword.NEXT_YEAR, nextYear);
|
model.addAttribute("nextYear", nextYear);
|
||||||
model.addAttribute(PageReturnAttributeKeyword.NEXT_MONTH, nextMonth);
|
model.addAttribute("nextMonth", nextMonth);
|
||||||
|
|
||||||
model.addAttribute(PageReturnAttributeKeyword.TRANSACTION_FORM_MAP, transactionFormMap);
|
model.addAttribute("transactionFormMap", transactionFormMap);
|
||||||
|
|
||||||
return TransitionTargetPageNameKeyword.TRANSACTION_LIST_HTML;
|
return "transaction_list";
|
||||||
}
|
}
|
||||||
|
|
||||||
// 詳細画面
|
// 詳細画面
|
||||||
@SessionCheck
|
@SessionCheck
|
||||||
@GetMapping(TransitionTargetPageNameKeyword.TRANSACTION_DETAIL)
|
@GetMapping("/transaction/detail")
|
||||||
public String findOne(@RequestParam(required = false) LocalDate todayDates, Model model, HttpSession session) {
|
public String findOne(@RequestParam(required = false) LocalDate todayDates, Model model, HttpSession session) {
|
||||||
|
|
||||||
LocalDate todayDate = (todayDates == null) ? LocalDate.now() : todayDates;
|
LocalDate todayDate = (todayDates == null) ? LocalDate.now() : todayDates;
|
||||||
|
|
||||||
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
|
LoginModel loginUser = (LoginModel) session.getAttribute("loginUser");
|
||||||
|
|
||||||
List<TransactionForm> transactionFormList = transactionService
|
List<TransactionForm> transactionFormList = transactionService
|
||||||
.findByUserIdAndDate(todayDate, loginUser.getUserId()).stream()
|
.findByUserIdAndDate(todayDate, loginUser.getUserId()).stream()
|
||||||
@@ -180,19 +177,19 @@ public class TransactionController {
|
|||||||
return transactionForm;
|
return transactionForm;
|
||||||
}).collect(Collectors.toList());
|
}).collect(Collectors.toList());
|
||||||
|
|
||||||
model.addAttribute(PageReturnAttributeKeyword.TODAY, todayDate);
|
model.addAttribute("today", todayDate);
|
||||||
model.addAttribute(PageReturnAttributeKeyword.TRANSACTION_FORM_LIST, transactionFormList);
|
model.addAttribute("transactionFormList", transactionFormList);
|
||||||
|
|
||||||
return TransitionTargetPageNameKeyword.TRANSACTION_DETAIL_HTML;
|
return "transaction_detail";
|
||||||
}
|
}
|
||||||
|
|
||||||
@SessionCheck
|
@SessionCheck
|
||||||
@GetMapping(TransitionTargetPageNameKeyword.TRANSACTION_CREATE)
|
@GetMapping("/transaction/create")
|
||||||
public String createOneGet(@RequestParam(defaultValue = "") LocalDate today,
|
public String createOneGet(@RequestParam(defaultValue = "") LocalDate today,
|
||||||
Long fixedCostId,
|
Long fixedCostId,
|
||||||
Model model, HttpSession session) {
|
Model model, HttpSession session) {
|
||||||
|
|
||||||
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
|
LoginModel loginUser = (LoginModel) session.getAttribute("loginUser");
|
||||||
if (today == null) {
|
if (today == null) {
|
||||||
today = LocalDate.now();
|
today = LocalDate.now();
|
||||||
}
|
}
|
||||||
@@ -218,62 +215,39 @@ public class TransactionController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
System.out.println(transactionForm.getCategoryName() + " " + transactionForm.getAmount());
|
||||||
|
|
||||||
List<CategoryForm> expenseList = new ArrayList<CategoryForm>();
|
model.addAttribute("transactionForm", transactionForm);
|
||||||
|
|
||||||
List<CategoryForm> incomeList = new ArrayList<CategoryForm>();
|
model.addAttribute("categoryFormList", categoryFormList);
|
||||||
|
|
||||||
for (CategoryForm categoryForm : categoryFormList) {
|
model.addAttribute("today", today.format(DateTimeFormatter.ISO_LOCAL_DATE));
|
||||||
|
|
||||||
if (categoryForm.getTransactionType() == 0) {
|
return "transaction_create";
|
||||||
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(SessionKeyword.T_TYPE, 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
|
@SessionCheck
|
||||||
@PostMapping(TransitionTargetPageNameKeyword.TRANSACTION_CREATE)
|
@PostMapping("/transaction/create")
|
||||||
public String createOnePost(@ModelAttribute TransactionForm transactionForm, @RequestParam LocalDate today,
|
public String createOnePost(@ModelAttribute TransactionForm transactionForm, @RequestParam LocalDate today,
|
||||||
Model model,
|
Model model,
|
||||||
HttpSession session) {
|
HttpSession session) {
|
||||||
|
|
||||||
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
|
LoginModel loginUser = (LoginModel) session.getAttribute("loginUser");
|
||||||
transactionForm.setUserId(loginUser.getUserId());
|
transactionForm.setUserId(loginUser.getUserId());
|
||||||
if (transactionService.createTransaction(TransactionForm.convertTo(transactionForm)) != 0) {
|
if (transactionService.createTransaction(TransactionForm.convertTo(transactionForm)) != 0) {
|
||||||
return TransitionTargetPageNameKeyword.ERROR_HTML;
|
return "error";
|
||||||
}
|
}
|
||||||
|
|
||||||
return TransitionTargetPageNameKeyword.REDIRECT +
|
return "redirect:/transaction/detail?todayDates=" + transactionForm.getTransactionDate();
|
||||||
TransitionTargetPageNameKeyword.TRANSACTION_DETAIL +
|
|
||||||
TransitionTargetPageNameKeyword.INTERROGATION +
|
|
||||||
TransitionTargetPageNameKeyword.TODAY_DATES +
|
|
||||||
TransitionTargetPageNameKeyword.EQUAL +
|
|
||||||
transactionForm.getTransactionDate();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SessionCheck
|
@SessionCheck
|
||||||
@GetMapping(TransitionTargetPageNameKeyword.TRANSACTION_UPDATE)
|
@GetMapping("/transaction/update")
|
||||||
public String updateOneGet(@RequestParam Long transactionId, @RequestParam(defaultValue = "") LocalDate today,
|
public String updateOneGet(@RequestParam Long transactionId, @RequestParam(defaultValue = "") LocalDate today,
|
||||||
Model model, HttpSession session) {
|
Model model, HttpSession session) {
|
||||||
|
|
||||||
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
|
LoginModel loginUser = (LoginModel) session.getAttribute("loginUser");
|
||||||
if (today == null) {
|
if (today == null) {
|
||||||
today = LocalDate.now();
|
today = LocalDate.now();
|
||||||
}
|
}
|
||||||
@@ -297,81 +271,54 @@ public class TransactionController {
|
|||||||
transactionService.findMoneyRecord(transactionId),
|
transactionService.findMoneyRecord(transactionId),
|
||||||
CategoryForm.convertFrom(categoryService.findByTransactionId(transactionId)).getTransactionType());
|
CategoryForm.convertFrom(categoryService.findByTransactionId(transactionId)).getTransactionType());
|
||||||
|
|
||||||
List<CategoryForm> expenseList = new ArrayList<CategoryForm>();
|
System.out.println("category: " + transactionForm.getCategoryId() + "金額: " + transactionForm.getAmount());
|
||||||
|
|
||||||
List<CategoryForm> incomeList = new ArrayList<CategoryForm>();
|
model.addAttribute("transactionId", transactionId);
|
||||||
|
|
||||||
for (CategoryForm categoryForm : categoryFormList) {
|
model.addAttribute("transactionForm", transactionForm);
|
||||||
|
|
||||||
if (categoryForm.getTransactionType() == 0) {
|
model.addAttribute("categoryFormList", categoryFormList);
|
||||||
expenseList.add(categoryForm);
|
|
||||||
} else {
|
|
||||||
incomeList.add(categoryForm);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
model.addAttribute("today", today);
|
||||||
|
|
||||||
model.addAttribute(PageReturnAttributeKeyword.EXPENSE_LIST, expenseList);
|
return "transaction_update";
|
||||||
model.addAttribute(PageReturnAttributeKeyword.INCOME_LIST, incomeList);
|
|
||||||
|
|
||||||
model.addAttribute(PageReturnAttributeKeyword.TRANSACTION_ID, transactionId);
|
|
||||||
|
|
||||||
model.addAttribute(PageReturnAttributeKeyword.TRANSACTION_FORM, transactionForm);
|
|
||||||
|
|
||||||
model.addAttribute(PageReturnAttributeKeyword.CATEGORY_FORM_LIST, categoryFormList);
|
|
||||||
|
|
||||||
model.addAttribute(PageReturnAttributeKeyword.TODAY, today);
|
|
||||||
|
|
||||||
session.setAttribute(SessionKeyword.T_TYPE, transactionForm.getTransactionType());
|
|
||||||
|
|
||||||
return TransitionTargetPageNameKeyword.TRANSACTION_UPDATE_HTML;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SessionCheck
|
@SessionCheck
|
||||||
@PostMapping(TransitionTargetPageNameKeyword.TRANSACTION_UPDATE)
|
@PostMapping("/transaction/update")
|
||||||
public String updateOnePost(@RequestParam Long transactionId, @ModelAttribute TransactionForm transactionForm,
|
public String updateOnePost(@RequestParam Long transactionId, @ModelAttribute TransactionForm transactionForm,
|
||||||
@RequestParam LocalDate today, Model model,
|
@RequestParam LocalDate today, Model model,
|
||||||
HttpSession session) {
|
HttpSession session) {
|
||||||
|
|
||||||
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
|
LoginModel loginUser = (LoginModel) session.getAttribute("loginUser");
|
||||||
|
|
||||||
transactionForm.setUserId(loginUser.getUserId());
|
transactionForm.setUserId(loginUser.getUserId());
|
||||||
transactionForm.setTransactionId(transactionId);
|
transactionForm.setTransactionId(transactionId);
|
||||||
|
|
||||||
if (transactionService.updateTransaction(TransactionForm.convertTo(transactionForm)) != 0) {
|
if (transactionService.updateTransaction(TransactionForm.convertTo(transactionForm)) != 0) {
|
||||||
return TransitionTargetPageNameKeyword.ERROR_HTML;
|
return "error";
|
||||||
}
|
}
|
||||||
|
|
||||||
return TransitionTargetPageNameKeyword.REDIRECT +
|
return "redirect:/transaction/detail?todayDates=" + transactionForm.getTransactionDate();
|
||||||
TransitionTargetPageNameKeyword.TRANSACTION_DETAIL +
|
|
||||||
TransitionTargetPageNameKeyword.INTERROGATION +
|
|
||||||
TransitionTargetPageNameKeyword.TODAY_DATES +
|
|
||||||
TransitionTargetPageNameKeyword.EQUAL +
|
|
||||||
transactionForm.getTransactionDate();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SessionCheck
|
@SessionCheck
|
||||||
@PostMapping(TransitionTargetPageNameKeyword.TRANSACTION_DELETE)
|
@PostMapping("/transaction/delete")
|
||||||
public String deleteOne(@RequestParam Long transactionId, @RequestParam LocalDate today) {
|
public String deleteOne(@RequestParam Long transactionId, @RequestParam LocalDate today) {
|
||||||
|
|
||||||
transactionService.deleteTransaction(transactionId);
|
transactionService.deleteTransaction(transactionId);
|
||||||
return TransitionTargetPageNameKeyword.REDIRECT +
|
return "redirect:/transaction/detail?todayDates=" + today;
|
||||||
TransitionTargetPageNameKeyword.TRANSACTION_DETAIL +
|
|
||||||
TransitionTargetPageNameKeyword.INTERROGATION +
|
|
||||||
TransitionTargetPageNameKeyword.TODAY_DATES +
|
|
||||||
TransitionTargetPageNameKeyword.EQUAL +
|
|
||||||
today;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SessionCheck
|
@SessionCheck
|
||||||
@GetMapping(TransitionTargetPageNameKeyword.MENU)
|
@GetMapping("/menu")
|
||||||
public String menu(HttpSession session, Model model,
|
public String menu(HttpSession session, Model model,
|
||||||
@RequestParam(required = false, defaultValue = "0") String years,
|
@RequestParam(required = false, defaultValue = "0") String years,
|
||||||
@RequestParam(required = false, defaultValue = "0") String months) {
|
@RequestParam(required = false, defaultValue = "0") String months) {
|
||||||
|
|
||||||
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
|
LoginModel loginUser = (LoginModel) session.getAttribute("loginUser");
|
||||||
|
|
||||||
LocalDate today = LocalDate.now();
|
LocalDate today = LocalDate.now();
|
||||||
|
|
||||||
@@ -395,18 +342,18 @@ public class TransactionController {
|
|||||||
int nextYear = nextYearMonth.getYear();
|
int nextYear = nextYearMonth.getYear();
|
||||||
int nextMonth = nextYearMonth.getMonthValue();
|
int nextMonth = nextYearMonth.getMonthValue();
|
||||||
|
|
||||||
model.addAttribute(PageReturnAttributeKeyword.YEAR, year);
|
model.addAttribute("year", year);
|
||||||
model.addAttribute(PageReturnAttributeKeyword.MONTH, month);
|
model.addAttribute("month", month);
|
||||||
model.addAttribute(PageReturnAttributeKeyword.DAY, today.getDayOfMonth());
|
model.addAttribute("day", today.getDayOfMonth());
|
||||||
|
|
||||||
model.addAttribute(PageReturnAttributeKeyword.LAST_DAY, lastDay);
|
model.addAttribute("lastDay", lastDay);
|
||||||
model.addAttribute(PageReturnAttributeKeyword.FIRST_DAY_OF_WEEK, firstDayOfWeek);
|
model.addAttribute("firstDayOfWeek", firstDayOfWeek);
|
||||||
|
|
||||||
model.addAttribute(PageReturnAttributeKeyword.PREVIOUS_YEAR, previousYear);
|
model.addAttribute("previousYear", previousYear);
|
||||||
model.addAttribute(PageReturnAttributeKeyword.PREVIOUS_MONTH, previousMonth);
|
model.addAttribute("previousMonth", previousMonth);
|
||||||
|
|
||||||
model.addAttribute(PageReturnAttributeKeyword.NEXT_YEAR, nextYear);
|
model.addAttribute("nextYear", nextYear);
|
||||||
model.addAttribute(PageReturnAttributeKeyword.NEXT_MONTH, nextMonth);
|
model.addAttribute("nextMonth", nextMonth);
|
||||||
|
|
||||||
LocalDate startDate = yearMonth.atDay(1);
|
LocalDate startDate = yearMonth.atDay(1);
|
||||||
LocalDate endDate = yearMonth.atEndOfMonth();
|
LocalDate endDate = yearMonth.atEndOfMonth();
|
||||||
@@ -415,51 +362,36 @@ public class TransactionController {
|
|||||||
|
|
||||||
List<Expense> expenseList = transactionService.findTotalExpenseList(startDate, endDate, loginUser.getUserId());
|
List<Expense> expenseList = transactionService.findTotalExpenseList(startDate, endDate, loginUser.getUserId());
|
||||||
|
|
||||||
model.addAttribute(PageReturnAttributeKeyword.INCOME_LIST, incomeList);
|
model.addAttribute("incomeList", incomeList);
|
||||||
model.addAttribute(PageReturnAttributeKeyword.EXPENSE_LIST, expenseList);
|
model.addAttribute("expenseList", expenseList);
|
||||||
|
|
||||||
int totalIncome = transactionService.findTotalIncome(startDate, endDate, loginUser.getUserId());
|
int totalIncome = transactionService.findTotalIncome(startDate, endDate, loginUser.getUserId());
|
||||||
|
|
||||||
int totalExpense = transactionService.findTotalExpense(startDate, endDate, loginUser.getUserId());
|
int totalExpense = transactionService.findTotalExpense(startDate, endDate, loginUser.getUserId());
|
||||||
|
|
||||||
model.addAttribute(PageReturnAttributeKeyword.TOTAL_INCOME, totalIncome);
|
model.addAttribute("totalIncome", totalIncome);
|
||||||
model.addAttribute(PageReturnAttributeKeyword.TOTAL_EXPENSE, totalExpense);
|
model.addAttribute("totalExpense", 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()));
|
UserForm userForm = UserForm.convertFrom(userService.findByUserId(loginUser.getUserId()));
|
||||||
|
|
||||||
List<GoalForm> resultList = goalForm.stream().filter(goal -> goal.getGoalComplete() == 0 && goal.getDeadline().isAfter(today) )
|
List<GoalForm> resultList = goalForm.stream().filter(goal -> goal.getGoalComplete() == 0)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
if (!resultList.isEmpty()) {
|
GoalForm result = resultList.getFirst();
|
||||||
GoalForm result = resultList.getFirst();
|
|
||||||
|
|
||||||
model.addAttribute(PageReturnAttributeKeyword.ACHIEVEMENT_RATE, result.getAchievementRate());
|
model.addAttribute("achievementRate", result.getAchievementRate());
|
||||||
|
|
||||||
model.addAttribute(PageReturnAttributeKeyword.CURRENT_AMOUNT, result.getCurrentAmount());
|
model.addAttribute("currentAmount", result.getCurrentAmount());
|
||||||
|
|
||||||
model.addAttribute(PageReturnAttributeKeyword.TARGET_AMOUNT, result.getTargetAmount());
|
model.addAttribute("targetAmount", result.getTargetAmount());
|
||||||
|
|
||||||
model.addAttribute(PageReturnAttributeKeyword.SAVING, userForm.getSaving());
|
model.addAttribute("saving", userForm.getSaving());
|
||||||
|
|
||||||
model.addAttribute(PageReturnAttributeKeyword.DEADLINE, result.getDeadline());
|
model.addAttribute("deadline", result.getDeadline());
|
||||||
|
|
||||||
} else {
|
return "menu";
|
||||||
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,13 +11,11 @@ import org.springframework.web.bind.annotation.ModelAttribute;
|
|||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
|
import com.example.demo.app.domain.model.LoginModel;
|
||||||
import com.example.demo.app.domain.service.CourseService;
|
import com.example.demo.app.domain.service.CourseService;
|
||||||
import com.example.demo.app.domain.service.QuestionService;
|
import com.example.demo.app.domain.service.QuestionService;
|
||||||
import com.example.demo.app.domain.service.UserService;
|
import com.example.demo.app.domain.service.UserService;
|
||||||
import com.example.demo.app.infra.entity.QuestionEntity;
|
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.SessionKeyword;
|
|
||||||
import com.example.demo.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword;
|
|
||||||
import com.example.demo.app.presentation.form.UserForm;
|
import com.example.demo.app.presentation.form.UserForm;
|
||||||
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
@@ -33,67 +31,66 @@ public class UserController {
|
|||||||
private final QuestionService questionService;
|
private final QuestionService questionService;
|
||||||
|
|
||||||
|
|
||||||
@GetMapping(TransitionTargetPageNameKeyword.USER_RESISTER)
|
@GetMapping("/user/register")
|
||||||
public String showRegister(Model model, HttpSession session) {
|
public String showRegister(Model model, HttpSession session) {
|
||||||
UserForm userForm = new UserForm();
|
UserForm userForm = new UserForm();
|
||||||
|
|
||||||
List<QuestionEntity> questionList = questionService.findAll();
|
List<QuestionEntity> questionList = questionService.findAll();
|
||||||
|
|
||||||
session.setAttribute(PageReturnAttributeKeyword.QUESTION_LIST, questionList);
|
session.setAttribute("questionList", questionList);
|
||||||
|
|
||||||
model.addAttribute(PageReturnAttributeKeyword.USER_FORM, userForm);
|
model.addAttribute("userForm", userForm);
|
||||||
return TransitionTargetPageNameKeyword.USER_RESISTER_HTML;
|
return "user_register";
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping(TransitionTargetPageNameKeyword.USER_RESISTER_RETURN)
|
@PostMapping("/user/register/return")
|
||||||
public String showRegisterReturn(@RequestParam(required = false) Long courseId, Model model, HttpSession session) {
|
public String showRegisterReturn(@RequestParam(required = false) Long courseId, Model model, HttpSession session) {
|
||||||
|
|
||||||
UserForm userForm = (UserForm) session.getAttribute(PageReturnAttributeKeyword.USER_FORM);
|
UserForm userForm = (UserForm) session.getAttribute("userForm");
|
||||||
|
System.out.println(
|
||||||
|
"######################################################################3" + userForm.getBirthDate());
|
||||||
|
|
||||||
if (userForm.getUserName().equals("")) {
|
if (userForm.getUserName().equals("")) {
|
||||||
userForm = new UserForm();
|
userForm = new UserForm();
|
||||||
userForm.setCourseId(courseId);
|
userForm.setCourseId(courseId);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (courseId != null) {
|
if (courseId != null) {
|
||||||
model.addAttribute(PageReturnAttributeKeyword.SELECTED_COURSE_NAME, courseService.findById(courseId).getCourseName());
|
model.addAttribute("selectedCourseName", courseService.findById(courseId).getCourseName());
|
||||||
}
|
}
|
||||||
|
|
||||||
session.setAttribute(SessionKeyword.SELECTED_COURSE_NAME, courseService.findById(courseId).getCourseName());
|
session.setAttribute("selectedCourseName", courseService.findById(courseId).getCourseName());
|
||||||
model.addAttribute(PageReturnAttributeKeyword.COURSE_ID, courseId);
|
model.addAttribute("courseId", courseId);
|
||||||
model.addAttribute(PageReturnAttributeKeyword.USER_FORM, userForm);
|
System.out.println(
|
||||||
|
"######################################################################3" + userForm.getBirthDate());
|
||||||
|
model.addAttribute("userForm", userForm);
|
||||||
|
|
||||||
return TransitionTargetPageNameKeyword.USER_RESISTER_RETURN_HTML;
|
return "user_register_return";
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping(TransitionTargetPageNameKeyword.USER_RESISTER_CONFIRM)
|
@GetMapping("/user/register/confirm")
|
||||||
public String confirmRegisterGet(@ModelAttribute UserForm userForm,
|
public String confirmRegisterGet(@ModelAttribute UserForm userForm,
|
||||||
String selectedCourseName, Model model,
|
String selectedCourseName, Model model,
|
||||||
HttpSession session) {
|
HttpSession session) {
|
||||||
|
|
||||||
model.addAttribute(PageReturnAttributeKeyword.SELECTED_COURSE_NAME, (String) session.getAttribute(SessionKeyword.SELECTED_COURSE_NAME));
|
model.addAttribute("selectedCourseName", (String) session.getAttribute("selectedCourseName"));
|
||||||
|
return "user_register_confirm";
|
||||||
session.setAttribute(SessionKeyword.QUESTION_ID, userForm.getSecretQuestionId());
|
|
||||||
|
|
||||||
return TransitionTargetPageNameKeyword.USER_RESISTER_CONFIRM_HTML;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping(TransitionTargetPageNameKeyword.USER_RESISTER_COMPLETE)
|
@PostMapping("/user/register/complete")
|
||||||
public String confirmRegister(
|
public String confirmRegister(
|
||||||
@ModelAttribute UserForm userForm,
|
@ModelAttribute UserForm userForm,
|
||||||
Model model,
|
Model model,
|
||||||
HttpSession session) {
|
HttpSession session) {
|
||||||
|
|
||||||
Long courseId = courseService.findByName((String) session.getAttribute(SessionKeyword.SELECTED_COURSE_NAME));
|
LoginModel loginUser = (LoginModel) session.getAttribute("loginUser");
|
||||||
|
|
||||||
Long questionId = (Long) session.getAttribute(SessionKeyword.QUESTION_ID);
|
Long courseId = courseService.findByName((String) session.getAttribute("selectedCourseName"));
|
||||||
|
|
||||||
userForm.setSecretQuestionId(questionId);
|
userService.register(userForm, courseId, loginUser.getUserId());
|
||||||
|
|
||||||
userService.register(userForm, courseId);
|
return "redirect:/login";
|
||||||
|
|
||||||
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.LOGIN;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -4,18 +4,17 @@ public class PageReturnAttributeKeyword {
|
|||||||
|
|
||||||
public static final String ERROR_MESSAGE = "errorMessage";
|
public static final String ERROR_MESSAGE = "errorMessage";
|
||||||
public static final String MESSAGE = "message";
|
public static final String MESSAGE = "message";
|
||||||
public static final String ERROR = "error";
|
|
||||||
public static final String STATUS = "status";
|
|
||||||
|
|
||||||
public static final String QUESTION_LIST = "questionList";
|
public static final String QUESTION_LIST = "questionList";
|
||||||
public static final String USER_FORM = "userForm";
|
public static final String USER_FORM = "userForm";
|
||||||
public static final String SELECTED_COURSE_NAME = "selectedCourseName";
|
public static final String SELECTED_COURSE_NAME = "selectedCourseName";
|
||||||
public static final String COURSE_ID = "courseId";
|
public static final String COURESE_ID = "courseId";
|
||||||
|
|
||||||
public static final String PASSWOR_RESET_FORM = "passwordResetForm";
|
public static final String PASSWOR_RESET_FORM = "passwordResetForm";
|
||||||
public static final String PASSWOR_RESET_USER_ID = "passwordResetUserId";
|
public static final String PASSWOR_RESET_USER_ID = "passwordResetUserId";
|
||||||
|
|
||||||
public static final String AUTHENTICATION_FORM = "authenticationForm";
|
public static final String AUTENTICATION_FORM = "authenticationForm";
|
||||||
|
|
||||||
public static final String PROFILE_FORM = "profileForm";
|
public static final String PROFILE_FORM = "profileForm";
|
||||||
public static final String PROFILE_EDIT_FORM = "profileEditForm";
|
public static final String PROFILE_EDIT_FORM = "profileEditForm";
|
||||||
@@ -53,14 +52,5 @@ public class PageReturnAttributeKeyword {
|
|||||||
public static final String ANALYSIS_FORM = "analysisForm";
|
public static final String ANALYSIS_FORM = "analysisForm";
|
||||||
|
|
||||||
public static final String GOAL_FORM = "goalForm";
|
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";
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,10 +3,4 @@ package com.example.demo.app.presentation.controller.pageproperty;
|
|||||||
public class SessionKeyword {
|
public class SessionKeyword {
|
||||||
// SESSION情報として格納したいログイン者の情報
|
// SESSION情報として格納したいログイン者の情報
|
||||||
public static final String LOGIN_USER = "loginUser";
|
public static final String LOGIN_USER = "loginUser";
|
||||||
|
|
||||||
public static final String SELECTED_COURSE_NAME = "selectedCourseName";
|
|
||||||
|
|
||||||
public static final String QUESTION_ID = "questionId";
|
|
||||||
|
|
||||||
public static final String T_TYPE = "tType";
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,13 +5,13 @@ public class TransitionTargetPageNameKeyword {
|
|||||||
// HTML
|
// HTML
|
||||||
public static final String ERROR_HTML = "error";
|
public static final String ERROR_HTML = "error";
|
||||||
|
|
||||||
public static final String USER_RESISTER_HTML = "user_register";
|
public static final String USER_RESISTER_HTML = "user_resiter";
|
||||||
public static final String USER_RESISTER_RETURN_HTML = "user_register_return";
|
public static final String USER_RESISTER_RETURN_HTML = "user_resiter_return";
|
||||||
public static final String USER_RESISTER_CONFIRM_HTML = "user_register_confirm";
|
public static final String USER_RESISTER_CONFIRM_HTML = "user_resiter_confirm";
|
||||||
|
|
||||||
public static final String LOGIN_HTML = "login";
|
public static final String LOGIN_HTML = "login";
|
||||||
|
|
||||||
public static final String PASSWORD_RESET_HTML = "password_reset";
|
public static final String PASSWORD_RESET_HTML = "passsword_reset";
|
||||||
|
|
||||||
public static final String AUTHENTICATION_HTML = "authentication";
|
public static final String AUTHENTICATION_HTML = "authentication";
|
||||||
|
|
||||||
@@ -21,8 +21,6 @@ public class TransitionTargetPageNameKeyword {
|
|||||||
public static final String PROFILE_EDIT_HTML = "profile_edit";
|
public static final String PROFILE_EDIT_HTML = "profile_edit";
|
||||||
|
|
||||||
public static final String SELECT_COURSE_HTML = "select_course";
|
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_LIST_HTML = "transaction_list";
|
||||||
public static final String TRANSACTION_DETAIL_HTML = "transaction_detail";
|
public static final String TRANSACTION_DETAIL_HTML = "transaction_detail";
|
||||||
@@ -33,15 +31,6 @@ public class TransitionTargetPageNameKeyword {
|
|||||||
|
|
||||||
public static final String GOAL_VIEW_HTML = "goal_view";
|
public static final String GOAL_VIEW_HTML = "goal_view";
|
||||||
public static final String GOAL_EDIT_HTML = "goal_edit";
|
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
|
// Countroller
|
||||||
public static final String ERROR = "/error";
|
public static final String ERROR = "/error";
|
||||||
@@ -58,7 +47,7 @@ public class TransitionTargetPageNameKeyword {
|
|||||||
|
|
||||||
public static final String AUTHENTICATION = "/authentication";
|
public static final String AUTHENTICATION = "/authentication";
|
||||||
|
|
||||||
public static final String PASSWORD_RESET = "/password/reset";
|
public static final String PASSWORD_RESET = "/passsword/reset";
|
||||||
|
|
||||||
public static final String MENU = "/menu";
|
public static final String MENU = "/menu";
|
||||||
|
|
||||||
@@ -69,9 +58,6 @@ public class TransitionTargetPageNameKeyword {
|
|||||||
public static final String SHOW_SELECT_COURSE = "/user/register/course";
|
public static final String SHOW_SELECT_COURSE = "/user/register/course";
|
||||||
public static final String COURSE = "/course";
|
public static final String COURSE = "/course";
|
||||||
public static final String CHANGE = "/change";
|
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 INTERROGATION = "?";
|
||||||
public static final String EQUAL = "=";
|
public static final String EQUAL = "=";
|
||||||
@@ -79,26 +65,12 @@ public class TransitionTargetPageNameKeyword {
|
|||||||
public static final String TRANSACTION_DETAIL = "/transaction/detail";
|
public static final String TRANSACTION_DETAIL = "/transaction/detail";
|
||||||
public static final String TRANSACTION_CREATE = "/transaction/create";
|
public static final String TRANSACTION_CREATE = "/transaction/create";
|
||||||
public static final String TRANSACTION_UPDATE = "/transaction/update";
|
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 TODAY_DATES = "todayDates";
|
||||||
|
|
||||||
public static final String ANALYSIS = "/analysis";
|
public static final String ANALYSIS = "/analysis";
|
||||||
|
|
||||||
public static final String GOAL = "/goal";
|
public static final String GOAL = "/goal";
|
||||||
public static final String EDIT = "/edit";
|
public static final String GOAL_EDIT = "/goal/edit";
|
||||||
public static final String UPDATE = "/update";
|
public static final String GOAL_UPDATE = "/goal/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";
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,8 +29,6 @@ public class GoalForm {
|
|||||||
|
|
||||||
private Integer goalComplete;
|
private Integer goalComplete;
|
||||||
|
|
||||||
private String status;
|
|
||||||
|
|
||||||
private Integer achievementRate; // 達成率
|
private Integer achievementRate; // 達成率
|
||||||
|
|
||||||
private Integer currentAmount; // 現在の資産
|
private Integer currentAmount; // 現在の資産
|
||||||
@@ -45,7 +43,6 @@ public class GoalForm {
|
|||||||
goalModel.getTargetAmount(),
|
goalModel.getTargetAmount(),
|
||||||
goalModel.getDeadline(),
|
goalModel.getDeadline(),
|
||||||
goalModel.getGoalComplete(),
|
goalModel.getGoalComplete(),
|
||||||
null,
|
|
||||||
goalModel.getAchievementRate(),
|
goalModel.getAchievementRate(),
|
||||||
goalModel.getCurrentAmount(),
|
goalModel.getCurrentAmount(),
|
||||||
goalModel.getUserId());
|
goalModel.getUserId());
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
package com.example.demo.app.presentation.form;
|
package com.example.demo.app.presentation.form;
|
||||||
|
|
||||||
import java.time.LocalDate;
|
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
@@ -12,7 +10,6 @@ import lombok.NoArgsConstructor;
|
|||||||
public class ProfileEditForm {
|
public class ProfileEditForm {
|
||||||
private String userName;
|
private String userName;
|
||||||
private String mailAddress;
|
private String mailAddress;
|
||||||
private LocalDate birthDate;
|
|
||||||
private Integer saving;
|
private Integer saving;
|
||||||
private Integer annualIncome;
|
private Integer annualIncome;
|
||||||
private Integer monthlyBudget;
|
private Integer monthlyBudget;
|
||||||
|
|||||||
5
src/main/java/com/example/demo/utility/Constant.java
Normal file
5
src/main/java/com/example/demo/utility/Constant.java
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
package com.example.demo.utility;
|
||||||
|
|
||||||
|
public class Constant {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
package com.example.demo.utility;
|
||||||
|
|
||||||
|
public class TestController1 {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -46,10 +46,6 @@ body {
|
|||||||
border-top: 1px solid #d0d7de;
|
border-top: 1px solid #d0d7de;
|
||||||
}
|
}
|
||||||
|
|
||||||
.a-footer {
|
|
||||||
text-decoration: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* =======================
|
/* =======================
|
||||||
カード
|
カード
|
||||||
======================= */
|
======================= */
|
||||||
@@ -182,10 +178,6 @@ td:hover {
|
|||||||
text-align: right;
|
text-align: right;
|
||||||
}
|
}
|
||||||
|
|
||||||
.a-calender {
|
|
||||||
text-decoration: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* =======================
|
/* =======================
|
||||||
金額表示
|
金額表示
|
||||||
======================= */
|
======================= */
|
||||||
@@ -214,10 +206,6 @@ td:hover {
|
|||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
}
|
}
|
||||||
|
|
||||||
.goal {
|
|
||||||
min-width: 300px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* =======================
|
/* =======================
|
||||||
ボタン
|
ボタン
|
||||||
======================= */
|
======================= */
|
||||||
|
|||||||
15
src/main/resources/static/css/transaction_detail.css
Normal file
15
src/main/resources/static/css/transaction_detail.css
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
.transaction-item {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
|
||||||
|
.transaction-buttons {
|
||||||
|
display: flex;
|
||||||
|
gap: 10px;
|
||||||
|
margin-right: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.transaction-buttons form {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
@@ -35,7 +35,7 @@
|
|||||||
<table class="table text-center">
|
<table class="table text-center">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="col"></th>
|
<th scope="col">カテゴリ別</th>
|
||||||
<th scope="col">支出</th>
|
<th scope="col">支出</th>
|
||||||
<th scope="col">前月比</th>
|
<th scope="col">前月比</th>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -47,7 +47,7 @@
|
|||||||
0
|
0
|
||||||
</td>
|
</td>
|
||||||
<td th:text="${analysisForm.totalDifferenceAmount >= 0}
|
<td th:text="${analysisForm.totalDifferenceAmount >= 0}
|
||||||
? '+' + ${analysisForm.totalDifferenceAmount}
|
? '+' + ${analysisForm.totalDifferenceAmount}
|
||||||
: ${analysisForm.totalDifferenceAmount}"
|
: ${analysisForm.totalDifferenceAmount}"
|
||||||
th:class="${analysisForm.totalDifferenceAmount >= 0}
|
th:class="${analysisForm.totalDifferenceAmount >= 0}
|
||||||
? 'text-danger'
|
? 'text-danger'
|
||||||
@@ -73,14 +73,16 @@
|
|||||||
|
|
||||||
<th scope="row"
|
<th scope="row"
|
||||||
th:text="${category.categoryName}">
|
th:text="${category.categoryName}">
|
||||||
|
食費
|
||||||
</th>
|
</th>
|
||||||
|
|
||||||
<td th:text="'¥' + ${category.currentMonthAmount}">
|
<td th:text="'¥' + ${category.currentMonthAmount}">
|
||||||
|
0
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
<span th:text="${category.monthDifferenceAmount >= 0}
|
<span th:text="${category.monthDifferenceAmount >= 0}
|
||||||
? '+' + ${category.monthDifferenceAmount}
|
? '+' + ${category.monthDifferenceAmount}
|
||||||
: ${category.monthDifferenceAmount}"
|
: ${category.monthDifferenceAmount}"
|
||||||
th:class="${category.monthDifferenceAmount >= 0}
|
th:class="${category.monthDifferenceAmount >= 0}
|
||||||
? 'text-danger'
|
? 'text-danger'
|
||||||
@@ -88,7 +90,7 @@
|
|||||||
</span>
|
</span>
|
||||||
<br>
|
<br>
|
||||||
<span th:text="${category.courseDifferenceAmount >= 0}
|
<span th:text="${category.courseDifferenceAmount >= 0}
|
||||||
? '+' + ${category.courseDifferenceAmount}
|
? '+' + ${category.courseDifferenceAmount}
|
||||||
: ${category.courseDifferenceAmount}"
|
: ${category.courseDifferenceAmount}"
|
||||||
th:class="${category.courseDifferenceAmount >= 0}
|
th:class="${category.courseDifferenceAmount >= 0}
|
||||||
? 'text-danger'
|
? 'text-danger'
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label" for="categoryName">カテゴリ名</label>
|
<label class="form-label" for="categoryName">カテゴリ名</label>
|
||||||
|
|
||||||
<input class="form-control" type="text" id="categoryName" th:field="*{categoryName}" required>
|
<input class="form-control" type="text" id="categoryName" th:field="*{categoryName}">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
@@ -33,7 +33,7 @@
|
|||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label" for="transactionType">収入・支出</label>
|
<label class="form-label" for="transactionType">収入・支出</label>
|
||||||
|
|
||||||
<select class="form-select" id="transactionType" th:field="*{transactionType}" required>
|
<select class="form-select" id="transactionType" th:field="*{transactionType}">
|
||||||
|
|
||||||
<option value="">選択してください</option>
|
<option value="">選択してください</option>
|
||||||
<option value="0">支出</option>
|
<option value="0">支出</option>
|
||||||
@@ -9,13 +9,13 @@
|
|||||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body style="padding-top:80px; padding-bottom:80px;">
|
<body class="pb-5 pt-5">
|
||||||
|
|
||||||
<div th:replace="~{header :: header}"></div>
|
<div th:replace="~{header :: header}"></div>
|
||||||
<div class="main-container">
|
<div class="main-container">
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<ul class="list-unstyled p-0 m-0">
|
<ul>
|
||||||
<li class="card shadow-sm mb-3" th:each="categoryForm : ${categoryFormList}">
|
<li class="card shadow-sm mb-3" th:each="categoryForm : ${categoryFormList}">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<div class="d-flex justify-content-between">
|
<div class="d-flex justify-content-between">
|
||||||
@@ -49,29 +49,19 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
<hr>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="d-grid mt-4">
|
|
||||||
|
|
||||||
<form th:action="@{/category/create}" method="get">
|
|
||||||
|
|
||||||
<input type="hidden"
|
|
||||||
name="today"
|
|
||||||
id="today"
|
|
||||||
th:value="${today}">
|
|
||||||
|
|
||||||
<button class="btn btn-success w-100" type="submit">
|
<form th:action="@{/category/create}" method="get">
|
||||||
新規登録
|
<input type="hidden" name="today" id="today" th:value="${today}">
|
||||||
</button>
|
<button type="submit">新規登録</button>
|
||||||
|
</form>
|
||||||
</form>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div th:replace="~{footer :: footer}"></div>
|
<div th:replace="~{footer :: footer}"></div>
|
||||||
</body>
|
</body>
|
||||||
@@ -25,7 +25,7 @@
|
|||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label" for="categoryName">カテゴリ名</label>
|
<label class="form-label" for="categoryName">カテゴリ名</label>
|
||||||
|
|
||||||
<input class="form-control" type="text" id="categoryName" th:field="*{categoryName}" required>
|
<input class="form-control" type="text" id="categoryName" th:field="*{categoryName}">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
@@ -33,7 +33,7 @@
|
|||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label" for="transactionType">収入・支出</label>
|
<label class="form-label" for="transactionType">収入・支出</label>
|
||||||
|
|
||||||
<select class="form-select" id="transactionType" th:field="*{transactionType}" required>
|
<select class="form-select" id="transactionType" th:field="*{transactionType}">
|
||||||
|
|
||||||
<option value="">選択してください</option>
|
<option value="">選択してください</option>
|
||||||
<option value="0">支出</option>
|
<option value="0">支出</option>
|
||||||
@@ -47,7 +47,7 @@
|
|||||||
<input type="hidden" name="categoryId" th:value="${categoryId}">
|
<input type="hidden" name="categoryId" th:value="${categoryId}">
|
||||||
|
|
||||||
<div class="d-grid">
|
<div class="d-grid">
|
||||||
<button type="submit" class="btn btn-primary">更新</button>
|
<button type="submit" class="btn btn-primary">登録</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label" for="courseName">コース名</label>
|
<label class="form-label" for="courseName">コース名</label>
|
||||||
|
|
||||||
<input class="form-control" type="text" id="courseName" th:field="*{courseName}" required>
|
<input class="form-control" type="text" id="courseName" th:field="*{courseName}">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body style="padding-top:80px; padding-bottom:120px;">
|
<body style="padding-top:80px; padding-bottom:80px;">
|
||||||
|
|
||||||
<div th:replace="~{header :: header}"></div>
|
<div th:replace="~{header :: header}"></div>
|
||||||
|
|
||||||
@@ -22,113 +22,95 @@
|
|||||||
<form th:action="@{/course/create}" th:object="${allocationFormList}" method="post">
|
<form th:action="@{/course/create}" th:object="${allocationFormList}" method="post">
|
||||||
|
|
||||||
|
|
||||||
|
<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">
|
<div class="mb-3">
|
||||||
<label class="form-label" for="allocationRatio4">固定費</label>
|
<label class="form-label" for="allocationRatio4">固定費</label>
|
||||||
<input class="form-control" type="number" min="0" max="100" onchange="inputChange()"
|
<input class="form-control" type="number" id="allocationRatio4" th:field="*{allocationRatio4}">
|
||||||
id="allocationRatio4" th:field="*{allocationRatio4}" required>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label" for="allocationRatio5">食費</label>
|
<label class="form-label" for="allocationRatio5">食費</label>
|
||||||
<input class="form-control" type="number" min="0" max="100" onchange="inputChange()"
|
<input class="form-control" type="number" id="allocationRatio5" th:field="*{allocationRatio5}">
|
||||||
id="allocationRatio5" th:field="*{allocationRatio5}" required>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label" for="allocationRatio6">交通費</label>
|
<label class="form-label" for="allocationRatio6">交通費</label>
|
||||||
<input class="form-control" type="number" min="0" max="100" onchange="inputChange()"
|
<input class="form-control" type="number" id="allocationRatio6" th:field="*{allocationRatio6}">
|
||||||
id="allocationRatio6" th:field="*{allocationRatio6}" required>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label" for="allocationRatio7">日用品費</label>
|
<label class="form-label" for="allocationRatio7">日用品費</label>
|
||||||
<input class="form-control" type="number" min="0" max="100" onchange="inputChange()"
|
<input class="form-control" type="number" id="allocationRatio7" th:field="*{allocationRatio7}">
|
||||||
id="allocationRatio7" th:field="*{allocationRatio7}" required>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label" for="allocationRatio8">被服/美容費</label>
|
<label class="form-label" for="allocationRatio8">被服/美容費</label>
|
||||||
<input class="form-control" type="number" min="0" max="100" onchange="inputChange()"
|
<input class="form-control" type="number" id="allocationRatio8" th:field="*{allocationRatio8}">
|
||||||
id="allocationRatio8" th:field="*{allocationRatio8}" required>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label" for="allocationRatio9">医療費</label>
|
<label class="form-label" for="allocationRatio9">医療費</label>
|
||||||
<input class="form-control" type="number" min="0" max="100" onchange="inputChange()"
|
<input class="form-control" type="number" id="allocationRatio9" th:field="*{allocationRatio9}">
|
||||||
id="allocationRatio9" th:field="*{allocationRatio9}" required>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label" for="allocationRatio10">趣味/娯楽費</label>
|
<label class="form-label" for="allocationRatio10">趣味/娯楽費</label>
|
||||||
<input class="form-control" type="number" min="0" max="100" onchange="inputChange()"
|
<input class="form-control" type="number" id="allocationRatio10"
|
||||||
id="allocationRatio10" th:field="*{allocationRatio10}" required>
|
th:field="*{allocationRatio10}">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label" for="allocationRatio11">その他</label>
|
<label class="form-label" for="allocationRatio11">その他</label>
|
||||||
<input class="form-control" type="number" min="0" max="100" onchange="inputChange()"
|
<input class="form-control" type="number" id="allocationRatio11"
|
||||||
id="allocationRatio11" th:field="*{allocationRatio11}" required>
|
th:field="*{allocationRatio11}">
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="mb-3">
|
|
||||||
<label class="form-label" for="allocationRatioTotal">合計(%)</label>
|
|
||||||
<input class="form-control" type="number" value="0" id="allocationRatioTotal" readonly>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
<div class="d-grid">
|
<div class="d-grid">
|
||||||
<button type="submit" class="btn btn-primary" id="submit" disabled="true">登録</button>
|
<button type="submit" class="btn btn-primary">登録</button>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
</form>
|
||||||
<span th:object="${courseForm}">
|
|
||||||
|
|
||||||
<input type="hidden" id="courseName" th:field="*{courseName}" required>
|
|
||||||
<br>
|
|
||||||
|
|
||||||
<input type="hidden" id="description" th:field="*{description}">
|
|
||||||
</span>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
<div th:replace="~{footer :: footer}"></div>
|
<div th:replace="~{footer :: footer}"></div>
|
||||||
|
|
||||||
<script>
|
|
||||||
|
|
||||||
function inputChange() {
|
|
||||||
let total = 0;
|
|
||||||
|
|
||||||
for (let i = 4; i <= 11; i++) {
|
|
||||||
total += Number(document.getElementById(`allocationRatio${i}`).value || 0);
|
|
||||||
if (total == 100) {
|
|
||||||
document.getElementById('submit').disabled = false;
|
|
||||||
} else {
|
|
||||||
document.getElementById('submit').disabled = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
document.getElementById("allocationRatioTotal").value = total;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
</script>
|
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,12 @@
|
|||||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
</head>
|
</head>
|
||||||
<body class="pb-5 pt-5">
|
<body class="pb-5 pt-5">
|
||||||
|
|
||||||
|
<div th:replace="~{header :: header}">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
<div th:replace="~{header :: header}">
|
<div th:replace="~{header :: header}">
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
<link rel="stylesheet" th:href="@{/css/style.css}">
|
<link rel="stylesheet" th:href="@{/css/style.css}">
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body style="padding-top:80px; padding-bottom:80px;">
|
<body class="pb-5 pt-5">
|
||||||
|
|
||||||
<div th:replace="~{header :: header}"></div>
|
<div th:replace="~{header :: header}"></div>
|
||||||
<div class="main-container">
|
<div class="main-container">
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
<h2 class="page-title" th:text="${today}"></h2>
|
<h2 class="page-title" th:text="${today}"></h2>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<ul class="list-unstyled p-0 m-0">
|
<ul>
|
||||||
<li th:each="fixedCostForm : ${fixedCostFormList}" class="card shadow-sm mb-3">
|
<li th:each="fixedCostForm : ${fixedCostFormList}" class="card shadow-sm mb-3">
|
||||||
|
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
@@ -52,29 +52,21 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
<hr>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="d-grid mt-4">
|
</ul>
|
||||||
|
|
||||||
<form th:action="@{/fixed-cost/create}" method="get">
|
|
||||||
|
|
||||||
<input type="hidden"
|
|
||||||
name="today"
|
|
||||||
id="today"
|
|
||||||
th:value="${today}">
|
|
||||||
|
|
||||||
<button class="btn btn-success w-100" type="submit">
|
|
||||||
新規登録
|
|
||||||
</button>
|
|
||||||
|
|
||||||
</form>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<form th:action="@{/fixed-cost/create}" method="get">
|
||||||
|
<input type="hidden" name="today" id="today" th:value="${today}">
|
||||||
|
<button type="submit">新規登録</button>
|
||||||
|
</form>
|
||||||
|
|
||||||
<div th:replace="~{footer :: footer}"></div>
|
<div th:replace="~{footer :: footer}"></div>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
|
|||||||
@@ -37,11 +37,11 @@
|
|||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label" for="transactionType">収入・支出</label>
|
<label class="form-label" for="transactionType">収入・支出</label>
|
||||||
|
|
||||||
<select class="form-select" id="transactionType" required>
|
<select class="form-select" id="transactionType">
|
||||||
|
|
||||||
<option value="">選択してください</option>
|
<option value="">選択してください</option>
|
||||||
<option value="0">支出</option>
|
<option value="1">支出</option>
|
||||||
<option value="1">収入</option>
|
<option value="2">収入</option>
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
@@ -51,7 +51,7 @@
|
|||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label" for="categoryId">カテゴリ</label>
|
<label class="form-label" for="categoryId">カテゴリ</label>
|
||||||
|
|
||||||
<select class="form-select" id="categoryId" th:field="*{categoryId}" required>
|
<select class="form-select" id="categoryId" th:field="*{categoryId}">
|
||||||
<option value="">選択してください</option>
|
<option value="">選択してください</option>
|
||||||
|
|
||||||
<option class="expenseListClass" th:each="category : ${expenseList}"
|
<option class="expenseListClass" th:each="category : ${expenseList}"
|
||||||
@@ -70,7 +70,7 @@
|
|||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label" for="amount">金額</label>
|
<label class="form-label" for="amount">金額</label>
|
||||||
|
|
||||||
<input class="form-control" type="number" id="amount" th:field="*{amount}" min="1" placeholder="金額を入力してください"
|
<input class="form-control" type="number" id="amount" th:field="*{amount}" min="0" placeholder="金額を入力してください"
|
||||||
required>
|
required>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -83,7 +83,6 @@
|
|||||||
|
|
||||||
<div th:replace="~{footer :: footer}"></div>
|
<div th:replace="~{footer :: footer}"></div>
|
||||||
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
const transactionType = document.getElementById("transactionType");
|
const transactionType = document.getElementById("transactionType");
|
||||||
const categoryId = document.getElementById("categoryId");
|
const categoryId = document.getElementById("categoryId");
|
||||||
@@ -91,10 +90,9 @@
|
|||||||
const expenseList = document.getElementsByClassName("expenseListClass");
|
const expenseList = document.getElementsByClassName("expenseListClass");
|
||||||
const incomeList = document.getElementsByClassName("incomeListClass");
|
const incomeList = document.getElementsByClassName("incomeListClass");
|
||||||
|
|
||||||
|
|
||||||
transactionType.addEventListener("change", function () {
|
transactionType.addEventListener("change", function () {
|
||||||
|
|
||||||
if (this.value === "0") {
|
if (this.value === "1") {
|
||||||
|
|
||||||
for (let i = 0; i < expenseList.length; i++) {
|
for (let i = 0; i < expenseList.length; i++) {
|
||||||
expenseList[i].style.display = "";
|
expenseList[i].style.display = "";
|
||||||
@@ -104,7 +102,7 @@
|
|||||||
incomeList[i].style.display = "none";
|
incomeList[i].style.display = "none";
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (this.value === "1") {
|
} else if (this.value === "2") {
|
||||||
|
|
||||||
for (let i = 0; i < expenseList.length; i++) {
|
for (let i = 0; i < expenseList.length; i++) {
|
||||||
expenseList[i].style.display = "none";
|
expenseList[i].style.display = "none";
|
||||||
|
|||||||
@@ -15,22 +15,22 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col border-end">
|
<div class="col border-end">
|
||||||
<button type="button" class="btn btn-link text-black text-decoration-none">
|
<button type="button" class="btn btn-link text-black text-decoration-none">
|
||||||
<a th:href="@{/transaction/create}" class="a-footer">入力</a>
|
<a th:href="@{/transaction/create}">入力</a>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="col border-end">
|
<div class="col border-end">
|
||||||
<button type="button" class="btn btn-link text-black text-decoration-none">
|
<button type="button" class="btn btn-link text-black text-decoration-none">
|
||||||
<a th:href="@{/transaction/list}" class="a-footer">一覧</a>
|
<a th:href="@{/transaction/list}">一覧</a>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="col border-end">
|
<div class="col border-end">
|
||||||
<button type="button" class="btn btn-link text-black text-decoration-none">
|
<button type="button" class="btn btn-link text-black text-decoration-none">
|
||||||
<a th:href="@{/analysis}" class="a-footer">分析</a>
|
<a th:href="@{/analysis}">分析</a>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="col border-end">
|
<div class="col border-end">
|
||||||
<button type="button" class="btn btn-link text-black text-decoration-none">
|
<button type="button" class="btn btn-link text-black text-decoration-none">
|
||||||
<a th:href="@{/goal}" class="a-footer">目標</a>
|
<a th:href="@{/goal}">目標</a>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,65 +1,46 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html xmlns:th="http://www.thymeleaf.org">
|
<html xmlns:th="http://www.thymeleaf.org">
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" name="viewport" content="width=device-width, initial-scale=1" http-equiv="Content-Type">
|
<meta charset="UTF-8">
|
||||||
<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}">
|
|
||||||
</head>
|
</head>
|
||||||
|
<body class="pb-5 pt-5">
|
||||||
<body style="padding-top:80px; padding-bottom:80px;">
|
|
||||||
|
|
||||||
<div th:replace="~{header :: header}"></div>
|
<div th:replace="~{header :: header}"></div>
|
||||||
|
|
||||||
<div class="main-container">
|
<h1>目標作成</h1>
|
||||||
|
|
||||||
<h1 class="page-title">目標作成</h1>
|
<form th:action="@{/goal/create}" th:object="${goalForm}" method="post">
|
||||||
|
<input type="hidden" th:field="*{goalId}">
|
||||||
|
|
||||||
<div class="card shadow-sm">
|
<div>
|
||||||
|
<label>目標名</label>
|
||||||
<div class="card-body">
|
<input type="text" th:field="*{goalTitle}" required>
|
||||||
|
|
||||||
<form th:action="@{/goal/create}" th:object="${goalForm}" method="post">
|
|
||||||
<input type="hidden" th:field="*{goalId}">
|
|
||||||
|
|
||||||
<div>
|
|
||||||
<label>目標名</label>
|
|
||||||
<input type="text" th:field="*{goalTitle}">
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div>
|
|
||||||
<label>目標説明</label>
|
|
||||||
<textarea th:field="*{goalSubtitle}"></textarea>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div>
|
|
||||||
<label>目標金額</label>
|
|
||||||
<input type="number" th:field="*{targetAmount}" required min="1">
|
|
||||||
<br>
|
|
||||||
<span th:text="|所持金:${session.currentAmount}円|"></span>
|
|
||||||
<input type="hidden" name="currentAmount" th:value="${currentAmount}">
|
|
||||||
<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>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
<div>
|
||||||
|
<label>目標説明</label>
|
||||||
|
<textarea th:field="*{goalSubtitle}" required></textarea>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<label>目標金額</label>
|
||||||
|
<input type="number" th:field="*{targetAmount}" required min="1">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<label>目標達成期限</label>
|
||||||
|
<input type="date" th:field="*{deadline}" th:min="${#temporals.format(#temporals.createNow(), 'yyyy-MM-dd')}" required>
|
||||||
|
</div>
|
||||||
|
<button type="submit">更新する</button>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
|
||||||
<div th:replace="~{footer :: footer}"></div>
|
<div th:replace="~{footer :: footer}"></div>
|
||||||
|
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
@@ -24,35 +24,30 @@
|
|||||||
|
|
||||||
<div>
|
<div>
|
||||||
<label>目標名</label>
|
<label>目標名</label>
|
||||||
<input type="text" th:field="*{goalTitle}">
|
<input type="text" th:field="*{goalTitle}" required>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<label>目標説明</label>
|
<label>目標説明</label>
|
||||||
<textarea th:field="*{goalSubtitle}"></textarea>
|
<textarea th:field="*{goalSubtitle}" required></textarea>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<label>目標金額</label>
|
<label>目標金額</label>
|
||||||
<input type="number" th:field="*{targetAmount}" min="1" max="1000000000" required>
|
<input type="number" th:field="*{targetAmount}" min="0" max="1000000000" required>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<label>目標達成期限</label>
|
<label>目標達成期限</label>
|
||||||
<input type="date" th:field="*{deadline}" th:min="${#temporals.format(#temporals.createNow(), 'yyyy-MM-dd')}" required>
|
<input type="date" th:field="*{deadline}" th:min="${#temporals.format(#temporals.createNow(), 'yyyy-MM-dd')}" required>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
|
||||||
<input type="hidden" th:field="*{goalComplete}">
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<button type="submit" class="btn btn-sm btn-primary w-100">更新する</button>
|
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<button type="submit" class="btn btn-sm btn-primary w-100">更新する</button>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body style="padding-top:80px; padding-bottom:80px;">
|
<body class="pb-5 pt-5">
|
||||||
|
|
||||||
<div th:replace="~{header :: header}"></div>
|
<div th:replace="~{header :: header}"></div>
|
||||||
|
|
||||||
@@ -47,12 +47,6 @@
|
|||||||
|
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
状態:
|
|
||||||
<span class="fw-bold" th:text="${goalForm.status}">
|
|
||||||
</span>
|
|
||||||
|
|
||||||
<br>
|
|
||||||
|
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
@@ -80,16 +74,16 @@
|
|||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
<div class="d-grid mt-4">
|
||||||
|
<form th:action="@{/goal}" method="get">
|
||||||
|
|
||||||
|
<button class="btn btn-success w-100" type="submit">
|
||||||
|
戻る
|
||||||
|
</button>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="d-grid mt-4">
|
|
||||||
<form th:action="@{/goal}" method="get">
|
|
||||||
<button class="btn btn-success w-100" type="submit">
|
|
||||||
戻る
|
|
||||||
</button>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div th:replace="~{footer :: footer}"></div>
|
<div th:replace="~{footer :: footer}"></div>
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" name="viewport" content="width=device-width, initial-scale=1" http-equiv="Content-Type">
|
<meta charset="UTF-8" name="viewport" content="width=device-width, initial-scale=1" http-equiv="Content-Type">
|
||||||
|
|
||||||
<title>目標詳細</title>
|
<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">
|
||||||
@@ -12,13 +11,14 @@
|
|||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body style="padding-top:80px; padding-bottom:80px;">
|
<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 th:if="${graphGoal != null}">
|
<div th:if="${graphGoal != null}">
|
||||||
|
|
||||||
<h2 th:text="${graphGoal.goalTitle}"></h2>
|
<h2 th:text="${graphGoal.goalTitle}"></h2>
|
||||||
@@ -30,52 +30,64 @@
|
|||||||
|
|
||||||
</div>
|
</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>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<script th:inline="javascript">
|
<script th:inline="javascript">
|
||||||
|
|
||||||
const months =
|
const months =
|
||||||
/*[[${achievementList.![month.monthValue]}]]*/[];
|
/*[[${achievementList.![month.monthValue]}]]*/[];
|
||||||
|
|
||||||
const achievementRates =
|
const achievementRates =
|
||||||
/*[[${achievementList.![achievementRate]}]]*/[];
|
/*[[${achievementList.![achievementRate]}]]*/[];
|
||||||
|
|
||||||
const labels =
|
const labels =
|
||||||
months.map(month => month + '月');
|
months.map(month => month + '月');
|
||||||
|
|
||||||
|
|
||||||
const myCt =
|
const myCt =
|
||||||
document.getElementById('myChart');
|
document.getElementById('myChart');
|
||||||
|
|
||||||
|
|
||||||
const myChart =
|
const myChart =
|
||||||
new Chart(myCt, {
|
new Chart(myCt, {
|
||||||
|
|
||||||
type: 'bar',
|
type: 'bar',
|
||||||
|
|
||||||
data: {
|
data: {
|
||||||
|
|
||||||
labels: labels,
|
labels: labels,
|
||||||
|
|
||||||
datasets: [
|
datasets: [
|
||||||
{
|
{
|
||||||
label: '達成率',
|
label: '達成率',
|
||||||
|
|
||||||
data: achievementRates,
|
data: achievementRates,
|
||||||
|
|
||||||
backgroundColor:
|
backgroundColor:
|
||||||
'rgba(54, 162, 235, 0.5)',
|
'rgba(54, 162, 235, 0.5)',
|
||||||
|
|
||||||
borderColor:
|
borderColor:
|
||||||
'rgba(54, 162, 235, 1)',
|
'rgba(54, 162, 235, 1)',
|
||||||
|
|
||||||
borderWidth: 1
|
borderWidth: 1
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
||||||
options: {
|
options: {
|
||||||
|
|
||||||
responsive: true,
|
responsive: true,
|
||||||
maintainAspectRatio: false,
|
|
||||||
scales: {
|
scales: {
|
||||||
|
|
||||||
y: {
|
y: {
|
||||||
beginAtZero: true,
|
beginAtZero: true,
|
||||||
max: 100,
|
max: 100,
|
||||||
|
|
||||||
ticks: {
|
ticks: {
|
||||||
callback: function (value) {
|
callback: function (value) {
|
||||||
return value + '%';
|
return value + '%';
|
||||||
@@ -85,88 +97,102 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
<!-- -->
|
||||||
|
|
||||||
<ul>
|
<div>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
|
||||||
|
<li th:each="goalForm : ${goalFormList}" class="transaction-item">
|
||||||
|
|
||||||
|
<div>
|
||||||
|
|
||||||
|
|
||||||
|
<form th:action="@{/goal}" method="get">
|
||||||
|
<table class="table">
|
||||||
|
|
||||||
<li th:each="goalForm : ${goalFormList}">
|
|
||||||
<div class="d-flex justify-content-between">
|
|
||||||
<form th:action="@{/goal}" method="get" class="w-100">
|
|
||||||
<div class="table-responsive">
|
|
||||||
<table class="table mb-0">
|
|
||||||
<input type="radio" name="goalId" th:value="${goalForm.goalId}"
|
<input type="radio" name="goalId" th:value="${goalForm.goalId}"
|
||||||
th:checked="${graphGoal != null and graphGoal.goalId == goalForm.goalId}"
|
th:checked="${graphGoal != null and graphGoal.goalId == goalForm.goalId}"
|
||||||
onchange="this.form.submit()">
|
onchange="this.form.submit()">
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<th>目標名</th>
|
<th>目標名</th>
|
||||||
<td th:text="${goalForm.goalTitle}"
|
<td th:text="${goalForm.goalTitle}"></td>
|
||||||
class="goal"></td>
|
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<th>目標説明</th >
|
<th>目標説明</th>
|
||||||
<td th:text="${goalForm.goalSubtitle}"
|
<td th:text="${goalForm.goalSubtitle}"></td>
|
||||||
class="goal"></td>
|
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>目標金額</th>
|
<th>目標金額</th>
|
||||||
<td th:text="${goalForm.targetAmount}"
|
<td th:text="${goalForm.targetAmount}"></td>
|
||||||
class="goal"></td>
|
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>目標達成期限</th>
|
<th>目標達成期限</th>
|
||||||
<td th:text="${goalForm.deadline}"
|
<td th:text="${goalForm.deadline}"></td>
|
||||||
class="goal"></td>
|
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<th>達成率</th>
|
<th>達成率</th>
|
||||||
<td th:text="${goalForm.achievementRate} + '%'"
|
<td th:text="${goalForm.achievementRate} + '%'"></td>
|
||||||
class="goal"></td>
|
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</form>
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="d-flex justify-content-end gap-2 mt-3">
|
</div>
|
||||||
<form th:action="@{/goal/edit}" method="get">
|
|
||||||
<input type="hidden" name="goalId" th:value="${goalForm.goalId}">
|
|
||||||
<button type="submit" class="btn btn-sm btn-primary">
|
|
||||||
編集
|
|
||||||
</button>
|
|
||||||
</form>
|
|
||||||
|
|
||||||
<form th:action="@{/goal/delete}" method="post">
|
|
||||||
<input type="hidden" name="goalId" th:value="${goalForm.goalId}">
|
|
||||||
<button type="submit" class="btn btn-sm btn-danger">
|
|
||||||
削除
|
|
||||||
</button>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
</ul>
|
<div class="transaction-buttons">
|
||||||
|
|
||||||
</div>
|
<form th:action="@{/goal/edit}" method="get">
|
||||||
<div class="d-grid gap-2 mt-4">
|
|
||||||
<form th:action="@{/goal/create}" method="get">
|
|
||||||
|
|
||||||
<button type="submit" class="btn btn-success w-100">
|
<input type="hidden" name="goalId" th:value="${goalForm.goalId}">
|
||||||
新規登録
|
|
||||||
</button>
|
|
||||||
|
|
||||||
</form>
|
<button type="submit" class="btn btn-sm btn-primary w-100">
|
||||||
|
編集
|
||||||
|
</button>
|
||||||
|
|
||||||
<form th:action="@{/goal/record}" method="get">
|
</form>
|
||||||
<button type="submit" class="btn btn-sm btn-primary w-100">
|
|
||||||
履歴
|
|
||||||
</button>
|
|
||||||
|
|
||||||
</form>
|
|
||||||
|
<form th:action="@{/goal/delete}" method="post">
|
||||||
</div>
|
|
||||||
<div th:replace="~{footer :: footer}"></div>
|
<input type="hidden" name="goalId" th:value="${goalForm.goalId}">
|
||||||
|
|
||||||
|
<button type="submit" class="btn btn-sm btn-primary w-100">
|
||||||
|
削除
|
||||||
|
</button>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<form th:action="@{/goal/create}" method="get">
|
||||||
|
|
||||||
|
<button type="submit" class="btn btn-sm btn-primary w-100">
|
||||||
|
新規登録
|
||||||
|
</button>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
<form th:action="@{/goal/record}" method="get">
|
||||||
|
|
||||||
|
<button type="submit" class="btn btn-sm btn-primary w-100">
|
||||||
|
履歴
|
||||||
|
</button>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
|
||||||
|
|
||||||
|
<div th:replace="~{footer :: footer}"></div>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
|
|||||||
@@ -1,34 +1,30 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html xmlns:th="http://www.thymeleaf.org">
|
<html xmlns:th="http://www.thymeleaf.org">
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" name="viewport" content="width=device-width, initial-scale=1">
|
<meta charset="UTF-8" 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>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<header th:fragment="header" class="fixed-top">
|
<header th:fragment="header" class="fixed-top">
|
||||||
|
|
||||||
<nav class="navbar app-header" style="background-color: #e3f2fd;" data-bs-theme="light">
|
<nav class="navbar app-header" style="background-color: #e3f2fd;" data-bs-theme="light">
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
<a th:href="@{/menu}" class="navbar-brand fw-bold">Monegement</a>
|
<a th:href="@{/menu}" class="navbar-brand fw-bold">Monegement</a>
|
||||||
<div class="d-flex gap-2" th:if="${session.loginUser != null}">
|
<div class="d-flex gap-2">
|
||||||
<a class="btn btn-outline-primary btn-sm" th:href="@{/course}">
|
<a class="btn btn-outline-primary btn-sm" th:href="@{/course}">
|
||||||
コース
|
コース
|
||||||
</a>
|
</a>
|
||||||
<a class="btn btn-outline-secondary btn-sm" th:href="@{/profile}">
|
<a class="btn btn-outline-secondary btn-sm" th:href="@{/profile}">
|
||||||
プロフィール
|
プロフィール
|
||||||
</a>
|
</a>
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
</header>
|
</header>
|
||||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.7/dist/js/bootstrap.bundle.min.js"></script>
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.7/dist/js/bootstrap.bundle.min.js"></script>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
@@ -6,11 +6,12 @@
|
|||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
|
||||||
<title>カレンダー</title>
|
<title>Calendar</title>
|
||||||
|
|
||||||
|
<link rel="stylesheet" th:href="@{/css/style.css}">
|
||||||
|
|
||||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
|
|
||||||
<link rel="stylesheet" th:href="@{/css/style.css}">
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
@@ -55,35 +56,51 @@
|
|||||||
|
|
||||||
|
|
||||||
<tbody>
|
<tbody>
|
||||||
|
|
||||||
<tr th:each="week : ${#numbers.sequence(0, 5)}">
|
<tr th:each="week : ${#numbers.sequence(0, 5)}">
|
||||||
|
|
||||||
<td th:each="weekDay : ${#numbers.sequence(0, 6)}">
|
<td th:each="weekDay : ${#numbers.sequence(0, 6)}">
|
||||||
|
|
||||||
<a th:if="${week * 7 + weekDay - firstDayOfWeek + 1 >= 1
|
<a th:if="${week * 7 + weekDay - firstDayOfWeek + 1 >= 1
|
||||||
and week * 7 + weekDay - firstDayOfWeek + 1 <= lastDay}" th:href="@{/transaction/detail(
|
and week * 7 + weekDay - firstDayOfWeek + 1 <= lastDay}" th:href="@{/transaction/detail(
|
||||||
todayDates=${T(java.time.LocalDate).of(year, month, week * 7 + weekDay - firstDayOfWeek + 1)}
|
todayDates=${T(java.time.LocalDate).of(year, month, week * 7 + weekDay - firstDayOfWeek + 1)}
|
||||||
)}" class="a-footer">
|
)}">
|
||||||
|
|
||||||
|
|
||||||
<div
|
<div
|
||||||
th:if="${week * 7 + weekDay - firstDayOfWeek + 1 >= 1 and week * 7 + weekDay - firstDayOfWeek + 1 <= lastDay}">
|
th:if="${week * 7 + weekDay - firstDayOfWeek + 1 >= 1 and week * 7 + weekDay - firstDayOfWeek + 1 <= lastDay}">
|
||||||
|
|
||||||
<div class="date" th:text="${week * 7 + weekDay - firstDayOfWeek + 1}">
|
<div class="date" th:text="${week * 7 + weekDay - firstDayOfWeek + 1}">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div th:each="income : ${incomeList}"
|
<div th:each="income : ${incomeList}"
|
||||||
th:if="${income.date.dayOfMonth == week * 7 + weekDay - firstDayOfWeek + 1}"
|
th:if="${income.date.dayOfMonth == week * 7 + weekDay - firstDayOfWeek + 1}"
|
||||||
class="income" th:text="|収入 +${income.amount}円|">
|
class="income" th:text="|収入 +${income.amount}円|">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div th:each="expense : ${expenseList}"
|
<div th:each="expense : ${expenseList}"
|
||||||
th:if="${expense.date.dayOfMonth == week * 7 + weekDay - firstDayOfWeek + 1}"
|
th:if="${expense.date.dayOfMonth == week * 7 + weekDay - firstDayOfWeek + 1}"
|
||||||
class="expense" th:text="|支出 -${expense.amount}円|">
|
class="expense" th:text="|支出 -${expense.amount}円|">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
|
||||||
<div class="card shadow-sm mb-3">
|
<div class="card shadow-sm mb-3">
|
||||||
|
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
|
|
||||||
<div class="d-flex justify-content-between mb-2">
|
<div class="d-flex justify-content-between mb-2">
|
||||||
<span>収入</span>
|
<span>収入</span>
|
||||||
<span th:text="'¥' + ${totalIncome}"></span>
|
<span th:text="'¥' + ${totalIncome}"></span>
|
||||||
@@ -108,19 +125,27 @@
|
|||||||
<span>目標資金</span>
|
<span>目標資金</span>
|
||||||
<span th:text="'¥' + ${targetAmount}"></span>
|
<span th:text="'¥' + ${targetAmount}"></span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="d-flex justify-content-between mb-2">
|
<div class="d-flex justify-content-between mb-2">
|
||||||
<span>現在高</span>
|
<span>現在高</span>
|
||||||
<span th:text="'¥' + ${currentAmount}"></span>
|
<span th:text="'¥' + ${currentAmount}"></span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="d-flex justify-content-between">
|
<div class="d-flex justify-content-between">
|
||||||
<span>貯金額</span>
|
<span>貯金額</span>
|
||||||
<span th:text="'¥' + ${saving}"></span>
|
<span th:text="'¥' + ${saving}"></span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="card shadow-sm">
|
<div class="card shadow-sm">
|
||||||
|
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
|
|
||||||
<div class="d-flex justify-content-between mb-2">
|
<div class="d-flex justify-content-between mb-2">
|
||||||
<span>達成率</span>
|
<span>達成率</span>
|
||||||
<span th:text="${achievementRate} + '%'"
|
<span th:text="${achievementRate} + '%'"
|
||||||
|
|||||||
@@ -38,7 +38,7 @@
|
|||||||
class="form-control"
|
class="form-control"
|
||||||
th:field="*{password}"
|
th:field="*{password}"
|
||||||
minlength="8"
|
minlength="8"
|
||||||
maxlength="24"
|
maxlength="255"
|
||||||
required>
|
required>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@@ -55,14 +55,10 @@
|
|||||||
class="form-control"
|
class="form-control"
|
||||||
th:field="*{passwordConfirm}"
|
th:field="*{passwordConfirm}"
|
||||||
minlength="8"
|
minlength="8"
|
||||||
maxlength="24"
|
maxlength="255"
|
||||||
required>
|
required>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<span th:if="${message != null}">
|
|
||||||
<h4 th:text="${message}" style="color: red;"></h4>
|
|
||||||
</span>
|
|
||||||
|
|
||||||
<div class="d-grid">
|
<div class="d-grid">
|
||||||
|
|
||||||
|
|||||||
@@ -52,15 +52,13 @@
|
|||||||
|
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label">
|
<label class="form-label">
|
||||||
生年月日
|
パスワード
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<input type="date"
|
<input type="password"
|
||||||
class="form-control"
|
class="form-control"
|
||||||
id="birthDate"
|
value="********"
|
||||||
name="birthDate"
|
disabled>
|
||||||
th:value="*{birthDate}"
|
|
||||||
required>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
@@ -101,15 +99,15 @@
|
|||||||
max="10000000"
|
max="10000000"
|
||||||
required>
|
required>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="d-grid">
|
|
||||||
<button type="submit"
|
|
||||||
class="btn btn-primary">
|
|
||||||
編集
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="d-grid">
|
||||||
|
<button type="submit"
|
||||||
|
class="btn btn-primary">
|
||||||
|
確認
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
|||||||
@@ -5,104 +5,48 @@
|
|||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
<link rel="stylesheet" th:href="@{/css/style.css}">
|
|
||||||
<title>コース選択</title>
|
<title>コース選択</title>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body style="padding-bottom: 120px; padding-top: 80px;">
|
<body>
|
||||||
<div th:replace="~{header :: header}"></div>
|
<div th:replace="~{header :: header}"></div>
|
||||||
|
|
||||||
<h1 class="page-title">コース選択</h1>
|
<h1 class="page-title">コース選択</h1>
|
||||||
|
|
||||||
<div class="d-grid gap-2 mt-4">
|
|
||||||
<th:block th:if="${mode == 'change'}">
|
<form th:action="${mode == 'regist'} ? @{/user/register/return}: @{/change}" method="post">
|
||||||
<form th:action="@{/course/create}" method="get">
|
|
||||||
<button class="btn btn-success w-100" type="submit">
|
|
||||||
新規登録
|
|
||||||
</button>
|
|
||||||
</form>
|
|
||||||
</th:block>
|
|
||||||
|
|
||||||
</th:block>
|
|
||||||
<form th:action="${mode == 'regist'} ? @{/user/register/return}: @{/change}" id="totalForm" method="post">
|
|
||||||
<button type="submit" class="btn btn-primary w-100">確定</button>
|
<button type="submit" class="btn btn-primary w-100">確定</button>
|
||||||
|
|
||||||
<div class="accordion" id="accordionExample">
|
<div class="accordion" id="accordionExample">
|
||||||
<div class="accordion-item" th:each="course:${courseList}">
|
<div class="accordion-item" th:each="course:${courseList}">
|
||||||
<h2 class="accordion-header d-flex align-items-center">
|
<h2 class="accordion-header d-flex align-items-center">
|
||||||
<input type="radio" name="courseId" th:value="${course.courseId}"
|
<input type="radio" name="courseId" th:value="${course.courseId}" th:checked="${course.courseId==currentCourseId}" class="form-check-input ms-3 me-2">
|
||||||
th:checked="${course.courseId==currentCourseId}" class="form-check-input ms-3 me-2">
|
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" th:data-bs-target="'#collapse' + ${course.courseId}" aria-expanded="false" aria-controls="'collapse' + ${course.courseId}">
|
||||||
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse"
|
<span th:text="${course.courseName}"></span>
|
||||||
th:data-bs-target="'#collapse' + ${course.courseId}" aria-expanded="false"
|
</button>
|
||||||
aria-controls="'collapse' + ${course.courseId}">
|
</h2>
|
||||||
<span th:text="${course.courseName}"></span>
|
<div th:id="'collapse' + ${course.courseId}" class="accordion-collapse collapse" data-bs-parent="#accordionExample">
|
||||||
</button>
|
<div class="accordion-body">
|
||||||
|
<span th:text="${course.description}"></span>
|
||||||
<p th:if="${course.courseId > 6}" style="width: 120px;"><button type="button" class="btn btn-danger w-100"
|
<table class="table table-bordered">
|
||||||
th:attr="data-course-id=${course.courseId}" onclick="deleteCourse(this)">削除</button></p>
|
<tr>
|
||||||
</h2>
|
<th>カテゴリ名</th><th>配分(%)</th>
|
||||||
<div th:id="'collapse' + ${course.courseId}" class="accordion-collapse collapse"
|
</tr>
|
||||||
data-bs-parent="#accordionExample" style="padding-bottom: 120px;">
|
<tr th:each="courseInfo:${courseInfoList}" th:if="${course.courseId == courseInfo.courseId}">
|
||||||
<div class="accordion-body">
|
<td th:text="${courseInfo.categoryName}"></td>
|
||||||
<span th:text="${course.description}"></span>
|
<td th:text="${courseInfo.allocationRatio}"></td>
|
||||||
<table class="table table-bordered">
|
</tr>
|
||||||
<tr>
|
</table>
|
||||||
<th>カテゴリ名</th>
|
</div>
|
||||||
<th>配分(%)</th>
|
</div>
|
||||||
</tr>
|
</div>
|
||||||
<tr th:each="courseInfo:${courseInfoList}"
|
|
||||||
th:if="${course.courseId == courseInfo.courseId}">
|
|
||||||
<td th:text="${courseInfo.categoryName}"></td>
|
|
||||||
<td th:text="${courseInfo.allocationRatio}"></td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
|
||||||
|
|
||||||
<th:block th:if="${mode=='change'}">
|
<th:block th:if="${mode=='change'}">
|
||||||
<div th:replace="~{footer :: footer}"></div>
|
<div th:replace="~{footer :: footer}"></div>
|
||||||
</th:block>
|
</th:block>
|
||||||
|
|
||||||
<script th:inline="javascript">
|
|
||||||
|
|
||||||
const message = /*[[${message}]]*/ null;
|
|
||||||
|
|
||||||
if (message != null) {
|
|
||||||
alert(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
function deleteCourse(button) {
|
|
||||||
|
|
||||||
const courseId = button.dataset.courseId;
|
|
||||||
|
|
||||||
const totalForm = document.getElementById("totalForm");
|
|
||||||
|
|
||||||
const input = document.createElement("input");
|
|
||||||
|
|
||||||
const radioButtons = totalForm.querySelectorAll('input[name="courseId"]');
|
|
||||||
radioButtons.forEach(radio => {
|
|
||||||
radio.disabled = true;
|
|
||||||
});
|
|
||||||
|
|
||||||
input.type = "hidden";
|
|
||||||
input.name = "courseId";
|
|
||||||
input.value = courseId;
|
|
||||||
|
|
||||||
totalForm.appendChild(input);
|
|
||||||
|
|
||||||
totalForm.action = "/course/delete";
|
|
||||||
totalForm.method = "post";
|
|
||||||
courseId.value = courseId;
|
|
||||||
|
|
||||||
totalForm.submit();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.7/dist/js/bootstrap.bundle.min.js"></script>
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.7/dist/js/bootstrap.bundle.min.js"></script>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
|
|||||||
@@ -3,9 +3,10 @@
|
|||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" name="viewport" content="width=device-width, initial-scale=1" http-equiv="Content-Type">
|
<meta charset="UTF-8" name="viewport" content="width=device-width, initial-scale=1" http-equiv="Content-Type">
|
||||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
|
|
||||||
<link rel="stylesheet" th:href="@{/css/style.css}">
|
|
||||||
<title>取引登録</title>
|
<title>取引登録</title>
|
||||||
|
<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>
|
</head>
|
||||||
|
|
||||||
<body style="padding-top:80px; padding-bottom:80px;">
|
<body style="padding-top:80px; padding-bottom:80px;">
|
||||||
@@ -14,170 +15,127 @@
|
|||||||
|
|
||||||
<div class="main-container">
|
<div class="main-container">
|
||||||
|
|
||||||
<h1 class="page-title">
|
<h1 class="page-title">
|
||||||
取引登録
|
取引登録
|
||||||
</h1>
|
</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 for="transactionDate"
|
||||||
日付
|
class="form-label">
|
||||||
</label>
|
日付
|
||||||
<input type="date" id="transactionDate" class="form-select" name="transactionDate"
|
</label>
|
||||||
th:value="*{transactionDate}" required>
|
<input type="date"
|
||||||
|
id="transactionDate"
|
||||||
|
class="form-select"
|
||||||
|
name="transactionDate"
|
||||||
|
th:value="*{transactionDate}"
|
||||||
|
required>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
|
|
||||||
<label for="transactionType" class="form-label">
|
<label for="transactionType"
|
||||||
収入・支出
|
class="form-label">
|
||||||
</label>
|
収入・支出
|
||||||
|
</label>
|
||||||
|
|
||||||
<select id="transactionType" class="form-select" name="transactionType" required>
|
<select id="transactionType"
|
||||||
|
class="form-select"
|
||||||
|
th:field="*{transactionType}"
|
||||||
|
required>
|
||||||
|
|
||||||
<option value="">
|
<option value="">
|
||||||
選択してください
|
選択してください
|
||||||
</option>
|
</option>
|
||||||
|
|
||||||
<option value="0">
|
<option value="1">
|
||||||
支出
|
支出
|
||||||
</option>
|
</option>
|
||||||
|
|
||||||
<option value="1">
|
<option value="2">
|
||||||
収入
|
収入
|
||||||
</option>
|
</option>
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
|
|
||||||
<label for="categoryId" class="form-label">
|
<label for="categoryId"
|
||||||
カテゴリ
|
class="form-label">
|
||||||
</label>
|
カテゴリ
|
||||||
|
</label>
|
||||||
|
|
||||||
<select id="categoryId" class="form-select" th:field="*{categoryId}" required>
|
<select id="categoryId"
|
||||||
|
class="form-select"
|
||||||
|
th:field="*{categoryId}"
|
||||||
|
required>
|
||||||
|
|
||||||
<option value="">
|
<option value="">
|
||||||
選択してください
|
選択してください
|
||||||
</option>
|
</option>
|
||||||
|
|
||||||
<option class="expenseListClass" th:each="category : ${expenseList}"
|
<option th:each="category : ${categoryFormList}"
|
||||||
th:value="${category.categoryId}" th:text="${category.categoryName}">
|
th:value="${category.categoryId}"
|
||||||
</option>
|
th:text="${category.categoryName}">
|
||||||
|
</option>
|
||||||
|
|
||||||
<option class="incomeListClass" th:each="category : ${incomeList}"
|
</select>
|
||||||
th:value="${category.categoryId}" th:text="${category.categoryName}">
|
|
||||||
</option>
|
|
||||||
|
|
||||||
</select>
|
</div>
|
||||||
|
|
||||||
</div>
|
<div class="mb-3">
|
||||||
|
|
||||||
<div class="mb-3">
|
<label for="amount"
|
||||||
|
class="form-label">
|
||||||
|
金額
|
||||||
|
</label>
|
||||||
|
|
||||||
<label for="amount" class="form-label">
|
<input type="number"
|
||||||
金額
|
id="amount"
|
||||||
</label>
|
class="form-control"
|
||||||
|
th:field="*{amount}"
|
||||||
|
min="0"
|
||||||
|
max="100000000"
|
||||||
|
placeholder="金額を入力してください"
|
||||||
|
required>
|
||||||
|
|
||||||
<input type="number" id="amount" class="form-control" th:field="*{amount}" min="1"
|
</div>
|
||||||
max="100000000" placeholder="金額を入力してください" required>
|
|
||||||
|
|
||||||
</div>
|
<input type="hidden"
|
||||||
|
name="today"
|
||||||
|
th:value="${today}">
|
||||||
|
|
||||||
<input type="hidden" name="today" th:value="${today}">
|
<div class="d-grid">
|
||||||
|
|
||||||
<div class="d-grid">
|
<button type="submit"
|
||||||
|
class="btn btn-primary">
|
||||||
|
|
||||||
<button type="submit" class="btn btn-primary">
|
登録
|
||||||
|
|
||||||
登録
|
</button>
|
||||||
|
|
||||||
</button>
|
</div>
|
||||||
|
|
||||||
</div>
|
</form>
|
||||||
|
|
||||||
</form>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div th:replace="~{footer :: footer}"></div>
|
<div th:replace="~{footer :: footer}"></div>
|
||||||
|
|
||||||
<script th:inline="javascript">
|
|
||||||
const transactionType = document.getElementById("transactionType");
|
|
||||||
const categoryId = document.getElementById("categoryId");
|
|
||||||
|
|
||||||
const expenseList = document.getElementsByClassName("expenseListClass");
|
|
||||||
const incomeList = document.getElementsByClassName("incomeListClass");
|
|
||||||
|
|
||||||
const tType = '[[${session.tType}]]';
|
|
||||||
|
|
||||||
console.log("tType: " + tType);
|
|
||||||
|
|
||||||
if (tType.includes("0")) {
|
|
||||||
console.log("okokokokokokokkkokokokoko");
|
|
||||||
transactionType.value = "0";
|
|
||||||
} else if (tType.includes("1")) {
|
|
||||||
transactionType.value = "1";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function toggleCategory() {
|
|
||||||
|
|
||||||
if (transactionType.value === "0") {
|
|
||||||
|
|
||||||
for (let i = 0; i < expenseList.length; i++) {
|
|
||||||
expenseList[i].style.display = "";
|
|
||||||
}
|
|
||||||
|
|
||||||
for (let i = 0; i < incomeList.length; i++) {
|
|
||||||
incomeList[i].style.display = "none";
|
|
||||||
}
|
|
||||||
|
|
||||||
} else if (transactionType.value === "1") {
|
|
||||||
|
|
||||||
for (let i = 0; i < expenseList.length; i++) {
|
|
||||||
expenseList[i].style.display = "none";
|
|
||||||
}
|
|
||||||
|
|
||||||
for (let i = 0; i < incomeList.length; i++) {
|
|
||||||
incomeList[i].style.display = "";
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
for (let i = 0; i < expenseList.length; i++) {
|
|
||||||
expenseList[i].style.display = "none";
|
|
||||||
}
|
|
||||||
|
|
||||||
for (let i = 0; i < incomeList.length; i++) {
|
|
||||||
incomeList[i].style.display = "none";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
transactionType.addEventListener("change", function () {
|
|
||||||
|
|
||||||
toggleCategory();
|
|
||||||
|
|
||||||
categoryId.value = "";
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
toggleCategory();
|
|
||||||
|
|
||||||
</script>
|
|
||||||
|
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
<link rel="stylesheet" th:href="@{/css/style.css}">
|
<link rel="stylesheet" th:href="@{/css/style.css}">
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body style="padding-top:80px; padding-bottom:80px;">
|
<body>
|
||||||
|
|
||||||
<div th:replace="~{header :: header}"></div>
|
<div th:replace="~{header :: header}"></div>
|
||||||
<div class="main-container">
|
<div class="main-container">
|
||||||
@@ -90,7 +90,6 @@
|
|||||||
|
|
||||||
<input type="hidden"
|
<input type="hidden"
|
||||||
name="today"
|
name="today"
|
||||||
id="today"
|
|
||||||
th:value="${today}">
|
th:value="${today}">
|
||||||
|
|
||||||
<button class="btn btn-success w-100"
|
<button class="btn btn-success w-100"
|
||||||
@@ -103,50 +102,22 @@
|
|||||||
</form>
|
</form>
|
||||||
|
|
||||||
</div>
|
</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>
|
</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>
|
<div th:replace="~{footer :: footer}"></div>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
|
|||||||
@@ -83,36 +83,21 @@
|
|||||||
カテゴリ
|
カテゴリ
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<!-- <select id="categoryId"-->
|
<select id="categoryId"
|
||||||
<!-- class="form-select"-->
|
class="form-select"
|
||||||
<!-- th:field="*{categoryId}"-->
|
th:field="*{categoryId}"
|
||||||
<!-- required>-->
|
required>
|
||||||
|
|
||||||
<!-- <option value="">-->
|
<option value="">
|
||||||
<!-- 選択してください-->
|
選択してください
|
||||||
<!-- </option>-->
|
</option>
|
||||||
|
|
||||||
<!-- <option th:each="category : ${categoryFormList}"-->
|
<option th:each="category : ${categoryFormList}"
|
||||||
<!-- th:value="${category.categoryId}"-->
|
th:value="${category.categoryId}"
|
||||||
<!-- th:text="${category.categoryName}">-->
|
th:text="${category.categoryName}">
|
||||||
<!-- </option>-->
|
</option>
|
||||||
|
|
||||||
<!-- </select>-->
|
</select>
|
||||||
<select id="categoryId" class="form-select" th:field="*{categoryId}" required>
|
|
||||||
|
|
||||||
<option value="">
|
|
||||||
選択してください
|
|
||||||
</option>
|
|
||||||
|
|
||||||
<option class="expenseListClass" th:each="category : ${expenseList}"
|
|
||||||
th:value="${category.categoryId}" th:text="${category.categoryName}">
|
|
||||||
</option>
|
|
||||||
|
|
||||||
<option class="incomeListClass" th:each="category : ${incomeList}"
|
|
||||||
th:value="${category.categoryId}" th:text="${category.categoryName}">
|
|
||||||
</option>
|
|
||||||
|
|
||||||
</select>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -156,68 +141,6 @@
|
|||||||
<div th:replace="~{footer :: footer}">
|
<div th:replace="~{footer :: footer}">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script th:inline="javascript">
|
|
||||||
const transactionType = document.getElementById("transactionType");
|
|
||||||
const categoryId = document.getElementById("categoryId");
|
|
||||||
|
|
||||||
const expenseList = document.getElementsByClassName("expenseListClass");
|
|
||||||
const incomeList = document.getElementsByClassName("incomeListClass");
|
|
||||||
|
|
||||||
const tType = '[[${session.tType}]]';
|
|
||||||
|
|
||||||
function toggleCategory() {
|
|
||||||
|
|
||||||
if (transactionType.value === "0") {
|
|
||||||
|
|
||||||
for (let i = 0; i < expenseList.length; i++) {
|
|
||||||
expenseList[i].style.display = "";
|
|
||||||
}
|
|
||||||
|
|
||||||
for (let i = 0; i < incomeList.length; i++) {
|
|
||||||
incomeList[i].style.display = "none";
|
|
||||||
}
|
|
||||||
|
|
||||||
} else if (transactionType.value === "1") {
|
|
||||||
|
|
||||||
for (let i = 0; i < expenseList.length; i++) {
|
|
||||||
expenseList[i].style.display = "none";
|
|
||||||
}
|
|
||||||
|
|
||||||
for (let i = 0; i < incomeList.length; i++) {
|
|
||||||
incomeList[i].style.display = "";
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
for (let i = 0; i < expenseList.length; i++) {
|
|
||||||
expenseList[i].style.display = "none";
|
|
||||||
}
|
|
||||||
|
|
||||||
for (let i = 0; i < incomeList.length; i++) {
|
|
||||||
incomeList[i].style.display = "none";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
transactionType.addEventListener("change", function () {
|
|
||||||
|
|
||||||
toggleCategory();
|
|
||||||
|
|
||||||
categoryId.value = "";
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
if (tType == "0") {
|
|
||||||
transactionType.value = "0";
|
|
||||||
} else if (tType == "1") {
|
|
||||||
transactionType.value = "1";
|
|
||||||
}
|
|
||||||
|
|
||||||
toggleCategory();
|
|
||||||
|
|
||||||
</script>
|
|
||||||
|
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
@@ -2,192 +2,229 @@
|
|||||||
<html lang="ja" xmlns:th="http://www.thymeleaf.org">
|
<html lang="ja" xmlns:th="http://www.thymeleaf.org">
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport"
|
||||||
|
content="width=device-width, initial-scale=1">
|
||||||
|
|
||||||
<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>
|
</head>
|
||||||
|
|
||||||
<body style="padding-top:80px; padding-bottom:80px;">
|
<body style="padding-top:80px; padding-bottom:80px;">
|
||||||
|
|
||||||
<div th:replace="~{header :: header}">
|
<div th:replace="~{header :: header}">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="main-container">
|
<div class="main-container">
|
||||||
|
|
||||||
<h1 class="page-title">
|
<h1 class="page-title">
|
||||||
新規会員登録
|
新規会員登録
|
||||||
</h1>
|
</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">
|
<div class="mb-3">
|
||||||
<label for="userName" class="form-label">
|
<label for="userName"
|
||||||
氏名
|
class="form-label">
|
||||||
</label>
|
氏名
|
||||||
|
</label>
|
||||||
|
|
||||||
<input type="text" id="userName" class="form-control" th:field="*{userName}" maxlength="100"
|
<input type="text"
|
||||||
required>
|
id="userName"
|
||||||
</div>
|
class="form-control"
|
||||||
|
th:field="*{userName}"
|
||||||
|
maxlength="100"
|
||||||
|
required>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label for="mailAddress" class="form-label">
|
<label for="mailAddress"
|
||||||
メールアドレス
|
class="form-label">
|
||||||
</label>
|
メールアドレス
|
||||||
|
</label>
|
||||||
|
|
||||||
<input type="email" id="mailAddress" class="form-control" th:field="*{mailAddress}"
|
<input type="email"
|
||||||
maxlength="255" required>
|
id="mailAddress"
|
||||||
</div>
|
class="form-control"
|
||||||
|
th:field="*{mailAddress}"
|
||||||
|
maxlength="255"
|
||||||
|
required>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label for="birthDate" class="form-label">
|
<label for="birthDate"
|
||||||
生年月日
|
class="form-label">
|
||||||
</label>
|
生年月日
|
||||||
|
</label>
|
||||||
|
|
||||||
<input type="date" id="birthDate" class="form-control" th:field="*{birthDate}" required>
|
<input type="date"
|
||||||
</div>
|
id="birthDate"
|
||||||
|
class="form-control"
|
||||||
|
th:field="*{birthDate}"
|
||||||
|
required>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label for="password" class="form-label">
|
<label for="password"
|
||||||
パスワード
|
class="form-label">
|
||||||
</label>
|
パスワード
|
||||||
|
</label>
|
||||||
|
|
||||||
<input type="password" id="password" class="form-control" th:field="*{password}" minlength="8"
|
<input type="password"
|
||||||
maxlength="24" required>
|
id="password"
|
||||||
</div>
|
class="form-control"
|
||||||
|
th:field="*{password}"
|
||||||
|
minlength="8"
|
||||||
|
maxlength="255"
|
||||||
|
required>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label for="secretQuestionId" class="form-label">
|
<label for="secretQuestionId"
|
||||||
秘密の質問
|
class="form-label">
|
||||||
</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 value="">
|
||||||
選択してください
|
選択してください
|
||||||
</option>
|
</option>
|
||||||
|
|
||||||
<option th:each="question : ${session.questionList}" th:value="${question.secretQuestionId}"
|
<option th:each="question : ${session.questionList}"
|
||||||
th:text="${question.questionText}">
|
th:value="${question.secretQuestionId}"
|
||||||
</option>
|
th:text="${question.questionText}">
|
||||||
|
</option>
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label for="secretAnswer" class="form-label">
|
<label for="secretAnswer"
|
||||||
秘密の質問の回答
|
class="form-label">
|
||||||
</label>
|
秘密の質問の回答
|
||||||
|
</label>
|
||||||
|
|
||||||
<input type="text" id="secretAnswer" class="form-control" th:field="*{secretAnswer}"
|
<input type="text"
|
||||||
maxlength="100" required>
|
id="secretAnswer"
|
||||||
</div>
|
class="form-control"
|
||||||
|
th:field="*{secretAnswer}"
|
||||||
|
maxlength="100"
|
||||||
|
required>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label for="saving" class="form-label">
|
<label for="saving"
|
||||||
貯蓄金
|
class="form-label">
|
||||||
</label>
|
貯蓄金
|
||||||
|
</label>
|
||||||
|
|
||||||
<input type="number" id="saving" class="form-control" th:field="*{saving}" min="0"
|
<input type="number"
|
||||||
max="1000000000" required>
|
id="saving"
|
||||||
</div>
|
class="form-control"
|
||||||
|
th:field="*{saving}"
|
||||||
|
min="0"
|
||||||
|
max="1000000000"
|
||||||
|
required>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label for="annualIncome" class="form-label">
|
<label for="annualIncome"
|
||||||
年収
|
class="form-label">
|
||||||
</label>
|
年収
|
||||||
|
</label>
|
||||||
|
|
||||||
<input type="number" id="annualIncome" class="form-control" th:field="*{annualIncome}" min="0"
|
<input type="number"
|
||||||
max="100000000" required>
|
id="annualIncome"
|
||||||
</div>
|
class="form-control"
|
||||||
|
th:field="*{annualIncome}"
|
||||||
|
min="0"
|
||||||
|
max="100000000"
|
||||||
|
required>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label for="monthlyBudget" class="form-label">
|
<label for="monthlyBudget"
|
||||||
月別使用可能金額
|
class="form-label">
|
||||||
</label>
|
月別使用可能金額
|
||||||
|
</label>
|
||||||
|
|
||||||
<input type="number" id="monthlyBudget" class="form-control" th:field="*{monthlyBudget}" min="0"
|
<input type="number"
|
||||||
max="10000000" required>
|
id="monthlyBudget"
|
||||||
</div>
|
class="form-control"
|
||||||
|
th:field="*{monthlyBudget}"
|
||||||
|
min="0"
|
||||||
|
max="10000000"
|
||||||
|
required>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label for="goalId" class="form-label">
|
<label for="goalId"
|
||||||
目標貯金額
|
class="form-label">
|
||||||
</label>
|
目標貯金額
|
||||||
|
</label>
|
||||||
|
|
||||||
<input type="number" id="goalId" class="form-control" th:field="*{goalId}" min="0"
|
<input type="number"
|
||||||
max="1000000000" required>
|
id="goalId"
|
||||||
</div>
|
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 type="submit"
|
||||||
コース選択
|
class="btn btn-outline-primary">
|
||||||
</button>
|
コース選択
|
||||||
|
</button>
|
||||||
|
|
||||||
<button type="submit" class="btn btn-primary">
|
<button type="submit"
|
||||||
作成
|
class="btn btn-primary">
|
||||||
</button>
|
作成
|
||||||
|
</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 type="submit"
|
||||||
戻る
|
class="btn btn-outline-secondary">
|
||||||
</button>
|
戻る
|
||||||
|
</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>
|
</body>
|
||||||
|
|
||||||
|
|||||||
@@ -39,19 +39,19 @@
|
|||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label for="password" class="form-label">パスワード</label>
|
<label for="password" class="form-label">パスワード</label>
|
||||||
<input type="password" id="password" class="form-control" name="password" th:value="*{password}" minlength="8"
|
<input type="password" id="password" class="form-control" name="password" th:value="*{password}" minlength="8"
|
||||||
maxlength="24" required readonly>
|
maxlength="255" required readonly>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label for="secretQuestionId" class="form-label">秘密の質問</label>
|
<label for="secretQuestionId" class="form-label">秘密の質問</label>
|
||||||
<select id="secretQuestionId" th:field="*{secretQuestionId}" required disabled>
|
<select id="secretQuestionId" th:field="*{secretQuestionId}" required readonly>
|
||||||
<option value="" readonly>選択してください</option>
|
<option value="">選択してください</option>
|
||||||
<option th:each="question : ${session.questionList}" th:value="${question.secretQuestionId}"
|
<option th:each="question : ${session.questionList}" th:value="${question.secretQuestionId}"
|
||||||
th:text="${question.questionText}" readonly>
|
th:text="${question.questionText}">
|
||||||
</option>
|
</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label for="secretAnswer" class="form-label">秘密の質問の回答</label>
|
<label for="secretAnswer" class="form-label">秘密の質問の回答</label>
|
||||||
<input type="text" id="secretAnswer" class="form-control" th:field="*{secretAnswer}" maxlength="100" readonly>
|
<input type="text" id="secretAnswer" class="form-control" th:field="*{secretAnswer}" maxlength="100" readonly>
|
||||||
@@ -82,7 +82,7 @@
|
|||||||
<div class="d-flex justify-content-between align-items-center">
|
<div class="d-flex justify-content-between align-items-center">
|
||||||
<input type="hidden" class="form-control" th:field="*{courseId}">
|
<input type="hidden" class="form-control" th:field="*{courseId}">
|
||||||
<span th:text="${selectedCourseName}">未選択</span>
|
<span th:text="${selectedCourseName}">未選択</span>
|
||||||
<button type="submit" class="btn btn-outline-primary btn-sm" disabled>コース選択</button>
|
<button type="submit" class="btn btn-outline-primary btn-sm">コース選択</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -1,145 +1,153 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="ja" xmlns:th="http://www.thymeleaf.org">
|
<html lang="ja"xmlns:th="http://www.thymeleaf.org">
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" name="viewport" content="width=device-width, initial-scale=1" http-equiv="Content-Type">
|
<meta charset="UTF-8" name="viewport" content="width=device-width, initial-scale=1" http-equiv="Content-Type">
|
||||||
<title>新規会員登録</title>
|
<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>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<div th:replace="~{header :: header}">
|
<div th:replace="~{header :: header}">
|
||||||
</div>
|
</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/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="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>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="d-grid mt-3">
|
|
||||||
<form th:action="@{/login}" method="get">
|
|
||||||
<button type="submit" class="btn btn-outline-secondary">戻る</button>
|
|
||||||
</form>
|
|
||||||
|
|
||||||
</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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
<form th:action="@{/user/register/confirm}" th:object="${userForm}" method="get">
|
||||||
</script>
|
<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="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>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
Reference in New Issue
Block a user