@@ -33,6 +33,10 @@ const applicationContainer = document.querySelector('.application-container');
33
33
const clearButton = document . getElementById ( 'clear-button' ) ;
34
34
const lastElementContainer = document . getElementById ( 'page_bottom_element' ) ;
35
35
36
+ const applicationDetailsActionsContainer = document . querySelector (
37
+ '.application-details-actions' ,
38
+ ) ;
39
+
36
40
const urlParams = new URLSearchParams ( window . location . search ) ;
37
41
let applicationId = urlParams . get ( 'id' ) ;
38
42
@@ -81,6 +85,18 @@ function closeApplicationDetails() {
81
85
applicationDetailsModal . classList . add ( 'hidden' ) ;
82
86
backDropBlur . style . display = 'none' ;
83
87
document . body . style . overflow = 'auto' ;
88
+ const applicationAcceptedMsg = document . querySelector (
89
+ '.application-details-accepted-msg' ,
90
+ ) ;
91
+ const applicationRejectedMsg = document . querySelector (
92
+ '.application-details-rejected-msg' ,
93
+ ) ;
94
+ if ( applicationAcceptedMsg ) {
95
+ applicationAcceptedMsg . remove ( ) ;
96
+ }
97
+ if ( applicationRejectedMsg ) {
98
+ applicationRejectedMsg . remove ( ) ;
99
+ }
84
100
removeQueryParamInUrl ( 'id' ) ;
85
101
}
86
102
@@ -187,18 +203,34 @@ function openApplicationDetails(application) {
187
203
applicationDetailsMain . appendChild ( applicationSection ) ;
188
204
189
205
if ( application . status === 'rejected' ) {
190
- applicationRejectButton . disabled = true ;
191
- applicationRejectButton . style . cursor = 'not-allowed' ;
192
- applicationRejectButton . classList . add ( 'disable-button' ) ;
206
+ applicationAcceptButton . classList . add ( 'hidden' ) ;
207
+ applicationRejectButton . classList . add ( 'hidden' ) ;
208
+ const applicationDetailsRejectedMsg = createElement ( {
209
+ type : 'p' ,
210
+ attributes : {
211
+ class : 'application-details-rejected-msg' ,
212
+ } ,
213
+ innerText : 'Application is already rejected' ,
214
+ } ) ;
215
+ applicationDetailsActionsContainer . append ( applicationDetailsRejectedMsg ) ;
193
216
} else if ( application . status === 'accepted' ) {
194
- applicationAcceptButton . disabled = true ;
195
- applicationAcceptButton . style . cursor = 'not-allowed' ;
196
- applicationAcceptButton . classList . add ( 'disable-button' ) ;
217
+ applicationAcceptButton . classList . add ( 'hidden' ) ;
218
+ applicationRejectButton . classList . add ( 'hidden' ) ;
219
+ const applicationDetailsAcceptedMsg = createElement ( {
220
+ type : 'p' ,
221
+ attributes : {
222
+ class : 'application-details-accepted-msg' ,
223
+ } ,
224
+ innerText : 'Application was already accepted' ,
225
+ } ) ;
226
+ applicationDetailsActionsContainer . append ( applicationDetailsAcceptedMsg ) ;
197
227
} else {
198
228
applicationRejectButton . disabled = false ;
199
229
applicationRejectButton . style . cursor = 'pointer' ;
200
230
applicationRejectButton . classList . remove ( 'disable-button' ) ;
231
+ applicationRejectButton . classList . remove ( 'hidden' ) ;
201
232
233
+ applicationAcceptButton . classList . remove ( 'hidden' ) ;
202
234
applicationAcceptButton . disabled = false ;
203
235
applicationAcceptButton . style . cursor = 'pointer' ;
204
236
applicationAcceptButton . classList . remove ( 'disable-button' ) ;
0 commit comments