From 69e64fd5fb1ca33fa1ec5778179ebae9e67ae4c7 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Sun, 17 Mar 2024 11:27:14 +0300 Subject: [PATCH] Blood Donation CR merged into dev_3.3 --- lib/config/config.dart | 16 +- lib/config/localized_values.dart | 1 + .../blood_donation_free_slots_response.dart | 25 + ...blood_donation_projects_list_response.dart | 46 ++ .../service/blood/blood_donation_service.dart | 27 + lib/pages/Blood/blood_donation.dart | 491 ++++++++++++++++- ...donation_appointment_terms_conditions.dart | 43 ++ .../blood_donation_book_appointment.dart | 502 ++++++++++++++++++ .../MyAppointments/AppointmentDetails.dart | 2 + .../widgets/AppointmentActions.dart | 62 +-- lib/pages/ToDoList/ToDo.dart | 16 +- lib/uitl/translations_delegate_base.dart | 1 + lib/widgets/in_app_browser/InAppBrowser.dart | 4 +- lib/widgets/new_design/doctor_header.dart | 79 ++- 14 files changed, 1206 insertions(+), 109 deletions(-) create mode 100644 lib/core/model/blooddonation/blood_donation_free_slots_response.dart create mode 100644 lib/core/model/blooddonation/blood_donation_projects_list_response.dart create mode 100644 lib/pages/Blood/blood_donation_appointment_terms_conditions.dart create mode 100644 lib/pages/Blood/blood_donation_book_appointment.dart diff --git a/lib/config/config.dart b/lib/config/config.dart index a24f0ed2..01c6d755 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -21,8 +21,8 @@ var PACKAGES_ORDERS = '/api/orders'; var PACKAGES_ORDER_HISTORY = '/api/orders/items'; var PACKAGES_TAMARA_OPT = '/api/orders/paymentoptions/tamara'; // var BASE_URL = 'http://10.50.100.198:4422/'; -// var BASE_URL = 'https://uat.hmgwebservices.com/'; -var BASE_URL = 'https://hmgwebservices.com/'; +var BASE_URL = 'https://uat.hmgwebservices.com/'; +// var BASE_URL = 'https://hmgwebservices.com/'; // var BASE_URL = 'http://10.20.200.111:1010/'; // var BASE_URL = 'https://hmgwebservices.com/'; // var BASE_URL = 'https://orash.cloudsolutions.com.sa/'; @@ -625,13 +625,17 @@ var PAYFORT_PROD_URL = 'https://paymentservices.payfort.com/FortAPI/paymentApi'; var CHECK_PATIENT_NPHIES_ELIGIBILITY = 'Services/Doctors.svc/REST/checkPatientInsuranceCompanyValidity'; var CONVERT_PATIENT_TO_CASH = 'Services/Doctors.svc/REST/deActivateInsuranceCompany'; +var GET_BLOOD_DONATION_PROJECTS_LIST = 'Services/OUTPs.svc/REST/BD_getProjectsHaveBDClinics'; + +var GET_BLOOD_DONATION_FREE_SLOTS = 'Services/OUTPs.svc/REST/BD_GetFreeSlots'; + //PAYFORT var getPayFortProjectDetails = "Services/PayFort_Serv.svc/REST/GetPayFortProjectDetails"; var addPayFortApplePayResponse = "Services/PayFort_Serv.svc/REST/AddResponse"; -var payFortEnvironment = FortEnvironment.production; -var applePayMerchantId = "merchant.com.hmgwebservices"; -// var payFortEnvironment = FortEnvironment.test; -// var applePayMerchantId = "merchant.com.hmgwebservices.uat"; +// var payFortEnvironment = FortEnvironment.production; +// var applePayMerchantId = "merchant.com.hmgwebservices"; +var payFortEnvironment = FortEnvironment.test; +var applePayMerchantId = "merchant.com.hmgwebservices.uat"; class AppGlobal { static var context; diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 1f5120bb..b5e1f0d2 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -1932,4 +1932,5 @@ const Map localizedValues = { "noUpcomingAppointment": {"en": "No upcoming appointments", "ar": "لا توجد مواعيد القادمة"}, "locationTimeoutError": {"en": "Unable to fetch your location, Please try again.", "ar": "غير قادر على جلب موقعك، يرجى المحاولة مرة أخرى."}, "loadMore": {"en": "Load More", "ar": "تحميل المزيد"}, + "selectHospitalBloodDonation": {"en": "Please select the hospital you want to book an appointment with: ", "ar": "يرجى اختيار المستشفى الذي تريد حجز موعد معه:"}, }; diff --git a/lib/core/model/blooddonation/blood_donation_free_slots_response.dart b/lib/core/model/blooddonation/blood_donation_free_slots_response.dart new file mode 100644 index 00000000..5c46cab1 --- /dev/null +++ b/lib/core/model/blooddonation/blood_donation_free_slots_response.dart @@ -0,0 +1,25 @@ +class BloodDonationFreeSlotsResponseModel { + int clinicID; + int doctorID; + String freeTimeSlots; + int projectID; + + BloodDonationFreeSlotsResponseModel( + {this.clinicID, this.doctorID, this.freeTimeSlots, this.projectID}); + + BloodDonationFreeSlotsResponseModel.fromJson(Map json) { + clinicID = json['ClinicID']; + doctorID = json['DoctorID']; + freeTimeSlots = json['FreeTimeSlots']; + projectID = json['ProjectID']; + } + + Map toJson() { + final Map data = new Map(); + data['ClinicID'] = this.clinicID; + data['DoctorID'] = this.doctorID; + data['FreeTimeSlots'] = this.freeTimeSlots; + data['ProjectID'] = this.projectID; + return data; + } +} diff --git a/lib/core/model/blooddonation/blood_donation_projects_list_response.dart b/lib/core/model/blooddonation/blood_donation_projects_list_response.dart new file mode 100644 index 00000000..ceb108c5 --- /dev/null +++ b/lib/core/model/blooddonation/blood_donation_projects_list_response.dart @@ -0,0 +1,46 @@ +class BloodDonationProjectsListResponse { + int rowID; + int iD; + int projectID; + int numberOfRooms; + bool isActive; + int createdBy; + String createdOn; + dynamic editedBy; + dynamic editedON; + String projectName; + dynamic projectNameN; + + BloodDonationProjectsListResponse( + {this.rowID, this.iD, this.projectID, this.numberOfRooms, this.isActive, this.createdBy, this.createdOn, this.editedBy, this.editedON, this.projectName, this.projectNameN}); + + BloodDonationProjectsListResponse.fromJson(Map json) { + rowID = json['RowID']; + iD = json['ID']; + projectID = json['ProjectID']; + numberOfRooms = json['NumberOfRooms']; + isActive = json['IsActive']; + createdBy = json['CreatedBy']; + createdOn = json['CreatedOn']; + editedBy = json['EditedBy']; + editedON = json['EditedON']; + projectName = json['ProjectName']; + projectNameN = json['ProjectNameN']; + } + + Map toJson() { + final Map data = new Map(); + data['RowID'] = this.rowID; + data['ID'] = this.iD; + data['ProjectID'] = this.projectID; + data['NumberOfRooms'] = this.numberOfRooms; + data['IsActive'] = this.isActive; + data['CreatedBy'] = this.createdBy; + data['CreatedOn'] = this.createdOn; + data['EditedBy'] = this.editedBy; + data['EditedON'] = this.editedON; + data['ProjectName'] = this.projectName; + data['ProjectNameN'] = this.projectNameN; + return data; + } +} diff --git a/lib/core/service/blood/blood_donation_service.dart b/lib/core/service/blood/blood_donation_service.dart index a59a2169..f73fbe98 100644 --- a/lib/core/service/blood/blood_donation_service.dart +++ b/lib/core/service/blood/blood_donation_service.dart @@ -70,4 +70,31 @@ class BloodDonationService extends BaseService { throw error; } } + + Future getBloodDonationProjectsList() async { + Map request; + request = {}; + dynamic localRes; + await baseAppClient.post(GET_BLOOD_DONATION_PROJECTS_LIST, onSuccess: (response, statusCode) async { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request); + + return Future.value(localRes); + } + + Future getBloodDonationFreeSlots(int clinicID, int projectID) async { + Map request; + request = {"ClinicID": clinicID, "ProjectID": projectID}; + dynamic localRes; + await baseAppClient.post(GET_BLOOD_DONATION_FREE_SLOTS, onSuccess: (response, statusCode) async { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request); + + return Future.value(localRes); + } + } diff --git a/lib/pages/Blood/blood_donation.dart b/lib/pages/Blood/blood_donation.dart index 5e4de7ee..ec39940d 100644 --- a/lib/pages/Blood/blood_donation.dart +++ b/lib/pages/Blood/blood_donation.dart @@ -1,3 +1,382 @@ +// import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +// import 'package:diplomaticquarterapp/core/model/ImagesInfo.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/viewModels/medical/my_balance_view_model.dart'; +// import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +// import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/h2o/h20_setting.dart'; +// import 'package:diplomaticquarterapp/pages/Blood/user_agreement_page.dart'; +// import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +// import 'package:diplomaticquarterapp/theme/colors.dart'; +// import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; +// import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +// import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +// import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; +// import 'package:diplomaticquarterapp/widgets/dialogs/radio_selection_dialog.dart'; +// import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +// import 'package:diplomaticquarterapp/widgets/show_zoom_image_dialog.dart'; +// import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; +// import 'package:flutter/cupertino.dart'; +// import 'package:flutter/material.dart'; +// import 'package:provider/provider.dart'; +// +// enum BeneficiaryType { MyAccount, MyFamilyFiles, OtherAccount, NON } +// enum Gender { Male, Female, NON } +// enum Blood { Oplus, Ominus, Aplus, Aminus, Bplus, Bminus, ABplus, ABminus, NON } +// +// class BloodDonationPage extends StatefulWidget { +// @override +// _BloodDonationPageState createState() => _BloodDonationPageState(); +// } +// +// class _BloodDonationPageState extends State { +// BeneficiaryType beneficiaryType = BeneficiaryType.NON; +// +// CitiesModel _selectedHospital; +// +// int _selectedHospitalIndex = 0; +// int _selectedGenderIndex = 1; +// int _selectedBloodTypeIndex = 0; +// String _selectedBloodType = "O+"; +// +// String amount = ""; +// String email; +// +// List_BloodGroupDetailsModel bloodDetails = List_BloodGroupDetailsModel(bloodGroup: "A-"); +// AppSharedPreferences sharedPref = AppSharedPreferences(); +// var checkedValue = false; +// List imagesInfo = List(); +// +// ProjectViewModel projectProvider; +// +// @override +// void initState() { +// imagesInfo.add( +// ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/images-info-home/blood/en/0.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/images-info-home/blood/ar/0.png'), +// ); +// WidgetsBinding.instance.addPostFrameCallback((_) {}); +// super.initState(); +// } +// +// int getSelectedCityID(MyBalanceViewModel model) { +// int cityID = 1; +// model.CitiesModelList.forEach((element) { +// if (element.description == model.bloodModelList[0].city) { +// cityID = element.iD; +// } +// }); +// return cityID; +// } +// +// @override +// Widget build(BuildContext context) { +// projectProvider = Provider.of(context); +// +// return BaseView( +// onModelReady: (model) => model.getCities().then((value) { +// model.getBlood().then((value) { +// if (model.bloodModelList.length > 0) { +// CitiesModel citiesModel = new CitiesModel(); +// citiesModel.iD = getSelectedCityID(model); +// _selectedHospitalIndex = (citiesModel.iD - 1); +// citiesModel.description = model.CitiesModelList[_selectedHospitalIndex].description; +// citiesModel.descriptionN = model.CitiesModelList[_selectedHospitalIndex].descriptionN; +// _selectedHospital = citiesModel; +// _selectedBloodType = model.bloodModelList[0].bloodGroup; +// _selectedBloodTypeIndex = getBloodIndex(_selectedBloodType); +// } else { +// _selectedHospital = model.CitiesModelList[0]; +// } +// }); +// }), +// // { +// // if (projectProvider.isLogin && projectProvider.user != null) { +// // model.getCities().then((value) { +// // model.getBlood().then((value) { +// // if (model.bloodModelList.length > 0) { +// // CitiesModel citiesModel = new CitiesModel(); +// // citiesModel.iD = getSelectedCityID(model); +// // _selectedHospitalIndex = (citiesModel.iD - 1); +// // citiesModel.description = model.CitiesModelList[_selectedHospitalIndex].description; +// // citiesModel.descriptionN = model.CitiesModelList[_selectedHospitalIndex].descriptionN; +// // _selectedHospital = citiesModel; +// // _selectedBloodType = model.bloodModelList[0].bloodGroup; +// // _selectedBloodTypeIndex = getBloodIndex(_selectedBloodType); +// // } else { +// // _selectedHospital = model.CitiesModelList[0]; +// // } +// // }); +// // }); +// // } +// // }, +// builder: (_, model, w) => AppScaffold( +// isShowAppBar: true, +// showNewAppBar: true, +// backgroundColor: Color(0xffF7F7F7), +// showNewAppBarTitle: true, +// baseViewModel: model, +// isShowDecPage: true, +// imagesInfo: imagesInfo, +// description: TranslationBase.of(context).bloodDonationInfo, +// appBarTitle: TranslationBase.of(context).bloodD, +// body: Column( +// children: [ +// Expanded( +// child: SingleChildScrollView( +// physics: BouncingScrollPhysics(), +// padding: EdgeInsets.all(21), +// child: Column( +// crossAxisAlignment: CrossAxisAlignment.start, +// children: [ +// Text( +// TranslationBase.of(context).bloodDEnterDesc, +// style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64), +// ), +// SizedBox(height: 12), +// if (projectProvider.isLogin && model.state != ViewState.Busy) +// +// CommonDropDownView( +// TranslationBase.of(context).city, +// model.CitiesModelList.isNotEmpty +// ? projectProvider.isArabic +// ? model.CitiesModelList[_selectedHospitalIndex].descriptionN +// : model.CitiesModelList[_selectedHospitalIndex].description +// : "", () { +// List list = [ +// for (int i = 0; i < model.CitiesModelList.length; i++) +// RadioSelectionDialogModel(projectProvider.isArabic ? model.CitiesModelList[i].descriptionN : model.CitiesModelList[i].description, i), +// ]; +// +// showDialog( +// context: context, +// builder: (cxt) => RadioSelectionDialog( +// listData: list, +// selectedIndex: _selectedHospitalIndex, +// isScrollable: true, +// onValueSelected: (index) { +// _selectedHospitalIndex = index; +// _selectedHospital = model.CitiesModelList[index]; +// setState(() {}); +// }, +// ), +// ); +// }).withBorderedContainer, +// SizedBox(height: 12), +// CommonDropDownView(TranslationBase.of(context).gender, _selectedGenderIndex == 1 ? TranslationBase.of(context).male : TranslationBase.of(context).female, () { +// List list = [ +// RadioSelectionDialogModel(TranslationBase.of(context).male, 1), +// RadioSelectionDialogModel(TranslationBase.of(context).female, 2), +// ]; +// +// showDialog( +// context: context, +// builder: (cxt) => RadioSelectionDialog( +// listData: list, +// selectedIndex: _selectedGenderIndex, +// onValueSelected: (index) { +// _selectedGenderIndex = index; +// setState(() {}); +// }, +// ), +// ); +// }).withBorderedContainer, +// SizedBox(height: 12), +// CommonDropDownView(TranslationBase.of(context).bloodType, _selectedBloodType, () { +// List list = [ +// RadioSelectionDialogModel("O+", 0), +// RadioSelectionDialogModel("O-", 1), +// RadioSelectionDialogModel("AB+", 2), +// RadioSelectionDialogModel("AB-", 3), +// RadioSelectionDialogModel("A+", 4), +// RadioSelectionDialogModel("A-", 5), +// RadioSelectionDialogModel("B+", 6), +// RadioSelectionDialogModel("B-", 7), +// ]; +// +// showDialog( +// context: context, +// builder: (cxt) => RadioSelectionDialog( +// listData: list, +// selectedIndex: _selectedBloodTypeIndex, +// isScrollable: true, +// onValueSelected: (index) { +// _selectedBloodTypeIndex = index; +// _selectedBloodType = getBlood(index); +// setState(() {}); +// }, +// ), +// ); +// }).withBorderedContainer, +// SizedBox(height: 12), +// Row( +// mainAxisAlignment: MainAxisAlignment.spaceBetween, +// children: [ +// Text( +// TranslationBase.of(context).viewTermsConditions + ":", +// style: TextStyle(fontWeight: FontWeight.w600, color: Color(0xff2E303A), fontSize: 14, letterSpacing: -0.56), +// ), +// InkWell( +// onTap: () { +// Navigator.of(context).push(FadePage(page: UserAgreementPage())); +// }, +// child: Text( +// TranslationBase.of(context).clickHere, +// style: TextStyle(fontWeight: FontWeight.w600, color: Colors.blue, fontSize: 14, letterSpacing: -0.56), +// ), +// ) +// ], +// ), +// SizedBox(height: 12), +// Row( +// children: [ +// Checkbox( +// onChanged: (bool value) { +// setState(() { +// checkedValue = value; +// }); +// }, +// value: checkedValue, +// activeColor: Color(0xFFc5272d), +// ), +// Text( +// TranslationBase.of(context).iAgreeToTheTermsAndConditions, +// style: TextStyle(fontSize: 14.0, fontWeight: FontWeight.bold), +// ), +// ], +// ), +// SizedBox( +// height: 10, +// ), +// Row( +// mainAxisAlignment: MainAxisAlignment.center, +// crossAxisAlignment: CrossAxisAlignment.center, +// children: [ +// Center( +// child: Container( +// color: Theme.of(context).primaryColor, +// width: 350, +// child: InkWell( +// onTap: () { +// showZoomImageDialog(context, 'assets/images/BloodChrt_EN.png', isNetworkImage: false); +// }, +// child: Container(width: 250, height: 200, child: Image.asset('assets/images/BloodChrt_EN.png'), color: Colors.white), +// ), +// ), +// ), +// ], +// ), +// SizedBox( +// height: MediaQuery.of(context).size.height * 0.15, +// ) +// ], +// ), +// ), +// ), +// DefaultButton( +// TranslationBase.of(context).save, +// checkedValue +// ? () async { +// if (_selectedHospital == null) { +// AppToast.showErrorToast(message: TranslationBase.of(context).selectCity); +// return; +// } +// bloodDetails.city = _selectedHospital.description; +// bloodDetails.cityCode = _selectedHospital.iD.toString(); +// bloodDetails.gender = _selectedGenderIndex; +// bloodDetails.bloodGroup = getBlood(_selectedBloodTypeIndex); +// await model.updateBloodGroup(bloodDetails); +// if (model.state == ViewState.Idle) { +// AppToast.showSuccessToast(message: model.updatedRegisterBloodMessage); +// } else { +// AppToast.showErrorToast(message: model.error); +// } +// } +// : null, +// disabledColor: CustomColors.grey2, +// ).insideContainer +// ], +// ), +// ), +// ); +// } +// +// String getBlood(int index) { +// switch (index) { +// case 0: +// return "O+"; +// break; +// case 1: +// return "O-"; +// break; +// case 2: +// return "AB+"; +// break; +// case 3: +// return "AB-"; +// break; +// case 4: +// return "A+"; +// break; +// case 5: +// return "A-"; +// break; +// case 6: +// return "B-"; +// break; +// case 7: +// return "B-"; +// break; +// case 8: +// return "B+"; +// break; +// +// default: +// return ""; +// } +// } +// +// int getBloodIndex(String type) { +// switch (type) { +// case "O+": +// return 0; +// break; +// case "O-": +// return 1; +// break; +// case "AB+": +// return 2; +// break; +// case "AB-": +// return 3; +// break; +// case "A+": +// return 4; +// break; +// case "A-": +// return 5; +// break; +// case "B-": +// return 6; +// break; +// case "B-": +// return 7; +// break; +// case "B+": +// return 8; +// break; +// +// default: +// return 0; +// } +// } +// +// String getHospitalName(ProjectViewModel projectProvider, BuildContext context) { +// if (_selectedHospital != null) +// return projectProvider.isArabic ? _selectedHospital.descriptionN : _selectedHospital.description; +// else +// return TranslationBase.of(context).selectCity; +// } +// } import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; import 'package:diplomaticquarterapp/core/model/blooddonation/blood_groub_details.dart'; @@ -5,12 +384,15 @@ import 'package:diplomaticquarterapp/core/model/blooddonation/get_all_cities.dar import 'package:diplomaticquarterapp/core/viewModels/medical/my_balance_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/h2o/h20_setting.dart'; +import 'package:diplomaticquarterapp/pages/Blood/blood_donation_book_appointment.dart'; import 'package:diplomaticquarterapp/pages/Blood/user_agreement_page.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/custom_text_button.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/radio_selection_dialog.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; @@ -21,7 +403,9 @@ import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; enum BeneficiaryType { MyAccount, MyFamilyFiles, OtherAccount, NON } + enum Gender { Male, Female, NON } + enum Blood { Oplus, Ominus, Aplus, Aminus, Bplus, Bminus, ABplus, ABminus, NON } class BloodDonationPage extends StatefulWidget { @@ -134,7 +518,6 @@ class _BloodDonationPageState extends State { ), SizedBox(height: 12), if (projectProvider.isLogin && model.state != ViewState.Busy) - CommonDropDownView( TranslationBase.of(context).city, model.CitiesModelList.isNotEmpty @@ -272,28 +655,90 @@ class _BloodDonationPageState extends State { ), ), ), - DefaultButton( - TranslationBase.of(context).save, - checkedValue - ? () async { - if (_selectedHospital == null) { - AppToast.showErrorToast(message: TranslationBase.of(context).selectCity); - return; - } - bloodDetails.city = _selectedHospital.description; - bloodDetails.cityCode = _selectedHospital.iD.toString(); - bloodDetails.gender = _selectedGenderIndex; - bloodDetails.bloodGroup = getBlood(_selectedBloodTypeIndex); - await model.updateBloodGroup(bloodDetails); - if (model.state == ViewState.Idle) { - AppToast.showSuccessToast(message: model.updatedRegisterBloodMessage); - } else { - AppToast.showErrorToast(message: model.error); - } - } - : null, - disabledColor: CustomColors.grey2, - ).insideContainer + Container( + color: CustomColors.appBackgroudGreyColor, + margin: EdgeInsets.all(14), + height: 45.0, + child: Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Expanded( + flex: 1, + child: ButtonTheme( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10.0), + ), + height: 45.0, + child: CustomTextButton( + backgroundColor: CustomColors.green, + elevation: 0, + onPressed: () { + Navigator.push(context, FadePage(page: BloodDonationBookAppointment())); + }, + child: Text(TranslationBase.of(context).bookAppo.toUpperCase(), + style: TextStyle( + fontSize: 16.0, + color: Colors.white, + )), + ), + ), + ), + mWidth(7), + Expanded( + flex: 1, + child: ButtonTheme( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10.0), + ), + height: 45.0, + child: CustomTextButton( + backgroundColor: Color(0xffc5272d), + elevation: 0, + onPressed: () async { + if (_selectedHospital == null) { + AppToast.showErrorToast(message: TranslationBase.of(context).selectCity); + return; + } + bloodDetails.city = _selectedHospital.description; + bloodDetails.cityCode = _selectedHospital.iD.toString(); + bloodDetails.gender = _selectedGenderIndex; + bloodDetails.bloodGroup = getBlood(_selectedBloodTypeIndex); + await model.updateBloodGroup(bloodDetails); + if (model.state == ViewState.Idle) { + AppToast.showSuccessToast(message: model.updatedRegisterBloodMessage); + } else { + AppToast.showErrorToast(message: model.error); + } + }, + child: Text(TranslationBase.of(context).save.toUpperCase(), style: TextStyle(fontSize: 16.0, color: Colors.white)), + ), + ), + ), + ], + ), + ), + // DefaultButton( + // TranslationBase.of(context).save, + // checkedValue + // ? () async { + // if (_selectedHospital == null) { + // AppToast.showErrorToast(message: TranslationBase.of(context).selectCity); + // return; + // } + // bloodDetails.city = _selectedHospital.description; + // bloodDetails.cityCode = _selectedHospital.iD.toString(); + // bloodDetails.gender = _selectedGenderIndex; + // bloodDetails.bloodGroup = getBlood(_selectedBloodTypeIndex); + // await model.updateBloodGroup(bloodDetails); + // if (model.state == ViewState.Idle) { + // AppToast.showSuccessToast(message: model.updatedRegisterBloodMessage); + // } else { + // AppToast.showErrorToast(message: model.error); + // } + // } + // : null, + // disabledColor: CustomColors.grey2, + // ).insideContainer ], ), ), diff --git a/lib/pages/Blood/blood_donation_appointment_terms_conditions.dart b/lib/pages/Blood/blood_donation_appointment_terms_conditions.dart new file mode 100644 index 00000000..54c7a336 --- /dev/null +++ b/lib/pages/Blood/blood_donation_appointment_terms_conditions.dart @@ -0,0 +1,43 @@ +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_html/flutter_html.dart'; +import 'package:provider/provider.dart'; + +class BloodDonationAppointmentTermsConditions extends StatelessWidget { + String contentEN = + ' DONOR EDUCATION

                                 

DONOR EDUCATION

Why Should I Give Blood?

Because You Can Make a Difference!

Learning more about blood donation and knowing

DEAR DONOR:

This information sheet explains how YOU can help us make the donation process safe for yourself and patients who might receive your blood.

 

PLEASE READ THIS INFORMATION BEFORE YOU DONATE!

ACCURACY & HONESTY ARE ESSENTIAL!

Your complete honesty in answering all questions is very important for the safety of patients who receive your blood. All information you provide is confidential.

 

DONATION RISKS (These are not common 1-2%) Some of the risks and/or problems associated with donating include: dizziness or lightheadedness, nausea and/or vomiting, rapid pulse rate, Itching at the site from an allergy to iodine, bruising (hematoma), pain at the site.

 

  1. DONOR ELIGIBILITY

YOU MAY DONATE :

  1.          If  you are 18 years old or older (17 with parental permission) and weigh at least 110 pounds (50 kg)
  2.          If  you are in good health
  3.          Have not donated whole blood in the past 8 weeks
  4.          Have not donated double red cells in the past 16 weeks

YOU MAY NOT DONATE IF YOU:

  1.          Have had AIDS or a Positive HIV test
  2.          Have participated in activities that put you at risk for acquiring AIDS.

 

Why we ask questions about sexual contact (as required by federal regulations)

Sexual contact may cause contagious diseases like HIV to get into the blood stream and be spread through transfusions to someone else.

PLEASE DO NOT DONATE TO GET AN HIV TEST DONE

  1. DONATION PROCESS
  1.       Registration: PHOTO ID must be presented prior to donation to identify you at every donation.
  2.       Interview: to determine if you are all right to donate we will:
  • Ask questions about health, travel and medicines.
  • Ask questions to see if you might be at risk for hepatitis, HIV or AIDS
  1.       Mini-physical Examination
  • Take your blood pressure, pulse, temperature, weight.
  • Take a small blood sample to make sure your Hemoglobin level is normal.
  1.      Phlebotomy
  • You will be seated in a donor chair, a tourniquet will be applied to your arm, and a suitable vein located.
  • The site will be cleaned with an antiseptic
  • A sterile needle will be gently inserted into your vein and the blood will be collected in a sterile bag for 5-15 minutes
  • After donation, a pressure bandage will be applied to the site and you may rest and enjoy some refreshments.

 

WHAT HAPPENS AFTER YOUR DONATION?

 

  1. Your blood is tested for: HepatitisB and C, HIV, HTLV (associated with a virus that causes    leukemia), Syphilis, Malaria, Sickling and Blood Type.
  2. There are certain conditions like in Emergency situation; there is a chance that your unit is released without completion of infectious disease testing.
  3. If your blood tests Positive it will not be given to a patient. Your blood will be discarded.
  4. You will be notified about test results that may disqualify you from donating in the future. Since confirmatory tests are necessary, it may take up few days before notification.
  5. If your blood tests Positive, your name will be put on a confidential list of Deferred Donors. When required, Blood Bank will report your donor information, including test result, to health departments and regulatory agencies as required by law.
  6. To ensure confidentiality, NO test results (including blood type) will be given by phone. Written approval from you will be required before test results are released.

 

CARE AFTER DONATING

 

When you donate blood, your body needs a few minutes to adjust to the slight change in blood fluid volume. It is important to follow these instructions:

  1. Remain lying on the donor chair until a staff member releases you to the refreshment area.
  2. Remain in the refreshment area for at least 10 minutes. Enjoy juice and a snack. If you cannot stay, please notify donor room staff.
  3. Drink more fluid than usual and eat heartily for today.
  4. Avoid smoking for 2 hours
  5. Refrain from strenuous exercise for 24 hours. If safety risks are a normal part of your routine, ask a donor room staff member how long you should wait before resuming regular activities.
  6. If you become light-headed or dizzy, lie down until the feeling disappears. If the feeling continues, contact Blood Bank or your physician.
  7. Leave your bandage in place for 4 to 5 hours. This will help to prevent bruising. If your arm starts bleeding again, apply direct pressure and elevate your arm.
  8. Make sure you’re eating a nutritious, well-balance diet containing foods rich in iron and high in vitamin C.
  9. However, if you are a frequent donor, iron rich foods in your diet may not be enough to replenish the iron you routinely lose through blood donations. We recommend you to consult with your health-care provider to see if taking an iron supplement is right for you.

 

If after donating, you realize that you should not have donated because of previous Risk Factors, behaviors, or diseases, YOUR BLOOD MUST NOT BE USED FOR TRANSFUSION!

PLEASE CONTACT Blood Bank IMMEDIATELY.

 

 

 

If you become ill within the next 72 hours, or think of any reason your blood should not be transfused, Please call Blood Bank at +966-11-4833672 or Ext 3662.

 

 

 

 

THANK YOU FOR GIVING

THE GIFT OF LIFE!

 

 

 

BB Form 091 - Donor Education Material (English)          HMG/QID/1892

'; + + String contentAR = + '

ﺗﺜﻘﯿﻒ اﻟﻤﺘﺒﺮع

لماذا علي أن أتبرع بالدم؟ أنك تستطیع أن تحدث فرق تعلم أكثر عن التبرع بالدم


ﻣﺎذا ﯾﺤﺪث ﺑﻌﺪ اﻟﺘﺒﺮع ﺑﺎﻟﺪم؟

-1 ﯾﺘﻢ ﻓﺤﺺ اﻻﯾﺪز ، ﻓﯿﺮوس اﻟﻜﺒﺪ اﻟﻮﺑﺎﺋﻲ ب و ج ، ﻓﯿﺮوس ﻛﺮﯾﺎت اﻟﺪم اﻟﺒﯿﻀﺎء )ﻣﺮﺗﺒﻂ ﺑﻔﯿﺮوس ﺗﺴﺒﺐ ﺳﺮطﺎن اﻟﺪم(

،اﻟﺰھﺮي ، اﻻﻧﯿﻤﯿﺎ اﻟﻤﻨﺠﻠﯿﺔ ،ﻓﺼﯿﻠﺔ اﻟﺪم و اﻻﺟﺴﺎم اﻟﻤﻀﺎدة.

-2 ﻓﻲ ﺣﺎل اﻟﻨﺘﯿﺠﺔ ﻛﺎﻧﺖ اﯾﺠﺎﺑﯿﺔ ﻻي ﻣﺮض ﻣﻦ اﻷﻣﺮاض اﻟﺴﺎﺑﻘﺔ ﻧﻘﻮم ﺑﺎﻟﺘﺨﻠﺺ ﻣﻦ اﻟﺪم ﻣﺒﺎﺷﺮة وﻻ ﯾﻌﻄﻰ ﻟﻠﻤﺮﯾﺾ وﯾﺘﻢ

اﺑﻼغ اﻟﻤﺘﺒﺮع ﻷﺧﺬ ﻋﯿﻨﺔ اﺧﺮى ﻟﻠﺘﺄﻛﺪ . وﻓﻲ ﺣﺎل وﺟﻮد ﻣﺮض ﯾﻤﻨﻊ اﻟﺘﺒﺮع ﻓﻲ اﻟﻤﺴﺘﻘﺒﻞ وﯾﺘﻢ اﺑﻼغ اﻟﻤﺘﺒﺮع.

-3 ﻓﻲ ﺣﺎل وﺟﻮد ﻣﺮض ﯾﻤﻨﻊ ﻣﻦ اﻟﺘﺒﺮع ﻣﺴﺘﻘﺒﻼ ﯾﺴﺠﻞ اﺳﻢ اﻟﻤﺘﺒﺮع ﻓﻲ ﻗﺎﺋﻤﺔ اﻟﻤﺘﺒﺮﻋﯿﻦ اﻟﻤﺮﻓﻮﺿﯿﯿﻦ ﻟﺪى ﺑﻨﻚ اﻟﺪم ﻣﻊ

ﻣﻌﻠﻮﻣﺎﺗﮫ وﻧﺘﯿﺠﺔ اﻟﻔﺤﺺ وﺗﻌﻄﻲ اﻟﻤﻌﻠﻮﻣﺎت ﻟﻠﺠﮭﺎت اﻟﻤﺨﺘﺼﺔ إذا طُﻠﺒﺖ ﻗﺎﻧﻮﻧﯿﺎً.

-4 ﻟﺴﺮﯾﺔ ﻧﺘﺎﺋﺞ اﻟﻔﺤﻮﺻﺎت ﺗﻌﻄﻲ اي ﻧﺘﯿﺠﺔ ﺑﺎﻟﮭﺎﺗﻒ وﯾﺠﺐ ﺣﻀﻮر اﻟﻤﺮﯾﺾ ﻣﻊ اﺛﺒﺎﺗﮫ ﻷﺧﺬ اﻟﻨﺘﯿﺠﺔ.

اﺣﺘﯿﺎطﺎت اﻟﺴﻼﻣﺔ ﺑﻌﺪ اﻟﺘﺒﺮع:

ﺑﻌﺪ اﻟﺘﺒﺮع ﺑﺎﻟﺪم ﺟﺴﻤﻚ ﯾﺤﺘﺎج ﻟﺒﻌﺾ اﻟﻮﻗﺖ ﻟﻠﺮاﺣﺔ ﻟﯿﺘﻢ ﺿﺒﻂ اﻟﺘﻐﯿﺮ ﻓﻲ اﻟﺴﻮاﺋﻞ اﻟﺪم ﻟﺬﻟﻚ ﻧﺮﺟﻮ اﺗﺒﺎع اﻻرﺷﺎدات

اﻟﺘﺎﻟﯿﺔ:

 

ﺑﻌﺪ اﻟﺘﺒﺮع ﻣﺒﺎﺷﺮة ﺗﻐﺎدر ﻛﺮﺳﻲ اﻟﺘﺒﺮع اﻻﺑﻌﺪ ارﺷﺎدك ﻣﻦ ﻗﺒﻞ اﻟﻌﺎﻣﻠﯿﻦ ﻟﺘﺠﻠﺲ ﻓﻲ ﻣﻜﺎن

-1

ﻣﺨﺼﺺ ﻟﻠﺮاﺣﺔ

 

اﻟﺠﻠﻮس ﻓﻲ اﻟﻤﻜﺎن اﻟﻤﺨﺼﺺ ﻟﻠﺮاﺣﺔ ﻟﻤﺪة 10 دﻗﺎﺋﻖ ﻣﻊ ﺷﺮب اﻟﻌﺼﯿﺮ واﻟﻤﺎء وﻓﻲ ﺣﺎل رﻏﺒﺘﻚ

-2

ﺑﺎﻟﻤﻐﺎدرة اﻟﺮﺟﺎء اﺧﺒﺎر أﺣﺪ اﻟﻌﺎﻣﻠﯿﻦ.

 

اﻟﺮﺟﺎء ﺷﺮب ﻛﻤﯿﺔ ﻛﺒﯿﺮة ﻣﻦ اﻟﺴﻮاﺋﻞ أﻛﺜﺮ ﻣﻦ اﻟﻤﻌﺘﺎد وﺗﻨﺎول طﻌﺎم ﺻﺤﻲ ﻟﺬﻟﻚ اﻟﯿﻮم.

-3

ﺗﺠﻨﺐ اﻟﺘﺪﺧﯿﻦ ﻟﻤﺪة ﺳﺎﻋﺘﯿﻦ ﺑﻌﺪ اﻟﺘﺒﺮع.

-4

ﺗﺠﻨﺐ اﻻﺟﮭﺎد أو اﻟﻨﺸﺎطﺎت اﻟﻘﻮﯾﺔ ﻟﻤﺪة 24 ﺳﺎﻋﺔ، اﻣﺎ إذا ﻛﺎن ﻟﺪﯾﻚ ﻧﺸﺎطﺎت آﻣﻨﺔ ﺑﺼﻮرة دورﯾﺔ

-5

اﻟﺮﺟﺎء اﻻﺳﺘﻔﺴﺎر ﻣﻦ اﻟﻌﺎﻣﻠﯿﻦ ﻓﻲ وﺣﺪة اﻟﺘﺒﺮع ﺑﺎﻟﺪم.

 

ﻟﻮ ﺷﻌﺮت ﺑﺎﻟﺪوار ﺑﻌﺪ ﻣﻐﺎدرﺗﻚ وﺣﺪة اﻟﺘﺒﺮع ﯾﺠﺐ وﺿﻊ رأﺳﻚ إﻟﻰ اﻻﺳﻔﻞ وﻗﺪﻣﯿﻚ إﻟﻰ اﻷﻋﻠﻰ

-6

ﺣﺘﻰ ﺗﺸﻌﺮ ﺑﺎﻟﺮاﺣﺔ وﻓﻲ ﺣﺎﻟﺔ ﻋﺪم ﺷﻌﻮرك ﺑﺎﻟﺮاﺣﺔ اﻟﺮﺟﺎء اﻟﺘﻮاﺻﻞ ﻣﻊ وﺣﺪة اﻟﺘﺒﺮع ﺑﺎﻟﺪم أو

 

اﻟﺘﺤﺪث ﻣﻊ طﺒﯿﺒﻚ.

 

اﺳﺤﺐ اﻟﻠﺼﻘﺔ ﻣﻦ ﻣﻜﺎن اﻟﺘﺒﺮع ﺑﻌﺪ 4 إﻟﻰ 5 ﺳﺎﻋﺎت ﻣﻦ اﻟﺘﺒﺮع ﻟﺘﺠﻨﺐ ﻧﺰﯾﻒ اﻟﺪم وإذا ﻧﺰف اﻟﺪم

-7

ﻗﻢ ﺑﻮﺿﻌﮭﺎ ﻓﻲ ﻣﻜﺎﻧﮭﺎ ﻣﺮة اﺧﺮى وارﻓﻊ ﯾﺪك إﻟﻰ اﻻﻋﻠﻰ.

 

اﺣﺮص ﻋﻠﻰ اﻟﺤﺼﻮل ﻋﻠﻰ وﺟﺒﺎت ﻏﻨﯿﺔ وﺻﺤﯿﺔ وإذا ﻛﻨﺖ ﺗﺘﺒﻊ ﺣﻤﯿﺔ ﻏﺬاﺋﯿﺔ اﺣﺮص ﻋﻠﻰ أن

-8

ﺗﻜﻮن ﺣﻤﯿﺘﻚ ﻣﺤﺘﻮﯾﺔ ﻋﻠﻰ ﻧﺴﺒﺔ ﻋﺎﻟﯿﺔ ﻣﻦ اﻟﺤﺪﯾﺪ وﻓﯿﺘﺎﻣﯿﻦ ﺳﻲ، ﻋﻠﻰ ﻛﻞ ﺣﺎل إذا ﻛﻨﺖ ﻣﻦ

 

اﻟﻤﺘﺒﺮﻋﯿﻦ اﻟﺪاﺋﻤﯿﻦ ﻓﺈن ﺣﻤﯿﺘﻚ اﻟﻐﺬاﺋﯿﺔ ﻗﺪ ﻻﺗﻜﻮن ﻛﺎﻓﯿﺔ ﻟﺘﻌﻮﯾﺾ ﺟﺴﻤﻚ ﻣﺎ ﯾﻔﻘﺪه ﻣﻦ ﺣﺪﯾﺪ ﻋﻨﺪ

 

ﺗﺒﺮﻋﻚ ﺑﺎﻟﺪم وﻧﻨﺼﺤﻚ ﺑﻤﺮاﺟﻌﺔ أﺧﺼﺎﺋﻲ اﻟﺮﻋﺎﯾﺔ اﻟﺼﺤﯿﺔ ﻟﯿﻘﺮر إذا ﻛﻨﺖ ﺗﺤﺘﺎج إﻟﻰ ﻣﻜﻤﻞ ﻏﺬاﺋﻲ

 

ﻣﺤﺘﻮي ﻋﻠﻰ اﻟﺤﺪﯾﺪ.

 

إذا أدرﻛﺖ ﺑﻌﺪ اﻟﺘﺒﺮع أﻧﻚ ﻗﺪ ﻗﻤﺖ ﺑﻨﺸﺎطﺎت أو ﺗﻌﺮﺿﺖ ﻷﻣﺮاض أو ﺳﻠﻮك ﯾﻤﻨﻌﻚ ﻣﻦ اﻟﺘﺒﺮع ﻧﺮﺟﻮ اﻻﺗﺼﺎل

ﺑﺒﻨﻚ اﻟﺪم ﻟﻌﻤﻞ اﻻﺣﺘﯿﺎطﺎت اﻟﻼزﻣﺔ ﻟﻤﻨﻊ ﻧﻘﻞ دﻣﻚ ﻻي ﻣﺮﯾﺾ. وﻟﻮ ﺷﻌﺮت ﺑﻌﺪ 72ﺳﺎﻋﺔ أﻧﻚ ﺑﺤﺎﻟﺔ ﻏﯿﺮ ﺟﯿﺪة أو دﻣﻚ ﯾﺠﺐ أن ﯾﻌﻄﻰ ﻻي ﻣﺮﯾﺾ ﻻي ﺳﺒﺐ ﻣﻦ اﻷﺳﺒﺎب

ﯾﺠﺐ اﻻﺗﺼﺎل ﺑﺒﻨﻚ اﻟﺪم

(+966114833672)واﻟﺘﺤﻮﯾﻠﺔ ھﻲ 3662

ﺷﻜﺮا ﻟﻌﻄﺎﺋﻚ..

ﻓﻌﻄﺎﺋﻚ ھﻮ ﺣﯿﺎة..

 

'; + + ProjectViewModel projectViewModel; + + @override + Widget build(BuildContext context) { + projectViewModel = Provider.of(context); + return AppScaffold( + isShowAppBar: true, + showNewAppBar: true, + backgroundColor: Color(0xffF7F7F7), + showNewAppBarTitle: true, + description: TranslationBase.of(context).bloodDonationInfo, + appBarTitle: TranslationBase.of(context).bloodD, + body: SingleChildScrollView( + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Html( + data: projectViewModel.isArabic ? contentAR : contentEN, + shrinkWrap: true, + ) + ], + ), + ), + ), + ); + } +} diff --git a/lib/pages/Blood/blood_donation_book_appointment.dart b/lib/pages/Blood/blood_donation_book_appointment.dart new file mode 100644 index 00000000..dd3fd6db --- /dev/null +++ b/lib/pages/Blood/blood_donation_book_appointment.dart @@ -0,0 +1,502 @@ +import 'package:diplomaticquarterapp/core/model/blooddonation/blood_donation_free_slots_response.dart'; +import 'package:diplomaticquarterapp/core/model/blooddonation/blood_donation_projects_list_response.dart'; +import 'package:diplomaticquarterapp/core/service/blood/blood_donation_service.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/models/Appointments/FreeSlot.dart'; +import 'package:diplomaticquarterapp/models/Appointments/timeSlot.dart'; +import 'package:diplomaticquarterapp/pages/Blood/blood_donation_appointment_terms_conditions.dart'; +import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/custom_text_button.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; +import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; +import 'package:diplomaticquarterapp/widgets/dialogs/radio_selection_dialog.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; +import 'package:flutter/material.dart'; +import 'package:intl/intl.dart'; +import 'package:provider/provider.dart'; +import 'package:syncfusion_flutter_calendar/calendar.dart'; + +import '../AlHabibMedicalService/h2o/h20_setting.dart'; + +class BloodDonationBookAppointment extends StatefulWidget { + const BloodDonationBookAppointment(); + + static bool areSlotsAvailable = false; + static DateTime selectedAppoDateTime; + static String selectedDate; + static String selectedTime; + + @override + State createState() => _BloodDonationBookAppointmentState(); +} + +class _BloodDonationBookAppointmentState extends State with TickerProviderStateMixin { + Map _events; + AnimationController _animationController; + CalendarController _calendarController; + + List bloodDonationProjectsListResponse = []; + int _selectedProjectID = 0; + int _clinicID = 0; + int _doctorID = 0; + + String selectedProjectName = ""; + + List docFreeSlots = []; + List dayEvents = []; + + var selectedDate = ""; + dynamic selectedDateJSON; + dynamic jsonFreeSlots; + + int selectedButtonIndex = 0; + + List bloodDonationFreeSlotsResponse = []; + + ProjectViewModel projectViewModel; + ScrollController _scrollController; + + var checkedValue = false; + + @override + void initState() { + final _selectedDay = DateTime.now(); + super.initState(); + + _events = { + _selectedDay: ['Event A0'] + }; + + _scrollController = new ScrollController(); + + _calendarController = CalendarController(); + _animationController = AnimationController( + vsync: this, + duration: const Duration(milliseconds: 50), + ); + + WidgetsBinding.instance.addPostFrameCallback((_) { + getBloodDonationProjectsList(); + }); + } + + @override + Widget build(BuildContext context) { + projectViewModel = Provider.of(context); + return AppScaffold( + isShowAppBar: true, + showNewAppBar: true, + backgroundColor: Color(0xffF7F7F7), + showNewAppBarTitle: true, + isShowDecPage: true, + description: TranslationBase.of(context).bloodDonationInfo, + appBarTitle: TranslationBase.of(context).bloodD, + body: SingleChildScrollView( + child: Padding( + padding: EdgeInsets.all(21), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text(TranslationBase.of(context).selectHospitalBloodDonation, style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.w600, letterSpacing: -0.64)), + mHeight(12), + CommonDropDownView( + TranslationBase.of(context).selectProject, + selectedProjectName, + () { + List list = []; + bloodDonationProjectsListResponse.forEach((element) { + list.add(RadioSelectionDialogModel(element.projectName, element.projectID)); + }); + showDialog( + context: context, + builder: (cxt) => RadioSelectionDialog( + listData: list, + selectedIndex: 0, + onValueSelected: (index) { + print(index); + _selectedProjectID = index; + selectedProjectName = bloodDonationProjectsListResponse.firstWhere((element) => element.projectID == index).projectName; + getBloodDonationFreeSlots(); + setState(() {}); + }, + ), + ); + }, + ).withBorderedContainer, + mHeight(12), + Container( + decoration: cardRadius(12), + child: _buildTableCalendarWithBuilders(projectViewModel), + ), + mHeight(12), + Text(selectedDate, style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.w600, letterSpacing: -0.64)), + mHeight(8), + BloodDonationBookAppointment.areSlotsAvailable + ? Container( + height: 40, + child: ListView.builder( + controller: _scrollController, + scrollDirection: Axis.horizontal, + itemCount: dayEvents.length, + itemBuilder: (context, index) { + return Container( + margin: EdgeInsets.only(right: (index == dayEvents.length - 1) ? 0 : 5.0, left: index == 0 ? 0 : 5), + child: ButtonTheme( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(5.0), + side: BorderSide( + color: index == selectedButtonIndex ? CustomColors.green : Colors.black, //Color of the border + style: BorderStyle.solid, //Style of the border + width: 1.5, //width of the border + ), + ), + minWidth: MediaQuery.of(context).size.width * 0.2, + child: index == selectedButtonIndex ? getSelectedButton(index) : getNormalButton(index)), + ); + }, + ), + ) + : Center( + child: Padding( + padding: const EdgeInsets.only(left: 12.0, right: 12.0), + child: Text(TranslationBase.of(context).noSlotsError, style: TextStyle(fontSize: 14.0, fontWeight: FontWeight.w600, letterSpacing: -0.46, color: CustomColors.grey)), + ), + ), + SizedBox(height: 16), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + TranslationBase.of(context).viewTermsConditions + ":", + style: TextStyle(fontWeight: FontWeight.w600, color: Color(0xff2E303A), fontSize: 14, letterSpacing: -0.56), + ), + InkWell( + onTap: () { + Navigator.of(context).push(FadePage(page: BloodDonationAppointmentTermsConditions())); + }, + child: Text( + TranslationBase.of(context).clickHere, + style: TextStyle(fontWeight: FontWeight.w600, color: Colors.blue, fontSize: 14, letterSpacing: -0.56), + ), + ) + ], + ), + SizedBox(height: 12), + Row( + children: [ + Checkbox( + onChanged: (bool value) { + setState(() { + checkedValue = value; + }); + }, + value: checkedValue, + activeColor: Color(0xFFc5272d), + ), + Text( + TranslationBase.of(context).iAgreeToTheTermsAndConditions, + style: TextStyle(fontSize: 14.0, fontWeight: FontWeight.bold), + ), + ], + ), + ], + ), + ), + ), + bottomSheet: Container( + color: Colors.white, + height: MediaQuery.of(context).size.height * 0.081, + width: double.infinity, + padding: EdgeInsets.all(12.0), + child: Column( + children: [ + Container( + width: MediaQuery.of(context).size.width * 0.9, + child: DefaultButton( + TranslationBase.of(context).bookAppo, + () async { + if (BloodDonationBookAppointment.areSlotsAvailable) { + if (checkedValue) { + insertBloodDonationAppointment(); + } else { + AppToast.showErrorToast(message: TranslationBase.of(context).pleaseAcceptTerms); + } + } else { + AppToast.showErrorToast(message: TranslationBase.of(context).selectSlot); + } + }, + textColor: Colors.white, + color: CustomColors.green, + ), + ), + ], + ), + ), + ); + } + + void insertBloodDonationAppointment() { + DoctorsListService service = new DoctorsListService(); + final timeSlot = BloodDonationBookAppointment.selectedAppoDateTime; + GifLoaderDialogUtils.showMyDialog(context); + service + .insertAppointment(_doctorID, _clinicID, _selectedProjectID, BloodDonationBookAppointment.selectedTime, BloodDonationBookAppointment.selectedDate, 45, projectViewModel.isArabic ? 1 : 2, + context, null, null, null, projectViewModel) + .then((res) { + GifLoaderDialogUtils.hideDialog(context); + if (res['MessageStatus'] == 1) { + AppToast.showSuccessToast(message: TranslationBase.of(context).bookedSuccess); + Navigator.of(context).pop(); + } else { + ConfirmDialog dialog = new ConfirmDialog( + context: context, + confirmMessage: res['ErrorEndUserMessage'], + okText: TranslationBase.of(context).ok, + cancelText: TranslationBase.of(context).cancel_nocaps, + okFunction: () async { + // openAppSettings(); + Navigator.pop(context); + }, + cancelFunction: () => {}); + dialog.showAlertDialog(context); + // AppToast.showErrorToast(message: res['ErrorEndUserMessage']); + } + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + ConfirmDialog dialog = new ConfirmDialog( + context: context, + confirmMessage: err, + okText: TranslationBase.of(context).ok, + cancelText: TranslationBase.of(context).cancel_nocaps, + okFunction: () async { + // openAppSettings(); + Navigator.pop(context); + }, + cancelFunction: () => {}); + dialog.showAlertDialog(context); + }); + } + + void _onDaySelected(DateTime day, ProjectViewModel projectViewModel) { + final DateFormat formatter = DateFormat('yyyy-MM-dd'); + setState(() { + this.selectedDate = DateUtil.getWeekDayMonthDayYearDateFormatted(day, projectViewModel.isArabic ? "ar" : "en"); + openTimeSlotsPickerForDate(day, docFreeSlots); + BloodDonationBookAppointment.selectedDate = formatter.format(day); + _calendarController.selectedDate = day; + print(BloodDonationBookAppointment.selectedDate); + }); + } + + Widget _buildTableCalendarWithBuilders(ProjectViewModel projectViewModel) { + return SfCalendar( + controller: _calendarController, + minDate: DateTime.now(), + showNavigationArrow: true, + headerStyle: CalendarHeaderStyle(textAlign: TextAlign.center, textStyle: TextStyle(fontSize: 14.0, fontWeight: FontWeight.w600, letterSpacing: -0.46)), + viewHeaderStyle: ViewHeaderStyle(dayTextStyle: TextStyle(fontSize: 12.0, fontWeight: FontWeight.w600, letterSpacing: -0.46, color: CustomColors.black)), + view: CalendarView.month, + todayHighlightColor: CustomColors.green, + selectionDecoration: containerColorRadiusBorderWidthCircular(Colors.transparent, 4, CustomColors.green, 2.5), + cellBorderColor: Colors.white, + dataSource: MeetingDataSource(_getDataSource()), + monthViewSettings: const MonthViewSettings(appointmentDisplayMode: MonthAppointmentDisplayMode.indicator, showTrailingAndLeadingDates: false, appointmentDisplayCount: 1), + onTap: (CalendarTapDetails details) { + _calendarController.selectedDate = details.date; + _onDaySelected(details.date, projectViewModel); + }, + ); + } + + Widget getNormalButton(int index) { + return CustomTextButton( + backgroundColor: Colors.white, + elevation: 0, + side: BorderSide( + color: Colors.black, //Color of the border + style: BorderStyle.solid, //Style of the border + width: 1.5 //width of the border + ), + onPressed: () { + final timeslot = dayEvents[index]; + BloodDonationBookAppointment.selectedAppoDateTime = timeslot.end; + + setState(() { + selectedButtonIndex = index; + BloodDonationBookAppointment.selectedTime = dayEvents[index].isoTime; + print(BloodDonationBookAppointment.selectedTime); + }); + }, + child: Text(dayEvents[index].isoTime, style: TextStyle(fontSize: 12.0, color: Color(0xFF60686b))), + ); + } + + Widget getSelectedButton(int index) { + return CustomTextButton( + backgroundColor: CustomColors.green, + elevation: 0, + side: BorderSide( + color: CustomColors.green, //Color of the border + style: BorderStyle.solid, //Style of the border + width: 1.5 //width of the border + ), + onPressed: () { + setState(() { + selectedButtonIndex = index; + BloodDonationBookAppointment.selectedTime = dayEvents[index].isoTime; + print(BloodDonationBookAppointment.selectedTime); + }); + }, + child: Text(dayEvents[index].isoTime, style: TextStyle(fontSize: 12.0, color: Colors.white)), + ); + } + + getBloodDonationFreeSlots() { + BloodDonationService service = new BloodDonationService(); + GifLoaderDialogUtils.showMyDialog(context); + service.getBloodDonationFreeSlots(134, _selectedProjectID).then((res) { + GifLoaderDialogUtils.hideDialog(context); + if (res["MessageStatus"] == 1) { + res['BD_FreeSlots'].forEach((element) { + bloodDonationFreeSlotsResponse.add(BloodDonationFreeSlotsResponseModel.fromJson(element)); + }); + print(bloodDonationFreeSlotsResponse.length); + _getJSONSlots().then((value) => { + setState(() => {_clinicID = bloodDonationFreeSlotsResponse[0].clinicID, _doctorID = bloodDonationFreeSlotsResponse[0].doctorID, _events.clear(), _events = value}) + }); + } else { + AppToast.showErrorToast(message: res["ErrorEndUserMessage"]); + } + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + print(err); + }); + } + + openTimeSlotsPickerForDate(DateTime dateStart, List freeSlots) { + dayEvents.clear(); + DateTime dateStartObj = new DateTime(dateStart.year, dateStart.month, dateStart.day, 0, 0, 0, 0, 0); + + freeSlots.forEach((v) { + if (v.start == dateStartObj) dayEvents.add(v); + }); + + setState(() { + if (dayEvents.length != 0) { + BloodDonationBookAppointment.areSlotsAvailable = true; + selectedButtonIndex = 0; + BloodDonationBookAppointment.selectedTime = dayEvents[selectedButtonIndex].isoTime; + } else + BloodDonationBookAppointment.areSlotsAvailable = false; + }); + } + + Future> _getJSONSlots() async { + Map _eventsParsed; + List slotsList = []; + DateTime date; + final DateFormat formatter = DateFormat('HH:mm'); + final DateFormat dateFormatter = DateFormat('yyyy-MM-dd'); + for (var i = 0; i < bloodDonationFreeSlotsResponse.length; i++) { + date = DateUtil.convertStringToDate(bloodDonationFreeSlotsResponse[i].freeTimeSlots); + slotsList.add(FreeSlot(date, ['slot'])); + docFreeSlots.add(TimeSlot(isoTime: formatter.format(date), start: new DateTime(date.year, date.month, date.day, 0, 0, 0, 0), end: date)); + } + _eventsParsed = Map.fromIterable(slotsList, key: (e) => e.slot, value: (e) => e.event); + setState(() { + BloodDonationBookAppointment.selectedDate = dateFormatter.format(DateUtil.convertStringToDate(bloodDonationFreeSlotsResponse[0].freeTimeSlots)); + selectedDate = DateUtil.getMonthDayYearDateFormatted(DateUtil.convertStringToDate(bloodDonationFreeSlotsResponse[0].freeTimeSlots)); + selectedDateJSON = bloodDonationFreeSlotsResponse[0].freeTimeSlots; + }); + openTimeSlotsPickerForDate(DateUtil.convertStringToDate(selectedDateJSON), docFreeSlots); + _calendarController.selectedDate = DateUtil.convertStringToDate(selectedDateJSON); + return _eventsParsed; + } + + getBloodDonationProjectsList() { + BloodDonationService service = new BloodDonationService(); + GifLoaderDialogUtils.showMyDialog(context); + service.getBloodDonationProjectsList().then((res) { + GifLoaderDialogUtils.hideDialog(context); + print(res['BD_getProjectsHaveBDClinics']); + if (res["MessageStatus"] == 1) { + res['BD_getProjectsHaveBDClinics'].forEach((element) { + bloodDonationProjectsListResponse.add(BloodDonationProjectsListResponse.fromJson(element)); + }); + print(bloodDonationProjectsListResponse.length); + } else { + AppToast.showErrorToast(message: res["ErrorEndUserMessage"]); + } + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + print(err); + }); + } + + List _getDataSource() { + final List meetings = []; + _events.forEach((key, value) { + final DateTime startTime = DateTime(key.year, key.month, key.day, 9, 0, 0); + final DateTime endTime = startTime.add(const Duration(minutes: 20)); + meetings.add(Meeting("", startTime, endTime, CustomColors.green, false)); + }); + return meetings; + } +} + +class MeetingDataSource extends CalendarDataSource { + MeetingDataSource(List source) { + appointments = source; + } + + @override + DateTime getStartTime(int index) { + return _getMeetingData(index).from; + } + + @override + DateTime getEndTime(int index) { + return _getMeetingData(index).to; + } + + @override + String getSubject(int index) { + return _getMeetingData(index).eventName; + } + + @override + Color getColor(int index) { + return _getMeetingData(index).background; + } + + @override + bool isAllDay(int index) { + return _getMeetingData(index).isAllDay; + } + + Meeting _getMeetingData(int index) { + final dynamic meeting = appointments[index]; + Meeting meetingData; + if (meeting is Meeting) { + meetingData = meeting; + } + return meetingData; + } +} + +class Meeting { + Meeting(this.eventName, this.from, this.to, this.background, this.isAllDay); + + String eventName; + DateTime from; + DateTime to; + Color background; + bool isAllDay; +} diff --git a/lib/pages/MyAppointments/AppointmentDetails.dart b/lib/pages/MyAppointments/AppointmentDetails.dart index 362320eb..ed1f9b31 100644 --- a/lib/pages/MyAppointments/AppointmentDetails.dart +++ b/lib/pages/MyAppointments/AppointmentDetails.dart @@ -120,6 +120,7 @@ class _AppointmentDetailsState extends State with SingleTick widget.appo.clinicID == 47 || widget.appo.clinicID == 23 || widget.appo.clinicID == 265 || + widget.appo.clinicID == 134 || widget.appo.isExecludeDoctor || widget.appo.isLiveCareAppointment) ? false @@ -157,6 +158,7 @@ class _AppointmentDetailsState extends State with SingleTick widget.appo.clinicID == 23 || widget.appo.clinicID == 253 || widget.appo.clinicID == 265 || + widget.appo.clinicID == 134 || widget.appo.isExecludeDoctor || widget.appo.isLiveCareAppointment) { _tabController.index = _tabController.previousIndex; diff --git a/lib/pages/MyAppointments/widgets/AppointmentActions.dart b/lib/pages/MyAppointments/widgets/AppointmentActions.dart index 0135ac19..474e3333 100644 --- a/lib/pages/MyAppointments/widgets/AppointmentActions.dart +++ b/lib/pages/MyAppointments/widgets/AppointmentActions.dart @@ -74,7 +74,7 @@ class _AppointmentActionsState extends State { shrinkWrap: true, itemBuilder: (context, index) { // bool shouldEnable = ((widget.appo.clinicID == 17 || widget.appo.clinicID == 47) || (widget.appo.isLiveCareAppointment && appoButtonsList[index].caller == "askDoc") || appoButtonsList[index].caller == "openReschedule"); - bool shouldEnable = (((widget.appo.clinicID == 17 || widget.appo.clinicID == 47) && appoButtonsList[index].caller == "openReschedule") || + bool shouldEnable = (((widget.appo.clinicID == 17 || widget.appo.clinicID == 47 || widget.appo.clinicID == 134) && appoButtonsList[index].caller == "openReschedule") || (widget.appo.isLiveCareAppointment && appoButtonsList[index].caller == "askDoc") || (Utils.isVidaPlusProject(projectViewModel, widget.appo.projectID) && widget.appo.clinicID == 10 && @@ -83,8 +83,8 @@ class _AppointmentActionsState extends State { onTap: shouldEnable ? null : () { - _handleButtonClicks(appoButtonsList[index], model); - }, + _handleButtonClicks(appoButtonsList[index], model); + }, child: MedicalProfileItem( title: appoButtonsList[index].title, imagePath: appoButtonsList[index].icon, @@ -133,7 +133,7 @@ class _AppointmentActionsState extends State { locator().appointment.appointment_detail_action(appointment: widget.appo, action: 'add reminder'); break; case "goToTodoList": - // Navigator.of(context).pop(); + // Navigator.of(context).pop(); navigateToToDoPage(context, model); locator().appointment.appointment_detail_action(appointment: widget.appo, action: 'todo list'); break; @@ -506,22 +506,22 @@ class _AppointmentActionsState extends State { showAskDocRequestDialog(List requestData) { showGeneralDialog( - barrierColor: Colors.black.withOpacity(0.5), - transitionBuilder: (context, a1, a2, widget) { - final curvedValue = Curves.easeInOutBack.transform(a1.value) - 1.0; - return Transform( - transform: Matrix4.translationValues(0.0, curvedValue * 200, 0.0), - child: Opacity( - opacity: a1.value, - child: AskDocDialog(requestData: requestData), - ), - ); - }, - transitionDuration: Duration(milliseconds: 500), - barrierDismissible: true, - barrierLabel: '', - context: context, - pageBuilder: (context, animation1, animation2) {}) + barrierColor: Colors.black.withOpacity(0.5), + transitionBuilder: (context, a1, a2, widget) { + final curvedValue = Curves.easeInOutBack.transform(a1.value) - 1.0; + return Transform( + transform: Matrix4.translationValues(0.0, curvedValue * 200, 0.0), + child: Opacity( + opacity: a1.value, + child: AskDocDialog(requestData: requestData), + ), + ); + }, + transitionDuration: Duration(milliseconds: 500), + barrierDismissible: true, + barrierLabel: '', + context: context, + pageBuilder: (context, animation1, animation2) {}) .then((value) { print("Dialog Closed"); print(value); @@ -576,10 +576,10 @@ class _AppointmentActionsState extends State { context, FadePage( page: VitalSignDetailsScreen( - appointmentNo: appoNo, - projectID: projectID, - isNotOneAppointment: false, - ))); + appointmentNo: appoNo, + projectID: projectID, + isNotOneAppointment: false, + ))); } navigateToInsertComplaint() { @@ -587,9 +587,9 @@ class _AppointmentActionsState extends State { context, FadePage( page: FeedbackHomePage( - messageType: MessageType.ComplaintOnAnAppointment, - appointment: widget.appo, - ))); + messageType: MessageType.ComplaintOnAnAppointment, + appointment: widget.appo, + ))); } navigateToToDoPage(BuildContext context, ToDoCountProviderModel model) { @@ -604,10 +604,10 @@ class _AppointmentActionsState extends State { context, FadePage( page: ToDo( - isShowAppBar: true, - isFromMyAppointments: true, - appointment: widget.appo, - ))); + isShowAppBar: true, + isFromMyAppointments: true, + appointment: widget.appo, + ))); } } diff --git a/lib/pages/ToDoList/ToDo.dart b/lib/pages/ToDoList/ToDo.dart index c8c767b1..72356d0e 100644 --- a/lib/pages/ToDoList/ToDo.dart +++ b/lib/pages/ToDoList/ToDo.dart @@ -15,6 +15,7 @@ import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.da import 'package:diplomaticquarterapp/models/LiveCare/ApplePayInsertRequest.dart'; import 'package:diplomaticquarterapp/models/anicllary-orders/ancillary_order_list_model.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/ancillary-orders/ancillaryOrdersDetails.dart'; +import 'package:diplomaticquarterapp/pages/Blood/blood_donation_appointment_terms_conditions.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/QRCode.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/SearchResults.dart'; import 'package:diplomaticquarterapp/pages/MyAppointments/AppointmentDetails.dart'; @@ -532,23 +533,18 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { case 30: return "assets/images/new-design/NFCIcon_option2.png"; break; - case 40: return "assets/images/new-design/video_call_instruction.png"; break; - case 50: return "assets/images/new-design/confirm_button.png"; break; - case 60: return "assets/images/new-design/waiting_for_doctor.png"; break; - case 90: return "assets/images/new-design/NFCIcon_option2.png"; break; - default: return ""; } @@ -572,6 +568,10 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { case 30: getAppoQR(context, appo); break; + case 40: + openInstructions(appo); + break; + case 50: confirmAppointment(appo); break; @@ -583,6 +583,12 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { } } + openInstructions(AppoitmentAllHistoryResultList appo) { + if (appo.clinicID == 134) { + Navigator.of(context).push(FadePage(page: BloodDonationAppointmentTermsConditions())); + } + } + Color getNextActionButtonColor(nextAction) { switch (nextAction) { case 0: diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index 3ab3fa66..61009cb4 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -2917,6 +2917,7 @@ class TranslationBase { String get noUpcomingAppointment => localizedValues["noUpcomingAppointment"][locale.languageCode]; String get locationTimeoutError => localizedValues["locationTimeoutError"][locale.languageCode]; String get loadMore => localizedValues["loadMore"][locale.languageCode]; + String get selectHospitalBloodDonation => localizedValues["selectHospitalBloodDonation"][locale.languageCode]; } diff --git a/lib/widgets/in_app_browser/InAppBrowser.dart b/lib/widgets/in_app_browser/InAppBrowser.dart index 1ed0f663..71aee90f 100644 --- a/lib/widgets/in_app_browser/InAppBrowser.dart +++ b/lib/widgets/in_app_browser/InAppBrowser.dart @@ -40,9 +40,9 @@ class MyInAppBrowser extends InAppBrowser { // static String APPLE_PAY_PAYFORT_URL = 'https://hmgwebservices.com/PayFortWebLive/PayFortApi/MakeApplePayRequest'; // Payfort Payment Gateway URL LIVE static String APPLE_PAY_PAYFORT_URL = 'https://hmgwebservices.com/PayFortWebLive/PayFortApi/MakeApplePayRequest'; // Payfort Payment Gateway URL UAT - // static String SERVICE_URL = 'https://hmgwebservices.com/PayFortWeb/pages/SendPayFortRequest.aspx'; // Payfort Payment Gateway URL UAT + static String SERVICE_URL = 'https://hmgwebservices.com/PayFortWeb/pages/SendPayFortRequest.aspx'; // Payfort Payment Gateway URL UAT - static String SERVICE_URL = 'https://hmgwebservices.com/PayFortWebLive/pages/SendPayFortRequest.aspx'; //Payfort Payment Gateway URL LIVE + // static String SERVICE_URL = 'https://hmgwebservices.com/PayFortWebLive/pages/SendPayFortRequest.aspx'; //Payfort Payment Gateway URL LIVE // static String SERVICE_URL = 'https://uat.hmgwebservices.com/payfortforvidaplus/pages/SendPayFortRequest.aspx'; //Payfort Payment Gateway URL UAT VIDA PLUS diff --git a/lib/widgets/new_design/doctor_header.dart b/lib/widgets/new_design/doctor_header.dart index d302ea2d..1df9acc9 100644 --- a/lib/widgets/new_design/doctor_header.dart +++ b/lib/widgets/new_design/doctor_header.dart @@ -26,14 +26,14 @@ class DoctorHeader extends StatelessWidget { DoctorHeader( {Key key, - @required this.headerModel, - @required this.buttonTitle, - @required this.onTap, - this.isNeedToShowButton = true, - this.isShowName = false, - this.buttonIcon, - this.showConfirmMessageDialog = true, - @required this.onRatingAndReviewTap}) + @required this.headerModel, + @required this.buttonTitle, + @required this.onTap, + this.isNeedToShowButton = true, + this.isShowName = false, + this.buttonIcon, + this.showConfirmMessageDialog = true, + @required this.onRatingAndReviewTap}) : super(key: key); ProjectViewModel projectViewModel; @@ -76,9 +76,9 @@ class DoctorHeader extends StatelessWidget { mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, children: [ - if (_speciality.isNotEmpty) + if (_speciality != null && _speciality.isNotEmpty) Text( - _speciality, + _speciality != "null" ? _speciality : "", style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.48, height: 18 / 12), ), headerModel.invoiceNo.isNotEmpty ? MyRichText(TranslationBase.of(context).invoiceNo + ":", headerModel.invoiceNo, projectViewModel.isArabic) : Container(), @@ -154,29 +154,29 @@ class DoctorHeader extends StatelessWidget { ), isNeedToShowButton ? InkWell( - onTap: () { - if (showConfirmMessageDialog) - showConfirmMessage(context, onTap, headerModel.email); - else - onTap(); - }, - child: Container( - padding: EdgeInsets.only(top: 10, bottom: 10, right: 21, left: 15), - decoration: BoxDecoration( - color: Color(0XFFD02127), borderRadius: projectViewModel.isArabic ? BorderRadius.only(topRight: Radius.circular(10)) : BorderRadius.only(topLeft: Radius.circular(10))), - child: Row( - mainAxisSize: MainAxisSize.min, - children: [ - SvgPicture.asset(buttonIcon ?? 'assets/images/new/email.svg', width: 19.0), - SizedBox(width: 6), - Text( - buttonTitle == null ? TranslationBase.of(context).sendEmail : buttonTitle, - style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Colors.white, letterSpacing: -0.64, height: 1), + onTap: () { + if (showConfirmMessageDialog) + showConfirmMessage(context, onTap, headerModel.email); + else + onTap(); + }, + child: Container( + padding: EdgeInsets.only(top: 10, bottom: 10, right: 21, left: 15), + decoration: BoxDecoration( + color: Color(0XFFD02127), borderRadius: projectViewModel.isArabic ? BorderRadius.only(topRight: Radius.circular(10)) : BorderRadius.only(topLeft: Radius.circular(10))), + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + SvgPicture.asset(buttonIcon ?? 'assets/images/new/email.svg', width: 19.0), + SizedBox(width: 6), + Text( + buttonTitle == null ? TranslationBase.of(context).sendEmail : buttonTitle, + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Colors.white, letterSpacing: -0.64, height: 1), + ), + ], + ), ), - ], - ), - ), - ) + ) : Container(), ], ), @@ -303,8 +303,7 @@ class DoctorHeader extends StatelessWidget { ), Container( margin: EdgeInsets.only(top: 10.0, left: 10.0, right: 10.0), - child: Text(getRatingWidth(doctorDetailsList[0].ratio).round().toString() + "%", - style: TextStyle(fontSize: 14.0, color: Colors.black, fontWeight: FontWeight.w600)), + child: Text(getRatingWidth(doctorDetailsList[0].ratio).round().toString() + "%", style: TextStyle(fontSize: 14.0, color: Colors.black, fontWeight: FontWeight.w600)), ), ], ), @@ -324,8 +323,7 @@ class DoctorHeader extends StatelessWidget { ), Container( margin: EdgeInsets.only(top: 10.0, left: 10.0, right: 10.0), - child: Text(doctorDetailsList[1].ratio.round().toString() + "%", - style: TextStyle(fontSize: 14.0, color: Colors.black, fontWeight: FontWeight.w600)), + child: Text(doctorDetailsList[1].ratio.round().toString() + "%", style: TextStyle(fontSize: 14.0, color: Colors.black, fontWeight: FontWeight.w600)), ), ], ), @@ -345,8 +343,7 @@ class DoctorHeader extends StatelessWidget { ), Container( margin: EdgeInsets.only(top: 10.0, left: 10.0, right: 10.0), - child: Text(doctorDetailsList[2].ratio.round().toString() + "%", - style: TextStyle(fontSize: 14.0, color: Colors.black, fontWeight: FontWeight.w600)), + child: Text(doctorDetailsList[2].ratio.round().toString() + "%", style: TextStyle(fontSize: 14.0, color: Colors.black, fontWeight: FontWeight.w600)), ), ], ), @@ -366,8 +363,7 @@ class DoctorHeader extends StatelessWidget { ), Container( margin: EdgeInsets.only(top: 10.0, left: 10.0, right: 10.0), - child: Text(doctorDetailsList[3].ratio.round().toString() + "%", - style: TextStyle(fontSize: 14.0, color: Colors.black, fontWeight: FontWeight.w600)), + child: Text(doctorDetailsList[3].ratio.round().toString() + "%", style: TextStyle(fontSize: 14.0, color: Colors.black, fontWeight: FontWeight.w600)), ), ], ), @@ -388,8 +384,7 @@ class DoctorHeader extends StatelessWidget { ), Container( margin: EdgeInsets.only(top: 10.0, left: 10.0, right: 10.0), - child: Text(doctorDetailsList[4].ratio.round().toString() + "%", - style: TextStyle(fontSize: 14.0, color: Colors.black, fontWeight: FontWeight.w600)), + child: Text(doctorDetailsList[4].ratio.round().toString() + "%", style: TextStyle(fontSize: 14.0, color: Colors.black, fontWeight: FontWeight.w600)), ), ], ),