From e14e004700b62b361f8f5bf720a6a490f468d438 Mon Sep 17 00:00:00 2001 From: Sultan Khan Date: Tue, 30 Mar 2021 11:57:54 +0300 Subject: [PATCH 1/3] page updated --- lib/config/localized_values.dart | 7 +- .../reschedule-leaves/reschedule_leave.dart | 229 ++++++------- lib/screens/sick-leave/add-sickleave.dart | 310 ++++++++++++------ lib/screens/sick-leave/show-sickleave.dart | 113 ++++--- lib/util/translations_delegate_base.dart | 1 + 5 files changed, 405 insertions(+), 255 deletions(-) diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 18bc5118..5a66b0ae 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -277,7 +277,7 @@ const Map> localizedValues = { "doc-name": {"en": "Doctor Name", "ar": "اسم الطبيب"}, "clinicname": {"en": "Clinic Name", "ar": "اسم العيادة"}, "sick-leave-date": {"en": "Sick leave date ", "ar": "تاريخ الاجازة."}, - "sick-leave-days": {"en": "Sick leave days", "ar": "عدد ايام الاجازة."}, + "sick-leave-days": {"en": "Leave Days: ", "ar": " :أيام الإجازة"}, 'admissionDetail': {'en': 'ADMISSION DETAIL: ', 'ar': 'تفاصيل القبول: '}, 'dateTime': {'en': 'DATE / TIME:', 'ar': 'التاريخ / الوقت:'}, 'date': {'en': 'Date', 'ar': 'التاريخ'}, @@ -302,8 +302,8 @@ const Map> localizedValues = { "ar": "يرجى ادخال هذا الحقل" }, 'no-sickleve-applied': { - 'en': "No sick leave applied", - 'ar': 'لم تطبق إجازة مرضية' + 'en': "No sick leave available, apply Now", + 'ar': 'لا توجد إجازة مرضية متاحة ، تقدم بطلب الآن' }, 'applynow': {'en': "Apply Now", 'ar': 'قدم الآن'}, 'add-sickleave': {'en': "ADD SICK LEAVE", 'ar': 'أضف إجازة مرضية'}, @@ -802,4 +802,5 @@ const Map> localizedValues = { "add-reschedule": {"en": "Add reschedule", "ar": "أضف إعادة الجدولة"}, "update-reschedule": {"en": "Update reschedule", "ar": "تحديث إعادة الجدولة"}, + "sick_leave": {"en": "Sick Leave", "ar": "أجازة مرضية"}, }; diff --git a/lib/screens/reschedule-leaves/reschedule_leave.dart b/lib/screens/reschedule-leaves/reschedule_leave.dart index e873f9b1..7af6b72c 100644 --- a/lib/screens/reschedule-leaves/reschedule_leave.dart +++ b/lib/screens/reschedule-leaves/reschedule_leave.dart @@ -128,121 +128,121 @@ class _RescheduleLeaveScreen extends State { widthFactor: 0.9, child: ListView( children: [ - Container( - margin: EdgeInsets.all(8), - decoration: BoxDecoration( - borderRadius: BorderRadius.all( - Radius.circular(6.0)), - border: Border.all( - width: 1.0, - color: HexColor("#CCCCCC"))), - width: double.infinity, - child: Padding( - padding: EdgeInsets.only( - top: SizeConfig.widthMultiplier * 0.9, - bottom: - SizeConfig.widthMultiplier * 0.9, - right: SizeConfig.widthMultiplier * 3, - left: SizeConfig.widthMultiplier * 3), - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Row( - mainAxisSize: MainAxisSize.max, - children: [ - Expanded( - // add Expanded to have your dropdown button fill remaining space - child: - DropdownButtonHideUnderline( - child: new IgnorePointer( - ignoring: true, - child: DropdownButton( - focusColor: - Colors.grey, - isExpanded: true, - dropdownColor: - Colors.grey, - value: getClinicName( - model) ?? - "", - iconSize: 0, - elevation: 16, - selectedItemBuilder: - (BuildContext - context) { - return model - .getClinicNameList() - .map((item) { - return Row( - mainAxisSize: - MainAxisSize - .max, - children: < - Widget>[ - AppText( - item, - fontSize: - SizeConfig.textMultiplier * - 2.1, - color: Colors - .grey[ - 500], - ), - ], - ); - }).toList(); - }, - onChanged: - (newValue) => - {}, - items: model - .getClinicNameList() - .map((item) { - return DropdownMenuItem( - value: item - .toString(), - child: Text( - item, - textAlign: - TextAlign - .end, - ), - ); - }).toList(), - ))), - ), - ], - ) - ], - ), - )), + // Container( + // margin: EdgeInsets.all(8), + // decoration: BoxDecoration( + // borderRadius: BorderRadius.all( + // Radius.circular(6.0)), + // border: Border.all( + // width: 1.0, + // color: HexColor("#CCCCCC"))), + // width: double.infinity, + // child: Padding( + // padding: EdgeInsets.only( + // top: SizeConfig.widthMultiplier * 0.9, + // bottom: + // SizeConfig.widthMultiplier * 0.9, + // right: SizeConfig.widthMultiplier * 3, + // left: SizeConfig.widthMultiplier * 3), + // child: Column( + // crossAxisAlignment: + // CrossAxisAlignment.start, + // children: [ + // Row( + // mainAxisSize: MainAxisSize.max, + // children: [ + // Expanded( + // // add Expanded to have your dropdown button fill remaining space + // child: + // DropdownButtonHideUnderline( + // child: new IgnorePointer( + // ignoring: true, + // child: DropdownButton( + // focusColor: + // Colors.grey, + // isExpanded: true, + // dropdownColor: + // Colors.grey, + // value: getClinicName( + // model) ?? + // "", + // iconSize: 0, + // elevation: 16, + // selectedItemBuilder: + // (BuildContext + // context) { + // return model + // .getClinicNameList() + // .map((item) { + // return Row( + // mainAxisSize: + // MainAxisSize + // .max, + // children: < + // Widget>[ + // AppText( + // item, + // fontSize: + // SizeConfig.textMultiplier * + // 2.1, + // color: Colors + // .grey[ + // 500], + // ), + // ], + // ); + // }).toList(); + // }, + // onChanged: + // (newValue) => + // {}, + // items: model + // .getClinicNameList() + // .map((item) { + // return DropdownMenuItem( + // value: item + // .toString(), + // child: Text( + // item, + // textAlign: + // TextAlign + // .end, + // ), + // ); + // }).toList(), + // ))), + // ), + // ], + // ) + // ], + // ), + // )), - Container( - margin: EdgeInsets.all(8), - decoration: BoxDecoration( - borderRadius: - BorderRadius.all(Radius.circular(6.0)), - border: Border.all( - width: 1.0, - color: HexColor("#CCCCCC"))), - padding: EdgeInsets.all(5), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - new IgnorePointer( - ignoring: true, - child: AppTextFormField( - readOnly: true, - hintText: profile != null - ? profile['DoctorName'] - : "", - borderColor: Colors.white, - onSaved: (value) {}, - inputFormatter: ONLY_NUMBERS)) - ], - ), - ), + // Container( + // margin: EdgeInsets.all(8), + // decoration: BoxDecoration( + // borderRadius: + // BorderRadius.all(Radius.circular(6.0)), + // border: Border.all( + // width: 1.0, + // color: HexColor("#CCCCCC"))), + // padding: EdgeInsets.all(5), + // child: Column( + // crossAxisAlignment: CrossAxisAlignment.start, + // children: [ + // new IgnorePointer( + // ignoring: true, + // child: AppTextFormField( + // readOnly: true, + // hintText: profile != null + // ? profile['DoctorName'] + // : "", + // borderColor: Colors.white, + // onSaved: (value) {}, + // inputFormatter: ONLY_NUMBERS)) + // ], + // ), + // ), Container( margin: EdgeInsets.all(8), @@ -842,6 +842,7 @@ class _RescheduleLeaveScreen extends State { ], ), )), + SizedBox(height: SizeConfig.screenHeight * .3), Container( margin: EdgeInsets.all( SizeConfig.widthMultiplier * 5), diff --git a/lib/screens/sick-leave/add-sickleave.dart b/lib/screens/sick-leave/add-sickleave.dart index ad74b760..3c4cac26 100644 --- a/lib/screens/sick-leave/add-sickleave.dart +++ b/lib/screens/sick-leave/add-sickleave.dart @@ -6,12 +6,15 @@ import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/models/sickleave/get_all_sickleave_response.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/sick-leave/sick_leave.dart'; +import 'package:doctor_app_flutter/util/date-utils.dart'; import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/patient-page-header-widget.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-header-new-design.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.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/rounded_container_widget.dart'; import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; @@ -25,19 +28,94 @@ class AddSickLeavScreen extends StatelessWidget { onModelReady: (model) => model.getSickLeave(patient.patientMRN), builder: (_, model, w) => AppScaffold( baseViewModel: model, + isShowAppBar: false, appBarTitle: TranslationBase.of(context).sickleave, body: SingleChildScrollView( child: Column(children: [ - PatientPageHeaderWidget(patient), + PatientProfileHeaderNewDesign( + patient, routeArgs['patientType'], routeArgs['arrivalType']), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: EdgeInsets.all(10), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + TranslationBase.of(context).patient, + fontWeight: FontWeight.bold, + ), + AppText( + TranslationBase.of(context).sickLeave, + fontSize: 24, + fontWeight: FontWeight.bold, + ), + ], + )), + Container( + width: SizeConfig.screenWidth, + margin: EdgeInsets.only( + left: 20, right: 20, top: 10, bottom: 10), + padding: EdgeInsets.all(20), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10), + color: HexColor('#EAEAEA')), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Container( + child: Container( + decoration: BoxDecoration( + color: Colors.grey, + borderRadius: BorderRadius.circular(10)), + padding: EdgeInsets.all(3), + child: IconButton( + icon: Icon( + Icons.add, + size: 35, + color: Colors.white, + ), + onPressed: () { + openSickLeave( + context, + false, + ); + }), + )), + Padding( + child: AppText( + TranslationBase.of(context).noSickLeaveApplied, + fontWeight: FontWeight.bold, + fontFamily: 'Poppins', + fontSize: 16, + textAlign: TextAlign.center, + color: HexColor('#7E7E7E')), + padding: EdgeInsets.all(10), + ), + ], + )), + ], + ), model.getAllSIckLeave.length > 0 ? Column( children: model.getAllSIckLeave .map((GetAllSickLeaveResponse item) { - return CardWithBgWidgetNew( - widget: Column( + return RoundedContainer( + child: Column( children: [ Container( - padding: EdgeInsets.only(left: 10, right: 10), + decoration: BoxDecoration( + border: Border( + left: BorderSide( + color: item.status == 1 + ? Colors.yellow[800] + : item.status == 2 + ? Colors.green + : Colors.black, + width: 5.0, + ))), + padding: EdgeInsets.all(10), child: Row( mainAxisAlignment: MainAxisAlignment.start, children: [ @@ -66,42 +144,77 @@ class AddSickLeavScreen extends StatelessWidget { context) .all, fontWeight: FontWeight.bold, - color: Colors.white, + color: item.status == 1 + ? Colors.yellow[800] + : item.status == 2 + ? Colors.green + : Colors.black, ), - color: item.status == 1 - ? Colors.yellow[800] - : item.status == 2 - ? Colors.green - : Colors.black, + ), + Row( + children: [ + AppText(TranslationBase.of( + context) + .daysSickleave), + AppText( + item.noOfDays.toString(), + fontWeight: FontWeight.bold, + ), + ], ), Row( children: [ AppText( TranslationBase.of(context) - .leaveStartDate + + .startDate + ' ', - fontWeight: FontWeight.bold, ), Flexible( - child: Text( - item.startDate, - overflow: - TextOverflow.ellipsis, + child: AppText( + DateUtils + .convertStringToDateFormat( + item.startDate, + 'dd-MMM-yyyy'), + fontWeight: FontWeight.bold, )) ], ), - AppText( - item.noOfDays.toString() + - ' ' + - TranslationBase.of(context) - .daysSickleave, - fontWeight: FontWeight.bold, - ), - Row(children: [ - AppText( - item.remarks ?? "", - ) - ]), + Row( + mainAxisAlignment: + MainAxisAlignment + .spaceBetween, + children: [ + AppText( + item.remarks ?? "", + ), + (item.status == 1 || + item.status == 2) + ? IconButton( + icon: Image.asset( + 'assets/images/edit.png'), + + // color: Colors.green, //Colors.black, + onPressed: () => { + if (item.status == + 1) + { + DrAppToastMsg.showErrorToast( + TranslationBase.of( + context) + .sickleaveonhold) + } + else + { + openSickLeave( + context, + true, + extendedData: + item) + } + }, + ) + : SizedBox() + ]), ], ), SizedBox( @@ -110,86 +223,81 @@ class AddSickLeavScreen extends StatelessWidget { ], ), ), - (item.status == 1 || item.status == 2) - ? Expanded( - flex: 1, - child: IconButton( - icon: Icon( - Icons.open_in_full, - size: 25, - color: item.status == 1 - ? Colors.grey[400] - : Colors.black, - ), - // color: Colors.green, //Colors.black, - onPressed: () => { - if (item.status == 1) - { - DrAppToastMsg.showErrorToast( - TranslationBase.of( - context) - .sickleaveonhold) - } - else - { - openSickLeave(context, true, - extendedData: item) - } - }, - )) - : SizedBox(), ], )), - SizedBox( - height: 20, - ), - Divider( - height: 1, - ), ], )); }).toList(), ) : new Builder(builder: (context) { - return Container( - height: MediaQuery.of(context).size.height * .7, - 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: () { - openSickLeave( - context, - false, - ); - }), - ), - 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'), - ) - ], - )); + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: EdgeInsets.all(10), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + TranslationBase.of(context).patient, + fontWeight: FontWeight.bold, + ), + AppText( + TranslationBase.of(context).sickLeave, + fontSize: 24, + fontWeight: FontWeight.bold, + ), + ], + )), + Container( + width: SizeConfig.screenWidth, + margin: EdgeInsets.only( + left: 20, right: 20, top: 20, bottom: 20), + padding: EdgeInsets.all(20), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10), + color: HexColor('#EAEAEA')), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Container( + child: Container( + decoration: BoxDecoration( + color: Colors.grey, + borderRadius: + BorderRadius.circular(10)), + padding: EdgeInsets.all(3), + child: IconButton( + icon: Icon( + Icons.add, + size: 35, + color: Colors.white, + ), + onPressed: () { + openSickLeave( + context, + false, + ); + }), + )), + Padding( + child: AppText( + TranslationBase.of(context) + .noSickLeaveApplied, + fontWeight: FontWeight.bold, + fontFamily: 'Poppins', + fontSize: 16, + textAlign: TextAlign.center, + color: HexColor('#7E7E7E')), + padding: EdgeInsets.all(10), + ), + ], + )), + SizedBox( + height: SizeConfig.screenHeight * .6, + ) + ], + ); }), ])))); } diff --git a/lib/screens/sick-leave/show-sickleave.dart b/lib/screens/sick-leave/show-sickleave.dart index c3bd3178..52ec7094 100644 --- a/lib/screens/sick-leave/show-sickleave.dart +++ b/lib/screens/sick-leave/show-sickleave.dart @@ -6,12 +6,15 @@ import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/models/sickleave/get_all_sickleave_response.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/sick-leave/sick_leave.dart'; +import 'package:doctor_app_flutter/util/date-utils.dart'; import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/patient-page-header-widget.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-header-new-design.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.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/rounded_container_widget.dart'; import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; @@ -23,22 +26,34 @@ class ShowSickLeaveScreen extends StatelessWidget { final routeArgs = ModalRoute.of(context).settings.arguments as Map; patient = routeArgs['patient']; return BaseView( - onModelReady: (model) => model.getSickLeave(patient.patientMRN ?? patient.patientId), + onModelReady: (model) => + model.getSickLeave(patient.patientMRN ?? patient.patientId), builder: (_, model, w) => AppScaffold( baseViewModel: model, appBarTitle: TranslationBase.of(context).sickleave, body: SingleChildScrollView( child: Column( children: [ - PatientPageHeaderWidget(patient), + PatientProfileHeaderNewDesign( + patient, routeArgs['patientType'], routeArgs['arrivalType']), Column( children: model.getAllSIckLeave .map((GetAllSickLeaveResponse item) { - return CardWithBgWidgetNew( - widget: Column( + return RoundedContainer( + child: Column( children: [ Container( - padding: EdgeInsets.only(left: 10, right: 10), + decoration: BoxDecoration( + border: Border( + left: BorderSide( + color: item.status == 1 + ? Colors.yellow[800] + : item.status == 2 + ? Colors.green + : Colors.black, + width: 5.0, + ))), + padding: EdgeInsets.all(10), child: Row( mainAxisAlignment: MainAxisAlignment.start, children: [ @@ -66,41 +81,74 @@ class ShowSickLeaveScreen extends StatelessWidget { context) .all, fontWeight: FontWeight.bold, - color: Colors.white, + color: item.status == 1 + ? Colors.yellow[800] + : item.status == 2 + ? Colors.green + : Colors.black, ), - color: item.status == 1 - ? Colors.yellow[800] - : item.status == 2 - ? Colors.green - : Colors.black, + ), + Row( + children: [ + AppText(TranslationBase.of(context) + .daysSickleave), + AppText( + item.noOfDays.toString(), + fontWeight: FontWeight.bold, + ), + ], ), Row( children: [ AppText( TranslationBase.of(context) - .leaveStartDate + + .startDate + ' ', - fontWeight: FontWeight.bold, ), Flexible( - child: Text( - item.startDate, - overflow: TextOverflow.ellipsis, + child: AppText( + DateUtils + .convertStringToDateFormat( + item.startDate, + 'dd-MMM-yyyy'), + fontWeight: FontWeight.bold, )) ], ), - AppText( - item.noOfDays.toString() + - ' ' + - TranslationBase.of(context) - .daysSickleave, - fontWeight: FontWeight.bold, - ), - Row(children: [ - AppText( - item.remarks ?? "", - ) - ]), + Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + AppText( + item.remarks ?? "", + ), + (item.status == 1 || + item.status == 2) + ? IconButton( + icon: Image.asset( + 'assets/images/edit.png'), + + // color: Colors.green, //Colors.black, + onPressed: () => { + if (item.status == 1) + { + DrAppToastMsg.showErrorToast( + TranslationBase.of( + context) + .sickleaveonhold) + } + // else + // { + // openSickLeave( + // context, + // true, + // extendedData: + // item) + // } + }, + ) + : SizedBox() + ]), ], ), SizedBox( @@ -109,15 +157,8 @@ class ShowSickLeaveScreen extends StatelessWidget { ], ), ), - ], )), - SizedBox( - height: 20, - ), - Divider( - height: 1, - ), ], )); }).toList(), @@ -128,6 +169,4 @@ class ShowSickLeaveScreen extends StatelessWidget { ), ); } - - } diff --git a/lib/util/translations_delegate_base.dart b/lib/util/translations_delegate_base.dart index b2ed3aff..83f43cbc 100644 --- a/lib/util/translations_delegate_base.dart +++ b/lib/util/translations_delegate_base.dart @@ -1184,6 +1184,7 @@ class TranslationBase { localizedValues['add-reschedule'][locale.languageCode]; String get updateReschedule => localizedValues['update-reschedule'][locale.languageCode]; + String get sickLeave => localizedValues['sick_leave'][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate { From ee2e3fbbd6a3872ed7229af4d64db0b737417a20 Mon Sep 17 00:00:00 2001 From: Sultan Khan Date: Tue, 30 Mar 2021 12:36:03 +0300 Subject: [PATCH 2/3] sick leave --- lib/screens/sick-leave/add-sickleave.dart | 34 +++--- lib/screens/sick-leave/sick_leave.dart | 135 +++++++++++++--------- 2 files changed, 99 insertions(+), 70 deletions(-) diff --git a/lib/screens/sick-leave/add-sickleave.dart b/lib/screens/sick-leave/add-sickleave.dart index 3c4cac26..1297a673 100644 --- a/lib/screens/sick-leave/add-sickleave.dart +++ b/lib/screens/sick-leave/add-sickleave.dart @@ -15,6 +15,7 @@ import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.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/rounded_container_widget.dart'; +import 'package:doctor_app_flutter/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; @@ -304,20 +305,23 @@ class AddSickLeavScreen extends StatelessWidget { openSickLeave(BuildContext context, isExtend, {GetAllSickLeaveResponse extendedData}) { - showModalBottomSheet( - context: context, - builder: (context) { - return new Container( - child: SickLeaveScreen( - appointmentNo: isExtend == true - ? extendedData.appointmentNo - : patient.appointmentNo, //extendedData.appointmentNo, - patientMRN: isExtend == true - ? extendedData.patientMRN - : patient.patientMRN, - isExtended: isExtend, - extendedData: extendedData, - patient: patient)); - }); + // showModalBottomSheet( + // context: context, + // builder: (context) { + // return new Container( + // child: + Navigator.push( + context, + FadePage( + page: SickLeaveScreen( + appointmentNo: isExtend == true + ? extendedData.appointmentNo + : patient.appointmentNo, //extendedData.appointmentNo, + patientMRN: isExtend == true + ? extendedData.patientMRN + : patient.patientMRN, + isExtended: isExtend, + extendedData: extendedData, + patient: patient))); } } diff --git a/lib/screens/sick-leave/sick_leave.dart b/lib/screens/sick-leave/sick_leave.dart index f8433fb0..8188c302 100644 --- a/lib/screens/sick-leave/sick_leave.dart +++ b/lib/screens/sick-leave/sick_leave.dart @@ -89,7 +89,10 @@ class _SickLeaveScreenState extends State { }, child: AppScaffold( baseViewModel: model2, - isShowAppBar: false, + appBarTitle: widget.isExtended == true + ? TranslationBase.of(context).extendSickLeave + : TranslationBase.of(context).addSickLeave, + isShowAppBar: true, body: Center( child: Container( margin: EdgeInsets.only(top: 10), @@ -97,29 +100,40 @@ class _SickLeaveScreenState extends State { widthFactor: 0.9, child: ListView( children: [ - Padding( - child: AppText( - widget.isExtended == true - ? TranslationBase.of(context) - .extendSickLeave - : TranslationBase.of(context) - .addSickLeave, - fontWeight: FontWeight.bold, - ), - padding: EdgeInsets.all(10)), + // Padding( + // child: AppText( + // widget.isExtended == true + // ? TranslationBase.of(context) + // .extendSickLeave + // : TranslationBase.of(context) + // .addSickLeave, + // fontWeight: FontWeight.bold, + // ), + // padding: EdgeInsets.all(10)), Container( margin: EdgeInsets.only(left: 10, right: 10), decoration: BoxDecoration( borderRadius: BorderRadius.all(Radius.circular(6.0)), border: Border.all( - width: 1.0, - color: HexColor("#CCCCCC"))), + width: 1.0, + color: HexColor("#CCCCCC"), + ), + color: Colors.white), padding: EdgeInsets.all(5), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ + Padding( + padding: EdgeInsets.only( + top: 5, left: 10, right: 10), + child: AppText( + TranslationBase.of(context) + .sickLeave + + ' ' + + TranslationBase.of(context) + .days)), AppTextFormField( borderColor: Colors.white, onChanged: (value) { @@ -132,8 +146,7 @@ class _SickLeaveScreenState extends State { hintText: widget.extendedData != null ? widget.extendedData.noOfDays .toString() - : TranslationBase.of(context) - .sickLeaveDays, + : '', // validator: (value) { // return TextValidator().validateName(value); // }, @@ -146,25 +159,28 @@ class _SickLeaveScreenState extends State { Container( margin: EdgeInsets.only(left: 10, right: 10), decoration: BoxDecoration( - borderRadius: BorderRadius.all( - Radius.circular(6.0)), - border: Border.all( - width: 1.0, - color: HexColor("#CCCCCC"))), + borderRadius: + BorderRadius.all(Radius.circular(6.0)), + border: Border.all( + width: 1.0, color: HexColor("#CCCCCC")), + color: Colors.white, + ), padding: EdgeInsets.all(5), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - // AppText( - // TranslationBase.of(context).sickLeaveDate, - // fontSize: 10, - // ), + Padding( + padding: EdgeInsets.only( + top: 5, left: 10, right: 10), + child: AppText( + TranslationBase.of(context) + .sickLeaveDate, + )), AppTextFormField( hintText: widget.extendedData != null ? widget.extendedData.startDate - : TranslationBase.of(context) - .sickLeaveDate, + : '', borderColor: Colors.white, prefix: IconButton( icon: Icon(Icons.calendar_today)), @@ -188,11 +204,12 @@ class _SickLeaveScreenState extends State { margin: EdgeInsets.only( top: 10, left: 10, right: 10), decoration: BoxDecoration( - borderRadius: BorderRadius.all( - Radius.circular(6.0)), - border: Border.all( - width: 1.0, - color: HexColor("#CCCCCC"))), + borderRadius: + BorderRadius.all(Radius.circular(6.0)), + border: Border.all( + width: 1.0, color: HexColor("#CCCCCC")), + color: Colors.white, + ), width: double.infinity, child: Padding( padding: EdgeInsets.only( @@ -205,10 +222,12 @@ class _SickLeaveScreenState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ - // AppText( - // TranslationBase.of(context).clinicName, - // fontSize: 10, - // ), + Padding( + padding: EdgeInsets.only(top: 5), + child: AppText( + TranslationBase.of(context) + .clinicName, + )), Row( mainAxisSize: MainAxisSize.max, children: [ @@ -291,19 +310,23 @@ class _SickLeaveScreenState extends State { Container( margin: EdgeInsets.only(left: 10, right: 10), decoration: BoxDecoration( - borderRadius: - BorderRadius.all(Radius.circular(6.0)), - border: Border.all( - width: 1.0, - color: HexColor("#CCCCCC"))), + borderRadius: + BorderRadius.all(Radius.circular(6.0)), + border: Border.all( + width: 1.0, color: HexColor("#CCCCCC")), + color: Colors.white, + ), padding: EdgeInsets.all(5), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - // AppText( - // TranslationBase.of(context).doctorName, - // fontSize: 10, - // ), + Padding( + padding: EdgeInsets.only( + top: 5, left: 10, right: 10), + child: AppText( + TranslationBase.of(context) + .doctorName, + )), new IgnorePointer( ignoring: true, child: AppTextFormField( @@ -324,19 +347,22 @@ class _SickLeaveScreenState extends State { Container( margin: EdgeInsets.only(left: 10, right: 10), decoration: BoxDecoration( - borderRadius: - BorderRadius.all(Radius.circular(6.0)), - border: Border.all( - width: 1.0, - color: HexColor("#CCCCCC"))), + borderRadius: + BorderRadius.all(Radius.circular(6.0)), + border: Border.all( + width: 1.0, color: HexColor("#CCCCCC")), + color: Colors.white, + ), padding: EdgeInsets.all(5), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - // AppText( - // TranslationBase.of(context).remarks, - // fontSize: 10, - // ), + Padding( + padding: EdgeInsets.only( + top: 5, left: 10, right: 10), + child: AppText( + TranslationBase.of(context).remarks, + )), TextField( maxLines: 3, decoration: InputDecoration( @@ -344,8 +370,7 @@ class _SickLeaveScreenState extends State { border: InputBorder.none, hintText: widget.extendedData != null ? widget.extendedData.remarks - : TranslationBase.of(context) - .remarks), + : ''), onChanged: (value) { addSickLeave.remarks = value; if (widget.extendedData != null) { From 9c111b07dddd3a2c88af46756cfcc6e51b8cefa6 Mon Sep 17 00:00:00 2001 From: Sultan Khan Date: Tue, 30 Mar 2021 13:08:05 +0300 Subject: [PATCH 3/3] design updates --- lib/config/localized_values.dart | 8 + .../add-rescheduleleave.dart | 332 +++++++++--------- lib/screens/sick-leave/sick_leave.dart | 4 +- lib/util/translations_delegate_base.dart | 5 +- 4 files changed, 184 insertions(+), 165 deletions(-) diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 5a66b0ae..662111d0 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -803,4 +803,12 @@ const Map> localizedValues = { "add-reschedule": {"en": "Add reschedule", "ar": "أضف إعادة الجدولة"}, "update-reschedule": {"en": "Update reschedule", "ar": "تحديث إعادة الجدولة"}, "sick_leave": {"en": "Sick Leave", "ar": "أجازة مرضية"}, + "addSickLeaveRequest": { + "en": "Add Sick Leave Request", + "ar": "إضافة طلب إجازة مرضية" + }, + "extendSickLeaveRequest": { + "en": "Extend Sick Leave Request", + "ar": "تمديد طلب الإجازة المرضية" + }, }; diff --git a/lib/screens/reschedule-leaves/add-rescheduleleave.dart b/lib/screens/reschedule-leaves/add-rescheduleleave.dart index dacbba72..aaafa380 100644 --- a/lib/screens/reschedule-leaves/add-rescheduleleave.dart +++ b/lib/screens/reschedule-leaves/add-rescheduleleave.dart @@ -26,7 +26,8 @@ class AddRescheduleLeavScreen extends StatelessWidget { baseViewModel: model, isShowAppBar: true, appBarTitle: TranslationBase.of(context).rescheduleLeaves, - body: Column(children: [ + body: SingleChildScrollView( + child: Column(children: [ Container( width: MediaQuery.of(context).size.width, margin: EdgeInsets.all(10), @@ -68,180 +69,185 @@ class AddRescheduleLeavScreen extends StatelessWidget { ], ), ), - Container( - height: MediaQuery.of(context).size.height * .65, - child: SingleChildScrollView( - child: Column( - children: model.getReschduleLeave - .map((GetRescheduleLeavesResponse item) { - return RoundedContainer( - child: Column( - children: [ - Container( - decoration: BoxDecoration( - border: Border( - left: BorderSide( - color: item.status == 1 - ? Colors.green - : item.status == 2 - ? HexColor('#CC9B14') - : Colors.red[800], - width: 5.0, - ))), - padding: EdgeInsets.only(left: 10, right: 10), - child: Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Expanded( - flex: 4, - child: Wrap( + Column( + children: model.getReschduleLeave + .map((GetRescheduleLeavesResponse item) { + return RoundedContainer( + child: Column( + children: [ + Container( + decoration: BoxDecoration( + border: Border( + left: BorderSide( + color: item.status == 1 + ? Colors.green + : item.status == 2 + ? HexColor('#CC9B14') + : Colors.red[800], + width: 5.0, + ))), + padding: EdgeInsets.only(left: 10, right: 10), + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Expanded( + flex: 4, + child: Wrap( + children: [ + Column( + crossAxisAlignment: + CrossAxisAlignment.start, children: [ - Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Container( - padding: EdgeInsets.all(3), - margin: EdgeInsets.only(top: 10), - child: AppText( - item.status == 1 - ? TranslationBase.of( - context) - .approved - : item.status == 2 - ? TranslationBase.of( - context) - .pending - : TranslationBase.of( - context) - .rejected, - fontWeight: FontWeight.bold, - color: item.status == 1 - ? Colors.green - : item.status == 2 - ? HexColor('#CC9B14') - : Colors.red[800], - fontSize: 14, - ), - ), - SizedBox( - height: 5, - ), - Container( + Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Container( + padding: EdgeInsets.all(3), + margin: + EdgeInsets.only(top: 10), child: AppText( - item.requisitionType == 1 - ? TranslationBase.of(context) - .offTime - : TranslationBase.of(context) - .holiday + - ' ', - fontWeight: FontWeight.bold, - )), - SizedBox( - height: 5, - ), - Row(children: [ - AppText( - TranslationBase.of(context) - .startDate), - AppText( - DateUtils - .convertStringToDateFormat( - item.dateTimeFrom, - 'yyyy-MM-dd HH:mm'), - fontWeight: FontWeight.bold, - ) - - // overflow: - // TextOverflow.ellipsis, + item.status == 1 + ? TranslationBase.of( + context) + .approved + : item.status == 2 + ? TranslationBase.of( + context) + .pending + : TranslationBase.of( + context) + .rejected, + fontWeight: FontWeight.bold, + color: item.status == 1 + ? Colors.green + : item.status == 2 + ? HexColor('#CC9B14') + : Colors.red[800], + fontSize: 14, + ), + ), + Padding( + padding: + EdgeInsets.only(top: 10), + child: AppText( + DateUtils + .convertStringToDateFormat( + item.dateTimeTo, + 'yyyy-MM-dd HH:mm'), + fontWeight: FontWeight.bold, + )) ]), + SizedBox( + height: 5, + ), + Container( + child: AppText( + item.requisitionType == 1 + ? TranslationBase.of(context) + .offTime + : TranslationBase.of(context) + .holiday + + ' ', + fontWeight: FontWeight.bold, + )), + SizedBox( + height: 5, + ), + Row(children: [ + AppText(TranslationBase.of(context) + .startDate), + AppText( + DateUtils.convertStringToDateFormat( + item.dateTimeFrom, + 'yyyy-MM-dd HH:mm'), + fontWeight: FontWeight.bold, + ) - // overflow: - // TextOverflow.ellipsis, + // overflow: + // TextOverflow.ellipsis, + ]), - SizedBox( - height: 5, - ), - Row( - children: [ - AppText( - TranslationBase.of(context) - .endDate), - AppText( - DateUtils - .convertStringToDateFormat( - item.dateTimeTo, - 'yyyy-MM-dd HH:mm'), - fontWeight: FontWeight.bold, - ) - ], - ), + // overflow: + // TextOverflow.ellipsis, - SizedBox( - height: 5, - ), - model.coveringDoctors.length > 0 - ? Row(children: [ - AppText( - TranslationBase.of( - context) - .coveringDoctor, - ), - AppText( - getDoctor( - model.coveringDoctors, - item.coveringDoctorId), - fontWeight: - FontWeight.bold, - ) - ]) - : SizedBox(), - // AppText( - // TranslationBase.of(context) - // .reasons, - // fontWeight: FontWeight.bold, - // ), - Row( - mainAxisAlignment: - MainAxisAlignment - .spaceBetween, - children: [ - Padding( - padding: EdgeInsets.only( - bottom: 5), - child: AppText(getReasons( - model.allReasons, - item.reasonId))), - (item.status == 2) - ? IconButton( - icon: Image.asset( - 'assets/images/edit.png'), - // color: Colors.green, //Colors.black, - onPressed: () => { - openLeave( - context, true, - extendedData: - item) - }, - ) - : SizedBox(), - ]), + SizedBox( + height: 5, + ), + Row( + children: [ + AppText(TranslationBase.of(context) + .endDate), + AppText( + DateUtils + .convertStringToDateFormat( + item.dateTimeTo, + 'yyyy-MM-dd HH:mm'), + fontWeight: FontWeight.bold, + ) ], ), + SizedBox( - width: 10, + height: 5, ), + model.coveringDoctors.length > 0 + ? Row(children: [ + AppText( + TranslationBase.of(context) + .coveringDoctor, + ), + AppText( + getDoctor( + model.coveringDoctors, + item.coveringDoctorId), + fontWeight: FontWeight.bold, + ) + ]) + : SizedBox(), + // AppText( + // TranslationBase.of(context) + // .reasons, + // fontWeight: FontWeight.bold, + // ), + Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Padding( + padding: EdgeInsets.only( + bottom: 5), + child: AppText(getReasons( + model.allReasons, + item.reasonId))), + (item.status == 2) + ? IconButton( + icon: Image.asset( + 'assets/images/edit.png'), + // color: Colors.green, //Colors.black, + onPressed: () => { + openLeave(context, true, + extendedData: item) + }, + ) + : SizedBox(), + ]), ], ), - ), - ], - )), - ], - ), - ); - }).toList(), - ))) - ])), + SizedBox( + width: 10, + ), + ], + ), + ), + ], + )), + ], + ), + ); + }).toList(), + ) + ]))), ); } diff --git a/lib/screens/sick-leave/sick_leave.dart b/lib/screens/sick-leave/sick_leave.dart index 8188c302..12f157c2 100644 --- a/lib/screens/sick-leave/sick_leave.dart +++ b/lib/screens/sick-leave/sick_leave.dart @@ -390,7 +390,9 @@ class _SickLeaveScreenState extends State { AppButton( title: widget.isExtended == true ? TranslationBase.of(context).extend - : TranslationBase.of(context).add, + : TranslationBase.of(context) + .addSickLeaverequest, + color: Colors.green, onPressed: () async { if (widget.isExtended) { await model2.extendSickLeave( diff --git a/lib/util/translations_delegate_base.dart b/lib/util/translations_delegate_base.dart index 83f43cbc..da9e5f75 100644 --- a/lib/util/translations_delegate_base.dart +++ b/lib/util/translations_delegate_base.dart @@ -523,7 +523,10 @@ class TranslationBase { localizedValues['add-sickleave'][locale.languageCode]; String get add => localizedValues['add'][locale.languageCode]; - + String get addSickLeaverequest => + localizedValues['addSickLeaveRequest'][locale.languageCode]; + String get extendSickLeaverequest => + localizedValues['extendSickLeaveRequest'][locale.languageCode]; String get approved => localizedValues['approved'][locale.languageCode]; String get extended => localizedValues['extended'][locale.languageCode];