diff --git a/lib/pages/BookAppointment/components/LaserClinic.dart b/lib/pages/BookAppointment/components/LaserClinic.dart index b1b8a154..37ec070a 100644 --- a/lib/pages/BookAppointment/components/LaserClinic.dart +++ b/lib/pages/BookAppointment/components/LaserClinic.dart @@ -1,12 +1,18 @@ +import 'dart:collection'; + import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart'; import 'package:diplomaticquarterapp/models/Appointments/laser_body_parts.dart'; +import 'package:diplomaticquarterapp/pages/BookAppointment/SearchResults.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/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/laser_body_parts_data.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:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; @@ -129,11 +135,13 @@ class _LaserClinicState extends State with SingleTickerProviderStat labelStyle: TextStyle( fontSize: 16, fontWeight: FontWeight.w600, + fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins', letterSpacing: -0.48, ), unselectedLabelStyle: TextStyle( fontSize: 16, fontWeight: FontWeight.w600, + fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins', letterSpacing: -0.48, ), tabs: [Text(TranslationBase.of(context).male), Text(TranslationBase.of(context).female)], @@ -176,8 +184,11 @@ class _LaserClinicState extends State with SingleTickerProviderStat Expanded( child: DefaultButton( TranslationBase.of(context).continues, - () {}, - color: Color(0xff359846), + getDuration() != 0 ? () { + callDoctorsSearchAPI(); + } : null, + color: CustomColors.green, + disabledColor: CustomColors.grey2, ), ), ], @@ -187,6 +198,65 @@ class _LaserClinicState extends State with SingleTickerProviderStat ); } + callDoctorsSearchAPI() { + GifLoaderDialogUtils.showMyDialog(context); + List doctorsList = []; + List arr = []; + List arrDistance = []; + List result; + int numAll; + List _patientDoctorAppointmentListHospital = List(); + + DoctorsListService service = new DoctorsListService(); + service.getDoctorsList(253, 0, false, context).then((res) { + GifLoaderDialogUtils.hideDialog(context); + if (res['MessageStatus'] == 1) { + setState(() { + if (res['DoctorList'].length != 0) { + doctorsList.clear(); + res['DoctorList'].forEach((v) { + doctorsList.add(new DoctorList.fromJson(v)); + }); + doctorsList.forEach((element) { + List doctorByHospital = _patientDoctorAppointmentListHospital + .where( + (elementClinic) => elementClinic.filterName == element.projectName, + ) + .toList(); + + if (doctorByHospital.length != 0) { + _patientDoctorAppointmentListHospital[_patientDoctorAppointmentListHospital.indexOf(doctorByHospital[0])].patientDoctorAppointmentList.add(element); + } else { + _patientDoctorAppointmentListHospital + .add(PatientDoctorAppointmentList(filterName: element.projectName, distanceInKMs: element.projectDistanceInKiloMeters.toString(), patientDoctorAppointment: element)); + } + }); + } else {} + }); + + result = LinkedHashSet.from(arr).toList(); + numAll = result.length; + navigateToSearchResults(context, doctorsList, _patientDoctorAppointmentListHospital); + } else { + AppToast.showErrorToast(message: res['ErrorEndUserMessage']); + } + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + print(err); + AppToast.showErrorToast(message: err); + }); + } + + Future navigateToSearchResults(context, List docList, List patientDoctorAppointmentListHospital) async { + Navigator.push(context, FadePage(page: SearchResults(isLiveCareAppointment: false, doctorsList: docList, patientDoctorAppointmentListHospital: patientDoctorAppointmentListHospital))) + .then((value) { + setState(() { + // dropdownValue = null; + }); + // getProjectsList(); + }); + } + int getDuration() { int duration = 0; if (_isFullBody) { @@ -255,7 +325,7 @@ class _LaserClinicState extends State with SingleTickerProviderStat color: _selectedCategoryIndex == index ? Colors.transparent : Color(0xffEAEAEA), ), ), - padding: EdgeInsets.symmetric(vertical: 11, horizontal: 26), + padding: EdgeInsets.symmetric(vertical: 8, horizontal: 26), child: Text( list[index].title, style: TextStyle( @@ -404,6 +474,7 @@ class _LaserClinicState extends State with SingleTickerProviderStat color: Color(0xff2B353E), letterSpacing: -0.48, ), + maxLines: 1, ), ), ], diff --git a/lib/pages/landing/landing_page_pharmcy.dart b/lib/pages/landing/landing_page_pharmcy.dart index 9e650966..c90a317a 100644 --- a/lib/pages/landing/landing_page_pharmcy.dart +++ b/lib/pages/landing/landing_page_pharmcy.dart @@ -76,7 +76,7 @@ class _LandingPagePharmacyState extends State { children: [ PharmacyPage(), PharmacyCategorisePage(), - PharmacyProfilePage(), + PharmacyProfilePage(moveToOrder: false), CartOrderPage(changeTab: changeCurrentTab), ], ), diff --git a/lib/pages/pharmacy/order/Order.dart b/lib/pages/pharmacy/order/Order.dart index 85a456bd..d1afd5a8 100644 --- a/lib/pages/pharmacy/order/Order.dart +++ b/lib/pages/pharmacy/order/Order.dart @@ -25,8 +25,7 @@ class OrderPage extends StatefulWidget { _OrderPageState createState() => _OrderPageState(); } -class _OrderPageState extends State - with SingleTickerProviderStateMixin { +class _OrderPageState extends State with SingleTickerProviderStateMixin { String pageID = "1"; String customerId = ""; String order = ""; @@ -54,8 +53,6 @@ class _OrderPageState extends State _tabController = new TabController( length: 4, vsync: this, - - // initialIndex: 1 ); } @@ -1171,14 +1168,7 @@ class _OrderPageState extends State orderModel: cancelledOrderList[ index]))) - .then((value) { - model - .getOrder(widget.customerID, - widget.customerGUID, pageID) - .then((value) { - getCancelledOrder(model); - }); - }); + ; }, child: Row( mainAxisAlignment: diff --git a/lib/pages/pharmacy/profile/profile.dart b/lib/pages/pharmacy/profile/profile.dart index ad3014e6..74f4662d 100644 --- a/lib/pages/pharmacy/profile/profile.dart +++ b/lib/pages/pharmacy/profile/profile.dart @@ -29,6 +29,10 @@ import 'package:flutter_svg/flutter_svg.dart'; dynamic languageID; class PharmacyProfilePage extends StatefulWidget { + final bool moveToOrder; + + PharmacyProfilePage({@required this.moveToOrder}); + @override _ProfilePageState createState() => _ProfilePageState(); } @@ -89,17 +93,20 @@ class _ProfilePageState extends State { getLanguageID(); super.initState(); getUser(); + if (widget.moveToOrder) { + Navigator.push(context, FadePage(page: OrderPage(customerID: customerId, customerGUID: customerGUID))); + } } @override Widget build(BuildContext context) { return BaseView( onModelReady: (model) async { - var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID); - var customerGUID = await sharedPref.getObject(PHARMACY_CUSTOMER_GUID); - GifLoaderDialogUtils.showMyDialog(context); - model.getOrder(customerId, customerGUID, page_id); - GifLoaderDialogUtils.hideDialog(context); + // var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID); + // var customerGUID = await sharedPref.getObject(PHARMACY_CUSTOMER_GUID); + // GifLoaderDialogUtils.showMyDialog(context); + // model.getOrder(customerId, customerGUID, page_id); + // GifLoaderDialogUtils.hideDialog(context); }, builder: (_, model, wi) => AppScaffold( appBarTitle: TranslationBase.of(context).myAccount, @@ -220,9 +227,7 @@ class _ProfilePageState extends State { ), Text( TranslationBase.of(context).lakum, - style: TextStyle( - fontSize: 13.0, - fontWeight: FontWeight.bold), + style: TextStyle(fontSize: 13.0, fontWeight: FontWeight.bold), ), ], ), @@ -231,8 +236,7 @@ class _ProfilePageState extends State { Expanded( child: InkWell( onTap: () { - Navigator.push(context, - FadePage(page: WishlistPage())); + Navigator.push(context, FadePage(page: WishlistPage())); }, child: Column( children: [ @@ -258,8 +262,7 @@ class _ProfilePageState extends State { Expanded( child: InkWell( onTap: () { - Navigator.push(context, - FadePage(page: MyReviewsPage())); + Navigator.push(context, FadePage(page: MyReviewsPage())); }, child: Column( children: [ @@ -304,9 +307,7 @@ class _ProfilePageState extends State { children: [ Text( TranslationBase.of(context).myAccount, - style: TextStyle( - fontSize: 16.0, - fontWeight: FontWeight.bold), + style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold), ), SizedBox( height: 10, @@ -317,10 +318,7 @@ class _ProfilePageState extends State { ), InkWell( onTap: () { - Navigator.push( - context, - FadePage( - page: HomePrescriptionsPage())); + Navigator.push(context, FadePage(page: HomePrescriptionsPage())); }, child: Row( children: [ @@ -333,8 +331,7 @@ class _ProfilePageState extends State { width: 15, ), Text( - TranslationBase.of(context) - .myPrescription, + TranslationBase.of(context).myPrescription, style: TextStyle( fontSize: 13.0, ), @@ -351,15 +348,11 @@ class _ProfilePageState extends State { ), InkWell( onTap: () { - Navigator.push(context, - FadePage(page: ComparePage())); + Navigator.push(context, FadePage(page: ComparePage())); }, child: Row( children: [ - Image.asset( - 'assets/images/pharmacy/compare.png', - width: 35, - height: 35), + Image.asset('assets/images/pharmacy/compare.png', width: 35, height: 35), SizedBox( width: 15, ), @@ -381,10 +374,7 @@ class _ProfilePageState extends State { ), InkWell( onTap: () { - Navigator.push( - context, - FadePage( - page: HomePrescriptionsPage())); + Navigator.push(context, FadePage(page: HomePrescriptionsPage())); }, child: Row( children: [ @@ -397,8 +387,7 @@ class _ProfilePageState extends State { width: 20, ), Text( - TranslationBase.of(context) - .medicationsRefill, + TranslationBase.of(context).medicationsRefill, style: TextStyle( fontSize: 13.0, ), @@ -415,8 +404,7 @@ class _ProfilePageState extends State { ), InkWell( onTap: () { - Navigator.push( - context, FadePage(page: MyFamily())); + Navigator.push(context, FadePage(page: MyFamily())); }, child: Row( children: [ @@ -446,10 +434,7 @@ class _ProfilePageState extends State { ), InkWell( onTap: () { - Navigator.push( - context, - FadePage( - page: PharmacyAddressesPage())); + Navigator.push(context, FadePage(page: PharmacyAddressesPage())); }, child: Row( children: [ @@ -462,8 +447,7 @@ class _ProfilePageState extends State { width: 20, ), Text( - TranslationBase.of(context) - .shippingAddresses, + TranslationBase.of(context).shippingAddresses, style: TextStyle( fontSize: 13.0, ), @@ -480,10 +464,7 @@ class _ProfilePageState extends State { ), InkWell( onTap: () { - Navigator.push( - context, - FadePage( - page: PharmacyTermsConditions())); + Navigator.push(context, FadePage(page: PharmacyTermsConditions())); }, child: Row( children: [ @@ -496,8 +477,7 @@ class _ProfilePageState extends State { width: 10, ), Text( - TranslationBase.of(context) - .conditionsHMG, + TranslationBase.of(context).conditionsHMG, style: TextStyle( fontSize: 13.0, ), @@ -514,15 +494,7 @@ class _ProfilePageState extends State { ), InkWell( onTap: () { - Navigator.push( - context, - FadePage( - page: LakumTermsConditions( - this.identificationNo, - this.firstName, - this.lastName, - this.mobileNo, - this.languageId))); + Navigator.push(context, FadePage(page: LakumTermsConditions(this.identificationNo, this.firstName, this.lastName, this.mobileNo, this.languageId))); }, child: Row( children: [ @@ -537,8 +509,7 @@ class _ProfilePageState extends State { width: 10, ), Text( - TranslationBase.of(context) - .conditions, + TranslationBase.of(context).conditions, style: TextStyle( fontSize: 13.0, ), @@ -569,9 +540,7 @@ class _ProfilePageState extends State { children: [ Text( TranslationBase.of(context).reachUs, - style: TextStyle( - fontSize: 16.0, - fontWeight: FontWeight.bold), + style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold), ), SizedBox( height: 5, @@ -582,8 +551,7 @@ class _ProfilePageState extends State { ), InkWell( onTap: () { - Navigator.push(context, - FadePage(page: LiveChatPage())); + Navigator.push(context, FadePage(page: LiveChatPage())); }, child: Row( children: [ @@ -611,8 +579,7 @@ class _ProfilePageState extends State { ), InkWell( onTap: () { - Navigator.push(context, - FadePage(page: FindUsPage())); + Navigator.push(context, FadePage(page: FindUsPage())); }, child: Row( children: [ @@ -625,8 +592,7 @@ class _ProfilePageState extends State { width: 20, ), Text( - TranslationBase.of(context) - .ourLocations, + TranslationBase.of(context).ourLocations, style: TextStyle(fontSize: 13.0), ), ], diff --git a/lib/services/pharmacy_services/product_detail_service.dart b/lib/services/pharmacy_services/product_detail_service.dart index e3e0fb7f..5599fc87 100644 --- a/lib/services/pharmacy_services/product_detail_service.dart +++ b/lib/services/pharmacy_services/product_detail_service.dart @@ -58,8 +58,8 @@ class ProductDetailService extends BaseService { _stockAvailability = response['products'][0]['stock_availability']; _stockAvailabilityn = response['products'][0]['stock_availabilityn']; - // _isStockAvailable = response['products'][0]['IsStockAvailable']; - _isStockAvailable = _stockAvailability == "In stock" ? true : false; + _isStockAvailable = response['products'][0]['IsStockAvailable']; + // _isStockAvailable = _stockAvailability == "In stock" ? true : false; }, onFailure: (String error, int statusCode) { hasError = true; super.error = error;