|
|
|
|
@ -1,6 +1,8 @@
|
|
|
|
|
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/pages/ErService/EROnlineCheckIn/EROnlineCheckInBookAppointment.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/pages/ErService/EROnlineCheckIn/EROnlineCheckInPaymentDetails.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/pages/landing/landing_page.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/services/clinic_services/get_clinic_service.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/theme/colors.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
|
|
|
|
|
@ -31,7 +33,8 @@ class _EROnlineCheckInHomePageState extends State<EROnlineCheckInHomePage> with
|
|
|
|
|
@override
|
|
|
|
|
void initState() {
|
|
|
|
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
|
|
|
|
checkIfPatientHasArrived();
|
|
|
|
|
// checkIfPatientHasArrived();
|
|
|
|
|
checkPatientERClinicBalanceAmount();
|
|
|
|
|
});
|
|
|
|
|
super.initState();
|
|
|
|
|
}
|
|
|
|
|
@ -283,6 +286,7 @@ class _EROnlineCheckInHomePageState extends State<EROnlineCheckInHomePage> with
|
|
|
|
|
showNfcReader(context, onNcfScan: (String nfcId) {
|
|
|
|
|
Future.delayed(const Duration(milliseconds: 100), () {
|
|
|
|
|
print(nfcId);
|
|
|
|
|
getProjectIDFromNFC(nfcId, true);
|
|
|
|
|
// Navigator.push(context, FadePage(page: EROnlineCheckInPaymentDetails()));
|
|
|
|
|
});
|
|
|
|
|
}, onCancel: () {
|
|
|
|
|
@ -309,7 +313,7 @@ class _EROnlineCheckInHomePageState extends State<EROnlineCheckInHomePage> with
|
|
|
|
|
showNfcReader(context, onNcfScan: (String nfcId) {
|
|
|
|
|
Future.delayed(const Duration(milliseconds: 100), () {
|
|
|
|
|
print(nfcId);
|
|
|
|
|
getProjectIDFromNFC(nfcId);
|
|
|
|
|
getProjectIDFromNFC(nfcId, false);
|
|
|
|
|
});
|
|
|
|
|
}, onCancel: () {
|
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
|
@ -340,7 +344,7 @@ class _EROnlineCheckInHomePageState extends State<EROnlineCheckInHomePage> with
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void getProjectIDFromNFC(String nfcID) {
|
|
|
|
|
void getProjectIDFromNFC(String nfcID, bool isArrived) {
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
ClinicListService ancillaryOrdersService = new ClinicListService();
|
|
|
|
|
ancillaryOrdersService.getProjectIDFromNFC(nfcID).then((response) {
|
|
|
|
|
@ -348,17 +352,21 @@ class _EROnlineCheckInHomePageState extends State<EROnlineCheckInHomePage> with
|
|
|
|
|
print(response["GetProjectByNFC"]);
|
|
|
|
|
int projectID = response['GetProjectByNFC'][0]["ProjectID"];
|
|
|
|
|
String projectName = response['GetProjectByNFC'][0]["ProjectName"];
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
Navigator.push(
|
|
|
|
|
context,
|
|
|
|
|
FadePage(
|
|
|
|
|
page: EROnlineCheckInPaymentDetails(
|
|
|
|
|
projectID: projectID,
|
|
|
|
|
isERBookAppointment: false,
|
|
|
|
|
projectName: projectName,
|
|
|
|
|
if (isArrived) {
|
|
|
|
|
autoGenerateInvoiceER(projectID);
|
|
|
|
|
} else {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
Navigator.push(
|
|
|
|
|
context,
|
|
|
|
|
FadePage(
|
|
|
|
|
page: EROnlineCheckInPaymentDetails(
|
|
|
|
|
projectID: projectID,
|
|
|
|
|
isERBookAppointment: false,
|
|
|
|
|
projectName: projectName,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
AppToast.showErrorToast(message: "Invalid NFC Card Scanned.");
|
|
|
|
|
}
|
|
|
|
|
@ -382,4 +390,59 @@ class _EROnlineCheckInHomePageState extends State<EROnlineCheckInHomePage> with
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
autoGenerateInvoiceER(int projectID) {
|
|
|
|
|
DoctorsListService service = new DoctorsListService();
|
|
|
|
|
service.autoGenerateInvoiceERClinicWithNoPaymentDetails(projectID, true).then((res) {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
_showMyDialog("Your online Check-In in the ER clinic has been done successfully.", context);
|
|
|
|
|
}).catchError((err) {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
AppToast.showErrorToast(message: err);
|
|
|
|
|
print(err);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Future<void> _showMyDialog(String message, BuildContext context) async {
|
|
|
|
|
return showDialog<void>(
|
|
|
|
|
context: context,
|
|
|
|
|
barrierDismissible: true, // user must tap button!
|
|
|
|
|
builder: (BuildContext context) {
|
|
|
|
|
return AlertDialog(
|
|
|
|
|
title: const Text('Alert'),
|
|
|
|
|
content: SingleChildScrollView(
|
|
|
|
|
child: ListBody(
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Text(message),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
actions: <Widget>[
|
|
|
|
|
TextButton(
|
|
|
|
|
child: const Text('OK'),
|
|
|
|
|
onPressed: () {
|
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
|
Navigator.pushAndRemoveUntil(context, MaterialPageRoute(builder: (context) => LandingPage()), (Route<dynamic> r) => false);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void checkPatientERClinicBalanceAmount() {
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
ClinicListService ancillaryOrdersService = new ClinicListService();
|
|
|
|
|
ancillaryOrdersService.checkPatientERClinicBalanceAmount(10).then((response) {
|
|
|
|
|
print(response["BalanceAmount"]);
|
|
|
|
|
isPatientArrived = response['BalanceAmount'] > 0;
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
// erOnlineCheckInPaymentDetailsResponse = EROnlineCheckInPaymentDetailsResponse.fromJson(response["ResponsePatientShare"]);
|
|
|
|
|
setState(() {});
|
|
|
|
|
}).catchError((err) {
|
|
|
|
|
AppToast.showErrorToast(message: err.toString());
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|