1 |
49598
|
stefanos.g
|
/**
|
2 |
|
|
* Created by stefania on 5/2/17.
|
3 |
|
|
*/
|
4 |
50005
|
myrto.kouk
|
import { Component, ViewChild, Input, Output, EventEmitter } from '@angular/core';
|
5 |
50186
|
myrto.kouk
|
import { ModalDirective } from 'ngx-bootstrap';
|
6 |
49598
|
stefanos.g
|
|
7 |
|
|
@Component({
|
8 |
|
|
selector: 'confirmation-dialog',
|
9 |
|
|
templateUrl: './confirmation-dialog.component.html'
|
10 |
|
|
})
|
11 |
|
|
export class ConfirmationDialogComponent {
|
12 |
|
|
|
13 |
50060
|
myrto.kouk
|
@ViewChild('autoShownModal') public autoShownModal:ModalDirective;
|
14 |
49598
|
stefanos.g
|
|
15 |
50060
|
myrto.kouk
|
@Input() public isModalShown:boolean = false;
|
16 |
49598
|
stefanos.g
|
|
17 |
50843
|
myrto.kouk
|
@Input() public confirmed:boolean = true;
|
18 |
|
|
|
19 |
50060
|
myrto.kouk
|
@Input() public title: string;
|
20 |
49598
|
stefanos.g
|
|
21 |
50060
|
myrto.kouk
|
@Input() public confirmActionButton: string;
|
22 |
49598
|
stefanos.g
|
|
23 |
50685
|
myrto.kouk
|
@Input() public hideModalButton:string = 'Cancel';
|
24 |
|
|
|
25 |
50925
|
myrto.kouk
|
@Output() emitObject: EventEmitter<any> = new EventEmitter();
|
26 |
49598
|
stefanos.g
|
|
27 |
|
|
private _ids: string[] = [];
|
28 |
|
|
|
29 |
|
|
public set ids(ids: string[]) {
|
30 |
|
|
this._ids = ids;
|
31 |
|
|
}
|
32 |
|
|
|
33 |
50005
|
myrto.kouk
|
public showModal():void {
|
34 |
49598
|
stefanos.g
|
this.isModalShown = true;
|
35 |
|
|
}
|
36 |
|
|
|
37 |
50005
|
myrto.kouk
|
public hideModal():void {
|
38 |
49598
|
stefanos.g
|
this.autoShownModal.hide();
|
39 |
|
|
}
|
40 |
|
|
|
41 |
50005
|
myrto.kouk
|
public onHidden():void {
|
42 |
49598
|
stefanos.g
|
this.isModalShown = false;
|
43 |
|
|
}
|
44 |
|
|
|
45 |
|
|
public confirmedAction() {
|
46 |
50925
|
myrto.kouk
|
this.emitObject.emit(this._ids);
|
47 |
50843
|
myrto.kouk
|
if(this.confirmed) {
|
48 |
|
|
this.hideModal();
|
49 |
|
|
}
|
50 |
49598
|
stefanos.g
|
}
|
51 |
|
|
}
|