|
|
|
@ -1,6 +1,9 @@
|
|
|
|
|
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/models/InPatientServices/get_inpatient_advance_requests_response_model.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/services/clinic_services/get_clinic_service.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/theme/colors.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/utils_new.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart';
|
|
|
|
@ -8,6 +11,7 @@ import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:flutter/services.dart';
|
|
|
|
|
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
import 'package:share_plus/share_plus.dart';
|
|
|
|
|
|
|
|
|
|
class InPatientPendingAdvancePayment extends StatefulWidget {
|
|
|
|
|
InPatientAdvanceResponseModel inPatientAdvanceResponseModel;
|
|
|
|
@ -185,7 +189,7 @@ class _InPatientPendingAdvancePaymentState extends State<InPatientPendingAdvance
|
|
|
|
|
DefaultButton(
|
|
|
|
|
TranslationBase.of(context).payNow.toUpperCase(),
|
|
|
|
|
() {
|
|
|
|
|
this.browser.openUrlRequest(urlRequest: URLRequest(url: Uri.parse("https://google.com/")), options: _InAppBrowserOptions);
|
|
|
|
|
getInPatientPaymentLink(false);
|
|
|
|
|
},
|
|
|
|
|
// : null,
|
|
|
|
|
color: CustomColors.green,
|
|
|
|
@ -205,9 +209,7 @@ class _InPatientPendingAdvancePaymentState extends State<InPatientPendingAdvance
|
|
|
|
|
DefaultButton(
|
|
|
|
|
TranslationBase.of(context).copyLink.toUpperCase(),
|
|
|
|
|
() {
|
|
|
|
|
Clipboard.setData(const ClipboardData(text: "https://google.com/")).then((_) {
|
|
|
|
|
ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text(TranslationBase.of(context).paymentLinkCopied)));
|
|
|
|
|
});
|
|
|
|
|
getInPatientPaymentLink(true);
|
|
|
|
|
},
|
|
|
|
|
svgIcon: "assets/images/new/copy.svg",
|
|
|
|
|
color: CustomColors.accentColor,
|
|
|
|
@ -220,4 +222,38 @@ class _InPatientPendingAdvancePaymentState extends State<InPatientPendingAdvance
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void getInPatientPaymentLink(bool isCopy) {
|
|
|
|
|
ClinicListService service = new ClinicListService();
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
int orderID = DateTime.now().microsecondsSinceEpoch;
|
|
|
|
|
int clinicID = projectViewModel.isPatientAdmitted ? projectViewModel.getAdmissionInfoResponseModel.clinicID : 17;
|
|
|
|
|
service
|
|
|
|
|
.getInPatientPaymentLink(
|
|
|
|
|
projectViewModel.inPatientProjectID,
|
|
|
|
|
projectViewModel.getAdmissionInfoResponseModel.admissionNo,
|
|
|
|
|
orderID,
|
|
|
|
|
projectViewModel.user.firstName + " " + projectViewModel.user.lastName,
|
|
|
|
|
projectViewModel.user.emailAddress,
|
|
|
|
|
widget.inPatientAdvanceResponseModel.responseInpatientAdvanceInfo[0].requestedAmount,
|
|
|
|
|
projectViewModel.user.patientIdentificationNo,
|
|
|
|
|
clinicID,
|
|
|
|
|
context)
|
|
|
|
|
.then((res) {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
if (res["MessageStatus"] == 1) {
|
|
|
|
|
String paymentLink = res["PaymentUrl"];
|
|
|
|
|
if (isCopy) {
|
|
|
|
|
Share.share(paymentLink);
|
|
|
|
|
} else {
|
|
|
|
|
this.browser.openUrlRequest(urlRequest: URLRequest(url: Uri.parse(paymentLink)), options: _InAppBrowserOptions);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
AppToast.showErrorToast(message: res["endUserMessage"]);
|
|
|
|
|
}
|
|
|
|
|
}).catchError((err) {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
print(err);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|