From: Kyle Huckins Date: Thu, 5 Dec 2019 19:17:27 +0000 (+0000) Subject: lp1849212 Display Associated Courses on Search Results X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=a1cd939de15811ea858f262737f7a4658afb71aa;p=working%2FEvergreen.git lp1849212 Display Associated Courses on Search Results - Display associated courses on Search Results UI Signed-off-by: Kyle Huckins Changes to be committed: modified: Open-ILS/src/eg2/src/app/staff/catalog/result/record.component.html modified: Open-ILS/src/eg2/src/app/staff/catalog/result/record.component.ts --- diff --git a/Open-ILS/src/eg2/src/app/staff/catalog/result/record.component.html b/Open-ILS/src/eg2/src/app/staff/catalog/result/record.component.html index 65209a0b4f..fa83758754 100644 --- a/Open-ILS/src/eg2/src/app/staff/catalog/result/record.component.html +++ b/Open-ILS/src/eg2/src/app/staff/catalog/result/record.component.html @@ -125,6 +125,10 @@ field="issn" joiner=","> + +
Associated Courses: + {{courseNames.join(', ')}}
+
diff --git a/Open-ILS/src/eg2/src/app/staff/catalog/result/record.component.ts b/Open-ILS/src/eg2/src/app/staff/catalog/result/record.component.ts index 8cb7f03c6c..5e777d5246 100644 --- a/Open-ILS/src/eg2/src/app/staff/catalog/result/record.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/catalog/result/record.component.ts @@ -10,6 +10,7 @@ import {CatalogSearchContext} from '@eg/share/catalog/search-context'; import {CatalogUrlService} from '@eg/share/catalog/catalog-url.service'; import {StaffCatalogService} from '../catalog.service'; import {BasketService} from '@eg/share/catalog/basket.service'; +import {CourseService} from '@eg/staff/share/course.service'; @Component({ selector: 'eg-catalog-result-record', @@ -29,6 +30,8 @@ export class ResultRecordComponent implements OnInit, OnDestroy { searchContext: CatalogSearchContext; isRecordSelected: boolean; basketSub: Subscription; + has_course: boolean; + courseNames: any[] = []; constructor( private router: Router, @@ -38,12 +41,14 @@ export class ResultRecordComponent implements OnInit, OnDestroy { private cat: CatalogService, private catUrl: CatalogUrlService, private staffCat: StaffCatalogService, - private basket: BasketService + private basket: BasketService, + private course: CourseService ) {} ngOnInit() { this.searchContext = this.staffCat.searchContext; this.summary.getHoldCount(); + this.loadCourseInformation(this.summary.id) this.isRecordSelected = this.basket.hasRecordId(this.summary.id); // Watch for basket changes caused by other components @@ -56,6 +61,23 @@ export class ResultRecordComponent implements OnInit, OnDestroy { this.basketSub.unsubscribe(); } + loadCourseInformation(recordId) { + console.log("Entering loadCourseInformation"); + this.course.isOptedIn().then(res => { + if (res) { + this.course.fetchCopiesInCourseFromRecord(recordId).then(course_list => { + Object.keys(course_list).forEach(key => { + this.courseNames.push(course_list[key].name() + + "(" + course_list[key].course_number() + ")"); + }); + this.has_course = true; + }); + } else { + this.has_course = false; + } + }); + } + orgName(orgId: number): string { return this.org.get(orgId).shortname(); }