diff --git a/src/app/common/modals/confirmation-modal/confirmation-modal.component.ts b/src/app/common/modals/confirmation-modal/confirmation-modal.component.ts index e65776a4b..27f0d89d8 100644 --- a/src/app/common/modals/confirmation-modal/confirmation-modal.component.ts +++ b/src/app/common/modals/confirmation-modal/confirmation-modal.component.ts @@ -1,6 +1,9 @@ +/* eslint-disable prettier/prettier */ +/* eslint-disable @angular-eslint/component-selector */ +/* eslint-disable @typescript-eslint/no-explicit-any */ import { Component, OnInit, Input, Inject} from '@angular/core'; -import { alertService } from 'src/app/ajs-upgraded-providers'; -import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog'; +import { AlertService } from '../../services/alert.service'; +import { MatDialogRef } from '@angular/material/dialog'; @Component({ selector: 'confirmation-modal', @@ -13,9 +16,8 @@ export class ConfirmationModalComponent implements OnInit { @Input() action: () => void; constructor( - @Inject(alertService) private alertService: any, + @Inject(AlertService) private alertService: any, public dialogRef: MatDialogRef, - @Inject(MAT_DIALOG_DATA) public data: any, ) {} ngOnInit(): void { @@ -23,19 +25,17 @@ export class ConfirmationModalComponent implements OnInit { } public confirmAction() { - console.log('confirmAction'); if (typeof this.action === 'function') { this.action(); } else { - this.alertService.add("danger", `${this.title} action failed`, 3000); + this.alertService.error(`${this.title} action failed.`); } - /** note - page reload after closing **/ + this.dialogRef.close(); } public cancelAction() { - console.log('cancelAction'); - this.alertService.add("info", `${this.title} action cancelled`, 3000); + this.alertService.success(`${this.title} action cancelled.`); this.dialogRef.close(); } -} \ No newline at end of file +} diff --git a/src/app/common/modals/confirmation-modal/confirmation-modal.service.ts b/src/app/common/modals/confirmation-modal/confirmation-modal.service.ts index e6d9c6a5f..06c4da61e 100644 --- a/src/app/common/modals/confirmation-modal/confirmation-modal.service.ts +++ b/src/app/common/modals/confirmation-modal/confirmation-modal.service.ts @@ -1,5 +1,8 @@ +/* eslint-disable prefer-const */ +/* eslint-disable prettier/prettier */ +/* eslint-disable @typescript-eslint/no-explicit-any */ import { Injectable } from '@angular/core'; -import { MatDialogRef, MAT_DIALOG_DATA, MatDialog } from '@angular/material/dialog'; +import { MatDialogRef, MatDialog } from '@angular/material/dialog'; import { ConfirmationModalComponent } from './confirmation-modal.component'; @Injectable({ @@ -11,7 +14,7 @@ export class ConfirmationModalService { public show(title: string, message: string, action?: any) { let dialogRef: MatDialogRef; dialogRef = this.dialog.open(ConfirmationModalComponent, {position: {top: '2.5%'}}); - dialogRef.updateSize("42.5%", ""); + dialogRef.updateSize('42.5%', ''); dialogRef.componentInstance.title = title; dialogRef.componentInstance.message = message; dialogRef.componentInstance.action = action;