From 16b827ddb40a7447580454612b9c73de392faca4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=84=9C=EC=98=88=EB=A6=B0?= Date: Sun, 8 Jan 2023 21:31:03 +0900 Subject: [PATCH] =?UTF-8?q?=EC=A3=BC=EC=9A=94=EC=82=AC=EA=B1=B4=EC=B2=98?= =?UTF-8?q?=EB=A6=AC=ED=98=84=ED=99=A9=20=EC=9E=84=EC=8B=9C=EC=A0=80?= =?UTF-8?q?=EC=9E=A5=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resources/static/js/ivsgt/majorStatus.js | 179 ++++++++++-------- .../majorStatus/majorStatusEditModal.html | 3 +- .../ivsgt/majorStatus/majorStatusPage.html | 4 +- 3 files changed, 107 insertions(+), 79 deletions(-) diff --git a/src/main/resources/static/js/ivsgt/majorStatus.js b/src/main/resources/static/js/ivsgt/majorStatus.js index 63a82764..3cfa7175 100644 --- a/src/main/resources/static/js/ivsgt/majorStatus.js +++ b/src/main/resources/static/js/ivsgt/majorStatus.js @@ -6,6 +6,41 @@ $("#jqueryBtn").click(function(){ }); + +$(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', '#addMajorBtn', function (){ getEditModal(null) }) @@ -16,17 +51,10 @@ $(document).on('click', '.tr', function (){ getViewModal(Number($(this).find(".majorKey").val())); }) -// $(document).on('click', '.tr', function (event){ -// const target = event.target; -// if(!(target.className === "cpChk" ||$(target).parents("td").length>0)){ -// const phoneKey = (Number($(this).find(".phoneKey").val())); -// showModal(phoneKey); -// } -// }); -$(document).on('click', '#saveBtn', function (){ - saveContent("MajorEditForm") -}) +// $(document).on('click', '#saveBtn', function (){ +// saveContent("MajorEditForm") +// }) $(document).on('click', '#editBtn', function (){ $("#MajorViewModal").modal('hide') @@ -72,37 +100,7 @@ $(document).on('click', '#deleteMajorBtn', function (){ } }) -// $(document).on('click', '#delectMajorBtn', function (){ -// if(confirm("선택한 대상을 삭제처리 하시겠습니까?")){ -// const checkArr = []; -// $('input:checkbox[name=equChk]:checked').each(function (idx, el){ -// checkArr.push({}); -// const target = $(el); -// checkArr[idx].equKey = Number(target.parents('tr').find('.majorKey').val()); -// }) -// deleteMajor(checkArr); -// -// } -// }) -// function deleteMajor(checkArr){ -// $.ajax({ -// type : 'POST', -// url : "/ivsgt/deleteContent", -// data : JSON.stringify(checkArr), -// contentType: 'application/json', -// beforeSend: function (xhr){ -// xhr.setRequestHeader($("[name='_csrf_header']").val(), $("[name='_csrf']").val()); -// }, -// success : function() { -// alert("삭제처리 되었습니다."); -// location.reload(); -// }, -// error : function(xhr, status) { -// alert("삭제처리에 실패하였습니다"); -// } -// }) -// } function getEditModal(majorKey){ $.ajax({ @@ -140,45 +138,74 @@ function getViewModal(majorKey){ } function saveContent(contentStatus){ - if(confirm("저장하시겠습니까?")){ - let flag = true; - if(contentStatus === "DST007"){ - flag = contentCheck(); - } - if(flag){ - contentFade("in"); - const MajorEditForm = $("#MajorEditForm"); - MajorEditForm.find("contentStatus").val(contentStatus); - const formData = new FormData(MajorEditForm[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('contentInfo', CrossEditor.GetBodyValue()); - $.ajax({ - type : 'POST', - data : formData, - url : "/ivsgt/saveContent", - processData: false, - contentType: false, - success : function(result) { - alert("저장되었습니다."); - contentFade("out"); - $("#MajorEditModal").modal('hide'); - getViewModal(result); - }, - error : function(xhr, status) { - alert("저장에 실패하였습니다.") - contentFade("out"); - } - }) - } + const formData = new FormData($("#MajorEditForm")[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 : "/ivsgt/saveContent", + processData: false, + contentType: false, + success : function(result) { + alert("저장되었습니다."); + contentFade("out"); + location.reload(); + }, + error : function(xhr, status) { + alert("저장에 실패하였습니다.") + contentFade("out"); + } + }) } + +// function saveContent(contentStatus){ +// if(confirm("저장하시겠습니까?")){ +// let flag = true; +// if(contentStatus === "DST007"){ +// flag = contentCheck(); +// } +// if(flag){ +// contentFade("in"); +// const MajorEditForm = $("#MajorEditForm"); +// MajorEditForm.find("contentStatus").val(contentStatus); +// const formData = new FormData(MajorEditForm[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('contentInfo', CrossEditor.GetBodyValue()); +// $.ajax({ +// type : 'POST', +// data : formData, +// url : "/ivsgt/saveContent", +// processData: false, +// contentType: false, +// success : function(result) { +// alert("저장되었습니다."); +// contentFade("out"); +// $("#MajorEditModal").modal('hide'); +// getViewModal(result); +// }, +// error : function(xhr, status) { +// alert("저장에 실패하였습니다.") +// contentFade("out"); +// } +// }) +// } +// } +// } + function contentCheck(formId){ let flag = true; if(!$("#contentTitle").val()){ diff --git a/src/main/resources/templates/ivsgt/majorStatus/majorStatusEditModal.html b/src/main/resources/templates/ivsgt/majorStatus/majorStatusEditModal.html index 11e3a0bd..b78fa1de 100644 --- a/src/main/resources/templates/ivsgt/majorStatus/majorStatusEditModal.html +++ b/src/main/resources/templates/ivsgt/majorStatus/majorStatusEditModal.html @@ -14,7 +14,6 @@ -
@@ -75,7 +74,7 @@
\ No newline at end of file diff --git a/src/main/resources/templates/ivsgt/majorStatus/majorStatusPage.html b/src/main/resources/templates/ivsgt/majorStatus/majorStatusPage.html index b47b0a77..d7cc328d 100644 --- a/src/main/resources/templates/ivsgt/majorStatus/majorStatusPage.html +++ b/src/main/resources/templates/ivsgt/majorStatus/majorStatusPage.html @@ -79,7 +79,9 @@ - + + +