-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
HIV-388 : Integrating surge report into front end
- Loading branch information
1 parent
2c2b40e
commit f1c5f4c
Showing
31 changed files
with
3,485 additions
and
130 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,33 @@ | ||
{ | ||
"index": "/index.html", | ||
"assetGroups": [{ | ||
"name": "app", | ||
"installMode": "prefetch", | ||
"updateMode": "prefetch", | ||
"resources": { | ||
"files": [ | ||
"/favicon.ico", | ||
"/index.html", | ||
"/*.css", | ||
"/*.js" | ||
] | ||
} | ||
}, { | ||
"name": "assets", | ||
"installMode": "prefetch", | ||
"updateMode": "prefetch", | ||
"resources": { | ||
"files": [ | ||
"/assets/**", | ||
"/*.ttf", | ||
"/*.woff2", | ||
"/*.svg", | ||
"/*.woff", | ||
"/*.png", | ||
"/*.jpg", | ||
"/*.eot", | ||
"/fontawesome*" | ||
] | ||
} | ||
}] | ||
} | ||
"index": "/index.html", | ||
"assetGroups": [{ | ||
"name": "app", | ||
"installMode": "prefetch", | ||
"updateMode": "prefetch", | ||
"resources": { | ||
"files": [ | ||
"/favicon.ico", | ||
"/index.html", | ||
"/*.css", | ||
"/*.js" | ||
] | ||
} | ||
}, { | ||
"name": "assets", | ||
"installMode": "prefetch", | ||
"updateMode": "prefetch", | ||
"resources": { | ||
"files": [ | ||
"/assets/**", | ||
"/*.ttf", | ||
"/*.woff2", | ||
"/*.svg", | ||
"/*.woff", | ||
"/*.png", | ||
"/*.jpg", | ||
"/*.eot", | ||
"/fontawesome*" | ||
] | ||
} | ||
}] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
src/app/clinic-dashboard/hiv/surge-report/surge-report.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import { Component, OnInit } from '@angular/core'; | ||
import { ActivatedRoute, Router } from '@angular/router'; | ||
import { SurgeReportBaseComponent } from 'src/app/hiv-care-lib/surge-report/surge-report-base.component'; | ||
import { SurgeResourceService } from 'src/app/etl-api/surge-resource.service'; | ||
|
||
@Component({ | ||
selector: 'surge-report', | ||
templateUrl: '../../../hiv-care-lib/surge-report/surge-report-base.component.html' | ||
}) | ||
export class SurgeReportComponent extends SurgeReportBaseComponent implements OnInit { | ||
|
||
public params: any; | ||
public surgeReportSummaryData: any = []; | ||
public columnDefs: any = []; | ||
|
||
public statusError = false; | ||
public errorMessage = ''; | ||
public showInfoMessage = false; | ||
public isLoading = false; | ||
|
||
constructor(public router: Router, | ||
public route: ActivatedRoute, | ||
public surgeReport: SurgeResourceService) { | ||
super(router, route, surgeReport); | ||
} | ||
|
||
ngOnInit() { | ||
this.route.queryParams.subscribe( | ||
(params: any) => { | ||
switch (params.currentView) { | ||
case 'daily': | ||
if (params && params._date) { | ||
this.isLoading = true; | ||
this.params = params; | ||
this.getSurgeDailyReport(params); | ||
} | ||
break; | ||
case 'weekly': | ||
if (params && params.year_week) { | ||
this.isLoading = true; | ||
this.params = params; | ||
this.getSurgeWeeklyReport(params); | ||
} | ||
break; | ||
} | ||
}, | ||
error => { | ||
console.error('Error', error); | ||
this.showInfoMessage = true; | ||
} | ||
); | ||
} | ||
|
||
} |
1 change: 0 additions & 1 deletion
1
src/app/clinic-schedule-lib/daily-schedule/daily-schedule-appointments.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
120 changes: 120 additions & 0 deletions
120
src/app/data-analytics-dashboard/hiv/surge/surge-report.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
import { Router, ActivatedRoute } from '@angular/router'; | ||
import { Component, OnInit } from '@angular/core'; | ||
import { Location } from '@angular/common'; | ||
import { take } from 'rxjs/operators'; | ||
import * as rison from 'rison-node'; | ||
import * as Moment from 'moment'; | ||
|
||
import { SurgeReportBaseComponent } from 'src/app/hiv-care-lib/surge-report/surge-report-base.component'; | ||
import { DataAnalyticsDashboardService } from '../../services/data-analytics-dashboard.services'; | ||
import { SurgeResourceService } from 'src/app/etl-api/surge-resource.service'; | ||
|
||
|
||
|
||
@Component({ | ||
selector: 'surge-report', | ||
templateUrl: '../../../hiv-care-lib/surge-report/surge-report-base.component.html', | ||
}) | ||
export class SurgeReportComponent extends SurgeReportBaseComponent implements OnInit { | ||
|
||
public enabledControls = 'dayControl,locationControl'; | ||
|
||
constructor( | ||
public router: Router, public route: ActivatedRoute, public surgeReport: SurgeResourceService, | ||
private dataAnalyticsDashboardService: DataAnalyticsDashboardService, private location: Location) { | ||
super(router, route, surgeReport); | ||
} | ||
|
||
ngOnInit() { | ||
this.loadParametersFromUrl(); | ||
} | ||
|
||
public generateReport() { | ||
this.storeParamsInUrl(); | ||
super.generateReport(); | ||
} | ||
|
||
public storeParamsInUrl() { | ||
this.setSelectedLocation(); | ||
let state = {}; | ||
this.displayTabluarFilters = true; | ||
switch (this.currentView) { | ||
case 'daily': | ||
state = { | ||
'_date': Moment(this.startDate).format('YYYY-MM-DD'), | ||
'locationUuids': this.getSelectedLocations(this.locationUuids), | ||
'displayTabluarFilters': this.displayTabluarFilters, | ||
'currentView': this.currentView, | ||
'reportName': this.reportName | ||
}; | ||
break; | ||
case 'weekly': | ||
state = { | ||
'year_week': this.yearWeek, | ||
'locationUuids': this.getSelectedLocations(this.locationUuids), | ||
'displayTabluarFilters': this.displayTabluarFilters, | ||
'currentView': this.currentView, | ||
'reportName': this.reportName | ||
}; | ||
break; | ||
} | ||
|
||
const stateUrl = rison.encode(state); | ||
const path = this.router.parseUrl(this.location.path()); | ||
path.queryParams = { | ||
'state': stateUrl | ||
}; | ||
|
||
this.params = state; | ||
this.location.replaceState(path.toString()); | ||
} | ||
|
||
public loadParametersFromUrl() { | ||
const path = this.router.parseUrl(this.location.path()); | ||
|
||
if (path.queryParams['state']) { | ||
const state = rison.decode(path.queryParams['state']); | ||
switch (state.currentView) { | ||
case 'daily': | ||
this.currentView = 'daily'; | ||
this.startDate = Moment(state._date).format('MM-DD-YYYY'); | ||
this.generateReport(); | ||
break; | ||
case 'weekly': | ||
this.currentView = 'weekly'; | ||
this.enabledControls = 'weekControl,locationControl'; | ||
this.yearWeek = state.year_week; | ||
this.generateReport(); | ||
break; | ||
} | ||
} | ||
|
||
} | ||
|
||
public setSelectedLocation() { | ||
this.dataAnalyticsDashboardService.getSelectedLocations().pipe(take(1)).subscribe( | ||
(data) => { | ||
if (data) { | ||
this.locationUuids = data.locations; | ||
} | ||
}); | ||
} | ||
|
||
private getSelectedLocations(locationUuids: Array<any>): string { | ||
return locationUuids.map(location => location.value).join(','); | ||
} | ||
|
||
public onTabChanged(val) { | ||
if (this.currentView === 'daily') { | ||
this.currentView = 'weekly'; | ||
this.enabledControls = 'weekControl,locationControl'; | ||
this.surgeReportSummaryData = []; | ||
this.displayTabluarFilters = false; | ||
} else { | ||
this.enabledControls = 'dayControl,locationControl'; | ||
this.currentView = 'daily'; | ||
this.surgeReportSummaryData = []; | ||
this.displayTabluarFilters = false; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.