|
|
|
|
import "package:collection/collection.dart";
|
|
|
|
|
import 'package:diplomaticquarterapp/core/viewModels/ancillary_orders_view_model.dart';
|
|
|
|
|
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/translations_delegate_base.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/utils.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/utils_new.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/transitions/fade_page.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
|
|
|
|
|
class AnicllaryOrdersDetails extends StatefulWidget {
|
|
|
|
|
final dynamic appoNo;
|
|
|
|
|
final dynamic orderNo;
|
|
|
|
|
final dynamic projectID;
|
|
|
|
|
|
|
|
|
|
AnicllaryOrdersDetails(this.appoNo, this.orderNo, this.projectID);
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
_AnicllaryOrdersState createState() => _AnicllaryOrdersState();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class _AnicllaryOrdersState extends State<AnicllaryOrdersDetails> with SingleTickerProviderStateMixin {
|
|
|
|
|
ProjectViewModel projectViewModel;
|
|
|
|
|
|
|
|
|
|
void initState() {
|
|
|
|
|
super.initState();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void dispose() {
|
|
|
|
|
super.dispose();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
projectViewModel = Provider.of(context);
|
|
|
|
|
return BaseView<AnciallryOrdersViewModel>(
|
|
|
|
|
onModelReady: (model) => model.getOrdersDetails(widget.appoNo, widget.orderNo, widget.projectID),
|
|
|
|
|
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),
|
|
|
|
|
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) {
|
|
|
|
|
return Padding(
|
|
|
|
|
child: Column(
|
|
|
|
|
children: [
|
|
|
|
|
Container(
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
child: Container(
|
|
|
|
|
decoration: cardRadius(12),
|
|
|
|
|
margin: EdgeInsets.zero,
|
|
|
|
|
child: Padding(
|
|
|
|
|
padding: const EdgeInsets.all(12.0),
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
Text(
|
|
|
|
|
TranslationBase.of(context).patientName + ":",
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
fontSize: 10,
|
|
|
|
|
letterSpacing: -0.6,
|
|
|
|
|
color: CustomColors.grey,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
mWidth(3),
|
|
|
|
|
Text(
|
|
|
|
|
projectViewModel.user.firstName + " " + projectViewModel.user.lastName,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
fontSize: 12,
|
|
|
|
|
letterSpacing: -0.48,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
Text(
|
|
|
|
|
TranslationBase.of(context).mrn + ":",
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
fontSize: 10,
|
|
|
|
|
letterSpacing: -0.6,
|
|
|
|
|
color: CustomColors.grey,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
mWidth(3),
|
|
|
|
|
Text(
|
|
|
|
|
projectViewModel.user.patientID.toString(),
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
fontSize: 12,
|
|
|
|
|
letterSpacing: -0.48,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
Text(
|
|
|
|
|
TranslationBase.of(context).nationalIdNumber + ":",
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
fontSize: 10,
|
|
|
|
|
letterSpacing: -0.6,
|
|
|
|
|
color: CustomColors.grey,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
mWidth(3),
|
|
|
|
|
Text(
|
|
|
|
|
projectViewModel.user.patientIdentificationNo,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
fontSize: 12,
|
|
|
|
|
letterSpacing: -0.48,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
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,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Divider()
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
padding: EdgeInsets.only(top: 5.0, bottom: 10.0),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Widget getAncillaryDetails(model) {
|
|
|
|
|
Map newMap = groupBy(model.ancillaryListsDetails[0].ancillaryOrderProcDetailsList, (obj) => obj.procedureCategoryName);
|
|
|
|
|
return Padding(padding: EdgeInsets.only(top: 0, bottom: 10), child: getHeaderDetails(newMap));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Widget getHeaderDetails(newMap) {
|
|
|
|
|
List<Widget> list = [];
|
|
|
|
|
newMap.forEach((key, value) {
|
|
|
|
|
list.add(
|
|
|
|
|
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),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: list,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
String getTotalValue(value) {
|
|
|
|
|
double total = 0.0;
|
|
|
|
|
value.ancillaryListsDetails[0].ancillaryOrderProcDetailsList.forEach((result) => {total += result.patientShareWithTax});
|
|
|
|
|
return total.toStringAsFixed(2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<TableRow> fullData(context, value) {
|
|
|
|
|
List<TableRow> 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;
|
|
|
|
|
}
|
|
|
|
|
}
|