diff --git a/lib/models/header_model.dart b/lib/models/header_model.dart new file mode 100644 index 00000000..626d0b3f --- /dev/null +++ b/lib/models/header_model.dart @@ -0,0 +1,16 @@ + + +class HeaderModel{ + String doctorName; + String doctorImageURL; + List speciality; + String invoiceNo; + String projectName; + DateTime orderDate; + String nationalityFlagURL; + int doctorRate; + int actualDoctorRate; + String email; + + HeaderModel(this.doctorName, this.doctorImageURL, this.speciality, this.invoiceNo, this.projectName, this.orderDate, this.nationalityFlagURL, this.doctorRate, this.actualDoctorRate, this.email); +} \ No newline at end of file diff --git a/lib/pages/landing/fragments/home_page_fragment2.dart b/lib/pages/landing/fragments/home_page_fragment2.dart index c3b16384..e4b0db7b 100644 --- a/lib/pages/landing/fragments/home_page_fragment2.dart +++ b/lib/pages/landing/fragments/home_page_fragment2.dart @@ -28,8 +28,7 @@ class HomePageFragment2 extends StatefulWidget { DashboardViewModel model; Function onPharmacyClick, onLoginClick; - - HomePageFragment2(this.model,{this.onLoginClick, this.onPharmacyClick}); + HomePageFragment2(this.model, {this.onLoginClick, this.onPharmacyClick}); @override _HomePageFragment2State createState() => _HomePageFragment2State(); @@ -84,7 +83,8 @@ class _HomePageFragment2State extends State { child: LoggedSliderView( projectViewModel, new SliderData(TranslationBase.of(context).fileno + ": " + projectViewModel.user.patientID.toString(), projectViewModel.user.firstName + ' ' + projectViewModel.user.lastName, - "", bannerColor[0].darkColor, bannerColor[0].lightColor),widget.model), + "", bannerColor[0].darkColor, bannerColor[0].lightColor), + widget.model), ), ), ) diff --git a/lib/pages/landing/widgets/logged_slider_view.dart b/lib/pages/landing/widgets/logged_slider_view.dart index e7a7dcb8..161d58fb 100644 --- a/lib/pages/landing/widgets/logged_slider_view.dart +++ b/lib/pages/landing/widgets/logged_slider_view.dart @@ -107,7 +107,7 @@ class LoggedSliderView extends StatelessWidget { height: 25 / 17, ), ), - mHeight(3), + mHeight(2), Text( sliderData.pateintId, style: TextStyle( diff --git a/lib/pages/medical/radiology/radiology_details_page.dart b/lib/pages/medical/radiology/radiology_details_page.dart index f6d12938..0441d3c1 100644 --- a/lib/pages/medical/radiology/radiology_details_page.dart +++ b/lib/pages/medical/radiology/radiology_details_page.dart @@ -3,11 +3,15 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/model/radiology/final_radiology.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/radiology_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/models/header_model.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_new.dart'; import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/confirm_send_email_dialog.dart'; +import 'package:diplomaticquarterapp/widgets/new_design/doctor_header.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -23,91 +27,118 @@ class RadiologyDetailsPage extends StatelessWidget { Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); return BaseView( - onModelReady: (model) => model.getRadImageURL( - projectId: finalRadiology.projectID, - lineItem: finalRadiology.invoiceLineItemNo, - invoiceNo: finalRadiology.invoiceNo), + onModelReady: (model) => model.getRadImageURL(projectId: finalRadiology.projectID, lineItem: finalRadiology.invoiceLineItemNo, invoiceNo: finalRadiology.invoiceNo), builder: (_, model, widget) => AppScaffold( - appBarTitle: TranslationBase.of(context).report, - isShowAppBar: true, - baseViewModel: model, - body: SingleChildScrollView( - child: Column( - mainAxisSize: MainAxisSize.max, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Texts( - '${finalRadiology.reportData}', - textAlign: TextAlign.center, - ), - Padding( - padding: const EdgeInsets.all(8.0), - child: Texts( - '${finalRadiology.reportData}', - textAlign: TextAlign.start, - fontSize: 17, - ), - ), - SizedBox( - height: MediaQuery.of(context).size.height * 0.2, - ) - ], - ), - ), - bottomSheet: (projectViewModel.havePrivilege(9) || - projectViewModel.havePrivilege(8)) - ? Container( + appBarTitle: TranslationBase.of(context).report, + isShowAppBar: true, + baseViewModel: model, + showNewAppBar: true, + showNewAppBarTitle: true, + backgroundColor: Color(0xffF8F8F8), + body: SingleChildScrollView( + child: Column( + mainAxisSize: MainAxisSize.max, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + DoctorHeader( + headerModel: new HeaderModel(finalRadiology.doctorName, finalRadiology.doctorImageURL, finalRadiology.speciality, finalRadiology.invoiceNo.toString(), finalRadiology.projectName, + finalRadiology.orderDate, finalRadiology.nationalityFlagURL, finalRadiology.doctorRate, finalRadiology.actualDoctorRate, model.user.emailAddress), + onTap: () { + showConfirmMessage(finalRadiology: finalRadiology, model: model); + }, + buttonTitle: TranslationBase.of(context).sendCopyRad, + isNeedToShowButton: projectViewModel.havePrivilege(8), + ), + Card( + margin: EdgeInsets.all(24), + shape: cardRadius(12), + elevation: 0, + child: Container( width: double.infinity, - height: finalRadiology.dIAPACSURL != "" - ? MediaQuery.of(context).size.height * 0.25 - : MediaQuery.of(context).size.height * 0.14, - color: Colors.grey[100], - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - Divider(), - if (finalRadiology.dIAPACSURL != "" && - projectViewModel.havePrivilege(9)) - Container( - width: MediaQuery.of(context).size.width * 0.8, - child: Button( - onTap: () { - launch(model.radImageURL); - }, - label: TranslationBase.of(context).openRad, - backgroundColor: Colors.grey[800], + child: Padding( + padding: const EdgeInsets.all(12.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Text( + "General Result", + style: TextStyle( + fontSize: 16, + letterSpacing: -0.64, + fontWeight: FontWeight.w600, ), ), - if (projectViewModel.havePrivilege(8)) - Container( - width: MediaQuery.of(context).size.width * 0.8, - child: Button( - onTap: () { - showConfirmMessage( - finalRadiology: finalRadiology, model: model); - }, - label: TranslationBase.of(context).sendCopyRad, - loading: model.state == ViewState.BusyLocal, - backgroundColor: Theme.of(context).primaryColor, - ), - ) - ], + mHeight(10), + Text( + '${finalRadiology.reportData}', + style: TextStyle(fontSize: 12, letterSpacing: -0.48), + ), + // Texts( + // '${finalRadiology.reportData}', + // textAlign: TextAlign.start, + // fontSize: 12, + // + // ), + mHeight(16), + (projectViewModel.havePrivilege(9) || projectViewModel.havePrivilege(8)) + ? (finalRadiology.dIAPACSURL != "" && projectViewModel.havePrivilege(9)) + ? Container( + width: MediaQuery.of(context).size.width * 0.8, + child: Button( + onTap: () { + launch(model.radImageURL); + }, + label: TranslationBase.of(context).openRad, + backgroundColor: CustomColors.accentColor, + ), + ) + : Container() + : Container(), + ], + ), ), - ) - : Container()), + ), + ), + ], + ), + ), + // bottomSheet: (projectViewModel.havePrivilege(9) || projectViewModel.havePrivilege(8)) + // ? Container( + // width: double.infinity, + // height: finalRadiology.dIAPACSURL != "" ? MediaQuery.of(context).size.height * 0.25 : MediaQuery.of(context).size.height * 0.14, + // color: Colors.grey[100], + // child: Column( + // mainAxisSize: MainAxisSize.min, + // children: [ + // Divider(), + // if (projectViewModel.havePrivilege(8)) + // Container( + // width: MediaQuery.of(context).size.width * 0.8, + // child: Button( + // onTap: () { + // showConfirmMessage(finalRadiology: finalRadiology, model: model); + // }, + // label: TranslationBase.of(context).sendCopyRad, + // loading: model.state == ViewState.BusyLocal, + // backgroundColor: Theme.of(context).primaryColor, + // ), + // ) + // ], + // ), + // ) + // : Container(), + ), ); } - void showConfirmMessage( - {FinalRadiology finalRadiology, RadiologyViewModel model}) { + void showConfirmMessage({FinalRadiology finalRadiology, RadiologyViewModel model}) { showDialog( context: AppGlobal.context, child: ConfirmSendEmailDialog( email: model.user.emailAddress, onTapSendEmail: () { - model.sendRadReportEmail( - mes: TranslationBase.of(AppGlobal.context).sendSuc, - finalRadiology: finalRadiology); + model.sendRadReportEmail(mes: TranslationBase.of(AppGlobal.context).sendSuc, finalRadiology: finalRadiology); }, ), ); diff --git a/lib/widgets/data_display/medical/LabResult/laboratory_result_widget.dart b/lib/widgets/data_display/medical/LabResult/laboratory_result_widget.dart index ccd1fc4b..8a27f75d 100644 --- a/lib/widgets/data_display/medical/LabResult/laboratory_result_widget.dart +++ b/lib/widgets/data_display/medical/LabResult/laboratory_result_widget.dart @@ -2,6 +2,7 @@ import 'package:diplomaticquarterapp/core/model/labs/lab_result.dart'; import 'package:diplomaticquarterapp/core/model/labs/patient_lab_orders.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/labs_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/models/header_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; @@ -50,9 +51,17 @@ class _LaboratoryResultWidgetState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ DoctorHeader( - patientLabOrder: widget.patientLabOrder, - invoiceNo: widget.billNo, - email: model.user.emailAddress, + headerModel: new HeaderModel( + widget.patientLabOrder.doctorName, + widget.patientLabOrder.doctorImageURL, + widget.patientLabOrder.speciality, + widget.billNo, + widget.patientLabOrder.projectName, + widget.patientLabOrder.orderDate, + widget.patientLabOrder.nationalityFlagURL, + widget.patientLabOrder.doctorRate, + widget.patientLabOrder.actualDoctorRate, + model.user.emailAddress), onTap: widget.onTap, ), SizedBox(height: 10), diff --git a/lib/widgets/data_display/medical/doctor_card.dart b/lib/widgets/data_display/medical/doctor_card.dart index 16b9c41a..debdb8ce 100644 --- a/lib/widgets/data_display/medical/doctor_card.dart +++ b/lib/widgets/data_display/medical/doctor_card.dart @@ -76,7 +76,7 @@ class DoctorCard extends StatelessWidget { : !isInOutPatient ? TranslationBase.of(context).inPatient.toLowerCase().capitalizeFirstofEach : TranslationBase.of(context).outpatient.toLowerCase().capitalizeFirstofEach, - style: TextStyle(fontSize: 10, fontFamily: "Poppins", fontWeight: FontWeight.w700, color: Colors.white, letterSpacing: -0.2, height: 16 / 10), + style: TextStyle(fontSize: 10, fontWeight: FontWeight.w700, color: Colors.white, letterSpacing: -0.2, height: 16 / 10), ), ), ), @@ -94,7 +94,7 @@ class DoctorCard extends StatelessWidget { Expanded( child: Text( (name ?? ""), - style: TextStyle(fontSize: 16, fontFamily: "Poppins", fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64, height: 25 / 16), + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64, height: 25 / 16), ), ), Column( @@ -103,11 +103,11 @@ class DoctorCard extends StatelessWidget { children: [ Text( DateUtil.formatDateToDate(date), - style: TextStyle(fontSize: 14, fontFamily: "Poppins", fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48, height: 18 / 12), + style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48, height: 18 / 12), ), Text( DateUtil.formatDateToTime(date), - style: TextStyle(fontSize: 14, fontFamily: "Poppins", fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.48, height: 18 / 12), + style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.48, height: 18 / 12), ), ], ) @@ -159,14 +159,12 @@ class DoctorCard extends StatelessWidget { // todo 'sikander' move this widget to separate file Widget myRichText(String title, String value) { return RichText( - text: TextSpan( - text: title, - style: TextStyle(fontSize: 12, fontFamily: "Poppins", fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.4, height: 18 / 10), - children: [ - TextSpan( - text: " $value", - style: TextStyle(fontSize: 14, fontFamily: "Poppins", fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48, height: 18 / 12), - ) - ]), + text: + TextSpan(text: title, style: TextStyle(fontSize: 12, fontFamily: "Poppins", fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.4, height: 18 / 10), children: [ + TextSpan( + text: " $value", + style: TextStyle(fontSize: 14, fontFamily: "Poppins", fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48, height: 18 / 12), + ) + ]), ); -} \ No newline at end of file +} diff --git a/lib/widgets/new_design/doctor_header.dart b/lib/widgets/new_design/doctor_header.dart index 6fab1b60..f433db60 100644 --- a/lib/widgets/new_design/doctor_header.dart +++ b/lib/widgets/new_design/doctor_header.dart @@ -1,4 +1,5 @@ import 'package:diplomaticquarterapp/core/model/labs/patient_lab_orders.dart'; +import 'package:diplomaticquarterapp/models/header_model.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/avatar/large_avatar.dart'; @@ -10,11 +11,12 @@ import 'package:flutter_svg/flutter_svg.dart'; import 'package:rating_bar/rating_bar.dart'; class DoctorHeader extends StatelessWidget { - final PatientLabOrders patientLabOrder; - final String invoiceNo; - final String email; + final HeaderModel headerModel; final VoidCallback onTap; - DoctorHeader({Key key, @required this.patientLabOrder, @required this.email, @required this.invoiceNo, @required this.onTap}) : super(key: key); + final String buttonTitle; + final bool isNeedToShowButton; + + DoctorHeader({Key key, @required this.headerModel, @required this.buttonTitle, @required this.onTap, this.isNeedToShowButton = true}) : super(key: key); @override Widget build(BuildContext context) { @@ -30,8 +32,8 @@ class DoctorHeader extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ LargeAvatar( - name: patientLabOrder.doctorName, - url: patientLabOrder.doctorImageURL, + name: headerModel.doctorName, + url: headerModel.doctorImageURL, width: 51, height: 51, ), @@ -42,11 +44,11 @@ class DoctorHeader extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - (patientLabOrder?.speciality?.toString()?.toLowerCase()?.capitalizeFirstofEach ?? ""), - style: TextStyle(fontSize: 12, fontFamily: "Poppins", fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.48, height: 18 / 12), + (headerModel?.speciality?.toString()?.toLowerCase()?.capitalizeFirstofEach ?? ""), + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.48, height: 18 / 12), ), - myRichText(TranslationBase.of(context).invoiceNo + ":", invoiceNo), - myRichText(TranslationBase.of(context).branch, patientLabOrder.projectName), + myRichText(TranslationBase.of(context).invoiceNo + ":", headerModel.invoiceNo), + myRichText(TranslationBase.of(context).branch, headerModel.projectName), ], ), ), @@ -55,16 +57,16 @@ class DoctorHeader extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.end, children: [ Text( - DateUtil.formatDateToDate(patientLabOrder.orderDate), - style: TextStyle(fontSize: 14, fontFamily: "Poppins", fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48, height: 18 / 12), + DateUtil.formatDateToDate(headerModel.orderDate), + style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48, height: 18 / 12), ), Text( - DateUtil.formatDateToTime(patientLabOrder.orderDate), - style: TextStyle(fontSize: 14, fontFamily: "Poppins", fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48, height: 18 / 12), + DateUtil.formatDateToTime(headerModel.orderDate), + style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48, height: 18 / 12), ), Padding( padding: const EdgeInsets.only(top: 8.0), - child: Image.network(patientLabOrder.nationalityFlagURL, height: 16), + child: Image.network(headerModel.nationalityFlagURL ?? "", height: 16), ), ], ) @@ -80,7 +82,7 @@ class DoctorHeader extends StatelessWidget { children: [ SizedBox(width: 21), RatingBar.readOnly( - initialRating: patientLabOrder.doctorRate + 0.0, + initialRating: headerModel.doctorRate + 0.0, size: 15.0, filledColor: Color(0XFFD02127), emptyColor: Color(0XFFD02127), @@ -91,32 +93,34 @@ class DoctorHeader extends StatelessWidget { ), SizedBox(width: 6), Text( - "${patientLabOrder.actualDoctorRate} ${TranslationBase.of(context).reviews}", - style: TextStyle(fontSize: 12, fontFamily: "Poppins", fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48, height: 18 / 12), + "${headerModel.actualDoctorRate} ${TranslationBase.of(context).reviews}", + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48, height: 18 / 12), ), ], ), - InkWell( - onTap: () { - showConfirmMessage(context, onTap, email); - }, - child: Container( - padding: EdgeInsets.only(top: 10, bottom: 10, right: 21, left: 15), - decoration: BoxDecoration(color: Color(0XFFD02127), borderRadius: BorderRadius.only(topLeft: Radius.circular(10))), - child: Row( - mainAxisSize: MainAxisSize.min, - children: [ - // todo: 'change icon for send email' - SvgPicture.asset('assets/images/new-design/covid-19-car.svg', width: 19.0), - SizedBox(width: 6), - Text( - TranslationBase.of(context).sendEmail, - style: TextStyle(fontSize: 16, fontFamily: "Poppins", fontWeight: FontWeight.w600, color: Colors.white, letterSpacing: -0.64, height: 25 / 16), + isNeedToShowButton + ? InkWell( + onTap: () { + showConfirmMessage(context, onTap, headerModel.email); + }, + child: Container( + padding: EdgeInsets.only(top: 10, bottom: 10, right: 21, left: 15), + decoration: BoxDecoration(color: Color(0XFFD02127), borderRadius: BorderRadius.only(topLeft: Radius.circular(10))), + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + // todo: 'change icon for send email' + SvgPicture.asset('assets/images/new/email.svg', width: 19.0), + SizedBox(width: 6), + Text( + buttonTitle == null ? TranslationBase.of(context).sendEmail : buttonTitle, + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Colors.white, letterSpacing: -0.64, height: 25 / 16), + ), + ], + ), ), - ], - ), - ), - ) + ) + : Container(), ], ) ],