|
|
|
|
@ -7,8 +7,10 @@ import 'package:diplomaticquarterapp/core/model/blooddonation/get_all_cities.dar
|
|
|
|
|
import 'package:diplomaticquarterapp/core/model/my_balance/AdvanceModel.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/core/model/my_balance/patient_info.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/core/service/blood/blood_details_servies.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/core/service/blood/blood_donation_service.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/core/viewModels/blooddonation/blood_details_view_model.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/core/viewModels/medical/my_balance_view_model.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/locator.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/models/FamilyFiles/GetAllSharedRecordByStatusResponse.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/pages/Blood/user_agreement_page.dart';
|
|
|
|
|
@ -18,10 +20,12 @@ import 'package:diplomaticquarterapp/pages/medical/balance/dialogs/SelectCiteisD
|
|
|
|
|
import 'package:diplomaticquarterapp/pages/medical/balance/dialogs/SelectHospitalDialog.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.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/dialogs/confirm_dialog.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
|
|
|
|
|
@ -55,8 +59,7 @@ class _BloodDonationPageState extends State<BloodDonationPage> {
|
|
|
|
|
Gender gender = Gender.Male;//Gender.NON;
|
|
|
|
|
Blood blood = Blood.Aminus;//Blood.NON;
|
|
|
|
|
//HospitalsModel _selectedHospital;
|
|
|
|
|
CitiesModel _selectedHospital;
|
|
|
|
|
|
|
|
|
|
var _selectedHospital = new CitiesModel();
|
|
|
|
|
String amount = "";
|
|
|
|
|
String email;
|
|
|
|
|
PatientInfo _selectedPatientInfo;
|
|
|
|
|
@ -65,12 +68,14 @@ class _BloodDonationPageState extends State<BloodDonationPage> {
|
|
|
|
|
AdvanceModel advanceModel = AdvanceModel();
|
|
|
|
|
List_BloodGroupDetailsModel bloodDetails=List_BloodGroupDetailsModel();
|
|
|
|
|
AppSharedPreferences sharedPref = AppSharedPreferences();
|
|
|
|
|
BloodDonationService _bloodDonationService = locator<BloodDonationService>();
|
|
|
|
|
AuthenticatedUser authUser;
|
|
|
|
|
var checkedValue = false;
|
|
|
|
|
@override
|
|
|
|
|
void initState() {
|
|
|
|
|
super.initState();
|
|
|
|
|
getAuthUser();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
@ -134,37 +139,7 @@ class _BloodDonationPageState extends State<BloodDonationPage> {
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
// if (beneficiaryType == BeneficiaryType.MyFamilyFiles)
|
|
|
|
|
// SizedBox(
|
|
|
|
|
// height: 12,
|
|
|
|
|
// ),
|
|
|
|
|
// if (beneficiaryType == BeneficiaryType.MyFamilyFiles)
|
|
|
|
|
// InkWell(
|
|
|
|
|
// onTap: () {
|
|
|
|
|
// model.getFamilyFiles().then((value) {
|
|
|
|
|
// confirmSelectFamilyDialog(model
|
|
|
|
|
// .getAllSharedRecordsByStatusResponse
|
|
|
|
|
// .getAllSharedRecordsByStatusList);
|
|
|
|
|
// }).showProgressBar(
|
|
|
|
|
// text: "Loading",
|
|
|
|
|
// backgroundColor: Colors.blue.withOpacity(0.6));
|
|
|
|
|
// },
|
|
|
|
|
// 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(getFamilyMembersName()),
|
|
|
|
|
// Icon(Icons.arrow_drop_down)
|
|
|
|
|
// ],
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
|
|
|
|
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 12,
|
|
|
|
|
),
|
|
|
|
|
@ -233,7 +208,7 @@ class _BloodDonationPageState extends State<BloodDonationPage> {
|
|
|
|
|
width: 10,
|
|
|
|
|
),
|
|
|
|
|
Text(
|
|
|
|
|
'I agree to the terms and conditions ',
|
|
|
|
|
TranslationBase.of(context).iAgreeToTheTermsAndConditions,
|
|
|
|
|
style: Theme.of(context).textTheme.subtitle1.copyWith(color: checkedValue? Colors.red : Colors.black),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
@ -267,7 +242,7 @@ class _BloodDonationPageState extends State<BloodDonationPage> {
|
|
|
|
|
image: Image.asset(
|
|
|
|
|
'assets/images/BloodChrt_EN.png'),
|
|
|
|
|
buttonCancelText:
|
|
|
|
|
Text('cancel'),
|
|
|
|
|
Text(TranslationBase.of(context).cancel),
|
|
|
|
|
buttonCancelColor:
|
|
|
|
|
Colors.grey,
|
|
|
|
|
onlyCancelButton: true,
|
|
|
|
|
@ -298,10 +273,20 @@ class _BloodDonationPageState extends State<BloodDonationPage> {
|
|
|
|
|
child: SecondaryButton(
|
|
|
|
|
textColor: Colors.white,
|
|
|
|
|
color: checkedValue== false ?Colors.white24:Color.fromRGBO(63, 72, 74, 1,),
|
|
|
|
|
label: "Save",
|
|
|
|
|
label: TranslationBase.of(context).save,
|
|
|
|
|
//
|
|
|
|
|
onTap: (){
|
|
|
|
|
Map<String, dynamic> request = Map();
|
|
|
|
|
request["BloodGroup"] = getBlood();//'O-';
|
|
|
|
|
request['CellNumber'] =authUser.mobileNumber;//m'537503378';
|
|
|
|
|
request['City'] = _selectedHospital.description; //'Riyadh';
|
|
|
|
|
request['CityCode'] =_selectedHospital.iD ;
|
|
|
|
|
request['Gender']= gender.index ==0 ? 1 : 2;
|
|
|
|
|
request['NationalID'] = authUser.nationalityID;
|
|
|
|
|
request['ZipCode'] = authUser.outSA ==1 ? '971' :'966';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
saveBloodDonation(request);
|
|
|
|
|
bloodDetails.city=_selectedHospital.toString();
|
|
|
|
|
|
|
|
|
|
// bloodDetails.
|
|
|
|
|
@ -543,11 +528,15 @@ class _BloodDonationPageState extends State<BloodDonationPage> {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
String getHospitalName() {
|
|
|
|
|
if (_selectedHospital != null)
|
|
|
|
|
if (_selectedHospital.description !=null)
|
|
|
|
|
return _selectedHospital.description;
|
|
|
|
|
else
|
|
|
|
|
return
|
|
|
|
|
"Riyadh";
|
|
|
|
|
{
|
|
|
|
|
_selectedHospital.iD =1;
|
|
|
|
|
_selectedHospital.description='Riyadh';
|
|
|
|
|
return _selectedHospital.description;
|
|
|
|
|
}
|
|
|
|
|
// "Riyadh";
|
|
|
|
|
// return List_BloodGroupDetailsModel.fromJson(0).city.toString();//"Select City";//TranslationBase.of(context).selectHospital;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -562,6 +551,7 @@ class _BloodDonationPageState extends State<BloodDonationPage> {
|
|
|
|
|
if (await this.sharedPref.getObject(USER_PROFILE) != null) {
|
|
|
|
|
var data = AuthenticatedUser.fromJson(
|
|
|
|
|
await this.sharedPref.getObject(USER_PROFILE));
|
|
|
|
|
getBloodDonationAgreement();
|
|
|
|
|
setState(() {
|
|
|
|
|
authUser = data;
|
|
|
|
|
});
|
|
|
|
|
@ -577,6 +567,28 @@ class _BloodDonationPageState extends State<BloodDonationPage> {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//================
|
|
|
|
|
saveBloodDonation(request){
|
|
|
|
|
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
_bloodDonationService.bloodDonationSave(request).then((result)=>
|
|
|
|
|
{
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context),
|
|
|
|
|
AppToast.showSuccessToast(message: result['ErrorEndUserMessage']),
|
|
|
|
|
saveBloodDonationAgreement()
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getBloodDonationAgreement(){
|
|
|
|
|
_bloodDonationService.getAgreement().then((result)=> {
|
|
|
|
|
checkedValue = result['IsAgreed']
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
saveBloodDonationAgreement(){
|
|
|
|
|
Map<String, dynamic> request = Map();
|
|
|
|
|
request['IsAgreed'] = checkedValue;
|
|
|
|
|
_bloodDonationService.saveAgreement(request).then((result)=> {
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|