diff --git a/lib/features/authentication/authentication_view_model.dart b/lib/features/authentication/authentication_view_model.dart index e3c8520..07c8980 100644 --- a/lib/features/authentication/authentication_view_model.dart +++ b/lib/features/authentication/authentication_view_model.dart @@ -50,7 +50,7 @@ class AuthenticationViewModel extends ChangeNotifier { _authenticationRepo = authenticationRepo, _localAuthService = localAuthService; - final TextEditingController nationalIdController = TextEditingController(), phoneNumberController = TextEditingController(), dobController = TextEditingController(), nameController = TextEditingController(); + final TextEditingController nationalIdController = TextEditingController(), phoneNumberController = TextEditingController(), dobController = TextEditingController(), nameController = TextEditingController(), emailController = TextEditingController(); CountryEnum selectedCountrySignup = CountryEnum.saudiArabia; MaritalStatusTypeEnum? maritalStatus; GenderTypeEnum? genderType; @@ -524,7 +524,7 @@ class AuthenticationViewModel extends ChangeNotifier { } } - Future onRegisterPress({required OTPTypeEnum otpTypeEnum}) async { + Future onRegistrationStart({required OTPTypeEnum otpTypeEnum}) async { bool isOutSidePatient = selectedCountrySignup.countryCode == CountryEnum.unitedArabEmirates.countryCode ? true : false; final request = await RequestUtils.getPatientAuthenticationRequest( @@ -555,6 +555,20 @@ class AuthenticationViewModel extends ChangeNotifier { }); } + + Future onRegistrationComplete() async{ + + // if (emailAddress.text.isEmpty) { + // Utils.showErrorToast(TranslationBase.of(context).enterEmailAddress); + // return; + // } else { + // Navigator.of(context).pop(); + // registerNow(); + // } + //authVM!.clearDefaultInputValues(); + } + + Future checkUserStatusForRegistration({required dynamic response, required dynamic request}) async { if (response is Map) { _appState.setAppAuthToken = response["LogInTokenID"]; diff --git a/lib/presentation/authentication/register.dart b/lib/presentation/authentication/register.dart index 00f4808..f238582 100644 --- a/lib/presentation/authentication/register.dart +++ b/lib/presentation/authentication/register.dart @@ -222,7 +222,7 @@ class _RegisterNew extends State { child: CustomButton( text: LocaleKeys.sendOTPSMS.tr(), onPressed: () async { - await authVM.onRegisterPress(otpTypeEnum: OTPTypeEnum.sms); + await authVM.onRegistrationStart(otpTypeEnum: OTPTypeEnum.sms); }, backgroundColor: AppColors.primaryRedColor, borderColor: AppColors.primaryRedBorderColor, @@ -245,7 +245,7 @@ class _RegisterNew extends State { child: CustomButton( text: LocaleKeys.sendOTPWHATSAPP.tr(), onPressed: () async { - await authVM.onRegisterPress(otpTypeEnum: OTPTypeEnum.whatsapp); + await authVM.onRegistrationStart(otpTypeEnum: OTPTypeEnum.whatsapp); }, backgroundColor: AppColors.whiteColor, borderColor: AppColors.borderOnlyColor, diff --git a/lib/presentation/authentication/register_step2.dart b/lib/presentation/authentication/register_step2.dart index 92faaee..bd23be1 100644 --- a/lib/presentation/authentication/register_step2.dart +++ b/lib/presentation/authentication/register_step2.dart @@ -37,7 +37,6 @@ class _RegisterNew extends State { @override void dispose() { super.dispose(); - // authVM!.clearDefaultInputValues(); } @override @@ -67,8 +66,7 @@ class _RegisterNew extends State { children: [ TextInputWidget( labelText: authVM!.isUserFromUAE() ? LocaleKeys.fullName.tr() : LocaleKeys.name.tr(), - hintText: - authVM!.isUserFromUAE() ? "" : ("${appState.getNHICUserData.firstNameEn!.toUpperCase()} ${appState.getNHICUserData.lastNameEn!.toUpperCase()}"), + hintText: authVM!.isUserFromUAE() ? "" : ("${appState.getNHICUserData.firstNameEn!.toUpperCase()} ${appState.getNHICUserData.lastNameEn!.toUpperCase()}"), controller: authVM!.isUserFromUAE() ? authVM!.nameController : null, isEnable: true, prefix: null, @@ -319,7 +317,7 @@ class _RegisterNew extends State { padding: EdgeInsets.only(bottom: MediaQuery.of(bottomSheetContext).viewInsets.bottom), child: SingleChildScrollView( child: GenericBottomSheet( - textController: TextEditingController(), + textController: authVM!.emailController, isForEmail: true, buttons: [ Padding( @@ -327,13 +325,7 @@ class _RegisterNew extends State { child: CustomButton( text: LocaleKeys.submit, onPressed: () { - // if (emailAddress.text.isEmpty) { - // Utils.showErrorToast(TranslationBase.of(context).enterEmailAddress); - // return; - // } else { - // Navigator.of(context).pop(); - // registerNow(); - // } + authVM!.onRegistrationComplete(); }, backgroundColor: AppColors.bgGreenColor, borderColor: AppColors.bgGreenColor,