|
|
|
|
@ -6,12 +6,14 @@ import 'package:hmg_patient_app_new/core/app_assets.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/core/app_export.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/core/enums.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/core/utils/utils.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/extensions/route_extensions.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/extensions/string_extensions.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/extensions/widget_extensions.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/features/blood_donation/blood_donation_view_model.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/features/habib_wallet/habib_wallet_view_model.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/features/hmg_services/models/ui_models/hmg_services_component_model.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/features/medical_file/medical_file_view_model.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/features/water_monitor/water_monitor_view_model.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/generated/locale_keys.g.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/presentation/blood_donation/blood_donation_page.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/presentation/contact_us/contact_us.dart';
|
|
|
|
|
@ -77,29 +79,31 @@ class ServicesPage extends StatelessWidget {
|
|
|
|
|
route: AppRoutes.eReferralPage,
|
|
|
|
|
),
|
|
|
|
|
HmgServicesComponentModel(
|
|
|
|
|
3,
|
|
|
|
|
"Blood Donation".needTranslation,
|
|
|
|
|
"".needTranslation,
|
|
|
|
|
AppAssets.blood_donation_icon,
|
|
|
|
|
bgColor: AppColors.bloodDonationCardColor,
|
|
|
|
|
true,
|
|
|
|
|
route: null, onTap: () async {
|
|
|
|
|
LoaderBottomSheet.showLoader(loadingText: "Fetching Data...");
|
|
|
|
|
await bloodDonationViewModel.getRegionSelectedClinics(onSuccess: (val) async {
|
|
|
|
|
// await bloodDonationViewModel.getPatientBloodGroupDetails(onSuccess: (val) {
|
|
|
|
|
3,
|
|
|
|
|
"Blood Donation".needTranslation,
|
|
|
|
|
"".needTranslation,
|
|
|
|
|
AppAssets.blood_donation_icon,
|
|
|
|
|
bgColor: AppColors.bloodDonationCardColor,
|
|
|
|
|
true,
|
|
|
|
|
route: null,
|
|
|
|
|
onTap: () async {
|
|
|
|
|
LoaderBottomSheet.showLoader(loadingText: "Fetching Data...");
|
|
|
|
|
await bloodDonationViewModel.getRegionSelectedClinics(onSuccess: (val) async {
|
|
|
|
|
// await bloodDonationViewModel.getPatientBloodGroupDetails(onSuccess: (val) {
|
|
|
|
|
LoaderBottomSheet.hideLoader();
|
|
|
|
|
Navigator.of(GetIt.instance<NavigationService>().navigatorKey.currentContext!).push(
|
|
|
|
|
CustomPageRoute(
|
|
|
|
|
page: BloodDonationPage(),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
// }, onError: (err) {
|
|
|
|
|
// LoaderBottomSheet.hideLoader();
|
|
|
|
|
// });
|
|
|
|
|
}, onError: (err) {
|
|
|
|
|
LoaderBottomSheet.hideLoader();
|
|
|
|
|
});
|
|
|
|
|
}),
|
|
|
|
|
// }, onError: (err) {
|
|
|
|
|
// LoaderBottomSheet.hideLoader();
|
|
|
|
|
// });
|
|
|
|
|
}, onError: (err) {
|
|
|
|
|
LoaderBottomSheet.hideLoader();
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
HmgServicesComponentModel(
|
|
|
|
|
11,
|
|
|
|
|
"Covid 19 Test".needTranslation,
|
|
|
|
|
@ -143,7 +147,37 @@ class ServicesPage extends StatelessWidget {
|
|
|
|
|
AppAssets.daily_water_monitor_icon,
|
|
|
|
|
bgColor: AppColors.whiteColor,
|
|
|
|
|
true,
|
|
|
|
|
route: AppRoutes.waterConsumptionScreen,
|
|
|
|
|
route: null, // Set to null since we handle navigation in onTap
|
|
|
|
|
onTap: () async {
|
|
|
|
|
LoaderBottomSheet.showLoader(loadingText: "Fetching your water intake details.".needTranslation);
|
|
|
|
|
|
|
|
|
|
final waterMonitorVM = getIt.get<WaterMonitorViewModel>();
|
|
|
|
|
final context = getIt.get<NavigationService>().navigatorKey.currentContext!;
|
|
|
|
|
|
|
|
|
|
// Fetch user details first to check if user has data
|
|
|
|
|
await waterMonitorVM.fetchUserDetailsForMonitoring(
|
|
|
|
|
onSuccess: (userDetail) {
|
|
|
|
|
LoaderBottomSheet.hideLoader();
|
|
|
|
|
|
|
|
|
|
// Navigate based on whether user has data or not
|
|
|
|
|
if (userDetail == null) {
|
|
|
|
|
// No data found, populate form with authenticated user data
|
|
|
|
|
waterMonitorVM.populateFromAuthenticatedUser();
|
|
|
|
|
// Navigate to settings screen
|
|
|
|
|
context.navigateWithName(AppRoutes.waterMonitorSettingsScreen);
|
|
|
|
|
} else {
|
|
|
|
|
// Data exists, navigate to consumption screen
|
|
|
|
|
context.navigateWithName(AppRoutes.waterConsumptionScreen);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
onError: (error) {
|
|
|
|
|
LoaderBottomSheet.hideLoader();
|
|
|
|
|
|
|
|
|
|
// On error, navigate to consumption screen (it will handle the error state)
|
|
|
|
|
context.navigateWithName(AppRoutes.waterConsumptionScreen);
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
HmgServicesComponentModel(
|
|
|
|
|
11,
|
|
|
|
|
|