import { Injectable } from '@angular/core'; import { Subject, Observable } from 'rxjs'; import { ModalSubject } from '../interfaces/modal.subject'; @Injectable() export class HBORModalService { public isOpen = false; private modalSubject = new Subject(); modalState$ = this.modalSubject.asObservable(); constructor() { } openInfo(title?, desription?) { this.modalSubject.next({}) } closeInfo() { } openError(title?, desription?, aditionalInfo?) { this.modalSubject.next({ type: 'error', showError: true, title: title, description: desription, aditionalInfo: aditionalInfo }); this.isOpen = true; } closeError() { this.modalSubject.next({ showError: false }); this.isOpen = false; } openConfirmDialog(title?, desription?, type?) { this.modalSubject.next({ type: type, showConfirmDialog: true, title: title, description: desription }); } closeConfirmDialog() { this.modalSubject.next({ showConfirmDialog: false }); } }