|
|
@ -1,9 +1,14 @@
|
|
|
|
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/config/size_config.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/models/Authentication/register_user_requet.dart';
|
|
|
|
|
|
|
|
import 'package:diplomaticquarterapp/pages/login/login-type.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/translations_delegate_base.dart';
|
|
|
|
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.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/input/text_field.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';
|
|
|
@ -22,6 +27,19 @@ class _RegisterInfo extends State<RegisterInfo> {
|
|
|
|
RegisterInfoResponse registerInfo;
|
|
|
|
RegisterInfoResponse registerInfo;
|
|
|
|
bool isLoading;
|
|
|
|
bool isLoading;
|
|
|
|
int page = 1;
|
|
|
|
int page = 1;
|
|
|
|
|
|
|
|
final List<Location> locationList = [
|
|
|
|
|
|
|
|
new Location(name: 'KSA', value: '1'),
|
|
|
|
|
|
|
|
new Location(name: 'Dubai', value: '2'),
|
|
|
|
|
|
|
|
];
|
|
|
|
|
|
|
|
var language;
|
|
|
|
|
|
|
|
var registerd_data;
|
|
|
|
|
|
|
|
final List<Language> languageList = [
|
|
|
|
|
|
|
|
new Language(name: 'English', value: '2'),
|
|
|
|
|
|
|
|
new Language(name: 'Arabic', value: '1'),
|
|
|
|
|
|
|
|
];
|
|
|
|
|
|
|
|
var email = '';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var location;
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
void initState() {
|
|
|
|
void initState() {
|
|
|
@ -55,7 +73,7 @@ class _RegisterInfo extends State<RegisterInfo> {
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
|
|
|
children: <Widget>[
|
|
|
|
children: <Widget>[
|
|
|
|
AppText('National ID'),
|
|
|
|
AppText(TranslationBase.of(context).nationalID),
|
|
|
|
Container(
|
|
|
|
Container(
|
|
|
|
margin: EdgeInsets.only(bottom: 10),
|
|
|
|
margin: EdgeInsets.only(bottom: 10),
|
|
|
|
child: TextFields(
|
|
|
|
child: TextFields(
|
|
|
@ -66,18 +84,34 @@ class _RegisterInfo extends State<RegisterInfo> {
|
|
|
|
top: 20, bottom: 20, left: 10, right: 10),
|
|
|
|
top: 20, bottom: 20, left: 10, right: 10),
|
|
|
|
readOnly: true,
|
|
|
|
readOnly: true,
|
|
|
|
)),
|
|
|
|
)),
|
|
|
|
AppText('Name'),
|
|
|
|
AppText(TranslationBase.of(context).firstName),
|
|
|
|
|
|
|
|
Container(
|
|
|
|
|
|
|
|
margin: EdgeInsets.only(bottom: 10),
|
|
|
|
|
|
|
|
child: TextFields(
|
|
|
|
|
|
|
|
hintText: 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,
|
|
|
|
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
|
|
|
|
top: 20, bottom: 20, left: 10, right: 10),
|
|
|
|
|
|
|
|
readOnly: true,
|
|
|
|
|
|
|
|
)),
|
|
|
|
|
|
|
|
AppText(TranslationBase.of(context).lastName),
|
|
|
|
Container(
|
|
|
|
Container(
|
|
|
|
margin: EdgeInsets.only(bottom: 10),
|
|
|
|
margin: EdgeInsets.only(bottom: 10),
|
|
|
|
child: TextFields(
|
|
|
|
child: TextFields(
|
|
|
|
hintText: registerInfo.firstNameEn +
|
|
|
|
hintText: registerInfo.lastNameEn,
|
|
|
|
' ' +
|
|
|
|
|
|
|
|
registerInfo.lastNameEn,
|
|
|
|
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
top: 20, bottom: 20, left: 10, right: 10),
|
|
|
|
top: 20, bottom: 20, left: 10, right: 10),
|
|
|
|
readOnly: true,
|
|
|
|
readOnly: true,
|
|
|
|
)),
|
|
|
|
)),
|
|
|
|
AppText('Gender'),
|
|
|
|
AppText(TranslationBase.of(context).gender),
|
|
|
|
Container(
|
|
|
|
Container(
|
|
|
|
margin: EdgeInsets.only(bottom: 10),
|
|
|
|
margin: EdgeInsets.only(bottom: 10),
|
|
|
|
child: TextFields(
|
|
|
|
child: TextFields(
|
|
|
@ -90,7 +124,16 @@ class _RegisterInfo extends State<RegisterInfo> {
|
|
|
|
top: 20, bottom: 20, left: 10, right: 10),
|
|
|
|
top: 20, bottom: 20, left: 10, right: 10),
|
|
|
|
readOnly: true,
|
|
|
|
readOnly: true,
|
|
|
|
)),
|
|
|
|
)),
|
|
|
|
AppText('Nationality'),
|
|
|
|
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(
|
|
|
|
Container(
|
|
|
|
margin: EdgeInsets.only(bottom: 10),
|
|
|
|
margin: EdgeInsets.only(bottom: 10),
|
|
|
|
child: TextFields(
|
|
|
|
child: TextFields(
|
|
|
@ -99,7 +142,16 @@ class _RegisterInfo extends State<RegisterInfo> {
|
|
|
|
top: 20, bottom: 20, left: 10, right: 10),
|
|
|
|
top: 20, bottom: 20, left: 10, right: 10),
|
|
|
|
readOnly: true,
|
|
|
|
readOnly: true,
|
|
|
|
)),
|
|
|
|
)),
|
|
|
|
AppText('Date of Birth'),
|
|
|
|
AppText(TranslationBase.of(context).mobileNumber),
|
|
|
|
|
|
|
|
Container(
|
|
|
|
|
|
|
|
margin: EdgeInsets.only(bottom: 10),
|
|
|
|
|
|
|
|
child: TextFields(
|
|
|
|
|
|
|
|
hintText:registerd_data.patientMobileNumber,
|
|
|
|
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
|
|
|
|
top: 20, bottom: 20, left: 10, right: 10),
|
|
|
|
|
|
|
|
readOnly: true,
|
|
|
|
|
|
|
|
)),
|
|
|
|
|
|
|
|
AppText(TranslationBase.of(context).dob),
|
|
|
|
Container(
|
|
|
|
Container(
|
|
|
|
margin: EdgeInsets.only(bottom: 10),
|
|
|
|
margin: EdgeInsets.only(bottom: 10),
|
|
|
|
child: TextFields(
|
|
|
|
child: TextFields(
|
|
|
@ -112,7 +164,73 @@ class _RegisterInfo extends State<RegisterInfo> {
|
|
|
|
)
|
|
|
|
)
|
|
|
|
: registerInfo != null && page == 2
|
|
|
|
: registerInfo != null && page == 2
|
|
|
|
? Column(
|
|
|
|
? Column(
|
|
|
|
children: <Widget>[],
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
|
|
|
AppText(TranslationBase.of(context).language,
|
|
|
|
|
|
|
|
textAlign: TextAlign.start),
|
|
|
|
|
|
|
|
Container(
|
|
|
|
|
|
|
|
padding: EdgeInsets.all(10),
|
|
|
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
|
|
|
border: Border.all(color: Colors.grey),
|
|
|
|
|
|
|
|
borderRadius: BorderRadius.circular(10)),
|
|
|
|
|
|
|
|
child: DropdownButtonHideUnderline(
|
|
|
|
|
|
|
|
child: DropdownButton(
|
|
|
|
|
|
|
|
isExpanded: true,
|
|
|
|
|
|
|
|
value: language,
|
|
|
|
|
|
|
|
iconSize: 40,
|
|
|
|
|
|
|
|
elevation: 16,
|
|
|
|
|
|
|
|
onChanged: (value) => {
|
|
|
|
|
|
|
|
setState(() {
|
|
|
|
|
|
|
|
language = value;
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
items: languageList
|
|
|
|
|
|
|
|
.map<DropdownMenuItem<String>>(
|
|
|
|
|
|
|
|
(Language value) {
|
|
|
|
|
|
|
|
return DropdownMenuItem<String>(
|
|
|
|
|
|
|
|
value: value.value,
|
|
|
|
|
|
|
|
child: Text(value.name),
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
}).toList()))),
|
|
|
|
|
|
|
|
AppText(TranslationBase.of(context).location),
|
|
|
|
|
|
|
|
Container(
|
|
|
|
|
|
|
|
padding: EdgeInsets.all(10),
|
|
|
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
|
|
|
border: Border.all(color: Colors.grey),
|
|
|
|
|
|
|
|
borderRadius: BorderRadius.circular(10)),
|
|
|
|
|
|
|
|
child: DropdownButtonHideUnderline(
|
|
|
|
|
|
|
|
child: DropdownButton(
|
|
|
|
|
|
|
|
isExpanded: true,
|
|
|
|
|
|
|
|
value: language,
|
|
|
|
|
|
|
|
iconSize: 40,
|
|
|
|
|
|
|
|
elevation: 16,
|
|
|
|
|
|
|
|
onChanged: (value) => {
|
|
|
|
|
|
|
|
setState(() {
|
|
|
|
|
|
|
|
location = value;
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
items: locationList
|
|
|
|
|
|
|
|
.map<DropdownMenuItem<String>>(
|
|
|
|
|
|
|
|
(Location value) {
|
|
|
|
|
|
|
|
return DropdownMenuItem<String>(
|
|
|
|
|
|
|
|
value: value.value,
|
|
|
|
|
|
|
|
child: Text(value.name),
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
}).toList()))),
|
|
|
|
|
|
|
|
AppText(TranslationBase.of(context).email),
|
|
|
|
|
|
|
|
Container(
|
|
|
|
|
|
|
|
margin: EdgeInsets.only(bottom: 10),
|
|
|
|
|
|
|
|
child: TextFields(
|
|
|
|
|
|
|
|
onChanged: (value) {
|
|
|
|
|
|
|
|
this.email = value;
|
|
|
|
|
|
|
|
this.isValid();
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
|
|
|
|
top: 20, bottom: 20, left: 10, right: 10),
|
|
|
|
|
|
|
|
)),
|
|
|
|
|
|
|
|
],
|
|
|
|
)
|
|
|
|
)
|
|
|
|
: SizedBox(),
|
|
|
|
: SizedBox(),
|
|
|
|
Expanded(
|
|
|
|
Expanded(
|
|
|
@ -124,9 +242,14 @@ class _RegisterInfo extends State<RegisterInfo> {
|
|
|
|
children: <Widget>[
|
|
|
|
children: <Widget>[
|
|
|
|
Expanded(
|
|
|
|
Expanded(
|
|
|
|
child: DefaultButton(
|
|
|
|
child: DefaultButton(
|
|
|
|
TranslationBase.of(context).next,
|
|
|
|
page == 1
|
|
|
|
|
|
|
|
? TranslationBase.of(context).next
|
|
|
|
|
|
|
|
: TranslationBase.of(context).register,
|
|
|
|
() => {nextPage()},
|
|
|
|
() => {nextPage()},
|
|
|
|
textColor: Colors.white,
|
|
|
|
textColor: Colors.white,
|
|
|
|
|
|
|
|
color: this.isValid() == false && page == 2
|
|
|
|
|
|
|
|
? Colors.grey
|
|
|
|
|
|
|
|
: Colors.black,
|
|
|
|
))
|
|
|
|
))
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
@ -137,21 +260,110 @@ class _RegisterInfo extends State<RegisterInfo> {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
nextPage() {
|
|
|
|
nextPage() {
|
|
|
|
|
|
|
|
if (page == 1) {
|
|
|
|
setState(() {
|
|
|
|
setState(() {
|
|
|
|
page++;
|
|
|
|
page++;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
registerNow();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
registerNow() {}
|
|
|
|
registerNow() {
|
|
|
|
|
|
|
|
dynamic request = getTempUserRequest();
|
|
|
|
|
|
|
|
request = RegisterUserRequest.fromJson(request);
|
|
|
|
|
|
|
|
this.authService.registerUser(request);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
getRegisterInfo() async {
|
|
|
|
getRegisterInfo() async {
|
|
|
|
RegisterInfoResponse registerInfo;
|
|
|
|
var data =
|
|
|
|
registerInfo =
|
|
|
|
|
|
|
|
RegisterInfoResponse.fromJson(await sharedPref.getObject(NHIC_DATA));
|
|
|
|
RegisterInfoResponse.fromJson(await sharedPref.getObject(NHIC_DATA));
|
|
|
|
|
|
|
|
if (await sharedPref.getObject(REGISTER_DATA_FOR_LOGIIN) != null) {
|
|
|
|
|
|
|
|
var data2 = CheckPatientAuthenticationReq.fromJson(
|
|
|
|
|
|
|
|
await sharedPref.getObject(REGISTER_DATA_FOR_LOGIIN));
|
|
|
|
|
|
|
|
|
|
|
|
setState(() {
|
|
|
|
setState(() {
|
|
|
|
this.registerInfo = registerInfo;
|
|
|
|
this.registerInfo = data;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.registerd_data = data2;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
getTempUserRequest() {
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
|
|
|
"Patientobject": {
|
|
|
|
|
|
|
|
"TempValue": true,
|
|
|
|
|
|
|
|
"PatientIdentificationType": 1,
|
|
|
|
|
|
|
|
"PatientIdentificationNo": registerInfo.idNumber,
|
|
|
|
|
|
|
|
"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,
|
|
|
|
|
|
|
|
"NationalityID": registerInfo.nationality,
|
|
|
|
|
|
|
|
"DateofBirthN": registerInfo.dateOfBirth,
|
|
|
|
|
|
|
|
"EmailAddress": email,
|
|
|
|
|
|
|
|
"SourceType": location,
|
|
|
|
|
|
|
|
"PreferredLanguage": registerd_data['languageID'],
|
|
|
|
|
|
|
|
"Marital": registerInfo.maritalStatusCode == 'U'
|
|
|
|
|
|
|
|
? '0'
|
|
|
|
|
|
|
|
: registerInfo.maritalStatusCode == 'M'
|
|
|
|
|
|
|
|
? '1'
|
|
|
|
|
|
|
|
: '2',
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
"PatientIdentificationID": registerInfo.idNumber,
|
|
|
|
|
|
|
|
"PatientMobileNumber": registerd_data['PatientMobileNumber'],
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
print(this.registerInfo);
|
|
|
|
// var patientObject ={};
|
|
|
|
|
|
|
|
// var request ={};
|
|
|
|
|
|
|
|
// patientObject['PatientIdentificationType'] = this.identificationType;
|
|
|
|
|
|
|
|
// patientObject['PatientIdentificationNo'] = this.id;
|
|
|
|
|
|
|
|
// request['PatientIdentificationID'] = this.id;
|
|
|
|
|
|
|
|
// request['PatientMobileNumber'] = this.registerInfo.MobileNumber;
|
|
|
|
|
|
|
|
// patientObject['MobileNumber'] = this.registerInfo.MobileNumber;
|
|
|
|
|
|
|
|
// patientObject['PatientOutSA'] = this.registerInfo.PatientOutSA;
|
|
|
|
|
|
|
|
// request['LogInTokenID'] = this.registerInfo.LogInTokenID;
|
|
|
|
|
|
|
|
// request['activationCode'] = this.registerInfo.activationCode;
|
|
|
|
|
|
|
|
// request['ProjectID'] = this.selectedProjectID;
|
|
|
|
|
|
|
|
// patientObject['ProjectID'] = this.selectedProjectID;
|
|
|
|
|
|
|
|
// request
|
|
|
|
|
|
|
|
// request.setBirthDate(this.dateOfBirth, this.cs.convertISODateToJsonDate(this.dateOfBirth));
|
|
|
|
|
|
|
|
// request.setGender(this.gender);
|
|
|
|
|
|
|
|
// request.Patientobject.NationalityID = this.selectedNationalityID;
|
|
|
|
|
|
|
|
// request.Patientobject.StrDateofBirth = this.dateOfBirth;
|
|
|
|
|
|
|
|
// request.Patientobject.DateofBirthN = this.dateHijri;
|
|
|
|
|
|
|
|
// request.Patientobject.EmailAddress = this.eMail;
|
|
|
|
|
|
|
|
// request.Patientobject.SourceType = this.iSOCountryID
|
|
|
|
|
|
|
|
// request.Patientobject.PreferredLanguage = this.preferredLanguage
|
|
|
|
|
|
|
|
// request.Patientobject.Marital = this.maritalStatus;
|
|
|
|
|
|
|
|
//return request;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool isValid() {
|
|
|
|
|
|
|
|
if (location != null ||
|
|
|
|
|
|
|
|
language != null ||
|
|
|
|
|
|
|
|
Utils.validEmail(email) == true) {
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Language {
|
|
|
|
|
|
|
|
final String name;
|
|
|
|
|
|
|
|
final String value;
|
|
|
|
|
|
|
|
Language({this.name, this.value});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Location {
|
|
|
|
|
|
|
|
final String name;
|
|
|
|
|
|
|
|
final String value;
|
|
|
|
|
|
|
|
Location({this.name, this.value});
|
|
|
|
}
|
|
|
|
}
|
|
|
|