fix Blood donation functionality and design

merge-update-with-lab-changes
mosazaid 5 years ago
parent 3a45239059
commit 174534d8a5

@ -373,6 +373,8 @@ const GET_PATIENT_ALL_PRES_ORD =
const PATIENT_ER_INSERT_PRES_ORDER = const PATIENT_ER_INSERT_PRES_ORDER =
'Services/Patients.svc/REST/PatientER_InsertPresOrder'; 'Services/Patients.svc/REST/PatientER_InsertPresOrder';
const PHARMACY_MAKE_REVIEW = 'epharmacy/api/insertreviews'; const PHARMACY_MAKE_REVIEW = 'epharmacy/api/insertreviews';
const BLOOD_DONATION_REGISTER_BLOOD_TYPE = 'Services/PatientVarification.svc/REST/BloodDonation_RegisterBloodType';
const ADD_USER_AGREEMENT_FOR_BLOOD_DONATION = 'Services/PatientVarification.svc/REST/AddUserAgreementForBloodDonation';
//Pharmacy wishlist //Pharmacy wishlist
const GET_WISHLIST = "shopping_cart_items/"; const GET_WISHLIST = "shopping_cart_items/";

@ -1511,5 +1511,7 @@ const Map localizedValues = {
"send-child-email-msg": {"en" : "Send the child's schedule to the email", "ar": "أرسل جدول الطفل إلى البريد الإلكتروني"}, "send-child-email-msg": {"en" : "Send the child's schedule to the email", "ar": "أرسل جدول الطفل إلى البريد الإلكتروني"},
"vaccination-add-child-msg": {"en" : "Add the child's information below to receive the schedule of vaccinations.", "ar": "أضف معلومات الطفل أدناه للحصول على جدول التطعيمات."}, "vaccination-add-child-msg": {"en" : "Add the child's information below to receive the schedule of vaccinations.", "ar": "أضف معلومات الطفل أدناه للحصول على جدول التطعيمات."},
"child_added_successfully": {"en" : "Child added successfully", "ar": "تمت إضافة الطفل بنجاح"}, "child_added_successfully": {"en" : "Child added successfully", "ar": "تمت إضافة الطفل بنجاح"},
"bloodD-enter-desc": {"en" : "Enter the required information, In order to register for Blood Donation Service", "ar": "أدخل المعلومات المطلوبة ، للتسجيل في خدمة التبرع بالدم"},
"viewTermsConditions": {"en" : "To view the terms and conditions", "ar": "لعرض الشروط والأحكام"},
// "visit": {"en" : "Visit", "ar": "الزيارة"},
}; };

@ -2,6 +2,7 @@ import 'dart:convert';
import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/config.dart';
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
import 'package:diplomaticquarterapp/core/model/blooddonation/blood_groub_details.dart';
import 'package:diplomaticquarterapp/core/model/my_balance/AdvanceModel.dart'; import 'package:diplomaticquarterapp/core/model/my_balance/AdvanceModel.dart';
import 'package:diplomaticquarterapp/core/model/my_balance/patient_advance_balance_amount.dart'; import 'package:diplomaticquarterapp/core/model/my_balance/patient_advance_balance_amount.dart';
import 'package:diplomaticquarterapp/core/model/my_balance/patient_info.dart'; import 'package:diplomaticquarterapp/core/model/my_balance/patient_info.dart';
@ -23,11 +24,11 @@ class MyBalanceService extends BaseService {
PatientInfoAndMobileNumber patientInfoAndMobileNumber; PatientInfoAndMobileNumber patientInfoAndMobileNumber;
String logInTokenID; String logInTokenID;
String verificationCode; String verificationCode;
String updatedRegisterBloodMessage = "";
AuthenticatedUserObject authenticatedUserObject = AuthenticatedUserObject authenticatedUserObject =
locator<AuthenticatedUserObject>(); locator<AuthenticatedUserObject>();
MyBalanceService(){ MyBalanceService() {
getFamilyFiles(); getFamilyFiles();
} }
@ -156,4 +157,49 @@ class MyBalanceService extends BaseService {
return await getSharedRecordByStatus(); return await getSharedRecordByStatus();
} }
} }
Future updateBloodGroup(List_BloodGroupDetailsModel detailsModel) async {
hasError = false;
await getUser();
var languageID =
await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar');
Map<String, dynamic> body = Map();
body['City'] = detailsModel.city;
body['cityCode'] = detailsModel.cityCode;
body['Gender'] = detailsModel.gender;
body['BloodGroup'] = detailsModel.bloodGroup;
body['CellNumber'] = user.mobileNumber;
body['LanguageID'] = languageID;
body['NationalID'] = user.nationalityID;
body['ZipCode'] = user.zipCode ?? "+966";
body['isDentalAllowedBackend'] = false;
await baseAppClient.post(BLOOD_DONATION_REGISTER_BLOOD_TYPE,
onSuccess: (dynamic response, int statusCode) {
updatedRegisterBloodMessage = response['ErrorEndUserMessage'];
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
if(error == null){
super.error = "Something went wrong";
}
}, body: body);
}
Future addUserAgreementForBloodDonation() async {
hasError = false;
var languageID =
await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar');
Map<String, dynamic> body = Map();
body['IsAgreed'] = true;
body['LanguageID'] = languageID;
body['isDentalAllowedBackend'] = false;
await baseAppClient.post(ADD_USER_AGREEMENT_FOR_BLOOD_DONATION,
onSuccess: (dynamic response, int statusCode) {
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: body);
}
} }

@ -0,0 +1,18 @@
import 'package:diplomaticquarterapp/config/config.dart';
import 'package:diplomaticquarterapp/core/service/base_service.dart';
class TermsConditionsService extends BaseService {
String userAgreementContent = "";
Future getUserTermsAndConditions() async {
hasError = false;
await baseAppClient.post(GET_USER_TERMS,
onSuccess: (dynamic response, int statusCode) {
userAgreementContent = response['UserAgreementContent'];
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: Map<String, dynamic>());
}
}

@ -0,0 +1,29 @@
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/service/termsConditionsService.dart';
import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart';
import '../../locator.dart';
class TermsConditionsViewModel extends BaseViewModel{
TermsConditionsService _service = locator<TermsConditionsService>();
String get userAgreementContent => _service.userAgreementContent;
getUserTermsAndConditions() async {
setState(ViewState.Busy);
await _service.getUserTermsAndConditions();
if (_service.hasError) {
error = _service.error;
setState(ViewState.Error);
} else {
setState(ViewState.Idle);
}
}
@override
void dispose() {
super.dispose();
}
}

@ -41,6 +41,9 @@ class MyBalanceViewModel extends BaseViewModel {
double get totalAdvanceBalanceAmount => double get totalAdvanceBalanceAmount =>
_myBalanceService.totalAdvanceBalanceAmount; _myBalanceService.totalAdvanceBalanceAmount;
String get updatedRegisterBloodMessage =>
_myBalanceService.updatedRegisterBloodMessage;
GetAllSharedRecordsByStatusResponse get getAllSharedRecordsByStatusResponse => GetAllSharedRecordsByStatusResponse get getAllSharedRecordsByStatusResponse =>
_myBalanceService.getAllSharedRecordsByStatusResponse; _myBalanceService.getAllSharedRecordsByStatusResponse;
@ -74,7 +77,6 @@ class MyBalanceViewModel extends BaseViewModel {
setState(ViewState.Idle); setState(ViewState.Idle);
} }
Future getCities() async { Future getCities() async {
setState(ViewState.Busy); setState(ViewState.Busy);
await _bloodDonationService.getAllCitiesOrders(); await _bloodDonationService.getAllCitiesOrders();
@ -159,4 +161,17 @@ class MyBalanceViewModel extends BaseViewModel {
setState(ViewState.Idle); setState(ViewState.Idle);
} }
} }
Future updateBloodGroup(List_BloodGroupDetailsModel detailsModel) async {
setState(ViewState.Busy);
await _myBalanceService.updateBloodGroup(detailsModel);
if (_myBalanceService.hasError) {
error = _myBalanceService.error;
setState(ViewState.ErrorLocal);
} else {
await _myBalanceService.addUserAgreementForBloodDonation();
setState(ViewState.Idle);
}
}
} }

@ -59,12 +59,14 @@ import 'core/service/parmacyModule/order-preview-service.dart';
import 'core/service/notifications_service.dart'; import 'core/service/notifications_service.dart';
import 'core/service/parmacyModule/terms-condition-service.dart'; import 'core/service/parmacyModule/terms-condition-service.dart';
import 'core/service/privilege_service.dart'; import 'core/service/privilege_service.dart';
import 'core/service/termsConditionsService.dart';
import 'core/service/weather_service.dart'; import 'core/service/weather_service.dart';
import 'core/viewModels/AlHabibMedicalService/cmc_view_model.dart'; import 'core/viewModels/AlHabibMedicalService/cmc_view_model.dart';
import 'core/service/parmacyModule/parmacy_module_service.dart'; import 'core/service/parmacyModule/parmacy_module_service.dart';
import 'core/service/offers_service.dart'; import 'core/service/offers_service.dart';
import 'core/service/pharmacy_categorise_service.dart'; import 'core/service/pharmacy_categorise_service.dart';
import 'core/viewModels/TermsConditionsViewModel.dart';
import 'core/viewModels/all_habib_medical_services/e_referral_view_model.dart'; import 'core/viewModels/all_habib_medical_services/e_referral_view_model.dart';
import 'core/viewModels/appointment_rate_view_model.dart'; import 'core/viewModels/appointment_rate_view_model.dart';
import 'core/viewModels/blooddonation/blood_details_view_model.dart'; import 'core/viewModels/blooddonation/blood_details_view_model.dart';
@ -204,6 +206,7 @@ void setupLocator() {
locator.registerLazySingleton(() => CancelOrderService()); locator.registerLazySingleton(() => CancelOrderService());
locator.registerLazySingleton(() => PrivilegeService()); locator.registerLazySingleton(() => PrivilegeService());
locator.registerLazySingleton(() => WeatherService()); locator.registerLazySingleton(() => WeatherService());
locator.registerLazySingleton(() => TermsConditionsService());
/// View Model /// View Model
locator.registerFactory(() => HospitalViewModel()); locator.registerFactory(() => HospitalViewModel());
@ -278,4 +281,5 @@ void setupLocator() {
// Geofencing // Geofencing
// --------------------- // ---------------------
locator.registerLazySingleton(() => GeofencingServices()); // Geofencing Services locator.registerLazySingleton(() => GeofencingServices()); // Geofencing Services
locator.registerFactory(() => TermsConditionsViewModel());
} }

@ -1,14 +1,15 @@
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/model/blooddonation/blood_groub_details.dart'; import 'package:diplomaticquarterapp/core/model/blooddonation/blood_groub_details.dart';
import 'package:diplomaticquarterapp/core/model/blooddonation/get_all_cities.dart'; import 'package:diplomaticquarterapp/core/model/blooddonation/get_all_cities.dart';
//import 'package:diplomaticquarterapp/core/model/hospitals/hospitals_model.dart'; //import 'package:diplomaticquarterapp/core/model/hospitals/hospitals_model.dart';
import 'package:diplomaticquarterapp/core/model/my_balance/AdvanceModel.dart'; import 'package:diplomaticquarterapp/core/model/my_balance/AdvanceModel.dart';
import 'package:diplomaticquarterapp/core/model/my_balance/patient_info.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_details_servies.dart';
import 'package:diplomaticquarterapp/core/viewModels/blooddonation/blood_details_view_model.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/core/viewModels/medical/my_balance_view_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart';
import 'package:diplomaticquarterapp/models/FamilyFiles/GetAllSharedRecordByStatusResponse.dart'; import 'package:diplomaticquarterapp/models/FamilyFiles/GetAllSharedRecordByStatusResponse.dart';
import 'package:diplomaticquarterapp/pages/Blood/user_agreement_page.dart'; import 'package:diplomaticquarterapp/pages/Blood/user_agreement_page.dart';
@ -27,6 +28,7 @@ import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:giffy_dialog/giffy_dialog.dart'; import 'package:giffy_dialog/giffy_dialog.dart';
import 'package:provider/provider.dart';
import 'package:smart_progress_bar/smart_progress_bar.dart'; import 'package:smart_progress_bar/smart_progress_bar.dart';
//import '../../../core/model/my_balance/AdvanceModel.dart'; //import '../../../core/model/my_balance/AdvanceModel.dart';
@ -39,8 +41,8 @@ import 'dialogs/SelectPatientInfoDialog.dart';
import 'new_text_Field.dart'; import 'new_text_Field.dart';
enum BeneficiaryType { MyAccount, MyFamilyFiles, OtherAccount, NON } enum BeneficiaryType { MyAccount, MyFamilyFiles, OtherAccount, NON }
enum Gender{Male,Female,NON} enum Gender { Male, Female, NON }
enum Blood{Oplus,Ominus,Aplus,Aminus,Bplus,Bminus,ABplus,ABminus,NON} enum Blood { Oplus, Ominus, Aplus, Aminus, Bplus, Bminus, ABplus, ABminus, NON }
class BloodDonationPage extends StatefulWidget { class BloodDonationPage extends StatefulWidget {
@override @override
@ -51,10 +53,11 @@ class _BloodDonationPageState extends State<BloodDonationPage> {
TextEditingController _fileTextController = TextEditingController(); TextEditingController _fileTextController = TextEditingController();
TextEditingController _notesTextController = TextEditingController(); TextEditingController _notesTextController = TextEditingController();
BeneficiaryType beneficiaryType = BeneficiaryType.NON; BeneficiaryType beneficiaryType = BeneficiaryType.NON;
Gender gender = Gender.Male;//Gender.NON; Gender gender = Gender.Male; //Gender.NON;
Blood blood = Blood.Aminus;//Blood.NON; Blood blood = Blood.Aminus; //Blood.NON;
//HospitalsModel _selectedHospital; //HospitalsModel _selectedHospital;
CitiesModel _selectedHospital; CitiesModel _selectedHospital =
CitiesModel(description: "Riyadh", descriptionN: "الرياض", iD: 1);
String amount = ""; String amount = "";
String email; String email;
@ -62,22 +65,27 @@ class _BloodDonationPageState extends State<BloodDonationPage> {
AuthenticatedUser authenticatedUser; AuthenticatedUser authenticatedUser;
GetAllSharedRecordsByStatusList selectedPatientFamily; GetAllSharedRecordsByStatusList selectedPatientFamily;
AdvanceModel advanceModel = AdvanceModel(); AdvanceModel advanceModel = AdvanceModel();
List_BloodGroupDetailsModel bloodDetails=List_BloodGroupDetailsModel(); List_BloodGroupDetailsModel bloodDetails = List_BloodGroupDetailsModel();
AppSharedPreferences sharedPref = AppSharedPreferences(); AppSharedPreferences sharedPref = AppSharedPreferences();
AuthenticatedUser authUser; AuthenticatedUser authUser;
var checkedValue = false; var checkedValue = false;
@override @override
void initState() { void initState() {
super.initState(); super.initState();
getAuthUser(); getAuthUser();
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
ProjectViewModel projectProvider = Provider.of(context);
return BaseView<MyBalanceViewModel>( return BaseView<MyBalanceViewModel>(
onModelReady: (model) => model.getCities(),//model.getHospitals(), onModelReady: (model) => model.getCities(), //model.getHospitals(),
builder: (_, model, w) => AppScaffold( builder: (_, model, w) => AppScaffold(
isShowAppBar: true, isShowAppBar: true,
appBarTitle: "Blood Donation",//TranslationBase.of(context).advancePayment, baseViewModel: model,
appBarTitle: TranslationBase.of(context).bloodD,
body: SingleChildScrollView( body: SingleChildScrollView(
physics: ScrollPhysics(), physics: ScrollPhysics(),
child: Container( child: Container(
@ -86,15 +94,16 @@ class _BloodDonationPageState extends State<BloodDonationPage> {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Texts( Texts(
// TranslationBase.of(context).advancePaymentLabel, TranslationBase.of(context).bloodDEnterDesc,
"Enter the required information, In order to register for Blood Donation Service",//+model.user.firstName,
textAlign: TextAlign.center, textAlign: TextAlign.center,
), ),
SizedBox( SizedBox(
height: 12, height: 12,
), ),
InkWell( InkWell(
onTap: () => confirmSelectHospitalDialog(model.CitiesModelList),//model.hospitals onTap: () =>
confirmSelectHospitalDialog(model.CitiesModelList),
//model.hospitals
child: Container( child: Container(
padding: EdgeInsets.all(12), padding: EdgeInsets.all(12),
width: double.infinity, width: double.infinity,
@ -105,7 +114,7 @@ class _BloodDonationPageState extends State<BloodDonationPage> {
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Texts(getHospitalName()), Texts(getHospitalName(projectProvider)),
Icon(Icons.arrow_drop_down) Icon(Icons.arrow_drop_down)
], ],
), ),
@ -116,7 +125,8 @@ class _BloodDonationPageState extends State<BloodDonationPage> {
), ),
InkWell( InkWell(
//======Gender======== //======Gender========
onTap: () => confirmSelectGenderDialog(),//confirmSelectBeneficiaryDialog(model), onTap: () => confirmSelectGenderDialog(),
//confirmSelectBeneficiaryDialog(model),
child: Container( child: Container(
padding: EdgeInsets.all(12), padding: EdgeInsets.all(12),
width: double.infinity, width: double.infinity,
@ -128,49 +138,19 @@ class _BloodDonationPageState extends State<BloodDonationPage> {
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
//Texts(getBeneficiaryType()), //Texts(getBeneficiaryType()),
Texts(getGender()), Texts(getGender(context)),
Icon(Icons.arrow_drop_down) Icon(Icons.arrow_drop_down)
], ],
), ),
), ),
), ),
// 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( SizedBox(
height: 12, height: 12,
), ),
InkWell( InkWell(
//======Gender======== //======Gender========
onTap: () => confirmSelectBloodDialog(),//confirmSelectBeneficiaryDialog(model), onTap: () => confirmSelectBloodDialog(),
//confirmSelectBeneficiaryDialog(model),
child: Container( child: Container(
padding: EdgeInsets.all(12), padding: EdgeInsets.all(12),
width: double.infinity, width: double.infinity,
@ -188,44 +168,14 @@ 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( SizedBox(
height: 12, height: 12,
), ),
Row( Row(
children: [ children: [
Container( Container(
child: Text(" To view the terms and conditions "), child: Text(
TranslationBase.of(context).viewTermsConditions),
), ),
SizedBox( SizedBox(
width: MediaQuery.of(context).size.height * 0.10, width: MediaQuery.of(context).size.height * 0.10,
@ -233,10 +183,14 @@ class _BloodDonationPageState extends State<BloodDonationPage> {
InkWell( InkWell(
onTap: () { onTap: () {
Navigator.of(context).push(MaterialPageRoute( Navigator.of(context).push(MaterialPageRoute(
builder: (BuildContext context) => UserAgreementPage())); builder: (BuildContext context) =>
UserAgreementPage()));
}, },
child: Container( child: Container(
child: Texts(" Click here ",color: Colors.blue,), child: Texts(
TranslationBase.of(context).clickHere,
color: Colors.blue,
),
), ),
) )
], ],
@ -247,25 +201,31 @@ class _BloodDonationPageState extends State<BloodDonationPage> {
Row( Row(
children: [ children: [
Checkbox( Checkbox(
onChanged: (bool value) { onChanged: (bool value) {
setState(() { setState(() {
checkedValue = value; checkedValue = value;
}); });
}, },
// tristate: checkedValue==true,//i == 1, // tristate: checkedValue==true,//i == 1,
value: checkedValue, value: checkedValue,
activeColor: Colors.red,//Color(0xFF6200EE), activeColor: Color(0xFFc5272d), //Color(0xFF6200EE),
),
SizedBox(
height: 10,
),
Row(
children: [],
), ),
SizedBox(height: 10,),
Row(children: [
],),
SizedBox( SizedBox(
width: 10, width: 10,
), ),
Text( Text(
'I agree to the terms and conditions ', TranslationBase.of(context)
style: Theme.of(context).textTheme.subtitle1.copyWith(color: checkedValue? Colors.red : Colors.black), .iAgreeToTheTermsAndConditions,
style: Theme.of(context).textTheme.subtitle1.copyWith(
color: checkedValue
? Color(0xFFc5272d)
: Colors.black),
), ),
], ],
), ),
@ -355,29 +315,25 @@ class _BloodDonationPageState extends State<BloodDonationPage> {
onTap: () { onTap: () {
showDialog( showDialog(
context: context, context: context,
builder: (_) => builder: (_) => AssetGiffyDialog(
AssetGiffyDialog(
title: Text( title: Text(
"", "",
style: TextStyle( style: TextStyle(
fontSize: 22.0, fontSize: 22.0,
fontWeight: fontWeight: FontWeight.w600),
FontWeight
.w600),
), ),
image: Image.asset( image: Image.asset(
'assets/images/BloodChrt_EN.png'), 'assets/images/BloodChrt_EN.png'),
buttonCancelText: buttonCancelText: Text(
Text('cancel'), TranslationBase.of(context).cancel),
buttonCancelColor: buttonCancelColor: Colors.grey,
Colors.grey,
onlyCancelButton: true, onlyCancelButton: true,
)); ));
}, },
child: Container( child: Container(
width: 250, width: 250,
height: 200, height: 200,
child:Image.asset( child: Image.asset(
'assets/images/BloodChrt_EN.png')), 'assets/images/BloodChrt_EN.png')),
), ),
), ),
@ -395,25 +351,37 @@ class _BloodDonationPageState extends State<BloodDonationPage> {
bottomSheet: Container( bottomSheet: Container(
height: MediaQuery.of(context).size.height * 0.12, height: MediaQuery.of(context).size.height * 0.12,
width: double.infinity, width: double.infinity,
padding: EdgeInsets.all(12), padding: EdgeInsets.all(12),
child: SecondaryButton( child: SecondaryButton(
textColor: Colors.white, textColor: Colors.white,
color: checkedValue== false ?Colors.white24:Color.fromRGBO(63, 72, 74, 1,), color: checkedValue == false
label: "Save", ? Color(0xFFa0a4a6)
// : Color.fromRGBO(
onTap: (){ 63,
72,
bloodDetails.city=_selectedHospital.toString(); 74,
1,
// bloodDetails. ),
label: TranslationBase.of(context).save,
onTap: () async {
bloodDetails.city = projectProvider.isArabic
? _selectedHospital.descriptionN
: _selectedHospital.description;
bloodDetails.cityCode = _selectedHospital.iD.toString();
bloodDetails.gender = gender == Gender.Male ? 1 : 2;
await model.updateBloodGroup(bloodDetails);
if (model.state == ViewState.Idle) {
AppToast.showSuccessToast(
message: model.updatedRegisterBloodMessage);
} else {
AppToast.showErrorToast(message: model.error);
}
}, },
), ),
)), )),
); );
} }
//============== //==============
void confirmSelectBeneficiaryDialog(MyBalanceViewModel model) { void confirmSelectBeneficiaryDialog(MyBalanceViewModel model) {
showDialog( showDialog(
@ -435,94 +403,85 @@ class _BloodDonationPageState extends State<BloodDonationPage> {
), ),
); );
} }
void confirmSelectBloodDialog(){
void confirmSelectBloodDialog() {
showDialog( showDialog(
context: context, context: context,
child: SelectBloodDialog(bloodType: blood, child: SelectBloodDialog(
bloodType: blood,
onValueSelected: (value) { onValueSelected: (value) {
setState(() { setState(() {
if (value == Blood.Oplus) { if (value == Blood.Oplus) {
bloodDetails.bloodGroup="O+"; bloodDetails.bloodGroup = "O+";
// _fileTextController.text = model.user.patientID.toString(); // _fileTextController.text = model.user.patientID.toString();
// advanceModel.depositorName = // advanceModel.depositorName =
// model.user.firstName + " " + model.user.lastName; // model.user.firstName + " " + model.user.lastName;
}else } else if (value == Blood.Ominus) {
if (value == Blood.Ominus) {
// _fileTextController.text = model.user.patientID.toString(); // _fileTextController.text = model.user.patientID.toString();
bloodDetails.bloodGroup="O-"; bloodDetails.bloodGroup = "O-";
// advanceModel.depositorName = // advanceModel.depositorName =
// model.user.firstName + " " + model.user.lastName; // model.user.firstName + " " + model.user.lastName;
}else } else if (value == Blood.ABplus) {
if (value == Blood.ABplus) { bloodDetails.bloodGroup = "AB+";
bloodDetails.bloodGroup="AB+";
// _fileTextController.text = model.user.patientID.toString(); // _fileTextController.text = model.user.patientID.toString();
// advanceModel.depositorName = // advanceModel.depositorName =
// model.user.firstName + " " + model.user.lastName; // model.user.firstName + " " + model.user.lastName;
}else } else if (value == Blood.ABminus) {
if (value == Blood.ABminus) { bloodDetails.bloodGroup = "AB-";
bloodDetails.bloodGroup="AB-";
// _fileTextController.text = model.user.patientID.toString(); // _fileTextController.text = model.user.patientID.toString();
// advanceModel.depositorName = // advanceModel.depositorName =
// model.user.firstName + " " + model.user.lastName; // model.user.firstName + " " + model.user.lastName;
}else } else if (value == Blood.Aplus) {
if (value == Blood.Aplus) { bloodDetails.bloodGroup = "A+";
bloodDetails.bloodGroup="A+";
// _fileTextController.text = model.user.patientID.toString(); // _fileTextController.text = model.user.patientID.toString();
// advanceModel.depositorName = // advanceModel.depositorName =
// model.user.firstName + " " + model.user.lastName; // model.user.firstName + " " + model.user.lastName;
}else } else if (value == Blood.Aminus) {
if (value == Blood.Aminus) { bloodDetails.bloodGroup = "A-";
bloodDetails.bloodGroup="A-";
// _fileTextController.text = model.user.patientID.toString(); // _fileTextController.text = model.user.patientID.toString();
// advanceModel.depositorName = // advanceModel.depositorName =
// model.user.firstName + " " + model.user.lastName; // model.user.firstName + " " + model.user.lastName;
}else } else if (value == Blood.Bplus) {
if (value == Blood.Bplus) { bloodDetails.bloodGroup = "B+";
bloodDetails.bloodGroup="B+";
// _fileTextController.text = model.user.patientID.toString(); // _fileTextController.text = model.user.patientID.toString();
// advanceModel.depositorName = // advanceModel.depositorName =
// model.user.firstName + " " + model.user.lastName; // model.user.firstName + " " + model.user.lastName;
}else } else if (value == Blood.Bminus) {
if (value == Blood.Bminus) { bloodDetails.bloodGroup = "B-";
bloodDetails.bloodGroup="B-";
// _fileTextController.text = model.user.patientID.toString(); // _fileTextController.text = model.user.patientID.toString();
// advanceModel.depositorName = // advanceModel.depositorName =
// model.user.firstName + " " + model.user.lastName; // model.user.firstName + " " + model.user.lastName;
} } else
else
_fileTextController.text = ""; _fileTextController.text = "";
// beneficiaryType = value; // beneficiaryType = value;
blood=value; blood = value;
} });
);
}, },
), ),
); );
} }
void confirmSelectGenderDialog(){
void confirmSelectGenderDialog() {
showDialog( showDialog(
context: context, context: context,
child: SelectGenderDialog(beneficiaryType: gender, child: SelectGenderDialog(
beneficiaryType: gender,
onValueSelected: (value) { onValueSelected: (value) {
setState(() { setState(() {
if (value == Gender.Male) { if (value == Gender.Male) {
// _fileTextController.text = model.user.patientID.toString(); // _fileTextController.text = model.user.patientID.toString();
bloodDetails.patientType=1; bloodDetails.patientType = 1;
// advanceModel.depositorName = // advanceModel.depositorName =
// model.user.firstName + " " + model.user.lastName; // model.user.firstName + " " + model.user.lastName;
} else } else
// _fileTextController.text = ""; // _fileTextController.text = "";
{bloodDetails.gender=2;} {
bloodDetails.gender = 2;
}
// beneficiaryType = value; // beneficiaryType = value;
gender=value; gender = value;
}); });
}, },
), ),
@ -591,23 +550,25 @@ class _BloodDonationPageState extends State<BloodDonationPage> {
return TranslationBase.of(context).otherAccount; return TranslationBase.of(context).otherAccount;
break; break;
case BeneficiaryType.NON: case BeneficiaryType.NON:
return "Select Gender";//TranslationBase.of(context).selectBeneficiary; return TranslationBase.of(context).selectBeneficiary;
} }
return "Select Gender";//TranslationBase.of(context).selectBeneficiary; return TranslationBase.of(context).selectBeneficiary;
} }
String getGender() {
String getGender(BuildContext context) {
switch (gender) { switch (gender) {
case Gender.Male: case Gender.Male:
return "Male"; return TranslationBase.of(context).male;
case Gender.Female: case Gender.Female:
return "Female"; return TranslationBase.of(context).female;
break; break;
case Gender.NON: case Gender.NON:
return "Select Gender";//TranslationBase.of(context).selectBeneficiary; return TranslationBase.of(context).selectGender;
} }
return "Select Gender";//TranslationBase.of(context).selectBeneficiary; return TranslationBase.of(context).selectGender;
} }
String getBlood() { String getBlood() {
switch (blood) { switch (blood) {
case Blood.Oplus: case Blood.Oplus:
@ -639,18 +600,19 @@ class _BloodDonationPageState extends State<BloodDonationPage> {
break; break;
case Blood.NON: case Blood.NON:
return "Select Blood Type";//TranslationBase.of(context).selectBeneficiary; return "Select Blood Type"; //TranslationBase.of(context).selectBeneficiary;
} }
return "Select Blood Type";//TranslationBase.of(context).selectBeneficiary; return "Select Blood Type"; //TranslationBase.of(context).selectBeneficiary;
} }
String getHospitalName() { String getHospitalName(ProjectViewModel projectProvider) {
if (_selectedHospital != null) if (_selectedHospital != null)
return _selectedHospital.description; return projectProvider.isArabic
? _selectedHospital.descriptionN
: _selectedHospital.description;
else else
return return projectProvider.isArabic ? "الرياض" : "Riyadh";
"Riyadh"; // return List_BloodGroupDetailsModel.fromJson(0).city.toString();//"Select City";//TranslationBase.of(context).selectHospital;
// return List_BloodGroupDetailsModel.fromJson(0).city.toString();//"Select City";//TranslationBase.of(context).selectHospital;
} }
String getPatientName() { String getPatientName() {
@ -677,8 +639,6 @@ class _BloodDonationPageState extends State<BloodDonationPage> {
return TranslationBase.of(context).selectFamilyPatientName; return TranslationBase.of(context).selectFamilyPatientName;
} }
//================
//================
} }

@ -38,7 +38,7 @@ class _SelectGenderDialogState extends State<SelectGenderDialog> {
}); });
}, },
child: ListTile( child: ListTile(
title: Text("Male"), title: Text(TranslationBase.of(context).male),
leading: Radio( leading: Radio(
value: Gender.Male, value: Gender.Male,
groupValue: beneficiaryType, groupValue: beneficiaryType,
@ -68,7 +68,7 @@ class _SelectGenderDialogState extends State<SelectGenderDialog> {
}); });
}, },
child: ListTile( child: ListTile(
title: Text("Female"), title: Text(TranslationBase.of(context).female),
leading: Radio( leading: Radio(
value: Gender.Female, value: Gender.Female,
groupValue: beneficiaryType, groupValue: beneficiaryType,

@ -1,55 +1,23 @@
import 'package:diplomaticquarterapp/core/viewModels/TermsConditionsViewModel.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter_html/flutter_html.dart';
class UserAgreementPage extends StatelessWidget { class UserAgreementPage extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return AppScaffold( return BaseView<TermsConditionsViewModel>(
isShowAppBar: true, onModelReady: (model) => model.getUserTermsAndConditions(),
appBarTitle: "User Agreement", builder: (_, model, w) => AppScaffold(
isShowAppBar: true,
body: appBarTitle: TranslationBase.of(context).userAgreement,
Container( body: SingleChildScrollView(
child:ListView( child: Html(
scrollDirection: Axis.vertical, data: model.userAgreementContent,
children: <Widget>[ ),
/////////// )),
Column( );
children: [
SizedBox(
height: 20,
),
Container(
child:Text("Communication via email, text messages and phone calls",textAlign: TextAlign.center,style: TextStyle(fontWeight: FontWeight.bold,fontSize: 16)),
),
SizedBox(
height: 20,
),
Container(
child:
Text("I understand that the contact number or Email that \n I have provided on registration will be used for communication by HMG.\n I hereby agree to be notified by HMG through SMS, Email or any other method for appointments notifications, current HMGs medical services, and any services introduced by the HMG in the future or any modifications made to the services offered by the HMG. And these messages may be submitted as evidence where the HMG has the right to use at any time whatsoever and as it sees fit.",textAlign: TextAlign.center,style: TextStyle(fontWeight: FontWeight.bold,fontSize: 16)),
),
SizedBox(
height: 20,
),
Container(
child:
Text("I understand the risks of communicating by email and text messages, in particular the privacy risks. \nI understand that HMG cannot guarantee the security and confidentiality of email or text communication. HMG will not be responsible for messages that are not received or delivered due to technical failure, or for disclosure of confidential information unless caused by intentional misconduct.",textAlign: TextAlign.center,style: TextStyle(fontWeight: FontWeight.bold,fontSize: 16)),
),
SizedBox(
height: 20,
),
Container(
child:
Text("\b I hereby agree to receive emails, text messages, phone calls for appointments notifications, special promotions and new features or products introduced by HMG or any third party.",textAlign: TextAlign.center,style: TextStyle(fontWeight: FontWeight.bold,fontSize: 16)),
),
],
)
///////////
])
));
} }
} }

@ -1,9 +1,11 @@
//import 'package:diplomaticquarterapp/core/model/hospitals/hospitals_model.dart'; //import 'package:diplomaticquarterapp/core/model/hospitals/hospitals_model.dart';
import 'package:diplomaticquarterapp/core/model/blooddonation/get_all_cities.dart'; import 'package:diplomaticquarterapp/core/model/blooddonation/get_all_cities.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
class SelectCiteisDialog extends StatefulWidget { class SelectCiteisDialog extends StatefulWidget {
final List<CitiesModel> hospitals; final List<CitiesModel> hospitals;
@ -12,6 +14,7 @@ class SelectCiteisDialog extends StatefulWidget {
SelectCiteisDialog( SelectCiteisDialog(
{Key key, this.hospitals, this.onValueSelected, this.selectedHospital}); {Key key, this.hospitals, this.onValueSelected, this.selectedHospital});
@override @override
_SelectCiteisDialogState createState() => _SelectCiteisDialogState(); _SelectCiteisDialogState createState() => _SelectCiteisDialogState();
} }
@ -24,9 +27,10 @@ class _SelectCiteisDialogState extends State<SelectCiteisDialog> {
widget.selectedHospital = widget.selectedHospital ?? widget.hospitals[0]; widget.selectedHospital = widget.selectedHospital ?? widget.hospitals[0];
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
ProjectViewModel projectProvider = Provider.of(context);
return SimpleDialog( return SimpleDialog(
children: [ children: [
Column( Column(
@ -34,7 +38,7 @@ class _SelectCiteisDialogState extends State<SelectCiteisDialog> {
Divider(), Divider(),
...List.generate( ...List.generate(
widget.hospitals.length, widget.hospitals.length,
(index) => Column( (index) => Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
SizedBox( SizedBox(
@ -53,7 +57,9 @@ class _SelectCiteisDialogState extends State<SelectCiteisDialog> {
child: ListTile( child: ListTile(
// title: Text(widget.hospitals[index].description + // title: Text(widget.hospitals[index].description +
// ' ${widget.hospitals[index].distanceInKilometers} KM'), // ' ${widget.hospitals[index].distanceInKilometers} KM'),
title: Text(widget.hospitals[index].description), title: Text(projectProvider.isArabic
? widget.hospitals[index].descriptionN
: widget.hospitals[index].description),
leading: Radio( leading: Radio(
value: widget.hospitals[index], value: widget.hospitals[index],
groupValue: widget.selectedHospital, groupValue: widget.selectedHospital,
@ -116,9 +122,9 @@ class _SelectCiteisDialogState extends State<SelectCiteisDialog> {
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: Center( child: Center(
child: Texts( child: Texts(
TranslationBase.of(context).ok, TranslationBase.of(context).ok,
fontWeight: FontWeight.w400, fontWeight: FontWeight.w400,
)), )),
), ),
), ),
), ),

@ -1263,6 +1263,8 @@ class TranslationBase {
String get sendChildEmailMsg => localizedValues["send-child-email-msg"][locale.languageCode]; String get sendChildEmailMsg => localizedValues["send-child-email-msg"][locale.languageCode];
String get vaccinationAddChildMsg => localizedValues["vaccination-add-child-msg"][locale.languageCode]; String get vaccinationAddChildMsg => localizedValues["vaccination-add-child-msg"][locale.languageCode];
String get childAddedSuccessfully => localizedValues["child_added_successfully"][locale.languageCode]; String get childAddedSuccessfully => localizedValues["child_added_successfully"][locale.languageCode];
String get bloodDEnterDesc => localizedValues["bloodD-enter-desc"][locale.languageCode];
String get viewTermsConditions => localizedValues["viewTermsConditions"][locale.languageCode];
} }

Loading…
Cancel
Save