Compare commits
32 Commits
0f800da9a3
...
104fa5e319
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
104fa5e319 | ||
|
|
fb031e5255 | ||
|
|
cb5d228db4 | ||
|
|
18c51d3a65 | ||
|
|
0162f2f679 | ||
|
|
31d80388af | ||
|
|
bce2d01e48 | ||
|
|
6ee8a3aa59 | ||
|
|
84e55d7606 | ||
|
|
aad285f9ba | ||
|
|
f1e48b02f9 | ||
|
|
60e0694731 | ||
|
|
b09fd95c31 | ||
|
|
65282cdcb2 | ||
|
|
0687a1837e | ||
|
|
2a4150c883 | ||
|
|
add6a85c64 | ||
|
|
fd74dee965 | ||
|
|
7aa8e31bfd | ||
|
|
e3af89a694 | ||
|
|
efdaacbb27 | ||
| 154e6787d4 | |||
| 75f2f7c8d0 | |||
| ac101172d2 | |||
|
|
d7a0aac355 | ||
|
|
a45045d008 | ||
|
|
17074c3132 | ||
|
|
34172aecc9 | ||
|
|
e5af64b53b | ||
|
|
b76be8f38a | ||
|
|
47185d8f26 | ||
|
|
546206317d |
@@ -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,25 +39,27 @@ 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());
|
||||||
|
|
||||||
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";
|
||||||
}
|
}
|
||||||
|
|
||||||
@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);
|
|
||||||
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|
||||||
LOGGER.log(Level.SEVERE, SEVERE_ERROR_MESSAGE_ILLEGAL_TRANSITION, e);
|
System.out.println("session invalidated exception");
|
||||||
|
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);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ public class GoalModel {
|
|||||||
goalModel.getTargetAmount(),
|
goalModel.getTargetAmount(),
|
||||||
goalModel.getDeadline(),
|
goalModel.getDeadline(),
|
||||||
0,
|
0,
|
||||||
userEntity, 0);
|
userEntity);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static GoalModel convertFrom(GoalForm goalForm) {
|
public static GoalModel convertFrom(GoalForm goalForm) {
|
||||||
|
|||||||
@@ -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)));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ public class GoalServiceImpl implements GoalService {
|
|||||||
|
|
||||||
// 現在の資産 = 貯蓄金 + 収支合計
|
// 現在の資産 = 貯蓄金 + 収支合計
|
||||||
int currentAmount = userEntity.getSaving() + transactionTotal;
|
int currentAmount = userEntity.getSaving() + transactionTotal;
|
||||||
|
|
||||||
// 達成率(%) = 現在の資産 ÷ 目標金額 × 100
|
// 達成率(%) = 現在の資産 ÷ 目標金額 × 100
|
||||||
|
|
||||||
List<GoalModel> goalModelList = new ArrayList<GoalModel>();
|
List<GoalModel> goalModelList = new ArrayList<GoalModel>();
|
||||||
@@ -59,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);
|
||||||
@@ -82,7 +97,7 @@ public class GoalServiceImpl implements GoalService {
|
|||||||
|
|
||||||
return GoalModel.convertFrom(updatedGoalEntity, 0, 0);
|
return GoalModel.convertFrom(updatedGoalEntity, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void delete(Long goalId) {
|
public void delete(Long goalId) {
|
||||||
goalRepository.deleteById(goalId);
|
goalRepository.deleteById(goalId);
|
||||||
}
|
}
|
||||||
@@ -100,12 +115,29 @@ public class GoalServiceImpl implements GoalService {
|
|||||||
.sum();
|
.sum();
|
||||||
|
|
||||||
int currentAmount = userEntity.getSaving() + transactionTotal;
|
int currentAmount = userEntity.getSaving() + transactionTotal;
|
||||||
|
|
||||||
goalEntityList.stream().forEach(goalEntity -> {
|
goalEntityList.stream().forEach(goalEntity -> {
|
||||||
if (goalEntity.getTargetAmount() <= currentAmount) {
|
if (goalEntity.getTargetAmount() <= currentAmount) {
|
||||||
goalRepository.updateCompleteByGoalId(goalEntity.getGoalId());
|
goalRepository.updateCompleteByGoalId(goalEntity.getGoalId());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getCurrentAmount(Long userId) {
|
||||||
|
|
||||||
|
UserEntity userEntity = userRepository.findById(userId).orElseThrow();
|
||||||
|
|
||||||
|
int transactionTotal = userEntity.getTransactionEntityList().stream()
|
||||||
|
.mapToInt(t -> {
|
||||||
|
int sign = t.getCategoryEntity().getTransactionType() == 1 ? 1 : -1;
|
||||||
|
return sign * t.getAmount();
|
||||||
|
})
|
||||||
|
.sum();
|
||||||
|
|
||||||
|
int currentAmount = userEntity.getSaving() + transactionTotal;
|
||||||
|
|
||||||
|
return currentAmount;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -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,11 +52,14 @@ 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);
|
||||||
|
|
||||||
userRepository.save(userEntity);
|
goalEntity.setUserEntity(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)
|
@Column(name = "category_name", nullable = false, length = 50)
|
||||||
private String categoryName;
|
private String categoryName;
|
||||||
|
|
||||||
@Column(name = "transaction_type", nullable = false)
|
@Column(name = "transaction_type", nullable = false)
|
||||||
|
|||||||
@@ -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;
|
||||||
@@ -28,16 +27,13 @@ public class CourseEntity {
|
|||||||
@Column(name = "course_id")
|
@Column(name = "course_id")
|
||||||
private Long courseId;
|
private Long courseId;
|
||||||
|
|
||||||
@Column(name = "course_name", nullable = false)
|
@Column(name = "course_name", nullable = false, length = 50)
|
||||||
private String courseName;
|
private String courseName;
|
||||||
|
|
||||||
|
|
||||||
@Column(name = "description", nullable = false)
|
@Column(name = "description", nullable = false)
|
||||||
private String description;
|
private String description;
|
||||||
|
|
||||||
@OneToMany(mappedBy = "courseEntity")
|
|
||||||
private List<UserEntity> userEntity;
|
|
||||||
|
|
||||||
public static List<CourseModel> createCourseModelList(List<CourseEntity> courseEntityList) {
|
public static List<CourseModel> createCourseModelList(List<CourseEntity> courseEntityList) {
|
||||||
|
|
||||||
return courseEntityList
|
return courseEntityList
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -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)
|
@Column(name = "fixed_cost_name", nullable = false, length = 50)
|
||||||
private String fixedCostName;
|
private String fixedCostName;
|
||||||
|
|
||||||
@Column(name = "amount", nullable = false)
|
@Column(name = "amount", nullable = false)
|
||||||
|
|||||||
@@ -29,10 +29,10 @@ public class GoalEntity {
|
|||||||
private Long goalId;
|
private Long goalId;
|
||||||
|
|
||||||
@Column(name = "goal_title", nullable = true)
|
@Column(name = "goal_title", nullable = true)
|
||||||
private String goalTitle;
|
private String goalTitle = "名前を設定してください";
|
||||||
|
|
||||||
@Column(name = "goal_subtitle", nullable = true)
|
@Column(name = "goal_subtitle", nullable = true)
|
||||||
private String goalSubtitle;
|
private String goalSubtitle = "説明を書いてください";
|
||||||
|
|
||||||
@Column(name = "target_amount", nullable = true)
|
@Column(name = "target_amount", nullable = true)
|
||||||
private Integer targetAmount;
|
private Integer targetAmount;
|
||||||
@@ -46,7 +46,5 @@ public class GoalEntity {
|
|||||||
@ManyToOne(fetch = FetchType.LAZY)
|
@ManyToOne(fetch = FetchType.LAZY)
|
||||||
@JoinColumn(name = "user_id")
|
@JoinColumn(name = "user_id")
|
||||||
private UserEntity userEntity;
|
private UserEntity userEntity;
|
||||||
|
|
||||||
private Integer deleteFlag;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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)
|
@Column(name = "user_name", nullable = false, length = 100)
|
||||||
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)
|
@Column(name = "secret_answer", nullable = false, length = 100)
|
||||||
private String secretQuestionAnswer;
|
private String secretQuestionAnswer;
|
||||||
|
|
||||||
@Column(name = "birth_date", nullable = false)
|
@Column(name = "birth_date", nullable = false)
|
||||||
|
|||||||
@@ -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,17 +1,24 @@
|
|||||||
package com.example.demo.app.infra.repository;
|
package com.example.demo.app.infra.repository;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
import org.springframework.data.jpa.repository.Query;
|
import org.springframework.data.jpa.repository.Query;
|
||||||
|
|
||||||
import com.example.demo.app.infra.entity.CourseEntity;
|
import com.example.demo.app.infra.entity.CourseEntity;
|
||||||
|
|
||||||
public interface CourseRepository extends JpaRepository<CourseEntity, Long> {
|
public interface CourseRepository extends JpaRepository<CourseEntity, Long> {
|
||||||
|
|
||||||
@Query("SELECT c FROM CourseEntity c WHERE c.courseId = :courseId ")
|
@Query("SELECT c FROM CourseEntity c WHERE c.courseId = :courseId ")
|
||||||
public CourseEntity findByCourseId(Long courseId);
|
public CourseEntity findByCourseId(Long courseId);
|
||||||
|
|
||||||
@Query("SELECT c FROM CourseEntity c WHERE c.courseName = :courseName ")
|
@Query("SELECT c FROM CourseEntity c WHERE c.courseName = :courseName ")
|
||||||
public CourseEntity findByCourseName(String courseName);
|
public CourseEntity findByCourseName(String courseName);
|
||||||
|
|
||||||
|
@Query("select c from CourseEntity c inner join CourseOwnerEntity o on c.courseId = o.courseEntity.courseId inner join UserEntity u on o.userEntity.userId = u.userId where u.userId = :userId")
|
||||||
|
public List<CourseEntity> findAllByUserId(Long userId);
|
||||||
|
|
||||||
|
@Query("select c from CourseEntity c where c.courseId between 1 and 6")
|
||||||
|
public List<CourseEntity> findAllByNull();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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()));
|
||||||
|
|
||||||
@@ -116,28 +125,30 @@ public class CourseController {
|
|||||||
|
|
||||||
List<AllocationModel> allocationModelList = new ArrayList<>();
|
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(),
|
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId4(),
|
||||||
(Long) session.getAttribute(PageReturnAttributeKeyword.COURSE_ID), 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(PageReturnAttributeKeyword.COURSE_ID), 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(PageReturnAttributeKeyword.COURSE_ID), 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(PageReturnAttributeKeyword.COURSE_ID), 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(PageReturnAttributeKeyword.COURSE_ID), 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(PageReturnAttributeKeyword.COURSE_ID), 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(PageReturnAttributeKeyword.COURSE_ID), 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(PageReturnAttributeKeyword.COURSE_ID), allocationFormList.getAllocationRatio11()));
|
(Long) session.getAttribute(PageReturnAttributeKeyword.COURSE_ID),
|
||||||
|
allocationFormList.getAllocationRatio11()));
|
||||||
|
|
||||||
allocationService.save(allocationModelList);
|
allocationService.save(allocationModelList);
|
||||||
|
|
||||||
|
|||||||
@@ -11,4 +11,5 @@ public class ErrorController {
|
|||||||
public String showError() {
|
public String showError() {
|
||||||
return TransitionTargetPageNameKeyword.ERROR_HTML;
|
return TransitionTargetPageNameKeyword.ERROR_HTML;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -267,20 +267,31 @@ public class GoalController {
|
|||||||
|
|
||||||
@SessionCheck
|
@SessionCheck
|
||||||
@GetMapping(TransitionTargetPageNameKeyword.CREATE)
|
@GetMapping(TransitionTargetPageNameKeyword.CREATE)
|
||||||
public String createGoalGet(@ModelAttribute GoalForm goalForm, HttpSession session) {
|
public String createGoalGet(@ModelAttribute GoalForm goalForm, HttpSession session, Model model) {
|
||||||
|
|
||||||
|
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
|
||||||
|
|
||||||
|
Long userId = loginUser.getUserId();
|
||||||
|
|
||||||
|
int currentAmount = goalService.getCurrentAmount(userId);
|
||||||
|
|
||||||
|
model.addAttribute("currentAmount", currentAmount);
|
||||||
|
|
||||||
return TransitionTargetPageNameKeyword.GOAL_CREATE_HTML;
|
return TransitionTargetPageNameKeyword.GOAL_CREATE_HTML;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SessionCheck
|
@SessionCheck
|
||||||
@PostMapping(TransitionTargetPageNameKeyword.CREATE)
|
@PostMapping(TransitionTargetPageNameKeyword.CREATE)
|
||||||
public String createGoalPost(@ModelAttribute GoalForm goalForm, HttpSession session) {
|
public String createGoalPost(@ModelAttribute GoalForm goalForm, HttpSession session, Model model) {
|
||||||
|
|
||||||
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
|
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
|
||||||
|
|
||||||
Long userId = loginUser.getUserId();
|
Long userId = loginUser.getUserId();
|
||||||
|
|
||||||
goalService.createGoal(GoalModel.convertFrom(goalForm), userId);
|
if (goalService.createGoal(GoalModel.convertFrom(goalForm), userId) == null) {
|
||||||
|
model.addAttribute(PageReturnAttributeKeyword.MESSAGE, "現在所持金より高い金額を設定してください。");
|
||||||
|
return TransitionTargetPageNameKeyword.GOAL_CREATE_HTML;
|
||||||
|
}
|
||||||
|
|
||||||
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.GOAL;
|
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.GOAL;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ 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());
|
||||||
|
|||||||
@@ -218,8 +218,28 @@ public class TransactionController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
model.addAttribute(PageReturnAttributeKeyword.TRANSACTION_FORM, transactionForm);
|
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
|
session.setAttribute(SessionKeyword.T_TYPE, 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));
|
||||||
@@ -408,7 +428,7 @@ public class TransactionController {
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
final String MESSAGE = "目標を設定してください";
|
final String MESSAGE = "目標を設定してください";
|
||||||
|
|
||||||
model.addAttribute(PageReturnAttributeKeyword.ACHIEVEMENT_RATE, MESSAGE);
|
model.addAttribute(PageReturnAttributeKeyword.ACHIEVEMENT_RATE, MESSAGE);
|
||||||
|
|
||||||
model.addAttribute(PageReturnAttributeKeyword.CURRENT_AMOUNT, MESSAGE);
|
model.addAttribute(PageReturnAttributeKeyword.CURRENT_AMOUNT, MESSAGE);
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ 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;
|
||||||
|
|
||||||
@@ -58,7 +59,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(PageReturnAttributeKeyword.SELECTED_COURSE_NAME, courseService.findById(courseId).getCourseName());
|
session.setAttribute(SessionKeyword.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);
|
||||||
|
|
||||||
@@ -70,11 +71,9 @@ public class UserController {
|
|||||||
String selectedCourseName, Model model,
|
String selectedCourseName, Model model,
|
||||||
HttpSession session) {
|
HttpSession session) {
|
||||||
|
|
||||||
model.addAttribute(PageReturnAttributeKeyword.SELECTED_COURSE_NAME, (String) session.getAttribute("selectedCourseName"));
|
model.addAttribute(PageReturnAttributeKeyword.SELECTED_COURSE_NAME, (String) session.getAttribute(SessionKeyword.SELECTED_COURSE_NAME));
|
||||||
|
|
||||||
session.setAttribute("questionId", userForm.getSecretQuestionId());
|
session.setAttribute(SessionKeyword.QUESTION_ID, userForm.getSecretQuestionId());
|
||||||
|
|
||||||
System.out.println("return questionId: ****************************:" + userForm.getSecretQuestionId());
|
|
||||||
|
|
||||||
return TransitionTargetPageNameKeyword.USER_RESISTER_CONFIRM_HTML;
|
return TransitionTargetPageNameKeyword.USER_RESISTER_CONFIRM_HTML;
|
||||||
|
|
||||||
@@ -86,11 +85,9 @@ public class UserController {
|
|||||||
Model model,
|
Model model,
|
||||||
HttpSession session) {
|
HttpSession session) {
|
||||||
|
|
||||||
Long courseId = courseService.findByName((String) session.getAttribute(PageReturnAttributeKeyword.SELECTED_COURSE_NAME));
|
Long courseId = courseService.findByName((String) session.getAttribute(SessionKeyword.SELECTED_COURSE_NAME));
|
||||||
|
|
||||||
Long questionId = (Long) session.getAttribute("questionId");
|
Long questionId = (Long) session.getAttribute(SessionKeyword.QUESTION_ID);
|
||||||
|
|
||||||
System.out.println("confirm questionId: ****************************:" + questionId);
|
|
||||||
|
|
||||||
userForm.setSecretQuestionId(questionId);
|
userForm.setSecretQuestionId(questionId);
|
||||||
|
|
||||||
|
|||||||
@@ -3,4 +3,10 @@ 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";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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,6 +12,7 @@ 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;
|
||||||
|
|||||||
@@ -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}">
|
<input class="form-control" type="text" id="categoryName" th:field="*{categoryName}" required>
|
||||||
</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}">
|
<select class="form-select" id="transactionType" th:field="*{transactionType}" required>
|
||||||
|
|
||||||
<option value="">選択してください</option>
|
<option value="">選択してください</option>
|
||||||
<option value="0">支出</option>
|
<option value="0">支出</option>
|
||||||
|
|||||||
@@ -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}">
|
<input class="form-control" type="text" id="categoryName" th:field="*{categoryName}" required>
|
||||||
</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}">
|
<select class="form-select" id="transactionType" th:field="*{transactionType}" required>
|
||||||
|
|
||||||
<option value="">選択してください</option>
|
<option value="">選択してください</option>
|
||||||
<option value="0">支出</option>
|
<option value="0">支出</option>
|
||||||
|
|||||||
@@ -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}">
|
<input class="form-control" type="text" id="courseName" th:field="*{courseName}" required>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body style="padding-top:80px; padding-bottom:80px;">
|
<body style="padding-top:80px; padding-bottom:120px;">
|
||||||
|
|
||||||
<div th:replace="~{header :: header}"></div>
|
<div th:replace="~{header :: header}"></div>
|
||||||
|
|
||||||
@@ -22,86 +22,70 @@
|
|||||||
<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" id="allocationRatio4" th:field="*{allocationRatio4}">
|
<input class="form-control" type="number" min="0" max="100" onchange="inputChange()" 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" id="allocationRatio5" th:field="*{allocationRatio5}">
|
<input class="form-control" type="number" min="0" max="100" onchange="inputChange()" 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" id="allocationRatio6" th:field="*{allocationRatio6}">
|
<input class="form-control" type="number" min="0" max="100" onchange="inputChange()" 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" id="allocationRatio7" th:field="*{allocationRatio7}">
|
<input class="form-control" type="number" min="0" max="100" onchange="inputChange()" 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" id="allocationRatio8" th:field="*{allocationRatio8}">
|
<input class="form-control" type="number" min="0" max="100" onchange="inputChange()" 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" id="allocationRatio9" th:field="*{allocationRatio9}">
|
<input class="form-control" type="number" min="0" max="100" onchange="inputChange()" 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" id="allocationRatio10"
|
<input class="form-control" type="number" min="0" max="100" onchange="inputChange()" id="allocationRatio10"
|
||||||
th:field="*{allocationRatio10}">
|
th:field="*{allocationRatio10}" required>
|
||||||
</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" id="allocationRatio11"
|
<input class="form-control" type="number" min="0" max="100" onchange="inputChange()" id="allocationRatio11"
|
||||||
th:field="*{allocationRatio11}">
|
th:field="*{allocationRatio11}" required>
|
||||||
|
</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">登録</button>
|
<button type="submit" class="btn btn-primary" id="submit" disabled="true">登録</button>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
@@ -110,7 +94,27 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div th:replace="~{footer :: footer}"></div>
|
<div th:replace="~{footer :: footer}"></div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
function inputChange(){
|
||||||
|
let total=0;
|
||||||
|
|
||||||
|
for(let i=4; i<=11; i++){
|
||||||
|
total += Number(document.getElementById(`allocationRatio${i}`).value || 0);
|
||||||
|
if(total == 100){
|
||||||
|
document.getElementById('submit').disabled = false;
|
||||||
|
}else{
|
||||||
|
document.getElementById('submit').disabled = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
document.getElementById("allocationRatioTotal").value = total;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
|
|||||||
@@ -6,12 +6,6 @@
|
|||||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
</head>
|
</head>
|
||||||
<body class="pb-5 pt-5">
|
<body class="pb-5 pt-5">
|
||||||
|
|
||||||
<div th:replace="~{header :: header}">
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
|
|
||||||
<div th:replace="~{header :: header}">
|
<div th:replace="~{header :: header}">
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -40,8 +40,8 @@
|
|||||||
<select class="form-select" id="transactionType">
|
<select class="form-select" id="transactionType">
|
||||||
|
|
||||||
<option value="">選択してください</option>
|
<option value="">選択してください</option>
|
||||||
<option value="1">支出</option>
|
<option value="0">支出</option>
|
||||||
<option value="2">収入</option>
|
<option value="1">収入</option>
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
@@ -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="0" placeholder="金額を入力してください"
|
<input class="form-control" type="number" id="amount" th:field="*{amount}" min="1" placeholder="金額を入力してください"
|
||||||
required>
|
required>
|
||||||
</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,9 +91,10 @@
|
|||||||
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 === "0") {
|
||||||
|
|
||||||
for (let i = 0; i < expenseList.length; i++) {
|
for (let i = 0; i < expenseList.length; i++) {
|
||||||
expenseList[i].style.display = "";
|
expenseList[i].style.display = "";
|
||||||
@@ -102,7 +104,7 @@
|
|||||||
incomeList[i].style.display = "none";
|
incomeList[i].style.display = "none";
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (this.value === "2") {
|
} else if (this.value === "1") {
|
||||||
|
|
||||||
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";
|
||||||
|
|||||||
@@ -26,17 +26,21 @@
|
|||||||
|
|
||||||
<div>
|
<div>
|
||||||
<label>目標名</label>
|
<label>目標名</label>
|
||||||
<input type="text" th:field="*{goalTitle}" required>
|
<input type="text" th:field="*{goalTitle}">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<label>目標説明</label>
|
<label>目標説明</label>
|
||||||
<textarea th:field="*{goalSubtitle}" required></textarea>
|
<textarea th:field="*{goalSubtitle}"></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">
|
||||||
|
<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>
|
||||||
|
|
||||||
|
|||||||
@@ -59,6 +59,10 @@
|
|||||||
required>
|
required>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<span th:if="${message != null}">
|
||||||
|
<h4 th:text="${message}" style="color: red;"></h4>
|
||||||
|
</span>
|
||||||
|
|
||||||
<div class="d-grid">
|
<div class="d-grid">
|
||||||
|
|
||||||
|
|||||||
@@ -52,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; padding-top: 60px;">
|
||||||
<div th:replace="~{header :: header}"></div>
|
<div th:replace="~{header :: header}"></div>
|
||||||
<h1 class="page-title">コース選択</h1>
|
<h1 class="page-title">コース選択</h1>
|
||||||
|
|
||||||
@@ -34,7 +34,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="0">
|
||||||
支出
|
支出
|
||||||
</option>
|
</option>
|
||||||
|
|
||||||
<option value="2">
|
<option value="1">
|
||||||
収入
|
収入
|
||||||
</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 = 0;
|
||||||
|
} else {
|
||||||
|
transactionType.value = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
transactionType.addEventListener("change", function () {
|
||||||
|
|
||||||
|
if (this.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 (this.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";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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"
|
||||||
@@ -102,23 +103,50 @@
|
|||||||
</form>
|
</form>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="d-grid mt-4">
|
||||||
|
|
||||||
|
<form th:action="@{/fixed-cost/list}" method="get">
|
||||||
|
|
||||||
|
<input type="hidden"
|
||||||
|
name="today"
|
||||||
|
id="today"
|
||||||
|
th:value="${today}">
|
||||||
|
|
||||||
|
<button class="btn btn-dark w-100"
|
||||||
|
type="submit">
|
||||||
|
|
||||||
|
固定費一覧
|
||||||
|
|
||||||
|
</button>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="d-grid mt-4">
|
||||||
|
|
||||||
|
<form th:action="@{/category/list}"
|
||||||
|
method="get">
|
||||||
|
|
||||||
|
<input type="hidden"
|
||||||
|
name="today"
|
||||||
|
id="today"
|
||||||
|
th:value="${today}">
|
||||||
|
|
||||||
|
<button class="btn btn-dark w-100"
|
||||||
|
type="submit">
|
||||||
|
|
||||||
|
カテゴリ一覧
|
||||||
|
|
||||||
|
</button>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<form th:action="@{/transaction/create}" method="get">
|
|
||||||
<input type="hidden" name="today" id="today" th:value="${today}">
|
|
||||||
<button type="submit">新規登録</button>
|
|
||||||
</form>
|
|
||||||
<form th:action="@{/fixed-cost/list}" method="get">
|
|
||||||
<input type="hidden" name="today" th:value="${today}">
|
|
||||||
<button type="submit">固定費一覧</button>
|
|
||||||
</form>
|
|
||||||
<form th:action="@{/category/list}" method="get">
|
|
||||||
<input type="hidden" name="today" th:value="${today}">
|
|
||||||
<button type="submit">カテゴリ一覧</button>
|
|
||||||
</form>
|
|
||||||
|
|
||||||
<div th:replace="~{footer :: footer}"></div>
|
<div th:replace="~{footer :: footer}"></div>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
|
|||||||
@@ -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