File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 83 KiB |
@ -0,0 +1,423 @@
|
||||
import 'dart:async';
|
||||
import 'dart:developer';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hmg_patient_app_new/core/app_assets.dart';
|
||||
import 'package:hmg_patient_app_new/core/app_state.dart';
|
||||
import 'package:hmg_patient_app_new/core/cache_consts.dart';
|
||||
import 'package:hmg_patient_app_new/core/dependencies.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/core/utils/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/habib_wallet/habib_wallet_view_model.dart';
|
||||
import 'package:hmg_patient_app_new/features/payfort/models/apple_pay_request_insert_model.dart';
|
||||
import 'package:hmg_patient_app_new/features/payfort/payfort_view_model.dart';
|
||||
import 'package:hmg_patient_app_new/generated/locale_keys.g.dart';
|
||||
import 'package:hmg_patient_app_new/presentation/lab/collapsing_list_view.dart';
|
||||
import 'package:hmg_patient_app_new/theme/colors.dart';
|
||||
import 'package:hmg_patient_app_new/widgets/chip/app_custom_chip_widget.dart';
|
||||
import 'package:hmg_patient_app_new/widgets/common_bottom_sheet.dart';
|
||||
import 'package:hmg_patient_app_new/widgets/in_app_browser/InAppBrowser.dart';
|
||||
import 'package:hmg_patient_app_new/widgets/loader/bottomsheet_loader.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class WalletPaymentConfirmPage extends StatefulWidget {
|
||||
const WalletPaymentConfirmPage({super.key});
|
||||
|
||||
@override
|
||||
State<WalletPaymentConfirmPage> createState() => _WalletPaymentConfirmPageState();
|
||||
}
|
||||
|
||||
class _WalletPaymentConfirmPageState extends State<WalletPaymentConfirmPage> {
|
||||
late PayfortViewModel payfortViewModel;
|
||||
late AppState appState;
|
||||
late HabibWalletViewModel habibWalletVM;
|
||||
|
||||
MyInAppBrowser? browser;
|
||||
String selectedPaymentMethod = "";
|
||||
|
||||
String transID = "";
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
scheduleMicrotask(() {
|
||||
payfortViewModel.initPayfortViewModel();
|
||||
});
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
appState = getIt.get<AppState>();
|
||||
habibWalletVM = Provider.of<HabibWalletViewModel>(context, listen: false);
|
||||
payfortViewModel = Provider.of<PayfortViewModel>(context, listen: false);
|
||||
return Scaffold(
|
||||
backgroundColor: AppColors.bgScaffoldColor,
|
||||
body: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Expanded(
|
||||
child: CollapsingListView(
|
||||
title: "Select Payment Method",
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
SizedBox(height: 24.h),
|
||||
Container(
|
||||
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
|
||||
color: AppColors.whiteColor,
|
||||
borderRadius: 20.h,
|
||||
hasShadow: false,
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Image.asset(AppAssets.mada, width: 72.h, height: 25.h).toShimmer2(isShow: false),
|
||||
SizedBox(height: 16.h),
|
||||
"Mada".needTranslation.toText16(isBold: true).toShimmer2(isShow: false),
|
||||
],
|
||||
),
|
||||
SizedBox(width: 8.h),
|
||||
const Spacer(),
|
||||
Utils.buildSvgWithAssets(
|
||||
icon: AppAssets.forward_arrow_icon,
|
||||
iconColor: AppColors.blackColor,
|
||||
width: 18.h,
|
||||
height: 13.h,
|
||||
fit: BoxFit.contain,
|
||||
).toShimmer2(isShow: false),
|
||||
],
|
||||
).paddingSymmetrical(16.h, 16.h),
|
||||
).paddingSymmetrical(24.h, 0.h).onPress(() {
|
||||
selectedPaymentMethod = "MADA";
|
||||
openPaymentURL("mada");
|
||||
}),
|
||||
SizedBox(height: 16.h),
|
||||
Container(
|
||||
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
|
||||
color: AppColors.whiteColor,
|
||||
borderRadius: 20.h,
|
||||
hasShadow: false,
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Image.asset(AppAssets.visa, width: 40.h, height: 40.h),
|
||||
SizedBox(width: 8.h),
|
||||
Image.asset(AppAssets.Mastercard, width: 40.h, height: 40.h),
|
||||
],
|
||||
).toShimmer2(isShow: false),
|
||||
SizedBox(height: 16.h),
|
||||
"Visa or Mastercard".needTranslation.toText16(isBold: true).toShimmer2(isShow: false),
|
||||
],
|
||||
),
|
||||
SizedBox(width: 8.h),
|
||||
const Spacer(),
|
||||
Utils.buildSvgWithAssets(
|
||||
icon: AppAssets.forward_arrow_icon,
|
||||
iconColor: AppColors.blackColor,
|
||||
width: 18.h,
|
||||
height: 13.h,
|
||||
fit: BoxFit.contain,
|
||||
).toShimmer2(isShow: false),
|
||||
],
|
||||
).paddingSymmetrical(16.h, 16.h),
|
||||
).paddingSymmetrical(24.h, 0.h).onPress(() {
|
||||
selectedPaymentMethod = "VISA";
|
||||
openPaymentURL("visa");
|
||||
}),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
// height: 200.h,
|
||||
width: MediaQuery.of(context).size.width,
|
||||
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
|
||||
color: AppColors.whiteColor,
|
||||
borderRadius: 24.h,
|
||||
hasShadow: true,
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
SizedBox(height: 24.h),
|
||||
habibWalletVM.depositorName.toText18(isBold: true).paddingSymmetrical(24.h, 0.h),
|
||||
SizedBox(height: 12.h),
|
||||
Wrap(
|
||||
direction: Axis.horizontal,
|
||||
spacing: 4.h,
|
||||
runSpacing: 4.h,
|
||||
children: [
|
||||
AppCustomChipWidget(labelText: "${LocaleKeys.fileno.tr(context: context)}.: ${habibWalletVM.fileNumber}"),
|
||||
AppCustomChipWidget(labelText: "${LocaleKeys.mobileNumber.tr(context: context)}: ${habibWalletVM.mobileNumber}"),
|
||||
AppCustomChipWidget(labelText: "${habibWalletVM.selectedHospital!.name}"),
|
||||
],
|
||||
).paddingSymmetrical(24.h, 0.h),
|
||||
SizedBox(height: 16.h),
|
||||
Divider(color: AppColors.borderOnlyColor.withValues(alpha: 0.1), height: 1.h).paddingSymmetrical(24.h, 0.h),
|
||||
SizedBox(height: 16.h),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
"Total amount to pay".needTranslation.toText16(isBold: true),
|
||||
Utils.getPaymentAmountWithSymbol(habibWalletVM.walletRechargeAmount.toString().toText24(isBold: true), AppColors.blackColor, 15.h, isSaudiCurrency: true),
|
||||
],
|
||||
).paddingSymmetrical(24.h, 0.h),
|
||||
SizedBox(height: 12.h),
|
||||
Platform.isIOS
|
||||
? Utils.buildSvgWithAssets(
|
||||
icon: AppAssets.apple_pay_button,
|
||||
width: 200.h,
|
||||
height: 56.h,
|
||||
fit: BoxFit.contain,
|
||||
).paddingSymmetrical(24.h, 0.h).onPress(() {
|
||||
if (Utils.havePrivilege(103)) {
|
||||
startApplePay();
|
||||
} else {
|
||||
openPaymentURL("applepay");
|
||||
}
|
||||
})
|
||||
: SizedBox(height: 12.h),
|
||||
SizedBox(height: 32.h),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
startApplePay() async {
|
||||
LoaderBottomSheet.showLoader();
|
||||
ApplePayInsertRequest applePayInsertRequest = ApplePayInsertRequest();
|
||||
|
||||
transID = Utils.getAdvancePaymentTransID(habibWalletVM.selectedHospital!.iD!, int.parse(habibWalletVM.fileNumber));
|
||||
|
||||
await payfortViewModel.getPayfortConfigurations(serviceId: ServiceTypeEnum.advancePayment.getIdFromServiceEnum(), projectId: habibWalletVM.selectedHospital!.iD!, integrationId: 2);
|
||||
|
||||
applePayInsertRequest.clientRequestID = transID;
|
||||
applePayInsertRequest.clinicID = 0;
|
||||
|
||||
applePayInsertRequest.currency = appState.getAuthenticatedUser()!.outSa! == 0 ? "SAR" : "AED";
|
||||
applePayInsertRequest.customerEmail = "CustID_${appState.getAuthenticatedUser()!.patientId.toString()}@HMG.com";
|
||||
applePayInsertRequest.customerID = appState.getAuthenticatedUser()!.patientId.toString();
|
||||
applePayInsertRequest.customerName = "${appState.getAuthenticatedUser()!.firstName} ${appState.getAuthenticatedUser()!.lastName}";
|
||||
|
||||
applePayInsertRequest.deviceToken = await Utils.getStringFromPrefs(CacheConst.pushToken);
|
||||
applePayInsertRequest.voipToken = await Utils.getStringFromPrefs(CacheConst.voipToken);
|
||||
applePayInsertRequest.doctorID = 0;
|
||||
applePayInsertRequest.projectID = habibWalletVM.selectedHospital!.iD!.toString();
|
||||
applePayInsertRequest.serviceID = ServiceTypeEnum.appointmentPayment.getIdFromServiceEnum().toString();
|
||||
applePayInsertRequest.channelID = 3;
|
||||
applePayInsertRequest.patientID = appState.getAuthenticatedUser()!.patientId.toString();
|
||||
applePayInsertRequest.patientTypeID = appState.getAuthenticatedUser()!.patientType;
|
||||
applePayInsertRequest.patientOutSA = appState.getAuthenticatedUser()!.outSa;
|
||||
applePayInsertRequest.appointmentDate = null;
|
||||
applePayInsertRequest.appointmentNo = 0;
|
||||
applePayInsertRequest.orderDescription = "Advance Payment";
|
||||
applePayInsertRequest.liveServiceID = "0";
|
||||
applePayInsertRequest.latitude = "0.0";
|
||||
applePayInsertRequest.longitude = "0.0";
|
||||
applePayInsertRequest.amount = habibWalletVM.walletRechargeAmount.toString();
|
||||
applePayInsertRequest.isSchedule = "0";
|
||||
applePayInsertRequest.language = appState.isArabic() ? 'ar' : 'en';
|
||||
applePayInsertRequest.languageID = appState.isArabic() ? 1 : 2;
|
||||
applePayInsertRequest.userName = appState.getAuthenticatedUser()!.patientId;
|
||||
applePayInsertRequest.responseContinueURL = "http://hmg.com/Documents/success.html";
|
||||
applePayInsertRequest.backClickUrl = "http://hmg.com/Documents/success.html";
|
||||
applePayInsertRequest.paymentOption = "ApplePay";
|
||||
|
||||
applePayInsertRequest.isMobSDK = true;
|
||||
applePayInsertRequest.merchantReference = transID;
|
||||
applePayInsertRequest.merchantIdentifier = payfortViewModel.payfortProjectDetailsRespModel!.merchantIdentifier;
|
||||
applePayInsertRequest.commandType = "PURCHASE";
|
||||
applePayInsertRequest.signature = payfortViewModel.payfortProjectDetailsRespModel!.signature;
|
||||
applePayInsertRequest.accessCode = payfortViewModel.payfortProjectDetailsRespModel!.accessCode;
|
||||
applePayInsertRequest.shaRequestPhrase = payfortViewModel.payfortProjectDetailsRespModel!.shaRequest;
|
||||
applePayInsertRequest.shaResponsePhrase = payfortViewModel.payfortProjectDetailsRespModel!.shaResponse;
|
||||
applePayInsertRequest.returnURL = "";
|
||||
|
||||
//TODO: Need to pass dynamic params to the Apple Pay instead of static values
|
||||
await payfortViewModel.applePayRequestInsert(applePayInsertRequest: applePayInsertRequest).then((value) {
|
||||
payfortViewModel.paymentWithApplePay(
|
||||
customerName: "${appState.getAuthenticatedUser()!.firstName} ${appState.getAuthenticatedUser()!.lastName}",
|
||||
// customerEmail: projectViewModel.authenticatedUserObject.user.emailAddress,
|
||||
customerEmail: "CustID_${appState.getAuthenticatedUser()!.patientId.toString()}@HMG.com",
|
||||
orderDescription: "Appointment Payment",
|
||||
orderAmount: double.parse(habibWalletVM.walletRechargeAmount.toString()),
|
||||
merchantReference: transID,
|
||||
merchantIdentifier: payfortViewModel.payfortProjectDetailsRespModel!.merchantIdentifier,
|
||||
applePayAccessCode: payfortViewModel.payfortProjectDetailsRespModel!.accessCode,
|
||||
applePayShaRequestPhrase: payfortViewModel.payfortProjectDetailsRespModel!.shaRequest,
|
||||
currency: appState.getAuthenticatedUser()!.outSa! == 0 ? "SAR" : "AED",
|
||||
onFailed: (failureResult) async {
|
||||
log("failureResult: ${failureResult.message.toString()}");
|
||||
showCommonBottomSheetWithoutHeight(
|
||||
context,
|
||||
child: Utils.getErrorWidget(loadingText: failureResult.message.toString()),
|
||||
callBackFunc: () {},
|
||||
isFullScreen: false,
|
||||
isCloseButtonVisible: true,
|
||||
);
|
||||
},
|
||||
onSucceeded: (successResult) async {
|
||||
log("successResult: ${successResult.responseMessage.toString()}");
|
||||
selectedPaymentMethod = successResult.paymentOption ?? "VISA";
|
||||
checkPaymentStatus();
|
||||
},
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
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) {});
|
||||
} 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));
|
||||
|
||||
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");
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,103 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hmg_patient_app_new/core/app_assets.dart';
|
||||
import 'package:hmg_patient_app_new/core/app_export.dart';
|
||||
import 'package:hmg_patient_app_new/core/app_state.dart';
|
||||
import 'package:hmg_patient_app_new/core/dependencies.dart';
|
||||
import 'package:hmg_patient_app_new/core/utils/utils.dart';
|
||||
import 'package:hmg_patient_app_new/extensions/widget_extensions.dart';
|
||||
import 'package:hmg_patient_app_new/features/my_appointments/models/resp_models/hospital_model.dart';
|
||||
import 'package:hmg_patient_app_new/theme/colors.dart';
|
||||
|
||||
class HospitalListItemAdvancePayment extends StatelessWidget {
|
||||
final HospitalsModel hospitalModel;
|
||||
final bool isLocationEnabled;
|
||||
|
||||
late AppState appState;
|
||||
|
||||
HospitalListItemAdvancePayment({super.key, required this.hospitalModel, required this.isLocationEnabled});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
appState = getIt.get<AppState>();
|
||||
return DecoratedBox(
|
||||
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
|
||||
color: AppColors.whiteColor,
|
||||
borderRadius: 20.h,
|
||||
hasShadow: false,
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
spacing: 8.h,
|
||||
children: [hospitalName],
|
||||
),
|
||||
),
|
||||
Utils.buildSvgWithAssets(
|
||||
icon: AppAssets.forward_arrow_icon,
|
||||
iconColor: AppColors.blackColor,
|
||||
width: 18,
|
||||
height: 13,
|
||||
fit: BoxFit.contain,
|
||||
),
|
||||
],
|
||||
).paddingSymmetrical(16.h, 16.h),
|
||||
);
|
||||
}
|
||||
|
||||
Widget get hospitalName => Row(
|
||||
children: [
|
||||
Utils.buildSvgWithAssets(
|
||||
icon: (hospitalModel.isHMC == true) ? AppAssets.hmc : AppAssets.hmg,
|
||||
).paddingOnly(right: 10),
|
||||
Expanded(
|
||||
child: Text(
|
||||
hospitalModel.name ?? "",
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 16,
|
||||
color: AppColors.blackColor,
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
);
|
||||
|
||||
// Widget get distanceInfo => Row(
|
||||
// children: [
|
||||
// Visibility(
|
||||
// visible: (hospitalModel.distanceInKMs != "0"),
|
||||
// child: AppCustomChipWidget(
|
||||
// labelText: "${hospitalData?.distanceInKMs ?? ""} km".needTranslation,
|
||||
// deleteIcon: AppAssets.location_red,
|
||||
// deleteIconSize: Size(9, 12),
|
||||
// backgroundColor: AppColors.secondaryLightRedColor,
|
||||
// textColor: AppColors.errorColor,
|
||||
// ),
|
||||
// ),
|
||||
// Visibility(
|
||||
// visible: (hospitalData?.distanceInKMs == "0"),
|
||||
// child: Row(
|
||||
// children: [
|
||||
// AppCustomChipWidget(
|
||||
// labelText: "Distance not available".needTranslation,
|
||||
// textColor: AppColors.blackColor,
|
||||
// ),
|
||||
// SizedBox(
|
||||
// width: 8.h,
|
||||
// )
|
||||
// ],
|
||||
// )),
|
||||
// Visibility(
|
||||
// visible: !isLocationEnabled,
|
||||
// child: AppCustomChipWidget(
|
||||
// labelText: "Location turned off".needTranslation,
|
||||
// deleteIcon: AppAssets.location_unavailable,
|
||||
// deleteIconSize: Size(9, 12),
|
||||
// textColor: AppColors.blackColor,
|
||||
// )),
|
||||
// ],
|
||||
// );
|
||||
}
|
||||
@ -0,0 +1,96 @@
|
||||
import 'package:easy_localization/easy_localization.dart' show tr, StringTranslateExtension;
|
||||
import 'package:flutter/material.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/book_appointments/book_appointments_view_model.dart';
|
||||
import 'package:hmg_patient_app_new/features/habib_wallet/habib_wallet_view_model.dart';
|
||||
import 'package:hmg_patient_app_new/features/my_appointments/appointment_via_region_viewmodel.dart';
|
||||
import 'package:hmg_patient_app_new/features/my_appointments/models/facility_selection.dart';
|
||||
import 'package:hmg_patient_app_new/features/my_appointments/my_appointments_view_model.dart';
|
||||
import 'package:hmg_patient_app_new/generated/locale_keys.g.dart';
|
||||
import 'package:hmg_patient_app_new/presentation/appointments/widgets/hospital_bottom_sheet/hospital_list_items.dart';
|
||||
import 'package:hmg_patient_app_new/presentation/appointments/widgets/hospital_bottom_sheet/type_selection_widget.dart';
|
||||
import 'package:hmg_patient_app_new/presentation/habib_wallet/widgets/hospital_list_item.dart';
|
||||
import 'package:hmg_patient_app_new/presentation/lab/collapsing_list_view.dart';
|
||||
import 'package:hmg_patient_app_new/theme/colors.dart' show AppColors;
|
||||
import 'package:hmg_patient_app_new/widgets/input_widget.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class SelectHospitalBottomSheet extends StatelessWidget {
|
||||
late HabibWalletViewModel habibWalletVM;
|
||||
final TextEditingController searchText = TextEditingController();
|
||||
|
||||
SelectHospitalBottomSheet({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
habibWalletVM = Provider.of<HabibWalletViewModel>(context, listen: false);
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// Text(
|
||||
// LocaleKeys.selectHospital.tr(),
|
||||
// style: TextStyle(
|
||||
// fontSize: 21,
|
||||
// fontWeight: FontWeight.w600,
|
||||
// color: AppColors.blackColor,
|
||||
// ),
|
||||
// ),
|
||||
Text(
|
||||
"Please select the hospital you want to make an advance payment for.".needTranslation,
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: AppColors.greyTextColor,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 16.h),
|
||||
// TextInputWidget(
|
||||
// labelText: LocaleKeys.search.tr(),
|
||||
// hintText: "Search Hospital".tr(),
|
||||
// controller: searchText,
|
||||
// onChange: (value) {
|
||||
// // appointmentsViewModel.filterHospitalListByString(value, regionalViewModel.selectedRegionId , regionalViewModel.selectedFacilityType ==
|
||||
// // FacilitySelection.HMG.name);
|
||||
// },
|
||||
// isEnable: true,
|
||||
// prefix: null,
|
||||
// autoFocus: false,
|
||||
// isBorderAllowed: false,
|
||||
// keyboardType: TextInputType.text,
|
||||
// isAllowLeadingIcon: true,
|
||||
// selectionType: SelectionTypeEnum.search,
|
||||
// padding: EdgeInsets.symmetric(
|
||||
// vertical: ResponsiveExtension(10).h,
|
||||
// horizontal: ResponsiveExtension(15).h,
|
||||
// ),
|
||||
// ),
|
||||
// SizedBox(height: 24.h),
|
||||
// TypeSelectionWidget(
|
||||
// hmcCount: "0",
|
||||
// hmgCount: "0",
|
||||
// ),
|
||||
// SizedBox(height: 21.h),
|
||||
SizedBox(
|
||||
height: MediaQuery.sizeOf(context).height * .4,
|
||||
child: ListView.separated(
|
||||
itemBuilder: (_, index) {
|
||||
return HospitalListItemAdvancePayment(
|
||||
hospitalModel: habibWalletVM.advancePaymentHospitals[index],
|
||||
isLocationEnabled: false,
|
||||
).onPress(() {
|
||||
habibWalletVM.setSelectedHospital(habibWalletVM.advancePaymentHospitals[index]);
|
||||
Navigator.of(context).pop();
|
||||
});
|
||||
},
|
||||
separatorBuilder: (_, __) => SizedBox(
|
||||
height: 16.h,
|
||||
),
|
||||
itemCount: habibWalletVM.advancePaymentHospitals.length),
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue