diff --git a/lib/config/config.dart b/lib/config/config.dart index bbbacaa4..9d4ce5e0 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -269,6 +269,8 @@ const SEND_CHECK_IN_NFC_REQUEST = 'Services/Patients.svc/REST/Patient_CheckAppoi const HAS_DENTAL_PLAN = 'Services/Doctors.svc/REST/Dental_IsPatientHasOnGoingEstimation'; +const LASER_BODY_PARTS = 'Services/Patients.svc/REST/Laser_GetBodyPartsByCategory'; + //URL to get medicine and pharmacies list const CHANNEL = 3; const GENERAL_ID = 'Cs2020@2016\$2958'; diff --git a/lib/models/Appointments/laser_body_parts.dart b/lib/models/Appointments/laser_body_parts.dart new file mode 100644 index 00000000..99896868 --- /dev/null +++ b/lib/models/Appointments/laser_body_parts.dart @@ -0,0 +1,64 @@ +class LaserBodyPart { + int id; + int category; + String bodyPart; + bool fullBoadyPart; + bool isRetouch; + String timeDuration; + String bodyPartN; + bool isActive; + String mappingCode; + int procedureID; + int orderNum; + String categoryName; + String categoryNameN; + + LaserBodyPart( + {this.id, + this.category, + this.bodyPart, + this.fullBoadyPart, + this.isRetouch, + this.timeDuration, + this.bodyPartN, + this.isActive, + this.mappingCode, + this.procedureID, + this.orderNum, + this.categoryName, + this.categoryNameN}); + + LaserBodyPart.fromJson(Map json) { + id = json['Id']; + category = json['Category']; + bodyPart = json['BodyPart']; + fullBoadyPart = json['FullBoadyPart']; + isRetouch = json['IsRetouch']; + timeDuration = json['TimeDuration']; + bodyPartN = json['BodyPartN']; + isActive = json['IsActive']; + mappingCode = json['MappingCode']; + procedureID = json['ProcedureID']; + orderNum = json['OrderNum']; + categoryName = json['CategoryName']; + categoryNameN = json['CategoryNameN']; + } + + Map toJson() { + final Map data = new Map(); + data['Id'] = this.id; + data['Category'] = this.category; + data['BodyPart'] = this.bodyPart; + data['FullBoadyPart'] = this.fullBoadyPart; + data['IsRetouch'] = this.isRetouch; + data['TimeDuration'] = this.timeDuration; + data['BodyPartN'] = this.bodyPartN; + data['IsActive'] = this.isActive; + data['MappingCode'] = this.mappingCode; + data['ProcedureID'] = this.procedureID; + data['OrderNum'] = this.orderNum; + data['CategoryName'] = this.categoryName; + data['CategoryNameN'] = this.categoryNameN; + return data; + } +} diff --git a/lib/pages/Blood/blood_donation.dart b/lib/pages/Blood/blood_donation.dart index 8fb12f33..42023744 100644 --- a/lib/pages/Blood/blood_donation.dart +++ b/lib/pages/Blood/blood_donation.dart @@ -108,11 +108,11 @@ class _BloodDonationPageState extends State { SizedBox(height: 12), CommonDropDownView( TranslationBase.of(context).city, - model.bloodModelList.isNotEmpty - ? model.bloodModelList[0].city - : projectProvider.isArabic - ? model.CitiesModelList[_selectedHospitalIndex].descriptionN - : model.CitiesModelList[_selectedHospitalIndex].description, () { + 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), @@ -127,6 +127,7 @@ class _BloodDonationPageState extends State { onValueSelected: (index) { _selectedHospitalIndex = index; _selectedHospital = model.CitiesModelList[index]; + setState(() {}); }, ), ); diff --git a/lib/pages/BookAppointment/components/LaserClinic.dart b/lib/pages/BookAppointment/components/LaserClinic.dart new file mode 100644 index 00000000..1bc623d3 --- /dev/null +++ b/lib/pages/BookAppointment/components/LaserClinic.dart @@ -0,0 +1,183 @@ +import 'package:diplomaticquarterapp/models/Appointments/laser_body_parts.dart'; +import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/material.dart'; + +import '../../../svg_tester.dart'; + +class LaserClinic extends StatefulWidget { + LaserClinic({Key key}) : super(key: key); + + @override + _LaserClinicState createState() { + return _LaserClinicState(); + } +} + +class _LaserClinicState extends State { + List _laserCategoryList = [0, 2, 11]; + List _selectedBodyPartList = []; + bool _isFullBody = false; + int _selectedCategoryIndex = 0; + List laserBodyPartsList = []; + + @override + void initState() { + super.initState(); + Future.delayed(Duration.zero, () { + callLaserBodyPartsAPI(); + }); + } + + callLaserBodyPartsAPI() async { + GifLoaderDialogUtils.showMyDialog(context); + + DoctorsListService service = new DoctorsListService(); + service.getLaserBodyPartsList(_selectedCategoryIndex).then((res) { + GifLoaderDialogUtils.hideDialog(context); + if (res['MessageStatus'] == 1) { + setState(() { + if (res['Laser_GetBodyPartsByCategoryList'].length != 0) { + laserBodyPartsList = []; + res['Laser_GetBodyPartsByCategoryList'].forEach((v) { + laserBodyPartsList.add(LaserBodyPart.fromJson(v)); + }); + } else {} + }); + } else { + AppToast.showErrorToast(message: res['ErrorEndUserMessage']); + } + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + print(err); + AppToast.showErrorToast(message: err); + }); + } + + @override + void dispose() { + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return AppScaffold( + appBarTitle: TranslationBase.of(context).clinic, + showNewAppBar: true, + showNewAppBarTitle: true, + isShowDecPage: false, + backgroundColor: Color(0xfff7f7f7), + body: Column( + children: [ + Expanded( + child: Padding( + padding: EdgeInsets.all(21), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + for (var index in _laserCategoryList) + InkWell( + onTap: () { + _selectedCategoryIndex = index; + setState(() {}); + callLaserBodyPartsAPI(); + }, + child: Container( + width: 75, + height: 75, + alignment: Alignment.center, + padding: EdgeInsets.only(left: 4, right: 4), + decoration: BoxDecoration(shape: BoxShape.circle, color: _selectedCategoryIndex == index ? Colors.redAccent : Color(0xff2E303A)), + child: Text( + index == 0 ? "Body" : (index == 2 ? "Face" : "Retouch"), + style: TextStyle(color: Colors.white), + ), + ), + ) + ], + ), + SizedBox(height: 12), + Expanded( + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: ListView.separated( + //shrinkWrap: true, + physics: BouncingScrollPhysics(), + itemBuilder: (cxt, index) { + return InkWell( + onTap: () { + if (_selectedBodyPartList.contains(laserBodyPartsList[index].bodyPart)) { + _selectedBodyPartList.remove(laserBodyPartsList[index].bodyPart); + } else { + _selectedBodyPartList.add(laserBodyPartsList[index].bodyPart); + } + setState(() {}); + }, + child: Row( + children: [ + Container( + width: 24, + height: 24, + alignment: Alignment.center, + decoration: + BoxDecoration(shape: BoxShape.circle, color: _selectedBodyPartList.contains(laserBodyPartsList[index].bodyPart) ? Color(0xff2E303A) : Colors.transparent), + child: Icon(Icons.done, color: _selectedBodyPartList.contains(laserBodyPartsList[index].bodyPart) ? Colors.white : Color(0xff2E303A))), + SizedBox(width: 8), + Expanded( + child: Text( + laserBodyPartsList[index].bodyPart, + style: TextStyle( + color: Color(0xff2E303A), + ), + ), + ), + ], + ), + ); + }, + separatorBuilder: (cxt, index) => Divider( + height: 1, + thickness: 1, + color: Color(0xff2E303A), + ), + itemCount: laserBodyPartsList.length), + ), + Expanded( + child: ListView( + physics: BouncingScrollPhysics(), + children: [ + Center( + child: Text( + "Minutes", + style: TextStyle(color: Color(0xff2E303A)), + ), + ), + Expanded( + child: BodyPartMapper( + dataList: _selectedBodyPartList, + )) + ], + ), + ) + ], + ), + ) + ], + ), + ), + ), + DefaultButton("Continue", () {}).insideContainer, + ], + ), + ); + } +} diff --git a/lib/pages/BookAppointment/components/SearchByClinic.dart b/lib/pages/BookAppointment/components/SearchByClinic.dart index 147cb9f9..5cc81d78 100644 --- a/lib/pages/BookAppointment/components/SearchByClinic.dart +++ b/lib/pages/BookAppointment/components/SearchByClinic.dart @@ -24,6 +24,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:provider/provider.dart'; +import 'LaserClinic.dart'; import 'LiveCareBookAppointment.dart'; class SearchByClinic extends StatefulWidget { @@ -71,13 +72,19 @@ class _SearchByClinicState extends State { if (projectViewModel.isLogin) { if (radioValue == null) { if (projectViewModel.user.gender == 1) { - radioValue = TranslationBase.of(context).male; + radioValue = TranslationBase + .of(context) + .male; } else { - radioValue = TranslationBase.of(context).female; + radioValue = TranslationBase + .of(context) + .female; } } } else if (radioValue == null) { - radioValue = TranslationBase.of(context).female; + radioValue = TranslationBase + .of(context) + .female; } if (ageController.text.isEmpty) { ageController.text = projectViewModel.isLogin ? projectViewModel.user.age.toString() : ""; @@ -99,7 +106,9 @@ class _SearchByClinicState extends State { top: 20, ), child: Text( - TranslationBase.of(context).doctorFilter, + TranslationBase + .of(context) + .doctorFilter, style: TextStyle( fontSize: 16, fontWeight: FontWeight.w600, @@ -114,7 +123,9 @@ class _SearchByClinicState extends State { Padding( padding: const EdgeInsets.only(left: 20, right: 20), child: Text( - TranslationBase.of(context).gender, + TranslationBase + .of(context) + .gender, style: TextStyle( fontSize: 12, letterSpacing: -0.48, @@ -129,55 +140,63 @@ class _SearchByClinicState extends State { children: [ Flexible( child: Row( - children: [ - Radio( - value: TranslationBase.of(context).female, - groupValue: radioValue, - onChanged: (v) { - setState(() { - radioValue = v; - }); - }, - ), - Text( - TranslationBase.of(context).female, - style: TextStyle( - fontSize: 12, - letterSpacing: -0.48, - fontWeight: FontWeight.w600, - ), - ), - ], - )), + children: [ + Radio( + value: TranslationBase + .of(context) + .female, + groupValue: radioValue, + onChanged: (v) { + setState(() { + radioValue = v; + }); + }, + ), + Text( + TranslationBase + .of(context) + .female, + style: TextStyle( + fontSize: 12, + letterSpacing: -0.48, + fontWeight: FontWeight.w600, + ), + ), + ], + )), Flexible( child: Row( - children: [ - Radio( - value: TranslationBase.of(context).male, - groupValue: radioValue, - onChanged: (v) { - setState(() { - radioValue = v; - }); - }, - ), - Text( - TranslationBase.of(context).male, - style: TextStyle( - fontSize: 12, - letterSpacing: -0.48, - fontWeight: FontWeight.w600, - ), - ), - ], - )), + children: [ + Radio( + value: TranslationBase + .of(context) + .male, + groupValue: radioValue, + onChanged: (v) { + setState(() { + radioValue = v; + }); + }, + ), + Text( + TranslationBase + .of(context) + .male, + style: TextStyle( + fontSize: 12, + letterSpacing: -0.48, + fontWeight: FontWeight.w600, + ), + ), + ], + )), ], ), ), ], ), - Container(child: inputWidget("Age", "", ageController),margin: EdgeInsets.only(left: 20, right: 20),), + Container(child: inputWidget("Age", "", ageController), margin: EdgeInsets.only(left: 20, right: 20),), ], ), @@ -199,164 +218,173 @@ class _SearchByClinicState extends State { }); }, ), - Text(TranslationBase.of(context).nearestAppo, style: TextStyle(fontSize: 14.0, letterSpacing: -0.56)), + Text(TranslationBase + .of(context) + .nearestAppo, style: TextStyle(fontSize: 14.0, letterSpacing: -0.56)), ], ), ), widget.clnicIds != null && widget.clnicIds.length > 1 && isLoaded == true ? Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: clinicsList.map((result) { - return RoundedContainer( - child: ListTile( - onTap: () { - // setState(() { - dropdownValue = result.clinicID.toString(); - setState(() { - if (!isDentalSelectedAndSupported()) { - projectDropdownValue = ""; - getDoctorsList(context); - } else {} - }); - }, - title: Text(result.clinicDescription, style: TextStyle(fontSize: 14.0, color: Colors.grey[700], letterSpacing: 1.0)))); - }).toList()) + crossAxisAlignment: CrossAxisAlignment.start, + children: clinicsList.map((result) { + return RoundedContainer( + child: ListTile( + onTap: () { + // setState(() { + dropdownValue = result.clinicID.toString(); + setState(() { + if (!isDentalSelectedAndSupported()) { + projectDropdownValue = ""; + getDoctorsList(context); + } else {} + }); + }, + title: Text(result.clinicDescription, style: TextStyle(fontSize: 14.0, color: Colors.grey[700], letterSpacing: 1.0)))); + }).toList()) : InkWell( - onTap: () { - // dropdownKey.currentState; - openDropdown(clinicDropdownKey); - }, - child: Container( - width: double.infinity, - decoration: containerRadius(Colors.white, 12), - margin: EdgeInsets.only(left: 20, right: 20), - padding: EdgeInsets.only(left: 10, right: 10, top: 12, bottom: 12), - child: Row( + onTap: () { + // dropdownKey.currentState; + openDropdown(clinicDropdownKey); + }, + child: Container( + width: double.infinity, + decoration: containerRadius(Colors.white, 12), + margin: EdgeInsets.only(left: 20, right: 20), + padding: EdgeInsets.only(left: 10, right: 10, top: 12, bottom: 12), + child: Row( + children: [ + Flexible( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ - Flexible( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - TranslationBase.of(context).selectClinic, - style: TextStyle( - fontSize: 11, - letterSpacing: -0.44, - fontWeight: FontWeight.w600, - ), - ), - Container( - height: 18, - child: DropdownButtonHideUnderline( - child: DropdownButton( - onTap: () { - print("Clicked"); - }, - key: clinicDropdownKey, - hint: new Text( - TranslationBase.of(context).selectClinic, - ), - value: dropdownValue, - iconSize: 0, - isExpanded: true, - style: TextStyle(fontSize: 14, letterSpacing: -0.56, color: Colors.black, fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins'), - items: clinicsList.map((item) { - return new DropdownMenuItem( - value: item.clinicID.toString() + - "-" + - item.isLiveCareClinicAndOnline.toString() + - "-" + - item.liveCareClinicID.toString() + - "-" + - item.liveCareServiceID.toString(), - child: Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Text(item.clinicDescription), - item.isLiveCareClinicAndOnline - ? SvgPicture.asset('assets/images/new-design/video_icon_green_right.svg', height: 12, width: 12, fit: BoxFit.cover) - : Container(), - ]), - ); - }).toList(), - onChanged: (newValue) { - setState(() { - print(newValue); - dropdownValue = newValue; - if (!isDentalSelectedAndSupported() && !nearestAppo) { - projectDropdownValue = ""; - getDoctorsList(context); - } else { - print("Dental"); - } - }); - }, - ), - ), + Text( + TranslationBase + .of(context) + .selectClinic, + style: TextStyle( + fontSize: 11, + letterSpacing: -0.44, + fontWeight: FontWeight.w600, + ), + ), + Container( + height: 18, + child: DropdownButtonHideUnderline( + child: DropdownButton( + onTap: () { + print("Clicked"); + }, + key: clinicDropdownKey, + hint: new Text( + TranslationBase + .of(context) + .selectClinic, ), - ], + value: dropdownValue, + iconSize: 0, + isExpanded: true, + style: TextStyle(fontSize: 14, letterSpacing: -0.56, color: Colors.black, fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins'), + items: clinicsList.map((item) { + return new DropdownMenuItem( + value: item.clinicID.toString() + + "-" + + item.isLiveCareClinicAndOnline.toString() + + "-" + + item.liveCareClinicID.toString() + + "-" + + item.liveCareServiceID.toString(), + child: Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ + Text(item.clinicDescription), + item.isLiveCareClinicAndOnline + ? SvgPicture.asset('assets/images/new-design/video_icon_green_right.svg', height: 12, width: 12, fit: BoxFit.cover) + : Container(), + ]), + ); + }).toList(), + onChanged: (newValue) { + setState(() { + print(newValue); + dropdownValue = newValue; + if (dropdownValue == "253-false-0-0") { + Navigator.push(context, FadePage(page: LaserClinic())); + } else + if (!isDentalSelectedAndSupported() && !nearestAppo) { + projectDropdownValue = ""; + getDoctorsList(context); + } else { + print("Dental"); + } + }); + }, + ), ), ), - Icon(Icons.keyboard_arrow_down), ], ), ), - ), + Icon(Icons.keyboard_arrow_down), + ], + ), + ), + ), mHeight(20), isDentalSelectedAndSupported() == true || (nearestAppo && isProjectLoaded) ? InkWell( - onTap: () { - openDropdown(projectDropdownKey); - }, - child: Container( - width: double.infinity, - decoration: containerRadius(Colors.white, 12), - margin: EdgeInsets.only(left: 20, right: 20), - padding: EdgeInsets.only(left: 10, right: 10, top: 12, bottom: 12), - child: Row( + onTap: () { + openDropdown(projectDropdownKey); + }, + child: Container( + width: double.infinity, + decoration: containerRadius(Colors.white, 12), + margin: EdgeInsets.only(left: 20, right: 20), + padding: EdgeInsets.only(left: 10, right: 10, top: 12, bottom: 12), + child: Row( + children: [ + Flexible( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ - Flexible( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - "Select Project", - style: TextStyle( - fontSize: 11, - letterSpacing: -0.44, - fontWeight: FontWeight.w600, - ), - ), - Container( - height: 18, - child: DropdownButtonHideUnderline( - child: DropdownButton( - key: projectDropdownKey, - hint: new Text("Select Project"), - value: projectDropdownValue, - iconSize: 0, - isExpanded: true, - style: TextStyle(fontSize: 14, letterSpacing: -0.56, color: Colors.black), - items: projectsList.map((item) { - return new DropdownMenuItem( - value: item.mainProjectID.toString(), - child: new Text(item.name), - ); - }).toList(), - onChanged: (newValue) { - setState(() { - projectDropdownValue = newValue; - getDoctorsList(context); - }); - }, - ), - ), - ), - ], + Text( + "Select Project", + style: TextStyle( + fontSize: 11, + letterSpacing: -0.44, + fontWeight: FontWeight.w600, + ), + ), + Container( + height: 18, + child: DropdownButtonHideUnderline( + child: DropdownButton( + key: projectDropdownKey, + hint: new Text("Select Project"), + value: projectDropdownValue, + iconSize: 0, + isExpanded: true, + style: TextStyle(fontSize: 14, letterSpacing: -0.56, color: Colors.black), + items: projectsList.map((item) { + return new DropdownMenuItem( + value: item.mainProjectID.toString(), + child: new Text(item.name), + ); + }).toList(), + onChanged: (newValue) { + setState(() { + projectDropdownValue = newValue; + getDoctorsList(context); + }); + }, + ), ), ), - Icon(Icons.keyboard_arrow_down), ], - )), - ) + ), + ), + Icon(Icons.keyboard_arrow_down), + ], + )), + ) : Container(), ], ), @@ -538,9 +566,9 @@ class _SearchByClinicState extends State { navigateToDentalComplaints(context, searchInfo); } else if (dropdownValue.split("-")[1] == "true" - // && authProvider.isLogin && - // authUser.patientType == 1 - ) { + // && authProvider.isLogin && + // authUser.patientType == 1 + ) { Navigator.push( context, FadePage( @@ -586,7 +614,7 @@ class _SearchByClinicState extends State { List doctorByHospital = _patientDoctorAppointmentListHospital .where( (elementClinic) => elementClinic.filterName == element.projectName, - ) + ) .toList(); if (doctorByHospital.length != 0) { diff --git a/lib/pages/landing/home_page_2.dart b/lib/pages/landing/home_page_2.dart index 9f395cad..615ff7c7 100644 --- a/lib/pages/landing/home_page_2.dart +++ b/lib/pages/landing/home_page_2.dart @@ -4,6 +4,7 @@ import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/locator.dart'; import 'package:diplomaticquarterapp/pages/Covid-DriveThru/covid-drivethru-location.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/svg_tester.dart'; import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; diff --git a/lib/services/appointment_services/GetDoctorsList.dart b/lib/services/appointment_services/GetDoctorsList.dart index 3986c8e4..80039ece 100644 --- a/lib/services/appointment_services/GetDoctorsList.dart +++ b/lib/services/appointment_services/GetDoctorsList.dart @@ -1317,4 +1317,19 @@ class DoctorsListService extends BaseService { }, body: request); return Future.value(localRes); } + + Future getLaserBodyPartsList(int laserCategoryID) async { + Map request; + + request = { + "LaserCategoryID": laserCategoryID, + }; + dynamic localRes; + await baseAppClient.post(LASER_BODY_PARTS, onSuccess: (response, statusCode) async { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request); + return Future.value(localRes); + } } diff --git a/lib/svg_tester.dart b/lib/svg_tester.dart new file mode 100644 index 00000000..eec4d371 --- /dev/null +++ b/lib/svg_tester.dart @@ -0,0 +1,24 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_html/flutter_html.dart'; + +class BodyPartMapper extends StatelessWidget { + List dataList; + + BodyPartMapper({Key key, this.dataList}) : super(key: key); + + String jaduu = + ''; + + @override + Widget build(BuildContext context) { + return Html(data: getSvg()); + } + + String getSvg() { + + + String finalSvg = + '$jaduu'; + return finalSvg; + } +}