Merge branch 'sultan_new_design' into 'development_new_design_2.0'

Sultan new design

See merge request Cloud_Solution/diplomatic-quarter!448
merge-update-with-lab-changes
Sultan khan 4 years ago
commit 5df3350125

@ -757,7 +757,6 @@ const Map localizedValues = {
"permissions": {"en": "Permission", "ar": "الصلاحيات"}, "permissions": {"en": "Permission", "ar": "الصلاحيات"},
"camera-permission": {"en": "Camera", "ar": "الكاميرا"}, "camera-permission": {"en": "Camera", "ar": "الكاميرا"},
"location-permission": {"en": "Location", "ar": "تحديد المواقع"}, "location-permission": {"en": "Location", "ar": "تحديد المواقع"},
"needPrescription": {"en": "This product requires a prescription", "ar": " هذا المنتج يتطلب وصفة طبية"}, "needPrescription": {"en": "This product requires a prescription", "ar": " هذا المنتج يتطلب وصفة طبية"},
"outOfStockMsg": {"en": "You have added product which is out of stock now, Please remove that!", "ar": "لقد قمت بإضافة المنتج الذي نفذ من المخزون الآن. يرجى إزالة ذلك"}, "outOfStockMsg": {"en": "You have added product which is out of stock now, Please remove that!", "ar": "لقد قمت بإضافة المنتج الذي نفذ من المخزون الآن. يرجى إزالة ذلك"},
"accessibility": {"en": "Accessibility Mode", "ar": "وضع امكانية الوصول"}, "accessibility": {"en": "Accessibility Mode", "ar": "وضع امكانية الوصول"},
@ -1532,6 +1531,7 @@ const Map localizedValues = {
"OtherInfo": {"en": "Other Info", "ar": "معلومات اخرى"}, "OtherInfo": {"en": "Other Info", "ar": "معلومات اخرى"},
"inPrgress": {"en": "In Progress", "ar": "في تقدم"}, "inPrgress": {"en": "In Progress", "ar": "في تقدم"},
"locked": {"en": "Locked", "ar": "مقفل"}, "locked": {"en": "Locked", "ar": "مقفل"},
"personalInfo": {"en": "Personal Information", "ar": "معلومات شخصية"},
"cmcTitle": {"en": "Comprehensive", "ar": "خدمة"}, "cmcTitle": {"en": "Comprehensive", "ar": "خدمة"},
"cmcSubtitle": {"en": "Medical Checkup", "ar": "الفحص الشامل"}, "cmcSubtitle": {"en": "Medical Checkup", "ar": "الفحص الشامل"},
"emergencyTitle": {"en": "Emergency", "ar": "خدمات"}, "emergencyTitle": {"en": "Emergency", "ar": "خدمات"},

@ -23,31 +23,33 @@ class CheckActivationCodeReq {
bool isDentalAllowedBackend; bool isDentalAllowedBackend;
int deviceTypeID; int deviceTypeID;
bool forRegisteration; bool forRegisteration;
CheckActivationCodeReq(
{this.patientMobileNumber, CheckActivationCodeReq({
this.mobileNo, this.patientMobileNumber,
this.deviceToken, this.mobileNo,
this.projectOutSA, this.deviceToken,
this.loginType, this.projectOutSA,
this.zipCode, this.loginType,
this.isRegister, this.zipCode,
this.logInTokenID, this.isRegister,
this.searchType, this.logInTokenID,
this.patientID, this.searchType,
this.nationalID, this.patientID,
this.patientIdentificationID, this.nationalID,
this.activationCode, this.patientIdentificationID,
this.isSilentLogin, this.activationCode,
this.versionID, this.isSilentLogin,
this.channel, this.versionID,
this.languageID, this.channel,
this.iPAdress, this.languageID,
this.generalid, this.iPAdress,
this.patientOutSA, this.generalid,
this.sessionID, this.patientOutSA,
this.isDentalAllowedBackend, this.sessionID,
this.deviceTypeID, this.isDentalAllowedBackend,
this.forRegisteration}); this.deviceTypeID,
this.forRegisteration,
});
CheckActivationCodeReq.fromJson(Map<String, dynamic> json) { CheckActivationCodeReq.fromJson(Map<String, dynamic> json) {
patientMobileNumber = json['PatientMobileNumber']; patientMobileNumber = json['PatientMobileNumber'];
@ -102,6 +104,7 @@ class CheckActivationCodeReq {
data['isDentalAllowedBackend'] = this.isDentalAllowedBackend; data['isDentalAllowedBackend'] = this.isDentalAllowedBackend;
data['DeviceTypeID'] = this.deviceTypeID; data['DeviceTypeID'] = this.deviceTypeID;
data['ForRegisteration'] = this.forRegisteration; data['ForRegisteration'] = this.forRegisteration;
return data; return data;
} }
} }

@ -0,0 +1,120 @@
class CheckActivationCodeRegisterReq {
int patientMobileNumber;
String mobileNo;
String deviceToken;
bool projectOutSA;
int loginType;
String zipCode;
bool isRegister;
String logInTokenID;
int searchType;
int patientID;
String nationalID;
String patientIdentificationID;
String activationCode;
bool isSilentLogin;
double versionID;
int channel;
int languageID;
String iPAdress;
String generalid;
int patientOutSA;
Null sessionID;
bool isDentalAllowedBackend;
int deviceTypeID;
bool forRegisteration;
String dob;
int isHijri;
String healthId;
CheckActivationCodeRegisterReq({
this.patientMobileNumber,
this.mobileNo,
this.deviceToken,
this.projectOutSA,
this.loginType,
this.zipCode,
this.isRegister,
this.logInTokenID,
this.searchType,
this.patientID,
this.nationalID,
this.patientIdentificationID,
this.activationCode,
this.isSilentLogin,
this.versionID,
this.channel,
this.languageID,
this.iPAdress,
this.generalid,
this.patientOutSA,
this.sessionID,
this.isDentalAllowedBackend,
this.deviceTypeID,
this.forRegisteration,
this.dob,
this.isHijri,
this.healthId,
});
CheckActivationCodeRegisterReq.fromJson(Map<String, dynamic> json) {
patientMobileNumber = json['PatientMobileNumber'];
mobileNo = json['MobileNo'];
deviceToken = json['DeviceToken'];
projectOutSA = json['ProjectOutSA'];
loginType = json['LoginType'];
zipCode = json['ZipCode'];
isRegister = json['isRegister'];
logInTokenID = json['LogInTokenID'];
searchType = json['SearchType'];
patientID = json['PatientID'];
nationalID = json['NationalID'];
patientIdentificationID = json['PatientIdentificationID'];
activationCode = json['activationCode'];
isSilentLogin = json['IsSilentLogin'];
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'];
forRegisteration = json['ForRegisteration'];
dob = json['DOB'];
isHijri = json['IsHijri'];
healthId = json['HealthId'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['PatientMobileNumber'] = this.patientMobileNumber;
data['MobileNo'] = this.mobileNo;
data['DeviceToken'] = this.deviceToken;
data['ProjectOutSA'] = this.projectOutSA;
data['LoginType'] = this.loginType;
data['ZipCode'] = this.zipCode;
data['isRegister'] = this.isRegister;
data['LogInTokenID'] = this.logInTokenID;
data['SearchType'] = this.searchType;
data['PatientID'] = this.patientID;
data['NationalID'] = this.nationalID;
data['PatientIdentificationID'] = this.patientIdentificationID;
data['activationCode'] = this.activationCode;
data['IsSilentLogin'] = this.isSilentLogin;
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['ForRegisteration'] = this.forRegisteration;
data['DOB'] = dob;
data['IsHijri'] = isHijri;
data['HealthId'] = healthId;
return data;
}
}

@ -1,7 +1,7 @@
class RegisterUserRequest { class RegisterUserRequest {
Patientobject patientobject; Patientobject patientobject;
String patientIdentificationID; String patientIdentificationID;
int patientMobileNumber; dynamic patientMobileNumber;
String logInTokenID; String logInTokenID;
double versionID; double versionID;
int channel; int channel;
@ -12,7 +12,10 @@ class RegisterUserRequest {
Null sessionID; Null sessionID;
bool isDentalAllowedBackend; bool isDentalAllowedBackend;
int deviceTypeID; int deviceTypeID;
String dob;
int isHijri;
String healthId;
String zipCode;
RegisterUserRequest( RegisterUserRequest(
{this.patientobject, {this.patientobject,
this.patientIdentificationID, this.patientIdentificationID,
@ -26,12 +29,14 @@ class RegisterUserRequest {
this.patientOutSA, this.patientOutSA,
this.sessionID, this.sessionID,
this.isDentalAllowedBackend, this.isDentalAllowedBackend,
this.deviceTypeID}); this.deviceTypeID,
this.dob,
this.isHijri,
this.healthId,
this.zipCode});
RegisterUserRequest.fromJson(Map<String, dynamic> json) { RegisterUserRequest.fromJson(Map<String, dynamic> json) {
patientobject = json['Patientobject'] != null patientobject = json['Patientobject'] != null ? new Patientobject.fromJson(json['Patientobject']) : null;
? new Patientobject.fromJson(json['Patientobject'])
: null;
patientIdentificationID = json['PatientIdentificationID']; patientIdentificationID = json['PatientIdentificationID'];
patientMobileNumber = json['PatientMobileNumber']; patientMobileNumber = json['PatientMobileNumber'];
logInTokenID = json['LogInTokenID']; logInTokenID = json['LogInTokenID'];
@ -44,6 +49,10 @@ class RegisterUserRequest {
sessionID = json['SessionID']; sessionID = json['SessionID'];
isDentalAllowedBackend = json['isDentalAllowedBackend']; isDentalAllowedBackend = json['isDentalAllowedBackend'];
deviceTypeID = json['DeviceTypeID']; deviceTypeID = json['DeviceTypeID'];
dob = json['DOB'];
isHijri = json['IsHijri'];
healthId = json['HealthId'];
zipCode = json['ZipCode'];
} }
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
@ -63,6 +72,10 @@ class RegisterUserRequest {
data['SessionID'] = this.sessionID; data['SessionID'] = this.sessionID;
data['isDentalAllowedBackend'] = this.isDentalAllowedBackend; data['isDentalAllowedBackend'] = this.isDentalAllowedBackend;
data['DeviceTypeID'] = this.deviceTypeID; data['DeviceTypeID'] = this.deviceTypeID;
data['DOB'] = this.dob;
data['IsHijri'] = this.isHijri;
data['HealthId'] = this.healthId;
data['ZipCode'] = this.zipCode;
return data; return data;
} }
} }
@ -71,7 +84,7 @@ class Patientobject {
bool tempValue; bool tempValue;
int patientIdentificationType; int patientIdentificationType;
String patientIdentificationNo; String patientIdentificationNo;
int mobileNumber; dynamic mobileNumber;
int patientOutSA; int patientOutSA;
String firstName; String firstName;
String middleName; String middleName;

@ -22,6 +22,9 @@ class SendActivationRequest {
bool isDentalAllowedBackend; bool isDentalAllowedBackend;
int deviceTypeID; int deviceTypeID;
String sMSSignature; String sMSSignature;
String dob;
int isHijri;
String healthId;
SendActivationRequest( SendActivationRequest(
{this.patientMobileNumber, {this.patientMobileNumber,
this.mobileNo, this.mobileNo,
@ -45,7 +48,10 @@ class SendActivationRequest {
this.sessionID, this.sessionID,
this.isDentalAllowedBackend, this.isDentalAllowedBackend,
this.deviceTypeID, this.deviceTypeID,
this.sMSSignature}); this.sMSSignature,
this.dob,
this.isHijri,
this.healthId});
SendActivationRequest.fromJson(Map<String, dynamic> json) { SendActivationRequest.fromJson(Map<String, dynamic> json) {
patientMobileNumber = json['PatientMobileNumber']; patientMobileNumber = json['PatientMobileNumber'];
@ -71,6 +77,9 @@ class SendActivationRequest {
isDentalAllowedBackend = json['isDentalAllowedBackend']; isDentalAllowedBackend = json['isDentalAllowedBackend'];
deviceTypeID = json['DeviceTypeID']; deviceTypeID = json['DeviceTypeID'];
sMSSignature = json['SMSSignature']; sMSSignature = json['SMSSignature'];
dob = json['DOB'];
isHijri = json['IsHijri'];
healthId = json['HealthId'];
} }
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
@ -98,6 +107,9 @@ class SendActivationRequest {
data['isDentalAllowedBackend'] = this.isDentalAllowedBackend; data['isDentalAllowedBackend'] = this.isDentalAllowedBackend;
data['DeviceTypeID'] = this.deviceTypeID; data['DeviceTypeID'] = this.deviceTypeID;
data['SMSSignature'] = sMSSignature; data['SMSSignature'] = sMSSignature;
data['DOB'] = dob;
data['IsHijri'] = isHijri;
data['HealthId'] = healthId;
return data; return data;
} }
} }

@ -35,8 +35,12 @@ import 'package:local_auth/auth_strings.dart';
import 'package:local_auth/local_auth.dart'; import 'package:local_auth/local_auth.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/config.dart';
import 'package:diplomaticquarterapp/uitl/utils.dart';
import 'package:diplomaticquarterapp/pages/login/register_new.dart';
class ConfirmLogin extends StatefulWidget { class ConfirmLogin extends StatefulWidget {
final Function changePageViewIndex;
const ConfirmLogin({Key key, this.changePageViewIndex}) : super(key: key);
@override @override
_ConfirmLogin createState() => _ConfirmLogin(); _ConfirmLogin createState() => _ConfirmLogin();
} }
@ -83,6 +87,10 @@ class _ConfirmLogin extends State<ConfirmLogin> {
ToDoCountProviderModel toDoProvider; ToDoCountProviderModel toDoProvider;
var dob;
int isHijri;
var healthId;
@override @override
void initState() { void initState() {
_getAvailableBiometrics(); _getAvailableBiometrics();
@ -363,15 +371,33 @@ class _ConfirmLogin extends State<ConfirmLogin> {
var request = this.getCommonRequest(type: type); var request = this.getCommonRequest(type: type);
request.sMSSignature = await SMSOTP.getSignature(); request.sMSSignature = await SMSOTP.getSignature();
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
if (healthId != null) {
await this.authService.sendActivationCode(request).then((result) { // final DateFormat dateFormat = DateFormat('MM/dd/yyyy');
GifLoaderDialogUtils.hideDialog(context); // final DateFormat dateFormat2 = DateFormat('dd/MM/yyyy');
if (result != null && result['isSMSSent'] == true) { request.dob = dob; //isHijri == 1 ? dob : dateFormat2.format(dateFormat.parse(dob));
this.startSMSService(type); request.healthId = healthId;
} request.isHijri = isHijri;
}).catchError((r) { await this.authService.sendActivationCodeRegister(request).then((result) {
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);
}); if (result != null && result['isSMSSent'] == true) {
this.startSMSService(type);
}
}).catchError((r) {
GifLoaderDialogUtils.hideDialog(context);
});
} else {
request.dob = "";
request.healthId = "";
request.isHijri = 0;
await this.authService.sendActivationCode(request).then((result) {
GifLoaderDialogUtils.hideDialog(context);
if (result != null && result['isSMSSent'] == true) {
this.startSMSService(type);
}
}).catchError((r) {
GifLoaderDialogUtils.hideDialog(context);
});
}
} }
var tempType; var tempType;
@ -472,6 +498,15 @@ class _ConfirmLogin extends State<ConfirmLogin> {
this.loginTokenID = await sharedPref.getString(LOGIN_TOKEN_ID); this.loginTokenID = await sharedPref.getString(LOGIN_TOKEN_ID);
this.loginType = this.registerd_data.searchType; this.loginType = this.registerd_data.searchType;
} }
var nhic = await sharedPref.getObject(NHIC_DATA);
if (nhic != null) {
final DateFormat dateFormat = DateFormat('MM/dd/yyyy');
final DateFormat dateFormat2 = DateFormat('dd/MM/yyyy');
dob = nhic['IsHijri'] ? nhic['DateOfBirth'] : dateFormat2.format(dateFormat.parse(nhic['DateOfBirth']));
isHijri = nhic['IsHijri'] ? 1 : 0;
healthId = nhic['HealthId'];
}
this.deviceToken = await sharedPref.getString(PUSH_TOKEN); this.deviceToken = await sharedPref.getString(PUSH_TOKEN);
this.lastLogin = await sharedPref.getInt(LAST_LOGIN) != null this.lastLogin = await sharedPref.getInt(LAST_LOGIN) != null
? await sharedPref.getInt(LAST_LOGIN) ? await sharedPref.getInt(LAST_LOGIN)
@ -515,55 +550,89 @@ class _ConfirmLogin extends State<ConfirmLogin> {
// Navigator.pop(context); // Navigator.pop(context);
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
var request = this.getCommonRequest().toJson(); var request = this.getCommonRequest().toJson();
dynamic res; dynamic res;
if (healthId != null) {
authService request['DOB'] = dob;
.checkActivationCode(request, value) request['HealthId'] = healthId;
.then((result) => { request['IsHijri'] = isHijri;
res = result,
if (result is Map) authService
{ .checkActivationCodeRegister(request, value)
result = CheckActivationCode.fromJson(result), .then((result) => {
if (this.registerd_data != null && this.registerd_data.isRegister == true) res = result,
{ if (result is Map)
Navigator.of(context).pushNamed( {
REGISTER_INFO, result = CheckActivationCode.fromJson(result),
) if (this.registerd_data != null && this.registerd_data.isRegister == true)
} {
else widget.changePageViewIndex(1),
{ Navigator.popUntil(context, (route) => Utils.route(route, equalsTo: RegisterNew)),
sharedPref.remove(FAMILY_FILE), }
result.list.isFamily = false, }
userData = result.list, else
sharedPref.setString(BLOOD_TYPE, result.patientBloodType), {
authenticatedUserObject.user = result.list, // Navigator.of(context).pop(),
projectViewModel.setPrivilege(privilegeList: res), GifLoaderDialogUtils.hideDialog(context),
sharedPref.setObject(MAIN_USER, result.list), Future.delayed(Duration(seconds: 1), () {
sharedPref.setObject(USER_PROFILE, result.list), AppToast.showErrorToast(message: result);
loginTokenID = result.logInTokenID, }),
sharedPref.setObject(LOGIN_TOKEN_ID, result.logInTokenID), }
sharedPref.setString(TOKEN, result.authenticationTokenID), })
checkIfUserAgreedBefore(result), .catchError((err) {
} print(err);
} GifLoaderDialogUtils.hideDialog(context);
else Future.delayed(Duration(seconds: 1), () {
{ AppToast.showErrorToast(message: err);
// Navigator.of(context).pop(), startSMSService(tempType);
GifLoaderDialogUtils.hideDialog(context), });
Future.delayed(Duration(seconds: 1), () {
AppToast.showErrorToast(message: result);
}),
}
})
.catchError((err) {
print(err);
GifLoaderDialogUtils.hideDialog(context);
Future.delayed(Duration(seconds: 1), () {
AppToast.showErrorToast(message: err);
startSMSService(tempType);
}); });
}); } else {
authService
.checkActivationCode(request, value)
.then((result) => {
res = result,
if (result is Map)
{
result = CheckActivationCode.fromJson(result),
if (this.registerd_data != null && this.registerd_data.isRegister == true)
{
widget.changePageViewIndex(1),
Navigator.popUntil(context, (route) => Utils.route(route, equalsTo: RegisterNew)),
}
else
{
sharedPref.remove(FAMILY_FILE),
result.list.isFamily = false,
userData = result.list,
sharedPref.setString(BLOOD_TYPE, result.patientBloodType),
authenticatedUserObject.user = result.list,
projectViewModel.setPrivilege(privilegeList: res),
sharedPref.setObject(MAIN_USER, result.list),
sharedPref.setObject(USER_PROFILE, result.list),
loginTokenID = result.logInTokenID,
sharedPref.setObject(LOGIN_TOKEN_ID, result.logInTokenID),
sharedPref.setString(TOKEN, result.authenticationTokenID),
checkIfUserAgreedBefore(result),
}
}
else
{
// Navigator.of(context).pop(),
GifLoaderDialogUtils.hideDialog(context),
Future.delayed(Duration(seconds: 1), () {
AppToast.showErrorToast(message: result);
}),
}
})
.catchError((err) {
print(err);
GifLoaderDialogUtils.hideDialog(context);
Future.delayed(Duration(seconds: 1), () {
AppToast.showErrorToast(message: err);
startSMSService(tempType);
});
});
}
} }
checkIfUserAgreedBefore(CheckActivationCode result) { checkIfUserAgreedBefore(CheckActivationCode result) {
@ -602,10 +671,6 @@ class _ConfirmLogin extends State<ConfirmLogin> {
getToDoCount(); getToDoCount();
// pharmacyModuleViewModel.generatePharmacyToken().then((value) async {
// if (pharmacyModuleViewModel.error.isNotEmpty) await pharmacyModuleViewModel.createUser();
// });
appointmentRateViewModel appointmentRateViewModel
.getIsLastAppointmentRatedList() .getIsLastAppointmentRatedList()
.then((value) => { .then((value) => {

@ -1,7 +1,7 @@
import 'package:diplomaticquarterapp/config/size_config.dart'; import 'package:diplomaticquarterapp/config/size_config.dart';
import 'package:diplomaticquarterapp/pages/login/forgot-password.dart'; import 'package:diplomaticquarterapp/pages/login/forgot-password.dart';
import 'package:diplomaticquarterapp/pages/login/login.dart'; import 'package:diplomaticquarterapp/pages/login/login.dart';
import 'package:diplomaticquarterapp/pages/login/register.dart'; import 'package:diplomaticquarterapp/pages/login/register_new.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart';
import 'package:diplomaticquarterapp/widgets/card/rounded_container.dart'; import 'package:diplomaticquarterapp/widgets/card/rounded_container.dart';
@ -71,7 +71,7 @@ class LoginType extends StatelessWidget {
width: double.infinity, width: double.infinity,
child: FlatButton( child: FlatButton(
onPressed: () { onPressed: () {
Navigator.of(context).push(FadePage(page: Register())); Navigator.of(context).push(FadePage(page: RegisterNew()));
}, },
child: Text( child: Text(
TranslationBase.of(context).registerNow, TranslationBase.of(context).registerNow,

@ -11,7 +11,7 @@ import 'package:diplomaticquarterapp/models/Authentication/check_paitent_authent
import 'package:diplomaticquarterapp/pages/landing/landing_page.dart'; import 'package:diplomaticquarterapp/pages/landing/landing_page.dart';
import 'package:diplomaticquarterapp/pages/login/confirm-login.dart'; import 'package:diplomaticquarterapp/pages/login/confirm-login.dart';
import 'package:diplomaticquarterapp/pages/login/login-type.dart'; import 'package:diplomaticquarterapp/pages/login/login-type.dart';
import 'package:diplomaticquarterapp/pages/login/register.dart'; import 'package:diplomaticquarterapp/pages/login/register_new.dart';
import 'package:diplomaticquarterapp/pages/rateAppointment/rate_appointment_doctor.dart'; import 'package:diplomaticquarterapp/pages/rateAppointment/rate_appointment_doctor.dart';
import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart';
import 'package:diplomaticquarterapp/services/clinic_services/get_clinic_service.dart'; import 'package:diplomaticquarterapp/services/clinic_services/get_clinic_service.dart';
@ -107,9 +107,6 @@ class _Login extends State<Login> {
style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.64, height: 23 / 16), style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.64, height: 23 / 16),
), ),
SizedBox(height: 20), SizedBox(height: 20),
// inputWidget("Country", "Saudi Arabia", isEnable: false, hasSelection: true),
// SizedBox(height: 12),
// inputWidget("Phone Number", "5xxxxxxxx", prefix: countryCode),
PhoneNumberSelectorWidget(onNumberChange: (value) => {mobileNo = value, validateForm()}, onCountryChange: (value) => countryCode = value), PhoneNumberSelectorWidget(onNumberChange: (value) => {mobileNo = value, validateForm()}, onCountryChange: (value) => countryCode = value),
SizedBox(height: 12), SizedBox(height: 12),
Directionality( Directionality(
@ -277,7 +274,7 @@ class _Login extends State<Login> {
cancelText: TranslationBase.of(context).cancel_nocaps, cancelText: TranslationBase.of(context).cancel_nocaps,
okFunction: () => { okFunction: () => {
ConfirmDialog.closeAlertDialog(context), ConfirmDialog.closeAlertDialog(context),
Navigator.of(context).push(FadePage(page: Register())), Navigator.of(context).push(FadePage(page: RegisterNew())),
}, },
cancelFunction: () => {ConfirmDialog.closeAlertDialog(context)}); cancelFunction: () => {ConfirmDialog.closeAlertDialog(context)});
dialog.showAlertDialog(context); dialog.showAlertDialog(context);

@ -1,14 +1,18 @@
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
import 'package:diplomaticquarterapp/config/size_config.dart'; import 'package:diplomaticquarterapp/locator.dart';
import 'package:diplomaticquarterapp/models/Appointments/toDoCountProviderModel.dart';
import 'package:diplomaticquarterapp/config/config.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:diplomaticquarterapp/pages/landing/landing_page.dart';
import 'package:diplomaticquarterapp/pages/rateAppointment/rate_appointment_doctor.dart';
import 'package:diplomaticquarterapp/routes.dart';
import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart';
import 'package:diplomaticquarterapp/core/viewModels/appointment_rate_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/appointment_rate_view_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/locator.dart'; import 'package:diplomaticquarterapp/models/Authentication/check_activation_code_response.dart' as checkActivation;
import 'package:diplomaticquarterapp/models/Authentication/check_activation_code_response.dart'
as checkActivation;
import 'package:diplomaticquarterapp/models/Authentication/check_paitent_authentication_req.dart'; import 'package:diplomaticquarterapp/models/Authentication/check_paitent_authentication_req.dart';
import 'package:diplomaticquarterapp/models/Authentication/register_info_response.dart'; import 'package:diplomaticquarterapp/models/Authentication/register_info_response.dart';
import 'package:diplomaticquarterapp/routes.dart'; import 'package:diplomaticquarterapp/services/clinic_services/get_clinic_service.dart';
import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart';
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
@ -17,7 +21,6 @@ import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart';
import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart';
import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart';
import 'package:diplomaticquarterapp/widgets/input/text_field.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart'; import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
@ -25,8 +28,12 @@ import 'package:flutter/material.dart';
import 'package:hijri/hijri_calendar.dart'; import 'package:hijri/hijri_calendar.dart';
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:diplomaticquarterapp/uitl/utils_new.dart';
class RegisterInfo extends StatefulWidget { class RegisterInfo extends StatefulWidget {
final Function changePageViewIndex;
final int page;
const RegisterInfo({Key key, this.changePageViewIndex, this.page = 1}) : super(key: key);
@override @override
_RegisterInfo createState() => _RegisterInfo(); _RegisterInfo createState() => _RegisterInfo();
} }
@ -36,7 +43,7 @@ class _RegisterInfo extends State<RegisterInfo> {
final sharedPref = new AppSharedPreferences(); final sharedPref = new AppSharedPreferences();
RegisterInfoResponse registerInfo; RegisterInfoResponse registerInfo;
bool isLoading; bool isLoading;
int page = 1; int page;
final List<Location> locationList = [ final List<Location> locationList = [
new Location(name: 'KSA', value: '1'), new Location(name: 'KSA', value: '1'),
new Location(name: 'Dubai', value: '2'), new Location(name: 'Dubai', value: '2'),
@ -49,240 +56,339 @@ class _RegisterInfo extends State<RegisterInfo> {
]; ];
String email = ''; String email = '';
ToDoCountProviderModel toDoProvider;
String location = '1'; String location = '1';
AuthenticatedUserObject authenticatedUserObject = AuthenticatedUserObject authenticatedUserObject = locator<AuthenticatedUserObject>();
locator<AuthenticatedUserObject>();
ProjectViewModel projectViewModel; ProjectViewModel projectViewModel;
AppointmentRateViewModel appointmentRateViewModel = AppointmentRateViewModel appointmentRateViewModel = locator<AppointmentRateViewModel>();
locator<AppointmentRateViewModel>();
@override @override
void initState() { void initState() {
WidgetsBinding.instance.addPostFrameCallback((timeStamp) { WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
getRegisterInfo(); getRegisterInfo();
}); });
setState(() {
page = widget.page;
});
super.initState(); super.initState();
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
projectViewModel = Provider.of(context); projectViewModel = Provider.of(context);
toDoProvider = Provider.of<ToDoCountProviderModel>(context);
return AppScaffold( return AppScaffold(
appBarTitle: TranslationBase.of(context).register, appBarTitle: TranslationBase.of(context).register,
isShowAppBar: true, isShowAppBar: false,
isShowDecPage: false, isShowDecPage: false,
body: SingleChildScrollView( body: SingleChildScrollView(
padding: EdgeInsets.all(20), padding: EdgeInsets.all(30),
child: Column(children: <Widget>[ child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[
AppText( Row(
TranslationBase.of(context).patientInfo, children: [
fontSize: SizeConfig.textMultiplier * 3, Expanded(
textAlign: TextAlign.left, child: AppText(
TranslationBase.of(context).personalInfo,
fontSize: 16,
textAlign: TextAlign.left,
fontWeight: FontWeight.bold,
),
),
Expanded(child: SizedBox())
],
), ),
SizedBox(height: 20),
registerInfo != null && page == 1 registerInfo != null && page == 1
? Column( ? Column(
crossAxisAlignment: CrossAxisAlignment.start, children: [
mainAxisAlignment: MainAxisAlignment.spaceEvenly, SizedBox(height: 20),
children: <Widget>[ getnameField(TranslationBase.of(context).identificationNumber, registerInfo.idNumber, TranslationBase.of(context).firstName,
AppText(TranslationBase.of(context).nationalID), registerInfo.firstNameEn == '-' ? registerInfo.firstNameAr : registerInfo.firstNameEn),
Container( SizedBox(height: 20),
margin: EdgeInsets.only(bottom: 10), getnameField(TranslationBase.of(context).middleName, registerInfo.secondNameEn == '-' ? registerInfo.secondNameEn : registerInfo.secondNameEn,
child: TextFields( TranslationBase.of(context).lastName, registerInfo.lastNameEn == '-' ? registerInfo.lastNameEn : registerInfo.lastNameEn),
hintText: registerInfo.idNumber, SizedBox(height: 20),
prefixIcon: Icon(Icons.chrome_reader_mode, getnameField(
color: Colors.red), TranslationBase.of(context).gender,
padding: EdgeInsets.only( registerInfo.maritalStatusCode == 'U'
top: 20, bottom: 20, left: 10, right: 10), ? 'Unknown'
readOnly: true, : registerInfo.maritalStatusCode == 'M'
)), ? 'Male'
AppText(TranslationBase.of(context).firstName), : 'Female',
Container( TranslationBase.of(context).maritalStatus,
margin: EdgeInsets.only(bottom: 10), registerInfo.maritalStatus),
child: TextFields( SizedBox(height: 20),
hintText: registerInfo.firstNameEn == '-' getnameField(TranslationBase.of(context).nationality, registerInfo.nationality, TranslationBase.of(context).mobileNumber, registerd_data.patientMobileNumber.toString()),
? registerInfo.firstNameAr SizedBox(height: 20),
: registerInfo.firstNameEn, getnameField(TranslationBase.of(context).dateOfBirth, registerInfo.dateOfBirth, "", ""),
padding: EdgeInsets.only( SizedBox(height: 20),
top: 20, bottom: 20, left: 10, right: 10),
readOnly: true,
)),
AppText(TranslationBase.of(context).middleName),
Container(
margin: EdgeInsets.only(bottom: 10),
child: TextFields(
hintText: registerInfo.secondNameEn == '-'
? registerInfo.secondNameAr
: registerInfo.secondNameEn,
padding: EdgeInsets.only(
top: 20, bottom: 20, left: 10, right: 10),
readOnly: true,
)),
AppText(TranslationBase.of(context).lastName),
Container(
margin: EdgeInsets.only(bottom: 10),
child: TextFields(
hintText: registerInfo.lastNameEn == '-'
? registerInfo.lastNameAr
: registerInfo.lastNameEn,
padding: EdgeInsets.only(
top: 20, bottom: 20, left: 10, right: 10),
readOnly: true,
)),
AppText(TranslationBase.of(context).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(TranslationBase.of(context).maritalStatus),
Container(
margin: EdgeInsets.only(bottom: 10),
child: TextFields(
hintText: registerInfo.maritalStatus,
padding: EdgeInsets.only(
top: 20, bottom: 20, left: 10, right: 10),
readOnly: true,
)),
AppText(TranslationBase.of(context).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(TranslationBase.of(context).mobileNumber),
Container(
margin: EdgeInsets.only(bottom: 10),
child: TextFields(
hintText:
registerd_data.patientMobileNumber.toString(),
padding: EdgeInsets.only(
top: 20, bottom: 20, left: 10, right: 10),
readOnly: true,
)),
AppText(TranslationBase.of(context).dob),
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(
// crossAxisAlignment: CrossAxisAlignment.start,
// mainAxisAlignment: MainAxisAlignment.spaceEvenly,
// children: <Widget>[
// AppText(TranslationBase.of(context).nationalID),
// 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(TranslationBase.of(context).firstName),
// Container(
// margin: EdgeInsets.only(bottom: 10),
// child: TextFields(
// hintText: registerInfo.firstNameEn == '-' ? registerInfo.firstNameAr : registerInfo.firstNameEn,
// padding: EdgeInsets.only(top: 20, bottom: 20, left: 10, right: 10),
// readOnly: true,
// )),
// AppText(TranslationBase.of(context).middleName),
// Container(
// margin: EdgeInsets.only(bottom: 10),
// child: TextFields(
// hintText: registerInfo.secondNameEn == '-' ? registerInfo.secondNameAr : registerInfo.secondNameEn,
// padding: EdgeInsets.only(top: 20, bottom: 20, left: 10, right: 10),
// readOnly: true,
// )),
// AppText(TranslationBase.of(context).lastName),
// Container(
// margin: EdgeInsets.only(bottom: 10),
// child: TextFields(
// hintText: registerInfo.lastNameEn == '-' ? registerInfo.lastNameAr : registerInfo.lastNameEn,
// padding: EdgeInsets.only(top: 20, bottom: 20, left: 10, right: 10),
// readOnly: true,
// )),
// AppText(TranslationBase.of(context).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(TranslationBase.of(context).maritalStatus),
// Container(
// margin: EdgeInsets.only(bottom: 10),
// child: TextFields(
// hintText: registerInfo.maritalStatus,
// padding: EdgeInsets.only(top: 20, bottom: 20, left: 10, right: 10),
// readOnly: true,
// )),
// AppText(TranslationBase.of(context).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(TranslationBase.of(context).mobileNumber),
// Container(
// margin: EdgeInsets.only(bottom: 10),
// child: TextFields(
// hintText: registerd_data.patientMobileNumber.toString(),
// padding: EdgeInsets.only(top: 20, bottom: 20, left: 10, right: 10),
// readOnly: true,
// )),
// AppText(TranslationBase.of(context).dob),
// 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 && widget.page == 2
? Column( ? Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
AppText(TranslationBase.of(context).language,
textAlign: TextAlign.start),
Container( Container(
padding: EdgeInsets.all(10), width: double.infinity,
decoration: BoxDecoration( decoration: containerRadius(Colors.white, 12),
color: Colors.white, padding: EdgeInsets.only(left: 10, right: 10, top: 5, bottom: 25),
border: Border.all(color: Colors.grey), child: Row(children: [
borderRadius: BorderRadius.circular(10)), Flexible(
child: DropdownButtonHideUnderline( child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
child: DropdownButton( Text(
isExpanded: true, TranslationBase.of(context).prefferedLanguage,
value: language, style: TextStyle(
iconSize: 40, fontSize: 11,
elevation: 16, letterSpacing: -0.44,
onChanged: (value) => { fontWeight: FontWeight.w600,
setState(() { ),
language = value; ),
}) Container(
}, height: 18,
items: languageList child: DropdownButtonHideUnderline(
.map<DropdownMenuItem<String>>( child: DropdownButton(
(Language value) { isExpanded: true,
return DropdownMenuItem<String>( value: language,
value: value.value, hint: Text(TranslationBase.of(context).prefferedLanguage),
child: Text(value.name), iconSize: 40,
); elevation: 16,
}).toList()))), onChanged: (value) => {
AppText(TranslationBase.of(context).location), setState(() {
language = value;
})
},
items: languageList.map<DropdownMenuItem<String>>((Language value) {
return DropdownMenuItem<String>(
value: value.value,
child: Text(value.name),
);
}).toList())))
]))
])),
SizedBox(
height: 20,
),
Container( Container(
padding: EdgeInsets.all(10), width: double.infinity,
decoration: BoxDecoration( decoration: containerRadius(Colors.white, 12),
color: Colors.white, padding: EdgeInsets.only(left: 10, right: 10, top: 5, bottom: 25),
border: Border.all(color: Colors.grey), child: Row(children: [
borderRadius: BorderRadius.circular(10)), Flexible(
child: DropdownButtonHideUnderline( child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
child: DropdownButton( Text(
isExpanded: true, TranslationBase.of(context).selectLocation,
value: location, style: TextStyle(
iconSize: 40, fontSize: 11,
elevation: 16, letterSpacing: -0.44,
onChanged: (value) => { fontWeight: FontWeight.w600,
setState(() { ),
location = value; ),
}) Container(
}, height: 18,
items: locationList child: DropdownButtonHideUnderline(
.map<DropdownMenuItem<String>>( child: DropdownButton(
(Location value) { isExpanded: true,
return DropdownMenuItem<String>( value: location,
value: value.value, hint: Text(TranslationBase.of(context).selectLocation),
child: Text(value.name), iconSize: 40,
); elevation: 16,
}).toList()))), onChanged: (value) => {
AppText(TranslationBase.of(context).email), setState(() {
location = value;
})
},
items: locationList.map<DropdownMenuItem<String>>((Location value) {
return DropdownMenuItem<String>(
value: value.value,
child: Text(
value.name,
),
);
}).toList())))
]))
])),
SizedBox(
height: 20,
),
Container( Container(
margin: EdgeInsets.only(bottom: 10), width: double.infinity,
child: TextFields( decoration: containerRadius(Colors.white, 12),
onChanged: (value) => { padding: EdgeInsets.only(left: 10, right: 10, top: 5, bottom: 12),
setState(() { margin: EdgeInsets.only(bottom: 0),
email = value; child: Row(children: [
}) Flexible(
}, child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
padding: EdgeInsets.only( Text(
top: 20, bottom: 20, left: 10, right: 10), TranslationBase.of(context).email,
)), style: TextStyle(
fontSize: 11,
letterSpacing: -0.44,
fontWeight: FontWeight.w600,
),
),
Container(
child: TextField(
onChanged: (value) {
setState(() {
email = value;
});
},
style: TextStyle(
fontSize: 14,
height: 21 / 14,
fontWeight: FontWeight.w400,
color: Color(0xff2B353E),
letterSpacing: -0.44,
),
decoration: InputDecoration(
isDense: true,
hintStyle: TextStyle(
fontSize: 14,
height: 21 / 14,
fontWeight: FontWeight.w400,
color: Color(0xff575757),
letterSpacing: -0.56,
),
prefixIconConstraints: BoxConstraints(minWidth: 50),
contentPadding: EdgeInsets.zero,
border: InputBorder.none,
focusedBorder: InputBorder.none,
enabledBorder: InputBorder.none,
),
))
]))
])),
], ],
) )
: SizedBox(), : SizedBox(),
Column( // Column(
mainAxisAlignment: MainAxisAlignment.end, // mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[ // children: <Widget>[
Row( // Row(
children: <Widget>[ // children: <Widget>[
Expanded( // Expanded(
child: DefaultButton( // child: DefaultButton(
page == 1 // page == 1 ? TranslationBase.of(context).next : TranslationBase.of(context).register,
? TranslationBase.of(context).next // () => {nextPage()},
: TranslationBase.of(context).register, // textColor: Colors.white,
() => {nextPage()}, // color: this.isValid() == false && page == 2 ? Colors.grey : Colors.black,
textColor: Colors.white, // ))
color: this.isValid() == false && page == 2 // ],
? Colors.grey // ),
: Colors.black, // ],
)) // )
], ]),
),
bottomSheet: Container(
width: double.maxFinite,
height: 80.0,
child: Row(
children: [
Expanded(
child: Padding(
padding: EdgeInsets.all(10), child: DefaultButton(TranslationBase.of(context).cancel, () => {Navigator.of(context).pop()}, textColor: Colors.white, color: Color(0xffD02127))),
),
Expanded(
child: Padding(
padding: EdgeInsets.all(10),
child: DefaultButton(page == 1 ? TranslationBase.of(context).next : TranslationBase.of(context).register, () => {nextPage()},
textColor: Colors.white, color: isValid() == true && page == 2 || page == 1 ? Color(0xff359846) : Colors.grey)),
), ),
], ],
) )));
]),
));
} }
nextPage() { nextPage() {
if (page == 1) { if (page == 1) {
setState(() { setState(() {
page++; widget.changePageViewIndex(2);
}); });
} else { } else {
registerNow(); registerNow();
@ -292,6 +398,7 @@ class _RegisterInfo extends State<RegisterInfo> {
registerNow() { registerNow() {
dynamic request = getTempUserRequest(); dynamic request = getTempUserRequest();
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
dynamic res;
this this
.authService .authService
.registerUser(request) .registerUser(request)
@ -306,21 +413,31 @@ class _RegisterInfo extends State<RegisterInfo> {
confirmMessage: result, confirmMessage: result,
okText: TranslationBase.of(context).ok, okText: TranslationBase.of(context).ok,
cancelText: TranslationBase.of(context).cancel_nocaps, cancelText: TranslationBase.of(context).cancel_nocaps,
okFunction: () => okFunction: () => {ConfirmDialog.closeAlertDialog(context)},
{ConfirmDialog.closeAlertDialog(context)}, cancelFunction: () => {ConfirmDialog.closeAlertDialog(context)}).showAlertDialog(context)
cancelFunction: () => {
ConfirmDialog.closeAlertDialog(context)
}).showAlertDialog(context)
} }
else else
{ {
res = result,
result = checkActivation.CheckActivationCode.fromJson(result), result = checkActivation.CheckActivationCode.fromJson(result),
// result.list.isFamily = false,
// sharedPref.setObject(USER_PROFILE, result.list),
// this.sharedPref.setObject(MAIN_USER, result.list),
// sharedPref.setObject(LOGIN_TOKEN_ID, result.logInTokenID),
// sharedPref.setString(TOKEN, result.authenticationTokenID),
// this.setUser(result),
sharedPref.remove(FAMILY_FILE),
result.list.isFamily = false, result.list.isFamily = false,
sharedPref.setString(BLOOD_TYPE, result.patientBloodType),
authenticatedUserObject.user = result.list,
projectViewModel.setPrivilege(privilegeList: res),
sharedPref.setObject(MAIN_USER, result.list),
sharedPref.setObject(USER_PROFILE, result.list), sharedPref.setObject(USER_PROFILE, result.list),
this.sharedPref.setObject(MAIN_USER, result.list),
sharedPref.setObject(LOGIN_TOKEN_ID, result.logInTokenID), sharedPref.setObject(LOGIN_TOKEN_ID, result.logInTokenID),
sharedPref.setString(TOKEN, result.authenticationTokenID), sharedPref.setString(TOKEN, result.authenticationTokenID),
this.setUser(result), checkIfUserAgreedBefore(result),
} }
}) })
.catchError((err) { .catchError((err) {
@ -346,11 +463,9 @@ class _RegisterInfo extends State<RegisterInfo> {
} }
getRegisterInfo() async { getRegisterInfo() async {
var data = var data = RegisterInfoResponse.fromJson(await sharedPref.getObject(NHIC_DATA));
RegisterInfoResponse.fromJson(await sharedPref.getObject(NHIC_DATA));
if (await sharedPref.getObject(REGISTER_DATA_FOR_LOGIIN) != null) { if (await sharedPref.getObject(REGISTER_DATA_FOR_LOGIIN) != null) {
var data2 = CheckPatientAuthenticationReq.fromJson( var data2 = CheckPatientAuthenticationReq.fromJson(await sharedPref.getObject(REGISTER_DATA_FOR_LOGIIN));
await sharedPref.getObject(REGISTER_DATA_FOR_LOGIIN));
setState(() { setState(() {
this.registerInfo = data; this.registerInfo = data;
@ -363,8 +478,7 @@ class _RegisterInfo extends State<RegisterInfo> {
getTempUserRequest() { getTempUserRequest() {
DateFormat dateFormat = DateFormat("mm/dd/yyyy"); DateFormat dateFormat = DateFormat("mm/dd/yyyy");
print(dateFormat.parse(registerInfo.dateOfBirth)); print(dateFormat.parse(registerInfo.dateOfBirth));
var hDate = var hDate = new HijriCalendar.fromDate(dateFormat.parse(registerInfo.dateOfBirth));
new HijriCalendar.fromDate(dateFormat.parse(registerInfo.dateOfBirth));
var date = hDate.toString(); var date = hDate.toString();
return { return {
"Patientobject": { "Patientobject": {
@ -380,8 +494,7 @@ class _RegisterInfo extends State<RegisterInfo> {
"LastNameN": registerInfo.lastNameAr, "LastNameN": registerInfo.lastNameAr,
"LastName": registerInfo.lastNameEn, "LastName": registerInfo.lastNameEn,
"StrDateofBirth": registerInfo.dateOfBirth, "StrDateofBirth": registerInfo.dateOfBirth,
"DateofBirth": DateUtil.convertISODateToJsonDate( "DateofBirth": DateUtil.convertISODateToJsonDate(registerInfo.dateOfBirth.replaceAll('/', '-')),
registerInfo.dateOfBirth.replaceAll('/', '-')),
"Gender": registerInfo.gender == 'M' ? 1 : 2, "Gender": registerInfo.gender == 'M' ? 1 : 2,
"NationalityID": registerInfo.nationalityCode, "NationalityID": registerInfo.nationalityCode,
"eHealthIDField": registerInfo.healthId, "eHealthIDField": registerInfo.healthId,
@ -396,19 +509,116 @@ class _RegisterInfo extends State<RegisterInfo> {
: '2', : '2',
}, },
"PatientIdentificationID": registerInfo.idNumber, "PatientIdentificationID": registerInfo.idNumber,
"PatientMobileNumber": registerd_data.patientMobileNumber, "PatientMobileNumber": registerd_data.patientMobileNumber.toString()[0] == '0' ? registerd_data.patientMobileNumber : '0' + registerd_data.patientMobileNumber.toString(),
}; };
} }
bool isValid() { bool isValid() {
if (location != null || if (location != null && language != null && Utils.validEmail(email) == true) {
language != null ||
Utils.validEmail(email) == true) {
return true; return true;
} else { } else {
return false; return false;
} }
} }
Widget getnameField(name1, value1, name2, value2) {
return Row(
children: [
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
AppText(
name1,
fontSize: 12,
fontWeight: FontWeight.bold,
),
AppText(
value1,
),
],
)),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
AppText(
name2,
fontSize: 12,
fontWeight: FontWeight.bold,
),
AppText(value2),
],
))
],
);
}
checkIfUserAgreedBefore(checkActivation.CheckActivationCode result) {
if (result.isNeedUserAgreement == true) {
//need to implement agreement page here
insertIMEI();
} else {
insertIMEI();
}
}
insertIMEI() async {
var selectedOption = await sharedPref.getInt(LAST_LOGIN);
authService.insertDeviceImei(selectedOption).then((value) => {goToHome()}).catchError((err) {
print(err);
});
// authService.registeredAuthenticatedUser(data, token, 0, 0).then((res) => {});
}
goToHome() async {
authenticatedUserObject.isLogin = true;
appointmentRateViewModel.isLogin = true;
projectViewModel.isLogin = true;
projectViewModel.user = authenticatedUserObject.user;
await authenticatedUserObject.getUser(getUser: true);
appointmentRateViewModel
.getIsLastAppointmentRatedList()
.then((value) => {
getToDoCount(),
GifLoaderDialogUtils.hideDialog(AppGlobal.context),
if (appointmentRateViewModel.isHaveAppointmentNotRate)
{
Navigator.pushAndRemoveUntil(
context,
FadePage(
page: RateAppointmentDoctor(),
),
(r) => false)
}
else
{
Navigator.pushAndRemoveUntil(
context,
FadePage(
page: LandingPage(),
),
(r) => false)
}
})
.catchError((err) {
print(err);
//GifLoaderDialogUtils.hideDialog(context);
});
// SMSOTP.showLoadingDialog(context, false),
}
getToDoCount() {
toDoProvider.setState(0, true, "0");
ClinicListService service = new ClinicListService();
service.getActiveAppointmentNo(context).then((res) {
if (res['MessageStatus'] == 1) {
toDoProvider.setState(res['AppointmentActiveNumber'], true, "0");
} else {}
}).catchError((err) {
print(err);
});
}
} }
class Language { class Language {

@ -14,16 +14,18 @@ import 'package:diplomaticquarterapp/uitl/utils.dart';
import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart';
import 'package:diplomaticquarterapp/widgets/dialogs/alert_dialog.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/alert_dialog.dart';
import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart';
import 'package:diplomaticquarterapp/widgets/input/text_field.dart';
import 'package:diplomaticquarterapp/widgets/mobile-no/mobile_no.dart'; import 'package:diplomaticquarterapp/widgets/mobile-no/mobile_no.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:intl/intl.dart'; import 'package:intl/intl.dart' as intl;
import 'package:flutter_datetime_picker/flutter_datetime_picker.dart';
class Register extends StatefulWidget { class Register extends StatefulWidget {
final Function changePageViewIndex;
const Register({Key key, this.changePageViewIndex}) : super(key: key);
@override @override
_Register createState() => _Register(); _Register createState() => _Register();
} }
@ -36,7 +38,9 @@ class _Register extends State<Register> {
var isHijri; var isHijri;
final util = Utils(); final util = Utils();
DateTime selectedDate; DateTime selectedDate;
String dob; TextEditingController dob = TextEditingController();
TextEditingController dobEn = TextEditingController();
bool isButtonDisabled = true; bool isButtonDisabled = true;
final authService = new AuthProvider(); final authService = new AuthProvider();
final sharedPref = new AppSharedPreferences(); final sharedPref = new AppSharedPreferences();
@ -47,8 +51,10 @@ class _Register extends State<Register> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return AppScaffold( return AppScaffold(
appBarTitle: TranslationBase.of(context).register, appBarTitle: TranslationBase.of(context).register,
isShowAppBar: true, isShowAppBar: false,
isShowDecPage: false, isShowDecPage: false,
showNewAppBar: false,
showNewAppBarTitle: true,
body: SingleChildScrollView( body: SingleChildScrollView(
child: Container( child: Container(
padding: EdgeInsets.only(top: 10, left: 20, right: 20, bottom: 30), padding: EdgeInsets.only(top: 10, left: 20, right: 20, bottom: 30),
@ -56,27 +62,22 @@ class _Register extends State<Register> {
width: SizeConfig.realScreenWidth, width: SizeConfig.realScreenWidth,
child: Column(children: <Widget>[ child: Column(children: <Widget>[
Expanded( Expanded(
flex: 1, child: ListView(
child: AppText( padding: EdgeInsets.zero,
TranslationBase.of(context).enterNationalId, physics: BouncingScrollPhysics(),
fontSize: SizeConfig.textMultiplier * 3, children: [
textAlign: TextAlign.left, SizedBox(height: 10),
)), Padding(
Expanded( padding: EdgeInsets.all(10),
flex: 4, child: Text(
child: Column( TranslationBase.of(context).enterNationalId,
mainAxisAlignment: MainAxisAlignment.spaceEvenly, style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.64, height: 23 / 16),
children: <Widget>[ )),
MobileNo(onNumberChange: (value) => {mobileNo = value, validateForm()}, onCountryChange: (value) => countryCode = value), SizedBox(height: 10),
Container( PhoneNumberSelectorWidget(onNumberChange: (value) => {mobileNo = value, validateForm()}, onCountryChange: (value) => countryCode = value),
child: TextFields( SizedBox(height: 12),
controller: nationalIDorFile, Directionality(textDirection: TextDirection.ltr, child: inputWidget(TranslationBase.of(context).nationalIdNumber, "Xxxxxxxxx", nationalIDorFile)),
onChanged: (value) => validateForm(), SizedBox(height: 20),
keyboardType: TextInputType.number,
prefixIcon: Icon(Icons.chrome_reader_mode, color: Color(0xFF40ACC9)),
padding: EdgeInsets.only(top: 20, bottom: 20, left: 10, right: 10),
hintText: TranslationBase.of(context).nationalID,
)),
Row( Row(
children: <Widget>[ children: <Widget>[
Expanded( Expanded(
@ -115,64 +116,159 @@ class _Register extends State<Register> {
), ),
], ],
), ),
Row(mainAxisAlignment: MainAxisAlignment.end, children: <Widget>[ Row(children: <Widget>[
Container( Container(
width: SizeConfig.realScreenWidth * .9, width: SizeConfig.realScreenWidth * .9,
height: 60,
child: isHijri == 1 child: isHijri == 1
? TextFields( ? Directionality(
onChanged: (value) => {dob = value}, textDirection: TextDirection.ltr,
hintText: 'DD/MM/YYYY', child: inputWidget(TranslationBase.of(context).dob, "DD/MM/YYYYY", dob,
prefixIcon: Icon(Icons.date_range), isNumber: false,
) suffix: Icon(
: RaisedButton.icon( Icons.calendar_today,
shape: RoundedRectangleBorder( size: 16,
borderRadius: BorderRadius.circular(15.0), )))
), : Container(
elevation: 0, child: InkWell(
color: Colors.white, onTap: () {
onPressed: () => {if (isHijri != null) _selectDate(context)}, if (isHijri != null) _selectDate(context);
icon: Icon(Icons.date_range), },
label: Text(selectedDate != null ? "${selectedDate.toLocal()}".split(' ')[0] : TranslationBase.of(context).dob))) child: Directionality(
textDirection: TextDirection.ltr,
child: inputWidget(TranslationBase.of(context).dob, "DD/MM/YYYYY", dobEn,
isNumber: false,
isEnable: false,
suffix: Icon(
Icons.calendar_today,
size: 16,
)))))),
]) ])
], ],
), ),
), ),
Expanded(
flex: 2,
child: Column(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
Divider(
color: Colors.grey,
height: 2,
),
SizedBox(
height: 10,
),
Row(
children: <Widget>[
Expanded(
child: DefaultButton(TranslationBase.of(context).registerNow, () => {startRegistration()},
textColor: Colors.white, color: isButtonDisabled == true ? Colors.grey : Colors.grey[900]))
],
),
],
))
]), ]),
))); )),
bottomSheet: Container(
width: double.maxFinite,
height: 80.0,
child: Row(
children: [
Expanded(
child: Padding(
padding: EdgeInsets.all(10), child: DefaultButton(TranslationBase.of(context).cancel, () => {Navigator.of(context).pop()}, textColor: Colors.white, color: Color(0xffD02127))),
),
Expanded(
child: Padding(
padding: EdgeInsets.all(10),
child: DefaultButton(TranslationBase.of(context).next, () => {startRegistration()}, textColor: Colors.white, color: isButtonDisabled == true ? Colors.grey : Color(0xff359846))),
),
],
)));
} }
Future<Null> _selectDate(BuildContext context) async { Future<Null> _selectDate(BuildContext context) async {
final DateTime picked = await showDatePicker(context: context, initialDate: DateTime.now(), firstDate: DateTime(1950, 8), lastDate: DateTime.now()); DatePicker.showDatePicker(
if (picked != null && picked != selectedDate) context,
setState(() { showTitleActions: true,
selectedDate = picked; minTime: DateTime(DateTime.now().year - 100, 1, 1),
}); maxTime: DateTime.now(),
onConfirm: (date) {
selectedDate = date;
setState(() {
final intl.DateFormat dateFormat = intl.DateFormat('dd/MM/yyyy');
dobEn.text = dateFormat.format(date);
});
},
currentTime: DateTime.now(),
);
}
Widget inputWidget(String _labelText, String _hintText, TextEditingController _controller, {String prefix, bool isEnable = true, bool hasSelection = false, bool isNumber = true, Icon suffix}) {
return Container(
padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15),
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(15),
color: Colors.white,
border: Border.all(
color: Color(0xffefefef),
width: 1,
),
),
child: InkWell(
onTap: hasSelection ? () {} : null,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expanded(
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
_labelText,
style: TextStyle(
fontSize: 11,
fontWeight: FontWeight.w600,
color: Color(0xff2B353E),
letterSpacing: -0.44,
),
),
TextField(
enabled: isEnable,
scrollPadding: EdgeInsets.zero,
keyboardType: isNumber ? TextInputType.number : TextInputType.datetime,
controller: _controller,
onChanged: (value) => {validateForm()},
style: TextStyle(
fontSize: 14,
height: 21 / 14,
fontWeight: FontWeight.w400,
color: Color(0xff2B353E),
letterSpacing: -0.44,
),
decoration: InputDecoration(
isDense: true,
hintText: _hintText,
hintStyle: TextStyle(
fontSize: 14,
height: 21 / 14,
fontWeight: FontWeight.w400,
color: Color(0xff575757),
letterSpacing: -0.56,
),
prefixIconConstraints: BoxConstraints(minWidth: 50),
prefixIcon: prefix == null
? null
: Text(
"+" + prefix,
style: TextStyle(
fontSize: 14,
height: 21 / 14,
fontWeight: FontWeight.w500,
color: Color(0xff2E303A),
letterSpacing: -0.56,
),
),
contentPadding: EdgeInsets.zero,
border: InputBorder.none,
focusedBorder: InputBorder.none,
enabledBorder: InputBorder.none,
),
),
],
),
),
if (hasSelection) Icon(Icons.keyboard_arrow_down_outlined),
if (suffix != null) suffix
],
),
),
);
} }
startRegistration() { startRegistration() {
final DateFormat dateFormat = DateFormat('dd/MM/yyyy'); final intl.DateFormat dateFormat = intl.DateFormat('dd/MM/yyyy');
if (isButtonDisabled == false) { if (isButtonDisabled == false) {
var request = CheckPatientForRegistration(); var request = CheckPatientForRegistration();
request.patientMobileNumber = int.parse(mobileNo); request.patientMobileNumber = int.parse(mobileNo);
@ -182,7 +278,7 @@ class _Register extends State<Register> {
request.patientIdentificationID = int.parse(nationalIDorFile.text); request.patientIdentificationID = int.parse(nationalIDorFile.text);
request.patientID = 0; request.patientID = 0;
request.isRegister = true; request.isRegister = true;
request.dob = isHijri == 1 ? dob : dateFormat.format(selectedDate); request.dob = isHijri == 1 ? dob.text : dateFormat.format(selectedDate);
request.isHijri = isHijri; request.isHijri = isHijri;
this.checkPatientForRegisteration(request); this.checkPatientForRegisteration(request);
} }
@ -207,7 +303,11 @@ class _Register extends State<Register> {
} }
void validateForm() { void validateForm() {
if (util.validateIDBox(nationalIDorFile.text, loginType) == true && mobileNo.length >= 9 && util.isSAUDIIDValid(nationalIDorFile.text, loginType) == true && isHijri != null) { if (util.validateIDBox(nationalIDorFile.text, loginType) == true &&
mobileNo.length >= 9 &&
util.isSAUDIIDValid(nationalIDorFile.text, loginType) == true &&
isHijri != null &&
(dobEn.text != null || dob.text != null)) {
setState(() { setState(() {
isButtonDisabled = false; isButtonDisabled = false;
}); });
@ -266,11 +366,11 @@ class _Register extends State<Register> {
// IsHijri: Number(this.dateOption) // IsHijri: Number(this.dateOption)
// } // }
final DateFormat dateFormat = DateFormat('dd/MM/yyyy'); final intl.DateFormat dateFormat = intl.DateFormat('dd/MM/yyyy');
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
var request = CheckUserStatusRequest(); var request = CheckUserStatusRequest();
request.patientIdentificationID = nationalIDorFile.text; request.patientIdentificationID = nationalIDorFile.text;
request.dOB = isHijri == 1 ? dob : dateFormat.format(selectedDate); request.dOB = isHijri == 1 ? dob.text : dateFormat.format(selectedDate);
request.isHijri = isHijri; request.isHijri = isHijri;
request.patientOutSA = countryCode == '966' ? 0 : 1; request.patientOutSA = countryCode == '966' ? 0 : 1;
this.authService.checkUserStatus(request).then((result) => { this.authService.checkUserStatus(request).then((result) => {
@ -279,16 +379,10 @@ class _Register extends State<Register> {
{ {
result = CheckUserStatusResponse.fromJson(result), result = CheckUserStatusResponse.fromJson(result),
sharedPref.setObject(NHIC_DATA, result), sharedPref.setObject(NHIC_DATA, result),
Navigator.of(context).push(FadePage(page: ConfirmLogin())), Navigator.of(context).push(FadePage(page: ConfirmLogin(changePageViewIndex: widget.changePageViewIndex))),
} }
else else
{AppToast.showErrorToast(message: result ? result : TranslationBase.of(context).somethingWentWrong)} {AppToast.showErrorToast(message: result ? result : TranslationBase.of(context).somethingWentWrong)}
}); });
} }
showLoader(bool isTrue) {
setState(() {
isLoading = isTrue;
});
}
} }

@ -0,0 +1,203 @@
import 'package:diplomaticquarterapp/config/size_config.dart';
import 'package:diplomaticquarterapp/pages/login/login-type.dart';
import 'package:diplomaticquarterapp/pages/login/register.dart';
import 'package:diplomaticquarterapp/pages/login/register-info.dart';
import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart';
import 'package:diplomaticquarterapp/theme/colors.dart';
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/uitl/utils.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:diplomaticquarterapp/uitl/utils_new.dart';
import 'package:diplomaticquarterapp/pages/login/confirm-login.dart';
class RegisterNew extends StatefulWidget {
@override
_RegisterNew createState() => _RegisterNew();
}
class _RegisterNew extends State<RegisterNew> {
final nationalIDorFile = TextEditingController();
final int loginType = LoginType.loginType;
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();
PageController _controller;
bool isLoading;
int _currentIndex = 0;
@override
void initState() {
super.initState();
_controller = new PageController();
}
@override
void dispose() {
super.dispose();
}
changePageViewIndex(pageIndex) {
_controller.jumpToPage(pageIndex);
}
@override
Widget build(BuildContext context) {
return AppScaffold(
appBarTitle: TranslationBase.of(context).register,
isShowAppBar: true,
isShowDecPage: false,
showNewAppBar: true,
showNewAppBarTitle: true,
body: SingleChildScrollView(
child: Container(
height: SizeConfig.realScreenHeight * .9,
width: SizeConfig.realScreenWidth,
child: Column(children: <Widget>[
Container(
width: double.infinity,
padding: EdgeInsets.only(left: 20, right: 20, top: 12),
child: Row(
children: [
Expanded(
child: showProgress(
title: TranslationBase.of(context).RequesterInfo,
status: _currentIndex == 0
? TranslationBase.of(context).inPrgress
: _currentIndex > 0
? TranslationBase.of(context).completed
: TranslationBase.of(context).locked,
color: _currentIndex == 0 ? CustomColors.orange : CustomColors.green,
),
),
Expanded(
child: showProgress(
title: TranslationBase.of(context).patientInfo,
status: _currentIndex == 1
? TranslationBase.of(context).inPrgress
: _currentIndex > 1
? TranslationBase.of(context).completed
: TranslationBase.of(context).locked,
color: _currentIndex == 1
? CustomColors.orange
: _currentIndex > 1
? CustomColors.green
: CustomColors.grey2,
),
),
showProgress(
title: TranslationBase.of(context).otherInfo,
status: _currentIndex == 2 ? TranslationBase.of(context).inPrgress : TranslationBase.of(context).locked,
color: _currentIndex == 2
? CustomColors.orange
: _currentIndex > 3
? CustomColors.green
: CustomColors.grey2,
isNeedBorder: false,
),
],
),
),
Expanded(
child: PageView(
physics: NeverScrollableScrollPhysics(),
controller: _controller,
onPageChanged: (index) {
setState(() {
_currentIndex = index;
});
},
scrollDirection: Axis.horizontal,
children: <Widget>[
Register(
changePageViewIndex: changePageViewIndex,
),
RegisterInfo(
changePageViewIndex: changePageViewIndex,
),
RegisterInfo(changePageViewIndex: changePageViewIndex, page: 2),
// NewEReferralStepOnePage(
// changePageViewIndex: changePageViewIndex,
// createEReferralRequestModel: createEReferralRequestModel,
// ),
// NewEReferralStepTowPage(
// changePageViewIndex: changePageViewIndex,
// createEReferralRequestModel: createEReferralRequestModel,
// ),
// NewEReferralStepThreePage(
// changePageViewIndex: changePageViewIndex,
// createEReferralRequestModel: createEReferralRequestModel,
// ),
],
),
),
]),
)),
);
}
Widget showProgress({String title, String status, Color color, bool isNeedBorder = true}) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Container(
width: 26,
height: 26,
decoration: containerRadius(color, 200),
child: Icon(
Icons.done,
color: Colors.white,
size: 16,
),
),
if (isNeedBorder)
Expanded(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: mDivider(Colors.grey),
)),
],
),
mHeight(8),
Text(
title,
style: TextStyle(
fontSize: 11,
fontWeight: FontWeight.w600,
letterSpacing: -0.44,
),
),
mHeight(2),
Container(
padding: EdgeInsets.all(5),
decoration: containerRadius(color.withOpacity(0.2), 4),
child: Text(
status,
style: TextStyle(
fontSize: 8,
fontWeight: FontWeight.w600,
letterSpacing: -0.32,
color: color,
),
),
),
],
)
],
);
}
}

@ -4,6 +4,7 @@ import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart';
import 'package:diplomaticquarterapp/core/service/client/base_app_client.dart'; import 'package:diplomaticquarterapp/core/service/client/base_app_client.dart';
import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart';
import 'package:diplomaticquarterapp/models/Authentication/check_activation_code_request.dart'; import 'package:diplomaticquarterapp/models/Authentication/check_activation_code_request.dart';
import 'package:diplomaticquarterapp/models/Authentication/check_activation_code_request_register.dart';
import 'package:diplomaticquarterapp/models/Authentication/check_activation_code_response.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_paitent_authentication_req.dart';
import 'package:diplomaticquarterapp/models/Authentication/check_user_status_req.dart'; import 'package:diplomaticquarterapp/models/Authentication/check_user_status_req.dart';
@ -15,7 +16,7 @@ import 'package:diplomaticquarterapp/models/Authentication/select_device_imei_re
import 'package:diplomaticquarterapp/models/Request.dart'; import 'package:diplomaticquarterapp/models/Request.dart';
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:intl/intl.dart';
import '../../locator.dart'; import '../../locator.dart';
// SharedPreferences sharedPref = new SharedPreferences(); // SharedPreferences sharedPref = new SharedPreferences();
@ -29,7 +30,11 @@ const String SELECT_DEVICE_IMEI = 'Services/Patients.svc/REST/Patient_SELECTDevi
const String CHECK_PATIENT_AUTH = 'Services/Authentication.svc/REST/CheckPatientAuthentication'; const String CHECK_PATIENT_AUTH = 'Services/Authentication.svc/REST/CheckPatientAuthentication';
const GET_MOBILE_INFO = 'Services/Authentication.svc/REST/GetMobileLoginInfo'; const GET_MOBILE_INFO = 'Services/Authentication.svc/REST/GetMobileLoginInfo';
const SEND_ACTIVATION_CODE = 'Services/Authentication.svc/REST/SendActivationCodebyOTPNotificationType'; const SEND_ACTIVATION_CODE = 'Services/Authentication.svc/REST/SendActivationCodebyOTPNotificationType';
const SEND_ACTIVATION_CODE_REGISTER = 'Services/Authentication.svc/REST/SendActivationCodebyOTPNotificationTypeForRegistration';
const CHECK_ACTIVATION_CODE = 'Services/Authentication.svc/REST/CheckActivationCode'; const CHECK_ACTIVATION_CODE = 'Services/Authentication.svc/REST/CheckActivationCode';
const CHECK_ACTIVATION_CODE_REGISTER = 'Services/Authentication.svc/REST/CheckActivationCodeForRegistration';
const FORGOT_PASSWORD = 'Services/Authentication.svc/REST/CheckActivationCodeForSendFileNo'; const FORGOT_PASSWORD = 'Services/Authentication.svc/REST/CheckActivationCodeForSendFileNo';
const CHECK_PATIENT_FOR_REGISTRATION = "Services/Authentication.svc/REST/CheckPatientForRegisteration"; const CHECK_PATIENT_FOR_REGISTRATION = "Services/Authentication.svc/REST/CheckPatientForRegisteration";
@ -211,8 +216,29 @@ class AuthProvider with ChangeNotifier {
return Future.value(localRes); return Future.value(localRes);
} }
Future<dynamic> sendActivationCodeRegister(request) async {
request.versionID = VERSION_ID;
request.channel = CHANNEL;
request.iPAdress = IP_ADDRESS;
request.generalid = GENERAL_ID;
request.languageID = LANGUAGE_ID;
request.deviceTypeID = DeviceTypeID;
request.patientOutSA = request.zipCode == '966' ? 0 : 1;
request.isDentalAllowedBackend = false;
dynamic localRes;
await new BaseAppClient().post(SEND_ACTIVATION_CODE_REGISTER, onSuccess: (dynamic response, int statusCode) {
localRes = response;
authenticatedUser = CheckActivationCode.fromJson(localRes);
}, onFailure: (String error, int statusCode) {
throw error;
}, body: request.toJson());
return Future.value(localRes);
}
Future<dynamic> checkActivationCode(request, [value]) async { Future<dynamic> checkActivationCode(request, [value]) async {
var neRequest = CheckActivationCodeReq.fromJson(request); var neRequest = CheckActivationCodeReq.fromJson(request);
neRequest.activationCode = value ?? "0000"; neRequest.activationCode = value ?? "0000";
neRequest.isSilentLogin = value != null ? false : true; neRequest.isSilentLogin = value != null ? false : true;
neRequest.versionID = VERSION_ID; neRequest.versionID = VERSION_ID;
@ -236,6 +262,38 @@ class AuthProvider with ChangeNotifier {
return Future.value(error); return Future.value(error);
// throw error; // throw error;
}, body: neRequest.toJson()); }, body: neRequest.toJson());
return Future.value(localRes);
} catch (error) {
throw localRes;
}
}
Future<dynamic> checkActivationCodeRegister(request, [value]) async {
var neRequest = CheckActivationCodeRegisterReq.fromJson(request);
neRequest.activationCode = value ?? "0000";
neRequest.isSilentLogin = value != null ? false : true;
neRequest.versionID = VERSION_ID;
neRequest.channel = CHANNEL;
neRequest.iPAdress = IP_ADDRESS;
neRequest.generalid = GENERAL_ID;
// neRequest.languageID = LANGUAGE_ID;
neRequest.deviceTypeID = DeviceTypeID;
neRequest.patientOutSA = neRequest.zipCode == '966' ? 0 : 1;
neRequest.projectOutSA = neRequest.zipCode == '966' ? false : true;
neRequest.isDentalAllowedBackend = false;
// neRequest.deviceToken = null;
neRequest.forRegisteration = neRequest.isRegister != null ? neRequest.isRegister : false;
neRequest.isRegister = false;
dynamic localRes;
try {
await new BaseAppClient().post(CHECK_ACTIVATION_CODE_REGISTER, onSuccess: (dynamic response, int statusCode) {
localRes = response; //CheckActivationCode.fromJson();
}, onFailure: (String error, int statusCode) {
localRes = error;
return Future.value(error);
// throw error;
}, body: neRequest.toJson());
// sharedPref.setString(BLOOD_TYPE, localRes['PatientBloodType']); // sharedPref.setString(BLOOD_TYPE, localRes['PatientBloodType']);
return Future.value(localRes); return Future.value(localRes);
} catch (error) { } catch (error) {
@ -302,10 +360,18 @@ class AuthProvider with ChangeNotifier {
request['Generalid'] = GENERAL_ID; request['Generalid'] = GENERAL_ID;
request['DeviceTypeID'] = DeviceTypeID; request['DeviceTypeID'] = DeviceTypeID;
request['LanguageID'] = LANGUAGE_ID; request['LanguageID'] = LANGUAGE_ID;
request['LogInTokenID'] = await sharedPref.getString(LOGIN_TOKEN_ID);
var nhic = await sharedPref.getObject(NHIC_DATA);
var requestN = RegisterUserRequest.fromJson(request); var requestN = RegisterUserRequest.fromJson(request);
requestN.patientOutSA = requestN.patientobject.patientOutSA; requestN.patientOutSA = requestN.patientobject.patientOutSA;
final DateFormat dateFormat = DateFormat('MM/dd/yyyy');
final DateFormat dateFormat2 = DateFormat('dd/MM/yyyy');
requestN.dob = nhic['IsHijri'] ? nhic['DateOfBirth'] : dateFormat2.format(dateFormat.parse(nhic['DateOfBirth']));
requestN.zipCode = requestN.patientOutSA == 1 ? '971' : '966';
requestN.healthId = requestN.patientobject.eHealthIDField;
requestN.isHijri = nhic['IsHijri'] ? 1 : 0;
await sharedPref.remove(USER_PROFILE); await sharedPref.remove(USER_PROFILE);
// request.tokenID = '';
dynamic localRes; dynamic localRes;
try { try {
await new BaseAppClient().post(REGISTER_USER, onSuccess: (dynamic response, int statusCode) { await new BaseAppClient().post(REGISTER_USER, onSuccess: (dynamic response, int statusCode) {

@ -1799,10 +1799,8 @@ class TranslationBase {
String get quantitySize => localizedValues['quantitySize'][locale.languageCode]; String get quantitySize => localizedValues['quantitySize'][locale.languageCode];
String get addToCart => localizedValues['addToCart'][locale.languageCode]; String get addToCart => localizedValues['addToCart'][locale.languageCode];
String get addToWishlist => String get addToWishlist => localizedValues['addToWishlist'][locale.languageCode];
localizedValues['addToWishlist'][locale.languageCode]; String get removeFromWishlist => localizedValues['removeFromWishlist'][locale.languageCode];
String get removeFromWishlist =>
localizedValues['removeFromWishlist'][locale.languageCode];
String get buyNow => localizedValues['buyNow'][locale.languageCode]; String get buyNow => localizedValues['buyNow'][locale.languageCode];
String get quantityShortcut => localizedValues['quantityShortcut'][locale.languageCode]; String get quantityShortcut => localizedValues['quantityShortcut'][locale.languageCode];
@ -2418,6 +2416,8 @@ class TranslationBase {
String get locked => localizedValues["locked"][locale.languageCode]; String get locked => localizedValues["locked"][locale.languageCode];
String get personalInfo => localizedValues['personalInfo'][locale.languageCode];
String get onlinePayment => localizedValues["onlinePayment"][locale.languageCode]; String get onlinePayment => localizedValues["onlinePayment"][locale.languageCode];
String get onlinePaymentSubtitle => localizedValues["onlinePaymentSubtitle"][locale.languageCode]; String get onlinePaymentSubtitle => localizedValues["onlinePaymentSubtitle"][locale.languageCode];
@ -2479,7 +2479,6 @@ class TranslationBase {
String get newProducts => localizedValues["newProducts"][locale.languageCode]; String get newProducts => localizedValues["newProducts"][locale.languageCode];
String get paymentSelected => localizedValues["paymentSelected"][locale.languageCode]; String get paymentSelected => localizedValues["paymentSelected"][locale.languageCode];
} }
class TranslationBaseDelegate extends LocalizationsDelegate<TranslationBase> { class TranslationBaseDelegate extends LocalizationsDelegate<TranslationBase> {

Loading…
Cancel
Save