login changes

merge-update-with-lab-changes
Sultan Khan 6 years ago
parent 9d0a2e1e43
commit 0bc529f420

@ -4,7 +4,7 @@ import 'dart:io';
const MAX_SMALL_SCREEN = 660;
const BASE_URL = 'https://hmgwebservices.com/Services';
const BASE_URL = 'https://uat.hmgwebservices.com/Services';
const GET_PROJECT = '/Lists.svc/REST/GetProject';
@ -13,12 +13,12 @@ const GET_MY_DOCTOR = '/Doctors.svc/REST/GetPatientDoctorAppointmentResult';
const GET_DOCTOR_PROFILE = '/Doctors.svc/REST/GetDocProfiles';
const GET_DOCTOR_RATING = '/Doctors.svc/REST/dr_GetAvgDoctorRating';
///Prescriptions
const PRESCRIPTIONS = '/Patients.svc/REST/GetPrescriptionApptList';
const GET_PRESCRIPTIONS_ALL_ORDERS = '/Patients.svc/REST/PatientER_GetPatientAllPresOrders';
const GET_PRESCRIPTION_REPORT = '/Patients.svc/REST/INP_GetPrescriptionReport';
const SEND_PRESCRIPTION_EMAIL = '/Notifications.svc/REST/SendPrescriptionEmail';
const GET_PRESCRIPTIONS_ALL_ORDERS =
'/Patients.svc/REST/PatientER_GetPatientAllPresOrders';
const GET_PRESCRIPTION_REPORT = '/Patients.svc/REST/INP_GetPrescriptionReport';
const SEND_PRESCRIPTION_EMAIL = '/Notifications.svc/REST/SendPrescriptionEmail';
//const BASE_URL = 'https://hmgwebservices.com/'; // Production Environment
//const BASE_URL = 'https://uat.hmgwebservices.com/Services'; // UAT Environment
@ -34,7 +34,7 @@ const GENERAL_ID = 'Cs2020@2016\$2958';
const IP_ADDRESS = '10.20.10.20';
const VERSION_ID = 5.5;
var DeviceTypeID = Platform.isIOS ? 1 : 2;
const LANGUAGE_ID = 2;
const GET_PHARMCY_ITEMS = "/Lists.svc/REST/GetPharmcyItems_Region";
const GET_PHARMACY_LIST = "/Patients.svc/REST/GetPharmcyList";
@ -59,5 +59,3 @@ class AppGlobal {
return request;
}
}

@ -137,4 +137,5 @@ const Map<String, Map<String, String>> localizedValues = {
"en": "Would you like to login with current username?",
"ar": "هل ترغب في تسجيل الدخول باسم المستخدم الحالي؟"
},
"another-acc": {"en": "Use Another Account", "ar": "استخدم حسابا آخر"},
};

@ -9,3 +9,4 @@ const LAST_LOGIN = 'last-login';
const ONLY_SMS = 'only-sms';
const AUTH_DATA = 'auth-data';
const IMEI_USER_DATA = 'imei-user-data';
const NHIC_DATA = 'nhic-data';

@ -46,12 +46,14 @@ class BaseAppClient {
if (!parsed['IsAuthenticated']) {
if (parsed['isSMSSent'] == true) {
onSuccess(parsed, statusCode);
} else if (parsed['MessageStatus'] == 1) {
onSuccess(parsed, statusCode);
} else {
logout();
}
// await helpers.logout();
//helpers.showErrorToast('Your session expired Please login agian');
var asd ="";
// var asd = "";
// TODO create logout fun
} else if (parsed['MessageStatus'] == 1 ||
parsed['SMSLoginRequired'] == true) {

@ -0,0 +1,316 @@
class CheckUserStatusResponse {
Null date;
int languageID;
int serviceName;
Null time;
Null androidLink;
Null authenticationTokenID;
Null data;
bool dataw;
int dietType;
Null errorCode;
Null errorEndUserMessage;
Null errorEndUserMessageN;
Null errorMessage;
int errorType;
int foodCategory;
Null iOSLink;
bool isAuthenticated;
int mealOrderStatus;
int mealType;
int messageStatus;
int numberOfResultRecords;
Null patientBlodType;
Null successMsg;
Null successMsgN;
Null accessTokenObject;
int age;
Null clientIdentifierId;
int createdBy;
String dateOfBirth;
String firstNameAr;
String firstNameEn;
String gender;
Null genderAr;
Null genderEn;
String healthId;
String idNumber;
String idType;
bool isHijri;
int isInstertedOrUpdated;
int isNull;
int isPatientExistNHIC;
String lastNameAr;
String lastNameEn;
Null listActiveAccessToken;
String maritalStatus;
String maritalStatusCode;
String nationality;
String nationalityCode;
String occupation;
String patientStatus;
String placeofBirth;
Null practitionerStatusCode;
Null practitionerStatusDescAr;
Null practitionerStatusDescEn;
String secondNameAr;
String secondNameEn;
String thirdNameAr;
String thirdNameEn;
Null accessToken;
int categoryCode;
Null categoryNameAr;
Null categoryNameEn;
int constraintCode;
Null constraintNameAr;
Null constraintNameEn;
Null content;
Null licenseExpiryDate;
Null licenseIssuedDate;
Null licenseStatusCode;
Null licenseStatusDescAr;
Null licenseStatusDescEn;
Null organizations;
Null registrationNumber;
int specialtyCode;
Null specialtyNameAr;
Null specialtyNameEn;
CheckUserStatusResponse(
{this.date,
this.languageID,
this.serviceName,
this.time,
this.androidLink,
this.authenticationTokenID,
this.data,
this.dataw,
this.dietType,
this.errorCode,
this.errorEndUserMessage,
this.errorEndUserMessageN,
this.errorMessage,
this.errorType,
this.foodCategory,
this.iOSLink,
this.isAuthenticated,
this.mealOrderStatus,
this.mealType,
this.messageStatus,
this.numberOfResultRecords,
this.patientBlodType,
this.successMsg,
this.successMsgN,
this.accessTokenObject,
this.age,
this.clientIdentifierId,
this.createdBy,
this.dateOfBirth,
this.firstNameAr,
this.firstNameEn,
this.gender,
this.genderAr,
this.genderEn,
this.healthId,
this.idNumber,
this.idType,
this.isHijri,
this.isInstertedOrUpdated,
this.isNull,
this.isPatientExistNHIC,
this.lastNameAr,
this.lastNameEn,
this.listActiveAccessToken,
this.maritalStatus,
this.maritalStatusCode,
this.nationality,
this.nationalityCode,
this.occupation,
this.patientStatus,
this.placeofBirth,
this.practitionerStatusCode,
this.practitionerStatusDescAr,
this.practitionerStatusDescEn,
this.secondNameAr,
this.secondNameEn,
this.thirdNameAr,
this.thirdNameEn,
this.accessToken,
this.categoryCode,
this.categoryNameAr,
this.categoryNameEn,
this.constraintCode,
this.constraintNameAr,
this.constraintNameEn,
this.content,
this.licenseExpiryDate,
this.licenseIssuedDate,
this.licenseStatusCode,
this.licenseStatusDescAr,
this.licenseStatusDescEn,
this.organizations,
this.registrationNumber,
this.specialtyCode,
this.specialtyNameAr,
this.specialtyNameEn});
CheckUserStatusResponse.fromJson(Map<String, dynamic> json) {
date = json['Date'];
languageID = json['LanguageID'];
serviceName = json['ServiceName'];
time = json['Time'];
androidLink = json['AndroidLink'];
authenticationTokenID = json['AuthenticationTokenID'];
data = json['Data'];
dataw = json['Dataw'];
dietType = json['DietType'];
errorCode = json['ErrorCode'];
errorEndUserMessage = json['ErrorEndUserMessage'];
errorEndUserMessageN = json['ErrorEndUserMessageN'];
errorMessage = json['ErrorMessage'];
errorType = json['ErrorType'];
foodCategory = json['FoodCategory'];
iOSLink = json['IOSLink'];
isAuthenticated = json['IsAuthenticated'];
mealOrderStatus = json['MealOrderStatus'];
mealType = json['MealType'];
messageStatus = json['MessageStatus'];
numberOfResultRecords = json['NumberOfResultRecords'];
patientBlodType = json['PatientBlodType'];
successMsg = json['SuccessMsg'];
successMsgN = json['SuccessMsgN'];
accessTokenObject = json['AccessTokenObject'];
age = json['Age'];
clientIdentifierId = json['ClientIdentifierId'];
createdBy = json['CreatedBy'];
dateOfBirth = json['DateOfBirth'];
firstNameAr = json['FirstNameAr'];
firstNameEn = json['FirstNameEn'];
gender = json['Gender'];
genderAr = json['GenderAr'];
genderEn = json['GenderEn'];
healthId = json['HealthId'];
idNumber = json['IdNumber'];
idType = json['IdType'];
isHijri = json['IsHijri'];
isInstertedOrUpdated = json['IsInstertedOrUpdated'];
isNull = json['IsNull'];
isPatientExistNHIC = json['IsPatientExistNHIC'];
lastNameAr = json['LastNameAr'];
lastNameEn = json['LastNameEn'];
listActiveAccessToken = json['List_ActiveAccessToken'];
maritalStatus = json['MaritalStatus'];
maritalStatusCode = json['MaritalStatusCode'];
nationality = json['Nationality'];
nationalityCode = json['NationalityCode'];
occupation = json['Occupation'];
patientStatus = json['PatientStatus'];
placeofBirth = json['PlaceofBirth'];
practitionerStatusCode = json['PractitionerStatusCode'];
practitionerStatusDescAr = json['PractitionerStatusDescAr'];
practitionerStatusDescEn = json['PractitionerStatusDescEn'];
secondNameAr = json['SecondNameAr'];
secondNameEn = json['SecondNameEn'];
thirdNameAr = json['ThirdNameAr'];
thirdNameEn = json['ThirdNameEn'];
accessToken = json['accessToken'];
categoryCode = json['categoryCode'];
categoryNameAr = json['categoryNameAr'];
categoryNameEn = json['categoryNameEn'];
constraintCode = json['constraintCode'];
constraintNameAr = json['constraintNameAr'];
constraintNameEn = json['constraintNameEn'];
content = json['content'];
licenseExpiryDate = json['licenseExpiryDate'];
licenseIssuedDate = json['licenseIssuedDate'];
licenseStatusCode = json['licenseStatusCode'];
licenseStatusDescAr = json['licenseStatusDescAr'];
licenseStatusDescEn = json['licenseStatusDescEn'];
organizations = json['organizations'];
registrationNumber = json['registrationNumber'];
specialtyCode = json['specialtyCode'];
specialtyNameAr = json['specialtyNameAr'];
specialtyNameEn = json['specialtyNameEn'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['Date'] = this.date;
data['LanguageID'] = this.languageID;
data['ServiceName'] = this.serviceName;
data['Time'] = this.time;
data['AndroidLink'] = this.androidLink;
data['AuthenticationTokenID'] = this.authenticationTokenID;
data['Data'] = this.data;
data['Dataw'] = this.dataw;
data['DietType'] = this.dietType;
data['ErrorCode'] = this.errorCode;
data['ErrorEndUserMessage'] = this.errorEndUserMessage;
data['ErrorEndUserMessageN'] = this.errorEndUserMessageN;
data['ErrorMessage'] = this.errorMessage;
data['ErrorType'] = this.errorType;
data['FoodCategory'] = this.foodCategory;
data['IOSLink'] = this.iOSLink;
data['IsAuthenticated'] = this.isAuthenticated;
data['MealOrderStatus'] = this.mealOrderStatus;
data['MealType'] = this.mealType;
data['MessageStatus'] = this.messageStatus;
data['NumberOfResultRecords'] = this.numberOfResultRecords;
data['PatientBlodType'] = this.patientBlodType;
data['SuccessMsg'] = this.successMsg;
data['SuccessMsgN'] = this.successMsgN;
data['AccessTokenObject'] = this.accessTokenObject;
data['Age'] = this.age;
data['ClientIdentifierId'] = this.clientIdentifierId;
data['CreatedBy'] = this.createdBy;
data['DateOfBirth'] = this.dateOfBirth;
data['FirstNameAr'] = this.firstNameAr;
data['FirstNameEn'] = this.firstNameEn;
data['Gender'] = this.gender;
data['GenderAr'] = this.genderAr;
data['GenderEn'] = this.genderEn;
data['HealthId'] = this.healthId;
data['IdNumber'] = this.idNumber;
data['IdType'] = this.idType;
data['IsHijri'] = this.isHijri;
data['IsInstertedOrUpdated'] = this.isInstertedOrUpdated;
data['IsNull'] = this.isNull;
data['IsPatientExistNHIC'] = this.isPatientExistNHIC;
data['LastNameAr'] = this.lastNameAr;
data['LastNameEn'] = this.lastNameEn;
data['List_ActiveAccessToken'] = this.listActiveAccessToken;
data['MaritalStatus'] = this.maritalStatus;
data['MaritalStatusCode'] = this.maritalStatusCode;
data['Nationality'] = this.nationality;
data['NationalityCode'] = this.nationalityCode;
data['Occupation'] = this.occupation;
data['PatientStatus'] = this.patientStatus;
data['PlaceofBirth'] = this.placeofBirth;
data['PractitionerStatusCode'] = this.practitionerStatusCode;
data['PractitionerStatusDescAr'] = this.practitionerStatusDescAr;
data['PractitionerStatusDescEn'] = this.practitionerStatusDescEn;
data['SecondNameAr'] = this.secondNameAr;
data['SecondNameEn'] = this.secondNameEn;
data['ThirdNameAr'] = this.thirdNameAr;
data['ThirdNameEn'] = this.thirdNameEn;
data['accessToken'] = this.accessToken;
data['categoryCode'] = this.categoryCode;
data['categoryNameAr'] = this.categoryNameAr;
data['categoryNameEn'] = this.categoryNameEn;
data['constraintCode'] = this.constraintCode;
data['constraintNameAr'] = this.constraintNameAr;
data['constraintNameEn'] = this.constraintNameEn;
data['content'] = this.content;
data['licenseExpiryDate'] = this.licenseExpiryDate;
data['licenseIssuedDate'] = this.licenseIssuedDate;
data['licenseStatusCode'] = this.licenseStatusCode;
data['licenseStatusDescAr'] = this.licenseStatusDescAr;
data['licenseStatusDescEn'] = this.licenseStatusDescEn;
data['organizations'] = this.organizations;
data['registrationNumber'] = this.registrationNumber;
data['specialtyCode'] = this.specialtyCode;
data['specialtyNameAr'] = this.specialtyNameAr;
data['specialtyNameEn'] = this.specialtyNameEn;
return data;
}
}

@ -0,0 +1,60 @@
class CheckUserStatusRequest {
String patientIdentificationID;
String dOB;
int isHijri;
double versionID;
int channel;
int languageID;
String iPAdress;
String generalid;
int patientOutSA;
Null sessionID;
bool isDentalAllowedBackend;
int deviceTypeID;
CheckUserStatusRequest(
{this.patientIdentificationID,
this.dOB,
this.isHijri,
this.versionID,
this.channel,
this.languageID,
this.iPAdress,
this.generalid,
this.patientOutSA,
this.sessionID,
this.isDentalAllowedBackend,
this.deviceTypeID});
CheckUserStatusRequest.fromJson(Map<String, dynamic> json) {
patientIdentificationID = json['PatientIdentificationID'];
dOB = json['DOB'];
isHijri = json['IsHijri'];
versionID = json['VersionID'];
channel = json['Channel'];
languageID = json['LanguageID'];
iPAdress = json['IPAdress'];
generalid = json['generalid'];
patientOutSA = json['PatientOutSA'];
sessionID = json['SessionID'];
isDentalAllowedBackend = json['isDentalAllowedBackend'];
deviceTypeID = json['DeviceTypeID'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['PatientIdentificationID'] = this.patientIdentificationID;
data['DOB'] = this.dOB;
data['IsHijri'] = this.isHijri;
data['VersionID'] = this.versionID;
data['Channel'] = this.channel;
data['LanguageID'] = this.languageID;
data['IPAdress'] = this.iPAdress;
data['generalid'] = this.generalid;
data['PatientOutSA'] = this.patientOutSA;
data['SessionID'] = this.sessionID;
data['isDentalAllowedBackend'] = this.isDentalAllowedBackend;
data['DeviceTypeID'] = this.deviceTypeID;
return data;
}
}

@ -0,0 +1,72 @@
class CheckPatientForRegistration {
int patientIdentificationID;
int patientMobileNumber;
String zipCode;
double versionID;
int channel;
int languageID;
String iPAdress;
String generalid;
int patientOutSA;
Null sessionID;
bool isDentalAllowedBackend;
int deviceTypeID;
String tokenID;
int patientID;
bool isRegister;
CheckPatientForRegistration(
{this.patientIdentificationID,
this.patientMobileNumber,
this.zipCode,
this.versionID,
this.channel,
this.languageID,
this.iPAdress,
this.generalid,
this.patientOutSA,
this.sessionID,
this.isDentalAllowedBackend,
this.deviceTypeID,
this.tokenID,
this.patientID,
this.isRegister});
CheckPatientForRegistration.fromJson(Map<String, dynamic> json) {
patientIdentificationID = json['PatientIdentificationID'];
patientMobileNumber = json['PatientMobileNumber'];
zipCode = json['ZipCode'];
versionID = json['VersionID'];
channel = json['Channel'];
languageID = json['LanguageID'];
iPAdress = json['IPAdress'];
generalid = json['generalid'];
patientOutSA = json['PatientOutSA'];
sessionID = json['SessionID'];
isDentalAllowedBackend = json['isDentalAllowedBackend'];
deviceTypeID = json['DeviceTypeID'];
tokenID = json['TokenID'];
patientID = json['PatientID'];
isRegister = json['isRegister'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['PatientIdentificationID'] = this.patientIdentificationID;
data['PatientMobileNumber'] = this.patientMobileNumber;
data['ZipCode'] = this.zipCode;
data['VersionID'] = this.versionID;
data['Channel'] = this.channel;
data['LanguageID'] = this.languageID;
data['IPAdress'] = this.iPAdress;
data['generalid'] = this.generalid;
data['PatientOutSA'] = this.patientOutSA;
data['SessionID'] = this.sessionID;
data['isDentalAllowedBackend'] = this.isDentalAllowedBackend;
data['DeviceTypeID'] = this.deviceTypeID;
data['TokenID'] = this.tokenID;
data['PatientID'] = this.patientID;
data['isRegister'] = this.isRegister;
return data;
}
}

@ -0,0 +1,316 @@
class RegisterInfoResponse {
Null date;
int languageID;
int serviceName;
Null time;
Null androidLink;
Null authenticationTokenID;
Null data;
bool dataw;
int dietType;
Null errorCode;
Null errorEndUserMessage;
Null errorEndUserMessageN;
Null errorMessage;
int errorType;
int foodCategory;
Null iOSLink;
bool isAuthenticated;
int mealOrderStatus;
int mealType;
int messageStatus;
int numberOfResultRecords;
Null patientBlodType;
Null successMsg;
Null successMsgN;
Null accessTokenObject;
int age;
Null clientIdentifierId;
int createdBy;
String dateOfBirth;
String firstNameAr;
String firstNameEn;
String gender;
Null genderAr;
Null genderEn;
String healthId;
String idNumber;
String idType;
bool isHijri;
int isInstertedOrUpdated;
int isNull;
int isPatientExistNHIC;
String lastNameAr;
String lastNameEn;
Null listActiveAccessToken;
String maritalStatus;
String maritalStatusCode;
String nationality;
String nationalityCode;
String occupation;
String patientStatus;
String placeofBirth;
Null practitionerStatusCode;
Null practitionerStatusDescAr;
Null practitionerStatusDescEn;
String secondNameAr;
String secondNameEn;
String thirdNameAr;
String thirdNameEn;
Null accessToken;
int categoryCode;
Null categoryNameAr;
Null categoryNameEn;
int constraintCode;
Null constraintNameAr;
Null constraintNameEn;
Null content;
Null licenseExpiryDate;
Null licenseIssuedDate;
Null licenseStatusCode;
Null licenseStatusDescAr;
Null licenseStatusDescEn;
Null organizations;
Null registrationNumber;
int specialtyCode;
Null specialtyNameAr;
Null specialtyNameEn;
RegisterInfoResponse(
{this.date,
this.languageID,
this.serviceName,
this.time,
this.androidLink,
this.authenticationTokenID,
this.data,
this.dataw,
this.dietType,
this.errorCode,
this.errorEndUserMessage,
this.errorEndUserMessageN,
this.errorMessage,
this.errorType,
this.foodCategory,
this.iOSLink,
this.isAuthenticated,
this.mealOrderStatus,
this.mealType,
this.messageStatus,
this.numberOfResultRecords,
this.patientBlodType,
this.successMsg,
this.successMsgN,
this.accessTokenObject,
this.age,
this.clientIdentifierId,
this.createdBy,
this.dateOfBirth,
this.firstNameAr,
this.firstNameEn,
this.gender,
this.genderAr,
this.genderEn,
this.healthId,
this.idNumber,
this.idType,
this.isHijri,
this.isInstertedOrUpdated,
this.isNull,
this.isPatientExistNHIC,
this.lastNameAr,
this.lastNameEn,
this.listActiveAccessToken,
this.maritalStatus,
this.maritalStatusCode,
this.nationality,
this.nationalityCode,
this.occupation,
this.patientStatus,
this.placeofBirth,
this.practitionerStatusCode,
this.practitionerStatusDescAr,
this.practitionerStatusDescEn,
this.secondNameAr,
this.secondNameEn,
this.thirdNameAr,
this.thirdNameEn,
this.accessToken,
this.categoryCode,
this.categoryNameAr,
this.categoryNameEn,
this.constraintCode,
this.constraintNameAr,
this.constraintNameEn,
this.content,
this.licenseExpiryDate,
this.licenseIssuedDate,
this.licenseStatusCode,
this.licenseStatusDescAr,
this.licenseStatusDescEn,
this.organizations,
this.registrationNumber,
this.specialtyCode,
this.specialtyNameAr,
this.specialtyNameEn});
RegisterInfoResponse.fromJson(Map<String, dynamic> json) {
date = json['Date'];
languageID = json['LanguageID'];
serviceName = json['ServiceName'];
time = json['Time'];
androidLink = json['AndroidLink'];
authenticationTokenID = json['AuthenticationTokenID'];
data = json['Data'];
dataw = json['Dataw'];
dietType = json['DietType'];
errorCode = json['ErrorCode'];
errorEndUserMessage = json['ErrorEndUserMessage'];
errorEndUserMessageN = json['ErrorEndUserMessageN'];
errorMessage = json['ErrorMessage'];
errorType = json['ErrorType'];
foodCategory = json['FoodCategory'];
iOSLink = json['IOSLink'];
isAuthenticated = json['IsAuthenticated'];
mealOrderStatus = json['MealOrderStatus'];
mealType = json['MealType'];
messageStatus = json['MessageStatus'];
numberOfResultRecords = json['NumberOfResultRecords'];
patientBlodType = json['PatientBlodType'];
successMsg = json['SuccessMsg'];
successMsgN = json['SuccessMsgN'];
accessTokenObject = json['AccessTokenObject'];
age = json['Age'];
clientIdentifierId = json['ClientIdentifierId'];
createdBy = json['CreatedBy'];
dateOfBirth = json['DateOfBirth'];
firstNameAr = json['FirstNameAr'];
firstNameEn = json['FirstNameEn'];
gender = json['Gender'];
genderAr = json['GenderAr'];
genderEn = json['GenderEn'];
healthId = json['HealthId'];
idNumber = json['IdNumber'];
idType = json['IdType'];
isHijri = json['IsHijri'];
isInstertedOrUpdated = json['IsInstertedOrUpdated'];
isNull = json['IsNull'];
isPatientExistNHIC = json['IsPatientExistNHIC'];
lastNameAr = json['LastNameAr'];
lastNameEn = json['LastNameEn'];
listActiveAccessToken = json['List_ActiveAccessToken'];
maritalStatus = json['MaritalStatus'];
maritalStatusCode = json['MaritalStatusCode'];
nationality = json['Nationality'];
nationalityCode = json['NationalityCode'];
occupation = json['Occupation'];
patientStatus = json['PatientStatus'];
placeofBirth = json['PlaceofBirth'];
practitionerStatusCode = json['PractitionerStatusCode'];
practitionerStatusDescAr = json['PractitionerStatusDescAr'];
practitionerStatusDescEn = json['PractitionerStatusDescEn'];
secondNameAr = json['SecondNameAr'];
secondNameEn = json['SecondNameEn'];
thirdNameAr = json['ThirdNameAr'];
thirdNameEn = json['ThirdNameEn'];
accessToken = json['accessToken'];
categoryCode = json['categoryCode'];
categoryNameAr = json['categoryNameAr'];
categoryNameEn = json['categoryNameEn'];
constraintCode = json['constraintCode'];
constraintNameAr = json['constraintNameAr'];
constraintNameEn = json['constraintNameEn'];
content = json['content'];
licenseExpiryDate = json['licenseExpiryDate'];
licenseIssuedDate = json['licenseIssuedDate'];
licenseStatusCode = json['licenseStatusCode'];
licenseStatusDescAr = json['licenseStatusDescAr'];
licenseStatusDescEn = json['licenseStatusDescEn'];
organizations = json['organizations'];
registrationNumber = json['registrationNumber'];
specialtyCode = json['specialtyCode'];
specialtyNameAr = json['specialtyNameAr'];
specialtyNameEn = json['specialtyNameEn'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['Date'] = this.date;
data['LanguageID'] = this.languageID;
data['ServiceName'] = this.serviceName;
data['Time'] = this.time;
data['AndroidLink'] = this.androidLink;
data['AuthenticationTokenID'] = this.authenticationTokenID;
data['Data'] = this.data;
data['Dataw'] = this.dataw;
data['DietType'] = this.dietType;
data['ErrorCode'] = this.errorCode;
data['ErrorEndUserMessage'] = this.errorEndUserMessage;
data['ErrorEndUserMessageN'] = this.errorEndUserMessageN;
data['ErrorMessage'] = this.errorMessage;
data['ErrorType'] = this.errorType;
data['FoodCategory'] = this.foodCategory;
data['IOSLink'] = this.iOSLink;
data['IsAuthenticated'] = this.isAuthenticated;
data['MealOrderStatus'] = this.mealOrderStatus;
data['MealType'] = this.mealType;
data['MessageStatus'] = this.messageStatus;
data['NumberOfResultRecords'] = this.numberOfResultRecords;
data['PatientBlodType'] = this.patientBlodType;
data['SuccessMsg'] = this.successMsg;
data['SuccessMsgN'] = this.successMsgN;
data['AccessTokenObject'] = this.accessTokenObject;
data['Age'] = this.age;
data['ClientIdentifierId'] = this.clientIdentifierId;
data['CreatedBy'] = this.createdBy;
data['DateOfBirth'] = this.dateOfBirth;
data['FirstNameAr'] = this.firstNameAr;
data['FirstNameEn'] = this.firstNameEn;
data['Gender'] = this.gender;
data['GenderAr'] = this.genderAr;
data['GenderEn'] = this.genderEn;
data['HealthId'] = this.healthId;
data['IdNumber'] = this.idNumber;
data['IdType'] = this.idType;
data['IsHijri'] = this.isHijri;
data['IsInstertedOrUpdated'] = this.isInstertedOrUpdated;
data['IsNull'] = this.isNull;
data['IsPatientExistNHIC'] = this.isPatientExistNHIC;
data['LastNameAr'] = this.lastNameAr;
data['LastNameEn'] = this.lastNameEn;
data['List_ActiveAccessToken'] = this.listActiveAccessToken;
data['MaritalStatus'] = this.maritalStatus;
data['MaritalStatusCode'] = this.maritalStatusCode;
data['Nationality'] = this.nationality;
data['NationalityCode'] = this.nationalityCode;
data['Occupation'] = this.occupation;
data['PatientStatus'] = this.patientStatus;
data['PlaceofBirth'] = this.placeofBirth;
data['PractitionerStatusCode'] = this.practitionerStatusCode;
data['PractitionerStatusDescAr'] = this.practitionerStatusDescAr;
data['PractitionerStatusDescEn'] = this.practitionerStatusDescEn;
data['SecondNameAr'] = this.secondNameAr;
data['SecondNameEn'] = this.secondNameEn;
data['ThirdNameAr'] = this.thirdNameAr;
data['ThirdNameEn'] = this.thirdNameEn;
data['accessToken'] = this.accessToken;
data['categoryCode'] = this.categoryCode;
data['categoryNameAr'] = this.categoryNameAr;
data['categoryNameEn'] = this.categoryNameEn;
data['constraintCode'] = this.constraintCode;
data['constraintNameAr'] = this.constraintNameAr;
data['constraintNameEn'] = this.constraintNameEn;
data['content'] = this.content;
data['licenseExpiryDate'] = this.licenseExpiryDate;
data['licenseIssuedDate'] = this.licenseIssuedDate;
data['licenseStatusCode'] = this.licenseStatusCode;
data['licenseStatusDescAr'] = this.licenseStatusDescAr;
data['licenseStatusDescEn'] = this.licenseStatusDescEn;
data['organizations'] = this.organizations;
data['registrationNumber'] = this.registrationNumber;
data['specialtyCode'] = this.specialtyCode;
data['specialtyNameAr'] = this.specialtyNameAr;
data['specialtyNameEn'] = this.specialtyNameEn;
return data;
}
}

@ -9,6 +9,7 @@ import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart';
import 'package:diplomaticquarterapp/widgets/card/rounded_container.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/otp/sms-popup.dart';
@ -59,6 +60,8 @@ class _ConfirmLogin extends State<ConfirmLogin> {
static bool _loading;
int fingrePrintBefore;
@override
void initState() {
_getAvailableBiometrics();
@ -225,22 +228,22 @@ class _ConfirmLogin extends State<ConfirmLogin> {
child: Column(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
// Row(
// children: <Widget>[
// Expanded(
// child: RaisedButton(
// color: Colors.grey,
// textColor: Colors.white,
// child:
// Text(TranslationBase.of(context).registerNow),
// onPressed: () => {
// Navigator.of(context).pushNamed(
// REGISTER,
// )
// },
// ))
// ],
// ),
user != null
? Row(
children: <Widget>[
Expanded(
child: DefaultButton(
TranslationBase.of(context)
.useAnotherAccount,
() => {
Navigator.of(context).pushNamed(
LOGIN_TYPE,
)
},
)),
],
)
: SizedBox(),
],
))
],
@ -263,8 +266,12 @@ class _ConfirmLogin extends State<ConfirmLogin> {
}
authenticateUser(type, isActive) {
this.selectedOption =
type; //this.selectedOption && !this.onlySMSBox ? this.selectedOption : this.fingrePrintBefore ? this.fingrePrintBefore : el.value;
if (type == 2 || type == 3) {
fingrePrintBefore = type;
}
this.selectedOption = user.logInType == 3 || user.logInType == 2
? user.logInType
: fingrePrintBefore != null ? fingrePrintBefore : type;
switch (type) {
case 1:
@ -283,7 +290,7 @@ class _ConfirmLogin extends State<ConfirmLogin> {
break;
}
sharedPref.setInt(LAST_LOGIN,
type); //this.cs.sharedService.setStorage(this.selectedOption, AuthenticationService.LAST_LOGIN);
this.selectedOption); //this.cs.sharedService.setStorage(this.selectedOption, AuthenticationService.LAST_LOGIN);
}
loginWithSMS(type, isActive) {
@ -364,7 +371,7 @@ class _ConfirmLogin extends State<ConfirmLogin> {
getMobileInfo(request) {
this.authService.getLoginInfo(request).then((result) => {
if (!result['SMSLoginRequired'])
if (result['SMSLoginRequired'] == false)
{
this.loginTokenID = result.logInTokenID,
this.patientOutSA = result.patientOutSA,
@ -379,10 +386,12 @@ class _ConfirmLogin extends State<ConfirmLogin> {
}
else
{
if (result['IsAuthenticated'])
if (result['IsAuthenticated'] == true)
{
setState(() {
isMoreOption = true;
this.onlySMSBox = true;
// this.fingrePrintBefore = true;
}),
//sharedPref.setBool(ONLY_SMS, true),
@ -471,7 +480,7 @@ class _ConfirmLogin extends State<ConfirmLogin> {
this.authService.checkActivationCode(request, value: value).then((result) =>
{
if (result != null)
if (result is Map)
{
result = CheckActivationCode.fromJson(result),
@ -482,14 +491,16 @@ class _ConfirmLogin extends State<ConfirmLogin> {
this.sharedPref.setObject(LOGIN_TOKEN_ID, result.logInTokenID),
this.sharedPref.setString(TOKEN, result.authenticationTokenID),
this.checkIfUserAgreedBefore(result),
Navigator.of(context).pop(),
// Navigator.of(context).pop(),
SMSOTP.showLoadingDialog(context, false),
}
else
{
AppToast.showErrorToast(message: 'Please Enter Valid Code'),
Navigator.of(context).pop(),
SMSOTP.showLoadingDialog(context, false)
// Navigator.of(context).pop(),
SMSOTP.showLoadingDialog(context, false),
Future.delayed(Duration(seconds: 1), () {
AppToast.showErrorToast(message: result);
}),
}
});
}
@ -677,7 +688,7 @@ class _ConfirmLogin extends State<ConfirmLogin> {
borderColor: Colors.grey,
showBorder: true,
child: Padding(
padding: EdgeInsets.fromLTRB(0, 10, 0, 5),
padding: EdgeInsets.fromLTRB(0, 0, 0, 5),
child: Column(
children: <Widget>[
Image.asset(

@ -105,7 +105,7 @@ class _Login extends State<Login> {
() => {this.startLogin()},
color: isButtonDisabled == true
? Colors.grey
: Colors.grey[600],
: Colors.grey[900],
textColor: Colors.white,
))
],
@ -123,8 +123,8 @@ class _Login extends State<Login> {
}
void validateForm() {
if (validateIDBox(nationalIDorFile.text) == true &&
mobileNo != null &&
if (util.validateIDBox(nationalIDorFile.text, loginType) == true &&
mobileNo.length >= 9 &&
util.isSAUDIIDValid(nationalIDorFile.text) == true) {
setState(() {
isButtonDisabled = false;
@ -136,18 +136,6 @@ class _Login extends State<Login> {
}
}
bool validateIDBox(String value) {
Pattern pattern = loginIDPattern(); //r'^\d+(?:\.\d+)?$';
RegExp regex = new RegExp(pattern);
return regex.hasMatch(value);
}
String loginIDPattern() {
var length = loginType == 1 ? 10 : 7;
return "([0-9]{" + length.toString() + "})";
}
checkUserAuthentication() {
showLoader(true);
var request = CheckPatientAuthenticationReq();

@ -0,0 +1,132 @@
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
import 'package:diplomaticquarterapp/config/size_config.dart';
import 'package:diplomaticquarterapp/models/Authentication/register_info_response.dart';
import 'package:diplomaticquarterapp/pages/login/login-type.dart';
import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart';
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/uitl/utils.dart';
import 'package:diplomaticquarterapp/widgets/buttons/button.dart';
import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart';
import 'package:diplomaticquarterapp/widgets/card/rounded_container.dart';
import 'package:diplomaticquarterapp/widgets/input/text_field.dart';
import 'package:diplomaticquarterapp/widgets/mobile-no/mobile_no.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
class RegisterInfo extends StatefulWidget {
@override
_RegisterInfo createState() => _RegisterInfo();
}
class _RegisterInfo extends State<RegisterInfo> {
final authService = new AuthProvider();
final sharedPref = new AppSharedPreferences();
RegisterInfoResponse registerInfo;
bool isLoading;
@override
void initState() {
getRegisterInfo();
super.initState();
}
@override
Widget build(BuildContext context) {
return AppScaffold(
appBarTitle: TranslationBase.of(context).register,
isShowAppBar: true,
body: SingleChildScrollView(
child: Container(
padding: EdgeInsets.only(top: 10, left: 20, right: 20, bottom: 30),
height: SizeConfig.realScreenHeight * .9,
width: SizeConfig.realScreenWidth,
child: Column(children: <Widget>[
Expanded(
flex: 1,
child: AppText(
TranslationBase.of(context).patientInfo,
fontSize: SizeConfig.textMultiplier * 3,
textAlign: TextAlign.left,
)),
registerInfo != null
? Expanded(
flex: 4,
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
Container(
child: TextFields(
hintText: registerInfo.idNumber,
prefixIcon:
Icon(Icons.chrome_reader_mode, color: Colors.red),
padding: EdgeInsets.only(
top: 20, bottom: 20, left: 10, right: 10),
readOnly: true,
)),
Container(
child: TextFields(
hintText: registerInfo.firstNameEn +
' ' +
registerInfo.lastNameEn,
padding: EdgeInsets.only(
top: 20, bottom: 20, left: 10, right: 10),
readOnly: true,
)),
Container(
child: TextFields(
hintText: registerInfo.maritalStatusCode,
padding: EdgeInsets.only(
top: 20, bottom: 20, left: 10, right: 10),
readOnly: true,
)),
Container(
child: TextFields(
prefixIcon:
Icon(Icons.chrome_reader_mode, color: Colors.red),
padding: EdgeInsets.only(
top: 20, bottom: 20, left: 10, right: 10),
hintText: TranslationBase.of(context).nationalID,
)),
Container(
child: TextFields(
padding: EdgeInsets.only(
top: 20, bottom: 20, left: 10, right: 10),
hintText: TranslationBase.of(context).nationalID,
)),
],
),
)
: SizedBox(),
Expanded(
flex: 2,
child: Column(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
Row(
children: <Widget>[
Expanded(
child: DefaultButton(
TranslationBase.of(context).registerNow,
() => {registerNow()},
textColor: Colors.white,
))
],
),
],
))
]),
)));
}
registerNow() {}
getRegisterInfo() async {
registerInfo =
RegisterInfoResponse.fromJson(await sharedPref.getObject(NHIC_DATA));
print(await sharedPref.getObject(NHIC_DATA));
}
}

@ -1,12 +1,22 @@
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
import 'package:diplomaticquarterapp/config/size_config.dart';
import 'package:diplomaticquarterapp/models/Authentication/check_user_status_reponse.dart';
import 'package:diplomaticquarterapp/models/Authentication/check_user_status_req.dart';
import 'package:diplomaticquarterapp/models/Authentication/checkpatient_for_registration.dart';
import 'package:diplomaticquarterapp/pages/login/login-type.dart';
import 'package:diplomaticquarterapp/routes.dart';
import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart';
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/uitl/utils.dart';
import 'package:diplomaticquarterapp/widgets/buttons/button.dart';
import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart';
import 'package:diplomaticquarterapp/widgets/card/rounded_container.dart';
import 'package:diplomaticquarterapp/widgets/input/text_field.dart';
import 'package:diplomaticquarterapp/widgets/mobile-no/mobile_no.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/progress_indicator/app_circular_progress_Indeicator.dart';
import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
@ -17,122 +27,253 @@ class Register extends StatefulWidget {
}
class _Register extends State<Register> {
final TextEditingController nationalIDorFile = null;
final nationalIDorFile = TextEditingController();
final int loginType = LoginType.loginType;
final TextEditingController mobileNo = null;
String mobileNo;
String countryCode = '966';
var isHijri;
final util = Utils();
DateTime selectedDate;
String dob;
bool isButtonDisabled = true;
final authService = new AuthProvider();
final sharedPref = new AppSharedPreferences();
bool isLoading;
@override
Widget build(BuildContext context) {
return AppScaffold(
appBarTitle: TranslationBase.of(context).register,
isShowAppBar: true,
body: SingleChildScrollView(
child: Container(
padding: EdgeInsets.only(top: 10, left: 20, right: 20, bottom: 30),
height: SizeConfig.realScreenHeight * .9,
width: SizeConfig.realScreenWidth,
child: Column(children: <Widget>[
Expanded(
flex: 1,
child: AppText(
TranslationBase.of(context).enterNationalId,
fontSize: SizeConfig.textMultiplier * 3,
textAlign: TextAlign.left,
)),
Expanded(
flex: 4,
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
MobileNo(controller: mobileNo),
Container(
child: TextFields(
controller: nationalIDorFile,
prefixIcon:
Icon(Icons.chrome_reader_mode, color: Colors.red),
padding: EdgeInsets.only(
top: 20, bottom: 20, left: 10, right: 10),
hintText: TranslationBase.of(context).nationalID,
)),
Row(
children: <Widget>[
Expanded(
child: Row(
body: isLoading == true
? AppCircularProgressIndicator()
: SingleChildScrollView(
child: Container(
padding:
EdgeInsets.only(top: 10, left: 20, right: 20, bottom: 30),
height: SizeConfig.realScreenHeight * .9,
width: SizeConfig.realScreenWidth,
child: Column(children: <Widget>[
Expanded(
flex: 1,
child: AppText(
TranslationBase.of(context).enterNationalId,
fontSize: SizeConfig.textMultiplier * 3,
textAlign: TextAlign.left,
)),
Expanded(
flex: 4,
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
MobileNo(
onNumberChange: (value) =>
{mobileNo = value, validateForm()},
onCountryChange: (value) => countryCode = value),
Container(
child: TextFields(
controller: nationalIDorFile,
onChanged: (value) => validateForm(),
prefixIcon:
Icon(Icons.chrome_reader_mode, color: Colors.red),
padding: EdgeInsets.only(
top: 20, bottom: 20, left: 10, right: 10),
hintText: TranslationBase.of(context).nationalID,
)),
Row(
children: <Widget>[
Radio(
value: 1,
groupValue: isHijri,
onChanged: (value) {
setState(() {
isHijri = value;
});
},
Expanded(
child: Row(
children: <Widget>[
Radio(
value: 1,
groupValue: isHijri,
onChanged: (value) {
setState(() {
isHijri = value;
});
validateForm();
},
),
Text(TranslationBase.of(context).hijriDate),
],
),
),
Text(TranslationBase.of(context).hijriDate),
],
),
),
Expanded(
child: Row(
children: <Widget>[
Radio(
value: 0,
groupValue: isHijri,
onChanged: (value) {
setState(() {
isHijri = value;
});
},
Expanded(
child: Row(
children: <Widget>[
Radio(
value: 0,
groupValue: isHijri,
onChanged: (value) {
setState(() {
isHijri = value;
});
validateForm();
},
),
Text(TranslationBase.of(context)
.gregorianDate),
],
),
),
Text(TranslationBase.of(context).gregorianDate),
],
),
),
],
),
Row(children: <Widget>[
Expanded(
child: RaisedButton.icon(
onPressed: () => {_selectDate(context)},
icon: Icon(Icons.date_range),
label: Text(selectedDate != null
? "${selectedDate.toLocal()}".split(' ')[0]
: TranslationBase.of(context).dob)))
])
],
),
),
Expanded(
flex: 2,
child: Column(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
Row(
children: <Widget>[
Expanded(
child: DefaultButton(
TranslationBase.of(context).login,
() => {},
))
Row(children: <Widget>[
Expanded(
child: isHijri == 1
? TextFields(
onChanged: (value) => {dob = value},
hintText: 'DD/MM/YYYY',
prefixIcon: Icon(Icons.date_range),
)
: RaisedButton.icon(
onPressed: () => {
if (isHijri != null)
_selectDate(context)
},
icon: Icon(Icons.date_range),
label: Text(selectedDate != null
? "${selectedDate.toLocal()}"
.split(' ')[0]
: TranslationBase.of(context).dob)))
])
],
),
],
))
]),
)));
),
Expanded(
flex: 2,
child: Column(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
Row(
children: <Widget>[
Expanded(
child: DefaultButton(
TranslationBase.of(context).registerNow,
() => {startRegistration()},
textColor: Colors.white,
color: isButtonDisabled == true
? Colors.grey
: Colors.grey[900]))
],
),
],
))
]),
)));
}
Future<Null> _selectDate(BuildContext context) async {
final DateTime picked = await showDatePicker(
context: context,
initialDate: DateTime.now(),
firstDate: DateTime(2015, 8),
lastDate: DateTime(2101));
firstDate: DateTime(1950, 8),
lastDate: DateTime.now());
if (picked != null && picked != selectedDate)
setState(() {
selectedDate = picked;
});
}
startRegistration() {
if (isButtonDisabled == false) {
var request = CheckPatientForRegistration();
request.patientMobileNumber = int.parse(mobileNo);
request.zipCode = countryCode;
request.patientOutSA = countryCode == '966' ? 0 : 1;
// if (this.loginType == 1) {
request.patientIdentificationID = int.parse(nationalIDorFile.text);
request.patientID = 0;
// } else {
// request.patientIdentificationID = 0;
// request.patientID = int.parse(nationalIDorFile.text);
// }
this.checkPatientForRegisteration(request);
}
}
checkPatientForRegisteration(request) {
showLoader(true);
this
.authService
.checkPatientForRegisteration(request)
.then((response) => {checkUserStatus(response, request)});
}
void validateForm() {
if (util.validateIDBox(nationalIDorFile.text, loginType) == true &&
mobileNo.length >= 9 &&
util.isSAUDIIDValid(nationalIDorFile.text) == true &&
isHijri != null) {
setState(() {
isButtonDisabled = false;
});
} else {
setState(() {
isButtonDisabled = true;
});
}
}
checkUserStatus(response, CheckPatientForRegistration request) async {
showLoader(false);
if (response is Map) {
var nRequest = request.toJson();
nRequest['LogInTokenID'] = response['LogInTokenID'];
if (response['hasFile'] == true) {
AppToast.showErrorToast(message: response['ErrorEndUserMessage']);
//confirm box need to implement
// this.cs.confirmLogin();
} else {
nRequest['forRegister'] = true;
sharedPref.setObject(REGISTER_DATA_FOR_LOGIIN, nRequest);
this.chekUserData(response['LogInTokenID']);
}
} else {
if (response['ErrorCode'] == '-986') {
AppToast.showErrorToast(message: response['ErrorEndUserMessage']);
}
}
}
chekUserData(loginToken) {
// 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)
// }
showLoader(true);
var request = CheckUserStatusRequest();
request.patientIdentificationID = nationalIDorFile.text;
request.dOB = isHijri == 1
? dob
: "${selectedDate.toLocal()}".split(' ')[0].replaceAll('-', '/');
request.isHijri = isHijri;
request.patientOutSA = countryCode == '966' ? 0 : 1;
this.authService.checkUserStatus(request).then((result) => {
showLoader(false),
if (result is Map)
{
result = CheckUserStatusResponse.fromJson(result),
sharedPref.setObject(NHIC_DATA, result),
Navigator.of(context).pushNamed(
REGISTER_INFO,
)
}
else
{AppToast.showErrorToast(message: result['ErrorEndUserMessage'])}
//this.onRegister();
});
}
showLoader(bool isTrue) {
setState(() {
isLoading = isTrue;
});
}
}

@ -1,6 +1,7 @@
import 'package:diplomaticquarterapp/pages/landing/landing_page.dart';
import 'package:diplomaticquarterapp/pages/login/confirm-login.dart';
import 'package:diplomaticquarterapp/pages/login/forgot-password.dart';
import 'package:diplomaticquarterapp/pages/login/register-info.dart';
import 'package:diplomaticquarterapp/pages/login/welcome.dart';
import 'package:diplomaticquarterapp/pages/login/login-type.dart';
import 'package:diplomaticquarterapp/pages/login/login.dart';
@ -17,6 +18,7 @@ const String LOGIN_PAGE = 'login-page';
const String FORGOT_PASSWORD = 'forgot-password';
const String REGISTER = 'register';
const String CONFIRM_LOGIN = 'confrim-login';
const String REGISTER_INFO = 'register-info';
var routes = {
// ROOT: (_) => RootPage(),
HOME: (_) => LandingPage(),
@ -25,5 +27,6 @@ var routes = {
LOGIN_PAGE: (_) => Login(),
FORGOT_PASSWORD: (_) => ForgotPassword(),
REGISTER: (_) => Register(),
CONFIRM_LOGIN: (_) => ConfirmLogin()
CONFIRM_LOGIN: (_) => ConfirmLogin(),
REGISTER_INFO: (_) => RegisterInfo()
};

@ -6,6 +6,8 @@ import 'package:diplomaticquarterapp/models/Authentication/check_activation_code
import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart';
import 'package:diplomaticquarterapp/models/Authentication/check_activation_code_response.dart';
import 'package:diplomaticquarterapp/models/Authentication/check_paitent_authentication_req.dart';
import 'package:diplomaticquarterapp/models/Authentication/check_user_status_req.dart';
import 'package:diplomaticquarterapp/models/Authentication/checkpatient_for_registration.dart';
import 'package:diplomaticquarterapp/models/Authentication/get_mobile_info_request.dart';
import 'package:diplomaticquarterapp/models/Authentication/get_mobile_info_response.dart';
import 'package:diplomaticquarterapp/models/Authentication/insert_device_imei_request.dart';
@ -29,6 +31,10 @@ const GET_MOBILE_INFO = '/Authentication.svc/REST/GetMobileLoginInfo';
const SEND_ACTIVATION_CODE =
'/Authentication.svc/REST/SendActivationCodebyOTPNotificationType';
const CHECK_ACTIVATION_CODE = '/Authentication.svc/REST/CheckActivationCode';
const CHECK_PATIENT_FOR_REGISTRATION =
"/Authentication.svc/REST/CheckPatientForRegisteration";
const CHECK_USER_STATUS = "/NHIC.svc/REST/GetPatientInfo";
class AuthProvider with ChangeNotifier {
bool isLogin = false;
@ -147,7 +153,7 @@ class AuthProvider with ChangeNotifier {
request.channel = CHANNEL;
request.iPAdress = IP_ADDRESS;
request.generalid = GENERAL_ID;
request.languageID = 2;
request.languageID = LANGUAGE_ID;
request.patientOutSA = request.zipCode == '966' ? 0 : 1;
try {
dynamic localRes;
@ -169,7 +175,7 @@ class AuthProvider with ChangeNotifier {
request.channel = CHANNEL;
request.iPAdress = IP_ADDRESS;
request.generalid = GENERAL_ID;
request.languageID = 2;
request.languageID = LANGUAGE_ID;
request.deviceTypeID = DeviceTypeID;
request.patientOutSA = request.zipCode == '966' ? 0 : 1;
request.isDentalAllowedBackend = false;
@ -193,7 +199,7 @@ class AuthProvider with ChangeNotifier {
request.channel = CHANNEL;
request.iPAdress = IP_ADDRESS;
request.generalid = GENERAL_ID;
request.languageID = 2;
request.languageID = LANGUAGE_ID;
request.deviceTypeID = DeviceTypeID;
request.patientOutSA = request.zipCode == '966' ? 0 : 1;
request.isDentalAllowedBackend = false;
@ -202,7 +208,7 @@ class AuthProvider with ChangeNotifier {
await new BaseAppClient().post(SEND_ACTIVATION_CODE,
onSuccess: (dynamic response, int statusCode) {
localRes = response;
authenticatedUser = localRes;
authenticatedUser = CheckActivationCode.fromJson(localRes);
}, onFailure: (String error, int statusCode) {
throw error;
}, body: request.toJson());
@ -213,7 +219,7 @@ class AuthProvider with ChangeNotifier {
}
}
Future checkActivationCode(request, {value}) async {
Future<dynamic> checkActivationCode(request, {value}) async {
var neRequest = CheckActivationCodeReq.fromJson(request);
neRequest.activationCode = value ?? "0000";
neRequest.isSilentLogin = value != null ? false : true;
@ -222,24 +228,25 @@ class AuthProvider with ChangeNotifier {
neRequest.channel = CHANNEL;
neRequest.iPAdress = IP_ADDRESS;
neRequest.generalid = GENERAL_ID;
neRequest.languageID = 2;
neRequest.languageID = LANGUAGE_ID;
neRequest.deviceTypeID = DeviceTypeID;
neRequest.patientOutSA = neRequest.zipCode == '966' ? 0 : 1;
neRequest.projectOutSA = neRequest.zipCode == '966' ? 0 : 1;
neRequest.isDentalAllowedBackend = false;
dynamic localRes;
try {
dynamic localRes;
await new BaseAppClient().post(CHECK_ACTIVATION_CODE,
onSuccess: (dynamic response, int statusCode) {
localRes = response; //CheckActivationCode.fromJson();
}, onFailure: (String error, int statusCode) {
throw error;
localRes = error;
return Future.value(error);
// throw error;
}, body: neRequest.toJson());
return Future.value(localRes);
} catch (error) {
Future.error(error);
throw error;
//return Future.value(error);
}
}
@ -247,4 +254,53 @@ class AuthProvider with ChangeNotifier {
this.isLogin = true;
return authenticatedUser;
}
Future<dynamic> checkPatientForRegisteration(
CheckPatientForRegistration request) async {
request.versionID = VERSION_ID;
request.channel = CHANNEL;
request.iPAdress = IP_ADDRESS;
request.generalid = GENERAL_ID;
request.deviceTypeID = DeviceTypeID;
request.languageID = LANGUAGE_ID;
request.isRegister = false;
// request.tokenID = '';
dynamic localRes;
try {
await new BaseAppClient().post(CHECK_PATIENT_FOR_REGISTRATION,
onSuccess: (dynamic response, int statusCode) {
localRes = response;
}, onFailure: (String error, int statusCode) {
localRes = error;
return Future.value(error);
}, body: request.toJson());
return Future.value(localRes);
} catch (error) {
throw error;
}
}
Future<dynamic> checkUserStatus(CheckUserStatusRequest request) async {
request.versionID = VERSION_ID;
request.channel = CHANNEL;
request.iPAdress = IP_ADDRESS;
request.generalid = GENERAL_ID;
request.deviceTypeID = DeviceTypeID;
request.languageID = LANGUAGE_ID;
// request.tokenID = '';
dynamic localRes;
try {
await new BaseAppClient().post(CHECK_USER_STATUS,
onSuccess: (dynamic response, int statusCode) {
localRes = response;
}, onFailure: (String error, int statusCode) {
localRes = error;
return Future.value(error);
}, body: request.toJson());
return Future.value(localRes);
} catch (error) {
throw error;
}
}
}

@ -174,6 +174,8 @@ class TranslationBase {
localizedValues['welcome-back'][locale.languageCode];
String get accountInfo =>
localizedValues['account-info'][locale.languageCode];
String get useAnotherAccount =>
localizedValues['another-acc'][locale.languageCode];
}
class TranslationBaseDelegate extends LocalizationsDelegate<TranslationBase> {

@ -80,4 +80,16 @@ class Utils {
} catch (err) {}
return false;
}
bool validateIDBox(String value, type) {
Pattern pattern = loginIDPattern(type); //r'^\d+(?:\.\d+)?$';
RegExp regex = new RegExp(pattern);
return regex.hasMatch(value);
}
String loginIDPattern(loginType) {
var length = loginType == 1 ? 10 : 7;
return "([0-9]{" + length.toString() + "})";
}
}

@ -284,11 +284,12 @@ class SMSOTP {
static void showLoadingDialog(BuildContext context, bool _loading) async {
_context = context;
_loading = true;
if (_loading == false) {
Navigator.of(context).pop();
return;
}
_loading = true;
await showDialog(
context: _context,
barrierDismissible: false,

Loading…
Cancel
Save