signup completed

pull/27/head
aamir-csol 2 months ago
parent 7dcc827721
commit 8c55064158

@ -804,6 +804,7 @@ class ApiConsts {
static final String insertPatientMobileData = 'Services/MobileNotifications.svc/REST/Insert_PatientMobileDeviceInfo'; static final String insertPatientMobileData = 'Services/MobileNotifications.svc/REST/Insert_PatientMobileDeviceInfo';
static final String getPrivileges = 'Services/Patients.svc/REST/Service_Privilege'; static final String getPrivileges = 'Services/Patients.svc/REST/Service_Privilege';
static final String registerUser = 'Services/Authentication.svc/REST/PatientRegistration';
// static values for Api // static values for Api
static final double appVersionID = 18.7; static final double appVersionID = 18.7;

@ -5,6 +5,7 @@ import 'package:hmg_patient_app_new/core/common_models/privilege/HMCProjectListM
import 'package:hmg_patient_app_new/core/common_models/privilege/PrivilegeModel.dart'; import 'package:hmg_patient_app_new/core/common_models/privilege/PrivilegeModel.dart';
import 'package:hmg_patient_app_new/core/common_models/privilege/ProjectDetailListModel.dart'; import 'package:hmg_patient_app_new/core/common_models/privilege/ProjectDetailListModel.dart';
import 'package:hmg_patient_app_new/core/common_models/privilege/VidaPlusProjectListModel.dart'; import 'package:hmg_patient_app_new/core/common_models/privilege/VidaPlusProjectListModel.dart';
import 'package:hmg_patient_app_new/features/authentication/models/request_models/send_activation_request_model.dart';
import 'package:hmg_patient_app_new/features/authentication/models/resp_models/authenticated_user_resp_model.dart'; import 'package:hmg_patient_app_new/features/authentication/models/resp_models/authenticated_user_resp_model.dart';
import 'package:hmg_patient_app_new/features/authentication/models/resp_models/check_user_staus_nhic_response_model.dart'; import 'package:hmg_patient_app_new/features/authentication/models/resp_models/check_user_staus_nhic_response_model.dart';
import 'package:hmg_patient_app_new/features/authentication/models/resp_models/select_device_by_imei.dart'; import 'package:hmg_patient_app_new/features/authentication/models/resp_models/select_device_by_imei.dart';

@ -1,3 +1,5 @@
import 'package:easy_localization/easy_localization.dart';
import 'package:hijri_gregorian_calendar/hijri_gregorian_calendar.dart';
import 'package:hmg_patient_app_new/core/api_consts.dart'; import 'package:hmg_patient_app_new/core/api_consts.dart';
import 'package:hmg_patient_app_new/core/app_state.dart'; import 'package:hmg_patient_app_new/core/app_state.dart';
import 'package:hmg_patient_app_new/core/dependencies.dart'; import 'package:hmg_patient_app_new/core/dependencies.dart';
@ -63,7 +65,7 @@ class RequestUtils {
required String? deviceToken, required String? deviceToken,
required bool patientOutSA, required bool patientOutSA,
required String? loginTokenID, required String? loginTokenID,
required var registeredData, required RegistrationDataModelPayload registeredData,
int? patientId, int? patientId,
required String nationIdText, required String nationIdText,
required String countryCode, required String countryCode,
@ -84,8 +86,8 @@ class RequestUtils {
if (registeredData != null) { if (registeredData != null) {
request.searchType = registeredData.searchType ?? 1; request.searchType = registeredData.searchType ?? 1;
request.patientID = registeredData.patientID ?? 0; request.patientID = registeredData.patientId ?? 0;
request.patientIdentificationID = request.nationalID = registeredData.patientIdentificationID ?? '0'; request.patientIdentificationID = request.nationalID = (registeredData.patientIdentificationId ?? 0);
request.dob = registeredData.dob; request.dob = registeredData.dob;
request.isRegister = registeredData.isRegister; request.isRegister = registeredData.isRegister;
} else { } else {
@ -135,9 +137,10 @@ class RequestUtils {
request.patientIdentificationID = request.nationalID = payload["PatientIdentificationID"] ?? '0'; request.patientIdentificationID = request.nationalID = payload["PatientIdentificationID"] ?? '0';
request.dob = payload["DOB"]; request.dob = payload["DOB"];
request.isRegister = payload["isRegister"]; request.isRegister = payload["isRegister"];
request.healthId = _appState.getNHICUserData.healthId; request.healthId = patientOutSA ? null : _appState.getNHICUserData.healthId;
request.isHijri = payload["IsHijri"]; request.isHijri = payload["IsHijri"];
request.deviceToken = _appState.deviceToken; request.deviceToken = _appState.deviceToken;
request.projectOutSA = patientOutSA;
} else { } else {
request.searchType = isFileNo ? 2 : 1; request.searchType = isFileNo ? 2 : 1;
request.patientID = patientId ?? 0; request.patientID = patientId ?? 0;
@ -176,20 +179,25 @@ class RequestUtils {
return request; return request;
} }
static dynamic getUserSignupCompletionRequest() { static dynamic getUserSignupCompletionRequest({String? fullName, String? emailAddress, GenderTypeEnum? gender, MaritalStatusTypeEnum? maritalStatus}) {
AppState appState = getIt.get<AppState>(); AppState appState = getIt.get<AppState>();
bool isDubai = appState.getUserRegistrationPayload.patientOutSa == 1 ? true : false; bool isDubai = appState.getUserRegistrationPayload.patientOutSa == 1 ? true : false;
List<String> names = appState.getUserRegistrationPayload.fullName != null ? appState.getUserRegistrationPayload.fullName!.split(" ") : []; List<String> names = fullName != null ? fullName.split(" ") : [];
var dob = appState.getUserRegistrationPayload.dob; var dob = appState.getUserRegistrationPayload.dob;
final DateFormat dateFormat1 = DateFormat('MM/dd/yyyy');
final DateFormat dateFormat2 = DateFormat('dd/MM/yyyy');
DateTime gregorianDate = dateFormat2.parse(dob!);
HijriGregDate hijriDate = HijriGregConverter.gregorianToHijri(gregorianDate);
String? date = "${hijriDate.day}/${hijriDate.month}/${hijriDate.year}";
return { return {
"Patientobject": { "Patientobject": {
"TempValue": true, "TempValue": true,
"PatientIdentificationType": "PatientIdentificationType":
(isDubai ? appState.getNHICUserData.idNumber!.substring(0, 1) : appState.getUserRegistrationPayload.patientIdentificationId?.toString().substring(0, 1)) == "1" ? 1 : 2, (isDubai ? appState.getUserRegistrationPayload.patientIdentificationId?.toString().substring(0, 1) : appState.getNHICUserData.idNumber!.substring(0, 1)) == "1" ? 1 : 2,
"PatientIdentificationNo": isDubai ? appState.getNHICUserData.idNumber! : appState.getUserRegistrationPayload.patientIdentificationId, "PatientIdentificationNo": isDubai ? appState.getUserRegistrationPayload.patientIdentificationId.toString() : appState.getNHICUserData.idNumber.toString(),
"MobileNumber": appState.getUserRegistrationPayload.patientMobileNumber ?? 0, "MobileNumber": appState.getUserRegistrationPayload.patientMobileNumber ?? 0,
"PatientOutSA": (appState.getUserRegistrationPayload.zipCode == CountryEnum.saudiArabia.countryCode || appState.getUserRegistrationPayload.zipCode == '+966') ? 0 : 1, "PatientOutSA": (appState.getUserRegistrationPayload.zipCode == CountryEnum.saudiArabia.countryCode || appState.getUserRegistrationPayload.zipCode == '+966') ? 0 : 1,
"FirstNameN": isDubai ? "..." : appState.getNHICUserData.firstNameAr, "FirstNameN": isDubai ? "..." : appState.getNHICUserData.firstNameAr,
@ -198,19 +206,19 @@ class RequestUtils {
"MiddleName": isDubai ? "..." : appState.getNHICUserData.secondNameEn, "MiddleName": isDubai ? "..." : appState.getNHICUserData.secondNameEn,
"LastNameN": isDubai ? "..." : appState.getNHICUserData.lastNameAr, "LastNameN": isDubai ? "..." : appState.getNHICUserData.lastNameAr,
"LastName": isDubai ? (names.length > 1 ? names[1] : "...") : appState.getNHICUserData.lastNameEn, "LastName": isDubai ? (names.length > 1 ? names[1] : "...") : appState.getNHICUserData.lastNameEn,
"StrDateofBirth": dob, "StrDateofBirth": dateFormat1.format(dateFormat2.parse(dob)),
"DateofBirth": DateUtil.convertISODateToJsonDate((dob ?? "").replaceAll('/', '-')), "DateofBirth": DateUtil.convertISODateToJsonDate((dob ?? "").replaceAll('/', '-')),
"Gender": isDubai ? (appState.getUserRegistrationPayload.gender == GenderTypeEnum.male ? 1 : 2) : (appState.getNHICUserData.gender == 'M' ? 1 : 2), "Gender": isDubai ? (gender == GenderTypeEnum.male ? 1 : 2) : (appState.getNHICUserData.gender == 'M' ? 1 : 2),
"NationalityID": isDubai ? "UAE" : appState.getUserRegistrationPayload.nationalityCode, "NationalityID": isDubai ? "UAE" : appState.getNHICUserData.nationalityCode,
"eHealthIDField": isDubai ? null : appState.getNHICUserData.healthId, "eHealthIDField": isDubai ? null : appState.getNHICUserData.healthId,
"DateofBirthN": DateTime.now(), "DateofBirthN": date,
"EmailAddress": appState.getUserRegistrationPayload.emailAddress, "EmailAddress": emailAddress,
"SourceType": (appState.getUserRegistrationPayload.zipCode == CountryEnum.saudiArabia.countryCode || appState.getUserRegistrationPayload.zipCode == '+966') ? 1 : 2, "SourceType": (appState.getUserRegistrationPayload.zipCode == CountryEnum.saudiArabia.countryCode || appState.getUserRegistrationPayload.zipCode == '+966') ? "1" : "2",
"PreferredLanguage": appState.getLanguageCode() == "ar" ? (isDubai ? "1" : 1) : (isDubai ? "2" : 2), "PreferredLanguage": appState.getLanguageCode() == "ar" ? (isDubai ? "1" : 1) : (isDubai ? "2" : 2),
"Marital": isDubai "Marital": isDubai
? (appState.getUserRegistrationPayload.maritalStatus == MaritalStatusTypeEnum.single ? (maritalStatus == MaritalStatusTypeEnum.single
? '0' ? '0'
: appState.getUserRegistrationPayload.maritalStatus == MaritalStatusTypeEnum.married : maritalStatus == MaritalStatusTypeEnum.married
? '1' ? '1'
: '2') : '2')
: (appState.getNHICUserData.maritalStatusCode == 'U' : (appState.getNHICUserData.maritalStatusCode == 'U'
@ -219,12 +227,16 @@ class RequestUtils {
? '1' ? '1'
: '2'), : '2'),
}, },
"PatientIdentificationID": isDubai ? appState.getUserRegistrationPayload.patientIdentificationId : appState.getNHICUserData.idNumber, "PatientIdentificationID": isDubai ? appState.getUserRegistrationPayload.patientIdentificationId.toString() : appState.getNHICUserData.idNumber.toString(),
"PatientMobileNumber": appState.getUserRegistrationPayload.patientMobileNumber.toString()[0] == '0' "PatientMobileNumber": appState.getUserRegistrationPayload.patientMobileNumber.toString()[0] == '0'
? appState.getUserRegistrationPayload.patientMobileNumber ? appState.getUserRegistrationPayload.patientMobileNumber
: '0${appState.getUserRegistrationPayload.patientMobileNumber}', : '0${appState.getUserRegistrationPayload.patientMobileNumber}',
if (isDubai) "DOB": dob, "DOB": dob,
if (isDubai) "IsHijri": appState.getUserRegistrationPayload.isHijri, "IsHijri": appState.getUserRegistrationPayload.isHijri,
"PatientOutSA": (appState.getUserRegistrationPayload.zipCode == CountryEnum.saudiArabia.countryCode || appState.getUserRegistrationPayload.zipCode == '+966') ? 0 : 1,
"isDentalAllowedBackend": appState.getUserRegistrationPayload.isDentalAllowedBackend,
"ZipCode": appState.getUserRegistrationPayload.zipCode,
if (!isDubai) "HealthId": appState.getNHICUserData.healthId,
}; };
} }
} }

@ -32,6 +32,8 @@ abstract class AuthenticationRepo {
Future<Either<Failure, GenericApiModel<dynamic>>> checkUserStatus({required dynamic commonAuthanticatedRequest}); Future<Either<Failure, GenericApiModel<dynamic>>> checkUserStatus({required dynamic commonAuthanticatedRequest});
Future<Either<Failure, GenericApiModel<dynamic>>> registerUser({required dynamic registrationPayloadDataModelRequest});
Future<Either<Failure, GenericApiModel<dynamic>>> insertPatientIMEIData({required dynamic patientIMEIDataRequest}); Future<Either<Failure, GenericApiModel<dynamic>>> insertPatientIMEIData({required dynamic patientIMEIDataRequest});
Future<Either<Failure, GenericApiModel<dynamic>>> insertPatientDeviceData({required dynamic patientDeviceDataRequest}); Future<Either<Failure, GenericApiModel<dynamic>>> insertPatientDeviceData({required dynamic patientDeviceDataRequest});
@ -182,7 +184,6 @@ class AuthenticationRepoImp implements AuthenticationRepo {
newRequest.projectOutSA = newRequest.zipCode == '966' ? false : true; newRequest.projectOutSA = newRequest.zipCode == '966' ? false : true;
newRequest.isDentalAllowedBackend = false; newRequest.isDentalAllowedBackend = false;
newRequest.forRegisteration = newRequest.isRegister ?? false; newRequest.forRegisteration = newRequest.isRegister ?? false;
newRequest.isRegister = false; newRequest.isRegister = false;
} }
@ -357,6 +358,39 @@ class AuthenticationRepoImp implements AuthenticationRepo {
} }
} }
@override
Future<Either<Failure, GenericApiModel<dynamic>>> registerUser({required dynamic registrationPayloadDataModelRequest}) async {
try {
GenericApiModel<dynamic>? apiResponse;
Failure? failure;
await apiClient.post(
ApiConsts.registerUser,
body: registrationPayloadDataModelRequest,
onFailure: (error, statusCode, {messageStatus, failureType}) {
failure = failureType;
},
onSuccess: (response, statusCode, {messageStatus, errorMessage}) {
try {
apiResponse = GenericApiModel<dynamic>(
messageStatus: messageStatus,
statusCode: statusCode,
errorMessage: errorMessage,
data: response,
);
} catch (e) {
failure = DataParsingFailure(e.toString());
}
},
);
if (failure != null) return Left(failure!);
if (apiResponse == null) return Left(ServerFailure("Unknown error"));
return Right(apiResponse!);
} catch (e) {
return Left(UnknownFailure(e.toString()));
}
}
@override @override
Future<Either<Failure, GenericApiModel>> insertPatientIMEIData({required patientIMEIDataRequest}) { Future<Either<Failure, GenericApiModel>> insertPatientIMEIData({required patientIMEIDataRequest}) {
try { try {

@ -107,6 +107,8 @@ class AuthenticationViewModel extends ChangeNotifier {
isTermsAccepted = false; isTermsAccepted = false;
selectedCountrySignup = CountryEnum.saudiArabia; selectedCountrySignup = CountryEnum.saudiArabia;
pickedCountryByUAEUser = null; pickedCountryByUAEUser = null;
_appState.setUserRegistrationPayload = RegistrationDataModelPayload();
_appState.setNHICUserData = CheckUserStatusResponseNHIC();
} }
void onCountryChange(CountryEnum country) { void onCountryChange(CountryEnum country) {
@ -308,40 +310,27 @@ class AuthenticationViewModel extends ChangeNotifier {
} }
Future<void> sendActivationCode({required OTPTypeEnum otpTypeEnum, required String nationalIdOrFileNumber, required String phoneNumber, dynamic payload}) async { Future<void> sendActivationCode({required OTPTypeEnum otpTypeEnum, required String nationalIdOrFileNumber, required String phoneNumber, dynamic payload}) async {
bool isForRegister = checkIsUserComingForRegister(request: payload);
bool isPatientOutSA = isPatientOutsideSA(request: payload);
bool isFileNo = isPatientHasFile(request: payload);
var request = RequestUtils.getCommonRequestSendActivationCode( var request = RequestUtils.getCommonRequestSendActivationCode(
otpTypeEnum: otpTypeEnum, otpTypeEnum: otpTypeEnum,
mobileNumber: phoneNumber, mobileNumber: phoneNumber,
selectedLoginType: otpTypeEnum.toInt(), selectedLoginType: otpTypeEnum.toInt(),
zipCode: selectedCountrySignup.countryCode, zipCode: selectedCountrySignup.countryCode,
nationalId: int.parse(nationalIdOrFileNumber), nationalId: int.parse(nationalIdOrFileNumber),
isFileNo: isFileNo, isFileNo: isPatientHasFile(request: payload),
patientId: 0, patientId: 0,
isForRegister: isForRegister, isForRegister: checkIsUserComingForRegister(request: payload),
patientOutSA: isPatientOutSA, patientOutSA: isPatientOutsideSA(request: payload),
payload: payload); payload: payload);
// TODO: GET APP SMS SIGNATURE HERE // TODO: GET APP SMS SIGNATURE HERE
request.sMSSignature = "enKTDcqbOVd"; request.sMSSignature = "enKTDcqbOVd";
// GifLoaderDialogUtils.showMyDialog(context);
// bool isForRegister = healthId != null || isDubai; if (checkIsUserComingForRegister(request: payload)) {
// if (isForRegister) { _appState.setUserRegistrationPayload = RegistrationDataModelPayload.fromJson(payload);
// if (!isDubai) { print("====== Demo ==========");
// request.dob = dob; //isHijri == 1 ? dob : dateFormat2.format(dateFormat.parse(dob)); }
// }
// request.healthId = healthId;
// request.isHijri = calenderType.toInt;
// } else {
// // request.dob = "";
// // request.healthId = "";
// // request.isHijri = 0;
// }
final resultEither = await _authenticationRepo.sendActivationCodeRepo(sendActivationCodeReq: request, isRegister: isForRegister, languageID: 'er'); final resultEither = await _authenticationRepo.sendActivationCodeRepo(sendActivationCodeReq: request, isRegister: checkIsUserComingForRegister(request: payload), languageID: 'er');
resultEither.fold( resultEither.fold(
(failure) async => await _errorHandlerService.handleError(failure: failure), (failure) async => await _errorHandlerService.handleError(failure: failure),
@ -377,19 +366,29 @@ class AuthenticationViewModel extends ChangeNotifier {
phoneNumber: phoneNumberController.text, phoneNumber: phoneNumberController.text,
otpTypeEnum: otpTypeEnum, otpTypeEnum: otpTypeEnum,
deviceToken: _appState.deviceToken, deviceToken: _appState.deviceToken,
patientOutSA: true, patientOutSA: _appState.getUserRegistrationPayload.projectOutSa == 1 ? true : false,
loginTokenID: _appState.appAuthToken, loginTokenID: _appState.appAuthToken,
registeredData: null, registeredData: _appState.getUserRegistrationPayload,
nationIdText: nationalIdController.text, nationIdText: nationalIdController.text,
countryCode: selectedCountrySignup.countryCode, countryCode: selectedCountrySignup.countryCode,
loginType: loginTypeEnum.toInt) loginType: loginTypeEnum.toInt)
.toJson(); .toJson();
bool isForRegister = (_appState.getUserRegistrationPayload.healthId != null || _appState.getUserRegistrationPayload.patientOutSa == true); bool isForRegister = (_appState.getUserRegistrationPayload.healthId != null || _appState.getUserRegistrationPayload.patientOutSa == 1) ? true : false;
if (isForRegister) { if (isForRegister) {
if (_appState.getUserRegistrationPayload.patientOutSa == true) request['DOB'] = _appState.getUserRegistrationPayload.dob; if (_appState.getUserRegistrationPayload.patientOutSa == 0) request['DOB'] = _appState.getUserRegistrationPayload.dob;
request['HealthId'] = _appState.getUserRegistrationPayload.healthId; request['HealthId'] = _appState.getUserRegistrationPayload.healthId;
request['IsHijri'] = _appState.getUserRegistrationPayload.isHijri; request['IsHijri'] = _appState.getUserRegistrationPayload.isHijri;
request["PatientOutSA"] = _appState.getUserRegistrationPayload.projectOutSa == true ? 1 : 0;
request["ForRegisteration"] = _appState.getUserRegistrationPayload.isRegister;
request["isRegister"] = false;
// if (request.containsKey("OTP_SendType")) {
// request.remove("OTP_SendType");
// print("====== Demo: Removed OTP_SendType for Register state");
// }
print("====== Req");
final resultEither = await _authenticationRepo.checkActivationCodeRepo(newRequest: request, activationCode: activationCode.toString(), isRegister: true); final resultEither = await _authenticationRepo.checkActivationCodeRepo(newRequest: request, activationCode: activationCode.toString(), isRegister: true);
@ -591,11 +590,27 @@ class AuthenticationViewModel extends ChangeNotifier {
} }
Future<void> onRegistrationComplete() async { Future<void> onRegistrationComplete() async {
var request = RequestUtils.getUserSignupCompletionRequest(); var request = RequestUtils.getUserSignupCompletionRequest(fullName: nameController.text, emailAddress: emailController.text, gender: genderType, maritalStatus: maritalStatus);
clearDefaultInputValues(); //
print("============= Final Payload ==============="); print("============= Final Payload ===============");
print(request); print(request);
print("==========================================="); print("=================== ====================");
final resultEither = await _authenticationRepo.registerUser(registrationPayloadDataModelRequest: request);
resultEither.fold((failure) async => await _errorHandlerService.handleError(failure: failure), (apiResponse) async {
if (apiResponse.data is String) {
//TODO: Here We Need to Show a Dialog Of Something in the case of Fail With OK and Cancel and the Display Variable WIll be result.
} else {
print(apiResponse.data as Map<String, dynamic>);
if (apiResponse.data["MessageStatus"] == 1) {
//TODO: Here We Need to Show a Dialog Of Something in the case of Success.
clearDefaultInputValues(); // This will Clear All Default Values Of User.
_navigationService.pushAndReplace(AppRoutes.loginScreen);
}
}
});
return;
} }
Future<void> checkUserStatusForRegistration({required dynamic response, required dynamic request}) async { Future<void> checkUserStatusForRegistration({required dynamic response, required dynamic request}) async {
@ -616,7 +631,8 @@ class AuthenticationViewModel extends ChangeNotifier {
sendActivationCode( sendActivationCode(
otpTypeEnum: OTPTypeEnumExtension.fromInt(request["OTP_SendType"]), otpTypeEnum: OTPTypeEnumExtension.fromInt(request["OTP_SendType"]),
nationalIdOrFileNumber: request["PatientIdentificationID"].toString(), nationalIdOrFileNumber: request["PatientIdentificationID"].toString(),
phoneNumber: request["PatientMobileNumber"].toString()); phoneNumber: request["PatientMobileNumber"].toString(),
payload: request);
} else { } else {
print("=======IN SA======="); print("=======IN SA=======");
chekUserNHICData(request: request); chekUserNHICData(request: request);
@ -630,13 +646,12 @@ class AuthenticationViewModel extends ChangeNotifier {
bool isPatientOutsideSA({required dynamic request}) { bool isPatientOutsideSA({required dynamic request}) {
bool isOutSideSa = false; bool isOutSideSa = false;
if (request is Map<String, dynamic> && request.containsKey("PatientOutSA")) { if (request["PatientOutSA"] == true || request["PatientOutSA"] == 1) {
if (request["PatientOutSA"] == true) { isOutSideSa = true;
isOutSideSa = true; } else {
} else { isOutSideSa = false;
isOutSideSa = false;
}
} }
print(isOutSideSa); print(isOutSideSa);
return isOutSideSa; return isOutSideSa;
} }

@ -1,20 +1,128 @@
// import 'dart:convert';
//
// import 'package:hmg_patient_app_new/core/enums.dart';
//
// class RegistrationDataModelPayload {
// int? patientMobileNumber;
// String? zipCode;
// int? searchType;
// int? patientId;
// int? patientIdentificationId;
// int? otpSendType;
// int? patientOutSa;
// bool? isDentalAllowedBackend;
// String? dob;
// int? isHijri;
// bool? forRegister;
// bool? isRegister;
// String? healthId;
// String? emailAddress;
// String? nationalityCode;
// GenderTypeEnum? gender;
// MaritalStatusTypeEnum? maritalStatus;
// String? fullName;
//
// RegistrationDataModelPayload({
// this.patientMobileNumber,
// this.zipCode,
// this.searchType,
// this.patientId,
// this.patientIdentificationId,
// this.otpSendType,
// this.patientOutSa,
// this.isDentalAllowedBackend,
// this.dob,
// this.isHijri,
// this.forRegister,
// this.isRegister,
// this.healthId,
// this.emailAddress,
// this.nationalityCode,
// this.gender,
// this.maritalStatus,
// this.fullName,
// });
//
// factory RegistrationDataModelPayload.fromRawJson(String str) => RegistrationDataModelPayload.fromJson(json.decode(str));
//
// String toRawJson() => json.encode(toJson());
//
// factory RegistrationDataModelPayload.fromJson(Map<String, dynamic> json) => RegistrationDataModelPayload(
// patientMobileNumber: json["PatientMobileNumber"],
// zipCode: json["ZipCode"],
// searchType: json["SearchType"],
// patientId: json["PatientID"],
// patientIdentificationId: json["PatientIdentificationID"],
// otpSendType: json["OTP_SendType"],
// patientOutSa: json["PatientOutSA"],
// isDentalAllowedBackend: json["isDentalAllowedBackend"],
// dob: json["DOB"],
// isHijri: json["IsHijri"],
// forRegister: json["forRegister"],
// isRegister: json["isRegister"],
// healthId: json["healthId"],
// emailAddress: json["emailAddress"],
// nationalityCode: json["nationalityCode"],
// gender: json["gender"],
// maritalStatus: json["maritalStatus"],
// fullName: json["fullName"],
// );
//
// Map<String, dynamic> toJson() => {
// "PatientMobileNumber": patientMobileNumber,
// "ZipCode": zipCode,
// "SearchType": searchType,
// "PatientID": patientId,
// "PatientIdentificationID": patientIdentificationId,
// "OTP_SendType": otpSendType,
// "PatientOutSA": patientOutSa,
// "isDentalAllowedBackend": isDentalAllowedBackend,
// "DOB": dob,
// "IsHijri": isHijri,
// "forRegister": forRegister,
// "isRegister": isRegister,
// "healthId": healthId,
// "emailAddress": emailAddress,
// "nationalityCode": nationalityCode,
// "gender": gender,
// "maritalStatus": maritalStatus,
// "fullName": fullName,
// };
// }
import 'dart:convert'; import 'dart:convert';
import 'package:hmg_patient_app_new/core/enums.dart'; import 'package:hmg_patient_app_new/core/enums.dart';
class RegistrationDataModelPayload { class RegistrationDataModelPayload {
int? patientMobileNumber; int? patientMobileNumber;
String? mobileNo;
String? deviceToken;
bool? projectOutSa;
int? loginType;
String? zipCode; String? zipCode;
bool? isRegister;
String? logInTokenId;
int? searchType; int? searchType;
int? patientId; int? patientId;
int? nationalId;
int? patientIdentificationId; int? patientIdentificationId;
int? otpSendType; int? otpSendType;
String? languageId;
String? versionId;
String? channel;
String? ipAdress;
String? generalid;
int? patientOutSa; int? patientOutSa;
bool? isDentalAllowedBackend; bool? isDentalAllowedBackend;
String? deviceTypeId;
String? smsSignature;
String? dob; String? dob;
int? isHijri; int? isHijri;
bool? forRegister; String? patientType;
bool? isRegister; String? latitude;
String? longitude;
String? healthId; String? healthId;
String? emailAddress; String? emailAddress;
String? nationalityCode; String? nationalityCode;
@ -22,19 +130,35 @@ class RegistrationDataModelPayload {
MaritalStatusTypeEnum? maritalStatus; MaritalStatusTypeEnum? maritalStatus;
String? fullName; String? fullName;
RegistrationDataModelPayload({ RegistrationDataModelPayload({
this.patientMobileNumber, this.patientMobileNumber,
this.mobileNo,
this.deviceToken,
this.projectOutSa,
this.loginType,
this.zipCode, this.zipCode,
this.isRegister,
this.logInTokenId,
this.searchType, this.searchType,
this.patientId, this.patientId,
this.nationalId,
this.patientIdentificationId, this.patientIdentificationId,
this.otpSendType, this.otpSendType,
this.languageId,
this.versionId,
this.channel,
this.ipAdress,
this.generalid,
this.patientOutSa, this.patientOutSa,
this.isDentalAllowedBackend, this.isDentalAllowedBackend,
this.deviceTypeId,
this.smsSignature,
this.dob, this.dob,
this.isHijri, this.isHijri,
this.forRegister, this.patientType,
this.isRegister, this.latitude,
this.longitude,
this.healthId, this.healthId,
this.emailAddress, this.emailAddress,
this.nationalityCode, this.nationalityCode,
@ -48,44 +172,74 @@ class RegistrationDataModelPayload {
String toRawJson() => json.encode(toJson()); String toRawJson() => json.encode(toJson());
factory RegistrationDataModelPayload.fromJson(Map<String, dynamic> json) => RegistrationDataModelPayload( factory RegistrationDataModelPayload.fromJson(Map<String, dynamic> json) => RegistrationDataModelPayload(
patientMobileNumber: json["PatientMobileNumber"], patientMobileNumber: json["PatientMobileNumber"],
zipCode: json["ZipCode"], mobileNo: json["MobileNo"],
searchType: json["SearchType"], deviceToken: json["DeviceToken"],
patientId: json["PatientID"], projectOutSa: json["ProjectOutSA"],
patientIdentificationId: json["PatientIdentificationID"], loginType: json["LoginType"],
otpSendType: json["OTP_SendType"], zipCode: json["ZipCode"],
patientOutSa: json["PatientOutSA"], isRegister: json["isRegister"],
isDentalAllowedBackend: json["isDentalAllowedBackend"], logInTokenId: json["LogInTokenID"],
dob: json["DOB"], searchType: json["SearchType"],
isHijri: json["IsHijri"], patientId: json["PatientID"],
forRegister: json["forRegister"], nationalId: json["NationalID"],
isRegister: json["isRegister"], patientIdentificationId: json["PatientIdentificationID"],
healthId: json["healthId"], otpSendType: json["OTP_SendType"],
emailAddress: json["emailAddress"], languageId: json["LanguageID"],
nationalityCode: json["nationalityCode"], versionId: json["VersionID"],
gender: json["gender"], channel: json["Channel"],
maritalStatus: json["maritalStatus"], ipAdress: json["IPAdress"],
fullName: json["fullName"], generalid: json["generalid"],
); patientOutSa: json["PatientOutSA"],
isDentalAllowedBackend: json["isDentalAllowedBackend"],
deviceTypeId: json["DeviceTypeID"],
smsSignature: json["SMSSignature"],
dob: json["DOB"],
isHijri: json["IsHijri"],
patientType: json["PatientType"],
latitude: json["Latitude"],
longitude: json["Longitude"],
healthId: json["healthId"],
emailAddress: json["emailAddress"],
nationalityCode: json["nationalityCode"],
gender: json["gender"],
maritalStatus: json["maritalStatus"],
fullName: json["fullName"],
);
Map<String, dynamic> toJson() => { Map<String, dynamic> toJson() => {
"PatientMobileNumber": patientMobileNumber, "PatientMobileNumber": patientMobileNumber,
"ZipCode": zipCode, "MobileNo": mobileNo,
"SearchType": searchType, "DeviceToken": deviceToken,
"PatientID": patientId, "ProjectOutSA": projectOutSa,
"PatientIdentificationID": patientIdentificationId, "LoginType": loginType,
"OTP_SendType": otpSendType, "ZipCode": zipCode,
"PatientOutSA": patientOutSa, "isRegister": isRegister,
"isDentalAllowedBackend": isDentalAllowedBackend, "LogInTokenID": logInTokenId,
"DOB": dob, "SearchType": searchType,
"IsHijri": isHijri, "PatientID": patientId,
"forRegister": forRegister, "NationalID": nationalId,
"isRegister": isRegister, "PatientIdentificationID": patientIdentificationId,
"healthId": healthId, "OTP_SendType": otpSendType,
"emailAddress": emailAddress, "LanguageID": languageId,
"nationalityCode": nationalityCode, "VersionID": versionId,
"gender": gender, "Channel": channel,
"maritalStatus": maritalStatus, "IPAdress": ipAdress,
"fullName": fullName, "generalid": generalid,
}; "PatientOutSA": patientOutSa,
"isDentalAllowedBackend": isDentalAllowedBackend,
"DeviceTypeID": deviceTypeId,
"SMSSignature": smsSignature,
"DOB": dob,
"IsHijri": isHijri,
"PatientType": patientType,
"Latitude": latitude,
"Longitude": longitude,
"healthId": healthId,
"emailAddress": emailAddress,
"nationalityCode": nationalityCode,
"gender": gender,
"maritalStatus": maritalStatus,
"fullName": fullName,
};
} }

@ -213,7 +213,7 @@ class _RegisterNew extends State<RegisterNew> {
countryCode: authVM.selectedCountrySignup.countryCode, countryCode: authVM.selectedCountrySignup.countryCode,
initialPhoneNumber: "", initialPhoneNumber: "",
textController: authVM.phoneNumberController, textController: authVM.phoneNumberController,
isEnableCountryDropdown: true, isEnableCountryDropdown: false,
onCountryChange: authVM.onCountryChange, onCountryChange: authVM.onCountryChange,
onChange: authVM.onPhoneNumberChange, onChange: authVM.onPhoneNumberChange,
buttons: [ buttons: [

@ -217,8 +217,8 @@ class _RegisterNew extends State<RegisterNewStep2> {
TextInputWidget( TextInputWidget(
labelText: LocaleKeys.mobileNumber.tr(), labelText: LocaleKeys.mobileNumber.tr(),
hintText: (appState.getUserRegistrationPayload.patientMobileNumber.toString() ?? ""), hintText: (appState.getUserRegistrationPayload.patientMobileNumber.toString() ?? ""),
controller: authVM!.phoneNumberController, controller: null,
isEnable: true, isEnable: false,
prefix: null, prefix: null,
isAllowRadius: false, isAllowRadius: false,
isBorderAllowed: false, isBorderAllowed: false,
@ -255,7 +255,7 @@ class _RegisterNew extends State<RegisterNewStep2> {
icon: AppAssets.cancel, icon: AppAssets.cancel,
onPressed: () { onPressed: () {
Navigator.of(context).pop(); Navigator.of(context).pop();
authVM!.clearDefaultInputValues(); // authVM!.clearDefaultInputValues();
}, },
backgroundColor: AppColors.secondaryLightRedColor, backgroundColor: AppColors.secondaryLightRedColor,
borderColor: AppColors.secondaryLightRedColor, borderColor: AppColors.secondaryLightRedColor,

Loading…
Cancel
Save