@ -54,9 +54,6 @@ class MyAppointmentsViewModel extends ChangeNotifier {
List < PatientQueueDetails > patientQueueDetailsList = [ ] ;
late PatientQueueDetails currentPatientQueueDetails ;
List < PatientAppointmentHistoryResponseModel > patientAppointmentsHistoryList = [ ] ;
List < PatientAppointmentHistoryResponseModel > filteredAppointmentList = [ ] ;
@ -344,10 +341,8 @@ class MyAppointmentsViewModel extends ChangeNotifier {
notifyListeners ( ) ;
}
Future < void > getPatientShareAppointment ( int projectID , int clinicID , String appointmentNo , bool isLiveCareAppointment ,
{ Function ( dynamic ) ? onSuccess , Function ( String ) ? onError } ) async {
final result = await myAppointmentsRepo . getPatientShareAppointment (
projectID: projectID , clinicID: clinicID , appointmentNo: appointmentNo , isLiveCareAppointment: isLiveCareAppointment ) ;
Future < void > getPatientShareAppointment ( int projectID , int clinicID , String appointmentNo , bool isLiveCareAppointment , { Function ( dynamic ) ? onSuccess , Function ( String ) ? onError } ) async {
final result = await myAppointmentsRepo . getPatientShareAppointment ( projectID: projectID , clinicID: clinicID , appointmentNo: appointmentNo , isLiveCareAppointment: isLiveCareAppointment ) ;
result . fold (
( failure ) async {
@ -421,13 +416,23 @@ class MyAppointmentsViewModel extends ChangeNotifier {
} ,
onConfirmTap: ( ) async {
Navigator . pop ( GetIt . instance < NavigationService > ( ) . navigatorKey . currentContext ! ) ;
Navigator . pop ( GetIt . instance < NavigationService > ( ) . navigatorKey . currentContext ! ) ;
Navigator . push (
GetIt . instance < NavigationService > ( ) . navigatorKey . currentContext ! ,
CustomPageRoute (
page: InsuranceHomePage ( ) ,
) ,
) ;
/ / Call the API to attempt updating patient insurance
LoaderBottomSheet . showLoader ( ) ;
sendPatientUpdateRequest ( onSuccess: ( val ) {
LoaderBottomSheet . hideLoader ( ) ;
setIsPatientAppointmentShareLoading ( true ) ;
getPatientShareAppointment ( projectID , clinicID , appointmentNo , isLiveCareAppointment ) ;
} , onError: ( err ) {
LoaderBottomSheet . hideLoader ( ) ;
Navigator . pop ( GetIt . instance < NavigationService > ( ) . navigatorKey . currentContext ! ) ;
Navigator . push (
GetIt . instance < NavigationService > ( ) . navigatorKey . currentContext ! ,
CustomPageRoute (
page: InsuranceHomePage ( ) ,
) ,
) ;
} ) ;
} ) ,
) , callBackFunc: ( ) {
/ / Navigator . pop ( GetIt . instance < NavigationService > ( ) . navigatorKey . currentContext ! ) ;
@ -443,6 +448,27 @@ class MyAppointmentsViewModel extends ChangeNotifier {
) ;
}
Future < void > sendPatientUpdateRequest ( { Function ( dynamic ) ? onSuccess , Function ( String ) ? onError } ) async {
final result = await myAppointmentsRepo . sendPatientUpdateRequest ( ) ;
result . fold (
/ / ( failure ) async = > await errorHandlerService . handleError ( failure: failure ) ,
( failure ) async {
onError ! ( failure . message ) ;
} ,
( apiResponse ) {
if ( apiResponse . messageStatus = = 2 ) {
/ / dialogService . showErrorDialog ( message: apiResponse . errorMessage ! , onOkPressed: ( ) { } ) ;
} else if ( apiResponse . messageStatus = = 1 ) {
notifyListeners ( ) ;
if ( onSuccess ! = null ) {
onSuccess ( apiResponse ) ;
}
}
} ,
) ;
}
Future < void > convertPatientToCash ( { required int projectID , Function ( dynamic ) ? onSuccess , Function ( String ) ? onError } ) async {
final result = await myAppointmentsRepo . convertPatientToCash ( projectID: projectID ) ;
@ -465,13 +491,8 @@ class MyAppointmentsViewModel extends ChangeNotifier {
}
Future < void > addAdvanceNumberRequest (
{ required String advanceNumber ,
required String paymentReference ,
required String appointmentNo ,
Function ( dynamic ) ? onSuccess ,
Function ( String ) ? onError } ) async {
final result =
await myAppointmentsRepo . addAdvanceNumberRequest ( advanceNumber: advanceNumber , paymentReference: paymentReference , appointmentNo: appointmentNo ) ;
{ required String advanceNumber , required String paymentReference , required String appointmentNo , Function ( dynamic ) ? onSuccess , Function ( String ) ? onError } ) async {
final result = await myAppointmentsRepo . addAdvanceNumberRequest ( advanceNumber: advanceNumber , paymentReference: paymentReference , appointmentNo: appointmentNo ) ;
result . fold (
( failure ) async = > await errorHandlerService . handleError ( failure: failure ) ,
@ -489,14 +510,8 @@ class MyAppointmentsViewModel extends ChangeNotifier {
}
Future < void > generateAppointmentQR (
{ required int clinicID ,
required int projectID ,
required String appointmentNo ,
required int isFollowUp ,
Function ( dynamic ) ? onSuccess ,
Function ( String ) ? onError } ) async {
final result =
await myAppointmentsRepo . generateAppointmentQR ( clinicID: clinicID , projectID: projectID , appointmentNo: appointmentNo , isFollowUp: isFollowUp ) ;
{ required int clinicID , required int projectID , required String appointmentNo , required int isFollowUp , Function ( dynamic ) ? onSuccess , Function ( String ) ? onError } ) async {
final result = await myAppointmentsRepo . generateAppointmentQR ( clinicID: clinicID , projectID: projectID , appointmentNo: appointmentNo , isFollowUp: isFollowUp ) ;
result . fold (
( failure ) async = > await errorHandlerService . handleError ( failure: failure ) ,
@ -513,14 +528,13 @@ class MyAppointmentsViewModel extends ChangeNotifier {
) ;
}
Future < void > cancelAppointment (
{ required PatientAppointmentHistoryResponseModel patientAppointmentHistoryResponseModel , Function ( dynamic ) ? onSuccess , Function ( String ) ? onError } ) async {
Future < void > cancelAppointment ( { required PatientAppointmentHistoryResponseModel patientAppointmentHistoryResponseModel , Function ( dynamic ) ? onSuccess , Function ( String ) ? onError } ) async {
final result = await myAppointmentsRepo . cancelAppointment ( patientAppointmentHistoryResponseModel: patientAppointmentHistoryResponseModel ) ;
result . fold (
/ / ( failure ) async = > await errorHandlerService . handleError ( failure: failure ) ,
( failure ) async {
if ( onError ! = null ) {
if ( onError ! = null ) {
onError ( failure . message ) ;
}
} ,
@ -538,8 +552,7 @@ class MyAppointmentsViewModel extends ChangeNotifier {
) ;
}
Future < void > confirmAppointment (
{ required PatientAppointmentHistoryResponseModel patientAppointmentHistoryResponseModel , Function ( dynamic ) ? onSuccess , Function ( String ) ? onError } ) async {
Future < void > confirmAppointment ( { required PatientAppointmentHistoryResponseModel patientAppointmentHistoryResponseModel , Function ( dynamic ) ? onSuccess , Function ( String ) ? onError } ) async {
final result = await myAppointmentsRepo . confirmAppointment ( patientAppointmentHistoryResponseModel: patientAppointmentHistoryResponseModel ) ;
result . fold (
@ -600,8 +613,7 @@ class MyAppointmentsViewModel extends ChangeNotifier {
required int checkInType ,
Function ( dynamic ) ? onSuccess ,
Function ( String ) ? onError } ) async {
final result = await myAppointmentsRepo . sendCheckInNfcRequest (
patientAppointmentHistoryResponseModel: patientAppointmentHistoryResponseModel , scannedCode: scannedCode , checkInType: checkInType ) ;
final result = await myAppointmentsRepo . sendCheckInNfcRequest ( patientAppointmentHistoryResponseModel: patientAppointmentHistoryResponseModel , scannedCode: scannedCode , checkInType: checkInType ) ;
result . fold (
( failure ) async = > await errorHandlerService . handleError ( failure: failure ) ,
@ -647,12 +659,8 @@ class MyAppointmentsViewModel extends ChangeNotifier {
}
Future < void > insertLiveCareVIDARequest (
{ required clientRequestID ,
required PatientAppointmentHistoryResponseModel patientAppointmentHistoryResponseModel ,
Function ( dynamic ) ? onSuccess ,
Function ( String ) ? onError } ) async {
final result = await myAppointmentsRepo . insertLiveCareVIDARequest (
clientRequestID: clientRequestID , patientAppointmentHistoryResponseModel: patientAppointmentHistoryResponseModel ) ;
{ required clientRequestID , required PatientAppointmentHistoryResponseModel patientAppointmentHistoryResponseModel , Function ( dynamic ) ? onSuccess , Function ( String ) ? onError } ) async {
final result = await myAppointmentsRepo . insertLiveCareVIDARequest ( clientRequestID: clientRequestID , patientAppointmentHistoryResponseModel: patientAppointmentHistoryResponseModel ) ;
result . fold (
( failure ) async = > await errorHandlerService . handleError ( failure: failure ) ,
@ -928,5 +936,4 @@ class MyAppointmentsViewModel extends ChangeNotifier {
} ,
) ;
}
}