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 } from '@angular/core';
import 'rxjs/add/operator/switchMap';
import { AppSettingsService } from './../../shared/app-settings/app-settings.service';
import { MenuModel } from './../../shared/menu/menu.component.model';
import { HomeService } from './home.service';
import { UserFacilityData, ClaimCountDetails } from './home.model';
import { UserInfoModel } from './user.info.model';
import { AuthenticationService } from './../../auth/auth.service';
// import { Station } from './model/Station';
// import { VisnClaims } from './model/VisnClaims';
// import { TotalClaims } from './model/TotalClaims';
// import { UserStations } from './model/UserStations';
// import { FormsModule } from '@angular/forms';
// import { UserInfo } from '../shared/models/UserInfo';
// import { ClaimCountDetails } from '../shared/models/ClaimCountDetails';
// import { UserFacilityData } from '../shared/models/UserFacilityData';
// import { HomeService } from './home.service';
@Component({
selector: 'app-home',
templateUrl: './home.component.html',
styleUrls: ['./home.component.scss']
})
export class HomeComponent implements OnInit {
constructor(
private appSettingsService: AppSettingsService,
private homeService: HomeService,
private authenticationService: AuthenticationService
) {}
menu: MenuModel;
visnClaimCounts: ClaimCountDetails;
stationsClaimCounts: ClaimCountDetails[] = [];
userFacilityData: UserFacilityData;
totalClaimsAssigned = 0;
totalClaimsAwaiting = '';
totalClaimsInProcess = '';
totalClaimsRejected = '';
userName = '';
searchStation = '';
userInfo: UserInfoModel;
selectAllStations = false;
title = 'Fee Payment Processing';
// allStationsActiveCheckMarked = false;
// checkMarkedStationsShownInAssignStationsTable: String[];
// userName: String;
// lastLogin: String;
// roles: String = '';
// userRoles: any;
// userInfo: UserInfo;
// activeStations: string[] = [];
// public updatedActiveStationsList: String;
// public visnClaims: VisnClaims;
// private totalClaims: TotalClaims;
// userStations: UserStations;
// totalClaimsInError = 0;
// homePermission;
// constructor(private homeService: HomeService) {}
ngOnInit() {
this.userName = this.authenticationService.getDecodedUserInfo().userName;
this.appSettingsService
.getMenu('FPPS_MENU')
.subscribe(menu => (this.menu = menu));
this.homeService.getUserInfo(this.userName).subscribe(
data => {
this.userInfo = data;
},
err => {
window.alert('User unauthorized');
},
() => {
this.getFacilities();
}
);
}
getFacilities() {
this.homeService.getUserFacilities(this.userName).subscribe(
data => {
this.userFacilityData = data['userFacilityData'];
this.visnClaimCounts = this.userFacilityData[
'claimCountDetails'
].filter(station => station.stationNumber === 'VISN')[0];
this.stationsClaimCounts = data['userFacilityData'][
'claimCountDetails'
].filter(station => station.stationNumber !== 'VISN');
this.totalClaimsAwaiting = this.userFacilityData[
'totalNumberOfClaimsAwaiting'
];
this.totalClaimsInProcess = this.userFacilityData[
'totalNumberOfClaimsInProcess'
];
this.totalClaimsRejected = this.userFacilityData[
'totalNumberOfClaimsRejected'
];
},
err => {
console.log(err);
},
() => {
const stations = this.homeService.getActiveStaions();
if (stations && stations.length > 0) {
stations.forEach(selectedStation => {
this.stationsClaimCounts.forEach(station => {
if (station.stationNumber === selectedStation) {
station.checked = true;
}
});
});
}
}
);
}
setActiveStations() {
const selectedStations = this.stationsClaimCounts
.filter(station => station.checked)
.map(stationInfo => stationInfo.stationNumber);
sessionStorage.setItem('activeStations', JSON.stringify(selectedStations));
const selected = sessionStorage.getItem('activeStations');
this.homeService.setActiveStations(selectedStations);
}
toggleSelectAllStations() {
this.stationsClaimCounts.forEach(
station => (station.checked = this.selectAllStations)
);
}
isAllStationsChecked() {
this.selectAllStations = this.stationsClaimCounts.every(
station => station.checked
);
}
// setDataTable() {
// this.setUserInfo();
// this.setRoles();
// this.populate();
// }
// // Gets the permission from the session, It is used in the html to show and hide things
// getUserPermissions() {
// this.homePermission = JSON.parse(sessionStorage.getItem('userInfo'))[
// 'permissions'
// ]['home'];
// }
// setRoles() {
// for (let i = 0; i < this.userRoles.length; i++) {
// if (i !== this.userRoles.length - 1) {
// this.roles = this.roles + this.userRoles[i] + ', ';
// } else {
// this.roles = this.roles + this.userRoles[i];
// }
// }
// }
// setUserInfo() {
// if (this.userInfo === undefined) {
// this.userInfo = JSON.parse(sessionStorage.getItem('userInfo'));
// this.userFacilityData = JSON.parse(
// sessionStorage.getItem('userFacilityData')
// );
// this.userName = this.userInfo.userName;
// this.lastLogin = this.userInfo.lastLogin;
// this.userRoles = this.userInfo.userRoles;
// sessionStorage.setItem('role', this.userRoles);
// }
// }
// // populate the data table
// populate() {
// if (
// sessionStorage.getItem('activeStations') &&
// sessionStorage.getItem('activeStations').trim().length > 0
// ) {
// const temp: string[] = sessionStorage
// .getItem('activeStations')
// .trim()
// .split(',');
// this.activeStations = temp;
// let iterator = 0;
// for (
// let i = 0;
// i < this.userFacilityData.claimCountDetails.length;
// i++
// ) {
// if (
// this.userFacilityData.claimCountDetails[i].stationNumber ===
// 'VISN'
// ) {
// this.visnClaimCounts = this.userFacilityData.claimCountDetails[
// i
// ];
// } else {
// this.stationsClaimCounts[
// iterator
// ] = this.userFacilityData.claimCountDetails[i];
// if (
// this.activeStations.indexOf(
// this.stationsClaimCounts[iterator].stationNumber
// ) > -1
// ) {
// this.stationsClaimCounts[
// iterator
// ].activedChecked = true;
// }
// iterator++;
// }
// }
// } else {
// let iterator = 0;
// for (
// let i = 0;
// i < this.userFacilityData.claimCountDetails.length;
// i++
// ) {
// if (
// this.userFacilityData.claimCountDetails[i].stationNumber ===
// 'VISN'
// ) {
// this.visnClaimCounts = this.userFacilityData.claimCountDetails[
// i
// ];
// } else {
// this.stationsClaimCounts[
// iterator
// ] = this.userFacilityData.claimCountDetails[i];
// this.activeStations[
// iterator
// ] = this.userFacilityData.claimCountDetails[
// i
// ].stationNumber;
// this.stationsClaimCounts[iterator].activedChecked = true;
// iterator++;
// }
// }
// }
// this.totalClaimsAwaiting = this.userFacilityData.totalNumberOfClaimsAwaiting;
// this.totalClaimsInProcess = this.userFacilityData.totalNumberOfClaimsInProcess;
// this.totalClaimsRejected = this.userFacilityData.totalNumberOfClaimsRejected;
// // tslint:disable-next-line:max-line-length
// (this.checkMarkedStationsShownInAssignStationsTable = this.getActiveCheckedStations().map(
// assignedStationNumber => String(assignedStationNumber)
// )),
// sessionStorage.setItem(
// 'activeStations',
// this.activeStations.join(',')
// );
// }
// getActiveCheckedStations(): string[] {
// return this.stationsClaimCounts
// .filter(assignedStation => assignedStation.activedChecked)
// .map(assignedStation => assignedStation.stationNumber);
// }
// onSetActiveClicked(): void {
// this.activeStations = this.getActiveCheckedStations();
// sessionStorage.setItem('activeStations', this.activeStations.join(','));
// }
// onRefreshStatsClicked(message: String): void {
// this.homeService.refreshStats(this.userName).subscribe(
// data => {
// sessionStorage.setItem(
// 'userFacilityData',
// JSON.stringify(data)
// );
// this.userFacilityData = data;
// this.populate();
// },
// error => alert(error)
// );
// }
// isAllChecked(): boolean {
// return this.stationsClaimCounts.every(_ => _.activedChecked);
// }
// onClickSelectAll() {
// const element = <HTMLInputElement>document.getElementById(
// 'IPT_assignStations_selectAllCheckBox_home_1'
// );
// const isChecked = element.checked;
// for (const assignedStation of this.stationsClaimCounts) {
// assignedStation.activedChecked = isChecked;
// }
// }
}