$(function(){ $("#dateSelectorDiv").datepicker({ format: "yyyy-mm-dd", language: "ko", autoclose: true }); }) $(document).on('click', '#addBtn', function (){ getCiaEduEditModal(null); }) function getCiaEduEditModal(ciKey){ $.ajax({ url: '/counterIntelligence/ciaEduEditModal', data: {ciKey: ciKey}, type: 'GET', dataType:"html", success: function(html){ $("#ciaEduEditModalContent").empty().append(html); $("#eduDate").datepicker({ format: "yyyy-mm-dd", language: "ko", autoclose: true }); setUploadDiv(); $("#ciaEduEditModal").modal('show'); }, error:function(){ } }); } $(document).on('click', '#saveBtn', function (){ if(confirm("저장하시겠습니까?")){ save('DST007'); } }) $(document).on('click', '#saveTempBtn', function (){ if(confirm("임시저장 하시겠습니까?")){ save('DST001'); } }) function save(contentStatus){ const formData = new FormData($("#ciaEduEditForm")[0]); for(const file of files) { if(!file.isDelete) formData.append('uploadFiles', file, file.name); } $(".text-decoration-line-through").each(function (idx, el){ formData.append('fileSeq', $(el).attr("data-fileseq")); }) formData.append('contentStatus', contentStatus); $.ajax({ type : 'POST', data : formData, url : "/counterIntelligence/saveCiActivity", processData: false, contentType: false, success : function(result) { alert("저장되었습니다."); contentFade("out"); location.reload(); }, error : function(xhr, status) { alert("저장에 실패하였습니다.") contentFade("out"); } }) } $(document).on('click', '.eiTr', function (){ getCiaEduViewModal($(this).find(".ciKey").val()); }) function getCiaEduViewModal(ciKey){ $.ajax({ url: '/counterIntelligence/ciaEduViewModal', data: {ciKey: ciKey}, type: 'GET', dataType:"html", success: function(html){ $("#ciaEduViewModalBody").empty().append(html) $("#ciaEduViewModal").modal('show'); }, error:function(){ } }); } $(document).on('click', '#editBtn', function (){ $("#ciaEduViewModal").modal('hide'); getCiaEduEditModal($(this).attr("data-cikey")); }) $(document).on('click', '#excelDown', function (){ exportExcel("방첩교육 실시 현황","ciaEduTb"); })