From 7d2a6c794b5513563318e9680ed68e90ce219b33 Mon Sep 17 00:00:00 2001 From: devmirza121 Date: Thu, 18 Nov 2021 14:02:56 +0300 Subject: [PATCH 1/4] Clinic Search Dialog --- lib/config/config.dart | 4 +- lib/models/Clinics/ClinicListResponse.dart | 6 + .../components/SearchByClinic.dart | 364 ++++++++---------- .../dialog/clinic_list_dialog.dart | 128 ++++++ pubspec.yaml | 2 + 5 files changed, 300 insertions(+), 204 deletions(-) create mode 100644 lib/pages/BookAppointment/dialog/clinic_list_dialog.dart diff --git a/lib/config/config.dart b/lib/config/config.dart index 92cafb4b..c4fabca6 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -15,8 +15,8 @@ const PACKAGES_CUSTOMER = '/api/customers'; const PACKAGES_SHOPPING_CART = '/api/shopping_cart_items'; const PACKAGES_ORDERS = '/api/orders'; const PACKAGES_TAMARA_OPT = '/api/orders/paymentoptions/tamara'; -const BASE_URL = 'https://uat.hmgwebservices.com/'; -// const BASE_URL = 'https://hmgwebservices.com/'; +// const BASE_URL = 'https://uat.hmgwebservices.com/'; +const BASE_URL = 'https://hmgwebservices.com/'; // Pharmacy UAT URLs // const BASE_PHARMACY_URL = 'https://uat.hmgwebservices.com/epharmacy/api/'; diff --git a/lib/models/Clinics/ClinicListResponse.dart b/lib/models/Clinics/ClinicListResponse.dart index cabb47b2..1aa4065e 100644 --- a/lib/models/Clinics/ClinicListResponse.dart +++ b/lib/models/Clinics/ClinicListResponse.dart @@ -41,6 +41,12 @@ class ListClinicCentralized { data['LiveCareServiceID'] = this.liveCareServiceID; return data; } + + + @override + String toString() { + return '${clinicDescription}'.toLowerCase() + ' ${clinicDescription}'.toUpperCase(); + } } class ListGetBookScheduleConfigsList { diff --git a/lib/pages/BookAppointment/components/SearchByClinic.dart b/lib/pages/BookAppointment/components/SearchByClinic.dart index 1703f183..7fb724b8 100644 --- a/lib/pages/BookAppointment/components/SearchByClinic.dart +++ b/lib/pages/BookAppointment/components/SearchByClinic.dart @@ -10,6 +10,7 @@ import 'package:diplomaticquarterapp/models/Clinics/ClinicListResponse.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/DentalComplaints.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/LaserBooking.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/SearchResults.dart'; +import 'package:diplomaticquarterapp/pages/BookAppointment/dialog/clinic_list_dialog.dart'; import 'package:diplomaticquarterapp/pages/livecare/livecare_home.dart'; import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; @@ -40,6 +41,7 @@ class SearchByClinic extends StatefulWidget { class _SearchByClinicState extends State { bool nearestAppo = false; String dropdownValue; + String dropdownTitle = ""; String projectDropdownValue; // var event = RobotProvider(); @@ -101,9 +103,7 @@ class _SearchByClinicState extends State { top: 20, ), child: Text( - TranslationBase - .of(context) - .doctorFilter, + TranslationBase.of(context).doctorFilter, style: TextStyle( fontSize: 16, fontWeight: FontWeight.w600, @@ -118,9 +118,7 @@ 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, @@ -135,56 +133,48 @@ 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, + ), + ), + ], + )), ], ), ), @@ -214,173 +204,143 @@ 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( - children: [ - Flexible( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, + onTap: () { + showClickListDialog(context, clinicsList, onSelection: (ListClinicCentralized clincs) { + Navigator.pop(context); + setState(() { + print(clincs.clinicID.toString() + "-" + clincs.isLiveCareClinicAndOnline.toString() + "-" + clincs.liveCareClinicID.toString() + "-" + clincs.liveCareServiceID.toString()); + dropdownTitle = clincs.clinicDescription; + dropdownValue = + clincs.clinicID.toString() + "-" + clincs.isLiveCareClinicAndOnline.toString() + "-" + clincs.liveCareClinicID.toString() + "-" + clincs.liveCareServiceID.toString(); + if (dropdownValue == "253-false-0-0") { + Navigator.push(context, FadePage(page: LaserClinic())); + } else if (!isDentalSelectedAndSupported() && !nearestAppo) { + projectDropdownValue = ""; + getDoctorsList(context); + } else { + print("Dental"); + } + }); + }); + }, + 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: 8), + child: Row( 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, + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).selectClinic, + style: TextStyle( + fontSize: 11, + letterSpacing: -0.44, + fontWeight: FontWeight.w600, + ), ), - 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"); - } - }); - }, - ), + Padding( + padding: const EdgeInsets.only(top: 4, bottom: 2), + child: Text( + dropdownTitle, + style: TextStyle( + fontSize: 13, + letterSpacing: -0.44, + fontWeight: FontWeight.w600, + ), + ), + ), + ], ), ), + 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( - children: [ - Flexible( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, + 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: [ - Text( - TranslationBase.of(context).selectHospital, - style: TextStyle( - fontSize: 11, - letterSpacing: -0.44, - fontWeight: FontWeight.w600, - ), - ), - Container( - height: 18, - child: DropdownButtonHideUnderline( - child: DropdownButton( - key: projectDropdownKey, - hint: new Text(TranslationBase.of(context).selectHospital), - 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); - }); - }, - ), + Flexible( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).selectHospital, + style: TextStyle( + fontSize: 11, + letterSpacing: -0.44, + fontWeight: FontWeight.w600, + ), + ), + Container( + height: 18, + child: DropdownButtonHideUnderline( + child: DropdownButton( + key: projectDropdownKey, + hint: new Text(TranslationBase.of(context).selectHospital), + 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(), ], ), @@ -612,7 +572,7 @@ class _SearchByClinicState extends State { List doctorByHospital = _patientDoctorAppointmentListHospital .where( (elementClinic) => elementClinic.filterName == element.projectName, - ) + ) .toList(); if (doctorByHospital.length != 0) { diff --git a/lib/pages/BookAppointment/dialog/clinic_list_dialog.dart b/lib/pages/BookAppointment/dialog/clinic_list_dialog.dart new file mode 100644 index 00000000..8f2fbb64 --- /dev/null +++ b/lib/pages/BookAppointment/dialog/clinic_list_dialog.dart @@ -0,0 +1,128 @@ +import 'package:diplomaticquarterapp/models/Clinics/ClinicListResponse.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/rendering.dart'; +import 'package:flutter_svg/svg.dart'; +import 'package:progress_hud_v2/generated/i18n.dart'; + +showClickListDialog(BuildContext context, List clinicsList, {Function(ListClinicCentralized) onSelection}) { + showDialog( + context: context, + builder: (BuildContext context) { + return Dialog( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(4.0), + ), //this right here + child: Container( + width: double.infinity, + // width: MediaQuery.of(context).size.width - 10, + height: MediaQuery.of(context).size.height - 80, + child: ClickListDialog( + clinicsList: clinicsList, + onSelection: onSelection, + ), + ), + ); + }, + ); +} + +class ClickListDialog extends StatefulWidget { + List clinicsList; + Function(ListClinicCentralized) onSelection; + + ClickListDialog({this.clinicsList, this.onSelection}); + + @override + _ClickListDialogState createState() => _ClickListDialogState(); +} + +class _ClickListDialogState extends State { + TextEditingController controller = new TextEditingController(); + List tempClinicsList = []; + + @override + void initState() { + // TODO: implement initState + super.initState(); + addAllData(); + } + + addAllData() { + tempClinicsList.clear(); + for (int i = 0; i < widget.clinicsList.length; i++) { + tempClinicsList.add(widget.clinicsList[i]); + } + setState(() {}); + } + + @override + Widget build(BuildContext context) { + return Container( + child: Column( + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: TextField( + controller: controller, + onChanged: (v) { + if (v.length > 0) { + tempClinicsList.clear(); + for (int i = 0; i < widget.clinicsList.length; i++) { + if (widget.clinicsList[i].clinicDescription.toLowerCase().contains(v.toLowerCase())) { + tempClinicsList.add(widget.clinicsList[i]); + } + } + } else { + addAllData(); + } + setState(() {}); + }, + decoration: InputDecoration( + hintStyle: TextStyle(fontSize: 17), + hintText: 'Search Clinic', + suffixIcon: Icon(Icons.search), + border: InputBorder.none, + contentPadding: EdgeInsets.all(12), + ), + ), + ), + Expanded( + child: ListView.separated( + padding: EdgeInsets.all(12), + itemBuilder: (context, index) { + return InkWell( + onTap: () { + widget.onSelection(tempClinicsList[index]); + + }, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Expanded(child: Text(tempClinicsList[index].clinicDescription)), + tempClinicsList[index].isLiveCareClinicAndOnline + ? SvgPicture.asset( + 'assets/images/new-design/video_icon_green_right.svg', + height: 12, + width: 12, + fit: BoxFit.cover, + ) + : Container(), + ], + ), + ), + ); + }, + itemCount: tempClinicsList.length, + separatorBuilder: (BuildContext context, int index) { + return mHeight(8); + }, + ), + ), + ], + ), + ); + } +} diff --git a/pubspec.yaml b/pubspec.yaml index dba94038..c7cda641 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -172,6 +172,8 @@ dependencies: badges: ^1.1.4 syncfusion_flutter_sliders: ^18.4.49-beta + searchable_dropdown: ^1.1.3 + dropdown_search: 0.4.9 # Dep by Zohaib shimmer: ^1.1.2 From 6439fe264abb377ea105536e4b251518c9393f5e Mon Sep 17 00:00:00 2001 From: Elham Rababh Date: Sun, 21 Nov 2021 10:44:46 +0200 Subject: [PATCH 2/4] small fix in order details --- lib/pages/pharmacies/widgets/ProductOrderItem.dart | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/pages/pharmacies/widgets/ProductOrderItem.dart b/lib/pages/pharmacies/widgets/ProductOrderItem.dart index a49c1273..429ee92b 100644 --- a/lib/pages/pharmacies/widgets/ProductOrderItem.dart +++ b/lib/pages/pharmacies/widgets/ProductOrderItem.dart @@ -249,11 +249,11 @@ class _ProductOrderItemState extends State { } else { newValue = widget.item.quantity - 1; } - } else { - _quantityController.text = "${widget.item.quantity}"; - _totalPrice = - "${(widget.item.product.price * widget.item.quantity).toStringAsFixed(2)}"; + widget.item.quantity = newValue; } + _quantityController.text = "${widget.item.quantity}"; + _totalPrice = + "${(widget.item.product.price * widget.item.quantity).toStringAsFixed(2)}"; } }); } From 2c198ed2246d5b29e7ddc4cc9c4b4c181cfe8751 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Sun, 21 Nov 2021 14:54:41 +0300 Subject: [PATCH 3/4] no message --- lib/pages/livecare/incoming_call.dart | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/pages/livecare/incoming_call.dart b/lib/pages/livecare/incoming_call.dart index 9e164c09..a463fc00 100644 --- a/lib/pages/livecare/incoming_call.dart +++ b/lib/pages/livecare/incoming_call.dart @@ -46,6 +46,7 @@ class _IncomingCallState extends State with SingleTickerProviderSt Widget build(BuildContext context) { return AppScaffold( isShowAppBar: false, + isShowDecPage: false, body: SafeArea( child: Container( decoration: BoxDecoration(color: Colors.grey[700]), From 816dfe4a12866f5fc90702c8be084cbe8d8f8afa Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Sun, 21 Nov 2021 15:38:08 +0300 Subject: [PATCH 4/4] Pharmacy fixes --- .../pharmacies/screens/cart-page/select_address_widget.dart | 3 ++- .../pharmacies/screens/product-details/product-detail.dart | 6 ++---- .../product-details/shared/product_details_app_bar.dart | 3 +-- lib/pages/pharmacy/order/OrderDetails.dart | 1 - 4 files changed, 5 insertions(+), 8 deletions(-) diff --git a/lib/pages/pharmacies/screens/cart-page/select_address_widget.dart b/lib/pages/pharmacies/screens/cart-page/select_address_widget.dart index a1634e21..bf51f8e5 100644 --- a/lib/pages/pharmacies/screens/cart-page/select_address_widget.dart +++ b/lib/pages/pharmacies/screens/cart-page/select_address_widget.dart @@ -189,9 +189,10 @@ class _SelectAddressWidgetState extends State { model.paymentCheckoutData.shippingOption == null ? "" : model.paymentCheckoutData.shippingOption.shippingRateComputationMethodSystemName == "Shipping.FixedOrByWeight" - ? "assets/images/pharmacy_module/payment/hmg_shipping_logo.png" + ? "assets/images/pharmacy_module/payment/LogoParmacyGreen.png" : "assets/images/pharmacy_module/payment/aramex_shipping_logo.png", fit: BoxFit.contain, + width: 100, ), margin: EdgeInsets.symmetric(horizontal: 8), ), diff --git a/lib/pages/pharmacies/screens/product-details/product-detail.dart b/lib/pages/pharmacies/screens/product-details/product-detail.dart index 9eeef868..1f9dcc52 100644 --- a/lib/pages/pharmacies/screens/product-details/product-detail.dart +++ b/lib/pages/pharmacies/screens/product-details/product-detail.dart @@ -1,4 +1,3 @@ -import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; @@ -291,7 +290,7 @@ class __ProductDetailPageState extends State { previousModel: model, ) : isAvailability - //&& widget.product.stockAvailability != "Out of stock" + //&& widget.product.stockAvailability != "Out of stock" ? AvailabilityInfo(previousModel: model) // : isAvailability && widget.product.stockAvailability == "Out of stock" // ? Container( @@ -303,7 +302,7 @@ class __ProductDetailPageState extends State { // TranslationBase.of(context).noLocationAvailable, // ), // ) - : Container(), + : Container(), ], ), ), @@ -374,5 +373,4 @@ class __ProductDetailPageState extends State { notifyMeWhenAvailable({itemId, customerId, ProductDetailViewModel model}) async { await model.notifyMe(customerId, itemId); } - } diff --git a/lib/pages/pharmacies/screens/product-details/shared/product_details_app_bar.dart b/lib/pages/pharmacies/screens/product-details/shared/product_details_app_bar.dart index f58438cf..fb608953 100644 --- a/lib/pages/pharmacies/screens/product-details/shared/product_details_app_bar.dart +++ b/lib/pages/pharmacies/screens/product-details/shared/product_details_app_bar.dart @@ -156,8 +156,7 @@ class ProductAppBar extends StatelessWidget with PreferredSizeWidget { await addToCartFunction( quantity: quantity, itemID: itemID, - model: model, - context: context); + model: model); Navigator.of(context).pop(); } diff --git a/lib/pages/pharmacy/order/OrderDetails.dart b/lib/pages/pharmacy/order/OrderDetails.dart index 291a3413..fc4ae184 100644 --- a/lib/pages/pharmacy/order/OrderDetails.dart +++ b/lib/pages/pharmacy/order/OrderDetails.dart @@ -254,7 +254,6 @@ class _OrderDetailsPageState extends State { ? "assets/images/pharmacy_module/payment/LogoParmacyGreen.png" : "assets/images/pharmacy_module/payment/aramex_shipping_logo.png", fit: BoxFit.contain, -// height: 100, width: 100, ), ),