diff --git a/assets/images/login/more_icon.png b/assets/images/login/more_icon.png new file mode 100644 index 00000000..b696d345 Binary files /dev/null and b/assets/images/login/more_icon.png differ diff --git a/lib/config/config.dart b/lib/config/config.dart index 09584325..41c76242 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -5,7 +5,7 @@ import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; 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'; @@ -61,7 +61,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"; diff --git a/lib/config/shared_pref_kay.dart b/lib/config/shared_pref_kay.dart index a4f11077..53fa08dd 100644 --- a/lib/config/shared_pref_kay.dart +++ b/lib/config/shared_pref_kay.dart @@ -8,3 +8,5 @@ const REGISTER_DATA_FOR_LOGIIN = 'register-data-for-login'; 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'; diff --git a/lib/locator.dart b/lib/locator.dart index c1a2a170..92d89283 100644 --- a/lib/locator.dart +++ b/lib/locator.dart @@ -1,3 +1,4 @@ +import 'package:diplomaticquarterapp/routes.dart'; import 'package:get_it/get_it.dart'; import 'core/service/hospital_service.dart'; diff --git a/lib/models/Authentication/authenticated_user.dart b/lib/models/Authentication/authenticated_user.dart index 40145b87..7ca3a3e2 100644 --- a/lib/models/Authentication/authenticated_user.dart +++ b/lib/models/Authentication/authenticated_user.dart @@ -11,55 +11,55 @@ class AuthenticatedUser { int relationshipID; int gender; String dateofBirth; - Null dateofBirthN; + dynamic dateofBirthN; String nationalityID; - Null phoneResi; - Null phoneOffice; + dynamic phoneResi; + dynamic phoneOffice; String mobileNumber; - Null faxNumber; + dynamic faxNumber; String emailAddress; - Null bloodGroup; - Null rHFactor; + dynamic bloodGroup; + dynamic rHFactor; bool isEmailAlertRequired; bool isSMSAlertRequired; String preferredLanguage; bool isPrivilegedMember; - Null memberID; - Null expiryDate; - Null isHmgEmployee; - Null employeeID; - Null emergencyContactName; - Null emergencyContactNo; + dynamic memberID; + dynamic expiryDate; + dynamic isHmgEmployee; + dynamic employeeID; + dynamic emergencyContactName; + dynamic emergencyContactNo; int patientPayType; - Null dHCCPatientRefID; + dynamic dHCCPatientRefID; bool isPatientDummy; int status; - Null isStatusCleared; + dynamic isStatusCleared; int patientIdentificationType; String patientIdentificationNo; int projectID; int infoSourceID; - Null address; + dynamic address; int age; String ageDesc; int areaID; int createdBy; String genderDescription; - Null iR; - Null iSOCityID; - Null iSOCountryID; + dynamic iR; + dynamic iSOCityID; + dynamic iSOCountryID; List listPrivilege; - Null marital; + dynamic marital; int outSA; - Null pOBox; + dynamic pOBox; bool receiveHealthSummaryReport; int sourceType; - Null strDateofBirth; - Null tempAddress; - Null zipCode; - // Null patientPayType; - // Null patientType; - // Null status; + dynamic strDateofBirth; + dynamic tempAddress; + dynamic zipCode; + // dynamic patientPayType; + // dynamic patientType; + // dynamic status; AuthenticatedUser({ this.setupID, @@ -260,7 +260,7 @@ class ListPrivilege { int iD; String serviceName; bool previlege; - Null region; + dynamic region; ListPrivilege({this.iD, this.serviceName, this.previlege, this.region}); diff --git a/lib/models/Authentication/check_activation_code_response.dart b/lib/models/Authentication/check_activation_code_response.dart index afa0057a..3a0aed65 100644 --- a/lib/models/Authentication/check_activation_code_response.dart +++ b/lib/models/Authentication/check_activation_code_response.dart @@ -1,68 +1,68 @@ import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; class CheckActivationCode { - Null date; + dynamic date; int languageID; int serviceName; - Null time; - Null androidLink; + dynamic time; + dynamic androidLink; String authenticationTokenID; - Null data; + dynamic data; bool dataw; int dietType; - Null errorCode; - Null errorEndUserMessage; - Null errorEndUserMessageN; - Null errorMessage; + dynamic errorCode; + dynamic errorEndUserMessage; + dynamic errorEndUserMessageN; + dynamic errorMessage; int errorType; int foodCategory; - Null iOSLink; + dynamic iOSLink; bool isAuthenticated; int mealOrderStatus; int mealType; int messageStatus; int numberOfResultRecords; - Null patientBlodType; - Null successMsg; - Null successMsgN; - Null doctorInformationList; - Null getAllPendingRecordsList; - Null getAllSharedRecordsByStatusList; - Null getResponseFileList; + dynamic patientBlodType; + dynamic successMsg; + dynamic successMsgN; + dynamic doctorInformationList; + dynamic getAllPendingRecordsList; + dynamic getAllSharedRecordsByStatusList; + dynamic getResponseFileList; bool isHMGPatient; bool isLoginSuccessfully; bool isNeedUpdateIdintificationNo; bool kioskSendSMS; AuthenticatedUser list; - Null listAskHabibMobileLoginInfo; - Null listAskHabibPatientFile; - Null listMergeFiles; - Null listMobileLoginInfo; - Null listPatientCount; - Null logInTokenID; - Null mohemmPrivilegeList; + dynamic listAskHabibMobileLoginInfo; + dynamic listAskHabibPatientFile; + dynamic listMergeFiles; + dynamic listMobileLoginInfo; + dynamic listPatientCount; + dynamic logInTokenID; + dynamic mohemmPrivilegeList; int pateintID; - Null patientBloodType; + String patientBloodType; bool patientHasFile; - Null patientMergedIDs; + dynamic patientMergedIDs; bool patientOutSA; int patientShareRequestID; int patientType; int projectIDOut; - Null returnMessage; + dynamic returnMessage; bool sMSLoginRequired; - Null servicePrivilegeList; - Null sharePatientName; - Null verificationCode; - Null email; - Null errorList; + dynamic servicePrivilegeList; + dynamic sharePatientName; + dynamic verificationCode; + dynamic email; + dynamic errorList; bool hasFile; bool isActiveCode; bool isMerged; bool isNeedUserAgreement; bool isSMSSent; - Null memberList; - Null message; + dynamic memberList; + dynamic message; int statusCode; CheckActivationCode( @@ -283,52 +283,52 @@ class List { int relationshipID; int gender; String dateofBirth; - Null dateofBirthN; + dynamic dateofBirthN; String nationalityID; - Null phoneResi; - Null phoneOffice; + dynamic phoneResi; + dynamic phoneOffice; String mobileNumber; - Null faxNumber; + dynamic faxNumber; String emailAddress; - Null bloodGroup; - Null rHFactor; + dynamic bloodGroup; + dynamic rHFactor; bool isEmailAlertRequired; bool isSMSAlertRequired; String preferredLanguage; bool isPrivilegedMember; - Null memberID; - Null expiryDate; - Null isHmgEmployee; - Null employeeID; - Null emergencyContactName; - Null emergencyContactNo; + dynamic memberID; + dynamic expiryDate; + dynamic isHmgEmployee; + dynamic employeeID; + dynamic emergencyContactName; + dynamic emergencyContactNo; int patientPayType; - Null dHCCPatientRefID; + dynamic dHCCPatientRefID; bool isPatientDummy; int status; - Null isStatusCleared; + dynamic isStatusCleared; int patientIdentificationType; String patientIdentificationNo; int projectID; int infoSourceID; - Null address; + dynamic address; int age; String ageDesc; int areaID; int createdBy; String genderDescription; - Null iR; - Null iSOCityID; - Null iSOCountryID; + dynamic iR; + dynamic iSOCityID; + dynamic iSOCountryID; ListPrivilege listPrivilege; - Null marital; + dynamic marital; int outSA; - Null pOBox; + dynamic pOBox; bool receiveHealthSummaryReport; int sourceType; - Null strDateofBirth; - Null tempAddress; - Null zipCode; + dynamic strDateofBirth; + dynamic tempAddress; + dynamic zipCode; List({ this.setupID, @@ -525,7 +525,7 @@ class ListPrivilege { int iD; String serviceName; bool previlege; - Null region; + dynamic region; ListPrivilege({this.iD, this.serviceName, this.previlege, this.region}); diff --git a/lib/models/Authentication/check_user_status_reponse.dart b/lib/models/Authentication/check_user_status_reponse.dart new file mode 100644 index 00000000..342eaad0 --- /dev/null +++ b/lib/models/Authentication/check_user_status_reponse.dart @@ -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 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 toJson() { + final Map data = new Map(); + 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; + } +} diff --git a/lib/models/Authentication/check_user_status_req.dart b/lib/models/Authentication/check_user_status_req.dart new file mode 100644 index 00000000..40dd8b49 --- /dev/null +++ b/lib/models/Authentication/check_user_status_req.dart @@ -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 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 toJson() { + final Map data = new Map(); + 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; + } +} diff --git a/lib/models/Authentication/checkpatient_for_registration.dart b/lib/models/Authentication/checkpatient_for_registration.dart new file mode 100644 index 00000000..420b4adb --- /dev/null +++ b/lib/models/Authentication/checkpatient_for_registration.dart @@ -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 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 toJson() { + final Map data = new Map(); + 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; + } +} diff --git a/lib/models/Authentication/insert_device_imei_request.dart b/lib/models/Authentication/insert_device_imei_request.dart index 474e6194..02e3b278 100644 --- a/lib/models/Authentication/insert_device_imei_request.dart +++ b/lib/models/Authentication/insert_device_imei_request.dart @@ -3,69 +3,14 @@ class INSERTDeviceIMEIRequest { int patientType; int patientID; String firstName; - String middleName; - String lastName; String firstNameN; - String middleNameN; String lastNameN; - int relationshipID; - int gender; - String dateofBirth; - Null dateofBirthN; - String nationalityID; - Null phoneResi; - Null phoneOffice; - String mobileNumber; - Null faxNumber; - String emailAddress; - Null bloodGroup; - Null rHFactor; - bool isEmailAlertRequired; - bool isSMSAlertRequired; int preferredLanguage; - bool isPrivilegedMember; - Null memberID; - Null expiryDate; - Null isHmgEmployee; - Null employeeID; - Null emergencyContactName; - Null emergencyContactNo; - int patientPayType; - Null dHCCPatientRefID; - bool isPatientDummy; - int status; - Null isStatusCleared; - int patientIdentificationType; String patientIdentificationNo; - int projectID; - int infoSourceID; - Null address; - int age; - String ageDesc; - int areaID; - int createdBy; - String genderDescription; - Null iR; - Null iSOCityID; - Null iSOCountryID; - List listPrivilege; - Null marital; bool outSA; - Null pOBox; - bool receiveHealthSummaryReport; - int sourceType; - Null strDateofBirth; - Null tempAddress; - String zipCode; - - String patientName; String identificationNo; - Null email; String mobileNo; - bool patientOutSA; - String tokenID; - Null patientBloodType; String iMEI; bool biometricEnabled; int logInTypeID; @@ -75,67 +20,14 @@ class INSERTDeviceIMEIRequest { this.patientType, this.patientID, this.firstName, - this.middleName, - this.lastName, this.firstNameN, - this.middleNameN, this.lastNameN, - this.relationshipID, - this.gender, - this.dateofBirth, - this.dateofBirthN, - this.nationalityID, - this.phoneResi, - this.phoneOffice, - this.mobileNumber, - this.faxNumber, - this.emailAddress, - this.bloodGroup, - this.rHFactor, - this.isEmailAlertRequired, - this.isSMSAlertRequired, this.preferredLanguage, - this.isPrivilegedMember, - this.memberID, - this.expiryDate, - this.isHmgEmployee, - this.employeeID, - this.emergencyContactName, - this.emergencyContactNo, - this.patientPayType, - this.dHCCPatientRefID, - this.isPatientDummy, - this.status, - this.isStatusCleared, - this.patientIdentificationType, this.patientIdentificationNo, - this.projectID, - this.infoSourceID, - this.address, - this.age, - this.ageDesc, - this.areaID, - this.createdBy, - this.genderDescription, - this.iR, - this.iSOCityID, - this.iSOCountryID, - this.listPrivilege, - this.marital, this.outSA, - this.pOBox, - this.receiveHealthSummaryReport, - this.sourceType, - this.strDateofBirth, - this.tempAddress, - this.zipCode, - this.patientName, this.identificationNo, - this.email, this.mobileNo, - this.patientOutSA, this.tokenID, - this.patientBloodType, this.iMEI, this.biometricEnabled, this.logInTypeID}); @@ -145,74 +37,14 @@ class INSERTDeviceIMEIRequest { patientType = json['PatientType']; patientID = json['PatientID']; firstName = json['FirstName']; - middleName = json['MiddleName']; - lastName = json['LastName']; firstNameN = json['FirstNameN']; - middleNameN = json['MiddleNameN']; lastNameN = json['LastNameN']; - relationshipID = json['RelationshipID']; - gender = json['Gender']; - dateofBirth = json['DateofBirth']; - dateofBirthN = json['DateofBirthN']; - nationalityID = json['NationalityID']; - phoneResi = json['PhoneResi']; - phoneOffice = json['PhoneOffice']; - mobileNumber = json['MobileNumber']; - faxNumber = json['FaxNumber']; - emailAddress = json['EmailAddress']; - bloodGroup = json['BloodGroup']; - rHFactor = json['RHFactor']; - isEmailAlertRequired = json['IsEmailAlertRequired']; - isSMSAlertRequired = json['IsSMSAlertRequired']; preferredLanguage = json['PreferredLanguage']; - isPrivilegedMember = json['IsPrivilegedMember']; - memberID = json['MemberID']; - expiryDate = json['ExpiryDate']; - isHmgEmployee = json['IsHmgEmployee']; - employeeID = json['EmployeeID']; - emergencyContactName = json['EmergencyContactName']; - emergencyContactNo = json['EmergencyContactNo']; - patientPayType = json['PatientPayType']; - dHCCPatientRefID = json['DHCCPatientRefID']; - isPatientDummy = json['IsPatientDummy']; - status = json['Status']; - isStatusCleared = json['IsStatusCleared']; - patientIdentificationType = json['PatientIdentificationType']; patientIdentificationNo = json['PatientIdentificationNo']; - projectID = json['ProjectID']; - infoSourceID = json['InfoSourceID']; - address = json['Address']; - age = json['Age']; - ageDesc = json['AgeDesc']; - areaID = json['AreaID']; - createdBy = json['CreatedBy']; - genderDescription = json['GenderDescription']; - iR = json['IR']; - iSOCityID = json['ISOCityID']; - iSOCountryID = json['ISOCountryID']; - if (json['ListPrivilege'] != null) { - listPrivilege = new List(); - json['ListPrivilege'].forEach((v) { - listPrivilege.add(new ListPrivilege.fromJson(v)); - }); - } - marital = json['Marital']; outSA = json['OutSA']; - pOBox = json['POBox']; - receiveHealthSummaryReport = json['ReceiveHealthSummaryReport']; - sourceType = json['SourceType']; - strDateofBirth = json['StrDateofBirth']; - tempAddress = json['TempAddress']; - zipCode = json['ZipCode']; - - patientName = json['PatientName']; identificationNo = json['IdentificationNo']; - email = json['Email']; mobileNo = json['MobileNo']; - patientOutSA = json['PatientOutSA']; - tokenID = json['TokenID']; - patientBloodType = json['PatientBloodType']; iMEI = json['IMEI']; biometricEnabled = json['BiometricEnabled']; logInTypeID = json['LogInTypeID']; @@ -224,100 +56,17 @@ class INSERTDeviceIMEIRequest { data['PatientType'] = this.patientType; data['PatientID'] = this.patientID; data['FirstName'] = this.firstName; - data['MiddleName'] = this.middleName; - data['LastName'] = this.lastName; data['FirstNameN'] = this.firstNameN; - data['MiddleNameN'] = this.middleNameN; data['LastNameN'] = this.lastNameN; - data['RelationshipID'] = this.relationshipID; - data['Gender'] = this.gender; - data['DateofBirth'] = this.dateofBirth; - data['DateofBirthN'] = this.dateofBirthN; - data['NationalityID'] = this.nationalityID; - data['PhoneResi'] = this.phoneResi; - data['PhoneOffice'] = this.phoneOffice; - data['MobileNumber'] = this.mobileNumber; - data['FaxNumber'] = this.faxNumber; - data['EmailAddress'] = this.emailAddress; - data['BloodGroup'] = this.bloodGroup; - data['RHFactor'] = this.rHFactor; - data['IsEmailAlertRequired'] = this.isEmailAlertRequired; - data['IsSMSAlertRequired'] = this.isSMSAlertRequired; data['PreferredLanguage'] = this.preferredLanguage; - data['IsPrivilegedMember'] = this.isPrivilegedMember; - data['MemberID'] = this.memberID; - data['ExpiryDate'] = this.expiryDate; - data['IsHmgEmployee'] = this.isHmgEmployee; - data['EmployeeID'] = this.employeeID; - data['EmergencyContactName'] = this.emergencyContactName; - data['EmergencyContactNo'] = this.emergencyContactNo; - data['PatientPayType'] = this.patientPayType; - data['DHCCPatientRefID'] = this.dHCCPatientRefID; - data['IsPatientDummy'] = this.isPatientDummy; - data['Status'] = this.status; - data['IsStatusCleared'] = this.isStatusCleared; - data['PatientIdentificationType'] = this.patientIdentificationType; data['PatientIdentificationNo'] = this.patientIdentificationNo; - data['ProjectID'] = this.projectID; - data['InfoSourceID'] = this.infoSourceID; - data['Address'] = this.address; - data['Age'] = this.age; - data['AgeDesc'] = this.ageDesc; - data['AreaID'] = this.areaID; - data['CreatedBy'] = this.createdBy; - data['GenderDescription'] = this.genderDescription; - data['IR'] = this.iR; - data['ISOCityID'] = this.iSOCityID; - data['ISOCountryID'] = this.iSOCountryID; - if (this.listPrivilege != null) { - data['ListPrivilege'] = - this.listPrivilege.map((v) => v.toJson()).toList(); - } - data['Marital'] = this.marital; data['OutSA'] = this.outSA; - data['POBox'] = this.pOBox; - data['ReceiveHealthSummaryReport'] = this.receiveHealthSummaryReport; - data['SourceType'] = this.sourceType; - data['StrDateofBirth'] = this.strDateofBirth; - data['TempAddress'] = this.tempAddress; - data['ZipCode'] = this.zipCode; - - data['PatientName'] = this.patientName; data['IdentificationNo'] = this.identificationNo; - data['Email'] = this.email; data['MobileNo'] = this.mobileNo; - data['PatientOutSA'] = this.patientOutSA; - data['TokenID'] = this.tokenID; - data['PatientBloodType'] = this.patientBloodType; data['IMEI'] = this.iMEI; data['BiometricEnabled'] = this.biometricEnabled; data['LogInTypeID'] = this.logInTypeID; return data; } } - -class ListPrivilege { - int iD; - String serviceName; - bool previlege; - Null region; - - ListPrivilege({this.iD, this.serviceName, this.previlege, this.region}); - - ListPrivilege.fromJson(Map json) { - iD = json['ID']; - serviceName = json['ServiceName']; - previlege = json['Previlege']; - region = json['Region']; - } - - Map toJson() { - final Map data = new Map(); - data['ID'] = this.iD; - data['ServiceName'] = this.serviceName; - data['Previlege'] = this.previlege; - data['Region'] = this.region; - return data; - } -} diff --git a/lib/models/Authentication/register_info_response.dart b/lib/models/Authentication/register_info_response.dart new file mode 100644 index 00000000..309a8aa9 --- /dev/null +++ b/lib/models/Authentication/register_info_response.dart @@ -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 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 toJson() { + final Map data = new Map(); + 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; + } +} diff --git a/lib/pages/landing/landing_page.dart b/lib/pages/landing/landing_page.dart index 4c6d1ad5..07a6bf24 100644 --- a/lib/pages/landing/landing_page.dart +++ b/lib/pages/landing/landing_page.dart @@ -97,7 +97,8 @@ class _LandingPageState extends State { .then((SelectDeviceIMEIRES value) => setUserValues(value)); } - void setUserValues(value) { + void setUserValues(value) async { print(value); + sharedPref.setObject(IMEI_USER_DATA, value); } } diff --git a/lib/pages/login/login.dart b/lib/pages/login/login.dart index b0f9a1fd..83d10fe6 100644 --- a/lib/pages/login/login.dart +++ b/lib/pages/login/login.dart @@ -1,7 +1,10 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/config/size_config.dart'; +import 'package:diplomaticquarterapp/models/Authentication/check_activation_code_request.dart'; +import 'package:diplomaticquarterapp/models/Authentication/check_activation_code_response.dart'; import 'package:diplomaticquarterapp/models/Authentication/check_paitent_authentication_req.dart'; import 'package:diplomaticquarterapp/core/service/client/base_app_client.dart'; +import 'package:diplomaticquarterapp/models/Authentication/select_device_imei_res.dart'; import 'package:diplomaticquarterapp/pages/login/login-type.dart'; import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; import 'package:diplomaticquarterapp/routes.dart'; @@ -18,6 +21,7 @@ import 'package:diplomaticquarterapp/widgets/progress_indicator/app_circular_pro import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; class Login extends StatefulWidget { @override @@ -34,6 +38,12 @@ class _Login extends State { final authService = new AuthProvider(); var sharedPref = new AppSharedPreferences(); bool isLoading = false; + + @override + void initState() { + super.initState(); + } + @override Widget build(BuildContext context) { return AppScaffold( @@ -95,7 +105,7 @@ class _Login extends State { () => {this.startLogin()}, color: isButtonDisabled == true ? Colors.grey - : Colors.grey[600], + : Colors.grey[900], textColor: Colors.white, )) ], @@ -113,9 +123,9 @@ class _Login extends State { } void validateForm() { - if (validateIDBox(nationalIDorFile.text) == true && - mobileNo != null && - util.isSAUDIIDValid(nationalIDorFile.text) == true) { + if (util.validateIDBox(nationalIDorFile.text, loginType) == true && + mobileNo.length >= 9 && + util.isSAUDIIDValid(nationalIDorFile.text, loginType) == true) { setState(() { isButtonDisabled = false; }); @@ -126,18 +136,6 @@ class _Login extends State { } } - 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(); @@ -164,12 +162,44 @@ class _Login extends State { } else { - if (value.IsAuthenticated) {this.checkActivationCode()} + if (value['IsAuthenticated']) {this.checkActivationCode()} } }); } - checkActivationCode() {} + checkActivationCode({code}) async { + Map request = {}; + // request.logInTokenID = await sharedPref.getString(LOGIN_TOKEN_ID); + // request.activationCode = code ?? "0000"; + // request.isSilentLogin = code != null ? false : true; + request['PatientMobileNumber'] = int.parse(mobileNo); + request['ZipCode'] = countryCode; + request['SearchType'] = loginType; + request['LoginType'] = loginType; + if (this.loginType == 1) { + request['PatientIdentificationID'] = this.nationalIDorFile.text; + request['PatientID'] = 0; + } else { + request['PatientIdentificationID'] = ''; + request['PatientID'] = int.parse(nationalIDorFile.text); + } + // request.isRegister = false; + this + .authService + .checkActivationCode(request, code) + .then((result) => { + result = CheckActivationCode.fromJson(result), + this.sharedPref.setObject(USER_PROFILE, result.list), + this.sharedPref.setObject(LOGIN_TOKEN_ID, result.logInTokenID), + this.sharedPref.setString(TOKEN, result.authenticationTokenID), + //this.checkIfUserAgreedBefore(result), + Navigator.of(context).pushNamed( + HOME, + ) + // SMSOTP.showLoadingDialog(context, false), + }); + } + showLoader(bool isTrue) { setState(() { isLoading = isTrue; diff --git a/lib/pages/login/register-info.dart b/lib/pages/login/register-info.dart new file mode 100644 index 00000000..70e5fb29 --- /dev/null +++ b/lib/pages/login/register-info.dart @@ -0,0 +1,154 @@ +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 { + final authService = new AuthProvider(); + final sharedPref = new AppSharedPreferences(); + RegisterInfoResponse registerInfo; + bool isLoading; + int page = 1; + @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: [ + Expanded( + flex: 1, + child: AppText( + TranslationBase.of(context).patientInfo, + fontSize: SizeConfig.textMultiplier * 3, + textAlign: TextAlign.left, + )), + registerInfo != null && page == 1 + ? Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + AppText('National ID'), + Container( + margin: EdgeInsets.only(bottom: 10), + 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, + )), + AppText('Name'), + Container( + margin: EdgeInsets.only(bottom: 10), + child: TextFields( + hintText: registerInfo.firstNameEn + + ' ' + + registerInfo.lastNameEn, + padding: EdgeInsets.only( + top: 20, bottom: 20, left: 10, right: 10), + readOnly: true, + )), + AppText('Gender'), + Container( + margin: EdgeInsets.only(bottom: 10), + child: TextFields( + hintText: registerInfo.maritalStatusCode == 'U' + ? 'Unknown' + : registerInfo.maritalStatusCode == 'M' + ? 'Male' + : 'Female', + padding: EdgeInsets.only( + top: 20, bottom: 20, left: 10, right: 10), + readOnly: true, + )), + AppText('Nationality'), + Container( + margin: EdgeInsets.only(bottom: 10), + child: TextFields( + hintText: registerInfo.nationalityCode, + padding: EdgeInsets.only( + top: 20, bottom: 20, left: 10, right: 10), + readOnly: true, + )), + AppText('Date of Birth'), + Container( + margin: EdgeInsets.only(bottom: 10), + child: TextFields( + hintText: registerInfo.dateOfBirth, + padding: EdgeInsets.only( + top: 20, bottom: 20, left: 10, right: 10), + readOnly: true, + )), + ], + ) + : registerInfo != null && page == 2 + ? Column( + children: [], + ) + : SizedBox(), + Expanded( + flex: 2, + child: Column( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Row( + children: [ + Expanded( + child: DefaultButton( + TranslationBase.of(context).next, + () => {nextPage()}, + textColor: Colors.white, + )) + ], + ), + ], + )) + ]), + ))); + } + + nextPage() { + setState(() { + page++; + }); + } + + registerNow() {} + getRegisterInfo() async { + registerInfo = + RegisterInfoResponse.fromJson(await sharedPref.getObject(NHIC_DATA)); + + print(await sharedPref.getObject(NHIC_DATA)); + } +} diff --git a/lib/pages/login/register.dart b/lib/pages/login/register.dart index 0d4244b0..5197b652 100644 --- a/lib/pages/login/register.dart +++ b/lib/pages/login/register.dart @@ -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 { - 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: [ - 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: [ - 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: [ - 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: [ + 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: [ + 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: [ - Radio( - value: 1, - groupValue: isHijri, - onChanged: (value) { - setState(() { - isHijri = value; - }); - }, + Expanded( + child: Row( + children: [ + 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: [ - Radio( - value: 0, - groupValue: isHijri, - onChanged: (value) { - setState(() { - isHijri = value; - }); - }, + Expanded( + child: Row( + children: [ + Radio( + value: 0, + groupValue: isHijri, + onChanged: (value) { + setState(() { + isHijri = value; + }); + validateForm(); + }, + ), + Text(TranslationBase.of(context) + .gregorianDate), + ], + ), ), - Text(TranslationBase.of(context).gregorianDate), ], ), - ), - ], - ), - Row(children: [ - 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: [ - Row( - children: [ - Expanded( - child: DefaultButton( - TranslationBase.of(context).login, - () => {}, - )) + Row(children: [ + 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: [ + Row( + children: [ + Expanded( + child: DefaultButton( + TranslationBase.of(context).registerNow, + () => {startRegistration()}, + textColor: Colors.white, + color: isButtonDisabled == true + ? Colors.grey + : Colors.grey[900])) + ], + ), + ], + )) + ]), + ))); } Future _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, loginType) == 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; + }); + } } diff --git a/lib/pages/login/welcome.dart b/lib/pages/login/welcome.dart index 1f2c0474..b4b05900 100644 --- a/lib/pages/login/welcome.dart +++ b/lib/pages/login/welcome.dart @@ -1,14 +1,30 @@ +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/config/size_config.dart'; +import 'package:diplomaticquarterapp/core/service/client/base_app_client.dart'; +import 'package:diplomaticquarterapp/models/Authentication/select_device_imei_res.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:diplomaticquarterapp/widgets/progress_indicator/app_circular_progress_Indeicator.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:diplomaticquarterapp/routes.dart'; -class WelcomeLogin extends StatelessWidget { +class WelcomeLogin extends StatefulWidget { @override + _WelcomeLogin createState() => _WelcomeLogin(); +} + +class _WelcomeLogin extends State { + bool isLoading = true; + @override + void initState() { + isLoading = true; + // checkUser(context); + super.initState(); + } + Widget build(BuildContext context) { return AppScaffold( appBarTitle: TranslationBase.of(context).welcome, diff --git a/lib/routes.dart b/lib/routes.dart index 0ee2364b..2c68ed21 100644 --- a/lib/routes.dart +++ b/lib/routes.dart @@ -1,10 +1,12 @@ 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'; import 'package:diplomaticquarterapp/pages/login/register.dart'; +import 'package:flutter/material.dart'; const String INIT_ROUTE = '/'; const String ROOT = 'root'; @@ -16,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(), @@ -24,5 +27,6 @@ var routes = { LOGIN_PAGE: (_) => Login(), FORGOT_PASSWORD: (_) => ForgotPassword(), REGISTER: (_) => Register(), - CONFIRM_LOGIN: (_) => ConfirmLogin() + CONFIRM_LOGIN: (_) => ConfirmLogin(), + REGISTER_INFO: (_) => RegisterInfo() }; diff --git a/lib/services/authentication/auth_provider.dart b/lib/services/authentication/auth_provider.dart index 40e76236..8f1a053e 100644 --- a/lib/services/authentication/auth_provider.dart +++ b/lib/services/authentication/auth_provider.dart @@ -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,11 +31,15 @@ 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; bool isLoading = true; - var authenticatedUser; + dynamic authenticatedUser; AuthProvider() { getUserAuthentication(); } @@ -89,6 +95,7 @@ class AuthProvider with ChangeNotifier { var request = AuthenticatedUser.fromJson(await sharedPref.getObject(USER_PROFILE)); var newRequest = INSERTDeviceIMEIRequest(); + var imei = await sharedPref.getString(PUSH_TOKEN); // if (!request.) { newRequest.iMEI = imei; @@ -99,6 +106,13 @@ class AuthProvider with ChangeNotifier { newRequest.biometricEnabled = false; newRequest.preferredLanguage = int.parse(request.preferredLanguage) ?? 1; newRequest.logInTypeID = lastLogin ?? 1; + newRequest.patientID = request.patientID; + newRequest.mobileNo = request.mobileNumber; + newRequest.identificationNo = request.patientIdentificationNo; + newRequest.patientIdentificationNo = request.patientIdentificationNo; + newRequest.patientType = request.patientType; + newRequest.setupID = request.setupID; + newRequest.tokenID = await sharedPref.getString(TOKEN); // } await new BaseAppClient().post(INSERT_DEVICE_IMEI, @@ -121,7 +135,8 @@ class AuthProvider with ChangeNotifier { request['IMEI'] = imei; await new BaseAppClient().post(SELECT_DEVICE_IMEI, onSuccess: (dynamic response, int statusCode) { - localRes = response; + localRes = SelectDeviceIMEIRES.fromJson( + response['Patient_SELECTDeviceIMEIbyIMEIList'][0]); }, onFailure: (String error, int statusCode) { throw error; }, body: request); @@ -138,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; @@ -160,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; @@ -184,16 +199,16 @@ 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; try { - var localRes; + dynamic localRes; 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()); @@ -204,7 +219,7 @@ class AuthProvider with ChangeNotifier { } } - Future checkActivationCode(request, value) async { + Future checkActivationCode(request, [value]) async { var neRequest = CheckActivationCodeReq.fromJson(request); neRequest.activationCode = value ?? "0000"; neRequest.isSilentLogin = value != null ? false : true; @@ -213,22 +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 = CheckActivationCode.fromJson(response); + 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) { - print(error); throw error; + //return Future.value(error); } } @@ -236,4 +254,53 @@ class AuthProvider with ChangeNotifier { this.isLogin = true; return authenticatedUser; } + + Future 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 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; + } + } } diff --git a/lib/uitl/utils.dart b/lib/uitl/utils.dart index ac586b7d..7a987279 100644 --- a/lib/uitl/utils.dart +++ b/lib/uitl/utils.dart @@ -43,41 +43,57 @@ class Utils { FocusScope.of(context).unfocus(); } - bool isSAUDIIDValid(String id) { - if (id == null) { - return false; - } - try { - id = id.toString(); - id = id.trim(); - var returnValue = int.parse(id); - var sum = 0; - if (returnValue > 0) { - var type = int.parse(id[0]); + bool isSAUDIIDValid(String id, type) { + if (type == 1) { + if (id == null) { + return false; + } + try { + id = id.toString(); + id = id.trim(); + var returnValue = int.parse(id); + var sum = 0; + if (returnValue > 0) { + var type = int.parse(id[0]); - if (id.length != 10) { - return false; - } - if (type != 2 && type != 1) { - return false; - } + if (id.length != 10) { + return false; + } + if (type != 2 && type != 1) { + return false; + } - for (var i = 0; i < 10; i++) { - if (i % 2 == 0) { - var a = id[i]; - var x = int.parse(a) * 2; - var b = x.toString(); - if (b.length == 1) { - b = "0" + b; + for (var i = 0; i < 10; i++) { + if (i % 2 == 0) { + var a = id[i]; + var x = int.parse(a) * 2; + var b = x.toString(); + if (b.length == 1) { + b = "0" + b; + } + sum += int.parse(b[0]) + int.parse(b[1]); + } else { + sum += int.parse(id[i]); } - sum += int.parse(b[0]) + int.parse(b[1]); - } else { - sum += int.parse(id[i]); } + return sum % 10 == 0; } - return sum % 10 == 0; - } - } catch (err) {} - return false; + } catch (err) {} + return false; + } else { + return true; + } + } + + 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() + "})"; } } diff --git a/lib/widgets/drawer/app_drawer_widget.dart b/lib/widgets/drawer/app_drawer_widget.dart index b01bb19e..260f5851 100644 --- a/lib/widgets/drawer/app_drawer_widget.dart +++ b/lib/widgets/drawer/app_drawer_widget.dart @@ -41,7 +41,7 @@ class _AppDrawerState extends State { padding: EdgeInsets.zero, children: [ Container( - height: SizeConfig.screenHeight * .25, + height: SizeConfig.screenHeight * .30, child: InkWell( child: DrawerHeader( child: Column( @@ -168,9 +168,7 @@ class _AppDrawerState extends State { TranslationBase.of(context).loginregister, Icons.lock_open), onTap: () { - Navigator.of(context).pushNamed( - WELCOME_LOGIN, - ); + login(); }, ), ], @@ -214,17 +212,35 @@ class _AppDrawerState extends State { } checkUserData() async { - var data = AuthenticatedUser.fromJson( - await this.sharedPref.getObject(USER_PROFILE)); - setState(() { - this.user = data; - print(this.user); - }); + if (await this.sharedPref.getObject(USER_PROFILE) != null) { + var data = AuthenticatedUser.fromJson( + await this.sharedPref.getObject(USER_PROFILE)); + setState(() { + this.user = data; + print(this.user); + }); + } } logout() async { - this.sharedPref.remove(USER_PROFILE); + // this.sharedPref.remove(USER_PROFILE); + // this.sharedPref.remove(IMEI_USER_DATA); + // this.sharedPref.remove(TOKEN); + // this.sharedPref.remove(LOGIN_TOKEN_ID); + await sharedPref.clear(); + this.user = null; Navigator.of(context).pushNamed(HOME); } + + login() async { + var data = await sharedPref.getObject(IMEI_USER_DATA); + if (data != null) { + Navigator.of(context).pushNamed(CONFIRM_LOGIN); + } else { + Navigator.of(context).pushNamed( + WELCOME_LOGIN, + ); + } + } } diff --git a/lib/widgets/in_app_browser/InAppBrowser.dart b/lib/widgets/in_app_browser/InAppBrowser.dart index 4f0dd644..406f5b76 100644 --- a/lib/widgets/in_app_browser/InAppBrowser.dart +++ b/lib/widgets/in_app_browser/InAppBrowser.dart @@ -1,12 +1,36 @@ +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; +import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; +import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:flutter_inappwebview/flutter_inappwebview.dart'; +import 'dart:convert'; + class MyInAppBrowser extends InAppBrowser { - static List successURLS = ['success', 'PayFortResponse', 'PayFortSucess']; +// static String SERVICE_URL = 'https://hmgwebservices.com/PayFortWeb/pages/SendPayFortRequest.aspx'; // Payfort Payment Gateway URL UAT + // ignore: non_constant_identifier_names + static String SERVICE_URL = + 'https://hmgwebservices.com/PayFortWebLive/pages/SendPayFortRequest.aspx'; //Payfort Payment Gateway URL LIVE + +// static String PREAUTH_SERVICE_URL = 'https://hmgwebservices.com/PayFortWeb/pages/SendPayFortRequest.aspx'; // Payfort PreAuth Payment Gateway URL UAT + static String PREAUTH_SERVICE_URL = + 'https://hmgwebservices.com/PayFortWebLive/pages/SendPayFortRequest.aspx'; //Payfort PreAuth Payment Gateway URL Live Store + + static List successURLS = [ + 'success', + 'PayFortResponse', + 'PayFortSucess' + ]; static List errorURLS = ['PayfortCancel']; final Function onExitCallback; + AppSharedPreferences sharedPref = AppSharedPreferences(); + AuthProvider authProvider = new AuthProvider(); + + AuthenticatedUser authUser; + MyInAppBrowser({this.onExitCallback}); Future onBrowserCreated() async { @@ -64,4 +88,108 @@ class MyInAppBrowser extends InAppBrowser { messageLevel: ${consoleMessage.messageLevel.toValue()} """); } + + getLanguageID() async { + return await sharedPref.getString(APP_LANGUAGE); + } + + getDeviceToken() async { + await sharedPref.getString(PUSH_TOKEN); + } + + String generateURL(int amount, String orderDesc, String transactionID, + String projId, String emailId, String paymentMethod, + [var patientData, var servID, var LiveServID]) { + authUser = authProvider.getAuthenticatedUser(); + + String currentLanguageID = getLanguageID() == 'ar' ? 'AR' : 'EN'; + String form = getForm(); + + if (authUser != null) { + form = form.replaceFirst("EMAIL_VALUE", authUser.emailAddress); + } else { + form = form.replaceFirst("EMAIL_VALUE", emailId); + } + + form = form.replaceFirst('AMOUNT_VALUE', amount.toString()); + form = form.replaceFirst('ORDER_DESCRIPTION_VALUE', orderDesc); + form = form.replaceFirst('ORDER_ID_VALUE', transactionID); + form = form.replaceFirst('REQUEST_ID_VALUE', transactionID); + form = form.replaceFirst('PROJECT_ID_VALUE', projId); + form = form.replaceFirst('PAYMENT_OPTION_VALUE', paymentMethod); + form = form.replaceFirst('LANG_VALUE', currentLanguageID); + form = form.replaceFirst('PATIENT_OUT_SA', authUser.outSA.toString()); + form = form.replaceFirst('PATIENT_TYPE_ID', + patientData == "" ? authUser.patientType : patientData.PatientType); + +// form = form.replaceFirst('DEVICE_TOKEN', this.cs.sharedService.getSharedData(AuthenticationService.DEVICE_TOKEN, false) + "," + this.cs.sharedService.getSharedData(AuthenticationService.APNS_TOKEN, false)); +// form = form.replaceFirst('LATITUDE_VALUE', this.cs.sharedService.getSharedData('userLat', false)); +// form = form.replaceFirst('LONGITUDE_VALUE', this.cs.sharedService.getSharedData('userLong', false)); + + form = form.replaceFirst('LATITUDE_VALUE', "24.708488"); + form = form.replaceFirst('LONGITUDE_VALUE', "46.665925"); + form = form.replaceFirst('DEVICE_TOKEN', getDeviceToken()); + + if (servID == "4") + form = form.replaceFirst( + 'SERVICE_URL_VALUE', MyInAppBrowser.PREAUTH_SERVICE_URL); + else + form = form.replaceFirst('SERVICE_URL_VALUE', MyInAppBrowser.SERVICE_URL); + + if (servID) { + form = form.replaceFirst('SERV_ID', servID); + form = form.replaceFirst('LIVE_SERVICE_ID', LiveServID); + } else { + form = form.replaceFirst('SERV_ID', "2"); + form = form.replaceFirst('LIVE_SERVICE_ID', "2"); + } + + if (!patientData) { + form = form.replaceFirst('CUSTNAME_VALUE', authUser.firstName); + form = form.replaceFirst('CUSTID_VALUE', authUser.patientID.toString()); + } else { + form = form.replaceFirst('CUSTNAME_VALUE', patientData.FirstName); + form = form.replaceFirst('CUSTID_VALUE', patientData.PatientID); + } + + Codec stringToBase64Url = utf8.fuse(base64Url); + String encoded = stringToBase64Url.encode('data:text/html;base64,' + form); // dXNlcm5hbWU6cGFzc3dvcmQ= + String decoded = stringToBase64Url.decode(encoded); // username:password + print(form); + print(encoded); + return encoded; + + } + + String getForm() { + return ' ' + + '' + + '' + + '
' + + '' + + '' + + '' + + '' + + // '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '
' + + '' + + '' + + ''; + } } diff --git a/lib/widgets/otp/sms-popup.dart b/lib/widgets/otp/sms-popup.dart index 6d93552b..709a8f0e 100644 --- a/lib/widgets/otp/sms-popup.dart +++ b/lib/widgets/otp/sms-popup.dart @@ -17,6 +17,10 @@ class SMSOTP { Future timer; + static BuildContext _context; + + static bool _loading; + SMSOTP( this.context, this.type, @@ -70,7 +74,7 @@ class SMSOTP { ? Image.asset('assets/images/login/103.png') : Image.asset('assets/images/login/104.png'), Padding( - padding: EdgeInsets.only(top: 20), + padding: EdgeInsets.only(top: 5), child: AppText( TranslationBase.of(context).verificationMessage + ' XXXXXX' + @@ -277,4 +281,30 @@ class SMSOTP { } }); } + + static void showLoadingDialog(BuildContext context, bool _loading) async { + _context = context; + + if (_loading == false) { + Navigator.of(context).pop(); + return; + } + _loading = true; + await showDialog( + context: _context, + barrierDismissible: false, + builder: (BuildContext context) { + return SimpleDialog( + elevation: 0.0, + backgroundColor: Colors.transparent, + children: [ + Center( + child: CircularProgressIndicator( + valueColor: AlwaysStoppedAnimation(Colors.black), + ), + ) + ], + ); + }); + } }