registration updated.

merge-update-with-lab-changes
Sultan khan 4 months ago committed by haroon amjad
parent a05cea7c8b
commit 890ff874e3

@ -4,7 +4,10 @@ import 'package:hmg_patient_app/config/size_config.dart';
import 'package:hmg_patient_app/core/viewModels/project_view_model.dart';
import 'package:hmg_patient_app/models/Authentication/check_activation_code_response.dart';
import 'package:hmg_patient_app/models/Authentication/check_paitent_authentication_req.dart';
import 'package:hmg_patient_app/models/Authentication/check_user_status_reponse.dart';
import 'package:hmg_patient_app/models/Authentication/check_user_status_req.dart';
import 'package:hmg_patient_app/models/Authentication/checkpatient_for_registration.dart';
import 'package:hmg_patient_app/models/Authentication/register_info_response.dart';
import 'package:hmg_patient_app/new_ui/otp/otp_validation_bootmsheet_widget.dart';
import 'package:hmg_patient_app/pages/AlHabibMedicalService/health_calculator/carbs/carbs.dart';
import 'package:hmg_patient_app/pages/login/login-type.dart';
@ -57,7 +60,8 @@ class _RegisterNew extends State<RegisterNew> {
late bool isLoading;
int _currentIndex = 0;
String? LoginTokenID;
bool isDubai =false;
final intl.DateFormat dateFormat = intl.DateFormat('dd/MM/yyyy');
@override
void initState() {
super.initState();
@ -521,7 +525,6 @@ class _RegisterNew extends State<RegisterNew> {
}
startRegistration(type) {
final intl.DateFormat dateFormat = intl.DateFormat('dd/MM/yyyy');
// if (isButtonDisabled == false) {
var request = CheckPatientForRegistration();
@ -576,8 +579,22 @@ class _RegisterNew extends State<RegisterNew> {
cancelFunction: () {})
.showAlertDialog(context);
} else {
sendActivationCode(type, nRequest['LogInTokenID']);
final intl.DateFormat dateFormat = intl.DateFormat('dd/MM/yyyy');
nRequest['forRegister'] = true;
nRequest['isRegister'] = true;
nRequest["PatientIdentificationID"] = nRequest["PatientIdentificationID"].toString();
request.dob = isHijri == 1 ? selectedDOB!.toString() : dateFormat.format(selectedDOB!);
nRequest['isHijri'] = isHijri;
sharedPref.setObject(REGISTER_DATA_FOR_LOGIIN, nRequest);
sharedPref.setString(LOGIN_TOKEN_ID, response['LogInTokenID']);
if (request.patientOutSA == 0) {
this.chekUserData(response['LogInTokenID'], type); // ظ ;
} else {
//Dubai registration page should be navigate from here..
// Navigator.of(context).push(FadePage(page: ConfirmLogin(changePageViewIndex: widget.changePageViewIndex, fromRegistration: true, isDubai: true)));
}
}
} else {
// if (response['ErrorCode'] == '-986') {
//AppToast.showErrorToast(message: response);
@ -593,12 +610,49 @@ class _RegisterNew extends State<RegisterNew> {
}
}
sendActivationCode(type, loginTokenID) async {
chekUserData(loginToken, int type) {
// let m = hijri(this.dateOfBirth).locale('en');
// // const dateHijri = m.format('iDD/iMM/iYYYY');
// const request = {
// PatientIdentificationID: this.id.toString(),
// // TokenID: token,
// DOB: this.dateOption === '1' ? this.dateOfBirth : moment(this.dateOfBirth).format('DD/MM/YYYY'),
// IsHijri: Number(this.dateOption)
// }
GifLoaderDialogUtils.showMyDialog(context);
var request = CheckUserStatusRequest();
request.patientIdentificationID = nationalIDorFile.text;
request.dOB = isHijri == 1 ? selectedDOB!.toString() : dateFormat.format(selectedDOB!);
request.isHijri = isHijri;
request.patientOutSA = countryCode == '966' ? 0 : 1;
this.authService.checkUserStatus(request).then((result) {
GifLoaderDialogUtils.hideDialog(context);
if (result is Map)
{
result = CheckUserStatusResponse.fromJson(result as Map<String, dynamic>);
sharedPref.setObject(NHIC_DATA, result);
// widget.changePageViewIndex!(1),
// Navigator.of(context).push(FadePage(page: ConfirmLogin(changePageViewIndex: widget.changePageViewIndex, fromRegistration: true))),
RegisterInfoResponse resultSet = RegisterInfoResponse.fromJson(result);
sendActivationCode(type,loginToken, result);
}
else
{
AppToast.showErrorToast(message: result != null ? result : TranslationBase.of(context).somethingWentWrong);
}
});
}
sendActivationCode(type, loginTokenID, RegisterInfoResponse nHICData) async {
LoginTokenID = loginTokenID;
var request = authService.getCommonRequest(
registerd_data: null,
deviceToken: null,
mobileNumber: mobileNo,
mobileNumber: int.parse(mobileNo),
zipCode: selectedCountry.countryCode,
patientOutSA: selectedCountry.countryCode == "966" ? 0 : 1,
loginTokenID: LoginTokenID,
@ -608,10 +662,11 @@ class _RegisterNew extends State<RegisterNew> {
// selectedOption = type;
GifLoaderDialogUtils.showMyDialog(context);
// if (healthId != null || isDubai) {
// if (!isDubai) {
// request.dob = dob; //isHijri == 1 ? dob : dateFormat2.format(dateFormat.parse(dob));
// }
// request.healthId = healthId;
if (!isDubai) {
// request.dob = dob; //isHijri == 1 ? dob : dateFormat2.format(dateFormat.parse(dob));
request.dob = nHICData.isHijri ==true ? nHICData.dateOfBirth: dateFormat.format(dateFormat.parse(nHICData.dateOfBirth!));
}
request.healthId = nHICData.healthId;
request.isHijri = isHijri;
await this.authService.sendActivationCodeRegister(request).then((result) {
GifLoaderDialogUtils.hideDialog(context);
@ -651,8 +706,11 @@ class _RegisterNew extends State<RegisterNew> {
if (result is Map)
{
result = CheckActivationCode.fromJson(result as Map<String, dynamic>),
// if (this.registerd_data != null && this.registerd_data.isRegister == true)
// {
//next registration page navigate from here.
Navigator.of(context).push(FadePage(page: RegisterNewStep2()))
// // if(widget.isDubai ==false){
// // widget.changePageViewIndex!(1),
// // if(widget.isDubai ==false){

@ -127,7 +127,7 @@ class _SavedLogin extends State<SavedLogin> {
),
Container(
margin: EdgeInsets.all(16),
child: SvgPicture.asset("assets/images/svg/apple-finder.svg", color: Colors.red, height: 54, width: 54,),),
child: SvgPicture.asset(getTypeIcons(widget.savedLoginData!.logInType!, context), color: Colors.red, height: 54, width: 54,),),
// Face ID login button
CustomButton(
text: "${TranslationBase.of(context).loginBy} ${getType(widget.savedLoginData!.logInType!, context)}",
@ -654,4 +654,15 @@ class _SavedLogin extends State<SavedLogin> {
}
});
}
String getTypeIcons(int type, BuildContext context) {
String path='assets/images/svg/';
final types = {
1: path + 'sms.svg',
2: path + 'fingerprint.svg',
3:path + 'apple-finder.svg',
4: path + 'whatsapp.svg',
};
return types[type] ?? path +'sms.svg';
}
}

@ -2,7 +2,6 @@ import 'package:flutter/gestures.dart';
import 'package:hmg_patient_app/analytics/google-analytics.dart';
import 'package:hmg_patient_app/config/config.dart';
import 'package:hmg_patient_app/config/shared_pref_kay.dart';
import 'package:hmg_patient_app/config/size_config.dart';
import 'package:hmg_patient_app/core/service/AuthenticatedUserObject.dart';
import 'package:hmg_patient_app/core/viewModels/appointment_rate_view_model.dart';
import 'package:hmg_patient_app/core/viewModels/project_view_model.dart';
@ -17,23 +16,16 @@ import 'package:hmg_patient_app/models/InPatientServices/get_admission_request_i
import 'package:hmg_patient_app/new_ui/otp/otp_validation_bootmsheet_widget.dart';
import 'package:hmg_patient_app/pages/AlHabibMedicalService/health_calculator/carbs/carbs.dart';
import 'package:hmg_patient_app/pages/landing/landing_page.dart';
import 'package:hmg_patient_app/pages/login/login-type.dart';
import 'package:hmg_patient_app/pages/login/register.dart';
import 'package:hmg_patient_app/pages/login/register_new.dart';
import 'package:hmg_patient_app/pages/login/user-login-agreement-page.dart';
import 'package:hmg_patient_app/pages/rateAppointment/rate_appointment_doctor.dart';
import 'package:hmg_patient_app/services/authentication/auth_provider.dart';
import 'package:hmg_patient_app/services/clinic_services/get_clinic_service.dart';
import 'package:hmg_patient_app/theme/colors.dart';
import 'package:hmg_patient_app/theme/theme_notifier.dart';
import 'package:hmg_patient_app/theme/theme_value.dart';
import 'package:hmg_patient_app/uitl/app_shared_preferences.dart';
import 'package:hmg_patient_app/uitl/app_toast.dart';
import 'package:hmg_patient_app/uitl/gif_loader_dialog_utils.dart';
import 'package:hmg_patient_app/uitl/translations_delegate_base.dart';
import 'package:hmg_patient_app/uitl/utils.dart';
import 'package:hmg_patient_app/widgets/buttons/defaultButton.dart';
import 'package:hmg_patient_app/widgets/drawer/langauge_picker.dart';
import 'package:hmg_patient_app/widgets/others/app_scaffold_widget.dart';
import 'package:hmg_patient_app/widgets/otp/sms-popup.dart';
import 'package:hmg_patient_app/widgets/text/app_texts_widget.dart';

@ -78,10 +78,10 @@ class Utils {
Utils.showErrorToast("Please enter your phone number.");
return null;
}
if (type == OTPType.whatsapp && !controller.text.startsWith("+966")) {
Utils.showErrorToast("WhatsApp OTP requires a phone number starting with +966.");
return null;
}
// if (type == OTPType.whatsapp && !controller.text.startsWith("+966")) {
// Utils.showErrorToast("WhatsApp OTP requires a phone number starting with +966.");
// return null;
//}
print("Requesting OTP for ${controller.text} via ${type == OTPType.whatsapp ? "WhatsApp" : "SMS"} and "
//$"{nationIdController.text}"

Loading…
Cancel
Save