</eg-marc-html>
</ng-template>
</ngb-tab>
+ <ngb-tab title="Edit Record" i18n-title id="edit">
+ <ng-template ngbTabContent>
+ <ng-container *ngIf="queuedRecord">
+ <eg-marc-editor [inPlaceMode]="true" [recordXml]="queuedRecord.marc()"
+ [recordSource]="queuedRecord.bib_source()"
+ (recordSaved)="handleMarcRecordSaved($event)"></eg-marc-editor>
+ </ng-container>
+ </ng-template>
+ </ngb-tab>
<ngb-tab title="Record Matches" i18n-title id="matches">
<ng-template ngbTabContent>
<eg-queued-record-matches [recordId]="recordId" [queueType]="queueType">
import {Component, OnInit, ViewChild} from '@angular/core';
import {Router, ActivatedRoute, ParamMap} from '@angular/router';
import {NgbTabset, NgbTabChangeEvent} from '@ng-bootstrap/ng-bootstrap';
+import {PcrudService} from '@eg/core/pcrud.service';
+import {IdlObject} from '@eg/core/idl.service';
@Component({
templateUrl: 'queued-record.component.html'
queueType: string;
recordId: number;
recordTab: string;
+ queuedRecord: IdlObject;
constructor(
private router: Router,
- private route: ActivatedRoute) {
+ private route: ActivatedRoute,
+ private pcrud: PcrudService) {
this.route.paramMap.subscribe((params: ParamMap) => {
this.queueId = +params.get('id');
this.recordId = +params.get('recordId');
this.queueType = params.get('qtype');
this.recordTab = params.get('recordTab');
+ if (this.recordTab === 'edit') {
+ this.loadRecord();
+ }
});
}
this.router.navigate([url]);
}
+
+ loadRecord() {
+ this.queuedRecord = null;
+ this.pcrud.retrieve('vqbr', this.recordId)
+ .subscribe(rec => this.queuedRecord = rec);
+ }
+
+ handleMarcRecordSaved(saveEvent: any) {
+ this.queuedRecord.marc(saveEvent.marcXml);
+ this.queuedRecord.bib_source(saveEvent.bibSource);
+ this.pcrud.update(this.queuedRecord).subscribe(
+ response => {
+ console.log('response = ', response);
+ }
+ );
+ }
}