|
|
|
@ -4,6 +4,7 @@ import 'package:diplomaticquarterapp/models/Authentication/check_paitent_authent
|
|
|
|
|
import 'package:diplomaticquarterapp/models/Authentication/register_info_response.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/models/Authentication/register_user_requet.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/date_uitl.dart';
|
|
|
|
@ -15,6 +16,8 @@ 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';
|
|
|
|
|
import 'package:hijri/hijri_calendar.dart';
|
|
|
|
|
import 'package:intl/intl.dart';
|
|
|
|
|
|
|
|
|
|
class RegisterInfo extends StatefulWidget {
|
|
|
|
|
@override
|
|
|
|
@ -31,15 +34,15 @@ class _RegisterInfo extends State<RegisterInfo> {
|
|
|
|
|
new Location(name: 'KSA', value: '1'),
|
|
|
|
|
new Location(name: 'Dubai', value: '2'),
|
|
|
|
|
];
|
|
|
|
|
var language;
|
|
|
|
|
String language = '1';
|
|
|
|
|
var registerd_data;
|
|
|
|
|
final List<Language> languageList = [
|
|
|
|
|
new Language(name: 'English', value: '2'),
|
|
|
|
|
new Language(name: 'Arabic', value: '1'),
|
|
|
|
|
];
|
|
|
|
|
var email = '';
|
|
|
|
|
String email = '';
|
|
|
|
|
|
|
|
|
|
var location;
|
|
|
|
|
String location = '1';
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
void initState() {
|
|
|
|
@ -56,18 +59,13 @@ class _RegisterInfo extends State<RegisterInfo> {
|
|
|
|
|
isShowAppBar: true,
|
|
|
|
|
isShowDecPage: false,
|
|
|
|
|
body: SingleChildScrollView(
|
|
|
|
|
child: Container(
|
|
|
|
|
padding: EdgeInsets.only(top: 10, left: 20, right: 20, bottom: 30),
|
|
|
|
|
height: SizeConfig.realScreenHeight * .9,
|
|
|
|
|
width: SizeConfig.realScreenWidth,
|
|
|
|
|
padding: EdgeInsets.all(20),
|
|
|
|
|
child: Column(children: <Widget>[
|
|
|
|
|
Expanded(
|
|
|
|
|
flex: 1,
|
|
|
|
|
child: AppText(
|
|
|
|
|
AppText(
|
|
|
|
|
TranslationBase.of(context).patientInfo,
|
|
|
|
|
fontSize: SizeConfig.textMultiplier * 3,
|
|
|
|
|
textAlign: TextAlign.left,
|
|
|
|
|
)),
|
|
|
|
|
),
|
|
|
|
|
registerInfo != null && page == 1
|
|
|
|
|
? Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
@ -146,7 +144,8 @@ class _RegisterInfo extends State<RegisterInfo> {
|
|
|
|
|
Container(
|
|
|
|
|
margin: EdgeInsets.only(bottom: 10),
|
|
|
|
|
child: TextFields(
|
|
|
|
|
hintText:registerd_data.patientMobileNumber,
|
|
|
|
|
hintText:
|
|
|
|
|
registerd_data.patientMobileNumber.toString(),
|
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
|
top: 20, bottom: 20, left: 10, right: 10),
|
|
|
|
|
readOnly: true,
|
|
|
|
@ -223,9 +222,10 @@ class _RegisterInfo extends State<RegisterInfo> {
|
|
|
|
|
Container(
|
|
|
|
|
margin: EdgeInsets.only(bottom: 10),
|
|
|
|
|
child: TextFields(
|
|
|
|
|
onChanged: (value) {
|
|
|
|
|
this.email = value;
|
|
|
|
|
this.isValid();
|
|
|
|
|
onChanged: (value) => {
|
|
|
|
|
setState(() {
|
|
|
|
|
email = value;
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
|
top: 20, bottom: 20, left: 10, right: 10),
|
|
|
|
@ -233,9 +233,7 @@ class _RegisterInfo extends State<RegisterInfo> {
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
: SizedBox(),
|
|
|
|
|
Expanded(
|
|
|
|
|
flex: 2,
|
|
|
|
|
child: Column(
|
|
|
|
|
Column(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.end,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Row(
|
|
|
|
@ -254,9 +252,9 @@ class _RegisterInfo extends State<RegisterInfo> {
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
))
|
|
|
|
|
)
|
|
|
|
|
]),
|
|
|
|
|
)));
|
|
|
|
|
));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
nextPage() {
|
|
|
|
@ -271,8 +269,17 @@ class _RegisterInfo extends State<RegisterInfo> {
|
|
|
|
|
|
|
|
|
|
registerNow() {
|
|
|
|
|
dynamic request = getTempUserRequest();
|
|
|
|
|
request = RegisterUserRequest.fromJson(request);
|
|
|
|
|
this.authService.registerUser(request);
|
|
|
|
|
|
|
|
|
|
this.authService.registerUser(request).then((result) => {
|
|
|
|
|
print(result),
|
|
|
|
|
// userData = result.list;
|
|
|
|
|
//AuthenticatedUser.fromJson(result['List'][0]),
|
|
|
|
|
sharedPref.setObject(USER_PROFILE, result.list),
|
|
|
|
|
|
|
|
|
|
sharedPref.setObject(LOGIN_TOKEN_ID, result.logInTokenID),
|
|
|
|
|
sharedPref.setString(TOKEN, result.authenticationTokenID),
|
|
|
|
|
Navigator.of(context).pushNamed(HOME)
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getRegisterInfo() async {
|
|
|
|
@ -291,25 +298,30 @@ class _RegisterInfo extends State<RegisterInfo> {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getTempUserRequest() {
|
|
|
|
|
DateFormat dateFormat = DateFormat("mm/dd/yyyy");
|
|
|
|
|
print(dateFormat.parse(registerInfo.dateOfBirth));
|
|
|
|
|
var hDate =
|
|
|
|
|
new HijriCalendar.fromDate(dateFormat.parse(registerInfo.dateOfBirth));
|
|
|
|
|
var date = hDate.toString();
|
|
|
|
|
return {
|
|
|
|
|
"Patientobject": {
|
|
|
|
|
"TempValue": true,
|
|
|
|
|
"PatientIdentificationType": 1,
|
|
|
|
|
"PatientIdentificationNo": registerInfo.idNumber,
|
|
|
|
|
"MobileNumber": registerd_data['patientMobileNumber'],
|
|
|
|
|
"PatientOutSA": registerd_data['zipCode'] == '966' ? '0' : '1',
|
|
|
|
|
"MobileNumber": registerd_data.patientMobileNumber,
|
|
|
|
|
"PatientOutSA": registerd_data.zipCode == '966' ? 0 : 1,
|
|
|
|
|
"FirstName": registerInfo.firstNameEn,
|
|
|
|
|
"MiddleName": registerInfo.secondNameEn,
|
|
|
|
|
"LastName": registerInfo.lastNameEn,
|
|
|
|
|
"StrDateofBirth": registerInfo.dateOfBirth,
|
|
|
|
|
"DateofBirth":
|
|
|
|
|
DateUtil.convertISODateToJsonDate(registerInfo.dateOfBirth),
|
|
|
|
|
"Gender": registerInfo.gender,
|
|
|
|
|
"DateofBirth": DateUtil.convertISODateToJsonDate(
|
|
|
|
|
registerInfo.dateOfBirth.replaceAll('/', '-')),
|
|
|
|
|
"Gender": registerInfo.gender == 'M' ? 1 : 2,
|
|
|
|
|
"NationalityID": registerInfo.nationality,
|
|
|
|
|
"DateofBirthN": registerInfo.dateOfBirth,
|
|
|
|
|
"DateofBirthN": date,
|
|
|
|
|
"EmailAddress": email,
|
|
|
|
|
"SourceType": location,
|
|
|
|
|
"PreferredLanguage": registerd_data['languageID'],
|
|
|
|
|
"PreferredLanguage": registerd_data.languageID.toString(),
|
|
|
|
|
"Marital": registerInfo.maritalStatusCode == 'U'
|
|
|
|
|
? '0'
|
|
|
|
|
: registerInfo.maritalStatusCode == 'M'
|
|
|
|
@ -317,7 +329,7 @@ class _RegisterInfo extends State<RegisterInfo> {
|
|
|
|
|
: '2',
|
|
|
|
|
},
|
|
|
|
|
"PatientIdentificationID": registerInfo.idNumber,
|
|
|
|
|
"PatientMobileNumber": registerd_data['PatientMobileNumber'],
|
|
|
|
|
"PatientMobileNumber": registerd_data.patientMobileNumber,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// var patientObject ={};
|
|
|
|
|