]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/src/eg2/src/app/staff/cat/vandelay/match-set-new-point.component.ts
LP2042879 Shelving Location Groups Admin accessibility
[Evergreen.git] / Open-ILS / src / eg2 / src / app / staff / cat / vandelay / match-set-new-point.component.ts
1 import {Component, OnInit, ViewChild, Output, Input} from '@angular/core';
2 import {IdlObject, IdlService} from '@eg/core/idl.service';
3 import {PcrudService} from '@eg/core/pcrud.service';
4 import {ComboboxEntry} from '@eg/share/combobox/combobox.component';
5
6 // Can be used to create match_set_point's and match_set_quality's
7 export class MatchSetPointValues {
8     pointType: string;
9     recordAttr: string;
10     matchScore: number;
11     negate: boolean;
12     marcTag: string;
13     marcSf: string;
14     heading: string;
15     boolOp: string;
16     value: string;
17 }
18
19 @Component({
20   selector: 'eg-match-set-new-point',
21   templateUrl: 'match-set-new-point.component.html'
22 })
23 export class MatchSetNewPointComponent implements OnInit {
24
25     public values: MatchSetPointValues;
26
27     bibAttrDefs: IdlObject[];
28     bibAttrDefEntries: ComboboxEntry[];
29
30     // defining a new match_set_quality
31     @Input() isForQuality: boolean;
32
33     // biblio, authority, quality
34     @Input() set pointType(type_: string) {
35         this.values.pointType = type_;
36         this.values.recordAttr = '';
37         this.values.matchScore = 1;
38         this.values.negate = false;
39         this.values.marcTag = '';
40         this.values.marcSf = '';
41         this.values.boolOp = 'AND';
42         this.values.value = '';
43     }
44
45     constructor(
46         private idl: IdlService,
47         private pcrud: PcrudService
48     ) {
49         this.values = new MatchSetPointValues();
50         this.bibAttrDefs = [];
51         this.bibAttrDefEntries = [];
52     }
53
54     ngOnInit() {
55         this.pcrud.retrieveAll('crad', {order_by: {crad: 'label'}})
56         .subscribe(attr => {
57             this.bibAttrDefs.push(attr);
58             this.bibAttrDefEntries.push({id: attr.name(), label: attr.label()});
59         });
60     }
61
62     setNewPointType(type_: string) {
63     }
64 }
65