Summary Table

Categories Total Count
PII 0
URL 0
DNS 0
EKL 0
IP 0
PORT 0
VsID 0
CF 0
AI 0
VPD 0
PL 0
Other 0

File Content

import {
Component,
OnInit,
Input,
OnDestroy,
SimpleChanges,
OnChanges
} from '@angular/core';
import { EwvViewerService } from '../../ewv-viewer/ewv-viewer.service';
import { Subscription } from 'rxjs/Subscription';

@Component({
selector: 'app-service-lvl-ambulance',
templateUrl: './service-lvl-ambulance-info.component.html',
styleUrls: ['../../ewv-viewer/ewv-viewer.component.scss']
})
export class ServiceLvlAmbulanceInfoComponent
implements OnInit, OnChanges, OnDestroy {
@Input() data;
@Input() accordionId;

isSplitView: boolean;
isSplitSubscription = new Subscription();

collapseState = true;
collapseStateSubscription: Subscription = new Subscription();

serviceLevel = [];
serviceLevelAmbulance: any[] = [];
serviceLvlMsg = 'No Service-Level Ambulance Data Found';

constructor(private ewvViewerService: EwvViewerService) {}

ngOnInit() {
this.collapseStateSubscription = this.ewvViewerService
.getCollapseState()
.subscribe(state => {
this.collapseState = state;
});
this.isSplitSubscription = this.ewvViewerService.isSplitView.subscribe(
data => (this.isSplitView = data)
);

this.populateData();
}

ngOnChanges(changes: SimpleChanges): void {
this.data = changes.data.currentValue;
this.populateData();
}

populateData() {
this.serviceLevel = [];

if (this.data) {
this.serviceLevel = this.data['serviceLinesInfo'];
if (this.serviceLevel === undefined || this.serviceLevel === null) {
this.serviceLevel = [];
}

for (let i = 0; i < this.serviceLevel.length; i++) {
if (this.serviceLevel[i]['serviceLineLevelAmbulanceInfo']) {
this.serviceLevelAmbulance.push(
this.serviceLevel[i].serviceLineLevelAmbulanceInfo
);
}
}
}
}

ngOnDestroy() {
this.collapseStateSubscription.unsubscribe();
this.isSplitSubscription.unsubscribe();
}
}