From a478844a68738ab833fe63d4c8b95933c5da11b6 Mon Sep 17 00:00:00 2001 From: Jane Sandberg Date: Mon, 14 Dec 2020 08:07:16 -0800 Subject: [PATCH 1/1] LP 1907921: Add a patron search button to course admin screen To test: 1) Apply this patch 2) Go to Admin > Local Admin > Course Reserves List 3) Select a course and Edit it 4) Go to the Course users tab 5) Note that there is now a Search for Patrons button 6) Use this button to search for a patron. 7) Click the select button. 8) Note that the patron's barcode appears in the Patron Barcode field 9) Select a Role 10) Click the Add User button 11) Note that the patron appears on the Course Users grid Signed-off-by: Jane Sandberg Signed-off-by: Garry Collum Signed-off-by: Galen Charlton --- .../course-associate-users.component.html | 8 ++++++++ .../course-associate-users.component.ts | 12 ++++++++++++ .../local/course-reserves/course-reserves.module.ts | 2 ++ 3 files changed, 22 insertions(+) diff --git a/Open-ILS/src/eg2/src/app/staff/admin/local/course-reserves/course-associate-users.component.html b/Open-ILS/src/eg2/src/app/staff/admin/local/course-reserves/course-associate-users.component.html index 5959761e15..d323638cc9 100644 --- a/Open-ILS/src/eg2/src/app/staff/admin/local/course-reserves/course-associate-users.component.html +++ b/Open-ILS/src/eg2/src/app/staff/admin/local/course-reserves/course-associate-users.component.html @@ -5,6 +5,9 @@ + + +
diff --git a/Open-ILS/src/eg2/src/app/staff/admin/local/course-reserves/course-associate-users.component.ts b/Open-ILS/src/eg2/src/app/staff/admin/local/course-reserves/course-associate-users.component.ts index f281342f6f..d9985fa494 100644 --- a/Open-ILS/src/eg2/src/app/staff/admin/local/course-reserves/course-associate-users.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/admin/local/course-reserves/course-associate-users.component.ts @@ -10,6 +10,7 @@ import {GridComponent} from '@eg/share/grid/grid.component'; import {IdlObject} from '@eg/core/idl.service'; import {StringComponent} from '@eg/share/string/string.component'; import {FmRecordEditorComponent} from '@eg/share/fm-editor/fm-editor.component'; +import {PatronSearchDialogComponent} from '@eg/staff/share/patron/search-dialog.component'; import {ToastService} from '@eg/share/toast/toast.service'; import {CourseService} from '@eg/staff/share/course.service'; import {ComboboxEntry} from '@eg/share/combobox/combobox.component'; @@ -25,6 +26,7 @@ export class CourseAssociateUsersComponent extends DialogComponent implements On @Input() displayMode: String; users: any[] = []; @ViewChild('editDialog', { static: true }) editDialog: FmRecordEditorComponent; + @ViewChild('patronSearch') patronSearch: PatronSearchDialogComponent; @ViewChild('usersGrid') usersGrid: GridComponent; @ViewChild('userDeleteFailedString', { static: true }) userDeleteFailedString: StringComponent; @@ -103,6 +105,16 @@ export class CourseAssociateUsersComponent extends DialogComponent implements On editOneThing(userFields.shift()); } + searchPatrons() { + this.patronSearch.open({size: 'xl'}).toPromise().then( + patrons => { + if (!patrons || patrons.length === 0) { return; } + const user = patrons[0]; + this.userBarcode = user.card().barcode(); + } + ); + } + showEditDialog(user: IdlObject): Promise { this.editDialog.mode = 'update'; this.editDialog.recordId = user.id(); diff --git a/Open-ILS/src/eg2/src/app/staff/admin/local/course-reserves/course-reserves.module.ts b/Open-ILS/src/eg2/src/app/staff/admin/local/course-reserves/course-reserves.module.ts index 30c7651e78..32a44a5c1d 100644 --- a/Open-ILS/src/eg2/src/app/staff/admin/local/course-reserves/course-reserves.module.ts +++ b/Open-ILS/src/eg2/src/app/staff/admin/local/course-reserves/course-reserves.module.ts @@ -9,6 +9,7 @@ import {CourseAssociateUsersComponent} from './course-associate-users.component' import {CourseReservesRoutingModule} from './routing.module'; import {ItemLocationSelectModule} from '@eg/share/item-location-select/item-location-select.module'; import {MarcSimplifiedEditorModule} from '@eg/staff/share/marc-edit/simplified-editor/simplified-editor.module'; +import {PatronModule} from '@eg/staff/share/patron/patron.module'; import {CourseTermMapComponent} from './course-term-map.component'; @NgModule({ @@ -25,6 +26,7 @@ import {CourseTermMapComponent} from './course-term-map.component'; CourseReservesRoutingModule, ItemLocationSelectModule, MarcSimplifiedEditorModule, + PatronModule, TreeModule ], exports: [ -- 2.43.2