From d1a8db8068e70c7ddd537abdabb5cebd25c17a7f Mon Sep 17 00:00:00 2001 From: Jane Sandberg Date: Sat, 15 Aug 2020 11:08:13 -0700 Subject: [PATCH] add course terms to UI Signed-off-by: Jane Sandberg --- .../course-reserves/course-list.component.html | 61 +++++++++++++++------- .../course-reserves/course-page.component.html | 10 ++++ .../local/course-reserves/course-page.component.ts | 25 +++++++-- 3 files changed, 73 insertions(+), 23 deletions(-) diff --git a/Open-ILS/src/eg2/src/app/staff/admin/local/course-reserves/course-list.component.html b/Open-ILS/src/eg2/src/app/staff/admin/local/course-reserves/course-list.component.html index 54d0c7d420..293edb9471 100644 --- a/Open-ILS/src/eg2/src/app/staff/admin/local/course-reserves/course-list.component.html +++ b/Open-ILS/src/eg2/src/app/staff/admin/local/course-reserves/course-list.component.html @@ -9,26 +9,41 @@ -
- - - - - - - - - - - - - - - -
+ +
+ + + + Terms taught + + diff --git a/Open-ILS/src/eg2/src/app/staff/admin/local/course-reserves/course-page.component.html b/Open-ILS/src/eg2/src/app/staff/admin/local/course-reserves/course-page.component.html index 39397d5792..1c1039a64a 100644 --- a/Open-ILS/src/eg2/src/app/staff/admin/local/course-reserves/course-page.component.html +++ b/Open-ILS/src/eg2/src/app/staff/admin/local/course-reserves/course-page.component.html @@ -61,6 +61,16 @@ + + +
  • + Course terms + + + + +
  • diff --git a/Open-ILS/src/eg2/src/app/staff/admin/local/course-reserves/course-page.component.ts b/Open-ILS/src/eg2/src/app/staff/admin/local/course-reserves/course-page.component.ts index df7a41a0b9..721c4f9068 100644 --- a/Open-ILS/src/eg2/src/app/staff/admin/local/course-reserves/course-page.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/admin/local/course-reserves/course-page.component.ts @@ -1,12 +1,14 @@ -import {Component, Input, ViewChild, OnInit, TemplateRef} from '@angular/core'; +import {Component, ViewChild, OnInit} from '@angular/core'; import {ActivatedRoute} from '@angular/router'; import {PcrudService} from '@eg/core/pcrud.service'; -import {IdlObject, IdlService} from '@eg/core/idl.service'; +import {IdlObject} from '@eg/core/idl.service'; +import {GridDataSource} from '@eg/share/grid/grid'; import {StringComponent} from '@eg/share/string/string.component'; import {ToastService} from '@eg/share/toast/toast.service'; import {CourseService} from '@eg/staff/share/course.service'; import {CourseAssociateUsersComponent} from './course-associate-users.component'; import {CourseAssociateMaterialComponent} from './course-associate-material.component'; +import {Pager} from '@eg/share/util/pager'; @Component({ selector: 'eg-course-page', @@ -18,6 +20,7 @@ export class CoursePageComponent implements OnInit { currentCourse: IdlObject; courseId: any; + // Materials Tab @ViewChild('courseMaterialDialog', {static: true}) private courseMaterialDialog: CourseAssociateMaterialComponent; @ViewChild('courseUserDialog', {static: true}) @@ -29,7 +32,8 @@ export class CoursePageComponent implements OnInit { @ViewChild('archiveSuccessString', { static: true }) archiveSuccessString: StringComponent; - // Materials Tab + // Course Tab + termsDataSource: GridDataSource = new GridDataSource(); constructor( private course: CourseService, @@ -44,6 +48,21 @@ export class CoursePageComponent implements OnInit { this.course.getCourses([this.courseId]).then(course => { this.currentCourse = course[0]; }); + this.termsDataSource.getRows = (pager: Pager, sort: any[]) => { + + const orderBy: any = {}; + if (sort.length) { + orderBy.acmtcm = sort[0].name + ' ' + sort[0].dir; + } + + const searchOps = { + offset: pager.offset, + limit: pager.limit, + order_by: orderBy + }; + + return this.pcrud.search('acmtcm', {course: this.courseId}, searchOps); + }; } // Edit Tab -- 2.11.0