|
|
|
|
@ -2,6 +2,7 @@ import 'dart:io';
|
|
|
|
|
|
|
|
|
|
import "package:collection/collection.dart";
|
|
|
|
|
import 'package:diplomaticquarterapp/config/config.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/core/service/ancillary_orders_service.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/core/viewModels/ancillary_orders_view_model.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart';
|
|
|
|
|
@ -24,6 +25,7 @@ import 'package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
import 'package:flutter_svg/flutter_svg.dart';
|
|
|
|
|
|
|
|
|
|
class AnicllaryOrdersDetails extends StatefulWidget {
|
|
|
|
|
final dynamic appoNo;
|
|
|
|
|
@ -47,10 +49,15 @@ class _AnicllaryOrdersState extends State<AnicllaryOrdersDetails> with SingleTic
|
|
|
|
|
|
|
|
|
|
List<AncillaryOrderProcDetailsList> selectedProcList = [];
|
|
|
|
|
|
|
|
|
|
List<AncillaryOrdersListProcListModel> _ancillaryProcLists = [];
|
|
|
|
|
|
|
|
|
|
String tamaraPaymentStatus;
|
|
|
|
|
String tamaraOrderID;
|
|
|
|
|
|
|
|
|
|
void initState() {
|
|
|
|
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
|
|
|
|
getAncillaryOrderDetails();
|
|
|
|
|
});
|
|
|
|
|
super.initState();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -58,12 +65,21 @@ class _AnicllaryOrdersState extends State<AnicllaryOrdersDetails> with SingleTic
|
|
|
|
|
super.dispose();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void getAncillaryOrderDetails(AnciallryOrdersViewModel model) {
|
|
|
|
|
void getAncillaryOrderDetails() {
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
model.getOrdersDetails(widget.appoNo, widget.orderNo, widget.projectID).then((value) {
|
|
|
|
|
addToSelectedProcedures(model);
|
|
|
|
|
AncillaryOrdersService ancillaryOrdersService = new AncillaryOrdersService();
|
|
|
|
|
ancillaryOrdersService.getOrdersDetails(widget.appoNo, widget.orderNo, widget.projectID).then((response) {
|
|
|
|
|
_ancillaryProcLists = [];
|
|
|
|
|
selectedProcList = [];
|
|
|
|
|
if (response['AncillaryOrderProcList'] != null && response['AncillaryOrderProcList'].length != 0) {
|
|
|
|
|
response['AncillaryOrderProcList'].forEach((item) {
|
|
|
|
|
_ancillaryProcLists.add(AncillaryOrdersListProcListModel.fromJson(item));
|
|
|
|
|
});
|
|
|
|
|
addToSelectedProcedures();
|
|
|
|
|
}
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
}).catchError((err) {
|
|
|
|
|
AppToast.showErrorToast(message: err.toString());
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
@ -73,83 +89,74 @@ class _AnicllaryOrdersState extends State<AnicllaryOrdersDetails> with SingleTic
|
|
|
|
|
projectViewModel = Provider.of(context);
|
|
|
|
|
localContext = context;
|
|
|
|
|
AppGlobal.context = context;
|
|
|
|
|
return BaseView<AnciallryOrdersViewModel>(
|
|
|
|
|
onModelReady: (model) {
|
|
|
|
|
// getAncillaryOrderDetails(model);
|
|
|
|
|
model.getOrdersDetails(widget.appoNo, widget.orderNo, widget.projectID).then((value) {
|
|
|
|
|
addToSelectedProcedures(model);
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
builder: (_, model, widget) => AppScaffold(
|
|
|
|
|
isShowAppBar: true,
|
|
|
|
|
showNewAppBar: true,
|
|
|
|
|
showNewAppBarTitle: true,
|
|
|
|
|
baseViewModel: model,
|
|
|
|
|
appBarTitle: TranslationBase.of(context).anicllaryOrders,
|
|
|
|
|
body: SingleChildScrollView(
|
|
|
|
|
padding: EdgeInsets.all(12),
|
|
|
|
|
child: model.ancillaryListsDetails.length > 0
|
|
|
|
|
? Column(children: [
|
|
|
|
|
getPatientInfo(model),
|
|
|
|
|
getAncillaryDetails(model),
|
|
|
|
|
])
|
|
|
|
|
: getNoDataWidget(context),
|
|
|
|
|
),
|
|
|
|
|
bottomSheet: model.ancillaryListsDetails.length > 0
|
|
|
|
|
? Container(
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
borderRadius: BorderRadius.only(topLeft: Radius.circular(10), topRight: Radius.circular(10), bottomLeft: Radius.circular(10), bottomRight: Radius.circular(10)),
|
|
|
|
|
boxShadow: [
|
|
|
|
|
BoxShadow(
|
|
|
|
|
color: Colors.grey.withOpacity(0.5),
|
|
|
|
|
spreadRadius: 5,
|
|
|
|
|
blurRadius: 7,
|
|
|
|
|
offset: Offset(0, 3), // changes position of shadow
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
padding: EdgeInsets.only(left: 21, right: 21, top: 15, bottom: 15),
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
// color: Colors.white,
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
|
children: [
|
|
|
|
|
SizedBox(height: 12),
|
|
|
|
|
Text(
|
|
|
|
|
TranslationBase.of(context).YouCanPayByTheFollowingOptions,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 16.0,
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
color: Color(0xff2B353E),
|
|
|
|
|
letterSpacing: -0.64,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
width: MediaQuery.of(context).size.width * 0.75,
|
|
|
|
|
child: getPaymentMethods(),
|
|
|
|
|
),
|
|
|
|
|
_amountView(TranslationBase.of(context).patientShareTotalToDo, getTotalValue() + " " + TranslationBase.of(context).sar, isBold: true, isTotal: true),
|
|
|
|
|
SizedBox(height: 12),
|
|
|
|
|
DefaultButton(
|
|
|
|
|
TranslationBase.of(context).payNow.toUpperCase(),
|
|
|
|
|
selectedProcList.length > 0
|
|
|
|
|
? () {
|
|
|
|
|
if (getTotalValue() != "0.00") {
|
|
|
|
|
makePayment(model);
|
|
|
|
|
} else {
|
|
|
|
|
autoGenerateInvoice();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
: null,
|
|
|
|
|
color: CustomColors.green,
|
|
|
|
|
disabledColor: CustomColors.grey2,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
return AppScaffold(
|
|
|
|
|
isShowAppBar: true,
|
|
|
|
|
showNewAppBar: true,
|
|
|
|
|
showNewAppBarTitle: true,
|
|
|
|
|
appBarTitle: TranslationBase.of(context).anicllaryOrders,
|
|
|
|
|
body: SingleChildScrollView(
|
|
|
|
|
padding: EdgeInsets.all(12),
|
|
|
|
|
child: _ancillaryProcLists.isNotEmpty
|
|
|
|
|
? Column(
|
|
|
|
|
children: [
|
|
|
|
|
getPatientInfo(),
|
|
|
|
|
getAncillaryDetails(),
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
: Container(),
|
|
|
|
|
: getNoDataWidget(context),
|
|
|
|
|
),
|
|
|
|
|
bottomSheet: Container(
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
borderRadius: BorderRadius.only(topLeft: Radius.circular(10), topRight: Radius.circular(10), bottomLeft: Radius.circular(10), bottomRight: Radius.circular(10)),
|
|
|
|
|
boxShadow: [
|
|
|
|
|
BoxShadow(
|
|
|
|
|
color: Colors.grey.withOpacity(0.5),
|
|
|
|
|
spreadRadius: 5,
|
|
|
|
|
blurRadius: 7,
|
|
|
|
|
offset: Offset(0, 3), // changes position of shadow
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
padding: EdgeInsets.only(left: 21, right: 21, top: 15, bottom: 15),
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
// color: Colors.white,
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
|
children: [
|
|
|
|
|
SizedBox(height: 12),
|
|
|
|
|
Text(
|
|
|
|
|
TranslationBase.of(context).YouCanPayByTheFollowingOptions,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 16.0,
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
color: Color(0xff2B353E),
|
|
|
|
|
letterSpacing: -0.64,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
width: MediaQuery.of(context).size.width * 0.75,
|
|
|
|
|
child: getPaymentMethods(),
|
|
|
|
|
),
|
|
|
|
|
_amountView(TranslationBase.of(context).patientShareTotalToDo, getTotalValue() + " " + TranslationBase.of(context).sar, isBold: true, isTotal: true),
|
|
|
|
|
SizedBox(height: 12),
|
|
|
|
|
DefaultButton(
|
|
|
|
|
TranslationBase.of(context).payNow.toUpperCase(),
|
|
|
|
|
selectedProcList.length > 0
|
|
|
|
|
? () {
|
|
|
|
|
if (getTotalValue() != "0.00") {
|
|
|
|
|
makePayment();
|
|
|
|
|
} else {
|
|
|
|
|
autoGenerateInvoice();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
: null,
|
|
|
|
|
color: selectedProcList.length > 0 ? CustomColors.green : CustomColors.grey2,
|
|
|
|
|
disabledColor: CustomColors.grey2,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
@ -184,7 +191,7 @@ class _AnicllaryOrdersState extends State<AnicllaryOrdersDetails> with SingleTic
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Widget getPatientInfo(AnciallryOrdersViewModel model) {
|
|
|
|
|
Widget getPatientInfo() {
|
|
|
|
|
return Padding(
|
|
|
|
|
child: Column(
|
|
|
|
|
children: [
|
|
|
|
|
@ -277,7 +284,7 @@ class _AnicllaryOrdersState extends State<AnicllaryOrdersDetails> with SingleTic
|
|
|
|
|
),
|
|
|
|
|
mWidth(3),
|
|
|
|
|
Text(
|
|
|
|
|
model.ancillaryListsDetails[0].appointmentNo.toString(),
|
|
|
|
|
_ancillaryProcLists[0].appointmentNo.toString(),
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
fontSize: 12,
|
|
|
|
|
@ -300,7 +307,7 @@ class _AnicllaryOrdersState extends State<AnicllaryOrdersDetails> with SingleTic
|
|
|
|
|
),
|
|
|
|
|
mWidth(3),
|
|
|
|
|
Text(
|
|
|
|
|
model.ancillaryListsDetails[0].ancillaryOrderProcDetailsList[0].orderNo.toString(),
|
|
|
|
|
_ancillaryProcLists[0].ancillaryOrderProcDetailsList[0].orderNo.toString(),
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
fontSize: 12,
|
|
|
|
|
@ -325,7 +332,7 @@ class _AnicllaryOrdersState extends State<AnicllaryOrdersDetails> with SingleTic
|
|
|
|
|
mWidth(3),
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Text(
|
|
|
|
|
model.ancillaryListsDetails[0].companyName.toString(),
|
|
|
|
|
_ancillaryProcLists[0].companyName.toString(),
|
|
|
|
|
overflow: TextOverflow.clip,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
@ -350,7 +357,7 @@ class _AnicllaryOrdersState extends State<AnicllaryOrdersDetails> with SingleTic
|
|
|
|
|
),
|
|
|
|
|
mWidth(3),
|
|
|
|
|
Text(
|
|
|
|
|
model.ancillaryListsDetails[0].insurancePolicyNo.toString(),
|
|
|
|
|
_ancillaryProcLists[0].insurancePolicyNo.toString(),
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
fontSize: 12,
|
|
|
|
|
@ -370,8 +377,8 @@ class _AnicllaryOrdersState extends State<AnicllaryOrdersDetails> with SingleTic
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Widget getAncillaryDetails(model) {
|
|
|
|
|
Map newMap = groupBy(model.ancillaryListsDetails[0].ancillaryOrderProcDetailsList, (obj) => obj.procedureCategoryName);
|
|
|
|
|
Widget getAncillaryDetails() {
|
|
|
|
|
Map newMap = groupBy(_ancillaryProcLists[0].ancillaryOrderProcDetailsList, (obj) => obj.procedureCategoryName);
|
|
|
|
|
return Padding(padding: EdgeInsets.only(top: 0, bottom: 200), child: getHeaderDetails(newMap));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -493,21 +500,21 @@ class _AnicllaryOrdersState extends State<AnicllaryOrdersDetails> with SingleTic
|
|
|
|
|
return tableRow;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
makePayment(AnciallryOrdersViewModel model) {
|
|
|
|
|
makePayment() {
|
|
|
|
|
showDraggableDialog(
|
|
|
|
|
context,
|
|
|
|
|
PaymentMethod(
|
|
|
|
|
onSelectedMethod: (String method, [String selectedInstallmentPlan]) {
|
|
|
|
|
selectedPaymentMethod = method;
|
|
|
|
|
this.selectedInstallmentPlan = selectedInstallmentPlan;
|
|
|
|
|
openPayment(selectedPaymentMethod, projectViewModel.user, double.parse(getTotalValue()), null, model, selectedInstallmentPlan);
|
|
|
|
|
openPayment(selectedPaymentMethod, projectViewModel.user, double.parse(getTotalValue()), null, selectedInstallmentPlan);
|
|
|
|
|
},
|
|
|
|
|
patientShare: double.parse(getTotalValue()),
|
|
|
|
|
isFromAdvancePayment: !projectViewModel.havePrivilege(94),
|
|
|
|
|
));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
openPayment(String paymentMethod, AuthenticatedUser authenticatedUser, num amount, AppoitmentAllHistoryResultList appo, AnciallryOrdersViewModel model, [String selectedInstallmentPlan]) {
|
|
|
|
|
openPayment(String paymentMethod, AuthenticatedUser authenticatedUser, num amount, AppoitmentAllHistoryResultList appo, [String selectedInstallmentPlan]) {
|
|
|
|
|
browser = new MyInAppBrowser(onExitCallback: onBrowserExit, appo: appo, onLoadStartCallback: onBrowserLoadStart);
|
|
|
|
|
|
|
|
|
|
transID = Utils.getAdvancePaymentTransID(widget.projectID, projectViewModel.user.patientID);
|
|
|
|
|
@ -529,10 +536,10 @@ class _AnicllaryOrdersState extends State<AnicllaryOrdersDetails> with SingleTic
|
|
|
|
|
// Need to get new Service ID from Ayman for Ancillary Tamara
|
|
|
|
|
"",
|
|
|
|
|
context,
|
|
|
|
|
model.ancillaryListsDetails[0].appointmentDate,
|
|
|
|
|
model.ancillaryListsDetails[0].appointmentNo,
|
|
|
|
|
model.ancillaryListsDetails[0].clinicID,
|
|
|
|
|
model.ancillaryListsDetails[0].doctorID,
|
|
|
|
|
_ancillaryProcLists[0].appointmentDate,
|
|
|
|
|
_ancillaryProcLists[0].appointmentNo,
|
|
|
|
|
_ancillaryProcLists[0].clinicID,
|
|
|
|
|
_ancillaryProcLists[0].doctorID,
|
|
|
|
|
selectedInstallmentPlan);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -717,16 +724,18 @@ class _AnicllaryOrdersState extends State<AnicllaryOrdersDetails> with SingleTic
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
addToSelectedProcedures(AnciallryOrdersViewModel model) {
|
|
|
|
|
if (model.ancillaryListsDetails.isNotEmpty) {
|
|
|
|
|
addToSelectedProcedures() {
|
|
|
|
|
if (_ancillaryProcLists.isNotEmpty) {
|
|
|
|
|
selectedProcList.clear();
|
|
|
|
|
model.ancillaryListsDetails[0].ancillaryOrderProcDetailsList.forEach((element) {
|
|
|
|
|
if (!isProcedureDisabled(element)) {
|
|
|
|
|
selectedProcList.add(element);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
setState(() {});
|
|
|
|
|
if (_ancillaryProcLists[0].ancillaryOrderProcDetailsList.isNotEmpty) {
|
|
|
|
|
_ancillaryProcLists[0].ancillaryOrderProcDetailsList.forEach((element) {
|
|
|
|
|
if (!isProcedureDisabled(element)) {
|
|
|
|
|
selectedProcList.add(element);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
} else {}
|
|
|
|
|
}
|
|
|
|
|
setState(() {});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
String getInsuranceText(value) {
|
|
|
|
|
|