[FO] 일계부 수입 등록 valid
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
package app.module.front.usecase.daily.income.web;
|
package app.module.front.usecase.daily.income.web;
|
||||||
|
|
||||||
import app.module.core.config.application.exception.NoRecordDataException;
|
import app.module.core.config.application.exception.NoRecordDataException;
|
||||||
|
import app.module.core.config.application.util.CoreUtil;
|
||||||
import app.module.front.usecase.daily.income.service.DailyIncomeService;
|
import app.module.front.usecase.daily.income.service.DailyIncomeService;
|
||||||
import app.module.front.usecase.daily.income.web.model.CreateDailyIncomeReqVO;
|
import app.module.front.usecase.daily.income.web.model.CreateDailyIncomeReqVO;
|
||||||
import app.module.front.usecase.daily.income.web.model.RemoveDailyIncomeReqVO;
|
import app.module.front.usecase.daily.income.web.model.RemoveDailyIncomeReqVO;
|
||||||
@@ -25,6 +26,7 @@ public class DailyIncomeController {
|
|||||||
private final DailyRecordService dailyRecordService;
|
private final DailyRecordService dailyRecordService;
|
||||||
private final DailyIncomeService dailyIncomeService;
|
private final DailyIncomeService dailyIncomeService;
|
||||||
private final CreateDailyIncomeValidator createDailyIncomeValidator;
|
private final CreateDailyIncomeValidator createDailyIncomeValidator;
|
||||||
|
private final CoreUtil coreUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 일계부 수입내역 등록 처리
|
* 일계부 수입내역 등록 처리
|
||||||
@@ -43,8 +45,9 @@ public class DailyIncomeController {
|
|||||||
|
|
||||||
createDailyIncomeValidator.validate(formVO, bindingResult);
|
createDailyIncomeValidator.validate(formVO, bindingResult);
|
||||||
if (bindingResult.hasErrors()) {
|
if (bindingResult.hasErrors()) {
|
||||||
return ResponseEntity.status(HttpStatus.UNPROCESSABLE_ENTITY)
|
// return ResponseEntity.status(HttpStatus.UNPROCESSABLE_ENTITY)
|
||||||
.body(bindingResult.getFieldErrors());
|
// .body(bindingResult.getFieldErrors());
|
||||||
|
return coreUtil.getErrorInfo(bindingResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
DailyRecordDto dailyRecord = this.vaildGetDailyRecord(searchMonth, groupNo);
|
DailyRecordDto dailyRecord = this.vaildGetDailyRecord(searchMonth, groupNo);
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package app.module.front.usecase.daily.income.web.model;
|
package app.module.front.usecase.daily.income.web.model;
|
||||||
|
|
||||||
import app.module.front.usecase.daily.record.web.model.DailyUIReqVO;
|
import app.module.front.usecase.daily.record.web.model.DailyUIReqVO;
|
||||||
|
import jakarta.validation.constraints.NotBlank;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
@@ -32,6 +33,7 @@ public class CreateDailyIncomeReqVO extends DailyUIReqVO {
|
|||||||
/**
|
/**
|
||||||
* 수입의 종류 코드
|
* 수입의 종류 코드
|
||||||
*/
|
*/
|
||||||
|
@NotBlank(message = "수입 종류를 선택해 주세요.")
|
||||||
private String categoryCode;
|
private String categoryCode;
|
||||||
/**
|
/**
|
||||||
* 수입의 종류 직접입력
|
* 수입의 종류 직접입력
|
||||||
@@ -40,6 +42,7 @@ public class CreateDailyIncomeReqVO extends DailyUIReqVO {
|
|||||||
/**
|
/**
|
||||||
* 수입원
|
* 수입원
|
||||||
*/
|
*/
|
||||||
|
@NotBlank(message = "수입원을 입력해 주세요.")
|
||||||
private String sourcePurpose;
|
private String sourcePurpose;
|
||||||
/**
|
/**
|
||||||
* 수량
|
* 수량
|
||||||
|
|||||||
@@ -24,16 +24,27 @@ public class CreateDailyIncomeValidator implements Validator {
|
|||||||
public void validate(Object target, Errors errors) {
|
public void validate(Object target, Errors errors) {
|
||||||
CreateDailyIncomeReqVO vo = (CreateDailyIncomeReqVO) target;
|
CreateDailyIncomeReqVO vo = (CreateDailyIncomeReqVO) target;
|
||||||
|
|
||||||
if ("SELF".equals(vo.getInputType()) || StringUtils.isBlank(vo.getInputType())) {
|
if (StringUtils.isBlank(vo.getCategoryCode())) {
|
||||||
|
errors.rejectValue(
|
||||||
|
"categoryCode", "valid.common.required",
|
||||||
|
"수입 종류를 입력해 주세요.");
|
||||||
|
}
|
||||||
|
|
||||||
if (StringUtils.isBlank(vo.getCategoryCode())) {
|
if ("SELF".equals(vo.getCategoryCode()) && StringUtils.isBlank(vo.getCategorySelf())) {
|
||||||
errors.rejectValue(
|
errors.rejectValue(
|
||||||
"categoryCode", "valid.common.required",
|
"categorySelf", "valid.common.required",
|
||||||
"수입 종류를 선택해 주세요.");
|
"수입 종류를 입력해 주세요.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (vo.getPrice() == null && vo.getEstimatedValue() == null) {
|
||||||
|
errors.rejectValue(
|
||||||
|
"price", "valid.common.required",
|
||||||
|
"현금 또는 현물평가액을 입력 해주세요.");
|
||||||
|
errors.rejectValue(
|
||||||
|
"estimatedValue", "valid.common.required",
|
||||||
|
"현금 또는 현물평가액을 입력 해주세요.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO : valid
|
// TODO : valid
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -177,6 +177,18 @@ var ajaxUtil = {
|
|||||||
infoBox.html('<li>' + oj.message + '</li>');
|
infoBox.html('<li>' + oj.message + '</li>');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (target.data('type') == 'select') {
|
||||||
|
const component = target.parent().parent().closest('.select-group');
|
||||||
|
if(component){
|
||||||
|
component.addClass('select-invalid');
|
||||||
|
let infoBox = component.find('.input-info');
|
||||||
|
if (infoBox.length === 0) {
|
||||||
|
infoBox = $('<ul class="input-info"></ul>').appendTo(component);
|
||||||
|
}
|
||||||
|
infoBox.html('<li>' + oj.message + '</li>');
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if ($('.invalid-feedback').length === 0) {
|
if ($('.invalid-feedback').length === 0) {
|
||||||
@@ -184,7 +196,6 @@ var ajaxUtil = {
|
|||||||
if (fieldErrors != null && fieldErrors.length > 0) {
|
if (fieldErrors != null && fieldErrors.length > 0) {
|
||||||
ajaxUtil._alert(fieldErrors[0].defaultMessage, '유효성 체크');
|
ajaxUtil._alert(fieldErrors[0].defaultMessage, '유효성 체크');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
500:function(rstData){
|
500:function(rstData){
|
||||||
|
|||||||
@@ -56,18 +56,10 @@
|
|||||||
</p>
|
</p>
|
||||||
<span class="select-sub-txt">임산물 수입이 있는 경우, 등록해 주세요.</span>
|
<span class="select-sub-txt">임산물 수입이 있는 경우, 등록해 주세요.</span>
|
||||||
</div>
|
</div>
|
||||||
<div id="select3" class="component-select bottom-sheet" data-props-default="재배형태를 선택해 주세요" data-props-type="bottomSheet">
|
<div id="cropCode" class="component-select bottom-sheet" data-props-default="재배형태를 선택해 주세요" data-props-type="bottomSheet">
|
||||||
<!-- TODO : select html -->
|
<input type="hidden1" name="cropCode" th:value="${detail.cropCode}" data-type="select">
|
||||||
<select name="cropCode">
|
<button type="button" class="select-box">
|
||||||
<option value="">선택</option>
|
<span class="select-txt"></span>
|
||||||
<option th:each="uiCode : ${recordCrop}"
|
|
||||||
th:value="${uiCode.codeValue}"
|
|
||||||
th:selected="${uiCode.codeValue eq detail.cropCode}"
|
|
||||||
>[[${uiCode.codeText}]] ([[${uiCode.codeValue}]])
|
|
||||||
</option>
|
|
||||||
</select>
|
|
||||||
<!--<button type="button" class="select-box">
|
|
||||||
<span class="select-txt">선택</span>
|
|
||||||
</button>
|
</button>
|
||||||
<div class="select-options">
|
<div class="select-options">
|
||||||
<div class="select-header">
|
<div class="select-header">
|
||||||
@@ -78,16 +70,13 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="select-scroll">
|
<div class="select-scroll">
|
||||||
<ul class="">
|
<ul class="">
|
||||||
<li class="option" data-value="option1">option1</li>
|
<li class="option"
|
||||||
<li class="option" data-value="option2">option2</li>
|
th:each="uiCode : ${recordCrop}"
|
||||||
<li class="option" data-value="option3">option3</li>
|
th:data-value="${uiCode.codeValue}"
|
||||||
<li class="option" data-value="option4">option4</li>
|
th:text="${uiCode.codeText}"></li>
|
||||||
<li class="option" data-value="option5">option5</li>
|
|
||||||
<li class="option" data-value="option6">option6</li>
|
|
||||||
<li class="option" data-value="option7">option7</li>
|
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>-->
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
@@ -102,19 +91,9 @@
|
|||||||
<i class="ico-required-mark" role="img" aria-label="필수">*</i>
|
<i class="ico-required-mark" role="img" aria-label="필수">*</i>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div id="select3" class="component-select bottom-sheet" data-props-default="수입 종류를 선택해 주세요" data-props-type="bottomSheet">
|
<div id="categoryCode" class="component-select bottom-sheet" data-props-default="수입 종류를 선택해 주세요" data-props-type="bottomSheet">
|
||||||
<!-- TODO : select html -->
|
<input type="hidden1" name="categoryCode" th:value="${detail.categoryCode}" data-type="select">
|
||||||
<select name="categoryCode">
|
<button type="button" class="select-box">
|
||||||
<option value="">선택</option>
|
|
||||||
<option th:each="uiCode : ${recordIncome}"
|
|
||||||
th:value="${uiCode.codeValue}"
|
|
||||||
th:selected="${uiCode.codeValue eq detail.categoryCode}"
|
|
||||||
>[[${uiCode.codeText}]] ([[${uiCode.codeValue}]])
|
|
||||||
</option>
|
|
||||||
</select>
|
|
||||||
<!-- TODO : 직접입력 html -->
|
|
||||||
<input type="text" name="categorySelf" th:value="${detail.categorySelf}">
|
|
||||||
<!--<button type="button" class="select-box">
|
|
||||||
<span class="select-txt"></span>
|
<span class="select-txt"></span>
|
||||||
</button>
|
</button>
|
||||||
<div class="select-options">
|
<div class="select-options">
|
||||||
@@ -126,22 +105,22 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="select-scroll">
|
<div class="select-scroll">
|
||||||
<ul class="">
|
<ul class="">
|
||||||
<li class="option" data-value="option1">봉급</li>
|
<li class="option"
|
||||||
<li class="option" data-value="option2">소득세</li>
|
th:each="uiCode : ${recordIncome}"
|
||||||
<li class="option" data-value="option3">수당</li>
|
th:data-value="${uiCode.codeValue}"
|
||||||
<li class="option" data-value="option4">직접 입력</li>
|
th:text="${uiCode.codeText}"></li>
|
||||||
|
<li class="option" data-value="SELF">직접 입력</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>-->
|
|
||||||
</div>
|
|
||||||
<!-- 직접입력 인풋 -->
|
|
||||||
<div class="component-input input-invalid" data-option="직접 입력">
|
|
||||||
<div class="input-field">
|
|
||||||
<input type="text" id="temp_input_invalid_0001" value="" placeholder="수입의 종류를 입력해 주세요">
|
|
||||||
</div>
|
</div>
|
||||||
<ul class="input-info">
|
</div>
|
||||||
|
<div class="component-input " data-option="직접 입력"><!-- input-invalid -->
|
||||||
|
<div class="input-field">
|
||||||
|
<input type="text" id="categorySelf" name="categorySelf" th:value="${detail.categorySelf}" placeholder="수입의 종류를 입력해 주세요">
|
||||||
|
</div>
|
||||||
|
<!--<ul class="input-info">
|
||||||
<li>수입 종류를 입력해 주세요.</li>
|
<li>수입 종류를 입력해 주세요.</li>
|
||||||
</ul>
|
</ul>-->
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="component-input">
|
<div class="component-input">
|
||||||
@@ -179,18 +158,10 @@
|
|||||||
단위
|
단위
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div id="select3" class="component-select bottom-sheet" data-props-default="단위를 선택해 주세요" data-props-type="bottomSheet">
|
<div id="unitCode" class="component-select bottom-sheet" data-props-default="단위를 선택해 주세요" data-props-type="bottomSheet">
|
||||||
<!-- TODO : select html -->
|
<input type="hidden1" name="unitCode" th:value="${detail.unitCode}">
|
||||||
<select name="unitCode">
|
<button type="button" class="select-box">
|
||||||
<option value="">선택</option>
|
<span class="select-txt"></span>
|
||||||
<option th:each="uiCode : ${recordUnit}"
|
|
||||||
th:value="${uiCode.codeValue}"
|
|
||||||
th:selected="${uiCode.codeValue eq detail.unitCode}"
|
|
||||||
>[[${uiCode.codeText}]] ([[${uiCode.codeValue}]])
|
|
||||||
</option>
|
|
||||||
</select>
|
|
||||||
<!--<button type="button" class="select-box">
|
|
||||||
<span class="select-txt">선택</span>
|
|
||||||
</button>
|
</button>
|
||||||
<div class="select-options">
|
<div class="select-options">
|
||||||
<div class="select-header">
|
<div class="select-header">
|
||||||
@@ -201,16 +172,14 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="select-scroll">
|
<div class="select-scroll">
|
||||||
<ul class="">
|
<ul class="">
|
||||||
<li class="option" data-value="option1">option1</li>
|
<li class="option" th:each="uiCode : ${recordUnit}"
|
||||||
<li class="option" data-value="option2">option2</li>
|
th:data-value="${uiCode.codeValue}"
|
||||||
<li class="option" data-value="option3">option3</li>
|
th:text="${uiCode.codeText}"
|
||||||
<li class="option" data-value="option4">option4</li>
|
th:selected="${uiCode.codeValue eq detail.unitCode ? 'current' : ''}"
|
||||||
<li class="option" data-value="option5">option5</li>
|
></li>
|
||||||
<li class="option" data-value="option6">option6</li>
|
|
||||||
<li class="option" data-value="option7">option7</li>
|
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>-->
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|||||||
@@ -104,7 +104,7 @@
|
|||||||
</main>
|
</main>
|
||||||
|
|
||||||
<!-- 하단 고정 버튼 -->
|
<!-- 하단 고정 버튼 -->
|
||||||
<div class="component-btns "> <!-- TODO : fixed -->
|
<div class="component-btns fixed">
|
||||||
<div class="btns-row">
|
<div class="btns-row">
|
||||||
<button type="button" class="btn btn-l btn-secondary">
|
<button type="button" class="btn btn-l btn-secondary">
|
||||||
<span class="btn-txt">이전 단계로 이동</span>
|
<span class="btn-txt">이전 단계로 이동</span>
|
||||||
@@ -164,6 +164,7 @@
|
|||||||
// scheduleDSeq: null,
|
// scheduleDSeq: null,
|
||||||
// reserveSeq: null,
|
// reserveSeq: null,
|
||||||
},
|
},
|
||||||
|
selectbox: null,
|
||||||
}
|
}
|
||||||
|
|
||||||
let formControl = {
|
let formControl = {
|
||||||
@@ -213,12 +214,56 @@
|
|||||||
id = 0;
|
id = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
|
||||||
ajaxUtil._ajaxAsyncMethod(
|
ajaxUtil._ajaxAsyncMethod(
|
||||||
ENV.httpUrl.form.replace('{id}', id),
|
ENV.httpUrl.form.replace('{id}', id),
|
||||||
{},
|
{},
|
||||||
function(rstHtml, status) {
|
function(rstHtml, status) {
|
||||||
$('.modal01').find('.modal-content').html(rstHtml);
|
$('.modal01').find('.modal-content').html(rstHtml);
|
||||||
|
|
||||||
|
|
||||||
|
// TODO
|
||||||
|
etUI.components.SelectBox().core.init(document.querySelector('#categoryCode'));
|
||||||
|
etUI.components.SelectBox().core.init(document.querySelector('#cropCode'));
|
||||||
|
etUI.components.SelectBox().core.init(document.querySelector('#unitCode'));
|
||||||
|
|
||||||
|
/*
|
||||||
|
const selectbox = etUI.components.SelectBox();
|
||||||
|
etUI.components.SelectBox().core.init(document.querySelector('#selectCategory'), {
|
||||||
|
onChange: function() {
|
||||||
|
console.log('sssssssssss')
|
||||||
|
},
|
||||||
|
selectItemCallback: function() {
|
||||||
|
console.log(1111)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
etUI.components.SelectBox().core.init(document.querySelector('#selectUnit'), {
|
||||||
|
onChange: function() {
|
||||||
|
console.log('sssssssssss')
|
||||||
|
},
|
||||||
|
selectItemCallback: function() {
|
||||||
|
console.log(3333)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
document.querySelector('#selectUnit').addEventListener('select:onChange', (e) => {
|
||||||
|
console.log(e.detail);
|
||||||
|
console.log(e.detail.value);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
etUI.components.SelectBox();
|
||||||
|
const selectbox2 = document.querySelector('.component-select');
|
||||||
|
selectbox2.addEventListener('select:onChange', (e) => {
|
||||||
|
console.log(e.detail);
|
||||||
|
console.log(e.detail.value);
|
||||||
|
});
|
||||||
|
*/
|
||||||
|
|
||||||
|
//document.queerySelector('#unitSelect')
|
||||||
|
|
||||||
const modal01 = document.querySelector(".modal01").ui;
|
const modal01 = document.querySelector(".modal01").ui;
|
||||||
modal01.open();
|
modal01.open();
|
||||||
},
|
},
|
||||||
@@ -230,6 +275,13 @@
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
createVaild() {
|
createVaild() {
|
||||||
|
const f = document.reqModalForm;
|
||||||
|
|
||||||
|
// TODO : setter
|
||||||
|
f.categoryCode.value = document.querySelector('#categoryCode').value !== undefined ? document.querySelector('#categoryCode').value : '';
|
||||||
|
f.cropCode.value = document.querySelector('#cropCode').value !== undefined ? document.querySelector('#cropCode').value : '';
|
||||||
|
f.unitCode.value = document.querySelector('#unitCode').value !== undefined ? document.querySelector('#unitCode').value : '';
|
||||||
|
|
||||||
formControl.create();
|
formControl.create();
|
||||||
},
|
},
|
||||||
create() {
|
create() {
|
||||||
|
|||||||
Reference in New Issue
Block a user