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;IAED,qCAAY,GAAZ,UAAa,GAAG;QACd,IAAI,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC;YAChC,OAAO,EAAE,GAAG;YACZ,QAAQ,EAAE,IAAI;YACd,QAAQ,EAAE,KAAK;SAChB,CAAC,CAAC;QACH,KAAK,CAAC,OAAO,EAAE,CAAC;IAClB,CAAC;IAvOU,cAAc;QAJ1B,gEAAS,CAAC;YACT,QAAQ,EAAE,kBAAkB;WACG;SAChC,CAAC;yJAgB4B,wEAAyC,yIAAgB,CAAmB,CAA4C;YACjI,WAA4H;OAhBpI,cAAc,CA0O1B;IAAD,CAAC;AAAA;SA1OY,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":"17.7d1f61934d13deca2f45.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: 'show-report',\r\n segment: 'show-report/:url',\r\n})\r\n@Component({\r\n selector: 'page-show-report',\r\n templateUrl: 'show-report.html',\r\n})\r\nexport class ShowReportPage {\r\n pdfLink:SafeResourceUrl;\r\n showReport: boolean = false;\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 prompt5 = this.alertCtrl.create({\r\n title: \"Password Reset Request\",\r\n message: \"We will generate a new password and send it via email\",\r\n buttons: [\r\n {\r\n text: 'Cancel',\r\n handler: data => { \r\n this.askLogin() \r\n }\r\n },\r\n {\r\n text: 'Send',\r\n handler: data => { \r\n\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 prompt5.present(); \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('redirect-assessment/12');\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/show-report/show-report.ts","import { NgModule } from '@angular/core';\r\nimport { IonicPageModule } from 'ionic-angular';\r\nimport { ShowReportPage } from './show-report';\r\n\r\n@NgModule({\r\n declarations: [\r\n ShowReportPage,\r\n ],\r\n imports: [\r\n IonicPageModule.forChild(ShowReportPage),\r\n ],\r\n})\r\nexport class ShowReportPageModule {}\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/pages/show-report/show-report.module.ts"],"sourceRoot":""}