LP1816475: Pre-fill patron barcode in Create Reservations
authorJane Sandberg <sandbej@linnbenton.edu>
Tue, 20 Aug 2019 17:07:17 +0000 (10:07 -0700)
committerGalen Charlton <gmc@equinoxinitiative.org>
Fri, 6 Sep 2019 14:12:35 +0000 (10:12 -0400)
Addresses comment #1 from
https://bugs.launchpad.net/evergreen/+bug/1816475/comments/20

Signed-off-by: Jane Sandberg <sandbej@linnbenton.edu>
Signed-off-by: Christine Burns <christine.burns@bc.libraries.coop>
Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Open-ILS/src/eg2/src/app/staff/booking/create-reservation-dialog.component.html
Open-ILS/src/eg2/src/app/staff/booking/create-reservation-dialog.component.ts
Open-ILS/src/eg2/src/app/staff/booking/create-reservation.component.html
Open-ILS/src/eg2/src/app/staff/booking/create-reservation.component.ts

index 1fe0195..243e4bf 100644 (file)
@@ -12,7 +12,7 @@
       <label class="col-lg-4 text-right font-weight-bold"
         i18n for="create-patron-barcode">Patron barcode</label>
       <input type="text" id="create-patron-barcode"
-        class="form-control col-lg-7" formControlName="patronBarcode">
+        class="form-control col-lg-7" formControlName="patronBarcode" [disabled]="patronId">
       <span class="col-lg-7 offset-lg-4" i18n>
         {{ (patron$ | async)?.first_given_name}}
         {{ (patron$ | async)?.second_given_name}}
index 759c8e4..96b2b6c 100644 (file)
@@ -37,6 +37,7 @@ export class CreateReservationDialogComponent
     @Input() targetResource: number;
     @Input() targetResourceBarcode: string;
     @Input() targetResourceType: ComboboxEntry;
+    @Input() patronId: number;
     @Input() attributes: number[] = [];
     @Input() resources: IdlObject[] = [];
     @Output() onComplete: EventEmitter<boolean>;
@@ -83,6 +84,14 @@ export class CreateReservationDialogComponent
             'resourceList': new FormControl(),
         }, [startTimeIsBeforeEndTimeValidator]
         );
+        if (this.patronId) {
+            this.pcrud.search('au', {id: this.patronId}, {
+                flesh: 1,
+                flesh_fields: {'au': ['card']}
+            }).subscribe((usr) =>
+                this.create.patchValue({patronBarcode: usr.card().barcode()})
+            );
+        }
 
         this.addBresv$ = () => {
             let selectedResourceId = this.targetResource ? [this.targetResource] : null;
index ef67b08..64bbdf8 100644 (file)
 
 <eg-create-reservation-dialog #createDialog
   (onComplete)="fetchData()"
+  [patronId]="patronId"
   [targetResourceBarcode]="resourceBarcode"
   [targetResource]="resourceId"
   [targetResourceType]="resourceType.value"
index 23cddcb..1b25f41 100644 (file)
@@ -44,7 +44,6 @@ export class CreateReservationComponent implements OnInit, AfterViewInit, OnDest
     multiday = false;
     resourceAvailabilityIcon: (row: ScheduleRow) => GridRowFlairEntry;
 
-    patronBarcode: string;
     patronId: number;
     resourceBarcode: string;
     resourceId: number;