{ "version": 3, "sources": ["src/app/shared/services/states/userinfo-state.service.ts"], "sourcesContent": ["import { AppointmentService } from './../../../proxy/services/appointment.service';\r\nimport {\r\n AgentProfileService,\r\n DoctorProfileService,\r\n PatientProfileService,\r\n} from 'src/app/proxy/services';\r\n\r\nimport { Injectable, OnInit } from '@angular/core';\r\nimport { BehaviorSubject } from 'rxjs';\r\nimport { AuthService } from '../auth.service';\r\n\r\n@Injectable({\r\n providedIn: 'root',\r\n})\r\nexport class UserinfoStateService implements OnInit {\r\n constructor(\r\n private DoctorProfileService: DoctorProfileService,\r\n private AgentProfileService: AgentProfileService,\r\n private PatientProfileService: PatientProfileService,\r\n private NormalAuth: AuthService,\r\n private AppointmentService: AppointmentService\r\n ) {}\r\n public authenticateUserInfo = new BehaviorSubject({});\r\n public userPatientInfo = new BehaviorSubject([]);\r\n\r\n sendData(data: any) {\r\n this.authenticateUserInfo.next(data);\r\n }\r\n getData() {\r\n return this.authenticateUserInfo.asObservable();\r\n }\r\n sendUserPatientData(data: any) {\r\n this.userPatientInfo.next(data);\r\n }\r\n getUserPatientData() {\r\n return this.userPatientInfo.asObservable();\r\n }\r\n ngOnInit() {\r\n let user = this.NormalAuth.authInfo();\r\n if (user.id) {\r\n this.getProfileInfo(user.id, user.userType);\r\n }\r\n }\r\n\r\n getProfileInfo(id: any, role: string): void {\r\n if (id) {\r\n // this.LoaderService.sendLoaderState(true);\r\n if (role == 'doctor') {\r\n this.DoctorProfileService.get(id).subscribe((res) => {\r\n this.sendData(res);\r\n // this.LoaderService.sendLoaderState(false);\r\n });\r\n }\r\n if (role == 'agent') {\r\n this.AgentProfileService.get(id).subscribe((res) => {\r\n this.sendData(res);\r\n // this.LoaderService.sendLoaderState(false);\r\n });\r\n }\r\n if (role == 'patient') {\r\n this.PatientProfileService.get(id).subscribe((res) => {\r\n this.sendData(res);\r\n // this.LoaderService.sendLoaderState(false);\r\n });\r\n }\r\n }\r\n }\r\n\r\n // get user created patient list\r\n getUserPatientInfo(id: any, role: string): void {\r\n if (id && role) {\r\n this.PatientProfileService.getPatientListByUserProfileId(\r\n id,\r\n role\r\n ).subscribe((res) => {\r\n this.sendUserPatientData(res);\r\n });\r\n }\r\n // if (id && role === 'doctor') {\r\n // this.AppointmentService.getPatientListByDoctorId(id).subscribe({\r\n // next: (res) => {\r\n // console.log(res);\r\n\r\n // this.sendUserPatientData(res);\r\n // },\r\n // });\r\n // }\r\n else {\r\n this.sendUserPatientData(null);\r\n }\r\n }\r\n}\r\n"], "mappings": "2JAcA,IAAaA,GAAoB,IAAA,CAA3B,IAAOA,EAAP,MAAOA,CAAoB,CAC/BC,YACUC,EACAC,EACAC,EACAC,EACAC,EAAsC,CAJtC,KAAAJ,qBAAAA,EACA,KAAAC,oBAAAA,EACA,KAAAC,sBAAAA,EACA,KAAAC,WAAAA,EACA,KAAAC,mBAAAA,EAEH,KAAAC,qBAAuB,IAAIC,EAAqB,CAAA,CAAE,EAClD,KAAAC,gBAAkB,IAAID,EAAqB,CAAA,CAAE,CAFjD,CAIHE,SAASC,EAAS,CAChB,KAAKJ,qBAAqBK,KAAKD,CAAI,CACrC,CACAE,SAAO,CACL,OAAO,KAAKN,qBAAqBO,aAAY,CAC/C,CACAC,oBAAoBJ,EAAS,CAC3B,KAAKF,gBAAgBG,KAAKD,CAAI,CAChC,CACAK,oBAAkB,CAChB,OAAO,KAAKP,gBAAgBK,aAAY,CAC1C,CACAG,UAAQ,CACN,IAAIC,EAAO,KAAKb,WAAWc,SAAQ,EAC/BD,EAAKE,IACP,KAAKC,eAAeH,EAAKE,GAAIF,EAAKI,QAAQ,CAE9C,CAEAD,eAAeD,EAASG,EAAY,CAC9BH,IAEEG,GAAQ,UACV,KAAKrB,qBAAqBsB,IAAIJ,CAAE,EAAEK,UAAWC,GAAO,CAClD,KAAKhB,SAASgB,CAAG,CAEnB,CAAC,EAECH,GAAQ,SACV,KAAKpB,oBAAoBqB,IAAIJ,CAAE,EAAEK,UAAWC,GAAO,CACjD,KAAKhB,SAASgB,CAAG,CAEnB,CAAC,EAECH,GAAQ,WACV,KAAKnB,sBAAsBoB,IAAIJ,CAAE,EAAEK,UAAWC,GAAO,CACnD,KAAKhB,SAASgB,CAAG,CAEnB,CAAC,EAGP,CAGAC,mBAAmBP,EAASG,EAAY,CAClCH,GAAMG,EACR,KAAKnB,sBAAsBwB,8BACzBR,EACAG,CAAI,EACJE,UAAWC,GAAO,CAClB,KAAKX,oBAAoBW,CAAG,CAC9B,CAAC,EAYD,KAAKX,oBAAoB,IAAI,CAEjC,yCA5EWf,GAAoB6B,EAAA3B,CAAA,EAAA2B,EAAA1B,CAAA,EAAA0B,EAAAzB,CAAA,EAAAyB,EAAAC,CAAA,EAAAD,EAAAvB,CAAA,CAAA,CAAA,wBAApBN,EAAoB+B,QAApB/B,EAAoBgC,UAAAC,WAFnB,MAAM,CAAA,EAEd,IAAOjC,EAAPkC,SAAOlC,CAAoB,GAAA", "names": ["UserinfoStateService", "constructor", "DoctorProfileService", "AgentProfileService", "PatientProfileService", "NormalAuth", "AppointmentService", "authenticateUserInfo", "BehaviorSubject", "userPatientInfo", "sendData", "data", "next", "getData", "asObservable", "sendUserPatientData", "getUserPatientData", "ngOnInit", "user", "authInfo", "id", "getProfileInfo", "userType", "role", "get", "subscribe", "res", "getUserPatientInfo", "getPatientListByUserProfileId", "\u0275\u0275inject", "AuthService", "factory", "\u0275fac", "providedIn", "_UserinfoStateService"] }