<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}}
@Input() targetResource: number;
@Input() targetResourceBarcode: string;
@Input() targetResourceType: ComboboxEntry;
+ @Input() patronId: number;
@Input() attributes: number[] = [];
@Input() resources: IdlObject[] = [];
@Output() onComplete: EventEmitter<boolean>;
'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;
<eg-create-reservation-dialog #createDialog
(onComplete)="fetchData()"
+ [patronId]="patronId"
[targetResourceBarcode]="resourceBarcode"
[targetResource]="resourceId"
[targetResourceType]="resourceType.value"