|
|
|
|
@ -132,8 +132,14 @@ class _SavedLogin extends State<SavedLogin> {
|
|
|
|
|
CustomButton(
|
|
|
|
|
text: "${TranslationBase.of(context).loginBy} ${getType(widget.savedLoginData!.logInType!, context)}",
|
|
|
|
|
onPressed: (){
|
|
|
|
|
loginWithFingerPrintFace(widget.savedLoginData!.logInType!, widget.savedLoginData!.iMEI!);
|
|
|
|
|
|
|
|
|
|
if(widget.savedLoginData!.logInType! == 2 || widget.savedLoginData!.logInType! == 3) {
|
|
|
|
|
loginWithFingerPrintFace(widget.savedLoginData!
|
|
|
|
|
.logInType!, widget.savedLoginData!.iMEI!);
|
|
|
|
|
}else {
|
|
|
|
|
int? val = widget.savedLoginData!
|
|
|
|
|
.logInType!;
|
|
|
|
|
checkUserAuthentication(val);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
backgroundColor:Color(0xffFEE9EA),
|
|
|
|
|
borderColor:Color(0xffFEE9EA),
|
|
|
|
|
@ -213,7 +219,7 @@ class _SavedLogin extends State<SavedLogin> {
|
|
|
|
|
onPressed: () {
|
|
|
|
|
int? val = Utils.onOtpBtnPressed(OTPType.whatsapp, phoneController);
|
|
|
|
|
if (val != null) {
|
|
|
|
|
//checkUserAuthentication(val);
|
|
|
|
|
checkUserAuthentication(val);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
backgroundColor: Colors.white,
|
|
|
|
|
@ -356,7 +362,7 @@ class _SavedLogin extends State<SavedLogin> {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
getMobileInfo(request,int lastLogin) {
|
|
|
|
|
// GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
this.authService.getLoginInfo(request).then((result) {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
if (result['SMSLoginRequired'] == false) {
|
|
|
|
|
@ -372,7 +378,7 @@ class _SavedLogin extends State<SavedLogin> {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
checkActivationCode(String? value, int loginType, String loginToken) async {
|
|
|
|
|
checkActivationCode(String? value, int loginType, String? loginToken) async {
|
|
|
|
|
AppGlobal.context = context;
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
var request = authService.getCommonRequest(
|
|
|
|
|
@ -382,34 +388,29 @@ class _SavedLogin extends State<SavedLogin> {
|
|
|
|
|
mobileNumber: int.parse(widget.savedLoginData.mobile!),
|
|
|
|
|
zipCode: widget.savedLoginData.outSA == 1 ? '971' : '966',
|
|
|
|
|
patientOutSA: widget.savedLoginData.outSA,
|
|
|
|
|
loginTokenID: "",
|
|
|
|
|
loginTokenID: loginToken ??"",
|
|
|
|
|
selectedOption: loginType,
|
|
|
|
|
user: widget.savedLoginData,
|
|
|
|
|
).toJson();
|
|
|
|
|
dynamic res;
|
|
|
|
|
|
|
|
|
|
authService
|
|
|
|
|
.checkActivationCode(request, null)
|
|
|
|
|
.checkActivationCode(request, value)
|
|
|
|
|
.then((result) async => {
|
|
|
|
|
res = result,
|
|
|
|
|
if (result is Map)
|
|
|
|
|
{
|
|
|
|
|
result = CheckActivationCode.fromJson(result as Map<String, dynamic>),
|
|
|
|
|
// if (result.errorCode == '699')
|
|
|
|
|
// {
|
|
|
|
|
// //699 block run here
|
|
|
|
|
// GifLoaderDialogUtils.hideDialog(context),
|
|
|
|
|
// Future.delayed(Duration(seconds: 2), () {
|
|
|
|
|
// AppToast.showErrorToast(message: result.errorEndUserMessage);
|
|
|
|
|
// Navigator.popUntil(context, (route) => Utils.route(route, equalsTo: Login));
|
|
|
|
|
// })
|
|
|
|
|
// }
|
|
|
|
|
// else if (this.registerd_data != null && this.registerd_data.isRegister == true)
|
|
|
|
|
// {
|
|
|
|
|
// widget.changePageViewIndex!(1),
|
|
|
|
|
// Navigator.popUntil(context, (route) => Utils.route(route, equalsTo: RegisterNew)),
|
|
|
|
|
// }
|
|
|
|
|
// else
|
|
|
|
|
if (result.errorCode == '699')
|
|
|
|
|
{
|
|
|
|
|
//699 block run here
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context),
|
|
|
|
|
Future.delayed(Duration(seconds: 2), () {
|
|
|
|
|
AppToast.showErrorToast(message: result.errorEndUserMessage);
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
sharedPref.remove(FAMILY_FILE),
|
|
|
|
|
result.list.isFamily = false,
|
|
|
|
|
@ -492,65 +493,27 @@ class _SavedLogin extends State<SavedLogin> {
|
|
|
|
|
|
|
|
|
|
// GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
getToDoCount();
|
|
|
|
|
|
|
|
|
|
checkIfIsInPatient() {
|
|
|
|
|
bool isAdmitted = false;
|
|
|
|
|
bool hasAdmissionRequest = false;
|
|
|
|
|
GetAdmissionInfoResponseModel getAdmissionInfoResponseModel;
|
|
|
|
|
GetAdmissionRequestInfoResponseModel getAdmissionRequestInfoResponseModel;
|
|
|
|
|
ClinicListService service = new ClinicListService();
|
|
|
|
|
service.checkIfInPatientAPI(context).then((res) {
|
|
|
|
|
if (res['MessageStatus'] == 1) {
|
|
|
|
|
isAdmitted = res['isAdmitted'];
|
|
|
|
|
hasAdmissionRequest = res['hasAdmissionRequests'];
|
|
|
|
|
print("IS ADMITTED: $isAdmitted");
|
|
|
|
|
print("Has Admission Request: $hasAdmissionRequest");
|
|
|
|
|
if (isAdmitted) {
|
|
|
|
|
if (res['PatientAdmittedInformation'].length != 0) {
|
|
|
|
|
getAdmissionInfoResponseModel = GetAdmissionInfoResponseModel.fromJson(res['PatientAdmittedInformation'][0]);
|
|
|
|
|
projectViewModel.setInPatientProjectID(res['PatientAdmittedInformation'][0]['ProjectID']);
|
|
|
|
|
projectViewModel.setInPatientAdmissionInfo(getAdmissionInfoResponseModel);
|
|
|
|
|
projectViewModel.setIsPatientAdmitted(true);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (hasAdmissionRequest) {
|
|
|
|
|
if (res['MedicalInstruction'].length != 0) {
|
|
|
|
|
getAdmissionRequestInfoResponseModel = GetAdmissionRequestInfoResponseModel.fromJson(res['MedicalInstruction'][0]);
|
|
|
|
|
// projectViewModel.setInPatientProjectID(res['MedicalInstruction'][0]['ProjectID']);
|
|
|
|
|
projectViewModel.setInPatientProjectID(res['MedicalInstruction'][0]['projectId']);
|
|
|
|
|
projectViewModel.setInPatientAdmissionRequest(getAdmissionRequestInfoResponseModel);
|
|
|
|
|
projectViewModel.setPatientHasAdmissionRequest(true);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {}
|
|
|
|
|
});
|
|
|
|
|
}();
|
|
|
|
|
appointmentRateViewModel
|
|
|
|
|
.getIsLastAppointmentRatedList(projectViewModel.isArabic ? 1 : 2)
|
|
|
|
|
.then((value) => {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(AppGlobal.context),
|
|
|
|
|
if (appointmentRateViewModel.isHaveAppointmentNotRate)
|
|
|
|
|
{
|
|
|
|
|
Navigator.pushAndRemoveUntil(
|
|
|
|
|
context,
|
|
|
|
|
FadePage(
|
|
|
|
|
page: RateAppointmentDoctor(),
|
|
|
|
|
),
|
|
|
|
|
(r) => false)
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Navigator.pushAndRemoveUntil(
|
|
|
|
|
context,
|
|
|
|
|
FadePage(
|
|
|
|
|
page: LandingPage(),
|
|
|
|
|
),
|
|
|
|
|
(r) => false)
|
|
|
|
|
},
|
|
|
|
|
insertIMEI(type)
|
|
|
|
|
})
|
|
|
|
|
.catchError((err) {
|
|
|
|
|
print(err);
|
|
|
|
|
checkIfIsInPatient();
|
|
|
|
|
|
|
|
|
|
appointmentRateViewModel.getIsLastAppointmentRatedList(projectViewModel.isArabic ? 1 : 2).then((_) {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(AppGlobal.context);
|
|
|
|
|
|
|
|
|
|
if (appointmentRateViewModel.isHaveAppointmentNotRate) {
|
|
|
|
|
Navigator.pushAndRemoveUntil(
|
|
|
|
|
context,
|
|
|
|
|
FadePage(page: RateAppointmentDoctor()),
|
|
|
|
|
(route) => false,
|
|
|
|
|
);
|
|
|
|
|
} else {
|
|
|
|
|
Navigator.pushAndRemoveUntil(
|
|
|
|
|
context,
|
|
|
|
|
FadePage(page: LandingPage()),
|
|
|
|
|
(route) => false,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
insertIMEI(type);
|
|
|
|
|
}).catchError((error) {
|
|
|
|
|
print(error);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -575,7 +538,6 @@ class _SavedLogin extends State<SavedLogin> {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
checkUserAuthentication(type) {
|
|
|
|
|
// showLoader(true);
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
var req = this.authService.getCommonRequest(type: type,
|
|
|
|
|
registerd_data: null,
|
|
|
|
|
@ -593,7 +555,6 @@ class _SavedLogin extends State<SavedLogin> {
|
|
|
|
|
authService
|
|
|
|
|
.checkPatientAuthentication(request)
|
|
|
|
|
.then((value) => {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context),
|
|
|
|
|
if (value['isSMSSent'])
|
|
|
|
|
{
|
|
|
|
|
sharedPref.setString(LOGIN_TOKEN_ID, value['LogInTokenID']),
|
|
|
|
|
@ -665,4 +626,31 @@ class _SavedLogin extends State<SavedLogin> {
|
|
|
|
|
},
|
|
|
|
|
).displayDialog(context);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void checkIfIsInPatient() {
|
|
|
|
|
final service = ClinicListService();
|
|
|
|
|
service.checkIfInPatientAPI(context).then((res) {
|
|
|
|
|
if (res['MessageStatus'] != 1) return;
|
|
|
|
|
|
|
|
|
|
final isAdmitted = res['isAdmitted'] == true;
|
|
|
|
|
final hasAdmissionRequest = res['hasAdmissionRequests'] == true;
|
|
|
|
|
|
|
|
|
|
print("IS ADMITTED: $isAdmitted");
|
|
|
|
|
print("Has Admission Request: $hasAdmissionRequest");
|
|
|
|
|
|
|
|
|
|
if (isAdmitted && res['PatientAdmittedInformation']?.isNotEmpty == true) {
|
|
|
|
|
final info = GetAdmissionInfoResponseModel.fromJson(res['PatientAdmittedInformation'][0]);
|
|
|
|
|
projectViewModel.setInPatientProjectID(res['PatientAdmittedInformation'][0]['ProjectID']);
|
|
|
|
|
projectViewModel.setInPatientAdmissionInfo(info);
|
|
|
|
|
projectViewModel.setIsPatientAdmitted(true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (hasAdmissionRequest && res['MedicalInstruction']?.isNotEmpty == true) {
|
|
|
|
|
final reqInfo = GetAdmissionRequestInfoResponseModel.fromJson(res['MedicalInstruction'][0]);
|
|
|
|
|
projectViewModel.setInPatientProjectID(res['MedicalInstruction'][0]['projectId']);
|
|
|
|
|
projectViewModel.setInPatientAdmissionRequest(reqInfo);
|
|
|
|
|
projectViewModel.setPatientHasAdmissionRequest(true);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|