@@ -133,8 +133,15 @@ <h2 class="accordion-header" id="flush-headingTwo">
133
133
</ details >
134
134
</ div >
135
135
</ div >
136
- < div >
137
- < i class ="fa-solid fa-circle-check fs-3 text-success "> </ i >
136
+ < div class ="d-flex align-items-center justify-content-end gap-5 ">
137
+ < div class ="form-check form-switch ">
138
+ < input class ="form-check-input toggle-active-switch "
139
+ type ="checkbox " role ="switch "
140
+ id ="{{ event }}toggleActiveSwitch " checked >
141
+ < label class ="form-check-label "
142
+ for ="{{ event }}toggleActiveSwitch "> Active</ label >
143
+ </ div >
144
+ < i id ="{{ event }}ActiveStatus " class ="fa-solid fa-circle-check fs-3 text-success "> </ i >
138
145
</ div >
139
146
</ div >
140
147
</ div >
@@ -216,7 +223,33 @@ <h1><i class="fa-solid fa-chart-area pe-3 text-muted"></i>Monitoring</h1>
216
223
</ div >
217
224
</ div >
218
225
</ div >
219
-
226
+ < script >
227
+ // on document load
228
+ $ ( document ) . ready (
229
+ function toggleEventActive ( ) {
230
+ $ ( '.toggle-active-switch' ) . on ( 'change' , function ( ) {
231
+ console . log ( 'toggle active' )
232
+ let event = $ ( this ) . attr ( 'id' ) . split ( 'toggleActiveSwitch' ) [ 0 ] ;
233
+ let active = $ ( this ) . is ( ':checked' ) ;
234
+ $ . ajax ( {
235
+ url : `/event/active?event=${ event } &active=${ active } ` ,
236
+ type : 'POST' ,
237
+ success : function ( data ) {
238
+ console . log ( data ) ;
239
+ const statusIcon = $ ( `#${ event } ActiveStatus` )
240
+ if ( data [ 'active' ] ) {
241
+ statusIcon . addClass ( 'fa-circle-check text-success' ) ;
242
+ statusIcon . removeClass ( 'fa-circle-xmark text-danger' ) ;
243
+ } else {
244
+ statusIcon . removeClass ( 'fa-circle-check text-success' ) ;
245
+ statusIcon . addClass ( 'fa-circle-xmark text-danger' ) ;
246
+ }
247
+ }
248
+ } )
249
+ } )
250
+ }
251
+ )
252
+ </ script >
220
253
< script >
221
254
var data = [
222
255
{
0 commit comments