From 1c2564a1e22b64f6f5cf60c429da817b1845fa89 Mon Sep 17 00:00:00 2001 From: Haroon Amjad <> Date: Sun, 21 Sep 2025 22:14:55 +0300 Subject: [PATCH] updates --- lib/core/api/api_client.dart | 4 +- lib/core/api_consts.dart | 2 +- .../wallet_payment_confirm_page.dart | 234 ++++++++++-------- .../insurance/widgets/insurance_history.dart | 38 +-- lib/presentation/lab/lab_orders_page.dart | 17 ++ .../medical_file_appointment_card.dart | 17 +- lib/widgets/buttons/custom_button.dart | 2 +- lib/widgets/chip/app_custom_chip_widget.dart | 7 +- pubspec.yaml | 2 +- 9 files changed, 175 insertions(+), 148 deletions(-) diff --git a/lib/core/api/api_client.dart b/lib/core/api/api_client.dart index 62339bf..a75a1ab 100644 --- a/lib/core/api/api_client.dart +++ b/lib/core/api/api_client.dart @@ -176,8 +176,8 @@ class ApiClientImp implements ApiClient { body[_appState.isAuthenticated ? 'TokenID' : 'LogInTokenID'] = _appState.appAuthToken; } - // body['TokenID'] = "@dm!n"; - // body['PatientID'] = 3628599; + body['TokenID'] = "@dm!n"; + body['PatientID'] = 3628599; } body.removeWhere((key, value) => value == null); diff --git a/lib/core/api_consts.dart b/lib/core/api_consts.dart index f802818..d31679c 100644 --- a/lib/core/api_consts.dart +++ b/lib/core/api_consts.dart @@ -723,7 +723,7 @@ const DEACTIVATE_ACCOUNT = 'Services/Patients.svc/REST/PatientAppleActivation_In class ApiConsts { static const maxSmallScreen = 660; - static AppEnvironmentTypeEnum appEnvironmentType = AppEnvironmentTypeEnum.uat; + static AppEnvironmentTypeEnum appEnvironmentType = AppEnvironmentTypeEnum.prod; // static String baseUrl = 'https://uat.hmgwebservices.com/'; // HIS API URL UAT diff --git a/lib/presentation/habib_wallet/wallet_payment_confirm_page.dart b/lib/presentation/habib_wallet/wallet_payment_confirm_page.dart index c22a939..329a3fe 100644 --- a/lib/presentation/habib_wallet/wallet_payment_confirm_page.dart +++ b/lib/presentation/habib_wallet/wallet_payment_confirm_page.dart @@ -98,7 +98,7 @@ class _WalletPaymentConfirmPageState extends State { ).paddingSymmetrical(16.h, 16.h), ).paddingSymmetrical(24.h, 0.h).onPress(() { selectedPaymentMethod = "MADA"; - // openPaymentURL("mada"); + openPaymentURL("mada"); }), SizedBox(height: 16.h), Container( @@ -137,7 +137,7 @@ class _WalletPaymentConfirmPageState extends State { ).paddingSymmetrical(16.h, 16.h), ).paddingSymmetrical(24.h, 0.h).onPress(() { selectedPaymentMethod = "VISA"; - // openPaymentURL("visa"); + openPaymentURL("visa"); }), ], ), @@ -188,7 +188,9 @@ class _WalletPaymentConfirmPageState extends State { ).paddingSymmetrical(24.h, 0.h).onPress(() { if (Utils.havePrivilege(103)) { startApplePay(); - } else {} + } else { + openPaymentURL("applepay"); + } }) : SizedBox(height: 12.h), SizedBox(height: 32.h), @@ -285,101 +287,137 @@ class _WalletPaymentConfirmPageState extends State { void checkPaymentStatus() async { LoaderBottomSheet.showLoader(); await payfortViewModel.checkPaymentStatus( - transactionID: transID, - onSuccess: (apiResponse) async { - print(apiResponse.data); - if (payfortViewModel.payfortCheckPaymentStatusResponseModel!.responseMessage!.toLowerCase() == "success") { - await habibWalletVM.HISCreateAdvancePayment( - paymentMethodName: selectedPaymentMethod, - paidAmount: habibWalletVM.walletRechargeAmount, - paymentReference: payfortViewModel.payfortCheckPaymentStatusResponseModel!.fortId!, - patientID: habibWalletVM.fileNumber, - projectID: habibWalletVM.selectedHospital!.iD!, - depositorName: habibWalletVM.depositorName, - onSuccess: (value) async { - await habibWalletVM.addAdvanceNumberRequest( - advanceNumber: Utils.isVidaPlusProject(habibWalletVM.selectedHospital!.iD) - ? value.data['OnlineCheckInAppointments'][0]['AdvanceNumber_VP'].toString() - : value.data['OnlineCheckInAppointments'][0]['AdvanceNumber'].toString(), - paymentReference: payfortViewModel.payfortCheckPaymentStatusResponseModel!.fortId!, - onSuccess: (value) { - LoaderBottomSheet.hideLoader(); - showCommonBottomSheetWithoutHeight( - context, - child: Utils.getSuccessWidget(loadingText: "Payment Successful!".needTranslation), - callBackFunc: () { - Navigator.of(context).pop(); - Navigator.of(context).pop(); - }, - isFullScreen: false, - isCloseButtonVisible: true, - ); - }, - onError: (err) { - LoaderBottomSheet.hideLoader(); - showCommonBottomSheetWithoutHeight( - context, - child: Utils.getErrorWidget(loadingText: "Payment Failed - ${err}".needTranslation), - callBackFunc: () {}, - isFullScreen: false, - isCloseButtonVisible: true, - ); - }); - }, - onError: (err) {}); + transactionID: transID, + onSuccess: (apiResponse) async { + print(apiResponse.data); + if (payfortViewModel.payfortCheckPaymentStatusResponseModel!.responseMessage!.toLowerCase() == "success") { + await habibWalletVM.HISCreateAdvancePayment( + paymentMethodName: selectedPaymentMethod, + paidAmount: habibWalletVM.walletRechargeAmount, + paymentReference: payfortViewModel.payfortCheckPaymentStatusResponseModel!.fortId!, + patientID: habibWalletVM.fileNumber, + projectID: habibWalletVM.selectedHospital!.iD!, + depositorName: habibWalletVM.depositorName, + onSuccess: (value) async { + await habibWalletVM.addAdvanceNumberRequest( + advanceNumber: Utils.isVidaPlusProject(habibWalletVM.selectedHospital!.iD) + ? value.data['OnlineCheckInAppointments'][0]['AdvanceNumber_VP'].toString() + : value.data['OnlineCheckInAppointments'][0]['AdvanceNumber'].toString(), + paymentReference: payfortViewModel.payfortCheckPaymentStatusResponseModel!.fortId!, + onSuccess: (value) { + LoaderBottomSheet.hideLoader(); + showCommonBottomSheetWithoutHeight( + context, + child: Utils.getSuccessWidget(loadingText: "Payment Successful!".needTranslation), + callBackFunc: () { + Navigator.of(context).pop(); + Navigator.of(context).pop(); + }, + isFullScreen: false, + isCloseButtonVisible: true, + ); + }, + onError: (err) { + LoaderBottomSheet.hideLoader(); + showCommonBottomSheetWithoutHeight( + context, + child: Utils.getErrorWidget(loadingText: "Payment Failed - ${err}".needTranslation), + callBackFunc: () {}, + isFullScreen: false, + isCloseButtonVisible: true, + ); + }); + }, + onError: (err) {}); + } else { + showCommonBottomSheetWithoutHeight( + context, + child: Utils.getErrorWidget(loadingText: "Payment Failed! Please try again.".needTranslation), + callBackFunc: () {}, + isFullScreen: false, + isCloseButtonVisible: true, + ); + } + }, + ); + } + + onBrowserLoadStart(String url) { + print("onBrowserLoadStart"); + print(url); + + if (selectedPaymentMethod == "tamara") { + if (Platform.isAndroid) { + Uri uri = new Uri.dataFromString(url); + // tamaraPaymentStatus = uri.queryParameters['status']!; + // tamaraOrderID = uri.queryParameters['AuthorizePaymentId']!; + } else { + Uri uri = new Uri.dataFromString(url); + // tamaraPaymentStatus = uri.queryParameters['paymentStatus']!; + // tamaraOrderID = uri.queryParameters['orderId']!; + } + } + + // if(selectedPaymentMethod != "TAMARA") { + MyInAppBrowser.successURLS.forEach((element) { + if (url.contains(element)) { + browser?.close(); + MyInAppBrowser.isPaymentDone = true; + return; + } + }); + // } + + // if(selectedPaymentMethod != "TAMARA") { + MyInAppBrowser.errorURLS.forEach((element) { + if (url.contains(element)) { + browser?.close(); + MyInAppBrowser.isPaymentDone = false; + return; + } + }); + // } + } + + onBrowserExit(bool isPaymentMade) async { + print("onBrowserExit Called!!!!"); + if (selectedPaymentMethod == "TAMARA") { + // checkTamaraPaymentStatus(transID!, appo); + // if (tamaraPaymentStatus != null && tamaraPaymentStatus.toLowerCase() == "approved") { + // updateTamaraRequestStatus("success", "14", Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo), tamaraOrderID, num.parse(selectedInstallments), appo); + // } else { + // updateTamaraRequestStatus("Failed", "00", Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo), tamaraOrderID, num.parse(selectedInstallments), appo); + // } + } else { + checkPaymentStatus(); + // checkPaymentStatus(appo); + } + } + + openPaymentURL(String paymentMethod) { + browser = MyInAppBrowser(onExitCallback: onBrowserExit, onLoadStartCallback: onBrowserLoadStart, context: context); + transID = Utils.getAdvancePaymentTransID(habibWalletVM.selectedHospital!.iD!, int.parse(habibWalletVM.fileNumber)); - // await myAppointmentsViewModel.createAdvancePayment( - // paymentMethodName: selectedPaymentMethod, - // projectID: widget.patientAppointmentHistoryResponseModel.projectID, - // clinicID: widget.patientAppointmentHistoryResponseModel.clinicID, - // appointmentNo: widget.patientAppointmentHistoryResponseModel.appointmentNo.toString(), - // payedAmount: payfortViewModel.payfortCheckPaymentStatusResponseModel!.amount!, - // paymentReference: payfortViewModel.payfortCheckPaymentStatusResponseModel!.fortId!, - // patientID: "4767477", - // patientType: 1, - // onSuccess: (value) async { - // print(value); - // await myAppointmentsViewModel.addAdvanceNumberRequest( - // advanceNumber: Utils.isVidaPlusProject(widget.patientAppointmentHistoryResponseModel.projectID) - // ? value.data['OnlineCheckInAppointments'][0]['AdvanceNumber_VP'].toString() - // : value.data['OnlineCheckInAppointments'][0]['AdvanceNumber'].toString(), - // paymentReference: payfortViewModel.payfortCheckPaymentStatusResponseModel!.fortId!, - // appointmentNo: widget.patientAppointmentHistoryResponseModel.appointmentNo.toString(), - // onSuccess: (value) async { - // if (widget.patientAppointmentHistoryResponseModel.isLiveCareAppointment!) { - // //TODO: Implement LiveCare Check-In API Call - // } else { - // await myAppointmentsViewModel.generateAppointmentQR( - // clinicID: widget.patientAppointmentHistoryResponseModel.clinicID, - // projectID: widget.patientAppointmentHistoryResponseModel.projectID, - // appointmentNo: widget.patientAppointmentHistoryResponseModel.appointmentNo.toString(), - // isFollowUp: myAppointmentsViewModel.patientAppointmentShareResponseModel!.isFollowup!, - // onSuccess: (apiResponse) { - // Future.delayed(Duration(milliseconds: 500), () { - // Navigator.of(context).pop(); - // Navigator.pushAndRemoveUntil( - // context, - // CustomPageRoute( - // page: LandingNavigation(), - // ), - // (r) => false); - // Navigator.of(context).push( - // CustomPageRoute(page: MyAppointmentsPage()), - // ); - // }); - // }); - // } - // }); - // }); - } else { - showCommonBottomSheetWithoutHeight( - context, - child: Utils.getErrorWidget(loadingText: "Payment Failed! Please try again.".needTranslation), - callBackFunc: () {}, - isFullScreen: false, - isCloseButtonVisible: true, - ); - } - }); + browser?.openPaymentBrowser( + habibWalletVM.walletRechargeAmount, + "Advance Payment", + transID, + habibWalletVM.selectedHospital!.iD!.toString(), + "CustID_${appState.getAuthenticatedUser()!.patientId.toString()}@HMG.com", + selectedPaymentMethod, + appState.getAuthenticatedUser()!.patientType.toString(), + "${appState.getAuthenticatedUser()!.firstName} ${appState.getAuthenticatedUser()!.lastName}", + appState.getAuthenticatedUser()!.patientId.toString(), + appState.getAuthenticatedUser()!, + browser!, + false, + "3", + "0", + context, + "", + "", + "", + "", + "3"); } } diff --git a/lib/presentation/insurance/widgets/insurance_history.dart b/lib/presentation/insurance/widgets/insurance_history.dart index 397cb63..de5581c 100644 --- a/lib/presentation/insurance/widgets/insurance_history.dart +++ b/lib/presentation/insurance/widgets/insurance_history.dart @@ -10,6 +10,7 @@ import 'package:hmg_patient_app_new/features/insurance/insurance_view_model.dart import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; +import 'package:hmg_patient_app_new/widgets/chip/app_custom_chip_widget.dart'; import 'package:hmg_patient_app_new/widgets/shimmer/movies_shimmer_widget.dart'; import 'package:provider/provider.dart'; @@ -73,7 +74,7 @@ class InsuranceHistory extends StatelessWidget { ], ), SizedBox(height: 8.h), - "Haroon Amjad".toText16(weight: FontWeight.w600), + // "Haroon Amjad".toText16(weight: FontWeight.w600), SizedBox(height: 8.h), Row( children: [ @@ -82,38 +83,11 @@ class InsuranceHistory extends StatelessWidget { spacing: 4.h, runSpacing: 4.h, children: [ - Row( - children: [ - CustomButton( - text: "File No.: 3628599", - onPressed: () {}, - backgroundColor: AppColors.greyColor, - borderColor: AppColors.greyColor, - textColor: AppColors.blackColor, - fontSize: 10, - fontWeight: FontWeight.w500, - borderRadius: 12, - padding: EdgeInsets.fromLTRB(10, 0, 10, 0), - height: 30.h, - ), - ], + AppCustomChipWidget( + labelText: "File No.: ${insuranceVM.patientInsuranceCardHistoryList[index].patientID}", ), - Row( - children: [ - CustomButton( - text: insuranceVM.patientInsuranceCardHistoryList[index].createdOn!, - // text: "test", - onPressed: () {}, - backgroundColor: AppColors.greyColor, - borderColor: AppColors.greyColor, - textColor: AppColors.blackColor, - fontSize: 10, - fontWeight: FontWeight.w500, - borderRadius: 12, - padding: EdgeInsets.fromLTRB(10, 0, 10, 0), - height: 30.h, - ), - ], + AppCustomChipWidget( + labelText: insuranceVM.patientInsuranceCardHistoryList[index].createdOn!, ), ], ), diff --git a/lib/presentation/lab/lab_orders_page.dart b/lib/presentation/lab/lab_orders_page.dart index 520bfec..0e14565 100644 --- a/lib/presentation/lab/lab_orders_page.dart +++ b/lib/presentation/lab/lab_orders_page.dart @@ -6,6 +6,8 @@ import 'package:flutter/material.dart'; import 'package:flutter_staggered_animations/flutter_staggered_animations.dart'; import 'package:hmg_patient_app_new/core/enums.dart'; import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; +import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; +import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; import 'package:hmg_patient_app_new/features/lab/models/resp_models/patient_lab_orders_response_model.dart'; import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; import 'package:hmg_patient_app_new/features/lab/lab_view_model.dart'; @@ -13,6 +15,7 @@ import 'package:hmg_patient_app_new/presentation/lab/lab_result_item_view.dart'; import 'package:hmg_patient_app_new/presentation/lab/search_lab_report.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:hmg_patient_app_new/widgets/chip/custom_chip_widget.dart'; +import 'package:hmg_patient_app_new/widgets/custom_tab_bar.dart'; import 'package:provider/provider.dart'; import 'collapsing_list_view.dart'; @@ -65,6 +68,20 @@ class _LabOrdersPageState extends State { return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ + SizedBox(height: 16.h), + CustomTabBar( + activeTextColor: Color(0xffED1C2B), + activeBackgroundColor: Color(0xffED1C2B).withValues(alpha: .1), + tabs: [ + CustomTabBarModel(null, "By Visit".needTranslation), + CustomTabBarModel(null, "By Test".needTranslation), + // CustomTabBarModel(null, "Completed".needTranslation), + ], + onTabChange: (index) { + // myAppointmentsViewModel.onTabChange(index); + }, + ), + SizedBox(height: 16.h), selectedFilterText!.isNotEmpty ? CustomChipWidget( chipText: selectedFilterText!, diff --git a/lib/presentation/medical_file/widgets/medical_file_appointment_card.dart b/lib/presentation/medical_file/widgets/medical_file_appointment_card.dart index a991ab8..a1a6f88 100644 --- a/lib/presentation/medical_file/widgets/medical_file_appointment_card.dart +++ b/lib/presentation/medical_file/widgets/medical_file_appointment_card.dart @@ -13,6 +13,7 @@ import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; import 'package:hmg_patient_app_new/presentation/appointments/appointment_details_page.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; +import 'package:hmg_patient_app_new/widgets/chip/app_custom_chip_widget.dart'; import 'package:hmg_patient_app_new/widgets/routes/custom_page_route.dart'; import 'package:hmg_patient_app_new/widgets/transitions/fade_page.dart'; @@ -30,20 +31,14 @@ class MedicalFileAppointmentCard extends StatelessWidget { return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - CustomButton( - text: DateUtil.formatDateToDate(DateUtil.convertStringToDate(patientAppointmentHistoryResponseModel.appointmentDate), false), - onPressed: () {}, - backgroundColor: AppointmentType.isArrived(patientAppointmentHistoryResponseModel) ? AppColors.greyColor : AppColors.secondaryLightRedColor, - borderColor: AppointmentType.isArrived(patientAppointmentHistoryResponseModel) ? AppColors.greyLightColor : AppColors.secondaryLightRedColor, - textColor: AppointmentType.isArrived(patientAppointmentHistoryResponseModel) ? AppColors.textColor : AppColors.primaryRedColor, - fontSize: 12, - fontWeight: FontWeight.w500, - borderRadius: 12.h, - padding: EdgeInsets.fromLTRB(10, 0, 10, 0), - height: 40.h, + AppCustomChipWidget( + richText: DateUtil.formatDateToDate(DateUtil.convertStringToDate(patientAppointmentHistoryResponseModel.appointmentDate), false).toText12().paddingSymmetrical(12.h, 0.h), icon: AppointmentType.isArrived(patientAppointmentHistoryResponseModel) ? AppAssets.appointment_calendar_icon : AppAssets.alarm_clock_icon, iconColor: AppointmentType.isArrived(patientAppointmentHistoryResponseModel) ? AppColors.textColor : AppColors.primaryRedColor, iconSize: 16.h, + backgroundColor: AppointmentType.isArrived(patientAppointmentHistoryResponseModel) ? AppColors.greyColor : AppColors.secondaryLightRedColor, + textColor: AppointmentType.isArrived(patientAppointmentHistoryResponseModel) ? AppColors.textColor : AppColors.primaryRedColor, + padding: EdgeInsets.only(top: 12.h, bottom: 12.h, left: 8.h, right: 8.h), ).toShimmer2(isShow: myAppointmentsViewModel.isMyAppointmentsLoading), SizedBox(height: 16.h), Container( diff --git a/lib/widgets/buttons/custom_button.dart b/lib/widgets/buttons/custom_button.dart index 30e4e5d..7a15eca 100644 --- a/lib/widgets/buttons/custom_button.dart +++ b/lib/widgets/buttons/custom_button.dart @@ -62,7 +62,7 @@ class CustomButton extends StatelessWidget { children: [ if (icon != null) Padding( - padding: const EdgeInsets.only(right: 8.0), + padding: const EdgeInsets.only(right: 8.0, left: 8.0, bottom: 4.5), child: Utils.buildSvgWithAssets(icon: icon!, iconColor: iconColor, isDisabled: isDisabled, width: iconSize, height: iconSize), ), Text( diff --git a/lib/widgets/chip/app_custom_chip_widget.dart b/lib/widgets/chip/app_custom_chip_widget.dart index 85c13f2..b29f6e6 100644 --- a/lib/widgets/chip/app_custom_chip_widget.dart +++ b/lib/widgets/chip/app_custom_chip_widget.dart @@ -23,6 +23,7 @@ class AppCustomChipWidget extends StatelessWidget { this.deleteIconSize = const Size(12, 12), this.deleteIconColor = AppColors.textColor, this.deleteIconHasColor = false, + this.padding = EdgeInsets.zero, }); final String? labelText; @@ -38,6 +39,7 @@ class AppCustomChipWidget extends StatelessWidget { final bool iconHasColor; final bool deleteIconHasColor; final OutlinedBorder? shape; + final EdgeInsets? padding; @override Widget build(BuildContext context) { @@ -50,7 +52,7 @@ class AppCustomChipWidget extends StatelessWidget { color: Colors.transparent, // Crucially, set color to transparent style: BorderStyle.none, ), - borderRadius: BorderRadius.circular(8.0), // Apply a border radius of 16.0 + borderRadius: BorderRadius.circular(10.0), // Apply a border radius of 16.0 ), ), child: icon.isNotEmpty @@ -67,7 +69,8 @@ class AppCustomChipWidget extends StatelessWidget { weight: FontWeight.w500, letterSpacing: -0.64, color: textColor), - padding: EdgeInsets.all(0.0), + // padding: EdgeInsets.all(0.0), + padding: padding, materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, labelPadding: EdgeInsets.only( left: -4.h, diff --git a/pubspec.yaml b/pubspec.yaml index 0466933..ea41d43 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -55,7 +55,7 @@ dependencies: uuid: ^4.5.1 health: ^13.1.3 # health: 12.0.1 - fl_chart: ^1.1.1 + fl_chart: ^1.0.0 geolocator: ^14.0.2 dropdown_search: ^6.0.2 google_maps_flutter: ^2.12.3