@ -17,13 +17,13 @@ import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'
import ' package:diplomaticquarterapp/services/livecare_services/livecare_provider.dart ' ;
import ' package:diplomaticquarterapp/services/livecare_services/livecare_provider.dart ' ;
import ' package:diplomaticquarterapp/uitl/app_shared_preferences.dart ' ;
import ' package:diplomaticquarterapp/uitl/app_shared_preferences.dart ' ;
import ' package:diplomaticquarterapp/uitl/app_toast.dart ' ;
import ' package:diplomaticquarterapp/uitl/app_toast.dart ' ;
import ' package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart ' ;
import ' package:diplomaticquarterapp/uitl/translations_delegate_base.dart ' ;
import ' package:diplomaticquarterapp/uitl/translations_delegate_base.dart ' ;
import ' package:diplomaticquarterapp/uitl/utils.dart ' ;
import ' package:diplomaticquarterapp/uitl/utils.dart ' ;
import ' package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart ' ;
import ' package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart ' ;
import ' package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.dart ' ;
import ' package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.dart ' ;
import ' package:flutter/cupertino.dart ' ;
import ' package:flutter/cupertino.dart ' ;
import ' package:flutter/material.dart ' ;
import ' package:flutter/material.dart ' ;
import ' package:smart_progress_bar/smart_progress_bar.dart ' ;
class ClinicList extends StatefulWidget {
class ClinicList extends StatefulWidget {
final Function getLiveCareHistory ;
final Function getLiveCareHistory ;
@ -79,31 +79,27 @@ class _clinic_listState extends State<ClinicList> {
void startLiveCare ( ) {
void startLiveCare ( ) {
bool isError = false ;
bool isError = false ;
LiveCareService service = new LiveCareService ( ) ;
LiveCareService service = new LiveCareService ( ) ;
GifLoaderDialogUtils . showMyDialog ( context ) ;
ERAppointmentFeesResponse erAppointmentFeesResponse =
ERAppointmentFeesResponse erAppointmentFeesResponse =
new ERAppointmentFeesResponse ( ) ;
new ERAppointmentFeesResponse ( ) ;
service
service . getERAppointmentFees ( selectedClinicID , context ) . then ( ( res ) {
. getERAppointmentFees ( selectedClinicID , context )
GifLoaderDialogUtils . hideDialog ( context ) ;
. then ( ( res ) {
if ( res [ ' HasAppointment ' ] = = true ) {
if ( res [ ' HasAppointment ' ] = = true ) {
isError = true ;
isError = true ;
showLiveCareCancelDialog ( res [ ' ErrorEndUserMessage ' ] , res ) ;
showLiveCareCancelDialog ( res [ ' ErrorEndUserMessage ' ] , res ) ;
} else {
} else {
erAppointmentFeesResponse = ERAppointmentFeesResponse . fromJson ( res ) ;
erAppointmentFeesResponse = ERAppointmentFeesResponse . fromJson ( res ) ;
isError = false ;
isError = false ;
}
}
if ( ! isError )
} )
getERAppointmentTime (
. catchError ( ( err ) {
erAppointmentFeesResponse . getERAppointmentFeesList ) ;
print ( err ) ;
} ) . catchError ( ( err ) {
isError = true ;
GifLoaderDialogUtils . hideDialog ( context ) ;
AppToast . showErrorToast ( message: err ) ;
print ( err ) ;
} )
isError = true ;
. showProgressBar (
AppToast . showErrorToast ( message: err ) ;
text: " Loading " , backgroundColor: Colors . blue . withOpacity ( 0.6 ) )
} ) ;
. then ( ( value ) {
if ( ! isError )
getERAppointmentTime (
erAppointmentFeesResponse . getERAppointmentFeesList ) ;
} ) ;
}
}
showLiveCareCancelDialog ( String msg , res ) {
showLiveCareCancelDialog ( String msg , res ) {
@ -112,8 +108,7 @@ class _clinic_listState extends State<ClinicList> {
confirmMessage: msg ,
confirmMessage: msg ,
okText: TranslationBase . of ( context ) . confirm ,
okText: TranslationBase . of ( context ) . confirm ,
cancelText: TranslationBase . of ( context ) . cancel_nocaps ,
cancelText: TranslationBase . of ( context ) . cancel_nocaps ,
okFunction: ( ) = >
okFunction: ( ) = > { cancelAppointment ( res ) } ,
{ cancelAppointment ( res ) } ,
cancelFunction: ( ) = > { } ) ;
cancelFunction: ( ) = > { } ) ;
dialog . showAlertDialog ( context ) ;
dialog . showAlertDialog ( context ) ;
}
}
@ -132,38 +127,37 @@ class _clinic_listState extends State<ClinicList> {
appo . appointmentDate = res [ ' AppointmentDate ' ] ;
appo . appointmentDate = res [ ' AppointmentDate ' ] ;
ConfirmDialog . closeAlertDialog ( context ) ;
ConfirmDialog . closeAlertDialog ( context ) ;
GifLoaderDialogUtils . showMyDialog ( context ) ;
DoctorsListService service = new DoctorsListService ( ) ;
DoctorsListService service = new DoctorsListService ( ) ;
service
service . cancelAppointment ( appo , context ) . then ( ( res ) {
. cancelAppointment ( appo , context )
GifLoaderDialogUtils . hideDialog ( context ) ;
. then ( ( res ) {
print ( res ) ;
print ( res ) ;
if ( res [ ' MessageStatus ' ] = = 1 ) {
if ( res [ ' MessageStatus ' ] = = 1 ) {
AppToast . showSuccessToast ( message: res [ ' ErrorEndUserMessage ' ] ) ;
AppToast . showSuccessToast ( message: res [ ' ErrorEndUserMessage ' ] ) ;
startLiveCare ( ) ;
} else {
} else {
AppToast . showErrorToast ( message: res [ ' ErrorEndUserMessage ' ] ) ;
AppToast . showErrorToast ( message: res [ ' ErrorEndUserMessage ' ] ) ;
}
}
} )
} ) . catchError ( ( err ) {
. catchError ( ( err ) {
GifLoaderDialogUtils . hideDialog ( context ) ;
print ( err ) ;
AppToast . showErrorToast ( message: err ) ;
} )
print ( err ) ;
. showProgressBar (
} ) ;
text: " Loading " , backgroundColor: Colors . blue . withOpacity ( 0.6 ) )
. then ( ( value ) {
startLiveCare ( ) ;
} ) ;
}
}
getERAppointmentTime ( GetERAppointmentFeesList getERAppointmentFeesList ) {
getERAppointmentTime ( GetERAppointmentFeesList getERAppointmentFeesList ) {
LiveCareService service = new LiveCareService ( ) ;
LiveCareService service = new LiveCareService ( ) ;
GifLoaderDialogUtils . showMyDialog ( context ) ;
service . getERAppointmentTime ( selectedClinicID , context ) . then ( ( res ) {
service . getERAppointmentTime ( selectedClinicID , context ) . then ( ( res ) {
GifLoaderDialogUtils . hideDialog ( context ) ;
print ( res ) ;
print ( res ) ;
showLiveCarePaymentDialog (
showLiveCarePaymentDialog (
getERAppointmentFeesList , res [ ' WatingtimeInteger ' ] ) ;
getERAppointmentFeesList , res [ ' WatingtimeInteger ' ] ) ;
} ) . catchError ( ( err ) {
} ) . catchError ( ( err ) {
GifLoaderDialogUtils . hideDialog ( context ) ;
print ( err ) ;
print ( err ) ;
AppToast . showErrorToast ( message: err ) ;
AppToast . showErrorToast ( message: err ) ;
} ) . showProgressBar (
} ) ;
text: " Loading " , backgroundColor: Colors . blue . withOpacity ( 0.6 ) ) ;
}
}
showLiveCarePaymentDialog (
showLiveCarePaymentDialog (
@ -320,12 +314,14 @@ class _clinic_listState extends State<ClinicList> {
checkPaymentStatus ( AppoitmentAllHistoryResultList appo ) {
checkPaymentStatus ( AppoitmentAllHistoryResultList appo ) {
DoctorsListService service = new DoctorsListService ( ) ;
DoctorsListService service = new DoctorsListService ( ) ;
GifLoaderDialogUtils . showMyDialog ( context ) ;
service
service
. checkPaymentStatus (
. checkPaymentStatus (
Utils . getAppointmentTransID (
Utils . getAppointmentTransID (
appo . projectID , appo . clinicID , appo . appointmentNo ) ,
appo . projectID , appo . clinicID , appo . appointmentNo ) ,
context )
context )
. then ( ( res ) {
. then ( ( res ) {
GifLoaderDialogUtils . hideDialog ( context ) ;
print ( " Printing Payment Status Reponse!!!! " ) ;
print ( " Printing Payment Status Reponse!!!! " ) ;
print ( res ) ;
print ( res ) ;
String paymentInfo = res [ ' Response_Message ' ] ;
String paymentInfo = res [ ' Response_Message ' ] ;
@ -336,27 +332,27 @@ class _clinic_listState extends State<ClinicList> {
AppToast . showErrorToast ( message: res [ ' Response_Message ' ] ) ;
AppToast . showErrorToast ( message: res [ ' Response_Message ' ] ) ;
}
}
} ) . catchError ( ( err ) {
} ) . catchError ( ( err ) {
GifLoaderDialogUtils . hideDialog ( context ) ;
AppToast . showErrorToast ( message: err ) ;
print ( err ) ;
print ( err ) ;
} ) . showProgressBar (
} ) ;
text: " Loading " , backgroundColor: Colors . blue . withOpacity ( 0.6 ) ) ;
}
}
addNewCallForPatientER ( String clientRequestID ) {
addNewCallForPatientER ( String clientRequestID ) {
LiveCareService service = new LiveCareService ( ) ;
LiveCareService service = new LiveCareService ( ) ;
GifLoaderDialogUtils . showMyDialog ( context ) ;
service
service
. addNewCallForPatientER ( selectedClinicID , clientRequestID , context )
. addNewCallForPatientER ( selectedClinicID , clientRequestID , context )
. then ( ( res ) {
. then ( ( res ) {
AppToast . showSuccessToast (
GifLoaderDialogUtils . hideDialog ( context ) ;
message: " New Call has been added successfully " ) ;
AppToast . showSuccessToast (
} )
message: " New Call has been added successfully " ) ;
. catchError ( ( err ) {
widget . getLiveCareHistory ( ) ;
print ( err ) ;
} ) . catchError ( ( err ) {
} )
GifLoaderDialogUtils . hideDialog ( context ) ;
. showProgressBar (
AppToast . showErrorToast ( message: err ) ;
text: " Loading " , backgroundColor: Colors . blue . withOpacity ( 0.6 ) )
print ( err ) ;
. then ( ( value ) {
} ) ;
widget . getLiveCareHistory ( ) ;
} ) ;
}
}
getLanguageID ( ) async {
getLanguageID ( ) async {
@ -366,7 +362,9 @@ class _clinic_listState extends State<ClinicList> {
getLiveCareClinicsList ( ) {
getLiveCareClinicsList ( ) {
isDataLoaded = false ;
isDataLoaded = false ;
LiveCareService service = new LiveCareService ( ) ;
LiveCareService service = new LiveCareService ( ) ;
GifLoaderDialogUtils . showMyDialog ( context ) ;
service . getLivecareClinics ( context ) . then ( ( res ) {
service . getLivecareClinics ( context ) . then ( ( res ) {
GifLoaderDialogUtils . hideDialog ( context ) ;
print ( res [ ' PatientER_GetClinicsList ' ] . length ) ;
print ( res [ ' PatientER_GetClinicsList ' ] . length ) ;
if ( res [ ' MessageStatus ' ] = = 1 ) {
if ( res [ ' MessageStatus ' ] = = 1 ) {
setState ( ( ) {
setState ( ( ) {
@ -384,15 +382,18 @@ class _clinic_listState extends State<ClinicList> {
AppToast . showErrorToast ( message: res [ ' ErrorEndUserMessage ' ] ) ;
AppToast . showErrorToast ( message: res [ ' ErrorEndUserMessage ' ] ) ;
}
}
} ) . catchError ( ( err ) {
} ) . catchError ( ( err ) {
GifLoaderDialogUtils . hideDialog ( context ) ;
AppToast . showErrorToast ( message: err ) ;
print ( err ) ;
print ( err ) ;
} ) . showProgressBar (
} ) ;
text: " Loading " , backgroundColor: Colors . blue . withOpacity ( 0.6 ) ) ;
}
}
getLiveCareScheduleClinicsList ( ) {
getLiveCareScheduleClinicsList ( ) {
isDataLoaded = false ;
isDataLoaded = false ;
LiveCareService service = new LiveCareService ( ) ;
LiveCareService service = new LiveCareService ( ) ;
GifLoaderDialogUtils . showMyDialog ( context ) ;
service . getLiveCareScheduledClinics ( context ) . then ( ( res ) {
service . getLiveCareScheduledClinics ( context ) . then ( ( res ) {
GifLoaderDialogUtils . hideDialog ( context ) ;
print ( res [ ' ClinicsHaveScheduleList ' ] . length ) ;
print ( res [ ' ClinicsHaveScheduleList ' ] . length ) ;
if ( res [ ' MessageStatus ' ] = = 1 ) {
if ( res [ ' MessageStatus ' ] = = 1 ) {
setState ( ( ) {
setState ( ( ) {
@ -411,9 +412,10 @@ class _clinic_listState extends State<ClinicList> {
AppToast . showErrorToast ( message: res [ ' ErrorEndUserMessage ' ] ) ;
AppToast . showErrorToast ( message: res [ ' ErrorEndUserMessage ' ] ) ;
}
}
} ) . catchError ( ( err ) {
} ) . catchError ( ( err ) {
GifLoaderDialogUtils . hideDialog ( context ) ;
AppToast . showErrorToast ( message: err ) ;
print ( err ) ;
print ( err ) ;
} ) . showProgressBar (
} ) ;
text: " Loading " , backgroundColor: Colors . blue . withOpacity ( 0.6 ) ) ;
}
}
openLiveCareSelectionDialog ( ) {
openLiveCareSelectionDialog ( ) {
@ -605,13 +607,13 @@ class _clinic_listState extends State<ClinicList> {
void startScheduleLiveCare ( ) {
void startScheduleLiveCare ( ) {
List < DoctorList > doctorsList = [ ] ;
List < DoctorList > doctorsList = [ ] ;
LiveCareService service = new LiveCareService ( ) ;
LiveCareService service = new LiveCareService ( ) ;
GifLoaderDialogUtils . showMyDialog ( context ) ;
List < PatientDoctorAppointmentList > _patientDoctorAppointmentListHospital =
List < PatientDoctorAppointmentList > _patientDoctorAppointmentListHospital =
List ( ) ;
List ( ) ;
service
service
. getLiveCareScheduledDoctorList ( context , selectedClinicID )
. getLiveCareScheduledDoctorList ( context , selectedClinicID )
. then ( ( res ) {
. then ( ( res ) {
print ( res [ ' DoctorByClinicIDList ' ] ) ;
GifLoaderDialogUtils . hideDialog ( context ) ;
print ( res [ ' DoctorByClinicIDList ' ] . length ) ;
if ( res [ ' MessageStatus ' ] = = 1 ) {
if ( res [ ' MessageStatus ' ] = = 1 ) {
setState ( ( ) {
setState ( ( ) {
if ( res [ ' DoctorByClinicIDList ' ] . length ! = 0 ) {
if ( res [ ' DoctorByClinicIDList ' ] . length ! = 0 ) {
@ -650,9 +652,10 @@ class _clinic_listState extends State<ClinicList> {
context , doctorsList , _patientDoctorAppointmentListHospital ) ;
context , doctorsList , _patientDoctorAppointmentListHospital ) ;
} else { }
} else { }
} ) . catchError ( ( err ) {
} ) . catchError ( ( err ) {
GifLoaderDialogUtils . hideDialog ( context ) ;
AppToast . showErrorToast ( message: err ) ;
print ( err ) ;
print ( err ) ;
} ) . showProgressBar (
} ) ;
text: " Loading " , backgroundColor: Colors . blue . withOpacity ( 0.6 ) ) ;
}
}
Future navigateToSearchResults (
Future navigateToSearchResults (