import { Component, EventEmitter, ElementRef, Injector, Output, ViewChild, ViewContainerRef, Input } from '@angular/core'; import { AppComponentBase } from '@shared/common/app-component-base'; import { AppSessionService } from '@shared/common/session/app-session.service'; import * as _ from 'lodash'; import { ModalDirective } from 'ngx-bootstrap'; import { finalize } from 'rxjs/operators'; import { AppConsts } from '@shared/AppConsts'; import { appModuleAnimation } from '@shared/animations/routerTransition'; import { FormBuilder, FormGroup, Validators } from "@angular/forms"; import * as moment from 'moment'; import { SupportTicketServiceProxy, SupportTicketSettingServiceProxy, SupportTicketStatusServiceProxy, SupportTicketSettingList, SupportTicketTypeServiceProxy, TicketTypeList, TicketStatusList, TenantListDropDown, TicketKPI } from '@shared/service-proxies/service-proxies'; @Component({ selector: 'support-kpi-box', templateUrl: './support-kpi-box.component.html', styleUrls: ['./support-kpi-box.component.less'], }) export class SupportKPIBoxComponent extends AppComponentBase { totalTicket: number = 0; totalNewTicket: number = 0; totalAssignedTicket: number = 0; totalClosedTicket: number = 0; totalTodayClosedTicket: number = 0; totalFeatureChangeTicket:number = 0; totalBugTicket: number = 0; totalNewFeatureTicket: number = 0; totalMyTicket: number = 0; totalMyCreateTicket: number = 0; totalUnAssignedTicket:number = 0; totalRequestTicket: number = 0; totalUrgentTicket: number = 0; currentKPI: boolean; activeToggle: string; tenancy: boolean active: string; constructor( injector: Injector, private viewContainerRef: ViewContainerRef, private _appSessionService: AppSessionService, private _supportTicketsServiceProxy: SupportTicketServiceProxy ) { super(injector); // this.getKpi(); this.currentKPI = false; this.active = 'NONE'; } getParentComponent() { return this.viewContainerRef['_data'].componentView.component.viewContainerRef['_view'].component } getKpi() { this._supportTicketsServiceProxy.getTicketForKPI( ).subscribe(result => { this.totalTicket = result.totalAllTicket; this.totalNewTicket = result.totalNewTicket; this.totalAssignedTicket = result.totalAssignedTicket; this.totalClosedTicket = result.totalCloseTicket; this.totalTodayClosedTicket = result.totalCloseTicketToday; this.totalFeatureChangeTicket = result.totalFeatureChangeTicket; this.totalBugTicket = result.totalIssueOrBugTicket; this.totalNewFeatureTicket = result.totalNewFeatureTicket; this.totalMyTicket = result.totalMyTicket; this.totalMyCreateTicket = result.totalMyCreateTicket; this.totalUnAssignedTicket = result.totalUnAssignedTicket; this.totalRequestTicket = result.totalRequestTicket; this.totalUrgentTicket = result.totalUrgentTicket; }); } show(id?, resolve?): void { } filterKpiBox(filter: string) { $('.filter-right').removeClass('active'); // if(this.lastAttempt == filter) // { // } // else // { // filter = 'ALL'; // this.lastAttempt = filter; // } // alert(this.active + ' ' + this.currentKPI); if (this.active != filter && this.currentKPI == true) { this.currentKPI = false; } if (this.currentKPI == true) { this.currentKPI = false; filter = 'ALL'; } else { this.currentKPI = true; switch (filter) { case 'TOTALOPEN': $('.filter-right-helpdesk-total').addClass('active'); this.active = filter; break; case 'NEW': $('.filter-right-helpdesk-new').addClass('active'); this.active = filter; break; case 'ASSIGNED': $('.filter-right-helpdesk-assigned').addClass('active'); this.active = filter; break; case 'UNASSIGNED': $('.filter-right-helpdesk-unassigned').addClass('active'); this.active = filter; break; case 'MODIFICATION': $('.filter-right-helpdesk-modification').addClass('active'); this.active = filter; break; case 'REQUEST': $('.filter-right-helpdesk-request').addClass('active'); this.active = filter; break; case 'URGENT': $('.filter-right-helpdesk-urgent').addClass('active'); this.active = filter; break; case 'CLOSED': $('.filter-right-helpdesk-close').addClass('active'); this.active = filter; break; case 'TODAY': $('.filter-right-helpdesk-today').addClass('active'); this.active = filter; break; case 'ISSUEORBUG': $('.filter-right-helpdesk-issue').addClass('active'); this.active = filter; break; case 'NEWFEATURE': $('.filter-right-helpdesk-new-feature').addClass('active'); this.active = filter; break; case 'MYTICKET': $('.filter-right-helpdesk-myticket').addClass('active'); this.active = filter; break; } } this.getParentComponent().filterKpiBox(filter); } onShown(): void { //document.getElementById('valueInput').focus(); } ngOnInit(): void { } }