$(document).on('click', '.userInfoTr', function (){ if($('#userStatus').val() == 'USC003'){ $.ajax({ url: '/userMgt/userEditModal', data: {userSeq: Number($(this).find(".userSeq").val())}, type: 'GET', dataType:"html", success: function(html){ $("#configInfo").empty().append(html) $("#userEditModal").modal('show'); }, error:function(){ } }); } }) $(document).on('click', '#logTab', function (){ location.href='/userMgt/userMgtPage?userStatus=USC002';  }) $(document).on('click', '#contentTab', function (){ location.href='/userMgt/userMgtPage?userStatus=USC003'; }) $(document).ready( function() { $('#chk-all').click( function() { $('.userInfoCheckBox').prop('checked',this.checked); }); }); $(document).on('click', '#approvalBtn', function (){ if(confirm("선택한 대상을 승인처리 하시겠습니까?")){ const checkArr = []; $('input:checkbox[name=userChk]:checked').each(function (idx, el){ checkArr.push({}); const target = $(el); checkArr[idx].userSeq = Number(target.parents('tr').find('.userSeq').val()); checkArr[idx].userStatus = "USC003" }) userApproval(checkArr); } }) function userApproval(checkArr){ $.ajax({ type : 'POST', url : "/userMgt/userApproval", data : JSON.stringify(checkArr), contentType: 'application/json', beforeSend: function (xhr){ xhr.setRequestHeader($("[name='_csrf_header']").val(), $("[name='_csrf']").val()); }, success : function(data) { alert(data+"건이 승인 처리되었습니다."); location.reload(); }, error : function(xhr, status) { alert("승인처리에 실패하였습니다"); } }) } $(document).on('click', '#companionBtn', function (){ if(confirm("선택한 대상을 반려처리 하시겠습니까?")){ const checkArr = []; $('input:checkbox[name=userChk]:checked').each(function (idx, el){ checkArr.push({}); const target = $(el); checkArr[idx].userSeq = Number(target.parents('tr').find('.userSeq').val()); checkArr[idx].userStatus = "USC005" }) userCompanion(checkArr); } }) function userCompanion(checkArr){ $.ajax({ type : 'POST', url : "/userMgt/userCompanion", data : JSON.stringify(checkArr), contentType: 'application/json', beforeSend: function (xhr){ xhr.setRequestHeader($("[name='_csrf_header']").val(), $("[name='_csrf']").val()); }, success : function(data) { alert(data+"건이 반려 처리되었습니다."); location.reload(); }, error : function(xhr, status) { alert("반려처리에 실패하였습니다"); } }) }