diff --git a/src/main/webapp/WEB-INF/views/crdn/crndRegistAndView/main/crdnLevyPrvntc/levyPrvntcPopup.jsp b/src/main/webapp/WEB-INF/views/crdn/crndRegistAndView/main/crdnLevyPrvntc/levyPrvntcPopup.jsp
index 46e22f3..696dc4e 100644
--- a/src/main/webapp/WEB-INF/views/crdn/crndRegistAndView/main/crdnLevyPrvntc/levyPrvntcPopup.jsp
+++ b/src/main/webapp/WEB-INF/views/crdn/crndRegistAndView/main/crdnLevyPrvntc/levyPrvntcPopup.jsp
@@ -187,7 +187,7 @@
|
경과년수 별잔가율 |
|
- 기초공시율 |
+ 기초공사율 |
|
건축물 과세시가 |
시가표준액 (1,000원미만절삭) |
@@ -213,7 +213,7 @@
-
+
= |
|
@@ -1168,47 +1168,166 @@
},
/**
- * 폼 유효성 검증
- * 중요로직: 필수 입력 필드 및 데이터 유효성을 검증하여 저장 가능 여부를 판단합니다.
- * @returns {boolean} 유효성 검증 결과
+ * 공통 필드 유효성 검증 함수
+ * 중요로직: 필드별 검증 규칙을 통합 관리하여 중복 코드를 제거합니다.
+ * @param {string} validationType - 검증 타입 ('save' 또는 'calculation')
+ * @returns {Object} 검증 결과 객체 { isValid: boolean, message: string, focusElement: string }
*/
- validateForm: function() {
- // 필수 필드 검증
- if (!$('#actInfoId').val()) {
- alert('행위정보를 선택해주세요.');
- return false;
+ validateCommon: function(validationType) {
+ // 1. 행위정보 선택 검증 (저장 시에만)
+ if (validationType === 'save' && !$('#actInfoId').val()) {
+ return {
+ isValid: false,
+ message: '행위정보를 선택해주세요.',
+ focusElement: null
+ };
}
-
- if (!$('#bscsCstrnSeCd').val()) {
- $('#bscsCstrnSeCd').focus();
- alert('기초공사구분을 선택해주세요.');
- return false;
+
+ // 2. 기초공사구분 검증 (저장 시에만)
+ if (validationType === 'save' && !$('#bscsCstrnSeCd').val()) {
+ return {
+ isValid: false,
+ message: '기초공사율을 선택해주세요.',
+ focusElement: '#bscsCstrnSeCd'
+ };
}
-
- // 산정률2 유효성 검증
- if (!$('#cmpttnRt2Cd').val()) {
- alert('산정률2를 선택해주세요.');
- $('#cmpttnRt2Cd').focus();
- return false;
+
+ // 3. 건물기준시가액 검증 (계산 시에만)
+ if (validationType === 'calculation') {
+ var bldgNewPrcCrtrAmt = $('#bldgNewPrcCrtrAmt').inputmask('unmaskedvalue') || '0';
+ if (!bldgNewPrcCrtrAmt || parseFloat(bldgNewPrcCrtrAmt) <= 0) {
+ return {
+ isValid: false,
+ message: '건물기준시가액을 입력해주세요.',
+ focusElement: '#bldgNewPrcCrtrAmt'
+ };
+ }
}
-
- var vltnArea = parseFloat($('#vltnArea').inputmask('unmaskedvalue')) || 0;
- if (vltnArea <= 0) {
- alert('위반면적을 입력해주세요.');
- $('#vltnArea').focus();
- return false;
+
+ // 4. 구조지수 검증 (계산 시에만)
+ if (validationType === 'calculation') {
+ var strctIdx = $('#strctIdx').inputmask('unmaskedvalue') || '0';
+ if (!strctIdx || parseFloat(strctIdx) <= 0) {
+ return {
+ isValid: false,
+ message: '구조지수를 입력해주세요.',
+ focusElement: '#strctIdx'
+ };
+ }
+ }
+
+ // 5. 용도지수 검증 (계산 시에만)
+ if (validationType === 'calculation') {
+ var usgIdx = $('#usgIdx').inputmask('unmaskedvalue') || '0';
+ if (!usgIdx || parseFloat(usgIdx) <= 0) {
+ return {
+ isValid: false,
+ message: '용도지수를 입력해주세요.',
+ focusElement: '#usgIdx'
+ };
+ }
+ }
+
+ // 6. 위치지수 검증 (계산 시에만)
+ if (validationType === 'calculation') {
+ var pstnIdx = $('#pstnIdx').inputmask('unmaskedvalue') || '0';
+ if (!pstnIdx || parseFloat(pstnIdx) <= 0) {
+ return {
+ isValid: false,
+ message: '위치지수를 입력해주세요.',
+ focusElement: '#pstnIdx'
+ };
+ }
+ }
+
+ // 7. 경과년수별잔가율 검증 (계산 시에만)
+ if (validationType === 'calculation') {
+ var elpsYrRdvlrt = $('#elpsYrRdvlrt').inputmask('unmaskedvalue') || '0';
+ if (!elpsYrRdvlrt || parseFloat(elpsYrRdvlrt) <= 0) {
+ return {
+ isValid: false,
+ message: '경과년수별잔가율을 입력해주세요.',
+ focusElement: '#elpsYrRdvlrt'
+ };
+ }
+ }
+
+ // 8. 기초공사율 검증 (계산 시에만)
+ if (validationType === 'calculation') {
+ var bscsCstrnRt = $('#bscsCstrnRt').inputmask('unmaskedvalue') || '0';
+ if (!bscsCstrnRt || parseFloat(bscsCstrnRt) <= 0) {
+ return {
+ isValid: false,
+ message: '기초공사율을 선택해주세요.',
+ focusElement: '#bscsCstrnSeCd'
+ };
+ }
+ }
+
+ // 9. 위반면적 검증 (공통)
+ var vltnArea = $('#vltnArea').inputmask('unmaskedvalue') || '0';
+ if (!vltnArea || parseFloat(vltnArea) <= 0) {
+ return {
+ isValid: false,
+ message: '위반면적을 입력해주세요.',
+ focusElement: '#vltnArea'
+ };
+ }
+
+ // 10. 산정률 검증 (공통 - 계산 시 또는 저장 시 체크)
+ var cmpttnRtRate = $('#cmpttnRtRate').val();
+ if (!cmpttnRtRate || parseFloat(cmpttnRtRate) <= 0) {
+ return {
+ isValid: false,
+ message: '산정률을 선택해주세요.',
+ focusElement: '#cmpttnRtCd'
+ };
+ }
+
+ // 11. 산정률2 검증 (공통)
+ var cmpttnRt2Rate = $('#cmpttnRt2Rate').val();
+ if (!cmpttnRt2Rate || parseFloat(cmpttnRt2Rate) <= 0) {
+ return {
+ isValid: false,
+ message: '산정률2를 선택해주세요.',
+ focusElement: '#cmpttnRt2Cd'
+ };
+ }
+
+ // 12. 계산 완료 여부 검증 (저장 시에만)
+ if (validationType === 'save') {
+ var taxableMarketPrice = $("#taxableMarketPrice").val(); // 건축물과세시가
+ var standardMarketPrice = $("#standardMarketPrice").val(); // 시가표준액
+ var standardMarketPrice_bottom = $("#standardMarketPrice_bottom").val(); // 시가표준액(하단)
+ var cmpttnAmt = $("#cmpttnAmt").val(); // 산정액
+ var levyWholAmt = $("#levyWholAmt").val(); // 부과총액
+
+ if (!(taxableMarketPrice && standardMarketPrice && standardMarketPrice_bottom && cmpttnAmt && levyWholAmt)) {
+ return {
+ isValid: false,
+ message: '[계산하기] 버튼을 클릭 하여 계산을 완료하시기 바랍니다.',
+ focusElement: null
+ };
+ }
}
- var taxableMarketPrice = $("#taxableMarketPrice").val();
- var standardMarketPrice = $("#standardMarketPrice").val();
- var standardMarketPrice_bottom = $("#standardMarketPrice_bottom").val();
- var cmpttnAmt = $("#cmpttnAmt").val();
- var levyWholAmt = $("#levyWholAmt").val();
- if( !(taxableMarketPrice && standardMarketPrice && standardMarketPrice_bottom && cmpttnAmt && levyWholAmt) ){
- alert('[계산하기] 버튼을 클릭 하여 계산을 완료하시기 바랍니다.');
+ return { isValid: true }; // 모든 검증 통과
+ },
+
+ /**
+ * 폼 유효성 검증 (저장용)
+ * 중요로직: 저장 시 필요한 모든 필드를 검증합니다.
+ * @returns {boolean} 유효성 검증 결과
+ */
+ validateForm: function() {
+ var result = this.validateCommon('save'); // 공통 검증 함수 호출
+ if (!result.isValid) {
+ alert(result.message); // 오류 메시지 표시
+ if (result.focusElement) {
+ $(result.focusElement).focus(); // 문제 필드로 포커스 이동
+ }
return false;
}
-
return true;
},
@@ -1425,96 +1544,12 @@
},
/**
- * 통합 계산 필수값 검증 함수
- * 중요로직: 건축물과세시가 계산부터 부과총액까지 전체 계산에 필요한 모든 필수값을 검증합니다.
+ * 통합 계산 필수값 검증 함수 (계산용)
+ * 중요로직: 계산 시 필요한 모든 필드를 검증합니다.
+ * @returns {Object} 검증 결과 객체 { isValid: boolean, message: string, focusElement: string }
*/
validateCalculationInputs: function() {
- // 1. 건축물과세시가 계산에 필요한 값들 검증
- var bldgNewPrcCrtrAmt = $('#bldgNewPrcCrtrAmt').inputmask('unmaskedvalue') || '0'; // 건물기준시가액
- if (!bldgNewPrcCrtrAmt || parseFloat(bldgNewPrcCrtrAmt) <= 0) {
- return {
- isValid: false,
- message: '건물기준시가액을 입력해주세요.',
- focusElement: '#bldgNewPrcCrtrAmt'
- };
- }
-
- var strctIdx = $('#strctIdx').inputmask('unmaskedvalue') || '0'; // 구조지수
- if (!strctIdx || parseFloat(strctIdx) <= 0) {
- return {
- isValid: false,
- message: '구조지수를 입력해주세요.',
- focusElement: '#strctIdx'
- };
- }
-
- var usgIdx = $('#usgIdx').inputmask('unmaskedvalue') || '0'; // 용도지수
- if (!usgIdx || parseFloat(usgIdx) <= 0) {
- return {
- isValid: false,
- message: '용도지수를 입력해주세요.',
- focusElement: '#usgIdx'
- };
- }
-
- var pstnIdx = $('#pstnIdx').inputmask('unmaskedvalue') || '0'; // 위치지수
- if (!pstnIdx || parseFloat(pstnIdx) <= 0) {
- return {
- isValid: false,
- message: '위치지수를 입력해주세요.',
- focusElement: '#pstnIdx'
- };
- }
-
- var elpsYrRdvlrt = $('#elpsYrRdvlrt').inputmask('unmaskedvalue') || '0'; // 경과년수별잔가율
- if (!elpsYrRdvlrt || parseFloat(elpsYrRdvlrt) <= 0) {
- return {
- isValid: false,
- message: '경과년수별잔가율을 입력해주세요.',
- focusElement: '#elpsYrRdvlrt'
- };
- }
-
- var bscsCstrnRt = $('#bscsCstrnRt').inputmask('unmaskedvalue') || '0'; // 기초공사율
- if (!bscsCstrnRt || parseFloat(bscsCstrnRt) <= 0) {
- return {
- isValid: false,
- message: '기초공사율을 선택해주세요.',
- focusElement: '#bscsCstrnSeCd'
- };
- }
-
- // 2. 위반면적 검증
- var vltnArea = $('#vltnArea').inputmask('unmaskedvalue') || '0'; // 위반면적
- if (!vltnArea || parseFloat(vltnArea) <= 0) {
- return {
- isValid: false,
- message: '위반면적을 입력해주세요.',
- focusElement: '#vltnArea'
- };
- }
-
- // 3. 산정률 검증
- var cmpttnRtRate = $('#cmpttnRtRate').val(); // 산정률 비율값
- if (!cmpttnRtRate || parseFloat(cmpttnRtRate) <= 0) {
- return {
- isValid: false,
- message: '산정률을 선택해주세요.',
- focusElement: '#cmpttnRtCd'
- };
- }
-
- // 4. 산정률2 검증
- var cmpttnRt2Rate = $('#cmpttnRt2Rate').val(); // 산정률2 비율값
- if (!cmpttnRt2Rate || parseFloat(cmpttnRt2Rate) <= 0) {
- return {
- isValid: false,
- message: '산정률2를 선택해주세요.',
- focusElement: '#cmpttnRt2Cd'
- };
- }
-
- return { isValid: true }; // 모든 검증 통과
+ return this.validateCommon('calculation'); // 공통 검증 함수 호출
},
/**