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AJ1B,gEAAS,CAAC;YACT,QAAQ,EAAE,kBAAkB;WACG;SAChC,CAAC;yJAgB4B,wEAAyC,yIAAgB,CAAmB,CAA4C;YACjI,WAA4H;OAhBpI,cAAc,CAwN1B;IAAD,CAAC;AAAA;SAxNY,cAAc,gB;;;;;;;;;;;;;;;;;;;ACnBc;AACO;AACD;AAU/C;IAAA;IAAmC,CAAC;IAAvB,oBAAoB;QARhC,+DAAQ,CAAC;YACR,YAAY,EAAE;gBACZ,oEAAc;aACf;YACD,OAAO,EAAE;gBACP,sEAAe,CAAC,QAAQ,CAAC,oEAAc,CAAC;aACzC;SACF,CAAC;OACW,oBAAoB,CAAG;IAAD,2BAAC;CAAA;AAAH","file":"11.68c06e4f9e3fffd0f676.chunk.js","sourcesContent":["import { Component } from '@angular/core';\r\nimport { IonicPage, NavController, NavParams, ViewController, AlertController, Alert, ToastController } from 'ionic-angular';\r\nimport { Items, User } from '../../providers/providers';\r\nimport { SafeResourceUrl, DomSanitizer } from '@angular/platform-browser';\r\nimport { TranslateService } from '@ngx-translate/core';\r\nimport { environment } from '../../environment/environment';\r\n\r\n/**\r\n * Generated class for the ReportPage page.\r\n *\r\n * See http://ionicframework.com/docs/components/#navigation for more info\r\n * on Ionic pages and navigation.\r\n */\r\n\r\n @IonicPage({\r\n name: 'view-report',\r\n segment: 'view-report/:url',\r\n})\r\n@Component({\r\n selector: 'page-view-report',\r\n templateUrl: 'view-report.html',\r\n})\r\nexport class ViewReportPage {\r\n pdfLink:SafeResourceUrl;\r\n showReport: boolean = true;\r\n email: string = '';\r\n responseData : any;\r\n fullLogo: string = '';\r\n credentials: { username: string, password: string } = {\r\n username: '',\r\n password: ''\r\n };\r\n\r\n // Our translated text strings\r\n private loginErrorString: string;\r\n private signupErrorString: string;\r\n\r\n constructor(public navCtrl: NavController, public translateService: TranslateService,public navParams: NavParams,private domSanitizer: DomSanitizer, \r\n public viewCtrl: ViewController, public alertCtrl: AlertController, public toastCtrl: ToastController, public items: Items, public user: User) {\r\n\r\n this.translateService.get('SIGNUP_ERROR').subscribe((value) => {\r\n this.signupErrorString = value;\r\n })\r\n this.translateService.get('LOGIN_ERROR').subscribe((value) => {\r\n this.loginErrorString = value;\r\n })\r\n\r\n if (this.navParams.get('url') != undefined) {\r\n // this.pdfLink = this.domSanitizer.bypassSecurityTrustResourceUrl('https://novopsych.com/api/responses/secure?token=' + this.navParams.get('url'));\r\n this.pdfLink = this.domSanitizer.bypassSecurityTrustResourceUrl(environment.apiUrl + '/responses/secure?token=' + this.navParams.get('url'));\r\n console.log(this.pdfLink)\r\n }\r\n\r\n this.fullLogo = environment.fullLogo\r\n \r\n }\r\n\r\n ionViewDidLoad() {\r\n let seq = this.items.getAssessmentEmail(this.navParams.get('url')).share();\r\n seq\r\n .map(res => res.json().data)\r\n .subscribe(res => {\r\n this.email = res.result.email\r\n\r\n if (this.email == '') {\r\n let toast = this.toastCtrl.create({\r\n message: 'Invalid report link',\r\n duration: 5000,\r\n position: 'top'\r\n });\r\n toast.present();\r\n }\r\n }, err => {\r\n let toast = this.toastCtrl.create({\r\n message: 'Invalid report link',\r\n duration: 5000,\r\n position: 'top'\r\n });\r\n toast.present();\r\n });\r\n // this.askLogin()\r\n }\r\n\r\n askLogin() {\r\n let prompt = this.alertCtrl.create({\r\n title: 'Enter password to continue',\r\n message: \"You have an existing account, please enter password to view result\",\r\n inputs: [\r\n {\r\n name: 'password',\r\n placeholder: 'Enter Password',\r\n type: 'password'\r\n },\r\n ],\r\n buttons: [\r\n {\r\n text: 'Forgot Password',\r\n handler: data => { \r\n let email:any;\r\n email = {email:this.email};\r\n this.user.forgotPassword(email).subscribe((resp) => {\r\n let prompt2 = this.alertCtrl.create({\r\n title: \"Password Sent\",\r\n message: \"Your password has been sent to your email address. If you don't receive the email, check your spam folder. For further assistance, please contact our support team at info@novopsych.com.\",\r\n buttons: [\r\n {\r\n text: 'Okay',\r\n handler: data => { \r\n this.askLogin() \r\n }\r\n }\r\n ]\r\n });\r\n prompt2.present();\r\n }, (err) => {\r\n let prompt2 = this.alertCtrl.create({\r\n title: \"Email not found\",\r\n message: \"We couldn't find an account associated with that email address. Please double-check and try again. If you continue to experience issues, please contact our support team at info@novopsych.com for assistance.\",\r\n buttons: [\r\n {\r\n text: 'Okay',\r\n handler: data => { \r\n this.askLogin() \r\n }\r\n }\r\n ]\r\n });\r\n prompt2.present();\r\n })\r\n \r\n }\r\n },\r\n {\r\n text: 'View Result',\r\n handler: data => {\r\n if (data.password == '') {\r\n let toast = this.toastCtrl.create({\r\n message: 'Please enter password',\r\n duration: 5000,\r\n position: 'top'\r\n });\r\n toast.present();\r\n this.askLogin()\r\n } else {\r\n let seq = this.items.reassignAssessment(this.navParams.get('url'), this.email, data.password).share();\r\n seq\r\n .map(res => res.json().data)\r\n .subscribe(res => {\r\n console.log(res)\r\n if (res.result == 1 || res.result == 2) {\r\n this.showReport = true\r\n this.credentials.username = this.email\r\n this.credentials.password = data.password\r\n } else {\r\n let prompt2 = this.alertCtrl.create({\r\n title: \"Invalid Login\",\r\n message: \"Report does not belong to user\",\r\n buttons: [\r\n {\r\n text: 'Okay',\r\n handler: data => { \r\n this.askLogin() \r\n }\r\n }\r\n ]\r\n });\r\n prompt2.present();\r\n }\r\n }, err => {\r\n let prompt2 = this.alertCtrl.create({\r\n title: \"Invalid Login\",\r\n message: \"Wrong credential entered\",\r\n buttons: [\r\n {\r\n text: 'Okay',\r\n handler: data => { \r\n this.askLogin() \r\n }\r\n }\r\n ]\r\n });\r\n prompt2.present();\r\n });\r\n \r\n }\r\n }\r\n }\r\n ]\r\n });\r\n prompt.present();\r\n }\r\n\r\n \r\n goToHomePage() {\r\n this.navCtrl.push('home');\r\n // if (this.credentials.username && this.credentials.password) {\r\n // this.user.login(this.credentials).then((result) => {\r\n // this.responseData = result;\r\n // if (this.responseData.meta.status='ok') {\r\n // localStorage.setItem('userData', JSON.stringify(this.responseData.data.user));\r\n // localStorage.setItem('userId', this.credentials.username);\r\n // localStorage.setItem('password', this.credentials.password);\r\n // this.user.getPractices().subscribe(res => {\r\n // if(res){\r\n // localStorage.setItem('practiceData', JSON.stringify(res));\r\n // this.navCtrl.push('home');\r\n // } else {\r\n // this.navCtrl.push('home');\r\n // }\r\n // },\r\n // err => {\r\n // // Log errors if any\r\n // console.log(err);\r\n // this.navCtrl.push('home');\r\n // });\r\n // }\r\n // else {\r\n // this.presentToast(this.loginErrorString);\r\n // }\r\n // }, (err) => {\r\n // this.presentToast(this.loginErrorString);\r\n // });\r\n // }\r\n // else {\r\n // this.presentToast(\"Give username and password\");\r\n // }\r\n }\r\n\r\n presentToast(msg) {\r\n let toast = this.toastCtrl.create({\r\n message: msg,\r\n duration: 3000,\r\n position: 'top'\r\n });\r\n toast.present();\r\n }\r\n\r\n\r\n}\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/pages/view-report/view-report.ts","import { NgModule } from '@angular/core';\r\nimport { IonicPageModule } from 'ionic-angular';\r\nimport { ViewReportPage } from './view-report';\r\n\r\n@NgModule({\r\n declarations: [\r\n ViewReportPage,\r\n ],\r\n imports: [\r\n IonicPageModule.forChild(ViewReportPage),\r\n ],\r\n})\r\nexport class ViewReportPageModule {}\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/pages/view-report/view-report.module.ts"],"sourceRoot":""}