24c37b5636d41f9b266f6a72190e97dbc02089ed
[sdc.git] /
1 /**
2  * Created by rc2122 on 6/1/2017.
3  */
4 import {Component, Output, EventEmitter, ViewChild} from "@angular/core";
5 import {ButtonsModelMap, ButtonModel} from "app/models/button";
6 import {ModalComponent} from "app/ng2/components/modal/modal.component";
7
8 @Component({
9     selector: 'confirm-delete-input',
10     templateUrl: './confirmation-delete-input.component.html'
11 })
12 export class ConfirmationDeleteInputComponent {
13
14     @Output() deleteInput: EventEmitter<any> = new EventEmitter<any>();
15     @ViewChild ('confirmationModal') confirmationModal:ModalComponent;
16     footerButtons:ButtonsModelMap = {};
17
18     constructor (){
19     }
20
21     ngOnInit() {
22         this.footerButtons['Delete'] = new ButtonModel('Delete', 'blue', this.onDeleteInput);
23         this.footerButtons['Close'] = new ButtonModel('Close', 'grey', this.closeModal);
24     }
25
26     onDeleteInput = (input) => {
27         this.deleteInput.emit(input);
28         this.closeModal();
29     };
30
31     openModal = () => {
32         this.confirmationModal.open();
33     }
34
35     closeModal = () => {
36         this.confirmationModal.close();
37     }
38 }