finish activation process until step 2
parent
f1f3b6bd56
commit
7840ec4c3b
File diff suppressed because it is too large
Load Diff
@ -1,28 +1,57 @@
|
|||||||
import 'package:diplomaticquarterapp/config/config.dart';
|
import 'package:diplomaticquarterapp/config/config.dart';
|
||||||
import 'package:diplomaticquarterapp/core/model/hospitals/hospitals_model.dart';
|
|
||||||
import 'package:diplomaticquarterapp/core/model/hospitals/request_get_hospitals_model.dart';
|
|
||||||
import 'package:diplomaticquarterapp/core/service/base_service.dart';
|
import 'package:diplomaticquarterapp/core/service/base_service.dart';
|
||||||
import 'package:diplomaticquarterapp/models/AlHabibMedicalServices/EReferral/get_all_relationship_types_request_model.dart';
|
import 'package:diplomaticquarterapp/models/AlHabibMedicalServices/EReferral/check_activation_code_for_e_referral_request_model.dart';
|
||||||
import 'package:diplomaticquarterapp/models/AlHabibMedicalServices/EReferral/get_all_relationship_types_response_model.dart';
|
import 'package:diplomaticquarterapp/models/AlHabibMedicalServices/EReferral/get_all_relationship_types_response_model.dart';
|
||||||
import 'package:geolocator/geolocator.dart';
|
import 'package:diplomaticquarterapp/models/AlHabibMedicalServices/EReferral/send_activation_code_for_e_referral_request_model.dart';
|
||||||
|
|
||||||
class EReferralService extends BaseService {
|
class EReferralService extends BaseService {
|
||||||
List<GetAllRelationshipTypeResponseModel> _relationTypes = List();
|
List<GetAllRelationshipTypeResponseModel> _relationTypes = List();
|
||||||
|
|
||||||
List<GetAllRelationshipTypeResponseModel> get relationTypes => _relationTypes;
|
List<GetAllRelationshipTypeResponseModel> get relationTypes => _relationTypes;
|
||||||
|
|
||||||
|
String _activationCode;
|
||||||
|
|
||||||
|
String get activationCode => _activationCode;
|
||||||
|
|
||||||
|
bool _isActivationCodeValid = false;
|
||||||
|
|
||||||
|
bool get isActivationCodeValid => _isActivationCodeValid;
|
||||||
|
|
||||||
Future getRelationTypes() async {
|
Future getRelationTypes() async {
|
||||||
await baseAppClient.post(GET_ALL_RELATIONSHIP_TYPES,
|
await baseAppClient.post(GET_ALL_RELATIONSHIP_TYPES,
|
||||||
onSuccess: (dynamic response, int statusCode) {
|
onSuccess: (dynamic response, int statusCode) {
|
||||||
_relationTypes.clear();
|
_relationTypes.clear();
|
||||||
response['List_EReferralResult'].forEach((relation) {
|
response['List_EReferralResult'].forEach((relation) {
|
||||||
_relationTypes.add(GetAllRelationshipTypeResponseModel.fromJson(relation));
|
_relationTypes
|
||||||
});
|
.add(GetAllRelationshipTypeResponseModel.fromJson(relation));
|
||||||
}, onFailure: (String error, int statusCode) {
|
});
|
||||||
hasError = true;
|
}, onFailure: (String error, int statusCode) {
|
||||||
super.error = error;
|
hasError = true;
|
||||||
}, body: {});
|
super.error = error;
|
||||||
|
}, body: {});
|
||||||
|
}
|
||||||
|
|
||||||
|
Future sendActivationCodeForEReferral(
|
||||||
|
SendActivationCodeForEReferralRequestModel
|
||||||
|
sendActivationCodeForEReferralRequestModel) async {
|
||||||
|
await baseAppClient.post(SEND_ACTIVATION_CODE_FOR_E_REFERRAL,
|
||||||
|
onSuccess: (dynamic response, int statusCode) {
|
||||||
|
_activationCode = response["VerificationCode"];
|
||||||
|
}, onFailure: (String error, int statusCode) {
|
||||||
|
hasError = true;
|
||||||
|
super.error = error;
|
||||||
|
}, body: sendActivationCodeForEReferralRequestModel.toJson());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future checkActivationCodeForEReferral(
|
||||||
|
CheckActivationCodeForEReferralResponseModel
|
||||||
|
checkActivationCodeForEReferralRequestModel) async {
|
||||||
|
await baseAppClient.post(CHECK_ACTIVATION_CODE_FOR_E_REFERRAL,
|
||||||
|
onSuccess: (dynamic response, int statusCode) {
|
||||||
|
_isActivationCodeValid = true;
|
||||||
|
}, onFailure: (String error, int statusCode) {
|
||||||
|
hasError = true;
|
||||||
|
super.error = error;
|
||||||
|
}, body: checkActivationCodeForEReferralRequestModel.toJson());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,57 @@
|
|||||||
|
class CheckActivationCodeForEReferralResponseModel {
|
||||||
|
String logInTokenID;
|
||||||
|
String activationCode;
|
||||||
|
double versionID;
|
||||||
|
int channel;
|
||||||
|
int languageID;
|
||||||
|
String iPAdress;
|
||||||
|
String generalid;
|
||||||
|
int patientOutSA;
|
||||||
|
Null sessionID;
|
||||||
|
bool isDentalAllowedBackend;
|
||||||
|
int deviceTypeID;
|
||||||
|
|
||||||
|
CheckActivationCodeForEReferralResponseModel(
|
||||||
|
{this.logInTokenID,
|
||||||
|
this.activationCode,
|
||||||
|
this.versionID,
|
||||||
|
this.channel,
|
||||||
|
this.languageID,
|
||||||
|
this.iPAdress,
|
||||||
|
this.generalid,
|
||||||
|
this.patientOutSA,
|
||||||
|
this.sessionID,
|
||||||
|
this.isDentalAllowedBackend,
|
||||||
|
this.deviceTypeID});
|
||||||
|
|
||||||
|
CheckActivationCodeForEReferralResponseModel.fromJson(
|
||||||
|
Map<String, dynamic> json) {
|
||||||
|
logInTokenID = json['LogInTokenID'];
|
||||||
|
activationCode = json['activationCode'];
|
||||||
|
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'];
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||||
|
data['LogInTokenID'] = this.logInTokenID;
|
||||||
|
data['activationCode'] = this.activationCode;
|
||||||
|
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;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,57 @@
|
|||||||
|
class SendActivationCodeForEReferralRequestModel {
|
||||||
|
int patientMobileNumber;
|
||||||
|
String zipCode;
|
||||||
|
double versionID;
|
||||||
|
int channel;
|
||||||
|
int languageID;
|
||||||
|
String iPAdress;
|
||||||
|
String generalid;
|
||||||
|
int patientOutSA;
|
||||||
|
Null sessionID;
|
||||||
|
bool isDentalAllowedBackend;
|
||||||
|
int deviceTypeID;
|
||||||
|
|
||||||
|
SendActivationCodeForEReferralRequestModel(
|
||||||
|
{this.patientMobileNumber,
|
||||||
|
this.zipCode,
|
||||||
|
this.versionID,
|
||||||
|
this.channel,
|
||||||
|
this.languageID,
|
||||||
|
this.iPAdress,
|
||||||
|
this.generalid,
|
||||||
|
this.patientOutSA,
|
||||||
|
this.sessionID,
|
||||||
|
this.isDentalAllowedBackend,
|
||||||
|
this.deviceTypeID});
|
||||||
|
|
||||||
|
SendActivationCodeForEReferralRequestModel.fromJson(
|
||||||
|
Map<String, dynamic> json) {
|
||||||
|
patientMobileNumber = json['PatientMobileNumber'];
|
||||||
|
zipCode = json['ZipCode'];
|
||||||
|
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'];
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||||
|
data['PatientMobileNumber'] = this.patientMobileNumber;
|
||||||
|
data['ZipCode'] = this.zipCode;
|
||||||
|
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;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,385 @@
|
|||||||
|
import 'dart:async';
|
||||||
|
|
||||||
|
import 'package:diplomaticquarterapp/config/config.dart';
|
||||||
|
import 'package:diplomaticquarterapp/config/size_config.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/model/my_balance/AdvanceModel.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/model/my_balance/patient_info_and_mobile_number.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/viewModels/all_habib_medical_services/e_referral_view_model.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/viewModels/medical/my_balance_view_model.dart';
|
||||||
|
import 'package:diplomaticquarterapp/models/AlHabibMedicalServices/EReferral/check_activation_code_for_e_referral_request_model.dart';
|
||||||
|
import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/E-Referral/new_e_referral_step_two_page.dart';
|
||||||
|
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
|
||||||
|
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
||||||
|
import 'package:diplomaticquarterapp/uitl/utils.dart';
|
||||||
|
import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart';
|
||||||
|
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
|
||||||
|
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:smart_progress_bar/smart_progress_bar.dart';
|
||||||
|
|
||||||
|
class EReferralConfirmSMSDialog extends StatefulWidget {
|
||||||
|
final String phoneNumber;
|
||||||
|
// final AdvanceModel advanceModel;
|
||||||
|
// final PatientInfoAndMobileNumber patientInfoAndMobileNumber;
|
||||||
|
// final String selectedPaymentMethod;
|
||||||
|
|
||||||
|
const EReferralConfirmSMSDialog(
|
||||||
|
{Key key,
|
||||||
|
this.phoneNumber,
|
||||||
|
// this.advanceModel,
|
||||||
|
// this.selectedPaymentMethod,
|
||||||
|
// this.patientInfoAndMobileNumber
|
||||||
|
})
|
||||||
|
: super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
_EReferralConfirmSMSDialogState createState() => _EReferralConfirmSMSDialogState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _EReferralConfirmSMSDialogState extends State<EReferralConfirmSMSDialog> {
|
||||||
|
final verifyAccountForm = GlobalKey<FormState>();
|
||||||
|
Map verifyAccountFormValue = {
|
||||||
|
'digit1': null,
|
||||||
|
'digit2': null,
|
||||||
|
'digit3': null,
|
||||||
|
'digit4': null,
|
||||||
|
};
|
||||||
|
|
||||||
|
TextEditingController digit1 = TextEditingController(text: "");
|
||||||
|
TextEditingController digit2 = TextEditingController(text: "");
|
||||||
|
TextEditingController digit3 = TextEditingController(text: "");
|
||||||
|
TextEditingController digit4 = TextEditingController(text: "");
|
||||||
|
|
||||||
|
String timerText = (TIMER_MIN - 1).toString() + ':59';
|
||||||
|
int min = TIMER_MIN - 1;
|
||||||
|
int sec = 59;
|
||||||
|
Timer _timer;
|
||||||
|
|
||||||
|
resendCode() {
|
||||||
|
min = TIMER_MIN - 1;
|
||||||
|
sec = 59;
|
||||||
|
_timer = Timer.periodic(Duration(seconds: 1), (Timer timer) {
|
||||||
|
if (min <= 0 && sec <= 0) {
|
||||||
|
timer.cancel();
|
||||||
|
} else {
|
||||||
|
setState(() {
|
||||||
|
sec = sec - 1;
|
||||||
|
if (sec == 0 && min == 0) {
|
||||||
|
Navigator.pop(context);
|
||||||
|
min = 0;
|
||||||
|
sec = 0;
|
||||||
|
} else if (sec == 0) {
|
||||||
|
min = min - 1;
|
||||||
|
sec = 59;
|
||||||
|
}
|
||||||
|
timerText = min.toString() + ':' + sec.toString();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
FocusNode focusD1;
|
||||||
|
FocusNode focusD2;
|
||||||
|
FocusNode focusD3;
|
||||||
|
FocusNode focusD4;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
resendCode();
|
||||||
|
focusD1 = FocusNode();
|
||||||
|
focusD2 = FocusNode();
|
||||||
|
focusD3 = FocusNode();
|
||||||
|
focusD4 = FocusNode();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
_timer.cancel();
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return BaseView<EReferralViewModel>(
|
||||||
|
builder: (_, model, w) => Dialog(
|
||||||
|
elevation: 0.6,
|
||||||
|
child: Container(
|
||||||
|
height: 520,
|
||||||
|
child: ListView(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
width: double.infinity,
|
||||||
|
height: 40,
|
||||||
|
color: Colors.grey[700],
|
||||||
|
child: Row(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
flex: 4,
|
||||||
|
child: Center(
|
||||||
|
child: Texts(
|
||||||
|
'SMS',
|
||||||
|
color: Colors.white,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
))),
|
||||||
|
Expanded(
|
||||||
|
flex: 1,
|
||||||
|
child: InkWell(
|
||||||
|
onTap: () => Navigator.pop(context),
|
||||||
|
child: Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
shape: BoxShape.circle, color: Colors.white),
|
||||||
|
child: Icon(
|
||||||
|
Icons.clear,
|
||||||
|
color: Colors.grey[900],
|
||||||
|
)),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Image.asset(
|
||||||
|
'assets/images/login/103.png',
|
||||||
|
height: MediaQuery.of(context).size.width * 0.25,
|
||||||
|
width: MediaQuery.of(context).size.width * 0.25,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 12,
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: Texts(
|
||||||
|
TranslationBase.of(context).pleaseEnterTheVerificationCode +
|
||||||
|
'[${widget.phoneNumber}]',
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 12,
|
||||||
|
),
|
||||||
|
Form(
|
||||||
|
key: verifyAccountForm,
|
||||||
|
child: Container(
|
||||||
|
width: SizeConfig.realScreenWidth * 0.90,
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: <Widget>[
|
||||||
|
SizedBox(
|
||||||
|
height: 30,
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||||
|
children: <Widget>[
|
||||||
|
Container(
|
||||||
|
width: 65,
|
||||||
|
child: TextFormField(
|
||||||
|
textInputAction: TextInputAction.next,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: SizeConfig.textMultiplier * 3,
|
||||||
|
),
|
||||||
|
focusNode: focusD1,
|
||||||
|
maxLength: 1,
|
||||||
|
controller: digit1,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
keyboardType: TextInputType.number,
|
||||||
|
decoration: buildInputDecoration(context),
|
||||||
|
onSaved: (val) {
|
||||||
|
verifyAccountFormValue['digit1'] = val;
|
||||||
|
},
|
||||||
|
validator: validateCodeDigit,
|
||||||
|
onFieldSubmitted: (_) {
|
||||||
|
FocusScope.of(context).requestFocus(focusD2);
|
||||||
|
},
|
||||||
|
onChanged: (val) {
|
||||||
|
if (val.length == 1) {
|
||||||
|
FocusScope.of(context).requestFocus(focusD2);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
width: 65,
|
||||||
|
child: TextFormField(
|
||||||
|
focusNode: focusD2,
|
||||||
|
controller: digit2,
|
||||||
|
textInputAction: TextInputAction.next,
|
||||||
|
maxLength: 1,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: SizeConfig.textMultiplier * 3,
|
||||||
|
),
|
||||||
|
keyboardType: TextInputType.number,
|
||||||
|
decoration: buildInputDecoration(context),
|
||||||
|
validator: validateCodeDigit,
|
||||||
|
onSaved: (val) {
|
||||||
|
verifyAccountFormValue['digit2'] = val;
|
||||||
|
},
|
||||||
|
onFieldSubmitted: (_) {
|
||||||
|
FocusScope.of(context).requestFocus(focusD3);
|
||||||
|
},
|
||||||
|
onChanged: (val) {
|
||||||
|
if (val.length == 1) {
|
||||||
|
FocusScope.of(context).requestFocus(focusD3);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
width: 65,
|
||||||
|
child: TextFormField(
|
||||||
|
focusNode: focusD3,
|
||||||
|
controller: digit3,
|
||||||
|
textInputAction: TextInputAction.next,
|
||||||
|
maxLength: 1,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: SizeConfig.textMultiplier * 3,
|
||||||
|
),
|
||||||
|
keyboardType: TextInputType.number,
|
||||||
|
decoration: buildInputDecoration(context),
|
||||||
|
validator: validateCodeDigit,
|
||||||
|
onSaved: (val) {
|
||||||
|
verifyAccountFormValue['digit3'] = val;
|
||||||
|
},
|
||||||
|
onFieldSubmitted: (_) {
|
||||||
|
FocusScope.of(context).requestFocus(focusD4);
|
||||||
|
},
|
||||||
|
onChanged: (val) {
|
||||||
|
if (val.length == 1) {
|
||||||
|
FocusScope.of(context)
|
||||||
|
.requestFocus(focusD4);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
)),
|
||||||
|
Container(
|
||||||
|
width: 65,
|
||||||
|
child: TextFormField(
|
||||||
|
focusNode: focusD4,
|
||||||
|
controller: digit4,
|
||||||
|
maxLength: 1,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: SizeConfig.textMultiplier * 3,
|
||||||
|
),
|
||||||
|
keyboardType: TextInputType.number,
|
||||||
|
decoration: buildInputDecoration(context),
|
||||||
|
validator: validateCodeDigit,
|
||||||
|
onSaved: (val) {
|
||||||
|
verifyAccountFormValue['digit4'] = val;
|
||||||
|
},
|
||||||
|
onFieldSubmitted: (_) {
|
||||||
|
FocusScope.of(context).requestFocus(focusD4);
|
||||||
|
submit(model);
|
||||||
|
},
|
||||||
|
onChanged: (val) {
|
||||||
|
if (val.length == 1) {
|
||||||
|
FocusScope.of(context)
|
||||||
|
.requestFocus(focusD4);
|
||||||
|
submit(model);
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 8,
|
||||||
|
),
|
||||||
|
if (model.state == ViewState.ErrorLocal ||
|
||||||
|
model.state == ViewState.Error)
|
||||||
|
Container(
|
||||||
|
margin: EdgeInsets.only(left: 8, right: 8),
|
||||||
|
width: double.maxFinite,
|
||||||
|
child: Texts(
|
||||||
|
model.error,
|
||||||
|
color: Colors.red,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(height: 20),
|
||||||
|
// buildText(),
|
||||||
|
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: Texts(
|
||||||
|
TranslationBase.of(context)
|
||||||
|
.theVerificationCodeExpiresIn +
|
||||||
|
' $timerText',
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(height: 20),
|
||||||
|
|
||||||
|
Container(
|
||||||
|
width: double.maxFinite,
|
||||||
|
padding: EdgeInsets.all(12),
|
||||||
|
child: SecondaryButton(
|
||||||
|
textColor: Colors.white,
|
||||||
|
label:
|
||||||
|
TranslationBase.of(context).submit.toUpperCase(),
|
||||||
|
onTap: () {
|
||||||
|
submit(model);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void submit(EReferralViewModel model) async {
|
||||||
|
if (verifyAccountForm.currentState.validate()) {
|
||||||
|
final activationCode =
|
||||||
|
digit1.text + digit2.text + digit3.text + digit4.text;
|
||||||
|
|
||||||
|
|
||||||
|
// ToDo call service
|
||||||
|
CheckActivationCodeForEReferralResponseModel checkActivationCodeForEReferralRequestModel= new CheckActivationCodeForEReferralResponseModel();
|
||||||
|
await model.checkActivationCodeForEReferral(checkActivationCodeForEReferralRequestModel);
|
||||||
|
if(model.state == ViewState.ErrorLocal) {
|
||||||
|
Utils.showErrorToast(model.error);
|
||||||
|
} else {
|
||||||
|
|
||||||
|
Navigator.push(context, FadePage(page: NewEReferralStepTowPage()));
|
||||||
|
// Navigate to new page
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String validateCodeDigit(value) {
|
||||||
|
if (value.isEmpty) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
InputDecoration buildInputDecoration(BuildContext context) {
|
||||||
|
return InputDecoration(
|
||||||
|
// ts/images/password_icon.png
|
||||||
|
contentPadding: EdgeInsets.only(top: 20, bottom: 20),
|
||||||
|
enabledBorder: OutlineInputBorder(
|
||||||
|
borderRadius: BorderRadius.all(Radius.circular(5)),
|
||||||
|
borderSide: BorderSide(color: Colors.black),
|
||||||
|
),
|
||||||
|
focusedBorder: OutlineInputBorder(
|
||||||
|
borderRadius: BorderRadius.all(Radius.circular(5.0)),
|
||||||
|
borderSide: BorderSide(color: Theme.of(context).primaryColor),
|
||||||
|
),
|
||||||
|
errorBorder: OutlineInputBorder(
|
||||||
|
borderRadius: BorderRadius.all(Radius.circular(5.0)),
|
||||||
|
borderSide: BorderSide(color: Theme.of(context).errorColor),
|
||||||
|
),
|
||||||
|
focusedErrorBorder: OutlineInputBorder(
|
||||||
|
borderRadius: BorderRadius.all(Radius.circular(5.0)),
|
||||||
|
borderSide: BorderSide(color: Theme.of(context).errorColor),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,307 @@
|
|||||||
|
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/model/my_balance/AdvanceModel.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/viewModels/all_habib_medical_services/e_referral_view_model.dart';
|
||||||
|
import 'package:diplomaticquarterapp/models/AlHabibMedicalServices/EReferral/get_all_relationship_types_response_model.dart';
|
||||||
|
import 'package:diplomaticquarterapp/models/AlHabibMedicalServices/EReferral/send_activation_code_for_e_referral_request_model.dart';
|
||||||
|
import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart';
|
||||||
|
import 'package:diplomaticquarterapp/models/FamilyFiles/GetAllSharedRecordByStatusResponse.dart';
|
||||||
|
import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/E-Referral/e_referral_confirm_sms_dialog.dart';
|
||||||
|
import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/E-Referral/select_country_ingo_Dialog.dart';
|
||||||
|
import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/E-Referral/select_relation_type_Dialog.dart';
|
||||||
|
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
|
||||||
|
import 'package:diplomaticquarterapp/pages/medical/balance/new_text_Field.dart';
|
||||||
|
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
|
||||||
|
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
||||||
|
import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart';
|
||||||
|
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
|
||||||
|
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
enum BeneficiaryType { MyAccount, MyFamilyFiles, OtherAccount, NON }
|
||||||
|
|
||||||
|
class NewEReferralStepTowPage extends StatefulWidget {
|
||||||
|
final EReferralViewModel eReferralViewModel;
|
||||||
|
|
||||||
|
const NewEReferralStepTowPage({Key key, this.eReferralViewModel}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
_NewEReferralStepTowPageState createState() => _NewEReferralStepTowPageState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _NewEReferralStepTowPageState extends State<NewEReferralStepTowPage> {
|
||||||
|
TextEditingController _nameTextController = TextEditingController();
|
||||||
|
TextEditingController _mobileTextController = TextEditingController();
|
||||||
|
BeneficiaryType beneficiaryType = BeneficiaryType.NON;
|
||||||
|
GetAllRelationshipTypeResponseModel _selectedRelation;
|
||||||
|
String email;
|
||||||
|
AuthenticatedUser authenticatedUser;
|
||||||
|
GetAllSharedRecordsByStatusList selectedPatientFamily;
|
||||||
|
AdvanceModel advanceModel = AdvanceModel();
|
||||||
|
|
||||||
|
// todo create a model for Country
|
||||||
|
// todo use country from the json
|
||||||
|
dynamic _selectedCountry = {
|
||||||
|
"name": "Saudi Arabia",
|
||||||
|
"name_ar": "المملكة العربية السعودية",
|
||||||
|
"code": "+966",
|
||||||
|
"countryCode": "SA",
|
||||||
|
"pattern": "5xxxxxxxx",
|
||||||
|
"maxLength": 9
|
||||||
|
};
|
||||||
|
AppSharedPreferences sharedPref = AppSharedPreferences();
|
||||||
|
AuthenticatedUser authUser;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
void showSMSDialog() {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
barrierDismissible: false,
|
||||||
|
child: EReferralConfirmSMSDialog(
|
||||||
|
phoneNumber: _selectedCountry['code']+_mobileTextController.text,
|
||||||
|
),
|
||||||
|
).then((value) {
|
||||||
|
print("dialog dismissed");
|
||||||
|
print(value);
|
||||||
|
if (value != null && value) {
|
||||||
|
// AppoitmentAllHistoryResultList appo =
|
||||||
|
// new AppoitmentAllHistoryResultList();
|
||||||
|
// appo.projectID = patientInfoAndMobileNumber.projectID;
|
||||||
|
// openPayment(selectedPaymentMethod, authenticatedUser,
|
||||||
|
// double.parse(advanceModel.amount), appo);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return BaseView<EReferralViewModel>(
|
||||||
|
onModelReady: (model) => model.getRelationTypes(),
|
||||||
|
builder: (_, model, widget) => AppScaffold(
|
||||||
|
isShowAppBar: false,
|
||||||
|
body: SingleChildScrollView(
|
||||||
|
physics: ScrollPhysics(),
|
||||||
|
child: Container(
|
||||||
|
margin: EdgeInsets.all(12),
|
||||||
|
child: Center(
|
||||||
|
child: FractionallySizedBox(
|
||||||
|
widthFactor: 0.94,
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
SizedBox(
|
||||||
|
height: 75,
|
||||||
|
),
|
||||||
|
Center(
|
||||||
|
child: Texts(
|
||||||
|
// TranslationBase.of(context).advancePaymentLabel,
|
||||||
|
"Steeeepppppppppp 2",
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 12,
|
||||||
|
),
|
||||||
|
NewTextFields(
|
||||||
|
hintText: "Enter Referral Requester Name*",
|
||||||
|
controller: _nameTextController,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 12,
|
||||||
|
),
|
||||||
|
InkWell(
|
||||||
|
onTap: () => confirmSelectCountryTypeDialog(),
|
||||||
|
child: Container(
|
||||||
|
padding: EdgeInsets.all(12),
|
||||||
|
width: double.infinity,
|
||||||
|
height: 65,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
borderRadius: BorderRadius.circular(12),
|
||||||
|
color: Colors.white),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Texts(getCountryName()),
|
||||||
|
Icon(Icons.arrow_drop_down)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 12,
|
||||||
|
),
|
||||||
|
MobileNumberTextFiled(
|
||||||
|
controller: _mobileTextController,
|
||||||
|
code: _selectedCountry == null
|
||||||
|
? "11"
|
||||||
|
: _selectedCountry["code"],
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 12,
|
||||||
|
),
|
||||||
|
Center(
|
||||||
|
child: Texts(
|
||||||
|
// TranslationBase.of(context).advancePaymentLabel,
|
||||||
|
"Requester Relationship",
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 12,
|
||||||
|
),
|
||||||
|
InkWell(
|
||||||
|
onTap: () => confirmSelectRelationTypeDialog(
|
||||||
|
model.relationTypes),
|
||||||
|
child: Container(
|
||||||
|
padding: EdgeInsets.all(12),
|
||||||
|
width: double.infinity,
|
||||||
|
height: 65,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
borderRadius: BorderRadius.circular(12),
|
||||||
|
color: Colors.white),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Texts(getRelationName()),
|
||||||
|
Icon(Icons.arrow_drop_down)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 12,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 12,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
bottomSheet: Container(
|
||||||
|
height: MediaQuery
|
||||||
|
.of(context)
|
||||||
|
.size
|
||||||
|
.height * 0.1,
|
||||||
|
width: double.infinity,
|
||||||
|
padding: EdgeInsets.all(9),
|
||||||
|
child: SecondaryButton(
|
||||||
|
textColor: Colors.white,
|
||||||
|
label: "Next",
|
||||||
|
onTap: () async {
|
||||||
|
SendActivationCodeForEReferralRequestModel sendActivationCodeForEReferralRequestModel =
|
||||||
|
SendActivationCodeForEReferralRequestModel(
|
||||||
|
zipCode: _selectedCountry['code'],
|
||||||
|
patientMobileNumber: int.parse(
|
||||||
|
_mobileTextController.text),);
|
||||||
|
await model.sendActivationCodeForEReferral(sendActivationCodeForEReferralRequestModel);
|
||||||
|
|
||||||
|
showSMSDialog();
|
||||||
|
},
|
||||||
|
loading: model.state == ViewState.BusyLocal,
|
||||||
|
disabled:
|
||||||
|
_nameTextController.text.isEmpty ||
|
||||||
|
_selectedRelation == null ||
|
||||||
|
_mobileTextController.text.isEmpty,
|
||||||
|
),
|
||||||
|
)));
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void confirmSelectRelationTypeDialog(
|
||||||
|
List<GetAllRelationshipTypeResponseModel> relations) {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
child: SelectRelationTypeDialog(
|
||||||
|
relationTypes: relations,
|
||||||
|
selectedRelation: _selectedRelation,
|
||||||
|
onValueSelected: (value) {
|
||||||
|
setState(() {
|
||||||
|
_selectedRelation = value;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void confirmSelectCountryTypeDialog() {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
child: SelectCountryDialog(
|
||||||
|
selectedCountry: _selectedCountry,
|
||||||
|
onValueSelected: (value) {
|
||||||
|
setState(() {
|
||||||
|
_selectedCountry = value;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
String getRelationName() {
|
||||||
|
if (_selectedRelation != null)
|
||||||
|
return _selectedRelation.text;
|
||||||
|
else
|
||||||
|
return "Select Relationship" /*TranslationBase.of(context).selectHospital*/;
|
||||||
|
}
|
||||||
|
|
||||||
|
String getCountryName() {
|
||||||
|
if (_selectedCountry != null)
|
||||||
|
return _selectedCountry["name"];
|
||||||
|
else
|
||||||
|
return "Country";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class MobileNumberTextFiled extends StatelessWidget {
|
||||||
|
const MobileNumberTextFiled({
|
||||||
|
Key key,
|
||||||
|
this.controller,
|
||||||
|
this.code
|
||||||
|
}) : super(key: key);
|
||||||
|
|
||||||
|
|
||||||
|
final TextEditingController controller;
|
||||||
|
final String code;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Container(
|
||||||
|
padding: EdgeInsets.all(5),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
borderRadius: BorderRadius.circular(15), color: Colors.white),
|
||||||
|
child: Row(children: <Widget>[
|
||||||
|
Expanded(
|
||||||
|
flex: 1,
|
||||||
|
child: Icon(
|
||||||
|
Icons.phone,
|
||||||
|
color: Colors.red,
|
||||||
|
)),
|
||||||
|
Expanded(
|
||||||
|
flex: 1,
|
||||||
|
child: Text(
|
||||||
|
code.toString(),
|
||||||
|
overflow: TextOverflow.clip,
|
||||||
|
)),
|
||||||
|
Expanded(
|
||||||
|
flex: 4,
|
||||||
|
child: Container(
|
||||||
|
margin: EdgeInsets.all(5),
|
||||||
|
child: TextField(
|
||||||
|
controller: controller,
|
||||||
|
keyboardType: TextInputType.phone,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
border: InputBorder.none, hintText: '5xxxxxxxx'),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
]),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue