prescription order detail ui changes

merge-update-with-lab-changes
Sikander Saleem 4 years ago
parent d9405b2bd0
commit baf4eab604

@ -1,13 +1,17 @@
import 'package:diplomaticquarterapp/core/model/prescriptions/prescriptions_order.dart'; import 'package:diplomaticquarterapp/core/model/prescriptions/prescriptions_order.dart';
import 'package:diplomaticquarterapp/core/viewModels/medical/prescriptions_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/prescriptions_view_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.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/widgets/buttons/BottomButton.dart'; import 'package:diplomaticquarterapp/extensions/string_extensions.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/dialogs/confirm_dialog.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
class PrescriptionsHistoryDetailsPage extends StatelessWidget { class PrescriptionsHistoryDetailsPage extends StatelessWidget {
final PrescriptionsOrder prescriptionsOrder; final PrescriptionsOrder prescriptionsOrder;
@ -16,138 +20,187 @@ class PrescriptionsHistoryDetailsPage extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context);
return BaseView<PrescriptionsViewModel>( return BaseView<PrescriptionsViewModel>(
onModelReady: (model) => model.getPrescriptionReportEnh( onModelReady: (model) => model.getPrescriptionReportEnh(prescriptionsOrder: prescriptionsOrder),
prescriptionsOrder: prescriptionsOrder), builder: (_, model, widget) {
builder: (_, model, widget) => AppScaffold( int status = prescriptionsOrder.status;
isShowAppBar: true, String _statusDisp = projectViewModel.isArabic ? prescriptionsOrder.descriptionN : prescriptionsOrder.description;
appBarTitle: TranslationBase.of(context).orderDetails, Color _color;
baseViewModel: model, if (status == 1) {
body: SingleChildScrollView( //pending
child: Container( _color = Color(0xffCC9B14);
margin: EdgeInsets.all(15.0), } else if (status == 2) {
child: Column( //processing
crossAxisAlignment: CrossAxisAlignment.start, _color = Color(0xff2E303A);
children: <Widget>[ } else if (status == 3) {
SizedBox( //completed
height: 5, _color = Color(0xff359846);
), } else if (status == 4) {
Container( //cancel // Rejected
width: double.infinity, _color = Color(0xffD02127);
decoration: BoxDecoration( }
color: prescriptionsOrder.status == 3 ?Colors.green : prescriptionsOrder.status ==2 ? Colors.grey: Colors.red, return AppScaffold(
borderRadius: BorderRadius.circular(5)), isShowAppBar: true,
child: Padding( appBarTitle: TranslationBase.of(context).orderDetails,
padding: const EdgeInsets.all(8.0), baseViewModel: model,
child: Texts(TranslationBase.of(context).orderStatus +' : ${prescriptionsOrder.descriptionN}',color: Colors.white,), showNewAppBar: true,
)), backgroundColor: Color(0xffF8F8F8),
SizedBox( showNewAppBarTitle: true,
height: 15, body: Column(
), children: [
Table( Expanded(
border: TableBorder.symmetric( child: ListView(
inside: BorderSide(width: 0.5), physics: BouncingScrollPhysics(),
outside: BorderSide(width: 0.5)), padding: EdgeInsets.all(21),
children: [ children: <Widget>[
TableRow(children: [ Container(
Container( decoration: BoxDecoration(
height: 50, color: _color,
color: Colors.white, borderRadius: BorderRadius.all(
child: Center( Radius.circular(10.0),
child: Texts(TranslationBase.of(context).orderNo),
),
),
Container(
height: 50,
color: Colors.white,
child: Center(
child: Texts(TranslationBase.of(context).date),
),
),
]),
TableRow(children: [
Container(
height: 70,
color: Colors.white,
child: Center(
child: Texts('${prescriptionsOrder.iD}'),
),
),
Container(
height: 70,
color: Colors.white,
child: Center(
child: Texts('${prescriptionsOrder.createdOn.year}-${prescriptionsOrder.createdOn.day}-${prescriptionsOrder.createdOn.day} ${prescriptionsOrder.createdOn.hour}:${prescriptionsOrder.createdOn.minute}'),
), ),
boxShadow: [
BoxShadow(
color: Color(0xff000000).withOpacity(.05),
blurRadius: 27,
offset: Offset(0, -3),
),
],
), ),
]) child: Container(
], margin: EdgeInsets.only(left: 6),
), padding: EdgeInsets.symmetric(vertical: 14, horizontal: 12),
SizedBox( decoration: BoxDecoration(
height: 15, color: Colors.white,
), border: Border.all(color: Colors.white, width: 1),
...List.generate( borderRadius: BorderRadius.only(
model.prescriptionReportEnhList.length, bottomRight: Radius.circular(10.0),
(index) => Container( topRight: Radius.circular(10.0),
margin: EdgeInsets.all(8.0),
color: Colors.white,
child: Row(
children: <Widget>[
ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(5)),
child: Image.network(
model.prescriptionReportEnhList[index].imageSRCUrl,
fit: BoxFit.cover,
width: 60,
height: 70,
), ),
), ),
Expanded( child: Column(
child: Padding( mainAxisSize: MainAxisSize.min,
padding: const EdgeInsets.all(8.0), children: [
child: Column( Row(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ mainAxisSize: MainAxisSize.min,
Texts(model.prescriptionReportEnhList[index] children: [
.itemDescription), Expanded(
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
_statusDisp,
style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: _color, letterSpacing: -0.4, height: 16 / 10),
),
Text(
'${TranslationBase.of(context).orderNo}. ${prescriptionsOrder.iD}',
style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64, height: 25 / 16),
),
],
),
),
Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Text(
DateUtil.formatDateToDate(prescriptionsOrder.createdOn, projectViewModel.isArabic),
style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.4, height: 16 / 10),
),
Text(
DateUtil.formatDateToTime(prescriptionsOrder.createdOn),
style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.4, height: 16 / 10),
),
],
)
], ],
), ),
), SizedBox(height: 16),
ListView.separated(
physics: NeverScrollableScrollPhysics(),
shrinkWrap: true,
itemBuilder: (context, index) => Row(
children: <Widget>[
Container(
decoration: BoxDecoration(
border: Border.all(width: 1.0, color: Color(0xffEBEBEB)),
borderRadius: BorderRadius.all(Radius.circular(30.0)),
),
child: ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(30)),
child: Image.network(
model.prescriptionReportEnhList[index].imageSRCUrl,
fit: BoxFit.cover,
width: 48,
height: 48,
),
),
),
SizedBox(width: 14),
Expanded(
child: Text(
(model.prescriptionReportEnhList[index].itemDescription.isNotEmpty
? model.prescriptionReportEnhList[index].itemDescription
: model.prescriptionReportEnhList[index].itemDescriptionN ?? '')
.toLowerCase()
.capitalizeFirstofEach,
style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64),
),
)
],
),
separatorBuilder: (context, index) => SizedBox(height: 12),
itemCount: model.prescriptionReportEnhList.length)
],
), ),
], ),
), ),
), ],
), ),
SizedBox(height: 120,) ),
], Container(
), color: Colors.white,
), padding: EdgeInsets.only(top: 16, bottom: 16, right: 21, left: 21),
), child: DefaultButton(
bottomSheet: Container( TranslationBase.of(context).cancelOrder,
//padding: EdgeInsets.all(8.0), prescriptionsOrder.status != 1
// margin: EdgeInsets.all(8.0), ? null
child: BottomButton( : () {
label: TranslationBase.of(context).cancelOrder, showCDialog(model, context);
disabled: prescriptionsOrder.status != 1, },
textColor: Colors.white, disabledColor: Color(0xff575757),
onTap: (){ ),
),
showCDialog(model,context); ],
//showAlertDialog(context);
},
), ),
), // bottomSheet: Container(
), // //padding: EdgeInsets.all(8.0),
// // margin: EdgeInsets.all(8.0),
// child: BottomButton(
// label: TranslationBase.of(context).cancelOrder,
// disabled: prescriptionsOrder.status != 1,
// textColor: Colors.white,
// onTap: () {
// showCDialog(model, context);
// //showAlertDialog(context);
// },
// ),
// ),
);
},
); );
} }
showCDialog(PrescriptionsViewModel model,context){ showCDialog(PrescriptionsViewModel model, context) {
ConfirmDialog( ConfirmDialog(
context: context, context: context,
confirmMessage: "Are you sure ?", confirmMessage: "Are you sure ?",
okText: TranslationBase.of(context).confirm, okText: TranslationBase.of(context).confirm,
cancelText: TranslationBase.of(context).cancel, cancelText: TranslationBase.of(context).cancel,
okFunction: () { okFunction: () {
Navigator.of(context).pop(); Navigator.of(context).pop();
model.updatePressOrder(presOrderID: prescriptionsOrder.iD).then((value) { model.updatePressOrder(presOrderID: prescriptionsOrder.iD).then((value) {
Navigator.of(context).pop(); Navigator.of(context).pop();
@ -156,5 +209,4 @@ class PrescriptionsHistoryDetailsPage extends StatelessWidget {
cancelFunction: () => {}).showAlertDialog(context); cancelFunction: () => {}).showAlertDialog(context);
// dialog.showAlertDialog(context); // dialog.showAlertDialog(context);
} }
} }

Loading…
Cancel
Save