From 98389e3f6849040871ad4e78c52d03ef07febdc4 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Wed, 28 Aug 2024 14:49:52 +0300 Subject: [PATCH] LiveCare Call Type implemented --- lib/config/config.dart | 12 +- lib/config/localized_values.dart | 6 + lib/core/service/client/base_app_client.dart | 6 +- .../livecare/live_care_payment_page.dart | 71 ++++++++- .../livecare/livecare_call_type_select.dart | 145 ++++++++++++++++++ lib/pages/livecare/widgets/clinic_list.dart | 121 ++++++++------- lib/uitl/translations_delegate_base.dart | 6 + .../medical/medical_profile_item.dart | 24 ++- lib/widgets/in_app_browser/InAppBrowser.dart | 4 +- lib/widgets/mobile-no/mobile_no.dart | 9 +- 10 files changed, 320 insertions(+), 84 deletions(-) create mode 100644 lib/pages/livecare/livecare_call_type_select.dart diff --git a/lib/config/config.dart b/lib/config/config.dart index 257a760b..b779da36 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -22,8 +22,8 @@ var PACKAGES_ORDER_HISTORY = '/api/orders/items'; var PACKAGES_TAMARA_OPT = '/api/orders/paymentoptions/tamara'; // var BASE_URL = 'http://10.50.100.198:2018/'; // 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://orash.cloudsolutions.com.sa/'; // var BASE_URL = 'https://vidauat.cloudsolutions.com.sa/'; @@ -668,10 +668,10 @@ var GET_DENTAL_INSTRUCTIONS = 'Services/OUTPs.svc/Rest/getProcedureNotification' //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 a2165f33..5babf3ea 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -1977,4 +1977,10 @@ const Map localizedValues = { "wecare": {"en": "We Care", "ar": "نحن نهتم"}, "myinstructions": {"en": "My Instructions", "ar": "تعليماتي"}, "searchClinic": {"en": "Search Clinic", "ar": "بحث العيادة"}, + "enterMobileNumber": {"en": "Enter Mobile Number", "ar": "أدخل رقم الجوال"}, + "videoCall": {"en": "Video Call", "ar": "اتصال فيديو"}, + "audioCall": {"en": "Audio Call", "ar": "اتصال صوتية"}, + "phoneCall": {"en": "Phone Call", "ar": "اتصال هاتفية"}, + "selectCallType": {"en": "Select Call Type", "ar": "حدد نوع المكالمة"}, + "selectedCallType": {"en": "Selected Call Type", "ar": "نوع المكالمة المحدد"}, }; diff --git a/lib/core/service/client/base_app_client.dart b/lib/core/service/client/base_app_client.dart index f2a656aa..d8f30f0c 100644 --- a/lib/core/service/client/base_app_client.dart +++ b/lib/core/service/client/base_app_client.dart @@ -203,9 +203,9 @@ class BaseAppClient { body.removeWhere((key, value) => key == null || value == null); // if (AppGlobal.isNetworkDebugEnabled) { - // print("URL : $url"); - // final jsonBody = json.encode(body); - // print(jsonBody); + print("URL : $url"); + final jsonBody = json.encode(body); + print(jsonBody); // } if (await Utils.checkConnection( diff --git a/lib/pages/livecare/live_care_payment_page.dart b/lib/pages/livecare/live_care_payment_page.dart index b6c0561d..c1f63e66 100644 --- a/lib/pages/livecare/live_care_payment_page.dart +++ b/lib/pages/livecare/live_care_payment_page.dart @@ -1,5 +1,7 @@ import 'dart:io'; +import 'package:auto_size_text/auto_size_text.dart'; +import 'package:diplomaticquarterapp/config/size_config.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/models/LiveCare/ERAppointmentFeesResponse.dart'; import 'package:diplomaticquarterapp/services/livecare_services/livecare_provider.dart'; @@ -25,8 +27,10 @@ class LiveCarePatmentPage extends StatefulWidget { String clinicName; bool isPharmaLiveCare; String pharmaLiveCareClientID; + int selectedCallType; - LiveCarePatmentPage({required this.getERAppointmentFeesList, required this.waitingTime, required this.clinicName, this.isPharmaLiveCare = false, this.pharmaLiveCareClientID = ""}); + LiveCarePatmentPage( + {required this.getERAppointmentFeesList, required this.waitingTime, required this.clinicName, this.isPharmaLiveCare = false, this.pharmaLiveCareClientID = "", required this.selectedCallType}); @override _LiveCarePatmentPageState createState() => _LiveCarePatmentPageState(); @@ -222,8 +226,39 @@ class _LiveCarePatmentPageState extends State { ], ), ), + mHeight(32.0), + AutoSizeText( + TranslationBase.of(context).selectedCallType, + maxLines: 1, + minFontSize: 12, + style: TextStyle( + fontSize: SizeConfig.textMultiplier! * 2.0, + fontWeight: FontWeight.w600, + letterSpacing: -0.39, + height: 0.8, + ), + ), + mHeight(12.0), + Row( + children: [ + SvgPicture.asset( + getCallTypeImagePath(), + width: 18, + height: 18, + ), + mWidth(10), + Text( + getCallTypeText(), + style: TextStyle( + fontSize: 14.0, + letterSpacing: -0.4, + fontWeight: FontWeight.w600, + ), + ), + ], + ), Container( - margin: EdgeInsets.only(top: 10.0), + margin: EdgeInsets.only(top: 16.0), child: Row( children: [ Radio( @@ -338,6 +373,38 @@ class _LiveCarePatmentPageState extends State { ); } + String getCallTypeImagePath() { + String callTypeImagePath = ""; + switch (widget.selectedCallType) { + case 1: + callTypeImagePath = "assets/images/new/services/video_call.svg"; + break; + case 2: + callTypeImagePath = "assets/images/new/services/audio_call.svg"; + break; + case 3: + callTypeImagePath = "assets/images/new/services/phone_call.svg"; + break; + } + return callTypeImagePath; + } + + String getCallTypeText() { + String callTypeText = ""; + switch (widget.selectedCallType) { + case 1: + callTypeText = TranslationBase.of(context).videoCall; + break; + case 2: + callTypeText = TranslationBase.of(context).audioCall; + break; + case 3: + callTypeText = TranslationBase.of(context).phoneCall; + break; + } + return callTypeText; + } + @override void dispose() { // cancelAPI(); diff --git a/lib/pages/livecare/livecare_call_type_select.dart b/lib/pages/livecare/livecare_call_type_select.dart new file mode 100644 index 00000000..b850e397 --- /dev/null +++ b/lib/pages/livecare/livecare_call_type_select.dart @@ -0,0 +1,145 @@ +import 'package:auto_size_text/auto_size_text.dart'; +import 'package:diplomaticquarterapp/config/size_config.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/medical/medical_profile_item.dart'; +import 'package:diplomaticquarterapp/widgets/mobile-no/mobile_no.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; + +class LiveCareCallTypeSelectPage extends StatefulWidget { + Function onSelectedMethod; + + LiveCareCallTypeSelectPage({required this.onSelectedMethod}); + + @override + State createState() => _LiveCareCallTypeSelectPageState(); +} + +class _LiveCareCallTypeSelectPageState extends State { + int selectedCallType = 1; + String mobileNo = ""; + String countryCode = '966'; + late ProjectViewModel projectViewModel; + + @override + Widget build(BuildContext context) { + projectViewModel = Provider.of(context); + mobileNo = Utils.getPhoneNumberWithoutZero(projectViewModel.authenticatedUserObject.user.mobileNumber!); + return AppScaffold( + appBarTitle: TranslationBase.of(context).selectCallType, + isShowAppBar: true, + showNewAppBar: true, + showNewAppBarTitle: true, + backgroundColor: CustomColors.appBackgroudGrey2Color, + body: Padding( + padding: EdgeInsets.all(21), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + GridView( + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 3, childAspectRatio: 2 / 2, crossAxisSpacing: 12, mainAxisSpacing: 12), + physics: NeverScrollableScrollPhysics(), + shrinkWrap: true, + children: [ + InkWell( + onTap: () { + setState(() { + selectedCallType = 1; + }); + }, + child: MedicalProfileItem( + title: TranslationBase.of(context).videoCall, + imagePath: 'video_call.svg', + subTitle: "", + isPngImage: false, + isShowBorder: selectedCallType == 1, + ), + ), + InkWell( + onTap: () { + setState(() { + selectedCallType = 2; + }); + }, + child: MedicalProfileItem( + title: TranslationBase.of(context).audioCall, + imagePath: 'audio_call.svg', + subTitle: "", + isPngImage: false, + isShowBorder: selectedCallType == 2, + ), + ), + InkWell( + onTap: () { + setState(() { + selectedCallType = 3; + }); + }, + child: MedicalProfileItem( + title: TranslationBase.of(context).phoneCall, + imagePath: 'phone_call.svg', + subTitle: "", + isPngImage: false, + isShowBorder: selectedCallType == 3, + ), + ), + ], + ), + if (selectedCallType == 3) + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + mHeight(32.0), + AutoSizeText( + TranslationBase.of(context).mobileNumber, + maxLines: 1, + minFontSize: 12, + style: TextStyle( + fontSize: SizeConfig.textMultiplier! * 2.0, + fontWeight: FontWeight.w600, + letterSpacing: -0.39, + height: 0.8, + ), + ), + mHeight(16.0), + PhoneNumberSelectorWidget( + onNumberChange: (value) => { + mobileNo = value, + }, + onCountryChange: (value) => { + countryCode = value, + }, + mobileNo: this.mobileNo, + isLiveCareTypeSelect: true, + ), + ], + ), + ], + ), + ), + bottomSheet: Container( + color: CustomColors.white, + padding: EdgeInsets.fromLTRB(12.0, 1.0, 12.0, 25.0), + child: DefaultButton( + TranslationBase.of(context).next, + () { + if (mobileNo.isNotEmpty) { + widget.onSelectedMethod(selectedCallType, mobileNo); + Navigator.pop(context, [selectedCallType, mobileNo]); + } else { + AppToast.showErrorToast(message: TranslationBase.of(context).enterMobileNumber); + } + }, + color: CustomColors.accentColor, + ), + ), + ); + } +} diff --git a/lib/pages/livecare/widgets/clinic_list.dart b/lib/pages/livecare/widgets/clinic_list.dart index 0ab1e1c6..9b6bac94 100644 --- a/lib/pages/livecare/widgets/clinic_list.dart +++ b/lib/pages/livecare/widgets/clinic_list.dart @@ -16,6 +16,7 @@ import 'package:diplomaticquarterapp/models/LiveCare/LiveCareScheduleClinicsList import 'package:diplomaticquarterapp/pages/BookAppointment/SearchResults.dart'; import 'package:diplomaticquarterapp/pages/ToDoList/payment_method_select.dart'; import 'package:diplomaticquarterapp/pages/landing/landing_page.dart'; +import 'package:diplomaticquarterapp/pages/livecare/livecare_call_type_select.dart'; import 'package:diplomaticquarterapp/pages/livecare/livecare_home.dart'; import 'package:diplomaticquarterapp/pages/livecare/livecare_scheduling/schedule_clinic_card.dart'; import 'package:diplomaticquarterapp/pages/livecare/livecare_type_select.dart'; @@ -36,6 +37,7 @@ 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/dragable_sheet.dart'; import 'package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; @@ -94,6 +96,9 @@ class _clinic_listState extends State { String? transID; BuildContext? localContext; + int selectedCallType = 0; + String selectedMobileNumber = ""; + @override void initState() { liveCareClinicsListResponse = new LiveCareClinicsListResponse(); @@ -127,28 +132,7 @@ class _clinic_listState extends State { } void startLiveCare() { - int languageID = projectViewModel.isArabic ? 1 : 2; - bool isError = false; - LiveCareService service = new LiveCareService(); - GifLoaderDialogUtils.showMyDialog(context); - ERAppointmentFeesResponse erAppointmentFeesResponse = new ERAppointmentFeesResponse(); - service.getERAppointmentFees(selectedClinicID, widget.isPharmacyLiveCare, languageID, context).then((res) { - GifLoaderDialogUtils.hideDialog(context); - if (res['HasAppointment'] == true) { - isError = true; - showLiveCareCancelDialog(res['ErrorEndUserMessage'], res); - } else { - erAppointmentFeesResponse = ERAppointmentFeesResponse.fromJson(res as Map); - isError = false; - } - if (!isError) getERAppointmentTime(erAppointmentFeesResponse.getERAppointmentFeesList!); - }).catchError((err) { - GifLoaderDialogUtils.hideDialog(context); - print(err); - isError = true; - AppToast.showErrorToast(message: err, localContext: context); - }); - projectViewModel.analytics.liveCare.livecare_immediate_consultation_clinic(clinic: selectedClinicName); + makePayment(); } showLiveCareCancelDialog(String msg, res) { @@ -212,6 +196,7 @@ class _clinic_listState extends State { navigateTo( context, LiveCarePatmentPage( + selectedCallType: this.selectedCallType, getERAppointmentFeesList: getERAppointmentFeesList, waitingTime: waitingTime, clinicName: selectedClinicName, @@ -219,22 +204,12 @@ class _clinic_listState extends State { pharmaLiveCareClientID: widget.pharmacyLiveCareQRCode)) .then( (value) { - if (value) { + if (value != null && value) { if (getERAppointmentFeesList.total == "0" || getERAppointmentFeesList.total == "0.0") { addNewCallForPatientER(projectViewModel.user!.patientID.toString() + "" + DateTime.now().millisecondsSinceEpoch.toString()); } else { navigateToPaymentMethod(getERAppointmentFeesList, context); } - - // askVideoCallPermission().then((value) { - // if (value) { - // if (getERAppointmentFeesList.total == "0" || getERAppointmentFeesList.total == "0.0") { - // addNewCallForPatientER(projectViewModel.user.patientID.toString() + "" + DateTime.now().millisecondsSinceEpoch.toString()); - // } else { - // navigateToPaymentMethod(getERAppointmentFeesList, context); - // } - // } - // }); } else { Navigator.pop(context); } @@ -242,6 +217,42 @@ class _clinic_listState extends State { ); } + makePayment() { + showDraggableDialog( + context, + LiveCareCallTypeSelectPage( + onSelectedMethod: (int selectedCallType, String mobileNumber) { + print(selectedCallType); + print(mobileNumber); + this.selectedCallType = selectedCallType; + selectedMobileNumber = mobileNumber; + int languageID = projectViewModel.isArabic ? 1 : 2; + bool isError = false; + LiveCareService service = new LiveCareService(); + GifLoaderDialogUtils.showMyDialog(context); + ERAppointmentFeesResponse erAppointmentFeesResponse = new ERAppointmentFeesResponse(); + service.getERAppointmentFees(selectedClinicID, widget.isPharmacyLiveCare, languageID, context).then((res) { + GifLoaderDialogUtils.hideDialog(context); + if (res['HasAppointment'] == true) { + isError = true; + showLiveCareCancelDialog(res['ErrorEndUserMessage'], res); + } else { + erAppointmentFeesResponse = ERAppointmentFeesResponse.fromJson(res as Map); + isError = false; + } + if (!isError) getERAppointmentTime(erAppointmentFeesResponse.getERAppointmentFeesList!); + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + print(err); + isError = true; + AppToast.showErrorToast(message: err, localContext: context); + }); + projectViewModel.analytics.liveCare.livecare_immediate_consultation_clinic(clinic: selectedClinicName); + }, + ), + ); + } + Future askVideoCallPermission() async { if (!(await Permission.camera.request().isGranted) || !(await Permission.microphone.request().isGranted)) { return false; @@ -413,28 +424,28 @@ class _clinic_listState extends State { service.applePayInsertRequest(applePayInsertRequest, localContext!).then((res) async { if (res["MessageStatus"] == 1) { await localContext!.read().initiateApplePayWithPayfort( - customerName: projectViewModel.user.firstName! + " " + projectViewModel.user.lastName!, - // customerEmail: projectViewModel.authenticatedUserObject.user.emailAddress, - customerEmail: "CustID_${projectViewModel.user.patientID}@HMG.com", - orderDescription: "LiveCare Payment", - orderAmount: double.parse(amount), - merchantReference: transID, - payfortProjectDetailsRespModel: payfortProjectDetailsRespModel, - currency: projectViewModel.user.outSA == 1 ? "AED" : "SAR", - onFailed: (failureResult) async { - log("failureResult: ${failureResult.toString()}"); - GifLoaderDialogUtils.hideDialog(localContext!); - AppToast.showErrorToast(message: failureResult.toString()); - }, - onSuccess: (successResult) async { - GifLoaderDialogUtils.hideDialog(localContext!); - log("Payfort: ${successResult.responseMessage}"); - await localContext!.read().addPayfortApplePayResponse(projectViewModel.user.patientID!, result: successResult); - checkPaymentStatus(appo); - }, - projectId: appo.projectID, - serviceTypeEnum: ServiceTypeEnum.appointmentPayment, - ); + customerName: projectViewModel.user.firstName! + " " + projectViewModel.user.lastName!, + // customerEmail: projectViewModel.authenticatedUserObject.user.emailAddress, + customerEmail: "CustID_${projectViewModel.user.patientID}@HMG.com", + orderDescription: "LiveCare Payment", + orderAmount: double.parse(amount), + merchantReference: transID, + payfortProjectDetailsRespModel: payfortProjectDetailsRespModel, + currency: projectViewModel.user.outSA == 1 ? "AED" : "SAR", + onFailed: (failureResult) async { + log("failureResult: ${failureResult.toString()}"); + GifLoaderDialogUtils.hideDialog(localContext!); + AppToast.showErrorToast(message: failureResult.toString()); + }, + onSuccess: (successResult) async { + GifLoaderDialogUtils.hideDialog(localContext!); + log("Payfort: ${successResult.responseMessage}"); + await localContext!.read().addPayfortApplePayResponse(projectViewModel.user.patientID!, result: successResult); + checkPaymentStatus(appo); + }, + projectId: appo.projectID, + serviceTypeEnum: ServiceTypeEnum.appointmentPayment, + ); } else { GifLoaderDialogUtils.hideDialog(context); AppToast.showErrorToast(message: "An error occurred while processing your request"); diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index 9aa15082..006c3e7a 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -2964,6 +2964,12 @@ class TranslationBase { String get wecare => localizedValues["wecare"][locale.languageCode]; String get myinstructions => localizedValues["myinstructions"][locale.languageCode]; String get searchClinic => localizedValues["searchClinic"][locale.languageCode]; + String get enterMobileNumber => localizedValues["enterMobileNumber"][locale.languageCode]; + String get videoCall => localizedValues["videoCall"][locale.languageCode]; + String get audioCall => localizedValues["audioCall"][locale.languageCode]; + String get phoneCall => localizedValues["phoneCall"][locale.languageCode]; + String get selectCallType => localizedValues["selectCallType"][locale.languageCode]; + String get selectedCallType => localizedValues["selectedCallType"][locale.languageCode]; } diff --git a/lib/widgets/data_display/medical/medical_profile_item.dart b/lib/widgets/data_display/medical/medical_profile_item.dart index 6d905484..c47a8451 100644 --- a/lib/widgets/data_display/medical/medical_profile_item.dart +++ b/lib/widgets/data_display/medical/medical_profile_item.dart @@ -15,6 +15,7 @@ class MedicalProfileItem extends StatelessWidget { Color? imgColor; final width; final height; + bool isShowBorder; MedicalProfileItem( {required this.imagePath, @@ -25,7 +26,9 @@ class MedicalProfileItem extends StatelessWidget { this.imgColor, this.isPngImage = false, this.width, - this.height, this.isInPatient = false}); + this.height, + this.isInPatient = false, + this.isShowBorder = false}); @override Widget build(BuildContext context) { @@ -34,8 +37,7 @@ class MedicalProfileItem extends StatelessWidget { height: double.infinity, width: double.infinity, margin: EdgeInsets.all(0), - decoration: containerColorRadiusBorderWidth( - Colors.white, 15, CustomColors.pharmacyGreyColor, 1), + decoration: containerColorRadiusBorderWidth(Colors.white, 15, isShowBorder ? CustomColors.accentColor : CustomColors.pharmacyGreyColor, isShowBorder ? 3 : 1), clipBehavior: Clip.antiAlias, child: Stack( children: [ @@ -56,22 +58,14 @@ class MedicalProfileItem extends StatelessWidget { isPngImage ? Image.asset( imagePath, - width: width != null - ? width - : SizeConfig.widthMultiplier! * 7, - height: height != null - ? height - : SizeConfig.widthMultiplier! * 7, + width: width != null ? width : SizeConfig.widthMultiplier! * 7, + height: height != null ? height : SizeConfig.widthMultiplier! * 7, color: imgColor, ) : SvgPicture.asset( isInPatient ? "assets/images/new/inpatient/$imagePath" : "assets/images/new/services/$imagePath", - height: height != null - ? height - : SizeConfig.widthMultiplier! * 7, - width: width != null - ? width - : SizeConfig.widthMultiplier! * 7, + height: height != null ? height : SizeConfig.widthMultiplier! * 7, + width: width != null ? width : SizeConfig.widthMultiplier! * 7, color: imgColor, ), mFlex(2), diff --git a/lib/widgets/in_app_browser/InAppBrowser.dart b/lib/widgets/in_app_browser/InAppBrowser.dart index f353eec2..9ffec736 100644 --- a/lib/widgets/in_app_browser/InAppBrowser.dart +++ b/lib/widgets/in_app_browser/InAppBrowser.dart @@ -38,9 +38,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/mobile-no/mobile_no.dart b/lib/widgets/mobile-no/mobile_no.dart index 72b6a7f0..2747e3a3 100644 --- a/lib/widgets/mobile-no/mobile_no.dart +++ b/lib/widgets/mobile-no/mobile_no.dart @@ -1,6 +1,7 @@ import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/models/mobile_number.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; @@ -12,7 +13,8 @@ class PhoneNumberSelectorWidget extends StatefulWidget { final Function? onNumberChange; final Function? onCountryChange; final String? mobileNo; - PhoneNumberSelectorWidget({Key? key, this.onNumberChange, this.onCountryChange, this.mobileNo}) : super(key: key); + bool isLiveCareTypeSelect; + PhoneNumberSelectorWidget({Key? key, this.onNumberChange, this.onCountryChange, this.mobileNo, this.isLiveCareTypeSelect = false}) : super(key: key); @override _PhoneNumberSelectorWidgetState createState() { @@ -25,6 +27,7 @@ class _PhoneNumberSelectorWidgetState extends State { String countryCode = '966'; List counties = []; ProjectViewModel? projectProvider; + TextEditingController textController = new TextEditingController(); @override void initState() { for (var element in countriesData) counties.add(Countries.fromJson(element)); @@ -41,6 +44,9 @@ class _PhoneNumberSelectorWidgetState extends State { Widget build(BuildContext context) { projectProvider = Provider.of(context); String? countryName = ""; + if(widget.isLiveCareTypeSelect) { + textController.text = Utils.getPhoneNumberWithoutZero(widget.mobileNo!); + } for (var element in counties) { if (element.code == countryCode) { countryName = projectProvider!.isArabic == true ? element.nameAr : element.name; @@ -87,6 +93,7 @@ class _PhoneNumberSelectorWidgetState extends State { ), ), TextField( + controller: hasSelection ? null : textController, enabled: isEnable, scrollPadding: EdgeInsets.zero, keyboardType: TextInputType.number,