Skip to content

Commit

Permalink
update for search filter issue
Browse files Browse the repository at this point in the history
  • Loading branch information
vishnubansaltarento committed Jan 31, 2024
1 parent 1103b90 commit fec1880
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export class FilterComponent implements OnInit, AfterContentChecked {

this.tpdsSvc.clearFilter.subscribe((result: any) => {
if (result && result.status) {
this.from = result.from;
this.from = result.from
this.clearFilter()
}
})
Expand Down Expand Up @@ -281,7 +281,7 @@ export class FilterComponent implements OnInit, AfterContentChecked {
this.tpdsSvc.filterToggle.next({ from: '', status: false })
}

clearFilter() {
clearFilter() {
if (this.from === 'content') {
this.filterObj = { competencyArea: [], competencyTheme: [], competencySubTheme: [], providers: [] }
this.selectedProviders = []
Expand All @@ -293,16 +293,17 @@ export class FilterComponent implements OnInit, AfterContentChecked {
this.resetFilter()
} else {
this.assigneeFilterObj = { group: [], designation: [] }
this.resetAssigneeFilter()
}

if (this.from === 'content') {
// this.getFilterData.emit(this.filterObj)
this.tpdsSvc.getFilterDataObject.next(this.filterObj)
//this.tpdsSvc.getFilterDataObject.next(this.filterObj)
} else {
// this.getFilterData.emit(this.assigneeFilterObj)
this.tpdsSvc.getFilterDataObject.next(this.assigneeFilterObj)
//this.tpdsSvc.getFilterDataObject.next(this.assigneeFilterObj)
}

if (this.checkboxes) {
this.checkboxes.forEach((element: any) => {
element['checked'] = false
Expand Down Expand Up @@ -409,4 +410,22 @@ export class FilterComponent implements OnInit, AfterContentChecked {
}

}

resetAssigneeFilter() {
if (this.groupList) {
this.groupList.map((pitem: any) => {
if (pitem && pitem['selected']) {
pitem['selected'] = false
}
})
}

if (this.designationList) {
this.designationList.map((pitem: any) => {
if (pitem && pitem['selected']) {
pitem['selected'] = false
}
})
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,18 @@ export class SearchComponent implements OnInit {

this.tpdsSvc.getFilterDataObject.subscribe(event => {
if (this.selectedDropDownValue === 'Course' ||
this.selectedDropDownValue === 'Standalone Assessment' ||
this.selectedDropDownValue === 'Program' ||
this.selectedDropDownValue === 'Blended program' ||
this.selectedDropDownValue === 'Curated program' ||
this.selectedDropDownValue === 'Moderated Course'
this.selectedDropDownValue === 'Standalone Assessment' ||
this.selectedDropDownValue === 'Program' ||
this.selectedDropDownValue === 'Blended program' ||
this.selectedDropDownValue === 'Curated program' ||
this.selectedDropDownValue === 'Moderated Course'
) {
this.getContent(this.selectedDropDownValue, event)
}
}
if (this.selectedDropDownValue === 'CustomUser') {
this.getCustomUsers(this.selectedDropDownValue, event)
}

})
if (this.tpdsSvc.trainingPlanStepperData.status && this.tpdsSvc.trainingPlanStepperData.status.toLowerCase() === 'live') {
this.isContentLive = true
Expand Down Expand Up @@ -89,8 +89,8 @@ export class SearchComponent implements OnInit {
/* tslint:disable */
event = !event ? 'Course' : event
/* tslint:enable */
this.searchText = '';
this.tpdsSvc.clearFilter.next({from:'content', status: true})
this.searchText = ''
this.tpdsSvc.clearFilter.next({ from: 'content', status: true })
this.resetPageIndex()
this.getContent(event)
break
Expand All @@ -100,7 +100,7 @@ export class SearchComponent implements OnInit {
// this.tpdsSvc.trainingPlanStepperData['assignmentTypeInfo']=[]
// }
/* tslint:disable */
this.tpdsSvc.clearFilter.next({from:'assignee', status: true})
this.tpdsSvc.clearFilter.next({ from: 'assignee', status: true })
this.resetPageIndex()
this.searchText = ''
event = !event ? 'Designation' : event
Expand All @@ -122,8 +122,11 @@ export class SearchComponent implements OnInit {
if (contentType === 'Moderated Course') {
this.tpdsSvc.moderatedCourseSelectStatus.next(true)
}
if (applyFilterObj && Object.keys(applyFilterObj).length) {
this.searchText = ''
}
if (this.searchText) {
this.tpdsSvc.clearFilter.next({from:'content', status: true})
this.tpdsSvc.clearFilter.next({ from: 'content', status: true })
/* tslint:disable */
applyFilterObj = {}
/* tslint:enable */
Expand Down Expand Up @@ -180,8 +183,11 @@ export class SearchComponent implements OnInit {
getCustomUsers(event: any, applyFilterObj?: any) {
this.loadingService.changeLoaderState(true)
const rootOrgId = _.get(this.route.snapshot.parent, 'data.configService.unMappedUser.rootOrg.rootOrgId')
if (applyFilterObj && Object.keys(applyFilterObj).length) {
this.searchText = ''
}
if (this.searchText) {
this.tpdsSvc.clearFilter.next({from:'assignee', status: true})
this.tpdsSvc.clearFilter.next({ from: 'assignee', status: true })
/* tslint:disable */
applyFilterObj = {}
/* tslint:enable */
Expand All @@ -204,7 +210,7 @@ export class SearchComponent implements OnInit {
'profileDetails',
'organisations',
],
limit: 500,
limit: 100000,
offset: 0,
},
}
Expand Down

0 comments on commit fec1880

Please sign in to comment.