|  |  |  | @ -4,7 +4,7 @@ import 'package:hmg_patient_app_new/core/api_consts.dart'; | 
		
	
		
			
				|  |  |  |  | import 'package:hmg_patient_app_new/core/common_models/generic_api_model.dart'; | 
		
	
		
			
				|  |  |  |  | import 'package:hmg_patient_app_new/core/exceptions/api_failure.dart'; | 
		
	
		
			
				|  |  |  |  | import 'package:hmg_patient_app_new/core/utils/date_util.dart'; | 
		
	
		
			
				|  |  |  |  | import 'package:hmg_patient_app_new/features/book_appointments/models/doctor_profile_response_model.dart'; | 
		
	
		
			
				|  |  |  |  | import 'package:hmg_patient_app_new/features/book_appointments/models/resp_models/doctor_profile_response_model.dart'; | 
		
	
		
			
				|  |  |  |  | import 'package:hmg_patient_app_new/features/book_appointments/models/resp_models/doctors_list_response_model.dart'; | 
		
	
		
			
				|  |  |  |  | import 'package:hmg_patient_app_new/features/book_appointments/models/resp_models/get_clinic_list_response_model.dart'; | 
		
	
		
			
				|  |  |  |  | import 'package:hmg_patient_app_new/services/logger_service.dart'; | 
		
	
	
		
			
				
					|  |  |  | @ -18,7 +18,8 @@ abstract class BookAppointmentsRepo { | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   Future<Either<Failure, GenericApiModel<DoctorsProfileResponseModel>>> getDoctorProfile(int clinicID, int projectID, int doctorId, {Function(dynamic)? onSuccess, Function(String)? onError}); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   Future<Either<Failure, GenericApiModel<DoctorsProfileResponseModel>>> getDoctorFreeSlots(int clinicID, int projectID, int doctorId, {Function(dynamic)? onSuccess, Function(String)? onError}); | 
		
	
		
			
				|  |  |  |  |   Future<Either<Failure, GenericApiModel<dynamic>>> getDoctorFreeSlots(int clinicID, int projectID, int doctorId, bool isBookingForLiveCare, | 
		
	
		
			
				|  |  |  |  |       {Function(dynamic)? onSuccess, Function(String)? onError}); | 
		
	
		
			
				|  |  |  |  | } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | class BookAppointmentsRepoImp implements BookAppointmentsRepo { | 
		
	
	
		
			
				
					|  |  |  | @ -175,8 +176,54 @@ class BookAppointmentsRepoImp implements BookAppointmentsRepo { | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
		
			
				|  |  |  |  |   } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   //TODO: Implement the logic for Dental & laser clinics | 
		
	
		
			
				|  |  |  |  |   @override | 
		
	
		
			
				|  |  |  |  |   Future<Either<Failure, GenericApiModel<DoctorsProfileResponseModel>>> getDoctorFreeSlots(int clinicID, int projectID, int doctorId, {Function(dynamic)? onSuccess, Function(String)? onError}) { | 
		
	
		
			
				|  |  |  |  |     throw UnimplementedError(); | 
		
	
		
			
				|  |  |  |  |   Future<Either<Failure, GenericApiModel<dynamic>>> getDoctorFreeSlots(int clinicID, int projectID, int doctorId, bool isBookingForLiveCare, | 
		
	
		
			
				|  |  |  |  |       {Function(dynamic)? onSuccess, Function(String)? onError}) async { | 
		
	
		
			
				|  |  |  |  |     Map<String, dynamic> mapDevice = { | 
		
	
		
			
				|  |  |  |  |       "DoctorID": doctorId, | 
		
	
		
			
				|  |  |  |  |       "IsBookingForLiveCare": isBookingForLiveCare, | 
		
	
		
			
				|  |  |  |  |       "ClinicID": clinicID, | 
		
	
		
			
				|  |  |  |  |       "ProjectID": projectID, | 
		
	
		
			
				|  |  |  |  |       "OriginalClinicID": clinicID, | 
		
	
		
			
				|  |  |  |  |       "days": 0, | 
		
	
		
			
				|  |  |  |  |       "isReschadual": false, | 
		
	
		
			
				|  |  |  |  |     }; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     try { | 
		
	
		
			
				|  |  |  |  |       GenericApiModel<dynamic>? apiResponse; | 
		
	
		
			
				|  |  |  |  |       Failure? failure; | 
		
	
		
			
				|  |  |  |  |       await apiClient.post( | 
		
	
		
			
				|  |  |  |  |         GET_DOCTOR_FREE_SLOTS, | 
		
	
		
			
				|  |  |  |  |         body: mapDevice, | 
		
	
		
			
				|  |  |  |  |         onFailure: (error, statusCode, {messageStatus, failureType}) { | 
		
	
		
			
				|  |  |  |  |           failure = failureType; | 
		
	
		
			
				|  |  |  |  |         }, | 
		
	
		
			
				|  |  |  |  |         onSuccess: (response, statusCode, {messageStatus, errorMessage}) { | 
		
	
		
			
				|  |  |  |  |           try { | 
		
	
		
			
				|  |  |  |  |             final list = response['FreeTimeSlots']; | 
		
	
		
			
				|  |  |  |  |             // if (list == null || list.isEmpty) { | 
		
	
		
			
				|  |  |  |  |             //   throw Exception("lab list is empty"); | 
		
	
		
			
				|  |  |  |  |             // } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |             // final freeSlotsList = list.map((item) => DoctorsListResponseModel.fromJson(item as Map<String, dynamic>)).toList().cast<DoctorsListResponseModel>(); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |             apiResponse = GenericApiModel<List<DoctorsListResponseModel>>( | 
		
	
		
			
				|  |  |  |  |               messageStatus: messageStatus, | 
		
	
		
			
				|  |  |  |  |               statusCode: statusCode, | 
		
	
		
			
				|  |  |  |  |               errorMessage: null, | 
		
	
		
			
				|  |  |  |  |               data: response['FreeTimeSlots'], | 
		
	
		
			
				|  |  |  |  |             ); | 
		
	
		
			
				|  |  |  |  |           } 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())); | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
		
			
				|  |  |  |  |   } | 
		
	
		
			
				|  |  |  |  | } | 
		
	
	
		
			
				
					|  |  |  | 
 |