Compare commits
11 Commits
s-morimoto
...
acd7534fdb
| Author | SHA1 | Date | |
|---|---|---|---|
| acd7534fdb | |||
| ee5ec5009d | |||
| 7604e9ee76 | |||
| 26fa2365e8 | |||
| 5adb527d7a | |||
| e54e0133f7 | |||
| c3dae348bf | |||
| ea1e18ad93 | |||
| bb3b8965b2 | |||
| 3b239d07bd | |||
| 0c54a42b97 |
@@ -10,7 +10,6 @@ import org.aspectj.lang.annotation.Pointcut;
|
|||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import com.example.demo.app.presentation.controller.pageproperty.SessionKeyword;
|
|
||||||
import com.example.demo.exception.NoSessionException;
|
import com.example.demo.exception.NoSessionException;
|
||||||
|
|
||||||
|
|
||||||
@@ -33,7 +32,7 @@ public class SessionCheckAspect {
|
|||||||
public void checkSession() {
|
public void checkSession() {
|
||||||
HttpSession session = request.getSession(false);
|
HttpSession session = request.getSession(false);
|
||||||
|
|
||||||
if (session == null || session.getAttribute(SessionKeyword.LOGIN_USER) == null) {
|
if (session == null || session.getAttribute("loginUser") == null) {
|
||||||
throw new NoSessionException("不正なログインです");
|
throw new NoSessionException("不正なログインです");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,8 +12,6 @@ import org.springframework.web.HttpRequestMethodNotSupportedException;
|
|||||||
import org.springframework.web.bind.annotation.ControllerAdvice;
|
import org.springframework.web.bind.annotation.ControllerAdvice;
|
||||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||||
|
|
||||||
import com.example.demo.app.presentation.controller.pageproperty.PageReturnAttributeKeyword;
|
|
||||||
import com.example.demo.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword;
|
|
||||||
import com.example.demo.exception.NoSessionException;
|
import com.example.demo.exception.NoSessionException;
|
||||||
|
|
||||||
@ControllerAdvice
|
@ControllerAdvice
|
||||||
@@ -32,36 +30,40 @@ public class GlobalExceptionHandler {
|
|||||||
LOGGER.log(Level.SEVERE, SEVERE_ERROR_MESSAGE_ILLEGAL_TRANSITION, e);
|
LOGGER.log(Level.SEVERE, SEVERE_ERROR_MESSAGE_ILLEGAL_TRANSITION, e);
|
||||||
|
|
||||||
model.addAttribute(
|
model.addAttribute(
|
||||||
PageReturnAttributeKeyword.ERROR_MESSAGE,
|
"errorMessage",
|
||||||
"システムエラーが発生しました。"
|
"システムエラーが発生しました。"
|
||||||
+ "初めからやり直してください。");
|
+ "初めからやり直してください。");
|
||||||
|
|
||||||
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.LOGIN;
|
return "redirect:/login";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ExceptionHandler(HttpRequestMethodNotSupportedException.class)
|
@ExceptionHandler(HttpRequestMethodNotSupportedException.class)
|
||||||
public String handleBadRequestException(Model model, Exception e, HttpSession session) {
|
public String handleBadRequestException(Model model, Exception e, HttpSession session) {
|
||||||
model.addAttribute(PageReturnAttributeKeyword.ERROR, SEVERE_ERROR_MESSAGE_BAD_REQUEST);
|
model.addAttribute("error", SEVERE_ERROR_MESSAGE_BAD_REQUEST);
|
||||||
model.addAttribute(PageReturnAttributeKeyword.STATUS, HttpStatus.BAD_REQUEST.value());
|
model.addAttribute("status", HttpStatus.BAD_REQUEST.value());
|
||||||
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|
||||||
LOGGER.log(Level.SEVERE, SEVERE_ERROR_MESSAGE_ILLEGAL_TRANSITION, e);
|
LOGGER.log(Level.SEVERE, SEVERE_ERROR_MESSAGE_ILLEGAL_TRANSITION, e);
|
||||||
|
|
||||||
System.out.println("session invalidated method not supported exception");
|
System.out.println("session invalidated");
|
||||||
session.invalidate();
|
session.invalidate();
|
||||||
|
|
||||||
return TransitionTargetPageNameKeyword.ERROR_HTML;
|
return "error";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ExceptionHandler(Exception.class)
|
@ExceptionHandler(Exception.class)
|
||||||
public String AllException(Model model, Exception e, HttpSession session) {
|
public String AllException(Model model, Exception e, HttpSession session) {
|
||||||
|
model.addAttribute("error", SEVERE_ERROR_MESSAGE_BAD_REQUEST);
|
||||||
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|
||||||
System.out.println("session invalidated exception");
|
LOGGER.log(Level.SEVERE, SEVERE_ERROR_MESSAGE_ILLEGAL_TRANSITION, e);
|
||||||
|
|
||||||
|
System.out.println("session invalidated");
|
||||||
session.invalidate();
|
session.invalidate();
|
||||||
return TransitionTargetPageNameKeyword.ERROR_HTML;
|
|
||||||
|
return "error";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ public class GoalModel {
|
|||||||
goalModel.getTargetAmount(),
|
goalModel.getTargetAmount(),
|
||||||
goalModel.getDeadline(),
|
goalModel.getDeadline(),
|
||||||
0,
|
0,
|
||||||
userEntity);
|
userEntity, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static GoalModel convertFrom(GoalForm goalForm) {
|
public static GoalModel convertFrom(GoalForm goalForm) {
|
||||||
|
|||||||
@@ -8,4 +8,6 @@ public interface AllocationService {
|
|||||||
|
|
||||||
public List<AllocationModel> findAll();
|
public List<AllocationModel> findAll();
|
||||||
|
|
||||||
|
public List<AllocationModel> save(List<AllocationModel> allocationModelList);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package com.example.demo.app.domain.service;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.example.demo.app.domain.model.CourseModel;
|
import com.example.demo.app.domain.model.CourseModel;
|
||||||
import com.example.demo.app.presentation.form.AllocationFormList;
|
|
||||||
|
|
||||||
public interface CourseService {
|
public interface CourseService {
|
||||||
|
|
||||||
@@ -13,14 +12,12 @@ public interface CourseService {
|
|||||||
|
|
||||||
public Long findByName(String courName);
|
public Long findByName(String courName);
|
||||||
|
|
||||||
public CourseModel save(CourseModel courseModel, Long userId, AllocationFormList allocationFormList);
|
public CourseModel save(CourseModel courseModel, Long userId);
|
||||||
|
|
||||||
public List<CourseModel> findAllByUserId(Long userId);
|
public List<CourseModel> findAllByUserId(Long userId);
|
||||||
|
|
||||||
public List<CourseModel> findAllByNull();
|
public List<CourseModel> findAllByNull();
|
||||||
|
|
||||||
public String deleteCourse(Long courseId, Long userId);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.example.demo.app.domain.service.impl;
|
package com.example.demo.app.domain.service.impl;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@@ -25,5 +26,26 @@ public class AllocationServiceImpl implements AllocationService {
|
|||||||
return AllocationEntity.createAllocationModelList(allocationRepository.findAll());
|
return AllocationEntity.createAllocationModelList(allocationRepository.findAll());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<AllocationModel> save(List<AllocationModel> allocationModelList) {
|
||||||
|
|
||||||
|
List<AllocationEntity> allocationEntityList = new ArrayList<>();
|
||||||
|
|
||||||
|
allocationModelList.forEach(allocationModel -> {
|
||||||
|
allocationEntityList.add(
|
||||||
|
AllocationModel.convertTo(
|
||||||
|
categoryRepository.findById(allocationModel.getCategoryId()).get(),
|
||||||
|
courseRepository.findById(allocationModel.getCourseId()).get(),
|
||||||
|
allocationModel.getAllocationRatio()));
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
List<AllocationModel> result = new ArrayList<>();
|
||||||
|
for (AllocationEntity allocationEntity : allocationEntityList) {
|
||||||
|
result.add(AllocationModel.convertFrom(allocationRepository.save(allocationEntity)));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,19 +7,14 @@ import jakarta.transaction.Transactional;
|
|||||||
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import com.example.demo.app.domain.model.AllocationModel;
|
|
||||||
import com.example.demo.app.domain.model.CourseModel;
|
import com.example.demo.app.domain.model.CourseModel;
|
||||||
import com.example.demo.app.domain.service.CourseService;
|
import com.example.demo.app.domain.service.CourseService;
|
||||||
import com.example.demo.app.infra.entity.AllocationEntity;
|
|
||||||
import com.example.demo.app.infra.entity.CourseEntity;
|
import com.example.demo.app.infra.entity.CourseEntity;
|
||||||
import com.example.demo.app.infra.entity.CourseOwnerEntity;
|
import com.example.demo.app.infra.entity.CourseOwnerEntity;
|
||||||
import com.example.demo.app.infra.entity.UserEntity;
|
import com.example.demo.app.infra.entity.UserEntity;
|
||||||
import com.example.demo.app.infra.repository.AllocationRepository;
|
|
||||||
import com.example.demo.app.infra.repository.CategoryRepository;
|
|
||||||
import com.example.demo.app.infra.repository.CourseOwnerRepository;
|
import com.example.demo.app.infra.repository.CourseOwnerRepository;
|
||||||
import com.example.demo.app.infra.repository.CourseRepository;
|
import com.example.demo.app.infra.repository.CourseRepository;
|
||||||
import com.example.demo.app.infra.repository.UserRepository;
|
import com.example.demo.app.infra.repository.UserRepository;
|
||||||
import com.example.demo.app.presentation.form.AllocationFormList;
|
|
||||||
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
||||||
@@ -27,14 +22,11 @@ import lombok.RequiredArgsConstructor;
|
|||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class CourseServiceImpl implements CourseService {
|
public class CourseServiceImpl implements CourseService {
|
||||||
|
|
||||||
private final AllocationRepository allocationRepository;
|
|
||||||
|
|
||||||
private final CourseRepository courseRepository;
|
private final CourseRepository courseRepository;
|
||||||
private final UserRepository userRepository;
|
private final UserRepository userRepository;
|
||||||
private final CourseOwnerRepository courseOwnerRepository;
|
private final CourseOwnerRepository courseOwnerRepository;
|
||||||
private final CategoryRepository categoryRepository;
|
|
||||||
|
|
||||||
public List<CourseModel> findAll() {
|
public List<CourseModel> findAll(){
|
||||||
|
|
||||||
return CourseEntity.createCourseModelList(courseRepository.findAll());
|
return CourseEntity.createCourseModelList(courseRepository.findAll());
|
||||||
}
|
}
|
||||||
@@ -57,42 +49,11 @@ public class CourseServiceImpl implements CourseService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
public CourseModel save(CourseModel courseModel, Long userId, AllocationFormList allocationFormList) {
|
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));
|
CourseEntity result = courseRepository.save( CourseModel.convertTo(courseModel));
|
||||||
|
|
||||||
List<AllocationModel> allocationModelList = new ArrayList<>();
|
|
||||||
|
|
||||||
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId4(),
|
|
||||||
result.getCourseId(),
|
|
||||||
allocationFormList.getAllocationRatio4()));
|
|
||||||
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId5(),
|
|
||||||
result.getCourseId(),
|
|
||||||
allocationFormList.getAllocationRatio5()));
|
|
||||||
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId6(),
|
|
||||||
result.getCourseId(),
|
|
||||||
allocationFormList.getAllocationRatio6()));
|
|
||||||
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId7(),
|
|
||||||
result.getCourseId(),
|
|
||||||
allocationFormList.getAllocationRatio7()));
|
|
||||||
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId8(),
|
|
||||||
result.getCourseId(),
|
|
||||||
allocationFormList.getAllocationRatio8()));
|
|
||||||
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId9(),
|
|
||||||
result.getCourseId(),
|
|
||||||
allocationFormList.getAllocationRatio9()));
|
|
||||||
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId10(),
|
|
||||||
result.getCourseId(),
|
|
||||||
allocationFormList.getAllocationRatio10()));
|
|
||||||
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId11(),
|
|
||||||
result.getCourseId(),
|
|
||||||
allocationFormList.getAllocationRatio11()));
|
|
||||||
|
|
||||||
allocationModelList.stream().forEach(allocation -> {
|
|
||||||
System.out.println(allocation.getCourseId());
|
|
||||||
});
|
|
||||||
|
|
||||||
UserEntity user = userRepository.findById(userId).orElse(null);
|
UserEntity user = userRepository.findById(userId).orElse(null);
|
||||||
|
|
||||||
@@ -106,44 +67,8 @@ public class CourseServiceImpl implements CourseService {
|
|||||||
|
|
||||||
courseOwnerRepository.save(courseOwnerEntity);
|
courseOwnerRepository.save(courseOwnerEntity);
|
||||||
|
|
||||||
List<AllocationEntity> allocationEntityList = new ArrayList<>();
|
|
||||||
|
|
||||||
allocationModelList.forEach(allocationModel -> {
|
|
||||||
allocationEntityList.add(
|
|
||||||
AllocationModel.convertTo(
|
|
||||||
categoryRepository.findById(allocationModel.getCategoryId()).get(),
|
|
||||||
courseRepository.findById(allocationModel.getCourseId()).get(),
|
|
||||||
allocationModel.getAllocationRatio()));
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
List<AllocationModel> resultList = new ArrayList<>();
|
|
||||||
for (AllocationEntity allocationEntity : allocationEntityList) {
|
|
||||||
resultList.add(AllocationModel.convertFrom(allocationRepository.save(allocationEntity)));
|
|
||||||
}
|
|
||||||
|
|
||||||
return CourseModel.convertFrom(result);
|
return CourseModel.convertFrom(result);
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Transactional
|
|
||||||
public String deleteCourse(Long courseId, Long userId) {
|
|
||||||
|
|
||||||
UserEntity userEntity = userRepository.findById(userId).orElse(null);
|
|
||||||
System.out.println("***********************ここでエラー1");
|
|
||||||
if (userEntity.getCourseEntity().getCourseId() == courseId) {
|
|
||||||
return "selected";
|
|
||||||
} else if (courseId <= 6) {
|
|
||||||
return "original";
|
|
||||||
}
|
|
||||||
System.out.println("***********************ここでエラー2");
|
|
||||||
allocationRepository.deleteByCourseId(courseId);
|
|
||||||
System.out.println("***********************ここでエラー3");
|
|
||||||
courseOwnerRepository.deleteByCourseId(courseId);
|
|
||||||
System.out.println("***********************ここでエラー4");
|
|
||||||
courseRepository.deleteById(courseId);
|
|
||||||
System.out.println("***********************ここでエラー5");
|
|
||||||
return "ok";
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,8 +25,6 @@ public class LoginServiceImpl implements LoginService {
|
|||||||
|
|
||||||
if (userEntity == null) {
|
if (userEntity == null) {
|
||||||
return null;
|
return null;
|
||||||
} else if (userEntity.getDeleteFlag() == 1) {
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean isValidPassword = false;
|
boolean isValidPassword = false;
|
||||||
|
|||||||
@@ -53,13 +53,13 @@ public class UserServiceImpl implements UserService {
|
|||||||
|
|
||||||
userEntity.setQuestionEntity(questionEntity);
|
userEntity.setQuestionEntity(questionEntity);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
userEntity.setCourseEntity(courseEntity);
|
userEntity.setCourseEntity(courseEntity);
|
||||||
|
|
||||||
userEntity.setDeleteFlag(0);
|
userEntity.setDeleteFlag(0);
|
||||||
|
|
||||||
goalEntity.setUserEntity(userRepository.save(userEntity));
|
userRepository.save(userEntity);
|
||||||
|
|
||||||
goalRepository.save(goalEntity);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ public class CategoryEntity {
|
|||||||
@Column(name = "category_id")
|
@Column(name = "category_id")
|
||||||
private Long categoryId;
|
private Long categoryId;
|
||||||
|
|
||||||
@Column(name = "category_name", nullable = false, length = 50)
|
@Column(name = "category_name", nullable = false)
|
||||||
private String categoryName;
|
private String categoryName;
|
||||||
|
|
||||||
@Column(name = "transaction_type", nullable = false)
|
@Column(name = "transaction_type", nullable = false)
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ public class CourseEntity {
|
|||||||
@Column(name = "course_id")
|
@Column(name = "course_id")
|
||||||
private Long courseId;
|
private Long courseId;
|
||||||
|
|
||||||
@Column(name = "course_name", nullable = false, length = 50)
|
@Column(name = "course_name", nullable = false)
|
||||||
private String courseName;
|
private String courseName;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ public class FixedCostEntity {
|
|||||||
@JoinColumn(name = "category_id")
|
@JoinColumn(name = "category_id")
|
||||||
private CategoryEntity categoryEntity;
|
private CategoryEntity categoryEntity;
|
||||||
|
|
||||||
@Column(name = "fixed_cost_name", nullable = false, length = 50)
|
@Column(name = "fixed_cost_name", nullable = false)
|
||||||
private String fixedCostName;
|
private String fixedCostName;
|
||||||
|
|
||||||
@Column(name = "amount", nullable = false)
|
@Column(name = "amount", nullable = false)
|
||||||
|
|||||||
@@ -29,10 +29,10 @@ public class GoalEntity {
|
|||||||
private Long goalId;
|
private Long goalId;
|
||||||
|
|
||||||
@Column(name = "goal_title", nullable = true)
|
@Column(name = "goal_title", nullable = true)
|
||||||
private String goalTitle = "名前を設定してください";
|
private String goalTitle;
|
||||||
|
|
||||||
@Column(name = "goal_subtitle", nullable = true)
|
@Column(name = "goal_subtitle", nullable = true)
|
||||||
private String goalSubtitle = "説明を書いてください";
|
private String goalSubtitle;
|
||||||
|
|
||||||
@Column(name = "target_amount", nullable = true)
|
@Column(name = "target_amount", nullable = true)
|
||||||
private Integer targetAmount;
|
private Integer targetAmount;
|
||||||
@@ -47,4 +47,6 @@ public class GoalEntity {
|
|||||||
@JoinColumn(name = "user_id")
|
@JoinColumn(name = "user_id")
|
||||||
private UserEntity userEntity;
|
private UserEntity userEntity;
|
||||||
|
|
||||||
|
private Integer deleteFlag;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
package com.example.demo.app.infra.entity;
|
|
||||||
|
|
||||||
public class TestController6 {
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -30,7 +30,7 @@ public class UserEntity {
|
|||||||
@Column(name = "user_id")
|
@Column(name = "user_id")
|
||||||
private Long userId;
|
private Long userId;
|
||||||
|
|
||||||
@Column(name = "user_name", nullable = false, length = 100)
|
@Column(name = "user_name", nullable = false)
|
||||||
private String userName;
|
private String userName;
|
||||||
|
|
||||||
@Column(name = "mail_address", nullable = false)
|
@Column(name = "mail_address", nullable = false)
|
||||||
@@ -39,7 +39,7 @@ public class UserEntity {
|
|||||||
@Column(name = "password", nullable = false)
|
@Column(name = "password", nullable = false)
|
||||||
private String password;
|
private String password;
|
||||||
|
|
||||||
@Column(name = "secret_answer", nullable = false, length = 100)
|
@Column(name = "secret_answer", nullable = false)
|
||||||
private String secretQuestionAnswer;
|
private String secretQuestionAnswer;
|
||||||
|
|
||||||
@Column(name = "birth_date", nullable = false)
|
@Column(name = "birth_date", nullable = false)
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package com.example.demo.app.infra.repository;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
import org.springframework.data.jpa.repository.Modifying;
|
|
||||||
import org.springframework.data.jpa.repository.Query;
|
import org.springframework.data.jpa.repository.Query;
|
||||||
|
|
||||||
import com.example.demo.app.domain.model.CourseInfoModel;
|
import com.example.demo.app.domain.model.CourseInfoModel;
|
||||||
@@ -30,8 +29,4 @@ public interface AllocationRepository extends JpaRepository<AllocationEntity, Al
|
|||||||
+ " a.categoryEntity.categoryId ASC ")
|
+ " a.categoryEntity.categoryId ASC ")
|
||||||
List<CourseInfoModel> findAllJoinedAllocation();
|
List<CourseInfoModel> findAllJoinedAllocation();
|
||||||
|
|
||||||
@Modifying
|
|
||||||
@Query("delete from AllocationEntity a where a.courseEntity.courseId = :courseId")
|
|
||||||
void deleteByCourseId(Long courseId);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,15 +1,9 @@
|
|||||||
package com.example.demo.app.infra.repository;
|
package com.example.demo.app.infra.repository;
|
||||||
|
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
import org.springframework.data.jpa.repository.Modifying;
|
|
||||||
import org.springframework.data.jpa.repository.Query;
|
|
||||||
|
|
||||||
import com.example.demo.app.infra.entity.CourseOwnerEntity;
|
import com.example.demo.app.infra.entity.CourseOwnerEntity;
|
||||||
|
|
||||||
public interface CourseOwnerRepository extends JpaRepository<CourseOwnerEntity, Long>{
|
public interface CourseOwnerRepository extends JpaRepository<CourseOwnerEntity, Long>{
|
||||||
|
|
||||||
@Modifying
|
|
||||||
@Query("delete from CourseOwnerEntity c where c.courseEntity.courseId = :courseId")
|
|
||||||
public void deleteByCourseId(Long courseId);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import org.springframework.web.bind.annotation.PostMapping;
|
|||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
import com.example.demo.aop.aspect.SessionCheck;
|
import com.example.demo.aop.aspect.SessionCheck;
|
||||||
|
import com.example.demo.app.domain.model.AllocationModel;
|
||||||
import com.example.demo.app.domain.model.CourseModel;
|
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;
|
||||||
@@ -110,48 +111,57 @@ public class CourseController {
|
|||||||
|
|
||||||
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
|
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
|
||||||
|
|
||||||
model.addAttribute("courseForm", courseForm);
|
CourseForm form = CourseForm
|
||||||
|
.convertFrom(courseService.save(CourseForm.convertTo(courseForm), loginUser.getUserId()));
|
||||||
|
|
||||||
|
session.setAttribute(PageReturnAttributeKeyword.COURSE_ID, form.getCourseId());
|
||||||
|
|
||||||
return TransitionTargetPageNameKeyword.COURSE_CREATE_RATIO_HTML;
|
return TransitionTargetPageNameKeyword.COURSE_CREATE_RATIO_HTML;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SessionCheck
|
@SessionCheck
|
||||||
@PostMapping(TransitionTargetPageNameKeyword.COURSE_CREATE)
|
@PostMapping(TransitionTargetPageNameKeyword.COURSE_CREATE)
|
||||||
public String createCoursePost(@ModelAttribute CourseForm courseForm,
|
public String createCoursePost(@ModelAttribute AllocationFormList allocationFormList, HttpSession session) {
|
||||||
@ModelAttribute AllocationFormList allocationFormList, HttpSession session) {
|
|
||||||
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
|
|
||||||
|
|
||||||
courseService.save(CourseForm.convertTo(courseForm), loginUser.getUserId(), allocationFormList);
|
List<AllocationModel> allocationModelList = new ArrayList<>();
|
||||||
|
|
||||||
|
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId1(),
|
||||||
|
(Long) session.getAttribute(PageReturnAttributeKeyword.COURSE_ID),
|
||||||
|
allocationFormList.getAllocationRatio1()));
|
||||||
|
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId2(),
|
||||||
|
(Long) session.getAttribute(PageReturnAttributeKeyword.COURSE_ID),
|
||||||
|
allocationFormList.getAllocationRatio2()));
|
||||||
|
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId3(),
|
||||||
|
(Long) session.getAttribute(PageReturnAttributeKeyword.COURSE_ID),
|
||||||
|
allocationFormList.getAllocationRatio3()));
|
||||||
|
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId4(),
|
||||||
|
(Long) session.getAttribute(PageReturnAttributeKeyword.COURSE_ID),
|
||||||
|
allocationFormList.getAllocationRatio4()));
|
||||||
|
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId5(),
|
||||||
|
(Long) session.getAttribute(PageReturnAttributeKeyword.COURSE_ID),
|
||||||
|
allocationFormList.getAllocationRatio5()));
|
||||||
|
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId6(),
|
||||||
|
(Long) session.getAttribute(PageReturnAttributeKeyword.COURSE_ID),
|
||||||
|
allocationFormList.getAllocationRatio6()));
|
||||||
|
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId7(),
|
||||||
|
(Long) session.getAttribute(PageReturnAttributeKeyword.COURSE_ID),
|
||||||
|
allocationFormList.getAllocationRatio7()));
|
||||||
|
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId8(),
|
||||||
|
(Long) session.getAttribute(PageReturnAttributeKeyword.COURSE_ID),
|
||||||
|
allocationFormList.getAllocationRatio8()));
|
||||||
|
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId9(),
|
||||||
|
(Long) session.getAttribute(PageReturnAttributeKeyword.COURSE_ID),
|
||||||
|
allocationFormList.getAllocationRatio9()));
|
||||||
|
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId10(),
|
||||||
|
(Long) session.getAttribute(PageReturnAttributeKeyword.COURSE_ID),
|
||||||
|
allocationFormList.getAllocationRatio10()));
|
||||||
|
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId11(),
|
||||||
|
(Long) session.getAttribute(PageReturnAttributeKeyword.COURSE_ID),
|
||||||
|
allocationFormList.getAllocationRatio11()));
|
||||||
|
|
||||||
|
allocationService.save(allocationModelList);
|
||||||
|
|
||||||
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.COURSE;
|
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.COURSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SessionCheck
|
|
||||||
@PostMapping("/course/delete")
|
|
||||||
public String createCoursePost(@RequestParam Long courseId, HttpSession session, Model model) {
|
|
||||||
|
|
||||||
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
|
|
||||||
|
|
||||||
System.out.println("**********************cousrId: " + courseId);
|
|
||||||
String condition = courseService.deleteCourse(courseId, loginUser.getUserId());
|
|
||||||
|
|
||||||
if (condition.equals("selected")) {
|
|
||||||
|
|
||||||
model.addAttribute("message", "適用中のコースは選べません");
|
|
||||||
|
|
||||||
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.COURSE;
|
|
||||||
|
|
||||||
} else if (condition.equals("original")) {
|
|
||||||
model.addAttribute("message", "既存のデータは削除できません");
|
|
||||||
|
|
||||||
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.COURSE;
|
|
||||||
} else if (condition.equals("ok")) {
|
|
||||||
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.COURSE;
|
|
||||||
}
|
|
||||||
model.addAttribute("message", "エラーが発生しました");
|
|
||||||
|
|
||||||
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.COURSE;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -11,5 +11,4 @@ public class ErrorController {
|
|||||||
public String showError() {
|
public String showError() {
|
||||||
return TransitionTargetPageNameKeyword.ERROR_HTML;
|
return TransitionTargetPageNameKeyword.ERROR_HTML;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,8 +57,6 @@ public class GoalController {
|
|||||||
|
|
||||||
Long userId = loginUser.getUserId();
|
Long userId = loginUser.getUserId();
|
||||||
|
|
||||||
LocalDate today = LocalDate.now();
|
|
||||||
|
|
||||||
goalService.updateGoalComplete(userId);
|
goalService.updateGoalComplete(userId);
|
||||||
|
|
||||||
List<GoalModel> goalModelList = goalService.getGoalByUserId(userId);
|
List<GoalModel> goalModelList = goalService.getGoalByUserId(userId);
|
||||||
@@ -66,8 +64,7 @@ public class GoalController {
|
|||||||
List<GoalForm> goalFormList1 = GoalForm.convertFrom(goalModelList);
|
List<GoalForm> goalFormList1 = GoalForm.convertFrom(goalModelList);
|
||||||
|
|
||||||
List<GoalForm> goalFormList = goalFormList1.stream()
|
List<GoalForm> goalFormList = goalFormList1.stream()
|
||||||
.filter(goalForm -> goalForm.getGoalComplete() == 0
|
.filter(goalForm -> goalForm.getGoalComplete() == 0)
|
||||||
&& !goalForm.getDeadline().isBefore(today))
|
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
model.addAttribute(
|
model.addAttribute(
|
||||||
@@ -110,6 +107,8 @@ public class GoalController {
|
|||||||
1,
|
1,
|
||||||
1);
|
1);
|
||||||
|
|
||||||
|
LocalDate today = LocalDate.now();
|
||||||
|
|
||||||
Map<LocalDate, List<TransactionForm>> transactionFormMap = new HashMap<>();
|
Map<LocalDate, List<TransactionForm>> transactionFormMap = new HashMap<>();
|
||||||
|
|
||||||
transactionService
|
transactionService
|
||||||
@@ -239,6 +238,7 @@ public class GoalController {
|
|||||||
|
|
||||||
GoalForm goalForm = GoalForm.convertFrom(goalService.getGoalById(goalId));
|
GoalForm goalForm = GoalForm.convertFrom(goalService.getGoalById(goalId));
|
||||||
|
|
||||||
|
|
||||||
model.addAttribute(PageReturnAttributeKeyword.GOAL_FORM, goalForm);
|
model.addAttribute(PageReturnAttributeKeyword.GOAL_FORM, goalForm);
|
||||||
return TransitionTargetPageNameKeyword.GOAL_EDIT_HTML;
|
return TransitionTargetPageNameKeyword.GOAL_EDIT_HTML;
|
||||||
|
|
||||||
@@ -275,9 +275,7 @@ public class GoalController {
|
|||||||
|
|
||||||
int currentAmount = goalService.getCurrentAmount(userId);
|
int currentAmount = goalService.getCurrentAmount(userId);
|
||||||
|
|
||||||
System.out.println("************************currentAmount : " + currentAmount);
|
model.addAttribute("currentAmount", currentAmount);
|
||||||
|
|
||||||
session.setAttribute(PageReturnAttributeKeyword.CURRENT_AMOUNT, currentAmount);
|
|
||||||
|
|
||||||
return TransitionTargetPageNameKeyword.GOAL_CREATE_HTML;
|
return TransitionTargetPageNameKeyword.GOAL_CREATE_HTML;
|
||||||
}
|
}
|
||||||
@@ -307,8 +305,7 @@ public class GoalController {
|
|||||||
if (record == null) {
|
if (record == null) {
|
||||||
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.GOAL;
|
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.GOAL;
|
||||||
} else {
|
} else {
|
||||||
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.GOAL
|
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.GOAL + TransitionTargetPageNameKeyword.RECORD;
|
||||||
+ TransitionTargetPageNameKeyword.RECORD;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -317,8 +314,6 @@ public class GoalController {
|
|||||||
@GetMapping(TransitionTargetPageNameKeyword.RECORD)
|
@GetMapping(TransitionTargetPageNameKeyword.RECORD)
|
||||||
public String getRecord(HttpSession session, Model model) {
|
public String getRecord(HttpSession session, Model model) {
|
||||||
|
|
||||||
LocalDate today = LocalDate.now();
|
|
||||||
|
|
||||||
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
|
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
|
||||||
|
|
||||||
Long userId = loginUser.getUserId();
|
Long userId = loginUser.getUserId();
|
||||||
@@ -330,13 +325,7 @@ public class GoalController {
|
|||||||
List<GoalForm> goalCompleteFormList = new ArrayList<>();
|
List<GoalForm> goalCompleteFormList = new ArrayList<>();
|
||||||
|
|
||||||
goalFormList.stream().forEach(goalForm -> {
|
goalFormList.stream().forEach(goalForm -> {
|
||||||
if (goalForm.getGoalComplete() == 1 || goalForm.getDeadline().isBefore(today)) {
|
if (goalForm.getGoalComplete() == 1) {
|
||||||
|
|
||||||
goalForm.setStatus(
|
|
||||||
goalForm.getGoalComplete() == 1
|
|
||||||
? "達成"
|
|
||||||
: "未達成");
|
|
||||||
|
|
||||||
goalCompleteFormList.add(goalForm);
|
goalCompleteFormList.add(goalForm);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -57,7 +57,8 @@ public class ProfileController {
|
|||||||
profileModel.getBirthDate(),
|
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;
|
||||||
|
|||||||
@@ -238,7 +238,7 @@ public class TransactionController {
|
|||||||
|
|
||||||
model.addAttribute(PageReturnAttributeKeyword.TRANSACTION_FORM, transactionForm);
|
model.addAttribute(PageReturnAttributeKeyword.TRANSACTION_FORM, transactionForm);
|
||||||
|
|
||||||
session.setAttribute(SessionKeyword.T_TYPE, String.valueOf(transactionForm.getTransactionType()));
|
session.setAttribute("tType", String.valueOf(transactionForm.getTransactionType()));
|
||||||
|
|
||||||
model.addAttribute(PageReturnAttributeKeyword.CATEGORY_FORM_LIST, categoryFormList);
|
model.addAttribute(PageReturnAttributeKeyword.CATEGORY_FORM_LIST, categoryFormList);
|
||||||
|
|
||||||
@@ -297,23 +297,6 @@ public class TransactionController {
|
|||||||
transactionService.findMoneyRecord(transactionId),
|
transactionService.findMoneyRecord(transactionId),
|
||||||
CategoryForm.convertFrom(categoryService.findByTransactionId(transactionId)).getTransactionType());
|
CategoryForm.convertFrom(categoryService.findByTransactionId(transactionId)).getTransactionType());
|
||||||
|
|
||||||
List<CategoryForm> expenseList = new ArrayList<CategoryForm>();
|
|
||||||
|
|
||||||
List<CategoryForm> incomeList = new ArrayList<CategoryForm>();
|
|
||||||
|
|
||||||
for (CategoryForm categoryForm : categoryFormList) {
|
|
||||||
|
|
||||||
if (categoryForm.getTransactionType() == 0) {
|
|
||||||
expenseList.add(categoryForm);
|
|
||||||
} else {
|
|
||||||
incomeList.add(categoryForm);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
model.addAttribute(PageReturnAttributeKeyword.EXPENSE_LIST, expenseList);
|
|
||||||
model.addAttribute(PageReturnAttributeKeyword.INCOME_LIST, incomeList);
|
|
||||||
|
|
||||||
model.addAttribute(PageReturnAttributeKeyword.TRANSACTION_ID, transactionId);
|
model.addAttribute(PageReturnAttributeKeyword.TRANSACTION_ID, transactionId);
|
||||||
|
|
||||||
model.addAttribute(PageReturnAttributeKeyword.TRANSACTION_FORM, transactionForm);
|
model.addAttribute(PageReturnAttributeKeyword.TRANSACTION_FORM, transactionForm);
|
||||||
@@ -322,8 +305,6 @@ public class TransactionController {
|
|||||||
|
|
||||||
model.addAttribute(PageReturnAttributeKeyword.TODAY, today);
|
model.addAttribute(PageReturnAttributeKeyword.TODAY, today);
|
||||||
|
|
||||||
session.setAttribute(SessionKeyword.T_TYPE, transactionForm.getTransactionType());
|
|
||||||
|
|
||||||
return TransitionTargetPageNameKeyword.TRANSACTION_UPDATE_HTML;
|
return TransitionTargetPageNameKeyword.TRANSACTION_UPDATE_HTML;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -429,8 +410,7 @@ public class TransactionController {
|
|||||||
|
|
||||||
UserForm userForm = UserForm.convertFrom(userService.findByUserId(loginUser.getUserId()));
|
UserForm userForm = UserForm.convertFrom(userService.findByUserId(loginUser.getUserId()));
|
||||||
|
|
||||||
List<GoalForm> resultList = goalForm.stream().filter(goal -> goal.getGoalComplete() == 0 && goal.getDeadline().isAfter(today) )
|
List<GoalForm> resultList = goalForm.stream().filter(goal -> goal.getGoalComplete() == 0)
|
||||||
|
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
if (!resultList.isEmpty()) {
|
if (!resultList.isEmpty()) {
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ import com.example.demo.app.domain.service.QuestionService;
|
|||||||
import com.example.demo.app.domain.service.UserService;
|
import com.example.demo.app.domain.service.UserService;
|
||||||
import com.example.demo.app.infra.entity.QuestionEntity;
|
import com.example.demo.app.infra.entity.QuestionEntity;
|
||||||
import com.example.demo.app.presentation.controller.pageproperty.PageReturnAttributeKeyword;
|
import com.example.demo.app.presentation.controller.pageproperty.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.controller.pageproperty.TransitionTargetPageNameKeyword;
|
||||||
import com.example.demo.app.presentation.form.UserForm;
|
import com.example.demo.app.presentation.form.UserForm;
|
||||||
|
|
||||||
@@ -59,7 +58,7 @@ public class UserController {
|
|||||||
model.addAttribute(PageReturnAttributeKeyword.SELECTED_COURSE_NAME, courseService.findById(courseId).getCourseName());
|
model.addAttribute(PageReturnAttributeKeyword.SELECTED_COURSE_NAME, courseService.findById(courseId).getCourseName());
|
||||||
}
|
}
|
||||||
|
|
||||||
session.setAttribute(SessionKeyword.SELECTED_COURSE_NAME, courseService.findById(courseId).getCourseName());
|
session.setAttribute(PageReturnAttributeKeyword.SELECTED_COURSE_NAME, courseService.findById(courseId).getCourseName());
|
||||||
model.addAttribute(PageReturnAttributeKeyword.COURSE_ID, courseId);
|
model.addAttribute(PageReturnAttributeKeyword.COURSE_ID, courseId);
|
||||||
model.addAttribute(PageReturnAttributeKeyword.USER_FORM, userForm);
|
model.addAttribute(PageReturnAttributeKeyword.USER_FORM, userForm);
|
||||||
|
|
||||||
@@ -71,9 +70,11 @@ public class UserController {
|
|||||||
String selectedCourseName, Model model,
|
String selectedCourseName, Model model,
|
||||||
HttpSession session) {
|
HttpSession session) {
|
||||||
|
|
||||||
model.addAttribute(PageReturnAttributeKeyword.SELECTED_COURSE_NAME, (String) session.getAttribute(SessionKeyword.SELECTED_COURSE_NAME));
|
model.addAttribute(PageReturnAttributeKeyword.SELECTED_COURSE_NAME, (String) session.getAttribute("selectedCourseName"));
|
||||||
|
|
||||||
session.setAttribute(SessionKeyword.QUESTION_ID, userForm.getSecretQuestionId());
|
session.setAttribute("questionId", userForm.getSecretQuestionId());
|
||||||
|
|
||||||
|
System.out.println("return questionId: ****************************:" + userForm.getSecretQuestionId());
|
||||||
|
|
||||||
return TransitionTargetPageNameKeyword.USER_RESISTER_CONFIRM_HTML;
|
return TransitionTargetPageNameKeyword.USER_RESISTER_CONFIRM_HTML;
|
||||||
|
|
||||||
@@ -85,9 +86,11 @@ public class UserController {
|
|||||||
Model model,
|
Model model,
|
||||||
HttpSession session) {
|
HttpSession session) {
|
||||||
|
|
||||||
Long courseId = courseService.findByName((String) session.getAttribute(SessionKeyword.SELECTED_COURSE_NAME));
|
Long courseId = courseService.findByName((String) session.getAttribute(PageReturnAttributeKeyword.SELECTED_COURSE_NAME));
|
||||||
|
|
||||||
Long questionId = (Long) session.getAttribute(SessionKeyword.QUESTION_ID);
|
Long questionId = (Long) session.getAttribute("questionId");
|
||||||
|
|
||||||
|
System.out.println("confirm questionId: ****************************:" + questionId);
|
||||||
|
|
||||||
userForm.setSecretQuestionId(questionId);
|
userForm.setSecretQuestionId(questionId);
|
||||||
|
|
||||||
|
|||||||
@@ -4,8 +4,7 @@ public class PageReturnAttributeKeyword {
|
|||||||
|
|
||||||
public static final String ERROR_MESSAGE = "errorMessage";
|
public static final String ERROR_MESSAGE = "errorMessage";
|
||||||
public static final String MESSAGE = "message";
|
public static final String MESSAGE = "message";
|
||||||
public static final String ERROR = "error";
|
|
||||||
public static final String STATUS = "status";
|
|
||||||
|
|
||||||
public static final String QUESTION_LIST = "questionList";
|
public static final String QUESTION_LIST = "questionList";
|
||||||
public static final String USER_FORM = "userForm";
|
public static final String USER_FORM = "userForm";
|
||||||
|
|||||||
@@ -3,10 +3,4 @@ package com.example.demo.app.presentation.controller.pageproperty;
|
|||||||
public class SessionKeyword {
|
public class SessionKeyword {
|
||||||
// SESSION情報として格納したいログイン者の情報
|
// SESSION情報として格納したいログイン者の情報
|
||||||
public static final String LOGIN_USER = "loginUser";
|
public static final String LOGIN_USER = "loginUser";
|
||||||
|
|
||||||
public static final String SELECTED_COURSE_NAME = "selectedCourseName";
|
|
||||||
|
|
||||||
public static final String QUESTION_ID = "questionId";
|
|
||||||
|
|
||||||
public static final String T_TYPE = "tType";
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,8 +29,6 @@ public class GoalForm {
|
|||||||
|
|
||||||
private Integer goalComplete;
|
private Integer goalComplete;
|
||||||
|
|
||||||
private String status;
|
|
||||||
|
|
||||||
private Integer achievementRate; // 達成率
|
private Integer achievementRate; // 達成率
|
||||||
|
|
||||||
private Integer currentAmount; // 現在の資産
|
private Integer currentAmount; // 現在の資産
|
||||||
@@ -45,7 +43,6 @@ public class GoalForm {
|
|||||||
goalModel.getTargetAmount(),
|
goalModel.getTargetAmount(),
|
||||||
goalModel.getDeadline(),
|
goalModel.getDeadline(),
|
||||||
goalModel.getGoalComplete(),
|
goalModel.getGoalComplete(),
|
||||||
null,
|
|
||||||
goalModel.getAchievementRate(),
|
goalModel.getAchievementRate(),
|
||||||
goalModel.getCurrentAmount(),
|
goalModel.getCurrentAmount(),
|
||||||
goalModel.getUserId());
|
goalModel.getUserId());
|
||||||
|
|||||||
@@ -16,4 +16,5 @@ public class ProfileEditForm {
|
|||||||
private Integer saving;
|
private Integer saving;
|
||||||
private Integer annualIncome;
|
private Integer annualIncome;
|
||||||
private Integer monthlyBudget;
|
private Integer monthlyBudget;
|
||||||
|
private LocalDate birthDate;
|
||||||
}
|
}
|
||||||
|
|||||||
5
src/main/java/com/example/demo/utility/Constant.java
Normal file
5
src/main/java/com/example/demo/utility/Constant.java
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
package com.example.demo.utility;
|
||||||
|
|
||||||
|
public class Constant {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
package com.example.demo.utility;
|
||||||
|
|
||||||
|
public class TestController1 {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -46,10 +46,6 @@ body {
|
|||||||
border-top: 1px solid #d0d7de;
|
border-top: 1px solid #d0d7de;
|
||||||
}
|
}
|
||||||
|
|
||||||
.a-footer {
|
|
||||||
text-decoration: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* =======================
|
/* =======================
|
||||||
カード
|
カード
|
||||||
======================= */
|
======================= */
|
||||||
@@ -182,10 +178,6 @@ td:hover {
|
|||||||
text-align: right;
|
text-align: right;
|
||||||
}
|
}
|
||||||
|
|
||||||
.a-calender {
|
|
||||||
text-decoration: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* =======================
|
/* =======================
|
||||||
金額表示
|
金額表示
|
||||||
======================= */
|
======================= */
|
||||||
@@ -214,10 +206,6 @@ td:hover {
|
|||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
}
|
}
|
||||||
|
|
||||||
.goal {
|
|
||||||
min-width: 300px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* =======================
|
/* =======================
|
||||||
ボタン
|
ボタン
|
||||||
======================= */
|
======================= */
|
||||||
|
|||||||
15
src/main/resources/static/css/transaction_detail.css
Normal file
15
src/main/resources/static/css/transaction_detail.css
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
.transaction-item {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
|
||||||
|
.transaction-buttons {
|
||||||
|
display: flex;
|
||||||
|
gap: 10px;
|
||||||
|
margin-right: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.transaction-buttons form {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
@@ -35,7 +35,7 @@
|
|||||||
<table class="table text-center">
|
<table class="table text-center">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="col"></th>
|
<th scope="col">カテゴリ別</th>
|
||||||
<th scope="col">支出</th>
|
<th scope="col">支出</th>
|
||||||
<th scope="col">前月比</th>
|
<th scope="col">前月比</th>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -47,7 +47,7 @@
|
|||||||
0
|
0
|
||||||
</td>
|
</td>
|
||||||
<td th:text="${analysisForm.totalDifferenceAmount >= 0}
|
<td th:text="${analysisForm.totalDifferenceAmount >= 0}
|
||||||
? '+' + ${analysisForm.totalDifferenceAmount}
|
? '+' + ${analysisForm.totalDifferenceAmount}
|
||||||
: ${analysisForm.totalDifferenceAmount}"
|
: ${analysisForm.totalDifferenceAmount}"
|
||||||
th:class="${analysisForm.totalDifferenceAmount >= 0}
|
th:class="${analysisForm.totalDifferenceAmount >= 0}
|
||||||
? 'text-danger'
|
? 'text-danger'
|
||||||
@@ -73,14 +73,16 @@
|
|||||||
|
|
||||||
<th scope="row"
|
<th scope="row"
|
||||||
th:text="${category.categoryName}">
|
th:text="${category.categoryName}">
|
||||||
|
食費
|
||||||
</th>
|
</th>
|
||||||
|
|
||||||
<td th:text="'¥' + ${category.currentMonthAmount}">
|
<td th:text="'¥' + ${category.currentMonthAmount}">
|
||||||
|
0
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
<span th:text="${category.monthDifferenceAmount >= 0}
|
<span th:text="${category.monthDifferenceAmount >= 0}
|
||||||
? '+' + ${category.monthDifferenceAmount}
|
? '+' + ${category.monthDifferenceAmount}
|
||||||
: ${category.monthDifferenceAmount}"
|
: ${category.monthDifferenceAmount}"
|
||||||
th:class="${category.monthDifferenceAmount >= 0}
|
th:class="${category.monthDifferenceAmount >= 0}
|
||||||
? 'text-danger'
|
? 'text-danger'
|
||||||
@@ -88,7 +90,7 @@
|
|||||||
</span>
|
</span>
|
||||||
<br>
|
<br>
|
||||||
<span th:text="${category.courseDifferenceAmount >= 0}
|
<span th:text="${category.courseDifferenceAmount >= 0}
|
||||||
? '+' + ${category.courseDifferenceAmount}
|
? '+' + ${category.courseDifferenceAmount}
|
||||||
: ${category.courseDifferenceAmount}"
|
: ${category.courseDifferenceAmount}"
|
||||||
th:class="${category.courseDifferenceAmount >= 0}
|
th:class="${category.courseDifferenceAmount >= 0}
|
||||||
? 'text-danger'
|
? 'text-danger'
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label" for="categoryName">カテゴリ名</label>
|
<label class="form-label" for="categoryName">カテゴリ名</label>
|
||||||
|
|
||||||
<input class="form-control" type="text" id="categoryName" th:field="*{categoryName}" required>
|
<input class="form-control" type="text" id="categoryName" th:field="*{categoryName}">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
@@ -33,7 +33,7 @@
|
|||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label" for="transactionType">収入・支出</label>
|
<label class="form-label" for="transactionType">収入・支出</label>
|
||||||
|
|
||||||
<select class="form-select" id="transactionType" th:field="*{transactionType}" required>
|
<select class="form-select" id="transactionType" th:field="*{transactionType}">
|
||||||
|
|
||||||
<option value="">選択してください</option>
|
<option value="">選択してください</option>
|
||||||
<option value="0">支出</option>
|
<option value="0">支出</option>
|
||||||
|
|||||||
@@ -9,13 +9,13 @@
|
|||||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body style="padding-top:80px; padding-bottom:80px;">
|
<body class="pb-5 pt-5">
|
||||||
|
|
||||||
<div th:replace="~{header :: header}"></div>
|
<div th:replace="~{header :: header}"></div>
|
||||||
<div class="main-container">
|
<div class="main-container">
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<ul class="list-unstyled p-0 m-0">
|
<ul>
|
||||||
<li class="card shadow-sm mb-3" th:each="categoryForm : ${categoryFormList}">
|
<li class="card shadow-sm mb-3" th:each="categoryForm : ${categoryFormList}">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<div class="d-flex justify-content-between">
|
<div class="d-flex justify-content-between">
|
||||||
@@ -49,30 +49,20 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
<hr>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="d-grid mt-4">
|
|
||||||
|
|
||||||
<form th:action="@{/category/create}" method="get">
|
<form th:action="@{/category/create}" method="get">
|
||||||
|
<input type="hidden" name="today" id="today" th:value="${today}">
|
||||||
<input type="hidden"
|
<button type="submit">新規登録</button>
|
||||||
name="today"
|
|
||||||
id="today"
|
|
||||||
th:value="${today}">
|
|
||||||
|
|
||||||
<button class="btn btn-success w-100" type="submit">
|
|
||||||
新規登録
|
|
||||||
</button>
|
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div th:replace="~{footer :: footer}"></div>
|
<div th:replace="~{footer :: footer}"></div>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label" for="categoryName">カテゴリ名</label>
|
<label class="form-label" for="categoryName">カテゴリ名</label>
|
||||||
|
|
||||||
<input class="form-control" type="text" id="categoryName" th:field="*{categoryName}" required>
|
<input class="form-control" type="text" id="categoryName" th:field="*{categoryName}">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
@@ -33,7 +33,7 @@
|
|||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label" for="transactionType">収入・支出</label>
|
<label class="form-label" for="transactionType">収入・支出</label>
|
||||||
|
|
||||||
<select class="form-select" id="transactionType" th:field="*{transactionType}" required>
|
<select class="form-select" id="transactionType" th:field="*{transactionType}">
|
||||||
|
|
||||||
<option value="">選択してください</option>
|
<option value="">選択してください</option>
|
||||||
<option value="0">支出</option>
|
<option value="0">支出</option>
|
||||||
@@ -47,7 +47,7 @@
|
|||||||
<input type="hidden" name="categoryId" th:value="${categoryId}">
|
<input type="hidden" name="categoryId" th:value="${categoryId}">
|
||||||
|
|
||||||
<div class="d-grid">
|
<div class="d-grid">
|
||||||
<button type="submit" class="btn btn-primary">更新</button>
|
<button type="submit" class="btn btn-primary">登録</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label" for="courseName">コース名</label>
|
<label class="form-label" for="courseName">コース名</label>
|
||||||
|
|
||||||
<input class="form-control" type="text" id="courseName" th:field="*{courseName}" required>
|
<input class="form-control" type="text" id="courseName" th:field="*{courseName}">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
|
|||||||
@@ -22,113 +22,95 @@
|
|||||||
<form th:action="@{/course/create}" th:object="${allocationFormList}" method="post">
|
<form th:action="@{/course/create}" th:object="${allocationFormList}" method="post">
|
||||||
|
|
||||||
|
|
||||||
|
<div class="mb-3">
|
||||||
|
<label class="form-label" for="allocationRatio1">給与</label>
|
||||||
|
<input class="form-control" type="number" id="allocationRatio1" th:field="*{allocationRatio1}">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
|
<div class="mb-3">
|
||||||
|
<label class="form-label" for="allocationRatio2">賞与</label>
|
||||||
|
<input class="form-control" type="number" id="allocationRatio2" th:field="*{allocationRatio2}">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
|
<div class="mb-3">
|
||||||
|
<label class="form-label" for="allocationRatio3">その他</label>
|
||||||
|
<input class="form-control" type="number" id="allocationRatio3" th:field="*{allocationRatio3}">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label" for="allocationRatio4">固定費</label>
|
<label class="form-label" for="allocationRatio4">固定費</label>
|
||||||
<input class="form-control" type="number" min="0" max="100" onchange="inputChange()"
|
<input class="form-control" type="number" id="allocationRatio4" th:field="*{allocationRatio4}">
|
||||||
id="allocationRatio4" th:field="*{allocationRatio4}" required>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label" for="allocationRatio5">食費</label>
|
<label class="form-label" for="allocationRatio5">食費</label>
|
||||||
<input class="form-control" type="number" min="0" max="100" onchange="inputChange()"
|
<input class="form-control" type="number" id="allocationRatio5" th:field="*{allocationRatio5}">
|
||||||
id="allocationRatio5" th:field="*{allocationRatio5}" required>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label" for="allocationRatio6">交通費</label>
|
<label class="form-label" for="allocationRatio6">交通費</label>
|
||||||
<input class="form-control" type="number" min="0" max="100" onchange="inputChange()"
|
<input class="form-control" type="number" id="allocationRatio6" th:field="*{allocationRatio6}">
|
||||||
id="allocationRatio6" th:field="*{allocationRatio6}" required>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label" for="allocationRatio7">日用品費</label>
|
<label class="form-label" for="allocationRatio7">日用品費</label>
|
||||||
<input class="form-control" type="number" min="0" max="100" onchange="inputChange()"
|
<input class="form-control" type="number" id="allocationRatio7" th:field="*{allocationRatio7}">
|
||||||
id="allocationRatio7" th:field="*{allocationRatio7}" required>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label" for="allocationRatio8">被服/美容費</label>
|
<label class="form-label" for="allocationRatio8">被服/美容費</label>
|
||||||
<input class="form-control" type="number" min="0" max="100" onchange="inputChange()"
|
<input class="form-control" type="number" id="allocationRatio8" th:field="*{allocationRatio8}">
|
||||||
id="allocationRatio8" th:field="*{allocationRatio8}" required>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label" for="allocationRatio9">医療費</label>
|
<label class="form-label" for="allocationRatio9">医療費</label>
|
||||||
<input class="form-control" type="number" min="0" max="100" onchange="inputChange()"
|
<input class="form-control" type="number" id="allocationRatio9" th:field="*{allocationRatio9}">
|
||||||
id="allocationRatio9" th:field="*{allocationRatio9}" required>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label" for="allocationRatio10">趣味/娯楽費</label>
|
<label class="form-label" for="allocationRatio10">趣味/娯楽費</label>
|
||||||
<input class="form-control" type="number" min="0" max="100" onchange="inputChange()"
|
<input class="form-control" type="number" id="allocationRatio10"
|
||||||
id="allocationRatio10" th:field="*{allocationRatio10}" required>
|
th:field="*{allocationRatio10}">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label" for="allocationRatio11">その他</label>
|
<label class="form-label" for="allocationRatio11">その他</label>
|
||||||
<input class="form-control" type="number" min="0" max="100" onchange="inputChange()"
|
<input class="form-control" type="number" id="allocationRatio11"
|
||||||
id="allocationRatio11" th:field="*{allocationRatio11}" required>
|
th:field="*{allocationRatio11}">
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="mb-3">
|
|
||||||
<label class="form-label" for="allocationRatioTotal">合計(%)</label>
|
|
||||||
<input class="form-control" type="number" value="0" id="allocationRatioTotal" readonly>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
<div class="d-grid">
|
<div class="d-grid">
|
||||||
<button type="submit" class="btn btn-primary" id="submit" disabled="true">登録</button>
|
<button type="submit" class="btn btn-primary">登録</button>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
</form>
|
||||||
<span th:object="${courseForm}">
|
|
||||||
|
|
||||||
<input type="hidden" id="courseName" th:field="*{courseName}" required>
|
|
||||||
<br>
|
|
||||||
|
|
||||||
<input type="hidden" id="description" th:field="*{description}">
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div th:replace="~{footer :: footer}"></div>
|
<div th:replace="~{footer :: footer}"></div>
|
||||||
|
|
||||||
<script>
|
|
||||||
|
|
||||||
function inputChange() {
|
|
||||||
let total = 0;
|
|
||||||
|
|
||||||
for (let i = 4; i <= 11; i++) {
|
|
||||||
total += Number(document.getElementById(`allocationRatio${i}`).value || 0);
|
|
||||||
if (total == 100) {
|
|
||||||
document.getElementById('submit').disabled = false;
|
|
||||||
} else {
|
|
||||||
document.getElementById('submit').disabled = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
document.getElementById("allocationRatioTotal").value = total;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
</script>
|
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
<link rel="stylesheet" th:href="@{/css/style.css}">
|
<link rel="stylesheet" th:href="@{/css/style.css}">
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body style="padding-top:80px; padding-bottom:80px;">
|
<body class="pb-5 pt-5">
|
||||||
|
|
||||||
<div th:replace="~{header :: header}"></div>
|
<div th:replace="~{header :: header}"></div>
|
||||||
<div class="main-container">
|
<div class="main-container">
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
<h2 class="page-title" th:text="${today}"></h2>
|
<h2 class="page-title" th:text="${today}"></h2>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<ul class="list-unstyled p-0 m-0">
|
<ul>
|
||||||
<li th:each="fixedCostForm : ${fixedCostFormList}" class="card shadow-sm mb-3">
|
<li th:each="fixedCostForm : ${fixedCostFormList}" class="card shadow-sm mb-3">
|
||||||
|
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
@@ -52,29 +52,21 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
<hr>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
|
</div>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="d-grid mt-4">
|
|
||||||
|
|
||||||
|
|
||||||
<form th:action="@{/fixed-cost/create}" method="get">
|
<form th:action="@{/fixed-cost/create}" method="get">
|
||||||
|
<input type="hidden" name="today" id="today" th:value="${today}">
|
||||||
<input type="hidden"
|
<button type="submit">新規登録</button>
|
||||||
name="today"
|
|
||||||
id="today"
|
|
||||||
th:value="${today}">
|
|
||||||
|
|
||||||
<button class="btn btn-success w-100" type="submit">
|
|
||||||
新規登録
|
|
||||||
</button>
|
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div th:replace="~{footer :: footer}"></div>
|
<div th:replace="~{footer :: footer}"></div>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
|
|||||||
@@ -37,11 +37,11 @@
|
|||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label" for="transactionType">収入・支出</label>
|
<label class="form-label" for="transactionType">収入・支出</label>
|
||||||
|
|
||||||
<select class="form-select" id="transactionType" required>
|
<select class="form-select" id="transactionType">
|
||||||
|
|
||||||
<option value="">選択してください</option>
|
<option value="">選択してください</option>
|
||||||
<option value="0">支出</option>
|
<option value="1">支出</option>
|
||||||
<option value="1">収入</option>
|
<option value="2">収入</option>
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
@@ -51,7 +51,7 @@
|
|||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label" for="categoryId">カテゴリ</label>
|
<label class="form-label" for="categoryId">カテゴリ</label>
|
||||||
|
|
||||||
<select class="form-select" id="categoryId" th:field="*{categoryId}" required>
|
<select class="form-select" id="categoryId" th:field="*{categoryId}">
|
||||||
<option value="">選択してください</option>
|
<option value="">選択してください</option>
|
||||||
|
|
||||||
<option class="expenseListClass" th:each="category : ${expenseList}"
|
<option class="expenseListClass" th:each="category : ${expenseList}"
|
||||||
@@ -70,7 +70,7 @@
|
|||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label" for="amount">金額</label>
|
<label class="form-label" for="amount">金額</label>
|
||||||
|
|
||||||
<input class="form-control" type="number" id="amount" th:field="*{amount}" min="1" placeholder="金額を入力してください"
|
<input class="form-control" type="number" id="amount" th:field="*{amount}" min="0" placeholder="金額を入力してください"
|
||||||
required>
|
required>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -94,7 +94,7 @@
|
|||||||
|
|
||||||
transactionType.addEventListener("change", function () {
|
transactionType.addEventListener("change", function () {
|
||||||
|
|
||||||
if (this.value === "0") {
|
if (this.value === "1") {
|
||||||
|
|
||||||
for (let i = 0; i < expenseList.length; i++) {
|
for (let i = 0; i < expenseList.length; i++) {
|
||||||
expenseList[i].style.display = "";
|
expenseList[i].style.display = "";
|
||||||
@@ -104,7 +104,7 @@
|
|||||||
incomeList[i].style.display = "none";
|
incomeList[i].style.display = "none";
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (this.value === "1") {
|
} else if (this.value === "2") {
|
||||||
|
|
||||||
for (let i = 0; i < expenseList.length; i++) {
|
for (let i = 0; i < expenseList.length; i++) {
|
||||||
expenseList[i].style.display = "none";
|
expenseList[i].style.display = "none";
|
||||||
|
|||||||
@@ -15,22 +15,22 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col border-end">
|
<div class="col border-end">
|
||||||
<button type="button" class="btn btn-link text-black text-decoration-none">
|
<button type="button" class="btn btn-link text-black text-decoration-none">
|
||||||
<a th:href="@{/transaction/create}" class="a-footer">入力</a>
|
<a th:href="@{/transaction/create}">入力</a>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="col border-end">
|
<div class="col border-end">
|
||||||
<button type="button" class="btn btn-link text-black text-decoration-none">
|
<button type="button" class="btn btn-link text-black text-decoration-none">
|
||||||
<a th:href="@{/transaction/list}" class="a-footer">一覧</a>
|
<a th:href="@{/transaction/list}">一覧</a>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="col border-end">
|
<div class="col border-end">
|
||||||
<button type="button" class="btn btn-link text-black text-decoration-none">
|
<button type="button" class="btn btn-link text-black text-decoration-none">
|
||||||
<a th:href="@{/analysis}" class="a-footer">分析</a>
|
<a th:href="@{/analysis}">分析</a>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="col border-end">
|
<div class="col border-end">
|
||||||
<button type="button" class="btn btn-link text-black text-decoration-none">
|
<button type="button" class="btn btn-link text-black text-decoration-none">
|
||||||
<a th:href="@{/goal}" class="a-footer">目標</a>
|
<a th:href="@{/goal}">目標</a>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -26,20 +26,18 @@
|
|||||||
|
|
||||||
<div>
|
<div>
|
||||||
<label>目標名</label>
|
<label>目標名</label>
|
||||||
<input type="text" th:field="*{goalTitle}">
|
<input type="text" th:field="*{goalTitle}" required>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<label>目標説明</label>
|
<label>目標説明</label>
|
||||||
<textarea th:field="*{goalSubtitle}"></textarea>
|
<textarea th:field="*{goalSubtitle}" required></textarea>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<label>目標金額</label>
|
<label>目標金額</label>
|
||||||
<input type="number" th:field="*{targetAmount}" required min="1">
|
<input type="number" th:field="*{targetAmount}" required min="1">
|
||||||
<br>
|
<span th:text="|所持金:${currentAmount}円|"></span>
|
||||||
<span th:text="|所持金:${session.currentAmount}円|"></span>
|
|
||||||
<input type="hidden" name="currentAmount" th:value="${currentAmount}">
|
|
||||||
<span th:if="${message != null}">
|
<span th:if="${message != null}">
|
||||||
<span th:text="${message}" style="color: red;"></span>
|
<span th:text="${message}" style="color: red;"></span>
|
||||||
</span>
|
</span>
|
||||||
@@ -54,12 +52,9 @@
|
|||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div th:replace="~{footer :: footer}"></div>
|
<div th:replace="~{footer :: footer}"></div>
|
||||||
|
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
@@ -8,7 +8,7 @@
|
|||||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body style="padding-top:80px; padding-bottom:80px;">
|
<body class="pb-5 pt-5">
|
||||||
|
|
||||||
<div th:replace="~{header :: header}"></div>
|
<div th:replace="~{header :: header}"></div>
|
||||||
|
|
||||||
@@ -47,12 +47,6 @@
|
|||||||
|
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
状態:
|
|
||||||
<span class="fw-bold" th:text="${goalForm.status}">
|
|
||||||
</span>
|
|
||||||
|
|
||||||
<br>
|
|
||||||
|
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
@@ -80,16 +74,16 @@
|
|||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="d-grid mt-4">
|
<div class="d-grid mt-4">
|
||||||
<form th:action="@{/goal}" method="get">
|
<form th:action="@{/goal}" method="get">
|
||||||
|
|
||||||
<button class="btn btn-success w-100" type="submit">
|
<button class="btn btn-success w-100" type="submit">
|
||||||
戻る
|
戻る
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div th:replace="~{footer :: footer}"></div>
|
<div th:replace="~{footer :: footer}"></div>
|
||||||
|
|||||||
@@ -54,102 +54,141 @@
|
|||||||
|
|
||||||
const myChart =
|
const myChart =
|
||||||
new Chart(myCt, {
|
new Chart(myCt, {
|
||||||
|
|
||||||
type: 'bar',
|
type: 'bar',
|
||||||
|
|
||||||
data: {
|
data: {
|
||||||
|
|
||||||
labels: labels,
|
labels: labels,
|
||||||
|
|
||||||
datasets: [
|
datasets: [
|
||||||
{
|
{
|
||||||
label: '達成率',
|
label: '達成率',
|
||||||
|
|
||||||
data: achievementRates,
|
data: achievementRates,
|
||||||
|
|
||||||
backgroundColor:
|
backgroundColor:
|
||||||
'rgba(54, 162, 235, 0.5)',
|
'rgba(54, 162, 235, 0.5)',
|
||||||
|
|
||||||
borderColor:
|
borderColor:
|
||||||
'rgba(54, 162, 235, 1)',
|
'rgba(54, 162, 235, 1)',
|
||||||
|
|
||||||
borderWidth: 1
|
borderWidth: 1
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
||||||
options: {
|
options: {
|
||||||
|
|
||||||
responsive: true,
|
responsive: true,
|
||||||
|
|
||||||
maintainAspectRatio: false,
|
maintainAspectRatio: false,
|
||||||
|
|
||||||
scales: {
|
scales: {
|
||||||
|
|
||||||
y: {
|
y: {
|
||||||
|
|
||||||
beginAtZero: true,
|
beginAtZero: true,
|
||||||
|
|
||||||
max: 100,
|
max: 100,
|
||||||
|
|
||||||
ticks: {
|
ticks: {
|
||||||
|
|
||||||
callback: function (value) {
|
callback: function (value) {
|
||||||
return value + '%';
|
return value + '%';
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
|
|
||||||
<li th:each="goalForm : ${goalFormList}">
|
<li th:each="goalForm : ${goalFormList}">
|
||||||
|
|
||||||
<div class="d-flex justify-content-between">
|
<div class="d-flex justify-content-between">
|
||||||
|
|
||||||
<form th:action="@{/goal}" method="get" class="w-100">
|
<form th:action="@{/goal}" method="get" class="w-100">
|
||||||
|
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
|
|
||||||
<table class="table mb-0">
|
<table class="table mb-0">
|
||||||
|
|
||||||
<input type="radio" name="goalId" th:value="${goalForm.goalId}"
|
<input type="radio" name="goalId" th:value="${goalForm.goalId}"
|
||||||
th:checked="${graphGoal != null and graphGoal.goalId == goalForm.goalId}"
|
th:checked="${graphGoal != null and graphGoal.goalId == goalForm.goalId}"
|
||||||
onchange="this.form.submit()">
|
onchange="this.form.submit()">
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<th>目標名</th>
|
<th>目標名</th>
|
||||||
<td th:text="${goalForm.goalTitle}"
|
<td th:text="${goalForm.goalTitle}"></td>
|
||||||
class="goal"></td>
|
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<th>目標説明</th >
|
<th>目標説明</th>
|
||||||
<td th:text="${goalForm.goalSubtitle}"
|
<td th:text="${goalForm.goalSubtitle}"></td>
|
||||||
class="goal"></td>
|
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<th>目標金額</th>
|
<th>目標金額</th>
|
||||||
<td th:text="${goalForm.targetAmount}"
|
<td th:text="${goalForm.targetAmount}"></td>
|
||||||
class="goal"></td>
|
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<th>目標達成期限</th>
|
<th>目標達成期限</th>
|
||||||
<td th:text="${goalForm.deadline}"
|
<td th:text="${goalForm.deadline}"></td>
|
||||||
class="goal"></td>
|
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<th>達成率</th>
|
<th>達成率</th>
|
||||||
<td th:text="${goalForm.achievementRate} + '%'"
|
<td th:text="${goalForm.achievementRate} + '%'"></td>
|
||||||
class="goal"></td>
|
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="d-flex justify-content-end gap-2 mt-3">
|
<div class="d-flex justify-content-end gap-2 mt-3">
|
||||||
|
|
||||||
<form th:action="@{/goal/edit}" method="get">
|
<form th:action="@{/goal/edit}" method="get">
|
||||||
|
|
||||||
<input type="hidden" name="goalId" th:value="${goalForm.goalId}">
|
<input type="hidden" name="goalId" th:value="${goalForm.goalId}">
|
||||||
|
|
||||||
<button type="submit" class="btn btn-sm btn-primary">
|
<button type="submit" class="btn btn-sm btn-primary">
|
||||||
編集
|
編集
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<form th:action="@{/goal/delete}" method="post">
|
<form th:action="@{/goal/delete}" method="post">
|
||||||
|
|
||||||
<input type="hidden" name="goalId" th:value="${goalForm.goalId}">
|
<input type="hidden" name="goalId" th:value="${goalForm.goalId}">
|
||||||
|
|
||||||
<button type="submit" class="btn btn-sm btn-danger">
|
<button type="submit" class="btn btn-sm btn-danger">
|
||||||
削除
|
削除
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="d-grid gap-2 mt-4">
|
|
||||||
<form th:action="@{/goal/create}" method="get">
|
<form th:action="@{/goal/create}" method="get">
|
||||||
|
|
||||||
<button type="submit" class="btn btn-success w-100">
|
<button type="submit" class="btn btn-success w-100">
|
||||||
@@ -159,13 +198,13 @@
|
|||||||
</form>
|
</form>
|
||||||
|
|
||||||
<form th:action="@{/goal/record}" method="get">
|
<form th:action="@{/goal/record}" method="get">
|
||||||
|
|
||||||
<button type="submit" class="btn btn-sm btn-primary w-100">
|
<button type="submit" class="btn btn-sm btn-primary w-100">
|
||||||
履歴
|
履歴
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
</div>
|
|
||||||
<div th:replace="~{footer :: footer}"></div>
|
<div th:replace="~{footer :: footer}"></div>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@@ -6,11 +6,12 @@
|
|||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
|
||||||
<title>カレンダー</title>
|
<title>Calendar</title>
|
||||||
|
|
||||||
|
<link rel="stylesheet" th:href="@{/css/style.css}">
|
||||||
|
|
||||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
|
|
||||||
<link rel="stylesheet" th:href="@{/css/style.css}">
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
@@ -55,35 +56,51 @@
|
|||||||
|
|
||||||
|
|
||||||
<tbody>
|
<tbody>
|
||||||
|
|
||||||
<tr th:each="week : ${#numbers.sequence(0, 5)}">
|
<tr th:each="week : ${#numbers.sequence(0, 5)}">
|
||||||
|
|
||||||
<td th:each="weekDay : ${#numbers.sequence(0, 6)}">
|
<td th:each="weekDay : ${#numbers.sequence(0, 6)}">
|
||||||
|
|
||||||
<a th:if="${week * 7 + weekDay - firstDayOfWeek + 1 >= 1
|
<a th:if="${week * 7 + weekDay - firstDayOfWeek + 1 >= 1
|
||||||
and week * 7 + weekDay - firstDayOfWeek + 1 <= lastDay}" th:href="@{/transaction/detail(
|
and week * 7 + weekDay - firstDayOfWeek + 1 <= lastDay}" th:href="@{/transaction/detail(
|
||||||
todayDates=${T(java.time.LocalDate).of(year, month, week * 7 + weekDay - firstDayOfWeek + 1)}
|
todayDates=${T(java.time.LocalDate).of(year, month, week * 7 + weekDay - firstDayOfWeek + 1)}
|
||||||
)}" class="a-footer">
|
)}">
|
||||||
|
|
||||||
|
|
||||||
<div
|
<div
|
||||||
th:if="${week * 7 + weekDay - firstDayOfWeek + 1 >= 1 and week * 7 + weekDay - firstDayOfWeek + 1 <= lastDay}">
|
th:if="${week * 7 + weekDay - firstDayOfWeek + 1 >= 1 and week * 7 + weekDay - firstDayOfWeek + 1 <= lastDay}">
|
||||||
|
|
||||||
<div class="date" th:text="${week * 7 + weekDay - firstDayOfWeek + 1}">
|
<div class="date" th:text="${week * 7 + weekDay - firstDayOfWeek + 1}">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div th:each="income : ${incomeList}"
|
<div th:each="income : ${incomeList}"
|
||||||
th:if="${income.date.dayOfMonth == week * 7 + weekDay - firstDayOfWeek + 1}"
|
th:if="${income.date.dayOfMonth == week * 7 + weekDay - firstDayOfWeek + 1}"
|
||||||
class="income" th:text="|収入 +${income.amount}円|">
|
class="income" th:text="|収入 +${income.amount}円|">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div th:each="expense : ${expenseList}"
|
<div th:each="expense : ${expenseList}"
|
||||||
th:if="${expense.date.dayOfMonth == week * 7 + weekDay - firstDayOfWeek + 1}"
|
th:if="${expense.date.dayOfMonth == week * 7 + weekDay - firstDayOfWeek + 1}"
|
||||||
class="expense" th:text="|支出 -${expense.amount}円|">
|
class="expense" th:text="|支出 -${expense.amount}円|">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
|
||||||
<div class="card shadow-sm mb-3">
|
<div class="card shadow-sm mb-3">
|
||||||
|
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
|
|
||||||
<div class="d-flex justify-content-between mb-2">
|
<div class="d-flex justify-content-between mb-2">
|
||||||
<span>収入</span>
|
<span>収入</span>
|
||||||
<span th:text="'¥' + ${totalIncome}"></span>
|
<span th:text="'¥' + ${totalIncome}"></span>
|
||||||
@@ -108,19 +125,27 @@
|
|||||||
<span>目標資金</span>
|
<span>目標資金</span>
|
||||||
<span th:text="'¥' + ${targetAmount}"></span>
|
<span th:text="'¥' + ${targetAmount}"></span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="d-flex justify-content-between mb-2">
|
<div class="d-flex justify-content-between mb-2">
|
||||||
<span>現在高</span>
|
<span>現在高</span>
|
||||||
<span th:text="'¥' + ${currentAmount}"></span>
|
<span th:text="'¥' + ${currentAmount}"></span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="d-flex justify-content-between">
|
<div class="d-flex justify-content-between">
|
||||||
<span>貯金額</span>
|
<span>貯金額</span>
|
||||||
<span th:text="'¥' + ${saving}"></span>
|
<span th:text="'¥' + ${saving}"></span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="card shadow-sm">
|
<div class="card shadow-sm">
|
||||||
|
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
|
|
||||||
<div class="d-flex justify-content-between mb-2">
|
<div class="d-flex justify-content-between mb-2">
|
||||||
<span>達成率</span>
|
<span>達成率</span>
|
||||||
<span th:text="${achievementRate} + '%'"
|
<span th:text="${achievementRate} + '%'"
|
||||||
|
|||||||
@@ -100,17 +100,17 @@
|
|||||||
min="0"
|
min="0"
|
||||||
max="10000000"
|
max="10000000"
|
||||||
required>
|
required>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<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>
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -5,25 +5,22 @@
|
|||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
<link rel="stylesheet" th:href="@{/css/style.css}">
|
|
||||||
<title>コース選択</title>
|
<title>コース選択</title>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body style="padding-bottom: 120px; padding-top: 80px;">
|
<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>
|
||||||
|
|
||||||
<div class="d-grid gap-2 mt-4">
|
|
||||||
<th:block th:if="${mode == 'change'}">
|
<th:block th:if="${mode == 'change'}">
|
||||||
<form th:action="@{/course/create}" method="get">
|
<form th:action="@{/course/create}" method="get">
|
||||||
<button class="btn btn-success w-100" type="submit">
|
<button type="submit">新規登録</button>
|
||||||
新規登録
|
|
||||||
</button>
|
|
||||||
</form>
|
</form>
|
||||||
</th:block>
|
|
||||||
|
|
||||||
</th:block>
|
</th:block>
|
||||||
<form th:action="${mode == 'regist'} ? @{/user/register/return}: @{/change}" id="totalForm" method="post">
|
<form th:action="${mode == 'regist'} ? @{/user/register/return}: @{/change}" method="post">
|
||||||
<button type="submit" class="btn btn-primary w-100">確定</button>
|
<button type="submit" class="btn btn-primary w-100">確定</button>
|
||||||
|
|
||||||
<div class="accordion" id="accordionExample">
|
<div class="accordion" id="accordionExample">
|
||||||
@@ -36,9 +33,6 @@
|
|||||||
aria-controls="'collapse' + ${course.courseId}">
|
aria-controls="'collapse' + ${course.courseId}">
|
||||||
<span th:text="${course.courseName}"></span>
|
<span th:text="${course.courseName}"></span>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<p th:if="${course.courseId > 6}" style="width: 120px;"><button type="button" class="btn btn-danger w-100"
|
|
||||||
th:attr="data-course-id=${course.courseId}" onclick="deleteCourse(this)">削除</button></p>
|
|
||||||
</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" style="padding-bottom: 120px;">
|
data-bs-parent="#accordionExample" style="padding-bottom: 120px;">
|
||||||
@@ -60,49 +54,11 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
|
||||||
|
|
||||||
<th:block th:if="${mode=='change'}">
|
<th:block th:if="${mode=='change'}">
|
||||||
<div th:replace="~{footer :: footer}"></div>
|
<div th:replace="~{footer :: footer}"></div>
|
||||||
</th:block>
|
</th:block>
|
||||||
|
|
||||||
<script th:inline="javascript">
|
|
||||||
|
|
||||||
const message = /*[[${message}]]*/ null;
|
|
||||||
|
|
||||||
if (message != null) {
|
|
||||||
alert(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
function deleteCourse(button) {
|
|
||||||
|
|
||||||
const courseId = button.dataset.courseId;
|
|
||||||
|
|
||||||
const totalForm = document.getElementById("totalForm");
|
|
||||||
|
|
||||||
const input = document.createElement("input");
|
|
||||||
|
|
||||||
const radioButtons = totalForm.querySelectorAll('input[name="courseId"]');
|
|
||||||
radioButtons.forEach(radio => {
|
|
||||||
radio.disabled = true;
|
|
||||||
});
|
|
||||||
|
|
||||||
input.type = "hidden";
|
|
||||||
input.name = "courseId";
|
|
||||||
input.value = courseId;
|
|
||||||
|
|
||||||
totalForm.appendChild(input);
|
|
||||||
|
|
||||||
totalForm.action = "/course/delete";
|
|
||||||
totalForm.method = "post";
|
|
||||||
courseId.value = courseId;
|
|
||||||
|
|
||||||
totalForm.submit();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.7/dist/js/bootstrap.bundle.min.js"></script>
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.7/dist/js/bootstrap.bundle.min.js"></script>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
|
|||||||
@@ -3,9 +3,10 @@
|
|||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" name="viewport" content="width=device-width, initial-scale=1" http-equiv="Content-Type">
|
<meta charset="UTF-8" name="viewport" content="width=device-width, initial-scale=1" http-equiv="Content-Type">
|
||||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
|
|
||||||
<link rel="stylesheet" th:href="@{/css/style.css}">
|
|
||||||
<title>取引登録</title>
|
<title>取引登録</title>
|
||||||
|
<link rel="stylesheet" th:href="@{/css/menu.css}">
|
||||||
|
|
||||||
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body style="padding-top:80px; padding-bottom:80px;">
|
<body style="padding-top:80px; padding-bottom:80px;">
|
||||||
@@ -44,11 +45,11 @@
|
|||||||
選択してください
|
選択してください
|
||||||
</option>
|
</option>
|
||||||
|
|
||||||
<option value="0">
|
<option value="1">
|
||||||
支出
|
支出
|
||||||
</option>
|
</option>
|
||||||
|
|
||||||
<option value="1">
|
<option value="2">
|
||||||
収入
|
収入
|
||||||
</option>
|
</option>
|
||||||
|
|
||||||
@@ -113,7 +114,7 @@
|
|||||||
|
|
||||||
<div th:replace="~{footer :: footer}"></div>
|
<div th:replace="~{footer :: footer}"></div>
|
||||||
|
|
||||||
<script th:inline="javascript">
|
<script inline="javascript">
|
||||||
const transactionType = document.getElementById("transactionType");
|
const transactionType = document.getElementById("transactionType");
|
||||||
const categoryId = document.getElementById("categoryId");
|
const categoryId = document.getElementById("categoryId");
|
||||||
|
|
||||||
@@ -122,19 +123,16 @@
|
|||||||
|
|
||||||
const tType = '[[${session.tType}]]';
|
const tType = '[[${session.tType}]]';
|
||||||
|
|
||||||
console.log("tType: " + tType);
|
if (tType == "0") {
|
||||||
|
transactionType.value = 1;
|
||||||
if (tType.includes("0")) {
|
} else {
|
||||||
console.log("okokokokokokokkkokokokoko");
|
transactionType.value = 2;
|
||||||
transactionType.value = "0";
|
|
||||||
} else if (tType.includes("1")) {
|
|
||||||
transactionType.value = "1";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function toggleCategory() {
|
transactionType.addEventListener("change", function () {
|
||||||
|
|
||||||
if (transactionType.value === "0") {
|
if (this.value === "1") {
|
||||||
|
|
||||||
for (let i = 0; i < expenseList.length; i++) {
|
for (let i = 0; i < expenseList.length; i++) {
|
||||||
expenseList[i].style.display = "";
|
expenseList[i].style.display = "";
|
||||||
@@ -144,7 +142,7 @@
|
|||||||
incomeList[i].style.display = "none";
|
incomeList[i].style.display = "none";
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (transactionType.value === "1") {
|
} else if (this.value === "2") {
|
||||||
|
|
||||||
for (let i = 0; i < expenseList.length; i++) {
|
for (let i = 0; i < expenseList.length; i++) {
|
||||||
expenseList[i].style.display = "none";
|
expenseList[i].style.display = "none";
|
||||||
@@ -164,18 +162,9 @@
|
|||||||
incomeList[i].style.display = "none";
|
incomeList[i].style.display = "none";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
transactionType.addEventListener("change", function () {
|
|
||||||
|
|
||||||
toggleCategory();
|
|
||||||
|
|
||||||
categoryId.value = "";
|
categoryId.value = "";
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
toggleCategory();
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -83,33 +83,18 @@
|
|||||||
カテゴリ
|
カテゴリ
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<!-- <select id="categoryId"-->
|
<select id="categoryId"
|
||||||
<!-- class="form-select"-->
|
class="form-select"
|
||||||
<!-- th:field="*{categoryId}"-->
|
th:field="*{categoryId}"
|
||||||
<!-- required>-->
|
required>
|
||||||
|
|
||||||
<!-- <option value="">-->
|
|
||||||
<!-- 選択してください-->
|
|
||||||
<!-- </option>-->
|
|
||||||
|
|
||||||
<!-- <option th:each="category : ${categoryFormList}"-->
|
|
||||||
<!-- th:value="${category.categoryId}"-->
|
|
||||||
<!-- th:text="${category.categoryName}">-->
|
|
||||||
<!-- </option>-->
|
|
||||||
|
|
||||||
<!-- </select>-->
|
|
||||||
<select id="categoryId" class="form-select" th:field="*{categoryId}" required>
|
|
||||||
|
|
||||||
<option value="">
|
<option value="">
|
||||||
選択してください
|
選択してください
|
||||||
</option>
|
</option>
|
||||||
|
|
||||||
<option class="expenseListClass" th:each="category : ${expenseList}"
|
<option th:each="category : ${categoryFormList}"
|
||||||
th:value="${category.categoryId}" th:text="${category.categoryName}">
|
th:value="${category.categoryId}"
|
||||||
</option>
|
th:text="${category.categoryName}">
|
||||||
|
|
||||||
<option class="incomeListClass" th:each="category : ${incomeList}"
|
|
||||||
th:value="${category.categoryId}" th:text="${category.categoryName}">
|
|
||||||
</option>
|
</option>
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
@@ -156,68 +141,6 @@
|
|||||||
<div th:replace="~{footer :: footer}">
|
<div th:replace="~{footer :: footer}">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script th:inline="javascript">
|
|
||||||
const transactionType = document.getElementById("transactionType");
|
|
||||||
const categoryId = document.getElementById("categoryId");
|
|
||||||
|
|
||||||
const expenseList = document.getElementsByClassName("expenseListClass");
|
|
||||||
const incomeList = document.getElementsByClassName("incomeListClass");
|
|
||||||
|
|
||||||
const tType = '[[${session.tType}]]';
|
|
||||||
|
|
||||||
function toggleCategory() {
|
|
||||||
|
|
||||||
if (transactionType.value === "0") {
|
|
||||||
|
|
||||||
for (let i = 0; i < expenseList.length; i++) {
|
|
||||||
expenseList[i].style.display = "";
|
|
||||||
}
|
|
||||||
|
|
||||||
for (let i = 0; i < incomeList.length; i++) {
|
|
||||||
incomeList[i].style.display = "none";
|
|
||||||
}
|
|
||||||
|
|
||||||
} else if (transactionType.value === "1") {
|
|
||||||
|
|
||||||
for (let i = 0; i < expenseList.length; i++) {
|
|
||||||
expenseList[i].style.display = "none";
|
|
||||||
}
|
|
||||||
|
|
||||||
for (let i = 0; i < incomeList.length; i++) {
|
|
||||||
incomeList[i].style.display = "";
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
for (let i = 0; i < expenseList.length; i++) {
|
|
||||||
expenseList[i].style.display = "none";
|
|
||||||
}
|
|
||||||
|
|
||||||
for (let i = 0; i < incomeList.length; i++) {
|
|
||||||
incomeList[i].style.display = "none";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
transactionType.addEventListener("change", function () {
|
|
||||||
|
|
||||||
toggleCategory();
|
|
||||||
|
|
||||||
categoryId.value = "";
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
if (tType == "0") {
|
|
||||||
transactionType.value = "0";
|
|
||||||
} else if (tType == "1") {
|
|
||||||
transactionType.value = "1";
|
|
||||||
}
|
|
||||||
|
|
||||||
toggleCategory();
|
|
||||||
|
|
||||||
</script>
|
|
||||||
|
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
@@ -80,7 +80,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label for="goalId" class="form-label">目標貯金額</label>
|
<label for="goalId" class="form-label">目標</label>
|
||||||
<input type="number" id="goalId" class="form-control" th:field="*{goalId}" min="0" required>
|
<input type="number" id="goalId" class="form-control" th:field="*{goalId}" min="0" required>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user