From 1a35201f276b4b74ace29856bd089effa0a40e3c Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Tue, 2 Nov 2021 16:41:42 +0200 Subject: [PATCH] regstration activtion code --- ...PNotificationTypeForRegistrationModel.dart | 48 +++--- .../service/PatientRegistrationService.dart | 23 ++- .../PatientRegistrationViewModel.dart | 9 +- .../register_patient/RegisterPatientPage.dart | 3 +- .../VerifyActivationCodePage.dart | 48 ++++++ .../register_patient/VerifyMethodPage.dart | 147 ++++++++++++++++++ 6 files changed, 245 insertions(+), 33 deletions(-) create mode 100644 lib/screens/patients/register_patient/VerifyActivationCodePage.dart create mode 100644 lib/screens/patients/register_patient/VerifyMethodPage.dart diff --git a/lib/core/model/PatientRegistration/SendActivationCodebyOTPNotificationTypeForRegistrationModel.dart b/lib/core/model/PatientRegistration/SendActivationCodebyOTPNotificationTypeForRegistrationModel.dart index 8244a95f..8aaf2c6c 100644 --- a/lib/core/model/PatientRegistration/SendActivationCodebyOTPNotificationTypeForRegistrationModel.dart +++ b/lib/core/model/PatientRegistration/SendActivationCodebyOTPNotificationTypeForRegistrationModel.dart @@ -16,7 +16,7 @@ class SendActivationCodeByOTPNotificationTypeForRegistrationModel { int channel; String iPAdress; String generalid; - int patientOutSA; + bool patientOutSA; Null sessionID; bool isDentalAllowedBackend; int deviceTypeID; @@ -26,29 +26,29 @@ class SendActivationCodeByOTPNotificationTypeForRegistrationModel { SendActivationCodeByOTPNotificationTypeForRegistrationModel( {this.patientMobileNumber, - this.mobileNo, - this.projectOutSA, - this.loginType, - this.zipCode, - this.isRegister, - this.logInTokenID, - this.searchType, - this.patientID, - this.nationalID, - this.patientIdentificationID, - this.oTPSendType, - this.languageID, - this.versionID, - this.channel, - this.iPAdress, - this.generalid, - this.patientOutSA, - this.sessionID, - this.isDentalAllowedBackend, - this.deviceTypeID, - this.dOB, - this.isHijri, - this.healthId}); + this.mobileNo, + this.projectOutSA, + this.loginType, + this.zipCode, + this.isRegister, + this.logInTokenID, + this.searchType, + this.patientID, + this.nationalID, + this.patientIdentificationID, + this.oTPSendType, + this.languageID, + this.versionID, + this.channel, + this.iPAdress, + this.generalid, + this.patientOutSA, + this.sessionID, + this.isDentalAllowedBackend, + this.deviceTypeID, + this.dOB, + this.isHijri, + this.healthId}); SendActivationCodeByOTPNotificationTypeForRegistrationModel.fromJson( Map json) { diff --git a/lib/core/service/PatientRegistrationService.dart b/lib/core/service/PatientRegistrationService.dart index fefa9021..4f084142 100644 --- a/lib/core/service/PatientRegistrationService.dart +++ b/lib/core/service/PatientRegistrationService.dart @@ -18,12 +18,27 @@ class PatientRegistrationService extends BaseService { } sendActivationCodeByOTPNotificationType( - SendActivationCodeByOTPNotificationTypeForRegistrationModel - registrationModel) async { + {SendActivationCodeByOTPNotificationTypeForRegistrationModel + registrationModel, + int otpType}) async { + registrationModel = + SendActivationCodeByOTPNotificationTypeForRegistrationModel( + oTPSendType: otpType, + patientIdentificationID: 1062938285, + patientMobileNumber: 785228065, + zipCode: "966", + patientOutSA: false, + mobileNo: "785228065", + healthId: "30000018540264", + dOB: "31/07/1988", + ); hasError = false; await baseAppClient.post(SEND_ACTIVATION_CODE_BY_OTP_NOT_TYPE, - onSuccess: (dynamic response, int statusCode) {}, - onFailure: (String error, int statusCode) { + onSuccess: (dynamic response, int statusCode) { + registrationModel = + SendActivationCodeByOTPNotificationTypeForRegistrationModel.fromJson( + response); + }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; }, body: registrationModel.toJson()); diff --git a/lib/core/viewModel/PatientRegistrationViewModel.dart b/lib/core/viewModel/PatientRegistrationViewModel.dart index 6dddffcd..416925bb 100644 --- a/lib/core/viewModel/PatientRegistrationViewModel.dart +++ b/lib/core/viewModel/PatientRegistrationViewModel.dart @@ -25,11 +25,12 @@ class PatientRegistrationViewModel extends BaseViewModel { } Future sendActivationCodeByOTPNotificationType( - SendActivationCodeByOTPNotificationTypeForRegistrationModel - registrationModel) async { + {SendActivationCodeByOTPNotificationTypeForRegistrationModel + registrationModel, + int otpType}) async { setState(ViewState.Busy); - await _patientRegistrationService - .sendActivationCodeByOTPNotificationType(registrationModel); + await _patientRegistrationService.sendActivationCodeByOTPNotificationType( + otpType: otpType); if (_patientRegistrationService.hasError) { error = _patientRegistrationService.error; setState(ViewState.Error); diff --git a/lib/screens/patients/register_patient/RegisterPatientPage.dart b/lib/screens/patients/register_patient/RegisterPatientPage.dart index 85e46185..daef5eda 100644 --- a/lib/screens/patients/register_patient/RegisterPatientPage.dart +++ b/lib/screens/patients/register_patient/RegisterPatientPage.dart @@ -3,6 +3,7 @@ import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/patients/patient_search/patient_search_header.dart'; import 'package:doctor_app_flutter/screens/patients/profile/UCAF/page-stepper-widget.dart'; import 'package:doctor_app_flutter/screens/patients/register_patient/RegisterConfirmationPatientPage.dart'; +import 'package:doctor_app_flutter/screens/patients/register_patient/VerifyMethodPage.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart'; @@ -99,8 +100,8 @@ class _RegisterPatientPageState extends State scrollDirection: Axis.horizontal, children: [ RegisterSearchPatientPage(), + ActivationPage(), RegisterConfirmationPatientPage(), - ]), ), ), diff --git a/lib/screens/patients/register_patient/VerifyActivationCodePage.dart b/lib/screens/patients/register_patient/VerifyActivationCodePage.dart new file mode 100644 index 00000000..d58e5a3b --- /dev/null +++ b/lib/screens/patients/register_patient/VerifyActivationCodePage.dart @@ -0,0 +1,48 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/viewModel/PatientRegistrationViewModel.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:flutter/material.dart'; + +class VerifyActivationCodePage extends StatefulWidget { + const VerifyActivationCodePage({Key key}) : super(key: key); + + @override + _VerifyActivationCodePageState createState() => + _VerifyActivationCodePageState(); +} + +class _VerifyActivationCodePageState extends State { + @override + Widget build(BuildContext context) { + return BaseView( + builder: (_, model, w) => AppScaffold( + baseViewModel: model, + isShowAppBar: false, + body: Column( + children: [ + Container( + width: double.infinity, + margin: EdgeInsets.all(16.0), + child: SingleChildScrollView( + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + "Please enter the verification code sent to 02221552", + fontFamily: 'Poppins', + fontSize: SizeConfig.textMultiplier * 2.2, + fontWeight: FontWeight.w800, + ), + ], + ), + ), + ) + ], + ), + ), + ); + } +} diff --git a/lib/screens/patients/register_patient/VerifyMethodPage.dart b/lib/screens/patients/register_patient/VerifyMethodPage.dart new file mode 100644 index 00000000..885b2701 --- /dev/null +++ b/lib/screens/patients/register_patient/VerifyMethodPage.dart @@ -0,0 +1,147 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/viewModel/PatientRegistrationViewModel.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:flutter/material.dart'; +import 'package:hexcolor/hexcolor.dart'; + +class ActivationPage extends StatefulWidget { + const ActivationPage({Key key}) : super(key: key); + + @override + _ActivationPageState createState() => _ActivationPageState(); +} + +class _ActivationPageState extends State { + @override + Widget build(BuildContext context) { + return BaseView( + builder: (_, model, w) => AppScaffold( + baseViewModel: model, + isShowAppBar: false, + body: Column( + children: [ + Container( + width: double.infinity, + margin: EdgeInsets.all(16.0), + child: SingleChildScrollView( + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + "Please select how you want to be verified", + fontFamily: 'Poppins', + fontSize: SizeConfig.textMultiplier * 2.2, + fontWeight: FontWeight.w800, + ), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Expanded( + child: InkWell( + onTap: () { + model.sendActivationCodeByOTPNotificationType( + otpType: 1); + }, + child: Container( + height: + MediaQuery.of(context).size.height * 0.233, + margin: EdgeInsets.all(10), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.all( + Radius.circular(10), + ), + border: Border.all( + color: HexColor('#707070'), width: 0.1), + ), + child: Column( + children: [ + Row( + children: [ + Image.asset( + "assets/images/verify-sms.png", + height: + MediaQuery.of(context).size.height * + 0.15, + width: + MediaQuery.of(context).size.width * + 0.15, + ), + ], + ), + SizedBox( + height: 20, + ), + AppText( + "Verify through SMS", + fontSize: 14, + color: Color(0xFF2E303A), + fontWeight: FontWeight.bold, + ) + ], + ), + ), + ), + ), + Expanded( + child: InkWell( + onTap: () { + model.sendActivationCodeByOTPNotificationType( + otpType: 1); + }, + child: Container( + height: + MediaQuery.of(context).size.height * 0.233, + margin: EdgeInsets.all(10), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.all( + Radius.circular(10), + ), + border: Border.all( + color: HexColor('#707070'), width: 0.1), + ), + child: Column( + children: [ + Row( + children: [ + Image.asset( + "assets/images/verify-whtsapp.png", + height: + MediaQuery.of(context).size.height * + 0.15, + width: + MediaQuery.of(context).size.width * + 0.15, + ), + ], + ), + SizedBox( + height: 20, + ), + AppText( + "Verify through WhatsApp", + fontSize: 14, + color: Color(0xFF2E303A), + fontWeight: FontWeight.bold, + ) + ], + ), + ), + ), + ), + ], + ), + ], + ), + ), + ) + ], + ), + ), + ); + } +}