81f79fed41168d186af08934f33fad67117cf31e
[evergreen/pines.git] /
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         this.entryValue = inputValue;
43     }
44
45     getFieldClass() {
46         return this.entry.fm_class;
47     }
48
49     delete() {
50         this.close({setting: {[this.entry.name]: null}, context: this.entryContext});
51     }
52
53     update() {
54         this.close({setting: {[this.entry.name]: this.entryValue}, context: this.entryContext});
55     }
56 }
57
58