From: Jason Etheridge Date: Mon, 3 Oct 2022 03:55:48 +0000 (-0400) Subject: seed our BibStaffView with BibSummary X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=32ed4820d72d44b87fb4bbabbe6da59295bddcf8;p=working%2FEvergreen.git seed our BibStaffView with BibSummary --- diff --git a/Open-ILS/src/eg2/src/app/staff/common.module.ts b/Open-ILS/src/eg2/src/app/staff/common.module.ts index 1381be062c..d463853384 100644 --- a/Open-ILS/src/eg2/src/app/staff/common.module.ts +++ b/Open-ILS/src/eg2/src/app/staff/common.module.ts @@ -12,6 +12,7 @@ import {OpChangeComponent} from '@eg/staff/share/op-change/op-change.component'; import {TitleComponent} from '@eg/share/title/title.component'; import {BucketDialogComponent} from '@eg/staff/share/buckets/bucket-dialog.component'; 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 {EgHelpPopoverComponent} from '@eg/share/eg-help-popover/eg-help-popover.component'; import {DatetimeValidatorDirective} from '@eg/share/validators/datetime_validator.directive'; import {MultiSelectComponent} from '@eg/share/multi-select/multi-select.component'; @@ -36,6 +37,7 @@ import {OfflineService} from '@eg/staff/share/offline.service'; OpChangeComponent, BucketDialogComponent, BibSummaryComponent, + BibStaffViewComponent, EgHelpPopoverComponent, DatetimeValidatorDirective, MultiSelectComponent, @@ -61,6 +63,7 @@ import {OfflineService} from '@eg/staff/share/offline.service'; OpChangeComponent, BucketDialogComponent, BibSummaryComponent, + BibStaffViewComponent, EgHelpPopoverComponent, DatetimeValidatorDirective, MultiSelectComponent, diff --git a/Open-ILS/src/eg2/src/app/staff/share/bib-staff-view/bib-staff-view.component.css b/Open-ILS/src/eg2/src/app/staff/share/bib-staff-view/bib-staff-view.component.css new file mode 100644 index 0000000000..11e8804226 --- /dev/null +++ b/Open-ILS/src/eg2/src/app/staff/share/bib-staff-view/bib-staff-view.component.css @@ -0,0 +1,11 @@ + + +.eg-bib-summary .card-header { + padding: .25rem .5rem +} + +.jacket { + padding: 3px; + width: 100%; +} + 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..2e49b19977 --- /dev/null +++ b/Open-ILS/src/eg2/src/app/staff/share/bib-staff-view/bib-staff-view.component.html @@ -0,0 +1,144 @@ + +
+
+
+ Record Summary + + (Deleted) + + + + + + {{iconFormatLabel(icon)}} + + + +
+
+
+ + expand_more + + + expand_less + +
+
+
+ + + +
+ + Jacket Image + +
+
+ + +
+
+
    +
  • +
    +
    Title:
    +
    + + +
    +
    Edition:
    +
    {{summary.display.edition}}
    +
    TCN:
    +
    {{summary.record.tcn_value()}}
    +
    Created By:
    + +
    +
  • +
  • +
    +
    Author:
    +
    {{summary.display.author}}
    +
    Pubdate:
    +
    {{summary.display.pubdate}}
    +
    Database ID:
    +
    {{summary.id}}
    +
    Last Edited By:
    + +
    +
  • +
  • +
    +
    Bib Call #:
    +
    {{summary.bibCallNumber}}
    +
    Record Owner:
    +
    {{orgName(summary.record.owner())}}
    +
    Created On:
    +
    {{summary.record.create_date() | date:'short'}}
    +
    Last Edited On:
    +
    {{summary.record.edit_date() | date:'short'}}
    +
    +
  • + +
  • +
    +
    Associated Courses
    +
    +
  • +
  • +
    +
    Course Name:
    + +
    Course Number:
    +
    {{course.course_number()}}
    +
    Section Number:
    +
    {{course.section_number()}}
    +
    Owning Library:
    +
    {{this.org.get(course.owning_lib()).shortname()}}
    +
    +
  • +
    + +
  • +
    +
    + + Resource: + Version of Resource: + Related Resource: + + +
    +
    + +
    {{url.note}}
    +
    +
    +
  • +
    +
+
+
+
+
+ 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..c150b73dc3 --- /dev/null +++ b/Open-ILS/src/eg2/src/app/staff/share/bib-staff-view/bib-staff-view.component.ts @@ -0,0 +1,108 @@ +import {Component, OnInit, Input} from '@angular/core'; +import {OrgService} from '@eg/core/org.service'; +import {CourseService} from '@eg/staff/share/course.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'; + +@Component({ + selector: 'eg-bib-summary', + templateUrl: 'bib-summary.component.html', + styleUrls: ['bib-summary.component.css'] +}) +export class BibSummaryComponent implements OnInit { + + initDone = false; + hasCourse = false; + courses: any; + + // 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; } + + // If provided, the record will be fetched by the component. + @Input() recordId: number; + + // 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(); + this.loadCourseInformation(this.summary.record.id()); + } + } + + constructor( + private bib: BibRecordService, + private org: OrgService, + private store: ServerStoreService, + private cat: CatalogService, + private course: CourseService + ) {} + + ngOnInit() { + + this.store.getItem('eg.cat.record.summary.collapse') + .then(value => this.expand = !value) + .then(_ => this.cat.fetchCcvms()) + .then(_ => { + if (this.summary) { + return this.loadCourseInformation(this.summary.record.id()) + .then(__ => this.summary.getBibCallNumber()); + } else { + if (this.recordId) { + return this.loadSummary(); + } + } + }).then(_ => this.initDone = true); + } + + saveExpandState() { + this.store.setItem('eg.cat.record.summary.collapse', !this.expand); + } + + loadSummary(): Promise { + return this.loadCourseInformation(this.recordId) + .then(_ => { + return this.bib.getBibSummary(this.recordId).toPromise() + .then(summary => { + this.summary = summary; + return summary.getBibCallNumber(); + }); + }); + } + + loadCourseInformation(recordId): Promise { + return this.org.settings('circ.course_materials_opt_in') + .then(setting => { + if (setting['circ.course_materials_opt_in']) { + this.course.fetchCoursesForRecord(recordId).then(courseList => { + if (courseList) { + this.courses = courseList; + this.hasCourse = true; + } + }); + } + }); + } + + orgName(orgId: number): string { + if (orgId) { + return this.org.get(orgId).shortname(); + } + } + + iconFormatLabel(code: string): string { + return this.cat.iconFormatLabel(code); + } +} + +