Compare commits
27 Commits
26fa2365e8
...
s-morimto
| Author | SHA1 | Date | |
|---|---|---|---|
| acd7534fdb | |||
|
|
add6a85c64 | ||
|
|
fd74dee965 | ||
|
|
7aa8e31bfd | ||
|
|
e3af89a694 | ||
|
|
efdaacbb27 | ||
| 154e6787d4 | |||
| 75f2f7c8d0 | |||
| ac101172d2 | |||
| ee5ec5009d | |||
|
|
d7a0aac355 | ||
|
|
a45045d008 | ||
|
|
17074c3132 | ||
| 7604e9ee76 | |||
|
|
34172aecc9 | ||
|
|
e5af64b53b | ||
|
|
b76be8f38a | ||
|
|
47185d8f26 | ||
|
|
0f800da9a3 | ||
|
|
546206317d | ||
|
|
d764da2ebf | ||
|
|
b83f360781 | ||
|
|
42c4d7c273 | ||
|
|
cfbf56cf4e | ||
|
|
503ac3f3db | ||
|
|
d5b18ae3ad | ||
|
|
efe93e010d |
@@ -4,6 +4,8 @@ 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;
|
||||||
@@ -37,7 +39,7 @@ public class GlobalExceptionHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ExceptionHandler(HttpRequestMethodNotSupportedException.class)
|
@ExceptionHandler(HttpRequestMethodNotSupportedException.class)
|
||||||
public String handleBadRequestException(Model model, Exception e) {
|
public String handleBadRequestException(Model model, Exception e, HttpSession session) {
|
||||||
model.addAttribute("error", SEVERE_ERROR_MESSAGE_BAD_REQUEST);
|
model.addAttribute("error", SEVERE_ERROR_MESSAGE_BAD_REQUEST);
|
||||||
model.addAttribute("status", HttpStatus.BAD_REQUEST.value());
|
model.addAttribute("status", HttpStatus.BAD_REQUEST.value());
|
||||||
|
|
||||||
@@ -45,17 +47,23 @@ public class GlobalExceptionHandler {
|
|||||||
|
|
||||||
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 "error";
|
return "error";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ExceptionHandler(Exception.class)
|
@ExceptionHandler(Exception.class)
|
||||||
public String AllException(Model model, Exception e) {
|
public String AllException(Model model, Exception e, HttpSession session) {
|
||||||
model.addAttribute("error", SEVERE_ERROR_MESSAGE_BAD_REQUEST);
|
model.addAttribute("error", SEVERE_ERROR_MESSAGE_BAD_REQUEST);
|
||||||
|
|
||||||
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 "error";
|
return "error";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ 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;
|
||||||
@@ -27,11 +26,10 @@ public class CourseModel {
|
|||||||
return courseEntityList.stream().map(CourseModel::convertFrom).toList();
|
return courseEntityList.stream().map(CourseModel::convertFrom).toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static CourseEntity convertTo(CourseModel courseModel, List<UserEntity> userEntityList) {
|
public static CourseEntity convertTo(CourseModel courseModel) {
|
||||||
return new CourseEntity(
|
return new CourseEntity(
|
||||||
courseModel.getCourseId(),
|
courseModel.getCourseId(),
|
||||||
courseModel.getCourseName(),
|
courseModel.getCourseName(),
|
||||||
courseModel.getDescription(),
|
courseModel.getDescription());
|
||||||
userEntityList);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,4 +13,11 @@ public interface CourseService {
|
|||||||
public Long findByName(String courName);
|
public Long findByName(String courName);
|
||||||
|
|
||||||
public CourseModel save(CourseModel courseModel, Long userId);
|
public CourseModel save(CourseModel courseModel, Long userId);
|
||||||
|
|
||||||
|
public List<CourseModel> findAllByUserId(Long userId);
|
||||||
|
|
||||||
|
public List<CourseModel> findAllByNull();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -18,6 +18,8 @@ public interface GoalService {
|
|||||||
|
|
||||||
public void updateGoalComplete(Long userId);
|
public void updateGoalComplete(Long userId);
|
||||||
|
|
||||||
|
public int getCurrentAmount(Long userId);
|
||||||
|
|
||||||
// void deleteGoal(Long goalId);
|
// void deleteGoal(Long goalId);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -3,12 +3,16 @@ 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.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.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.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;
|
||||||
|
|
||||||
@@ -20,12 +24,22 @@ public class CourseServiceImpl implements CourseService {
|
|||||||
|
|
||||||
private final CourseRepository courseRepository;
|
private final CourseRepository courseRepository;
|
||||||
private final UserRepository userRepository;
|
private final UserRepository userRepository;
|
||||||
|
private final CourseOwnerRepository courseOwnerRepository;
|
||||||
|
|
||||||
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));
|
||||||
}
|
}
|
||||||
@@ -34,12 +48,27 @@ public class CourseServiceImpl implements CourseService {
|
|||||||
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) {
|
||||||
|
|
||||||
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));
|
||||||
|
|
||||||
|
UserEntity user = userRepository.findById(userId).orElse(null);
|
||||||
|
|
||||||
|
user.setCourseEntity(result);
|
||||||
|
|
||||||
|
UserEntity userResult = userRepository.save(user);
|
||||||
|
|
||||||
|
CourseOwnerEntity courseOwnerEntity = new CourseOwnerEntity();
|
||||||
|
courseOwnerEntity.setUserEntity(userResult);
|
||||||
|
courseOwnerEntity.setCourseEntity(result);
|
||||||
|
|
||||||
|
courseOwnerRepository.save(courseOwnerEntity);
|
||||||
|
|
||||||
|
return CourseModel.convertFrom(result);
|
||||||
|
|
||||||
return CourseModel.convertFrom( courseRepository.save( CourseModel.convertTo(courseModel, userEntityList)));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,13 +59,28 @@ public class GoalServiceImpl implements GoalService {
|
|||||||
: (int) ((currentAmount * 100.0) / goalEntity.getTargetAmount()),
|
: (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);
|
||||||
@@ -108,4 +123,21 @@ public class GoalServiceImpl implements GoalService {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getCurrentAmount(Long userId) {
|
||||||
|
|
||||||
|
UserEntity userEntity = userRepository.findById(userId).orElseThrow();
|
||||||
|
|
||||||
|
int transactionTotal = userEntity.getTransactionEntityList().stream()
|
||||||
|
.mapToInt(t -> {
|
||||||
|
int sign = t.getCategoryEntity().getTransactionType() == 1 ? 1 : -1;
|
||||||
|
return sign * t.getAmount();
|
||||||
|
})
|
||||||
|
.sum();
|
||||||
|
|
||||||
|
int currentAmount = userEntity.getSaving() + transactionTotal;
|
||||||
|
|
||||||
|
return currentAmount;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -58,6 +58,7 @@ 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,6 +52,9 @@ public class UserServiceImpl implements UserService {
|
|||||||
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);
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ 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;
|
||||||
@@ -35,9 +34,6 @@ public class CourseEntity {
|
|||||||
@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
|
||||||
|
|||||||
@@ -0,0 +1,37 @@
|
|||||||
|
package com.example.demo.app.infra.entity;
|
||||||
|
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.FetchType;
|
||||||
|
import jakarta.persistence.GeneratedValue;
|
||||||
|
import jakarta.persistence.GenerationType;
|
||||||
|
import jakarta.persistence.Id;
|
||||||
|
import jakarta.persistence.JoinColumn;
|
||||||
|
import jakarta.persistence.ManyToOne;
|
||||||
|
import jakarta.persistence.OneToOne;
|
||||||
|
import jakarta.persistence.Table;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@Table(name = "course_owner_t")
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class CourseOwnerEntity {
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
private Long courseOwnerId;
|
||||||
|
|
||||||
|
@ManyToOne(fetch = FetchType.LAZY)
|
||||||
|
@JoinColumn(name = "user_id")
|
||||||
|
private UserEntity userEntity;
|
||||||
|
|
||||||
|
@OneToOne(fetch = FetchType.LAZY)
|
||||||
|
@JoinColumn(name = "course_id")
|
||||||
|
private CourseEntity courseEntity;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package com.example.demo.app.infra.repository;
|
||||||
|
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
|
||||||
|
import com.example.demo.app.infra.entity.CourseOwnerEntity;
|
||||||
|
|
||||||
|
public interface CourseOwnerRepository extends JpaRepository<CourseOwnerEntity, Long>{
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
package com.example.demo.app.infra.repository;
|
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;
|
||||||
|
|
||||||
@@ -13,5 +15,10 @@ public interface CourseRepository extends JpaRepository<CourseEntity, Long> {
|
|||||||
@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();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,9 @@ import org.springframework.web.bind.annotation.PostMapping;
|
|||||||
|
|
||||||
import com.example.demo.app.domain.model.LoginModel;
|
import com.example.demo.app.domain.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;
|
||||||
@@ -23,64 +26,64 @@ public class CategoryController {
|
|||||||
private final CategoryService categoryService;
|
private final CategoryService categoryService;
|
||||||
|
|
||||||
|
|
||||||
@GetMapping("/category/list")
|
@GetMapping(TransitionTargetPageNameKeyword.CATEGORY_LIST)
|
||||||
public String categoryListGet(Model model, HttpSession session) {
|
public String categoryListGet(Model model, HttpSession session) {
|
||||||
|
|
||||||
LoginModel loginUser = (LoginModel) session.getAttribute("loginUser");
|
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
|
||||||
|
|
||||||
List<CategoryForm> categoryFormList = CategoryForm.convertFrom(categoryService.findAllByuserId(loginUser.getUserId()));
|
List<CategoryForm> categoryFormList = CategoryForm.convertFrom(categoryService.findAllByuserId(loginUser.getUserId()));
|
||||||
|
|
||||||
model.addAttribute("categoryFormList", categoryFormList);
|
model.addAttribute(PageReturnAttributeKeyword.CATEGORY_FORM_LIST, categoryFormList);
|
||||||
|
|
||||||
return "category-list";
|
return TransitionTargetPageNameKeyword.CATEGORY_LIST_HTML;
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/category/create")
|
@GetMapping(TransitionTargetPageNameKeyword.CATEGORY_CREATE)
|
||||||
public String categoryCreateGet(@ModelAttribute CategoryForm categoryForm) {
|
public String categoryCreateGet(@ModelAttribute CategoryForm categoryForm) {
|
||||||
|
|
||||||
return "category-create";
|
return TransitionTargetPageNameKeyword.CATEGORY_CREATE_HTML;
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/category/create")
|
@PostMapping(TransitionTargetPageNameKeyword.CATEGORY_CREATE)
|
||||||
public String categoryCreatePost(@ModelAttribute CategoryForm categoryForm, HttpSession session) {
|
public String categoryCreatePost(@ModelAttribute CategoryForm categoryForm, HttpSession session) {
|
||||||
|
|
||||||
LoginModel loginUser = (LoginModel) session.getAttribute("loginUser");
|
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
|
||||||
|
|
||||||
|
|
||||||
categoryService.save(CategoryForm.convertTo(categoryForm), loginUser.getUserId());
|
categoryService.save(CategoryForm.convertTo(categoryForm), loginUser.getUserId());
|
||||||
|
|
||||||
return "redirect:/category/list";
|
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.CATEGORY_LIST;
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/category/update")
|
@GetMapping(TransitionTargetPageNameKeyword.CATEGORY_UPDATE)
|
||||||
public String categoryUpdateGet(Model model, Long categoryId) {
|
public String categoryUpdateGet(Model model, Long categoryId) {
|
||||||
|
|
||||||
CategoryForm categoryForm = CategoryForm.convertFrom(categoryService.findOne(categoryId));
|
CategoryForm categoryForm = CategoryForm.convertFrom(categoryService.findOne(categoryId));
|
||||||
|
|
||||||
model.addAttribute("categoryId", categoryId);
|
model.addAttribute(PageReturnAttributeKeyword.CATEGORY_ID, categoryId);
|
||||||
model.addAttribute("categoryForm", categoryForm);
|
model.addAttribute(PageReturnAttributeKeyword.CATEGORY_FORM, categoryForm);
|
||||||
|
|
||||||
return "category-update";
|
return TransitionTargetPageNameKeyword.CATEGORY_UPDATE_HTML;
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/category/update")
|
@PostMapping(TransitionTargetPageNameKeyword.CATEGORY_UPDATE)
|
||||||
public String categoryUpdatePost(@ModelAttribute CategoryForm categoryForm, HttpSession session, Long categoryId) {
|
public String categoryUpdatePost(@ModelAttribute CategoryForm categoryForm, HttpSession session, Long categoryId) {
|
||||||
|
|
||||||
LoginModel loginUser = (LoginModel) session.getAttribute("loginUser");
|
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
|
||||||
|
|
||||||
categoryForm.setCategoryId(categoryId);
|
categoryForm.setCategoryId(categoryId);
|
||||||
|
|
||||||
categoryService.save(CategoryForm.convertTo(categoryForm), loginUser.getUserId());
|
categoryService.save(CategoryForm.convertTo(categoryForm), loginUser.getUserId());
|
||||||
|
|
||||||
return "redirect:/category/list";
|
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.CATEGORY_LIST;
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/category/delete")
|
@PostMapping(TransitionTargetPageNameKeyword.CATEGORY_DELETE)
|
||||||
public String categoryDeletePost(Long categoryId) {
|
public String categoryDeletePost(Long categoryId) {
|
||||||
|
|
||||||
categoryService.delete(categoryId);
|
categoryService.delete(categoryId);
|
||||||
|
|
||||||
return "redirect:/category/list";
|
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.CATEGORY_LIST;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ 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.AllocationModel;
|
import com.example.demo.app.domain.model.AllocationModel;
|
||||||
|
import com.example.demo.app.domain.model.CourseModel;
|
||||||
import com.example.demo.app.domain.model.LoginModel;
|
import com.example.demo.app.domain.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;
|
||||||
@@ -47,7 +48,9 @@ public class CourseController {
|
|||||||
session.setAttribute(PageReturnAttributeKeyword.USER_FORM, userForm);
|
session.setAttribute(PageReturnAttributeKeyword.USER_FORM, userForm);
|
||||||
model.addAttribute(PageReturnAttributeKeyword.MODE, MODE);
|
model.addAttribute(PageReturnAttributeKeyword.MODE, MODE);
|
||||||
model.addAttribute(PageReturnAttributeKeyword.CURRENT_COURSE_ID, courseService.findByName(DEFAULT));
|
model.addAttribute(PageReturnAttributeKeyword.CURRENT_COURSE_ID, courseService.findByName(DEFAULT));
|
||||||
model.addAttribute(PageReturnAttributeKeyword.COURSE_LIST, CourseForm.convertFrom(courseService.findAll()));
|
|
||||||
|
model.addAttribute(PageReturnAttributeKeyword.COURSE_LIST,
|
||||||
|
CourseForm.convertFrom(courseService.findAllByNull()));
|
||||||
model.addAttribute(PageReturnAttributeKeyword.COURSE_INFO_LIST,
|
model.addAttribute(PageReturnAttributeKeyword.COURSE_INFO_LIST,
|
||||||
CourseInfoForm.convertFrom(courseInfoService.findAll()));
|
CourseInfoForm.convertFrom(courseInfoService.findAll()));
|
||||||
|
|
||||||
@@ -66,9 +69,15 @@ public class CourseController {
|
|||||||
|
|
||||||
Long currentCourseId = userService.findByUserId(userId).getCourseId();
|
Long currentCourseId = userService.findByUserId(userId).getCourseId();
|
||||||
|
|
||||||
|
List<CourseModel> courseModelList = new ArrayList<>(courseService.findAllByNull());
|
||||||
|
|
||||||
|
List<CourseModel> tempList = courseService.findAllByUserId(userId);
|
||||||
|
|
||||||
|
tempList.forEach(courseModelList::add);
|
||||||
|
|
||||||
model.addAttribute(PageReturnAttributeKeyword.MODE, MODE);
|
model.addAttribute(PageReturnAttributeKeyword.MODE, MODE);
|
||||||
model.addAttribute(PageReturnAttributeKeyword.CURRENT_COURSE_ID, currentCourseId);
|
model.addAttribute(PageReturnAttributeKeyword.CURRENT_COURSE_ID, currentCourseId);
|
||||||
model.addAttribute(PageReturnAttributeKeyword.COURSE_LIST, CourseForm.convertFrom(courseService.findAll()));
|
model.addAttribute(PageReturnAttributeKeyword.COURSE_LIST, CourseForm.convertFrom(courseModelList));
|
||||||
model.addAttribute(PageReturnAttributeKeyword.COURSE_INFO_LIST,
|
model.addAttribute(PageReturnAttributeKeyword.COURSE_INFO_LIST,
|
||||||
CourseInfoForm.convertFrom(courseInfoService.findAll()));
|
CourseInfoForm.convertFrom(courseInfoService.findAll()));
|
||||||
|
|
||||||
@@ -88,60 +97,71 @@ public class CourseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@SessionCheck
|
@SessionCheck
|
||||||
@GetMapping("/course/create")
|
@GetMapping(TransitionTargetPageNameKeyword.COURSE_CREATE)
|
||||||
public String createCourseGet(@ModelAttribute CourseForm courseForm, HttpSession session) {
|
public String createCourseGet(@ModelAttribute CourseForm courseForm, HttpSession session) {
|
||||||
|
|
||||||
return "course_create";
|
return TransitionTargetPageNameKeyword.COURSE_CREATE_HTML;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SessionCheck
|
@SessionCheck
|
||||||
@PostMapping("/course/create/ratio")
|
@PostMapping(TransitionTargetPageNameKeyword.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("loginUser");
|
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
|
||||||
|
|
||||||
CourseForm form = CourseForm
|
CourseForm form = CourseForm
|
||||||
.convertFrom(courseService.save(CourseForm.convertTo(courseForm), loginUser.getUserId()));
|
.convertFrom(courseService.save(CourseForm.convertTo(courseForm), loginUser.getUserId()));
|
||||||
|
|
||||||
session.setAttribute("courseId", form.getCourseId());
|
session.setAttribute(PageReturnAttributeKeyword.COURSE_ID, form.getCourseId());
|
||||||
|
|
||||||
return "course_create_ratio";
|
return TransitionTargetPageNameKeyword.COURSE_CREATE_RATIO_HTML;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SessionCheck
|
@SessionCheck
|
||||||
@PostMapping("/course/create")
|
@PostMapping(TransitionTargetPageNameKeyword.COURSE_CREATE)
|
||||||
public String createCoursePost(@ModelAttribute AllocationFormList allocationFormList, HttpSession session) {
|
public String createCoursePost(@ModelAttribute AllocationFormList allocationFormList, HttpSession session) {
|
||||||
|
|
||||||
List<AllocationModel> allocationModelList = new ArrayList<>();
|
List<AllocationModel> allocationModelList = new ArrayList<>();
|
||||||
|
|
||||||
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId1(),
|
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId1(),
|
||||||
(Long) session.getAttribute("courseId"), allocationFormList.getAllocationRatio1()));
|
(Long) session.getAttribute(PageReturnAttributeKeyword.COURSE_ID),
|
||||||
|
allocationFormList.getAllocationRatio1()));
|
||||||
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId2(),
|
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId2(),
|
||||||
(Long) session.getAttribute("courseId"), allocationFormList.getAllocationRatio2()));
|
(Long) session.getAttribute(PageReturnAttributeKeyword.COURSE_ID),
|
||||||
|
allocationFormList.getAllocationRatio2()));
|
||||||
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId3(),
|
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId3(),
|
||||||
(Long) session.getAttribute("courseId"), allocationFormList.getAllocationRatio3()));
|
(Long) session.getAttribute(PageReturnAttributeKeyword.COURSE_ID),
|
||||||
|
allocationFormList.getAllocationRatio3()));
|
||||||
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId4(),
|
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId4(),
|
||||||
(Long) session.getAttribute("courseId"), allocationFormList.getAllocationRatio4()));
|
(Long) session.getAttribute(PageReturnAttributeKeyword.COURSE_ID),
|
||||||
|
allocationFormList.getAllocationRatio4()));
|
||||||
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId5(),
|
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId5(),
|
||||||
(Long) session.getAttribute("courseId"), allocationFormList.getAllocationRatio5()));
|
(Long) session.getAttribute(PageReturnAttributeKeyword.COURSE_ID),
|
||||||
|
allocationFormList.getAllocationRatio5()));
|
||||||
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId6(),
|
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId6(),
|
||||||
(Long) session.getAttribute("courseId"), allocationFormList.getAllocationRatio6()));
|
(Long) session.getAttribute(PageReturnAttributeKeyword.COURSE_ID),
|
||||||
|
allocationFormList.getAllocationRatio6()));
|
||||||
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId7(),
|
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId7(),
|
||||||
(Long) session.getAttribute("courseId"), allocationFormList.getAllocationRatio7()));
|
(Long) session.getAttribute(PageReturnAttributeKeyword.COURSE_ID),
|
||||||
|
allocationFormList.getAllocationRatio7()));
|
||||||
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId8(),
|
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId8(),
|
||||||
(Long) session.getAttribute("courseId"), allocationFormList.getAllocationRatio8()));
|
(Long) session.getAttribute(PageReturnAttributeKeyword.COURSE_ID),
|
||||||
|
allocationFormList.getAllocationRatio8()));
|
||||||
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId9(),
|
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId9(),
|
||||||
(Long) session.getAttribute("courseId"), allocationFormList.getAllocationRatio9()));
|
(Long) session.getAttribute(PageReturnAttributeKeyword.COURSE_ID),
|
||||||
|
allocationFormList.getAllocationRatio9()));
|
||||||
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId10(),
|
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId10(),
|
||||||
(Long) session.getAttribute("courseId"), allocationFormList.getAllocationRatio10()));
|
(Long) session.getAttribute(PageReturnAttributeKeyword.COURSE_ID),
|
||||||
|
allocationFormList.getAllocationRatio10()));
|
||||||
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId11(),
|
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId11(),
|
||||||
(Long) session.getAttribute("courseId"), allocationFormList.getAllocationRatio11()));
|
(Long) session.getAttribute(PageReturnAttributeKeyword.COURSE_ID),
|
||||||
|
allocationFormList.getAllocationRatio11()));
|
||||||
|
|
||||||
allocationService.save(allocationModelList);
|
allocationService.save(allocationModelList);
|
||||||
|
|
||||||
return "redirect:/course";
|
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.COURSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -16,6 +16,9 @@ import com.example.demo.aop.aspect.SessionCheck;
|
|||||||
import com.example.demo.app.domain.model.LoginModel;
|
import com.example.demo.app.domain.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;
|
||||||
|
|
||||||
@@ -29,30 +32,30 @@ public class FixedCostController {
|
|||||||
private final CategoryService categoryService;
|
private final CategoryService categoryService;
|
||||||
|
|
||||||
@SessionCheck
|
@SessionCheck
|
||||||
@GetMapping("/fixed-cost/list")
|
@GetMapping(TransitionTargetPageNameKeyword.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("loginUser");
|
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
|
||||||
|
|
||||||
if (today == null) {
|
if (today == null) {
|
||||||
today = (LocalDate) session.getAttribute("today");
|
today = (LocalDate) session.getAttribute(PageReturnAttributeKeyword.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("fixedCostFormList", fixedCostFormList);
|
model.addAttribute(PageReturnAttributeKeyword.FIXED_COST_FORM_LIST, fixedCostFormList);
|
||||||
|
|
||||||
model.addAttribute("today", today);
|
model.addAttribute(PageReturnAttributeKeyword.TODAY, today);
|
||||||
|
|
||||||
return "fixed_cost";
|
return TransitionTargetPageNameKeyword.FIXED_COST_HTML;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@SessionCheck
|
@SessionCheck
|
||||||
@GetMapping("/fixed-cost/create")
|
@GetMapping(TransitionTargetPageNameKeyword.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) {
|
||||||
|
|
||||||
@@ -72,42 +75,42 @@ public class FixedCostController {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
model.addAttribute("expenseList", expenseList);
|
model.addAttribute(PageReturnAttributeKeyword.EXPENSE_LIST, expenseList);
|
||||||
model.addAttribute("incomeList", incomeList);
|
model.addAttribute(PageReturnAttributeKeyword.INCOME_LIST, incomeList);
|
||||||
model.addAttribute("today", today);
|
model.addAttribute(PageReturnAttributeKeyword.TODAY, today);
|
||||||
|
|
||||||
|
|
||||||
return "fixed_cost_create";
|
return TransitionTargetPageNameKeyword.FIXED_COST_CREATE_HTML;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@SessionCheck
|
@SessionCheck
|
||||||
@PostMapping("/fixed-cost/create")
|
@PostMapping(TransitionTargetPageNameKeyword.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("loginUser");
|
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
|
||||||
|
|
||||||
fixedCostForm.setUserId(loginUser.getUserId());
|
fixedCostForm.setUserId(loginUser.getUserId());
|
||||||
|
|
||||||
fixedCostService.save(FixedCostForm.convertTo(fixedCostForm));
|
fixedCostService.save(FixedCostForm.convertTo(fixedCostForm));
|
||||||
|
|
||||||
session.setAttribute("today", today);
|
session.setAttribute(PageReturnAttributeKeyword.TODAY, today);
|
||||||
|
|
||||||
return "redirect:/fixed-cost/list";
|
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.FIXED_COST_LIST;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@SessionCheck
|
@SessionCheck
|
||||||
@PostMapping("/fixed-cost/delete")
|
@PostMapping(TransitionTargetPageNameKeyword.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("today", today);
|
session.setAttribute(PageReturnAttributeKeyword.TODAY, today);
|
||||||
|
|
||||||
return "redirect:/fixed-cost/list";
|
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.FIXED_COST_LIST;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ public class GoalController {
|
|||||||
HttpSession session,
|
HttpSession session,
|
||||||
Long goalId) {
|
Long goalId) {
|
||||||
|
|
||||||
LoginModel loginUser = (LoginModel) session.getAttribute("loginUser");
|
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
|
||||||
|
|
||||||
Long userId = loginUser.getUserId();
|
Long userId = loginUser.getUserId();
|
||||||
|
|
||||||
@@ -68,15 +68,15 @@ public class GoalController {
|
|||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
model.addAttribute(
|
model.addAttribute(
|
||||||
"goalFormList",
|
PageReturnAttributeKeyword.GOAL_FORM_LIST,
|
||||||
goalFormList);
|
goalFormList);
|
||||||
|
|
||||||
model.addAttribute(
|
model.addAttribute(
|
||||||
"achievementList",
|
PageReturnAttributeKeyword.ACHIEVEMENT_LIST,
|
||||||
new ArrayList<MonthlyAchievementForm>());
|
new ArrayList<MonthlyAchievementForm>());
|
||||||
|
|
||||||
if (goalFormList.isEmpty()) {
|
if (goalFormList.isEmpty()) {
|
||||||
return "goal_view";
|
return TransitionTargetPageNameKeyword.GOAL_VIEW_HTML;
|
||||||
}
|
}
|
||||||
|
|
||||||
GoalForm graphGoal;
|
GoalForm graphGoal;
|
||||||
@@ -95,7 +95,7 @@ public class GoalController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
model.addAttribute(
|
model.addAttribute(
|
||||||
"graphGoal",
|
PageReturnAttributeKeyword.GRAPH_GOAL,
|
||||||
graphGoal);
|
graphGoal);
|
||||||
|
|
||||||
int currentAmount = graphGoal.getCurrentAmount();
|
int currentAmount = graphGoal.getCurrentAmount();
|
||||||
@@ -223,7 +223,7 @@ public class GoalController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
model.addAttribute(
|
model.addAttribute(
|
||||||
"achievementList",
|
PageReturnAttributeKeyword.ACHIEVEMENT_LIST,
|
||||||
achievementList);
|
achievementList);
|
||||||
|
|
||||||
return TransitionTargetPageNameKeyword.GOAL_VIEW_HTML;
|
return TransitionTargetPageNameKeyword.GOAL_VIEW_HTML;
|
||||||
@@ -266,44 +266,55 @@ public class GoalController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@SessionCheck
|
@SessionCheck
|
||||||
@GetMapping("/create")
|
@GetMapping(TransitionTargetPageNameKeyword.CREATE)
|
||||||
public String createGoalGet(@ModelAttribute GoalForm goalForm, HttpSession session) {
|
public String createGoalGet(@ModelAttribute GoalForm goalForm, HttpSession session, Model model) {
|
||||||
|
|
||||||
return "goal_create";
|
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
|
||||||
}
|
|
||||||
|
|
||||||
@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();
|
||||||
|
|
||||||
goalService.createGoal(GoalModel.convertFrom(goalForm), userId);
|
int currentAmount = goalService.getCurrentAmount(userId);
|
||||||
|
|
||||||
return "redirect:/goal";
|
model.addAttribute("currentAmount", currentAmount);
|
||||||
|
|
||||||
|
return TransitionTargetPageNameKeyword.GOAL_CREATE_HTML;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SessionCheck
|
@SessionCheck
|
||||||
@PostMapping("/delete") // フラグ考慮してないため、今度修正必要
|
@PostMapping(TransitionTargetPageNameKeyword.CREATE)
|
||||||
|
public String createGoalPost(@ModelAttribute GoalForm goalForm, HttpSession session, Model model) {
|
||||||
|
|
||||||
|
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
|
||||||
|
|
||||||
|
Long userId = loginUser.getUserId();
|
||||||
|
|
||||||
|
if (goalService.createGoal(GoalModel.convertFrom(goalForm), userId) == null) {
|
||||||
|
model.addAttribute(PageReturnAttributeKeyword.MESSAGE, "現在所持金より高い金額を設定してください。");
|
||||||
|
return TransitionTargetPageNameKeyword.GOAL_CREATE_HTML;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.GOAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SessionCheck
|
||||||
|
@PostMapping(TransitionTargetPageNameKeyword.DELETE) // フラグ考慮してないため、今度修正必要
|
||||||
public String deleteGoal(Long goalId, Long record) {
|
public String deleteGoal(Long goalId, Long record) {
|
||||||
|
|
||||||
goalService.delete(goalId);
|
goalService.delete(goalId);
|
||||||
|
|
||||||
if (record == null) {
|
if (record == null) {
|
||||||
return "redirect:/goal";
|
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.GOAL;
|
||||||
} else {
|
} else {
|
||||||
return "redirect:/goal/record";
|
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.GOAL + TransitionTargetPageNameKeyword.RECORD;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SessionCheck
|
@SessionCheck
|
||||||
@GetMapping("/record")
|
@GetMapping(TransitionTargetPageNameKeyword.RECORD)
|
||||||
public String getRecord(HttpSession session, Model model) {
|
public String getRecord(HttpSession session, Model model) {
|
||||||
|
|
||||||
LoginModel loginUser = (LoginModel) session.getAttribute("loginUser");
|
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
|
||||||
|
|
||||||
Long userId = loginUser.getUserId();
|
Long userId = loginUser.getUserId();
|
||||||
goalService.updateGoalComplete(userId);
|
goalService.updateGoalComplete(userId);
|
||||||
@@ -320,10 +331,10 @@ public class GoalController {
|
|||||||
});
|
});
|
||||||
|
|
||||||
model.addAttribute(
|
model.addAttribute(
|
||||||
"goalCompleteFormList",
|
PageReturnAttributeKeyword.GOAL_COMPLETE_FORM_LIST,
|
||||||
goalCompleteFormList);
|
goalCompleteFormList);
|
||||||
|
|
||||||
return "goal_record";
|
return TransitionTargetPageNameKeyword.GOAL_RECORD_HTML;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -26,8 +26,8 @@ public class LoginController {
|
|||||||
@GetMapping(TransitionTargetPageNameKeyword.LOGIN)
|
@GetMapping(TransitionTargetPageNameKeyword.LOGIN)
|
||||||
public String showLogin(@ModelAttribute LoginForm loginForm, HttpSession session) {
|
public String showLogin(@ModelAttribute LoginForm loginForm, HttpSession session) {
|
||||||
|
|
||||||
if (session.getAttribute("loginUser") != null) {
|
if (session.getAttribute(SessionKeyword.LOGIN_USER) != null) {
|
||||||
return "redirect:/menu";
|
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.MENU;
|
||||||
}
|
}
|
||||||
|
|
||||||
return TransitionTargetPageNameKeyword.LOGIN_HTML;
|
return TransitionTargetPageNameKeyword.LOGIN_HTML;
|
||||||
|
|||||||
@@ -54,9 +54,11 @@ 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(),
|
||||||
|
profileModel.getBirthDate());
|
||||||
|
|
||||||
model.addAttribute(PageReturnAttributeKeyword.PROFILE_EDIT_FORM, profileEditForm);
|
model.addAttribute(PageReturnAttributeKeyword.PROFILE_EDIT_FORM, profileEditForm);
|
||||||
return TransitionTargetPageNameKeyword.PROFILE_EDIT_HTML;
|
return TransitionTargetPageNameKeyword.PROFILE_EDIT_HTML;
|
||||||
|
|||||||
@@ -192,7 +192,7 @@ public class TransactionController {
|
|||||||
Long fixedCostId,
|
Long fixedCostId,
|
||||||
Model model, HttpSession session) {
|
Model model, HttpSession session) {
|
||||||
|
|
||||||
LoginModel loginUser = (LoginModel) session.getAttribute("loginUser");
|
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
|
||||||
if (today == null) {
|
if (today == null) {
|
||||||
today = LocalDate.now();
|
today = LocalDate.now();
|
||||||
}
|
}
|
||||||
@@ -218,8 +218,28 @@ public class TransactionController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
List<CategoryForm> expenseList = new ArrayList<CategoryForm>();
|
||||||
|
|
||||||
|
List<CategoryForm> incomeList = new ArrayList<CategoryForm>();
|
||||||
|
|
||||||
|
for (CategoryForm categoryForm : categoryFormList) {
|
||||||
|
|
||||||
|
if (categoryForm.getTransactionType() == 0) {
|
||||||
|
expenseList.add(categoryForm);
|
||||||
|
} else {
|
||||||
|
incomeList.add(categoryForm);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
model.addAttribute(PageReturnAttributeKeyword.EXPENSE_LIST, expenseList);
|
||||||
|
model.addAttribute(PageReturnAttributeKeyword.INCOME_LIST, incomeList);
|
||||||
|
|
||||||
model.addAttribute(PageReturnAttributeKeyword.TRANSACTION_FORM, transactionForm);
|
model.addAttribute(PageReturnAttributeKeyword.TRANSACTION_FORM, transactionForm);
|
||||||
|
|
||||||
|
session.setAttribute("tType", String.valueOf(transactionForm.getTransactionType()));
|
||||||
|
|
||||||
model.addAttribute(PageReturnAttributeKeyword.CATEGORY_FORM_LIST, categoryFormList);
|
model.addAttribute(PageReturnAttributeKeyword.CATEGORY_FORM_LIST, categoryFormList);
|
||||||
|
|
||||||
model.addAttribute(PageReturnAttributeKeyword.TODAY, today.format(DateTimeFormatter.ISO_LOCAL_DATE));
|
model.addAttribute(PageReturnAttributeKeyword.TODAY, today.format(DateTimeFormatter.ISO_LOCAL_DATE));
|
||||||
@@ -253,7 +273,7 @@ public class TransactionController {
|
|||||||
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("loginUser");
|
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
|
||||||
if (today == null) {
|
if (today == null) {
|
||||||
today = LocalDate.now();
|
today = LocalDate.now();
|
||||||
}
|
}
|
||||||
@@ -295,7 +315,7 @@ public class TransactionController {
|
|||||||
@RequestParam LocalDate today, Model model,
|
@RequestParam LocalDate today, Model model,
|
||||||
HttpSession session) {
|
HttpSession session) {
|
||||||
|
|
||||||
LoginModel loginUser = (LoginModel) session.getAttribute("loginUser");
|
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
|
||||||
|
|
||||||
transactionForm.setUserId(loginUser.getUserId());
|
transactionForm.setUserId(loginUser.getUserId());
|
||||||
transactionForm.setTransactionId(transactionId);
|
transactionForm.setTransactionId(transactionId);
|
||||||
@@ -407,15 +427,17 @@ public class TransactionController {
|
|||||||
model.addAttribute(PageReturnAttributeKeyword.DEADLINE, result.getDeadline());
|
model.addAttribute(PageReturnAttributeKeyword.DEADLINE, result.getDeadline());
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
model.addAttribute(PageReturnAttributeKeyword.ACHIEVEMENT_RATE, "目標を設定してください");
|
final String MESSAGE = "目標を設定してください";
|
||||||
|
|
||||||
model.addAttribute(PageReturnAttributeKeyword.CURRENT_AMOUNT, "目標を設定してください");
|
model.addAttribute(PageReturnAttributeKeyword.ACHIEVEMENT_RATE, MESSAGE);
|
||||||
|
|
||||||
model.addAttribute(PageReturnAttributeKeyword.TARGET_AMOUNT, "目標を設定してください");
|
model.addAttribute(PageReturnAttributeKeyword.CURRENT_AMOUNT, MESSAGE);
|
||||||
|
|
||||||
|
model.addAttribute(PageReturnAttributeKeyword.TARGET_AMOUNT, MESSAGE);
|
||||||
|
|
||||||
model.addAttribute(PageReturnAttributeKeyword.SAVING, userForm.getSaving());
|
model.addAttribute(PageReturnAttributeKeyword.SAVING, userForm.getSaving());
|
||||||
|
|
||||||
model.addAttribute(PageReturnAttributeKeyword.DEADLINE, "目標を設定してください");
|
model.addAttribute(PageReturnAttributeKeyword.DEADLINE, MESSAGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
return TransitionTargetPageNameKeyword.MENU_HTML;
|
return TransitionTargetPageNameKeyword.MENU_HTML;
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ public class UserController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
session.setAttribute(PageReturnAttributeKeyword.SELECTED_COURSE_NAME, courseService.findById(courseId).getCourseName());
|
session.setAttribute(PageReturnAttributeKeyword.SELECTED_COURSE_NAME, courseService.findById(courseId).getCourseName());
|
||||||
model.addAttribute(PageReturnAttributeKeyword.COURESE_ID, courseId);
|
model.addAttribute(PageReturnAttributeKeyword.COURSE_ID, courseId);
|
||||||
model.addAttribute(PageReturnAttributeKeyword.USER_FORM, userForm);
|
model.addAttribute(PageReturnAttributeKeyword.USER_FORM, userForm);
|
||||||
|
|
||||||
return TransitionTargetPageNameKeyword.USER_RESISTER_RETURN_HTML;
|
return TransitionTargetPageNameKeyword.USER_RESISTER_RETURN_HTML;
|
||||||
@@ -71,6 +71,11 @@ public class UserController {
|
|||||||
HttpSession session) {
|
HttpSession session) {
|
||||||
|
|
||||||
model.addAttribute(PageReturnAttributeKeyword.SELECTED_COURSE_NAME, (String) session.getAttribute("selectedCourseName"));
|
model.addAttribute(PageReturnAttributeKeyword.SELECTED_COURSE_NAME, (String) session.getAttribute("selectedCourseName"));
|
||||||
|
|
||||||
|
session.setAttribute("questionId", userForm.getSecretQuestionId());
|
||||||
|
|
||||||
|
System.out.println("return questionId: ****************************:" + userForm.getSecretQuestionId());
|
||||||
|
|
||||||
return TransitionTargetPageNameKeyword.USER_RESISTER_CONFIRM_HTML;
|
return TransitionTargetPageNameKeyword.USER_RESISTER_CONFIRM_HTML;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -83,6 +88,12 @@ public class UserController {
|
|||||||
|
|
||||||
Long courseId = courseService.findByName((String) session.getAttribute(PageReturnAttributeKeyword.SELECTED_COURSE_NAME));
|
Long courseId = courseService.findByName((String) session.getAttribute(PageReturnAttributeKeyword.SELECTED_COURSE_NAME));
|
||||||
|
|
||||||
|
Long questionId = (Long) session.getAttribute("questionId");
|
||||||
|
|
||||||
|
System.out.println("confirm questionId: ****************************:" + questionId);
|
||||||
|
|
||||||
|
userForm.setSecretQuestionId(questionId);
|
||||||
|
|
||||||
userService.register(userForm, courseId);
|
userService.register(userForm, courseId);
|
||||||
|
|
||||||
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.LOGIN;
|
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.LOGIN;
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ public class PageReturnAttributeKeyword {
|
|||||||
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 COURESE_ID = "courseId";
|
public static final String COURSE_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";
|
||||||
@@ -52,5 +52,14 @@ 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";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,8 @@ 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";
|
||||||
@@ -31,6 +33,15 @@ 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,6 +69,9 @@ 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 = "=";
|
||||||
@@ -73,5 +87,18 @@ public class TransitionTargetPageNameKeyword {
|
|||||||
public static final String GOAL = "/goal";
|
public static final String GOAL = "/goal";
|
||||||
public static final String EDIT = "/edit";
|
public static final String EDIT = "/edit";
|
||||||
public static final String UPDATE = "/update";
|
public static final String UPDATE = "/update";
|
||||||
|
public static final String CREATE = "/create";
|
||||||
|
public static final String DELETE = "/delete";
|
||||||
|
public static final String RECORD = "/record";
|
||||||
|
|
||||||
|
public static final String CATEGORY_LIST = "/category/list";
|
||||||
|
public static final String CATEGORY_CREATE = "/category/create";
|
||||||
|
public static final String CATEGORY_UPDATE = "/category/update";
|
||||||
|
public static final String CATEGORY_DELETE = "/category/delete";
|
||||||
|
|
||||||
|
public static final String FIXED_COST_LIST = "/fixed-cost/list";
|
||||||
|
public static final String FIXED_COST_CREATE = "/fixed-cost/create";
|
||||||
|
public static final String FIXED_COST_DELETE = "/fixed-cost/delete";
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package com.example.demo.app.presentation.form;
|
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;
|
||||||
@@ -10,7 +12,9 @@ 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;
|
||||||
|
private LocalDate birthDate;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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:80px;">
|
<body style="padding-top:80px; padding-bottom:120px;">
|
||||||
|
|
||||||
<div th:replace="~{header :: header}"></div>
|
<div th:replace="~{header :: header}"></div>
|
||||||
|
|
||||||
|
|||||||
@@ -7,12 +7,6 @@
|
|||||||
</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>
|
||||||
|
|
||||||
|
|||||||
@@ -83,6 +83,7 @@
|
|||||||
|
|
||||||
<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");
|
||||||
@@ -90,6 +91,7 @@
|
|||||||
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 === "1") {
|
if (this.value === "1") {
|
||||||
|
|||||||
@@ -37,6 +37,10 @@
|
|||||||
<div>
|
<div>
|
||||||
<label>目標金額</label>
|
<label>目標金額</label>
|
||||||
<input type="number" th:field="*{targetAmount}" required min="1">
|
<input type="number" th:field="*{targetAmount}" required min="1">
|
||||||
|
<span th:text="|所持金:${currentAmount}円|"></span>
|
||||||
|
<span th:if="${message != null}">
|
||||||
|
<span th:text="${message}" style="color: red;"></span>
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
@@ -44,7 +48,7 @@
|
|||||||
<input type="date" th:field="*{deadline}"
|
<input type="date" th:field="*{deadline}"
|
||||||
th:min="${#temporals.format(#temporals.createNow(), 'yyyy-MM-dd')}" required>
|
th:min="${#temporals.format(#temporals.createNow(), 'yyyy-MM-dd')}" required>
|
||||||
</div>
|
</div>
|
||||||
<button type="submit" class="btn btn-sm btn-primary w-100">更新する</button>
|
<button type="submit" class="btn btn-sm btn-primary w-100">登録</button>
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
|||||||
@@ -112,7 +112,7 @@
|
|||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
|
|
||||||
<li th:each="goalForm : ${goalFormList}" class="transaction-item">
|
<li th:each="goalForm : ${goalFormList}">
|
||||||
|
|
||||||
<div class="d-flex justify-content-between">
|
<div class="d-flex justify-content-between">
|
||||||
|
|
||||||
|
|||||||
@@ -60,6 +60,10 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<span th:if="${message != null}">
|
||||||
|
<h4 th:text="${message}" style="color: red;"></h4>
|
||||||
|
</span>
|
||||||
|
|
||||||
<div class="d-grid">
|
<div class="d-grid">
|
||||||
|
|
||||||
<button type="submit"
|
<button type="submit"
|
||||||
|
|||||||
@@ -52,13 +52,15 @@
|
|||||||
|
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label">
|
<label class="form-label">
|
||||||
パスワード
|
生年月日
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<input type="password"
|
<input type="date"
|
||||||
class="form-control"
|
class="form-control"
|
||||||
value="********"
|
id="birthDate"
|
||||||
disabled>
|
name="birthDate"
|
||||||
|
th:value="*{birthDate}"
|
||||||
|
required>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
@@ -105,7 +107,7 @@
|
|||||||
<div class="d-grid">
|
<div class="d-grid">
|
||||||
<button type="submit"
|
<button type="submit"
|
||||||
class="btn btn-primary">
|
class="btn btn-primary">
|
||||||
確認
|
確定
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
<title>コース選択</title>
|
<title>コース選択</title>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body style="padding-bottom: 120px">
|
||||||
<div th:replace="~{header :: header}"></div>
|
<div th:replace="~{header :: header}"></div>
|
||||||
|
|
||||||
<h1 class="page-title">コース選択</h1>
|
<h1 class="page-title">コース選択</h1>
|
||||||
@@ -35,7 +35,7 @@
|
|||||||
</button>
|
</button>
|
||||||
</h2>
|
</h2>
|
||||||
<div th:id="'collapse' + ${course.courseId}" class="accordion-collapse collapse"
|
<div th:id="'collapse' + ${course.courseId}" class="accordion-collapse collapse"
|
||||||
data-bs-parent="#accordionExample">
|
data-bs-parent="#accordionExample" style="padding-bottom: 120px;">
|
||||||
<div class="accordion-body">
|
<div class="accordion-body">
|
||||||
<span th:text="${course.description}"></span>
|
<span th:text="${course.description}"></span>
|
||||||
<table class="table table-bordered">
|
<table class="table table-bordered">
|
||||||
|
|||||||
@@ -15,127 +15,158 @@
|
|||||||
|
|
||||||
<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}"
|
<form th:action="@{/transaction/create}" th:object="${transactionForm}" method="post">
|
||||||
th:object="${transactionForm}"
|
|
||||||
method="post">
|
|
||||||
|
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label for="transactionDate"
|
<label for="transactionDate" class="form-label">
|
||||||
class="form-label">
|
日付
|
||||||
日付
|
</label>
|
||||||
</label>
|
<input type="date" id="transactionDate" class="form-select" name="transactionDate"
|
||||||
<input type="date"
|
th:value="*{transactionDate}" required>
|
||||||
id="transactionDate"
|
|
||||||
class="form-select"
|
|
||||||
name="transactionDate"
|
|
||||||
th:value="*{transactionDate}"
|
|
||||||
required>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
|
|
||||||
<label for="transactionType"
|
<label for="transactionType" class="form-label">
|
||||||
class="form-label">
|
収入・支出
|
||||||
収入・支出
|
</label>
|
||||||
</label>
|
|
||||||
|
|
||||||
<select id="transactionType"
|
<select id="transactionType" class="form-select" name="transactionType" required>
|
||||||
class="form-select"
|
|
||||||
th:field="*{transactionType}"
|
|
||||||
required>
|
|
||||||
|
|
||||||
<option value="">
|
<option value="">
|
||||||
選択してください
|
選択してください
|
||||||
</option>
|
</option>
|
||||||
|
|
||||||
<option value="1">
|
<option value="1">
|
||||||
支出
|
支出
|
||||||
</option>
|
</option>
|
||||||
|
|
||||||
<option value="2">
|
<option value="2">
|
||||||
収入
|
収入
|
||||||
</option>
|
</option>
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
|
|
||||||
<label for="categoryId"
|
<label for="categoryId" class="form-label">
|
||||||
class="form-label">
|
カテゴリ
|
||||||
カテゴリ
|
</label>
|
||||||
</label>
|
|
||||||
|
|
||||||
<select id="categoryId"
|
<select id="categoryId" class="form-select" th:field="*{categoryId}" required>
|
||||||
class="form-select"
|
|
||||||
th:field="*{categoryId}"
|
|
||||||
required>
|
|
||||||
|
|
||||||
<option value="">
|
<option value="">
|
||||||
選択してください
|
選択してください
|
||||||
</option>
|
</option>
|
||||||
|
|
||||||
<option th:each="category : ${categoryFormList}"
|
<option class="expenseListClass" th:each="category : ${expenseList}"
|
||||||
th:value="${category.categoryId}"
|
th:value="${category.categoryId}" th:text="${category.categoryName}">
|
||||||
th:text="${category.categoryName}">
|
</option>
|
||||||
</option>
|
|
||||||
|
|
||||||
</select>
|
<option class="incomeListClass" th:each="category : ${incomeList}"
|
||||||
|
th:value="${category.categoryId}" th:text="${category.categoryName}">
|
||||||
|
</option>
|
||||||
|
|
||||||
</div>
|
</select>
|
||||||
|
|
||||||
<div class="mb-3">
|
</div>
|
||||||
|
|
||||||
<label for="amount"
|
<div class="mb-3">
|
||||||
class="form-label">
|
|
||||||
金額
|
|
||||||
</label>
|
|
||||||
|
|
||||||
<input type="number"
|
<label for="amount" class="form-label">
|
||||||
id="amount"
|
金額
|
||||||
class="form-control"
|
</label>
|
||||||
th:field="*{amount}"
|
|
||||||
min="0"
|
|
||||||
max="100000000"
|
|
||||||
placeholder="金額を入力してください"
|
|
||||||
required>
|
|
||||||
|
|
||||||
</div>
|
<input type="number" id="amount" class="form-control" th:field="*{amount}" min="1"
|
||||||
|
max="100000000" placeholder="金額を入力してください" required>
|
||||||
|
|
||||||
<input type="hidden"
|
</div>
|
||||||
name="today"
|
|
||||||
th:value="${today}">
|
|
||||||
|
|
||||||
<div class="d-grid">
|
<input type="hidden" name="today" th:value="${today}">
|
||||||
|
|
||||||
<button type="submit"
|
<div class="d-grid">
|
||||||
class="btn btn-primary">
|
|
||||||
|
|
||||||
登録
|
<button type="submit" class="btn btn-primary">
|
||||||
|
|
||||||
</button>
|
登録
|
||||||
|
|
||||||
</div>
|
</button>
|
||||||
|
|
||||||
</form>
|
</div>
|
||||||
|
|
||||||
</div>
|
</form>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div th:replace="~{footer :: footer}"></div>
|
<div th:replace="~{footer :: footer}"></div>
|
||||||
|
|
||||||
|
<script inline="javascript">
|
||||||
|
const transactionType = document.getElementById("transactionType");
|
||||||
|
const categoryId = document.getElementById("categoryId");
|
||||||
|
|
||||||
|
const expenseList = document.getElementsByClassName("expenseListClass");
|
||||||
|
const incomeList = document.getElementsByClassName("incomeListClass");
|
||||||
|
|
||||||
|
const tType = '[[${session.tType}]]';
|
||||||
|
|
||||||
|
if (tType == "0") {
|
||||||
|
transactionType.value = 1;
|
||||||
|
} else {
|
||||||
|
transactionType.value = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
transactionType.addEventListener("change", function () {
|
||||||
|
|
||||||
|
if (this.value === "1") {
|
||||||
|
|
||||||
|
for (let i = 0; i < expenseList.length; i++) {
|
||||||
|
expenseList[i].style.display = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
for (let i = 0; i < incomeList.length; i++) {
|
||||||
|
incomeList[i].style.display = "none";
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (this.value === "2") {
|
||||||
|
|
||||||
|
for (let i = 0; i < expenseList.length; i++) {
|
||||||
|
expenseList[i].style.display = "none";
|
||||||
|
}
|
||||||
|
|
||||||
|
for (let i = 0; i < incomeList.length; i++) {
|
||||||
|
incomeList[i].style.display = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
for (let i = 0; i < expenseList.length; i++) {
|
||||||
|
expenseList[i].style.display = "none";
|
||||||
|
}
|
||||||
|
|
||||||
|
for (let i = 0; i < incomeList.length; i++) {
|
||||||
|
incomeList[i].style.display = "none";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
categoryId.value = "";
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
|
|||||||
@@ -90,6 +90,7 @@
|
|||||||
|
|
||||||
<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,20 +104,48 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
<div class="d-grid mt-4">
|
||||||
|
|
||||||
<form th:action="@{/transaction/create}" method="get">
|
<form th:action="@{/fixed-cost/list}" method="get">
|
||||||
<input type="hidden" name="today" id="today" th:value="${today}">
|
|
||||||
<button type="submit">新規登録</button>
|
<input type="hidden"
|
||||||
</form>
|
name="today"
|
||||||
<form th:action="@{/fixed-cost/list}" method="get">
|
id="today"
|
||||||
<input type="hidden" name="today" th:value="${today}">
|
th:value="${today}">
|
||||||
<button type="submit">固定費一覧</button>
|
|
||||||
</form>
|
<button class="btn btn-dark w-100"
|
||||||
<form th:action="@{/category/list}" method="get">
|
type="submit">
|
||||||
<input type="hidden" name="today" th:value="${today}">
|
|
||||||
<button type="submit">カテゴリ一覧</button>
|
固定費一覧
|
||||||
</form>
|
|
||||||
|
</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 th:replace="~{footer :: footer}"></div>
|
<div th:replace="~{footer :: footer}"></div>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@@ -2,229 +2,192 @@
|
|||||||
<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"
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
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"
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
rel="stylesheet">
|
|
||||||
|
|
||||||
<link rel="stylesheet"
|
<link rel="stylesheet" th:href="@{/css/style.css}">
|
||||||
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}"
|
<form th:action="@{/user/register/course}" th:object="${userForm}" method="post">
|
||||||
th:object="${userForm}"
|
|
||||||
method="post">
|
|
||||||
|
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label for="userName"
|
<label for="userName" class="form-label">
|
||||||
class="form-label">
|
氏名
|
||||||
氏名
|
</label>
|
||||||
</label>
|
|
||||||
|
|
||||||
<input type="text"
|
<input type="text" id="userName" class="form-control" th:field="*{userName}" maxlength="100"
|
||||||
id="userName"
|
required>
|
||||||
class="form-control"
|
</div>
|
||||||
th:field="*{userName}"
|
|
||||||
maxlength="100"
|
|
||||||
required>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label for="mailAddress"
|
<label for="mailAddress" class="form-label">
|
||||||
class="form-label">
|
メールアドレス
|
||||||
メールアドレス
|
</label>
|
||||||
</label>
|
|
||||||
|
|
||||||
<input type="email"
|
<input type="email" id="mailAddress" class="form-control" th:field="*{mailAddress}"
|
||||||
id="mailAddress"
|
maxlength="255" required>
|
||||||
class="form-control"
|
</div>
|
||||||
th:field="*{mailAddress}"
|
|
||||||
maxlength="255"
|
|
||||||
required>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label for="birthDate"
|
<label for="birthDate" class="form-label">
|
||||||
class="form-label">
|
生年月日
|
||||||
生年月日
|
</label>
|
||||||
</label>
|
|
||||||
|
|
||||||
<input type="date"
|
<input type="date" id="birthDate" class="form-control" th:field="*{birthDate}" required>
|
||||||
id="birthDate"
|
</div>
|
||||||
class="form-control"
|
|
||||||
th:field="*{birthDate}"
|
|
||||||
required>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label for="password"
|
<label for="password" class="form-label">
|
||||||
class="form-label">
|
パスワード
|
||||||
パスワード
|
</label>
|
||||||
</label>
|
|
||||||
|
|
||||||
<input type="password"
|
<input type="password" id="password" class="form-control" th:field="*{password}" minlength="8"
|
||||||
id="password"
|
maxlength="24" required>
|
||||||
class="form-control"
|
</div>
|
||||||
th:field="*{password}"
|
|
||||||
minlength="8"
|
|
||||||
maxlength="24"
|
|
||||||
required>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label for="secretQuestionId"
|
<label for="secretQuestionId" class="form-label">
|
||||||
class="form-label">
|
秘密の質問
|
||||||
秘密の質問
|
</label>
|
||||||
</label>
|
|
||||||
|
|
||||||
<select id="secretQuestionId"
|
<select id="secretQuestionId" class="form-select" th:field="*{secretQuestionId}" required>
|
||||||
class="form-select"
|
|
||||||
th:field="*{secretQuestionId}"
|
|
||||||
required>
|
|
||||||
|
|
||||||
<option value="">
|
<option value="">
|
||||||
選択してください
|
選択してください
|
||||||
</option>
|
</option>
|
||||||
|
|
||||||
<option th:each="question : ${session.questionList}"
|
<option th:each="question : ${session.questionList}" th:value="${question.secretQuestionId}"
|
||||||
th:value="${question.secretQuestionId}"
|
th:text="${question.questionText}">
|
||||||
th:text="${question.questionText}">
|
</option>
|
||||||
</option>
|
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label for="secretAnswer"
|
<label for="secretAnswer" class="form-label">
|
||||||
class="form-label">
|
秘密の質問の回答
|
||||||
秘密の質問の回答
|
</label>
|
||||||
</label>
|
|
||||||
|
|
||||||
<input type="text"
|
<input type="text" id="secretAnswer" class="form-control" th:field="*{secretAnswer}"
|
||||||
id="secretAnswer"
|
maxlength="100" required>
|
||||||
class="form-control"
|
</div>
|
||||||
th:field="*{secretAnswer}"
|
|
||||||
maxlength="100"
|
|
||||||
required>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label for="saving"
|
<label for="saving" class="form-label">
|
||||||
class="form-label">
|
貯蓄金
|
||||||
貯蓄金
|
</label>
|
||||||
</label>
|
|
||||||
|
|
||||||
<input type="number"
|
<input type="number" id="saving" class="form-control" th:field="*{saving}" min="0"
|
||||||
id="saving"
|
max="1000000000" required>
|
||||||
class="form-control"
|
</div>
|
||||||
th:field="*{saving}"
|
|
||||||
min="0"
|
|
||||||
max="1000000000"
|
|
||||||
required>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label for="annualIncome"
|
<label for="annualIncome" class="form-label">
|
||||||
class="form-label">
|
年収
|
||||||
年収
|
</label>
|
||||||
</label>
|
|
||||||
|
|
||||||
<input type="number"
|
<input type="number" id="annualIncome" class="form-control" th:field="*{annualIncome}" min="0"
|
||||||
id="annualIncome"
|
max="100000000" required>
|
||||||
class="form-control"
|
</div>
|
||||||
th:field="*{annualIncome}"
|
|
||||||
min="0"
|
|
||||||
max="100000000"
|
|
||||||
required>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label for="monthlyBudget"
|
<label for="monthlyBudget" class="form-label">
|
||||||
class="form-label">
|
月別使用可能金額
|
||||||
月別使用可能金額
|
</label>
|
||||||
</label>
|
|
||||||
|
|
||||||
<input type="number"
|
<input type="number" id="monthlyBudget" class="form-control" th:field="*{monthlyBudget}" min="0"
|
||||||
id="monthlyBudget"
|
max="10000000" required>
|
||||||
class="form-control"
|
</div>
|
||||||
th:field="*{monthlyBudget}"
|
|
||||||
min="0"
|
|
||||||
max="10000000"
|
|
||||||
required>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label for="goalId"
|
<label for="goalId" class="form-label">
|
||||||
class="form-label">
|
目標貯金額
|
||||||
目標貯金額
|
</label>
|
||||||
</label>
|
|
||||||
|
|
||||||
<input type="number"
|
<input type="number" id="goalId" class="form-control" th:field="*{goalId}" min="0"
|
||||||
id="goalId"
|
max="1000000000" required>
|
||||||
class="form-control"
|
</div>
|
||||||
th:field="*{goalId}"
|
|
||||||
min="0"
|
|
||||||
max="1000000000"
|
|
||||||
required>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<input type="hidden"
|
<input type="hidden" th:field="*{courseId}">
|
||||||
th:field="*{courseId}">
|
|
||||||
|
|
||||||
<div class="d-grid gap-2 mt-4">
|
<div class="d-grid gap-2 mt-4">
|
||||||
|
|
||||||
<button type="submit"
|
<button type="submit" class="btn btn-outline-primary">
|
||||||
class="btn btn-outline-primary">
|
コース選択
|
||||||
コース選択
|
</button>
|
||||||
</button>
|
|
||||||
|
|
||||||
<button type="submit"
|
<button type="submit" class="btn btn-primary">
|
||||||
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}"
|
<form th:action="@{/login}" method="get">
|
||||||
method="get">
|
|
||||||
|
|
||||||
<button type="submit"
|
<button type="submit" class="btn btn-outline-secondary">
|
||||||
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>
|
||||||
|
|
||||||
|
|||||||
@@ -44,10 +44,10 @@
|
|||||||
|
|
||||||
<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 readonly>
|
<select id="secretQuestionId" th:field="*{secretQuestionId}" required disabled>
|
||||||
<option value="">選択してください</option>
|
<option value="" readonly>選択してください</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}">
|
th:text="${question.questionText}" readonly>
|
||||||
</option>
|
</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
@@ -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">コース選択</button>
|
<button type="submit" class="btn btn-outline-primary btn-sm" disabled>コース選択</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -1,15 +1,17 @@
|
|||||||
<!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">
|
||||||
|
|
||||||
@@ -17,137 +19,127 @@
|
|||||||
|
|
||||||
<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">
|
<form th:action="@{/user/register/confirm}" th:object="${userForm}" method="get">
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label for="userName" class="form-label">氏名</label>
|
<label for="userName" class="form-label">氏名</label>
|
||||||
<input type="text"
|
<input type="text" id="userName" class="form-control" th:field="*{userName}" maxlength="100"
|
||||||
id="userName"
|
required>
|
||||||
class="form-control"
|
</div>
|
||||||
th:field="*{userName}"
|
|
||||||
maxlength="100"
|
|
||||||
required>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label for="mailAddress" class="form-label">メールアドレス</label>
|
<label for="mailAddress" class="form-label">メールアドレス</label>
|
||||||
<input type="email"
|
<input type="email" id="mailAddress" class="form-control" th:field="*{mailAddress}"
|
||||||
id="mailAddress"
|
maxlength="255" required>
|
||||||
class="form-control"
|
</div>
|
||||||
th:field="*{mailAddress}"
|
|
||||||
maxlength="255"
|
<div class="mb-3">
|
||||||
required>
|
<label for="birthDate" class="form-label">生年月日</label>
|
||||||
</div>
|
<input type="date" id="birthDate" name="birthDate" class="form-control" th:value="*{birthDate}"
|
||||||
|
required>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="password" class="form-label">パスワード</label>
|
||||||
|
<input type="password" id="password" name="password" class="form-control" th:value="*{password}"
|
||||||
|
minlength="8" maxlength="24" required>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="secretQuestionId" class="form-label">秘密の質問</label>
|
||||||
|
<select id="secretQuestionId" th:field="*{secretQuestionId}" required>
|
||||||
|
<option value="">選択してください</option>
|
||||||
|
<option th:each="question : ${session.questionList}" th:value="${question.secretQuestionId}"
|
||||||
|
th:text="${question.questionText}">
|
||||||
|
</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="secretAnswer" class="form-label">秘密の質問の回答</label>
|
||||||
|
<input type="text" id="secretAnswer" class="form-control" th:field="*{secretAnswer}"
|
||||||
|
maxlength="100" required>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="saving" class="form-label">貯蓄金</label>
|
||||||
|
<input type="number" id="saving" class="form-control" th:field="*{saving}" min="0" required>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="annualIncome" class="form-label">年収</label>
|
||||||
|
<input type="number" id="annualIncome" class="form-control" th:field="*{annualIncome}" min="0"
|
||||||
|
required>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="monthlyBudget" class="form-label">月別使用可能金額</label>
|
||||||
|
<input type="number" id="monthlyBudget" class="form-control" th:field="*{monthlyBudget}" min="0"
|
||||||
|
required>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="goalId" class="form-label">目標</label>
|
||||||
|
<input type="number" id="goalId" class="form-control" th:field="*{goalId}" min="0" required>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mb-4">
|
||||||
|
<label class="form-label">コース</label>
|
||||||
|
<div class="d-flex justify-content-between align-items-center">
|
||||||
|
<input type="hidden" th:field="*{courseId}">
|
||||||
|
<span th:text="${selectedCourseName}">未選択</span>
|
||||||
|
<button class="btn btn-outline-primary btn-sm" disabled>
|
||||||
|
コース選択
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="d-grid">
|
||||||
|
<button type="submit" class="btn btn-primary">作成</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
<div class="mb-3">
|
|
||||||
<label for="birthDate" class="form-label">生年月日</label>
|
|
||||||
<input type="date" id="birthDate" name="birthDate" class="form-control" th:value="*{birthDate}"
|
|
||||||
required>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<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 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>
|
||||||
|
|
||||||
<div class="d-grid mt-3">
|
<div class="d-grid mt-3">
|
||||||
<form th:action="@{/login}" method="get">
|
<form th:action="@{/login}" method="get">
|
||||||
<button type="submit" class="btn btn-outline-secondary">戻る</button>
|
<button type="submit" class="btn btn-outline-secondary">戻る</button>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
<script>
|
||||||
|
|
||||||
|
const date = new Date();
|
||||||
|
|
||||||
|
const year = date.getFullYear();
|
||||||
|
const month = date.getMonth() + 1;
|
||||||
|
const day = date.getDate();
|
||||||
|
|
||||||
|
const birthDate = document.getElementById("birthDate");
|
||||||
|
|
||||||
|
if (month < 10) {
|
||||||
|
if (day < 10) {
|
||||||
|
birthDate.setAttribute("max", year + "-0" + month + "-0" + day);
|
||||||
|
} else {
|
||||||
|
birthDate.setAttribute("max", year + "-0" + month + "-" + day);
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
if (day < 10) {
|
||||||
|
birthDate.setAttribute("max", year + "-" + month + "-0" + day);
|
||||||
|
} else {
|
||||||
|
birthDate.setAttribute("max", year + "-" + month + "-" + day);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
Reference in New Issue
Block a user