diff --git a/lib/client/base_app_client.dart b/lib/client/base_app_client.dart index 604e6f30..559f7132 100644 --- a/lib/client/base_app_client.dart +++ b/lib/client/base_app_client.dart @@ -70,7 +70,7 @@ class BaseAppClient { body['Channel'] = CHANNEL; body['SessionID'] = SESSION_ID; body['IsLoginForDoctorApp'] = IS_LOGIN_FOR_DOCTOR_APP; - body['PatientOutSA'] = body['PatientOutSA']??0; // PATIENT_OUT_SA; + body['PatientOutSA'] = body['PatientOutSA'] ?? 0; // PATIENT_OUT_SA; if (body['VidaAuthTokenID'] == null) { body['VidaAuthTokenID'] = await sharedPref.getString(VIDA_AUTH_TOKEN_ID); @@ -96,9 +96,12 @@ class BaseAppClient { } else { var parsed = json.decode(response.body.toString()); if (!parsed['IsAuthenticated']) { - // onFailure(getError(parsed), statusCode); - await helpers.logout(); - helpers.showErrorToast('Your session expired Please login agian'); + if (body['OTP_SendType'] != null) { + onFailure(getError(parsed), statusCode); + } else { + await helpers.logout(); + helpers.showErrorToast('Your session expired Please login agian'); + } } else if (parsed['MessageStatus'] == 1) { if (!parsed['IsAuthenticated']) onFailure(getError(parsed), statusCode); diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index c25d8fae..2f9f5d66 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -29,7 +29,7 @@ const Map> localizedValues = { 'en': 'Answer/Suggestions', 'ar': 'ملاحضات وتفاصيل العيادة' }, - 'outPatients': {'en': 'Out-Patients', 'ar': 'المريض الخارجي'}, + 'outPatients': {'en': 'Out Patient', 'ar': 'المريض الخارجي'}, 'searchPatient': {'en': 'Search Patient', 'ar': 'البحث عن مريض'}, 'searchAbout': {'en': 'Search', 'ar': 'البحث عن'}, 'patient': {'en': 'Patient', 'ar': ' مريض'}, @@ -44,7 +44,7 @@ const Map> localizedValues = { 'radiology': {'en': 'Radiology', 'ar': 'الأشعة'}, 'service': {'en': 'Service', 'ar': 'خدمة'}, 'referral': {'en': 'Referral', 'ar': 'االإحالة'}, - 'inPatient': {'en': 'In-Patient', 'ar': 'المريض الداخلي'}, + 'inPatient': {'en': 'In Patient', 'ar': 'المريض الداخلي'}, 'operations': {'en': 'Operations', 'ar': 'عمليات'}, 'patientServices': {'en': 'Patient Services', 'ar': 'خدمات المرضى'}, 'searchMedicine': {'en': 'Search Medicine', 'ar': 'بحث عن الدواء'}, @@ -426,7 +426,10 @@ const Map> localizedValues = { 'ar': 'تاريخ القبول المتوقع' }, // 'emergencyAdmission': {'en': "EMERGENCY ADMISSION", 'ar': 'دخول الطوارئ'}, - 'isSickLeaveRequired': {'en': "Is Sick Leave Required", 'ar': 'هل الإجازة المرضية مطلوبة'}, + 'isSickLeaveRequired': { + 'en': "Is Sick Leave Required", + 'ar': 'هل الإجازة المرضية مطلوبة' + }, 'patientPregnant': {'en': "Patient Pregnant", 'ar': 'حمل المريض'}, 'treatmentLine': { 'en': "Main line of treatment", @@ -459,10 +462,7 @@ const Map> localizedValues = { 'en': "POST PLANS & ESTIMATED COST", 'ar': 'خطط البريد والتكلفة المقدرة' }, - 'postPlans': { - 'en': "POST PLANS", - 'ar': 'خطط البريد' - }, + 'postPlans': {'en': "POST PLANS", 'ar': 'خطط البريد'}, 'ucaf': {'en': "UCAF", 'ar': 'UCAF'}, 'emergencyCase': {'en': "Emergency Case", 'ar': 'حالة طارئة'}, 'durationOfIllness': {'en': "duration Of Illness", 'ar': 'مدة المرض'}, @@ -695,20 +695,41 @@ const Map> localizedValues = { 'clinicSearch': {'en': "Search Clinic", 'ar': "بحث عن عيادة"}, 'doctorSearch': {'en': "Search Doctor", 'ar': "بحث عن طبيب"}, - 'referralResponse': {'en': "Referral Response : ", 'ar': " : استجابة الإحالة"}, + 'referralResponse': { + 'en': "Referral Response : ", + 'ar': " : استجابة الإحالة" + }, 'estimatedCost': {'en': "Estimated Cost", 'ar': "التكلفة المتوقعة"}, 'diagnosisDetail': {'en': "Diagnosis Detail : ", 'ar': "تفاصيل التشخيص"}, - 'referralSuccessMsgAccept': {'en': "Referral Accepted Successfully", 'ar': "تم قبول الإحالة بنجاح"}, - 'referralSuccessMsgReject': {'en': "Referral Rejected Successfully", 'ar': "تم رفض الإحالة بنجاح"}, - 'sickLeaveComments': {'en': "Sick leave comments", 'ar': "تعليقات إجازة مرضية"}, + 'referralSuccessMsgAccept': { + 'en': "Referral Accepted Successfully", + 'ar': "تم قبول الإحالة بنجاح" + }, + 'referralSuccessMsgReject': { + 'en': "Referral Rejected Successfully", + 'ar': "تم رفض الإحالة بنجاح" + }, + 'sickLeaveComments': { + 'en': "Sick leave comments", + 'ar': "تعليقات إجازة مرضية" + }, 'pastMedicalHistory': {'en': "Past medical history", 'ar': "التاريخ الطبي"}, - 'pastSurgicalHistory': {'en': "Past surgical history", 'ar': "التاريخ الجراحي"}, + 'pastSurgicalHistory': { + 'en': "Past surgical history", + 'ar': "التاريخ الجراحي" + }, 'complications': {'en': "Complications", 'ar': "المضاعفات"}, 'floor': {'en': "Floor", 'ar': "الطابق"}, 'roomCategory': {'en': "Room category", 'ar': "فئة الغرفة"}, - 'otherDepartmentsInterventions': {'en': "Other departments interventions", 'ar': "تدخلات الأقسام الأخرى"}, + 'otherDepartmentsInterventions': { + 'en': "Other departments interventions", + 'ar': "تدخلات الأقسام الأخرى" + }, 'otherProcedure': {'en': "Other procedure", 'ar': "إجراء آخر"}, - 'admissionRequestSuccessMsg': {'en': "Admission Request Created Successfully", 'ar': "تم إنشاء طلب القبول بنجاح"}, + 'admissionRequestSuccessMsg': { + 'en': "Admission Request Created Successfully", + 'ar': "تم إنشاء طلب القبول بنجاح" + }, // 'icd': {'en': "ICD", 'ar': " "}, 'orderNo': {'en': "Order No : ", 'ar': "رقم الطلب"}, }; diff --git a/lib/screens/dashboard_screen.dart b/lib/screens/dashboard_screen.dart index 30dc2700..dba5b965 100644 --- a/lib/screens/dashboard_screen.dart +++ b/lib/screens/dashboard_screen.dart @@ -2,6 +2,7 @@ import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/core/viewModel/dashboard_view_model.dart'; +import 'package:charts_flutter/flutter.dart' as charts; import 'package:doctor_app_flutter/core/viewModel/patient_view_model.dart'; import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; import 'package:doctor_app_flutter/models/doctor/clinic_model.dart'; @@ -18,6 +19,7 @@ import 'package:doctor_app_flutter/util/date-utils.dart'; import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/dashboard/guage_chart.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/profile-welcome-widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:firebase_messaging/firebase_messaging.dart'; @@ -34,6 +36,7 @@ import 'doctor/my_referral_patient_screen.dart'; import 'doctor/my_referred_patient_screen.dart'; import 'medicine/medicine_search_screen.dart'; import 'patients/profile/referral/referred-patient-screen.dart'; +import '../widgets/shared/rounded_container_widget.dart'; DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); Helpers helpers = Helpers(); @@ -223,439 +226,710 @@ class _DashboardScreenState extends State { ), Container( color: Colors.white, - height: this.isExpanded - ? MediaQuery.of(context).size.height * 0.19 - : MediaQuery.of(context).size.height * 0.12, + height: MediaQuery.of(context).size.height * 0.45, ), ], ), Positioned( 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( + top: MediaQuery.of(context).size.height * .1, + child: Container( + height: MediaQuery.of(context).size.height * 0.52, + child: Column( + children: [ + RoundedContainer( + height: + MediaQuery.of(context).size.height * 0.24, + margin: 5, + child: Column(children: [ + Expanded( + flex: 3, + child: 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 + flex: 5, + child: Padding( + padding: + const EdgeInsets.all(5.0), + child: Column( + mainAxisAlignment: + MainAxisAlignment + .spaceBetween, + crossAxisAlignment: + CrossAxisAlignment + .start, + children: [ + rowCount( + model .dashboardItemsList[ 0] - .summaryoptions[2] - .value - .toString() - : model + .summaryoptions[0] + .kPIParameter, + model .dashboardItemsList[ - 1] - .summaryoptions[2] - .value - .toString() - : "", - fontWeight: FontWeight.bold, - color: Colors.white, - fontSize: 28), - AppText( - model.dashboardItemsList - .length > - 0 - ? isInpatient == 'in' - ? model + 0] + .summaryoptions[0] + .value, + Colors.red), + rowCount( + model + .dashboardItemsList[ + 0] + .summaryoptions[1] + .kPIParameter, + model + .dashboardItemsList[ + 0] + .summaryoptions[1] + .value, + Colors.black), + rowCount( + model .dashboardItemsList[ 0] .summaryoptions[2] - .kPIParameter - .toString() - : model + .kPIParameter, + model .dashboardItemsList[ - 1] + 0] .summaryoptions[2] - .kPIParameter - .toString() - : "", - color: Colors.white, - fontSize: 12, - textAlign: TextAlign.center) - ], - )) + .value, + Colors.grey[800]), + ], + ))), + Expanded( + flex: 3, + child: Stack(children: [ + Container( + child: GaugeChart( + _createInpatientData( + model))), + Positioned( + child: Column( + children: [ + AppText( + TranslationBase.of( + context) + .inPatient, + fontSize: 11, + fontWeight: + FontWeight.bold, + ), + AppText( + getPatientCount(model + .dashboardItemsList[0]) + .toString(), + fontSize: 11, + fontWeight: + FontWeight.bold, + ) + ], + ), + top: MediaQuery.of(context) + .size + .height * + 0.08, + left: MediaQuery.of(context) + .size + .width * + 0.10) + ])), ], - ), - Row( + )), + Expanded( + flex: 1, + child: Padding( + padding: const EdgeInsets.all(5.0), + child: Row( + mainAxisAlignment: + MainAxisAlignment.start, + children: [ + rowCount( + model + .dashboardItemsList[0] + .summaryoptions[3] + .kPIParameter, + model.dashboardItemsList[0] + .summaryoptions[3].value, + Colors.grey), + rowCount( + model + .dashboardItemsList[0] + .summaryoptions[4] + .kPIParameter, + model.dashboardItemsList[0] + .summaryoptions[4].value, + Colors.grey[300]), + ], + )), + ) + ])), + RoundedContainer( + height: + MediaQuery.of(context).size.height * 0.24, + margin: 5, + child: Column(children: [ + Expanded( + flex: 3, + child: Row( children: [ Expanded( - child: Column( - children: [ - AppText( - model.dashboardItemsList - .length > - 0 - ? isInpatient == 'in' - ? model + flex: 5, + child: Padding( + padding: + const EdgeInsets.all(5.0), + child: Column( + mainAxisAlignment: + MainAxisAlignment + .spaceBetween, + crossAxisAlignment: + CrossAxisAlignment + .start, + children: [ + rowCount( + model .dashboardItemsList[ - 0] - .summaryoptions[3] - .value - .toString() - : model + 1] + .summaryoptions[0] + .kPIParameter, + model .dashboardItemsList[ 1] - .summaryoptions[3] - .value - .toString() - : "", - fontWeight: FontWeight.bold, - color: Colors.white, - fontSize: 28), - AppText( - model.dashboardItemsList - .length > - 0 - ? isInpatient == 'in' - ? model + .summaryoptions[0] + .value, + Colors.red), + rowCount( + model .dashboardItemsList[ - 0] - .summaryoptions[3] - .kPIParameter - .toString() - : model + 1] + .summaryoptions[1] + .kPIParameter, + model .dashboardItemsList[ 1] - .summaryoptions[3] - .kPIParameter - .toString() - : "", - color: Colors.white, - fontSize: 12, - textAlign: TextAlign.center) - ], - )), + .summaryoptions[1] + .value, + Colors.black), + rowCount( + model + .dashboardItemsList[ + 1] + .summaryoptions[2] + .kPIParameter, + model + .dashboardItemsList[ + 1] + .summaryoptions[2] + .value, + Colors.grey[800]), + ], + ))), 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) - ], - ), + flex: 3, + child: Stack(children: [ + Container( + child: GaugeChart( + _createOutPatientData( + model))), + Positioned( + child: Column( + children: [ + AppText( + TranslationBase.of( + context) + .outPatient, + fontSize: 11, + fontWeight: + FontWeight.bold, + textOverflow: + TextOverflow + .ellipsis, + ), + AppText( + getPatientCount(model + .dashboardItemsList[1]) + .toString(), + fontSize: 11, + fontWeight: + FontWeight.bold, + ) + ], + ), + top: MediaQuery.of(context) + .size + .height * + 0.08, + left: MediaQuery.of(context) + .size + .width * + 0.09) + ]), ), - 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, - ), - ], - ), - ), - 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: [ - AppText( - model.dashboardItemsList.length > 0 - ? getPatientCount( - model.dashboardItemsList[0]) - : "", - fontSize: - SizeConfig.textMultiplier * 6, - color: Colors.white, - ), - Flexible( - child: AppText( - TranslationBase.of(context).inPatient, - color: Colors.white, - textOverflow: TextOverflow.ellipsis, - )), - ], - ), - Padding( - padding: EdgeInsets.all(5), - child: Column( + )), + Expanded( + flex: 1, + child: Padding( + padding: const EdgeInsets.all(5.0), + child: Row( mainAxisAlignment: - MainAxisAlignment.end, + MainAxisAlignment.start, children: [ - Icon( - DoctorApp.in_patient_white, - size: 35, - color: Colors.white, - ) + rowCount( + model + .dashboardItemsList[1] + .summaryoptions[3] + .kPIParameter, + model.dashboardItemsList[1] + .summaryoptions[3].value, + Colors.grey), + rowCount( + model + .dashboardItemsList[1] + .summaryoptions[4] + .kPIParameter, + model.dashboardItemsList[1] + .summaryoptions[4].value, + Colors.grey[300]), + rowCount( + model + .dashboardItemsList[1] + .summaryoptions[5] + .kPIParameter, + model.dashboardItemsList[1] + .summaryoptions[5].value, + Colors.grey[200]) ], - )) - ], - ), - ), - 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( - model.dashboardItemsList.length > 0 - ? getPatientCount( - model.dashboardItemsList[1]) - : "", - fontSize: - SizeConfig.textMultiplier * 6, - color: Colors.white, - ), - Flexible( - child: AppText( - TranslationBase.of(context) - .outPatients, - color: Colors.white, - textOverflow: TextOverflow.ellipsis, )), - ], - ), - 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, - ), + ) + ])) ], - ), - ), - isExpanded: isExpanded, - )) + )) + //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, + // ), + // ], + // ), + // ), + // 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: [ + // AppText( + // model.dashboardItemsList.length > 0 + // ? getPatientCount( + // model.dashboardItemsList[0]) + // : "", + // fontSize: + // SizeConfig.textMultiplier * 6, + // color: Colors.white, + // ), + // Flexible( + // child: AppText( + // TranslationBase.of(context).inPatient, + // color: Colors.white, + // textOverflow: TextOverflow.ellipsis, + // )), + // ], + // ), + // 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( + // model.dashboardItemsList.length > 0 + // ? getPatientCount( + // model.dashboardItemsList[1]) + // : "", + // fontSize: + // SizeConfig.textMultiplier * 6, + // color: Colors.white, + // ), + // Flexible( + // child: AppText( + // TranslationBase.of(context) + // .outPatients, + // color: Colors.white, + // textOverflow: TextOverflow.ellipsis, + // )), + // ], + // ), + // 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, + // ), + // ], + // ), + // ), + // isExpanded: isExpanded, + // )) + ) ]), FractionallySizedBox( widthFactor: 0.90, @@ -1065,6 +1339,81 @@ class _DashboardScreenState extends State { ); } + static List> _createInpatientData(model) { + final data = [ + new GaugeSegment( + model.dashboardItemsList[0].summaryoptions[0].kPIParameter, + getValue(model.dashboardItemsList[0].summaryoptions[0].value), + charts.MaterialPalette.red.shadeDefault), + new GaugeSegment( + model.dashboardItemsList[0].summaryoptions[1].kPIParameter, + getValue(model.dashboardItemsList[0].summaryoptions[1].value), + charts.MaterialPalette.black.darker), + new GaugeSegment( + model.dashboardItemsList[0].summaryoptions[2].kPIParameter, + getValue(model.dashboardItemsList[0].summaryoptions[2].value), + charts.MaterialPalette.gray.shade800), + new GaugeSegment( + model.dashboardItemsList[0].summaryoptions[3].kPIParameter, + getValue(model.dashboardItemsList[0].summaryoptions[3].value), + charts.MaterialPalette.gray.shadeDefault.lighter), + new GaugeSegment( + model.dashboardItemsList[0].summaryoptions[4].kPIParameter, + getValue(model.dashboardItemsList[0].summaryoptions[4].value), + charts.MaterialPalette.gray.shadeDefault), + ]; + + return [ + new charts.Series( + id: 'Segments', + domainFn: (GaugeSegment segment, _) => segment.segment, + measureFn: (GaugeSegment segment, _) => segment.size, + data: data, + colorFn: (GaugeSegment segment, _) => segment.color, + ) + ]; + } + + static List> _createOutPatientData( + model) { + final data = [ + new GaugeSegment( + model.dashboardItemsList[1].summaryoptions[0].kPIParameter, + getValue(model.dashboardItemsList[1].summaryoptions[0].value), + charts.MaterialPalette.red.shadeDefault), + new GaugeSegment( + model.dashboardItemsList[1].summaryoptions[1].kPIParameter, + getValue(model.dashboardItemsList[1].summaryoptions[1].value), + charts.MaterialPalette.black.darker), + new GaugeSegment( + model.dashboardItemsList[1].summaryoptions[2].kPIParameter, + getValue(model.dashboardItemsList[1].summaryoptions[2].value), + charts.MaterialPalette.gray.shade800), + new GaugeSegment( + model.dashboardItemsList[1].summaryoptions[3].kPIParameter, + getValue(model.dashboardItemsList[1].summaryoptions[3].value), + charts.MaterialPalette.gray.shadeDefault), + new GaugeSegment( + model.dashboardItemsList[1].summaryoptions[4].kPIParameter, + getValue(model.dashboardItemsList[1].summaryoptions[4].value), + charts.MaterialPalette.gray.shadeDefault.lighter), + ]; + + return [ + new charts.Series( + id: 'Segments', + domainFn: (GaugeSegment segment, _) => segment.segment, + measureFn: (GaugeSegment segment, _) => segment.size, + data: data, + colorFn: (GaugeSegment segment, _) => segment.color, + ) + ]; + } + + static int getValue(value) { + return value == 0 ? 1 : value; + } + showCupertinoPicker( {context, List actionList, decKey, onSelectFun}) { showModalBottomSheet( @@ -1165,6 +1514,40 @@ class _DashboardScreenState extends State { return value.toString(); } + + Widget dot(Color c) { + return Container( + padding: EdgeInsets.all(5.0), + margin: EdgeInsets.all(5.0), + decoration: BoxDecoration(color: c, shape: BoxShape.circle)); + } + + Widget rowCount(name, int count, Color c) { + return Row( + children: [ + dot(c), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + name, + color: Colors.black, + textAlign: TextAlign.center, + fontSize: 10, + textOverflow: TextOverflow.ellipsis, + ), + AppText( + '(' + count.toString() + ')', + color: Colors.black, + textAlign: TextAlign.center, + fontSize: 14, + fontWeight: FontWeight.bold, + ) + ], + ), + ], + ); + } } // TODO Move to it file diff --git a/lib/util/translations_delegate_base.dart b/lib/util/translations_delegate_base.dart index 813d7064..8da3a0e0 100644 --- a/lib/util/translations_delegate_base.dart +++ b/lib/util/translations_delegate_base.dart @@ -389,7 +389,7 @@ class TranslationBase { String get replay2 => localizedValues['replay2'][locale.languageCode]; - String get outPatient => localizedValues['outPatient'][locale.languageCode]; + String get outPatient => localizedValues['outPatients'][locale.languageCode]; String get logout => localizedValues['logout'][locale.languageCode]; @@ -765,8 +765,7 @@ class TranslationBase { String get postPlansEstimatedCost => localizedValues['postPlansEstimatedCost'][locale.languageCode]; - String get postPlans => - localizedValues['postPlans'][locale.languageCode]; + String get postPlans => localizedValues['postPlans'][locale.languageCode]; String get ucaf => localizedValues['ucaf'][locale.languageCode]; @@ -1085,25 +1084,39 @@ class TranslationBase { localizedValues['clinicSearch'][locale.languageCode]; String get doctorSearch => localizedValues['doctorSearch'][locale.languageCode]; - String get referralResponse => localizedValues['referralResponse'][locale.languageCode]; - String get estimatedCost => localizedValues['estimatedCost'][locale.languageCode]; - String get diagnosisDetail => localizedValues['diagnosisDetail'][locale.languageCode]; - String get referralSuccessMsgAccept => localizedValues['referralSuccessMsgAccept'][locale.languageCode]; - String get referralSuccessMsgReject => localizedValues['referralSuccessMsgReject'][locale.languageCode]; + String get referralResponse => + localizedValues['referralResponse'][locale.languageCode]; + String get estimatedCost => + localizedValues['estimatedCost'][locale.languageCode]; + String get diagnosisDetail => + localizedValues['diagnosisDetail'][locale.languageCode]; + String get referralSuccessMsgAccept => + localizedValues['referralSuccessMsgAccept'][locale.languageCode]; + String get referralSuccessMsgReject => + localizedValues['referralSuccessMsgReject'][locale.languageCode]; String get patientName => localizedValues['patient-name'][locale.languageCode]; - String get appointmentNumber => localizedValues['appointmentNumber'][locale.languageCode]; - String get sickLeaveComments => localizedValues['sickLeaveComments'][locale.languageCode]; - String get pastMedicalHistory => localizedValues['pastMedicalHistory'][locale.languageCode]; - String get pastSurgicalHistory => localizedValues['pastSurgicalHistory'][locale.languageCode]; - String get complications => localizedValues['complications'][locale.languageCode]; + String get appointmentNumber => + localizedValues['appointmentNumber'][locale.languageCode]; + String get sickLeaveComments => + localizedValues['sickLeaveComments'][locale.languageCode]; + String get pastMedicalHistory => + localizedValues['pastMedicalHistory'][locale.languageCode]; + String get pastSurgicalHistory => + localizedValues['pastSurgicalHistory'][locale.languageCode]; + String get complications => + localizedValues['complications'][locale.languageCode]; String get floor => localizedValues['floor'][locale.languageCode]; - String get roomCategory => localizedValues['roomCategory'][locale.languageCode]; - String get otherDepartmentsInterventions => localizedValues['otherDepartmentsInterventions'][locale.languageCode]; - String get otherProcedure => localizedValues['otherProcedure'][locale.languageCode]; - String get admissionRequestSuccessMsg => localizedValues['admissionRequestSuccessMsg'][locale.languageCode]; + String get roomCategory => + localizedValues['roomCategory'][locale.languageCode]; + String get otherDepartmentsInterventions => + localizedValues['otherDepartmentsInterventions'][locale.languageCode]; + String get otherProcedure => + localizedValues['otherProcedure'][locale.languageCode]; + String get admissionRequestSuccessMsg => + localizedValues['admissionRequestSuccessMsg'][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate { diff --git a/lib/widgets/dashboard/guage_chart.dart b/lib/widgets/dashboard/guage_chart.dart new file mode 100644 index 00000000..ddd649d1 --- /dev/null +++ b/lib/widgets/dashboard/guage_chart.dart @@ -0,0 +1,54 @@ +import 'package:charts_flutter/flutter.dart' as charts; +import 'package:flutter/material.dart'; +import 'dart:math'; + +class GaugeChart extends StatelessWidget { + final List seriesList; + final bool animate; + + GaugeChart(this.seriesList, {this.animate}); + + /// Creates a [PieChart] with sample data and no transition. + factory GaugeChart.withSampleData() { + return new GaugeChart( + _createSampleData(), + // Disable animations for image tests. + animate: false, + ); + } + @override + Widget build(BuildContext context) { + return new charts.PieChart(seriesList, + animate: animate, + defaultRenderer: new charts.ArcRendererConfig(arcWidth: 10)); + //); + } + + static List> _createSampleData() { + final data = [ + new GaugeSegment('Low', 75, charts.MaterialPalette.blue.shadeDefault), + new GaugeSegment( + 'Acceptable', 100, charts.MaterialPalette.blue.shadeDefault), + new GaugeSegment('High', 50, charts.MaterialPalette.blue.shadeDefault), + new GaugeSegment( + 'Highly Unusual', 55, charts.MaterialPalette.blue.shadeDefault), + ]; + + return [ + new charts.Series( + id: 'Segments', + domainFn: (GaugeSegment segment, _) => segment.segment, + measureFn: (GaugeSegment segment, _) => segment.size, + data: data, + ) + ]; + } +} + +/// Sample data type. +class GaugeSegment { + final String segment; + final int size; + final charts.Color color; + GaugeSegment(this.segment, this.size, this.color); +}