From bcbdbb295d68f8f978d3e80d4b803a827fe0ba17 Mon Sep 17 00:00:00 2001 From: faizatflutter Date: Mon, 22 Jun 2026 14:34:14 +0300 Subject: [PATCH] completed the demo --- lib/core/api/api_client.dart | 6 +-- lib/core/api_consts.dart | 3 +- .../habib_wallet/habib_wallet_repo.dart | 21 +++++++-- .../habib_wallet/habib_wallet_view_model.dart | 13 ++++-- .../widgets/invoice_list_card.dart | 44 +++++++++---------- .../refund_request_create_page.dart | 2 + 6 files changed, 55 insertions(+), 34 deletions(-) diff --git a/lib/core/api/api_client.dart b/lib/core/api/api_client.dart index 9e3e5621..7f6b178b 100644 --- a/lib/core/api/api_client.dart +++ b/lib/core/api/api_client.dart @@ -210,9 +210,9 @@ class ApiClientImp implements ApiClient { body['TokenID'] = "@dm!n"; } - body['TokenID'] = "@dm!n"; + // body['TokenID'] = "@dm!n"; // body['PatientID'] = 6424682; - body['PatientID'] = 4770714; + // body['PatientID'] = 4772785; // body['PatientID'] = 4771727; // body['PatientID'] = 3648831; // body['PatientID'] = 89754444; @@ -263,7 +263,7 @@ class ApiClientImp implements ApiClient { body: requestBody, headers: headers, ); - // log("response: ${response.body.toString()}"); + log("response: ${response.body.toString()}"); } on SocketException catch (e) { final message = e.message.contains('Connection reset by peer') ? LocaleKeys.networkConnectionReset.tr() : LocaleKeys.networkErrorMessage.tr(); onFailure(message, -1, failureType: ConnectivityFailure(message)); diff --git a/lib/core/api_consts.dart b/lib/core/api_consts.dart index 9397a795..1542ce82 100644 --- a/lib/core/api_consts.dart +++ b/lib/core/api_consts.dart @@ -289,6 +289,7 @@ class ApiConsts { static String submitRefund = "Services/COCWS.svc/REST/SubmitRefund"; static String isRefundableInvoice = "Services/Outps.svc/REST/isRefundableInvoice"; static String getThresholdAmount = "Services/OUTPs.svc/REST/HIS_getThresholdAmount"; + static String checkIfPatientAdmitted = 'Services/Inps.svc/REST/checkIsPatientAdmittedOrAdmissionRequest'; static String getAiAnalysisURL = "https://api.labpredict.com"; static String getAiRadiologyAnalysis = "$getAiAnalysisURL/radiology"; @@ -922,8 +923,6 @@ var PAYFORT_PROD_URL = 'https://paymentservices.payfort.com/FortAPI/paymentApi'; // Check If InPatient API var CHECK_IF_INPATIENT = 'Services/Patients.svc/REST/GetInPatientAdmissionInfo'; -var CHECK_IF_PATIENT_ADMITTED = 'Services/Inps.svc/REST/checkIsPatientAdmittedOrAdmissionRequest'; - // Get General Instructions API var GET_GENERAL_INSTRUCTIONS = 'Services/INPs.svc/REST/getGeneralInstructions'; diff --git a/lib/features/habib_wallet/habib_wallet_repo.dart b/lib/features/habib_wallet/habib_wallet_repo.dart index b5f8d30c..c4a356bd 100644 --- a/lib/features/habib_wallet/habib_wallet_repo.dart +++ b/lib/features/habib_wallet/habib_wallet_repo.dart @@ -13,7 +13,12 @@ abstract class HabibWalletRepo { Future>>> getProjectList(); Future>> HISCreateAdvancePayment( - {required String paymentMethodName, required num paidAmount, required String paymentReference, required String patientID, required int projectID, required String depositorName}); + {required String paymentMethodName, + required num paidAmount, + required String paymentReference, + required String patientID, + required int projectID, + required String depositorName}); Future>> addAdvanceNumberRequest({required String advanceNumber, required String paymentReference}); @@ -52,7 +57,10 @@ class HabibWalletRepoImp implements HabibWalletRepo { // throw Exception("lab list is empty"); // } - final List balanceAmountList = list.map((item) => PatientAdvanceBalanceResponseModel.fromJson(item as Map)).toList().cast(); + final List balanceAmountList = list + .map((item) => PatientAdvanceBalanceResponseModel.fromJson(item as Map)) + .toList() + .cast(); for (var element in balanceAmountList) { element.totalAmount = response['TotalAdvanceBalanceAmount']; @@ -117,7 +125,12 @@ class HabibWalletRepoImp implements HabibWalletRepo { @override Future> HISCreateAdvancePayment( - {required String paymentMethodName, required num paidAmount, required String paymentReference, required String patientID, required int projectID, required String depositorName}) async { + {required String paymentMethodName, + required num paidAmount, + required String paymentReference, + required String patientID, + required int projectID, + required String depositorName}) async { Map request = { "CustName": depositorName, "CustID": patientID, @@ -319,7 +332,7 @@ class HabibWalletRepoImp implements HabibWalletRepo { GenericApiModel? apiResponse; Failure? failure; await apiClient.post( - CHECK_IF_PATIENT_ADMITTED, + ApiConsts.checkIfPatientAdmitted, body: requestBody, onFailure: (error, statusCode, {messageStatus, failureType}) { failure = failureType; diff --git a/lib/features/habib_wallet/habib_wallet_view_model.dart b/lib/features/habib_wallet/habib_wallet_view_model.dart index 9afc65d8..23805aa3 100644 --- a/lib/features/habib_wallet/habib_wallet_view_model.dart +++ b/lib/features/habib_wallet/habib_wallet_view_model.dart @@ -557,7 +557,12 @@ class HabibWalletViewModel extends ChangeNotifier { Function(dynamic)? onSuccess, Function(String)? onError}) async { final result = await habibWalletRepo.HISCreateAdvancePayment( - paymentMethodName: paymentMethodName, paidAmount: paidAmount, paymentReference: paymentReference, patientID: patientID, projectID: projectID, depositorName: depositorName); + paymentMethodName: paymentMethodName, + paidAmount: paidAmount, + paymentReference: paymentReference, + patientID: patientID, + projectID: projectID, + depositorName: depositorName); result.fold( // (failure) async => await errorHandlerService.handleError(failure: failure), @@ -579,7 +584,8 @@ class HabibWalletViewModel extends ChangeNotifier { ); } - Future addAdvanceNumberRequest({required String advanceNumber, required String paymentReference, Function(dynamic)? onSuccess, Function(String)? onError}) async { + Future addAdvanceNumberRequest( + {required String advanceNumber, required String paymentReference, Function(dynamic)? onSuccess, Function(String)? onError}) async { final result = await habibWalletRepo.addAdvanceNumberRequest(advanceNumber: advanceNumber, paymentReference: paymentReference); result.fold( @@ -631,7 +637,8 @@ class HabibWalletViewModel extends ChangeNotifier { lakumAccountInfo = LakumInquiryInformationResponseModel(); notifyListeners(); - final result = await habibWalletRepo.getLakumAccountInformation(identificationNumber: getIt.get().getAuthenticatedUser()!.patientIdentificationNo ?? ""); + final result = await habibWalletRepo.getLakumAccountInformation( + identificationNumber: getIt.get().getAuthenticatedUser()!.patientIdentificationNo ?? ""); result.fold( // (failure) async => await errorHandlerService.handleError(failure: failure), diff --git a/lib/presentation/my_invoices/widgets/invoice_list_card.dart b/lib/presentation/my_invoices/widgets/invoice_list_card.dart index 20e3b40b..d1a8f718 100644 --- a/lib/presentation/my_invoices/widgets/invoice_list_card.dart +++ b/lib/presentation/my_invoices/widgets/invoice_list_card.dart @@ -215,28 +215,28 @@ class InvoiceListCard extends StatelessWidget { iconSize: 14.h, ), ), - // if (getInvoicesListResponseModel.isAllowRefund == true) ...[ - // SizedBox(width: 8.w), - // Expanded( - // child: CustomButton( - // text: LocaleKeys.requestRefund.tr(context: context), - // onPressed: () { - // _handleRefundInvoiceTap(context); - // }, - // icon: AppAssets.refundIcon, - // iconColor: AppColors.caloriesCalculatorColor, - // backgroundColor: AppColors.blueColor.withValues(alpha: 0.14), - // borderColor: AppColors.primaryRedColor.withValues(alpha: 0.01), - // textColor: AppColors.caloriesCalculatorColor, - // fontSize: 14.f, - // fontWeight: FontWeight.w600, - // borderRadius: 12.r, - // padding: EdgeInsets.symmetric(horizontal: 10.w), - // height: 40.h, - // iconSize: 14.h, - // ), - // ), - // ] + if (getInvoicesListResponseModel.isAllowRefund == true) ...[ + SizedBox(width: 8.w), + Expanded( + child: CustomButton( + text: LocaleKeys.requestRefund.tr(context: context), + onPressed: () { + _handleRefundInvoiceTap(context); + }, + icon: AppAssets.refundIcon, + iconColor: AppColors.caloriesCalculatorColor, + backgroundColor: AppColors.blueColor.withValues(alpha: 0.14), + borderColor: AppColors.primaryRedColor.withValues(alpha: 0.01), + textColor: AppColors.caloriesCalculatorColor, + fontSize: 14.f, + fontWeight: FontWeight.w600, + borderRadius: 12.r, + padding: EdgeInsets.symmetric(horizontal: 10.w), + height: 40.h, + iconSize: 14.h, + ), + ), + ] ], ), ], diff --git a/lib/presentation/refund_request/refund_request_create_page.dart b/lib/presentation/refund_request/refund_request_create_page.dart index 5f9ddb53..b645307e 100644 --- a/lib/presentation/refund_request/refund_request_create_page.dart +++ b/lib/presentation/refund_request/refund_request_create_page.dart @@ -1,3 +1,4 @@ +import 'dart:developer'; import 'dart:io'; import 'package:easy_localization/easy_localization.dart'; @@ -114,6 +115,7 @@ class _RefundRequestCreatePageState extends State { refundReason: !_canSelectIndividualProcedures ? "Inpatient/Package invoice" : null, )) .toList(); + _refundRequestViewModel.setProcedures( procedures, needsITGApproval: details.needITGApproval ?? false,