e-referral issue and registration crashlytics issue fixed.

dev_sultan
Sultan khan 15 hours ago
parent 8d1a54f295
commit e2adc629b8

@ -1841,5 +1841,7 @@
"thisAboveInfoPrescription": "تم تحليل الوصفة الطبية هذه بواسطة الذكاء الاصطناعي، وهي لا تُعدّ نصيحة طبية. استشر طبيبك المختص للتشخيص والعلاج.", "thisAboveInfoPrescription": "تم تحليل الوصفة الطبية هذه بواسطة الذكاء الاصطناعي، وهي لا تُعدّ نصيحة طبية. استشر طبيبك المختص للتشخيص والعلاج.",
"liveCareNotificationPermissionsMessage": "يتطلب لايف كير أذونات الإشعارات، يرجى السماح بهذه الأذونات للمتابعة.", "liveCareNotificationPermissionsMessage": "يتطلب لايف كير أذونات الإشعارات، يرجى السماح بهذه الأذونات للمتابعة.",
"weatherIndicators": "طقس", "weatherIndicators": "طقس",
"submitRating": "إرسال التقييم" "submitRating": "إرسال التقييم",
"maxOneFileAllowed": "يمكن رفع ملف واحد فقط",
"fileSizeExceedsLimit": "يجب ألا يتجاوز حجم الملف 1 ميغابايت"
} }

@ -1831,7 +1831,9 @@
"thisAboveInfoPrescription": "This prescription was analyzed by AI, and it is not medical advice. Consult your healthcare provider for diagnosis and treatment.", "thisAboveInfoPrescription": "This prescription was analyzed by AI, and it is not medical advice. Consult your healthcare provider for diagnosis and treatment.",
"liveCareNotificationPermissionsMessage": "LiveCare requires Notifications permission, Please allow to proceed.", "liveCareNotificationPermissionsMessage": "LiveCare requires Notifications permission, Please allow to proceed.",
"weatherIndicators": "Weather", "weatherIndicators": "Weather",
"submitRating": "Submit" "submitRating": "Submit",
"maxOneFileAllowed": "Only 1 file can be uploaded",
"fileSizeExceedsLimit": "File size must not exceed 1 MB"
} }

@ -1033,24 +1033,33 @@ class AuthenticationViewModel extends ChangeNotifier {
} }
Future<void> insertPatientIMEIData(int loginType) async { Future<void> insertPatientIMEIData(int loginType) async {
final authenticatedUser = _appState.getAuthenticatedUser();
if (authenticatedUser == null) {
log("insertPatientIMEIData: authenticatedUser is null, skipping.");
return;
}
if (authenticatedUser.patientId == null) {
log("insertPatientIMEIData: patientId is null, skipping.");
return;
}
final resultEither = await _authenticationRepo.insertPatientIMEIData( final resultEither = await _authenticationRepo.insertPatientIMEIData(
patientIMEIDataRequest: PatientInsertDeviceImei( patientIMEIDataRequest: PatientInsertDeviceImei(
imei: _appState.deviceToken, imei: _appState.deviceToken,
deviceTypeId: _appState.getDeviceTypeID(), deviceTypeId: _appState.getDeviceTypeID(),
patientId: _appState.getAuthenticatedUser()!.patientId!, patientId: authenticatedUser.patientId!,
patientIdentificationNo: _appState.getAuthenticatedUser()!.patientIdentificationNo!, patientIdentificationNo: authenticatedUser.patientIdentificationNo ?? '',
identificationNo: _appState.getAuthenticatedUser()!.patientIdentificationNo!, identificationNo: authenticatedUser.patientIdentificationNo ?? '',
firstName: _appState.getAuthenticatedUser()!.firstName!, firstName: authenticatedUser.firstName ?? '',
lastName: _appState.getAuthenticatedUser()!.lastName!, lastName: authenticatedUser.lastName ?? '',
patientTypeId: _appState.getAuthenticatedUser()!.patientType, patientTypeId: authenticatedUser.patientType,
mobileNo: _appState.getAuthenticatedUser()!.mobileNumber!, mobileNo: authenticatedUser.mobileNumber ?? '',
logInTypeId: loginType, logInTypeId: loginType,
patientOutSa: _appState.getAuthenticatedUser()!.outSa!, patientOutSa: authenticatedUser.outSa ?? 0,
outSa: _appState.getAuthenticatedUser()!.outSa == 1 ? true : false, outSa: authenticatedUser.outSa == 1 ? true : false,
biometricEnabled: loginType == 1 || loginType == 2 ? false : true, biometricEnabled: loginType == 1 || loginType == 2 ? false : true,
firstNameN: _appState.getAuthenticatedUser()!.firstNameN, firstNameN: authenticatedUser.firstNameN,
lastNameN: _appState.getAuthenticatedUser()!.lastNameN, lastNameN: authenticatedUser.lastNameN,
zipCode: _appState.getAuthenticatedUser()!.zipCode //selectedCountrySignup == CountryEnum.others ? '0': selectedCountrySignup.countryCode, zipCode: authenticatedUser.zipCode //selectedCountrySignup == CountryEnum.others ? '0': selectedCountrySignup.countryCode,
) )
.toJson()); .toJson());
resultEither.fold((failure) async => await _errorHandlerService.handleError(failure: failure), (apiResponse) async { resultEither.fold((failure) async => await _errorHandlerService.handleError(failure: failure), (apiResponse) async {
@ -1064,22 +1073,27 @@ class AuthenticationViewModel extends ChangeNotifier {
} }
Future<void> insertPatientDeviceData(int loginType) async { Future<void> insertPatientDeviceData(int loginType) async {
final authenticatedUser = _appState.getAuthenticatedUser();
if (authenticatedUser == null || authenticatedUser.patientId == null) {
log("insertPatientDeviceData: authenticatedUser or patientId is null, skipping.");
return;
}
final resultEither = await _authenticationRepo.insertPatientDeviceData( final resultEither = await _authenticationRepo.insertPatientDeviceData(
patientDeviceDataRequest: InsertPatientMobileDeviceInfo( patientDeviceDataRequest: InsertPatientMobileDeviceInfo(
deviceToken: _appState.deviceToken, deviceToken: _appState.deviceToken,
deviceTypeId: _appState.getDeviceTypeID(), deviceTypeId: _appState.getDeviceTypeID(),
patientId: _appState.getAuthenticatedUser()!.patientId!, patientId: authenticatedUser.patientId!,
patientTypeId: _appState.getAuthenticatedUser()!.patientType, patientTypeId: authenticatedUser.patientType,
patientOutSa: _appState.getAuthenticatedUser()!.outSa!, patientOutSa: authenticatedUser.outSa ?? 0,
loginType: loginType, loginType: loginType,
languageId: _appState.getLanguageID(), languageId: _appState.getLanguageID(),
latitude: _appState.userLat, latitude: _appState.userLat,
longitude: _appState.userLong, longitude: _appState.userLong,
voipToken: "", voipToken: "",
deviceType: _appState.deviceTypeID, deviceType: _appState.deviceTypeID,
patientMobileNumber: _appState.getAuthenticatedUser()!.mobileNumber, patientMobileNumber: authenticatedUser.mobileNumber,
nationalId: _appState.getAuthenticatedUser()!.patientIdentificationNo, nationalId: authenticatedUser.patientIdentificationNo,
gender: _appState.getAuthenticatedUser()!.gender) gender: authenticatedUser.gender)
.toJson()); .toJson());
resultEither.fold((failure) async { resultEither.fold((failure) async {
// await _errorHandlerService.handleError(failure: failure); // await _errorHandlerService.handleError(failure: failure);

@ -135,7 +135,7 @@ class HmgServicesViewModel extends ChangeNotifier {
notifyListeners(); notifyListeners();
await errorHandlerService.handleError(failure: failure); await errorHandlerService.handleError(failure: failure);
if (onError != null) { if (onError != null) {
onError(failure.toString()); onError(failure.message);
} }
}, },
(apiResponse) { (apiResponse) {
@ -168,7 +168,7 @@ class HmgServicesViewModel extends ChangeNotifier {
notifyListeners(); notifyListeners();
await errorHandlerService.handleError(failure: failure); await errorHandlerService.handleError(failure: failure);
if (onError != null) { if (onError != null) {
onError(failure.toString()); onError(failure.message);
} }
}, },
(apiResponse) { (apiResponse) {
@ -207,7 +207,7 @@ class HmgServicesViewModel extends ChangeNotifier {
notifyListeners(); notifyListeners();
await errorHandlerService.handleError(failure: failure); await errorHandlerService.handleError(failure: failure);
if (onError != null) { if (onError != null) {
onError(failure.toString()); onError(failure.message);
} }
}, },
(apiResponse) { (apiResponse) {
@ -242,7 +242,7 @@ class HmgServicesViewModel extends ChangeNotifier {
notifyListeners(); notifyListeners();
await errorHandlerService.handleError(failure: failure); await errorHandlerService.handleError(failure: failure);
if (onError != null) { if (onError != null) {
onError(failure.toString()); onError(failure.message);
} }
}, },
(apiResponse) { (apiResponse) {
@ -335,7 +335,7 @@ class HmgServicesViewModel extends ChangeNotifier {
notifyListeners(); notifyListeners();
await errorHandlerService.handleError(failure: failure); await errorHandlerService.handleError(failure: failure);
if (onError != null) { if (onError != null) {
onError(failure.toString()); onError(failure.message);
} }
}, },
(apiResponse) { (apiResponse) {
@ -379,7 +379,7 @@ class HmgServicesViewModel extends ChangeNotifier {
notifyListeners(); notifyListeners();
await errorHandlerService.handleError(failure: failure); await errorHandlerService.handleError(failure: failure);
if (onError != null) { if (onError != null) {
onError(failure.toString()); onError(failure.message);
} }
}, },
(apiResponse) { (apiResponse) {
@ -412,7 +412,7 @@ class HmgServicesViewModel extends ChangeNotifier {
notifyListeners(); notifyListeners();
await errorHandlerService.handleError(failure: failure); await errorHandlerService.handleError(failure: failure);
if (onError != null) { if (onError != null) {
onError(failure.toString()); onError(failure.message);
} }
}, },
(apiResponse) { (apiResponse) {
@ -451,7 +451,7 @@ class HmgServicesViewModel extends ChangeNotifier {
notifyListeners(); notifyListeners();
await errorHandlerService.handleError(failure: failure); await errorHandlerService.handleError(failure: failure);
if (onError != null) { if (onError != null) {
onError(failure.toString()); onError(failure.message);
} }
}, },
(apiResponse) { (apiResponse) {
@ -498,7 +498,7 @@ class HmgServicesViewModel extends ChangeNotifier {
notifyListeners(); notifyListeners();
await errorHandlerService.handleError(failure: failure); await errorHandlerService.handleError(failure: failure);
if (onError != null) { if (onError != null) {
onError(failure.toString()); onError(failure.message);
} }
}, },
(apiResponse) { (apiResponse) {
@ -577,7 +577,7 @@ class HmgServicesViewModel extends ChangeNotifier {
notifyListeners(); notifyListeners();
await errorHandlerService.handleError(failure: failure); await errorHandlerService.handleError(failure: failure);
if (onError != null) { if (onError != null) {
onError(failure.toString()); onError(failure.message);
} }
}, },
(apiResponse) { (apiResponse) {
@ -609,7 +609,7 @@ class HmgServicesViewModel extends ChangeNotifier {
notifyListeners(); notifyListeners();
await errorHandlerService.handleError(failure: failure); await errorHandlerService.handleError(failure: failure);
if (onError != null) { if (onError != null) {
onError(failure.toString()); onError(failure.message);
} }
}, },
(apiResponse) { (apiResponse) {
@ -646,7 +646,7 @@ class HmgServicesViewModel extends ChangeNotifier {
notifyListeners(); notifyListeners();
await errorHandlerService.handleError(failure: failure); await errorHandlerService.handleError(failure: failure);
if (onError != null) { if (onError != null) {
onError(failure.toString()); onError(failure.message);
} }
}, },
(apiResponse) { (apiResponse) {
@ -687,7 +687,7 @@ class HmgServicesViewModel extends ChangeNotifier {
notifyListeners(); notifyListeners();
await errorHandlerService.handleError(failure: failure); await errorHandlerService.handleError(failure: failure);
if (onError != null) { if (onError != null) {
onError(failure.toString()); onError(failure.message);
} }
}, },
(apiResponse) { (apiResponse) {
@ -718,9 +718,8 @@ class HmgServicesViewModel extends ChangeNotifier {
result.fold( result.fold(
(failure) async { (failure) async {
notifyListeners(); notifyListeners();
// await errorHandlerService.handleError(failure: failure);
if (onError != null) { if (onError != null) {
onError(failure.toString()); onError(failure.message);
} }
}, },
(apiResponse) { (apiResponse) {
@ -753,7 +752,7 @@ class HmgServicesViewModel extends ChangeNotifier {
notifyListeners(); notifyListeners();
await errorHandlerService.handleError(failure: failure); await errorHandlerService.handleError(failure: failure);
if (onError != null) { if (onError != null) {
onError(failure.toString()); onError(failure.message);
} }
}, },
(apiResponse) { (apiResponse) {
@ -837,7 +836,7 @@ class HmgServicesViewModel extends ChangeNotifier {
notifyListeners(); notifyListeners();
await errorHandlerService.handleError(failure: failure); await errorHandlerService.handleError(failure: failure);
if (onError != null) { if (onError != null) {
onError(failure.toString()); onError(failure.message);
} }
}, },
(apiResponse) { (apiResponse) {
@ -872,7 +871,7 @@ class HmgServicesViewModel extends ChangeNotifier {
notifyListeners(); notifyListeners();
await errorHandlerService.handleError(failure: failure); await errorHandlerService.handleError(failure: failure);
if (onError != null) { if (onError != null) {
onError(failure.toString()); onError(failure.message);
} }
}, },
(apiResponse) { (apiResponse) {
@ -908,7 +907,7 @@ class HmgServicesViewModel extends ChangeNotifier {
notifyListeners(); notifyListeners();
await errorHandlerService.handleError(failure: failure); await errorHandlerService.handleError(failure: failure);
if (onError != null) { if (onError != null) {
onError(failure.toString()); onError(failure.message);
} }
}, },
(apiResponse) { (apiResponse) {

@ -60,8 +60,8 @@ class _RegisterNew extends State<RegisterNewStep2> {
var name = authVM!.isUserFromUAE() var name = authVM!.isUserFromUAE()
? "" ? ""
: appState.getLanguageCode() == "en" : appState.getLanguageCode() == "en"
? ("${appState.getNHICUserData.firstNameEn!.toUpperCase()} ${appState.getNHICUserData.lastNameEn!.toUpperCase()}") ? ("${(appState.getNHICUserData.firstNameEn ?? '').toUpperCase()} ${(appState.getNHICUserData.lastNameEn ?? '').toUpperCase()}").trim()
: ("${appState.getNHICUserData.firstNameAr!.toUpperCase()} ${appState.getNHICUserData.lastNameAr!.toUpperCase()}"); : ("${(appState.getNHICUserData.firstNameAr ?? '').toUpperCase()} ${(appState.getNHICUserData.lastNameAr ?? '').toUpperCase()}").trim();
return Scaffold( return Scaffold(
backgroundColor: AppColors.bgScaffoldColor, backgroundColor: AppColors.bgScaffoldColor,
appBar: CustomAppBar( appBar: CustomAppBar(
@ -267,8 +267,8 @@ class _RegisterNew extends State<RegisterNewStep2> {
: TextInputWidget( : TextInputWidget(
labelText: LocaleKeys.maritalStatus.tr(context: context), labelText: LocaleKeys.maritalStatus.tr(context: context),
hintText: appState.isArabic() hintText: appState.isArabic()
? (MaritalStatusTypeExtension.fromValue(appState.getNHICUserData.maritalStatusCode)!.typeAr) ? (MaritalStatusTypeExtension.fromValue(appState.getNHICUserData.maritalStatusCode)?.typeAr ?? '')
: (MaritalStatusTypeExtension.fromValue(appState.getNHICUserData.maritalStatusCode)!.type), : (MaritalStatusTypeExtension.fromValue(appState.getNHICUserData.maritalStatusCode)?.type ?? ''),
isEnable: true, isEnable: true,
prefix: null, prefix: null,
isAllowRadius: false, isAllowRadius: false,
@ -352,7 +352,7 @@ class _RegisterNew extends State<RegisterNewStep2> {
), ),
TextInputWidget( TextInputWidget(
labelText: LocaleKeys.dob.tr(context: context), labelText: LocaleKeys.dob.tr(context: context),
hintText: authVM!.isUserFromUAE() ? appState.getUserRegistrationPayload.dob! : appState.getNHICUserData.dateOfBirth ?? "", hintText: authVM!.isUserFromUAE() ? (appState.getUserRegistrationPayload.dob ?? '') : (appState.getNHICUserData.dateOfBirth ?? ""),
controller: authVM!.isUserFromUAE() ? authVM!.dobController : null, controller: authVM!.isUserFromUAE() ? authVM!.dobController : null,
isEnable: false, isEnable: false,
prefix: null, prefix: null,

@ -129,6 +129,18 @@ class ReferralFormManager extends ChangeNotifier {
notifyListeners(); // Only notify when errors change notifyListeners(); // Only notify when errors change
} }
void setFieldError(String field, String? message) {
switch (field) {
case 'medicalReport':
_errors.medicalReport = message;
break;
case 'insuredDocument':
_errors.insuredDocument = message;
break;
}
notifyListeners();
}
void clearAllErrors() { void clearAllErrors() {
_errors.requesterName = null; _errors.requesterName = null;
_errors.requesterPhone = null; _errors.requesterPhone = null;

@ -289,6 +289,17 @@ class _OtherDetailsStepState extends State<OtherDetailsStep> {
} }
void _addMedicalReport(String image, File file, ReferralFormManager formManager) { void _addMedicalReport(String image, File file, ReferralFormManager formManager) {
// Max 1 file
if (formManager.formData.medicalReportImages.isNotEmpty) {
formManager.setFieldError('medicalReport', LocaleKeys.maxOneFileAllowed.tr(context: context));
return;
}
// Max 1 MB
final fileSizeInBytes = file.lengthSync();
if (fileSizeInBytes > 1 * 1024 * 1024) {
formManager.setFieldError('medicalReport', LocaleKeys.fileSizeExceedsLimit.tr(context: context));
return;
}
final newAttachment = EReferralAttachment( final newAttachment = EReferralAttachment(
fileName: 'medical_report_${formManager.formData.medicalReportImages.length + 1}.png', fileName: 'medical_report_${formManager.formData.medicalReportImages.length + 1}.png',
base64String: image base64String: image
@ -304,6 +315,17 @@ class _OtherDetailsStepState extends State<OtherDetailsStep> {
} }
void _addInsuranceDocument(String image, File file, ReferralFormManager formManager) { void _addInsuranceDocument(String image, File file, ReferralFormManager formManager) {
// Max 1 file
if (formManager.formData.insuredPatientImages.isNotEmpty) {
formManager.setFieldError('insuredDocument', LocaleKeys.maxOneFileAllowed.tr(context: context));
return;
}
// Max 1 MB
final fileSizeInBytes = file.lengthSync();
if (fileSizeInBytes > 1 * 1024 * 1024) {
formManager.setFieldError('insuredDocument', LocaleKeys.fileSizeExceedsLimit.tr(context: context));
return;
}
final newAttachment = EReferralAttachment( final newAttachment = EReferralAttachment(
fileName: 'insurance_${formManager.formData.insuredPatientImages.length + 1}.png', fileName: 'insurance_${formManager.formData.insuredPatientImages.length + 1}.png',
base64String: image base64String: image

Loading…
Cancel
Save