3 Commits

3 changed files with 17 additions and 9 deletions

View File

@@ -275,7 +275,9 @@ public class GoalController {
int currentAmount = goalService.getCurrentAmount(userId); int currentAmount = goalService.getCurrentAmount(userId);
model.addAttribute(PageReturnAttributeKeyword.CURRENT_AMOUNT, currentAmount); System.out.println("************************currentAmount : " + currentAmount);
session.setAttribute(PageReturnAttributeKeyword.CURRENT_AMOUNT, currentAmount);
return TransitionTargetPageNameKeyword.GOAL_CREATE_HTML; return TransitionTargetPageNameKeyword.GOAL_CREATE_HTML;
} }
@@ -292,7 +294,7 @@ public class GoalController {
model.addAttribute(PageReturnAttributeKeyword.MESSAGE, "現在所持金より高い金額を設定してください。"); model.addAttribute(PageReturnAttributeKeyword.MESSAGE, "現在所持金より高い金額を設定してください。");
return TransitionTargetPageNameKeyword.GOAL_CREATE_HTML; return TransitionTargetPageNameKeyword.GOAL_CREATE_HTML;
} }
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.GOAL; return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.GOAL;
} }

View File

@@ -37,7 +37,9 @@
<div> <div>
<label>目標金額</label> <label>目標金額</label>
<input type="number" th:field="*{targetAmount}" required min="1"> <input type="number" th:field="*{targetAmount}" required min="1">
<span th:text="|所持金:${currentAmount}円|"></span> <br>
<span th:text="|所持金:${session.currentAmount}円|"></span>
<input type="hidden" name="currentAmount" th:value="${currentAmount}">
<span th:if="${message != null}"> <span th:if="${message != null}">
<span th:text="${message}" style="color: red;"></span> <span th:text="${message}" style="color: red;"></span>
</span> </span>

View File

@@ -122,6 +122,16 @@
const tType = '[[${session.tType}]]'; const tType = '[[${session.tType}]]';
console.log("tType: " + tType);
if (tType.includes("0")) {
console.log("okokokokokokokkkokokokoko");
transactionType.value = "0";
} else if (tType.includes("1")) {
transactionType.value = "1";
}
function toggleCategory() { function toggleCategory() {
if (transactionType.value === "0") { if (transactionType.value === "0") {
@@ -164,12 +174,6 @@
}); });
if (tType == "0") {
transactionType.value = "0";
} else if (tType == "1") {
transactionType.value = "1";
}
toggleCategory(); toggleCategory();
</script> </script>