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