diff --git a/lib/pages/AlHabibMedicalService/ancillary-orders/ancillaryOrdersDetails.dart b/lib/pages/AlHabibMedicalService/ancillary-orders/ancillaryOrdersDetails.dart index 0576193b..de26c4b9 100644 --- a/lib/pages/AlHabibMedicalService/ancillary-orders/ancillaryOrdersDetails.dart +++ b/lib/pages/AlHabibMedicalService/ancillary-orders/ancillaryOrdersDetails.dart @@ -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/base/base_view.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/utils.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/others/app_scaffold_widget.dart'; -import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; @@ -49,47 +48,46 @@ class _AnicllaryOrdersState extends State with SingleTic baseViewModel: model, appBarTitle: TranslationBase.of(context).anicllaryOrders, body: SingleChildScrollView( - padding: EdgeInsets.all(12), - child: model.ancillaryListsDetails.length > 0 - ? Column(children: [ - getPatientInfo(model), - getInvoiceDetails(model), - getInsuranceDetails(model), - getAncillaryDetails(model), - Row( - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ - Texts( - TranslationBase.of(context).total, - fontSize: 20, - fontWeight: FontWeight.bold, - ), - Texts( - getTotalValue(model), - fontSize: 20, - fontWeight: FontWeight.bold, - ) - ], - ), - Row( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - Button( - label: TranslationBase.of(context).payNow, - backgroundColor: Colors.red[800], - onTap: () { - Navigator.push( - context, - FadePage( - page: OrdersPayment(), - ), - ); - }, - ) - ], - ) - ]) - : SizedBox()))); + padding: EdgeInsets.all(12), + child: model.ancillaryListsDetails.length > 0 + ? Column(children: [ + getPatientInfo(model), + getAncillaryDetails(model), + Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + Texts( + TranslationBase.of(context).total, + fontSize: 20, + fontWeight: FontWeight.bold, + ), + Texts( + getTotalValue(model), + fontSize: 20, + fontWeight: FontWeight.bold, + ) + ], + ), + ]) + : getNoDataWidget(context), + ), + bottomSheet: Container( + color: Theme.of(context).scaffoldBackgroundColor, + margin: EdgeInsets.only(bottom: 5.0), + width: double.infinity, + padding: EdgeInsets.all(12), + child: DefaultButton( + TranslationBase.of(context).payNow.toUpperCase(), + () { + Navigator.push( + context, + FadePage( + page: OrdersPayment(), + ), + ); + }, + ), + ))); } Widget getPatientInfo(AnciallryOrdersViewModel model) { @@ -172,6 +170,51 @@ class _AnicllaryOrdersState extends State with SingleTic ), ], ), + Row( + children: [ + Text( + TranslationBase.of(context).appointmentNo + ":", + style: TextStyle( + fontWeight: FontWeight.w600, + fontSize: 10, + letterSpacing: -0.6, + color: CustomColors.grey, + ), + ), + mWidth(3), + Text( + model.ancillaryListsDetails[0].appointmentNo.toString(), + style: TextStyle( + fontWeight: FontWeight.w600, + fontSize: 12, + letterSpacing: -0.48, + ), + ), + ], + ), + mWidth(3), + Row( + children: [ + Text( + TranslationBase.of(context).orderNo + ":", + style: TextStyle( + fontWeight: FontWeight.w600, + fontSize: 10, + letterSpacing: -0.6, + color: CustomColors.grey, + ), + ), + mWidth(3), + Text( + model.ancillaryListsDetails[0].ancillaryOrderProcDetailsList[0].orderNo.toString(), + style: TextStyle( + fontWeight: FontWeight.w600, + fontSize: 12, + letterSpacing: -0.48, + ), + ), + ], + ), ], ), ), @@ -184,153 +227,42 @@ class _AnicllaryOrdersState extends State with SingleTic ); } - Widget getInvoiceDetails(model) { - return Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ - Texts( - TranslationBase.of(context).invoiceNo, -// fontWeight: FontWeight.bold, - color: Colors.red[500], - ), - Texts(" : "), - Texts( - model.ancillaryListsDetails[0].appointmentNo.toString(), - ) - ], - ), - Row( - children: [ -// Texts( -// TranslationBase.of(context).invoiceDate, -// // fontWeight: FontWeight.bold, -// color: Colors.red[500], -// ), - Texts(" : "), - Texts( - DateUtil.getDayMonthYearDateFormatted( - DateUtil.convertStringToDate(model.ancillaryListsDetails[0].appointmentDate), - ), - ) - ], - ), - Row( - children: [ - Texts( - TranslationBase.of(context).doctorName, -// fontWeight: FontWeight.bold, - color: Colors.red[500], - ), - Texts(" : "), - Texts( - model.ancillaryListsDetails[0].doctorName, - ), - ], - ), - SizedBox( - height: 10, - ), - 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( - color: Colors.black26, - ), - ], - )); - } - Widget getAncillaryDetails(model) { Map newMap = groupBy(model.ancillaryListsDetails[0].ancillaryOrderProcDetailsList, (obj) => obj.procedureCategoryName); - - return Padding(padding: EdgeInsets.only(top: 10, bottom: 10), child: getHeaderDetails(newMap)); + return Padding(padding: EdgeInsets.only(top: 0, bottom: 10), child: getHeaderDetails(newMap)); } Widget getHeaderDetails(newMap) { - List list = new List(); - + List list = []; newMap.forEach((key, value) { list.add( - Texts( - key, - fontWeight: FontWeight.bold, + Container( + 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(2.0), + 1: FlexColumnWidth(1.5), + 2: FlexColumnWidth(1.5), + 3: FlexColumnWidth(1.5), + }, + children: fullData(context, value), + ), + ], + ), + ), ), ); - list.add(Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - getLabDetails(value), - ], - )); }); return Column( @@ -341,30 +273,34 @@ class _AnicllaryOrdersState extends State with SingleTic String getTotalValue(value) { 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); } - getLabDetails(value) { - return Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: value.map((result) { - return Container( - width: MediaQuery.of(context).size.width * .9, - padding: EdgeInsets.all(10), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ - Expanded(flex: 3, child: Text(result.procedureName.toString(), overflow: TextOverflow.ellipsis)), - Expanded(child: AppText(result.companyShare.toString())), - Expanded(child: AppText(result.companyTaxAmount.toString())), - Expanded( - child: AppText( - result.companyShareWithTax.toString(), - )) - ], - )); - }).toList(), + List fullData(context, value) { + List tableRow = []; + + tableRow.add( + TableRow( + children: [ + Utils.tableColumnTitle(TranslationBase.of(context).procedure), + Utils.tableColumnTitle(TranslationBase.of(context).price), + Utils.tableColumnTitle(TranslationBase.of(context).vat), + Utils.tableColumnTitle(TranslationBase.of(context).total), + ], + ), ); + + 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; } } diff --git a/lib/pages/medical/my_invoices/invoice_detail_page.dart b/lib/pages/medical/my_invoices/invoice_detail_page.dart index 55a91b9a..b928e0f8 100644 --- a/lib/pages/medical/my_invoices/invoice_detail_page.dart +++ b/lib/pages/medical/my_invoices/invoice_detail_page.dart @@ -76,7 +76,6 @@ class _InvoiceDetailState extends State { ), Container( child: Container( - decoration: cardRadius(12), margin: EdgeInsets.only(left: 16, top: 8, right: 16, bottom: 16), child: Padding( diff --git a/lib/widgets/data_display/medical/LabResult/LabResultWidget.dart b/lib/widgets/data_display/medical/LabResult/LabResultWidget.dart index 427b16e1..1a3245cf 100644 --- a/lib/widgets/data_display/medical/LabResult/LabResultWidget.dart +++ b/lib/widgets/data_display/medical/LabResult/LabResultWidget.dart @@ -144,7 +144,7 @@ class LabResultWidget extends StatelessWidget { bool checkIfCovidLab(List labResultList) { bool isCovidResult = false; 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; covidLabResult = order; }