@@ -10,7 +10,7 @@ $("#alarmIcon").click(function () {
10
10
overlay . toggleClass ( "show-overlay" ) ;
11
11
} ) ;
12
12
13
- $ ( document ) . ready ( function ( ) {
13
+ $ ( ".msg-overlay-bubble-list" ) . ready ( function ( ) {
14
14
// 페이지가 완전히 로드된 후에 알림을 띄우는 함수 실행
15
15
showNotifications ( ) ;
16
16
// x 버튼 클릭 시 ...
@@ -23,10 +23,16 @@ $(document).ready(function() {
23
23
console . log ( "notifyID" )
24
24
console . log ( notifyID )
25
25
console . log ( isRead )
26
- if ( isRead ) {
27
- // 해당 일정의 부모 요소를 숨깁니다.
28
- $ ( this ) . closest ( '.card-outer' ) . remove ( ) ;
29
- } else {
26
+ // if (isRead) {
27
+ // // 해당 일정의 부모 요소를 숨깁니다.
28
+ // $(this).closest('.card-outer').remove();
29
+ // } else {
30
+ // isRead = true; // isRead 의 값이 false 인 경우, x 버튼을 누르면 true 로 바꾸기
31
+ // console.log("false -> true")
32
+ // console.log(isRead)
33
+ // }
34
+
35
+ if ( isRead != true ) {
30
36
isRead = true ; // isRead 의 값이 false 인 경우, x 버튼을 누르면 true 로 바꾸기
31
37
console . log ( "false -> true" )
32
38
console . log ( isRead )
@@ -41,20 +47,19 @@ $(document).ready(function() {
41
47
} ,
42
48
success : function ( response ) {
43
49
console . log ( '데이터 전송 성공:' , response ) ;
44
- // if (isRead === true) {
45
- // // 해당 일정의 부모 요소를 숨깁니다.
46
- // $(this).closest('.card-outer').hide();
47
- // }
50
+
51
+ // let $this = $(this);
52
+ // $this.closest('.card-outer').remove();
53
+
54
+ //$(this).closest('.card-outer').remove();
55
+
56
+ let $cardToRemove = $ ( document ) . find ( '[data-notify-id="' + notifyID + '"]' ) . closest ( '.card-outer' ) ;
57
+ $cardToRemove . remove ( ) ;
48
58
} ,
49
59
error : function ( xhr , status , error ) {
50
60
console . error ( '데이터 전송 실패:' , error ) ;
51
61
}
52
62
} )
53
-
54
- // if (isRead === true) {
55
- // // 해당 일정의 부모 요소를 숨깁니다.
56
- // $(this).closest('.card-outer').hide();
57
- // }
58
63
} )
59
64
60
65
$ ( document ) . on ( 'click' , '.card-outer' , function ( ) {
@@ -66,14 +71,14 @@ $(document).ready(function() {
66
71
console . log ( scheduleId )
67
72
console . log ( notifyCategoryId )
68
73
69
- if ( notifyCategoryId === 1 ) {
70
- window . location . href = '/schedule/vote?scheduleId=' + scheduleId ;
71
- } else if ( notifyCategoryId === 2 ) {
74
+ if ( notifyCategoryId === 1 ) { // 모임 일정 초대
75
+ location . href = '/schedule/vote?scheduleId=' + scheduleId ;
76
+ } else if ( notifyCategoryId === 2 ) { // 모임 일정 장소 확정
72
77
// 카드 상세 페이지로 이동
73
- window . location . href = '/schedule/datail ?scheduleId=' + scheduleId ;
74
- } else if ( notifyCategoryId === 3 ) {
78
+ location . href = '/schedule/detail ?scheduleId=' + scheduleId ;
79
+ } else if ( notifyCategoryId === 3 ) { // 일정 예고
75
80
// 카드 상세 페이지로 이동
76
- window . location . href = '/schedule/detail?scheduleId=' + scheduleId ;
81
+ location . href = '/schedule/detail?scheduleId=' + scheduleId ;
77
82
}
78
83
79
84
} ) ;
@@ -115,9 +120,20 @@ function showNotifications() {
115
120
let startTimeArray = startTime . split ( ":" ) ;
116
121
let startTimewithoutSec = startTimeArray [ 0 ] + ":" + startTimeArray [ 1 ] ;
117
122
123
+ // 메세지 가공
124
+ let fullMessage = card . message ;
125
+ let fullMessageArray = fullMessage . split ( "." ) ;
126
+ let message1 = fullMessageArray [ 0 ] ;
127
+ let message2 = fullMessageArray [ 1 ] ;
128
+ if ( message2 === null ) {
129
+ $cardName . append ( fullMessage ) ;
130
+ } else {
131
+ $cardName . append ( message1 + "<br>" + message2 ) ;
132
+ }
133
+
118
134
119
135
// 데이터 추가
120
- $cardName . append ( card . message ) ;
136
+ // $cardName.append(card.message);
121
137
$cardMain1 . append ( "<h3 style='font-weight: bold; font-size: 15px;'>" + card . name + "</h3>" ) ;
122
138
//$cardMain2.append('<p><i class="bi bi-calendar-check"> </i>' + startDate + '</p>');
123
139
$cardMain3 . append ( '<p style="font-size: 12px;"><i class="bi bi-calendar-check" style="margin-top: 16px;"> </i>' + startDate + '</p>' ) ;
@@ -133,18 +149,18 @@ function showNotifications() {
133
149
$cardMain . append ( $cardMain3 ) ;
134
150
$ ( ".msg-overlay-bubble-list" ) . append ( $cardOuter ) ;
135
151
136
- if ( card . placeName === null ) {
137
- $cardMain2 . append ( '<p style="font-size: 12px;"><i class="bi bi-geo-alt" style="margin-top: 16px;"> </i>' + '투표중' + '</p>' )
138
- } else {
139
- $cardMain2 . append ( '<p style="font-size: 12px;"><i class="bi bi-geo-alt" style="margin-top: 16px;"> </i>' + card . placeName + '</p>' )
140
- }
152
+ // if (card.placeName === null) {
153
+ // $cardMain2.append('<p style="font-size: 12px;"><i class="bi bi-geo-alt" style="margin-top: 16px;"> </i>' + '투표중' + '</p>')
154
+ // } else {
155
+ // $cardMain2.append('<p style="font-size: 12px;"><i class="bi bi-geo-alt" style="margin-top: 16px;"> </i>' + card.placeName + '</p>')
156
+ // }
141
157
142
158
if ( card . voteDeadline === null ) { // 투표 마감일 X = 개인 일정
143
159
$cardMain2 . append ( "" ) ;
144
160
} else if ( card . voteDeadline < today ) { // 투표 마감일 지남
145
161
//$cardMain3.append("<p style='margin-top: 16px;'>" + "투표 마감</p>");
146
- $cardMain2 . append ( "" ) ;
147
- } else { // 투표 마감일 전
162
+ $cardMain2 . append ( card . placeName ) ;
163
+ } else { // 투표 마감일 전 (투표중)
148
164
let deadline = card . voteDeadline ;
149
165
let deadlineArray = deadline . split ( " " ) ;
150
166
let deadlineDate = deadlineArray [ 0 ] ;
@@ -160,7 +176,7 @@ function showNotifications() {
160
176
// console.log(deadlineDateArray[1]) // 05
161
177
// console.log('day')
162
178
// console.log(deadlineDateArray[2]) // 17
163
- $cardMain3 . append ( "<p style='font-size: 12px;'>" + deadlineMonth + "/" + deadlineDay + " <br> 투표 마감</p>" ) ;
179
+ $cardMain2 . append ( "<p style='font-size: 12px;'><i class=\"bi bi-geo-alt\" style=\"margin-top: 16px;\"> </i>" + deadlineMonth + "/" + deadlineDay + " 투표 마감</p>" ) ;
164
180
}
165
181
166
182
$cardMain2 . append (
0 commit comments