no message

pull/76/head
Sultan khan 1 month ago
parent d5bd99f525
commit 3acd549de7

@ -45,7 +45,7 @@ class MedicalFileViewModel extends ChangeNotifier {
int selectedMedicalReportsTabIndex = 0;
static final DialogService _dialogService = getIt.get<DialogService>();
AppState _appState = getIt<AppState>();
AuthenticationViewModel authVM = getIt.get<AuthenticationViewModel>();
MedicalFileViewModel({required this.medicalFileRepo, required this.errorHandlerService});
initMedicalFileProvider() {
@ -267,41 +267,15 @@ class MedicalFileViewModel extends ChangeNotifier {
);
}
Future<void> switchFamilyFiles({Function(dynamic)? onSuccess, Function(String)? onError}) async {
final result = await medicalFileRepo.getPatientFamilyFiles();
Future<void> switchFamilyFiles( {Function(dynamic)? onSuccess,int? responseID,int? patientID, String? phoneNumber, Function(String)? onError}) async {
authVM.phoneNumberController.text = phoneNumber!;
await authVM.checkActivationCode(activationCode: '0000', otpTypeEnum: OTPTypeEnum.sms, onWrongActivationCode: (String? str) {}, responseID: responseID, requestID: patientID, isExcludedUser: true);
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!,
responseId: _appState.getAuthenticatedUser()!.patientId),
);
notifyListeners();
if (onSuccess != null) {
onSuccess(apiResponse);
}
}
},
);
}
}
Future<void> addFamilyFile({required OTPTypeEnum otpTypeEnum, required bool isExcludedUser}) async {
AuthenticationViewModel authVM = getIt.get<AuthenticationViewModel>();
NavigationService navigationService = getIt.get<NavigationService>();
FamilyFileRequest request =
await RequestUtils.getAddFamilyRequest(nationalIDorFile: authVM.nationalIdController.text, mobileNo: authVM.phoneNumberController.text, countryCode: authVM.selectedCountrySignup.countryCode);

@ -70,7 +70,10 @@ class _FamilyMedicalScreenState extends State<FamilyMedicalScreen> {
onTabChange: (int index) {},
),
SizedBox(height: 25.h),
FamilyCards(profiles: widget.profiles, onSelect: widget.onSelect, isShowDetails: true),
FamilyCards(profiles: widget.profiles, onSelect: (FamilyFileResponseModelLists profile){
medicalVM?.switchFamilyFiles(responseID: profile.responseId, patientID: profile.patientId, phoneNumber: profile.mobileNumber);
}, isShowDetails: true),
SizedBox(height: 20.h),
],
),

Loading…
Cancel
Save