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