From 8d58348267e83b91546d30049ce55408a8caf780 Mon Sep 17 00:00:00 2001 From: Sultan Khan Date: Mon, 21 Dec 2020 16:32:39 +0300 Subject: [PATCH] dashboard changes --- lib/config/config.dart | 9 +- lib/config/localized_values.dart | 1 + lib/core/service/dasboard_service.dart | 12 +- lib/core/service/sickleave_service.dart | 4 +- lib/core/viewModel/sick_leave_view_model.dart | 4 +- lib/screens/dashboard_screen.dart | 721 +++++++++++------ lib/screens/patients/patients_screen.dart | 751 +++++++++--------- lib/screens/sick-leave/add-sickleave.dart | 20 +- lib/screens/sick-leave/sick_leave.dart | 11 +- lib/util/translations_delegate_base.dart | 2 + .../prescription_out_patinets_widget.dart | 46 +- lib/widgets/shared/app_texts_widget.dart | 5 +- 12 files changed, 923 insertions(+), 663 deletions(-) diff --git a/lib/config/config.dart b/lib/config/config.dart index 39dfb023..2e0adf27 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -96,7 +96,8 @@ var SERVICES_PATIANT = [ "GtMyReferredPatient", "GtMyDischargeReferralPatient", "GtMyTomorrowPatient", - "GtMyReferralPatient" + "GtMyReferralPatient", + "PatientArrivalList" ]; var SERVICES_PATIANT2 = [ "List_MyOutPatient", @@ -114,7 +115,8 @@ var SERVICES_PATIANT_HEADER = [ "Referred", "Referral Discharge", "Tomorrow", - "Referral" + "Referral", + "Arrived" ]; var SERVICES_PATIANT_HEADER_AR = [ "المريض الخارجي", @@ -123,7 +125,8 @@ var SERVICES_PATIANT_HEADER_AR = [ "المريض المحول الي", "المريض المحال المعافى", "مريض الغد", - "المريض المحول مني" + "المريض المحول مني", + "وصل المريض" ]; //****************** diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 0abdad83..3ba857e0 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -305,4 +305,5 @@ const Map> localizedValues = { 'en': "EXTEND SICK LEAVE", 'ar': 'قم بتمديد الإجازة المرضية' }, + 'patient-target': {'en': 'Target Patient', 'ar': 'الهدف المريض'} }; diff --git a/lib/core/service/dasboard_service.dart b/lib/core/service/dasboard_service.dart index 8ad8aa4f..5a66e9eb 100644 --- a/lib/core/service/dasboard_service.dart +++ b/lib/core/service/dasboard_service.dart @@ -1,20 +1,22 @@ import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/core/service/base/base_service.dart'; -// import 'package:doctor_app_flutter/models/dashboard/dashboard_model.dart'; +import 'package:doctor_app_flutter/models/dashboard/dashboard_model.dart'; class DashboardService extends BaseService { - var _dashboardItemsList = []; - get dashboardItemsList => _dashboardItemsList; + List _dashboardItemsList = []; + List get dashboardItemsList => _dashboardItemsList; // DashboardModel _dashboard = DashboardModel(); Future getDashboard() async { - return Future.value(null); + hasError = false; await baseAppClient.post( GET_DASHBOARD, onSuccess: (dynamic response, int statusCode) { _dashboardItemsList.clear(); - _dashboardItemsList = response['listDoctorDashboarKPI']; + response['listDoctorDashboarKPI'].forEach((v) { + _dashboardItemsList.add(DashboardModel.fromJson(v)); + }); }, onFailure: (String error, int statusCode) { hasError = true; diff --git a/lib/core/service/sickleave_service.dart b/lib/core/service/sickleave_service.dart index 1c5ee415..70d9a3e4 100644 --- a/lib/core/service/sickleave_service.dart +++ b/lib/core/service/sickleave_service.dart @@ -11,7 +11,7 @@ class SickLeaveService extends BaseService { List get getAllSickLeave => _getAllsickLeave; List _getAllsickLeave = []; - Future getStatistics() async { + Future getStatistics(appoNo, patientMRN) async { hasError = false; await baseAppClient.post( GET_SICKLEAVE_STATISTIC, @@ -24,7 +24,7 @@ class SickLeaveService extends BaseService { hasError = true; super.error = error; }, - body: {"PatientMRN": 3120746, "AppointmentNo": 2016054661}, + body: {"PatientMRN": patientMRN, "AppointmentNo": appoNo}, ); } diff --git a/lib/core/viewModel/sick_leave_view_model.dart b/lib/core/viewModel/sick_leave_view_model.dart index 7eac919f..a11d43ec 100644 --- a/lib/core/viewModel/sick_leave_view_model.dart +++ b/lib/core/viewModel/sick_leave_view_model.dart @@ -32,9 +32,9 @@ class SickLeaveViewModel extends BaseViewModel { setState(ViewState.Idle); } - Future preSickLeaveStatistics() async { + Future preSickLeaveStatistics(appoNo, patientMRN) async { setState(ViewState.Busy); - await _sickLeaveService.getStatistics(); + await _sickLeaveService.getStatistics(appoNo, patientMRN); if (_sickLeaveService.hasError) { error = _sickLeaveService.error; setState(ViewState.Error); diff --git a/lib/screens/dashboard_screen.dart b/lib/screens/dashboard_screen.dart index ce5776ac..0e7e5382 100644 --- a/lib/screens/dashboard_screen.dart +++ b/lib/screens/dashboard_screen.dart @@ -19,7 +19,7 @@ import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; import 'package:percent_indicator/circular_percent_indicator.dart'; import 'package:provider/provider.dart'; - +import 'package:doctor_app_flutter/models/dashboard/dashboard_model.dart'; import '../routes.dart'; import '../widgets/shared/app_texts_widget.dart'; import 'doctor/doctor_reply_screen.dart'; @@ -47,7 +47,8 @@ class _DashboardScreenState extends State { ProjectProvider projectsProvider; var _isInit = true; DoctorProfileModel profile; - + bool isExpanded = false; + String isInpatient = ""; void didChangeDependencies() async { super.didChangeDependencies(); if (_isInit) { @@ -77,7 +78,6 @@ class _DashboardScreenState extends State { builder: (_, model, w) => AppScaffold( baseViewModel: model, isShowAppBar: false, - isLoading: isLoading, body: ListView(children: [ Column( children: [ @@ -211,182 +211,437 @@ class _DashboardScreenState extends State { ), Container( color: Colors.white, - height: 90, + height: this.isExpanded ? 150 : 90, ), ], ), Positioned( - right: 9.0, - left: 9, - bottom: 19, - child: Container( - decoration: BoxDecoration( - color: HexColor("#DED8CF"), - borderRadius: BorderRadius.all( - Radius.circular(10.0), - ), - ), - margin: EdgeInsets.only(left: 10, right: 10), - height: 140, - width: double.infinity, - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Divider(), - Padding( - padding: const EdgeInsets.only( - top: 8.0, bottom: 8, right: 40, left: 8), - child: CircularPercentIndicator( - radius: 100, - animation: true, - animationDuration: 1200, - lineWidth: 7.0, - percent: .75, - center: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - AppText( - "38", - fontSize: SizeConfig.textMultiplier * 3.7, - color: HexColor('#5D4C35'), - fontWeight: FontWeight.bold, - ), - AppText( - TranslationBase.of(context).outPatients, - fontWeight: FontWeight.normal, - fontSize: SizeConfig.textMultiplier * 1.4, - color: HexColor('#5D4C35'), - ), - ], + right: 9.0, + left: 9, + bottom: 15, + child: ExpandableCardContainer( + expandedChild: Container( + margin: EdgeInsets.only(left: 10, right: 10), + height: MediaQuery.of(context).orientation == + Orientation.portrait + ? MediaQuery.of(context).size.height * 0.22 + : MediaQuery.of(context).size.height * 0.25, + width: double.infinity, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + DashboardItem( + onTap: () { + setState(() { + this.isExpanded = false; + }); + }, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Column( + children: [ + Row( + children: [ + Expanded( + child: Column( + children: [ + AppText( + model.dashboardItemsList + .length > + 0 + ? isInpatient == 'in' + ? model + .dashboardItemsList[ + 0] + .summaryoptions[0] + .value + .toString() + : model + .dashboardItemsList[ + 1] + .summaryoptions[0] + .value + .toString() + : "", + fontWeight: FontWeight.bold, + color: Colors.white, + fontSize: 24, + ), + AppText( + model.dashboardItemsList + .length > + 0 + ? isInpatient == 'in' + ? model + .dashboardItemsList[ + 0] + .summaryoptions[0] + .kPIParameter + : model + .dashboardItemsList[ + 1] + .summaryoptions[0] + .kPIParameter + : "", + //'My Admitted Patient', + color: Colors.white, + textAlign: TextAlign.center, + fontSize: 12, + ) + ], + )), + Expanded( + child: Column( + children: [ + AppText( + model.dashboardItemsList + .length > + 0 + ? isInpatient == 'in' + ? model + .dashboardItemsList[ + 0] + .summaryoptions[1] + .value + .toString() + : model + .dashboardItemsList[ + 1] + .summaryoptions[1] + .value + .toString() + : "", + fontWeight: FontWeight.bold, + color: Colors.white, + fontSize: 28, + ), + AppText( + model.dashboardItemsList + .length > + 0 + ? isInpatient == 'in' + ? model + .dashboardItemsList[ + 0] + .summaryoptions[1] + .kPIParameter + : model + .dashboardItemsList[ + 1] + .summaryoptions[1] + .kPIParameter + : "", + color: Colors.white, + textAlign: TextAlign.center, + fontSize: 12, + ) + ], + )), + Expanded( + child: Column( + children: [ + AppText( + model.dashboardItemsList + .length > + 0 + ? isInpatient == 'in' + ? model + .dashboardItemsList[ + 0] + .summaryoptions[2] + .value + .toString() + : model + .dashboardItemsList[ + 1] + .summaryoptions[2] + .value + .toString() + : "", + fontWeight: FontWeight.bold, + color: Colors.white, + fontSize: 28), + AppText( + model.dashboardItemsList + .length > + 0 + ? isInpatient == 'in' + ? model + .dashboardItemsList[ + 0] + .summaryoptions[2] + .kPIParameter + .toString() + : model + .dashboardItemsList[ + 1] + .summaryoptions[2] + .kPIParameter + .toString() + : "", + color: Colors.white, + fontSize: 12, + textAlign: TextAlign.center) + ], + )) + ], + ), + Row( + children: [ + Expanded( + child: Column( + children: [ + AppText( + model.dashboardItemsList + .length > + 0 + ? isInpatient == 'in' + ? model + .dashboardItemsList[ + 0] + .summaryoptions[3] + .value + .toString() + : model + .dashboardItemsList[ + 1] + .summaryoptions[3] + .value + .toString() + : "", + fontWeight: FontWeight.bold, + color: Colors.white, + fontSize: 28), + AppText( + model.dashboardItemsList + .length > + 0 + ? isInpatient == 'in' + ? model + .dashboardItemsList[ + 0] + .summaryoptions[3] + .kPIParameter + .toString() + : model + .dashboardItemsList[ + 1] + .summaryoptions[3] + .kPIParameter + .toString() + : "", + color: Colors.white, + fontSize: 12, + textAlign: TextAlign.center) + ], + )), + Expanded( + child: Column( + children: [ + AppText( + model.dashboardItemsList + .length > + 0 + ? isInpatient == 'in' + ? model + .dashboardItemsList[ + 0] + .summaryoptions[ + 4] + .value + .toString() + : model + .dashboardItemsList[ + 1] + .summaryoptions[ + 4] + .value + .toString() + : "", + fontWeight: FontWeight.bold, + color: Colors.white, + fontSize: 28), + AppText( + model.dashboardItemsList + .length > + 0 + ? isInpatient == 'in' + ? model + .dashboardItemsList[ + 0] + .summaryoptions[ + 4] + .kPIParameter + .toString() + : model + .dashboardItemsList[ + 1] + .summaryoptions[ + 4] + .kPIParameter + .toString() + : "", + color: Colors.white, + fontSize: 12, + textAlign: TextAlign.center) + ], + ), + ), + Expanded( + child: Container(), + ) + ], + ) + ], + )), + imageName: '5.png', + color: HexColor('#B8382C'), + hasBorder: false, + width: MediaQuery.of(context).size.width * 0.9, + height: MediaQuery.of(context).orientation == + Orientation.portrait + ? MediaQuery.of(context).size.height * 0.22 + : MediaQuery.of(context).size.height * 0.25, ), - circularStrokeCap: CircularStrokeCap.butt, - backgroundColor: Colors.blueGrey[100], - progressColor: HexColor('#B8382C'), - ), + ], ), - Container( - child: Table( - defaultColumnWidth: FixedColumnWidth( - MediaQuery.of(context).size.width / 5), -// border: TableBorder.all( -// color: Colors.black26, -// width: 1, -// style: BorderStyle.solid), - border: TableBorder.symmetric( - inside: BorderSide( - width: 0.5, - color: HexColor('#5D4C35'), - ), - ), - children: [ - TableRow( - children: [ - TableCell( - child: Center( - child: Column( + ), + collapsedChild: Container( + margin: EdgeInsets.only(left: 10, right: 10), + height: MediaQuery.of(context).orientation == + Orientation.portrait + ? MediaQuery.of(context).size.height * 0.15 + : MediaQuery.of(context).size.height * 0.25, + width: double.infinity, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + DashboardItem( + onTap: () { + setState(() { + this.isExpanded = true; + this.isInpatient = 'in'; + }); + }, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Column( + mainAxisAlignment: + MainAxisAlignment.start, children: [ - InkWell( - child: AppText( - TranslationBase.of(context).arrived, - fontSize: - SizeConfig.textMultiplier * 1.5, - color: HexColor('#5D4C35'), - ), - onTap: () {}, - ), AppText( - "23", + model.dashboardItemsList.length > 0 + ? getPatientCount( + model.dashboardItemsList[0]) + : "", fontSize: - SizeConfig.textMultiplier * 2.7, - color: HexColor('#5D4C35'), - fontWeight: FontWeight.bold, - ), - SizedBox( - height: 6, + SizeConfig.textMultiplier * 6, + color: Colors.white, ), + Flexible( + child: AppText( + TranslationBase.of(context).inPatient, + color: Colors.white, + textOverflow: TextOverflow.ellipsis, + )), ], ), - )), - TableCell( - child: Column( + Padding( + padding: EdgeInsets.all(5), + child: Column( + mainAxisAlignment: + MainAxisAlignment.end, + children: [ + Icon( + DoctorApp.in_patient_white, + size: 35, + color: Colors.white, + ) + ], + )) + ], + ), + ), + imageName: '4.png', + color: HexColor('#B8382C'), + hasBorder: false, + width: MediaQuery.of(context).size.width * 0.44, + height: MediaQuery.of(context).orientation == + Orientation.portrait + ? MediaQuery.of(context).size.height * 0.15 + : MediaQuery.of(context).size.height * 0.25, + ), + DashboardItem( + onTap: () { + setState(() { + isExpanded = true; + this.isInpatient = 'out'; + }); + }, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Column( + mainAxisAlignment: + MainAxisAlignment.start, children: [ AppText( - TranslationBase.of(context).er, - fontSize: - SizeConfig.textMultiplier * 1.5, - color: HexColor('#5D4C35'), - ), - AppText( - "03", + model.dashboardItemsList.length > 0 + ? getPatientCount( + model.dashboardItemsList[1]) + : "", fontSize: - SizeConfig.textMultiplier * 2.7, - color: HexColor('#5D4C35'), - fontWeight: FontWeight.bold, - ), - SizedBox( - height: 6, + SizeConfig.textMultiplier * 6, + color: Colors.white, ), + Flexible( + child: AppText( + TranslationBase.of(context) + .outPatients, + color: Colors.white, + textOverflow: TextOverflow.ellipsis, + )), ], ), - ), - ], -// - ), - TableRow(children: [ - TableCell( - child: Column( - children: [ - SizedBox( - height: 6, - ), - AppText( - TranslationBase.of(context).notArrived, - fontSize: - SizeConfig.textMultiplier * 1.5, - color: HexColor('#5D4C35'), - ), - AppText( - "15", - fontSize: - SizeConfig.textMultiplier * 2.7, - color: HexColor('#5D4C35'), - fontWeight: FontWeight.bold, - ), - ], - ), - ), - TableCell( - child: Column( - children: [ - SizedBox( - height: 6, - ), - AppText( - TranslationBase.of(context).walkIn, - fontSize: - SizeConfig.textMultiplier * 1.5, - color: HexColor('#5D4C35'), - ), - AppText( - "04", - fontSize: - SizeConfig.textMultiplier * 2.7, - color: HexColor('#5D4C35'), - fontWeight: FontWeight.bold, - ), - ], - ), + Padding( + padding: EdgeInsets.all(5), + child: Column( + mainAxisAlignment: + MainAxisAlignment.end, + children: [ + Icon( + DoctorApp.out_patient, + size: 35, + color: Colors.white, + ) + ], + )) + ], ), - ]), - ], - ), + ), + imageName: '5.png', + color: HexColor('#B8382C'), + hasBorder: false, + width: MediaQuery.of(context).size.width * 0.44, + height: MediaQuery.of(context).orientation == + Orientation.portrait + ? MediaQuery.of(context).size.height * 0.15 + : MediaQuery.of(context).size.height * 0.25, + ), + ], ), - Divider(), - ], - ), - ), - ) + ), + isExpanded: isExpanded, + )) ]), FractionallySizedBox( widthFactor: 0.90, @@ -412,16 +667,21 @@ class _DashboardScreenState extends State { ), ), Container( - margin: EdgeInsets.only(bottom: 10), + // margin: EdgeInsets.only(bottom: 10), child: Column( children: [ AppText( - "08", + model.dashboardItemsList.length > 0 + ? getPatientCount( + model.dashboardItemsList[7]) + : "", fontSize: SizeConfig.textMultiplier * 6, color: Colors.white, ), AppText( - TranslationBase.of(context).labResult, + TranslationBase.of(context) + .targetPatient, + textAlign: TextAlign.center, color: Colors.white, ) ], @@ -449,7 +709,10 @@ class _DashboardScreenState extends State { child: Column( children: [ AppText( - "10", + model.dashboardItemsList.length > 0 + ? getPatientCount( + model.dashboardItemsList[6]) + : "", fontSize: SizeConfig.textMultiplier * 6, color: Colors.white, ), @@ -482,7 +745,10 @@ class _DashboardScreenState extends State { child: Column( children: [ AppText( - "05", + model.dashboardItemsList.length > 0 + ? getPatientCount( + model.dashboardItemsList[2]) + : "", fontSize: SizeConfig.textMultiplier * 6, color: Colors.white, ), @@ -503,99 +769,6 @@ class _DashboardScreenState extends State { SizedBox( height: 15, ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - DashboardItem( - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Column( - children: [ - Icon( - DoctorApp.in_patient_white, - size: 40, - color: Colors.white, - ), - ], - ), - Column( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - AppText( - "14", - fontSize: SizeConfig.textMultiplier * 6, - color: Colors.white, - ), - AppText( - TranslationBase.of(context).inPatient, - color: Colors.white, - ) - ], - ) - ], - ), - ), - imageName: '4.png', - color: HexColor('#B8382C'), - hasBorder: false, - width: MediaQuery.of(context).size.width * 0.44, - height: MediaQuery.of(context).orientation == - Orientation.portrait - ? MediaQuery.of(context).size.height * 0.13 - : MediaQuery.of(context).size.height * 0.25, - ), - DashboardItem( - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Column( - children: [ - Icon( - DoctorApp.operations, - size: 40, - color: Colors.white, - ), - ], - ), - Column( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - AppText( - "07", - fontSize: SizeConfig.textMultiplier * 6, - color: Colors.white, - ), - AppText( - TranslationBase.of(context).operations, - color: Colors.white, - ) - ], - ) - ], - ), - ), - imageName: '5.png', - color: HexColor('#B8382C'), - hasBorder: false, - width: MediaQuery.of(context).size.width * 0.44, - height: MediaQuery.of(context).orientation == - Orientation.portrait - ? MediaQuery.of(context).size.height * 0.13 - : MediaQuery.of(context).size.height * 0.25, - ), - ], - ), - SizedBox( - height: 15, - ), Row( children: [ AppText( @@ -909,8 +1082,17 @@ class _DashboardScreenState extends State { this.isLoading = val; }); } + + getPatientCount(DashboardModel inPatientCount) { + int value = 0; + inPatientCount.summaryoptions.forEach((result) => {value += result.value}); + + return value.toString(); + } } +getSummaryResult(item) {} + // TODO Move to it file class DashboardItem extends StatelessWidget { const DashboardItem( @@ -970,3 +1152,28 @@ class DashboardItem extends StatelessWidget { ); } } + +class ExpandableCardContainer extends StatefulWidget { + final bool isExpanded; + final Widget collapsedChild; + final Widget expandedChild; + + const ExpandableCardContainer( + {Key key, this.isExpanded, this.collapsedChild, this.expandedChild}) + : super(key: key); + + @override + _ExpandableCardContainerState createState() => + _ExpandableCardContainerState(); +} + +class _ExpandableCardContainerState extends State { + @override + Widget build(BuildContext context) { + return new AnimatedContainer( + duration: new Duration(milliseconds: 1000), + curve: Curves.easeInOut, + child: widget.isExpanded ? widget.expandedChild : widget.collapsedChild, + ); + } +} diff --git a/lib/screens/patients/patients_screen.dart b/lib/screens/patients/patients_screen.dart index 4ca3e587..d278dbcd 100644 --- a/lib/screens/patients/patients_screen.dart +++ b/lib/screens/patients/patients_screen.dart @@ -246,24 +246,13 @@ class _PatientsScreenState extends State { @override Widget build(BuildContext context) { _locations = [ - TranslationBase - .of(context) - .all, - TranslationBase - .of(context) - .today, - TranslationBase - .of(context) - .tomorrow, - TranslationBase - .of(context) - .nextWeek, + TranslationBase.of(context).all, + TranslationBase.of(context).today, + TranslationBase.of(context).tomorrow, + TranslationBase.of(context).nextWeek, ]; projectsProvider = Provider.of(context); - final routeArgs = ModalRoute - .of(context) - .settings - .arguments as Map; + final routeArgs = ModalRoute.of(context).settings.arguments as Map; patient = routeArgs['patientSearchForm']; @@ -300,397 +289,394 @@ class _PatientsScreenState extends State { }); }); }, - builder: (_, model, w) => - AppScaffold( - appBarTitle: patientTypeTitle, - body: _isLoading - ? DrAppCircularProgressIndeicator() - : _isError + builder: (_, model, w) => AppScaffold( + appBarTitle: patientTypeTitle, + body: _isLoading + ? DrAppCircularProgressIndeicator() + : _isError ? DrAppEmbeddedError(error: error) : lItems == null || lItems.length == 0 - ? DrAppEmbeddedError( - error: TranslationBase - .of(context) - .youDontHaveAnyPatient) - : Container( - child: ListView( - scrollDirection: Axis.vertical, - children: [ - Container( - child: lItems == null - ? Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Container( - child: Center( - child: Padding( - padding: const EdgeInsets.fromLTRB( - 0, 0, 0, 0), //250 - child: - DrAppCircularProgressIndeicator(), - )), - ), - ], - ) - : Column( - children: [ - Padding( - padding: EdgeInsets.only( - top: MediaQuery.of(context) - .size - .height * - 0.03), - child: SERVICES_PATIANT2[ - int.parse(patientType)] == - "List_MyOutPatient" - ? _locationBar(context) - : Container(), - ), - SizedBox(height: 18.5), - Container( - width: SizeConfig.screenWidth * 0.9, - height: SizeConfig.screenHeight * 0.05, - child: TextField( - controller: _controller, - onChanged: (String str) { - this.searchData(str); - }, - decoration: buildInputDecoration( - context, - TranslationBase.of(context) - .searchPatient), + ? DrAppEmbeddedError( + error: + TranslationBase.of(context).youDontHaveAnyPatient) + : Container( + child: ListView( + scrollDirection: Axis.vertical, + children: [ + Container( + child: lItems == null + ? Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Container( + child: Center( + child: Padding( + padding: const EdgeInsets.fromLTRB( + 0, 0, 0, 0), //250 + child: + DrAppCircularProgressIndeicator(), + )), ), - ), - SizedBox( - height: 10.0, - ), - Divider( - thickness: 0.8, - color: Color(0xffCCCCCC), - ), - Container( - decoration: BoxDecoration( - color: Color(0Xffffffff), - borderRadius: - BorderRadius.circular(20)), - margin: EdgeInsets.fromLTRB(0, 0, 0, 0), - child: (responseModelList.length > 0) - ? Column( - // mainAxisAlignment: MainAxisAlignment.center, - children: responseModelList.map( - (PatiantInformtion item) { - return Container( - decoration: - myBoxDecoration(), - child: InkWell( - child: Row( - children: [ - Column( - mainAxisAlignment: - MainAxisAlignment - .start, - children: [ - Padding( - padding: EdgeInsets - .only( - left: - 12.0), - child: - Container( - decoration: - BoxDecoration( - boxShadow: [ - BoxShadow( - color: Color.fromRGBO( - 0, - 0, - 0, - 0.08), - offset: Offset( - 0.0, - 5.0), - blurRadius: - 16.0) - ], - borderRadius: - BorderRadius.all( - Radius.circular(35.0)), - color: Color( - 0xffCCCCCC), - ), - width: 70, - height: 70, - child: Icon( - item.genderDescription == - "Male" - ? DoctorApp - .male - : DoctorApp - .female_icon, - size: 70, - color: Colors - .white, + ], + ) + : Column( + children: [ + Padding( + padding: EdgeInsets.only( + top: MediaQuery.of(context) + .size + .height * + 0.03), + child: SERVICES_PATIANT2[ + int.parse(patientType)] == + "List_MyOutPatient" + ? _locationBar(context) + : Container(), + ), + SizedBox(height: 18.5), + Container( + width: SizeConfig.screenWidth * 0.9, + height: + SizeConfig.screenHeight * 0.05, + child: TextField( + controller: _controller, + onChanged: (String str) { + this.searchData(str); + }, + decoration: buildInputDecoration( + context, + TranslationBase.of(context) + .searchPatient), + ), + ), + SizedBox( + height: 10.0, + ), + Divider( + thickness: 0.8, + color: Color(0xffCCCCCC), + ), + Container( + decoration: BoxDecoration( + color: Color(0Xffffffff), + borderRadius: + BorderRadius.circular(20)), + margin: + EdgeInsets.fromLTRB(0, 0, 0, 0), + child: (responseModelList.length > 0) + ? Column( + // mainAxisAlignment: MainAxisAlignment.center, + children: responseModelList + .map((PatiantInformtion + item) { + return Container( + decoration: + myBoxDecoration(), + child: InkWell( + child: Row( + children: [ + Column( + mainAxisAlignment: + MainAxisAlignment + .start, + children: < + Widget>[ + Padding( + padding: EdgeInsets + .only( + left: + 12.0), + child: + Container( + decoration: + BoxDecoration( + boxShadow: [ + BoxShadow( + color: Color.fromRGBO( + 0, + 0, + 0, + 0.08), + offset: Offset(0.0, + 5.0), + blurRadius: + 16.0) + ], + borderRadius: + BorderRadius.all( + Radius.circular(35.0)), + color: Color( + 0xffCCCCCC), + ), + width: 70, + height: 70, + child: Icon( + item.genderDescription == + "Male" + ? DoctorApp + .male + : DoctorApp + .female_icon, + size: 70, + color: Colors + .white, + ), ), ), - ), - ], - ), + ], + ), - SizedBox( - width: 10, - ), + SizedBox( + width: 10, + ), - Expanded( - child: Column( - crossAxisAlignment: - CrossAxisAlignment - .start, - children: [ - Column( - children: [ - SizedBox( - height: - 10.0, - ), - Padding( - padding: EdgeInsets.symmetric( - vertical: - 5.5, - horizontal: - 22.5), - child: - AppText( - item.firstName + - " " + - item.lastName, - fontSize: - 2.0 * - SizeConfig.textMultiplier, - fontWeight: - FontWeight.bold, - backGroundcolor: - Colors.white, + Expanded( + child: Column( + crossAxisAlignment: + CrossAxisAlignment + .start, + children: [ + Column( + children: [ + SizedBox( + height: + 10.0, ), - ), - ], - ), - Row( - mainAxisAlignment: - MainAxisAlignment - .spaceAround, - children: [ - Column( - crossAxisAlignment: - CrossAxisAlignment - .start, - children: < - Widget>[ - Wrap( - children: [ + Padding( + padding: EdgeInsets.symmetric( + vertical: + 5.5, + horizontal: + 22.5), + child: AppText( - TranslationBase.of(context).fileNo, - fontSize: 1.8 * SizeConfig.textMultiplier, - fontWeight: FontWeight.bold, - backGroundcolor: Colors.white, - ), - AppText( - item.patientId.toString(), - fontSize: 1.8 * SizeConfig.textMultiplier, - fontWeight: FontWeight.w300, - backGroundcolor: Colors.white, - ), - ], - ), - SizedBox( - height: - 2.5, - ), - AppText( - 'NATIONALITY: ' + - item.nationalityName.toString(), + item.firstName + + " " + + item.lastName, fontSize: - 1.8 * SizeConfig.textMultiplier, + 2.0 * SizeConfig.textMultiplier, fontWeight: FontWeight.bold, backGroundcolor: Colors.white, ), - SizedBox( - height: - 15.5, - ), - SERVICES_PATIANT2[int.parse(patientType)] == - "List_MyOutPatient" - ? Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Container( - height: 15, - width: 60, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(25), - color: HexColor("#20A169"), + ), + ], + ), + Row( + mainAxisAlignment: + MainAxisAlignment + .spaceAround, + children: [ + Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: < + Widget>[ + Wrap( + children: [ + AppText( + TranslationBase.of(context).fileNo, + fontSize: 1.8 * SizeConfig.textMultiplier, + fontWeight: FontWeight.bold, + backGroundcolor: Colors.white, + ), + AppText( + item.patientId.toString(), + fontSize: 1.8 * SizeConfig.textMultiplier, + fontWeight: FontWeight.w300, + backGroundcolor: Colors.white, + ), + ], + ), + SizedBox( + height: + 2.5, + ), + AppText( + 'NATIONALITY: ' + + item.nationalityName.toString(), + fontSize: + 1.8 * SizeConfig.textMultiplier, + fontWeight: + FontWeight.bold, + backGroundcolor: + Colors.white, + ), + SizedBox( + height: + 15.5, + ), + SERVICES_PATIANT2[int.parse(patientType)] == "List_MyOutPatient" + ? Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Container( + height: 15, + width: 60, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(25), + color: HexColor("#20A169"), + ), + child: AppText( + item.startTime, + color: Colors.white, + fontSize: 1.5 * SizeConfig.textMultiplier, + textAlign: TextAlign.center, + fontWeight: FontWeight.bold, + ), ), - child: AppText( - item.startTime, - color: Colors.white, - fontSize: 1.5 * SizeConfig.textMultiplier, - textAlign: TextAlign.center, - fontWeight: FontWeight.bold, + SizedBox( + width: 3.5, ), - ), - SizedBox( - width: 3.5, - ), - Container( - child: AppText( - convertDateFormat2(item.appointmentDate.toString()), - fontSize: 1.5 * SizeConfig.textMultiplier, - fontWeight: FontWeight.bold, + Container( + child: AppText( + convertDateFormat2(item.appointmentDate.toString()), + fontSize: 1.5 * SizeConfig.textMultiplier, + fontWeight: FontWeight.bold, + ), ), - ), - SizedBox( - height: 0.5, - ) - ], - ) - : SizedBox( - height: 5, + SizedBox( + height: 0.5, + ) + ], + ) + : SizedBox( + height: 5, + ), + ], + ), + Column( + crossAxisAlignment: + CrossAxisAlignment.start, + // mainAxisAlignment: + // MainAxisAlignment + // .spaceBetween, + children: < + Widget>[ + SizedBox( + height: + 0.5, + ), + SizedBox( + height: + 0, + ), + Wrap( + children: [ + AppText( + TranslationBase.of(context).age2, + fontSize: 1.8 * SizeConfig.textMultiplier, + fontWeight: FontWeight.bold, + backGroundcolor: Colors.white, ), - ], - ), - Column( - crossAxisAlignment: - CrossAxisAlignment - .start, - // mainAxisAlignment: - // MainAxisAlignment - // .spaceBetween, - children: < - Widget>[ - SizedBox( - height: - 0.5, - ), - SizedBox( - height: - 0, - ), - Wrap( - children: [ - AppText( - TranslationBase.of(context).age2, - fontSize: 1.8 * SizeConfig.textMultiplier, - fontWeight: FontWeight.bold, - backGroundcolor: Colors.white, - ), - AppText( - item.age.toString(), - fontSize: 1.8 * SizeConfig.textMultiplier, - fontWeight: FontWeight.w300, - backGroundcolor: Colors.white, - ), - ], - ), - SizedBox( - height: - 2.5, - ), - Wrap( - children: [ - AppText( - TranslationBase.of(context).gender2, - fontSize: 1.8 * SizeConfig.textMultiplier, - fontWeight: FontWeight.bold, - backGroundcolor: Colors.white, - ), - AppText( - item.gender.toString() == '1' ? 'Male' : 'Female', - fontSize: 1.8 * SizeConfig.textMultiplier, - fontWeight: FontWeight.w300, - backGroundcolor: Colors.white, - ), - ], - ), - SizedBox( - height: - 8, - ), - SERVICES_PATIANT2[int.parse(patientType)] == - "List_MyOutPatient" - ? Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Container( - height: 15, - width: 60, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(25), - color: HexColor("#20A169"), + AppText( + item.age.toString(), + fontSize: 1.8 * SizeConfig.textMultiplier, + fontWeight: FontWeight.w300, + backGroundcolor: Colors.white, + ), + ], + ), + SizedBox( + height: + 2.5, + ), + Wrap( + children: [ + AppText( + TranslationBase.of(context).gender2, + fontSize: 1.8 * SizeConfig.textMultiplier, + fontWeight: FontWeight.bold, + backGroundcolor: Colors.white, + ), + AppText( + item.gender.toString() == '1' ? 'Male' : 'Female', + fontSize: 1.8 * SizeConfig.textMultiplier, + fontWeight: FontWeight.w300, + backGroundcolor: Colors.white, + ), + ], + ), + SizedBox( + height: + 8, + ), + SERVICES_PATIANT2[int.parse(patientType)] == "List_MyOutPatient" + ? Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Container( + height: 15, + width: 60, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(25), + color: HexColor("#20A169"), + ), + child: AppText( + item.startTime, + color: Colors.white, + fontSize: 1.5 * SizeConfig.textMultiplier, + textAlign: TextAlign.center, + fontWeight: FontWeight.bold, + ), ), - child: AppText( - item.startTime, - color: Colors.white, - fontSize: 1.5 * SizeConfig.textMultiplier, - textAlign: TextAlign.center, - fontWeight: FontWeight.bold, + SizedBox( + width: 3.5, ), - ), - SizedBox( - width: 3.5, - ), - Container( - child: AppText( - convertDateFormat2(item.appointmentDate.toString()), - fontSize: 1.5 * SizeConfig.textMultiplier, - fontWeight: FontWeight.bold, + Container( + child: AppText( + convertDateFormat2(item.appointmentDate.toString()), + fontSize: 1.5 * SizeConfig.textMultiplier, + fontWeight: FontWeight.bold, + ), ), - ), - SizedBox( - height: 25.5, - ), - ], - ) - : SizedBox( - height: 15, - ), - ], - ), - ], - ), - ], + SizedBox( + height: 25.5, + ), + ], + ) + : SizedBox( + height: 15, + ), + ], + ), + ], + ), + ], + ), ), - ), - // Divider(color: Colors.grey) - ], + // Divider(color: Colors.grey) + ], + ), + onTap: () { + Navigator.of(context) + .pushNamed( + PATIENTS_PROFILE, + arguments: { + "patient": item + }); + }, ), - onTap: () { - Navigator.of(context) - .pushNamed( - PATIENTS_PROFILE, - arguments: { - "patient": item - }); - }, - ), - ); - }).toList(), - ) - : Center( - child: DrAppEmbeddedError( - error: TranslationBase.of( - context) - .youDontHaveAnyPatient), + ); + }).toList(), + ) + : Center( + child: DrAppEmbeddedError( + error: TranslationBase.of( + context) + .youDontHaveAnyPatient), + ), ), - ), - ], - ), - ) - ], - ), - ), - ),); + ], + ), + ) + ], + ), + ), + ), + ); } InputDecoration buildInputDecoration(BuildContext context, hint) { @@ -760,7 +746,6 @@ class _PatientsScreenState extends State { ), ), onTap: () { - filterBooking(item.toString()); setState(() { diff --git a/lib/screens/sick-leave/add-sickleave.dart b/lib/screens/sick-leave/add-sickleave.dart index 697b9127..37bf9454 100644 --- a/lib/screens/sick-leave/add-sickleave.dart +++ b/lib/screens/sick-leave/add-sickleave.dart @@ -35,9 +35,9 @@ class AddSickLeavScreen extends StatelessWidget { children: [ Expanded( flex: 4, - child: Row( - mainAxisAlignment: - MainAxisAlignment.start, + child: Wrap( + // mainAxisAlignment: + // MainAxisAlignment.start, children: [ Column( crossAxisAlignment: @@ -68,12 +68,18 @@ class AddSickLeavScreen extends StatelessWidget { children: [ AppText( TranslationBase.of( - context) - .leaveStartDate, + context) + .leaveStartDate + + ' ', fontWeight: FontWeight.bold, ), - AppText(item.startDate) + Flexible( + child: Text( + item.startDate, + overflow: + TextOverflow.ellipsis, + )) ], ), AppText( @@ -176,6 +182,8 @@ class AddSickLeavScreen extends StatelessWidget { builder: (context) { return new Container( child: SickLeaveScreen( + appointmentNo: extendedData.appointmentNo, + patientMRN: extendedData.patientMRN, isExtended: isExtend, extendedData: extendedData, )); diff --git a/lib/screens/sick-leave/sick_leave.dart b/lib/screens/sick-leave/sick_leave.dart index 7091a54f..026b7c19 100644 --- a/lib/screens/sick-leave/sick_leave.dart +++ b/lib/screens/sick-leave/sick_leave.dart @@ -26,7 +26,13 @@ Helpers helpers = Helpers(); class SickLeaveScreen extends StatefulWidget { final bool isExtended; final GetAllSickLeaveResponse extendedData; - SickLeaveScreen({this.isExtended = false, this.extendedData}); + final appointmentNo; + final patientMRN; + SickLeaveScreen( + {this.appointmentNo, + this.patientMRN, + this.isExtended = false, + this.extendedData}); @override _SickLeaveScreenState createState() => _SickLeaveScreenState(); } @@ -69,7 +75,8 @@ class _SickLeaveScreenState extends State { return BaseView( onModelReady: (model) => model.getClinicsList(), builder: (_, model, w) => BaseView( - onModelReady: (model2) => model2.preSickLeaveStatistics(), + onModelReady: (model2) => model2.preSickLeaveStatistics( + widget.appointmentNo, widget.patientMRN), builder: (_, model2, w) => AppScaffold( baseViewModel: model2, isShowAppBar: false, diff --git a/lib/util/translations_delegate_base.dart b/lib/util/translations_delegate_base.dart index 43fec17b..1dde64be 100644 --- a/lib/util/translations_delegate_base.dart +++ b/lib/util/translations_delegate_base.dart @@ -336,6 +336,8 @@ class TranslationBase { String get extend => localizedValues['extend'][locale.languageCode]; String get extendSickLeave => localizedValues['extend-sickleave'][locale.languageCode]; + String get targetPatient => + localizedValues['patient-target'][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate { diff --git a/lib/widgets/patients/profile/prescription_out_patinets_widget.dart b/lib/widgets/patients/profile/prescription_out_patinets_widget.dart index fd43e48d..bfb7b8c7 100644 --- a/lib/widgets/patients/profile/prescription_out_patinets_widget.dart +++ b/lib/widgets/patients/profile/prescription_out_patinets_widget.dart @@ -1,11 +1,13 @@ import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/models/patient/prescription/prescription_res_model.dart'; import 'package:doctor_app_flutter/screens/patients/out_patient_prescription_details_screen.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/card_with_bgNew_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/errors/dr_app_embedded_error.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:hexcolor/hexcolor.dart'; import 'large_avatar.dart'; @@ -18,7 +20,41 @@ class PrescriptionOutPatientWidget extends StatelessWidget { Widget build(BuildContext context) { return Container( child: patientPrescriptionsList.length == 0 - ? DrAppEmbeddedError(error: 'You don\'t have any Prescriptions') + ? Center( + child: SingleChildScrollView( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Container( + padding: EdgeInsets.all(40), + decoration: BoxDecoration( + border: + Border.all(color: HexColor('#B8382C'), width: 4), + borderRadius: BorderRadius.all(Radius.circular(100))), + child: IconButton( + icon: Icon( + Icons.add, + size: 35, + ), + onPressed: () { + openAddPrescription(context); + }), + ), + Padding( + child: AppText( + TranslationBase.of(context).noSickLeaveApplied, + fontWeight: FontWeight.bold, + ), + padding: EdgeInsets.all(10), + ), + AppText( + TranslationBase.of(context).applyNow, + fontWeight: FontWeight.bold, + color: HexColor('#B8382C'), + ) + ], + ), + )) : Container( margin: EdgeInsets.fromLTRB(SizeConfig.realScreenWidth * 0.05, 0, SizeConfig.realScreenWidth * 0.05, 0), @@ -91,4 +127,12 @@ class PrescriptionOutPatientWidget extends StatelessWidget { ), ); } + + openAddPrescription(BuildContext context) { + showModalBottomSheet( + context: context, + builder: (context) { + return new Container(); + }); + } } diff --git a/lib/widgets/shared/app_texts_widget.dart b/lib/widgets/shared/app_texts_widget.dart index e52dab51..d5320bb9 100644 --- a/lib/widgets/shared/app_texts_widget.dart +++ b/lib/widgets/shared/app_texts_widget.dart @@ -20,7 +20,7 @@ class AppText extends StatefulWidget { final bool visibility; final TextAlign textAlign; final Color backGroundcolor; - + final TextOverflow textOverflow; AppText(this.data, {this.color = Colors.black, this.fontWeight = FontWeight.normal, @@ -33,6 +33,7 @@ class AppText extends StatefulWidget { this.marginLeft = 0, this.visibility = true, this.textAlign, + this.textOverflow, this.backGroundcolor = Colors.white}); @override @@ -55,7 +56,7 @@ class _AppTextState extends State { child: Text( widget.data, textAlign: widget.textAlign, - overflow: TextOverflow.clip, + overflow: widget.textOverflow ?? TextOverflow.clip, style: TextStyle( color: widget.color, fontWeight: widget.fontWeight,