Merge pull request 'dev_sultan' (#306) from dev_sultan into master

Reviewed-on: https://34.17.182.140/Haroon6138/HMG_Patient_App_New/pulls/306
master
Haroon6138 19 hours ago
commit f08c2f0b0c

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

@ -1832,7 +1832,8 @@
"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",
"completedPrescriptionOrder": "Completed" "maxOneFileAllowed": "Only 1 file can be uploaded",
"fileSizeExceedsLimit": "File size must not exceed 1 MB"
} }

@ -601,7 +601,7 @@ SPEC CHECKSUMS:
OrderedSet: e539b66b644ff081c73a262d24ad552a69be3a94 OrderedSet: e539b66b644ff081c73a262d24ad552a69be3a94
package_info_plus: c0502532a26c7662a62a356cebe2692ec5fe4ec4 package_info_plus: c0502532a26c7662a62a356cebe2692ec5fe4ec4
path_provider_foundation: 0b743cbb62d8e47eab856f09262bb8c1ddcfe6ba path_provider_foundation: 0b743cbb62d8e47eab856f09262bb8c1ddcfe6ba
PayFortSDK: e12f79051ae15b2e29536771a45354900180bfcb PayFortSDK: 233eabe9a45601fdbeac67fa6e5aae46ed8faf82
permission_handler_apple: 9878588469a2b0d0fc1e048d9f43605f92e6cec2 permission_handler_apple: 9878588469a2b0d0fc1e048d9f43605f92e6cec2
Polyline: 2a1f29f87f8d9b7de868940f4f76deb8c678a5b1 Polyline: 2a1f29f87f8d9b7de868940f4f76deb8c678a5b1
PromisesObjC: f5707f49cb48b9636751c5b2e7d227e43fba9f47 PromisesObjC: f5707f49cb48b9636751c5b2e7d227e43fba9f47
@ -612,7 +612,7 @@ SPEC CHECKSUMS:
shared_preferences_foundation: 5086985c1d43c5ba4d5e69a4e8083a389e2909e6 shared_preferences_foundation: 5086985c1d43c5ba4d5e69a4e8083a389e2909e6
Solar-dev: 4612dc9878b9fed2667d23b327f1d4e54e16e8d0 Solar-dev: 4612dc9878b9fed2667d23b327f1d4e54e16e8d0
sqflite_darwin: 5a7236e3b501866c1c9befc6771dfd73ffb8702d sqflite_darwin: 5a7236e3b501866c1c9befc6771dfd73ffb8702d
SwiftProtobuf: 9e106a71456f4d3f6a3b0c8fd87ef0be085efc38 SwiftProtobuf: e1b437c8e31a4c5577b643249a0bb62ed4f02153
SwiftyGif: 706c60cf65fa2bc5ee0313beece843c8eb8194d4 SwiftyGif: 706c60cf65fa2bc5ee0313beece843c8eb8194d4
Turf: aa2ede4298009639d10db36aba1a7ebaad072a5e Turf: aa2ede4298009639d10db36aba1a7ebaad072a5e
url_launcher_ios: bb13df5870e8c4234ca12609d04010a21be43dfa url_launcher_ios: bb13df5870e8c4234ca12609d04010a21be43dfa

@ -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

@ -1042,13 +1042,13 @@ packages:
source: hosted source: hosted
version: "1.2.1" version: "1.2.1"
image_picker_android: image_picker_android:
dependency: "direct main" dependency: transitive
description: description:
name: image_picker_android name: image_picker_android
sha256: "66810af8e99b2657ee98e5c6f02064f69bb63f7a70e343937f70946c5f8c6622" sha256: "5e9bf126c37c117cf8094215373c6d561117a3cfb50ebc5add1a61dc6e224677"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "0.8.13+16" version: "0.8.13+10"
image_picker_for_web: image_picker_for_web:
dependency: transitive dependency: transitive
description: description:
@ -1082,7 +1082,7 @@ packages:
source: hosted source: hosted
version: "0.2.2+1" version: "0.2.2+1"
image_picker_platform_interface: image_picker_platform_interface:
dependency: "direct main" dependency: transitive
description: description:
name: image_picker_platform_interface name: image_picker_platform_interface
sha256: "567e056716333a1647c64bb6bd873cff7622233a5c3f694be28a583d4715690c" sha256: "567e056716333a1647c64bb6bd873cff7622233a5c3f694be28a583d4715690c"

@ -101,7 +101,9 @@ dependencies:
flutter_widget_from_html: ^0.17.1 flutter_widget_from_html: ^0.17.1
huawei_map: ^6.12.0+301 huawei_map: ^6.12.0+301
flutter_image_compress: ^2.3.0 flutter_image_compress: ^2.3.0
scrollable_positioned_list: ^0.3.8 scrollable_positioned_list: ^0.3.8
in_app_review: ^2.0.11 in_app_review: ^2.0.11
dev_dependencies: dev_dependencies:

Loading…
Cancel
Save