[EDIT] 収支区分の値について、支出が0、収入が1になっていなかった箇所を修正しました。

This commit is contained in:
kkazuya
2026-09-29 12:40:17 +09:00
parent 18c51d3a65
commit cb5d228db4
2 changed files with 11 additions and 11 deletions

View File

@@ -40,8 +40,8 @@
<select class="form-select" id="transactionType"> <select class="form-select" id="transactionType">
<option value="">選択してください</option> <option value="">選択してください</option>
<option value="1">支出</option> <option value="0">支出</option>
<option value="2">収入</option> <option value="1">収入</option>
</select> </select>
</div> </div>
@@ -70,7 +70,7 @@
<div class="mb-3"> <div class="mb-3">
<label class="form-label" for="amount">金額</label> <label class="form-label" for="amount">金額</label>
<input class="form-control" type="number" id="amount" th:field="*{amount}" min="0" placeholder="金額を入力してください" <input class="form-control" type="number" id="amount" th:field="*{amount}" min="1" placeholder="金額を入力してください"
required> required>
</div> </div>
@@ -94,7 +94,7 @@
transactionType.addEventListener("change", function () { transactionType.addEventListener("change", function () {
if (this.value === "1") { if (this.value === "0") {
for (let i = 0; i < expenseList.length; i++) { for (let i = 0; i < expenseList.length; i++) {
expenseList[i].style.display = ""; expenseList[i].style.display = "";
@@ -104,7 +104,7 @@
incomeList[i].style.display = "none"; incomeList[i].style.display = "none";
} }
} else if (this.value === "2") { } else if (this.value === "1") {
for (let i = 0; i < expenseList.length; i++) { for (let i = 0; i < expenseList.length; i++) {
expenseList[i].style.display = "none"; expenseList[i].style.display = "none";

View File

@@ -45,11 +45,11 @@
選択してください 選択してください
</option> </option>
<option value="1"> <option value="0">
支出 支出
</option> </option>
<option value="2"> <option value="1">
収入 収入
</option> </option>
@@ -124,15 +124,15 @@
const tType = '[[${session.tType}]]'; const tType = '[[${session.tType}]]';
if (tType == "0") { if (tType == "0") {
transactionType.value = 1; transactionType.value = 0;
} else { } else {
transactionType.value = 2; transactionType.value = 1;
} }
transactionType.addEventListener("change", function () { transactionType.addEventListener("change", function () {
if (this.value === "1") { if (this.value === "0") {
for (let i = 0; i < expenseList.length; i++) { for (let i = 0; i < expenseList.length; i++) {
expenseList[i].style.display = ""; expenseList[i].style.display = "";
@@ -142,7 +142,7 @@
incomeList[i].style.display = "none"; incomeList[i].style.display = "none";
} }
} else if (this.value === "2") { } else if (this.value === "1") {
for (let i = 0; i < expenseList.length; i++) { for (let i = 0; i < expenseList.length; i++) {
expenseList[i].style.display = "none"; expenseList[i].style.display = "none";