|
|
|
@ -54,7 +54,11 @@ class _AnicllaryOrdersState extends State<AnicllaryOrdersDetails> with SingleTic
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
projectViewModel = Provider.of(context);
|
|
|
|
|
return BaseView<AnciallryOrdersViewModel>(
|
|
|
|
|
onModelReady: (model) => model.getOrdersDetails(widget.appoNo, widget.orderNo, widget.projectID),
|
|
|
|
|
onModelReady: (model) {
|
|
|
|
|
model.getOrdersDetails(widget.appoNo, widget.orderNo, widget.projectID).then((value) {
|
|
|
|
|
addToSelectedProcedures(model);
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
builder: (_, model, widget) => AppScaffold(
|
|
|
|
|
isShowAppBar: true,
|
|
|
|
|
showNewAppBar: true,
|
|
|
|
@ -111,7 +115,7 @@ class _AnicllaryOrdersState extends State<AnicllaryOrdersDetails> with SingleTic
|
|
|
|
|
TranslationBase.of(context).payNow.toUpperCase(),
|
|
|
|
|
selectedProcList.length > 0 && getTotalValue() != "0.00"
|
|
|
|
|
? () {
|
|
|
|
|
makePayment();
|
|
|
|
|
makePayment(model);
|
|
|
|
|
}
|
|
|
|
|
: null,
|
|
|
|
|
color: CustomColors.green,
|
|
|
|
@ -282,6 +286,7 @@ class _AnicllaryOrdersState extends State<AnicllaryOrdersDetails> with SingleTic
|
|
|
|
|
),
|
|
|
|
|
mWidth(3),
|
|
|
|
|
Row(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Text(
|
|
|
|
|
TranslationBase.of(context).insuranceCompany + ":",
|
|
|
|
@ -293,12 +298,15 @@ class _AnicllaryOrdersState extends State<AnicllaryOrdersDetails> with SingleTic
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
mWidth(3),
|
|
|
|
|
Text(
|
|
|
|
|
model.ancillaryListsDetails[0].companyName.toString(),
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
fontSize: 12,
|
|
|
|
|
letterSpacing: -0.48,
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Text(
|
|
|
|
|
model.ancillaryListsDetails[0].companyName.toString(),
|
|
|
|
|
overflow: TextOverflow.clip,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
fontSize: 12,
|
|
|
|
|
letterSpacing: -0.48,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
@ -331,7 +339,6 @@ class _AnicllaryOrdersState extends State<AnicllaryOrdersDetails> with SingleTic
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Divider()
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
padding: EdgeInsets.only(top: 5.0, bottom: 10.0),
|
|
|
|
@ -348,35 +355,74 @@ class _AnicllaryOrdersState extends State<AnicllaryOrdersDetails> with SingleTic
|
|
|
|
|
newMap.forEach((key, value) {
|
|
|
|
|
list.add(
|
|
|
|
|
Container(
|
|
|
|
|
padding: EdgeInsets.only(bottom: 8.0),
|
|
|
|
|
child: Text(key, style: TextStyle(color: Colors.black, letterSpacing: -0.64, fontSize: 18.0, fontWeight: FontWeight.bold)),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
list.add(
|
|
|
|
|
Container(
|
|
|
|
|
decoration: cardRadius(12),
|
|
|
|
|
margin: EdgeInsets.only(left: 0, top: 8, right: 0, bottom: 16),
|
|
|
|
|
child: Padding(
|
|
|
|
|
padding: const EdgeInsets.all(12.0),
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Table(
|
|
|
|
|
columnWidths: {
|
|
|
|
|
0: FlexColumnWidth(1.0),
|
|
|
|
|
1: FlexColumnWidth(2.5),
|
|
|
|
|
2: FlexColumnWidth(1.5),
|
|
|
|
|
3: FlexColumnWidth(1.5),
|
|
|
|
|
4: FlexColumnWidth(1.5),
|
|
|
|
|
},
|
|
|
|
|
children: fullData(context, value),
|
|
|
|
|
ListView.separated(
|
|
|
|
|
shrinkWrap: true,
|
|
|
|
|
physics: NeverScrollableScrollPhysics(),
|
|
|
|
|
itemBuilder: (context, index) {
|
|
|
|
|
return AbsorbPointer(
|
|
|
|
|
absorbing: isProcedureDisabled(value[index]),
|
|
|
|
|
child: Container(
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
color: getCardColor(value[index]),
|
|
|
|
|
borderRadius: BorderRadius.all(
|
|
|
|
|
Radius.circular(10.0),
|
|
|
|
|
),
|
|
|
|
|
boxShadow: [
|
|
|
|
|
BoxShadow(
|
|
|
|
|
color: Color(0xff000000).withOpacity(.05),
|
|
|
|
|
blurRadius: 27,
|
|
|
|
|
offset: Offset(0, -3),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
child: Container(
|
|
|
|
|
margin: EdgeInsets.only(left: projectViewModel.isArabic ? 0 : 6, right: projectViewModel.isArabic ? 6 : 0),
|
|
|
|
|
padding: EdgeInsets.symmetric(vertical: 12, horizontal: 12),
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
color: isProcedureDisabled(value[index]) ? Colors.grey[300] : Colors.white,
|
|
|
|
|
border: Border.all(color: isProcedureDisabled(value[index]) ? Colors.grey[300] : Colors.white, width: 1),
|
|
|
|
|
borderRadius: BorderRadius.only(
|
|
|
|
|
bottomRight: projectViewModel.isArabic ? Radius.circular(0) : Radius.circular(10.0),
|
|
|
|
|
topRight: projectViewModel.isArabic ? Radius.circular(0) : Radius.circular(10.0),
|
|
|
|
|
bottomLeft: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0),
|
|
|
|
|
topLeft: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Container(
|
|
|
|
|
padding: EdgeInsets.only(bottom: 12.0),
|
|
|
|
|
child: Text(
|
|
|
|
|
getInsuranceText(value[index]),
|
|
|
|
|
style: TextStyle(fontSize: 13, fontWeight: FontWeight.w600, color: getCardColor(value[index]), letterSpacing: -0.4, height: 16 / 10),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Table(
|
|
|
|
|
columnWidths: {
|
|
|
|
|
0: FlexColumnWidth(1.0),
|
|
|
|
|
1: FlexColumnWidth(2.5),
|
|
|
|
|
2: FlexColumnWidth(1.5),
|
|
|
|
|
3: FlexColumnWidth(1.5),
|
|
|
|
|
4: FlexColumnWidth(1.5),
|
|
|
|
|
},
|
|
|
|
|
children: fullData(context, value[index]),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
separatorBuilder: (context, index) => SizedBox(height: 12),
|
|
|
|
|
itemCount: value.length),
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: list,
|
|
|
|
@ -404,39 +450,38 @@ class _AnicllaryOrdersState extends State<AnicllaryOrdersDetails> with SingleTic
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < value.length; i++) {
|
|
|
|
|
tableRow.add(
|
|
|
|
|
TableRow(children: [
|
|
|
|
|
Checkbox(
|
|
|
|
|
value: checkIfProcedureSelected(value[i]),
|
|
|
|
|
onChanged: (v) {
|
|
|
|
|
setState(() {
|
|
|
|
|
addSelectedProcedure(value[i]);
|
|
|
|
|
});
|
|
|
|
|
}),
|
|
|
|
|
Utils.tableColumnValue('${value[i].procedureName}', isLast: true, isCapitable: false, mProjectViewModel: projectViewModel),
|
|
|
|
|
Utils.tableColumnValue('${value[i].patientShare.toString() + " " + TranslationBase.of(context).sar.toUpperCase()}', isLast: true, isCapitable: false, mProjectViewModel: projectViewModel),
|
|
|
|
|
Utils.tableColumnValue('${value[i].patientTaxAmount.toString() + " " + TranslationBase.of(context).sar.toUpperCase()}',
|
|
|
|
|
isLast: true, isCapitable: false, mProjectViewModel: projectViewModel),
|
|
|
|
|
Utils.tableColumnValue('${value[i].patientShareWithTax.toString() + " " + TranslationBase.of(context).sar.toUpperCase()}',
|
|
|
|
|
isLast: true, isCapitable: false, mProjectViewModel: projectViewModel),
|
|
|
|
|
]),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
tableRow.add(
|
|
|
|
|
TableRow(children: [
|
|
|
|
|
Checkbox(
|
|
|
|
|
value: checkIfProcedureSelected(value),
|
|
|
|
|
onChanged: (v) {
|
|
|
|
|
setState(() {
|
|
|
|
|
addSelectedProcedure(value);
|
|
|
|
|
});
|
|
|
|
|
}),
|
|
|
|
|
Utils.tableColumnValue('${value.procedureName}', isLast: true, isCapitable: false, mProjectViewModel: projectViewModel),
|
|
|
|
|
Utils.tableColumnValue('${value.patientShare.toString() + " " + TranslationBase.of(context).sar.toUpperCase()}', isLast: true, isCapitable: false, mProjectViewModel: projectViewModel),
|
|
|
|
|
Utils.tableColumnValue('${value.patientTaxAmount.toString() + " " + TranslationBase.of(context).sar.toUpperCase()}', isLast: true, isCapitable: false, mProjectViewModel: projectViewModel),
|
|
|
|
|
Utils.tableColumnValue('${value.patientShareWithTax.toString() + " " + TranslationBase.of(context).sar.toUpperCase()}', isLast: true, isCapitable: false, mProjectViewModel: projectViewModel),
|
|
|
|
|
]),
|
|
|
|
|
);
|
|
|
|
|
return tableRow;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
makePayment() {
|
|
|
|
|
showDraggableDialog(context, PaymentMethod(
|
|
|
|
|
onSelectedMethod: (String method, [String selectedInstallmentPlan]) {
|
|
|
|
|
selectedPaymentMethod = method;
|
|
|
|
|
print(selectedPaymentMethod);
|
|
|
|
|
openPayment(selectedPaymentMethod, projectViewModel.authenticatedUserObject.user, double.parse(getTotalValue()), null);
|
|
|
|
|
}, patientShare: double.parse(getTotalValue()),
|
|
|
|
|
));
|
|
|
|
|
makePayment(AnciallryOrdersViewModel model) {
|
|
|
|
|
showDraggableDialog(
|
|
|
|
|
context,
|
|
|
|
|
PaymentMethod(
|
|
|
|
|
onSelectedMethod: (String method, [String selectedInstallmentPlan]) {
|
|
|
|
|
selectedPaymentMethod = method;
|
|
|
|
|
print(selectedPaymentMethod);
|
|
|
|
|
openPayment(selectedPaymentMethod, projectViewModel.authenticatedUserObject.user, double.parse(getTotalValue()), null, model, selectedInstallmentPlan);
|
|
|
|
|
},
|
|
|
|
|
patientShare: double.parse(getTotalValue()),
|
|
|
|
|
));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
openPayment(String paymentMethod, AuthenticatedUser authenticatedUser, double amount, AppoitmentAllHistoryResultList appo) {
|
|
|
|
|
openPayment(String paymentMethod, AuthenticatedUser authenticatedUser, double amount, AppoitmentAllHistoryResultList appo, AnciallryOrdersViewModel model, [String selectedInstallmentPlan]) {
|
|
|
|
|
browser = new MyInAppBrowser(onExitCallback: onBrowserExit, appo: appo, onLoadStartCallback: onBrowserLoadStart);
|
|
|
|
|
|
|
|
|
|
transID = Utils.getAdvancePaymentTransID(widget.projectID, projectViewModel.authenticatedUserObject.user.patientID);
|
|
|
|
@ -455,7 +500,12 @@ class _AnicllaryOrdersState extends State<AnicllaryOrdersDetails> with SingleTic
|
|
|
|
|
browser,
|
|
|
|
|
false,
|
|
|
|
|
"3",
|
|
|
|
|
"");
|
|
|
|
|
"",
|
|
|
|
|
model.ancillaryListsDetails[0].appointmentDate,
|
|
|
|
|
model.ancillaryListsDetails[0].appointmentNo,
|
|
|
|
|
model.ancillaryListsDetails[0].clinicID,
|
|
|
|
|
model.ancillaryListsDetails[0].doctorID,
|
|
|
|
|
selectedInstallmentPlan);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onBrowserLoadStart(String url) {
|
|
|
|
@ -581,6 +631,60 @@ class _AnicllaryOrdersState extends State<AnicllaryOrdersDetails> with SingleTic
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
addToSelectedProcedures(AnciallryOrdersViewModel model) {
|
|
|
|
|
if (model.ancillaryListsDetails.isNotEmpty) {
|
|
|
|
|
selectedProcList.clear();
|
|
|
|
|
model.ancillaryListsDetails[0].ancillaryOrderProcDetailsList.forEach((element) {
|
|
|
|
|
if (!isProcedureDisabled(element)) {
|
|
|
|
|
selectedProcList.add(element);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
setState(() {});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
String getInsuranceText(value) {
|
|
|
|
|
String insuranceText = "";
|
|
|
|
|
if (!value.isApprovalRequired) {
|
|
|
|
|
insuranceText = "Cash";
|
|
|
|
|
} else {
|
|
|
|
|
if (value.isApprovalCreated && value.approvalNo != 0) {
|
|
|
|
|
insuranceText = "Approved";
|
|
|
|
|
} else if(value.isApprovalRequired && value.isApprovalCreated && value.approvalNo == 0) {
|
|
|
|
|
insuranceText = "Approval Rejected - Please visit receptionist";
|
|
|
|
|
} else {
|
|
|
|
|
insuranceText = "Sent For Approval";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return insuranceText;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Color getCardColor(value) {
|
|
|
|
|
Color color = Color(0xff);
|
|
|
|
|
if (!value.isApprovalRequired) {
|
|
|
|
|
color = Color(0xff2E303A);
|
|
|
|
|
} else {
|
|
|
|
|
if (value.isApprovalCreated && value.approvalNo != 0) {
|
|
|
|
|
color = Color(0xff359846);
|
|
|
|
|
} else if(value.isApprovalRequired && value.isApprovalCreated && value.approvalNo == 0) {
|
|
|
|
|
color = Color(0xffD02127);
|
|
|
|
|
} else {
|
|
|
|
|
color = Color(0xffCC9B14);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return color;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool isProcedureDisabled(AncillaryOrderProcDetailsList ancillaryOrderProcDetailsList) {
|
|
|
|
|
if ((ancillaryOrderProcDetailsList.isApprovalRequired && !ancillaryOrderProcDetailsList.isApprovalCreated) ||
|
|
|
|
|
(ancillaryOrderProcDetailsList.isApprovalCreated && ancillaryOrderProcDetailsList.approvalNo == 0) ||
|
|
|
|
|
(ancillaryOrderProcDetailsList.isApprovalRequired && ancillaryOrderProcDetailsList.isApprovalCreated && ancillaryOrderProcDetailsList.approvalNo == 0)) {
|
|
|
|
|
return true;
|
|
|
|
|
} else {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
addSelectedProcedure(AncillaryOrderProcDetailsList ancillaryOrderProcDetailsList) {
|
|
|
|
|
if (!checkIfProcedureSelected(ancillaryOrderProcDetailsList)) {
|
|
|
|
|
selectedProcList.add(ancillaryOrderProcDetailsList);
|
|
|
|
|