File tree Expand file tree Collapse file tree 2 files changed +27
-0
lines changed
Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Original file line number Diff line number Diff line change 11document . addEventListener ( "DOMContentLoaded" , function ( ) {
22 handleBulkAddCommission ( ) ;
33 handleAttendanceFormSync ( ) ;
4+ handleParliamentarianCounter ( ) ;
45} ) ;
56
67
@@ -115,6 +116,31 @@ function handleBulkAddCommission() {
115116}
116117
117118
119+ function handleParliamentarianCounter ( ) {
120+ if ( ! window . location . href . includes ( '/new-bulk' ) ) {
121+ return ;
122+ }
123+
124+ var $list = $ ( '#parliamentarian_id' ) ;
125+ if ( ! $list . length || ! $list . is ( 'ul' ) ) {
126+ return ;
127+ }
128+
129+ var $counter = $ ( '<li><strong></strong></li>' ) ;
130+ $list . prepend ( $counter ) ;
131+
132+ function update ( ) {
133+ var $boxes = $list . find ( "input[type='checkbox']" ) ;
134+ var total = $boxes . length ;
135+ var checked = $boxes . filter ( ':checked' ) . length ;
136+ $counter . find ( 'strong' ) . text ( checked + ' / ' + total ) ;
137+ }
138+
139+ update ( ) ;
140+ $list . on ( 'change' , 'input[type="checkbox"]' , update ) ;
141+ }
142+
143+
118144function handleAttendanceFormSync ( ) {
119145 // Pre-restrict interdependent dropdown values to prevent invalid
120146 // combinations. When a user selects a commission or parliamentarian,
Original file line number Diff line number Diff line change @@ -514,6 +514,7 @@ def add_plenary_attendence(self: AttendenceCollection,
514514 request : PasRequest ,
515515 form : AttendenceAddPlenaryForm
516516) -> RenderData | Response :
517+ request .include ('custom' )
517518
518519 if not request .is_admin :
519520 request .alert (_ ('You do not have permission to add plenary sessions.' ))
You can’t perform that action at this time.
0 commit comments