ce2add0a8ae9131363c2c0e566f104b47416041d
[evergreen-equinox.git] / Open-ILS / src / eg2 / src / app / staff / admin / local / org-unit-settings / edit-org-unit-setting-dialog.component.ts
1 import {Component, Input, ViewChild, TemplateRef} from '@angular/core';
2 import {DialogComponent} from '@eg/share/dialog/dialog.component';
3 import {AuthService} from '@eg/core/auth.service';
4 import {NetService} from '@eg/core/net.service';
5 import {OrgService} from '@eg/core/org.service';
6 import {IdlObject} from '@eg/core/idl.service';
7 import {NgbModal, NgbModalOptions} from '@ng-bootstrap/ng-bootstrap';
8 import {OrgUnitSetting} from '@eg/staff/admin/local/org-unit-settings/org-unit-settings.component';
9
10 @Component({
11   selector: 'eg-admin-edit-org-unit-setting-dialog',
12   templateUrl: './edit-org-unit-setting-dialog.component.html'
13 })
14
15 export class EditOuSettingDialogComponent extends DialogComponent {
16
17     // What OU Setting we're editing
18     entry: any = {};
19     entryValue: any;
20     entryContext: IdlObject;
21     linkedFieldOptions: IdlObject[];
22
23     constructor(
24         private auth: AuthService,
25         private net: NetService,
26         private org: OrgService,
27         private modal: NgbModal
28     ) {
29         super(modal);
30         if (!this.entry) {
31             this.entryValue = null;
32             this.entryContext = null;
33             this.linkedFieldOptions = null;
34         }
35     }
36
37     inputType() {
38         return this.entry.dataType;
39     }
40
41     setInputValue(inputValue) {
42         console.log("In Input value");
43         console.log(inputValue);
44         this.entryValue = inputValue;
45     }
46
47     getFieldClass() {
48         return this.entry.fm_class;
49     }
50
51     delete() {
52         this.close({setting: {[this.entry.name]: null}, context: this.entryContext});
53     }
54
55     update() {
56         this.close({setting: {[this.entry.name]: this.entryValue}, context: this.entryContext});
57     }
58 }
59
60