From a7c53482e2cec88c39f511ffcd64ce77a2793b4e Mon Sep 17 00:00:00 2001 From: Raghavendra Shivhare Date: Tue, 14 Jul 2020 19:50:38 +0530 Subject: [PATCH] Issue #SB-19243 fix: UI and NCERT content --- .../faq-report-issue/faq-report-issue.page.ts | 18 ++++++++--- .../explore-books-sort.component.ts | 30 +++++++++++++------ 2 files changed, 35 insertions(+), 13 deletions(-) diff --git a/src/app/faq-report-issue/faq-report-issue.page.ts b/src/app/faq-report-issue/faq-report-issue.page.ts index a4881a553d..4ed4e10764 100644 --- a/src/app/faq-report-issue/faq-report-issue.page.ts +++ b/src/app/faq-report-issue/faq-report-issue.page.ts @@ -94,6 +94,7 @@ export class FaqReportIssuePage implements OnInit, OnDestroy { showThanksResponse: boolean; formContext: any; supportEmail: any; + relevantTerms: any; constructor( private router: Router, @@ -306,9 +307,13 @@ export class FaqReportIssuePage implements OnInit, OnDestroy { this.takeAction(); } } - if (this.formValues && this.formValues.children && this.formValues.children.subcategory && - this.formValues.children.subcategory.notify) { + if (this.formValues && this.formValues.children && this.formValues.children.subcategory && + this.formValues.subcategory === 'contentavailability') { const corRelationList: Array = this.prepareTelemetryCorrelation(); + if (this.formValues && this.formValues.children && this.formValues.children.subcategory && + this.formValues.children.subcategory.notify) { + corRelationList.push({ id: 'true', type: 'Notify' }); + } this.telemetryGeneratorService.generateInteractTelemetry( InteractType.SUPPORT, '', Environment.HOME, @@ -352,6 +357,9 @@ export class FaqReportIssuePage implements OnInit, OnDestroy { [this.formValues.children.subcategory.medium.name] : undefined, geadeList: (this.formValues.children && this.formValues.children.subcategory && this.formValues.children.subcategory.grade) ? [this.formValues.children.subcategory.grade.name] : undefined, + subjectList: (this.formValues.children && this.formValues.children.subcategory && this.formValues.children.subcategory.subject) ? + [this.formValues.children.subcategory.subject.name] : undefined, + relevantTerms: this.relevantTerms, curLang: this.translate.currentLang } }); @@ -529,16 +537,18 @@ export class FaqReportIssuePage implements OnInit, OnDestroy { switch (dataSrc.marker) { case 'ACTIVE_CHANNEL.SUGGESTED_FRAMEWORK_LIST.MAPPED_TO_FRAMEWORKCATEGORIES': templateOptions.options = this.getClosure('board'); - // delete templateOptions.dataSrc; break; case 'FRAMEWORK_CATEGORY_TERMS': templateOptions.options = this.getClosure(dataSrc.params.categoryCode); - // delete templateOptions.dataSrc; break; } if (dataSrc && dataSrc.action) { this.callToAction[templateOptions.value] = dataSrc.action; } + if (dataSrc && dataSrc.params && dataSrc.params.relevantTerms) { + this.relevantTerms = dataSrc.params.relevantTerms; + } + delete templateOptions.dataSrc; } getClosure(type: string) { diff --git a/src/app/resources/explore-books-sort/explore-books-sort.component.ts b/src/app/resources/explore-books-sort/explore-books-sort.component.ts index c3084fa102..e65be9a409 100644 --- a/src/app/resources/explore-books-sort/explore-books-sort.component.ts +++ b/src/app/resources/explore-books-sort/explore-books-sort.component.ts @@ -10,7 +10,7 @@ import { ContentSearchCriteria, ContentSearchResult, ContentService, - SearchType, TelemetryObject + SearchType, TelemetryObject, GetSuggestedFrameworksRequest, CachedItemRequestSourceFrom, FrameworkCategoryCodesGroup, FrameworkUtilService } from 'sunbird-sdk'; import {ContentType, ExploreConstants, RouterLinks, Search} from '@app/app/app.constant'; import {Router} from '@angular/router'; @@ -21,10 +21,6 @@ import {ContentUtil} from '@app/util/content-util'; styleUrls: ['./explore-books-sort.component.scss'], }) export class ExploreBooksSortComponent implements OnInit, OnDestroy { - @Input() boardList: string[]; - @Input() mediumList: string[]; - @Input() gradeList: string[]; - @Input() curLang: string; storyAndWorksheets: Array; unregisterBackButton: Subscription; searchRequest: ContentSearchCriteria = { @@ -33,7 +29,15 @@ export class ExploreBooksSortComponent implements OnInit, OnDestroy { appName = ''; public imageSrcMap = new Map(); defaultImg: string; + boardList: string[]; + mediumList: string[]; + gradeList: string[]; + subjectList: string[]; + curLang: string; + relevantTerms: any; + constructor( + @Inject('FRAMEWORK_UTIL_SERVICE') private frameworkUtilService: FrameworkUtilService, private platform: Platform, public commonUtilService: CommonUtilService, private telemetryGeneratorService: TelemetryGeneratorService, @@ -42,10 +46,17 @@ export class ExploreBooksSortComponent implements OnInit, OnDestroy { private location: Location, @Inject('CONTENT_SERVICE') private contentService: ContentService, private ngZone: NgZone, - private router: Router + private router: Router, + private params: NavParams ) { - this.initForm(); this.defaultImg = this.commonUtilService.convertFileSrc('assets/imgs/ic_launcher.png'); + this.boardList = this.params.get('boardList'); + this.mediumList = this.params.get('mediumList'); + this.gradeList = this.params.get('gradeList'); + this.subjectList = this.params.get('subjectList'); + this.relevantTerms = this.params.get('relevantTerms'); + this.curLang = this.params.get('curLang'); + this.initForm(); } async ngOnInit() { this.handleBackButton(false); @@ -63,10 +74,11 @@ export class ExploreBooksSortComponent implements OnInit, OnDestroy { }); } - private getRelevantTextBooks() { - this.searchRequest.board = this.boardList ? this.boardList : null; + private async getRelevantTextBooks() { + this.searchRequest.board = this.relevantTerms ? this.relevantTerms : []; this.searchRequest.medium = this.mediumList ? this.mediumList : null; this.searchRequest.grade = this.gradeList ? this.gradeList : null; + this.searchRequest.subject = this.subjectList ? this.subjectList : null; this.searchRequest.facets = Search.FACETS_ETB; this.searchRequest.mode = 'hard'; this.searchRequest.contentTypes = [ContentType.TEXTBOOK];