|
|
|
|
@ -67,19 +67,14 @@ class _Register extends State<Register> {
|
|
|
|
|
child: Column(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
MobileNo(
|
|
|
|
|
onNumberChange: (value) =>
|
|
|
|
|
{mobileNo = value, validateForm()},
|
|
|
|
|
onCountryChange: (value) => countryCode = value),
|
|
|
|
|
MobileNo(onNumberChange: (value) => {mobileNo = value, validateForm()}, onCountryChange: (value) => countryCode = value),
|
|
|
|
|
Container(
|
|
|
|
|
child: TextFields(
|
|
|
|
|
controller: nationalIDorFile,
|
|
|
|
|
onChanged: (value) => validateForm(),
|
|
|
|
|
keyboardType: TextInputType.number,
|
|
|
|
|
prefixIcon: Icon(Icons.chrome_reader_mode,
|
|
|
|
|
color: Color(0xFF40ACC9)),
|
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
|
top: 20, bottom: 20, left: 10, right: 10),
|
|
|
|
|
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(
|
|
|
|
|
@ -120,33 +115,25 @@ class _Register extends State<Register> {
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.end,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Container(
|
|
|
|
|
width: SizeConfig.realScreenWidth * .9,
|
|
|
|
|
height: 60,
|
|
|
|
|
child: isHijri == 1
|
|
|
|
|
? TextFields(
|
|
|
|
|
onChanged: (value) => {dob = value},
|
|
|
|
|
hintText: 'DD/MM/YYYY',
|
|
|
|
|
prefixIcon: Icon(Icons.date_range),
|
|
|
|
|
)
|
|
|
|
|
: RaisedButton.icon(
|
|
|
|
|
shape: RoundedRectangleBorder(
|
|
|
|
|
borderRadius: BorderRadius.circular(15.0),
|
|
|
|
|
),
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
onPressed: () => {
|
|
|
|
|
if (isHijri != null)
|
|
|
|
|
_selectDate(context)
|
|
|
|
|
},
|
|
|
|
|
icon: Icon(Icons.date_range),
|
|
|
|
|
label: Text(selectedDate != null
|
|
|
|
|
? "${selectedDate.toLocal()}"
|
|
|
|
|
.split(' ')[0]
|
|
|
|
|
: TranslationBase.of(context).dob)))
|
|
|
|
|
])
|
|
|
|
|
Row(mainAxisAlignment: MainAxisAlignment.end, children: <Widget>[
|
|
|
|
|
Container(
|
|
|
|
|
width: SizeConfig.realScreenWidth * .9,
|
|
|
|
|
height: 60,
|
|
|
|
|
child: isHijri == 1
|
|
|
|
|
? TextFields(
|
|
|
|
|
onChanged: (value) => {dob = value},
|
|
|
|
|
hintText: 'DD/MM/YYYY',
|
|
|
|
|
prefixIcon: Icon(Icons.date_range),
|
|
|
|
|
)
|
|
|
|
|
: RaisedButton.icon(
|
|
|
|
|
shape: RoundedRectangleBorder(
|
|
|
|
|
borderRadius: BorderRadius.circular(15.0),
|
|
|
|
|
),
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
onPressed: () => {if (isHijri != null) _selectDate(context)},
|
|
|
|
|
icon: Icon(Icons.date_range),
|
|
|
|
|
label: Text(selectedDate != null ? "${selectedDate.toLocal()}".split(' ')[0] : TranslationBase.of(context).dob)))
|
|
|
|
|
])
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
@ -165,13 +152,8 @@ class _Register extends State<Register> {
|
|
|
|
|
Row(
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Expanded(
|
|
|
|
|
child: DefaultButton(
|
|
|
|
|
TranslationBase.of(context).registerNow,
|
|
|
|
|
() => {startRegistration()},
|
|
|
|
|
textColor: Colors.white,
|
|
|
|
|
color: isButtonDisabled == true
|
|
|
|
|
? Colors.grey
|
|
|
|
|
: Colors.grey[900]))
|
|
|
|
|
child: DefaultButton(TranslationBase.of(context).registerNow, () => {startRegistration()},
|
|
|
|
|
textColor: Colors.white, color: isButtonDisabled == true ? Colors.grey : Colors.grey[900]))
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
@ -181,11 +163,7 @@ class _Register extends State<Register> {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Future<Null> _selectDate(BuildContext context) async {
|
|
|
|
|
final DateTime picked = await showDatePicker(
|
|
|
|
|
context: context,
|
|
|
|
|
initialDate: DateTime.now(),
|
|
|
|
|
firstDate: DateTime(1950, 8),
|
|
|
|
|
lastDate: DateTime.now());
|
|
|
|
|
final DateTime picked = await showDatePicker(context: context, initialDate: DateTime.now(), firstDate: DateTime(1950, 8), lastDate: DateTime.now());
|
|
|
|
|
if (picked != null && picked != selectedDate)
|
|
|
|
|
setState(() {
|
|
|
|
|
selectedDate = picked;
|
|
|
|
|
@ -193,30 +171,25 @@ class _Register extends State<Register> {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
startRegistration() {
|
|
|
|
|
final DateFormat dateFormat = DateFormat('dd/MM/yyyy');
|
|
|
|
|
if (isButtonDisabled == false) {
|
|
|
|
|
var request = CheckPatientForRegistration();
|
|
|
|
|
request.patientMobileNumber = int.parse(mobileNo);
|
|
|
|
|
request.zipCode = countryCode;
|
|
|
|
|
request.patientOutSA = countryCode == '966' ? 0 : 1;
|
|
|
|
|
// if (this.loginType == 1) {
|
|
|
|
|
|
|
|
|
|
request.patientIdentificationID = int.parse(nationalIDorFile.text);
|
|
|
|
|
request.patientID = 0;
|
|
|
|
|
request.isRegister = true;
|
|
|
|
|
// } else {
|
|
|
|
|
// request.patientIdentificationID = 0;
|
|
|
|
|
// request.patientID = int.parse(nationalIDorFile.text);
|
|
|
|
|
// }
|
|
|
|
|
request.dob = isHijri == 1 ? dob : dateFormat.format(selectedDate);
|
|
|
|
|
request.isHijri = isHijri;
|
|
|
|
|
this.checkPatientForRegisteration(request);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
checkPatientForRegisteration(request) {
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
this
|
|
|
|
|
.authService
|
|
|
|
|
.checkPatientForRegisteration(request)
|
|
|
|
|
.then((response) => {checkUserStatus(response, request)})
|
|
|
|
|
.catchError((err) {
|
|
|
|
|
this.authService.checkPatientForRegisteration(request).then((response) => {checkUserStatus(response, request)}).catchError((err) {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
ConfirmDialog dialog = new ConfirmDialog(
|
|
|
|
|
context: context,
|
|
|
|
|
@ -233,10 +206,7 @@ class _Register extends State<Register> {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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) {
|
|
|
|
|
setState(() {
|
|
|
|
|
isButtonDisabled = false;
|
|
|
|
|
});
|
|
|
|
|
@ -265,8 +235,7 @@ class _Register extends State<Register> {
|
|
|
|
|
} else {
|
|
|
|
|
nRequest['forRegister'] = true;
|
|
|
|
|
nRequest['isRegister'] = true;
|
|
|
|
|
nRequest["PatientIdentificationID"] =
|
|
|
|
|
nRequest["PatientIdentificationID"].toString();
|
|
|
|
|
nRequest["PatientIdentificationID"] = nRequest["PatientIdentificationID"].toString();
|
|
|
|
|
sharedPref.setObject(REGISTER_DATA_FOR_LOGIIN, nRequest);
|
|
|
|
|
sharedPref.setString(LOGIN_TOKEN_ID, response['LogInTokenID']);
|
|
|
|
|
this.chekUserData(response['LogInTokenID']);
|
|
|
|
|
@ -312,12 +281,7 @@ class _Register extends State<Register> {
|
|
|
|
|
Navigator.of(context).push(FadePage(page: ConfirmLogin())),
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
AppToast.showErrorToast(
|
|
|
|
|
message: result
|
|
|
|
|
? result
|
|
|
|
|
: TranslationBase.of(context).somethingWentWrong)
|
|
|
|
|
}
|
|
|
|
|
{AppToast.showErrorToast(message: result ? result : TranslationBase.of(context).somethingWentWrong)}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|