--- /dev/null
+<style>
+ /* common card-tight class, see also bib-summary.css */
+.eg-copies .card-body {
+ padding: .25rem;
+}
+.eg-copies .list-group-item {
+ padding: .25rem;
+}
+</style>
+<div class='eg-copies card w-100'>
+ <div class="card-header font-weight-bold d-flex bg-info">
+ <div class="flex-1" i18n>Location</div>
+ <div class="flex-2" i18n>Call Number / Copy Notes</div>
+ <div class="flex-1" i18n>Barcode</div>
+ <div class="flex-1" i18n>Shelving Location</div>
+ <div class="flex-1" i18n>Circulation Modifier</div>
+ <div class="flex-1" i18n>Age Hold Protection</div>
+ <div class="flex-1" i18n>Active/Create Date</div>
+ <div class="flex-1" i18n>Holdable?</div>
+ <div class="flex-1" i18n>Status</div>
+ <div class="flex-1" i18n>Due Date</div>
+ </div>
+ <div class="card-body">
+ <ul class="list-group list-group-flush" *ngIf="copies && copies.length">
+ <li class="list-group-item" *ngFor="let copy of copies">
+ <div class="d-flex">
+ <div class="flex-1" i18n>{{orgName(copy.circ_lib)}}</div>
+ <div class="flex-2" i18n>
+ {{copy.call_number_prefix_label}}
+ {{copy.call_number_label}}
+ {{copy.call_number_suffix_label}}
+ </div>
+ <div class="flex-1" i18n>{{copy.barcode}}</div>
+ <div class="flex-1" i18n>{{copy.location}}</div>
+ <div class="flex-1" i18n>{{copy.circ_modifier || ''}}</div>
+ <div class="flex-1" i18n>{{copy.age_protect}}</div>
+ <div class="flex-1" i18n>
+ {{copy.active_date || copy.create_date | date:'shortDate'}}
+ </div>
+ <div class="flex-1">
+ <span *ngIf="holdable(copy)" i18n>Yes</span>
+ <span *ngIf="!holdable(copy)" i18n>No</span>
+ </div>
+ <div class="flex-1" i18n>{{copy.copy_status}}</div>
+ <div class="flex-1" i18n>{{copy.due_date | date:'shortDate'}}</div>
+ </div>
+ </li>
+ </ul>
+ </div>
+</div>
--- /dev/null
+import {Component, OnInit, Input} from '@angular/core';
+import {EgNetService} from '@eg/core/net';
+import {StaffCatalogService} from '../staff-catalog.service';
+import {StaffRecordService} from './record.service';
+import {Pager} from '@eg/share/util/pager';
+import {EgOrgService} from '@eg/core/org';
+
+@Component({
+ selector: 'eg-catalog-copies',
+ styleUrls: ['copies.component.css'],
+ templateUrl: 'copies.component.html'
+})
+export class CopiesComponent implements OnInit {
+
+ @Input() recordId: number;
+ pager: Pager;
+ copies: any[];
+
+ constructor(
+ private net: EgNetService,
+ private org: EgOrgService,
+ private staffCat: StaffCatalogService,
+ private staffRecord: StaffRecordService
+ ) {}
+
+ ngOnInit() {
+ if (!this.recordId) return;
+ this.pager = new Pager();
+ this.pager.limit = 50; // TODO
+ this.fetchCopies();
+ }
+
+ orgName(orgId: number): string {
+ return this.org.get(orgId).shortname();
+ }
+
+ fetchCopies(): void {
+ this.copies = [];
+ this.net.request(
+ 'open-ils.search',
+ 'open-ils.search.bib.copies.staff',
+ this.recordId,
+ this.staffCat.searchContext.searchOrg.id(),
+ this.staffCat.searchContext.searchOrg.ou_type().depth(), // TODO
+ this.pager.limit,
+ this.pager.offset,
+ this.staffCat.searchContext.searchOrg.id() // TODO pref_ou
+ ).subscribe(copy => {
+ this.copies.push(copy);
+ });
+ }
+
+ holdable(copy: any): boolean {
+ return copy.holdable == 't'
+ && copy.location_holdable == 't'
+ && copy.status_holdable == 't';
+ }
+
+}
+
+