내정보, 비밀번호 확인, 내정보 수정 : UX에 따라 수정 필요.
This commit is contained in:
@@ -39,7 +39,9 @@ var ajaxUtil = {
|
||||
message: alertMessage,
|
||||
type: "alert",
|
||||
callback: function() {
|
||||
console.log("alert callback");
|
||||
if (typeof afterEvent === 'function') {
|
||||
afterEvent();
|
||||
}
|
||||
},
|
||||
});
|
||||
} else {
|
||||
@@ -47,7 +49,9 @@ var ajaxUtil = {
|
||||
message: alertMessage,
|
||||
type: "alert",
|
||||
callback: function() {
|
||||
console.log("alert callback");
|
||||
if (typeof afterEvent === 'function') {
|
||||
afterEvent();
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -161,16 +165,23 @@ var ajaxUtil = {
|
||||
},
|
||||
422:function(rstData, status) {
|
||||
console.log(rstData)
|
||||
/**
|
||||
* TODO
|
||||
* 폼이 너무 여러가지 형식이 있는데 서버에러를 가지고 처리하는게 맞는지 검토 필요
|
||||
* 코드 정리는 나중에 하려고 그냥 만듬.... 정리 필요.
|
||||
*/
|
||||
|
||||
|
||||
let isResetDone = false;
|
||||
|
||||
$(rstData.responseJSON.fieldErrors).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('input-invalid');
|
||||
$(formElement).find('.input-info').each(function () {
|
||||
$(this).remove();
|
||||
@@ -180,28 +191,44 @@ var ajaxUtil = {
|
||||
}
|
||||
|
||||
if (target.length > 0) {
|
||||
|
||||
const component = target.closest('.component-input');
|
||||
if(component){
|
||||
component.addClass('input-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>');
|
||||
}
|
||||
}
|
||||
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 (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);
|
||||
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.parent().parent().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 + '1111</li>');
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
if ($('.input-info').length === 0) {
|
||||
|
||||
Reference in New Issue
Block a user