@@ -135,7 +135,7 @@ $(document).ready(function () {
135
135
updateButtonState ( ) ;
136
136
} ) ;
137
137
138
- $ ( '#per-page-top' ) . change ( function ( ) {
138
+ $ ( '#per-page-top, #per-page-bot ' ) . change ( function ( ) {
139
139
var length = $ ( this ) . val ( ) ;
140
140
table . page . len ( length ) . draw ( ) ;
141
141
updateButtonState ( ) ;
@@ -144,6 +144,32 @@ $(document).ready(function () {
144
144
// Draw the table
145
145
table . draw ( ) ;
146
146
147
+ function countNonEmptyCollections ( obj ) {
148
+ let count = 0 ;
149
+ Object . keys ( obj ) . forEach ( key => {
150
+ const value = obj [ key ] ;
151
+ if ( Array . isArray ( value ) && value . length > 0 ) {
152
+ // Count non-empty arrays
153
+ count ++ ;
154
+ } else if ( value instanceof Set && value . size > 0 ) {
155
+ // Count non-empty sets
156
+ count ++ ;
157
+ }
158
+ } ) ;
159
+
160
+ const selectedGsLevels = $ ( '.gs-level-filter.active' ) . map ( function ( ) { return $ ( this ) . data ( 'gs-level' ) ; } ) . get ( ) ;
161
+ const selectedJobSeries = $ ( '.job-series-filter.active' ) . map ( function ( ) { return $ ( this ) . data ( 'job-series' ) ; } ) . get ( ) ;
162
+ const selectedCompetencies = $ ( '.competency-filter:checked' ) . map ( function ( ) { return $ ( this ) . data ( 'competency' ) ; } ) . get ( ) ;
163
+ const filterCount = selectedGsLevels . length + selectedJobSeries . length + selectedCompetencies . length ;
164
+ count += filterCount ;
165
+
166
+ if ( count == 0 ) {
167
+ $ ( "#career-facet-remove-all-filters-button-training" ) . css ( 'display' , 'none' ) ;
168
+ } else {
169
+ $ ( "#career-facet-remove-all-filters-button-training" ) . css ( 'display' , 'block' ) ;
170
+ }
171
+ }
172
+
147
173
function filterTable ( ) {
148
174
const selectedGsLevels = $ ( '.gs-level-filter.active' ) . map ( function ( ) { return $ ( this ) . data ( 'gs-level' ) ; } ) . get ( ) ;
149
175
const selectedJobSeries = $ ( '.job-series-filter.active' ) . map ( function ( ) { return $ ( this ) . data ( 'job-series' ) ; } ) . get ( ) ;
@@ -163,6 +189,8 @@ $(document).ready(function () {
163
189
} ) . flat ( ) . join ( '|' ) ;
164
190
165
191
table . column ( 8 ) . search ( filterRegex , true , false ) . draw ( ) ;
192
+
193
+ countNonEmptyCollections ( activeFilters ) ;
166
194
}
167
195
168
196
$ ( '.gs-level-filter, .job-series-filter' ) . on ( 'click' , function ( ) {
@@ -213,7 +241,7 @@ $(document).ready(function () {
213
241
activeFilters [ columnIndex ] . clear ( ) ;
214
242
activeFilters [ columnIndex ] . add ( 'all' ) ;
215
243
}
216
-
244
+ countNonEmptyCollections ( activeFilters ) ;
217
245
// Apply the filters
218
246
table . draw ( ) ;
219
247
window . history . replaceState ( { } , "" , location . pathname ) ;
@@ -252,6 +280,20 @@ $(document).ready(function () {
252
280
}
253
281
} ) ;
254
282
283
+ // Event handler for clear all
284
+ $ ( "#career-facet-remove-all-filters-button-training" ) . on ( 'click' , function ( ) {
285
+ activeFilters = { } ;
286
+ $ ( '.filterBtn' ) . removeClass ( 'active' ) ;
287
+ $ ( 'input[type="checkbox"]' ) . prop ( 'checked' , false ) ;
288
+ $ ( "#career-facet-remove-all-filters-button-training" ) . css ( 'display' , 'none' ) ;
289
+ $ ( '.gs-level-filter' ) . removeClass ( 'active' ) ;
290
+ $ ( '.job-series-filter' ) . removeClass ( 'active' ) ;
291
+ updateSelectAllState ( 'job-career-competency-select-training' ) ;
292
+ updateSelectAllState ( 'general-career-competency-select-training' ) ;
293
+ filterTable ( ) ;
294
+ $ ( this ) . hide ( ) ;
295
+ } ) ;
296
+
255
297
// Event handler for "Select All" / "Deselect All" button
256
298
$ ( '#training-download-button-1' ) . on ( 'click' , function ( ) {
257
299
var $button = $ ( this ) ;
@@ -303,7 +345,8 @@ $(document).ready(function () {
303
345
0 : [ 0 , 500 ] ,
304
346
500 : [ 500 , 1000 ] ,
305
347
1000 : [ 1000 , 2000 ] ,
306
- 2000 : [ 2000 , 10000 ]
348
+ 2000 : [ 2000 , 10000 ] ,
349
+ 10000 : [ 10000 , 15000 ]
307
350
} ;
308
351
var isInRange = filterValues . some ( filterValue => {
309
352
if ( rangeMappings [ filterValue ] ) {
0 commit comments