2020-10-27 01:10:18 +01:00
|
|
|
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
|
|
|
|
|
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
|
|
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
|
selector: 'app-delete-dialog',
|
|
|
|
|
templateUrl: './delete-dialog.component.html',
|
2020-11-22 14:43:59 +01:00
|
|
|
styleUrls: ['./delete-dialog.component.scss']
|
2020-10-27 01:10:18 +01:00
|
|
|
})
|
|
|
|
|
export class DeleteDialogComponent implements OnInit {
|
|
|
|
|
|
|
|
|
|
constructor(public activeModal: NgbActiveModal) { }
|
|
|
|
|
|
|
|
|
|
@Output()
|
|
|
|
|
public deleteClicked = new EventEmitter()
|
|
|
|
|
|
|
|
|
|
@Input()
|
|
|
|
|
title = "Delete confirmation"
|
|
|
|
|
|
|
|
|
|
@Input()
|
|
|
|
|
message = "Do you really want to delete this?"
|
|
|
|
|
|
|
|
|
|
@Input()
|
|
|
|
|
message2
|
|
|
|
|
|
2020-12-11 14:47:33 +01:00
|
|
|
deleteButtonEnabled = true
|
|
|
|
|
seconds = 0
|
|
|
|
|
|
|
|
|
|
delayConfirm(seconds: number) {
|
|
|
|
|
this.deleteButtonEnabled = false
|
|
|
|
|
this.seconds = seconds
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
if (this.seconds <= 1) {
|
|
|
|
|
this.deleteButtonEnabled = true
|
|
|
|
|
} else {
|
|
|
|
|
this.delayConfirm(seconds - 1)
|
|
|
|
|
}
|
|
|
|
|
}, 1000)
|
|
|
|
|
}
|
|
|
|
|
|
2020-10-27 01:10:18 +01:00
|
|
|
ngOnInit(): void {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
cancelClicked() {
|
|
|
|
|
this.activeModal.close()
|
|
|
|
|
}
|
|
|
|
|
}
|