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)
.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("currentAmount", result.getCurrentAmount());
@@ -391,6 +392,20 @@ public class TransactionController {
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";
}

View File

@@ -1,17 +1,25 @@
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<meta charset="UTF-8" name="viewport" content="width=device-width, initial-scale=1" http-equiv="Content-Type">
<title>目標作成</title>
<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>
<body class="pb-5 pt-5">
<body style="padding-top:80px; padding-bottom:80px;">
<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">
<input type="hidden" th:field="*{goalId}">
@@ -33,9 +41,10 @@
<div>
<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>
<button type="submit">更新する</button>
<button type="submit" class="btn btn-sm btn-primary w-100">更新する</button>
</form>
@@ -43,4 +52,5 @@
</body>
</html>

View File

@@ -31,9 +31,11 @@
</div>
<div style="width: 600px; height: 300px;">
<div class="card shadow-sm mb-3">
<div style="height: 400px;">
<canvas id="myChart"></canvas>
</div>
</div>
<script th:inline="javascript">
@@ -81,6 +83,7 @@
options: {
responsive: true,
maintainAspectRatio: false,
scales: {
@@ -101,21 +104,22 @@
</script>
<!-- -->
<div>
<ul>
<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">
<table class="table">
<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>
@@ -125,10 +129,12 @@
<th>目標説明</th>
<td th:text="${goalForm.goalSubtitle}"></td>
</tr>
<tr>
<th>目標金額</th>
<td th:text="${goalForm.targetAmount}"></td>
</tr>
<tr>
<th>目標達成期限</th>
<td th:text="${goalForm.deadline}"></td>
@@ -138,47 +144,44 @@
<th>達成率</th>
<td th:text="${goalForm.achievementRate} + '%'"></td>
</tr>
</table>
</div>
</form>
</div>
<div class="transaction-buttons">
<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 w-100">
<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-primary w-100">
<button type="submit" class="btn btn-sm btn-danger">
削除
</button>
</form>
</div>
</li>
</ul>
</div>
<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>
@@ -190,8 +193,7 @@
</button>
</form>
</div>
<div th:replace="~{footer :: footer}"></div>
</body>

View File

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