Compare commits
6 Commits
438ff59bc2
...
2a563d335c
| Author | SHA1 | Date | |
|---|---|---|---|
| 2a563d335c | |||
|
|
104fa5e319 | ||
|
|
fb031e5255 | ||
|
|
cb5d228db4 | ||
|
|
18c51d3a65 | ||
|
|
0162f2f679 |
@@ -125,15 +125,6 @@ public class CourseController {
|
|||||||
|
|
||||||
List<AllocationModel> allocationModelList = new ArrayList<>();
|
List<AllocationModel> allocationModelList = new ArrayList<>();
|
||||||
|
|
||||||
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId1(),
|
|
||||||
(Long) session.getAttribute(PageReturnAttributeKeyword.COURSE_ID),
|
|
||||||
allocationFormList.getAllocationRatio1()));
|
|
||||||
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId2(),
|
|
||||||
(Long) session.getAttribute(PageReturnAttributeKeyword.COURSE_ID),
|
|
||||||
allocationFormList.getAllocationRatio2()));
|
|
||||||
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId3(),
|
|
||||||
(Long) session.getAttribute(PageReturnAttributeKeyword.COURSE_ID),
|
|
||||||
allocationFormList.getAllocationRatio3()));
|
|
||||||
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId4(),
|
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId4(),
|
||||||
(Long) session.getAttribute(PageReturnAttributeKeyword.COURSE_ID),
|
(Long) session.getAttribute(PageReturnAttributeKeyword.COURSE_ID),
|
||||||
allocationFormList.getAllocationRatio4()));
|
allocationFormList.getAllocationRatio4()));
|
||||||
|
|||||||
@@ -238,8 +238,8 @@ public class TransactionController {
|
|||||||
|
|
||||||
model.addAttribute(PageReturnAttributeKeyword.TRANSACTION_FORM, transactionForm);
|
model.addAttribute(PageReturnAttributeKeyword.TRANSACTION_FORM, transactionForm);
|
||||||
|
|
||||||
session.setAttribute("tType", String.valueOf(transactionForm.getTransactionType()));
|
session.setAttribute(SessionKeyword.T_TYPE, String.valueOf(transactionForm.getTransactionType()));
|
||||||
|
|
||||||
model.addAttribute(PageReturnAttributeKeyword.CATEGORY_FORM_LIST, categoryFormList);
|
model.addAttribute(PageReturnAttributeKeyword.CATEGORY_FORM_LIST, categoryFormList);
|
||||||
|
|
||||||
model.addAttribute(PageReturnAttributeKeyword.TODAY, today.format(DateTimeFormatter.ISO_LOCAL_DATE));
|
model.addAttribute(PageReturnAttributeKeyword.TODAY, today.format(DateTimeFormatter.ISO_LOCAL_DATE));
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import com.example.demo.app.domain.service.QuestionService;
|
|||||||
import com.example.demo.app.domain.service.UserService;
|
import com.example.demo.app.domain.service.UserService;
|
||||||
import com.example.demo.app.infra.entity.QuestionEntity;
|
import com.example.demo.app.infra.entity.QuestionEntity;
|
||||||
import com.example.demo.app.presentation.controller.pageproperty.PageReturnAttributeKeyword;
|
import com.example.demo.app.presentation.controller.pageproperty.PageReturnAttributeKeyword;
|
||||||
|
import com.example.demo.app.presentation.controller.pageproperty.SessionKeyword;
|
||||||
import com.example.demo.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword;
|
import com.example.demo.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword;
|
||||||
import com.example.demo.app.presentation.form.UserForm;
|
import com.example.demo.app.presentation.form.UserForm;
|
||||||
|
|
||||||
@@ -58,7 +59,7 @@ public class UserController {
|
|||||||
model.addAttribute(PageReturnAttributeKeyword.SELECTED_COURSE_NAME, courseService.findById(courseId).getCourseName());
|
model.addAttribute(PageReturnAttributeKeyword.SELECTED_COURSE_NAME, courseService.findById(courseId).getCourseName());
|
||||||
}
|
}
|
||||||
|
|
||||||
session.setAttribute(PageReturnAttributeKeyword.SELECTED_COURSE_NAME, courseService.findById(courseId).getCourseName());
|
session.setAttribute(SessionKeyword.SELECTED_COURSE_NAME, courseService.findById(courseId).getCourseName());
|
||||||
model.addAttribute(PageReturnAttributeKeyword.COURSE_ID, courseId);
|
model.addAttribute(PageReturnAttributeKeyword.COURSE_ID, courseId);
|
||||||
model.addAttribute(PageReturnAttributeKeyword.USER_FORM, userForm);
|
model.addAttribute(PageReturnAttributeKeyword.USER_FORM, userForm);
|
||||||
|
|
||||||
@@ -70,11 +71,9 @@ public class UserController {
|
|||||||
String selectedCourseName, Model model,
|
String selectedCourseName, Model model,
|
||||||
HttpSession session) {
|
HttpSession session) {
|
||||||
|
|
||||||
model.addAttribute(PageReturnAttributeKeyword.SELECTED_COURSE_NAME, (String) session.getAttribute("selectedCourseName"));
|
model.addAttribute(PageReturnAttributeKeyword.SELECTED_COURSE_NAME, (String) session.getAttribute(SessionKeyword.SELECTED_COURSE_NAME));
|
||||||
|
|
||||||
session.setAttribute("questionId", userForm.getSecretQuestionId());
|
session.setAttribute(SessionKeyword.QUESTION_ID, userForm.getSecretQuestionId());
|
||||||
|
|
||||||
System.out.println("return questionId: ****************************:" + userForm.getSecretQuestionId());
|
|
||||||
|
|
||||||
return TransitionTargetPageNameKeyword.USER_RESISTER_CONFIRM_HTML;
|
return TransitionTargetPageNameKeyword.USER_RESISTER_CONFIRM_HTML;
|
||||||
|
|
||||||
@@ -86,11 +85,9 @@ public class UserController {
|
|||||||
Model model,
|
Model model,
|
||||||
HttpSession session) {
|
HttpSession session) {
|
||||||
|
|
||||||
Long courseId = courseService.findByName((String) session.getAttribute(PageReturnAttributeKeyword.SELECTED_COURSE_NAME));
|
Long courseId = courseService.findByName((String) session.getAttribute(SessionKeyword.SELECTED_COURSE_NAME));
|
||||||
|
|
||||||
Long questionId = (Long) session.getAttribute("questionId");
|
Long questionId = (Long) session.getAttribute(SessionKeyword.QUESTION_ID);
|
||||||
|
|
||||||
System.out.println("confirm questionId: ****************************:" + questionId);
|
|
||||||
|
|
||||||
userForm.setSecretQuestionId(questionId);
|
userForm.setSecretQuestionId(questionId);
|
||||||
|
|
||||||
|
|||||||
@@ -3,4 +3,10 @@ package com.example.demo.app.presentation.controller.pageproperty;
|
|||||||
public class SessionKeyword {
|
public class SessionKeyword {
|
||||||
// SESSION情報として格納したいログイン者の情報
|
// SESSION情報として格納したいログイン者の情報
|
||||||
public static final String LOGIN_USER = "loginUser";
|
public static final String LOGIN_USER = "loginUser";
|
||||||
|
|
||||||
|
public static final String SELECTED_COURSE_NAME = "selectedCourseName";
|
||||||
|
|
||||||
|
public static final String QUESTION_ID = "questionId";
|
||||||
|
|
||||||
|
public static final String T_TYPE = "tType";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label" for="categoryName">カテゴリ名</label>
|
<label class="form-label" for="categoryName">カテゴリ名</label>
|
||||||
|
|
||||||
<input class="form-control" type="text" id="categoryName" th:field="*{categoryName}">
|
<input class="form-control" type="text" id="categoryName" th:field="*{categoryName}" required>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
@@ -33,7 +33,7 @@
|
|||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label" for="transactionType">収入・支出</label>
|
<label class="form-label" for="transactionType">収入・支出</label>
|
||||||
|
|
||||||
<select class="form-select" id="transactionType" th:field="*{transactionType}">
|
<select class="form-select" id="transactionType" th:field="*{transactionType}" required>
|
||||||
|
|
||||||
<option value="">選択してください</option>
|
<option value="">選択してください</option>
|
||||||
<option value="0">支出</option>
|
<option value="0">支出</option>
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label" for="categoryName">カテゴリ名</label>
|
<label class="form-label" for="categoryName">カテゴリ名</label>
|
||||||
|
|
||||||
<input class="form-control" type="text" id="categoryName" th:field="*{categoryName}">
|
<input class="form-control" type="text" id="categoryName" th:field="*{categoryName}" required>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
@@ -33,7 +33,7 @@
|
|||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label" for="transactionType">収入・支出</label>
|
<label class="form-label" for="transactionType">収入・支出</label>
|
||||||
|
|
||||||
<select class="form-select" id="transactionType" th:field="*{transactionType}">
|
<select class="form-select" id="transactionType" th:field="*{transactionType}" required>
|
||||||
|
|
||||||
<option value="">選択してください</option>
|
<option value="">選択してください</option>
|
||||||
<option value="0">支出</option>
|
<option value="0">支出</option>
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label" for="courseName">コース名</label>
|
<label class="form-label" for="courseName">コース名</label>
|
||||||
|
|
||||||
<input class="form-control" type="text" id="courseName" th:field="*{courseName}">
|
<input class="form-control" type="text" id="courseName" th:field="*{courseName}" required>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
|
|||||||
@@ -22,86 +22,70 @@
|
|||||||
<form th:action="@{/course/create}" th:object="${allocationFormList}" method="post">
|
<form th:action="@{/course/create}" th:object="${allocationFormList}" method="post">
|
||||||
|
|
||||||
|
|
||||||
<div class="mb-3">
|
|
||||||
<label class="form-label" for="allocationRatio1">給与</label>
|
|
||||||
<input class="form-control" type="number" id="allocationRatio1" th:field="*{allocationRatio1}">
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<br>
|
|
||||||
|
|
||||||
<div class="mb-3">
|
|
||||||
<label class="form-label" for="allocationRatio2">賞与</label>
|
|
||||||
<input class="form-control" type="number" id="allocationRatio2" th:field="*{allocationRatio2}">
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<br>
|
|
||||||
|
|
||||||
<div class="mb-3">
|
|
||||||
<label class="form-label" for="allocationRatio3">その他</label>
|
|
||||||
<input class="form-control" type="number" id="allocationRatio3" th:field="*{allocationRatio3}">
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<br>
|
|
||||||
|
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label" for="allocationRatio4">固定費</label>
|
<label class="form-label" for="allocationRatio4">固定費</label>
|
||||||
<input class="form-control" type="number" id="allocationRatio4" th:field="*{allocationRatio4}">
|
<input class="form-control" type="number" min="0" max="100" onchange="inputChange()" id="allocationRatio4" th:field="*{allocationRatio4}" required>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label" for="allocationRatio5">食費</label>
|
<label class="form-label" for="allocationRatio5">食費</label>
|
||||||
<input class="form-control" type="number" id="allocationRatio5" th:field="*{allocationRatio5}">
|
<input class="form-control" type="number" min="0" max="100" onchange="inputChange()" id="allocationRatio5" th:field="*{allocationRatio5}" required>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label" for="allocationRatio6">交通費</label>
|
<label class="form-label" for="allocationRatio6">交通費</label>
|
||||||
<input class="form-control" type="number" id="allocationRatio6" th:field="*{allocationRatio6}">
|
<input class="form-control" type="number" min="0" max="100" onchange="inputChange()" id="allocationRatio6" th:field="*{allocationRatio6}" required>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label" for="allocationRatio7">日用品費</label>
|
<label class="form-label" for="allocationRatio7">日用品費</label>
|
||||||
<input class="form-control" type="number" id="allocationRatio7" th:field="*{allocationRatio7}">
|
<input class="form-control" type="number" min="0" max="100" onchange="inputChange()" id="allocationRatio7" th:field="*{allocationRatio7}" required>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label" for="allocationRatio8">被服/美容費</label>
|
<label class="form-label" for="allocationRatio8">被服/美容費</label>
|
||||||
<input class="form-control" type="number" id="allocationRatio8" th:field="*{allocationRatio8}">
|
<input class="form-control" type="number" min="0" max="100" onchange="inputChange()" id="allocationRatio8" th:field="*{allocationRatio8}" required>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label" for="allocationRatio9">医療費</label>
|
<label class="form-label" for="allocationRatio9">医療費</label>
|
||||||
<input class="form-control" type="number" id="allocationRatio9" th:field="*{allocationRatio9}">
|
<input class="form-control" type="number" min="0" max="100" onchange="inputChange()" id="allocationRatio9" th:field="*{allocationRatio9}" required>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label" for="allocationRatio10">趣味/娯楽費</label>
|
<label class="form-label" for="allocationRatio10">趣味/娯楽費</label>
|
||||||
<input class="form-control" type="number" id="allocationRatio10"
|
<input class="form-control" type="number" min="0" max="100" onchange="inputChange()" id="allocationRatio10"
|
||||||
th:field="*{allocationRatio10}">
|
th:field="*{allocationRatio10}" required>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label" for="allocationRatio11">その他</label>
|
<label class="form-label" for="allocationRatio11">その他</label>
|
||||||
<input class="form-control" type="number" id="allocationRatio11"
|
<input class="form-control" type="number" min="0" max="100" onchange="inputChange()" id="allocationRatio11"
|
||||||
th:field="*{allocationRatio11}">
|
th:field="*{allocationRatio11}" required>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mb-3">
|
||||||
|
<label class="form-label" for="allocationRatioTotal">合計(%)</label>
|
||||||
|
<input class="form-control" type="number" value="0" id="allocationRatioTotal" readonly>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
<div class="d-grid">
|
<div class="d-grid">
|
||||||
<button type="submit" class="btn btn-primary">登録</button>
|
<button type="submit" class="btn btn-primary" id="submit" disabled="true">登録</button>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
@@ -110,7 +94,27 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div th:replace="~{footer :: footer}"></div>
|
<div th:replace="~{footer :: footer}"></div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
function inputChange(){
|
||||||
|
let total=0;
|
||||||
|
|
||||||
|
for(let i=4; i<=11; i++){
|
||||||
|
total += Number(document.getElementById(`allocationRatio${i}`).value || 0);
|
||||||
|
if(total == 100){
|
||||||
|
document.getElementById('submit').disabled = false;
|
||||||
|
}else{
|
||||||
|
document.getElementById('submit').disabled = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
document.getElementById("allocationRatioTotal").value = total;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
|
|||||||
@@ -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";
|
||||||
|
|||||||
@@ -26,12 +26,12 @@
|
|||||||
|
|
||||||
<div>
|
<div>
|
||||||
<label>目標名</label>
|
<label>目標名</label>
|
||||||
<input type="text" th:field="*{goalTitle}" required>
|
<input type="text" th:field="*{goalTitle}">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<label>目標説明</label>
|
<label>目標説明</label>
|
||||||
<textarea th:field="*{goalSubtitle}" required></textarea>
|
<textarea th:field="*{goalSubtitle}"></textarea>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
|
|||||||
@@ -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";
|
||||||
|
|||||||
Reference in New Issue
Block a user