fixes & updates

merge-update-with-lab-changes
haroon amjad 4 years ago
parent 8f91d0a0dc
commit 4acdad0e99

@ -4,13 +4,12 @@ import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/ancillary-orders/ordersPayment.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/ancillary-orders/ordersPayment.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/theme/colors.dart';
import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/uitl/utils.dart';
import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/uitl/utils_new.dart';
import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
@ -53,8 +52,6 @@ class _AnicllaryOrdersState extends State<AnicllaryOrdersDetails> with SingleTic
child: model.ancillaryListsDetails.length > 0 child: model.ancillaryListsDetails.length > 0
? Column(children: [ ? Column(children: [
getPatientInfo(model), getPatientInfo(model),
getInvoiceDetails(model),
getInsuranceDetails(model),
getAncillaryDetails(model), getAncillaryDetails(model),
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceAround, mainAxisAlignment: MainAxisAlignment.spaceAround,
@ -71,13 +68,17 @@ class _AnicllaryOrdersState extends State<AnicllaryOrdersDetails> with SingleTic
) )
], ],
), ),
Row( ])
mainAxisAlignment: MainAxisAlignment.end, : getNoDataWidget(context),
children: [ ),
Button( bottomSheet: Container(
label: TranslationBase.of(context).payNow, color: Theme.of(context).scaffoldBackgroundColor,
backgroundColor: Colors.red[800], margin: EdgeInsets.only(bottom: 5.0),
onTap: () { width: double.infinity,
padding: EdgeInsets.all(12),
child: DefaultButton(
TranslationBase.of(context).payNow.toUpperCase(),
() {
Navigator.push( Navigator.push(
context, context,
FadePage( FadePage(
@ -85,11 +86,8 @@ class _AnicllaryOrdersState extends State<AnicllaryOrdersDetails> with SingleTic
), ),
); );
}, },
) ),
], )));
)
])
: SizedBox())));
} }
Widget getPatientInfo(AnciallryOrdersViewModel model) { Widget getPatientInfo(AnciallryOrdersViewModel model) {
@ -172,165 +170,99 @@ class _AnicllaryOrdersState extends State<AnicllaryOrdersDetails> with SingleTic
), ),
], ],
), ),
],
),
),
),
),
Divider()
],
),
padding: EdgeInsets.only(top: 5.0, bottom: 10.0),
);
}
Widget getInvoiceDetails(model) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row( Row(
children: [ children: [
Texts( Text(
TranslationBase.of(context).invoiceNo, TranslationBase.of(context).appointmentNo + ":",
// fontWeight: FontWeight.bold, style: TextStyle(
color: Colors.red[500], fontWeight: FontWeight.w600,
fontSize: 10,
letterSpacing: -0.6,
color: CustomColors.grey,
), ),
Texts(" : "), ),
Texts( mWidth(3),
Text(
model.ancillaryListsDetails[0].appointmentNo.toString(), model.ancillaryListsDetails[0].appointmentNo.toString(),
) style: TextStyle(
], fontWeight: FontWeight.w600,
fontSize: 12,
letterSpacing: -0.48,
), ),
Row(
children: [
// Texts(
// TranslationBase.of(context).invoiceDate,
// // fontWeight: FontWeight.bold,
// color: Colors.red[500],
// ),
Texts(" : "),
Texts(
DateUtil.getDayMonthYearDateFormatted(
DateUtil.convertStringToDate(model.ancillaryListsDetails[0].appointmentDate),
), ),
)
], ],
), ),
mWidth(3),
Row( Row(
children: [ children: [
Texts( Text(
TranslationBase.of(context).doctorName, TranslationBase.of(context).orderNo + ":",
// fontWeight: FontWeight.bold, style: TextStyle(
color: Colors.red[500], fontWeight: FontWeight.w600,
), fontSize: 10,
Texts(" : "), letterSpacing: -0.6,
Texts( color: CustomColors.grey,
model.ancillaryListsDetails[0].doctorName,
), ),
],
), ),
SizedBox( mWidth(3),
height: 10, Text(
model.ancillaryListsDetails[0].ancillaryOrderProcDetailsList[0].orderNo.toString(),
style: TextStyle(
fontWeight: FontWeight.w600,
fontSize: 12,
letterSpacing: -0.48,
), ),
Divider(
color: Colors.black26,
)
],
);
}
Widget getInsuranceDetails(model) {
return Padding(
padding: EdgeInsets.only(top: 10, bottom: 10),
child: Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Texts(
TranslationBase.of(context).insurance,
fontWeight: FontWeight.bold,
), ),
Texts(
TranslationBase.of(context).insuranceID,
fontWeight: FontWeight.bold,
)
], ],
), ),
Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Texts(
model.ancillaryListsDetails[0].policyName,
),
Texts(
model.ancillaryListsDetails[0].insurancePolicyNo,
)
], ],
), ),
SizedBox(
height: 15,
),
Divider(
color: Colors.red[800],
thickness: 3,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Row(
children: [],
),
Row(mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [
Texts(
TranslationBase.of(context).price,
color: Colors.grey[500],
fontSize: 14,
), ),
SizedBox(width: 15),
Texts(
TranslationBase.of(context).vat,
color: Colors.grey[500],
fontSize: 14,
), ),
SizedBox(width: 15),
Texts(
TranslationBase.of(context).total,
color: Colors.grey[500],
fontSize: 14,
), ),
]), Divider()
], ],
), ),
Divider( padding: EdgeInsets.only(top: 5.0, bottom: 10.0),
color: Colors.black26, );
),
],
));
} }
Widget getAncillaryDetails(model) { Widget getAncillaryDetails(model) {
Map newMap = groupBy(model.ancillaryListsDetails[0].ancillaryOrderProcDetailsList, (obj) => obj.procedureCategoryName); Map newMap = groupBy(model.ancillaryListsDetails[0].ancillaryOrderProcDetailsList, (obj) => obj.procedureCategoryName);
return Padding(padding: EdgeInsets.only(top: 0, bottom: 10), child: getHeaderDetails(newMap));
return Padding(padding: EdgeInsets.only(top: 10, bottom: 10), child: getHeaderDetails(newMap));
} }
Widget getHeaderDetails(newMap) { Widget getHeaderDetails(newMap) {
List<Widget> list = new List<Widget>(); List<Widget> list = [];
newMap.forEach((key, value) { newMap.forEach((key, value) {
list.add( list.add(
Texts( Container(
key, child: Text(key, style: TextStyle(color: Colors.black, letterSpacing: -0.64, fontSize: 18.0, fontWeight: FontWeight.bold)),
fontWeight: FontWeight.bold,
), ),
); );
list.add(Row( list.add(
mainAxisAlignment: MainAxisAlignment.start, 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: [ children: [
getLabDetails(value), Table(
columnWidths: {
0: FlexColumnWidth(2.0),
1: FlexColumnWidth(1.5),
2: FlexColumnWidth(1.5),
3: FlexColumnWidth(1.5),
},
children: fullData(context, value),
),
], ],
)); ),
),
),
);
}); });
return Column( return Column(
@ -341,30 +273,34 @@ class _AnicllaryOrdersState extends State<AnicllaryOrdersDetails> with SingleTic
String getTotalValue(value) { String getTotalValue(value) {
double total = 0.0; double total = 0.0;
value.ancillaryListsDetails[0].ancillaryOrderProcDetailsList.forEach((result) => {total += result.companyShareWithTax}); value.ancillaryListsDetails[0].ancillaryOrderProcDetailsList.forEach((result) => {total += result.patientShareWithTax});
return total.toStringAsFixed(2); return total.toStringAsFixed(2);
} }
getLabDetails(value) { List<TableRow> fullData(context, value) {
return Column( List<TableRow> tableRow = [];
crossAxisAlignment: CrossAxisAlignment.start,
children: value.map<Widget>((result) { tableRow.add(
return Container( TableRow(
width: MediaQuery.of(context).size.width * .9,
padding: EdgeInsets.all(10),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [ children: [
Expanded(flex: 3, child: Text(result.procedureName.toString(), overflow: TextOverflow.ellipsis)), Utils.tableColumnTitle(TranslationBase.of(context).procedure),
Expanded(child: AppText(result.companyShare.toString())), Utils.tableColumnTitle(TranslationBase.of(context).price),
Expanded(child: AppText(result.companyTaxAmount.toString())), Utils.tableColumnTitle(TranslationBase.of(context).vat),
Expanded( Utils.tableColumnTitle(TranslationBase.of(context).total),
child: AppText(
result.companyShareWithTax.toString(),
))
], ],
)); ),
}).toList(),
); );
for (int i = 0; i < value.length; i++) {
tableRow.add(
TableRow(children: [
Utils.tableColumnValue('${value[i].procedureName.toString()}', isLast: true),
Utils.tableColumnValue('${value[i].patientShare.toString()}', isLast: true),
Utils.tableColumnValue('${value[i].patientTaxAmount.toString() + " " + TranslationBase.of(context).sar}', isLast: true),
Utils.tableColumnValue('${value[i].patientShareWithTax.toString() + " " + TranslationBase.of(context).sar}', isLast: true),
]),
);
}
return tableRow;
} }
} }

@ -76,7 +76,6 @@ class _InvoiceDetailState extends State<InvoiceDetail> {
), ),
Container( Container(
child: Container( child: Container(
decoration: cardRadius(12), decoration: cardRadius(12),
margin: EdgeInsets.only(left: 16, top: 8, right: 16, bottom: 16), margin: EdgeInsets.only(left: 16, top: 8, right: 16, bottom: 16),
child: Padding( child: Padding(

@ -144,7 +144,7 @@ class LabResultWidget extends StatelessWidget {
bool checkIfCovidLab(List<LabResult> labResultList) { bool checkIfCovidLab(List<LabResult> labResultList) {
bool isCovidResult = false; bool isCovidResult = false;
labResultList.forEach((order) { labResultList.forEach((order) {
if (order.testCode.toUpperCase().contains("COVID") && order.isCertificateAllowed.toString() == "true") { if ((order.testCode.toUpperCase().contains("COVID") || order.testCode.toUpperCase().contains("COV")) && order.isCertificateAllowed.toString().toLowerCase() == "true") {
isCovidResult = true; isCovidResult = true;
covidLabResult = order; covidLabResult = order;
} }

Loading…
Cancel
Save