[FIX]収支の選択に合わせてカテゴリが出るようにしました。
This commit is contained in:
@@ -113,58 +113,66 @@
|
|||||||
|
|
||||||
<div th:replace="~{footer :: footer}"></div>
|
<div th:replace="~{footer :: footer}"></div>
|
||||||
|
|
||||||
<script inline="javascript">
|
<script th:inline="javascript">
|
||||||
const transactionType = document.getElementById("transactionType");
|
const transactionType = document.getElementById("transactionType");
|
||||||
const categoryId = document.getElementById("categoryId");
|
const categoryId = document.getElementById("categoryId");
|
||||||
|
|
||||||
const expenseList = document.getElementsByClassName("expenseListClass");
|
const expenseList = document.getElementsByClassName("expenseListClass");
|
||||||
const incomeList = document.getElementsByClassName("incomeListClass");
|
const incomeList = document.getElementsByClassName("incomeListClass");
|
||||||
|
|
||||||
const tType = '[[${session.tType}]]';
|
const tType = '[[${session.tType}]]';
|
||||||
|
|
||||||
if (tType == "0") {
|
function toggleCategory() {
|
||||||
transactionType.value = 0;
|
|
||||||
} else if (tType == "1") {
|
|
||||||
transactionType.value = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
transactionType.addEventListener("change", function () {
|
|
||||||
|
|
||||||
if (this.value === "0") {
|
if (transactionType.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 = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
for (let i = 0; i < incomeList.length; i++) {
|
for (let i = 0; i < incomeList.length; i++) {
|
||||||
incomeList[i].style.display = "none";
|
incomeList[i].style.display = "none";
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (this.value === "1") {
|
} else if (transactionType.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";
|
||||||
}
|
}
|
||||||
|
|
||||||
for (let i = 0; i < incomeList.length; i++) {
|
for (let i = 0; i < incomeList.length; i++) {
|
||||||
incomeList[i].style.display = "";
|
incomeList[i].style.display = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
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";
|
||||||
}
|
}
|
||||||
|
|
||||||
for (let i = 0; i < incomeList.length; i++) {
|
for (let i = 0; i < incomeList.length; i++) {
|
||||||
incomeList[i].style.display = "none";
|
incomeList[i].style.display = "none";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
categoryId.value = "";
|
transactionType.addEventListener("change", function () {
|
||||||
});
|
|
||||||
</script>
|
toggleCategory();
|
||||||
|
|
||||||
|
categoryId.value = "";
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
if (tType == "0") {
|
||||||
|
transactionType.value = "0";
|
||||||
|
} else if (tType == "1") {
|
||||||
|
transactionType.value = "1";
|
||||||
|
}
|
||||||
|
|
||||||
|
toggleCategory();
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@@ -156,7 +156,7 @@
|
|||||||
<div th:replace="~{footer :: footer}">
|
<div th:replace="~{footer :: footer}">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script inline="javascript">
|
<script th:inline="javascript">
|
||||||
const transactionType = document.getElementById("transactionType");
|
const transactionType = document.getElementById("transactionType");
|
||||||
const categoryId = document.getElementById("categoryId");
|
const categoryId = document.getElementById("categoryId");
|
||||||
|
|
||||||
@@ -165,36 +165,29 @@
|
|||||||
|
|
||||||
const tType = '[[${session.tType}]]';
|
const tType = '[[${session.tType}]]';
|
||||||
|
|
||||||
if (tType == "0") {
|
function toggleCategory() {
|
||||||
transactionType.value = 0;
|
|
||||||
} else if (tType == "1") {
|
|
||||||
transactionType.value = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
transactionType.addEventListener("change", function () {
|
|
||||||
|
|
||||||
if (this.value === "0") {
|
if (transactionType.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 = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
for (let i = 0; i < incomeList.length; i++) {
|
for (let i = 0; i < incomeList.length; i++) {
|
||||||
incomeList[i].style.display = "none";
|
incomeList[i].style.display = "none";
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (this.value === "1") {
|
} else if (transactionType.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";
|
||||||
}
|
}
|
||||||
|
|
||||||
for (let i = 0; i < incomeList.length; i++) {
|
for (let i = 0; i < incomeList.length; i++) {
|
||||||
incomeList[i].style.display = "";
|
incomeList[i].style.display = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
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";
|
||||||
@@ -204,9 +197,24 @@
|
|||||||
incomeList[i].style.display = "none";
|
incomeList[i].style.display = "none";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
transactionType.addEventListener("change", function () {
|
||||||
|
|
||||||
|
toggleCategory();
|
||||||
|
|
||||||
|
categoryId.value = "";
|
||||||
|
|
||||||
categoryId.value = "";
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (tType == "0") {
|
||||||
|
transactionType.value = "0";
|
||||||
|
} else if (tType == "1") {
|
||||||
|
transactionType.value = "1";
|
||||||
|
}
|
||||||
|
|
||||||
|
toggleCategory();
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user