+<div class="row">
+ <!-- templates row -->
+</div>
+
+<div class="row d-flex">
+ <div class="flex-1 p-1"><h3 class="font-weight-bold" i18n>Identification</h3></div>
+ <div class="flex-1 p-1"><h3 class="font-weight-bold" i18n>Location</h3></div>
+ <div class="flex-1 p-1"><h3 class="font-weight-bold" i18n>Circulation</h3></div>
+ <div class="flex-1 p-1"><h3 class="font-weight-bold" i18n>Miscellaneous</h3></div>
+ <div class="flex-1 p-1"><h3 class="font-weight-bold" i18n>Statistics</h3></div>
+</div>
+
+
+<!-- List of Edit Templates -->
+<ng-template #locationEditTemplate>
+ <eg-combobox #locationCbox [entries]="circModifiers"></eg-combobox>
+</ng-template>
+
+<!-- ROW 1 -->
+
+<div class="row d-flex mb-1">
+ <div class="flex-1 p-1">
+ <eg-batch-item-attr label="Status" i18n-label
+ [readOnly]="true"
+ [labelCounts]="itemAttrCounts('status')">
+ </eg-batch-item-attr>
+ </div>
+ <div class="flex-1 p-1">
+ <eg-batch-item-attr label="Location / Collection" i18n-label
+ [labelCounts]="itemAttrCounts('location')"
+ [editTemplate]="locationEditTemplate"
+ (changesSaved)="locationChanged(locationModCbox.selected)">
+ </eg-batch-item-attr>
+ </div>
+ <div class="flex-1 p-1">
+ </div>
+ <div class="flex-1 p-1">
+ </div>
+ <div class="flex-1 p-1">
+ </div>
+</div>
+
+<!-- ROW 2 -->
+
+<div class="row d-flex mb-1">
+ <div class="flex-1 p-1">
+ <eg-batch-item-attr label="Barcode" i18n-label
+ [readOnly]="true"
+ [labelCounts]="itemAttrCounts('barcode')">
+ </eg-batch-item-attr>
+ </div>
+ <div class="flex-1 p-1">
+ </div>
+ <div class="flex-1 p-1">
+ </div>
+ <div class="flex-1 p-1">
+ </div>
+ <div class="flex-1 p-1">
+ </div>
+</div>
+
+<!-- ROW 3 -->
+
+<div class="row d-flex mb-1">
+ <div class="flex-1 p-1">
+ <eg-batch-item-attr label="Creation Date" i18n-label
+ [readOnly]="true"
+ [labelCounts]="itemAttrCounts('create_date')">
+ </eg-batch-item-attr>
+ </div>
+ <div class="flex-1 p-1">
+ </div>
+ <div class="flex-1 p-1">
+ </div>
+ <div class="flex-1 p-1">
+ </div>
+ <div class="flex-1 p-1">
+ </div>
+</div>
+
+<!-- ROW 4 -->
+
+<div class="row d-flex mb-1">
+ <div class="flex-1 p-1">
+ <eg-batch-item-attr label="Active Date" i18n-label
+ [readOnly]="true"
+ [labelCounts]="itemAttrCounts('active_date')">
+ </eg-batch-item-attr>
+ </div>
+ <div class="flex-1 p-1">
+ </div>
+ <div class="flex-1 p-1">
+ </div>
+ <div class="flex-1 p-1">
+ </div>
+ <div class="flex-1 p-1">
+ </div>
+</div>
+
+<!-- ROW 5 -->
+
+<div class="row d-flex mb-1">
+ <div class="flex-1 p-1">
+ <eg-batch-item-attr label="Creator" i18n-label
+ [readOnly]="true"
+ [labelCounts]="itemAttrCounts('creator')">
+ </eg-batch-item-attr>
+ </div>
+ <div class="flex-1 p-1">
+ </div>
+ <div class="flex-1 p-1">
+ </div>
+ <div class="flex-1 p-1">
+ </div>
+ <div class="flex-1 p-1">
+ </div>
+</div>
+
+<!-- ROW 6 -->
+
+<div class="row d-flex mb-1">
+ <div class="flex-1 p-1">
+ <eg-batch-item-attr label="Last Edit Date" i18n-label
+ [readOnly]="true"
+ [labelCounts]="itemAttrCounts('edit_date')">
+ </eg-batch-item-attr>
+ </div>
+ <div class="flex-1 p-1">
+ </div>
+ <div class="flex-1 p-1">
+ </div>
+ <div class="flex-1 p-1">
+ </div>
+ <div class="flex-1 p-1">
+ </div>
+</div>
+
+<div class="row d-flex mb-1">
+ <div class="flex-1 p-1">
+ <eg-batch-item-attr label="Last Editor" i18n-label
+ [readOnly]="true"
+ [labelCounts]="itemAttrCounts('editor')">
+ </eg-batch-item-attr>
+ </div>
+ <div class="flex-1 p-1">
+ </div>
+ <div class="flex-1 p-1">
+ </div>
+ <div class="flex-1 p-1">
+ </div>
+ <div class="flex-1 p-1">
+ </div>
+</div>
+
-import {Component, OnInit, AfterViewInit, ViewChild, Renderer2} from '@angular/core';
+import {Component, Input, OnInit, AfterViewInit, ViewChild, Renderer2} from '@angular/core';
import {Router, ActivatedRoute, ParamMap} from '@angular/router';
import {tap} from 'rxjs/operators';
import {IdlObject, IdlService} from '@eg/core/idl.service';
import {HoldingsService} from '@eg/staff/share/holdings/holdings.service';
import {VolCopyContext} from './volcopy';
import {VolCopyService} from './volcopy.service';
-
-
+import {FormatService} from '@eg/core/format.service';
@Component({
+ selector: 'eg-copy-attrs',
templateUrl: 'copy-attrs.component.html'
})
export class CopyAttrsComponent implements OnInit {
+ @Input() context: VolCopyContext;
constructor(
private router: Router,
private auth: AuthService,
private pcrud: PcrudService,
private holdings: HoldingsService,
- private volcopy: VolCopyService
+ private volcopy: VolCopyService,
+ private format: FormatService
) { }
ngOnInit() {
}
+ itemAttrCounts(field: string): {[value: string]: number} {
+
+ const counts = {};
+ this.context.copyList().forEach(copy => {
+ let value = copy[field]();
+ if (value === undefined || value === null) { value = ''; }
+
+ if (value !== '') {
+
+ if (field === 'status') {
+ if (value in this.volcopy.copyStatuses) {
+ value = this.volcopy.copyStatuses[value].name();
+ }
+
+ } else if (field.match(/date/)) {
+ value = this.format.transform({
+ datatype: 'timestamp',
+ value: value
+ });
+ } else if (field === 'creator' || field === 'editor') {
+ value = value.usrname();
+ }
+ }
+
+ if (counts[value] === undefined) {
+ counts[value] = 0;
+ };
+ counts[value]++;
+ });
+
+ return counts;
+ }
}