$(document).on('change', '#pressurizedYn', function (){ if($("#pressurizedYn").val() == 'Y'){ $("#pressurizedN").attr("disabled",true); $("#pressurizedN").val(""); }else{ $("#pressurizedN").removeAttr("disabled"); } }) $(document).on('click', '#saveBtn', function (){ if(confirm("저장하시겠습니까?")){ // if($('#contentTitle').val() == ''){ // alert("제목을 입력해주세요."); // $('#contentTitle').focus(); // return false; // } // if($('#majorType').val() == ''){ // alert("종류를 선택해주세요."); // $('#majorType').focus(); // return false; // } saveContent('DST007'); } }) $(document).on('click', '#saveTempBtn', function (){ if(confirm("임시저장 하시겠습니까?")){ // if($('#contentTitle').val() == ''){ // alert("제목을 입력해주세요."); // $('#contentTitle').focus(); // return false; // } // if($('#majorType').val() == ''){ // alert("종류를 선택해주세요."); // $('#majorType').focus(); // return false; // } saveContent('DST001'); } }) $(document).on('click', '#addAsfCovBtn', function (){ getEditModal(null) }) $(document).on('click', '.tr', function (){ $(".trChkBox").prop("checked", false); $(this).find(".trChkBox").prop("checked", true); getViewModal($(this).attr("data-key")); }) // $(document).on('click', '#saveBtn', function (){ // saveContent("MajorEditForm") // }) $(document).on('click', '#editBtn', function (){ $("#asfCovViewModal").modal('hide') getEditModal($(this).attr("data-asfCovKey")); }) $(function(){ $("#dateSelectorDiv").datepicker({ format: "yyyy-mm-dd", language: "ko", autoclose: true }); }) $(document).on('click', '#deleteMajorBtn', function (){ const asfCovKey = $('#asfCovEditModalContent').find(".asfCovKey").val(); console.log(asfCovKey); if(confirm("삭제하시겠습니까?")){ //contentFade("in"); $.ajax({ type : 'POST', url : "/faStatistics/deleteContent", data : JSON.stringify({asfCovKey:asfCovKey}), contentType: 'application/json', beforeSend: function (xhr){ xhr.setRequestHeader($("[name='_csrf_header']").val(), $("[name='_csrf']").val()); }, success : function(data) { alert("삭제 처리되었습니다."); //contentFade("out"); location.reload(); }, error : function(xhr, status) { alert("삭제 처리에 실패하였습니다"); //contentFade("out"); } }) } }) function getEditModal(asfCovKey){ $.ajax({ url: '/faStatistics/asfCovEditModal', data: {asfCovKey: asfCovKey}, type: 'GET', dataType:"html", success: function(html){ $("#asfCovEditModalContent").empty().append(html); $("#asfCovEditModal").modal('show'); $("#editContent").empty().append(html); }, error:function(e){ ajaxErrorAction(e); } }); } function getViewModal(asfCovKey,versionNo){ $.ajax({ url: '/faStatistics/asfCovViewModal', data: { versionNo : versionNo, asfCovKey : asfCovKey }, type: 'GET', dataType:"html", success: function(html){ $("#asfCovViewModalContent").empty().append(html) $("#asfCovViewModal").modal('show'); }, error:function(e){ ajaxErrorAction(e); } }); } function saveContent(contentStatus){ const formData = new FormData($("#asfCovEditForm")[0]); formData.append('contentStatus', contentStatus); $.ajax({ type : 'POST', data : formData, url : "/faStatistics/saveContent", processData: false, contentType: false, success : function(result) { alert("저장되었습니다."); contentFade("out"); location.reload(); }, error : function(xhr, status) { alert("저장에 실패하였습니다.") contentFade("out"); } }) } function contentCheck(formId){ let flag = true; // if(!$("#contentTitle").val()){ // alert("제목을 입력해주세요.") // flag = false; // } flag = fileCheck(flag, files); return flag; } $(document).on('click', '#asfCovDownExcel', function (){ exportExcel('ASF 및 코로나19 관련 조치현황', 'asfCovTable'); }); $(document).on('click', '#caseNumBtn', function (){ const cdsKey = $("#cdsKey").val(); $.ajax({ url: $("#modalUrl").val(), data : $("#modalSearchForm").serialize(), type: 'GET', contentType: false, dataType:"html", success: function(html){ $("#subModalBody").empty().append(html); if(cdsKey != ""){ $(".crackdownChkbox[value="+cdsKey+"]").prop("checked", true); } $("#asfCovSubModal").modal('show'); }, error:function(e){ ajaxErrorAction(e); } }); }) $(document).on('click', '#getCrackdownBtn', function (){ getEditModal($(".crackdownChkbox:checked").parents(".crackdownTr").attr("data-key")); const tr= $(".crackdownChkbox:checked").parents(".crackdownTr") $(".cdsInfo").removeAttr("disable") $("#cdsKey").val(tr.attr("data-key")) $("#boatNameKr").val(tr.find(".boatNameKr").val()) $("#caseNum").val(tr.find(".caseNum").val()) $("#caseAgency").val(tr.find(".caseAgencyNm").val()) $("#casePoliceOfficer").val(tr.find(".casePoliceOfficer").val()) $("#crackdownPolice").val(tr.find(".crackdownPolice").val()) $("#crackdownBoat").val(tr.find(".crackdownBoat").val()) $("#asfCovSubModal").modal('hide'); $(".cdsInfo").attr("disable", "disable") }) $(function(){ const searchFormBoat = $("#searchFormBoat") if(searchFormBoat.val()!==""){ searchFormBoat.find("."+$("#searchFormPolice").val()).show(); searchFormBoat.removeAttr("disabled"); } $("#dateSelectorDiv").datepicker({ format: "yyyy-mm-dd", language: "ko", autoclose: true }); }); $(document).on('change', '#searchFormPolice', function (){ const searchFormBoat = $("#searchFormBoat") searchFormBoat.find("option").hide() if(this.value !== ""){ searchFormBoat.removeAttr("disabled") searchFormBoat.find("."+this.value).show(); }else{ searchFormBoat.attr("disabled", "disabled") } }) // $(function(){ // const searchFormBoat = $("#pressurizedN") // if(searchFormBoat.val()!==""){ // searchFormBoat.find("."+$("#pressurizedYn").val()).show(); // searchFormBoat.removeAttr("disabled"); // } // // }); // // $(document).on('change', '#pressurizedYn', function (){ // const searchFormBoat = $("#pressurizedN") // searchFormBoat.find("option").hide() // if(this.value !== ""){ // searchFormBoat.removeAttr("disabled") // searchFormBoat.find("."+this.value).show(); // }else{ // searchFormBoat.attr("disabled", "disabled") // } // }) $(document).on('click', '.versionInfoTr', function (){ $(this).find(".versionNo").prop('checked', true); const versionNo = $(this).find(".versionNo").val(); const asfCovKey = $(this).find(".asfCovKey").val(); getHistoryDetail(versionNo, asfCovKey); }); function getHistoryDetail(versionNo, asfCovKey){ $.ajax({ url: '/faStatistics/asfCovHistoryDetail', data: { versionNo : versionNo, asfCovKey : asfCovKey }, type: 'GET', dataType:"html", success: function(html){ $("#asfcovVersionInfoDiv").empty().append(html); }, error:function(e){ ajaxErrorAction(e); } }); }