From 46b1dbe9eb0661264b171551a9cc447af50eae08 Mon Sep 17 00:00:00 2001 From: Jason Stephenson Date: Tue, 23 May 2023 13:22:43 -0400 Subject: [PATCH] Add CW MARS Angular customizations Signed-off-by: Jason Stephenson --- .../src/app/share/catalog/bib-record.service.ts | 6 + .../eg2/src/app/share/catalog/search-context.ts | 2 +- .../app/staff/catalog/record/record.component.html | 8 +- .../app/staff/catalog/record/record.component.ts | 3 +- .../app/staff/catalog/search-form.component.html | 5 + Open-ILS/src/eg2/src/app/staff/common.module.ts | 3 + .../bib-staff-view/bib-staff-view.component.css | 22 ++ .../bib-staff-view/bib-staff-view.component.html | 280 +++++++++++++++++++++ .../bib-staff-view/bib-staff-view.component.ts | 95 +++++++ 9 files changed, 420 insertions(+), 4 deletions(-) create mode 100644 Open-ILS/src/eg2/src/app/staff/share/bib-staff-view/bib-staff-view.component.css create mode 100644 Open-ILS/src/eg2/src/app/staff/share/bib-staff-view/bib-staff-view.component.html create mode 100644 Open-ILS/src/eg2/src/app/staff/share/bib-staff-view/bib-staff-view.component.ts diff --git a/Open-ILS/src/eg2/src/app/share/catalog/bib-record.service.ts b/Open-ILS/src/eg2/src/app/share/catalog/bib-record.service.ts index a4dd0b0f2e..954906c10f 100644 --- a/Open-ILS/src/eg2/src/app/share/catalog/bib-record.service.ts +++ b/Open-ILS/src/eg2/src/app/share/catalog/bib-record.service.ts @@ -37,6 +37,9 @@ export class BibRecordSummary { id: number; // == record.id() for convenience metabibId: number; // If present, this is a metabib summary metabibRecords: number[]; // all constituent bib records + staffViewMetabibId: number; // to supplement a record summary + staffViewMetabibRecords: number[]; // to supplement a record summary + staffViewMetabibAttributes: any; // to supplement a record summary orgId: number; orgDepth: number; record: IdlObject; @@ -128,6 +131,9 @@ export class BibRecordService { .pipe(map(bibSummary => { const summary = new BibRecordSummary(bibSummary.record, orgId); summary.net = this.net; // inject + summary.staffViewMetabibId = Number(bibSummary.staff_view_metabib_id); + summary.staffViewMetabibRecords = bibSummary.staff_view_metabib_records; + summary.staffViewMetabibAttributes = bibSummary.staff_view_metabib_attributes; summary.display = bibSummary.display; summary.attributes = bibSummary.attributes; summary.holdCount = bibSummary.hold_count; diff --git a/Open-ILS/src/eg2/src/app/share/catalog/search-context.ts b/Open-ILS/src/eg2/src/app/share/catalog/search-context.ts index 7ee7ab1271..53d6763199 100644 --- a/Open-ILS/src/eg2/src/app/share/catalog/search-context.ts +++ b/Open-ILS/src/eg2/src/app/share/catalog/search-context.ts @@ -417,7 +417,7 @@ export class CatalogSearchContext { */ reset(): void { this.pager.offset = 0; - this.sort = ''; + this.sort = 'poprel'; this.showBasket = false; this.result = new CatalogSearchResults(); this.resultIds = []; diff --git a/Open-ILS/src/eg2/src/app/staff/catalog/record/record.component.html b/Open-ILS/src/eg2/src/app/staff/catalog/record/record.component.html index 7dea673c3a..106f8c918f 100644 --- a/Open-ILS/src/eg2/src/app/staff/catalog/record/record.component.html +++ b/Open-ILS/src/eg2/src/app/staff/catalog/record/record.component.html @@ -38,6 +38,12 @@ + + + + + + @@ -104,5 +110,3 @@ - - diff --git a/Open-ILS/src/eg2/src/app/staff/catalog/record/record.component.ts b/Open-ILS/src/eg2/src/app/staff/catalog/record/record.component.ts index 80e6e19e46..8d58d2c4d0 100644 --- a/Open-ILS/src/eg2/src/app/staff/catalog/record/record.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/catalog/record/record.component.ts @@ -9,6 +9,7 @@ import {CatalogService} from '@eg/share/catalog/catalog.service'; import {BibRecordService, BibRecordSummary} from '@eg/share/catalog/bib-record.service'; import {StaffCatalogService} from '../catalog.service'; import {BibSummaryComponent} from '@eg/staff/share/bib-summary/bib-summary.component'; +import {BibStaffViewComponent} from '@eg/staff/share/bib-staff-view/bib-staff-view.component'; import {StoreService} from '@eg/core/store.service'; import {ConfirmDialogComponent} from '@eg/share/dialog/confirm.component'; import {MarcEditorComponent} from '@eg/staff/share/marc-edit/editor.component'; @@ -154,7 +155,7 @@ export class RecordComponent implements OnInit { this.bib.getBibSummary( this.recordId, this.searchContext.searchOrg.id(), - this.searchContext.searchOrg.ou_type().depth()).toPromise() + this.searchContext.isStaff).toPromise() .then(summary => { this.summary = this.staffCat.currentDetailRecordSummary = summary; diff --git a/Open-ILS/src/eg2/src/app/staff/catalog/search-form.component.html b/Open-ILS/src/eg2/src/app/staff/catalog/search-form.component.html index e08dd8cbc7..912734d82a 100644 --- a/Open-ILS/src/eg2/src/app/staff/catalog/search-form.component.html +++ b/Open-ILS/src/eg2/src/app/staff/catalog/search-form.component.html @@ -64,7 +64,9 @@ + + + + + .row:first-child { + margin-left: 0; +} + +.eg-bib-staff-view .bib-details ul { + margin-bottom: 0; + padding-left: 0; +} + +.eg-bib-staff-view .bib-details li { + border: 0; + list-style: none; + padding: .25rem .25rem 0 0; +} diff --git a/Open-ILS/src/eg2/src/app/staff/share/bib-staff-view/bib-staff-view.component.html b/Open-ILS/src/eg2/src/app/staff/share/bib-staff-view/bib-staff-view.component.html new file mode 100644 index 0000000000..e69032d263 --- /dev/null +++ b/Open-ILS/src/eg2/src/app/staff/share/bib-staff-view/bib-staff-view.component.html @@ -0,0 +1,280 @@ +
+
+ + +
+ + + + + +
+
Series Title:
+
+ +
+
+ + + + + +
+
Performer:
+
+
    +
  • + {{_performer}} +
  • +
+
+
+ + +
+
Edition:
+
+ {{summary.display.edition}} +
+
+ + +
+
Publisher:
+
+ {{summary.display.publisher}} +
+
+ + +
+
Production Credit:
+
+
    +
  • + {{_credit}} +
  • +
+
+
+ + +
+
Type of Resource:
+
+ {{summary.display.type_of_resource}} +
+
+ + +
+
Physical Description:
+
+
    +
  • + {{_desc}} +
  • +
+
+
+ + +
+
ISBN:
+
+ +
+
+ + +
+
ISSN:
+
+ +
+
+ + +
+
UPC:
+
+ +
+
+ +
+ + +
+ + +
+
Summary:
+
+ {{summary.display.abstract}} +
+
+ + +
+
General Note:
+
+
    +
  • + {{_note}} +
  • +
+
+
+ + +
+
Bibliography:
+
+
    +
  • + {{_bibliography}} +
  • +
+
+
+ + +
+
Table of Contents:
+
+ {{summary.display.toc}} +
+
+ + +
+
Thesis:
+
+
    +
  • + {{_thesis}} +
  • +
+
+
+ +
+ +
+ + +
+
Hold and Copy Counts:
+
+
    +
  • {{summary.holdCount}} hold requests
  • +
  • + {{_count.available}} of {{_count.count}} copies available at {{orgName(_count.org_unit)}}. +
  • +
+
+
+ + + +
+
Subject:
+
+ +
+
+ + +
+
Genre:
+
+ +
+
+ + +
+
Formats and Editions:
+
+ +
+
+ +
+ +
+
diff --git a/Open-ILS/src/eg2/src/app/staff/share/bib-staff-view/bib-staff-view.component.ts b/Open-ILS/src/eg2/src/app/staff/share/bib-staff-view/bib-staff-view.component.ts new file mode 100644 index 0000000000..f3991ed4d2 --- /dev/null +++ b/Open-ILS/src/eg2/src/app/staff/share/bib-staff-view/bib-staff-view.component.ts @@ -0,0 +1,95 @@ +import {Component, OnInit, Input} from '@angular/core'; +import {OrgService} from '@eg/core/org.service'; +import {BibRecordService, BibRecordSummary + } from '@eg/share/catalog/bib-record.service'; +import {ServerStoreService} from '@eg/core/server-store.service'; +import {CatalogService} from '@eg/share/catalog/catalog.service'; +import {StaffCatalogService} from '@eg/staff/catalog/catalog.service'; + +@Component({ + selector: 'eg-bib-staff-view', + templateUrl: 'bib-staff-view.component.html', + styleUrls: ['bib-staff-view.component.css'] +}) +export class BibStaffViewComponent implements OnInit { + + recId: number; + initDone = false; + + // True / false if the display is vertically expanded + private _exp: boolean; + set expand(e: boolean) { + this._exp = e; + if (this.initDone) { + this.saveExpandState(); + } + } + get expand(): boolean { return this._exp; } + + @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.loadSummary(); + } + } + + // Otherwise, we'll use the provided bib summary object. + summary: BibRecordSummary; + @Input() set bibSummary(s: any) { + this.summary = s; + if (this.initDone && this.summary) { + this.summary.getBibCallNumber(); + } + } + + constructor( + private bib: BibRecordService, + private org: OrgService, + private store: ServerStoreService, + private cat: CatalogService, + private staffCat: StaffCatalogService + ) {} + + ngOnInit() { + + this.store.getItem('eg.cat.record.staff-view.collapse') + .then(value => this.expand = !value) + .then(_ => this.cat.fetchCcvms()) + .then(_ => { + if (this.recId) { + // ignore any existing this.summary, always refetch + return this.loadSummary(); + } + }).then(_ => this.initDone = true); + } + + saveExpandState() { + this.store.setItem('eg.cat.record.staff-view.collapse', !this.expand); + } + + loadSummary(): Promise { + return this.bib.getBibSummary( + this.recId, + this.staffCat.searchContext.searchOrg.id(), + true // isStaff + ).toPromise() + .then(summary => { + this.summary = summary; + return summary.getBibCallNumber(); + }); + } + + orgName(orgId: number): string { + if (orgId) { + return this.org.get(orgId).shortname(); + } + } + + iconFormatLabel(code: string): string { + return this.cat.iconFormatLabel(code); + } +} + + -- 2.11.0