import {ResultRecordComponent} from './result/record.component';
import {StaffCatalogService} from './catalog.service';
import {RecordPaginationComponent} from './record/pagination.component';
+import {MarcViewComponent} from './record/marc-view.component';
@NgModule({
declarations: [
ResultRecordComponent,
ResultFacetsComponent,
ResultPaginationComponent,
- RecordPaginationComponent
+ RecordPaginationComponent,
+ MarcViewComponent
],
imports: [
EgStaffCommonModule,
--- /dev/null
+import {Component, OnInit, Input, ElementRef} from '@angular/core';
+import {EgNetService} from '@eg/core/net.service';
+import {StaffCatalogService} from '../catalog.service';
+import {EgOrgService} from '@eg/core/org.service';
+
+@Component({
+ selector: 'eg-catalog-marc-view',
+ // bulk of display is generated from MARC HTML
+ template: '<div class="w-100"></div>'
+})
+export class MarcViewComponent implements OnInit {
+
+ recId: number;
+ initDone = false;
+
+ @Input() set recordId(id: number) {
+ this.recId = id;
+ // Only force new data collection when recordId()
+ // is invoked after ngInit() has already run.
+ if (this.initDone) {
+ this.collectData();
+ }
+ }
+
+ constructor(
+ private elm: ElementRef,
+ private net: EgNetService,
+ private staffCat: StaffCatalogService
+ ) {}
+
+ ngOnInit() {
+ this.initDone = true;
+ this.collectData();
+ }
+
+ collectData() {
+ if (!this.recId) { return; }
+ this.fetchMarcHtml();
+ }
+
+ fetchMarcHtml() {
+ this.net.request(
+ 'open-ils.search',
+ 'open-ils.search.biblio.record.html',
+ this.recId, false
+
+ ).subscribe(html => {
+
+ // Remove those pesky non-i8n labels / actions.
+ // Note: for printing, use the browser print page
+ // option. The end result is the same.
+ html = html.replace(
+ /<button onclick="window.print(.*?)<\/button>/,'');
+ html = html.replace(/<title>(.*?)<\/title>/,'');
+
+ // remove reference to nonexistant CSS file
+ html = html.replace(/<link(.*?)\/>/,'');
+ this.elm.nativeElement.innerHTML = html;
+ });
+ }
+}
+
+
<eg-bib-summary [bibSummary]="bibSummary">
</eg-bib-summary>
</div>
- <div id='staff-catalog-copies-container' class='mt-3'>
- <eg-catalog-copies [recordId]="recordId"></eg-catalog-copies>
+ <div id='staff-catalog-bib-tabs-container' class='mt-3'>
+ <ngb-tabset>
+ <ngb-tab title="Copy Table" i18n-title id="copy_table">
+ <ng-template ngbTabContent>
+ <eg-catalog-copies [recordId]="recordId"></eg-catalog-copies>
+ </ng-template>
+ </ngb-tab>
+ <ngb-tab title="MARC View" i18n-title id="marc_view">
+ <ng-template ngbTabContent>
+ <eg-catalog-marc-view [recordId]="recordId"></eg-catalog-marc-view>
+ </ng-template>
+ </ngb-tab>
+ </ngb-tabset>
</div>
</div>