registration changes

merge-update-with-lab-changes
Sultan Khan 6 years ago
parent e735855c33
commit 8e3fb6831d

@ -139,4 +139,19 @@ const Map<String, Map<String, String>> localizedValues = {
},
"another-acc": {"en": "Use Another Account", "ar": "استخدم حسابا آخر"},
"next": {"en": "Next", "ar": 'التالى'},
"first-name": {"en": "First Name", "ar": "الاسم الأول"},
"middle-name": {"en": "Middle Name", "ar": "الاسم الثاني"},
"last-name": {"en": "Last Name", "ar": "إسم العائلة"},
"female": {"en": "Female", "ar": "أنثى"},
"male": {"en": "Male", "ar": "ذكر"},
"preferred-language": {"en": "Preferred Language", "ar": "اللغة المفضلة"},
"english": {"en": "English", "ar": "الإنجليزية"},
"arabic": {"en": "Arabic", "ar": "العربية"},
"locations-register": {
"en": "Where do you want to create this file?",
"ar": "أين تريد فتح هذا الملف؟"
},
"ksa": {"en": "KSA", "ar": "السعودية"},
"dubai": {"en": "Dubai", "ar": "دبي"},
"enter-email": {"en": "Enter Email", "ar": "ادخل البريد الالكتروني"},
};

@ -49,6 +49,8 @@ class BaseAppClient {
} else if (parsed['MessageStatus'] == 1) {
onSuccess(parsed, statusCode);
} else {
onFailure(parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'],
statusCode);
logout();
}
// await helpers.logout();

@ -0,0 +1,104 @@
class RegisteredAuthenticatedUserRequest {
double versionID;
int channel;
int languageID;
String iPAdress;
String generalid;
int patientOutSA;
String sessionID;
bool isDentalAllowedBackend;
int deviceTypeID;
int patientID;
String tokenID;
String voipToken;
int patientTypeID;
int patientType;
String deviceToken;
String deviceType;
String patientMobileNumber;
String nationalID;
int gender;
int loginType;
String mACAddress;
int latitude;
int longitude;
RegisteredAuthenticatedUserRequest(
{this.versionID,
this.channel,
this.languageID,
this.iPAdress,
this.generalid,
this.patientOutSA,
this.sessionID,
this.isDentalAllowedBackend,
this.deviceTypeID,
this.patientID,
this.tokenID,
this.voipToken,
this.patientTypeID,
this.patientType,
this.deviceToken,
this.deviceType,
this.patientMobileNumber,
this.nationalID,
this.gender,
this.loginType,
this.mACAddress,
this.latitude,
this.longitude});
RegisteredAuthenticatedUserRequest.fromJson(Map<String, dynamic> json) {
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'];
patientID = json['PatientID'];
tokenID = json['TokenID'];
voipToken = json['VoipToken'];
patientTypeID = json['PatientTypeID'];
patientType = json['PatientType'];
deviceToken = json['DeviceToken'];
deviceType = json['DeviceType'];
patientMobileNumber = json['PatientMobileNumber'];
nationalID = json['NationalID'];
gender = json['Gender'];
loginType = json['LoginType'];
mACAddress = json['MACAddress'];
latitude = json['Latitude'];
longitude = json['Longitude'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
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['PatientID'] = this.patientID;
data['TokenID'] = this.tokenID;
data['VoipToken'] = this.voipToken;
data['PatientTypeID'] = this.patientTypeID;
data['PatientType'] = this.patientType;
data['DeviceToken'] = this.deviceToken;
data['DeviceType'] = this.deviceType;
data['PatientMobileNumber'] = this.patientMobileNumber;
data['NationalID'] = this.nationalID;
data['Gender'] = this.gender;
data['LoginType'] = this.loginType;
data['MACAddress'] = this.mACAddress;
data['Latitude'] = this.latitude;
data['Longitude'] = this.longitude;
return data;
}
}

@ -1,4 +1,5 @@
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart';
import 'package:diplomaticquarterapp/models/Authentication/select_device_imei_res.dart';
import 'package:diplomaticquarterapp/pages/ToDoList/ToDo.dart';
import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart';
@ -69,7 +70,12 @@ class _LandingPageState extends State<LandingPage> {
body: PageView(
physics: NeverScrollableScrollPhysics(),
controller: pageController,
children: [Container(), MedicalProfilePage(), MyAdmissionsPage(), ToDo()],
children: [
Container(),
MedicalProfilePage(),
MyAdmissionsPage(),
ToDo()
],
),
bottomNavigationBar: BottomNavBar(changeIndex: _changeCurrentTab),
);
@ -90,14 +96,23 @@ class _LandingPageState extends State<LandingPage> {
}
}
void checkUserStatus(token) {
void checkUserStatus(token) async {
authService
.selectDeviceImei(token)
.then((SelectDeviceIMEIRES value) => setUserValues(value));
if (await sharedPref.getObject(USER_PROFILE) != null) {
var data =
AuthenticatedUser.fromJson(await sharedPref.getObject(USER_PROFILE));
if (data != null)
authService.registeredAuthenticatedUser(data, token, 0, 0);
// setState(() {
// this.user = data;
// print(this.user);
// });
}
}
void setUserValues(value) async {
print(value);
sharedPref.setObject(IMEI_USER_DATA, value);
}
}

@ -301,9 +301,9 @@ class _ConfirmLogin extends State<ConfirmLogin> {
this.checkUserAuthentication(type);
} else {
if (this.loginTokenID != null) {
Future.delayed(Duration(seconds: 1), () {
this.sendActivationCode(type);
});
// Future.delayed(Duration(seconds: 1), () {
this.sendActivationCode(type);
// });
} else {
this.checkUserAuthentication(type);
}
@ -322,9 +322,9 @@ class _ConfirmLogin extends State<ConfirmLogin> {
sharedPref.setString(LOGIN_TOKEN_ID, value['LogInTokenID']),
this.loginTokenID = value['LogInTokenID'],
sharedPref.setObject(REGISTER_DATA_FOR_LOGIIN, request),
Future.delayed(Duration(seconds: 1), () {
this.sendActivationCode(type);
})
// Future.delayed(Duration(seconds: 1), () {
this.sendActivationCode(type)
// })
}
else
{

@ -21,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:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:hijri/hijri_calendar.dart';
import 'package:intl/intl.dart';
@ -92,7 +93,8 @@ class _RegisterInfo extends State<RegisterInfo> {
right: 10),
readOnly: true,
)),
AppText('First Name'),
AppText(
TranslationBase.of(context).firstName),
Container(
margin: EdgeInsets.only(bottom: 10),
child: TextFields(
@ -104,7 +106,8 @@ class _RegisterInfo extends State<RegisterInfo> {
right: 10),
readOnly: true,
)),
AppText('Middle Name'),
AppText(
TranslationBase.of(context).middleName),
Container(
margin: EdgeInsets.only(bottom: 10),
child: TextFields(
@ -116,7 +119,7 @@ class _RegisterInfo extends State<RegisterInfo> {
right: 10),
readOnly: true,
)),
AppText('Last Name'),
AppText(TranslationBase.of(context).lastName),
Container(
margin: EdgeInsets.only(bottom: 10),
child: TextFields(
@ -128,7 +131,7 @@ class _RegisterInfo extends State<RegisterInfo> {
right: 10),
readOnly: true,
)),
AppText('Gender'),
AppText(TranslationBase.of(context).gender),
Container(
margin: EdgeInsets.only(bottom: 10),
child: TextFields(
@ -138,8 +141,12 @@ class _RegisterInfo extends State<RegisterInfo> {
? 'Unknown'
: registerInfo.maritalStatusCode ==
'M'
? 'Male'
: 'Female',
? AppText(
TranslationBase.of(context)
.male)
: AppText(
TranslationBase.of(context)
.female),
padding: EdgeInsets.only(
top: 20,
bottom: 20,
@ -147,7 +154,8 @@ class _RegisterInfo extends State<RegisterInfo> {
right: 10),
readOnly: true,
)),
AppText('Nationality'),
AppText(
TranslationBase.of(context).nationality),
Container(
margin: EdgeInsets.only(bottom: 10),
child: TextFields(
@ -159,7 +167,7 @@ class _RegisterInfo extends State<RegisterInfo> {
right: 10),
readOnly: true,
)),
AppText('Date of Birth'),
AppText(TranslationBase.of(context).dob),
Container(
margin: EdgeInsets.only(bottom: 10),
child: TextFields(
@ -185,7 +193,8 @@ class _RegisterInfo extends State<RegisterInfo> {
MainAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
AppText('Preferred Language'),
AppText(TranslationBase.of(context)
.prefferedLanguage),
Container(
margin: EdgeInsets.only(top: 0),
decoration: BoxDecoration(
@ -212,8 +221,12 @@ class _RegisterInfo extends State<RegisterInfo> {
newValue) =>
{},
items: <String>[
'English',
'Arabic',
TranslationBase.of(
context)
.english,
TranslationBase.of(
context)
.arabic,
].map<
DropdownMenuItem<
String>>((String
@ -225,8 +238,8 @@ class _RegisterInfo extends State<RegisterInfo> {
Text(value),
);
}).toList()))),
AppText(
'Where do you want to create this file?'),
AppText(TranslationBase.of(context)
.registrLocation),
Container(
margin:
EdgeInsets.only(bottom: 10),
@ -254,8 +267,12 @@ class _RegisterInfo extends State<RegisterInfo> {
newValue) =>
{},
items: <String>[
'KSA',
'Dubai',
TranslationBase.of(
context)
.ksa,
TranslationBase.of(
context)
.dubai,
].map<
DropdownMenuItem<
String>>((String
@ -267,12 +284,15 @@ class _RegisterInfo extends State<RegisterInfo> {
Text(value),
);
}).toList()))),
AppText('Email'),
AppText(TranslationBase.of(context)
.enterEmail),
Container(
margin:
EdgeInsets.only(bottom: 10),
child: TextFields(
hintText: 'Email',
hintText:
TranslationBase.of(context)
.enterEmail,
controller: emailAddress,
padding: EdgeInsets.only(
top: 20,
@ -319,23 +339,6 @@ class _RegisterInfo extends State<RegisterInfo> {
])
],
))),
// Expanded(
// flex: 2,
// child: Column(
// mainAxisAlignment: MainAxisAlignment.end,
// children: <Widget>[
// Row(
// children: <Widget>[
// Expanded(
// child: DefaultButton(
// TranslationBase.of(context).next,
// () => {nextPage()},
// textColor: Colors.white,
// ))
// ],
// ),
// ],
// ))
)));
}

@ -271,7 +271,7 @@ class _Register extends State<Register> {
// )
}
else
{AppToast.showErrorToast(message: result['ErrorEndUserMessage'])}
{AppToast.showErrorToast(message: result)}
//this.onRegister();
});
}

@ -1,5 +1,3 @@
import 'dart:convert';
import 'package:diplomaticquarterapp/config/config.dart';
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
import 'package:diplomaticquarterapp/models/Authentication/check_activation_code_request.dart';
@ -11,6 +9,7 @@ import 'package:diplomaticquarterapp/models/Authentication/checkpatient_for_regi
import 'package:diplomaticquarterapp/models/Authentication/insert_device_imei_request.dart';
import 'package:diplomaticquarterapp/models/Authentication/register_user_requet.dart';
import 'package:diplomaticquarterapp/models/Authentication/select_device_imei_res.dart';
import 'package:diplomaticquarterapp/models/Authentication/registered_authenticated_user_req.dart';
import 'package:diplomaticquarterapp/core/service/client/base_app_client.dart';
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
import 'package:flutter/cupertino.dart';
@ -33,6 +32,8 @@ const CHECK_PATIENT_FOR_REGISTRATION =
const CHECK_USER_STATUS = "/NHIC.svc/REST/GetPatientInfo";
const REGISTER_USER = '/Authentication.svc/REST/PatientRegistration';
const LOGGED_IN_USER_URL =
'/MobileNotifications.svc/REST/Insert_PatientMobileDeviceInfo';
class AuthProvider with ChangeNotifier {
bool isLogin = false;
@ -326,4 +327,36 @@ class AuthProvider with ChangeNotifier {
throw error;
}
}
Future registeredAuthenticatedUser(
AuthenticatedUser user, deviceToken, lat, long) async {
var request = new RegisteredAuthenticatedUserRequest();
request.deviceToken = deviceToken;
request.voipToken =
""; //this.cs.sharedService.getSharedData(AuthenticationService.APNS_TOKEN, false);
request.deviceType = DeviceTypeID.toString();
request.patientMobileNumber = '0' + user.mobileNumber;
request.nationalID = user.patientIdentificationNo;
request.gender = user.gender;
request.patientID = user.patientID;
request.patientOutSA = user.outSA;
request.loginType = await sharedPref.getInt(LAST_LOGIN) ?? 1;
request.mACAddress = '00:00:00:00:00:00';
request.latitude = lat;
request.longitude = long;
request.languageID = int.parse(user.preferredLanguage);
dynamic localRes;
try {
await new BaseAppClient().post(LOGGED_IN_USER_URL,
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;
}
}
}

@ -177,6 +177,20 @@ class TranslationBase {
String get useAnotherAccount =>
localizedValues['another-acc'][locale.languageCode];
String get next => localizedValues['next'][locale.languageCode];
String get firstName => localizedValues['first-name'][locale.languageCode];
String get middleName => localizedValues['middle-name'][locale.languageCode];
String get lastName => localizedValues['last-name'][locale.languageCode];
String get male => localizedValues['male'][locale.languageCode];
String get female => localizedValues['female'][locale.languageCode];
String get prefferedLanguage =>
localizedValues['preferred-language'][locale.languageCode];
String get english => localizedValues['english'][locale.languageCode];
String get arabic => localizedValues['arabic'][locale.languageCode];
String get registrLocation =>
localizedValues['locations-register'][locale.languageCode];
String get ksa => localizedValues['ksa'][locale.languageCode];
String get dubai => localizedValues['dubai'][locale.languageCode];
String get enterEmail => localizedValues['enter-email'][locale.languageCode];
}
class TranslationBaseDelegate extends LocalizationsDelegate<TranslationBase> {

Loading…
Cancel
Save