This commit is contained in:
2026-09-24 13:22:18 +09:00
20 changed files with 647 additions and 74 deletions

View File

@@ -0,0 +1,66 @@
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>固定費詳細</title>
<link rel="stylesheet" th:href="@{/css/transaction_detail.css}">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
</head>
<body class="pb-5 pt-5">
<div th:replace="~{header :: header}"></div>
<h1 th:text="${today}"></h1>
<div>
<ul>
<li th:each="fixedCostForm : ${fixedCostFormList}" class="transaction-item">
<div>
<p>
カテゴリ名:
<span th:text="${fixedCostForm.categoryName}"></span>
<br>
固定費名:
<span th:text="${fixedCostForm.fixedCostName}"></span>
<br>
金額:
<span th:text="${fixedCostForm.amount}"></span>
</p>
</div>
<div class="transaction-buttons">
<form th:action="@{/transaction/create}" method="get">
<input type="hidden" name="fixedCostId" th:value="${fixedCostForm.fixedCostId}">
<input type="hidden" name="today" th:value="${today}">
<button type="submit">登録</button>
</form>
<form th:action="@{/fixed-cost/delete}" method="post">
<input type="hidden" name="fixedCostId" th:value="${fixedCostForm.fixedCostId}">
<input type="hidden" name="today" th:value="${today}">
<button type="submit">削除</button>
</form>
</div>
<hr>
<hr>
</li>
</ul>
</div>
<form th:action="@{/fixed-cost/create}" method="get">
<input type="hidden" name="today" id="today" th:value="${today}">
<button type="submit">新規登録</button>
</form>
<div th:replace="~{footer :: footer}"></div>
</body>
</html>

View File

@@ -0,0 +1,129 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" th:href="@{/css/menu.css}">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
</head>
<body class="pb-5 pt-5">
<div th:replace="~{header :: header}"></div>
<h1>取引登録</h1>
<form th:action="@{/fixed-cost/create}" th:object="${fixedCostForm}" method="post">
<div>
<label for="fixedCostName">固定費名</label>
<input type="text" id="fixedCostName" th:field="*{fixedCostName}" required>
</div>
<br>
<div>
<label for="transactionType">収入・支出</label>
<select id="transactionType">
<option value="">選択してください</option>
<option value="1">支出</option>
<option value="2">収入</option>
</select>
</div>
<br>
<div>
<label for="categoryId">カテゴリ</label>
<select id="categoryId" th:field="*{categoryId}">
<option value="">選択してください</option>
<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>
</div>
<br>
<div>
<label for="amount">金額</label>
<input type="number" id="amount" th:field="*{amount}" min="0" placeholder="金額を入力してください" required>
</div>
<br>
<input type="hidden" name="today" id="today" th:value="${today}">
<button type="submit">登録</button>
</form>
<div th:replace="~{footer :: footer}"></div>
<script>
const transactionType = document.getElementById("transactionType");
const categoryId = document.getElementById("categoryId");
const expenseList = document.getElementsByClassName("expenseListClass");
const incomeList = document.getElementsByClassName("incomeListClass");
transactionType.addEventListener("change", function () {
if (this.value === "1") {
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 === "2") {
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>
</html>

View File

@@ -113,17 +113,17 @@
</div>
<div>
<span>目標貯金</span>
<span th:text="${targetAmount}"></span>
<span>円</span>
</div>
<!-- <div>-->
<!-- <span>目標貯金</span>-->
<!-- <span th:text="${targetAmount}"></span>-->
<!-- <span>円</span>-->
<!-- </div>-->
<div>
<span>現在高</span>
<span th:text="${currentAmount}"></span>
<span>円</span>
</div>
<!-- <div>-->
<!-- <span>現在高</span>-->
<!-- <span th:text="${currentAmount}"></span>-->
<!-- <span>円</span>-->
<!-- </div>-->
<div>
<span>貯金額</span>
@@ -133,16 +133,16 @@
<hr>
<div>
<span>達成率</span>
<span th:text="${achievementRate}"></span>
<span>%</span>
</div>
<div>
<span>達成期限</span>
<span th:text="${deadline}"></span>
<span>円</span>
</div>
<!-- <div>-->
<!-- <span>達成率</span>-->
<!-- <span th:text="${achievementRate}"></span>-->
<!-- <span>%</span>-->
<!-- </div>-->
<!-- <div>-->
<!-- <span>達成期限</span>-->
<!-- <span th:text="${deadline}"></span>-->
<!-- <span>円</span>-->
<!-- </div>-->
<div th:replace="~{footer :: footer}"></div>

View File

@@ -56,6 +56,10 @@
<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>
<div th:replace="~{footer :: footer}"></div>
</body>