@ -43,7 +43,7 @@ class ClinicList extends StatefulWidget {
bool isPharmacyLiveCare ;
String pharmacyLiveCareQRCode ;
ClinicList ( { @ required this . getLiveCareHistory , this . isPharmacyLiveCare = false , this . pharmacyLiveCareQRCode = " " } ) ;
ClinicList ( { required this . getLiveCareHistory , this . isPharmacyLiveCare = false , this . pharmacyLiveCareQRCode = " " } ) ;
@ override
_clinic_listState createState ( ) = > _clinic_listState ( ) ;
@ -51,44 +51,44 @@ class ClinicList extends StatefulWidget {
class _clinic_listState extends State < ClinicList > {
int currentSelectedIndex = 0 ;
LiveCareClinicsListResponse liveCareClinicsListResponse ;
late LiveCareClinicsListResponse liveCareClinicsListResponse ;
List< PatientERGetClinicsList > liveCareOnlineClinicsListResponse ;
List< PatientERGetClinicsList > liveCareOfflineClinicsListResponse ;
late List< PatientERGetClinicsList > liveCareOnlineClinicsListResponse ;
late List< PatientERGetClinicsList > liveCareOfflineClinicsListResponse ;
LiveCareScheduleClinicsListResponse liveCareScheduleClinicsListResponse ;
late LiveCareScheduleClinicsListResponse liveCareScheduleClinicsListResponse ;
bool isDataLoaded = false ;
var languageID ;
var currentSelectedLiveCareType ;
int selectedClinicID ;
late int selectedClinicID ;
String selectedClinicName = " - " ;
AppSharedPreferences sharedPref = AppSharedPreferences ( ) ;
AuthenticatedUser authUser ;
late AuthenticatedUser authUser ;
AuthProvider authProvider = new AuthProvider ( ) ;
MyInAppBrowser browser ;
late MyInAppBrowser browser ;
String liveCareClinicIDs ;
late String liveCareClinicIDs ;
ProjectViewModel projectViewModel ;
late ProjectViewModel projectViewModel ;
String selectedPaymentMethod = " " ;
String amount = " " ;
String tamaraPaymentStatus ;
String tamaraOrderID ;
String selectedInstallmentPlan ;
late String tamaraPaymentStatus ;
late String tamaraOrderID ;
late String selectedInstallmentPlan ;
@ override
void initState ( ) {
liveCareClinicsListResponse = new LiveCareClinicsListResponse ( ) ;
liveCareOnlineClinicsListResponse = new [ ] ;
liveCareOfflineClinicsListResponse = new [ ] ;
liveCareOnlineClinicsListResponse = [ ] ;
liveCareOfflineClinicsListResponse = [ ] ;
liveCareScheduleClinicsListResponse = new LiveCareScheduleClinicsListResponse ( ) ;
@ -126,10 +126,10 @@ class _clinic_listState extends State<ClinicList> {
isError = true ;
showLiveCareCancelDialog ( res [ ' ErrorEndUserMessage ' ] , res ) ;
} else {
erAppointmentFeesResponse = ERAppointmentFeesResponse . fromJson ( res ) ;
erAppointmentFeesResponse = ERAppointmentFeesResponse . fromJson ( res as Map < String , dynamic > ) ;
isError = false ;
}
if ( ! isError ) getERAppointmentTime ( erAppointmentFeesResponse . getERAppointmentFeesList ) ;
if ( ! isError ) getERAppointmentTime ( erAppointmentFeesResponse . getERAppointmentFeesList ! ) ;
} ) . catchError ( ( err ) {
GifLoaderDialogUtils . hideDialog ( context ) ;
print ( err ) ;
@ -208,7 +208,7 @@ class _clinic_listState extends State<ClinicList> {
( value ) {
if ( value ) {
if ( getERAppointmentFeesList . total = = " 0 " | | getERAppointmentFeesList . total = = " 0.0 " ) {
addNewCallForPatientER ( projectViewModel . user . patientID . toString ( ) + " " + DateTime . now ( ) . millisecondsSinceEpoch . toString ( ) ) ;
addNewCallForPatientER ( projectViewModel . user ! . patientID . toString ( ) + " " + DateTime . now ( ) . millisecondsSinceEpoch . toString ( ) ) ;
} else {
navigateToPaymentMethod ( getERAppointmentFeesList , context ) ;
}
@ -311,17 +311,17 @@ class _clinic_listState extends State<ClinicList> {
context ,
FadePage (
page: PaymentMethod (
onSelectedMethod: ( String metohd , [ String selectedInstallmentPlan ] ) {
onSelectedMethod: ( String metohd , [ String ? selectedInstallmentPlan ] ) {
setState ( ( ) { } ) ;
} ,
patientShare: num . parse ( getERAppointmentFeesList . total ) ,
patientShare: num . parse ( getERAppointmentFeesList . total ! ) ,
isFromAdvancePayment: widget . isPharmacyLiveCare ,
) ) ) . then ( ( value ) {
print ( value ) ;
widget . isPharmacyLiveCare = isPharmacyLiveCare ;
widget . pharmacyLiveCareQRCode = pharmaLiveCareQRCodeValue ;
if ( value ! = null ) {
openPayment ( value , authUser , num . parse ( getERAppointmentFeesList . total ) , appo ) ;
openPayment ( value , authUser , num . parse ( getERAppointmentFeesList . total ! ) , appo ) ;
projectViewModel . analytics . liveCare . payment_method ( appointment_type: ' livecare ' , clinic: selectedClinicName , payment_method: value [ 0 ] , payment_type: ' appointment ' ) ;
}
} ) ;
@ -337,12 +337,12 @@ class _clinic_listState extends State<ClinicList> {
browser . openPaymentBrowser (
amount ,
" LiveCare Payment " ,
widget . isPharmacyLiveCare ? widget . pharmacyLiveCareQRCode : Utils . getAppointmentTransID ( appo . projectID , appo . clinicID , appo . appointmentNo ) ,
widget . isPharmacyLiveCare ? widget . pharmacyLiveCareQRCode : Utils . getAppointmentTransID ( appo . projectID ! , appo . clinicID ! , appo . appointmentNo ! ) ,
" 12 " ,
authenticatedUser . emailAddress ,
authenticatedUser . emailAddress ! ,
paymentMethod [ 0 ] ,
authenticatedUser . patientType ,
authenticatedUser . firstName ,
authenticatedUser . firstName ! ,
authenticatedUser . patientID ,
authenticatedUser ,
browser ,
@ -364,12 +364,12 @@ class _clinic_listState extends State<ClinicList> {
if ( selectedPaymentMethod = = " TAMARA " ) {
if ( Platform . isAndroid ) {
Uri uri = new Uri . dataFromString ( url ) ;
tamaraPaymentStatus = uri . queryParameters [ ' status ' ] ;
tamaraOrderID = uri . queryParameters [ ' AuthorizePaymentId ' ] ;
tamaraPaymentStatus = uri . queryParameters [ ' status ' ] ! ;
tamaraOrderID = uri . queryParameters [ ' AuthorizePaymentId ' ] ! ;
} else {
Uri uri = new Uri . dataFromString ( url ) ;
tamaraPaymentStatus = uri . queryParameters [ ' paymentStatus ' ] ;
tamaraOrderID = uri . queryParameters [ ' orderId ' ] ;
tamaraPaymentStatus = uri . queryParameters [ ' paymentStatus ' ] ! ;
tamaraOrderID = uri . queryParameters [ ' orderId ' ] ! ;
}
}
@ -394,7 +394,7 @@ class _clinic_listState extends State<ClinicList> {
print ( " onBrowserExit Called!!!! " ) ;
try {
if ( selectedPaymentMethod = = " TAMARA " ) {
checkTamaraPaymentStatus ( Utils . getAppointmentTransID ( appo . projectID , appo . clinicID , appo . appointmentNo ) , appo ) ;
checkTamaraPaymentStatus ( Utils . getAppointmentTransID ( appo . projectID ! , appo . clinicID ! , appo . appointmentNo ! ) , appo ) ;
/ / if ( tamaraPaymentStatus ! = null & & tamaraPaymentStatus . toLowerCase ( ) = = " approved " ) {
/ / updateTamaraRequestStatus ( " success " , " 14 " , Utils . getAppointmentTransID ( appo . projectID , appo . clinicID , appo . appointmentNo ) , tamaraOrderID , num . parse ( selectedInstallmentPlan ) , appo ) ;
/ / } else {
@ -415,10 +415,10 @@ class _clinic_listState extends State<ClinicList> {
service . getTamaraPaymentStatus ( orderID ) . then ( ( res ) {
GifLoaderDialogUtils . hideDialog ( context ) ;
if ( res [ " status " ] . toString ( ) . toLowerCase ( ) = = " success " ) {
updateTamaraRequestStatus ( " success " , " 14 " , orderID , tamaraOrderID , num . parse ( selectedInstallmentPlan ) , appo ) ;
updateTamaraRequestStatus ( " success " , " 14 " , orderID , tamaraOrderID , int . parse ( selectedInstallmentPlan ) , appo ) ;
} else {
updateTamaraRequestStatus (
" Failed " , " 00 " , Utils . getAppointmentTransID ( appo . projectID , appo . clinicID , appo . appointmentNo ) , tamaraOrderID ! = null ? tamaraOrderID : " " , num . parse ( selectedInstallmentPlan ) , appo ) ;
" Failed " , " 00 " , Utils . getAppointmentTransID ( appo . projectID ! , appo . clinicID ! , appo . appointmentNo ! ) , tamaraOrderID ! = null ? tamaraOrderID : " " , int . parse ( selectedInstallmentPlan ) , appo ) ;
}
} ) . catchError ( ( err ) {
GifLoaderDialogUtils . hideDialog ( context ) ;
@ -428,14 +428,14 @@ class _clinic_listState extends State<ClinicList> {
}
updateTamaraRequestStatus ( String responseMessage , String status , String clientRequestID , String tamaraOrderID , int selectedInstallments , AppoitmentAllHistoryResultList appo ) {
final currency = projectViewModel . user . outSA = = 0 ? " sar " : ' aed ' ;
final currency = projectViewModel . user ! . outSA = = 0 ? " sar " : ' aed ' ;
GifLoaderDialogUtils . showMyDialog ( context ) ;
try {
DoctorsListService service = new DoctorsListService ( ) ;
service . updateTamaraRequestStatus ( responseMessage , status , clientRequestID , tamaraOrderID , selectedInstallments ) . then ( ( res ) {
GifLoaderDialogUtils . hideDialog ( context ) ;
if ( tamaraPaymentStatus ! = null & & tamaraPaymentStatus . toLowerCase ( ) = = " approved " ) {
addNewCallForPatientER ( Utils . getAppointmentTransID ( appo . projectID , appo . clinicID , appo . appointmentNo ) ) ;
addNewCallForPatientER ( Utils . getAppointmentTransID ( appo . projectID ! , appo . clinicID ! , appo . appointmentNo ! ) ) ;
} else {
AppToast . showErrorToast ( message: res [ ' Response_Message ' ] ) ;
projectViewModel . analytics . liveCare . livecare_immediate_consultation_payment_failed (
@ -459,19 +459,19 @@ class _clinic_listState extends State<ClinicList> {
checkPaymentStatus ( AppoitmentAllHistoryResultList appo ) {
String amount ;
String payment_method ;
final currency = projectViewModel . user . outSA = = 0 ? " sar " : ' aed ' ;
final currency = projectViewModel . user ! . outSA = = 0 ? " sar " : ' aed ' ;
DoctorsListService service = new DoctorsListService ( ) ;
GifLoaderDialogUtils . showMyDialog ( context ) ;
service
. checkPaymentStatus (
widget . isPharmacyLiveCare ? widget . pharmacyLiveCareQRCode : Utils . getAppointmentTransID ( appo . projectID , appo . clinicID , appo . appointmentNo ) , widget . isPharmacyLiveCare , context )
widget . isPharmacyLiveCare ? widget . pharmacyLiveCareQRCode : Utils . getAppointmentTransID ( appo . projectID ! , appo . clinicID ! , appo . appointmentNo ! ) , widget . isPharmacyLiveCare , context )
. then ( ( res ) {
GifLoaderDialogUtils . hideDialog ( context ) ;
String paymentInfo = res [ ' Response_Message ' ] ;
amount = res [ ' Amount ' ] . toString ( ) ;
payment_method = res [ ' PaymentMethod ' ] ;
if ( paymentInfo = = ' Success ' ) {
addNewCallForPatientER ( widget . isPharmacyLiveCare ? widget . pharmacyLiveCareQRCode : Utils . getAppointmentTransID ( appo . projectID , appo . clinicID , appo . appointmentNo ) ) ;
addNewCallForPatientER ( widget . isPharmacyLiveCare ? widget . pharmacyLiveCareQRCode : Utils . getAppointmentTransID ( appo . projectID ! , appo . clinicID ! , appo . appointmentNo ! ) ) ;
} else {
AppToast . showErrorToast ( message: res [ ' Response_Message ' ] ) ;
projectViewModel . analytics . liveCare . livecare_immediate_consultation_payment_failed (
@ -517,9 +517,9 @@ class _clinic_listState extends State<ClinicList> {
if ( res [ ' MessageStatus ' ] = = 1 ) {
setState ( ( ) {
liveCareOnlineClinicsListResponse . clear ( ) ;
liveCareClinicsListResponse = LiveCareClinicsListResponse . fromJson ( res ) ;
liveCareClinicsListResponse = LiveCareClinicsListResponse . fromJson ( res as Map < String , dynamic > ) ;
liveCareClinicsListResponse . patientERGetClinicsList . forEach ( ( clinic ) {
liveCareClinicsListResponse . patientERGetClinicsList ! . forEach ( ( clinic ) {
if ( clinic . isOnline = = 1 ) {
liveCareOnlineClinicsListResponse . add ( clinic ) ;
} else {
@ -530,8 +530,8 @@ class _clinic_listState extends State<ClinicList> {
selectedClinicID = int . parse ( liveCareClinicIDs . split ( " - " ) [ 2 ] ) ;
selectedClinicName = liveCareClinicIDs . split ( " - " ) [ 0 ] ;
} else {
selectedClinicID = liveCareClinicsListResponse . patientERGetClinicsList [ 0 ] . serviceID ;
selectedClinicName = liveCareClinicsListResponse . patientERGetClinicsList [ 0 ] . serviceName ;
selectedClinicID = liveCareClinicsListResponse . patientERGetClinicsList ! [ 0 ] . serviceID ! ;
selectedClinicName = liveCareClinicsListResponse . patientERGetClinicsList ! [ 0 ] . serviceName ! ;
}
isDataLoaded = true ;
} ) ;
@ -554,9 +554,9 @@ class _clinic_listState extends State<ClinicList> {
print ( res [ ' ClinicsHaveScheduleList ' ] . length ) ;
if ( res [ ' MessageStatus ' ] = = 1 ) {
setState ( ( ) {
liveCareScheduleClinicsListResponse = LiveCareScheduleClinicsListResponse . fromJson ( res ) ;
selectedClinicID = liveCareScheduleClinicsListResponse . clinicsHaveScheduleList [ 0 ] . serviceID ;
selectedClinicName = liveCareScheduleClinicsListResponse . clinicsHaveScheduleList [ 0 ] . clinicDesc ;
liveCareScheduleClinicsListResponse = LiveCareScheduleClinicsListResponse . fromJson ( res as Map < String , dynamic > ) ;
selectedClinicID = liveCareScheduleClinicsListResponse . clinicsHaveScheduleList ! [ 0 ] . serviceID ! ;
selectedClinicName = liveCareScheduleClinicsListResponse . clinicsHaveScheduleList ! [ 0 ] . clinicDesc ! ;
isDataLoaded = true ;
} ) ;
} else {
@ -629,7 +629,7 @@ class _clinic_listState extends State<ClinicList> {
isDataLoaded
? Expanded (
child: Container (
child: liveCareScheduleClinicsListResponse . clinicsHaveScheduleList . length > 0
child: liveCareScheduleClinicsListResponse . clinicsHaveScheduleList ! . length > 0
? Column (
crossAxisAlignment: CrossAxisAlignment . start ,
children: < Widget > [
@ -639,15 +639,15 @@ class _clinic_listState extends State<ClinicList> {
shrinkWrap: true ,
physics: ScrollPhysics ( ) ,
padding: EdgeInsets . all ( 0.0 ) ,
itemCount: liveCareScheduleClinicsListResponse . clinicsHaveScheduleList . length ,
itemCount: liveCareScheduleClinicsListResponse . clinicsHaveScheduleList ! . length ,
itemBuilder: ( context , index ) {
return InkWell (
onTap: ( ) {
updateSelectedScheduleIndex ( liveCareScheduleClinicsListResponse . clinicsHaveScheduleList [ index ] ) ;
updateSelectedScheduleIndex ( liveCareScheduleClinicsListResponse . clinicsHaveScheduleList ! [ index ] ) ;
} ,
child: ScheduleClinicCard (
isSelected: selectedClinicID = = liveCareScheduleClinicsListResponse . clinicsHaveScheduleList [ index ] . serviceID ? true : false ,
clinicsHaveScheduleList: liveCareScheduleClinicsListResponse . clinicsHaveScheduleList [ index ] ,
isSelected: selectedClinicID = = liveCareScheduleClinicsListResponse . clinicsHaveScheduleList ! [ index ] . serviceID ? true : false ,
clinicsHaveScheduleList: liveCareScheduleClinicsListResponse . clinicsHaveScheduleList ! [ index ] ,
languageID: languageID ,
) ,
) ;
@ -778,7 +778,7 @@ class _clinic_listState extends State<ClinicList> {
. toList ( ) ;
if ( doctorByHospital . length ! = 0 ) {
_patientDoctorAppointmentListHospital [ _patientDoctorAppointmentListHospital . indexOf ( doctorByHospital [ 0 ] ) ] . patientDoctorAppointmentList . add ( element ) ;
_patientDoctorAppointmentListHospital [ _patientDoctorAppointmentListHospital . indexOf ( doctorByHospital [ 0 ] ) ] . patientDoctorAppointmentList ! . add ( element ) ;
} else {
_patientDoctorAppointmentListHospital
. add ( PatientDoctorAppointmentList ( filterName: element . projectName , distanceInKMs: element . projectDistanceInKiloMeters . toString ( ) , patientDoctorAppointment: element ) ) ;
@ -803,15 +803,15 @@ class _clinic_listState extends State<ClinicList> {
updateSelectedIndex ( PatientERGetClinicsList patientERGetClinicsList ) {
setState ( ( ) {
selectedClinicID = patientERGetClinicsList . serviceID ;
selectedClinicName = patientERGetClinicsList . serviceName ;
selectedClinicID = patientERGetClinicsList . serviceID ! ;
selectedClinicName = patientERGetClinicsList . serviceName ! ;
} ) ;
}
updateSelectedScheduleIndex ( ClinicsHaveScheduleList patientERGetClinicsList ) {
setState ( ( ) {
selectedClinicID = patientERGetClinicsList . serviceID ;
selectedClinicName = patientERGetClinicsList . clinicDesc ;
selectedClinicID = patientERGetClinicsList . serviceID ! ;
selectedClinicName = patientERGetClinicsList . clinicDesc ! ;
} ) ;
}
}