@@ -37,7 +37,9 @@ export class CircularHeatmapComponent implements OnInit {
3737 radial_labels : string [ ] = [ ] ;
3838 YamlObject : any ;
3939 teamList : any ;
40- filteredTeamView : string [ ] = [ ] ;
40+ teamGroups : any ;
41+ selectedTeamChips : string [ ] = [ 'All' ] ;
42+ teamVisible : string [ ] = [ ] ;
4143 segment_labels : string [ ] = [ ] ;
4244 taskDetails : any ;
4345 showOverlay : boolean ;
@@ -59,6 +61,8 @@ export class CircularHeatmapComponent implements OnInit {
5961 this . maxLevelOfTasks = y ;
6062 }
6163 this . teamList = this . YamlObject [ 'strings' ] [ 'en' ] [ 'teams' ] ;
64+ this . teamGroups = this . YamlObject [ 'strings' ] [ 'en' ] [ 'teamGroups' ] ;
65+ this . teamVisible = this . teamList ;
6266 } ) ;
6367 this . yaml . setURI ( './assets/YAML/generated/generated.yaml' ) ;
6468 // Function sets data
@@ -120,7 +124,6 @@ export class CircularHeatmapComponent implements OnInit {
120124 teams . forEach ( ( singleTeam : any ) => {
121125 teamStatus [ singleTeam ] = false ;
122126 } ) ;
123- console . log ( 'check' , teamStatus ) ;
124127
125128 var teamsImplemented : any =
126129 this . YamlObject [ allDimensionNames [ i ] ] [
@@ -135,7 +138,6 @@ export class CircularHeatmapComponent implements OnInit {
135138 Object . keys ( teamStatus ) as ( keyof typeof teamStatus ) [ ]
136139 ) . forEach ( ( key , index ) => {
137140 // 👇️ name Bobby Hadz 0, country Chile 1
138- console . log ( key , teamStatus [ key ] , index ) ;
139141 totalTaskTeams += 1 ;
140142 if ( teamStatus [ key ] === true ) {
141143 totalTeamsImplemented += 1 ;
@@ -174,18 +176,36 @@ export class CircularHeatmapComponent implements OnInit {
174176
175177 toggleTeamSelection ( chip : MatChip ) {
176178 chip . toggleSelected ( ) ;
177- // this.filteredTeamView = chip.value.replace(/\s/g, '');
179+ let currChipValue = chip . value . replace ( / \s / g, '' ) ;
180+ let visibilityUpdated = false ;
178181 if ( chip . selected ) {
179- this . filteredTeamView = [
180- ...this . filteredTeamView ,
181- chip . value . replace ( / \s / g, '' ) ,
182- ] ;
182+ this . selectedTeamChips = [ ...this . selectedTeamChips , currChipValue ] ;
183+ if ( currChipValue == 'All' ) {
184+ this . teamVisible = this . teamList ;
185+ console . log ( 'All' , this . teamList ) ;
186+ visibilityUpdated = true ;
187+ } else {
188+ this . teamVisible = [ ] ;
189+
190+ (
191+ Object . keys ( this . teamGroups ) as ( keyof typeof this . teamGroups ) [ ]
192+ ) . forEach ( ( key , index ) => {
193+ if ( key === currChipValue ) {
194+ this . teamVisible = this . teamGroups [ key ] ;
195+ visibilityUpdated = true ;
196+ }
197+ } ) ;
198+ if ( ! visibilityUpdated ) {
199+ this . teamVisible . push ( currChipValue ) ;
200+ }
201+ }
183202 } else {
184- this . filteredTeamView = this . filteredTeamView . filter (
185- o => o !== chip . value . replace ( / \s / g , '' )
203+ this . selectedTeamChips = this . selectedTeamChips . filter (
204+ o => o !== currChipValue
186205 ) ;
187206 }
188- console . log ( this . filteredTeamView ) ;
207+ console . log ( 'Selected Chips' , this . selectedTeamChips ) ;
208+ console . log ( 'Team Visible' , this . teamVisible ) ;
189209
190210 // Update heatmap based on selection
191211 this . reColorHeatmap ( ) ;
@@ -644,8 +664,8 @@ export class CircularHeatmapComponent implements OnInit {
644664 ( Object . keys ( teamList ) as ( keyof typeof teamList ) [ ] ) . forEach (
645665 ( key , index ) => {
646666 if (
647- this . filteredTeamView [ 0 ] === 'All' ||
648- key === this . filteredTeamView [ 0 ]
667+ this . selectedTeamChips [ 0 ] === 'All' ||
668+ key === this . selectedTeamChips [ 0 ]
649669 ) {
650670 // console.log('Yes');
651671 if ( teamList [ key ] === true ) {
0 commit comments