|
|
|
|
@ -74,7 +74,7 @@ class _RegisterNew extends State<RegisterNew> {
|
|
|
|
|
CheckUserStatusResponse? nHICData;
|
|
|
|
|
|
|
|
|
|
final int loginType = LoginType.loginType;
|
|
|
|
|
late String mobileNo;
|
|
|
|
|
String mobileNo = '';
|
|
|
|
|
var loginTokenID;
|
|
|
|
|
|
|
|
|
|
// String countryCode = '966';
|
|
|
|
|
@ -322,6 +322,18 @@ class _RegisterNew extends State<RegisterNew> {
|
|
|
|
|
// Utils.showErrorToast(TranslationBase.of(context).pleaseEnterNationalId);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (nationalIDorFile != null && !Utils.validateIqama(nationalIDorFile.text)) {
|
|
|
|
|
context.showBottomSheet(
|
|
|
|
|
child: ExceptionBottomSheet(
|
|
|
|
|
message: "Please enter correct national id",
|
|
|
|
|
showCancel: false,
|
|
|
|
|
onOkPressed: () {
|
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (selectedCountry == null || selectedCountry.countryCode.isEmpty) {
|
|
|
|
|
context.showBottomSheet(
|
|
|
|
|
child: ExceptionBottomSheet(
|
|
|
|
|
@ -384,8 +396,33 @@ class _RegisterNew extends State<RegisterNew> {
|
|
|
|
|
child: CustomButton(
|
|
|
|
|
text: TranslationBase.of(context).sendOTPSMS,
|
|
|
|
|
onPressed: () {
|
|
|
|
|
int? val = Utils.onOtpBtnPressed(OTPType.sms, mobileNo, context);
|
|
|
|
|
registerUser(val);
|
|
|
|
|
if (mobileNo.isEmpty) {
|
|
|
|
|
context.showBottomSheet(
|
|
|
|
|
child: ExceptionBottomSheet(
|
|
|
|
|
message: "Please enter mobile number",
|
|
|
|
|
showCancel: false,
|
|
|
|
|
onOkPressed: () {
|
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
//
|
|
|
|
|
// else if (mobileNo.length < 8) {
|
|
|
|
|
// context.showBottomSheet(
|
|
|
|
|
// child: ExceptionBottomSheet(
|
|
|
|
|
// message: "Please enter correct mobile number",
|
|
|
|
|
// showCancel: false,
|
|
|
|
|
// onOkPressed: () {
|
|
|
|
|
// Navigator.of(context).pop();
|
|
|
|
|
// },
|
|
|
|
|
// ),
|
|
|
|
|
// );
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
registerUser(1);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
backgroundColor: CustomColors.bgRedColor,
|
|
|
|
|
borderColor: CustomColors.bgRedBorderColor,
|
|
|
|
|
@ -414,8 +451,31 @@ class _RegisterNew extends State<RegisterNew> {
|
|
|
|
|
child: CustomButton(
|
|
|
|
|
text: TranslationBase.of(context).sendOTPWHATSAPP,
|
|
|
|
|
onPressed: () {
|
|
|
|
|
int? val = Utils.onOtpBtnPressed(OTPType.whatsapp, mobileNo, context);
|
|
|
|
|
registerUser(val);
|
|
|
|
|
if (mobileNo.isEmpty) {
|
|
|
|
|
context.showBottomSheet(
|
|
|
|
|
child: ExceptionBottomSheet(
|
|
|
|
|
message: "Please enter mobile number",
|
|
|
|
|
showCancel: false,
|
|
|
|
|
onOkPressed: () {
|
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
} else if (mobileNo.length < 9) {
|
|
|
|
|
context.showBottomSheet(
|
|
|
|
|
child: ExceptionBottomSheet(
|
|
|
|
|
message: "Please enter correct mobile number",
|
|
|
|
|
showCancel: false,
|
|
|
|
|
onOkPressed: () {
|
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
} else {
|
|
|
|
|
registerUser(4);
|
|
|
|
|
}
|
|
|
|
|
// int? val = Utils.onOtpBtnPressed(OTPType.whatsapp, mobileNo, context);
|
|
|
|
|
// registerUser(val);
|
|
|
|
|
},
|
|
|
|
|
backgroundColor: Colors.white,
|
|
|
|
|
borderColor: Color(0xFF2E3039),
|
|
|
|
|
@ -555,22 +615,24 @@ class _RegisterNew extends State<RegisterNew> {
|
|
|
|
|
checkPatientForRegistration({required CheckPatientForRegistration registrationData, type}) {
|
|
|
|
|
int languageID = Provider.of<ProjectViewModel>(context, listen: false).isArabic ? 1 : 2;
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
authService.checkPatientForRegisteration(registrationData, languageID).then((response) => {
|
|
|
|
|
// Keep loader active, continue to next step
|
|
|
|
|
checkUserStatus(response, registrationData, type)
|
|
|
|
|
}).catchError((err) {
|
|
|
|
|
authService
|
|
|
|
|
.checkPatientForRegisteration(registrationData, languageID)
|
|
|
|
|
.then((response) => {
|
|
|
|
|
// Keep loader active, continue to next step
|
|
|
|
|
checkUserStatus(response, registrationData, type)
|
|
|
|
|
})
|
|
|
|
|
.catchError((err) {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
|
|
|
|
|
context.showBottomSheet(
|
|
|
|
|
child: ExceptionBottomSheet(
|
|
|
|
|
showCancel: true,
|
|
|
|
|
message: err,
|
|
|
|
|
onOkPressed: () {
|
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
|
Navigator.of(context).push(FadePage(page: RegisterNew()));
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
// context.showBottomSheet(
|
|
|
|
|
// child: ExceptionBottomSheet(
|
|
|
|
|
// showCancel: true,
|
|
|
|
|
// message: err,
|
|
|
|
|
// onOkPressed: () {
|
|
|
|
|
// Navigator.of(context).pop();
|
|
|
|
|
// Navigator.of(context).push(FadePage(page: RegisterNew()));
|
|
|
|
|
// },
|
|
|
|
|
// ),
|
|
|
|
|
// );
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -580,12 +642,13 @@ class _RegisterNew extends State<RegisterNew> {
|
|
|
|
|
var nRequest = request.toJson();
|
|
|
|
|
nRequest['LogInTokenID'] = response['LogInTokenID'];
|
|
|
|
|
if (response['hasFile'] == true) {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
context.showBottomSheet(
|
|
|
|
|
child: ExceptionBottomSheet(
|
|
|
|
|
message: response['ErrorEndUserMessage'],
|
|
|
|
|
showCancel: true,
|
|
|
|
|
onOkPressed: () {
|
|
|
|
|
AlertDialogBox.closeAlertDialog(context);
|
|
|
|
|
// AlertDialogBox.closeAlertDialog(context);
|
|
|
|
|
sharedPref.setObject(REGISTER_DATA_FOR_LOGIIN, nRequest);
|
|
|
|
|
setState(() {
|
|
|
|
|
isSkipRegistration = true;
|
|
|
|
|
@ -604,7 +667,7 @@ class _RegisterNew extends State<RegisterNew> {
|
|
|
|
|
sharedPref.setObject(REGISTER_DATA_FOR_LOGIIN, nRequest);
|
|
|
|
|
sharedPref.setString(LOGIN_TOKEN_ID, response['LogInTokenID']);
|
|
|
|
|
if (request.patientOutSA == 0) {
|
|
|
|
|
this.chekUserData(response['LogInTokenID'], type); // ظ ;
|
|
|
|
|
this.chekUserData(response['LogInTokenID'], type);
|
|
|
|
|
} else {
|
|
|
|
|
sendActivationCode(type, response['LogInTokenID'], null, isSkipRegistration);
|
|
|
|
|
}
|
|
|
|
|
@ -613,6 +676,7 @@ class _RegisterNew extends State<RegisterNew> {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
// if (response['ErrorCode'] == '-986') {
|
|
|
|
|
//AppToast.showErrorToast(message: response);
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
context.showBottomSheet(
|
|
|
|
|
child: ExceptionBottomSheet(
|
|
|
|
|
message: response,
|
|
|
|
|
@ -694,13 +758,13 @@ class _RegisterNew extends State<RegisterNew> {
|
|
|
|
|
request.patientIdentificationID = nationalIDorFile.text;
|
|
|
|
|
}
|
|
|
|
|
request.isHijri = isHijri ?? 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (skipRegistration) {
|
|
|
|
|
// Keep existing loader active, don't show new one
|
|
|
|
|
var req = getCommonRequest(type: type);
|
|
|
|
|
req.logInTokenID = "";
|
|
|
|
|
var request = CheckPatientAuthenticationReq.fromJson(req.toJson());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
authService.checkPatientAuthentication(request).then((value) async {
|
|
|
|
|
if (value['isSMSSent']) {
|
|
|
|
|
sharedPref.setString(LOGIN_TOKEN_ID, value['LogInTokenID']);
|
|
|
|
|
|