임산물현황 추가 팝업까지 + 값체크.

This commit is contained in:
주우성
2025-06-15 12:55:33 +09:00
parent 9723b58aa9
commit ecf5b83bba
39 changed files with 1257 additions and 85 deletions

View File

@@ -3,7 +3,7 @@ let kri = {
};
kri.menu = new Object;
kri.logger = new Object();
kri.form = new Object();
/* kri.menu */
/**
* 스크립트로 페이지 이동
@@ -74,3 +74,65 @@ kri.logger.warn = function(message){
};
kri.form.error = function(errorList){
let isResetDone = false;
$(errorList).each((idx, oj) => {
const target = $('[name="' + oj.field + '"]');
let infoBox = null;
if (!isResetDone) {
const formElement = target.closest('form');
if (formElement.length > 0) {
$(formElement).find('.component-input').removeClass('input-invalid');
$(formElement).find('.input-flex-group').removeClass('invalid');
$(formElement).find('.select-group').removeClass('select-invalid');
$(formElement).find('.input-info').each(function () {
$(this).remove();
});
}
isResetDone = true;
}
if (target.length > 0) {
const component = target.closest('.component-input');
if(component){
component.addClass('input-invalid');
//연결된 구조 일 경우 상위에 변경
if(target.closest('.input-flex-group').length > 0){
infoBox = target.closest('.input-flex-group').find('.input-info');
} else {
infoBox = component.find('.input-info');
}
if (infoBox.length === 0) {
if(target.closest('.input-flex-group').length > 0){
infoBox = $('<ul class="input-info"></ul>').appendTo(target.closest('.input-flex-group'));
target.closest('.input-flex-group').addClass('invalid');
} else {
infoBox = $('<ul class="input-info"></ul>').appendTo(component);
}
}
infoBox.html('<li>' + oj.message + '</li>');
}
}
if (target.data('type') === 'select') {
const component = target.closest('.select-group');
if (component) {
component.addClass('select-invalid');
infoBox = component.find('.input-info');
if (infoBox.length === 0) {
infoBox = $('<ul class="input-info"></ul>').appendTo(component);
}
infoBox.html('<li>' + oj.message + '</li>');
}
}
});
}