From 1a35201f276b4b74ace29856bd089effa0a40e3c Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Tue, 2 Nov 2021 16:41:42 +0200 Subject: [PATCH 1/4] 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, + ) + ], + ), + ), + ), + ), + ], + ), + ], + ), + ), + ) + ], + ), + ), + ); + } +} From d4927873d51b4b53b43cf7edee03a9fff9bbb68f Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Wed, 3 Nov 2021 09:20:32 +0200 Subject: [PATCH 2/4] fix lap result special --- lib/core/model/labs/all_special_lab_result_model.dart | 2 +- .../profile/lab_result/all_lab_special_result_page.dart | 5 ++++- pubspec.lock | 6 +++--- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/lib/core/model/labs/all_special_lab_result_model.dart b/lib/core/model/labs/all_special_lab_result_model.dart index ffea88de..ffdc5ee5 100644 --- a/lib/core/model/labs/all_special_lab_result_model.dart +++ b/lib/core/model/labs/all_special_lab_result_model.dart @@ -1,5 +1,5 @@ class AllSpecialLabResultModel { - int actualDoctorRate; + dynamic actualDoctorRate; dynamic admissionDate; dynamic admissionNumber; dynamic appointmentDate; diff --git a/lib/screens/patients/profile/lab_result/all_lab_special_result_page.dart b/lib/screens/patients/profile/lab_result/all_lab_special_result_page.dart index 9a7ffd63..545b4378 100644 --- a/lib/screens/patients/profile/lab_result/all_lab_special_result_page.dart +++ b/lib/screens/patients/profile/lab_result/all_lab_special_result_page.dart @@ -3,6 +3,7 @@ import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/patients/profile/lab_result/special_lab_result_details_page.dart'; +import 'package:doctor_app_flutter/util/date-utils.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-app-bar.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; @@ -174,7 +175,9 @@ class _AllLabSpecialResultState extends State { clinic: model .allSpecialLabList[index].clinicDescription, appointmentDate: - model.allSpecialLabList[index].orderDate, + AppDateUtils.getDateTimeFromServerFormat( + model.allSpecialLabList[index].createdOn, + ), orderNo: model.allSpecialLabList[index].orderNo, isShowTime: false, ), diff --git a/pubspec.lock b/pubspec.lock index 43aefcb2..53035a4a 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -692,7 +692,7 @@ packages: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.3.0-nullsafety.3" + version: "1.3.0-nullsafety.4" mime: dependency: transitive description: @@ -1026,7 +1026,7 @@ packages: name: stack_trace url: "https://pub.dartlang.org" source: hosted - version: "1.10.0-nullsafety.1" + version: "1.10.0-nullsafety.2" sticky_headers: dependency: "direct main" description: @@ -1231,5 +1231,5 @@ packages: source: hosted version: "2.2.1" sdks: - dart: ">=2.10.2 <2.11.0" + dart: ">=2.10.2 <=2.11.0-213.1.beta" flutter: ">=1.22.2 <2.0.0" From fd9e8ddb2814fb822adb5386f816a608d63a5052 Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Wed, 3 Nov 2021 09:43:43 +0200 Subject: [PATCH 3/4] actaivation code page --- .../service/PatientRegistrationService.dart | 17 +++++++++++------ .../viewModel/PatientRegistrationViewModel.dart | 17 ++++++++--------- .../register_patient/RegisterPatientPage.dart | 8 ++++++-- .../register_patient/VerifyMethodPage.dart | 4 +++- 4 files changed, 28 insertions(+), 18 deletions(-) diff --git a/lib/core/service/PatientRegistrationService.dart b/lib/core/service/PatientRegistrationService.dart index 2ca70aea..084bde69 100644 --- a/lib/core/service/PatientRegistrationService.dart +++ b/lib/core/service/PatientRegistrationService.dart @@ -6,6 +6,7 @@ import 'package:doctor_app_flutter/core/model/PatientRegistration/GetPatientInfo import 'package:doctor_app_flutter/core/model/PatientRegistration/PatientRegistrationModel.dart'; import 'package:doctor_app_flutter/core/model/PatientRegistration/SendActivationCodebyOTPNotificationTypeForRegistrationModel.dart'; import 'package:doctor_app_flutter/core/service/base/base_service.dart'; +import 'package:doctor_app_flutter/core/viewModel/PatientRegistrationViewModel.dart'; class PatientRegistrationService extends BaseService { GetPatientInfoResponseModel getPatientInfoResponseModel; @@ -37,17 +38,21 @@ class PatientRegistrationService extends BaseService { sendActivationCodeByOTPNotificationType( {SendActivationCodeByOTPNotificationTypeForRegistrationModel registrationModel, - int otpType}) async { + int otpType, + PatientRegistrationViewModel user}) async { registrationModel = SendActivationCodeByOTPNotificationTypeForRegistrationModel( oTPSendType: otpType, - patientIdentificationID: 1062938285, - patientMobileNumber: 785228065, - zipCode: "966", + patientIdentificationID: + user.checkPatientForRegistrationModel.patientIdentificationID, + patientMobileNumber: + user.checkPatientForRegistrationModel.patientMobileNumber, + zipCode: user.checkPatientForRegistrationModel.zipCode, patientOutSA: false, - mobileNo: "785228065", healthId: "30000018540264", - dOB: "31/07/1988", + dOB: user.checkPatientForRegistrationModel.dOB, + isRegister: user.checkPatientForRegistrationModel.isRegister, + isHijri: user.checkPatientForRegistrationModel.isHijri, ); hasError = false; await baseAppClient.post(SEND_ACTIVATION_CODE_BY_OTP_NOT_TYPE, diff --git a/lib/core/viewModel/PatientRegistrationViewModel.dart b/lib/core/viewModel/PatientRegistrationViewModel.dart index d8a4ea2c..f7461054 100644 --- a/lib/core/viewModel/PatientRegistrationViewModel.dart +++ b/lib/core/viewModel/PatientRegistrationViewModel.dart @@ -14,15 +14,13 @@ class PatientRegistrationViewModel extends BaseViewModel { PatientRegistrationService _patientRegistrationService = locator(); + GetPatientInfoResponseModel get getPatientInfoResponseModel => + _patientRegistrationService.getPatientInfoResponseModel; - GetPatientInfoResponseModel get getPatientInfoResponseModel =>_patientRegistrationService.getPatientInfoResponseModel; - - - CheckPatientForRegistrationModel checkPatientForRegistrationModel ; + CheckPatientForRegistrationModel checkPatientForRegistrationModel; Future checkPatientForRegistration( CheckPatientForRegistrationModel registrationModel) async { - - checkPatientForRegistrationModel =registrationModel; + checkPatientForRegistrationModel = registrationModel; setState(ViewState.BusyLocal); await _patientRegistrationService .checkPatientForRegistration(registrationModel); @@ -36,8 +34,8 @@ class PatientRegistrationViewModel extends BaseViewModel { Future getPatientInfo( GetPatientInfoRequestModel getPatientInfoRequestModel) async { setState(ViewState.BusyLocal); - await _patientRegistrationService. - getPatientInfo(getPatientInfoRequestModel); + await _patientRegistrationService + .getPatientInfo(getPatientInfoRequestModel); if (_patientRegistrationService.hasError) { error = _patientRegistrationService.error; setState(ViewState.ErrorLocal); @@ -48,7 +46,8 @@ class PatientRegistrationViewModel extends BaseViewModel { Future sendActivationCodeByOTPNotificationType( {SendActivationCodeByOTPNotificationTypeForRegistrationModel registrationModel, - int otpType}) async { + int otpType, + PatientRegistrationViewModel user}) async { setState(ViewState.Busy); await _patientRegistrationService.sendActivationCodeByOTPNotificationType( otpType: otpType); diff --git a/lib/screens/patients/register_patient/RegisterPatientPage.dart b/lib/screens/patients/register_patient/RegisterPatientPage.dart index 382dd501..efe816cf 100644 --- a/lib/screens/patients/register_patient/RegisterPatientPage.dart +++ b/lib/screens/patients/register_patient/RegisterPatientPage.dart @@ -99,8 +99,12 @@ class _RegisterPatientPageState extends State }, scrollDirection: Axis.horizontal, children: [ - RegisterSearchPatientPage(changePageViewIndex: changePageViewIndex,), - ActivationPage(model: model,), + RegisterSearchPatientPage( + changePageViewIndex: changePageViewIndex, + ), + ActivationPage( + user: model, + ), RegisterConfirmationPatientPage(), ]), ), diff --git a/lib/screens/patients/register_patient/VerifyMethodPage.dart b/lib/screens/patients/register_patient/VerifyMethodPage.dart index 885b2701..21286014 100644 --- a/lib/screens/patients/register_patient/VerifyMethodPage.dart +++ b/lib/screens/patients/register_patient/VerifyMethodPage.dart @@ -1,4 +1,5 @@ import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/model/PatientRegistration/CheckPatientForRegistrationModel.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'; @@ -7,7 +8,8 @@ import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; class ActivationPage extends StatefulWidget { - const ActivationPage({Key key}) : super(key: key); + PatientRegistrationViewModel user = PatientRegistrationViewModel(); + ActivationPage({this.user}); @override _ActivationPageState createState() => _ActivationPageState(); From 13c42b297a6621586580c1ad3ee77460568d9449 Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Wed, 3 Nov 2021 17:08:47 +0200 Subject: [PATCH 4/4] check activation code --- .../service/PatientRegistrationService.dart | 22 +- .../PatientRegistrationViewModel.dart | 205 ++++--- .../register_patient/RegisterPatientPage.dart | 12 +- .../register_patient/VerifyMethodPage.dart | 552 ++++++++++++++---- 4 files changed, 559 insertions(+), 232 deletions(-) diff --git a/lib/core/service/PatientRegistrationService.dart b/lib/core/service/PatientRegistrationService.dart index 084bde69..ed3db005 100644 --- a/lib/core/service/PatientRegistrationService.dart +++ b/lib/core/service/PatientRegistrationService.dart @@ -39,20 +39,21 @@ class PatientRegistrationService extends BaseService { {SendActivationCodeByOTPNotificationTypeForRegistrationModel registrationModel, int otpType, - PatientRegistrationViewModel user}) async { + PatientRegistrationViewModel user, + CheckPatientForRegistrationModel + checkPatientForRegistrationModel}) async { registrationModel = SendActivationCodeByOTPNotificationTypeForRegistrationModel( oTPSendType: otpType, patientIdentificationID: - user.checkPatientForRegistrationModel.patientIdentificationID, - patientMobileNumber: - user.checkPatientForRegistrationModel.patientMobileNumber, - zipCode: user.checkPatientForRegistrationModel.zipCode, + checkPatientForRegistrationModel.patientIdentificationID, + patientMobileNumber: checkPatientForRegistrationModel.patientMobileNumber, + zipCode: checkPatientForRegistrationModel.zipCode, patientOutSA: false, healthId: "30000018540264", - dOB: user.checkPatientForRegistrationModel.dOB, - isRegister: user.checkPatientForRegistrationModel.isRegister, - isHijri: user.checkPatientForRegistrationModel.isHijri, + dOB: checkPatientForRegistrationModel.dOB, + isRegister: checkPatientForRegistrationModel.isRegister, + isHijri: checkPatientForRegistrationModel.isHijri, ); hasError = false; await baseAppClient.post(SEND_ACTIVATION_CODE_BY_OTP_NOT_TYPE, @@ -69,8 +70,9 @@ class PatientRegistrationService extends BaseService { checkActivationCode(CheckActivationCodeModel registrationModel) async { hasError = false; await baseAppClient.post(CHECK_ACTIVATION_CODE_FOR_PATIENT, - onSuccess: (dynamic response, int statusCode) {}, - onFailure: (String error, int statusCode) { + onSuccess: (dynamic response, int statusCode) { + registrationModel = CheckActivationCodeModel.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 12c57ff0..aee62cad 100644 --- a/lib/core/viewModel/PatientRegistrationViewModel.dart +++ b/lib/core/viewModel/PatientRegistrationViewModel.dart @@ -14,19 +14,17 @@ class PatientRegistrationViewModel extends BaseViewModel { PatientRegistrationService _patientRegistrationService = locator(); - - GetPatientInfoResponseModel get getPatientInfoResponseModel =>_patientRegistrationService.getPatientInfoResponseModel; - - CheckPatientForRegistrationModel checkPatientForRegistrationModel ; GetPatientInfoResponseModel get getPatientInfoResponseModel => _patientRegistrationService.getPatientInfoResponseModel; CheckPatientForRegistrationModel checkPatientForRegistrationModel; + Future checkPatientForRegistration( CheckPatientForRegistrationModel registrationModel) async { checkPatientForRegistrationModel = registrationModel; - checkPatientForRegistrationModel =CheckPatientForRegistrationModel.fromJson(registrationModel.toJson()); + checkPatientForRegistrationModel = + CheckPatientForRegistrationModel.fromJson(registrationModel.toJson()); setState(ViewState.BusyLocal); await _patientRegistrationService .checkPatientForRegistration(registrationModel); @@ -40,111 +38,106 @@ class PatientRegistrationViewModel extends BaseViewModel { Future getPatientInfo( GetPatientInfoRequestModel getPatientInfoRequestModel) async { setState(ViewState.BusyLocal); + /// TODO Elham* return call service when it working - _patientRegistrationService.getPatientInfoResponseModel = GetPatientInfoResponseModel.fromJson({ - "Date": null, - "LanguageID": 0, - "ServiceName": 0, - "Time": null, - "AndroidLink": null, - "AuthenticationTokenID": null, - "Data": null, - "Dataw": false, - "DietType": 0, - "ErrorCode": null, - "ErrorEndUserMessage": null, - "ErrorEndUserMessageN": null, - "ErrorMessage": null, - "ErrorType": 0, - "FoodCategory": 0, - "IOSLink": null, - "IsAuthenticated": false, - "MealOrderStatus": 0, - "MealType": 0, - "MessageStatus": 1, - "NumberOfResultRecords": 0, - "PatientBlodType": null, - "SuccessMsg": null, - "SuccessMsgN": null, - "VidaUpdatedResponse": null, - "AccessTokenObject": null, - "Age": 33, - "ClientIdentifierId": null, - "CreatedBy": 0, - "DateOfBirth": "07/31/1988", - "FirstNameAr": "سفيان", - "FirstNameEn": "SUFIAN", - "Gender": "M", - "GenderAr": null, - "GenderEn": null, - "HealthId": "30000018540264", - "IdNumber": "1062938285", - "IdType": "NationalId", - "IsHijri": false, - "IsInstertedOrUpdated": 0, - "IsNull": 0, - "IsPatientExistNHIC": 0, - "IsRecordLockedByCurrentUser": false, - "LastNameAr": "عثمان", - "LastNameEn": "OTHMAN", - "List_ActiveAccessToken": null, - "MaritalStatus": "غير معروف", - "MaritalStatusCode": "U", - "NationalDateOfBirth": "18/12/1408", - "Nationality": "السعودية", - "NationalityCode": "SAU", - "Occupation": "طالب", - "PCDTransactionDataResultList": null, - "PCD_GetVidaPatientForManualVerificationList": null, - "PCD_NHIC_HMG_PatientDetailsMatchCalulationList": null, - "PCD_ReturnValue": 0, - "PatientStatus": "-", - "PlaceofBirth": "فينا", - "PractitionerStatusCode": null, - "PractitionerStatusDescAr": null, - "PractitionerStatusDescEn": null, - "RowCount": 0, - "SecondNameAr": "عبدالهادي", - "SecondNameEn": "ABDULHADI", - "ThirdNameAr": "احمد", - "ThirdNameEn": "A", - "YakeenVidaPatientDataStatisticsByPatientIdList": null, - "YakeenVidaPatientDataStatisticsList": null, - "YakeenVidaPatientDataStatisticsPrefferedList": null, - "accessToken": null, - "categoryCode": 0, - "categoryNameAr": null, - "categoryNameEn": null, - "constraintCode": 0, - "constraintNameAr": null, - "constraintNameEn": null, - "content": null, - "errorList": null, - "licenseExpiryDate": null, - "licenseIssuedDate": null, - "licenseStatusCode": null, - "licenseStatusDescAr": null, - "licenseStatusDescEn": null, - "organizations": null, - "registrationNumber": null, - "specialtyCode": 0, - "specialtyNameAr": null, - "specialtyNameEn": null - }); + _patientRegistrationService.getPatientInfoResponseModel = + GetPatientInfoResponseModel.fromJson({ + "Date": null, + "LanguageID": 0, + "ServiceName": 0, + "Time": null, + "AndroidLink": null, + "AuthenticationTokenID": null, + "Data": null, + "Dataw": false, + "DietType": 0, + "ErrorCode": null, + "ErrorEndUserMessage": null, + "ErrorEndUserMessageN": null, + "ErrorMessage": null, + "ErrorType": 0, + "FoodCategory": 0, + "IOSLink": null, + "IsAuthenticated": false, + "MealOrderStatus": 0, + "MealType": 0, + "MessageStatus": 1, + "NumberOfResultRecords": 0, + "PatientBlodType": null, + "SuccessMsg": null, + "SuccessMsgN": null, + "VidaUpdatedResponse": null, + "AccessTokenObject": null, + "Age": 33, + "ClientIdentifierId": null, + "CreatedBy": 0, + "DateOfBirth": "07/31/1988", + "FirstNameAr": "سفيان", + "FirstNameEn": "SUFIAN", + "Gender": "M", + "GenderAr": null, + "GenderEn": null, + "HealthId": "30000018540264", + "IdNumber": "1062938285", + "IdType": "NationalId", + "IsHijri": false, + "IsInstertedOrUpdated": 0, + "IsNull": 0, + "IsPatientExistNHIC": 0, + "IsRecordLockedByCurrentUser": false, + "LastNameAr": "عثمان", + "LastNameEn": "OTHMAN", + "List_ActiveAccessToken": null, + "MaritalStatus": "غير معروف", + "MaritalStatusCode": "U", + "NationalDateOfBirth": "18/12/1408", + "Nationality": "السعودية", + "NationalityCode": "SAU", + "Occupation": "طالب", + "PCDTransactionDataResultList": null, + "PCD_GetVidaPatientForManualVerificationList": null, + "PCD_NHIC_HMG_PatientDetailsMatchCalulationList": null, + "PCD_ReturnValue": 0, + "PatientStatus": "-", + "PlaceofBirth": "فينا", + "PractitionerStatusCode": null, + "PractitionerStatusDescAr": null, + "PractitionerStatusDescEn": null, + "RowCount": 0, + "SecondNameAr": "عبدالهادي", + "SecondNameEn": "ABDULHADI", + "ThirdNameAr": "احمد", + "ThirdNameEn": "A", + "YakeenVidaPatientDataStatisticsByPatientIdList": null, + "YakeenVidaPatientDataStatisticsList": null, + "YakeenVidaPatientDataStatisticsPrefferedList": null, + "accessToken": null, + "categoryCode": 0, + "categoryNameAr": null, + "categoryNameEn": null, + "constraintCode": 0, + "constraintNameAr": null, + "constraintNameEn": null, + "content": null, + "errorList": null, + "licenseExpiryDate": null, + "licenseIssuedDate": null, + "licenseStatusCode": null, + "licenseStatusDescAr": null, + "licenseStatusDescEn": null, + "organizations": null, + "registrationNumber": null, + "specialtyCode": 0, + "specialtyNameAr": null, + "specialtyNameEn": null + }); // await _patientRegistrationService. // getPatientInfo(getPatientInfoRequestModel); // if (_patientRegistrationService.hasError) { // error = _patientRegistrationService.error; // setState(ViewState.ErrorLocal); // } else - // setState(ViewState.Idle); - await _patientRegistrationService - .getPatientInfo(getPatientInfoRequestModel); - if (_patientRegistrationService.hasError) { - error = _patientRegistrationService.error; - setState(ViewState.ErrorLocal); - } else - setState(ViewState.Idle); + setState(ViewState.Idle); } Future sendActivationCodeByOTPNotificationType( @@ -153,8 +146,12 @@ class PatientRegistrationViewModel extends BaseViewModel { int otpType, PatientRegistrationViewModel user}) async { setState(ViewState.Busy); + print(checkPatientForRegistrationModel); + print(checkPatientForRegistrationModel); + await _patientRegistrationService.sendActivationCodeByOTPNotificationType( - otpType: otpType); + otpType: otpType, + checkPatientForRegistrationModel: checkPatientForRegistrationModel); 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 52e3b0c9..f9d6d5d3 100644 --- a/lib/screens/patients/register_patient/RegisterPatientPage.dart +++ b/lib/screens/patients/register_patient/RegisterPatientPage.dart @@ -99,16 +99,16 @@ class _RegisterPatientPageState extends State }, scrollDirection: Axis.horizontal, children: [ - RegisterSearchPatientPage(changePageViewIndex: changePageViewIndex,model: model), - RegisterConfirmationPatientPage(model: model,), - RegisterSearchPatientPage( + changePageViewIndex: changePageViewIndex, + model: model), + ActivationPage( + model: model, changePageViewIndex: changePageViewIndex, ), - ActivationPage( - user: model, + RegisterConfirmationPatientPage( + model: model, ), - RegisterConfirmationPatientPage(), ]), ), ), diff --git a/lib/screens/patients/register_patient/VerifyMethodPage.dart b/lib/screens/patients/register_patient/VerifyMethodPage.dart index 21286014..b959e0a8 100644 --- a/lib/screens/patients/register_patient/VerifyMethodPage.dart +++ b/lib/screens/patients/register_patient/VerifyMethodPage.dart @@ -2,147 +2,475 @@ import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/core/model/PatientRegistration/CheckPatientForRegistrationModel.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/util/translations_delegate_base.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:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; class ActivationPage extends StatefulWidget { - PatientRegistrationViewModel user = PatientRegistrationViewModel(); - ActivationPage({this.user}); + final PatientRegistrationViewModel model; + final Function changePageViewIndex; + ActivationPage({this.model, this.changePageViewIndex}); @override _ActivationPageState createState() => _ActivationPageState(); } class _ActivationPageState extends State { + bool isSendOtp = false; + final verifyAccountForm = GlobalKey(); + TextStyle buildTextStyle() { + return TextStyle( + fontSize: SizeConfig.textMultiplier * 3, + ); + } + + Map verifyAccountFormValue = { + 'digit1': '', + 'digit2': '', + 'digit3': '', + 'digit4': '', + }; + final focusD1 = FocusNode(); + final focusD2 = FocusNode(); + final focusD3 = FocusNode(); + final focusD4 = FocusNode(); + + TextEditingController digit1 = TextEditingController(text: ""); + TextEditingController digit2 = TextEditingController(text: ""); + TextEditingController digit3 = TextEditingController(text: ""); + TextEditingController digit4 = TextEditingController(text: ""); + @override Widget build(BuildContext context) { - return BaseView( - builder: (_, model, w) => AppScaffold( - baseViewModel: model, + return AppScaffold( + baseViewModel: widget.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, + Visibility( + //visible: isSendOtp, + child: !isSendOtp + ? 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: () async { + setState(() { + isSendOtp = true; + }); + + await widget.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, + ) + ], ), - ], + ), ), - SizedBox( - height: 20, + ), + Expanded( + child: InkWell( + onTap: () async { + isSendOtp = false; + await widget.model + .sendActivationCodeByOTPNotificationType( + otpType: 1, user: widget.model); + }, + 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, + ) + ], + ), + ), ), - 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, + ), + ) + : 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, + ), + Row( + children: [ + Center( + child: SingleChildScrollView( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Form( + key: verifyAccountForm, + child: Padding( + padding: EdgeInsets.only(top: 20), + child: Directionality( + textDirection: TextDirection.ltr, + child: Row( + mainAxisAlignment: + MainAxisAlignment.start, + children: [ + Container( + width: SizeConfig + .realScreenWidth * + 0.16, + margin: EdgeInsets.all(5), + child: TextFormField( + textInputAction: + TextInputAction.next, + style: buildTextStyle(), + autofocus: true, + maxLength: 1, + controller: digit1, + textAlign: TextAlign.center, + keyboardType: + TextInputType.number, + decoration: + buildInputDecoration( + context), + onSaved: (val) {}, + //validator: validateCodeDigit, + onFieldSubmitted: (_) { + FocusScope.of(context) + .requestFocus( + focusD2); + }, + onChanged: (val) { + if (val.length == 1) { + FocusScope.of(context) + .requestFocus( + focusD2); + verifyAccountFormValue[ + 'digit1'] = + val.trim(); + //checkValue(); + } + }, + ), + ), + Container( + width: SizeConfig + .realScreenWidth * + 0.16, + margin: EdgeInsets.all(5), + child: TextFormField( + focusNode: focusD2, + textInputAction: + TextInputAction.next, + maxLength: 1, + controller: digit2, + textAlign: TextAlign.center, + style: buildTextStyle(), + keyboardType: + TextInputType.number, + decoration: + buildInputDecoration( + context), + onSaved: (val) {}, + onFieldSubmitted: (_) { + FocusScope.of(context) + .requestFocus( + focusD3); + }, + onChanged: (val) { + if (val.length == 1) { + FocusScope.of(context) + .requestFocus( + focusD3); + verifyAccountFormValue[ + 'digit2'] = + val.trim(); + //checkValue(); + } + }, + //validator: validateCodeDigit, + ), + ), + Container( + margin: EdgeInsets.all(5), + width: SizeConfig + .realScreenWidth * + 0.16, + child: TextFormField( + focusNode: focusD3, + textInputAction: + TextInputAction.next, + maxLength: 1, + controller: digit3, + textAlign: + TextAlign.center, + style: buildTextStyle(), + keyboardType: + TextInputType.number, + decoration: + buildInputDecoration( + context), + onSaved: (val) {}, + onFieldSubmitted: (_) { + FocusScope.of(context) + .requestFocus( + focusD4); + }, + onChanged: (val) { + if (val.length == 1) { + FocusScope.of(context) + .requestFocus( + focusD4); + verifyAccountFormValue[ + 'digit3'] = + val.trim(); + //checkValue(); + } + }, + // validator: + // validateCodeDigit, + )), + Container( + margin: EdgeInsets.all(5), + width: SizeConfig + .realScreenWidth * + 0.16, + child: TextFormField( + focusNode: focusD4, + maxLength: 1, + textAlign: + TextAlign.center, + style: buildTextStyle(), + controller: digit4, + keyboardType: + TextInputType.number, + decoration: + buildInputDecoration( + context), + onFieldSubmitted: (_) { + FocusScope.of(context) + .requestFocus( + focusD4); + }, + onChanged: (val) { + if (val.length == 1) { + verifyAccountFormValue[ + 'digit4'] = + val.trim(); + //checkValue(); + } + }, + // validator: + // validateCodeDigit, + )), + ], + )), ), - ], - ), - SizedBox( - height: 20, - ), - AppText( - "Verify through WhatsApp", - fontSize: 14, - color: Color(0xFF2E303A), - fontWeight: FontWeight.bold, - ) - ], - ), + ), + Padding( + padding: const EdgeInsets.all(12.0), + child: Column( + mainAxisAlignment: + MainAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + AppText( + TranslationBase.of(context) + .validationMessage + + ' ', + fontWeight: FontWeight.w600, + fontSize: 14, + ), + // AppText( + // displayTime, + // color: Colors.red, + // textAlign: TextAlign.start, + // fontWeight: FontWeight.bold, + // fontSize: 14, + // ) + ]), + ) + ], + ))), + ], ), - ), + ], ), - ], + ), ), - ], - ), - ), ) ], ), + bottomSheet: isSendOtp + ? Container( + height: 60, + margin: EdgeInsets.symmetric(vertical: 16, horizontal: 16), + child: Row( + children: [ + Expanded( + child: Container( + child: AppButton( + title: TranslationBase.of(context).cancel, + hasBorder: true, + vPadding: 12, + hPadding: 8, + borderColor: Color(0xFFeaeaea), + color: Color(0xFFeaeaea), + fontColor: Colors.black, + fontSize: 2.2, + onPressed: () { + Navigator.of(context).pop(); + }, + ), + ), + ), + SizedBox( + width: 8, + ), + Expanded( + child: Container( + child: AppButton( + title: TranslationBase.of(context).next, + hasBorder: true, + vPadding: 12, + hPadding: 8, + borderColor: Color(0xFFB8382B), + color: Color(0xFFB8382B), + fontColor: Colors.white, + fontSize: 2.0, + onPressed: () async { + //widget.model.checkActivationCode(), + }, + ), + ), + ), + ], + ), + ) + : null); + } + + InputDecoration buildInputDecoration(BuildContext context) { + return InputDecoration( + counterText: " ", + enabledBorder: OutlineInputBorder( + borderRadius: BorderRadius.all(Radius.circular(10)), + borderSide: BorderSide(color: Colors.grey[300]), + ), + focusedBorder: OutlineInputBorder( + borderRadius: BorderRadius.all(Radius.circular(10.0)), + borderSide: BorderSide(color: Colors.grey[300]), + ), + errorBorder: OutlineInputBorder( + borderRadius: BorderRadius.all(Radius.circular(10.0)), + borderSide: BorderSide(color: Colors.grey[300]), + ), + focusedErrorBorder: OutlineInputBorder( + borderRadius: BorderRadius.all(Radius.circular(10.0)), + borderSide: BorderSide(color: Theme.of(context).errorColor), ), ); }