|
@@ -45,6 +45,7 @@
|
|
|
</body>
|
|
|
</html>
|
|
|
<script th:inline="javascript">
|
|
|
+
|
|
|
const $delete = $('.del-btn');
|
|
|
const $save = $('.save-btn');
|
|
|
const $edit = $('.edit-btn');
|
|
@@ -187,18 +188,19 @@
|
|
|
* 삭제 이벤트
|
|
|
*/
|
|
|
function delEvent() {
|
|
|
- if (confirm( "번호 : " + popupId + "\n제목 : " + popupTitle + '\n게시물을 삭제하시겠습니까?')) {
|
|
|
+ let message = "번호 : " + popupId + "<br>제목 : " + popupTitle + '<br>게시물을 삭제하시겠습니까?';
|
|
|
+ alertMessage('red', message, '팝업공지', null, ()=>{
|
|
|
getDataAsync('/api/popup/deletePopup', 'POST', {popupId : popupId}, null, (jsonData)=>{
|
|
|
if (jsonData) {
|
|
|
- alert(jsonData.message);
|
|
|
- if (jsonData.success === "S") {
|
|
|
- window.location.href = '/phits/popup-list';
|
|
|
- }
|
|
|
+ // alert();
|
|
|
+ alertMessage('blue', jsonData.message, '팝업공지', null, ()=>{
|
|
|
+ if (jsonData.success === "S") {
|
|
|
+ window.location.href = '/phits/popup-list';
|
|
|
+ }
|
|
|
+ }, true)
|
|
|
}
|
|
|
- }, (error)=>{
|
|
|
- console.log(error);
|
|
|
- });
|
|
|
- }
|
|
|
+ }, null);
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -206,13 +208,32 @@
|
|
|
*/
|
|
|
function save() {
|
|
|
object.getById["content"].exec("UPDATE_CONTENTS_FIELD", []);
|
|
|
- // const file = $attachFile[0].files[0];
|
|
|
const title = $title.val();
|
|
|
- const pcontent = $content.val();
|
|
|
- // const attachNm = popup.img_name;
|
|
|
+ let pcontent = $content.val();
|
|
|
const postVal = $post.val();
|
|
|
let postFrom = "";
|
|
|
let postTo = "";
|
|
|
+ if (pcontent && pcontent.length >= 13) {
|
|
|
+ let trimContent = pcontent.replaceAll("<p> </p>", "");
|
|
|
+ if (trimContent === "") {
|
|
|
+ pcontent = "";
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ let spaceGap = pcontent.length - 13;
|
|
|
+ let spaceEl = pcontent.substring(spaceGap);
|
|
|
+ if (spaceEl === '<p> </p>') {
|
|
|
+ pcontent = pcontent.substring(0, spaceGap);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (isNull(title)) {
|
|
|
+ return alertError('팝업 공지 제목을 입력해주세요', '팝업공지', $title);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (isNull(pcontent)) {
|
|
|
+ return alertError('팝업 공지 내용을 입력해주세요', '팝업공지', $content);
|
|
|
+ }
|
|
|
|
|
|
//첨부파일 기간값 유효성 체크
|
|
|
if (!isNull(postVal)) {
|
|
@@ -222,23 +243,12 @@
|
|
|
postTo = postArray[1];
|
|
|
}
|
|
|
else {
|
|
|
- $post.focus();
|
|
|
- return alert('공지기간 값을 입력해주세요');
|
|
|
+ return alertError('공지기간 값을 입력해주세요', '팝업공지', $post);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (popup.title === title && popup.pcontent === pcontent && $post.post_from === postFrom && $post.post_to === postTo) {
|
|
|
- // if (file) {
|
|
|
- // if (file.name === attachNm) {
|
|
|
- // return alert("수정하신 내용이 없습니다. 내용을 확인 해 주세요");
|
|
|
- // }
|
|
|
- // }
|
|
|
- // else {
|
|
|
- // const attachFileName = $attach.children().eq(0).text();
|
|
|
- // if ( (attachFileName === "첨부파일 없음" && attachNm === "") || attachFileName === attachNm) {
|
|
|
- return alert("수정하신 내용이 없습니다. 내용을 확인 해 주세요");
|
|
|
- // }
|
|
|
- // }
|
|
|
+ if (popup.title === title && popup.pcontent === pcontent && popup.post_from === postFrom && popup.post_to === postTo) {
|
|
|
+ return alertError("수정하신 내용이 없습니다. 내용을 확인 해 주세요", '팝업공지');
|
|
|
}
|
|
|
|
|
|
const formData = new FormData();
|
|
@@ -257,14 +267,15 @@
|
|
|
type: 'POST',
|
|
|
success: function(jsonData) {
|
|
|
if (jsonData) {
|
|
|
- alert(jsonData.message);
|
|
|
- if (jsonData.success === "S") {
|
|
|
- window.location.href = "/phits/popup-view/" + popupId;
|
|
|
- }
|
|
|
+ alertMessage('blue', jsonData.message, '팝업공지', null, ()=>{
|
|
|
+ if (jsonData.success === "S") {
|
|
|
+ window.location.href = "/phits/popup-view/" + popupId;
|
|
|
+ }
|
|
|
+ }, true);
|
|
|
}
|
|
|
},
|
|
|
error: function(error) {
|
|
|
- alert(error.responseJSON.message);
|
|
|
+ sendErrorMsg(error)
|
|
|
}
|
|
|
});
|
|
|
|