[ADD] 収支の作成・削除・一覧検索・単体検索機能を追加しました。menu画面の追加及びカレンダー機能を追加しました。

This commit is contained in:
s-choi
2026-09-18 11:13:20 +09:00
parent 039f416f49
commit 52f2559cf7
5 changed files with 222 additions and 0 deletions

View File

@@ -0,0 +1,15 @@
table, th, td {border: 1px solid black; border-collapse: collapse;}
td:hover{background-color: lightblue;}
th{font-weight: bold; height: 50px;}
td{text-align: left; vertical-align: text-top; width: 200px; height: 100px; padding: 10px}
.holiday{color: red;}
#today{font-weight: bold; background-color: bisque;}
.year{font-size: 30px;}
.month{font-size: 50px; font-weight: bold;}

View File

@@ -0,0 +1,72 @@
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>Calendar</title>
<link rel="stylesheet" th:href="@{/css/menu.css}">
</head>
<body>
<span class="year" th:text="|${year}年|"></span>
<span class="month" th:text="|${month}月|"></span>
<table id="calendar">
<thead>
<tr>
<th class="holiday">日</th>
<th>月</th>
<th>火</th>
<th>水</th>
<th>木</th>
<th>金</th>
<th>土</th>
</tr>
</thead>
<tbody>
<tr th:each="week : ${#numbers.sequence(0, 5)}">
<td th:each="weekDay : ${#numbers.sequence(0, 6)}">
<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}円|"
style="color: blue;">
</div>
<div th:each="expense : ${expenseList}"
th:if="${expense.date.dayOfMonth == week * 7 + weekDay - firstDayOfWeek + 1}"
class="expense"
th:text="|支出 -${expense.amount}円|"
style="color: red;">
</div>
</div>
</td>
</tr>
</tbody>
</table>
<div>
<h2>
<span th:text="|収入:${totalIncome}|"></span>
<span th:text="|支出:${totalExpense}|"></span>
</h2>
</div>
</body>
</html>

View File

@@ -0,0 +1,68 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<h1>取引登録</h1>
<form th:action="@{/transaction/create}" th:object="${transactionForm}" method="post">
<div>
<label for="transactionDate">日付</label>
<input type="date" id="transactionDate" th:field="*{transactionDate}">
</div>
<br>
<div>
<label for="transactionType">収入・支出</label>
<select id="transactionType" th:field="*{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 th:each="category : ${categoryFormList}" 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="金額を入力してください">
</div>
<br>
<input type="hidden" name="today" id="today" th:value="${today}">
<button type="submit">登録</button>
</form>
</body>
</html>

View File

@@ -0,0 +1,38 @@
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>収支詳細</title>
</head>
<body>
<h1 th:text="${today}"></h1>
<div>
<ul>
<li th:each="transactionForm : ${transactionFormList}">
<p>カテゴリ名:<span th:text="${transactionForm.categoryName}"></span>
<br>金額:<span th:text="${transactionForm.amount}"></span>
</p>
<form th:action="@{/transaction/delete}" method="post">
<input type="hidden" name="today" id="today" th:value="${today}">
<input type="hidden" name="transactionId" id="transactionId" value="${transactionForm.transactionId}">
<button type="submit">削除</button>
</form>
<hr />
</li>
</ul>
</div>
<form th:action="@{/transaction/create}" method="get">
<input type="hidden" name="today" id="today" th:value="${today}">
<button type="submit">新規登録</button>
</form>
</body>
</html>

View File

@@ -0,0 +1,29 @@
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>一覧</title>
</head>
<body>
<div th:each="transactionForm : ${transactionFormMap}">
<a th:href="@{/transaction/detail(todayDates=${transactionForm.key})}">
<h3 th:text="${transactionForm.key}"></h3>
</a>
<ul>
<li th:each="transaction : ${transactionForm.value}">
<p>カテゴリ名:<span th:text="${transaction.categoryName}"></span>
<br>金額:<span th:text="${transaction.amount}"></span>
</p>
<hr />
</li>
</ul>
</div>
</body>
</html>