|
|
|
@ -79,23 +79,22 @@ class ServicesPage extends StatelessWidget {
|
|
|
|
route: AppRoutes.eReferralPage,
|
|
|
|
route: AppRoutes.eReferralPage,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
HmgServicesComponentModel(
|
|
|
|
HmgServicesComponentModel(
|
|
|
|
3,
|
|
|
|
3,
|
|
|
|
"Blood Donation".needTranslation,
|
|
|
|
"Blood Donation".needTranslation,
|
|
|
|
"".needTranslation,
|
|
|
|
"".needTranslation,
|
|
|
|
AppAssets.blood_donation_icon,
|
|
|
|
AppAssets.blood_donation_icon,
|
|
|
|
bgColor: AppColors.bloodDonationCardColor,
|
|
|
|
bgColor: AppColors.bloodDonationCardColor,
|
|
|
|
true,
|
|
|
|
true,
|
|
|
|
route: null,
|
|
|
|
route: null, onTap: () async {
|
|
|
|
onTap: () async {
|
|
|
|
LoaderBottomSheet.showLoader(loadingText: "Fetching Data...");
|
|
|
|
LoaderBottomSheet.showLoader(loadingText: "Fetching Data...");
|
|
|
|
await bloodDonationViewModel.getRegionSelectedClinics(onSuccess: (val) async {
|
|
|
|
await bloodDonationViewModel.getRegionSelectedClinics(onSuccess: (val) async {
|
|
|
|
// await bloodDonationViewModel.getPatientBloodGroupDetails(onSuccess: (val) {
|
|
|
|
// await bloodDonationViewModel.getPatientBloodGroupDetails(onSuccess: (val) {
|
|
|
|
LoaderBottomSheet.hideLoader();
|
|
|
|
LoaderBottomSheet.hideLoader();
|
|
|
|
Navigator.of(GetIt.instance<NavigationService>().navigatorKey.currentContext!).push(
|
|
|
|
Navigator.of(GetIt.instance<NavigationService>().navigatorKey.currentContext!).push(
|
|
|
|
CustomPageRoute(
|
|
|
|
CustomPageRoute(
|
|
|
|
page: BloodDonationPage(),
|
|
|
|
page: BloodDonationPage(),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
// }, onError: (err) {
|
|
|
|
// }, onError: (err) {
|
|
|
|
// LoaderBottomSheet.hideLoader();
|
|
|
|
// LoaderBottomSheet.hideLoader();
|
|
|
|
// });
|
|
|
|
// });
|
|
|
|
@ -159,30 +158,20 @@ class ServicesPage extends StatelessWidget {
|
|
|
|
route: null, // Set to null since we handle navigation in onTap
|
|
|
|
route: null, // Set to null since we handle navigation in onTap
|
|
|
|
onTap: () async {
|
|
|
|
onTap: () async {
|
|
|
|
LoaderBottomSheet.showLoader(loadingText: "Fetching your water intake details.".needTranslation);
|
|
|
|
LoaderBottomSheet.showLoader(loadingText: "Fetching your water intake details.".needTranslation);
|
|
|
|
|
|
|
|
|
|
|
|
final waterMonitorVM = getIt.get<WaterMonitorViewModel>();
|
|
|
|
final waterMonitorVM = getIt.get<WaterMonitorViewModel>();
|
|
|
|
final context = getIt.get<NavigationService>().navigatorKey.currentContext!;
|
|
|
|
final context = getIt.get<NavigationService>().navigatorKey.currentContext!;
|
|
|
|
|
|
|
|
|
|
|
|
// Fetch user details first to check if user has data
|
|
|
|
|
|
|
|
await waterMonitorVM.fetchUserDetailsForMonitoring(
|
|
|
|
await waterMonitorVM.fetchUserDetailsForMonitoring(
|
|
|
|
onSuccess: (userDetail) {
|
|
|
|
onSuccess: (userDetail) {
|
|
|
|
LoaderBottomSheet.hideLoader();
|
|
|
|
LoaderBottomSheet.hideLoader();
|
|
|
|
|
|
|
|
|
|
|
|
// Navigate based on whether user has data or not
|
|
|
|
|
|
|
|
if (userDetail == null) {
|
|
|
|
if (userDetail == null) {
|
|
|
|
// No data found, populate form with authenticated user data
|
|
|
|
|
|
|
|
waterMonitorVM.populateFromAuthenticatedUser();
|
|
|
|
waterMonitorVM.populateFromAuthenticatedUser();
|
|
|
|
// Navigate to settings screen
|
|
|
|
|
|
|
|
context.navigateWithName(AppRoutes.waterMonitorSettingsScreen);
|
|
|
|
context.navigateWithName(AppRoutes.waterMonitorSettingsScreen);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
// Data exists, navigate to consumption screen
|
|
|
|
|
|
|
|
context.navigateWithName(AppRoutes.waterConsumptionScreen);
|
|
|
|
context.navigateWithName(AppRoutes.waterConsumptionScreen);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
onError: (error) {
|
|
|
|
onError: (error) {
|
|
|
|
LoaderBottomSheet.hideLoader();
|
|
|
|
LoaderBottomSheet.hideLoader();
|
|
|
|
|
|
|
|
|
|
|
|
// On error, navigate to consumption screen (it will handle the error state)
|
|
|
|
|
|
|
|
context.navigateWithName(AppRoutes.waterConsumptionScreen);
|
|
|
|
context.navigateWithName(AppRoutes.waterConsumptionScreen);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|