|  |  | @ -39,14 +39,27 @@ class MedicalFileViewModel extends ChangeNotifier { | 
			
		
	
		
		
			
				
					
					|  |  |  |   List<PatientMedicalReportResponseModel> patientMedicalReportCancelledList = []; |  |  |  |   List<PatientMedicalReportResponseModel> patientMedicalReportCancelledList = []; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |   List<FamilyFileResponseModelLists> patientFamilyFiles = []; |  |  |  |   List<FamilyFileResponseModelLists> patientFamilyFiles = []; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   List<FamilyFileResponseModelLists> pendingFamilyFiles = []; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |   String patientSickLeavePDFBase64 = ""; |  |  |  |   String patientSickLeavePDFBase64 = ""; | 
			
		
	
		
		
			
				
					
					|  |  |  |   String patientMedicalReportPDFBase64 = ""; |  |  |  |   String patientMedicalReportPDFBase64 = ""; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |   int selectedMedicalReportsTabIndex = 0; |  |  |  |   int selectedMedicalReportsTabIndex = 0; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   int _selectedFamilyFileTabIndex = 0; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   int get getSelectedFamilyFileTabIndex => _selectedFamilyFileTabIndex; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   set setSelectedFamilyFileTabIndex(int value) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     if (_selectedFamilyFileTabIndex != value) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       _selectedFamilyFileTabIndex = value; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       notifyListeners(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |   static final DialogService _dialogService = getIt.get<DialogService>(); |  |  |  |   static final DialogService _dialogService = getIt.get<DialogService>(); | 
			
		
	
		
		
			
				
					
					|  |  |  |   AppState _appState = getIt<AppState>(); |  |  |  |   final AppState _appState = getIt<AppState>(); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |   AuthenticationViewModel authVM = getIt.get<AuthenticationViewModel>(); |  |  |  |   AuthenticationViewModel authVM = getIt.get<AuthenticationViewModel>(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |   MedicalFileViewModel({required this.medicalFileRepo, required this.errorHandlerService}); |  |  |  |   MedicalFileViewModel({required this.medicalFileRepo, required this.errorHandlerService}); | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |   initMedicalFileProvider() { |  |  |  |   initMedicalFileProvider() { | 
			
		
	
	
		
		
			
				
					|  |  | @ -67,6 +80,14 @@ class MedicalFileViewModel extends ChangeNotifier { | 
			
		
	
		
		
			
				
					
					|  |  |  |     notifyListeners(); |  |  |  |     notifyListeners(); | 
			
		
	
		
		
			
				
					
					|  |  |  |   } |  |  |  |   } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   void onFamilyFileTabChange(int index) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     setSelectedFamilyFileTabIndex = index; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     if (index == 1) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       getAllPendingRecordsByResponseId(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     notifyListeners(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |   setIsPatientVaccineListLoading(bool isLoading) { |  |  |  |   setIsPatientVaccineListLoading(bool isLoading) { | 
			
		
	
		
		
			
				
					
					|  |  |  |     isPatientVaccineListLoading = isLoading; |  |  |  |     isPatientVaccineListLoading = isLoading; | 
			
		
	
		
		
			
				
					
					|  |  |  |     notifyListeners(); |  |  |  |     notifyListeners(); | 
			
		
	
	
		
		
			
				
					|  |  | @ -235,8 +256,8 @@ class MedicalFileViewModel extends ChangeNotifier { | 
			
		
	
		
		
			
				
					
					|  |  |  |     ); |  |  |  |     ); | 
			
		
	
		
		
			
				
					
					|  |  |  |   } |  |  |  |   } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |   Future<void> getFamilyFiles({Function(dynamic)? onSuccess, Function(String)? onError}) async { |  |  |  |   Future<void> getFamilyFiles({int? status, Function(dynamic)? onSuccess, Function(String)? onError}) async { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |     final result = await medicalFileRepo.getPatientFamilyFiles(); |  |  |  |     final result = await medicalFileRepo.getPatientFamilyFiles(status, _appState.superUserID != null ? _appState.superUserID! : _appState.getAuthenticatedUser()!.patientId!); | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     result.fold( |  |  |  |     result.fold( | 
			
		
	
		
		
			
				
					
					|  |  |  |       (failure) async => await errorHandlerService.handleError( |  |  |  |       (failure) async => await errorHandlerService.handleError( | 
			
		
	
	
		
		
			
				
					|  |  | @ -250,6 +271,7 @@ class MedicalFileViewModel extends ChangeNotifier { | 
			
		
	
		
		
			
				
					
					|  |  |  |           _dialogService.showErrorBottomSheet(message: apiResponse.errorMessage!, onOkPressed: () {}); |  |  |  |           _dialogService.showErrorBottomSheet(message: apiResponse.errorMessage!, onOkPressed: () {}); | 
			
		
	
		
		
			
				
					
					|  |  |  |         } else if (apiResponse.messageStatus == 1) { |  |  |  |         } else if (apiResponse.messageStatus == 1) { | 
			
		
	
		
		
			
				
					
					|  |  |  |           patientFamilyFiles = apiResponse.data!; |  |  |  |           patientFamilyFiles = apiResponse.data!; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |           if (apiResponse.data != null) { | 
			
		
	
		
		
			
				
					
					|  |  |  |             patientFamilyFiles.insert( |  |  |  |             patientFamilyFiles.insert( | 
			
		
	
		
		
			
				
					
					|  |  |  |               0, |  |  |  |               0, | 
			
		
	
		
		
			
				
					
					|  |  |  |               FamilyFileResponseModelLists( |  |  |  |               FamilyFileResponseModelLists( | 
			
		
	
	
		
		
			
				
					|  |  | @ -257,8 +279,72 @@ class MedicalFileViewModel extends ChangeNotifier { | 
			
		
	
		
		
			
				
					
					|  |  |  |                 patientName: '${_appState.getAuthenticatedUser()!.firstName!} ${_appState.getAuthenticatedUser()!.lastName!}', |  |  |  |                 patientName: '${_appState.getAuthenticatedUser()!.firstName!} ${_appState.getAuthenticatedUser()!.lastName!}', | 
			
		
	
		
		
			
				
					
					|  |  |  |                 isActive: true, |  |  |  |                 isActive: true, | 
			
		
	
		
		
			
				
					
					|  |  |  |                 gender: _appState.getAuthenticatedUser()!.gender!, |  |  |  |                 gender: _appState.getAuthenticatedUser()!.gender!, | 
			
		
	
		
		
			
				
					
					|  |  |  |                 responseId: _appState.getAuthenticatedUser()!.patientId), |  |  |  |                 responseId: _appState.getAuthenticatedUser()!.patientId, | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 age: _appState.getAuthenticatedUser()!.age, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 mobileNumber: _appState.getAuthenticatedUser()!.mobileNumber, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 patientIdenficationNumber: _appState.getAuthenticatedUser()!.patientIdentificationNo, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 emaiLAddress: _appState.getAuthenticatedUser()!.emailAddress, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 genderDescription: _appState.getAuthenticatedUser()!.genderDescription, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |               ), | 
			
		
	
		
		
			
				
					
					|  |  |  |             ); |  |  |  |             ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             final List<FamilyFileResponseModelLists> activeFamilyFiles = []; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             final List<FamilyFileResponseModelLists> tempPendingFamilyFiles = []; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             for (var element in apiResponse.data!) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |               if (element.status != null && element.status == FamilyFileEnum.active.toInt) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 activeFamilyFiles.add(FamilyFileResponseModelLists( | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     patientId: element.patientId, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     patientName: element.patientName!, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     isActive: element.status == FamilyFileEnum.active.toInt ? true : false, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     gender: element.gender!, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     responseId: element.patientId, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     mobileNumber: element.mobileNumber, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     age: element.age, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     patientIdenficationNumber: element.patientIdenficationNumber, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     relationship: element.relationship, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     relationshipId: element.relationshipId, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     relationshipN: element.relationshipN, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     status: element.status, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     statusDescription: element.statusDescription, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     createdOn: element.createdOn, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     editedOn: element.editedOn, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     patientDataVerified: element.patientDataVerified, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     regionId: element.regionId, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     familyRegionId: element.familyRegionId, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     genderDescription: element.genderDescription, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     genderImage: element.genderImage, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     emaiLAddress: element.emaiLAddress)); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |               } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |               if (element.status != null && element.status == FamilyFileEnum.pending.toInt) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 tempPendingFamilyFiles.add(FamilyFileResponseModelLists( | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     patientId: element.patientId, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     patientName: element.patientName!, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     isActive: element.status == FamilyFileEnum.active.toInt ? true : false, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     gender: element.gender!, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     responseId: element.patientId, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     mobileNumber: element.mobileNumber, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     age: element.age, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     patientIdenficationNumber: element.patientIdenficationNumber, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     relationship: element.relationship, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     relationshipId: element.relationshipId, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     relationshipN: element.relationshipN, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     status: element.status, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     statusDescription: element.statusDescription, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     createdOn: element.createdOn, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     editedOn: element.editedOn, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     patientDataVerified: element.patientDataVerified, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     regionId: element.regionId, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     familyRegionId: element.familyRegionId, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     genderDescription: element.genderDescription, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     genderImage: element.genderImage, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     emaiLAddress: element.emaiLAddress)); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |               } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             patientFamilyFiles.addAll(activeFamilyFiles.where((element) => !patientFamilyFiles.any((e) => e.patientId == element.patientId))); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             pendingFamilyFiles.addAll(tempPendingFamilyFiles); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |           } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |           notifyListeners(); |  |  |  |           notifyListeners(); | 
			
		
	
		
		
			
				
					
					|  |  |  |           if (onSuccess != null) { |  |  |  |           if (onSuccess != null) { | 
			
		
	
		
		
			
				
					
					|  |  |  |             onSuccess(apiResponse); |  |  |  |             onSuccess(apiResponse); | 
			
		
	
	
		
		
			
				
					|  |  | @ -278,61 +364,93 @@ class MedicalFileViewModel extends ChangeNotifier { | 
			
		
	
		
		
			
				
					
					|  |  |  |         if (apiResponse.messageStatus == 2) { |  |  |  |         if (apiResponse.messageStatus == 2) { | 
			
		
	
		
		
			
				
					
					|  |  |  |           _dialogService.showErrorBottomSheet(message: apiResponse.errorMessage!, onOkPressed: () {}); |  |  |  |           _dialogService.showErrorBottomSheet(message: apiResponse.errorMessage!, onOkPressed: () {}); | 
			
		
	
		
		
			
				
					
					|  |  |  |         } else if (apiResponse.messageStatus == 1) { |  |  |  |         } else if (apiResponse.messageStatus == 1) { | 
			
		
	
		
		
			
				
					
					|  |  |  |           print("======= Pending Records Response: ${jsonEncode(apiResponse.data)}"); |  |  |  |           if (apiResponse.data != null) { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             final List<FamilyFileResponseModelLists> tempPendingFamilyFiles = []; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             for (var element in apiResponse.data!) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |               if (element.status != null && element.status == FamilyFileEnum.pending.toInt) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 tempPendingFamilyFiles.add(FamilyFileResponseModelLists( | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     patientId: element.patientId, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     patientName: element.patientName!, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     isActive: element.status == FamilyFileEnum.active.toInt ? true : false, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     gender: element.gender, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     responseId: element.patientId, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     mobileNumber: element.mobileNumber, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     age: element.age, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     patientIdenficationNumber: element.patientIdenficationNumber, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     relationship: element.relationship, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     relationshipId: element.relationshipId, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     relationshipN: element.relationshipN, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     status: element.status, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     statusDescription: element.statusDescription, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     createdOn: element.createdOn, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     editedOn: element.editedOn, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     patientDataVerified: element.patientDataVerified, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     regionId: element.regionId, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     familyRegionId: element.familyRegionId, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     genderDescription: element.genderDescription, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     genderImage: element.genderImage, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     emaiLAddress: element.emaiLAddress)); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |               } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             pendingFamilyFiles.addAll(tempPendingFamilyFiles.where((element) => !pendingFamilyFiles.any((e) => e.patientId == element.patientId))); | 
			
		
	
		
		
			
				
					
					|  |  |  |           } |  |  |  |           } | 
			
		
	
		
		
			
				
					
					|  |  |  |       }, |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     ); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |   } |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |   Future<void> switchFamilyFiles({Function(dynamic)? onSuccess, Function(String)? onError}) async { |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     // final result = await medicalFileRepo.getPatientFamilyFiles(); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     final result = await medicalFileRepo.getPatientFamilyFiles(3,_appState.superUserID  !=null ? _appState.superUserID!  : _appState.getAuthenticatedUser()!.patientId!); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     result.fold( |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |       (failure) async => await errorHandlerService.handleError( |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         failure: failure, |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         onOkPressed: () { |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |           onError!(failure.message); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         }, |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |       ), |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |       (apiResponse) { |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         if (apiResponse.messageStatus == 2) { |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |           _dialogService.showErrorBottomSheet(message: apiResponse.errorMessage!, onOkPressed: () {}); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         } else if (apiResponse.messageStatus == 1) { |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |           patientFamilyFiles = apiResponse.data!; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |           patientFamilyFiles.insert( |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             0, |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             FamilyFileResponseModelLists( |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                 patientId: _appState.getAuthenticatedUser()!.patientId, |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                 patientName: '${_appState.getAuthenticatedUser()!.firstName!} ${_appState.getAuthenticatedUser()!.lastName!}', |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                 isActive: true, |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                 gender: _appState.getAuthenticatedUser()!.gender!, |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                 age: _appState.getAuthenticatedUser()!.age, |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                 mobileNumber:  _appState.getAuthenticatedUser()!.mobileNumber, |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                 responseId: _appState.getAuthenticatedUser()!.patientId), |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |           ); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |           notifyListeners(); |  |  |  |           notifyListeners(); | 
			
		
	
		
		
			
				
					
					|  |  |  |           if (onSuccess != null) { |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             onSuccess(apiResponse); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |           } |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         } |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |       }, |  |  |  |       }, | 
			
		
	
		
		
			
				
					
					|  |  |  |     ); |  |  |  |     ); | 
			
		
	
		
		
			
				
					
					|  |  |  |   } |  |  |  |   } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |   Future<void> switchFamilyFiles( {Function(dynamic)? onSuccess,int? responseID,int? patientID, String? phoneNumber, Function(String)? onError}) async { |  |  |  |   // Future<void> switchFamilyFiles({Function(dynamic)? onSuccess, Function(String)? onError}) async { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |     authVM.phoneNumberController.text =phoneNumber!.startsWith("0") |  |  |  |   //   // final result = await medicalFileRepo.getPatientFamilyFiles(); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |         ? phoneNumber.replaceFirst("0", "") |  |  |  |   //   final result = await medicalFileRepo.getPatientFamilyFiles(3, _appState.superUserID != null ? _appState.superUserID! : _appState.getAuthenticatedUser()!.patientId!); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |         : phoneNumber; |  |  |  |   // | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |   //   result.fold( | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |   //     (failure) async => await errorHandlerService.handleError( | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |   //       failure: failure, | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |     await authVM.checkActivationCode(activationCode: '0000', otpTypeEnum: OTPTypeEnum.sms, onWrongActivationCode: (String? str) {}, responseID: responseID, isFormFamilyFile:false, isSwitchUser: true, patientID: patientID,  ); |  |  |  |   //       onOkPressed: () { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |   //         onError!(failure.message); | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   //       }, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   //     ), | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   //     (apiResponse) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   //       if (apiResponse.messageStatus == 2) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   //         _dialogService.showErrorBottomSheet(message: apiResponse.errorMessage!, onOkPressed: () {}); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   //       } else if (apiResponse.messageStatus == 1) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   //         patientFamilyFiles = apiResponse.data!; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   //         patientFamilyFiles.insert( | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   //           0, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   //           FamilyFileResponseModelLists( | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   //               patientId: _appState.getAuthenticatedUser()!.patientId, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   //               patientName: '${_appState.getAuthenticatedUser()!.firstName!} ${_appState.getAuthenticatedUser()!.lastName!}', | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   //               isActive: true, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   //               gender: _appState.getAuthenticatedUser()!.gender!, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   //               age: _appState.getAuthenticatedUser()!.age, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   //               mobileNumber: _appState.getAuthenticatedUser()!.mobileNumber, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   //               responseId: _appState.getAuthenticatedUser()!.patientId), | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   //         ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   //         notifyListeners(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   //         if (onSuccess != null) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   //           onSuccess(apiResponse); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   //         } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   //       } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   //     }, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   //   ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   // } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   Future<void> switchFamilyFiles({Function(dynamic)? onSuccess, int? responseID, int? patientID, String? phoneNumber, Function(String)? onError}) async { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     authVM.phoneNumberController.text = phoneNumber!.startsWith("0") ? phoneNumber.replaceFirst("0", "") : phoneNumber; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     await authVM.checkActivationCode( | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       activationCode: '0000', | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       otpTypeEnum: OTPTypeEnum.sms, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       onWrongActivationCode: (String? str) {}, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       responseID: responseID, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       isFormFamilyFile: false, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       isSwitchUser: true, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       patientID: patientID, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     ); | 
			
		
	
		
		
			
				
					
					|  |  |  |   } |  |  |  |   } | 
			
		
	
		
		
			
				
					
					|  |  |  |   Future<void> addFamilyFile({required OTPTypeEnum otpTypeEnum, required bool isExcludedUser}) async { |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   Future<void> addFamilyFile({required OTPTypeEnum otpTypeEnum, required bool isExcludedUser}) async { | 
			
		
	
		
		
			
				
					
					|  |  |  |     LoaderBottomSheet.showLoader(); |  |  |  |     LoaderBottomSheet.showLoader(); | 
			
		
	
		
		
			
				
					
					|  |  |  |     AuthenticationViewModel authVM = getIt.get<AuthenticationViewModel>(); |  |  |  |     AuthenticationViewModel authVM = getIt.get<AuthenticationViewModel>(); | 
			
		
	
		
		
			
				
					
					|  |  |  |     NavigationService navigationService = getIt.get<NavigationService>(); |  |  |  |     NavigationService navigationService = getIt.get<NavigationService>(); | 
			
		
	
	
		
		
			
				
					|  |  | 
 |