diff --git a/lib/core/api_consts.dart b/lib/core/api_consts.dart index f54fd26..42f10f4 100644 --- a/lib/core/api_consts.dart +++ b/lib/core/api_consts.dart @@ -804,6 +804,7 @@ class ApiConsts { static final String insertPatientMobileData = 'Services/MobileNotifications.svc/REST/Insert_PatientMobileDeviceInfo'; static final String getPatientMobileData = '/Services/Authentication.svc/REST/GetMobileLoginInfo'; static final String getPrivileges = 'Services/Patients.svc/REST/Service_Privilege'; + static final String registerUser = 'Services/Authentication.svc/REST/PatientRegistration'; // static values for Api static final double appVersionID = 18.7; diff --git a/lib/core/app_state.dart b/lib/core/app_state.dart index 3c4555e..52500bf 100644 --- a/lib/core/app_state.dart +++ b/lib/core/app_state.dart @@ -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/ProjectDetailListModel.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/check_user_staus_nhic_response_model.dart'; import 'package:hmg_patient_app_new/features/authentication/models/resp_models/select_device_by_imei.dart'; diff --git a/lib/core/utils/request_utils.dart b/lib/core/utils/request_utils.dart index f54432c..fb6624d 100644 --- a/lib/core/utils/request_utils.dart +++ b/lib/core/utils/request_utils.dart @@ -1,7 +1,12 @@ +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/app_state.dart'; import 'package:hmg_patient_app_new/core/dependencies.dart'; import 'package:hmg_patient_app_new/core/enums.dart'; +import 'package:hmg_patient_app_new/core/utils/date_util.dart'; +import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; +import 'package:hmg_patient_app_new/features/authentication/models/request_models/registration_payload_model.dart'; import 'package:hmg_patient_app_new/features/authentication/models/request_models/send_activation_request_model.dart'; import 'package:hmg_patient_app_new/features/common/models/commong_authanticated_req_model.dart'; @@ -60,7 +65,7 @@ class RequestUtils { required String? deviceToken, required bool patientOutSA, required String? loginTokenID, - required var registeredData, + required RegistrationDataModelPayload registeredData, int? patientId, required String nationIdText, required String countryCode, @@ -81,8 +86,8 @@ class RequestUtils { if (registeredData != null) { request.searchType = registeredData.searchType ?? 1; - request.patientID = registeredData.patientID ?? 0; - request.patientIdentificationID = request.nationalID = registeredData.patientIdentificationID ?? '0'; + request.patientID = registeredData.patientId ?? 0; + request.patientIdentificationID = request.nationalID = (registeredData.patientIdentificationId ?? 0); request.dob = registeredData.dob; request.isRegister = registeredData.isRegister; } else { @@ -132,9 +137,10 @@ class RequestUtils { request.patientIdentificationID = request.nationalID = payload["PatientIdentificationID"] ?? '0'; request.dob = payload["DOB"]; request.isRegister = payload["isRegister"]; - request.healthId = _appState.getNHICUserData.healthId; + request.healthId = patientOutSA ? null : _appState.getNHICUserData.healthId; request.isHijri = payload["IsHijri"]; request.deviceToken = _appState.deviceToken; + request.projectOutSA = patientOutSA; } else { request.searchType = isFileNo ? 2 : 1; request.patientID = patientId ?? 0; @@ -172,4 +178,65 @@ class RequestUtils { request.tokenId = null; return request; } + + static dynamic getUserSignupCompletionRequest({String? fullName, String? emailAddress, GenderTypeEnum? gender, MaritalStatusTypeEnum? maritalStatus}) { + AppState appState = getIt.get(); + + bool isDubai = appState.getUserRegistrationPayload.patientOutSa == 1 ? true : false; + List names = fullName != null ? fullName.split(" ") : []; + + 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 { + "Patientobject": { + "TempValue": true, + "PatientIdentificationType": + (isDubai ? appState.getUserRegistrationPayload.patientIdentificationId?.toString().substring(0, 1) : appState.getNHICUserData.idNumber!.substring(0, 1)) == "1" ? 1 : 2, + "PatientIdentificationNo": isDubai ? appState.getUserRegistrationPayload.patientIdentificationId.toString() : appState.getNHICUserData.idNumber.toString(), + "MobileNumber": appState.getUserRegistrationPayload.patientMobileNumber ?? 0, + "PatientOutSA": (appState.getUserRegistrationPayload.zipCode == CountryEnum.saudiArabia.countryCode || appState.getUserRegistrationPayload.zipCode == '+966') ? 0 : 1, + "FirstNameN": isDubai ? "..." : appState.getNHICUserData.firstNameAr, + "FirstName": isDubai ? (names.isNotEmpty ? names[0] : "...") : appState.getNHICUserData.firstNameEn, + "MiddleNameN": isDubai ? "..." : appState.getNHICUserData.secondNameAr, + "MiddleName": isDubai ? "..." : appState.getNHICUserData.secondNameEn, + "LastNameN": isDubai ? "..." : appState.getNHICUserData.lastNameAr, + "LastName": isDubai ? (names.length > 1 ? names[1] : "...") : appState.getNHICUserData.lastNameEn, + "StrDateofBirth": dateFormat1.format(dateFormat2.parse(dob)), + "DateofBirth": DateUtil.convertISODateToJsonDate((dob ?? "").replaceAll('/', '-')), + "Gender": isDubai ? (gender == GenderTypeEnum.male ? 1 : 2) : (appState.getNHICUserData.gender == 'M' ? 1 : 2), + "NationalityID": isDubai ? "UAE" : appState.getNHICUserData.nationalityCode, + "eHealthIDField": isDubai ? null : appState.getNHICUserData.healthId, + "DateofBirthN": date, + "EmailAddress": emailAddress, + "SourceType": (appState.getUserRegistrationPayload.zipCode == CountryEnum.saudiArabia.countryCode || appState.getUserRegistrationPayload.zipCode == '+966') ? "1" : "2", + "PreferredLanguage": appState.getLanguageCode() == "ar" ? (isDubai ? "1" : 1) : (isDubai ? "2" : 2), + "Marital": isDubai + ? (maritalStatus == MaritalStatusTypeEnum.single + ? '0' + : maritalStatus == MaritalStatusTypeEnum.married + ? '1' + : '2') + : (appState.getNHICUserData.maritalStatusCode == 'U' + ? '0' + : appState.getNHICUserData.maritalStatusCode == 'M' + ? '1' + : '2'), + }, + "PatientIdentificationID": isDubai ? appState.getUserRegistrationPayload.patientIdentificationId.toString() : appState.getNHICUserData.idNumber.toString(), + "PatientMobileNumber": appState.getUserRegistrationPayload.patientMobileNumber.toString()[0] == '0' + ? appState.getUserRegistrationPayload.patientMobileNumber + : '0${appState.getUserRegistrationPayload.patientMobileNumber}', + "DOB": dob, + "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, + }; + } } diff --git a/lib/features/authentication/authentication_repo.dart b/lib/features/authentication/authentication_repo.dart index 8fbf259..f3f4119 100644 --- a/lib/features/authentication/authentication_repo.dart +++ b/lib/features/authentication/authentication_repo.dart @@ -32,6 +32,8 @@ abstract class AuthenticationRepo { Future>> checkUserStatus({required dynamic commonAuthanticatedRequest}); + Future>> registerUser({required dynamic registrationPayloadDataModelRequest}); + Future>> insertPatientIMEIData({required dynamic patientIMEIDataRequest}); Future>> insertPatientDeviceData({required dynamic patientDeviceDataRequest}); @@ -184,7 +186,6 @@ class AuthenticationRepoImp implements AuthenticationRepo { newRequest.projectOutSA = newRequest.zipCode == '966' ? false : true; newRequest.isDentalAllowedBackend = false; newRequest.forRegisteration = newRequest.isRegister ?? false; - newRequest.isRegister = false; } @@ -359,6 +360,39 @@ class AuthenticationRepoImp implements AuthenticationRepo { } } + @override + Future>> registerUser({required dynamic registrationPayloadDataModelRequest}) async { + try { + GenericApiModel? 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( + 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 Future> insertPatientIMEIData({required patientIMEIDataRequest}) { try { diff --git a/lib/features/authentication/authentication_view_model.dart b/lib/features/authentication/authentication_view_model.dart index e46d7ff..b59fd13 100644 --- a/lib/features/authentication/authentication_view_model.dart +++ b/lib/features/authentication/authentication_view_model.dart @@ -15,6 +15,7 @@ import 'package:hmg_patient_app_new/core/utils/loading_utils.dart'; import 'package:hmg_patient_app_new/core/utils/request_utils.dart'; import 'package:hmg_patient_app_new/core/utils/utils.dart'; import 'package:hmg_patient_app_new/core/utils/validation_utils.dart'; +import 'package:hmg_patient_app_new/extensions/context_extensions.dart'; import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; import 'package:hmg_patient_app_new/features/authentication/authentication_repo.dart'; import 'package:hmg_patient_app_new/features/authentication/models/request_models/check_activation_code_register_request_model.dart'; @@ -31,6 +32,7 @@ import 'package:hmg_patient_app_new/services/error_handler_service.dart'; import 'package:hmg_patient_app_new/services/localauth_service.dart'; import 'package:hmg_patient_app_new/services/navigation_service.dart'; import 'package:hmg_patient_app_new/widgets/loader/bottomsheet_loader.dart'; +import 'package:hmg_patient_app_new/widgets/bottomsheet/exception_bottom_sheet.dart'; import 'models/request_models/get_user_mobile_device_data.dart'; import 'models/request_models/insert_patient_mobile_deviceinfo.dart'; @@ -110,6 +112,8 @@ class AuthenticationViewModel extends ChangeNotifier { isTermsAccepted = false; selectedCountrySignup = CountryEnum.saudiArabia; pickedCountryByUAEUser = null; + _appState.setUserRegistrationPayload = RegistrationDataModelPayload(); + _appState.setNHICUserData = CheckUserStatusResponseNHIC(); } void onCountryChange(CountryEnum country) { @@ -315,40 +319,27 @@ class AuthenticationViewModel extends ChangeNotifier { } Future 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( otpTypeEnum: otpTypeEnum, mobileNumber: phoneNumber, selectedLoginType: otpTypeEnum.toInt(), zipCode: selectedCountrySignup.countryCode, nationalId: int.parse(nationalIdOrFileNumber), - isFileNo: isFileNo, + isFileNo: isPatientHasFile(request: payload), patientId: 0, - isForRegister: isForRegister, - patientOutSA: isPatientOutSA, + isForRegister: checkIsUserComingForRegister(request: payload), + patientOutSA: isPatientOutsideSA(request: payload), payload: payload); // TODO: GET APP SMS SIGNATURE HERE request.sMSSignature = "enKTDcqbOVd"; - // GifLoaderDialogUtils.showMyDialog(context); - // bool isForRegister = healthId != null || isDubai; - // if (isForRegister) { - // if (!isDubai) { - // 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; - // } + if (checkIsUserComingForRegister(request: payload)) { + _appState.setUserRegistrationPayload = RegistrationDataModelPayload.fromJson(payload); + print("====== Demo =========="); + } - 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( (failure) async => await _errorHandlerService.handleError(failure: failure), @@ -386,9 +377,9 @@ class AuthenticationViewModel extends ChangeNotifier { phoneNumber: phoneNumberController.text, otpTypeEnum: otpTypeEnum, deviceToken: _appState.deviceToken, - patientOutSA: true, + patientOutSA: _appState.getUserRegistrationPayload.projectOutSa == 1 ? true : false, loginTokenID: _appState.appAuthToken, - registeredData: null, + registeredData: _appState.getUserRegistrationPayload, nationIdText: nationalIdController.text, countryCode: selectedCountrySignup.countryCode, loginType: loginTypeEnum.toInt) @@ -396,9 +387,19 @@ class AuthenticationViewModel extends ChangeNotifier { LoaderBottomSheet.showLoader(); bool isForRegister = (_appState.getUserRegistrationPayload.healthId != null || _appState.getUserRegistrationPayload.patientOutSa == true); 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['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); @@ -615,35 +616,61 @@ class AuthenticationViewModel extends ChangeNotifier { } Future onRegistrationComplete() async { - // if (emailAddress.text.isEmpty) { - // Utils.showErrorToast(TranslationBase.of(context).enterEmailAddress); - // return; - // } else { - // Navigator.of(context).pop(); - // registerNow(); - // } - //authVM!.clearDefaultInputValues(); + var request = RequestUtils.getUserSignupCompletionRequest(fullName: nameController.text, emailAddress: emailController.text, gender: genderType, maritalStatus: maritalStatus); + // + print("============= Final Payload ==============="); + print(request); + 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); + 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 checkUserStatusForRegistration({required dynamic response, required dynamic request}) async { if (response is Map) { - _appState.setAppAuthToken = response["LogInTokenID"]; if (response["MessageStatus"] == 2) { print(response["ErrorEndUserMessage"]); return; } if (response['hasFile'] == true) { //TODO: Show Here Ok And Cancel Dialog and On OKPress it will go for sendActivationCode + + _navigationService.context?.showBottomSheet( + child: ExceptionBottomSheet( + message: response["ErrorMessage"], + showCancel: true, + showOKButton: true, + onOkPressed: () { + _navigationService.popUntilNamed(AppRoutes.loginScreen); + }, + onCancelPressed: () { + _navigationService.pop(); + }, + )); } else { request['forRegister'] = true; request['isRegister'] = true; + _appState.setAppAuthToken = response['LogInTokenID']; if (isPatientOutsideSA(request: response)) { print("=======OUT SA======="); - _appState.setAppAuthToken = response['LogInTokenID']; sendActivationCode( otpTypeEnum: OTPTypeEnumExtension.fromInt(request["OTP_SendType"]), nationalIdOrFileNumber: request["PatientIdentificationID"].toString(), - phoneNumber: request["PatientMobileNumber"].toString()); + phoneNumber: request["PatientMobileNumber"].toString(), + payload: request); } else { print("=======IN SA======="); chekUserNHICData(request: request); @@ -657,13 +684,12 @@ class AuthenticationViewModel extends ChangeNotifier { bool isPatientOutsideSA({required dynamic request}) { bool isOutSideSa = false; - if (request is Map && request.containsKey("PatientOutSA")) { - if (request["PatientOutSA"] == true) { - isOutSideSa = true; - } else { - isOutSideSa = false; - } + if (request["PatientOutSA"] == true || request["PatientOutSA"] == 1) { + isOutSideSa = true; + } else { + isOutSideSa = false; } + print(isOutSideSa); return isOutSideSa; } diff --git a/lib/features/authentication/models/request_models/registration_payload_model.dart b/lib/features/authentication/models/request_models/registration_payload_model.dart index fa4f612..bbb31f9 100644 --- a/lib/features/authentication/models/request_models/registration_payload_model.dart +++ b/lib/features/authentication/models/request_models/registration_payload_model.dart @@ -1,34 +1,170 @@ +// 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 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 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 'package:hmg_patient_app_new/core/enums.dart'; + class RegistrationDataModelPayload { int? patientMobileNumber; + String? mobileNo; + String? deviceToken; + bool? projectOutSa; + int? loginType; String? zipCode; + bool? isRegister; + String? logInTokenId; int? searchType; int? patientId; + int? nationalId; int? patientIdentificationId; int? otpSendType; + String? languageId; + String? versionId; + String? channel; + String? ipAdress; + String? generalid; int? patientOutSa; bool? isDentalAllowedBackend; + String? deviceTypeId; + String? smsSignature; String? dob; int? isHijri; - bool? forRegister; - bool? isRegister; + String? patientType; + String? latitude; + String? longitude; String? healthId; + String? emailAddress; + String? nationalityCode; + GenderTypeEnum? gender; + MaritalStatusTypeEnum? maritalStatus; + String? fullName; + RegistrationDataModelPayload({ this.patientMobileNumber, + this.mobileNo, + this.deviceToken, + 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.isDentalAllowedBackend, + this.deviceTypeId, + this.smsSignature, this.dob, this.isHijri, - this.forRegister, - this.isRegister, + this.patientType, + this.latitude, + this.longitude, this.healthId, + this.emailAddress, + this.nationalityCode, + this.gender, + this.maritalStatus, + this.fullName, }); factory RegistrationDataModelPayload.fromRawJson(String str) => RegistrationDataModelPayload.fromJson(json.decode(str)); @@ -36,34 +172,74 @@ class RegistrationDataModelPayload { String toRawJson() => json.encode(toJson()); factory RegistrationDataModelPayload.fromJson(Map 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"], - ); + patientMobileNumber: json["PatientMobileNumber"], + mobileNo: json["MobileNo"], + deviceToken: json["DeviceToken"], + projectOutSa: json["ProjectOutSA"], + loginType: json["LoginType"], + zipCode: json["ZipCode"], + isRegister: json["isRegister"], + logInTokenId: json["LogInTokenID"], + searchType: json["SearchType"], + patientId: json["PatientID"], + nationalId: json["NationalID"], + patientIdentificationId: json["PatientIdentificationID"], + otpSendType: json["OTP_SendType"], + languageId: json["LanguageID"], + versionId: json["VersionID"], + channel: json["Channel"], + ipAdress: json["IPAdress"], + 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 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, - }; + "PatientMobileNumber": patientMobileNumber, + "MobileNo": mobileNo, + "DeviceToken": deviceToken, + "ProjectOutSA": projectOutSa, + "LoginType": loginType, + "ZipCode": zipCode, + "isRegister": isRegister, + "LogInTokenID": logInTokenId, + "SearchType": searchType, + "PatientID": patientId, + "NationalID": nationalId, + "PatientIdentificationID": patientIdentificationId, + "OTP_SendType": otpSendType, + "LanguageID": languageId, + "VersionID": versionId, + "Channel": channel, + "IPAdress": ipAdress, + "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, + }; } diff --git a/lib/presentation/authentication/register.dart b/lib/presentation/authentication/register.dart index f238582..efb0a18 100644 --- a/lib/presentation/authentication/register.dart +++ b/lib/presentation/authentication/register.dart @@ -213,7 +213,7 @@ class _RegisterNew extends State { countryCode: authVM.selectedCountrySignup.countryCode, initialPhoneNumber: "", textController: authVM.phoneNumberController, - isEnableCountryDropdown: true, + isEnableCountryDropdown: false, onCountryChange: authVM.onCountryChange, onChange: authVM.onPhoneNumberChange, buttons: [ diff --git a/lib/presentation/authentication/register_step2.dart b/lib/presentation/authentication/register_step2.dart index bd23be1..d7071a4 100644 --- a/lib/presentation/authentication/register_step2.dart +++ b/lib/presentation/authentication/register_step2.dart @@ -46,7 +46,7 @@ class _RegisterNew extends State { appBar: CustomAppBar( onBackPressed: () { Navigator.of(context).pop(); - authVM!.clearDefaultInputValues(); + // authVM!.clearDefaultInputValues(); }, onLanguageChanged: (lang) {}, hideLogoAndLang: true, @@ -217,15 +217,14 @@ class _RegisterNew extends State { TextInputWidget( labelText: LocaleKeys.mobileNumber.tr(), hintText: (appState.getUserRegistrationPayload.patientMobileNumber.toString() ?? ""), - controller: authVM!.phoneNumberController, - isEnable: true, + controller: null, + isEnable: false, prefix: null, isAllowRadius: false, isBorderAllowed: false, isAllowLeadingIcon: true, isReadOnly: true, - leadingIcon: AppAssets.call, - onChange: (value) {}) + leadingIcon: AppAssets.call) .paddingSymmetrical(0.h, 16.h), Divider( height: 1, @@ -233,15 +232,15 @@ class _RegisterNew extends State { ), TextInputWidget( labelText: LocaleKeys.dob.tr(), - hintText: authVM!.isUserFromUAE() ? appState.getUserRegistrationPayload.dob! : (appState.getNHICUserData.dateOfBirth ?? ""), - controller: authVM!.dobController, - isEnable: authVM!.isUserFromUAE() ? true : false, + hintText: authVM!.isUserFromUAE() ? appState.getUserRegistrationPayload.dob! : appState.getNHICUserData.dateOfBirth ?? "", + controller: authVM!.isUserFromUAE() ? authVM!.dobController : null, + isEnable: false, prefix: null, isBorderAllowed: false, isAllowLeadingIcon: true, isReadOnly: true, leadingIcon: AppAssets.birthday_cake, - selectionType: authVM!.isUserFromUAE() ? SelectionTypeEnum.calendar : null, + selectionType: null, ).paddingSymmetrical(0.h, 16.h), ], ), @@ -256,7 +255,7 @@ class _RegisterNew extends State { icon: AppAssets.cancel, onPressed: () { Navigator.of(context).pop(); - authVM!.clearDefaultInputValues(); + // authVM!.clearDefaultInputValues(); }, backgroundColor: AppColors.secondaryLightRedColor, borderColor: AppColors.secondaryLightRedColor,