import { Component, OnInit } from '@angular/core'; import { SharedService } from '../../shared/shared.service'; import { MarketingService } from '../../services/marketing.service'; declare var $: any; @Component( { moduleId: module.id, selector: 'alertplugin-cmp', templateUrl: 'alertplugin.component.html', styleUrls: ['alertplugin.component.css'] }) export class AlertPluginComponent implements OnInit { storeId: number = 10553; showAlert: boolean = false; alertMessage: string = 'Notification of Planned Maintenance'; constructor(public sharedService: SharedService, public marketingService: MarketingService) {} ngOnInit(): void { this.sharedService.storeId.subscribe((val: number) => { this.storeId = val; }); this.marketingService.getEspotStaticContent(this.storeId, 'ALERT_FOR_AGENT').subscribe(result => { if (result) { this.alertMessage = result; this.showAlert = true; } }, error => { console.error('error=>' + error); }); } showNotification(from, align): void { // var self= this; const type = ['', 'info', 'success', 'warning', 'danger']; const color = Math.floor((Math.random() * 4) + 1); $.notify( { message: this.alertMessage }, { type: type[3], // timer: 3000, placement: { from: from, align: align } }); } }