Skip to content

Commit

Permalink
Merge pull request #87 from Sohith-code/cbrelease-4.8.19
Browse files Browse the repository at this point in the history
Added competency key training-plan competency filter
  • Loading branch information
sureshece16 authored Nov 8, 2024
2 parents ccd1781 + 0aa8d42 commit 3759ea2
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ export class BulkUploadComponent implements OnInit, OnDestroy, AfterViewInit {
clearInterval(this.interval)
this.getBulkStatusList()
}
}, 1000)
}, 1000)
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,6 @@ export class BulkUploadOdcsComponent implements OnInit, OnDestroy, AfterViewInit
clearInterval(this.interval)
this.getBulkStatusList()
}
}, 1000)
}, 1000)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@
[formControl]='searchProviderControl' placeholder="Enter Provider" type="Standard">
</div>
</div>
<div [ngClass]="(!(competencyThemeList?.length) && !(competencySubThemeList?.length)) ? 'category-content-without-theme': 'category-content'">
<div
[ngClass]="(!(competencyThemeList?.length) && !(competencySubThemeList?.length)) ? 'category-content-without-theme': 'category-content'">
<div class="flex flex-1 flex-row category-item"
*ngFor="let item of providersList | filterSearch: searchProviderInput.value">
<mat-checkbox #checkboxes disableRipple class="example-margin"
Expand Down Expand Up @@ -134,7 +135,9 @@
</mat-panel-title>
</mat-expansion-panel-header>
<div class="flex flex-1 flex-row category-item" *ngFor="let des of designationList">
<mat-checkbox #checkboxes disableRipple class="example-margin" [checked]="des?.selected" (change)="manageSelectedDesignation($event, des)">{{des?.name | titlecase}}</mat-checkbox>
<mat-checkbox #checkboxes disableRipple class="example-margin" [checked]="des?.selected"
(change)="manageSelectedDesignation($event, des)">{{des?.name |
titlecase}}</mat-checkbox>
</div>
</mat-expansion-panel>
</mat-accordion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ import { Component, ChangeDetectorRef, Input, ElementRef, EventEmitter, OnInit,
import { TrainingPlanService } from './../../services/traininig-plan.service'
import { FormControl } from '@angular/forms'
import { TrainingPlanDataSharingService } from '../../services/training-plan-data-share.service'
import { ICompentencyKeys } from '../../../home/interface/interfaces'
import { InitService } from '../../../../../../../../../src/app/services/init.service'
import { environment } from '../../../../../../../../../src/environments/environment'
@Component({
selector: 'ws-app-filter',
templateUrl: './filter.component.html',
Expand Down Expand Up @@ -31,18 +34,29 @@ export class FilterComponent implements OnInit, AfterContentChecked {
competencyList: any = []
competencyThemeList: any[] = []
competencySubThemeList: any[] = []
filterObj: any = { competencyArea: [], competencyTheme: [], competencySubTheme: [], providers: [] }
filterObj: any
assigneeFilterObj: any = { group: [], designation: [] }
searchThemeControl = new FormControl()
searchSubThemeControl = new FormControl()
searchProviderControl = new FormControl()
@ViewChildren('checkboxes') checkboxes!: QueryList<ElementRef>
compentencyKey!: ICompentencyKeys
constructor(
private cdref: ChangeDetectorRef,
private trainingPlanService: TrainingPlanService,
private tpdsSvc: TrainingPlanDataSharingService) { }
private tpdsSvc: TrainingPlanDataSharingService,
private initService: InitService
) { }

ngOnInit() {
this.compentencyKey = this.initService.configSvc.competency[environment.compentencyVersionKey]
this.filterObj = {
[this.compentencyKey.vCompetencyArea]: [],
[this.compentencyKey.vCompetencyTheme]: [],
[this.compentencyKey.vCompetencySubTheme]: [],
providers: [],

}
this.tpdsSvc.filterToggle.subscribe((data: any) => {
if (data && data.status) {
if (data.from === 'content') {
Expand Down Expand Up @@ -153,8 +167,8 @@ export class FilterComponent implements OnInit, AfterContentChecked {
citem.children.map((themechild: any) => {
themechild['parent'] = ctype.id
})
if (this.filterObj['competencyArea']) {
this.filterObj['competencyArea'].push(citem.name)
if (this.filterObj[this.compentencyKey.vCompetencyArea]) {
this.filterObj[this.compentencyKey.vCompetencyArea].push(citem.name)
}
this.competencyThemeList = this.competencyThemeList.concat(citem.children)
}
Expand All @@ -167,27 +181,27 @@ export class FilterComponent implements OnInit, AfterContentChecked {
}
})

if (this.filterObj['competencyArea'] &&
this.filterObj['competencyArea'].indexOf(ctype.id) > -1) {
const index = this.filterObj['competencyArea'].findIndex((x: any) => x === ctype.id)
this.filterObj['competencyArea'].splice(index, 1)
if (this.filterObj[this.compentencyKey.vCompetencyArea] &&
this.filterObj[this.compentencyKey.vCompetencyArea].indexOf(ctype.id) > -1) {
const index = this.filterObj[this.compentencyKey.vCompetencyArea].findIndex((x: any) => x === ctype.id)
this.filterObj[this.compentencyKey.vCompetencyArea].splice(index, 1)
}
if (this.filterObj['competencyTheme']) {
if (this.filterObj[this.compentencyKey.vCompetencyTheme]) {
this.competencyThemeList.map(sitem => {
if (sitem.parent === ctype.id) {
if (this.filterObj['competencyTheme'].indexOf(sitem.name) > -1) {
const index = this.filterObj['competencyTheme'].findIndex((x: any) => x === sitem.name)
this.filterObj['competencyTheme'].splice(index, 1)
if (this.filterObj[this.compentencyKey.vCompetencyTheme].indexOf(sitem.name) > -1) {
const index = this.filterObj[this.compentencyKey.vCompetencyTheme].findIndex((x: any) => x === sitem.name)
this.filterObj[this.compentencyKey.vCompetencyTheme].splice(index, 1)
}
}
})
}
if (this.filterObj['competencySubTheme']) {
if (this.filterObj[this.compentencyKey.vCompetencySubTheme]) {
this.competencySubThemeList.map(ssitem => {
if (ssitem.parentType === ctype.id) {
if (this.filterObj['competencySubTheme'].indexOf(ssitem.name) > -1) {
const index = this.filterObj['competencySubTheme'].findIndex((x: any) => x === ssitem.name)
this.filterObj['competencySubTheme'].splice(index, 1)
if (this.filterObj[this.compentencyKey.vCompetencySubTheme].indexOf(ssitem.name) > -1) {
const index = this.filterObj[this.compentencyKey.vCompetencySubTheme].findIndex((x: any) => x === ssitem.name)
this.filterObj[this.compentencyKey.vCompetencySubTheme].splice(index, 1)
}
}
})
Expand Down Expand Up @@ -219,8 +233,8 @@ export class FilterComponent implements OnInit, AfterContentChecked {
subthemechild['parent'] = csitem.name
})
this.competencySubThemeList = this.competencySubThemeList.concat(csitem.children)
if (this.filterObj['competencyTheme']) {
this.filterObj['competencyTheme'].push(cstype.name)
if (this.filterObj[this.compentencyKey.vCompetencyTheme]) {
this.filterObj[this.compentencyKey.vCompetencyTheme].push(cstype.name)
}

}
Expand All @@ -235,10 +249,10 @@ export class FilterComponent implements OnInit, AfterContentChecked {
this.competencySubThemeList = this.competencySubThemeList.filter(sitem => {
return sitem.parent !== cstype.name
})
if (this.filterObj['competencyTheme'] &&
this.filterObj['competencyTheme'].indexOf(cstype.name) > -1) {
const index = this.filterObj['competencyTheme'].findIndex((x: any) => x === cstype.name)
this.filterObj['competencyTheme'].splice(index, 1)
if (this.filterObj[this.compentencyKey.vCompetencyTheme] &&
this.filterObj[this.compentencyKey.vCompetencyTheme].indexOf(cstype.name) > -1) {
const index = this.filterObj[this.compentencyKey.vCompetencyTheme].findIndex((x: any) => x === cstype.name)
this.filterObj[this.compentencyKey.vCompetencyTheme].splice(index, 1)
}
this.searchSubThemeControl.reset()
}
Expand All @@ -251,8 +265,8 @@ export class FilterComponent implements OnInit, AfterContentChecked {
cstlitem['selected'] = true
}
})
if (this.filterObj['competencySubTheme']) {
this.filterObj['competencySubTheme'].push(csttype.name)
if (this.filterObj[this.compentencyKey.vCompetencySubTheme]) {
this.filterObj[this.compentencyKey.vCompetencySubTheme].push(csttype.name)
}

} else {
Expand All @@ -261,10 +275,10 @@ export class FilterComponent implements OnInit, AfterContentChecked {
cstlitem['selected'] = false
}
})
if (this.filterObj['competencySubTheme'] &&
this.filterObj['competencySubTheme'].indexOf(csttype.name) > -1) {
const index = this.filterObj['competencySubTheme'].findIndex((x: any) => x === csttype.name)
this.filterObj['competencySubTheme'].splice(index, 1)
if (this.filterObj[this.compentencyKey.vCompetencySubTheme] &&
this.filterObj[this.compentencyKey.vCompetencySubTheme].indexOf(csttype.name) > -1) {
const index = this.filterObj[this.compentencyKey.vCompetencySubTheme].findIndex((x: any) => x === csttype.name)
this.filterObj[this.compentencyKey.vCompetencySubTheme].splice(index, 1)
}
}

Expand All @@ -283,7 +297,12 @@ export class FilterComponent implements OnInit, AfterContentChecked {

clearFilter() {
if (this.from === 'content') {
this.filterObj = { competencyArea: [], competencyTheme: [], competencySubTheme: [], providers: [] }
this.filterObj = {
[this.compentencyKey.vCompetencyArea]: [],
[this.compentencyKey.vCompetencyTheme]: [],
[this.compentencyKey.vCompetencySubTheme]: [],
providers: [],
}
this.selectedProviders = []
this.competencyThemeList = []
this.competencySubThemeList = []
Expand Down

0 comments on commit 3759ea2

Please sign in to comment.