4 Commits

Author SHA1 Message Date
s-choi
29749c444a [HOTFIX] 目標がなかった場合、ログインできない問題を修正しました。 2026-09-25 14:39:03 +09:00
s-choi
073ee12f03 [STYLE] グラフなどのCSS結合 2026-09-25 14:38:38 +09:00
s-choi
1438c94406 [STYLE] 目標作成画面のCSS結合 2026-09-25 14:38:21 +09:00
s-choi
65290c0189 [STYLE] bodyの間隔を調整しました。 2026-09-25 14:38:00 +09:00
4 changed files with 117 additions and 90 deletions

View File

@@ -378,9 +378,10 @@ public class TransactionController {
List<GoalForm> resultList = goalForm.stream().filter(goal -> goal.getGoalComplete() == 0) List<GoalForm> resultList = goalForm.stream().filter(goal -> goal.getGoalComplete() == 0)
.collect(Collectors.toList()); .collect(Collectors.toList());
GoalForm result = new GoalForm();
GoalForm result = resultList.getFirst(); if (resultList.getFirst() != null) {
result = resultList.getFirst();
model.addAttribute("achievementRate", result.getAchievementRate()); model.addAttribute("achievementRate", result.getAchievementRate());
model.addAttribute("currentAmount", result.getCurrentAmount()); model.addAttribute("currentAmount", result.getCurrentAmount());
@@ -391,6 +392,20 @@ public class TransactionController {
model.addAttribute("deadline", result.getDeadline()); model.addAttribute("deadline", result.getDeadline());
} else {
model.addAttribute("achievementRate", "目標を設定してください");
model.addAttribute("currentAmount", "目標を設定してください");
model.addAttribute("targetAmount", "目標を設定してください");
model.addAttribute("saving", userForm.getSaving());
model.addAttribute("deadline", "目標を設定してください");
}
return "menu"; return "menu";
} }

View File

@@ -1,17 +1,25 @@
<!DOCTYPE html> <!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"> <html xmlns:th="http://www.thymeleaf.org">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8" name="viewport" content="width=device-width, initial-scale=1" http-equiv="Content-Type">
<title>目標作成</title> <title>目標作成</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.7/dist/css/bootstrap.min.css" rel="stylesheet"> <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" th:href="@{/css/style.css}">
</head> </head>
<body class="pb-5 pt-5">
<body style="padding-top:80px; padding-bottom:80px;">
<div th:replace="~{header :: header}"></div> <div th:replace="~{header :: header}"></div>
<h1>目標作成</h1> <div class="main-container">
<h1 class="page-title">目標作成</h1>
<div class="card shadow-sm">
<div class="card-body">
<form th:action="@{/goal/create}" th:object="${goalForm}" method="post"> <form th:action="@{/goal/create}" th:object="${goalForm}" method="post">
<input type="hidden" th:field="*{goalId}"> <input type="hidden" th:field="*{goalId}">
@@ -33,9 +41,10 @@
<div> <div>
<label>目標達成期限</label> <label>目標達成期限</label>
<input type="date" th:field="*{deadline}" th:min="${#temporals.format(#temporals.createNow(), 'yyyy-MM-dd')}" required> <input type="date" th:field="*{deadline}"
th:min="${#temporals.format(#temporals.createNow(), 'yyyy-MM-dd')}" required>
</div> </div>
<button type="submit">更新する</button> <button type="submit" class="btn btn-sm btn-primary w-100">更新する</button>
</form> </form>
@@ -43,4 +52,5 @@
</body> </body>
</html> </html>

View File

@@ -31,9 +31,11 @@
</div> </div>
<div style="width: 600px; height: 300px;"> <div class="card shadow-sm mb-3">
<div style="height: 400px;">
<canvas id="myChart"></canvas> <canvas id="myChart"></canvas>
</div> </div>
</div>
<script th:inline="javascript"> <script th:inline="javascript">
@@ -81,6 +83,7 @@
options: { options: {
responsive: true, responsive: true,
maintainAspectRatio: false,
scales: { scales: {
@@ -101,21 +104,22 @@
</script> </script>
<!-- --> <!-- -->
<div>
<ul> <ul>
<li th:each="goalForm : ${goalFormList}" class="transaction-item"> <li th:each="goalForm : ${goalFormList}" class="transaction-item">
<div> <div class="d-flex justify-content-between">
<form th:action="@{/goal}" method="get" class="w-100">
<form th:action="@{/goal}" method="get"> <div class="table-responsive">
<table class="table"> <table class="table mb-0">
<input type="radio" name="goalId" th:value="${goalForm.goalId}" <input type="radio" name="goalId" th:value="${goalForm.goalId}"
th:checked="${graphGoal != null and graphGoal.goalId == goalForm.goalId}" th:checked="${graphGoal != null and graphGoal.goalId == goalForm.goalId}"
onchange="this.form.submit()"> onchange="this.form.submit()">
<tr> <tr>
<th>目標名</th> <th>目標名</th>
<td th:text="${goalForm.goalTitle}"></td> <td th:text="${goalForm.goalTitle}"></td>
@@ -125,10 +129,12 @@
<th>目標説明</th> <th>目標説明</th>
<td th:text="${goalForm.goalSubtitle}"></td> <td th:text="${goalForm.goalSubtitle}"></td>
</tr> </tr>
<tr> <tr>
<th>目標金額</th> <th>目標金額</th>
<td th:text="${goalForm.targetAmount}"></td> <td th:text="${goalForm.targetAmount}"></td>
</tr> </tr>
<tr> <tr>
<th>目標達成期限</th> <th>目標達成期限</th>
<td th:text="${goalForm.deadline}"></td> <td th:text="${goalForm.deadline}"></td>
@@ -138,47 +144,44 @@
<th>達成率</th> <th>達成率</th>
<td th:text="${goalForm.achievementRate} + '%'"></td> <td th:text="${goalForm.achievementRate} + '%'"></td>
</tr> </tr>
</table> </table>
</div>
</form> </form>
</div> </div>
<div class="d-flex justify-content-end gap-2 mt-3">
<div class="transaction-buttons">
<form th:action="@{/goal/edit}" method="get"> <form th:action="@{/goal/edit}" method="get">
<input type="hidden" name="goalId" th:value="${goalForm.goalId}"> <input type="hidden" name="goalId" th:value="${goalForm.goalId}">
<button type="submit" class="btn btn-sm btn-primary w-100"> <button type="submit" class="btn btn-sm btn-primary">
編集 編集
</button> </button>
</form> </form>
<form th:action="@{/goal/delete}" method="post"> <form th:action="@{/goal/delete}" method="post">
<input type="hidden" name="goalId" th:value="${goalForm.goalId}"> <input type="hidden" name="goalId" th:value="${goalForm.goalId}">
<button type="submit" class="btn btn-sm btn-primary w-100"> <button type="submit" class="btn btn-sm btn-danger">
削除 削除
</button> </button>
</form> </form>
</div> </div>
</li> </li>
</ul> </ul>
</div> </div>
<form th:action="@{/goal/create}" method="get"> <form th:action="@{/goal/create}" method="get">
<button type="submit" class="btn btn-sm btn-primary w-100"> <button type="submit" class="btn btn-success w-100">
新規登録 新規登録
</button> </button>
@@ -190,8 +193,7 @@
</button> </button>
</form> </form>
</div>
<div th:replace="~{footer :: footer}"></div> <div th:replace="~{footer :: footer}"></div>
</body> </body>

View File

@@ -10,7 +10,7 @@
<link rel="stylesheet" th:href="@{/css/style.css}"> <link rel="stylesheet" th:href="@{/css/style.css}">
</head> </head>
<body> <body style="padding-top:80px; padding-bottom:80px;">
<div th:replace="~{header :: header}"></div> <div th:replace="~{header :: header}"></div>
<div class="main-container"> <div class="main-container">