From cc1a63786f9918d5ebff8be06d7283ee2208f021 Mon Sep 17 00:00:00 2001 From: Sultan Khan Date: Mon, 14 Dec 2020 17:58:19 +0300 Subject: [PATCH] sick leave --- assets/images/sick_leaves_icons.png | Bin 0 -> 3073 bytes lib/config/localized_values.dart | 12 +- lib/routes.dart | 5 +- lib/screens/sick-leave/sick_leave.dart | 286 ++++++++++++++++++ lib/util/translations_delegate_base.dart | 11 +- lib/widgets/auth/verfiy_account.dart | 1 + .../profile/profile_medical_info_widget.dart | 8 + lib/widgets/shared/app_text_form_field.dart | 86 +++--- 8 files changed, 364 insertions(+), 45 deletions(-) create mode 100644 assets/images/sick_leaves_icons.png create mode 100644 lib/screens/sick-leave/sick_leave.dart diff --git a/assets/images/sick_leaves_icons.png b/assets/images/sick_leaves_icons.png new file mode 100644 index 0000000000000000000000000000000000000000..67a9c93796a11a9856362cff6ce3b1394e401da0 GIT binary patch literal 3073 zcmV+c4F200YiZU{S8ih#;gocko(@1KGl7ED_xd28MST=DwKcl5-*?tdTaG``64d8k6G@k=-J~!`TKm{#*g^_a; zL!Z3jA^w5xthS%<4DikLM zseMZF&#I7fdqK_ZHIfREP|j3DNB3dluSo!Q@p}1rRLn{{mUNM0K*BCF$z=Yc=J+sk z-JCIv0ihG<;*d8Q$EW86nhl^^6oEV-%ky?MMgwETFc`1)YnkV_auw#|WFMR`KMHZJ znE0KvOn3e32}a_BnY8OLNK&|yLfqp{+V=83x(ZHhC`G!mE2c8(Vf=+ z6y<25TrKq8%Sa{p;rogUT*+F-0r)Yu7XtVrO<4AZGswmJp^EX*01nnj*S|5(%JRZc zT2(dUL)kVSql}rZS*!wgq3IvWG)PaL;H>QC7`)w)0FH_3#si=?$LSNpy>3=}@=6a% z{UD4~d)bZ*Yd;8Nzxxh1S6Qk{0DPNqRh*Ex@9SJ0GR`BMbeI6#Vz7$+(%kDjAs+Kq zb>c5V=5rb&$gO#8#Ltr7j{~(Pht$W03=S*^eyQ&DTfg%w6=mHN#&a0-H8E4#!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({Z(k=8E3TVr&WW_5#b*i4#ao+gia=3Z3-ZcNT}S-ce`d zNs~s8{A~zvp@PJneJ84wod5OA?UFPXaZpE!bK>nyseyldlSr z!v?|ed|30C?pdaIC*#X7-&B(kNi`3bP$?6sAj{P5WkIEpimd0mm0KBX?qH_{su>y8>+ql~%!@ z<;+67sO%0Fa2_DLvYq#d75V(0+a9!#^T;9$C6im0W1E57FZXf3dXis2u#uLW*mvC) z;v1F4(j>T)rWxsDlimnX;D-a|v0^#G+skqmrz6E>`L0J%RBTJo7Xbbb+gfe%c}Q4o P00000NkvXXu0mjfS3urD literal 0 HcmV?d00001 diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 0b176b65..b33d8268 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -242,15 +242,17 @@ const Map> localizedValues = { 'ar': 'لا يوجد اي نتائج' }, 'typeMedicineName': {'en': 'Type Medicine Name', 'ar': 'اكتب اسم الدواء'}, - 'moreThan3Letter': { 'en': 'Medicine Name Should Be More Than 3 letter', 'ar': 'يجب أن يكون اسم الدواء أكثر من 3 أحرف' }, 'gender2': {'en': 'Gender: ', 'ar': 'الجنس: '}, 'age2': {'en': 'Age: ', 'ar': 'العمر: '}, - 'replySuccessfully': { - 'en': 'Reply Successfully', - 'ar': 'تم الرد بنجاح' - }, + 'replySuccessfully': {'en': 'Reply Successfully', 'ar': 'تم الرد بنجاح'}, + "sick-leaves": {"en": "Sick Leaves", "ar": "الاجازات المرضية"}, + "submit": {"en": "Submit", "ar": "ارسال"}, + "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": "عدد ايام الاجازة."} }; diff --git a/lib/routes.dart b/lib/routes.dart index dff02129..b7da4d2b 100644 --- a/lib/routes.dart +++ b/lib/routes.dart @@ -7,6 +7,7 @@ import 'package:doctor_app_flutter/screens/patients/profile/refer_patient_screen import 'package:doctor_app_flutter/screens/patients/profile/prescriptions/in_patient_prescription_details_screen.dart'; import 'package:doctor_app_flutter/screens/live_care/video_call.dart'; +import 'package:doctor_app_flutter/screens/sick-leave/sick_leave.dart'; import './screens/QR_reader_screen.dart'; import './screens/auth/change_password_screen.dart'; @@ -74,6 +75,7 @@ const String IN_PATIENT_PRESCRIPTIONS_DETAILS = 'patients/prescription-details'; // const String VIDEO_CALL = 'video-call'; const String LIVECARE_PENDING_LIST = 'livecare-pendinglist'; // const String LIVECARE_END_DIALOG = 'video-call/EndCallDialogBox'; +const String PATIENT_SICKLEAVE = 'patients/patient_sickleave'; var routes = { ROOT: (_) => RootPage(), HOME: (_) => LandingPage(), @@ -109,5 +111,6 @@ var routes = { IN_PATIENT_PRESCRIPTIONS_DETAILS: (_) => InpatientPrescriptionDetailsScreen(), // VIDEO_CALL: (_) => VideoCallPage(patientData: null), LIVECARE_PENDING_LIST: (_) => LiveCarePandingListScreen(), - // LIVECARE_END_DIALOG: (_) => EndCallDialogBox() + // LIVECARE_END_DIALOG: (_) => EndCallDialogBox(), + PATIENT_SICKLEAVE: (_) => SickLeaveScreen() }; diff --git a/lib/screens/sick-leave/sick_leave.dart b/lib/screens/sick-leave/sick_leave.dart new file mode 100644 index 00000000..acf9c7a7 --- /dev/null +++ b/lib/screens/sick-leave/sick_leave.dart @@ -0,0 +1,286 @@ +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/patient_view_model.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.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/shared/app_buttons_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_text_form_field.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/rounded_container_widget.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:hexcolor/hexcolor.dart'; +import 'package:intl/intl.dart'; + +Helpers helpers = Helpers(); + +class SickLeaveScreen extends StatefulWidget { + @override + _SickLeaveScreenState createState() => _SickLeaveScreenState(); +} + +class _SickLeaveScreenState extends State { + DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); + TextEditingController _toDateController = new TextEditingController(); + String _selectedClinic; + Map profile = {}; + void _presentDatePicker(id) { + showDatePicker( + context: context, + initialDate: DateTime.now(), + firstDate: DateTime(2019), + lastDate: DateTime.now(), + ).then((pickedDate) { + if (pickedDate == null) { + return; + } + setState(() { + var selectedDate = DateFormat.yMd().format(pickedDate); + _toDateController.text = selectedDate; + }); + }); + } + + @override + void initState() { + getProfile(); + super.initState(); + } + + @override + Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) => model.getClinicsList(), + builder: (_, model, w) => AppScaffold( + baseViewModel: model, + appBarTitle: TranslationBase.of(context).sickleave, + body: Center( + child: Container( + margin: EdgeInsets.only(top: SizeConfig.realScreenHeight / 7), + child: FractionallySizedBox( + widthFactor: 0.9, + child: ListView( + children: [ + 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"))), + padding: EdgeInsets.all(5), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + TranslationBase.of(context).sickLeaveDays, + fontSize: 10, + ), + AppTextFormField( + borderColor: Colors.white, + onSaved: (value) {}, + // validator: (value) { + // return TextValidator().validateName(value); + // }, + inputFormatter: ONLY_NUMBERS) + ]), + ), + SizedBox( + height: 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"))), + padding: EdgeInsets.all(5), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + TranslationBase.of(context).sickLeaveDate, + fontSize: 10, + ), + AppTextFormField( + borderColor: Colors.white, + prefix: IconButton( + icon: Icon(Icons.calendar_today)), + textInputType: TextInputType.number, + controller: _toDateController, + onTap: () { + _presentDatePicker('_selectedToDate'); + }, + inputFormatter: ONLY_DATE, + onSaved: (value) {}), + ], + )), + RoundedContainer( + // margin: 10, + showBorder: true, + // raduis: 30, + borderColor: 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: [ + AppText( + TranslationBase.of(context).clinicName, + fontSize: 10, + ), + 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( + isExpanded: true, + value: getClinicName(model), + iconSize: 40, + elevation: 16, + selectedItemBuilder: + (BuildContext context) { + return model + .getClinicNameList() + .map((item) { + return Row( + mainAxisSize: + MainAxisSize.max, + children: [ + AppText( + item, + fontSize: SizeConfig + .textMultiplier * + 2.1, + ), + ], + ); + }).toList(); + }, + onChanged: (newValue) => {}, + items: model + .getClinicNameList() + .map((item) { + return DropdownMenuItem( + value: item.toString(), + child: Text( + item, + textAlign: + TextAlign.end, + ), + ); + }).toList(), + ))), + ), + ], + ) + ], + ), + )), + 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"))), + padding: EdgeInsets.all(5), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + TranslationBase.of(context).doctorName, + fontSize: 10, + ), + AppTextFormField( + readOnly: true, + hintText: profile['DoctorName'], + borderColor: Colors.white, + onSaved: (value) {}, + // validator: (value) { + // return TextValidator().validateName(value); + // }, + inputFormatter: ONLY_NUMBERS) + ], + ), + ), + SizedBox( + height: 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"))), + padding: EdgeInsets.all(5), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + TranslationBase.of(context).remarks, + fontSize: 10, + ), + AppTextFormField( + borderColor: Colors.white, + onSaved: (value) {}, + // validator: (value) { + // return TextValidator().validateName(value); + // }, + inputFormatter: ONLY_NUMBERS) + ], + ), + ), + Container( + margin: + EdgeInsets.all(SizeConfig.widthMultiplier * 5), + child: Wrap( + alignment: WrapAlignment.center, + children: [ + AppButton( + title: TranslationBase.of(context).submit, + onPressed: () { + // _validateInputs(); + }, + ), + ], + ), + ) + ], + ), + ), + ), + ), + )); + } + + getProfile() async { + Map p = await sharedPref.getObj(DOCTOR_PROFILE); + setState(() { + this.profile = p; + }); + } + + getClinicName(model) { + var clinicInfo = model.clinicsList + .where((i) => i['ClinicID'] == this.profile['ClinicID']) + .toList(); + print(clinicInfo); + return clinicInfo[0]['ClinicDescription']; + } +} diff --git a/lib/util/translations_delegate_base.dart b/lib/util/translations_delegate_base.dart index 1eabaea8..73e6f11d 100644 --- a/lib/util/translations_delegate_base.dart +++ b/lib/util/translations_delegate_base.dart @@ -33,7 +33,8 @@ class TranslationBase { String get mobileNo => localizedValues['mobileNo'][locale.languageCode]; - String get replySuccessfully => localizedValues['replySuccessfully'][locale.languageCode]; + String get replySuccessfully => + localizedValues['replySuccessfully'][locale.languageCode]; String get messagesScreenToolbarTitle => localizedValues['messagesScreenToolbarTitle'][locale.languageCode]; @@ -277,6 +278,14 @@ class TranslationBase { localizedValues['moreThan3Letter'][locale.languageCode]; String get gender2 => localizedValues['gender2'][locale.languageCode]; String get age2 => localizedValues['age2'][locale.languageCode]; + String get sickleave => localizedValues['sick-leaves'][locale.languageCode]; + String get submit => localizedValues['submit'][locale.languageCode]; + String get doctorName => localizedValues['doc-name'][locale.languageCode]; + String get clinicName => localizedValues['clinicname'][locale.languageCode]; + String get sickLeaveDate => + localizedValues['sick-leave-date'][locale.languageCode]; + String get sickLeaveDays => + localizedValues['sick-leave-days'][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate { diff --git a/lib/widgets/auth/verfiy_account.dart b/lib/widgets/auth/verfiy_account.dart index 1f64aa5b..bd66d511 100644 --- a/lib/widgets/auth/verfiy_account.dart +++ b/lib/widgets/auth/verfiy_account.dart @@ -396,6 +396,7 @@ class _VerifyAccountState extends State { Map profile, Function changeLoadingStata) { var doctor = DoctorProfileModel.fromJson(profile); authProv.setDoctorProfile(doctor); + sharedPref.setObj(DOCTOR_PROFILE, profile); this.getDashboard(doctor, changeLoadingStata); } diff --git a/lib/widgets/patients/profile/profile_medical_info_widget.dart b/lib/widgets/patients/profile/profile_medical_info_widget.dart index 092edb02..3b9d4f48 100644 --- a/lib/widgets/patients/profile/profile_medical_info_widget.dart +++ b/lib/widgets/patients/profile/profile_medical_info_widget.dart @@ -82,6 +82,14 @@ class ProfileMedicalInfoWidget extends StatelessWidget { route: PATIENT_ORDERS, name: TranslationBase.of(context).orders, icon: 'radiology-1.png')), + Visibility( + visible: selectedPatientType != 0 && selectedPatientType != 5, + child: PatientProfileButton( + key: key, + patient: patient, + route: PATIENT_SICKLEAVE, + name: TranslationBase.of(context).sickleave, + icon: 'sick_leaves_icons.png')), ]); } } diff --git a/lib/widgets/shared/app_text_form_field.dart b/lib/widgets/shared/app_text_form_field.dart index a0e91748..15a3941a 100644 --- a/lib/widgets/shared/app_text_form_field.dart +++ b/lib/widgets/shared/app_text_form_field.dart @@ -24,6 +24,7 @@ class AppTextFormField extends FormField { ValueChanged onFieldSubmitted, IconButton prefix, String labelText, + bool readOnly = false, borderColor}) : super( onSaved: onSaved, @@ -33,44 +34,53 @@ class AppTextFormField extends FormField { return Column( children: [ SizedBox( - height: 40.0, - child: TextFormField( - focusNode: focusNode, - keyboardType: textInputType, - inputFormatters: [WhitelistingTextInputFormatter(RegExp(inputFormatter)), - ],onChanged: onChanged?? (value){ - state.didChange(value); - }, - textInputAction: textInputAction, - onFieldSubmitted: onFieldSubmitted, - decoration: InputDecoration( - hintText: hintText, - suffixIcon: prefix, - hintStyle: TextStyle( - fontSize: SizeConfig.textMultiplier * 1.8,), - contentPadding: EdgeInsets.fromLTRB(20.0, 0.0, 20.0, 0.0), - labelText: labelText, - labelStyle: TextStyle( - fontSize: SizeConfig.textMultiplier * 1.7,), - enabledBorder: OutlineInputBorder( - borderRadius: BorderRadius.all(Radius.circular(6)), - borderSide: BorderSide( - color: borderColor != null ? borderColor : HexColor( - "#CCCCCC")), - ), - focusedBorder: OutlineInputBorder( - borderSide: BorderSide( - color: borderColor != null ? borderColor : HexColor( - "#CCCCCC")), - borderRadius: BorderRadius.all(Radius.circular(6)), - ) - //BorderRadius.all(Radius.circular(20)); - ), - onTap: onTap, - controller: controller, - ), - ), - state.hasError + height: 40.0, + child: TextFormField( + readOnly: readOnly, + focusNode: focusNode, + keyboardType: textInputType, + inputFormatters: [ + WhitelistingTextInputFormatter(RegExp(inputFormatter)), + ], + onChanged: onChanged ?? + (value) { + state.didChange(value); + }, + textInputAction: textInputAction, + onFieldSubmitted: onFieldSubmitted, + decoration: InputDecoration( + hintText: hintText, + suffixIcon: prefix, + hintStyle: TextStyle( + fontSize: SizeConfig.textMultiplier * 1.8, + ), + contentPadding: + EdgeInsets.fromLTRB(20.0, 0.0, 20.0, 0.0), + labelText: labelText, + labelStyle: TextStyle( + fontSize: SizeConfig.textMultiplier * 1.7, + ), + enabledBorder: OutlineInputBorder( + borderRadius: BorderRadius.all(Radius.circular(6)), + borderSide: BorderSide( + color: borderColor != null + ? borderColor + : HexColor("#CCCCCC")), + ), + focusedBorder: OutlineInputBorder( + borderSide: BorderSide( + color: borderColor != null + ? borderColor + : HexColor("#CCCCCC")), + borderRadius: BorderRadius.all(Radius.circular(6)), + ) + //BorderRadius.all(Radius.circular(20)); + ), + onTap: onTap, + controller: controller, + ), + ), + state.hasError ? Text( state.errorText, style: TextStyle(color: Colors.red),