e-referral issue and registration crashlytics issue fixed.

dev_sultan
Sultan khan 5 hours ago
parent 8d1a54f295
commit e2adc629b8

@ -1841,5 +1841,7 @@
"thisAboveInfoPrescription": "تم تحليل الوصفة الطبية هذه بواسطة الذكاء الاصطناعي، وهي لا تُعدّ نصيحة طبية. استشر طبيبك المختص للتشخيص والعلاج.",
"liveCareNotificationPermissionsMessage": "يتطلب لايف كير أذونات الإشعارات، يرجى السماح بهذه الأذونات للمتابعة.",
"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.",
"liveCareNotificationPermissionsMessage": "LiveCare requires Notifications permission, Please allow to proceed.",
"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 {
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(
patientIMEIDataRequest: PatientInsertDeviceImei(
imei: _appState.deviceToken,
deviceTypeId: _appState.getDeviceTypeID(),
patientId: _appState.getAuthenticatedUser()!.patientId!,
patientIdentificationNo: _appState.getAuthenticatedUser()!.patientIdentificationNo!,
identificationNo: _appState.getAuthenticatedUser()!.patientIdentificationNo!,
firstName: _appState.getAuthenticatedUser()!.firstName!,
lastName: _appState.getAuthenticatedUser()!.lastName!,
patientTypeId: _appState.getAuthenticatedUser()!.patientType,
mobileNo: _appState.getAuthenticatedUser()!.mobileNumber!,
patientId: authenticatedUser.patientId!,
patientIdentificationNo: authenticatedUser.patientIdentificationNo ?? '',
identificationNo: authenticatedUser.patientIdentificationNo ?? '',
firstName: authenticatedUser.firstName ?? '',
lastName: authenticatedUser.lastName ?? '',
patientTypeId: authenticatedUser.patientType,
mobileNo: authenticatedUser.mobileNumber ?? '',
logInTypeId: loginType,
patientOutSa: _appState.getAuthenticatedUser()!.outSa!,
outSa: _appState.getAuthenticatedUser()!.outSa == 1 ? true : false,
patientOutSa: authenticatedUser.outSa ?? 0,
outSa: authenticatedUser.outSa == 1 ? true : false,
biometricEnabled: loginType == 1 || loginType == 2 ? false : true,
firstNameN: _appState.getAuthenticatedUser()!.firstNameN,
lastNameN: _appState.getAuthenticatedUser()!.lastNameN,
zipCode: _appState.getAuthenticatedUser()!.zipCode //selectedCountrySignup == CountryEnum.others ? '0': selectedCountrySignup.countryCode,
firstNameN: authenticatedUser.firstNameN,
lastNameN: authenticatedUser.lastNameN,
zipCode: authenticatedUser.zipCode //selectedCountrySignup == CountryEnum.others ? '0': selectedCountrySignup.countryCode,
)
.toJson());
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 {
final authenticatedUser = _appState.getAuthenticatedUser();
if (authenticatedUser == null || authenticatedUser.patientId == null) {
log("insertPatientDeviceData: authenticatedUser or patientId is null, skipping.");
return;
}
final resultEither = await _authenticationRepo.insertPatientDeviceData(
patientDeviceDataRequest: InsertPatientMobileDeviceInfo(
deviceToken: _appState.deviceToken,
deviceTypeId: _appState.getDeviceTypeID(),
patientId: _appState.getAuthenticatedUser()!.patientId!,
patientTypeId: _appState.getAuthenticatedUser()!.patientType,
patientOutSa: _appState.getAuthenticatedUser()!.outSa!,
patientId: authenticatedUser.patientId!,
patientTypeId: authenticatedUser.patientType,
patientOutSa: authenticatedUser.outSa ?? 0,
loginType: loginType,
languageId: _appState.getLanguageID(),
latitude: _appState.userLat,
longitude: _appState.userLong,
voipToken: "",
deviceType: _appState.deviceTypeID,
patientMobileNumber: _appState.getAuthenticatedUser()!.mobileNumber,
nationalId: _appState.getAuthenticatedUser()!.patientIdentificationNo,
gender: _appState.getAuthenticatedUser()!.gender)
patientMobileNumber: authenticatedUser.mobileNumber,
nationalId: authenticatedUser.patientIdentificationNo,
gender: authenticatedUser.gender)
.toJson());
resultEither.fold((failure) async {
// await _errorHandlerService.handleError(failure: failure);

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

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

@ -129,6 +129,18 @@ class ReferralFormManager extends ChangeNotifier {
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() {
_errors.requesterName = null;
_errors.requesterPhone = null;

@ -289,6 +289,17 @@ class _OtherDetailsStepState extends State<OtherDetailsStep> {
}
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(
fileName: 'medical_report_${formManager.formData.medicalReportImages.length + 1}.png',
base64String: image
@ -304,6 +315,17 @@ class _OtherDetailsStepState extends State<OtherDetailsStep> {
}
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(
fileName: 'insurance_${formManager.formData.insuredPatientImages.length + 1}.png',
base64String: image

Loading…
Cancel
Save