|  |  |  | @ -9,10 +9,9 @@ import 'package:hmg_patient_app_new/services/logger_service.dart'; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | abstract class MyAppointmentsRepo { | 
		
	
		
			
				|  |  |  |  |   Future<Either<Failure, GenericApiModel<List<PatientAppointmentHistoryResponseModel>>>> getPatientAppointments( | 
		
	
		
			
				|  |  |  |  |       {required String patientId, required bool isActiveAppointment, required bool isArrivedAppointments}); | 
		
	
		
			
				|  |  |  |  |       {required bool isActiveAppointment, required bool isArrivedAppointments}); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   Future<Either<Failure, GenericApiModel<PatientAppointmentShareResponseModel>>> getPatientShareAppointment( | 
		
	
		
			
				|  |  |  |  |       {required String patientId, required int projectID, required int clinicID, required String appointmentNo}); | 
		
	
		
			
				|  |  |  |  |   Future<Either<Failure, GenericApiModel<PatientAppointmentShareResponseModel>>> getPatientShareAppointment({required int projectID, required int clinicID, required String appointmentNo}); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   Future<Either<Failure, GenericApiModel<dynamic>>> createAdvancePayment( | 
		
	
		
			
				|  |  |  |  |       {required String paymentMethodName, | 
		
	
	
		
			
				
					|  |  |  | @ -26,7 +25,9 @@ abstract class MyAppointmentsRepo { | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   Future<Either<Failure, GenericApiModel<dynamic>>> addAdvanceNumberRequest({required String advanceNumber, required String paymentReference, required String appointmentNo}); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   Future<Either<Failure, GenericApiModel<dynamic>>> generateAppointmentQR({required String clinicID, required String projectID, required String appointmentNo, required int isFollowUp}); | 
		
	
		
			
				|  |  |  |  |   Future<Either<Failure, GenericApiModel<dynamic>>> generateAppointmentQR({required int clinicID, required int projectID, required String appointmentNo, required int isFollowUp}); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   Future<Either<Failure, GenericApiModel<dynamic>>> cancelAppointment({required PatientAppointmentHistoryResponseModel patientAppointmentHistoryResponseModel}); | 
		
	
		
			
				|  |  |  |  | } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | class MyAppointmentsRepoImp implements MyAppointmentsRepo { | 
		
	
	
		
			
				
					|  |  |  | @ -37,8 +38,8 @@ class MyAppointmentsRepoImp implements MyAppointmentsRepo { | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   @override | 
		
	
		
			
				|  |  |  |  |   Future<Either<Failure, GenericApiModel<List<PatientAppointmentHistoryResponseModel>>>> getPatientAppointments( | 
		
	
		
			
				|  |  |  |  |       {required String patientId, required bool isActiveAppointment, required bool isArrivedAppointments}) async { | 
		
	
		
			
				|  |  |  |  |     final mapDevice = { | 
		
	
		
			
				|  |  |  |  |       {required bool isActiveAppointment, required bool isArrivedAppointments}) async { | 
		
	
		
			
				|  |  |  |  |     Map<String, dynamic> mapDevice = { | 
		
	
		
			
				|  |  |  |  |       "IsActiveAppointment": isActiveAppointment, | 
		
	
		
			
				|  |  |  |  |       "isDentalAllowedBackend": false, | 
		
	
		
			
				|  |  |  |  |       "PatientTypeID": 1, | 
		
	
	
		
			
				
					|  |  |  | @ -61,9 +62,9 @@ class MyAppointmentsRepoImp implements MyAppointmentsRepo { | 
		
	
		
			
				|  |  |  |  |         onSuccess: (response, statusCode, {messageStatus, errorMessage}) { | 
		
	
		
			
				|  |  |  |  |           try { | 
		
	
		
			
				|  |  |  |  |             final list = response['AppoimentAllHistoryResultList']; | 
		
	
		
			
				|  |  |  |  |             if (list == null || list.isEmpty) { | 
		
	
		
			
				|  |  |  |  |               throw Exception("Appointments list is empty"); | 
		
	
		
			
				|  |  |  |  |             } | 
		
	
		
			
				|  |  |  |  |             // if (list == null || list.isEmpty) { | 
		
	
		
			
				|  |  |  |  |             //   throw Exception("Appointments list is empty"); | 
		
	
		
			
				|  |  |  |  |             // } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |             final appointmentsList = list.map((item) => PatientAppointmentHistoryResponseModel.fromJson(item as Map<String, dynamic>)).toList().cast<PatientAppointmentHistoryResponseModel>(); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
	
		
			
				
					|  |  |  | @ -87,19 +88,8 @@ class MyAppointmentsRepoImp implements MyAppointmentsRepo { | 
		
	
		
			
				|  |  |  |  |   } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   @override | 
		
	
		
			
				|  |  |  |  |   Future<Either<Failure, GenericApiModel<PatientAppointmentShareResponseModel>>> getPatientShareAppointment( | 
		
	
		
			
				|  |  |  |  |       {required String patientId, required int projectID, required int clinicID, required String appointmentNo}) async { | 
		
	
		
			
				|  |  |  |  |     final mapRequest = { | 
		
	
		
			
				|  |  |  |  |       "ProjectID": projectID, | 
		
	
		
			
				|  |  |  |  |       "ClinicID": clinicID, | 
		
	
		
			
				|  |  |  |  |       "AppointmentNo": appointmentNo, | 
		
	
		
			
				|  |  |  |  |       "IsActiveAppointment": true, | 
		
	
		
			
				|  |  |  |  |       "PatientOutSA": 0, | 
		
	
		
			
				|  |  |  |  |       "isDentalAllowedBackend": false, | 
		
	
		
			
				|  |  |  |  |       "PatientID": patientId, | 
		
	
		
			
				|  |  |  |  |       "PatientTypeID": 1, | 
		
	
		
			
				|  |  |  |  |       "PatientType": 1, | 
		
	
		
			
				|  |  |  |  |     }; | 
		
	
		
			
				|  |  |  |  |   Future<Either<Failure, GenericApiModel<PatientAppointmentShareResponseModel>>> getPatientShareAppointment({required int projectID, required int clinicID, required String appointmentNo}) async { | 
		
	
		
			
				|  |  |  |  |     Map<String, dynamic> mapRequest = {"ProjectID": projectID, "ClinicID": clinicID, "AppointmentNo": appointmentNo, "IsActiveAppointment": true}; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     try { | 
		
	
		
			
				|  |  |  |  |       GenericApiModel<PatientAppointmentShareResponseModel>? apiResponse; | 
		
	
	
		
			
				
					|  |  |  | @ -139,8 +129,6 @@ class MyAppointmentsRepoImp implements MyAppointmentsRepo { | 
		
	
		
			
				|  |  |  |  |     } catch (e) { | 
		
	
		
			
				|  |  |  |  |       return Left(UnknownFailure(e.toString())); | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     throw UnimplementedError(); | 
		
	
		
			
				|  |  |  |  |   } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   @override | 
		
	
	
		
			
				
					|  |  |  | @ -154,7 +142,7 @@ class MyAppointmentsRepoImp implements MyAppointmentsRepo { | 
		
	
		
			
				|  |  |  |  |     required String patientID, | 
		
	
		
			
				|  |  |  |  |     required int patientType, | 
		
	
		
			
				|  |  |  |  |   }) async { | 
		
	
		
			
				|  |  |  |  |     final requestBody = { | 
		
	
		
			
				|  |  |  |  |     Map<String, dynamic> requestBody = { | 
		
	
		
			
				|  |  |  |  |       "ProjectID": projectID, | 
		
	
		
			
				|  |  |  |  |       "OnlineCheckInAppointment": { | 
		
	
		
			
				|  |  |  |  |         "AppointmentNo": appointmentNo, | 
		
	
	
		
			
				
					|  |  |  | @ -202,7 +190,7 @@ class MyAppointmentsRepoImp implements MyAppointmentsRepo { | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   @override | 
		
	
		
			
				|  |  |  |  |   Future<Either<Failure, GenericApiModel>> addAdvanceNumberRequest({required String advanceNumber, required String paymentReference, required String appointmentNo}) async { | 
		
	
		
			
				|  |  |  |  |     final requestBody = { | 
		
	
		
			
				|  |  |  |  |     Map<String, dynamic> requestBody = { | 
		
	
		
			
				|  |  |  |  |       "AdvanceNumber": advanceNumber, | 
		
	
		
			
				|  |  |  |  |       "AdvanceNumber_VP": advanceNumber, | 
		
	
		
			
				|  |  |  |  |       "PaymentReferenceNumber": paymentReference, | 
		
	
	
		
			
				
					|  |  |  | @ -240,8 +228,8 @@ class MyAppointmentsRepoImp implements MyAppointmentsRepo { | 
		
	
		
			
				|  |  |  |  |   } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   @override | 
		
	
		
			
				|  |  |  |  |   Future<Either<Failure, GenericApiModel>> generateAppointmentQR({required String clinicID, required String projectID, required String appointmentNo, required int isFollowUp}) async { | 
		
	
		
			
				|  |  |  |  |     final requestBody = { | 
		
	
		
			
				|  |  |  |  |   Future<Either<Failure, GenericApiModel>> generateAppointmentQR({required int clinicID, required int projectID, required String appointmentNo, required int isFollowUp}) async { | 
		
	
		
			
				|  |  |  |  |     Map<String, dynamic> requestBody = { | 
		
	
		
			
				|  |  |  |  |       "AppointmentNo": appointmentNo, | 
		
	
		
			
				|  |  |  |  |       "ClinicID": clinicID, | 
		
	
		
			
				|  |  |  |  |       "ProjectID": projectID, | 
		
	
	
		
			
				
					|  |  |  | @ -277,4 +265,49 @@ class MyAppointmentsRepoImp implements MyAppointmentsRepo { | 
		
	
		
			
				|  |  |  |  |       return Left(UnknownFailure(e.toString())); | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
		
			
				|  |  |  |  |   } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   @override | 
		
	
		
			
				|  |  |  |  |   Future<Either<Failure, GenericApiModel>> cancelAppointment({required PatientAppointmentHistoryResponseModel patientAppointmentHistoryResponseModel}) async { | 
		
	
		
			
				|  |  |  |  |     Map<String, dynamic> requestBody = { | 
		
	
		
			
				|  |  |  |  |       "AppointmentID": patientAppointmentHistoryResponseModel.appointmentNo, | 
		
	
		
			
				|  |  |  |  |       "ClinicID": patientAppointmentHistoryResponseModel.clinicID, | 
		
	
		
			
				|  |  |  |  |       "ProjectID": patientAppointmentHistoryResponseModel.projectID, | 
		
	
		
			
				|  |  |  |  |       "CancelToReschadual": false, | 
		
	
		
			
				|  |  |  |  |       "EndTime": patientAppointmentHistoryResponseModel.endTime, | 
		
	
		
			
				|  |  |  |  |       "StartTime": patientAppointmentHistoryResponseModel.startTime, | 
		
	
		
			
				|  |  |  |  |       "DoctorID": patientAppointmentHistoryResponseModel.doctorID, | 
		
	
		
			
				|  |  |  |  |       "IsForLiveCare": patientAppointmentHistoryResponseModel.isLiveCareAppointment, | 
		
	
		
			
				|  |  |  |  |       "OriginalClinicID": patientAppointmentHistoryResponseModel.originalClinicID, | 
		
	
		
			
				|  |  |  |  |       "OriginalProjectID": patientAppointmentHistoryResponseModel.originalProjectID | 
		
	
		
			
				|  |  |  |  |     }; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     try { | 
		
	
		
			
				|  |  |  |  |       GenericApiModel<dynamic>? apiResponse; | 
		
	
		
			
				|  |  |  |  |       Failure? failure; | 
		
	
		
			
				|  |  |  |  |       await apiClient.post( | 
		
	
		
			
				|  |  |  |  |         CANCEL_APPOINTMENT, | 
		
	
		
			
				|  |  |  |  |         body: requestBody, | 
		
	
		
			
				|  |  |  |  |         onFailure: (error, statusCode, {messageStatus, failureType}) { | 
		
	
		
			
				|  |  |  |  |           failure = failureType; | 
		
	
		
			
				|  |  |  |  |         }, | 
		
	
		
			
				|  |  |  |  |         onSuccess: (response, statusCode, {messageStatus, errorMessage}) { | 
		
	
		
			
				|  |  |  |  |           try { | 
		
	
		
			
				|  |  |  |  |             apiResponse = GenericApiModel<dynamic>( | 
		
	
		
			
				|  |  |  |  |               messageStatus: messageStatus, | 
		
	
		
			
				|  |  |  |  |               statusCode: statusCode, | 
		
	
		
			
				|  |  |  |  |               errorMessage: null, | 
		
	
		
			
				|  |  |  |  |               data: response, | 
		
	
		
			
				|  |  |  |  |             ); | 
		
	
		
			
				|  |  |  |  |           } catch (e) { | 
		
	
		
			
				|  |  |  |  |             failure = DataParsingFailure(e.toString()); | 
		
	
		
			
				|  |  |  |  |           } | 
		
	
		
			
				|  |  |  |  |         }, | 
		
	
		
			
				|  |  |  |  |       ); | 
		
	
		
			
				|  |  |  |  |       if (failure != null) return Left(failure!); | 
		
	
		
			
				|  |  |  |  |       if (apiResponse == null) return Left(ServerFailure("Unknown error")); | 
		
	
		
			
				|  |  |  |  |       return Right(apiResponse!); | 
		
	
		
			
				|  |  |  |  |     } catch (e) { | 
		
	
		
			
				|  |  |  |  |       return Left(UnknownFailure(e.toString())); | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
		
			
				|  |  |  |  |   } | 
		
	
		
			
				|  |  |  |  | } | 
		
	
	
		
			
				
					|  |  |  | 
 |