28 Commits

Author SHA1 Message Date
a10a4053cf [FIX]不要なコメントを排除しました 2026-09-30 11:13:34 +09:00
s-choi
a811b0d261 [HOTFIX] なぜか収支入力画面でホームボタンを押下すると例外が発生する問題をコメント化しました。 2026-09-30 11:05:22 +09:00
s-choi
9d5dd5b9b2 [STYLE] 英語を日本語に変えました。 2026-09-30 10:09:04 +09:00
s-choi
378c169c1f [STYLE] 改行を整えました。 2026-09-30 09:42:00 +09:00
s-choi
e67912a259 [DELETE] 余計なファイルを削除しました。 2026-09-30 09:41:39 +09:00
s-choi
c470cc1970 Merge branch 'n-kawahito' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into s-choi 2026-09-29 16:08:24 +09:00
s-choi
edadbf86ec [FIX] 既存のデータは削除できないようにしました。 2026-09-29 16:08:10 +09:00
546a2927eb [FIX]目標がすぐ改行される問題を解消しました 2026-09-29 16:01:27 +09:00
s-choi
129d74a4df Merge branch 'n-kawahito' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into s-choi 2026-09-29 15:59:41 +09:00
s-choi
d3b76fb2cd [FIX] 所持金がnullに表示されるバグを修正しました。 2026-09-29 15:59:14 +09:00
s-choi
67cc89d2a8 [FIX] 固定費の収支区分が自動で入力されないバグを修正しました。 2026-09-29 15:58:55 +09:00
31b5e54023 [FIX]ボタン表示ミスを修正しました 2026-09-29 15:31:23 +09:00
1d34a2189d Merge branch 's-choi' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into n-kawahito 2026-09-29 15:25:45 +09:00
s-choi
bbee55f58f [FIX] 未達成の履歴がメニューに表示される問題を修正しました。 2026-09-29 15:24:56 +09:00
kkazuya
f319fcb9f8 [EDIT] 固定費登録の収支区分とカテゴリーを入力必須にしました 2026-09-29 15:22:15 +09:00
78d3042299 [EDIT]マージ跡を消しました 2026-09-29 15:13:56 +09:00
ead133ba65 Merge branch 's-choi' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into n-kawahito
# Conflicts:
#	src/main/resources/templates/select_course.html
2026-09-29 15:13:04 +09:00
00c3041d95 [FIX]収支の選択に合わせてカテゴリが出るようにしました。 2026-09-29 15:11:35 +09:00
s-choi
65b4a9e54a [EDIT] コース削除機能を追加しました。 2026-09-29 15:09:08 +09:00
s-choi
515c789399 [EDIT] コースの情報を配分入力画面でも渡されるようにしました。 2026-09-29 15:08:49 +09:00
s-choi
7299ee0d06 [EDIT] 余計な機能を削除しました。 2026-09-29 15:08:16 +09:00
s-choi
fa0bfa7c90 [FIX] 配分まで入力してもらったあと、保存されるように修正しました。コース削除機能を追加しました。 2026-09-29 15:07:58 +09:00
s-choi
a911eaabc5 [EDIT] courseIdによる削除クエリを追加しました。 2026-09-29 15:07:10 +09:00
d27d8afbb3 Merge branch 'k-kobayashi' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into n-kawahito 2026-09-29 14:48:01 +09:00
kkazuya
d291306599 [FIX] 取引更新画面のカテゴリ表示不備を修正しました。 2026-09-29 14:47:37 +09:00
04b15c4397 Merge branch 'k-kobayashi' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into n-kawahito 2026-09-29 14:38:33 +09:00
kkazuya
5c87473e55 [FIX] 固定費一覧画面の新規登録ボタンの遷移先を修正しました。 2026-09-29 14:35:31 +09:00
s-choi
52cf2b0a84 Merge branch 'k-kobayashi' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into s-choi 2026-09-29 12:53:49 +09:00
24 changed files with 431 additions and 291 deletions

View File

@@ -49,7 +49,7 @@ public class GlobalExceptionHandler {
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();
return TransitionTargetPageNameKeyword.ERROR_HTML;
@@ -61,7 +61,7 @@ public class GlobalExceptionHandler {
e.printStackTrace();
System.out.println("session invalidated exception");
session.invalidate();
// session.invalidate();
return TransitionTargetPageNameKeyword.ERROR_HTML;
}
}

View File

@@ -8,6 +8,4 @@ public interface AllocationService {
public List<AllocationModel> findAll();
public List<AllocationModel> save(List<AllocationModel> allocationModelList);
}

View File

@@ -3,6 +3,7 @@ package com.example.demo.app.domain.service;
import java.util.List;
import com.example.demo.app.domain.model.CourseModel;
import com.example.demo.app.presentation.form.AllocationFormList;
public interface CourseService {
@@ -12,12 +13,14 @@ public interface CourseService {
public Long findByName(String courName);
public CourseModel save(CourseModel courseModel, Long userId);
public CourseModel save(CourseModel courseModel, Long userId, AllocationFormList allocationFormList);
public List<CourseModel> findAllByUserId(Long userId);
public List<CourseModel> findAllByNull();
public String deleteCourse(Long courseId, Long userId);
}

View File

@@ -1,6 +1,5 @@
package com.example.demo.app.domain.service.impl;
import java.util.ArrayList;
import java.util.List;
import org.springframework.stereotype.Service;
@@ -26,26 +25,5 @@ public class AllocationServiceImpl implements AllocationService {
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;
}
}

View File

@@ -7,14 +7,19 @@ import jakarta.transaction.Transactional;
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.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.CourseOwnerEntity;
import com.example.demo.app.infra.entity.UserEntity;
import com.example.demo.app.infra.repository.AllocationRepository;
import com.example.demo.app.infra.repository.CategoryRepository;
import com.example.demo.app.infra.repository.CourseOwnerRepository;
import com.example.demo.app.infra.repository.CourseRepository;
import com.example.demo.app.infra.repository.UserRepository;
import com.example.demo.app.presentation.form.AllocationFormList;
import lombok.RequiredArgsConstructor;
@@ -22,9 +27,12 @@ import lombok.RequiredArgsConstructor;
@RequiredArgsConstructor
public class CourseServiceImpl implements CourseService {
private final AllocationRepository allocationRepository;
private final CourseRepository courseRepository;
private final UserRepository userRepository;
private final CourseOwnerRepository courseOwnerRepository;
private final CategoryRepository categoryRepository;
public List<CourseModel> findAll() {
@@ -49,12 +57,43 @@ public class CourseServiceImpl implements CourseService {
}
@Transactional
public CourseModel save(CourseModel courseModel, Long userId) {
public CourseModel save(CourseModel courseModel, Long userId, AllocationFormList allocationFormList) {
List<UserEntity> userEntityList = new ArrayList<>();
userEntityList.add(userRepository.findById(userId).get());
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);
user.setCourseEntity(result);
@@ -67,8 +106,39 @@ public class CourseServiceImpl implements CourseService {
courseOwnerRepository.save(courseOwnerEntity);
List<AllocationEntity> allocationEntityList = new ArrayList<>();
allocationModelList.forEach(allocationModel -> {
allocationEntityList.add(
AllocationModel.convertTo(
categoryRepository.findById(allocationModel.getCategoryId()).get(),
courseRepository.findById(allocationModel.getCourseId()).get(),
allocationModel.getAllocationRatio()));
});
List<AllocationModel> resultList = new ArrayList<>();
for (AllocationEntity allocationEntity : allocationEntityList) {
resultList.add(AllocationModel.convertFrom(allocationRepository.save(allocationEntity)));
}
return CourseModel.convertFrom(result);
}
@Transactional
public String deleteCourse(Long courseId, Long userId) {
UserEntity userEntity = userRepository.findById(userId).orElse(null);
if (userEntity.getCourseEntity().getCourseId() == courseId) {
return "selected";
} else if (courseId <= 6) {
return "original";
}
allocationRepository.deleteByCourseId(courseId);
courseOwnerRepository.deleteByCourseId(courseId);
courseRepository.deleteById(courseId);
return "ok";
}
}

View File

@@ -3,6 +3,7 @@ package com.example.demo.app.infra.repository;
import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import com.example.demo.app.domain.model.CourseInfoModel;
@@ -29,4 +30,8 @@ public interface AllocationRepository extends JpaRepository<AllocationEntity, Al
+ " a.categoryEntity.categoryId ASC ")
List<CourseInfoModel> findAllJoinedAllocation();
@Modifying
@Query("delete from AllocationEntity a where a.courseEntity.courseId = :courseId")
void deleteByCourseId(Long courseId);
}

View File

@@ -1,9 +1,15 @@
package com.example.demo.app.infra.repository;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import com.example.demo.app.infra.entity.CourseOwnerEntity;
public interface CourseOwnerRepository extends JpaRepository<CourseOwnerEntity, Long>{
@Modifying
@Query("delete from CourseOwnerEntity c where c.courseEntity.courseId = :courseId")
public void deleteByCourseId(Long courseId);
}

View File

@@ -13,7 +13,6 @@ import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import com.example.demo.aop.aspect.SessionCheck;
import com.example.demo.app.domain.model.AllocationModel;
import com.example.demo.app.domain.model.CourseModel;
import com.example.demo.app.domain.model.LoginModel;
import com.example.demo.app.domain.service.AllocationService;
@@ -111,48 +110,48 @@ public class CourseController {
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
CourseForm form = CourseForm
.convertFrom(courseService.save(CourseForm.convertTo(courseForm), loginUser.getUserId()));
session.setAttribute(PageReturnAttributeKeyword.COURSE_ID, form.getCourseId());
model.addAttribute("courseForm", courseForm);
return TransitionTargetPageNameKeyword.COURSE_CREATE_RATIO_HTML;
}
@SessionCheck
@PostMapping(TransitionTargetPageNameKeyword.COURSE_CREATE)
public String createCoursePost(@ModelAttribute AllocationFormList allocationFormList, HttpSession session) {
public String createCoursePost(@ModelAttribute CourseForm courseForm,
@ModelAttribute AllocationFormList allocationFormList, HttpSession session) {
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
List<AllocationModel> allocationModelList = new ArrayList<>();
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);
courseService.save(CourseForm.convertTo(courseForm), loginUser.getUserId(), allocationFormList);
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;
}
}

View File

@@ -275,7 +275,9 @@ public class GoalController {
int currentAmount = goalService.getCurrentAmount(userId);
model.addAttribute(PageReturnAttributeKeyword.CURRENT_AMOUNT, currentAmount);
// System.out.println("************************currentAmount : " + currentAmount);
session.setAttribute(PageReturnAttributeKeyword.CURRENT_AMOUNT, currentAmount);
return TransitionTargetPageNameKeyword.GOAL_CREATE_HTML;
}

View File

@@ -297,6 +297,23 @@ public class TransactionController {
transactionService.findMoneyRecord(transactionId),
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_FORM, transactionForm);
@@ -305,6 +322,8 @@ public class TransactionController {
model.addAttribute(PageReturnAttributeKeyword.TODAY, today);
session.setAttribute(SessionKeyword.T_TYPE, transactionForm.getTransactionType());
return TransitionTargetPageNameKeyword.TRANSACTION_UPDATE_HTML;
}
@@ -353,29 +372,29 @@ public class TransactionController {
@RequestParam(required = false, defaultValue = "0") String months) {
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
System.out.println("******************************************::1");
LocalDate today = LocalDate.now();
System.out.println("******************************************::2");
int year = (years.equals("0")) ? today.getYear() : Integer.parseInt(years);
System.out.println("******************************************::3");
int month = (months.equals("0")) ? today.getMonthValue() : Integer.parseInt(months);
System.out.println("******************************************::4");
YearMonth yearMonth = YearMonth.of(year, month);
System.out.println("******************************************::5");
int lastDay = yearMonth.lengthOfMonth();
System.out.println("******************************************::6");
int firstDayOfWeek = yearMonth.atDay(1).getDayOfWeek().getValue() % 7;
System.out.println("******************************************::7");
YearMonth previousYearMonth = yearMonth.minusMonths(1);
System.out.println("******************************************::8");
int previousYear = previousYearMonth.getYear();
int previousMonth = previousYearMonth.getMonthValue();
System.out.println("******************************************::9");
YearMonth nextYearMonth = yearMonth.plusMonths(1);
System.out.println("******************************************::10");
int nextYear = nextYearMonth.getYear();
int nextMonth = nextYearMonth.getMonthValue();
System.out.println("******************************************::11");
model.addAttribute(PageReturnAttributeKeyword.YEAR, year);
model.addAttribute(PageReturnAttributeKeyword.MONTH, month);
model.addAttribute(PageReturnAttributeKeyword.DAY, today.getDayOfMonth());
@@ -388,34 +407,34 @@ public class TransactionController {
model.addAttribute(PageReturnAttributeKeyword.NEXT_YEAR, nextYear);
model.addAttribute(PageReturnAttributeKeyword.NEXT_MONTH, nextMonth);
System.out.println("******************************************::12");
LocalDate startDate = yearMonth.atDay(1);
LocalDate endDate = yearMonth.atEndOfMonth();
System.out.println("******************************************::13");
List<Income> incomeList = transactionService.findTotalIncomeList(startDate, endDate, loginUser.getUserId());
System.out.println("******************************************::14");
List<Expense> expenseList = transactionService.findTotalExpenseList(startDate, endDate, loginUser.getUserId());
System.out.println("******************************************::15");
model.addAttribute(PageReturnAttributeKeyword.INCOME_LIST, incomeList);
model.addAttribute(PageReturnAttributeKeyword.EXPENSE_LIST, expenseList);
System.out.println("******************************************::16");
int totalIncome = transactionService.findTotalIncome(startDate, endDate, loginUser.getUserId());
int totalExpense = transactionService.findTotalExpense(startDate, endDate, loginUser.getUserId());
System.out.println("******************************************::17");
model.addAttribute(PageReturnAttributeKeyword.TOTAL_INCOME, totalIncome);
model.addAttribute(PageReturnAttributeKeyword.TOTAL_EXPENSE, totalExpense);
System.out.println("******************************************::18");
List<GoalForm> goalForm = GoalForm.convertFrom(goalService.getGoalByUserId(loginUser.getUserId()));
System.out.println("******************************************::19");
UserForm userForm = UserForm.convertFrom(userService.findByUserId(loginUser.getUserId()));
System.out.println("******************************************::20");
List<GoalForm> resultList = goalForm.stream().filter(goal -> goal.getGoalComplete() == 0)
List<GoalForm> resultList = goalForm.stream().filter(goal -> goal.getGoalComplete() == 0 && goal.getDeadline().isAfter(today) )
.collect(Collectors.toList());
System.out.println("******************************************::21");
if (!resultList.isEmpty()) {
GoalForm result = resultList.getFirst();
System.out.println("******************************************::22");
model.addAttribute(PageReturnAttributeKeyword.ACHIEVEMENT_RATE, result.getAchievementRate());
model.addAttribute(PageReturnAttributeKeyword.CURRENT_AMOUNT, result.getCurrentAmount());

View File

@@ -1,5 +0,0 @@
package com.example.demo.utility;
public class Constant {
}

View File

@@ -1,5 +0,0 @@
package com.example.demo.utility;
public class TestController1 {
}

View File

@@ -214,6 +214,10 @@ td:hover {
vertical-align: middle;
}
.goal {
min-width: 300px;
}
/* =======================
ボタン
======================= */

View File

@@ -1,15 +0,0 @@
.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;
}

View File

@@ -24,58 +24,64 @@
<div class="mb-3">
<label class="form-label" for="allocationRatio4">固定費</label>
<input class="form-control" type="number" min="0" max="100" onchange="inputChange()" id="allocationRatio4" th:field="*{allocationRatio4}" required>
<input class="form-control" type="number" min="0" max="100" onchange="inputChange()"
id="allocationRatio4" th:field="*{allocationRatio4}" required>
</div>
<br>
<div class="mb-3">
<label class="form-label" for="allocationRatio5">食費</label>
<input class="form-control" type="number" min="0" max="100" onchange="inputChange()" id="allocationRatio5" th:field="*{allocationRatio5}" required>
<input class="form-control" type="number" min="0" max="100" onchange="inputChange()"
id="allocationRatio5" th:field="*{allocationRatio5}" required>
</div>
<br>
<div class="mb-3">
<label class="form-label" for="allocationRatio6">交通費</label>
<input class="form-control" type="number" min="0" max="100" onchange="inputChange()" id="allocationRatio6" th:field="*{allocationRatio6}" required>
<input class="form-control" type="number" min="0" max="100" onchange="inputChange()"
id="allocationRatio6" th:field="*{allocationRatio6}" required>
</div>
<br>
<div class="mb-3">
<label class="form-label" for="allocationRatio7">日用品費</label>
<input class="form-control" type="number" min="0" max="100" onchange="inputChange()" id="allocationRatio7" th:field="*{allocationRatio7}" required>
<input class="form-control" type="number" min="0" max="100" onchange="inputChange()"
id="allocationRatio7" th:field="*{allocationRatio7}" required>
</div>
<br>
<div class="mb-3">
<label class="form-label" for="allocationRatio8">被服/美容費</label>
<input class="form-control" type="number" min="0" max="100" onchange="inputChange()" id="allocationRatio8" th:field="*{allocationRatio8}" required>
<input class="form-control" type="number" min="0" max="100" onchange="inputChange()"
id="allocationRatio8" th:field="*{allocationRatio8}" required>
</div>
<br>
<div class="mb-3">
<label class="form-label" for="allocationRatio9">医療費</label>
<input class="form-control" type="number" min="0" max="100" onchange="inputChange()" id="allocationRatio9" th:field="*{allocationRatio9}" required>
<input class="form-control" type="number" min="0" max="100" onchange="inputChange()"
id="allocationRatio9" th:field="*{allocationRatio9}" required>
</div>
<br>
<div class="mb-3">
<label class="form-label" for="allocationRatio10">趣味/娯楽費</label>
<input class="form-control" type="number" min="0" max="100" onchange="inputChange()" id="allocationRatio10"
th:field="*{allocationRatio10}" required>
<input class="form-control" type="number" min="0" max="100" onchange="inputChange()"
id="allocationRatio10" th:field="*{allocationRatio10}" required>
</div>
<br>
<div class="mb-3">
<label class="form-label" for="allocationRatio11">その他</label>
<input class="form-control" type="number" min="0" max="100" onchange="inputChange()" id="allocationRatio11"
th:field="*{allocationRatio11}" required>
<input class="form-control" type="number" min="0" max="100" onchange="inputChange()"
id="allocationRatio11" th:field="*{allocationRatio11}" required>
</div>
<div class="mb-3">
@@ -88,7 +94,15 @@
<button type="submit" class="btn btn-primary" id="submit" disabled="true">登録</button>
</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>

View File

@@ -58,7 +58,7 @@
</div>
<div class="d-grid mt-4">
<form th:action="@{/category/create}" method="get">
<form th:action="@{/fixed-cost/create}" method="get">
<input type="hidden"
name="today"

View File

@@ -37,7 +37,7 @@
<div class="mb-3">
<label class="form-label" for="transactionType">収入・支出</label>
<select class="form-select" id="transactionType">
<select class="form-select" id="transactionType" required>
<option value="">選択してください</option>
<option value="0">支出</option>
@@ -51,7 +51,7 @@
<div class="mb-3">
<label class="form-label" for="categoryId">カテゴリ</label>
<select class="form-select" id="categoryId" th:field="*{categoryId}">
<select class="form-select" id="categoryId" th:field="*{categoryId}" required>
<option value="">選択してください</option>
<option class="expenseListClass" th:each="category : ${expenseList}"

View File

@@ -37,7 +37,9 @@
<div>
<label>目標金額</label>
<input type="number" th:field="*{targetAmount}" required min="1">
<span th:text="|所持金:${currentAmount}円|"></span>
<br>
<span th:text="|所持金:${session.currentAmount}円|"></span>
<input type="hidden" name="currentAmount" th:value="${currentAmount}">
<span th:if="${message != null}">
<span th:text="${message}" style="color: red;"></span>
</span>

View File

@@ -54,143 +54,102 @@
const myChart =
new Chart(myCt, {
type: 'bar',
data: {
labels: labels,
datasets: [
{
label: '達成率',
data: achievementRates,
backgroundColor:
'rgba(54, 162, 235, 0.5)',
borderColor:
'rgba(54, 162, 235, 1)',
borderWidth: 1
}
]
},
options: {
responsive: true,
maintainAspectRatio: false,
scales: {
y: {
beginAtZero: true,
max: 100,
ticks: {
callback: function (value) {
return value + '%';
}
}
}
}
}
});
</script>
<ul>
<li th:each="goalForm : ${goalFormList}">
<div class="d-flex justify-content-between">
<form th:action="@{/goal}" method="get" class="w-100">
<div class="table-responsive">
<table class="table mb-0">
<input type="radio" name="goalId" th:value="${goalForm.goalId}"
th:checked="${graphGoal != null and graphGoal.goalId == goalForm.goalId}"
onchange="this.form.submit()">
<tr>
<th>目標名</th>
<td th:text="${goalForm.goalTitle}"></td>
<td th:text="${goalForm.goalTitle}"
class="goal"></td>
</tr>
<tr>
<th>目標説明</th >
<td th:text="${goalForm.goalSubtitle}"></td>
<td th:text="${goalForm.goalSubtitle}"
class="goal"></td>
</tr>
<tr>
<th>目標金額</th>
<td th:text="${goalForm.targetAmount}"></td>
<td th:text="${goalForm.targetAmount}"
class="goal"></td>
</tr>
<tr>
<th>目標達成期限</th>
<td th:text="${goalForm.deadline}"></td>
<td th:text="${goalForm.deadline}"
class="goal"></td>
</tr>
<tr>
<th>達成率</th>
<td th:text="${goalForm.achievementRate} + '%'"></td>
<td th:text="${goalForm.achievementRate} + '%'"
class="goal"></td>
</tr>
</table>
</div>
</form>
</div>
<div class="d-flex justify-content-end gap-2 mt-3">
<form th:action="@{/goal/edit}" method="get">
<input type="hidden" name="goalId" th:value="${goalForm.goalId}">
<button type="submit" class="btn btn-sm btn-primary">
編集
</button>
</form>
<form th:action="@{/goal/delete}" method="post">
<input type="hidden" name="goalId" th:value="${goalForm.goalId}">
<button type="submit" class="btn btn-sm btn-danger">
削除
</button>
</form>
</div>
</li>
</ul>
</div>
<div class="d-grid gap-2 mt-4">
<form th:action="@{/goal/create}" method="get">
<button type="submit" class="btn btn-success w-100">
@@ -200,7 +159,6 @@
</form>
<form th:action="@{/goal/record}" method="get">
<button type="submit" class="btn btn-sm btn-primary w-100">
履歴
</button>
@@ -208,7 +166,6 @@
</form>
</div>
<div th:replace="~{footer :: footer}"></div>
</body>

View File

@@ -6,7 +6,7 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Calendar</title>
<title>カレンダー</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
@@ -55,51 +55,35 @@
<tbody>
<tr th:each="week : ${#numbers.sequence(0, 5)}">
<td th:each="weekDay : ${#numbers.sequence(0, 6)}">
<a th:if="${week * 7 + weekDay - firstDayOfWeek + 1 >= 1
and week * 7 + weekDay - firstDayOfWeek + 1 <= lastDay}" th:href="@{/transaction/detail(
todayDates=${T(java.time.LocalDate).of(year, month, week * 7 + weekDay - firstDayOfWeek + 1)}
)}" class="a-footer">
<div
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>
<div th:each="income : ${incomeList}"
th:if="${income.date.dayOfMonth == week * 7 + weekDay - firstDayOfWeek + 1}"
class="income" th:text="|収入 +${income.amount}円|">
</div>
<div th:each="expense : ${expenseList}"
th:if="${expense.date.dayOfMonth == week * 7 + weekDay - firstDayOfWeek + 1}"
class="expense" th:text="|支出 -${expense.amount}円|">
</div>
</div>
</a>
</td>
</tr>
</tbody>
</table>
<div class="card shadow-sm mb-3">
<div class="card-body">
<div class="d-flex justify-content-between mb-2">
<span>収入</span>
<span th:text="'¥' + ${totalIncome}"></span>
@@ -124,25 +108,19 @@
<span>目標資金</span>
<span th:text="'¥' + ${targetAmount}"></span>
</div>
<div class="d-flex justify-content-between mb-2">
<span>現在高</span>
<span th:text="'¥' + ${currentAmount}"></span>
</div>
<div class="d-flex justify-content-between">
<span>貯金額</span>
<span th:text="'¥' + ${saving}"></span>
</div>
</div>
</div>
<div class="card shadow-sm">
<div class="card-body">
<div class="d-flex justify-content-between mb-2">
<span>達成率</span>
<span th:text="${achievementRate} + '%'"

View File

@@ -22,7 +22,8 @@
</form>
</th:block>
<form th:action="${mode == 'regist'} ? @{/user/register/return}: @{/change}" method="post">
</th:block>
<form th:action="${mode == 'regist'} ? @{/user/register/return}: @{/change}" id="totalForm" method="post">
<button type="submit" class="btn btn-primary w-100">確定</button>
<div class="accordion" id="accordionExample">
@@ -35,6 +36,9 @@
aria-controls="'collapse' + ${course.courseId}">
<span th:text="${course.courseName}"></span>
</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>
<div th:id="'collapse' + ${course.courseId}" class="accordion-collapse collapse"
data-bs-parent="#accordionExample" style="padding-bottom: 120px;">
@@ -62,6 +66,43 @@
<div th:replace="~{footer :: footer}"></div>
</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>
</body>

View File

@@ -113,7 +113,7 @@
<div th:replace="~{footer :: footer}"></div>
<script inline="javascript">
<script th:inline="javascript">
const transactionType = document.getElementById("transactionType");
const categoryId = document.getElementById("categoryId");
@@ -122,16 +122,19 @@
const tType = '[[${session.tType}]]';
if (tType == "0") {
transactionType.value = 0;
} else if (tType == "1") {
transactionType.value = 1;
console.log("tType: " + tType);
if (tType.includes("0")) {
console.log("okokokokokokokkkokokokoko");
transactionType.value = "0";
} else if (tType.includes("1")) {
transactionType.value = "1";
}
transactionType.addEventListener("change", function () {
function toggleCategory() {
if (this.value === "0") {
if (transactionType.value === "0") {
for (let i = 0; i < expenseList.length; i++) {
expenseList[i].style.display = "";
@@ -141,7 +144,7 @@
incomeList[i].style.display = "none";
}
} else if (this.value === "1") {
} else if (transactionType.value === "1") {
for (let i = 0; i < expenseList.length; i++) {
expenseList[i].style.display = "none";
@@ -161,9 +164,18 @@
incomeList[i].style.display = "none";
}
}
}
transactionType.addEventListener("change", function () {
toggleCategory();
categoryId.value = "";
});
toggleCategory();
</script>

View File

@@ -83,18 +83,33 @@
カテゴリ
</label>
<select id="categoryId"
class="form-select"
th:field="*{categoryId}"
required>
<!-- <select id="categoryId"-->
<!-- class="form-select"-->
<!-- th:field="*{categoryId}"-->
<!-- 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>
<option th:each="category : ${categoryFormList}"
th:value="${category.categoryId}"
th:text="${category.categoryName}">
<option class="expenseListClass" th:each="category : ${expenseList}"
th:value="${category.categoryId}" th:text="${category.categoryName}">
</option>
<option class="incomeListClass" th:each="category : ${incomeList}"
th:value="${category.categoryId}" th:text="${category.categoryName}">
</option>
</select>
@@ -141,6 +156,68 @@
<div th:replace="~{footer :: footer}">
</div>
<script th:inline="javascript">
const transactionType = document.getElementById("transactionType");
const categoryId = document.getElementById("categoryId");
const expenseList = document.getElementsByClassName("expenseListClass");
const incomeList = document.getElementsByClassName("incomeListClass");
const tType = '[[${session.tType}]]';
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>
</html>