UNPKG

consumerportal

Version:

mydna Custimised for you

66 lines (53 loc) 1.72 kB
/// <reference path="../../includes.ts" /> declare function saveAs(blob, str); module resultsReportsCtrl{ import IPatientCase = services.IPatientCase; interface IResultsReportController { getPatientCases(): any; downloadReport(IncidentId: any, orderNumber: any): any; } class ResultsReportsController implements IResultsReportController { static $inject = [ 'apiSrvc', 'errorHandlerSrvc', '$scope', 'mydnaApis', 'authenSrvc', 'patientService' ]; PatientCases: IPatientCase[]; casesLoaded = false; constructor( private apiSrvc: apiSrvc.IApiService, private errorHandlerSrvc: errorHandlerSrvc.IErrorHandlerService, private $scope: angular.IScope, private mydnaApis: ImyDNAApis, private authenSrvc: authenSrvc.IAuthenService, private patientService: services.IPatientService ){ const vm = this; vm.PatientCases = []; vm.getPatientCases(); } getPatientCases(){ this.patientService.cases(true).then((values:IPatientCase[]) => { this.PatientCases = values; this.casesLoaded = true; }); } openBooking() { window.open('https://app.acuityscheduling.com/schedule.php?owner=14769732', '_blank'); } downloadReport(IncidentId, orderNumber) { this.patientService.download(IncidentId, orderNumber); } viewReport(pc: IPatientCase) { if (pc.TestFullName === 'Fitness Report') { location.hash = '#/sports'; } else if (pc.TestFullName === 'Alcohol Report') { location.hash = '#/alcohol'; } } } angular.module('app').controller('resultsReportsCtrl', ResultsReportsController); }