Updates & fixes

haroon_dev
haroon amjad 1 day ago
parent c9e602cfa3
commit 9986729ba5

@ -339,6 +339,7 @@ class HabibWalletViewModel extends ChangeNotifier {
Future<void> getLakumAccountInformation({Function(dynamic)? onSuccess, Function(String)? onError}) async { Future<void> getLakumAccountInformation({Function(dynamic)? onSuccess, Function(String)? onError}) async {
isLakumAccountInfoLoading = true; isLakumAccountInfoLoading = true;
lakumAccountInfo = LakumInquiryInformationResponseModel();
notifyListeners(); notifyListeners();
final result = await habibWalletRepo.getLakumAccountInformation(identificationNumber: getIt.get<AppState>().getAuthenticatedUser()!.patientIdentificationNo ?? ""); final result = await habibWalletRepo.getLakumAccountInformation(identificationNumber: getIt.get<AppState>().getAuthenticatedUser()!.patientIdentificationNo ?? "");

@ -40,7 +40,7 @@ class ProfileSettingsViewModel extends ChangeNotifier {
bool isDeactivateAccountSuccess = false; bool isDeactivateAccountSuccess = false;
String? deactivateAccountError; String? deactivateAccountError;
late GetPatientInfoForUpdate getPatientInfoForUpdate; GetPatientInfoForUpdate? getPatientInfoForUpdate;
bool isPatientProfileLoading = false; bool isPatientProfileLoading = false;
// Profile image state // Profile image state

@ -98,7 +98,7 @@ Future<void> callAppStateInitializations() async {
PlatformDispatcher.instance.onError = (error, stack) { PlatformDispatcher.instance.onError = (error, stack) {
if (!kDebugMode) { if (!kDebugMode) {
FirebaseCrashlytics.instance.recordError(error, stack, FirebaseCrashlytics.instance.recordError(error, stack,
fatal: true, fatal: false,
printDetails: true, printDetails: true,
reason: reason:
"${appState.isAuthenticated ? "Authenticated User ID: ${appState.getAuthenticatedUser()!.patientId} - ${appState.getAuthenticatedUser()!.mobileNumber}" : "Unauthenticated User"} - Uncaught asynchronous error"); "${appState.isAuthenticated ? "Authenticated User ID: ${appState.getAuthenticatedUser()!.patientId} - ${appState.getAuthenticatedUser()!.mobileNumber}" : "Unauthenticated User"} - Uncaught asynchronous error");

@ -838,8 +838,9 @@ class _AppointmentDetailsPageState extends State<AppointmentDetailsPage> {
iconSize: 36.w, iconSize: 36.w,
isLocked: false, isLocked: false,
).toShimmer2() ).toShimmer2()
: MedicalFileCard( : myAppointmentsVM.appointmentRatedResponseModel != null
label: !((myAppointmentsVM.appointmentRatedResponseModel!).isAllowedToRate ?? false) ? MedicalFileCard(
label: !(myAppointmentsVM.appointmentRatedResponseModel!.isAllowedToRate ?? false)
? LocaleKeys.ratingSubmitted.tr(context: context) ? LocaleKeys.ratingSubmitted.tr(context: context)
: LocaleKeys.doctorRatingAppointment.tr(context: context), : LocaleKeys.doctorRatingAppointment.tr(context: context),
textColor: AppColors.blackColor, textColor: AppColors.blackColor,
@ -849,7 +850,7 @@ class _AppointmentDetailsPageState extends State<AppointmentDetailsPage> {
iconSize: 36.w, iconSize: 36.w,
isLocked: !(myAppointmentsVM.appointmentRatedResponseModel!.isAllowedToRate ?? false), isLocked: !(myAppointmentsVM.appointmentRatedResponseModel!.isAllowedToRate ?? false),
).onPress(() { ).onPress(() {
if ((myAppointmentsVM.appointmentRatedResponseModel!.isAllowedToRate ?? true)) { if (myAppointmentsVM.appointmentRatedResponseModel?.isAllowedToRate ?? false) {
showCommonBottomSheetWithoutHeight( showCommonBottomSheetWithoutHeight(
context, context,
title: LocaleKeys.doctorRating.tr(context: context), title: LocaleKeys.doctorRating.tr(context: context),
@ -871,7 +872,8 @@ class _AppointmentDetailsPageState extends State<AppointmentDetailsPage> {
isFullScreen: false, isFullScreen: false,
); );
} }
}), })
: SizedBox.shrink(),
], ],
); );
}), }),

@ -43,14 +43,15 @@ class LakumWalletDetails extends StatelessWidget {
// Check if account number is not available // Check if account number is not available
if (viewModel.yahalaAccountNumber == "0" || viewModel.yahalaAccountNumber.isEmpty) { if (viewModel.yahalaAccountNumber == "0" || viewModel.yahalaAccountNumber.isEmpty) {
return Center( return Utils.getNoDataWidget(context);
child: Padding( // return Center(
padding: EdgeInsets.all(32.w), // child: Padding(
child: LocaleKeys.lakumMsg.tr().toText14( // padding: EdgeInsets.all(32.w),
color: AppColors.greyTextColor, // child: LocaleKeys.lakumMsg.tr().toText14(
), // color: AppColors.greyTextColor,
), // ),
); // ),
// );
} }
// Get all transactions // Get all transactions

@ -148,7 +148,7 @@ class _LandingPageState extends State<LandingPage> {
notificationsViewModel.initNotificationsViewModel(); notificationsViewModel.initNotificationsViewModel();
insuranceViewModel.initInsuranceProvider(); insuranceViewModel.initInsuranceProvider();
if(!appState.isRatedVisible) { if(appState.isRatedVisible) {
appointmentRatingViewModel.getLastRatingAppointment(onSuccess: (response) { appointmentRatingViewModel.getLastRatingAppointment(onSuccess: (response) {
if (appointmentRatingViewModel.appointmentRatedList.isNotEmpty) { if (appointmentRatingViewModel.appointmentRatedList.isNotEmpty) {
appointmentRatingViewModel.getAppointmentDetails(appointmentRatingViewModel.appointmentRatedList.last.appointmentNo!, appointmentRatingViewModel.appointmentRatedList.last.projectID!, appointmentRatingViewModel.getAppointmentDetails(appointmentRatingViewModel.appointmentRatedList.last.appointmentNo!, appointmentRatingViewModel.appointmentRatedList.last.projectID!,
@ -282,7 +282,7 @@ class _LandingPageState extends State<LandingPage> {
await authVM.onLoginPressed(); await authVM.onLoginPressed();
} }
}), }),
(appState.isAuthenticated && (int.parse(todoSectionVM.notificationsCount ?? "0") > 0)) (appState.isAuthenticated && todoSectionVM.notificationsCount != null && todoSectionVM.notificationsCount != "0")
? Positioned( ? Positioned(
// right: appState.isArabic() ? 8.w : -8.w, // right: appState.isArabic() ? 8.w : -8.w,
top: -8.h, top: -8.h,
@ -297,7 +297,7 @@ class _LandingPageState extends State<LandingPage> {
borderRadius: BorderRadius.circular(20.r), borderRadius: BorderRadius.circular(20.r),
), ),
child: Text( child: Text(
todoSectionVM.notificationsCount.toString(), todoSectionVM.notificationsCount ?? "0",
style: TextStyle( style: TextStyle(
color: Colors.white, color: Colors.white,
fontFamily: "Poppins", fontFamily: "Poppins",

@ -99,7 +99,7 @@ class LakumWalletCard extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.end, crossAxisAlignment: CrossAxisAlignment.end,
children: [ children: [
NumberFormat.decimalPattern() NumberFormat.decimalPattern()
.format(habibWalletVM.isLakumAccountInfoLoading ? 123 :habibWalletVM.lakumAccountInfo.pointsBalance) .format(habibWalletVM.isLakumAccountInfoLoading ? 123 : habibWalletVM.yahalaAccountNumber == "0" ? 0 : habibWalletVM.lakumAccountInfo.pointsBalance)
.toString() .toString()
.toText32(isBold: true, isEnglishOnly: true) .toText32(isBold: true, isEnglishOnly: true)
.toShimmer2(isShow: habibWalletVM.isLakumAccountInfoLoading, radius: 12.h, width: 80.h, height: 40.h), .toShimmer2(isShow: habibWalletVM.isLakumAccountInfoLoading, radius: 12.h, width: 80.h, height: 40.h),

@ -53,11 +53,17 @@ class ProfileSettingsState extends State<ProfileSettings> {
@override @override
void initState() { void initState() {
scheduleMicrotask(() { super.initState();
_loadPermissions();
// Load data after first frame
WidgetsBinding.instance.addPostFrameCallback((_) {
if (mounted) {
insuranceViewModel.initInsuranceProvider(); insuranceViewModel.initInsuranceProvider();
// Load profile settings for preferred language
profileSettingsViewModel.getProfileSettings();
}
}); });
_loadPermissions();
super.initState();
} }
@override @override
@ -96,12 +102,14 @@ class ProfileSettingsState extends State<ProfileSettings> {
final SwiperController _controller = SwiperController(); final SwiperController _controller = SwiperController();
late InsuranceViewModel insuranceViewModel; late InsuranceViewModel insuranceViewModel;
late ContactUsViewModel contactUsViewModel; late ContactUsViewModel contactUsViewModel;
late ProfileSettingsViewModel profileSettingsViewModel;
String _permissionsLabel = ""; String _permissionsLabel = "";
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
insuranceViewModel = Provider.of<InsuranceViewModel>(context, listen: false); insuranceViewModel = Provider.of<InsuranceViewModel>(context, listen: false);
contactUsViewModel = Provider.of<ContactUsViewModel>(context, listen: false); contactUsViewModel = Provider.of<ContactUsViewModel>(context, listen: false);
profileSettingsViewModel = Provider.of<ProfileSettingsViewModel>(context, listen: false);
return CollapsingListView( return CollapsingListView(
title: LocaleKeys.profileAndSettings.tr(context: context), title: LocaleKeys.profileAndSettings.tr(context: context),
logout: () { logout: () {
@ -268,9 +276,9 @@ class ProfileSettingsState extends State<ProfileSettings> {
actionItem(AppAssets.language, LocaleKeys.communicationLanguage.tr(context: context), () { actionItem(AppAssets.language, LocaleKeys.communicationLanguage.tr(context: context), () {
profileVm.openPreferredLanguageBottomSheet(); profileVm.openPreferredLanguageBottomSheet();
}, },
trailingLabel: profileVm.isPatientProfileLoading trailingLabel: profileVm.isPatientProfileLoading || profileVm.getPatientInfoForUpdate == null
? "English" ? "English"
: (profileVm.getPatientInfoForUpdate.preferredLanguage! == "1" ? LocaleKeys.arabic.tr(context: context) : LocaleKeys.english.tr(context: context)), : (profileVm.getPatientInfoForUpdate!.preferredLanguage! == "1" ? LocaleKeys.arabic.tr(context: context) : LocaleKeys.english.tr(context: context)),
isShowLoading: profileVm.isPatientProfileLoading), isShowLoading: profileVm.isPatientProfileLoading),
1.divider, 1.divider,
actionItem(AppAssets.smart_phone_fill, LocaleKeys.emrgNo.tr(context: context), () { actionItem(AppAssets.smart_phone_fill, LocaleKeys.emrgNo.tr(context: context), () {

@ -29,7 +29,7 @@ class _PreferredLanguageWidgetState extends State<PreferredLanguageWidget> {
super.initState(); super.initState();
WidgetsBinding.instance.addPostFrameCallback((_) { WidgetsBinding.instance.addPostFrameCallback((_) {
setState(() { setState(() {
selectedValue = profileSettingsViewModel.getPatientInfoForUpdate.preferredLanguage!; selectedValue = profileSettingsViewModel.getPatientInfoForUpdate?.preferredLanguage!;
}); });
}); });
} }
@ -60,9 +60,9 @@ class _PreferredLanguageWidgetState extends State<PreferredLanguageWidget> {
profileSettingsViewModel!.updatePatientInfo( profileSettingsViewModel!.updatePatientInfo(
patientInfo: { patientInfo: {
"PreferredLanguage": selectedValue, "PreferredLanguage": selectedValue,
"EmailAddress": profileSettingsViewModel.getPatientInfoForUpdate.emailAddress, "EmailAddress": profileSettingsViewModel.getPatientInfoForUpdate!.emailAddress,
"EmergencyContactName": profileSettingsViewModel.getPatientInfoForUpdate.emergencyContactName, "EmergencyContactName": profileSettingsViewModel.getPatientInfoForUpdate!.emergencyContactName,
"EmergencyContactNo": profileSettingsViewModel.getPatientInfoForUpdate.emergencyContactNo, "EmergencyContactNo": profileSettingsViewModel.getPatientInfoForUpdate!.emergencyContactNo,
"IsEmailAlertRequired": true, "IsEmailAlertRequired": true,
"IsSMSAlertRequired": true, "IsSMSAlertRequired": true,
}, },

@ -39,7 +39,7 @@ class _UpdateEmailDialogState extends State<UpdateEmailDialog> {
// Set the text // Set the text
setState(() { setState(() {
textController!.text = viewModel.getPatientInfoForUpdate.emailAddress ?? ""; textController!.text = viewModel.getPatientInfoForUpdate!.emailAddress ?? "";
}); });
}); });
@ -118,10 +118,10 @@ class _UpdateEmailDialogState extends State<UpdateEmailDialog> {
LoaderBottomSheet.showLoader(loadingText: LocaleKeys.updatingEmailAddress.tr(context: context)); LoaderBottomSheet.showLoader(loadingText: LocaleKeys.updatingEmailAddress.tr(context: context));
profileSettingsViewModel!.updatePatientInfo( profileSettingsViewModel!.updatePatientInfo(
patientInfo: { patientInfo: {
"PreferredLanguage": profileSettingsViewModel!.getPatientInfoForUpdate.preferredLanguage, "PreferredLanguage": profileSettingsViewModel!.getPatientInfoForUpdate!.preferredLanguage,
"EmailAddress": textController!.text, "EmailAddress": textController!.text,
"EmergencyContactName": profileSettingsViewModel!.getPatientInfoForUpdate.emergencyContactName, "EmergencyContactName": profileSettingsViewModel!.getPatientInfoForUpdate!.emergencyContactName,
"EmergencyContactNo": profileSettingsViewModel!.getPatientInfoForUpdate.emergencyContactNo, "EmergencyContactNo": profileSettingsViewModel!.getPatientInfoForUpdate!.emergencyContactNo,
"IsEmailAlertRequired": true, "IsEmailAlertRequired": true,
"IsSMSAlertRequired": true, "IsSMSAlertRequired": true,
}, },

@ -41,7 +41,7 @@ class _UpdateEmergencyContactDialogState extends State<UpdateEmergencyContactDia
// Set the text // Set the text
setState(() { setState(() {
textController!.text = viewModel.getPatientInfoForUpdate.emergencyContactNo ?? ""; textController!.text = viewModel.getPatientInfoForUpdate!.emergencyContactNo ?? "";
}); });
}); });
@ -120,9 +120,9 @@ class _UpdateEmergencyContactDialogState extends State<UpdateEmergencyContactDia
LoaderBottomSheet.showLoader(loadingText: LocaleKeys.loadingText.tr(context: context)); LoaderBottomSheet.showLoader(loadingText: LocaleKeys.loadingText.tr(context: context));
profileSettingsViewModel!.updatePatientInfo( profileSettingsViewModel!.updatePatientInfo(
patientInfo: { patientInfo: {
"PreferredLanguage": profileSettingsViewModel!.getPatientInfoForUpdate.preferredLanguage, "PreferredLanguage": profileSettingsViewModel!.getPatientInfoForUpdate!.preferredLanguage,
"EmailAddress": profileSettingsViewModel!.getPatientInfoForUpdate.emailAddress, "EmailAddress": profileSettingsViewModel!.getPatientInfoForUpdate!.emailAddress,
"EmergencyContactName": profileSettingsViewModel!.getPatientInfoForUpdate.emergencyContactName, "EmergencyContactName": profileSettingsViewModel!.getPatientInfoForUpdate!.emergencyContactName,
"EmergencyContactNo": textController!.text, "EmergencyContactNo": textController!.text,
"IsEmailAlertRequired": true, "IsEmailAlertRequired": true,
"IsSMSAlertRequired": true, "IsSMSAlertRequired": true,

@ -302,6 +302,18 @@ class _PossibleConditionsPageState extends State<PossibleConditionsPage> {
// Set flag to indicate booking is from symptoms checker // Set flag to indicate booking is from symptoms checker
symptomsCheckerViewModel.setBookingFromSymptomsChecker(true); symptomsCheckerViewModel.setBookingFromSymptomsChecker(true);
// Check if clinicDetailsList is not empty before accessing
if (symptomsCheckerViewModel.clinicDetailsList.isEmpty) {
// Show error if no clinic details available
final dialogService = getIt<DialogService>();
dialogService.showErrorBottomSheet(
message: appState.isArabic()
? "لا توجد تفاصيل عيادة متاحة"
: "No clinic details available",
);
return;
}
// bookAppointmentsViewModel.getLocation(); // bookAppointmentsViewModel.getLocation();
bookAppointmentsViewModel.setSelectedClinic(GetClinicsListResponseModel( bookAppointmentsViewModel.setSelectedClinic(GetClinicsListResponseModel(
clinicID: symptomsCheckerViewModel.clinicDetailsList.first.clinicID, clinicID: symptomsCheckerViewModel.clinicDetailsList.first.clinicID,
@ -395,9 +407,17 @@ class _PossibleConditionsPageState extends State<PossibleConditionsPage> {
//if the region screen is opened for the dental clinic then the project id will be in the hospital list as the list is formed form the get project api //if the region screen is opened for the dental clinic then the project id will be in the hospital list as the list is formed form the get project api
var id = ""; var id = "";
if (data.regionBottomSheetType == RegionBottomSheetType.REGION_FOR_DENTAL_AND_LASER) { if (data.regionBottomSheetType == RegionBottomSheetType.REGION_FOR_DENTAL_AND_LASER) {
id = regionalViewModel.selectedHospital?.hospitalList.first.iD?.toString() ?? ""; // Check if hospitalList is not empty before accessing first
if (regionalViewModel.selectedHospital?.hospitalList != null &&
regionalViewModel.selectedHospital!.hospitalList.isNotEmpty) {
id = regionalViewModel.selectedHospital!.hospitalList.first.iD?.toString() ?? "";
}
} else { } else {
id = regionalViewModel.selectedHospital?.patientDoctorAppointmentList?.first.projectID?.toString() ?? ""; // Check if patientDoctorAppointmentList is not empty before accessing first
if (regionalViewModel.selectedHospital?.patientDoctorAppointmentList != null &&
regionalViewModel.selectedHospital!.patientDoctorAppointmentList!.isNotEmpty) {
id = regionalViewModel.selectedHospital!.patientDoctorAppointmentList!.first.projectID?.toString() ?? "";
}
} }
bookAppointmentsViewModel.setProjectID(id); bookAppointmentsViewModel.setProjectID(id);
return SizedBox.shrink(); return SizedBox.shrink();

Loading…
Cancel
Save