From ac747e7519bf4af63d1136c768dba70f477c645d Mon Sep 17 00:00:00 2001 From: Sultan Khan Date: Mon, 14 Dec 2020 10:27:24 +0300 Subject: [PATCH 01/21] dashboard --- lib/config/config.dart | 1 + lib/config/shared_pref_kay.dart | 1 + lib/providers/auth_provider.dart | 25 +++++++++++++++++++++---- lib/widgets/auth/verfiy_account.dart | 14 ++++++++++---- pubspec.yaml | 6 +++--- 5 files changed, 36 insertions(+), 11 deletions(-) diff --git a/lib/config/config.dart b/lib/config/config.dart index 6549ada5..4dcc13dc 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -77,6 +77,7 @@ const GET_DOC_PROFILES = 'Services/Doctors.svc/REST/GetDocProfiles'; const TRANSFERT_TO_ADMIN = 'LiveCareApi/DoctorApp/TransferToAdmin'; const END_CALL = 'LiveCareApi/DoctorApp/EndCall'; const END_CALL_WITH_CHARGE = 'LiveCareApi/DoctorApp/CompleteCallWithCharge'; +const GET_DASHBOARD = 'DoctorApplication.svc/REST/GetDoctorDashboardKPI'; var selectedPatientType = 1; diff --git a/lib/config/shared_pref_kay.dart b/lib/config/shared_pref_kay.dart index 18b58c28..b4c4c374 100644 --- a/lib/config/shared_pref_kay.dart +++ b/lib/config/shared_pref_kay.dart @@ -8,3 +8,4 @@ final APP_Language = 'language'; final DOCTOR_PROFILE = 'doctorProfile'; final LIVE_CARE_PATIENT = 'livecare-patient-profile'; final LOGGED_IN_USER = 'loggedUser'; +final DASHBOARD_DATA = 'dashboard-data'; diff --git a/lib/providers/auth_provider.dart b/lib/providers/auth_provider.dart index eaca545d..67dc45e6 100644 --- a/lib/providers/auth_provider.dart +++ b/lib/providers/auth_provider.dart @@ -17,17 +17,16 @@ class AuthProvider with ChangeNotifier { bool isLoading = true; DoctorProfileModel doctorProfile; BaseAppClient baseAppClient = BaseAppClient(); - setDoctorProfile(DoctorProfileModel profileModel){ + setDoctorProfile(DoctorProfileModel profileModel) { doctorProfile = profileModel; notifyListeners(); } - AuthProvider() { getUserAuthentication(); } - getUserAuthentication() async { + getUserAuthentication() async { Map profile = await sharedPref.getObj(DOCTOR_PROFILE); if (profile != null) { doctorProfile = new DoctorProfileModel.fromJson(profile); @@ -154,7 +153,8 @@ class AuthProvider with ChangeNotifier { await baseAppClient.post(GET_DOC_PROFILES, onSuccess: (dynamic response, int statusCode) { localRes = response; - doctorProfile = DoctorProfileModel.fromJson(response['DoctorProfileList'][0]); + doctorProfile = + DoctorProfileModel.fromJson(response['DoctorProfileList'][0]); selectedClinicName = response['DoctorProfileList'][0]['ClinicDescription']; }, onFailure: (String error, int statusCode) { @@ -167,4 +167,21 @@ class AuthProvider with ChangeNotifier { throw error; } } + + Future getDashboard(docInfo) async { + try { + dynamic localRes; + await baseAppClient.post(GET_DASHBOARD, + onSuccess: (dynamic response, int statusCode) { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: {"DoctorID": docInfo.doctorID}); + notifyListeners(); + return Future.value(localRes); + } catch (error) { + print(error); + throw error; + } + } } diff --git a/lib/widgets/auth/verfiy_account.dart b/lib/widgets/auth/verfiy_account.dart index 8a43a42f..461ea5bc 100644 --- a/lib/widgets/auth/verfiy_account.dart +++ b/lib/widgets/auth/verfiy_account.dart @@ -363,7 +363,7 @@ class _VerifyAccountState extends State { "IsSilentLogIN": false }; - authProv.memberCheckActivationCodeNew(model).then((res) async{ + authProv.memberCheckActivationCodeNew(model).then((res) async { if (res['MessageStatus'] == 1) { sharedPref.setString(TOKEN, res['AuthenticationTokenID']); if (res['List_DoctorProfile'] != null) { @@ -394,12 +394,18 @@ class _VerifyAccountState extends State { */ loginProcessCompleted( Map profile, Function changeLoadingStata) { - var doctor = DoctorProfileModel.fromJson(profile); - authProv.setDoctorProfile(doctor); + var doctor = DoctorProfileModel.fromJson(profile); + authProv.setDoctorProfile(doctor); + this.getDashboard(doctor, changeLoadingStata); + } + getDashboard(doctor, Function changeLoadingStata) { + // authProv.getDashboard(doctor).then((value) { + // print(value); changeLoadingStata(false); - sharedPref.setObj(DOCTOR_PROFILE, profile); + // sharedPref.setObj(DASHBOARD_DATA, value); Navigator.of(context).pushReplacementNamed(HOME); + // }); } Future _asyncSimpleDialog( diff --git a/pubspec.yaml b/pubspec.yaml index bdda7810..038ad335 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -14,7 +14,7 @@ description: A new Flutter project. version: 1.0.0+1 environment: - sdk: ">=2.6.0 <3.0.0" + sdk: ">=2.8.0 <3.0.0" dependencies: flutter: @@ -50,7 +50,7 @@ dependencies: cupertino_icons: ^0.1.2 # SVG #flutter_svg: ^0.17.4 - percent_indicator: "^2.1.1" + percent_indicator: ^2.1.1 #Dependency Injection get_it: ^4.0.2 @@ -80,7 +80,7 @@ flutter: assets: - assets/images/ - assets/images/dashboard/ - # - images/a_dot_ham.jpeg + # An image asset can refer to one or more resolution-specific "variants", see # https://flutter.dev/assets-and-images/#resolution-aware. From cc1a63786f9918d5ebff8be06d7283ee2208f021 Mon Sep 17 00:00:00 2001 From: Sultan Khan Date: Mon, 14 Dec 2020 17:58:19 +0300 Subject: [PATCH 02/21] 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#!<(&% zVY!Nfc{0m5QVZ>$FhD;_^I9Un3H*I8BWvg7ULn&dDM_|QlQu35un;U>=TYAC z5b|lxxnzo!f?zYxso;jckQ0=@KdT-}V}$;W7uW^Ri=oUxx$GGk(vCFwDhVHg6izNM z8?!8QqU2UHlahzqm&u(T52QV{>(%kWAmJ|dm-#w7! zJ_};#B}uWanN8lP<;1&bsqKsbJ2Anu63Ftp55ROPbGZ>@Nq~H^FD+}AxmGCUUo%UH z1Cqh~luJmDBiq4)OrN6SO6IL;_QiGXWA$ntC{HKZ z7dHtBa{JRc&J4zw8B?DS7^jxIbU1ao)K>mubCwiG3L{Rr5^wz=1a+OS2Eru9IZ4%d zJDuE%%6ev~6NfR4n4-L$SX`r71}`zFEcQZi6bw+yzf)mIyOGApkIJmuLKaVylty!J(3?pL=7bn%xYYtCn-zpS3Y@D}7 zEzgFVXX4*WSnP1w#yVwPjch+yy?9shSf7nwc?oyTh zw7EFNn&Qtrn2YV)?|PYQ`mhc#*;MF-@cb?xLaVyZ`-~OOAz67bIk&Uuh>qla677#Q zI7NjUTWotpnM$3~+~fRk8i_gkX3APFwV*V1E%%5_4oG|7ZS>MNFzbj)mj}T&RUG@c zS3}H2O2~%;P%D$U-?f-m(GoWxJ>aOJz?(uU<^)TiVDFRvsK~51g}v7JQsnb zIL>22ze#{Hs$y+Gk25F2QtfMq)D!kpai&;y3S5YzE=Qy3Py+PnfYH^dvc z<+Lhy?ejsORt%^zwA7*y)>dYU=9>Z(#y^0Gro12Y#f#x;S?(=BLViA*cwD?VD&Tds zib!qsVRHgOr&bbUWuwEvSjt_qgx)mY(B0`X1CCwEZDc#i*PQp?L57uB5x|>{W;eKS zY3CI{VPH11k#&kNGV~@vkn2}p9KhM^m~o0*7@(I!mgq;L4jd7~3r#moGjULqCgx&6 zHe6NVv9%lmC7kQ zm~wQb>XJi>9Rw5e@%~m%(m=YR{wjOXiglkWqhmTX2UaCEbR(0gi_EPoFb^!0P(B#Q zf_EEN$d?N(&;(VjamQLl({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), From 76e10459e0d8c76cdb84c9cd32dd4c1a37007c7d Mon Sep 17 00:00:00 2001 From: Sultan Khan Date: Tue, 15 Dec 2020 07:47:11 +0300 Subject: [PATCH 03/21] sick leave --- lib/screens/sick-leave/sick_leave.dart | 3 ++- .../profile/profile_medical_info_widget.dart | 17 +++++++++++------ 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/lib/screens/sick-leave/sick_leave.dart b/lib/screens/sick-leave/sick_leave.dart index acf9c7a7..c43bd77f 100644 --- a/lib/screens/sick-leave/sick_leave.dart +++ b/lib/screens/sick-leave/sick_leave.dart @@ -149,7 +149,8 @@ class _SickLeaveScreenState extends State { ignoring: true, child: DropdownButton( isExpanded: true, - value: getClinicName(model), + value: getClinicName(model) ?? + "", iconSize: 40, elevation: 16, selectedItemBuilder: diff --git a/lib/widgets/patients/profile/profile_medical_info_widget.dart b/lib/widgets/patients/profile/profile_medical_info_widget.dart index 23d68ae5..d72d0c5a 100644 --- a/lib/widgets/patients/profile/profile_medical_info_widget.dart +++ b/lib/widgets/patients/profile/profile_medical_info_widget.dart @@ -97,7 +97,8 @@ class ProfileMedicalInfoWidget extends StatelessWidget { key: key, patient: patient, route: PATIENT_SICKLEAVE, - name: TranslationBase.of(context).sickleave, + nameLine1: TranslationBase.of(context).sickleave, + nameLine2: "", icon: 'sick_leaves_icons.png')), ]); } @@ -160,7 +161,12 @@ class PatientProfileButton extends StatelessWidget { final PatiantInformtion patient; final String url = "assets/images/"; PatientProfileButton( - {Key key, this.patient, this.nameLine1, this.nameLine2, this.icon, this.route}) + {Key key, + this.patient, + this.nameLine1, + this.nameLine2, + this.icon, + this.route}) : super(key: key); @override Widget build(BuildContext context) { @@ -174,18 +180,17 @@ class PatientProfileButton extends StatelessWidget { Container( alignment: Alignment.topLeft, padding: EdgeInsets.all(5), - child: - Column( + child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - AppText( + AppText( this.nameLine1, color: Color(0xFFB9382C), fontWeight: FontWeight.w600, textAlign: TextAlign.left, fontSize: SizeConfig.textMultiplier * 2, ), - AppText( + AppText( this.nameLine2, color: Colors.black, fontWeight: FontWeight.w600, From 900264bc26e308431dde6383a725bd3476007c79 Mon Sep 17 00:00:00 2001 From: Sultan Khan Date: Tue, 15 Dec 2020 09:05:05 +0300 Subject: [PATCH 04/21] sick leave --- lib/core/service/patient_service.dart | 48 ++-- lib/core/viewModel/auth_view_model.dart | 17 -- lib/core/viewModel/patient_view_model.dart | 25 +- lib/screens/dashboard_screen.dart | 280 ++++++++------------- 4 files changed, 159 insertions(+), 211 deletions(-) diff --git a/lib/core/service/patient_service.dart b/lib/core/service/patient_service.dart index b16753f5..82cb9a60 100644 --- a/lib/core/service/patient_service.dart +++ b/lib/core/service/patient_service.dart @@ -276,7 +276,7 @@ class PatientService extends BaseService { ); } - Future getPatientInsuranceApprovals(patient) async { + Future getPatientInsuranceApprovals(patient) async { hasError = false; await baseAppClient.post( @@ -293,7 +293,7 @@ class PatientService extends BaseService { ); } - Future getPatientProgressNote(patient) async { + Future getPatientProgressNote(patient) async { hasError = false; await baseAppClient.post( @@ -310,7 +310,6 @@ class PatientService extends BaseService { ); } - Future getClinicsList() async { hasError = false; @@ -328,7 +327,6 @@ class PatientService extends BaseService { ); } - Future getReferralFrequancyList() async { hasError = false; @@ -363,19 +361,19 @@ class PatientService extends BaseService { ); } - // TODO send the total model insted of each parameter - Future referToDoctor({String selectedDoctorID, - String selectedClinicID, - int admissionNo, - String extension, - String priority, - String frequency, - String referringDoctorRemarks, - int patientID, - int patientTypeID, - String roomID, - int projectID}) async { + Future referToDoctor( + {String selectedDoctorID, + String selectedClinicID, + int admissionNo, + String extension, + String priority, + String frequency, + String referringDoctorRemarks, + int patientID, + int patientTypeID, + String roomID, + int projectID}) async { hasError = false; // TODO Change it to use it when we implement authentication user Map profile = await sharedPref.getObj(DOCTOR_PROFILE); @@ -409,4 +407,22 @@ class PatientService extends BaseService { body: _referToDoctorRequest.toJson(), ); } + + Future getDashboard() async { + try { + dynamic localRes; + hasError = false; + await baseAppClient.post(GET_DASHBOARD, + onSuccess: (dynamic response, int statusCode) { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: {}); + // notifyListeners(); + return Future.value(localRes); + } catch (error) { + hasError = true; + super.error = error; + } + } } diff --git a/lib/core/viewModel/auth_view_model.dart b/lib/core/viewModel/auth_view_model.dart index d4c00ca3..26dc78d8 100644 --- a/lib/core/viewModel/auth_view_model.dart +++ b/lib/core/viewModel/auth_view_model.dart @@ -167,21 +167,4 @@ class AuthViewModel with ChangeNotifier { throw error; } } - - Future getDashboard(docInfo) async { - try { - dynamic localRes; - await baseAppClient.post(GET_DASHBOARD, - onSuccess: (dynamic response, int statusCode) { - localRes = response; - }, onFailure: (String error, int statusCode) { - throw error; - }, body: {"DoctorID": docInfo.doctorID}); - notifyListeners(); - return Future.value(localRes); - } catch (error) { - print(error); - throw error; - } - } } diff --git a/lib/core/viewModel/patient_view_model.dart b/lib/core/viewModel/patient_view_model.dart index f39a3d48..c1339fd0 100644 --- a/lib/core/viewModel/patient_view_model.dart +++ b/lib/core/viewModel/patient_view_model.dart @@ -48,7 +48,7 @@ class PatientViewModel extends BaseViewModel { get referalFrequancyList => _patientService.referalFrequancyList; Future getPatientList(PatientModel patient, patientType, {bool isBusyLocal = false}) async { - if(isBusyLocal) { + if (isBusyLocal) { setState(ViewState.BusyLocal); } else { setState(ViewState.Busy); @@ -56,11 +56,23 @@ class PatientViewModel extends BaseViewModel { return _patientService.getPatientList(patient, patientType); if (_patientService.hasError) { error = _patientService.error; - if(isBusyLocal) { + if (isBusyLocal) { setState(ViewState.ErrorLocal); } else { setState(ViewState.Error); - } } else + } + } else + setState(ViewState.Idle); + } + + Future getDashboard() async { + setState(ViewState.Busy); + await _patientService.getDashboard(); + if (_patientService.hasError) { + error = _patientService.error; + setState(ViewState.Idle); + //setState(ViewState.Error); + } else setState(ViewState.Idle); } @@ -167,6 +179,7 @@ class PatientViewModel extends BaseViewModel { } } } + Future getDoctorsList(String clinicId) async { setState(ViewState.BusyLocal); await _patientService.getDoctorsList(clinicId); @@ -182,8 +195,9 @@ class PatientViewModel extends BaseViewModel { } List getDoctorNameList() { - var doctorNamelist = - _patientService.doctorsList.map((value) => value['DoctorName'].toString()).toList(); + var doctorNamelist = _patientService.doctorsList + .map((value) => value['DoctorName'].toString()) + .toList(); return doctorNamelist; } @@ -193,6 +207,7 @@ class PatientViewModel extends BaseViewModel { .toList(); return clinicsNameslist; } + Future getReferralFrequancyList() async { setState(ViewState.Busy); await _patientService.getReferralFrequancyList(); diff --git a/lib/screens/dashboard_screen.dart b/lib/screens/dashboard_screen.dart index 80697352..e9c6341f 100644 --- a/lib/screens/dashboard_screen.dart +++ b/lib/screens/dashboard_screen.dart @@ -1,5 +1,6 @@ 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/icons_app/doctor_app_icons.dart'; import 'package:doctor_app_flutter/models/doctor/clinic_model.dart'; import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart'; @@ -7,6 +8,7 @@ import 'package:doctor_app_flutter/models/doctor/profile_req_Model.dart'; import 'package:doctor_app_flutter/core/viewModel/auth_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/hospital_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/project_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'; @@ -69,9 +71,10 @@ class _DashboardScreenState extends State { if (!currentFocus.hasPrimaryFocus) { currentFocus.unfocus(); } - return SafeArea( - bottom: true, - child: AppScaffold( + return BaseView( + onModelReady: (model) => model.getDashboard(), + builder: (_, model, w) => AppScaffold( + baseViewModel: model, isShowAppBar: false, isLoading: isLoading, body: ListView(children: [ @@ -96,9 +99,7 @@ class _DashboardScreenState extends State { Row( children: [ AppText( - TranslationBase - .of(context) - .welcome, + TranslationBase.of(context).welcome, fontSize: SizeConfig.textMultiplier * 1.7, color: Colors.white, ) @@ -123,8 +124,8 @@ class _DashboardScreenState extends State { showCupertinoPicker( decKey: '', context: context, - actionList: projectsProvider - .doctorClinicsList); + actionList: + projectsProvider.doctorClinicsList); }, child: Row( mainAxisAlignment: @@ -134,11 +135,12 @@ class _DashboardScreenState extends State { child: AppText( authProvider.selectedClinicName != null - ? authProvider.selectedClinicName + ? authProvider + .selectedClinicName : authProvider.doctorProfile .clinicDescription, fontSize: - SizeConfig.textMultiplier * 1.7, + SizeConfig.textMultiplier * 1.7, color: Colors.white, textAlign: TextAlign.center, ), @@ -148,27 +150,29 @@ class _DashboardScreenState extends State { ), Row( mainAxisAlignment: - MainAxisAlignment.start, + MainAxisAlignment.start, mainAxisSize: MainAxisSize.max, crossAxisAlignment: - CrossAxisAlignment.start, + CrossAxisAlignment.start, children: [ InkWell( - child: Container( margin: EdgeInsets.only( left: 5, top: projectsProvider - .isArabic ? 0 : 5, + .isArabic + ? 0 + : 5, right: 10, bottom: projectsProvider - .isArabic ? 15 : 7), + .isArabic + ? 15 + : 7), child: Icon( DoctorApp.sync_icon, - color: Colors.white, size: SizeConfig - .textMultiplier * + .textMultiplier * 1.8, )), ), @@ -176,20 +180,16 @@ class _DashboardScreenState extends State { ), ]), ), - ], ), Expanded( child: Column( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.end, - children: [ Container( decoration: BoxDecoration( - color: Theme - .of(context) - .backgroundColor, + color: Theme.of(context).backgroundColor, borderRadius: BorderRadius.all( Radius.circular(10.0), ), @@ -197,8 +197,7 @@ class _DashboardScreenState extends State { height: 50, width: 60, child: Image.network( - authProvider.doctorProfile - .doctorImageURL, + authProvider.doctorProfile.doctorImageURL, // fit: BoxFit.fill, ), ), @@ -246,18 +245,18 @@ class _DashboardScreenState extends State { center: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ - AppText("38", - fontSize: - SizeConfig.textMultiplier * 3.7, + 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'), - ), + fontWeight: FontWeight.bold, + ), + AppText( + TranslationBase.of(context).outPatients, + fontWeight: FontWeight.normal, + fontSize: SizeConfig.textMultiplier * 1.4, + color: HexColor('#5D4C35'), + ), ], ), circularStrokeCap: CircularStrokeCap.butt, @@ -418,15 +417,12 @@ class _DashboardScreenState extends State { color: Colors.white, ), AppText( - TranslationBase - .of(context) - .labResult, + TranslationBase.of(context).labResult, color: Colors.white, ) ], ), ), - ], ), imageName: '1.png', @@ -446,7 +442,6 @@ class _DashboardScreenState extends State { ), Container( margin: EdgeInsets.only(bottom: 10), - child: Column( children: [ AppText( @@ -455,15 +450,12 @@ class _DashboardScreenState extends State { color: Colors.white, ), AppText( - TranslationBase - .of(context) - .radiology, + TranslationBase.of(context).radiology, color: Colors.white, ) ], ), ), - ], ), imageName: '2.png', @@ -481,10 +473,8 @@ class _DashboardScreenState extends State { color: Colors.white, ), ), - Container( margin: EdgeInsets.only(bottom: 10), - child: Column( children: [ AppText( @@ -493,20 +483,16 @@ class _DashboardScreenState extends State { color: Colors.white, ), AppText( - TranslationBase - .of(context) - .referral, + TranslationBase.of(context).referral, color: Colors.white, ) ], ), ), - ], ), imageName: '3.png', opacity: 0.9, - ), ], ), @@ -522,7 +508,7 @@ class _DashboardScreenState extends State { padding: const EdgeInsets.all(8.0), child: Row( mainAxisAlignment: - MainAxisAlignment.spaceBetween, + MainAxisAlignment.spaceBetween, children: [ Column( children: [ @@ -542,9 +528,7 @@ class _DashboardScreenState extends State { color: Colors.white, ), AppText( - TranslationBase - .of(context) - .inPatient, + TranslationBase.of(context).inPatient, color: Colors.white, ) ], @@ -555,28 +539,18 @@ class _DashboardScreenState extends State { 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, + 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, + MainAxisAlignment.spaceBetween, children: [ Column( children: [ @@ -596,9 +570,7 @@ class _DashboardScreenState extends State { color: Colors.white, ), AppText( - TranslationBase - .of(context) - .operations, + TranslationBase.of(context).operations, color: Colors.white, ) ], @@ -609,21 +581,11 @@ class _DashboardScreenState extends State { 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, + 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, ), ], ), @@ -633,9 +595,7 @@ class _DashboardScreenState extends State { Row( children: [ AppText( - TranslationBase - .of(context) - .patientServices, + TranslationBase.of(context).patientServices, fontSize: SizeConfig.textMultiplier * 3, ), ], @@ -691,16 +651,12 @@ class _DashboardScreenState extends State { Column( children: [ AppText( - TranslationBase - .of(context) - .theDoctor, + TranslationBase.of(context).theDoctor, textAlign: TextAlign.center, color: Colors.black, ), AppText( - TranslationBase - .of(context) - .reply, + TranslationBase.of(context).reply, textAlign: TextAlign.center, color: Colors.black, ), @@ -713,8 +669,7 @@ class _DashboardScreenState extends State { Navigator.push( context, MaterialPageRoute( - builder: (context) => - DoctorReplyScreen(), + builder: (context) => DoctorReplyScreen(), ), ); }, @@ -729,9 +684,7 @@ class _DashboardScreenState extends State { color: Colors.black, ), AppText( - TranslationBase - .of(context) - .searchMedicine, + TranslationBase.of(context).searchMedicine, color: Colors.black, textAlign: TextAlign.center, ) @@ -742,8 +695,7 @@ class _DashboardScreenState extends State { Navigator.push( context, MaterialPageRoute( - builder: (context) => - MedicineSearchScreen(), + builder: (context) => MedicineSearchScreen(), ), ); }, @@ -777,12 +729,8 @@ class _DashboardScreenState extends State { ), AppText( projectsProvider.isArabic - ? TranslationBase - .of(context) - .qr - : TranslationBase - .of(context) - .reader, + ? TranslationBase.of(context).qr + : TranslationBase.of(context).reader, color: Colors.black, textAlign: TextAlign.center, ), @@ -806,9 +754,7 @@ class _DashboardScreenState extends State { color: Colors.black, ), AppText( - TranslationBase - .of(context) - .myReferralPatient, + TranslationBase.of(context).myReferralPatient, textAlign: TextAlign.center, color: Colors.black, ) @@ -819,8 +765,7 @@ class _DashboardScreenState extends State { Navigator.push( context, MaterialPageRoute( - builder: (context) => - MyReferralPatient(), + builder: (context) => MyReferralPatient(), ), ); }, @@ -835,9 +780,7 @@ class _DashboardScreenState extends State { color: Colors.black, ), AppText( - TranslationBase - .of(context) - .myReferredPatient, + TranslationBase.of(context).myReferredPatient, color: Colors.black, textAlign: TextAlign.center, ) @@ -848,8 +791,7 @@ class _DashboardScreenState extends State { Navigator.push( context, MaterialPageRoute( - builder: (context) => - MyReferredPatient(), + builder: (context) => MyReferredPatient(), ), ); }, @@ -890,21 +832,17 @@ class _DashboardScreenState extends State { mainAxisAlignment: MainAxisAlignment.end, children: [ CupertinoButton( - child: AppText(TranslationBase - .of(context) - .cancel - // style: TextStyle(context) - ), + child: AppText(TranslationBase.of(context).cancel + // style: TextStyle(context) + ), onPressed: () { Navigator.pop(context); }, ), CupertinoButton( - child: AppText(TranslationBase - .of(context) - .done - // style: textStyle(context), - ), + child: AppText(TranslationBase.of(context).done + // style: textStyle(context), + ), onPressed: () { Navigator.pop(context); // onSelectFun(cupertinoPickerIndex); @@ -927,8 +865,7 @@ class _DashboardScreenState extends State { child: AppText( e.clinicName, fontSize: - SizeConfig.textMultiplier * - 1.9, + SizeConfig.textMultiplier * 1.9, )), ), )) @@ -969,19 +906,20 @@ class _DashboardScreenState extends State { }); } } + // TODO Move to it file class DashboardItem extends StatelessWidget { - const DashboardItem({ - this.hasBorder = false, - this.imageName, - @required this.child, - this.onTap, - Key key, - this.width, - this.height, - this.color, - this.opacity = 0.4 - }) : super(key: key); + const DashboardItem( + {this.hasBorder = false, + this.imageName, + @required this.child, + this.onTap, + Key key, + this.width, + this.height, + this.color, + this.opacity = 0.4}) + : super(key: key); final bool hasBorder; final String imageName; final Widget child; @@ -996,38 +934,34 @@ class DashboardItem extends StatelessWidget { return InkWell( onTap: onTap, child: Container( - width: width != null ? width : MediaQuery - .of(context) - .size - .width * 0.29, - height: height != null ? height : MediaQuery - .of(context) - .orientation == Orientation.portrait ? MediaQuery - .of(context) - .size - .height * 0.19 : MediaQuery - .of(context) - .size - .height * 0.35, - + width: width != null ? width : MediaQuery.of(context).size.width * 0.29, + height: height != null + ? height + : MediaQuery.of(context).orientation == Orientation.portrait + ? MediaQuery.of(context).size.height * 0.19 + : MediaQuery.of(context).size.height * 0.35, decoration: BoxDecoration( - color: !hasBorder ? color != null ? color : HexColor('#050705') - .withOpacity(opacity) : Colors - .white, + color: !hasBorder + ? color != null + ? color + : HexColor('#050705').withOpacity(opacity) + : Colors.white, borderRadius: BorderRadius.circular(6.0), - border: hasBorder ? Border.all( - width: 1.0, color: const Color(0xffcccccc)) : Border.all( - width: 0.0, color: Colors.transparent), - image: imageName != null ? DecorationImage( - image: AssetImage('assets/images/dashboard/${imageName}'), - fit: BoxFit.cover, - colorFilter: new ColorFilter.mode( - Colors.black.withOpacity(0.2), BlendMode.dstIn), - - ) : null, - + border: hasBorder + ? Border.all(width: 1.0, color: const Color(0xffcccccc)) + : Border.all(width: 0.0, color: Colors.transparent), + image: imageName != null + ? DecorationImage( + image: AssetImage('assets/images/dashboard/${imageName}'), + fit: BoxFit.cover, + colorFilter: new ColorFilter.mode( + Colors.black.withOpacity(0.2), BlendMode.dstIn), + ) + : null, + ), + child: Center( + child: child, ), - child: Center(child: child,), ), ); } From ba2697c917d902e61a2ffb6631013a513540814f Mon Sep 17 00:00:00 2001 From: Sultan Khan Date: Wed, 16 Dec 2020 18:29:12 +0300 Subject: [PATCH 05/21] sick leave --- lib/client/base_app_client.dart | 10 +- lib/config/config.dart | 7 +- lib/config/localized_values.dart | 8 +- lib/core/service/dasboard_service.dart | 28 ++ lib/core/service/patient_service.dart | 35 +- lib/core/service/sickleave_service.dart | 23 + lib/core/viewModel/dashboard_view_model.dart | 21 + lib/core/viewModel/patient_view_model.dart | 21 +- lib/core/viewModel/sick_leave_view_model.dart | 31 ++ lib/locator.dart | 8 + lib/models/dashboard/dashboard_model.dart | 70 +++ lib/routes.dart | 5 +- lib/screens/dashboard_screen.dart | 16 +- lib/screens/sick-leave/add-sickleave.dart | 27 ++ lib/screens/sick-leave/sick_leave.dart | 422 +++++++++--------- lib/util/translations_delegate_base.dart | 5 + .../profile/profile_medical_info_widget.dart | 6 +- 17 files changed, 500 insertions(+), 243 deletions(-) create mode 100644 lib/core/service/dasboard_service.dart create mode 100644 lib/core/service/sickleave_service.dart create mode 100644 lib/core/viewModel/dashboard_view_model.dart create mode 100644 lib/core/viewModel/sick_leave_view_model.dart create mode 100644 lib/models/dashboard/dashboard_model.dart create mode 100644 lib/screens/sick-leave/add-sickleave.dart diff --git a/lib/client/base_app_client.dart b/lib/client/base_app_client.dart index 454f4d04..d831d5ac 100644 --- a/lib/client/base_app_client.dart +++ b/lib/client/base_app_client.dart @@ -30,7 +30,7 @@ Helpers helpers = new Helpers(); * */ class BaseAppClient { //TODO change the post fun to nun static when you change all service - post( + post( String endPoint, { Map body, Function(dynamic response, int statusCode) onSuccess, @@ -43,6 +43,11 @@ class BaseAppClient { if (profile != null) { DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile); + // body["VidaAuthTokenID"] = + // "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIyODA0IiwianRpIjoiNzUyODk5MGItZjFhYS00NmUyLWE0MWMtMTIwMjZmMTk5YzJkIiwiZW1haWwiOiJNb2hhbWVkLlJlc3dhbkBjbG91ZHNvbHV0aW9uLXNhLmNvbSIsImlkIjoiMjgwNCIsIk5hbWUiOiJNVUhBTU1BRCBBWkFNIiwiRW1wbG95ZWVJZCI6IjE0ODUiLCJGYWNpbGl0eUdyb3VwSWQiOiIwMTAyNjYiLCJGYWNpbGl0eUlkIjoiMTUiLCJQaGFyYW1jeUZhY2lsaXR5SWQiOiI1NSIsIklTX1BIQVJNQUNZX0NPTk5FQ1RFRCI6IlRydWUiLCJEb2N0b3JJZCI6IjE0ODUiLCJTRVNTSU9OSUQiOiIyMTU3NTk4MiIsIkNsaW5pY0lkIjoiMyIsInJvbGUiOlsiU0VDVVJJVFkgQURNSU5JU1RSQVRPUlMiLCJTRVRVUCBBRE1JTklTVFJBVE9SUyIsIkNFTydTIiwiRVhFQ1VUSVZFIERJUkVDVE9SUyIsIk1BTkFHRVJTIiwiU1VQRVJWSVNPUlMiLCJDTElFTlQgU0VSVklDRVMgQ09PUkRJTkFUT1JTIiwiQ0xJRU5UIFNFUlZJQ0VTIFNVUEVSVklTT1JTIiwiQ0xJRU5UIFNFUlZJQ0VTIE1BTkdFUlMiLCJIRUFEIE5VUlNFUyIsIkRPQ1RPUlMiLCJDSElFRiBPRiBNRURJQ0FMIFNUQUZGUyIsIkJJTy1NRURJQ0FMIFRFQ0hOSUNJQU5TIiwiQklPLU1FRElDQUwgRU5HSU5FRVJTIiwiQklPLU1FRElDQUwgREVQQVJUTUVOVCBIRUFEUyIsIklUIEhFTFAgREVTSyIsIkFETUlOSVNUUkFUT1JTIiwiTEFCIEFETUlOSVNUUkFUT1IiLCJMQUIgVEVDSE5JQ0lBTiIsIkJVU0lORVNTIE9GRklDRSBTVEFGRiIsIkZJTkFOQ0UgQUNDT1VOVEFOVFMiLCJQSEFSTUFDWSBTVEFGRiIsIkFDQ09VTlRTIFNUQUZGIiwiTEFCIFJFQ0VQVElPTklTVCIsIkVSIE5VUlNFIiwiSU5QQVRJRU5UIEJJTExJTkcgU1VQRVJWSVNPUiIsIkxEUi1PUiBOVVJTRVMiLCJBRE1JU1NJT04gU1RBRkYiLCJIRUxQIERFU0sgQURNSU4iLCJBUFBST1ZBTCBTVEFGRiIsIklOUEFUSUVOVCBCSUxMSU5HIENPT1JESU5BVE9SIiwiQklMTElORyBTVEFGRiIsIkNPTlNFTlQgIiwiQ29uc2VudCAtIERlbnRhbCIsIldFQkVNUiJdLCJuYmYiOjE2MDgxMTIyMzYsImV4cCI6MTYwODk3NjIzNiwiaWF0IjoxNjA4MTEyMjM2fQ.Bp84aDpkoZQsZ0cbSPYL9mhqqmvyxydoOirSlnc2Qz8"; + // body["VidaRefreshTokenID"] = + // "I0bL3kx07yjX/msZLKeb48Niug1QxylYtyWp9tkRkYWAKwabgszKF/fJy0DHwZavpZXWCb8fMw4NvRBZbk0MqA=="; + body['DoctorID'] = doctorProfile?.doctorID; body['EditedBy'] = doctorProfile?.doctorID; body['ProjectID'] = doctorProfile?.projectID; @@ -80,7 +85,8 @@ class BaseAppClient { } else { var parsed = json.decode(response.body.toString()); if (!parsed['IsAuthenticated']) { - await helpers.logout(); + //need to uncomment + // await helpers.logout(); helpers.showErrorToast('Your session expired Please login agian'); } else if (parsed['MessageStatus'] == 1) { diff --git a/lib/config/config.dart b/lib/config/config.dart index 017b46ec..17e23187 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -77,7 +77,12 @@ const GET_DOC_PROFILES = 'Services/Doctors.svc/REST/GetDocProfiles'; const TRANSFERT_TO_ADMIN = 'LiveCareApi/DoctorApp/TransferToAdmin'; const END_CALL = 'LiveCareApi/DoctorApp/EndCall'; const END_CALL_WITH_CHARGE = 'LiveCareApi/DoctorApp/CompleteCallWithCharge'; -const GET_DASHBOARD = 'DoctorApplication.svc/REST/GetDoctorDashboardKPI'; +const GET_DASHBOARD = + 'Services/DoctorApplication.svc/REST/GetDoctorDashboardKPI'; +const GET_SICKLEAVE_STATISTIC = + 'Services/DoctorApplication.svc/REST/PreSickLeaveStatistics'; +const ARRIVED_PATIENT_URL = + 'Services/DoctorApplication.svc/REST/PatientArrivalList​'; var selectedPatientType = 1; diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 21830385..7c476549 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -261,7 +261,9 @@ const Map> localizedValues = { }, 'gender2': {'en': 'Gender: ', 'ar': 'الجنس: '}, 'age2': {'en': 'Age: ', 'ar': 'العمر: '}, - "sick-leaves": {"en": "Sick Leaves", "ar": "الاجازات المرضية"}, + "sick-leaves": {"en": "Patient Sick", "ar": "الاجازات المرضية"}, + "patient-sick": {"en": "Patient Sick", "ar": "المرضية"}, + "leave": {"en": "Leave", "ar": "غادر"}, "submit": {"en": "Submit", "ar": "ارسال"}, "doc-name": {"en": "Doctor Name", "ar": "اسم الطبيب"}, "clinicname": {"en": "Clinic Name", "ar": "اسم العيادة"}, @@ -275,4 +277,8 @@ const Map> localizedValues = { 'area': {'en': 'AREA:', 'ar': 'المنطقة'}, 'room': {'en': 'ROOM:', 'ar': 'الغرفة'}, 'bed': {'en': 'BED:', 'ar': 'السرير'}, + "prevoius-sickleave-issed": { + "en": "Total previous sick leave issued by the doctor", + "ar": "مجموع الإجازات المرضية السابقة التي أصدرها الطبيب" + } }; diff --git a/lib/core/service/dasboard_service.dart b/lib/core/service/dasboard_service.dart new file mode 100644 index 00000000..cabcbf7c --- /dev/null +++ b/lib/core/service/dasboard_service.dart @@ -0,0 +1,28 @@ +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'; + +class DashboardService extends BaseService { + var _dashboardItemsList = []; + get dashboardItemsList => _dashboardItemsList; + + // DashboardModel _dashboard = DashboardModel(); + + Future getDashboard() async { + await baseAppClient.post( + GET_DASHBOARD, + onSuccess: (dynamic response, int statusCode) { + _dashboardItemsList.clear(); + _dashboardItemsList = response['listDoctorDashboarKPI']; + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + body: { + "VidaAuthTokenID": + "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIyODA0IiwianRpIjoiZDYxZmM5MTQtZWFhYy00YjQ4LTgyMmEtMmE3OTNlZDMzZGYwIiwiZW1haWwiOiJNb2hhbWVkLlJlc3dhbkBjbG91ZHNvbHV0aW9uLXNhLmNvbSIsImlkIjoiMjgwNCIsIk5hbWUiOiJNVUhBTU1BRCBBWkFNIiwiRW1wbG95ZWVJZCI6IjE0ODUiLCJGYWNpbGl0eUdyb3VwSWQiOiIwMTAyNjYiLCJGYWNpbGl0eUlkIjoiMTUiLCJQaGFyYW1jeUZhY2lsaXR5SWQiOiI1NSIsIklTX1BIQVJNQUNZX0NPTk5FQ1RFRCI6IlRydWUiLCJEb2N0b3JJZCI6IjE0ODUiLCJTRVNTSU9OSUQiOiIyMTU3NTgwOCIsIkNsaW5pY0lkIjoiMyIsInJvbGUiOlsiU0VDVVJJVFkgQURNSU5JU1RSQVRPUlMiLCJTRVRVUCBBRE1JTklTVFJBVE9SUyIsIkNFTydTIiwiRVhFQ1VUSVZFIERJUkVDVE9SUyIsIk1BTkFHRVJTIiwiU1VQRVJWSVNPUlMiLCJDTElFTlQgU0VSVklDRVMgQ09PUkRJTkFUT1JTIiwiQ0xJRU5UIFNFUlZJQ0VTIFNVUEVSVklTT1JTIiwiQ0xJRU5UIFNFUlZJQ0VTIE1BTkdFUlMiLCJIRUFEIE5VUlNFUyIsIkRPQ1RPUlMiLCJDSElFRiBPRiBNRURJQ0FMIFNUQUZGUyIsIkJJTy1NRURJQ0FMIFRFQ0hOSUNJQU5TIiwiQklPLU1FRElDQUwgRU5HSU5FRVJTIiwiQklPLU1FRElDQUwgREVQQVJUTUVOVCBIRUFEUyIsIklUIEhFTFAgREVTSyIsIkFETUlOSVNUUkFUT1JTIiwiTEFCIEFETUlOSVNUUkFUT1IiLCJMQUIgVEVDSE5JQ0lBTiIsIkJVU0lORVNTIE9GRklDRSBTVEFGRiIsIkZJTkFOQ0UgQUNDT1VOVEFOVFMiLCJQSEFSTUFDWSBTVEFGRiIsIkFDQ09VTlRTIFNUQUZGIiwiTEFCIFJFQ0VQVElPTklTVCIsIkVSIE5VUlNFIiwiSU5QQVRJRU5UIEJJTExJTkcgU1VQRVJWSVNPUiIsIkxEUi1PUiBOVVJTRVMiLCJBRE1JU1NJT04gU1RBRkYiLCJIRUxQIERFU0sgQURNSU4iLCJBUFBST1ZBTCBTVEFGRiIsIklOUEFUSUVOVCBCSUxMSU5HIENPT1JESU5BVE9SIiwiQklMTElORyBTVEFGRiIsIkNPTlNFTlQgIiwiQ29uc2VudCAtIERlbnRhbCIsIldFQkVNUiJdLCJuYmYiOjE2MDgwMjg0NzQsImV4cCI6MTYwODg5MjQ3NCwiaWF0IjoxNjA4MDI4NDc0fQ.8OJcy6vUuPnNTi_qSjip8YCrFdaRLtJKbNKXcMtnQxk" + }, + ); + } +} diff --git a/lib/core/service/patient_service.dart b/lib/core/service/patient_service.dart index 82cb9a60..8642014e 100644 --- a/lib/core/service/patient_service.dart +++ b/lib/core/service/patient_service.dart @@ -62,6 +62,10 @@ class PatientService extends BaseService { // TODO: replace var with model var _doctorsList = []; + var _arrivedList = []; + + get arrivedList => _arrivedList; + get doctorsList => _doctorsList; // TODO: replace var with model @@ -408,21 +412,20 @@ class PatientService extends BaseService { ); } - Future getDashboard() async { - try { - dynamic localRes; - hasError = false; - await baseAppClient.post(GET_DASHBOARD, - onSuccess: (dynamic response, int statusCode) { - localRes = response; - }, onFailure: (String error, int statusCode) { - throw error; - }, body: {}); - // notifyListeners(); - return Future.value(localRes); - } catch (error) { - hasError = true; - super.error = error; - } + Future getArrivedList() async { + hasError = false; + + await baseAppClient.post( + ARRIVED_PATIENT_URL, + onSuccess: (dynamic response, int statusCode) { + _arrivedList = []; + _arrivedList = response['"patientArrivalList": ']; + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + body: _doctorsByClinicIdRequest.toJson(), + ); } } diff --git a/lib/core/service/sickleave_service.dart b/lib/core/service/sickleave_service.dart new file mode 100644 index 00000000..9f47c38c --- /dev/null +++ b/lib/core/service/sickleave_service.dart @@ -0,0 +1,23 @@ +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'; + +class SickLeaveService extends BaseService { + var _statistics = {}; + get sickLeavestatisitics => _statistics; + + Future getStatistics() async { + await baseAppClient.post( + GET_SICKLEAVE_STATISTIC, + onSuccess: (dynamic response, int statusCode) { + print(response); + _statistics = response['SickLeaveStatistics']; + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + body: {"PatientMRN": 3120737, "AppointmentNo": 2016055008}, + ); + } +} diff --git a/lib/core/viewModel/dashboard_view_model.dart b/lib/core/viewModel/dashboard_view_model.dart new file mode 100644 index 00000000..9eb3c0fc --- /dev/null +++ b/lib/core/viewModel/dashboard_view_model.dart @@ -0,0 +1,21 @@ +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/service/dasboard_service.dart'; +import 'package:doctor_app_flutter/core/service/medicine_service.dart'; + +import '../../locator.dart'; +import 'base_view_model.dart'; + +class DashboardViewModel extends BaseViewModel { + DashboardService _dashboardService = locator(); + get dashboardItemsList => _dashboardService.dashboardItemsList; + + Future getDashboard() async { + setState(ViewState.Busy); + await _dashboardService.getDashboard(); + if (_dashboardService.hasError) { + error = _dashboardService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } +} diff --git a/lib/core/viewModel/patient_view_model.dart b/lib/core/viewModel/patient_view_model.dart index c1339fd0..c46183a5 100644 --- a/lib/core/viewModel/patient_view_model.dart +++ b/lib/core/viewModel/patient_view_model.dart @@ -65,17 +65,6 @@ class PatientViewModel extends BaseViewModel { setState(ViewState.Idle); } - Future getDashboard() async { - setState(ViewState.Busy); - await _patientService.getDashboard(); - if (_patientService.hasError) { - error = _patientService.error; - setState(ViewState.Idle); - //setState(ViewState.Error); - } else - setState(ViewState.Idle); - } - Future getPatientVitalSign(patient) async { setState(ViewState.Busy); await _patientService.getPatientVitalSign(patient); @@ -256,4 +245,14 @@ class PatientViewModel extends BaseViewModel { } else setState(ViewState.Idle); } + + Future getArrivedList() async { + setState(ViewState.Busy); + await _patientService.getArrivedList(); + if (_patientService.hasError) { + error = _patientService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } } diff --git a/lib/core/viewModel/sick_leave_view_model.dart b/lib/core/viewModel/sick_leave_view_model.dart new file mode 100644 index 00000000..eecee46d --- /dev/null +++ b/lib/core/viewModel/sick_leave_view_model.dart @@ -0,0 +1,31 @@ +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/service/sickleave_service.dart'; +import 'package:doctor_app_flutter/core/service/medicine_service.dart'; + +import '../../locator.dart'; +import 'base_view_model.dart'; + +class SickLeaveViewModel extends BaseViewModel { + SickLeaveService _sickLeaveService = locator(); + get sickLeaveStatistics => _sickLeaveService.sickLeavestatisitics; + + // Future getDashboard() async { + // setState(ViewState.Busy); + // await _dashboardService.getDashboard(); + // if (_dashboardService.hasError) { + // error = _dashboardService.error; + // setState(ViewState.Error); + // } else + // setState(ViewState.Idle); + // } + + Future preSickLeaveStatistics() async { + setState(ViewState.Busy); + await _sickLeaveService.getStatistics(); + if (_sickLeaveService.hasError) { + error = _sickLeaveService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } +} diff --git a/lib/locator.dart b/lib/locator.dart index 550b4666..e0536f23 100644 --- a/lib/locator.dart +++ b/lib/locator.dart @@ -1,5 +1,9 @@ +import 'package:doctor_app_flutter/core/service/dasboard_service.dart'; import 'package:doctor_app_flutter/core/service/patient_service.dart'; +import 'package:doctor_app_flutter/core/service/sickleave_service.dart'; +import 'package:doctor_app_flutter/core/viewModel/dashboard_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/patient_view_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/sick_leave_view_model.dart'; import 'package:get_it/get_it.dart'; import 'core/service/doctor_reply_service.dart'; @@ -24,6 +28,8 @@ void setupLocator() { locator.registerLazySingleton(() => ReferredPatientService()); locator.registerLazySingleton(() => MedicineService()); locator.registerLazySingleton(() => PatientService()); + locator.registerLazySingleton(() => DashboardService()); + locator.registerLazySingleton(() => SickLeaveService()); /// View Model locator.registerFactory(() => DoctorReplayViewModel()); @@ -32,4 +38,6 @@ void setupLocator() { locator.registerFactory(() => ReferredPatientViewModel()); locator.registerFactory(() => MedicineViewModel()); locator.registerFactory(() => PatientViewModel()); + locator.registerFactory(() => DashboardViewModel()); + locator.registerFactory(() => SickLeaveViewModel()); } diff --git a/lib/models/dashboard/dashboard_model.dart b/lib/models/dashboard/dashboard_model.dart new file mode 100644 index 00000000..0e03e899 --- /dev/null +++ b/lib/models/dashboard/dashboard_model.dart @@ -0,0 +1,70 @@ +class DashboardModel { + String kPIName; + int displaySequence; + List summaryoptions; + + DashboardModel({this.kPIName, this.displaySequence, this.summaryoptions}); + + DashboardModel.fromJson(Map json) { + kPIName = json['KPIName']; + displaySequence = json['displaySequence']; + if (json['summaryoptions'] != null) { + summaryoptions = new List(); + json['summaryoptions'].forEach((v) { + summaryoptions.add(new Summaryoptions.fromJson(v)); + }); + } + } + + Map toJson() { + final Map data = new Map(); + data['KPIName'] = this.kPIName; + data['displaySequence'] = this.displaySequence; + if (this.summaryoptions != null) { + data['summaryoptions'] = + this.summaryoptions.map((v) => v.toJson()).toList(); + } + return data; + } +} + +class Summaryoptions { + String kPIParameter; + String captionColor; + bool isCaptionBold; + bool isValueBold; + int order; + int value; + String valueColor; + + Summaryoptions( + {this.kPIParameter, + this.captionColor, + this.isCaptionBold, + this.isValueBold, + this.order, + this.value, + this.valueColor}); + + Summaryoptions.fromJson(Map json) { + kPIParameter = json['KPIParameter']; + captionColor = json['captionColor']; + isCaptionBold = json['isCaptionBold']; + isValueBold = json['isValueBold']; + order = json['order']; + value = json['value']; + valueColor = json['valueColor']; + } + + Map toJson() { + final Map data = new Map(); + data['KPIParameter'] = this.kPIParameter; + data['captionColor'] = this.captionColor; + data['isCaptionBold'] = this.isCaptionBold; + data['isValueBold'] = this.isValueBold; + data['order'] = this.order; + data['value'] = this.value; + data['valueColor'] = this.valueColor; + return data; + } +} diff --git a/lib/routes.dart b/lib/routes.dart index b7da4d2b..7dcf5e01 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/add-sickleave.dart'; import 'package:doctor_app_flutter/screens/sick-leave/sick_leave.dart'; import './screens/QR_reader_screen.dart'; @@ -76,6 +77,7 @@ const String IN_PATIENT_PRESCRIPTIONS_DETAILS = 'patients/prescription-details'; const String LIVECARE_PENDING_LIST = 'livecare-pendinglist'; // const String LIVECARE_END_DIALOG = 'video-call/EndCallDialogBox'; const String PATIENT_SICKLEAVE = 'patients/patient_sickleave'; +const String ADD_SICKLEAVE = 'add-sickleave'; var routes = { ROOT: (_) => RootPage(), HOME: (_) => LandingPage(), @@ -112,5 +114,6 @@ var routes = { // VIDEO_CALL: (_) => VideoCallPage(patientData: null), LIVECARE_PENDING_LIST: (_) => LiveCarePandingListScreen(), // LIVECARE_END_DIALOG: (_) => EndCallDialogBox(), - PATIENT_SICKLEAVE: (_) => SickLeaveScreen() + PATIENT_SICKLEAVE: (_) => SickLeaveScreen(), + ADD_SICKLEAVE: (_) => AddSickLeavScreen() }; diff --git a/lib/screens/dashboard_screen.dart b/lib/screens/dashboard_screen.dart index e9c6341f..ce5776ac 100644 --- a/lib/screens/dashboard_screen.dart +++ b/lib/screens/dashboard_screen.dart @@ -1,5 +1,6 @@ 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: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'; @@ -71,7 +72,7 @@ class _DashboardScreenState extends State { if (!currentFocus.hasPrimaryFocus) { currentFocus.unfocus(); } - return BaseView( + return BaseView( onModelReady: (model) => model.getDashboard(), builder: (_, model, w) => AppScaffold( baseViewModel: model, @@ -285,11 +286,14 @@ class _DashboardScreenState extends State { child: Center( child: Column( children: [ - AppText( - TranslationBase.of(context).arrived, - fontSize: - SizeConfig.textMultiplier * 1.5, - color: HexColor('#5D4C35'), + InkWell( + child: AppText( + TranslationBase.of(context).arrived, + fontSize: + SizeConfig.textMultiplier * 1.5, + color: HexColor('#5D4C35'), + ), + onTap: () {}, ), AppText( "23", diff --git a/lib/screens/sick-leave/add-sickleave.dart b/lib/screens/sick-leave/add-sickleave.dart new file mode 100644 index 00000000..77af8dc4 --- /dev/null +++ b/lib/screens/sick-leave/add-sickleave.dart @@ -0,0 +1,27 @@ +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:flutter/material.dart'; + +class AddSickLeavScreen extends StatelessWidget { + @override + Widget build(BuildContext context) { + return AppScaffold( + appBarTitle: TranslationBase.of(context).sickleave, + body: Center( + child: Column( + children: [ + Container( + padding: EdgeInsets.all(20), + decoration: BoxDecoration( + border: Border.all( + color: Colors.red[500], + ), + borderRadius: BorderRadius.all(Radius.circular(20))), + child: IconButton(icon: Icon(Icons.add), onPressed: null), + ) + ], + ), + ), + ); + } +} diff --git a/lib/screens/sick-leave/sick_leave.dart b/lib/screens/sick-leave/sick_leave.dart index c43bd77f..d4592be1 100644 --- a/lib/screens/sick-leave/sick_leave.dart +++ b/lib/screens/sick-leave/sick_leave.dart @@ -2,10 +2,12 @@ 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/core/viewModel/sick_leave_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/Text.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'; @@ -55,219 +57,236 @@ class _SickLeaveScreenState extends State { 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), + builder: (_, model, w) => BaseView( + onModelReady: (model2) => model2.preSickLeaveStatistics(), + builder: (_, model2, 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).clinicName, + TranslationBase.of(context).doctorName, 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(), - ))), - ), - ], - ) + AppTextFormField( + readOnly: true, + hintText: profile['DoctorName'], + borderColor: Colors.white, + onSaved: (value) {}, + // validator: (value) { + // return TextValidator().validateName(value); + // }, + inputFormatter: ONLY_NUMBERS) ], ), - )), - 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, + ), + 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) + ], ), - 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, + ), + Container( + margin: EdgeInsets.all( + SizeConfig.widthMultiplier * 5), + child: Wrap( + alignment: WrapAlignment.center, + children: [ + AppButton( + title: TranslationBase.of(context).submit, + onPressed: () { + // _validateInputs(); + }, + ), + ], ), - AppTextFormField( - borderColor: Colors.white, - onSaved: (value) {}, - // validator: (value) { - // return TextValidator().validateName(value); - // }, - inputFormatter: ONLY_NUMBERS) - ], - ), + ), + Column( + children: [ + Texts(TranslationBase.of(context) + .previousSickLeaveIssue + + ' ') + ], + ) + ], ), - Container( - margin: - EdgeInsets.all(SizeConfig.widthMultiplier * 5), - child: Wrap( - alignment: WrapAlignment.center, - children: [ - AppButton( - title: TranslationBase.of(context).submit, - onPressed: () { - // _validateInputs(); - }, - ), - ], - ), - ) - ], + ), ), ), - ), - ), - )); + ))); } getProfile() async { @@ -281,7 +300,6 @@ class _SickLeaveScreenState extends State { var clinicInfo = model.clinicsList .where((i) => i['ClinicID'] == this.profile['ClinicID']) .toList(); - print(clinicInfo); - return clinicInfo[0]['ClinicDescription']; + return clinicInfo.length > 0 ? clinicInfo[0]['ClinicDescription'] : ""; } } diff --git a/lib/util/translations_delegate_base.dart b/lib/util/translations_delegate_base.dart index 2386c0d6..b85488cb 100644 --- a/lib/util/translations_delegate_base.dart +++ b/lib/util/translations_delegate_base.dart @@ -292,6 +292,9 @@ class TranslationBase { String get gender2 => localizedValues['gender2'][locale.languageCode]; String get age2 => localizedValues['age2'][locale.languageCode]; String get sickleave => localizedValues['sick-leaves'][locale.languageCode]; + String get patientSick => + localizedValues['patient-sick'][locale.languageCode]; + String get leave => localizedValues['leave'][locale.languageCode]; String get submit => localizedValues['submit'][locale.languageCode]; String get doctorName => localizedValues['doc-name'][locale.languageCode]; String get clinicName => localizedValues['clinicname'][locale.languageCode]; @@ -307,6 +310,8 @@ class TranslationBase { String get area => localizedValues['area'][locale.languageCode]; String get room => localizedValues['room'][locale.languageCode]; String get bed => localizedValues['bed'][locale.languageCode]; + String get previousSickLeaveIssue => + localizedValues['prevoius-sickleave-issed'][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate { diff --git a/lib/widgets/patients/profile/profile_medical_info_widget.dart b/lib/widgets/patients/profile/profile_medical_info_widget.dart index d72d0c5a..9258650f 100644 --- a/lib/widgets/patients/profile/profile_medical_info_widget.dart +++ b/lib/widgets/patients/profile/profile_medical_info_widget.dart @@ -96,9 +96,9 @@ class ProfileMedicalInfoWidget extends StatelessWidget { child: PatientProfileButton( key: key, patient: patient, - route: PATIENT_SICKLEAVE, - nameLine1: TranslationBase.of(context).sickleave, - nameLine2: "", + route: ADD_SICKLEAVE, + nameLine1: TranslationBase.of(context).patientSick, + nameLine2: TranslationBase.of(context).leave, icon: 'sick_leaves_icons.png')), ]); } From 4f96cff5856536ce8b71aaf84fba7b88cb48c014 Mon Sep 17 00:00:00 2001 From: Sultan Khan Date: Thu, 17 Dec 2020 13:20:34 +0300 Subject: [PATCH 06/21] sick leave --- lib/client/base_app_client.dart | 10 +- lib/config/localized_values.dart | 7 + lib/core/service/dasboard_service.dart | 5 +- lib/core/service/sickleave_service.dart | 7 +- lib/lookups/patient_lookup.dart | 1 + lib/screens/sick-leave/add-sickleave.dart | 61 ++- lib/screens/sick-leave/sick_leave.dart | 436 +++++++++++----------- lib/util/translations_delegate_base.dart | 18 +- 8 files changed, 296 insertions(+), 249 deletions(-) diff --git a/lib/client/base_app_client.dart b/lib/client/base_app_client.dart index d831d5ac..94c732a5 100644 --- a/lib/client/base_app_client.dart +++ b/lib/client/base_app_client.dart @@ -42,12 +42,10 @@ class BaseAppClient { String token = await sharedPref.getString(TOKEN); if (profile != null) { DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile); - - // body["VidaAuthTokenID"] = - // "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIyODA0IiwianRpIjoiNzUyODk5MGItZjFhYS00NmUyLWE0MWMtMTIwMjZmMTk5YzJkIiwiZW1haWwiOiJNb2hhbWVkLlJlc3dhbkBjbG91ZHNvbHV0aW9uLXNhLmNvbSIsImlkIjoiMjgwNCIsIk5hbWUiOiJNVUhBTU1BRCBBWkFNIiwiRW1wbG95ZWVJZCI6IjE0ODUiLCJGYWNpbGl0eUdyb3VwSWQiOiIwMTAyNjYiLCJGYWNpbGl0eUlkIjoiMTUiLCJQaGFyYW1jeUZhY2lsaXR5SWQiOiI1NSIsIklTX1BIQVJNQUNZX0NPTk5FQ1RFRCI6IlRydWUiLCJEb2N0b3JJZCI6IjE0ODUiLCJTRVNTSU9OSUQiOiIyMTU3NTk4MiIsIkNsaW5pY0lkIjoiMyIsInJvbGUiOlsiU0VDVVJJVFkgQURNSU5JU1RSQVRPUlMiLCJTRVRVUCBBRE1JTklTVFJBVE9SUyIsIkNFTydTIiwiRVhFQ1VUSVZFIERJUkVDVE9SUyIsIk1BTkFHRVJTIiwiU1VQRVJWSVNPUlMiLCJDTElFTlQgU0VSVklDRVMgQ09PUkRJTkFUT1JTIiwiQ0xJRU5UIFNFUlZJQ0VTIFNVUEVSVklTT1JTIiwiQ0xJRU5UIFNFUlZJQ0VTIE1BTkdFUlMiLCJIRUFEIE5VUlNFUyIsIkRPQ1RPUlMiLCJDSElFRiBPRiBNRURJQ0FMIFNUQUZGUyIsIkJJTy1NRURJQ0FMIFRFQ0hOSUNJQU5TIiwiQklPLU1FRElDQUwgRU5HSU5FRVJTIiwiQklPLU1FRElDQUwgREVQQVJUTUVOVCBIRUFEUyIsIklUIEhFTFAgREVTSyIsIkFETUlOSVNUUkFUT1JTIiwiTEFCIEFETUlOSVNUUkFUT1IiLCJMQUIgVEVDSE5JQ0lBTiIsIkJVU0lORVNTIE9GRklDRSBTVEFGRiIsIkZJTkFOQ0UgQUNDT1VOVEFOVFMiLCJQSEFSTUFDWSBTVEFGRiIsIkFDQ09VTlRTIFNUQUZGIiwiTEFCIFJFQ0VQVElPTklTVCIsIkVSIE5VUlNFIiwiSU5QQVRJRU5UIEJJTExJTkcgU1VQRVJWSVNPUiIsIkxEUi1PUiBOVVJTRVMiLCJBRE1JU1NJT04gU1RBRkYiLCJIRUxQIERFU0sgQURNSU4iLCJBUFBST1ZBTCBTVEFGRiIsIklOUEFUSUVOVCBCSUxMSU5HIENPT1JESU5BVE9SIiwiQklMTElORyBTVEFGRiIsIkNPTlNFTlQgIiwiQ29uc2VudCAtIERlbnRhbCIsIldFQkVNUiJdLCJuYmYiOjE2MDgxMTIyMzYsImV4cCI6MTYwODk3NjIzNiwiaWF0IjoxNjA4MTEyMjM2fQ.Bp84aDpkoZQsZ0cbSPYL9mhqqmvyxydoOirSlnc2Qz8"; - // body["VidaRefreshTokenID"] = - // "I0bL3kx07yjX/msZLKeb48Niug1QxylYtyWp9tkRkYWAKwabgszKF/fJy0DHwZavpZXWCb8fMw4NvRBZbk0MqA=="; - + body["VidaAuthTokenID"] = + "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIyODA0IiwianRpIjoiYzNhYWM3NTEtYjdlNS00NTBmLWI2N2ItMTYyNjA2MTJhOGM3IiwiZW1haWwiOiJNb2hhbWVkLlJlc3dhbkBjbG91ZHNvbHV0aW9uLXNhLmNvbSIsImlkIjoiMjgwNCIsIk5hbWUiOiJNVUhBTU1BRCBBWkFNIiwiRW1wbG95ZWVJZCI6IjE0ODUiLCJGYWNpbGl0eUdyb3VwSWQiOiIwMTAyNjYiLCJGYWNpbGl0eUlkIjoiMTUiLCJQaGFyYW1jeUZhY2lsaXR5SWQiOiI1NSIsIklTX1BIQVJNQUNZX0NPTk5FQ1RFRCI6IlRydWUiLCJEb2N0b3JJZCI6IjE0ODUiLCJTRVNTSU9OSUQiOiIyMTU3NjA3NSIsIkNsaW5pY0lkIjoiMyIsInJvbGUiOlsiU0VDVVJJVFkgQURNSU5JU1RSQVRPUlMiLCJTRVRVUCBBRE1JTklTVFJBVE9SUyIsIkNFTydTIiwiRVhFQ1VUSVZFIERJUkVDVE9SUyIsIk1BTkFHRVJTIiwiU1VQRVJWSVNPUlMiLCJDTElFTlQgU0VSVklDRVMgQ09PUkRJTkFUT1JTIiwiQ0xJRU5UIFNFUlZJQ0VTIFNVUEVSVklTT1JTIiwiQ0xJRU5UIFNFUlZJQ0VTIE1BTkdFUlMiLCJIRUFEIE5VUlNFUyIsIkRPQ1RPUlMiLCJDSElFRiBPRiBNRURJQ0FMIFNUQUZGUyIsIkJJTy1NRURJQ0FMIFRFQ0hOSUNJQU5TIiwiQklPLU1FRElDQUwgRU5HSU5FRVJTIiwiQklPLU1FRElDQUwgREVQQVJUTUVOVCBIRUFEUyIsIklUIEhFTFAgREVTSyIsIkFETUlOSVNUUkFUT1JTIiwiTEFCIEFETUlOSVNUUkFUT1IiLCJMQUIgVEVDSE5JQ0lBTiIsIkJVU0lORVNTIE9GRklDRSBTVEFGRiIsIkZJTkFOQ0UgQUNDT1VOVEFOVFMiLCJQSEFSTUFDWSBTVEFGRiIsIkFDQ09VTlRTIFNUQUZGIiwiTEFCIFJFQ0VQVElPTklTVCIsIkVSIE5VUlNFIiwiSU5QQVRJRU5UIEJJTExJTkcgU1VQRVJWSVNPUiIsIkxEUi1PUiBOVVJTRVMiLCJBRE1JU1NJT04gU1RBRkYiLCJIRUxQIERFU0sgQURNSU4iLCJBUFBST1ZBTCBTVEFGRiIsIklOUEFUSUVOVCBCSUxMSU5HIENPT1JESU5BVE9SIiwiQklMTElORyBTVEFGRiIsIkNPTlNFTlQgIiwiQ29uc2VudCAtIERlbnRhbCIsIldFQkVNUiJdLCJuYmYiOjE2MDgxMzY3ODMsImV4cCI6MTYwOTAwMDc4MywiaWF0IjoxNjA4MTM2NzgzfQ.8cb7axSSZUwbdzQ9AdTDaahtyhoVvAiDCXIGz4F-FuQ"; + body["VidaRefreshTokenID"] = + "hapR/0V/AljCVq/j49o4T7Bnee7hN295Xks54jo3ATEKZMqa8k9pXmbwDGycnz0Do6jk1W7YWFl6oy6aKfIjDA=="; body['DoctorID'] = doctorProfile?.doctorID; body['EditedBy'] = doctorProfile?.doctorID; body['ProjectID'] = doctorProfile?.projectID; diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index a19ef3f0..dddccfa2 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -288,4 +288,11 @@ const Map> localizedValues = { }, 'clinicSelect': {'en': "Select Clinic", 'ar': 'اختار عيادة'}, 'doctorSelect': {'en': "Select Doctor", 'ar': 'اختار طبيب'}, + 'no-sickleve-applied': { + 'en': "No sick leave applied", + 'ar': 'لم تطبق إجازة مرضية' + }, + 'applynow': {'en': "Apply Now", 'ar': 'قدم الآن'}, + 'add-sickleave': {'en': "ADD SICK LEAVE", 'ar': 'أضف إجازة مرضية'}, + 'add': {'en': "Add", 'ar': 'أضف'}, }; diff --git a/lib/core/service/dasboard_service.dart b/lib/core/service/dasboard_service.dart index cabcbf7c..8ad8aa4f 100644 --- a/lib/core/service/dasboard_service.dart +++ b/lib/core/service/dasboard_service.dart @@ -9,6 +9,7 @@ class DashboardService extends BaseService { // DashboardModel _dashboard = DashboardModel(); Future getDashboard() async { + return Future.value(null); await baseAppClient.post( GET_DASHBOARD, onSuccess: (dynamic response, int statusCode) { @@ -20,8 +21,8 @@ class DashboardService extends BaseService { super.error = error; }, body: { - "VidaAuthTokenID": - "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIyODA0IiwianRpIjoiZDYxZmM5MTQtZWFhYy00YjQ4LTgyMmEtMmE3OTNlZDMzZGYwIiwiZW1haWwiOiJNb2hhbWVkLlJlc3dhbkBjbG91ZHNvbHV0aW9uLXNhLmNvbSIsImlkIjoiMjgwNCIsIk5hbWUiOiJNVUhBTU1BRCBBWkFNIiwiRW1wbG95ZWVJZCI6IjE0ODUiLCJGYWNpbGl0eUdyb3VwSWQiOiIwMTAyNjYiLCJGYWNpbGl0eUlkIjoiMTUiLCJQaGFyYW1jeUZhY2lsaXR5SWQiOiI1NSIsIklTX1BIQVJNQUNZX0NPTk5FQ1RFRCI6IlRydWUiLCJEb2N0b3JJZCI6IjE0ODUiLCJTRVNTSU9OSUQiOiIyMTU3NTgwOCIsIkNsaW5pY0lkIjoiMyIsInJvbGUiOlsiU0VDVVJJVFkgQURNSU5JU1RSQVRPUlMiLCJTRVRVUCBBRE1JTklTVFJBVE9SUyIsIkNFTydTIiwiRVhFQ1VUSVZFIERJUkVDVE9SUyIsIk1BTkFHRVJTIiwiU1VQRVJWSVNPUlMiLCJDTElFTlQgU0VSVklDRVMgQ09PUkRJTkFUT1JTIiwiQ0xJRU5UIFNFUlZJQ0VTIFNVUEVSVklTT1JTIiwiQ0xJRU5UIFNFUlZJQ0VTIE1BTkdFUlMiLCJIRUFEIE5VUlNFUyIsIkRPQ1RPUlMiLCJDSElFRiBPRiBNRURJQ0FMIFNUQUZGUyIsIkJJTy1NRURJQ0FMIFRFQ0hOSUNJQU5TIiwiQklPLU1FRElDQUwgRU5HSU5FRVJTIiwiQklPLU1FRElDQUwgREVQQVJUTUVOVCBIRUFEUyIsIklUIEhFTFAgREVTSyIsIkFETUlOSVNUUkFUT1JTIiwiTEFCIEFETUlOSVNUUkFUT1IiLCJMQUIgVEVDSE5JQ0lBTiIsIkJVU0lORVNTIE9GRklDRSBTVEFGRiIsIkZJTkFOQ0UgQUNDT1VOVEFOVFMiLCJQSEFSTUFDWSBTVEFGRiIsIkFDQ09VTlRTIFNUQUZGIiwiTEFCIFJFQ0VQVElPTklTVCIsIkVSIE5VUlNFIiwiSU5QQVRJRU5UIEJJTExJTkcgU1VQRVJWSVNPUiIsIkxEUi1PUiBOVVJTRVMiLCJBRE1JU1NJT04gU1RBRkYiLCJIRUxQIERFU0sgQURNSU4iLCJBUFBST1ZBTCBTVEFGRiIsIklOUEFUSUVOVCBCSUxMSU5HIENPT1JESU5BVE9SIiwiQklMTElORyBTVEFGRiIsIkNPTlNFTlQgIiwiQ29uc2VudCAtIERlbnRhbCIsIldFQkVNUiJdLCJuYmYiOjE2MDgwMjg0NzQsImV4cCI6MTYwODg5MjQ3NCwiaWF0IjoxNjA4MDI4NDc0fQ.8OJcy6vUuPnNTi_qSjip8YCrFdaRLtJKbNKXcMtnQxk" + // "VidaAuthTokenID": + // "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIyODA0IiwianRpIjoiZDYxZmM5MTQtZWFhYy00YjQ4LTgyMmEtMmE3OTNlZDMzZGYwIiwiZW1haWwiOiJNb2hhbWVkLlJlc3dhbkBjbG91ZHNvbHV0aW9uLXNhLmNvbSIsImlkIjoiMjgwNCIsIk5hbWUiOiJNVUhBTU1BRCBBWkFNIiwiRW1wbG95ZWVJZCI6IjE0ODUiLCJGYWNpbGl0eUdyb3VwSWQiOiIwMTAyNjYiLCJGYWNpbGl0eUlkIjoiMTUiLCJQaGFyYW1jeUZhY2lsaXR5SWQiOiI1NSIsIklTX1BIQVJNQUNZX0NPTk5FQ1RFRCI6IlRydWUiLCJEb2N0b3JJZCI6IjE0ODUiLCJTRVNTSU9OSUQiOiIyMTU3NTgwOCIsIkNsaW5pY0lkIjoiMyIsInJvbGUiOlsiU0VDVVJJVFkgQURNSU5JU1RSQVRPUlMiLCJTRVRVUCBBRE1JTklTVFJBVE9SUyIsIkNFTydTIiwiRVhFQ1VUSVZFIERJUkVDVE9SUyIsIk1BTkFHRVJTIiwiU1VQRVJWSVNPUlMiLCJDTElFTlQgU0VSVklDRVMgQ09PUkRJTkFUT1JTIiwiQ0xJRU5UIFNFUlZJQ0VTIFNVUEVSVklTT1JTIiwiQ0xJRU5UIFNFUlZJQ0VTIE1BTkdFUlMiLCJIRUFEIE5VUlNFUyIsIkRPQ1RPUlMiLCJDSElFRiBPRiBNRURJQ0FMIFNUQUZGUyIsIkJJTy1NRURJQ0FMIFRFQ0hOSUNJQU5TIiwiQklPLU1FRElDQUwgRU5HSU5FRVJTIiwiQklPLU1FRElDQUwgREVQQVJUTUVOVCBIRUFEUyIsIklUIEhFTFAgREVTSyIsIkFETUlOSVNUUkFUT1JTIiwiTEFCIEFETUlOSVNUUkFUT1IiLCJMQUIgVEVDSE5JQ0lBTiIsIkJVU0lORVNTIE9GRklDRSBTVEFGRiIsIkZJTkFOQ0UgQUNDT1VOVEFOVFMiLCJQSEFSTUFDWSBTVEFGRiIsIkFDQ09VTlRTIFNUQUZGIiwiTEFCIFJFQ0VQVElPTklTVCIsIkVSIE5VUlNFIiwiSU5QQVRJRU5UIEJJTExJTkcgU1VQRVJWSVNPUiIsIkxEUi1PUiBOVVJTRVMiLCJBRE1JU1NJT04gU1RBRkYiLCJIRUxQIERFU0sgQURNSU4iLCJBUFBST1ZBTCBTVEFGRiIsIklOUEFUSUVOVCBCSUxMSU5HIENPT1JESU5BVE9SIiwiQklMTElORyBTVEFGRiIsIkNPTlNFTlQgIiwiQ29uc2VudCAtIERlbnRhbCIsIldFQkVNUiJdLCJuYmYiOjE2MDgwMjg0NzQsImV4cCI6MTYwODg5MjQ3NCwiaWF0IjoxNjA4MDI4NDc0fQ.8OJcy6vUuPnNTi_qSjip8YCrFdaRLtJKbNKXcMtnQxk" }, ); } diff --git a/lib/core/service/sickleave_service.dart b/lib/core/service/sickleave_service.dart index 9f47c38c..7e9de230 100644 --- a/lib/core/service/sickleave_service.dart +++ b/lib/core/service/sickleave_service.dart @@ -3,14 +3,15 @@ import 'package:doctor_app_flutter/core/service/base/base_service.dart'; // import 'package:doctor_app_flutter/models/dashboard/dashboard_model.dart'; class SickLeaveService extends BaseService { - var _statistics = {}; - get sickLeavestatisitics => _statistics; - + Map get sickLeavestatisitics => _statistics; + Map _statistics = {}; Future getStatistics() async { + hasError = false; await baseAppClient.post( GET_SICKLEAVE_STATISTIC, onSuccess: (dynamic response, int statusCode) { print(response); + _statistics = {}; _statistics = response['SickLeaveStatistics']; }, onFailure: (String error, int statusCode) { diff --git a/lib/lookups/patient_lookup.dart b/lib/lookups/patient_lookup.dart index 189535ce..d8db7945 100644 --- a/lib/lookups/patient_lookup.dart +++ b/lib/lookups/patient_lookup.dart @@ -10,6 +10,7 @@ const PATIENT_TYPE = const [ }, {"text": "Tomorrow Patient", "text_ar": "مريض الغد", "val": "5"}, {"text": "Referral", "text_ar": "المريض المحول مني", "val": "6"}, + {"text": "Arrived", "text_ar": "وصل", "val": "7"}, ]; const LOCATIONS = const [ diff --git a/lib/screens/sick-leave/add-sickleave.dart b/lib/screens/sick-leave/add-sickleave.dart index 77af8dc4..57960ec2 100644 --- a/lib/screens/sick-leave/add-sickleave.dart +++ b/lib/screens/sick-leave/add-sickleave.dart @@ -1,27 +1,58 @@ +import 'package:doctor_app_flutter/screens/sick-leave/sick_leave.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.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:flutter/material.dart'; +import 'package:hexcolor/hexcolor.dart'; class AddSickLeavScreen extends StatelessWidget { @override Widget build(BuildContext context) { return AppScaffold( appBarTitle: TranslationBase.of(context).sickleave, - body: Center( - child: Column( - children: [ - Container( - padding: EdgeInsets.all(20), - decoration: BoxDecoration( - border: Border.all( - color: Colors.red[500], - ), - borderRadius: BorderRadius.all(Radius.circular(20))), - child: IconButton(icon: Icon(Icons.add), onPressed: null), - ) - ], - ), - ), + body: new Builder(builder: (context) { + return Center( + 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); + }), + ), + 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'), + ) + ], + ), + ); + }), ); } + + openSickLeave(BuildContext context) { + showModalBottomSheet( + context: context, + builder: (context) { + return new Container(child: SickLeaveScreen()); + }); + } } diff --git a/lib/screens/sick-leave/sick_leave.dart b/lib/screens/sick-leave/sick_leave.dart index d4592be1..1eac90c3 100644 --- a/lib/screens/sick-leave/sick_leave.dart +++ b/lib/screens/sick-leave/sick_leave.dart @@ -58,235 +58,233 @@ class _SickLeaveScreenState extends State { return BaseView( onModelReady: (model) => model.getClinicsList(), builder: (_, model, w) => BaseView( - onModelReady: (model2) => model2.preSickLeaveStatistics(), - builder: (_, model2, 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, + onModelReady: (model2) => model2.preSickLeaveStatistics(), + builder: (_, model2, w) => Center( + child: Container( + margin: EdgeInsets.only(top: 10), + child: FractionallySizedBox( + widthFactor: 0.9, + child: ListView( + children: [ + Padding( + child: AppText( + TranslationBase.of(context).addSickLeave, + fontWeight: FontWeight.bold, ), - 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), + 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"))), + padding: EdgeInsets.all(5), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppTextFormField( + borderColor: Colors.white, + onSaved: (value) {}, + hintText: TranslationBase.of(context) + .sickLeaveDays, + // 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( + hintText: TranslationBase.of(context) + .sickLeaveDate, + borderColor: Colors.white, + prefix: IconButton( + icon: Icon(Icons.calendar_today)), + textInputType: TextInputType.number, + controller: _toDateController, + onTap: () { + _presentDatePicker('_selectedToDate'); + }, + inputFormatter: ONLY_DATE, + onSaved: (value) {}), + ], + )), + Container( + margin: EdgeInsets.all(10), + 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: [ - AppText( - TranslationBase.of(context).remarks, - fontSize: 10, - ), - AppTextFormField( - borderColor: Colors.white, - onSaved: (value) {}, - // validator: (value) { - // return TextValidator().validateName(value); - // }, - inputFormatter: ONLY_NUMBERS) + // 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.all( - SizeConfig.widthMultiplier * 5), - child: Wrap( - alignment: WrapAlignment.center, - children: [ - AppButton( - title: TranslationBase.of(context).submit, - onPressed: () { - // _validateInputs(); - }, - ), - ], + )), + 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, + hintText: TranslationBase.of(context).remarks, + 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).add, + onPressed: () { + // _validateInputs(); + }, ), - ), - Column( - children: [ - Texts(TranslationBase.of(context) - .previousSickLeaveIssue + - ' ') - ], - ) - ], + ], + ), ), - ), + Column( + children: [ + Texts(TranslationBase.of(context) + .previousSickLeaveIssue + + ' ') + ], + ) + ], ), ), - ))); + ), + ), + )); } getProfile() async { diff --git a/lib/util/translations_delegate_base.dart b/lib/util/translations_delegate_base.dart index a8c1ae2a..5290e933 100644 --- a/lib/util/translations_delegate_base.dart +++ b/lib/util/translations_delegate_base.dart @@ -108,8 +108,10 @@ class TranslationBase { String get profile => localizedValues['profile'][locale.languageCode]; String get gender => localizedValues['gender'][locale.languageCode]; String get clinic => localizedValues['clinic'][locale.languageCode]; - String get clinicSelect => localizedValues['clinicSelect'][locale.languageCode]; - String get doctorSelect => localizedValues['doctorSelect'][locale.languageCode]; + String get clinicSelect => + localizedValues['clinicSelect'][locale.languageCode]; + String get doctorSelect => + localizedValues['doctorSelect'][locale.languageCode]; String get hospital => localizedValues['hospital'][locale.languageCode]; String get speciality => localizedValues['speciality'][locale.languageCode]; String get errorMessage => @@ -227,8 +229,10 @@ class TranslationBase { String get urgent => localizedValues['urgent'][locale.languageCode]; String get routine => localizedValues['routine'][locale.languageCode]; String get send => localizedValues['send'][locale.languageCode]; - String get referralFrequency => localizedValues['referralFrequency'][locale.languageCode]; - String get selectReferralFrequency => localizedValues['selectReferralFrequency'][locale.languageCode]; + String get referralFrequency => + localizedValues['referralFrequency'][locale.languageCode]; + String get selectReferralFrequency => + localizedValues['selectReferralFrequency'][locale.languageCode]; String get clinicalDetailsAndRemarks => localizedValues['clinicalDetailsAndRemarks'][locale.languageCode]; String get remarks => localizedValues['remarks'][locale.languageCode]; @@ -316,6 +320,12 @@ class TranslationBase { String get bed => localizedValues['bed'][locale.languageCode]; String get previousSickLeaveIssue => localizedValues['prevoius-sickleave-issed'][locale.languageCode]; + String get noSickLeaveApplied => + localizedValues['no-sickleve-applied'][locale.languageCode]; + String get applyNow => localizedValues['applynow'][locale.languageCode]; + String get addSickLeave => + localizedValues['add-sickleave'][locale.languageCode]; + String get add => localizedValues['add'][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate { From e61f3f0281488f94db81bb843281441b49147ae3 Mon Sep 17 00:00:00 2001 From: Sultan Khan Date: Sun, 20 Dec 2020 08:25:02 +0300 Subject: [PATCH 07/21] add sick leave --- lib/client/base_app_client.dart | 2 +- lib/config/config.dart | 4 +- lib/config/localized_values.dart | 12 +- lib/core/service/sickleave_service.dart | 71 ++- lib/core/viewModel/sick_leave_view_model.dart | 41 +- .../sickleave/add_sickleave_request.dart | 32 ++ .../sickleave/extend_sick_leave_request.dart | 25 + .../sickleave/get_all_sickleave_response.dart | 44 ++ lib/screens/sick-leave/add-sickleave.dart | 204 +++++-- lib/screens/sick-leave/sick_leave.dart | 501 ++++++++++-------- lib/util/translations_delegate_base.dart | 10 + 11 files changed, 678 insertions(+), 268 deletions(-) create mode 100644 lib/models/sickleave/add_sickleave_request.dart create mode 100644 lib/models/sickleave/extend_sick_leave_request.dart create mode 100644 lib/models/sickleave/get_all_sickleave_response.dart diff --git a/lib/client/base_app_client.dart b/lib/client/base_app_client.dart index 94c732a5..c0a6b357 100644 --- a/lib/client/base_app_client.dart +++ b/lib/client/base_app_client.dart @@ -85,7 +85,7 @@ class BaseAppClient { if (!parsed['IsAuthenticated']) { //need to uncomment // await helpers.logout(); - + onSuccess(parsed, statusCode); helpers.showErrorToast('Your session expired Please login agian'); } else if (parsed['MessageStatus'] == 1) { onSuccess(parsed, statusCode); diff --git a/lib/config/config.dart b/lib/config/config.dart index 17e23187..39dfb023 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -83,7 +83,9 @@ const GET_SICKLEAVE_STATISTIC = 'Services/DoctorApplication.svc/REST/PreSickLeaveStatistics'; const ARRIVED_PATIENT_URL = 'Services/DoctorApplication.svc/REST/PatientArrivalList​'; - +const ADD_SICK_LEAVE = 'Services/DoctorApplication.svc/REST/PostSickLeave'; +const GET_SICK_LEAVE = 'Services/DoctorApplication.svc/REST/GetAllSickLeaves'; +const EXTEND_SICK_LEAVE = 'Services/DoctorApplication.svc/REST/ExtendSickLeave'; var selectedPatientType = 1; //*********change value to decode json from Dropdown ************ diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index dddccfa2..0abdad83 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -266,7 +266,7 @@ const Map> localizedValues = { }, 'gender2': {'en': 'Gender: ', 'ar': 'الجنس: '}, 'age2': {'en': 'Age: ', 'ar': 'العمر: '}, - "sick-leaves": {"en": "Patient Sick", "ar": "الاجازات المرضية"}, + "sick-leaves": {"en": "Patient Sick Leave", "ar": "الاجازات المرضية"}, "patient-sick": {"en": "Patient Sick", "ar": "المرضية"}, "leave": {"en": "Leave", "ar": "غادر"}, "submit": {"en": "Submit", "ar": "ارسال"}, @@ -295,4 +295,14 @@ const Map> localizedValues = { 'applynow': {'en': "Apply Now", 'ar': 'قدم الآن'}, 'add-sickleave': {'en': "ADD SICK LEAVE", 'ar': 'أضف إجازة مرضية'}, 'add': {'en': "Add", 'ar': 'أضف'}, + 'approved': {'en': "Approved", 'ar': 'وافق'}, + 'extended': {'en': "Extended", 'ar': 'وسعوا'}, + 'pending': {'en': "Pending", 'ar': 'قيد الانتظار'}, + 'leave-start-date': {'en': "Leave start date", 'ar': 'تاريخ بدء المغادرة'}, + 'days-sick-leave': {'en': "DAYS OF SICK LEAVE", 'ar': 'أيام الإجازة المرضية'}, + 'extend': {'en': "Extend", 'ar': 'تمديد'}, + 'extend-sickleave': { + 'en': "EXTEND SICK LEAVE", + 'ar': 'قم بتمديد الإجازة المرضية' + }, }; diff --git a/lib/core/service/sickleave_service.dart b/lib/core/service/sickleave_service.dart index 7e9de230..1c5ee415 100644 --- a/lib/core/service/sickleave_service.dart +++ b/lib/core/service/sickleave_service.dart @@ -1,10 +1,16 @@ 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/sickleave/add_sickleave_request.dart'; +import 'package:doctor_app_flutter/models/sickleave/extend_sick_leave_request.dart'; +import 'package:doctor_app_flutter/models/sickleave/get_all_sickleave_response.dart'; // import 'package:doctor_app_flutter/models/dashboard/dashboard_model.dart'; class SickLeaveService extends BaseService { Map get sickLeavestatisitics => _statistics; Map _statistics = {}; + + List get getAllSickLeave => _getAllsickLeave; + List _getAllsickLeave = []; Future getStatistics() async { hasError = false; await baseAppClient.post( @@ -18,7 +24,70 @@ class SickLeaveService extends BaseService { hasError = true; super.error = error; }, - body: {"PatientMRN": 3120737, "AppointmentNo": 2016055008}, + body: {"PatientMRN": 3120746, "AppointmentNo": 2016054661}, + ); + } + + Future addSickLeave(AddSickLeaveRequest addSickLeaveRequest) async { + addSickLeaveRequest.appointmentNo = '2016054661'; + addSickLeaveRequest.patientMRN = '3120746'; + hasError = false; + await baseAppClient.post( + ADD_SICK_LEAVE, + onSuccess: (dynamic response, int statusCode) { + Future.value(response); + print(response); + // _statistics = {}; + // _statistics = response['SickLeaveStatistics']; + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + body: addSickLeaveRequest.toJson(), + ); + } + + Future extendSickLeave(GetAllSickLeaveResponse request) async { + var extendSickLeaveRequest = ExtendSickLeaveRequest(); + extendSickLeaveRequest.patientMRN = + request.patientMRN.toString(); //'3120746'; + extendSickLeaveRequest.previousRequestNo = request.requestNo.toString(); + extendSickLeaveRequest.noOfDays = request.noOfDays.toString(); + extendSickLeaveRequest.remarks = request.remarks; + hasError = false; + await baseAppClient.post( + EXTEND_SICK_LEAVE, + onSuccess: (dynamic response, int statusCode) { + Future.value(response); + print(response); + // _statistics = {}; + // _statistics = response['SickLeaveStatistics']; + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + body: extendSickLeaveRequest.toJson(), + ); + } + + Future getSickLeave() async { + hasError = false; + await baseAppClient.post( + GET_SICK_LEAVE, + onSuccess: (dynamic response, int statusCode) { + Future.value(response); + _getAllsickLeave.clear(); + response['SickLeavesList']['entityList'].forEach((v) { + _getAllsickLeave.add(GetAllSickLeaveResponse.fromJson(v)); + }); + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + body: {'PatientMRN': 3120772}, ); } } diff --git a/lib/core/viewModel/sick_leave_view_model.dart b/lib/core/viewModel/sick_leave_view_model.dart index eecee46d..7eac919f 100644 --- a/lib/core/viewModel/sick_leave_view_model.dart +++ b/lib/core/viewModel/sick_leave_view_model.dart @@ -1,6 +1,9 @@ import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/service/sickleave_service.dart'; import 'package:doctor_app_flutter/core/service/medicine_service.dart'; +import 'package:doctor_app_flutter/models/sickleave/add_sickleave_request.dart'; +import 'package:doctor_app_flutter/models/sickleave/extend_sick_leave_request.dart'; +import 'package:doctor_app_flutter/models/sickleave/get_all_sickleave_response.dart'; import '../../locator.dart'; import 'base_view_model.dart'; @@ -8,16 +11,26 @@ import 'base_view_model.dart'; class SickLeaveViewModel extends BaseViewModel { SickLeaveService _sickLeaveService = locator(); get sickLeaveStatistics => _sickLeaveService.sickLeavestatisitics; + get getAllSIckLeave => _sickLeaveService.getAllSickLeave; + Future addSickLeave(AddSickLeaveRequest addSickLeaveRequest) async { + setState(ViewState.Busy); + await _sickLeaveService.addSickLeave(addSickLeaveRequest); + if (_sickLeaveService.hasError) { + error = _sickLeaveService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } - // Future getDashboard() async { - // setState(ViewState.Busy); - // await _dashboardService.getDashboard(); - // if (_dashboardService.hasError) { - // error = _dashboardService.error; - // setState(ViewState.Error); - // } else - // setState(ViewState.Idle); - // } + Future extendSickLeave(GetAllSickLeaveResponse extendSickLeaveRequest) async { + setState(ViewState.Busy); + await _sickLeaveService.extendSickLeave(extendSickLeaveRequest); + if (_sickLeaveService.hasError) { + error = _sickLeaveService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } Future preSickLeaveStatistics() async { setState(ViewState.Busy); @@ -28,4 +41,14 @@ class SickLeaveViewModel extends BaseViewModel { } else setState(ViewState.Idle); } + + Future getSickLeave() async { + setState(ViewState.Busy); + await _sickLeaveService.getSickLeave(); + if (_sickLeaveService.hasError) { + error = _sickLeaveService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } } diff --git a/lib/models/sickleave/add_sickleave_request.dart b/lib/models/sickleave/add_sickleave_request.dart new file mode 100644 index 00000000..d398153b --- /dev/null +++ b/lib/models/sickleave/add_sickleave_request.dart @@ -0,0 +1,32 @@ +class AddSickLeaveRequest { + String patientMRN; + String appointmentNo; + String startDate; + String noOfDays; + String remarks; + + AddSickLeaveRequest( + {this.patientMRN, + this.appointmentNo, + this.startDate, + this.noOfDays, + this.remarks}); + + AddSickLeaveRequest.fromJson(Map json) { + patientMRN = json['PatientMRN']; + appointmentNo = json['AppointmentNo']; + startDate = json['StartDate']; + noOfDays = json['NoOfDays']; + remarks = json['Remarks']; + } + + Map toJson() { + final Map data = new Map(); + data['PatientMRN'] = this.patientMRN; + data['AppointmentNo'] = this.appointmentNo; + data['StartDate'] = this.startDate; + data['NoOfDays'] = this.noOfDays; + data['Remarks'] = this.remarks; + return data; + } +} diff --git a/lib/models/sickleave/extend_sick_leave_request.dart b/lib/models/sickleave/extend_sick_leave_request.dart new file mode 100644 index 00000000..8b61eb90 --- /dev/null +++ b/lib/models/sickleave/extend_sick_leave_request.dart @@ -0,0 +1,25 @@ +class ExtendSickLeaveRequest { + String patientMRN; + String previousRequestNo; + String noOfDays; + String remarks; + + ExtendSickLeaveRequest( + {this.patientMRN, this.previousRequestNo, this.noOfDays, this.remarks}); + + ExtendSickLeaveRequest.fromJson(Map json) { + patientMRN = json['PatientMRN']; + previousRequestNo = json['PreviousRequestNo']; + noOfDays = json['NoOfDays']; + remarks = json['Remarks']; + } + + Map toJson() { + final Map data = new Map(); + data['PatientMRN'] = this.patientMRN; + data['PreviousRequestNo'] = this.previousRequestNo; + data['NoOfDays'] = this.noOfDays; + data['Remarks'] = this.remarks; + return data; + } +} diff --git a/lib/models/sickleave/get_all_sickleave_response.dart b/lib/models/sickleave/get_all_sickleave_response.dart new file mode 100644 index 00000000..f3fc8032 --- /dev/null +++ b/lib/models/sickleave/get_all_sickleave_response.dart @@ -0,0 +1,44 @@ +class GetAllSickLeaveResponse { + int appointmentNo; + bool isExtendedLeave; + int noOfDays; + int patientMRN; + String remarks; + int requestNo; + String startDate; + int status; + + GetAllSickLeaveResponse( + {this.appointmentNo, + this.isExtendedLeave, + this.noOfDays, + this.patientMRN, + this.remarks, + this.requestNo, + this.startDate, + this.status}); + + GetAllSickLeaveResponse.fromJson(Map json) { + appointmentNo = json['appointmentNo']; + isExtendedLeave = json['isExtendedLeave']; + noOfDays = json['noOfDays']; + patientMRN = json['patientMRN']; + remarks = json['remarks']; + requestNo = json['requestNo']; + startDate = json['startDate']; + status = json['status']; + } + + Map toJson() { + final Map data = new Map(); + data['appointmentNo'] = this.appointmentNo; + data['isExtendedLeave'] = this.isExtendedLeave; + data['noOfDays'] = this.noOfDays; + data['patientMRN'] = this.patientMRN; + data['remarks'] = this.remarks; + data['requestNo'] = this.requestNo; + data['startDate'] = this.startDate; + data['status'] = this.status; + return data; + } +} diff --git a/lib/screens/sick-leave/add-sickleave.dart b/lib/screens/sick-leave/add-sickleave.dart index 57960ec2..697b9127 100644 --- a/lib/screens/sick-leave/add-sickleave.dart +++ b/lib/screens/sick-leave/add-sickleave.dart @@ -1,58 +1,184 @@ +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/core/viewModel/sick_leave_view_model.dart'; +import 'package:doctor_app_flutter/icons_app/doctor_app_icons.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/translations_delegate_base.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:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; class AddSickLeavScreen extends StatelessWidget { @override Widget build(BuildContext context) { - return AppScaffold( - appBarTitle: TranslationBase.of(context).sickleave, - body: new Builder(builder: (context) { - return Center( - 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); + return BaseView( + onModelReady: (model) => model.getSickLeave(), + builder: (_, model, w) => AppScaffold( + baseViewModel: model, + appBarTitle: TranslationBase.of(context).sickleave, + body: model.getAllSIckLeave.length > 0 + ? SingleChildScrollView( + child: Column( + children: model.getAllSIckLeave + .map((GetAllSickLeaveResponse item) { + return CardWithBgWidgetNew( + widget: Column( + children: [ + Container( + padding: EdgeInsets.only(left: 10, right: 10), + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Expanded( + flex: 4, + child: Row( + mainAxisAlignment: + MainAxisAlignment.start, + children: [ + Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Container( + padding: EdgeInsets.all(3), + child: AppText( + item.status == 1 + ? TranslationBase.of( + context) + .approved + : item.status == 2 + ? TranslationBase + .of(context) + .extended + : TranslationBase + .of(context) + .pending, + fontWeight: FontWeight.bold, + color: Colors.white, + ), + color: item.status == 1 + ? Colors.green + : Colors.yellow[800], + ), + Row( + children: [ + AppText( + TranslationBase.of( + context) + .leaveStartDate, + fontWeight: + FontWeight.bold, + ), + AppText(item.startDate) + ], + ), + AppText( + item.noOfDays.toString() + + ' ' + + TranslationBase.of( + context) + .daysSickleave, + fontWeight: FontWeight.bold, + ), + Row(children: [ + AppText( + item.remarks, + ) + ]), + ], + ), + SizedBox( + width: 20, + ), + ], + ), + ), + (item.status == 1 || item.status == 2) + ? Expanded( + flex: 1, + child: IconButton( + icon: Icon( + Icons.open_in_full, + size: 40, + ), + // color: Colors.green, //Colors.black, + onPressed: () => { + openSickLeave(context, true, + extendedData: item) + }, + )) + : SizedBox(), + ], + )), + SizedBox( + height: 20, + ), + Divider( + height: 1, + ), + ], + )); + }).toList(), + ), + ) + : new Builder(builder: (context) { + return 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: () { + 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'), + ) + ], + ), + )); }), - ), - 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'), - ) - ], - ), - ); - }), - ); + )); } - openSickLeave(BuildContext context) { + openSickLeave(BuildContext context, isExtend, + {GetAllSickLeaveResponse extendedData}) { showModalBottomSheet( context: context, builder: (context) { - return new Container(child: SickLeaveScreen()); + return new Container( + child: SickLeaveScreen( + isExtended: isExtend, + extendedData: extendedData, + )); }); } } diff --git a/lib/screens/sick-leave/sick_leave.dart b/lib/screens/sick-leave/sick_leave.dart index 1eac90c3..7091a54f 100644 --- a/lib/screens/sick-leave/sick_leave.dart +++ b/lib/screens/sick-leave/sick_leave.dart @@ -3,9 +3,11 @@ 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/core/viewModel/sick_leave_view_model.dart'; +import 'package:doctor_app_flutter/models/sickleave/add_sickleave_request.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/text_validator.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/Text.dart'; import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; @@ -17,10 +19,14 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; import 'package:intl/intl.dart'; +import 'package:doctor_app_flutter/models/sickleave/get_all_sickleave_response.dart'; Helpers helpers = Helpers(); class SickLeaveScreen extends StatefulWidget { + final bool isExtended; + final GetAllSickLeaveResponse extendedData; + SickLeaveScreen({this.isExtended = false, this.extendedData}); @override _SickLeaveScreenState createState() => _SickLeaveScreenState(); } @@ -30,6 +36,7 @@ class _SickLeaveScreenState extends State { TextEditingController _toDateController = new TextEditingController(); String _selectedClinic; Map profile = {}; + AddSickLeaveRequest addSickLeave = AddSickLeaveRequest(); void _presentDatePicker(id) { showDatePicker( context: context, @@ -41,8 +48,12 @@ class _SickLeaveScreenState extends State { return; } setState(() { - var selectedDate = DateFormat.yMd().format(pickedDate); - _toDateController.text = selectedDate; + // var selectedDate = DateFormat.yMd().format(pickedDate); + final df = new DateFormat('yyyy-MM-dd'); + addSickLeave.startDate = df.format(pickedDate); + + _toDateController.text = addSickLeave.startDate; + //addSickLeave.startDate = selectedDate; }); }); } @@ -58,233 +69,291 @@ class _SickLeaveScreenState extends State { return BaseView( onModelReady: (model) => model.getClinicsList(), builder: (_, model, w) => BaseView( - onModelReady: (model2) => model2.preSickLeaveStatistics(), - builder: (_, model2, w) => Center( - child: Container( - margin: EdgeInsets.only(top: 10), - child: FractionallySizedBox( - widthFactor: 0.9, - child: ListView( - children: [ - Padding( - child: AppText( - TranslationBase.of(context).addSickLeave, - fontWeight: FontWeight.bold, + onModelReady: (model2) => model2.preSickLeaveStatistics(), + builder: (_, model2, w) => AppScaffold( + baseViewModel: model2, + isShowAppBar: false, + body: Center( + child: Container( + margin: EdgeInsets.only(top: 10), + child: FractionallySizedBox( + 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)), + 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: [ + AppTextFormField( + borderColor: Colors.white, + onChanged: (value) { + addSickLeave.noOfDays = value; + }, + hintText: widget.extendedData != null + ? widget.extendedData.noOfDays + .toString() + : TranslationBase.of(context) + .sickLeaveDays, + // validator: (value) { + // return TextValidator().validateName(value); + // }, + inputFormatter: ONLY_NUMBERS) + ]), ), - 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"))), - padding: EdgeInsets.all(5), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppTextFormField( - borderColor: Colors.white, - onSaved: (value) {}, - hintText: TranslationBase.of(context) - .sickLeaveDays, - // 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( - hintText: TranslationBase.of(context) - .sickLeaveDate, - borderColor: Colors.white, - prefix: IconButton( - icon: Icon(Icons.calendar_today)), - textInputType: TextInputType.number, - controller: _toDateController, - onTap: () { - _presentDatePicker('_selectedToDate'); - }, - inputFormatter: ONLY_DATE, - onSaved: (value) {}), - ], - )), - Container( - margin: EdgeInsets.all(10), - 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), + 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( + hintText: widget.extendedData != null + ? widget.extendedData.startDate + : TranslationBase.of(context) + .sickLeaveDate, + borderColor: Colors.white, + prefix: IconButton( + icon: Icon(Icons.calendar_today)), + textInputType: TextInputType.number, + controller: _toDateController, + onTap: () { + _presentDatePicker('_selectedToDate'); + }, + inputFormatter: ONLY_DATE, + onChanged: (value) { + addSickLeave.startDate = value; + }), + ], + )), + Container( + 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"))), + 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(), + ))), + ), + ], + ) + ], + ), + )), + model2.sickLeaveStatistics[ + 'recommendedSickLeaveDays'] != + null + ? Padding( + child: AppText( + model2.sickLeaveStatistics[ + 'recommendedSickLeaveDays'], + fontWeight: FontWeight.bold, + ), + padding: EdgeInsets.all(10), + ) + : 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).clinicName, + // TranslationBase.of(context).doctorName, // 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(), - ))), - ), - ], - ) + new IgnorePointer( + ignoring: true, + child: AppTextFormField( + readOnly: true, + hintText: profile['DoctorName'], + borderColor: Colors.white, + onSaved: (value) {}, + // validator: (value) { + // return TextValidator().validateName(value); + // }, + inputFormatter: ONLY_NUMBERS)) ], ), - )), - 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, - hintText: TranslationBase.of(context).remarks, - 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).add, - onPressed: () { - // _validateInputs(); - }, + ), + 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, + hintText: widget.extendedData != null + ? widget.extendedData.remarks + : TranslationBase.of(context).remarks, + onChanged: (value) { + addSickLeave.remarks = value; + }, + validator: (value) { + // return TextValidator().validateName(value); + }, + inputFormatter: ONLY_LETTERS) + ], ), - ], - ), - ), - Column( - children: [ - Texts(TranslationBase.of(context) - .previousSickLeaveIssue + - ' ') + ), + Container( + margin: EdgeInsets.all( + SizeConfig.widthMultiplier * 5), + child: Wrap( + alignment: WrapAlignment.center, + children: [ + AppButton( + title: widget.isExtended == true + ? TranslationBase.of(context).extend + : TranslationBase.of(context).add, + onPressed: () { + if (widget.isExtended) { + model2 + .extendSickLeave( + widget.extendedData) + .then((value) => (value) { + print(value); + }); + } else { + model2 + .addSickLeave(addSickLeave) + .then((value) => print(value)); + } + }, + ), + ], + ), + ), + // Column( + // children: [ + // Texts(TranslationBase.of(context) + // .previousSickLeaveIssue + + // ' ') + // ], + // ) ], - ) - ], + ), + ), ), ), - ), - ), - )); + ))); } getProfile() async { diff --git a/lib/util/translations_delegate_base.dart b/lib/util/translations_delegate_base.dart index 5290e933..43fec17b 100644 --- a/lib/util/translations_delegate_base.dart +++ b/lib/util/translations_delegate_base.dart @@ -326,6 +326,16 @@ class TranslationBase { String get addSickLeave => localizedValues['add-sickleave'][locale.languageCode]; String get add => localizedValues['add'][locale.languageCode]; + String get approved => localizedValues['approved'][locale.languageCode]; + String get extended => localizedValues['extended'][locale.languageCode]; + String get pending => localizedValues['pending'][locale.languageCode]; + String get leaveStartDate => + localizedValues['leave-start-date'][locale.languageCode]; + String get daysSickleave => + localizedValues['days-sick-leave'][locale.languageCode]; + String get extend => localizedValues['extend'][locale.languageCode]; + String get extendSickLeave => + localizedValues['extend-sickleave'][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate { From 8d58348267e83b91546d30049ce55408a8caf780 Mon Sep 17 00:00:00 2001 From: Sultan Khan Date: Mon, 21 Dec 2020 16:32:39 +0300 Subject: [PATCH 08/21] 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, From 989c06ae33080e1cdbb398411ea8e778e43dcae9 Mon Sep 17 00:00:00 2001 From: Sultan Khan Date: Wed, 23 Dec 2020 10:29:58 +0300 Subject: [PATCH 09/21] prescription changes --- lib/config/localized_values.dart | 6 ++- lib/util/translations_delegate_base.dart | 2 + lib/widgets/patients/profile/medication.dart | 13 +++++ .../prescription_in_patinets_widget.dart | 47 +++++++++++++++++-- .../prescription_out_patinets_widget.dart | 5 +- 5 files changed, 66 insertions(+), 7 deletions(-) create mode 100644 lib/widgets/patients/profile/medication.dart diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 3ba857e0..c4d2f5a5 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -305,5 +305,9 @@ const Map> localizedValues = { 'en': "EXTEND SICK LEAVE", 'ar': 'قم بتمديد الإجازة المرضية' }, - 'patient-target': {'en': 'Target Patient', 'ar': 'الهدف المريض'} + 'patient-target': {'en': 'Target Patient', 'ar': 'الهدف المريض'}, + 'no-priscription-listed': { + 'en': 'No Prescription Listed', + 'ar': 'لا وصفة طبية مدرجة' + } }; diff --git a/lib/util/translations_delegate_base.dart b/lib/util/translations_delegate_base.dart index 1dde64be..497506b3 100644 --- a/lib/util/translations_delegate_base.dart +++ b/lib/util/translations_delegate_base.dart @@ -338,6 +338,8 @@ class TranslationBase { localizedValues['extend-sickleave'][locale.languageCode]; String get targetPatient => localizedValues['patient-target'][locale.languageCode]; + String get noPrescription => + localizedValues['no-priscription-listed'][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate { diff --git a/lib/widgets/patients/profile/medication.dart b/lib/widgets/patients/profile/medication.dart new file mode 100644 index 00000000..62494d8e --- /dev/null +++ b/lib/widgets/patients/profile/medication.dart @@ -0,0 +1,13 @@ +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:flutter/material.dart'; + +class MedicationDetails extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Column( + children: [ + AppText('MEDICATION'), + ], + ); + } +} diff --git a/lib/widgets/patients/profile/prescription_in_patinets_widget.dart b/lib/widgets/patients/profile/prescription_in_patinets_widget.dart index a5b9d014..1c9b4462 100644 --- a/lib/widgets/patients/profile/prescription_in_patinets_widget.dart +++ b/lib/widgets/patients/profile/prescription_in_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_report_for_in_patient.dart'; import 'package:doctor_app_flutter/routes.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'; @@ -19,7 +21,41 @@ class PrescriptionInPatientWidget extends StatelessWidget { Widget build(BuildContext context) { return Container( child: prescriptionReportForInPatientList.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).noPrescription, + 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), @@ -28,9 +64,12 @@ class PrescriptionInPatientWidget extends StatelessWidget { itemBuilder: (BuildContext context, int index) { return InkWell( onTap: () { - Navigator.of(context).pushNamed(IN_PATIENT_PRESCRIPTIONS_DETAILS, arguments: { - 'prescription': prescriptionReportForInPatientList[index] - }); + Navigator.of(context).pushNamed( + IN_PATIENT_PRESCRIPTIONS_DETAILS, + arguments: { + 'prescription': + prescriptionReportForInPatientList[index] + }); }, child: CardWithBgWidgetNew( widget: Column( diff --git a/lib/widgets/patients/profile/prescription_out_patinets_widget.dart b/lib/widgets/patients/profile/prescription_out_patinets_widget.dart index bfb7b8c7..b4ceffb4 100644 --- a/lib/widgets/patients/profile/prescription_out_patinets_widget.dart +++ b/lib/widgets/patients/profile/prescription_out_patinets_widget.dart @@ -2,6 +2,7 @@ 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/patients/profile/medication.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'; @@ -42,7 +43,7 @@ class PrescriptionOutPatientWidget extends StatelessWidget { ), Padding( child: AppText( - TranslationBase.of(context).noSickLeaveApplied, + TranslationBase.of(context).noPrescription, fontWeight: FontWeight.bold, ), padding: EdgeInsets.all(10), @@ -132,7 +133,7 @@ class PrescriptionOutPatientWidget extends StatelessWidget { showModalBottomSheet( context: context, builder: (context) { - return new Container(); + return MedicationDetails(); }); } } From bb651478a06bb088760af22bb9c99ad65df38ea2 Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Sat, 26 Dec 2020 20:05:30 +0200 Subject: [PATCH 10/21] Finish subjective --- lib/client/base_app_client.dart | 25 +- lib/config/config.dart | 2 + lib/config/localized_values.dart | 7 +- lib/core/service/SOAP_service.dart | 32 ++- lib/core/service/base/lookup-service.dart | 1 + lib/core/viewModel/SOAP_view_model.dart | 22 ++ .../post_chief_complaint_request_model.dart | 48 ++++ .../SOAP/post_histories_request_model.dart | 64 +++++ lib/util/translations_delegate_base.dart | 1 + .../SOAP/subjective/subjective_page.dart | 246 +++++++++++------- lib/widgets/shared/TextFields.dart | 2 +- lib/widgets/shared/app_buttons_widget.dart | 98 ++++--- 12 files changed, 407 insertions(+), 141 deletions(-) create mode 100644 lib/models/SOAP/post_chief_complaint_request_model.dart create mode 100644 lib/models/SOAP/post_histories_request_model.dart diff --git a/lib/client/base_app_client.dart b/lib/client/base_app_client.dart index 9d621755..d9abcd5e 100644 --- a/lib/client/base_app_client.dart +++ b/lib/client/base_app_client.dart @@ -61,7 +61,8 @@ class BaseAppClient { body['SessionID'] = SESSION_ID; body['IsLoginForDoctorApp'] = IS_LOGIN_FOR_DOCTOR_APP; body['PatientOutSA'] = 0; // PATIENT_OUT_SA; - body['VidaAuthTokenID'] = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMDAyIiwianRpIjoiZjcwMTUyYzktMjAwNy00Y2FjLTkzMWUtOGI0MDlhMWFkNjc4IiwiZW1haWwiOiIiLCJpZCI6IjEwMDIiLCJOYW1lIjoiVEVNUCAtIERPQ1RPUiIsIkVtcGxveWVlSWQiOiI0NzA5IiwiRmFjaWxpdHlHcm91cElkIjoiMDEwMjY2IiwiRmFjaWxpdHlJZCI6IjE1IiwiUGhhcmFtY3lGYWNpbGl0eUlkIjoiNTUiLCJJU19QSEFSTUFDWV9DT05ORUNURUQiOiJUcnVlIiwiRG9jdG9ySWQiOiI0NzA5IiwiU0VTU0lPTklEIjoiMjE1ODU1MzAiLCJDbGluaWNJZCI6IjE3Iiwicm9sZSI6IkRPQ1RPUlMiLCJuYmYiOjE2MDg1NTMxMDAsImV4cCI6MTYwOTQxNzEwMCwiaWF0IjoxNjA4NTUzMTAwfQ.lydDI-nsHlmb4Z4vesnckCU1i3hnNayoWVacc3E5_XM"; + body['VidaAuthTokenID'] = + "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMDAyIiwianRpIjoiOGUxMWI1ZGItNTE5Mi00NmIzLWIzMDAtNDMwYjZmNDI4YWExIiwiZW1haWwiOiIiLCJpZCI6IjEwMDIiLCJOYW1lIjoiVEVNUCAtIERPQ1RPUiIsIkVtcGxveWVlSWQiOiI0NzA5IiwiRmFjaWxpdHlHcm91cElkIjoiMDEwMjY2IiwiRmFjaWxpdHlJZCI6IjE1IiwiUGhhcmFtY3lGYWNpbGl0eUlkIjoiNTUiLCJJU19QSEFSTUFDWV9DT05ORUNURUQiOiJUcnVlIiwiRG9jdG9ySWQiOiI0NzA5IiwiU0VTU0lPTklEIjoiMjE1OTU3MjgiLCJDbGluaWNJZCI6IjEiLCJyb2xlIjpbIkRPQ1RPUlMiLCJIRUFEIERPQ1RPUlMiLCJBRE1JTklTVFJBVE9SUyIsIlJFQ0VQVElPTklTVCIsIkVSIE5VUlNFIiwiRVIgUkVDRVBUSU9OSVNUIiwiUEhBUk1BQ1kgQUNDT1VOVCBTVEFGRiIsIlBIQVJNQUNZIE5VUlNFIiwiSU5QQVRJRU5UIFBIQVJNQUNJU1QiLCJBRE1JU1NJT04gU1RBRkYiLCJBUFBST1ZBTCBTVEFGRiIsIkNPTlNFTlQgIiwiTUVESUNBTCBSRVBPUlQgLSBTSUNLIExFQVZFIE1BTkFHRVIiXSwibmJmIjoxNjA4ODE0MDcyLCJleHAiOjE2MDk2NzgwNzIsImlhdCI6MTYwODgxNDA3Mn0.u23f3ifrNMQrK0ReTZWs9olaZCEYuf06ZZZJsBWJ5LI"; print("URL : $url"); print("Body : ${json.encode(body)}"); @@ -78,25 +79,27 @@ class BaseAppClient { onFailure('Error While Fetching data', statusCode); } else { var parsed = json.decode(response.body.toString()); - if (!parsed['IsAuthenticated']) { - await helpers.logout(); - - helpers.showErrorToast('Your session expired Please login agian'); - } else - if (parsed['MessageStatus'] == 1) { + // if (!parsed['IsAuthenticated']) { + // await helpers.logout(); + // + // helpers.showErrorToast('Your session expired Please login agian'); + // } else + if (parsed['MessageStatus'] == 1) { onSuccess(parsed, statusCode); } else { String error = parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage']; if (parsed["ValidationErrors"] != null) { + error = + parsed["ValidationErrors"]["StatusMessage"].toString() + "\n"; + if (parsed["ValidationErrors"]["ValidationErrors"] != null && parsed["ValidationErrors"]["ValidationErrors"].length != 0) { - error =''; for (var i = 0; - i < parsed["ValidationErrors"]["ValidationErrors"].length; - i++) { - error = error +parsed["ValidationErrors"]["ValidationErrors"][i]["Messages"][0] +"\n"; + i < parsed["ValidationErrors"]["ValidationErrors"].length; + i++) { + error = error +parsed["ValidationErrors"]["ValidationErrors"][i]["Messages"][0] +"\n"; } } } diff --git a/lib/config/config.dart b/lib/config/config.dart index 783cf811..a79daa45 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -86,6 +86,8 @@ const END_CALL_WITH_CHARGE = 'LiveCareApi/DoctorApp/CompleteCallWithCharge'; const GET_ALLERGIES = 'Services/DoctorApplication.svc/REST/GetAllergies'; const GET_MASTER_LOOKUP_LIST = 'Services/DoctorApplication.svc/REST/GetMasterLookUpList'; const POST_ALLERGY = 'Services/DoctorApplication.svc/REST/PostAllergies'; +const POST_HISTORY = 'Services/DoctorApplication.svc/REST/PostHistory'; +const POST_CHIEF_COMPLAINT = 'Services/DoctorApplication.svc/REST/PostChiefcomplaint'; var selectedPatientType = 1; diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index e205bb4e..ffd3c822 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -280,7 +280,10 @@ const Map> localizedValues = { 'clinicSelect': {'en': "Select Clinic", 'ar': 'اختار عيادة'}, 'doctorSelect': {'en': "Select Doctor", 'ar': 'اختار طبيب'}, "empty-message": { - "en": "Please enter message", - "ar": "يرجى ادخال الموضوع" + "en": "Please enter Value", + "ar": "يرجى ادخال القيمه" + },"chiefComplaintLength": { + "en": "Chief Complaint length should be greater than 25", + "ar": "يجب أن يكون طول شكوى الرئيس أكبر من 25" }, }; diff --git a/lib/core/service/SOAP_service.dart b/lib/core/service/SOAP_service.dart index 56645184..1a8c91a1 100644 --- a/lib/core/service/SOAP_service.dart +++ b/lib/core/service/SOAP_service.dart @@ -1,14 +1,13 @@ import 'package:doctor_app_flutter/config/config.dart'; -import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart'; -import 'package:doctor_app_flutter/core/service/base/base_service.dart'; import 'package:doctor_app_flutter/models/SOAP/get_Allergies_request_model.dart'; import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; import 'package:doctor_app_flutter/models/SOAP/post_allergy_request_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/post_chief_complaint_request_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/post_histories_request_model.dart'; import 'base/lookup-service.dart'; class SOAPService extends LookupService { - Future getAllergies(GetAllergiesRequestModel getAllergiesRequestModel) async { await baseAppClient.post( GET_ALLERGIES, @@ -27,13 +26,38 @@ class SOAPService extends LookupService { } Future postAllergy(PostAllergyRequestModel postAllergyRequestModel) async { + hasError = false; await baseAppClient.post(POST_ALLERGY, onSuccess: (dynamic response, int statusCode) { - print("Success"); + print("Success"); }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; }, body: postAllergyRequestModel.toJson()); } + + Future postHistories( + PostHistoriesRequestModel postHistoriesRequestModel) async { + hasError = false; + await baseAppClient.post(POST_HISTORY, + onSuccess: (dynamic response, int statusCode) { + print("Success"); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: postHistoriesRequestModel.toJson()); + } + + Future postChiefComplaint( + PostChiefComplaintRequestModel postChiefComplaintRequestModel) async { + hasError = false; + await baseAppClient.post(POST_CHIEF_COMPLAINT, + onSuccess: (dynamic response, int statusCode) { + print("Success"); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: postChiefComplaintRequestModel.toJson()); + } } diff --git a/lib/core/service/base/lookup-service.dart b/lib/core/service/base/lookup-service.dart index 1e46d13a..18353c82 100644 --- a/lib/core/service/base/lookup-service.dart +++ b/lib/core/service/base/lookup-service.dart @@ -27,6 +27,7 @@ class LookupService extends BaseService { List _historySurgicalList = []; Future getMasterLookup(MasterKeysService masterKeys) async { + hasError = false; Map body = { "MasterInput": masterKeys.getMasterKeyService() }; diff --git a/lib/core/viewModel/SOAP_view_model.dart b/lib/core/viewModel/SOAP_view_model.dart index 608b2e3d..5131e086 100644 --- a/lib/core/viewModel/SOAP_view_model.dart +++ b/lib/core/viewModel/SOAP_view_model.dart @@ -5,6 +5,8 @@ import 'package:doctor_app_flutter/models/SOAP/Allergy_model.dart'; import 'package:doctor_app_flutter/models/SOAP/get_Allergies_request_model.dart'; import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; import 'package:doctor_app_flutter/models/SOAP/post_allergy_request_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/post_chief_complaint_request_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/post_histories_request_model.dart'; import '../../locator.dart'; import 'base_view_model.dart'; @@ -60,5 +62,25 @@ class SOAPViewModel extends BaseViewModel { setState(ViewState.Idle); } + Future postHistories(PostHistoriesRequestModel postHistoriesRequestModel) async { + setState(ViewState.BusyLocal); + await _SOAPService.postHistories(postHistoriesRequestModel); + if (_SOAPService.hasError) { + error = _SOAPService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + + Future postChiefComplaint(PostChiefComplaintRequestModel postChiefComplaintRequestModel) async { + setState(ViewState.BusyLocal); + await _SOAPService.postChiefComplaint(postChiefComplaintRequestModel); + if (_SOAPService.hasError) { + error = _SOAPService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + } diff --git a/lib/models/SOAP/post_chief_complaint_request_model.dart b/lib/models/SOAP/post_chief_complaint_request_model.dart new file mode 100644 index 00000000..bedf2978 --- /dev/null +++ b/lib/models/SOAP/post_chief_complaint_request_model.dart @@ -0,0 +1,48 @@ +class PostChiefComplaintRequestModel { + int appointmentNo; + int episodeID; + int patientMRN; + String chiefComplaint; + String hopi; + String currentMedication; + bool ispregnant; + bool isLactation; + int numberOfWeeks; + + PostChiefComplaintRequestModel( + {this.appointmentNo, + this.episodeID, + this.patientMRN, + this.chiefComplaint, + this.hopi, + this.currentMedication, + this.ispregnant, + this.isLactation, + this.numberOfWeeks}); + + PostChiefComplaintRequestModel.fromJson(Map json) { + appointmentNo = json['AppointmentNo']; + episodeID = json['EpisodeID']; + patientMRN = json['PatientMRN']; + chiefComplaint = json['chiefComplaint']; + hopi = json['Hopi']; + currentMedication = json['CurrentMedication']; + ispregnant = json['ispregnant']; + isLactation = json['isLactation']; + numberOfWeeks = json['numberOfWeeks']; + } + + Map toJson() { + final Map data = new Map(); + data['AppointmentNo'] = this.appointmentNo; + data['EpisodeID'] = this.episodeID; + data['PatientMRN'] = this.patientMRN; + data['chiefComplaint'] = this.chiefComplaint; + data['Hopi'] = this.hopi; + data['CurrentMedication'] = this.currentMedication; + data['ispregnant'] = this.ispregnant; + data['isLactation'] = this.isLactation; + data['numberOfWeeks'] = this.numberOfWeeks; + return data; + } +} diff --git a/lib/models/SOAP/post_histories_request_model.dart b/lib/models/SOAP/post_histories_request_model.dart new file mode 100644 index 00000000..baa428fd --- /dev/null +++ b/lib/models/SOAP/post_histories_request_model.dart @@ -0,0 +1,64 @@ +class PostHistoriesRequestModel { + List listMedicalHistoryVM; + + PostHistoriesRequestModel({this.listMedicalHistoryVM}); + + PostHistoriesRequestModel.fromJson(Map json) { + if (json['listMedicalHistoryVM'] != null) { + listMedicalHistoryVM = new List(); + json['listMedicalHistoryVM'].forEach((v) { + listMedicalHistoryVM.add(new ListMedicalHistoryVM.fromJson(v)); + }); + } + } + + Map toJson() { + final Map data = new Map(); + if (this.listMedicalHistoryVM != null) { + data['listMedicalHistoryVM'] = + this.listMedicalHistoryVM.map((v) => v.toJson()).toList(); + } + return data; + } +} + +class ListMedicalHistoryVM { + int patientMRN; + int historyType; + int historyId; + int episodeId; + int appointmentNo; + bool isChecked; + String remarks; + + ListMedicalHistoryVM( + {this.patientMRN, + this.historyType, + this.historyId, + this.episodeId, + this.appointmentNo, + this.isChecked, + this.remarks}); + + ListMedicalHistoryVM.fromJson(Map json) { + patientMRN = json['patientMRN']; + historyType = json['historyType']; + historyId = json['historyId']; + episodeId = json['episodeId']; + appointmentNo = json['appointmentNo']; + isChecked = json['isChecked']; + remarks = json['remarks']; + } + + Map toJson() { + final Map data = new Map(); + data['patientMRN'] = this.patientMRN; + data['historyType'] = this.historyType; + data['historyId'] = this.historyId; + data['episodeId'] = this.episodeId; + data['appointmentNo'] = this.appointmentNo; + data['isChecked'] = this.isChecked; + data['remarks'] = this.remarks; + return data; + } +} diff --git a/lib/util/translations_delegate_base.dart b/lib/util/translations_delegate_base.dart index 7292492d..3f483480 100644 --- a/lib/util/translations_delegate_base.dart +++ b/lib/util/translations_delegate_base.dart @@ -300,6 +300,7 @@ class TranslationBase { String get next => localizedValues['next'][locale.languageCode]; String get healthRecordInformation => localizedValues['healthRecordInformation'][locale.languageCode]; String get emptyMessage => localizedValues['empty-message'][locale.languageCode]; + String get chiefComplaintLength => localizedValues['chiefComplaintLength'][locale.languageCode]; } diff --git a/lib/widgets/patients/profile/SOAP/subjective/subjective_page.dart b/lib/widgets/patients/profile/SOAP/subjective/subjective_page.dart index a78f6d0b..ae024b10 100644 --- a/lib/widgets/patients/profile/SOAP/subjective/subjective_page.dart +++ b/lib/widgets/patients/profile/SOAP/subjective/subjective_page.dart @@ -5,6 +5,8 @@ import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; import 'package:doctor_app_flutter/models/SOAP/my_selected_allergy.dart'; import 'package:doctor_app_flutter/models/SOAP/post_allergy_request_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/post_chief_complaint_request_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/post_histories_request_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/SOAP/subjective/add_allergies_widget.dart'; @@ -34,9 +36,9 @@ class _SubjectivePageState extends State { bool isChiefExpand = false; bool isHistoryExpand = false; bool isAllergiesExpand = false; - List myHistoryList = List(); TextEditingController illnessController = TextEditingController(); TextEditingController complaintsController = TextEditingController(); + final formKey = GlobalKey(); @override Widget build(BuildContext context) { @@ -83,56 +85,64 @@ class _SubjectivePageState extends State { isChiefExpand ? EvaIcons.minus : EvaIcons.plus)) ], ), - bodyWidget: Column(children: [ - SizedBox( - height: 20, - ), - Container( - margin: EdgeInsets.only(left: 10, right: 10, top: 15), - child: TextFields( - hintText: "Add Chief Complaints", - fontSize: 13.5, - // hintColor: Colors.black, - fontWeight: FontWeight.w600, - maxLines: 25, - minLines: 13, - controller: complaintsController, - validator: (value) { - if (value == null) - return TranslationBase - .of(context) - .emptyMessage; - else - return null; - }), - ), - SizedBox( - height: 20, - ), - Container( - margin: EdgeInsets.only(left: 10, right: 10, top: 15), - child: TextFields( - hintText: "History of Present Illness", - fontSize: 13.5, - // hintColor: Colors.black, - fontWeight: FontWeight.w600, - maxLines: 25, - minLines: 13, - controller: illnessController, - validator: (value) { - if (value == null) - return TranslationBase - .of(context) - .emptyMessage; - else - return null; - }), - ), - SizedBox( - height: 20, - ), - AddMedication(), - ]), + bodyWidget: Form( + key: formKey, + child: Column(children: [ + SizedBox( + height: 20, + ), + Container( + margin: EdgeInsets.only(left: 10, right: 10, top: 15), + child: TextFields( + hintText: "Add Chief Complaints", + fontSize: 13.5, + // hintColor: Colors.black, + fontWeight: FontWeight.w600, + maxLines: 25, + minLines: 13, + controller: complaintsController, + validator: (value) { + if (value == null || value =="") + return TranslationBase + .of(context) + .emptyMessage; + else if (value.length < 25) + return TranslationBase + .of(context) + .chiefComplaintLength; + //""; + else + return null; + }), + ), + SizedBox( + height: 20, + ), + Container( + margin: EdgeInsets.only(left: 10, right: 10, top: 15), + child: TextFields( + hintText: "History of Present Illness", + fontSize: 13.5, + // hintColor: Colors.black, + fontWeight: FontWeight.w600, + maxLines: 25, + minLines: 13, + controller: illnessController, + validator: (value) { + if (value == null || value =="") + return TranslationBase + .of(context) + .emptyMessage; + else + return null; + }), + ), + SizedBox( + height: 20, + ), + AddMedication(), + ]), + ), isExpand: isChiefExpand, ), @@ -177,7 +187,7 @@ class _SubjectivePageState extends State { ), bodyWidget: Column( children: [ - AddHistoryWidget(myHistoryList: myHistoryList) + AddHistoryWidget(myHistoryList: widget.myHistoryList) ], ), isExpand: isHistoryExpand, @@ -243,58 +253,118 @@ class _SubjectivePageState extends State { SizedBox( height: 30, ), - AppButton( - title: TranslationBase - .of(context) - .next, - - onPressed: () async { - addSubjectiveInfo(model: model, - myAllergiesList: widget.myAllergiesList, - myHistoryList: myHistoryList); - - }, - ), + AppButton( + title: TranslationBase.of(context).next, + loading: model.state == ViewState.BusyLocal, + onPressed: () async { + addSubjectiveInfo( + model: model, + myAllergiesList: widget.myAllergiesList, + myHistoryList: widget.myHistoryList); + }, + ), ], ), ), ), - ),),); + ), + ), + ); } addSubjectiveInfo( - {SOAPViewModel model, List myAllergiesList, List< - MasterKeyModel> myHistoryList }) async { - PostAllergyRequestModel postAllergyRequestModel = new PostAllergyRequestModel(); + {SOAPViewModel model, + List myAllergiesList, + List myHistoryList}) async { + await postChiefComplaint(model: model); + if (myHistoryList.length != 0) + await postHistories(model: model, myHistoryList: myHistoryList); + if (myAllergiesList.length != 0) + await postAllergy(myAllergiesList: myAllergiesList, model: model); + + widget.changePageViewIndex(1); + } + + postAllergy( + {List myAllergiesList, SOAPViewModel model}) async { + PostAllergyRequestModel postAllergyRequestModel = + new PostAllergyRequestModel(); widget.myAllergiesList.forEach((allergy) { - if(postAllergyRequestModel.listHisProgNotePatientAllergyDiseaseVM ==null) + if (postAllergyRequestModel.listHisProgNotePatientAllergyDiseaseVM == + null) postAllergyRequestModel.listHisProgNotePatientAllergyDiseaseVM = []; - postAllergyRequestModel.listHisProgNotePatientAllergyDiseaseVM.add( - ListHisProgNotePatientAllergyDiseaseVM( - allergyDiseaseId: allergy.selectedAllergy.id, - allergyDiseaseType: allergy.selectedAllergy.typeId, - patientMRN: 2500477, - episodeId: 200011502, - appointmentNo: 2016053271, - severity: allergy.selectedAllergySeverity.id, - remarks: allergy.remark, - createdBy: 1485, - createdOn: "2020-08-14T20:37:22.780Z", - editedBy: 1485, - editedOn: "2020-08-14T20:37:22.780Z", - isChecked: false, - isUpdatedByNurse: false - )); + //TODO: make static value dynamic + postAllergyRequestModel.listHisProgNotePatientAllergyDiseaseVM + .add(ListHisProgNotePatientAllergyDiseaseVM( + allergyDiseaseId: allergy.selectedAllergy.id, + allergyDiseaseType: allergy.selectedAllergy.typeId, + patientMRN: 3120690, + episodeId: 200012117, + appointmentNo: 2016054573, + severity: allergy.selectedAllergySeverity.id, + remarks: allergy.remark, + createdBy: 1485, + // + createdOn: "2020-08-14T20:37:22.780Z", + editedBy: 1485, + editedOn: "2020-08-14T20:37:22.780Z", + isChecked: false, + isUpdatedByNurse: false)); }); await model.postAllergy(postAllergyRequestModel); - if(model.state == ViewState.ErrorLocal) { + if (model.state == ViewState.ErrorLocal) { helpers.showErrorToast(model.error); } - widget.changePageViewIndex(1); + } - print(postAllergyRequestModel); + postHistories( + {List myHistoryList, SOAPViewModel model}) async { + PostHistoriesRequestModel postHistoriesRequestModel = + new PostHistoriesRequestModel(); + widget.myHistoryList.forEach((history) { + if (postHistoriesRequestModel.listMedicalHistoryVM == null) + postHistoriesRequestModel.listMedicalHistoryVM = []; + //TODO: make static value dynamic + postHistoriesRequestModel.listMedicalHistoryVM.add(ListMedicalHistoryVM( + patientMRN: 3120690, + episodeId: 200012117, + appointmentNo: 2016054573, + remarks: "", + historyId: history.id, + historyType: history.typeId, + isChecked: false, + )); + }); + await model.postHistories(postHistoriesRequestModel); + if (model.state == ViewState.ErrorLocal) { + helpers.showErrorToast(model.error); + } } + postChiefComplaint({SOAPViewModel model}) async { + formKey.currentState.save(); + if(formKey.currentState.validate()){ + PostChiefComplaintRequestModel postChiefComplaintRequestModel = + //TODO: make static value dynamic + new PostChiefComplaintRequestModel( + patientMRN: 3120690, + episodeID: 200012117, + appointmentNo: 2016054573, + chiefComplaint: complaintsController.text, + currentMedication: "currentMedication", + hopi: illnessController.text, + isLactation: false, + ispregnant: false, + numberOfWeeks: 22); + + await model.postChiefComplaint(postChiefComplaintRequestModel); + + if (model.state == ViewState.ErrorLocal) { + helpers.showErrorToast(model.error); + } + } + + } } diff --git a/lib/widgets/shared/TextFields.dart b/lib/widgets/shared/TextFields.dart index e41b4379..fec58e89 100644 --- a/lib/widgets/shared/TextFields.dart +++ b/lib/widgets/shared/TextFields.dart @@ -157,7 +157,7 @@ class _TextFieldsState extends State { : Icon(EvaIcons.search, size: 20.0, color: Colors.grey[500]), - errorStyle: TextStyle(fontSize: 14.0, fontWeight: widget.fontWeight, height: widget.borderOnlyError ? 0.0 : null), + errorStyle: TextStyle(fontSize: 12.0, fontWeight: widget.fontWeight, height: widget.borderOnlyError ? 0.0 : null), errorBorder: OutlineInputBorder( borderSide: BorderSide(color: Theme.of(context).errorColor.withOpacity(widget.bare ? 0.0 : 0.5 ), width: 2.0), borderRadius: BorderRadius.circular(widget.bare ? 0.0 : 8.0) diff --git a/lib/widgets/shared/app_buttons_widget.dart b/lib/widgets/shared/app_buttons_widget.dart index d01fe5af..85b0483d 100644 --- a/lib/widgets/shared/app_buttons_widget.dart +++ b/lib/widgets/shared/app_buttons_widget.dart @@ -14,50 +14,78 @@ class AppButton extends StatefulWidget { final Color color; final double fontSize; final double padding; + final bool loading; + final bool disabled; - AppButton({@required this.onPressed, this.title, this.icon, this.color, this.fontSize = 2, this.padding = 13}); + AppButton( + {@required this.onPressed, + this.title, + this.icon, + this.color, + this.fontSize = 2, + this.padding = 13, + this.loading = false, + this.disabled = false}); _AppButtonState createState() => _AppButtonState(); - } class _AppButtonState extends State{ @override Widget build(BuildContext context) { - return - RawMaterialButton( - fillColor: widget.color != null ? widget.color : HexColor("#B8382C"), - splashColor: widget.color, - child: Padding( - padding: EdgeInsets.only( - top: widget.padding, - bottom: widget.padding, - //right: SizeConfig.widthMultiplier * widget.padding, - //left: SizeConfig.widthMultiplier * widget.padding - ), - child: Row( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - if (widget.icon != null) - Icon( - widget.icon, - color: Colors.white, - ), - if (widget.icon != null) - SizedBox( - width: 5.0, - ), - AppText( - widget.title.toUpperCase(), - color: Colors.white, - fontSize: SizeConfig.textMultiplier * widget.fontSize , - ), - ], + return + IgnorePointer( + ignoring: widget.loading, + child: RawMaterialButton( + fillColor: widget.color != null ? widget.color : HexColor("#B8382C"), + splashColor: widget.color, + child: Padding( + padding: EdgeInsets.only( + top: widget.padding, + bottom: widget.padding, + //right: SizeConfig.widthMultiplier * widget.padding, + //left: SizeConfig.widthMultiplier * widget.padding + ), + child: Row( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + if (widget.icon != null) + Icon( + widget.icon, + color: Colors.white, + ), + if (widget.icon != null) + SizedBox( + width: 5.0, + ), + widget.loading + ? Padding( + padding: EdgeInsets.all(2.6), + child: SizedBox( + height: 19.0, + width: 19.0, + child: CircularProgressIndicator( + backgroundColor: Colors.white, + valueColor: + AlwaysStoppedAnimation( + Colors.grey[300], + ), + ), + ), + ) + : AppText( + widget.title.toUpperCase(), + color: Colors.white, + fontSize: SizeConfig.textMultiplier * widget.fontSize, + ), + ], + ), ), + onPressed: widget.onPressed, + shape: const RoundedRectangleBorder( + borderRadius: BorderRadius.all(Radius.circular(6))), ), - onPressed: widget.onPressed, - shape: const RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(6))), - ); + ); } } \ No newline at end of file From e96d38454c9c78db18c1e1a054eb406e0725fd40 Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Sat, 26 Dec 2020 20:53:27 +0200 Subject: [PATCH 11/21] First step from examination --- lib/core/service/base/lookup-service.dart | 10 +- lib/core/viewModel/SOAP_view_model.dart | 1 + .../patients/profile/SOAP/add_SOAP_index.dart | 3 +- .../patients/profile/SOAP/objective_page.dart | 624 +++++++++--------- 4 files changed, 317 insertions(+), 321 deletions(-) diff --git a/lib/core/service/base/lookup-service.dart b/lib/core/service/base/lookup-service.dart index 18353c82..11623880 100644 --- a/lib/core/service/base/lookup-service.dart +++ b/lib/core/service/base/lookup-service.dart @@ -26,6 +26,10 @@ class LookupService extends BaseService { List get historySurgicalList => _historySurgicalList; List _historySurgicalList = []; + + List get physicalExaminationList => _physicalExaminationList; + List _physicalExaminationList = []; + Future getMasterLookup(MasterKeysService masterKeys) async { hasError = false; Map body = { @@ -85,7 +89,11 @@ class LookupService extends BaseService { }); break; case MasterKeysService.PhysicalExamination: - return 59; + _physicalExaminationList.clear(); + entryList.forEach((v) { + _physicalExaminationList + .add(MasterKeyModel.fromJson(v)); + }); break; case MasterKeysService.AllergySeverity: _allergySeverityList.clear(); diff --git a/lib/core/viewModel/SOAP_view_model.dart b/lib/core/viewModel/SOAP_view_model.dart index 5131e086..3ff33389 100644 --- a/lib/core/viewModel/SOAP_view_model.dart +++ b/lib/core/viewModel/SOAP_view_model.dart @@ -29,6 +29,7 @@ class SOAPViewModel extends BaseViewModel { List get historySocialList => _SOAPService.historySocialList; List get historySurgicalList => _SOAPService.historySurgicalList; List get mergeHistorySurgicalWithHistorySportList => [...historySurgicalList,...historySportList]; + List get physicalExaminationList => _SOAPService.physicalExaminationList; diff --git a/lib/widgets/patients/profile/SOAP/add_SOAP_index.dart b/lib/widgets/patients/profile/SOAP/add_SOAP_index.dart index 9d75b22c..4e8c0873 100644 --- a/lib/widgets/patients/profile/SOAP/add_SOAP_index.dart +++ b/lib/widgets/patients/profile/SOAP/add_SOAP_index.dart @@ -30,6 +30,7 @@ class _AddSOAPIndexState extends State int _currentIndex = 0; List myAllergiesList= List(); List myHistoryList = List(); + List myExaminationList = List(); changePageViewIndex(pageIndex) { _controller.jumpToPage(pageIndex); } @@ -153,7 +154,7 @@ class _AddSOAPIndexState extends State scrollDirection: Axis.horizontal, children: [ SubjectivePage(changePageViewIndex: changePageViewIndex,myAllergiesList: myAllergiesList,myHistoryList: myHistoryList,), - ObjectivePage(changePageViewIndex: changePageViewIndex,), + ObjectivePage(changePageViewIndex: changePageViewIndex,myExaminationList:myExaminationList), AssessmentPage(changePageViewIndex: changePageViewIndex,), PlanPage(changePageViewIndex: changePageViewIndex,) ], diff --git a/lib/widgets/patients/profile/SOAP/objective_page.dart b/lib/widgets/patients/profile/SOAP/objective_page.dart index b2cd920f..c3e8d5db 100644 --- a/lib/widgets/patients/profile/SOAP/objective_page.dart +++ b/lib/widgets/patients/profile/SOAP/objective_page.dart @@ -1,4 +1,9 @@ import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart'; +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/Text.dart'; import 'package:doctor_app_flutter/widgets/shared/TextFields.dart'; @@ -7,15 +12,16 @@ 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/divider_with_spaces_around.dart'; import 'package:doctor_app_flutter/widgets/shared/expandable-widget-header-body.dart'; +import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; import 'package:eva_icons_flutter/eva_icons_flutter.dart'; import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; -import 'package:hexcolor/hexcolor.dart'; class ObjectivePage extends StatefulWidget { final Function changePageViewIndex; + final List myExaminationList; - ObjectivePage({Key key, this.changePageViewIndex}); + ObjectivePage({Key key, this.changePageViewIndex, this.myExaminationList}); @override _ObjectivePageState createState() => _ObjectivePageState(); @@ -117,115 +123,136 @@ class _ObjectivePageState extends State { SizedBox( height: 20, ), - Container( - margin: - EdgeInsets.only(left: 15, right: 15, top: 15), - child: Column( - children: [ - Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Texts('Abdomen'.toUpperCase(), - variant: "bodyText", - bold: true, - color: Colors.black) - ], - ), - SizedBox( - height: 8, - ), - Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ + Column( + children: widget.myExaminationList.map((examination) { + return Container( + margin: EdgeInsets.only( + left: 15, right: 15, top: 15), + child: Column(children: [ Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, children: [ - InkWell( - child: Center( - child: Container( - height: screenSize.height * 0.070, - decoration: containerBorderDecoration( - Colors.white,Colors.grey - ), - child: Center( - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Text( - "Normal", - style: TextStyle( - fontSize: 12, - color: - Colors.black, //Colors.black, - fontWeight: FontWeight.bold, + Texts(examination.nameEn.toUpperCase(), + variant: "bodyText", + bold: true, + color: Colors.black) + ], + ), + SizedBox( + height: 8, + ), + Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + InkWell( + child: Center( + child: Container( + height: + screenSize.height * + 0.070, + decoration: + containerBorderDecoration( + Colors.white, + Colors.grey), + child: Center( + child: Padding( + padding: + const EdgeInsets + .all(8.0), + child: Text( + "Normal", + style: TextStyle( + fontSize: 12, + color: + Colors.black, + //Colors.black, + fontWeight: + FontWeight + .bold, + ), + ), ), - ), - ), - )), + )), + ), + onTap: () {}), + SizedBox( + width: 12, ), - onTap: () { - - }), - SizedBox(width: 12,), - InkWell( - child: Center( - child: Container( - height: screenSize.height * 0.070, - decoration: containerBorderDecoration( - Color(0xFF515A5D), Colors.black - ), - child: Center( - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Text( - "Abnormal", - style: TextStyle( - fontSize: 12, - color: - Colors.white, //Colors.black, - fontWeight: FontWeight.bold, + InkWell( + child: Center( + child: Container( + height: + screenSize.height * + 0.070, + decoration: + containerBorderDecoration( + Color(0xFF515A5D), + Colors.black), + child: Center( + child: Padding( + padding: + const EdgeInsets + .all(8.0), + child: Text( + "Abnormal", + style: TextStyle( + fontSize: 12, + color: + Colors.white, + //Colors.black, + fontWeight: + FontWeight + .bold, + ), + ), ), - ), - ), - )), - ), - onTap: () { - - }), + )), + ), + onTap: () {}), + ], + ), + InkWell( + + child: Icon( + FontAwesomeIcons.trash, + color: Colors.grey, + size: 20, + ), + onTap: ()=>removeExamination(examination), + ) ], ), - Icon( - FontAwesomeIcons.trash, - color: Colors.grey, - size: 20, - ) - ], - ), - SizedBox( - height: 20, - ), - Container( - margin: EdgeInsets.only(left: 10, right: 10, top: 15), - child: TextFields( - hintText: "Remarks", - fontSize: 13.5, - // hintColor: Colors.black, - fontWeight: FontWeight.w600, - maxLines: 25, - minLines: 13, - controller: remarksController, - validator: (value) { - if (value == null) - return TranslationBase.of(context).emptyMessage; - else - return null; - }), - ), - SizedBox( - height: 20, - ), - ], - ), + SizedBox( + height: 20, + ), + Container( + margin: EdgeInsets.only( + left: 10, right: 10, top: 15), + child: TextFields( + hintText: "Remarks", + fontSize: 13.5, + // hintColor: Colors.black, + fontWeight: FontWeight.w600, + maxLines: 25, + minLines: 13, + controller: remarksController, + validator: (value) { + if (value == null) + return TranslationBase.of(context) + .emptyMessage; + else + return null; + }), + ), + SizedBox( + height: 20, + ), + ])); + }).toList(), ) ], ) @@ -249,10 +276,23 @@ class _ObjectivePageState extends State { )); } + removeExamination(MasterKeyModel masterKey) { + Iterable history = widget.myExaminationList.where( + (element) => + masterKey.id == element.id && masterKey.typeId == element.typeId); + + if (history.length > 0) + setState(() { + widget.myExaminationList.remove(history.first); + }); + } + openExaminationList(BuildContext context) { - final screenSize = MediaQuery.of(context).size; - InputDecoration textFieldSelectorDecoration( - String hintText, String selectedText, bool isDropDown) { + final screenSize = MediaQuery + .of(context) + .size; + InputDecoration textFieldSelectorDecoration(String hintText, + String selectedText, bool isDropDown) { return InputDecoration( focusedBorder: OutlineInputBorder( borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), @@ -275,228 +315,174 @@ class _ObjectivePageState extends State { ); } - ; showModalBottomSheet( backgroundColor: Colors.white, isScrollControlled: true, context: context, builder: (context) { - return FractionallySizedBox( - heightFactor: 0.7, - child: Container( - child: FractionallySizedBox( - widthFactor: 0.9, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - height: 16, - ), - AppText( - "Examinations", - fontWeight: FontWeight.bold, - fontSize: 16, - ), - SizedBox( - height: 16, - ), - Container( - height: MediaQuery.of(context).size.height * 0.5, - child: Center( - child: Container( - margin: EdgeInsets.only(top: 15), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12), - color: Colors.white), - child: ListView( - children: [ - Column( + return AddExaminationDailog( + myExaminationList: widget.myExaminationList, + addSelectedExamination: () { + setState(() { + Navigator.of(context).pop(); + }); + }, + removeExamination: (masterKey) => removeExamination(masterKey),); + }); + } +} + +class AddExaminationDailog extends StatefulWidget { + final List myExaminationList; + final Function addSelectedExamination; + final Function (MasterKeyModel) removeExamination; + + const AddExaminationDailog( + {Key key, this.myExaminationList, this.addSelectedExamination, this.removeExamination}) + : super(key: key); + + @override + _AddExaminationDailogState createState() => _AddExaminationDailogState(); +} + +class _AddExaminationDailogState extends State { + @override + Widget build(BuildContext context) { + return FractionallySizedBox( + heightFactor: 0.7, + child: BaseView( + onModelReady: (model) async { + if (model.physicalExaminationList.length == 0) { + await model.getMasterLookup( + MasterKeysService.PhysicalExamination); + } + }, + builder: (_, model, w) => + AppScaffold( + // baseViewModel: model, + isShowAppBar: false, + body: Center( + child: Container( + child: FractionallySizedBox( + widthFactor: 0.9, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ - Row( - children: [ - Checkbox( - value: true, - activeColor: Colors.red[800], - onChanged: (bool newValue) { - setState(() {}); - }), - Expanded( - child: Padding( - padding: const EdgeInsets.symmetric( - horizontal: 10, vertical: 0), - child: Texts('Examinations', - variant: "bodyText", - bold: true, - color: Colors.black), - ), - ), - ], - ), - DividerWithSpacesAround(), - Row( - children: [ - Checkbox( - value: true, - activeColor: Colors.red[800], - onChanged: (bool newValue) { - setState(() {}); - }), - Expanded( - child: Padding( - padding: const EdgeInsets.symmetric( - horizontal: 10, vertical: 0), - child: Texts('Examinations', - variant: "bodyText", - bold: true, - color: Colors.black), - ), - ), - ], - ), - DividerWithSpacesAround(), - Row( - children: [ - Checkbox( - value: true, - activeColor: Colors.red[800], - onChanged: (bool newValue) { - setState(() {}); - }), - Expanded( - child: Padding( - padding: const EdgeInsets.symmetric( - horizontal: 10, vertical: 0), - child: Texts('Examinations', - variant: "bodyText", - bold: true, - color: Colors.black), - ), - ), - ], - ), - DividerWithSpacesAround(), - Row( - children: [ - Checkbox( - value: true, - activeColor: Colors.red[800], - onChanged: (bool newValue) { - setState(() {}); - }), - Expanded( - child: Padding( - padding: const EdgeInsets.symmetric( - horizontal: 10, vertical: 0), - child: Texts('Examinations', - variant: "bodyText", - bold: true, - color: Colors.black), - ), - ), - ], + SizedBox( + height: 16, ), - DividerWithSpacesAround(), - Row( - children: [ - Checkbox( - value: true, - activeColor: Colors.red[800], - onChanged: (bool newValue) { - setState(() {}); - }), - Expanded( - child: Padding( - padding: const EdgeInsets.symmetric( - horizontal: 10, vertical: 0), - child: Texts('Examinations', - variant: "bodyText", - bold: true, - color: Colors.black), - ), - ), - ], + AppText( + "Examinations", + fontWeight: FontWeight.bold, + fontSize: 16, ), - DividerWithSpacesAround(), - Row( - children: [ - Checkbox( - value: true, - activeColor: Colors.red[800], - onChanged: (bool newValue) { - setState(() {}); - }), - Expanded( - child: Padding( - padding: const EdgeInsets.symmetric( - horizontal: 10, vertical: 0), - child: Texts('Examinations', - variant: "bodyText", - bold: true, - color: Colors.black), - ), - ), - ], + SizedBox( + height: 16, ), - DividerWithSpacesAround(), - Row( - children: [ - Checkbox( - value: true, - activeColor: Colors.red[800], - onChanged: (bool newValue) { - setState(() {}); - }), - Expanded( - child: Padding( - padding: const EdgeInsets.symmetric( - horizontal: 10, vertical: 0), - child: Texts('Examinations', - variant: "bodyText", - bold: true, - color: Colors.black), - ), - ), - ], + NetworkBaseView( + baseViewModel: model, + child: Container( + height: + MediaQuery + .of(context) + .size + .height * 0.5, + child: Center( + child: Container( + margin: EdgeInsets.only(top: 15), + decoration: BoxDecoration( + borderRadius: BorderRadius + .circular(12), + color: Colors.white), + child: ListView( + children: [ + Column( + children: model + .physicalExaminationList + .map((examinationInfo) { + return Column( + children: [ + Row( + children: [ + Checkbox( + value: isServiceSelected( + examinationInfo), + activeColor: + Colors.red[800], + onChanged: + ( + bool newValue) { + setState(() { + if (isServiceSelected( + examinationInfo + )) { + widget + .removeExamination( + examinationInfo + ); + } + else { + widget + .myExaminationList + .add( + examinationInfo); + } + }); + }), + Expanded( + child: Padding( + padding: + const EdgeInsets + .symmetric( + horizontal: 10, + vertical: 0), + child: Texts( + examinationInfo + .nameEn, + variant: "bodyText", + bold: true, + color: + Colors.black), + ), + ), + ], + ), + DividerWithSpacesAround(), + ], + ); + }).toList(), + ), + ], + ), + )), + ), ), - DividerWithSpacesAround(), - Row( - children: [ - Checkbox( - value: true, - activeColor: Colors.red[800], - onChanged: (bool newValue) { - setState(() {}); - }), - Expanded( - child: Padding( - padding: const EdgeInsets.symmetric( - horizontal: 10, vertical: 0), - child: Texts('Examinations', - variant: "bodyText", - bold: true, - color: Colors.black), - ), - ), - ], + SizedBox( + height: 10, ), - DividerWithSpacesAround(), - ], - ), - ], - ), - )), - ), - SizedBox( - height: 10, - ), - AppButton( - title: "Add SELECTED Examinations".toUpperCase(), - onPressed: () {}, - ), - ]), - )), - ); - }); + if (model.state == ViewState.Idle) + AppButton( + title: "Add SELECTED Examinations" + .toUpperCase(), + onPressed: () { + widget.addSelectedExamination(); + }, + ), + ]), + ))), + )), + ); } -} + isServiceSelected(MasterKeyModel masterKey) { + Iterable history = + widget + .myExaminationList + .where((element) => + masterKey.id == element.id && masterKey.typeId == element.typeId); + if (history.length > 0) { + return true; + } + return false; + } +} From 4560706d552160d5a26e469202d5630574ab614c Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Sun, 27 Dec 2020 15:46:29 +0200 Subject: [PATCH 12/21] improve code inside my eam --- lib/client/base_app_client.dart | 11 ++- lib/models/SOAP/my_selected_examination.dart | 33 +++++++ .../post_physical_exam_request_model.dart | 99 +++++++++++++++++++ .../patients/profile/SOAP/add_SOAP_index.dart | 5 +- .../patients/profile/SOAP/objective_page.dart | 50 ++++++---- 5 files changed, 172 insertions(+), 26 deletions(-) create mode 100644 lib/models/SOAP/my_selected_examination.dart create mode 100644 lib/models/SOAP/post_physical_exam_request_model.dart diff --git a/lib/client/base_app_client.dart b/lib/client/base_app_client.dart index d9abcd5e..043753b2 100644 --- a/lib/client/base_app_client.dart +++ b/lib/client/base_app_client.dart @@ -79,11 +79,12 @@ class BaseAppClient { onFailure('Error While Fetching data', statusCode); } else { var parsed = json.decode(response.body.toString()); - // if (!parsed['IsAuthenticated']) { - // await helpers.logout(); - // - // helpers.showErrorToast('Your session expired Please login agian'); - // } else + if (!parsed['IsAuthenticated']) { + // TODO: return it back when IsAuthenticated work fine in all service + // await helpers.logout(); + + helpers.showErrorToast('Your session expired Please login agian'); + } else if (parsed['MessageStatus'] == 1) { onSuccess(parsed, statusCode); } else { diff --git a/lib/models/SOAP/my_selected_examination.dart b/lib/models/SOAP/my_selected_examination.dart new file mode 100644 index 00000000..3b6685c8 --- /dev/null +++ b/lib/models/SOAP/my_selected_examination.dart @@ -0,0 +1,33 @@ +import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; + +class MySelectedExamination { + MasterKeyModel selectedExamination; + String remark; + bool isNormal; + bool isAbnormal; + + MySelectedExamination( + {this.selectedExamination, this.remark, this.isNormal = true, this.isAbnormal = false}); + + MySelectedExamination.fromJson(Map json) { + + selectedExamination = json['selectedExamination'] != null + ? new MasterKeyModel.fromJson(json['selectedExamination']) + : null; + remark = json['remark']; + remark = json['isNormal']; + remark = json['isAbnormal']; + } + + Map toJson() { + final Map data = new Map(); + + if (this.selectedExamination != null) { + data['selectedExamination'] = this.selectedExamination.toJson(); + } + data['remark'] = this.remark; + data['isNormal'] = this.isNormal; + data['isAbnormal'] = this.isAbnormal; + return data; + } +} diff --git a/lib/models/SOAP/post_physical_exam_request_model.dart b/lib/models/SOAP/post_physical_exam_request_model.dart new file mode 100644 index 00000000..f9f23897 --- /dev/null +++ b/lib/models/SOAP/post_physical_exam_request_model.dart @@ -0,0 +1,99 @@ +import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; + +class PostPhysicalExamRequestModel { + List listHisProgNotePhysicalVM; + + PostPhysicalExamRequestModel({this.listHisProgNotePhysicalVM}); + + PostPhysicalExamRequestModel.fromJson(Map json) { + if (json['listHisProgNotePhysicalVM'] != null) { + listHisProgNotePhysicalVM = new List(); + json['listHisProgNotePhysicalVM'].forEach((v) { + listHisProgNotePhysicalVM + .add(new ListHisProgNotePhysicalVM.fromJson(v)); + }); + } + } + + Map toJson() { + final Map data = new Map(); + if (this.listHisProgNotePhysicalVM != null) { + data['listHisProgNotePhysicalVM'] = + this.listHisProgNotePhysicalVM.map((v) => v.toJson()).toList(); + } + return data; + } +} + +class ListHisProgNotePhysicalVM { + int episodeId; + int appointmentNo; + int examType; + int examId; + int patientMRN; + bool isNormal; + bool isAbnormal; + String remarks; + int createdBy; + String createdOn; + int editedBy; + String editedOn; + bool notExamined; + MasterKeyModel masterDescription; + + ListHisProgNotePhysicalVM( + {this.episodeId, + this.appointmentNo, + this.examType, + this.examId, + this.patientMRN, + this.isNormal, + this.isAbnormal, + this.remarks, + this.createdBy, + this.createdOn, + this.editedBy, + this.editedOn, + this.notExamined, + this.masterDescription}); + + ListHisProgNotePhysicalVM.fromJson(Map json) { + episodeId = json['episodeId']; + appointmentNo = json['appointmentNo']; + examType = json['examType']; + examId = json['examId']; + patientMRN = json['patientMRN']; + isNormal = json['isNormal']; + isAbnormal = json['isAbnormal']; + remarks = json['remarks']; + createdBy = json['createdBy']; + createdOn = json['createdOn']; + editedBy = json['editedBy']; + editedOn = json['editedOn']; + notExamined = json['notExamined']; + masterDescription = json['masterDescription'] != null + ? new MasterKeyModel.fromJson(json['masterDescription']) + : null; + } + + Map toJson() { + final Map data = new Map(); + data['episodeId'] = this.episodeId; + data['appointmentNo'] = this.appointmentNo; + data['examType'] = this.examType; + data['examId'] = this.examId; + data['patientMRN'] = this.patientMRN; + data['isNormal'] = this.isNormal; + data['isAbnormal'] = this.isAbnormal; + data['remarks'] = this.remarks; + data['createdBy'] = this.createdBy; + data['createdOn'] = this.createdOn; + data['editedBy'] = this.editedBy; + data['editedOn'] = this.editedOn; + data['notExamined'] = this.notExamined; + if (this.masterDescription != null) { + data['masterDescription'] = this.masterDescription.toJson(); + } + return data; + } +} \ No newline at end of file diff --git a/lib/widgets/patients/profile/SOAP/add_SOAP_index.dart b/lib/widgets/patients/profile/SOAP/add_SOAP_index.dart index 4e8c0873..705bc85f 100644 --- a/lib/widgets/patients/profile/SOAP/add_SOAP_index.dart +++ b/lib/widgets/patients/profile/SOAP/add_SOAP_index.dart @@ -2,6 +2,7 @@ import 'package:doctor_app_flutter/core/viewModel/doctor_replay_view_model.dart' import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; import 'package:doctor_app_flutter/models/SOAP/my_selected_allergy.dart'; +import 'package:doctor_app_flutter/models/SOAP/my_selected_examination.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; @@ -30,7 +31,7 @@ class _AddSOAPIndexState extends State int _currentIndex = 0; List myAllergiesList= List(); List myHistoryList = List(); - List myExaminationList = List(); + List mySelectedExamination = List(); changePageViewIndex(pageIndex) { _controller.jumpToPage(pageIndex); } @@ -154,7 +155,7 @@ class _AddSOAPIndexState extends State scrollDirection: Axis.horizontal, children: [ SubjectivePage(changePageViewIndex: changePageViewIndex,myAllergiesList: myAllergiesList,myHistoryList: myHistoryList,), - ObjectivePage(changePageViewIndex: changePageViewIndex,myExaminationList:myExaminationList), + ObjectivePage(changePageViewIndex: changePageViewIndex,mySelectedExamination:mySelectedExamination), AssessmentPage(changePageViewIndex: changePageViewIndex,), PlanPage(changePageViewIndex: changePageViewIndex,) ], diff --git a/lib/widgets/patients/profile/SOAP/objective_page.dart b/lib/widgets/patients/profile/SOAP/objective_page.dart index c3e8d5db..a1b91864 100644 --- a/lib/widgets/patients/profile/SOAP/objective_page.dart +++ b/lib/widgets/patients/profile/SOAP/objective_page.dart @@ -3,6 +3,7 @@ import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart'; import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/my_selected_examination.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/Text.dart'; @@ -19,9 +20,10 @@ import 'package:font_awesome_flutter/font_awesome_flutter.dart'; class ObjectivePage extends StatefulWidget { final Function changePageViewIndex; - final List myExaminationList; + final List mySelectedExamination; - ObjectivePage({Key key, this.changePageViewIndex, this.myExaminationList}); + ObjectivePage( + {Key key, this.changePageViewIndex, this.mySelectedExamination}); @override _ObjectivePageState createState() => _ObjectivePageState(); @@ -29,7 +31,6 @@ class ObjectivePage extends StatefulWidget { class _ObjectivePageState extends State { bool isSysExaminationExpand = false; - List examinationsList; TextEditingController remarksController = TextEditingController(); BoxDecoration containerBorderDecoration( @@ -124,7 +125,8 @@ class _ObjectivePageState extends State { height: 20, ), Column( - children: widget.myExaminationList.map((examination) { + children: + widget.mySelectedExamination.map((examination) { return Container( margin: EdgeInsets.only( left: 15, right: 15, top: 15), @@ -133,7 +135,10 @@ class _ObjectivePageState extends State { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Texts(examination.nameEn.toUpperCase(), + Texts( + examination + .selectedExamination.nameEn + .toUpperCase(), variant: "bodyText", bold: true, color: Colors.black) @@ -216,13 +221,14 @@ class _ObjectivePageState extends State { ], ), InkWell( - + child: Icon( FontAwesomeIcons.trash, color: Colors.grey, size: 20, ), - onTap: ()=>removeExamination(examination), + onTap: () => removeExamination( + examination.selectedExamination), ) ], ), @@ -277,13 +283,15 @@ class _ObjectivePageState extends State { } removeExamination(MasterKeyModel masterKey) { - Iterable history = widget.myExaminationList.where( + Iterable history = widget.mySelectedExamination + .where( (element) => - masterKey.id == element.id && masterKey.typeId == element.typeId); + masterKey.id == element.selectedExamination.id && + masterKey.typeId == element.selectedExamination.typeId); if (history.length > 0) setState(() { - widget.myExaminationList.remove(history.first); + widget.mySelectedExamination.remove(history.first); }); } @@ -321,7 +329,7 @@ class _ObjectivePageState extends State { context: context, builder: (context) { return AddExaminationDailog( - myExaminationList: widget.myExaminationList, + mySelectedExamination: widget.mySelectedExamination, addSelectedExamination: () { setState(() { Navigator.of(context).pop(); @@ -333,12 +341,12 @@ class _ObjectivePageState extends State { } class AddExaminationDailog extends StatefulWidget { - final List myExaminationList; + final List mySelectedExamination; final Function addSelectedExamination; final Function (MasterKeyModel) removeExamination; const AddExaminationDailog( - {Key key, this.myExaminationList, this.addSelectedExamination, this.removeExamination}) + {Key key, this.mySelectedExamination, this.addSelectedExamination, this.removeExamination}) : super(key: key); @override @@ -422,10 +430,13 @@ class _AddExaminationDailogState extends State { ); } else { + MySelectedExamination mySelectedExamination = new MySelectedExamination( + selectedExamination: examinationInfo + ); widget - .myExaminationList + .mySelectedExamination .add( - examinationInfo); + mySelectedExamination); } }); }), @@ -475,12 +486,13 @@ class _AddExaminationDailogState extends State { } isServiceSelected(MasterKeyModel masterKey) { - Iterable history = + Iterable exam = widget - .myExaminationList + .mySelectedExamination .where((element) => - masterKey.id == element.id && masterKey.typeId == element.typeId); - if (history.length > 0) { + masterKey.id == element.selectedExamination.id && + masterKey.typeId == element.selectedExamination.typeId); + if (exam.length > 0) { return true; } return false; From 26a25f44e09a41c7cf73a98f25018e1064a8866c Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Mon, 28 Dec 2020 10:42:24 +0200 Subject: [PATCH 13/21] fix error null thing --- lib/client/base_app_client.dart | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/client/base_app_client.dart b/lib/client/base_app_client.dart index 7aeeba29..2fda496a 100644 --- a/lib/client/base_app_client.dart +++ b/lib/client/base_app_client.dart @@ -93,8 +93,9 @@ class BaseAppClient { parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage']; if (parsed["ValidationErrors"] != null) { - error = - parsed["ValidationErrors"]["StatusMessage"].toString() + "\n"; + // TODO : return it back after check the StatusMessage it not null + // error = + // parsed["ValidationErrors"]["StatusMessage"].toString() + "\n"; if (parsed["ValidationErrors"]["ValidationErrors"] != null && parsed["ValidationErrors"]["ValidationErrors"].length != 0) { From 384c7cd58afd4918b05d31e1e7be045af4d2c4dd Mon Sep 17 00:00:00 2001 From: Sultan Khan Date: Mon, 28 Dec 2020 12:03:15 +0300 Subject: [PATCH 14/21] code merged --- lib/client/base_app_client.dart | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/lib/client/base_app_client.dart b/lib/client/base_app_client.dart index 4ac1325e..37c459e2 100644 --- a/lib/client/base_app_client.dart +++ b/lib/client/base_app_client.dart @@ -40,10 +40,10 @@ class BaseAppClient { String token = await sharedPref.getString(TOKEN); if (profile != null) { DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile); - body["VidaAuthTokenID"] = - "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIyODA0IiwianRpIjoiYzNhYWM3NTEtYjdlNS00NTBmLWI2N2ItMTYyNjA2MTJhOGM3IiwiZW1haWwiOiJNb2hhbWVkLlJlc3dhbkBjbG91ZHNvbHV0aW9uLXNhLmNvbSIsImlkIjoiMjgwNCIsIk5hbWUiOiJNVUhBTU1BRCBBWkFNIiwiRW1wbG95ZWVJZCI6IjE0ODUiLCJGYWNpbGl0eUdyb3VwSWQiOiIwMTAyNjYiLCJGYWNpbGl0eUlkIjoiMTUiLCJQaGFyYW1jeUZhY2lsaXR5SWQiOiI1NSIsIklTX1BIQVJNQUNZX0NPTk5FQ1RFRCI6IlRydWUiLCJEb2N0b3JJZCI6IjE0ODUiLCJTRVNTSU9OSUQiOiIyMTU3NjA3NSIsIkNsaW5pY0lkIjoiMyIsInJvbGUiOlsiU0VDVVJJVFkgQURNSU5JU1RSQVRPUlMiLCJTRVRVUCBBRE1JTklTVFJBVE9SUyIsIkNFTydTIiwiRVhFQ1VUSVZFIERJUkVDVE9SUyIsIk1BTkFHRVJTIiwiU1VQRVJWSVNPUlMiLCJDTElFTlQgU0VSVklDRVMgQ09PUkRJTkFUT1JTIiwiQ0xJRU5UIFNFUlZJQ0VTIFNVUEVSVklTT1JTIiwiQ0xJRU5UIFNFUlZJQ0VTIE1BTkdFUlMiLCJIRUFEIE5VUlNFUyIsIkRPQ1RPUlMiLCJDSElFRiBPRiBNRURJQ0FMIFNUQUZGUyIsIkJJTy1NRURJQ0FMIFRFQ0hOSUNJQU5TIiwiQklPLU1FRElDQUwgRU5HSU5FRVJTIiwiQklPLU1FRElDQUwgREVQQVJUTUVOVCBIRUFEUyIsIklUIEhFTFAgREVTSyIsIkFETUlOSVNUUkFUT1JTIiwiTEFCIEFETUlOSVNUUkFUT1IiLCJMQUIgVEVDSE5JQ0lBTiIsIkJVU0lORVNTIE9GRklDRSBTVEFGRiIsIkZJTkFOQ0UgQUNDT1VOVEFOVFMiLCJQSEFSTUFDWSBTVEFGRiIsIkFDQ09VTlRTIFNUQUZGIiwiTEFCIFJFQ0VQVElPTklTVCIsIkVSIE5VUlNFIiwiSU5QQVRJRU5UIEJJTExJTkcgU1VQRVJWSVNPUiIsIkxEUi1PUiBOVVJTRVMiLCJBRE1JU1NJT04gU1RBRkYiLCJIRUxQIERFU0sgQURNSU4iLCJBUFBST1ZBTCBTVEFGRiIsIklOUEFUSUVOVCBCSUxMSU5HIENPT1JESU5BVE9SIiwiQklMTElORyBTVEFGRiIsIkNPTlNFTlQgIiwiQ29uc2VudCAtIERlbnRhbCIsIldFQkVNUiJdLCJuYmYiOjE2MDgxMzY3ODMsImV4cCI6MTYwOTAwMDc4MywiaWF0IjoxNjA4MTM2NzgzfQ.8cb7axSSZUwbdzQ9AdTDaahtyhoVvAiDCXIGz4F-FuQ"; - body["VidaRefreshTokenID"] = - "hapR/0V/AljCVq/j49o4T7Bnee7hN295Xks54jo3ATEKZMqa8k9pXmbwDGycnz0Do6jk1W7YWFl6oy6aKfIjDA=="; + // body["VidaAuthTokenID"] = + // "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIyODA0IiwianRpIjoiYzNhYWM3NTEtYjdlNS00NTBmLWI2N2ItMTYyNjA2MTJhOGM3IiwiZW1haWwiOiJNb2hhbWVkLlJlc3dhbkBjbG91ZHNvbHV0aW9uLXNhLmNvbSIsImlkIjoiMjgwNCIsIk5hbWUiOiJNVUhBTU1BRCBBWkFNIiwiRW1wbG95ZWVJZCI6IjE0ODUiLCJGYWNpbGl0eUdyb3VwSWQiOiIwMTAyNjYiLCJGYWNpbGl0eUlkIjoiMTUiLCJQaGFyYW1jeUZhY2lsaXR5SWQiOiI1NSIsIklTX1BIQVJNQUNZX0NPTk5FQ1RFRCI6IlRydWUiLCJEb2N0b3JJZCI6IjE0ODUiLCJTRVNTSU9OSUQiOiIyMTU3NjA3NSIsIkNsaW5pY0lkIjoiMyIsInJvbGUiOlsiU0VDVVJJVFkgQURNSU5JU1RSQVRPUlMiLCJTRVRVUCBBRE1JTklTVFJBVE9SUyIsIkNFTydTIiwiRVhFQ1VUSVZFIERJUkVDVE9SUyIsIk1BTkFHRVJTIiwiU1VQRVJWSVNPUlMiLCJDTElFTlQgU0VSVklDRVMgQ09PUkRJTkFUT1JTIiwiQ0xJRU5UIFNFUlZJQ0VTIFNVUEVSVklTT1JTIiwiQ0xJRU5UIFNFUlZJQ0VTIE1BTkdFUlMiLCJIRUFEIE5VUlNFUyIsIkRPQ1RPUlMiLCJDSElFRiBPRiBNRURJQ0FMIFNUQUZGUyIsIkJJTy1NRURJQ0FMIFRFQ0hOSUNJQU5TIiwiQklPLU1FRElDQUwgRU5HSU5FRVJTIiwiQklPLU1FRElDQUwgREVQQVJUTUVOVCBIRUFEUyIsIklUIEhFTFAgREVTSyIsIkFETUlOSVNUUkFUT1JTIiwiTEFCIEFETUlOSVNUUkFUT1IiLCJMQUIgVEVDSE5JQ0lBTiIsIkJVU0lORVNTIE9GRklDRSBTVEFGRiIsIkZJTkFOQ0UgQUNDT1VOVEFOVFMiLCJQSEFSTUFDWSBTVEFGRiIsIkFDQ09VTlRTIFNUQUZGIiwiTEFCIFJFQ0VQVElPTklTVCIsIkVSIE5VUlNFIiwiSU5QQVRJRU5UIEJJTExJTkcgU1VQRVJWSVNPUiIsIkxEUi1PUiBOVVJTRVMiLCJBRE1JU1NJT04gU1RBRkYiLCJIRUxQIERFU0sgQURNSU4iLCJBUFBST1ZBTCBTVEFGRiIsIklOUEFUSUVOVCBCSUxMSU5HIENPT1JESU5BVE9SIiwiQklMTElORyBTVEFGRiIsIkNPTlNFTlQgIiwiQ29uc2VudCAtIERlbnRhbCIsIldFQkVNUiJdLCJuYmYiOjE2MDgxMzY3ODMsImV4cCI6MTYwOTAwMDc4MywiaWF0IjoxNjA4MTM2NzgzfQ.8cb7axSSZUwbdzQ9AdTDaahtyhoVvAiDCXIGz4F-FuQ"; + // body["VidaRefreshTokenID"] = + // "hapR/0V/AljCVq/j49o4T7Bnee7hN295Xks54jo3ATEKZMqa8k9pXmbwDGycnz0Do6jk1W7YWFl6oy6aKfIjDA=="; body['DoctorID'] = doctorProfile?.doctorID; body['EditedBy'] = doctorProfile?.doctorID; body['ProjectID'] = doctorProfile?.projectID; @@ -65,8 +65,8 @@ class BaseAppClient { body['IsLoginForDoctorApp'] = IS_LOGIN_FOR_DOCTOR_APP; body['PatientOutSA'] = 0; // PATIENT_OUT_SA; body['VidaAuthTokenID'] = await sharedPref.getString(VIDA_AUTH_TOKEN_ID); - body['VidaRefreshTokenID'] = await sharedPref.getString(VIDA_REFRESH_TOKEN_ID); - + body['VidaRefreshTokenID'] = + await sharedPref.getString(VIDA_REFRESH_TOKEN_ID); print("URL : $url"); print("Body : ${json.encode(body)}"); @@ -88,8 +88,7 @@ class BaseAppClient { // await helpers.logout(); onSuccess(parsed, statusCode); helpers.showErrorToast('Your session expired Please login agian'); - } else - if (parsed['MessageStatus'] == 1) { + } else if (parsed['MessageStatus'] == 1) { onSuccess(parsed, statusCode); } else { String error = @@ -98,17 +97,19 @@ class BaseAppClient { if (parsed["ValidationErrors"] != null) { if (parsed["ValidationErrors"]["ValidationErrors"] != null && parsed["ValidationErrors"]["ValidationErrors"].length != 0) { - error =''; + error = ''; for (var i = 0; i < parsed["ValidationErrors"]["ValidationErrors"].length; i++) { - error = error +parsed["ValidationErrors"]["ValidationErrors"][i]["Messages"][0] +"\n"; + error = error + + parsed["ValidationErrors"]["ValidationErrors"][i] + ["Messages"][0] + + "\n"; } } } - onFailure(error, - statusCode); + onFailure(error, statusCode); } } } else { From 18d58e70378f7d1e972756e7d23ac3d47aba6de5 Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Mon, 28 Dec 2020 11:07:52 +0200 Subject: [PATCH 15/21] remove is Auth for test target --- lib/client/base_app_client.dart | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/lib/client/base_app_client.dart b/lib/client/base_app_client.dart index 2fda496a..597de3b4 100644 --- a/lib/client/base_app_client.dart +++ b/lib/client/base_app_client.dart @@ -80,12 +80,12 @@ class BaseAppClient { onFailure('Error While Fetching data', statusCode); } else { var parsed = json.decode(response.body.toString()); - if (!parsed['IsAuthenticated']) { - // TODO: return it back when IsAuthenticated work fine in all service - // await helpers.logout(); - - helpers.showErrorToast('Your session expired Please login agian'); - } else + // if (!parsed['IsAuthenticated']) { + // // TODO: return it back when IsAuthenticated work fine in all service + // // await helpers.logout(); + // + // helpers.showErrorToast('Your session expired Please login agian'); + // } else if (parsed['MessageStatus'] == 1) { onSuccess(parsed, statusCode); } else { @@ -93,9 +93,8 @@ class BaseAppClient { parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage']; if (parsed["ValidationErrors"] != null) { - // TODO : return it back after check the StatusMessage it not null - // error = - // parsed["ValidationErrors"]["StatusMessage"].toString() + "\n"; + error = + parsed["ValidationErrors"]["StatusMessage"].toString() + "\n"; if (parsed["ValidationErrors"]["ValidationErrors"] != null && parsed["ValidationErrors"]["ValidationErrors"].length != 0) { From 1da12873c7c3f25af2e57a05a97bf197e5b5a19c Mon Sep 17 00:00:00 2001 From: Sultan Khan Date: Mon, 28 Dec 2020 12:52:02 +0300 Subject: [PATCH 16/21] dashboard --- lib/screens/dashboard_screen.dart | 40 +------------------------------ 1 file changed, 1 insertion(+), 39 deletions(-) diff --git a/lib/screens/dashboard_screen.dart b/lib/screens/dashboard_screen.dart index a8c2e014..b6bbc6cf 100644 --- a/lib/screens/dashboard_screen.dart +++ b/lib/screens/dashboard_screen.dart @@ -112,18 +112,6 @@ class _DashboardScreenState extends State { ) ], ), - Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - AppText( - 'Dr. ${authProvider.doctorProfile.doctorName}', - fontWeight: FontWeight.bold, - fontSize: - SizeConfig.textMultiplier * 2.5, - color: Colors.white, - ) - ], - ), SizedBox( height: 4, ), @@ -191,36 +179,12 @@ class _DashboardScreenState extends State { ), ], ), - Expanded( - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.end, - children: [ - Container( - decoration: BoxDecoration( - color: - Theme.of(context).backgroundColor, - borderRadius: BorderRadius.all( - Radius.circular(10.0), - ), - ), - height: 50, - width: 60, - child: Image.network( - authProvider - .doctorProfile.doctorImageURL, -// fit: BoxFit.fill, - ), - ), - ], - ), - ) ]), ), ), Container( color: Colors.white, - height: this.isExpanded ? 150 : 90, + height: this.isExpanded ? 150 : 110, ), ], ), @@ -1102,8 +1066,6 @@ class _DashboardScreenState extends State { } } -getSummaryResult(item) {} - // TODO Move to it file class DashboardItem extends StatelessWidget { const DashboardItem( From cde56a82f2b0601e7c73db92849ab70308dc758f Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Sat, 26 Dec 2020 20:05:30 +0200 Subject: [PATCH 17/21] Finish subjective --- lib/client/base_app_client.dart | 3 + lib/config/config.dart | 2 + lib/core/service/SOAP_service.dart | 32 ++- lib/core/service/base/lookup-service.dart | 1 + lib/core/viewModel/SOAP_view_model.dart | 22 ++ .../post_chief_complaint_request_model.dart | 48 ++++ .../SOAP/post_histories_request_model.dart | 64 +++++ .../SOAP/subjective/subjective_page.dart | 246 +++++++++++------- lib/widgets/shared/TextFields.dart | 2 +- lib/widgets/shared/app_buttons_widget.dart | 98 ++++--- 10 files changed, 390 insertions(+), 128 deletions(-) create mode 100644 lib/models/SOAP/post_chief_complaint_request_model.dart create mode 100644 lib/models/SOAP/post_histories_request_model.dart diff --git a/lib/client/base_app_client.dart b/lib/client/base_app_client.dart index db2c5e76..53117116 100644 --- a/lib/client/base_app_client.dart +++ b/lib/client/base_app_client.dart @@ -95,6 +95,9 @@ class BaseAppClient { parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage']; if (parsed["ValidationErrors"] != null) { + error = + parsed["ValidationErrors"]["StatusMessage"].toString() + "\n"; + if (parsed["ValidationErrors"]["ValidationErrors"] != null && parsed["ValidationErrors"]["ValidationErrors"].length != 0) { error = ''; diff --git a/lib/config/config.dart b/lib/config/config.dart index ff99729a..2c83235b 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -112,6 +112,8 @@ const GET_ALLERGIES = 'Services/DoctorApplication.svc/REST/GetAllergies'; const GET_MASTER_LOOKUP_LIST = 'Services/DoctorApplication.svc/REST/GetMasterLookUpList'; const POST_ALLERGY = 'Services/DoctorApplication.svc/REST/PostAllergies'; +const POST_HISTORY = 'Services/DoctorApplication.svc/REST/PostHistory'; +const POST_CHIEF_COMPLAINT = 'Services/DoctorApplication.svc/REST/PostChiefcomplaint'; var selectedPatientType = 1; diff --git a/lib/core/service/SOAP_service.dart b/lib/core/service/SOAP_service.dart index 56645184..1a8c91a1 100644 --- a/lib/core/service/SOAP_service.dart +++ b/lib/core/service/SOAP_service.dart @@ -1,14 +1,13 @@ import 'package:doctor_app_flutter/config/config.dart'; -import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart'; -import 'package:doctor_app_flutter/core/service/base/base_service.dart'; import 'package:doctor_app_flutter/models/SOAP/get_Allergies_request_model.dart'; import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; import 'package:doctor_app_flutter/models/SOAP/post_allergy_request_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/post_chief_complaint_request_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/post_histories_request_model.dart'; import 'base/lookup-service.dart'; class SOAPService extends LookupService { - Future getAllergies(GetAllergiesRequestModel getAllergiesRequestModel) async { await baseAppClient.post( GET_ALLERGIES, @@ -27,13 +26,38 @@ class SOAPService extends LookupService { } Future postAllergy(PostAllergyRequestModel postAllergyRequestModel) async { + hasError = false; await baseAppClient.post(POST_ALLERGY, onSuccess: (dynamic response, int statusCode) { - print("Success"); + print("Success"); }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; }, body: postAllergyRequestModel.toJson()); } + + Future postHistories( + PostHistoriesRequestModel postHistoriesRequestModel) async { + hasError = false; + await baseAppClient.post(POST_HISTORY, + onSuccess: (dynamic response, int statusCode) { + print("Success"); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: postHistoriesRequestModel.toJson()); + } + + Future postChiefComplaint( + PostChiefComplaintRequestModel postChiefComplaintRequestModel) async { + hasError = false; + await baseAppClient.post(POST_CHIEF_COMPLAINT, + onSuccess: (dynamic response, int statusCode) { + print("Success"); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: postChiefComplaintRequestModel.toJson()); + } } diff --git a/lib/core/service/base/lookup-service.dart b/lib/core/service/base/lookup-service.dart index ca794d91..fd008b26 100644 --- a/lib/core/service/base/lookup-service.dart +++ b/lib/core/service/base/lookup-service.dart @@ -29,6 +29,7 @@ class LookupService extends BaseService { List listOfPhysiotherapyGoals = []; Future getMasterLookup(MasterKeysService masterKeys) async { + hasError = false; Map body = { "MasterInput": masterKeys.getMasterKeyService() }; diff --git a/lib/core/viewModel/SOAP_view_model.dart b/lib/core/viewModel/SOAP_view_model.dart index 608b2e3d..5131e086 100644 --- a/lib/core/viewModel/SOAP_view_model.dart +++ b/lib/core/viewModel/SOAP_view_model.dart @@ -5,6 +5,8 @@ import 'package:doctor_app_flutter/models/SOAP/Allergy_model.dart'; import 'package:doctor_app_flutter/models/SOAP/get_Allergies_request_model.dart'; import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; import 'package:doctor_app_flutter/models/SOAP/post_allergy_request_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/post_chief_complaint_request_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/post_histories_request_model.dart'; import '../../locator.dart'; import 'base_view_model.dart'; @@ -60,5 +62,25 @@ class SOAPViewModel extends BaseViewModel { setState(ViewState.Idle); } + Future postHistories(PostHistoriesRequestModel postHistoriesRequestModel) async { + setState(ViewState.BusyLocal); + await _SOAPService.postHistories(postHistoriesRequestModel); + if (_SOAPService.hasError) { + error = _SOAPService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + + Future postChiefComplaint(PostChiefComplaintRequestModel postChiefComplaintRequestModel) async { + setState(ViewState.BusyLocal); + await _SOAPService.postChiefComplaint(postChiefComplaintRequestModel); + if (_SOAPService.hasError) { + error = _SOAPService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + } diff --git a/lib/models/SOAP/post_chief_complaint_request_model.dart b/lib/models/SOAP/post_chief_complaint_request_model.dart new file mode 100644 index 00000000..bedf2978 --- /dev/null +++ b/lib/models/SOAP/post_chief_complaint_request_model.dart @@ -0,0 +1,48 @@ +class PostChiefComplaintRequestModel { + int appointmentNo; + int episodeID; + int patientMRN; + String chiefComplaint; + String hopi; + String currentMedication; + bool ispregnant; + bool isLactation; + int numberOfWeeks; + + PostChiefComplaintRequestModel( + {this.appointmentNo, + this.episodeID, + this.patientMRN, + this.chiefComplaint, + this.hopi, + this.currentMedication, + this.ispregnant, + this.isLactation, + this.numberOfWeeks}); + + PostChiefComplaintRequestModel.fromJson(Map json) { + appointmentNo = json['AppointmentNo']; + episodeID = json['EpisodeID']; + patientMRN = json['PatientMRN']; + chiefComplaint = json['chiefComplaint']; + hopi = json['Hopi']; + currentMedication = json['CurrentMedication']; + ispregnant = json['ispregnant']; + isLactation = json['isLactation']; + numberOfWeeks = json['numberOfWeeks']; + } + + Map toJson() { + final Map data = new Map(); + data['AppointmentNo'] = this.appointmentNo; + data['EpisodeID'] = this.episodeID; + data['PatientMRN'] = this.patientMRN; + data['chiefComplaint'] = this.chiefComplaint; + data['Hopi'] = this.hopi; + data['CurrentMedication'] = this.currentMedication; + data['ispregnant'] = this.ispregnant; + data['isLactation'] = this.isLactation; + data['numberOfWeeks'] = this.numberOfWeeks; + return data; + } +} diff --git a/lib/models/SOAP/post_histories_request_model.dart b/lib/models/SOAP/post_histories_request_model.dart new file mode 100644 index 00000000..baa428fd --- /dev/null +++ b/lib/models/SOAP/post_histories_request_model.dart @@ -0,0 +1,64 @@ +class PostHistoriesRequestModel { + List listMedicalHistoryVM; + + PostHistoriesRequestModel({this.listMedicalHistoryVM}); + + PostHistoriesRequestModel.fromJson(Map json) { + if (json['listMedicalHistoryVM'] != null) { + listMedicalHistoryVM = new List(); + json['listMedicalHistoryVM'].forEach((v) { + listMedicalHistoryVM.add(new ListMedicalHistoryVM.fromJson(v)); + }); + } + } + + Map toJson() { + final Map data = new Map(); + if (this.listMedicalHistoryVM != null) { + data['listMedicalHistoryVM'] = + this.listMedicalHistoryVM.map((v) => v.toJson()).toList(); + } + return data; + } +} + +class ListMedicalHistoryVM { + int patientMRN; + int historyType; + int historyId; + int episodeId; + int appointmentNo; + bool isChecked; + String remarks; + + ListMedicalHistoryVM( + {this.patientMRN, + this.historyType, + this.historyId, + this.episodeId, + this.appointmentNo, + this.isChecked, + this.remarks}); + + ListMedicalHistoryVM.fromJson(Map json) { + patientMRN = json['patientMRN']; + historyType = json['historyType']; + historyId = json['historyId']; + episodeId = json['episodeId']; + appointmentNo = json['appointmentNo']; + isChecked = json['isChecked']; + remarks = json['remarks']; + } + + Map toJson() { + final Map data = new Map(); + data['patientMRN'] = this.patientMRN; + data['historyType'] = this.historyType; + data['historyId'] = this.historyId; + data['episodeId'] = this.episodeId; + data['appointmentNo'] = this.appointmentNo; + data['isChecked'] = this.isChecked; + data['remarks'] = this.remarks; + return data; + } +} diff --git a/lib/widgets/patients/profile/SOAP/subjective/subjective_page.dart b/lib/widgets/patients/profile/SOAP/subjective/subjective_page.dart index a78f6d0b..ae024b10 100644 --- a/lib/widgets/patients/profile/SOAP/subjective/subjective_page.dart +++ b/lib/widgets/patients/profile/SOAP/subjective/subjective_page.dart @@ -5,6 +5,8 @@ import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; import 'package:doctor_app_flutter/models/SOAP/my_selected_allergy.dart'; import 'package:doctor_app_flutter/models/SOAP/post_allergy_request_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/post_chief_complaint_request_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/post_histories_request_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/SOAP/subjective/add_allergies_widget.dart'; @@ -34,9 +36,9 @@ class _SubjectivePageState extends State { bool isChiefExpand = false; bool isHistoryExpand = false; bool isAllergiesExpand = false; - List myHistoryList = List(); TextEditingController illnessController = TextEditingController(); TextEditingController complaintsController = TextEditingController(); + final formKey = GlobalKey(); @override Widget build(BuildContext context) { @@ -83,56 +85,64 @@ class _SubjectivePageState extends State { isChiefExpand ? EvaIcons.minus : EvaIcons.plus)) ], ), - bodyWidget: Column(children: [ - SizedBox( - height: 20, - ), - Container( - margin: EdgeInsets.only(left: 10, right: 10, top: 15), - child: TextFields( - hintText: "Add Chief Complaints", - fontSize: 13.5, - // hintColor: Colors.black, - fontWeight: FontWeight.w600, - maxLines: 25, - minLines: 13, - controller: complaintsController, - validator: (value) { - if (value == null) - return TranslationBase - .of(context) - .emptyMessage; - else - return null; - }), - ), - SizedBox( - height: 20, - ), - Container( - margin: EdgeInsets.only(left: 10, right: 10, top: 15), - child: TextFields( - hintText: "History of Present Illness", - fontSize: 13.5, - // hintColor: Colors.black, - fontWeight: FontWeight.w600, - maxLines: 25, - minLines: 13, - controller: illnessController, - validator: (value) { - if (value == null) - return TranslationBase - .of(context) - .emptyMessage; - else - return null; - }), - ), - SizedBox( - height: 20, - ), - AddMedication(), - ]), + bodyWidget: Form( + key: formKey, + child: Column(children: [ + SizedBox( + height: 20, + ), + Container( + margin: EdgeInsets.only(left: 10, right: 10, top: 15), + child: TextFields( + hintText: "Add Chief Complaints", + fontSize: 13.5, + // hintColor: Colors.black, + fontWeight: FontWeight.w600, + maxLines: 25, + minLines: 13, + controller: complaintsController, + validator: (value) { + if (value == null || value =="") + return TranslationBase + .of(context) + .emptyMessage; + else if (value.length < 25) + return TranslationBase + .of(context) + .chiefComplaintLength; + //""; + else + return null; + }), + ), + SizedBox( + height: 20, + ), + Container( + margin: EdgeInsets.only(left: 10, right: 10, top: 15), + child: TextFields( + hintText: "History of Present Illness", + fontSize: 13.5, + // hintColor: Colors.black, + fontWeight: FontWeight.w600, + maxLines: 25, + minLines: 13, + controller: illnessController, + validator: (value) { + if (value == null || value =="") + return TranslationBase + .of(context) + .emptyMessage; + else + return null; + }), + ), + SizedBox( + height: 20, + ), + AddMedication(), + ]), + ), isExpand: isChiefExpand, ), @@ -177,7 +187,7 @@ class _SubjectivePageState extends State { ), bodyWidget: Column( children: [ - AddHistoryWidget(myHistoryList: myHistoryList) + AddHistoryWidget(myHistoryList: widget.myHistoryList) ], ), isExpand: isHistoryExpand, @@ -243,58 +253,118 @@ class _SubjectivePageState extends State { SizedBox( height: 30, ), - AppButton( - title: TranslationBase - .of(context) - .next, - - onPressed: () async { - addSubjectiveInfo(model: model, - myAllergiesList: widget.myAllergiesList, - myHistoryList: myHistoryList); - - }, - ), + AppButton( + title: TranslationBase.of(context).next, + loading: model.state == ViewState.BusyLocal, + onPressed: () async { + addSubjectiveInfo( + model: model, + myAllergiesList: widget.myAllergiesList, + myHistoryList: widget.myHistoryList); + }, + ), ], ), ), ), - ),),); + ), + ), + ); } addSubjectiveInfo( - {SOAPViewModel model, List myAllergiesList, List< - MasterKeyModel> myHistoryList }) async { - PostAllergyRequestModel postAllergyRequestModel = new PostAllergyRequestModel(); + {SOAPViewModel model, + List myAllergiesList, + List myHistoryList}) async { + await postChiefComplaint(model: model); + if (myHistoryList.length != 0) + await postHistories(model: model, myHistoryList: myHistoryList); + if (myAllergiesList.length != 0) + await postAllergy(myAllergiesList: myAllergiesList, model: model); + + widget.changePageViewIndex(1); + } + + postAllergy( + {List myAllergiesList, SOAPViewModel model}) async { + PostAllergyRequestModel postAllergyRequestModel = + new PostAllergyRequestModel(); widget.myAllergiesList.forEach((allergy) { - if(postAllergyRequestModel.listHisProgNotePatientAllergyDiseaseVM ==null) + if (postAllergyRequestModel.listHisProgNotePatientAllergyDiseaseVM == + null) postAllergyRequestModel.listHisProgNotePatientAllergyDiseaseVM = []; - postAllergyRequestModel.listHisProgNotePatientAllergyDiseaseVM.add( - ListHisProgNotePatientAllergyDiseaseVM( - allergyDiseaseId: allergy.selectedAllergy.id, - allergyDiseaseType: allergy.selectedAllergy.typeId, - patientMRN: 2500477, - episodeId: 200011502, - appointmentNo: 2016053271, - severity: allergy.selectedAllergySeverity.id, - remarks: allergy.remark, - createdBy: 1485, - createdOn: "2020-08-14T20:37:22.780Z", - editedBy: 1485, - editedOn: "2020-08-14T20:37:22.780Z", - isChecked: false, - isUpdatedByNurse: false - )); + //TODO: make static value dynamic + postAllergyRequestModel.listHisProgNotePatientAllergyDiseaseVM + .add(ListHisProgNotePatientAllergyDiseaseVM( + allergyDiseaseId: allergy.selectedAllergy.id, + allergyDiseaseType: allergy.selectedAllergy.typeId, + patientMRN: 3120690, + episodeId: 200012117, + appointmentNo: 2016054573, + severity: allergy.selectedAllergySeverity.id, + remarks: allergy.remark, + createdBy: 1485, + // + createdOn: "2020-08-14T20:37:22.780Z", + editedBy: 1485, + editedOn: "2020-08-14T20:37:22.780Z", + isChecked: false, + isUpdatedByNurse: false)); }); await model.postAllergy(postAllergyRequestModel); - if(model.state == ViewState.ErrorLocal) { + if (model.state == ViewState.ErrorLocal) { helpers.showErrorToast(model.error); } - widget.changePageViewIndex(1); + } - print(postAllergyRequestModel); + postHistories( + {List myHistoryList, SOAPViewModel model}) async { + PostHistoriesRequestModel postHistoriesRequestModel = + new PostHistoriesRequestModel(); + widget.myHistoryList.forEach((history) { + if (postHistoriesRequestModel.listMedicalHistoryVM == null) + postHistoriesRequestModel.listMedicalHistoryVM = []; + //TODO: make static value dynamic + postHistoriesRequestModel.listMedicalHistoryVM.add(ListMedicalHistoryVM( + patientMRN: 3120690, + episodeId: 200012117, + appointmentNo: 2016054573, + remarks: "", + historyId: history.id, + historyType: history.typeId, + isChecked: false, + )); + }); + await model.postHistories(postHistoriesRequestModel); + if (model.state == ViewState.ErrorLocal) { + helpers.showErrorToast(model.error); + } } + postChiefComplaint({SOAPViewModel model}) async { + formKey.currentState.save(); + if(formKey.currentState.validate()){ + PostChiefComplaintRequestModel postChiefComplaintRequestModel = + //TODO: make static value dynamic + new PostChiefComplaintRequestModel( + patientMRN: 3120690, + episodeID: 200012117, + appointmentNo: 2016054573, + chiefComplaint: complaintsController.text, + currentMedication: "currentMedication", + hopi: illnessController.text, + isLactation: false, + ispregnant: false, + numberOfWeeks: 22); + + await model.postChiefComplaint(postChiefComplaintRequestModel); + + if (model.state == ViewState.ErrorLocal) { + helpers.showErrorToast(model.error); + } + } + + } } diff --git a/lib/widgets/shared/TextFields.dart b/lib/widgets/shared/TextFields.dart index e41b4379..fec58e89 100644 --- a/lib/widgets/shared/TextFields.dart +++ b/lib/widgets/shared/TextFields.dart @@ -157,7 +157,7 @@ class _TextFieldsState extends State { : Icon(EvaIcons.search, size: 20.0, color: Colors.grey[500]), - errorStyle: TextStyle(fontSize: 14.0, fontWeight: widget.fontWeight, height: widget.borderOnlyError ? 0.0 : null), + errorStyle: TextStyle(fontSize: 12.0, fontWeight: widget.fontWeight, height: widget.borderOnlyError ? 0.0 : null), errorBorder: OutlineInputBorder( borderSide: BorderSide(color: Theme.of(context).errorColor.withOpacity(widget.bare ? 0.0 : 0.5 ), width: 2.0), borderRadius: BorderRadius.circular(widget.bare ? 0.0 : 8.0) diff --git a/lib/widgets/shared/app_buttons_widget.dart b/lib/widgets/shared/app_buttons_widget.dart index d01fe5af..85b0483d 100644 --- a/lib/widgets/shared/app_buttons_widget.dart +++ b/lib/widgets/shared/app_buttons_widget.dart @@ -14,50 +14,78 @@ class AppButton extends StatefulWidget { final Color color; final double fontSize; final double padding; + final bool loading; + final bool disabled; - AppButton({@required this.onPressed, this.title, this.icon, this.color, this.fontSize = 2, this.padding = 13}); + AppButton( + {@required this.onPressed, + this.title, + this.icon, + this.color, + this.fontSize = 2, + this.padding = 13, + this.loading = false, + this.disabled = false}); _AppButtonState createState() => _AppButtonState(); - } class _AppButtonState extends State{ @override Widget build(BuildContext context) { - return - RawMaterialButton( - fillColor: widget.color != null ? widget.color : HexColor("#B8382C"), - splashColor: widget.color, - child: Padding( - padding: EdgeInsets.only( - top: widget.padding, - bottom: widget.padding, - //right: SizeConfig.widthMultiplier * widget.padding, - //left: SizeConfig.widthMultiplier * widget.padding - ), - child: Row( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - if (widget.icon != null) - Icon( - widget.icon, - color: Colors.white, - ), - if (widget.icon != null) - SizedBox( - width: 5.0, - ), - AppText( - widget.title.toUpperCase(), - color: Colors.white, - fontSize: SizeConfig.textMultiplier * widget.fontSize , - ), - ], + return + IgnorePointer( + ignoring: widget.loading, + child: RawMaterialButton( + fillColor: widget.color != null ? widget.color : HexColor("#B8382C"), + splashColor: widget.color, + child: Padding( + padding: EdgeInsets.only( + top: widget.padding, + bottom: widget.padding, + //right: SizeConfig.widthMultiplier * widget.padding, + //left: SizeConfig.widthMultiplier * widget.padding + ), + child: Row( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + if (widget.icon != null) + Icon( + widget.icon, + color: Colors.white, + ), + if (widget.icon != null) + SizedBox( + width: 5.0, + ), + widget.loading + ? Padding( + padding: EdgeInsets.all(2.6), + child: SizedBox( + height: 19.0, + width: 19.0, + child: CircularProgressIndicator( + backgroundColor: Colors.white, + valueColor: + AlwaysStoppedAnimation( + Colors.grey[300], + ), + ), + ), + ) + : AppText( + widget.title.toUpperCase(), + color: Colors.white, + fontSize: SizeConfig.textMultiplier * widget.fontSize, + ), + ], + ), ), + onPressed: widget.onPressed, + shape: const RoundedRectangleBorder( + borderRadius: BorderRadius.all(Radius.circular(6))), ), - onPressed: widget.onPressed, - shape: const RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(6))), - ); + ); } } \ No newline at end of file From 4df3b1fb402cf22dadd735b3112ada948be04df7 Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Sat, 26 Dec 2020 20:53:27 +0200 Subject: [PATCH 18/21] First step from examination --- lib/core/service/base/lookup-service.dart | 49 +- lib/core/viewModel/SOAP_view_model.dart | 1 + .../patients/profile/SOAP/add_SOAP_index.dart | 3 +- .../patients/profile/SOAP/objective_page.dart | 624 +++++++++--------- 4 files changed, 330 insertions(+), 347 deletions(-) diff --git a/lib/core/service/base/lookup-service.dart b/lib/core/service/base/lookup-service.dart index fd008b26..ac03657b 100644 --- a/lib/core/service/base/lookup-service.dart +++ b/lib/core/service/base/lookup-service.dart @@ -5,7 +5,6 @@ import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; import 'base_service.dart'; class LookupService extends BaseService { - List listOfAllergies = []; List get allergySeverityList => _allergySeverityList; @@ -26,7 +25,7 @@ class LookupService extends BaseService { List get historySurgicalList => _historySurgicalList; List _historySurgicalList = []; - List listOfPhysiotherapyGoals = []; + List listOfPhysiotherapyGoals = []; Future getMasterLookup(MasterKeysService masterKeys) async { hasError = false; @@ -35,12 +34,12 @@ class LookupService extends BaseService { }; await baseAppClient.post(GET_MASTER_LOOKUP_LIST, onSuccess: (dynamic response, int statusCode) { - setMasterLookupInCorrectArray( - response['MasterLookUpList']['entityList'], masterKeys); - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, body: body); + setMasterLookupInCorrectArray( + response['MasterLookUpList']['entityList'], masterKeys); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); } setMasterLookupInCorrectArray(entryList, MasterKeysService masterKeys) { @@ -48,61 +47,57 @@ class LookupService extends BaseService { case MasterKeysService.Allergies: listOfAllergies.clear(); entryList.forEach((v) { - listOfAllergies - .add(MasterKeyModel.fromJson(v)); + listOfAllergies.add(MasterKeyModel.fromJson(v)); }); break; case MasterKeysService.HistoryFamily: _historyFamilyList.clear(); entryList.forEach((v) { - _historyFamilyList - .add(MasterKeyModel.fromJson(v)); + _historyFamilyList.add(MasterKeyModel.fromJson(v)); }); break; case MasterKeysService.HistoryMedical: _historyMedicalList.clear(); entryList.forEach((v) { - _historyMedicalList - .add(MasterKeyModel.fromJson(v)); + _historyMedicalList.add(MasterKeyModel.fromJson(v)); }); break; case MasterKeysService.HistorySocial: historySocialList.clear(); entryList.forEach((v) { - historySocialList - .add(MasterKeyModel.fromJson(v)); + historySocialList.add(MasterKeyModel.fromJson(v)); }); break; case MasterKeysService.HistorySports: _historySportList.clear(); entryList.forEach((v) { - _historySportList - .add(MasterKeyModel.fromJson(v)); - }); break; + _historySportList.add(MasterKeyModel.fromJson(v)); + }); + break; case MasterKeysService.HistorySurgical: _historySurgicalList.clear(); entryList.forEach((v) { - _historySurgicalList - .add(MasterKeyModel.fromJson(v)); + _historySurgicalList.add(MasterKeyModel.fromJson(v)); }); break; case MasterKeysService.PhysicalExamination: - return 59; + _physicalExaminationList.clear(); + entryList.forEach((v) { + _physicalExaminationList.add(MasterKeyModel.fromJson(v)); + }); break; case MasterKeysService.AllergySeverity: _allergySeverityList.clear(); entryList.forEach((v) { - _allergySeverityList - .add(MasterKeyModel.fromJson(v)); + _allergySeverityList.add(MasterKeyModel.fromJson(v)); }); break; case MasterKeysService.physiotherapyGoals: listOfPhysiotherapyGoals.clear(); entryList.forEach((v) { - listOfPhysiotherapyGoals - .add(MasterKeyModel.fromJson(v)); + listOfPhysiotherapyGoals.add(MasterKeyModel.fromJson(v)); }); break; } } -} \ No newline at end of file +} diff --git a/lib/core/viewModel/SOAP_view_model.dart b/lib/core/viewModel/SOAP_view_model.dart index 5131e086..3ff33389 100644 --- a/lib/core/viewModel/SOAP_view_model.dart +++ b/lib/core/viewModel/SOAP_view_model.dart @@ -29,6 +29,7 @@ class SOAPViewModel extends BaseViewModel { List get historySocialList => _SOAPService.historySocialList; List get historySurgicalList => _SOAPService.historySurgicalList; List get mergeHistorySurgicalWithHistorySportList => [...historySurgicalList,...historySportList]; + List get physicalExaminationList => _SOAPService.physicalExaminationList; diff --git a/lib/widgets/patients/profile/SOAP/add_SOAP_index.dart b/lib/widgets/patients/profile/SOAP/add_SOAP_index.dart index 9d75b22c..4e8c0873 100644 --- a/lib/widgets/patients/profile/SOAP/add_SOAP_index.dart +++ b/lib/widgets/patients/profile/SOAP/add_SOAP_index.dart @@ -30,6 +30,7 @@ class _AddSOAPIndexState extends State int _currentIndex = 0; List myAllergiesList= List(); List myHistoryList = List(); + List myExaminationList = List(); changePageViewIndex(pageIndex) { _controller.jumpToPage(pageIndex); } @@ -153,7 +154,7 @@ class _AddSOAPIndexState extends State scrollDirection: Axis.horizontal, children: [ SubjectivePage(changePageViewIndex: changePageViewIndex,myAllergiesList: myAllergiesList,myHistoryList: myHistoryList,), - ObjectivePage(changePageViewIndex: changePageViewIndex,), + ObjectivePage(changePageViewIndex: changePageViewIndex,myExaminationList:myExaminationList), AssessmentPage(changePageViewIndex: changePageViewIndex,), PlanPage(changePageViewIndex: changePageViewIndex,) ], diff --git a/lib/widgets/patients/profile/SOAP/objective_page.dart b/lib/widgets/patients/profile/SOAP/objective_page.dart index b2cd920f..c3e8d5db 100644 --- a/lib/widgets/patients/profile/SOAP/objective_page.dart +++ b/lib/widgets/patients/profile/SOAP/objective_page.dart @@ -1,4 +1,9 @@ import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart'; +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/Text.dart'; import 'package:doctor_app_flutter/widgets/shared/TextFields.dart'; @@ -7,15 +12,16 @@ 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/divider_with_spaces_around.dart'; import 'package:doctor_app_flutter/widgets/shared/expandable-widget-header-body.dart'; +import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; import 'package:eva_icons_flutter/eva_icons_flutter.dart'; import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; -import 'package:hexcolor/hexcolor.dart'; class ObjectivePage extends StatefulWidget { final Function changePageViewIndex; + final List myExaminationList; - ObjectivePage({Key key, this.changePageViewIndex}); + ObjectivePage({Key key, this.changePageViewIndex, this.myExaminationList}); @override _ObjectivePageState createState() => _ObjectivePageState(); @@ -117,115 +123,136 @@ class _ObjectivePageState extends State { SizedBox( height: 20, ), - Container( - margin: - EdgeInsets.only(left: 15, right: 15, top: 15), - child: Column( - children: [ - Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Texts('Abdomen'.toUpperCase(), - variant: "bodyText", - bold: true, - color: Colors.black) - ], - ), - SizedBox( - height: 8, - ), - Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ + Column( + children: widget.myExaminationList.map((examination) { + return Container( + margin: EdgeInsets.only( + left: 15, right: 15, top: 15), + child: Column(children: [ Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, children: [ - InkWell( - child: Center( - child: Container( - height: screenSize.height * 0.070, - decoration: containerBorderDecoration( - Colors.white,Colors.grey - ), - child: Center( - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Text( - "Normal", - style: TextStyle( - fontSize: 12, - color: - Colors.black, //Colors.black, - fontWeight: FontWeight.bold, + Texts(examination.nameEn.toUpperCase(), + variant: "bodyText", + bold: true, + color: Colors.black) + ], + ), + SizedBox( + height: 8, + ), + Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + InkWell( + child: Center( + child: Container( + height: + screenSize.height * + 0.070, + decoration: + containerBorderDecoration( + Colors.white, + Colors.grey), + child: Center( + child: Padding( + padding: + const EdgeInsets + .all(8.0), + child: Text( + "Normal", + style: TextStyle( + fontSize: 12, + color: + Colors.black, + //Colors.black, + fontWeight: + FontWeight + .bold, + ), + ), ), - ), - ), - )), + )), + ), + onTap: () {}), + SizedBox( + width: 12, ), - onTap: () { - - }), - SizedBox(width: 12,), - InkWell( - child: Center( - child: Container( - height: screenSize.height * 0.070, - decoration: containerBorderDecoration( - Color(0xFF515A5D), Colors.black - ), - child: Center( - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Text( - "Abnormal", - style: TextStyle( - fontSize: 12, - color: - Colors.white, //Colors.black, - fontWeight: FontWeight.bold, + InkWell( + child: Center( + child: Container( + height: + screenSize.height * + 0.070, + decoration: + containerBorderDecoration( + Color(0xFF515A5D), + Colors.black), + child: Center( + child: Padding( + padding: + const EdgeInsets + .all(8.0), + child: Text( + "Abnormal", + style: TextStyle( + fontSize: 12, + color: + Colors.white, + //Colors.black, + fontWeight: + FontWeight + .bold, + ), + ), ), - ), - ), - )), - ), - onTap: () { - - }), + )), + ), + onTap: () {}), + ], + ), + InkWell( + + child: Icon( + FontAwesomeIcons.trash, + color: Colors.grey, + size: 20, + ), + onTap: ()=>removeExamination(examination), + ) ], ), - Icon( - FontAwesomeIcons.trash, - color: Colors.grey, - size: 20, - ) - ], - ), - SizedBox( - height: 20, - ), - Container( - margin: EdgeInsets.only(left: 10, right: 10, top: 15), - child: TextFields( - hintText: "Remarks", - fontSize: 13.5, - // hintColor: Colors.black, - fontWeight: FontWeight.w600, - maxLines: 25, - minLines: 13, - controller: remarksController, - validator: (value) { - if (value == null) - return TranslationBase.of(context).emptyMessage; - else - return null; - }), - ), - SizedBox( - height: 20, - ), - ], - ), + SizedBox( + height: 20, + ), + Container( + margin: EdgeInsets.only( + left: 10, right: 10, top: 15), + child: TextFields( + hintText: "Remarks", + fontSize: 13.5, + // hintColor: Colors.black, + fontWeight: FontWeight.w600, + maxLines: 25, + minLines: 13, + controller: remarksController, + validator: (value) { + if (value == null) + return TranslationBase.of(context) + .emptyMessage; + else + return null; + }), + ), + SizedBox( + height: 20, + ), + ])); + }).toList(), ) ], ) @@ -249,10 +276,23 @@ class _ObjectivePageState extends State { )); } + removeExamination(MasterKeyModel masterKey) { + Iterable history = widget.myExaminationList.where( + (element) => + masterKey.id == element.id && masterKey.typeId == element.typeId); + + if (history.length > 0) + setState(() { + widget.myExaminationList.remove(history.first); + }); + } + openExaminationList(BuildContext context) { - final screenSize = MediaQuery.of(context).size; - InputDecoration textFieldSelectorDecoration( - String hintText, String selectedText, bool isDropDown) { + final screenSize = MediaQuery + .of(context) + .size; + InputDecoration textFieldSelectorDecoration(String hintText, + String selectedText, bool isDropDown) { return InputDecoration( focusedBorder: OutlineInputBorder( borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), @@ -275,228 +315,174 @@ class _ObjectivePageState extends State { ); } - ; showModalBottomSheet( backgroundColor: Colors.white, isScrollControlled: true, context: context, builder: (context) { - return FractionallySizedBox( - heightFactor: 0.7, - child: Container( - child: FractionallySizedBox( - widthFactor: 0.9, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - height: 16, - ), - AppText( - "Examinations", - fontWeight: FontWeight.bold, - fontSize: 16, - ), - SizedBox( - height: 16, - ), - Container( - height: MediaQuery.of(context).size.height * 0.5, - child: Center( - child: Container( - margin: EdgeInsets.only(top: 15), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12), - color: Colors.white), - child: ListView( - children: [ - Column( + return AddExaminationDailog( + myExaminationList: widget.myExaminationList, + addSelectedExamination: () { + setState(() { + Navigator.of(context).pop(); + }); + }, + removeExamination: (masterKey) => removeExamination(masterKey),); + }); + } +} + +class AddExaminationDailog extends StatefulWidget { + final List myExaminationList; + final Function addSelectedExamination; + final Function (MasterKeyModel) removeExamination; + + const AddExaminationDailog( + {Key key, this.myExaminationList, this.addSelectedExamination, this.removeExamination}) + : super(key: key); + + @override + _AddExaminationDailogState createState() => _AddExaminationDailogState(); +} + +class _AddExaminationDailogState extends State { + @override + Widget build(BuildContext context) { + return FractionallySizedBox( + heightFactor: 0.7, + child: BaseView( + onModelReady: (model) async { + if (model.physicalExaminationList.length == 0) { + await model.getMasterLookup( + MasterKeysService.PhysicalExamination); + } + }, + builder: (_, model, w) => + AppScaffold( + // baseViewModel: model, + isShowAppBar: false, + body: Center( + child: Container( + child: FractionallySizedBox( + widthFactor: 0.9, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ - Row( - children: [ - Checkbox( - value: true, - activeColor: Colors.red[800], - onChanged: (bool newValue) { - setState(() {}); - }), - Expanded( - child: Padding( - padding: const EdgeInsets.symmetric( - horizontal: 10, vertical: 0), - child: Texts('Examinations', - variant: "bodyText", - bold: true, - color: Colors.black), - ), - ), - ], - ), - DividerWithSpacesAround(), - Row( - children: [ - Checkbox( - value: true, - activeColor: Colors.red[800], - onChanged: (bool newValue) { - setState(() {}); - }), - Expanded( - child: Padding( - padding: const EdgeInsets.symmetric( - horizontal: 10, vertical: 0), - child: Texts('Examinations', - variant: "bodyText", - bold: true, - color: Colors.black), - ), - ), - ], - ), - DividerWithSpacesAround(), - Row( - children: [ - Checkbox( - value: true, - activeColor: Colors.red[800], - onChanged: (bool newValue) { - setState(() {}); - }), - Expanded( - child: Padding( - padding: const EdgeInsets.symmetric( - horizontal: 10, vertical: 0), - child: Texts('Examinations', - variant: "bodyText", - bold: true, - color: Colors.black), - ), - ), - ], - ), - DividerWithSpacesAround(), - Row( - children: [ - Checkbox( - value: true, - activeColor: Colors.red[800], - onChanged: (bool newValue) { - setState(() {}); - }), - Expanded( - child: Padding( - padding: const EdgeInsets.symmetric( - horizontal: 10, vertical: 0), - child: Texts('Examinations', - variant: "bodyText", - bold: true, - color: Colors.black), - ), - ), - ], + SizedBox( + height: 16, ), - DividerWithSpacesAround(), - Row( - children: [ - Checkbox( - value: true, - activeColor: Colors.red[800], - onChanged: (bool newValue) { - setState(() {}); - }), - Expanded( - child: Padding( - padding: const EdgeInsets.symmetric( - horizontal: 10, vertical: 0), - child: Texts('Examinations', - variant: "bodyText", - bold: true, - color: Colors.black), - ), - ), - ], + AppText( + "Examinations", + fontWeight: FontWeight.bold, + fontSize: 16, ), - DividerWithSpacesAround(), - Row( - children: [ - Checkbox( - value: true, - activeColor: Colors.red[800], - onChanged: (bool newValue) { - setState(() {}); - }), - Expanded( - child: Padding( - padding: const EdgeInsets.symmetric( - horizontal: 10, vertical: 0), - child: Texts('Examinations', - variant: "bodyText", - bold: true, - color: Colors.black), - ), - ), - ], + SizedBox( + height: 16, ), - DividerWithSpacesAround(), - Row( - children: [ - Checkbox( - value: true, - activeColor: Colors.red[800], - onChanged: (bool newValue) { - setState(() {}); - }), - Expanded( - child: Padding( - padding: const EdgeInsets.symmetric( - horizontal: 10, vertical: 0), - child: Texts('Examinations', - variant: "bodyText", - bold: true, - color: Colors.black), - ), - ), - ], + NetworkBaseView( + baseViewModel: model, + child: Container( + height: + MediaQuery + .of(context) + .size + .height * 0.5, + child: Center( + child: Container( + margin: EdgeInsets.only(top: 15), + decoration: BoxDecoration( + borderRadius: BorderRadius + .circular(12), + color: Colors.white), + child: ListView( + children: [ + Column( + children: model + .physicalExaminationList + .map((examinationInfo) { + return Column( + children: [ + Row( + children: [ + Checkbox( + value: isServiceSelected( + examinationInfo), + activeColor: + Colors.red[800], + onChanged: + ( + bool newValue) { + setState(() { + if (isServiceSelected( + examinationInfo + )) { + widget + .removeExamination( + examinationInfo + ); + } + else { + widget + .myExaminationList + .add( + examinationInfo); + } + }); + }), + Expanded( + child: Padding( + padding: + const EdgeInsets + .symmetric( + horizontal: 10, + vertical: 0), + child: Texts( + examinationInfo + .nameEn, + variant: "bodyText", + bold: true, + color: + Colors.black), + ), + ), + ], + ), + DividerWithSpacesAround(), + ], + ); + }).toList(), + ), + ], + ), + )), + ), ), - DividerWithSpacesAround(), - Row( - children: [ - Checkbox( - value: true, - activeColor: Colors.red[800], - onChanged: (bool newValue) { - setState(() {}); - }), - Expanded( - child: Padding( - padding: const EdgeInsets.symmetric( - horizontal: 10, vertical: 0), - child: Texts('Examinations', - variant: "bodyText", - bold: true, - color: Colors.black), - ), - ), - ], + SizedBox( + height: 10, ), - DividerWithSpacesAround(), - ], - ), - ], - ), - )), - ), - SizedBox( - height: 10, - ), - AppButton( - title: "Add SELECTED Examinations".toUpperCase(), - onPressed: () {}, - ), - ]), - )), - ); - }); + if (model.state == ViewState.Idle) + AppButton( + title: "Add SELECTED Examinations" + .toUpperCase(), + onPressed: () { + widget.addSelectedExamination(); + }, + ), + ]), + ))), + )), + ); } -} + isServiceSelected(MasterKeyModel masterKey) { + Iterable history = + widget + .myExaminationList + .where((element) => + masterKey.id == element.id && masterKey.typeId == element.typeId); + if (history.length > 0) { + return true; + } + return false; + } +} From a362901da8221a046ed59391bd77bae38f694d90 Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Sun, 27 Dec 2020 15:46:29 +0200 Subject: [PATCH 19/21] improve code inside my eam --- lib/models/SOAP/my_selected_examination.dart | 33 +++++++ .../post_physical_exam_request_model.dart | 99 +++++++++++++++++++ .../patients/profile/SOAP/add_SOAP_index.dart | 5 +- .../patients/profile/SOAP/objective_page.dart | 50 ++++++---- 4 files changed, 166 insertions(+), 21 deletions(-) create mode 100644 lib/models/SOAP/my_selected_examination.dart create mode 100644 lib/models/SOAP/post_physical_exam_request_model.dart diff --git a/lib/models/SOAP/my_selected_examination.dart b/lib/models/SOAP/my_selected_examination.dart new file mode 100644 index 00000000..3b6685c8 --- /dev/null +++ b/lib/models/SOAP/my_selected_examination.dart @@ -0,0 +1,33 @@ +import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; + +class MySelectedExamination { + MasterKeyModel selectedExamination; + String remark; + bool isNormal; + bool isAbnormal; + + MySelectedExamination( + {this.selectedExamination, this.remark, this.isNormal = true, this.isAbnormal = false}); + + MySelectedExamination.fromJson(Map json) { + + selectedExamination = json['selectedExamination'] != null + ? new MasterKeyModel.fromJson(json['selectedExamination']) + : null; + remark = json['remark']; + remark = json['isNormal']; + remark = json['isAbnormal']; + } + + Map toJson() { + final Map data = new Map(); + + if (this.selectedExamination != null) { + data['selectedExamination'] = this.selectedExamination.toJson(); + } + data['remark'] = this.remark; + data['isNormal'] = this.isNormal; + data['isAbnormal'] = this.isAbnormal; + return data; + } +} diff --git a/lib/models/SOAP/post_physical_exam_request_model.dart b/lib/models/SOAP/post_physical_exam_request_model.dart new file mode 100644 index 00000000..f9f23897 --- /dev/null +++ b/lib/models/SOAP/post_physical_exam_request_model.dart @@ -0,0 +1,99 @@ +import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; + +class PostPhysicalExamRequestModel { + List listHisProgNotePhysicalVM; + + PostPhysicalExamRequestModel({this.listHisProgNotePhysicalVM}); + + PostPhysicalExamRequestModel.fromJson(Map json) { + if (json['listHisProgNotePhysicalVM'] != null) { + listHisProgNotePhysicalVM = new List(); + json['listHisProgNotePhysicalVM'].forEach((v) { + listHisProgNotePhysicalVM + .add(new ListHisProgNotePhysicalVM.fromJson(v)); + }); + } + } + + Map toJson() { + final Map data = new Map(); + if (this.listHisProgNotePhysicalVM != null) { + data['listHisProgNotePhysicalVM'] = + this.listHisProgNotePhysicalVM.map((v) => v.toJson()).toList(); + } + return data; + } +} + +class ListHisProgNotePhysicalVM { + int episodeId; + int appointmentNo; + int examType; + int examId; + int patientMRN; + bool isNormal; + bool isAbnormal; + String remarks; + int createdBy; + String createdOn; + int editedBy; + String editedOn; + bool notExamined; + MasterKeyModel masterDescription; + + ListHisProgNotePhysicalVM( + {this.episodeId, + this.appointmentNo, + this.examType, + this.examId, + this.patientMRN, + this.isNormal, + this.isAbnormal, + this.remarks, + this.createdBy, + this.createdOn, + this.editedBy, + this.editedOn, + this.notExamined, + this.masterDescription}); + + ListHisProgNotePhysicalVM.fromJson(Map json) { + episodeId = json['episodeId']; + appointmentNo = json['appointmentNo']; + examType = json['examType']; + examId = json['examId']; + patientMRN = json['patientMRN']; + isNormal = json['isNormal']; + isAbnormal = json['isAbnormal']; + remarks = json['remarks']; + createdBy = json['createdBy']; + createdOn = json['createdOn']; + editedBy = json['editedBy']; + editedOn = json['editedOn']; + notExamined = json['notExamined']; + masterDescription = json['masterDescription'] != null + ? new MasterKeyModel.fromJson(json['masterDescription']) + : null; + } + + Map toJson() { + final Map data = new Map(); + data['episodeId'] = this.episodeId; + data['appointmentNo'] = this.appointmentNo; + data['examType'] = this.examType; + data['examId'] = this.examId; + data['patientMRN'] = this.patientMRN; + data['isNormal'] = this.isNormal; + data['isAbnormal'] = this.isAbnormal; + data['remarks'] = this.remarks; + data['createdBy'] = this.createdBy; + data['createdOn'] = this.createdOn; + data['editedBy'] = this.editedBy; + data['editedOn'] = this.editedOn; + data['notExamined'] = this.notExamined; + if (this.masterDescription != null) { + data['masterDescription'] = this.masterDescription.toJson(); + } + return data; + } +} \ No newline at end of file diff --git a/lib/widgets/patients/profile/SOAP/add_SOAP_index.dart b/lib/widgets/patients/profile/SOAP/add_SOAP_index.dart index 4e8c0873..705bc85f 100644 --- a/lib/widgets/patients/profile/SOAP/add_SOAP_index.dart +++ b/lib/widgets/patients/profile/SOAP/add_SOAP_index.dart @@ -2,6 +2,7 @@ import 'package:doctor_app_flutter/core/viewModel/doctor_replay_view_model.dart' import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; import 'package:doctor_app_flutter/models/SOAP/my_selected_allergy.dart'; +import 'package:doctor_app_flutter/models/SOAP/my_selected_examination.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; @@ -30,7 +31,7 @@ class _AddSOAPIndexState extends State int _currentIndex = 0; List myAllergiesList= List(); List myHistoryList = List(); - List myExaminationList = List(); + List mySelectedExamination = List(); changePageViewIndex(pageIndex) { _controller.jumpToPage(pageIndex); } @@ -154,7 +155,7 @@ class _AddSOAPIndexState extends State scrollDirection: Axis.horizontal, children: [ SubjectivePage(changePageViewIndex: changePageViewIndex,myAllergiesList: myAllergiesList,myHistoryList: myHistoryList,), - ObjectivePage(changePageViewIndex: changePageViewIndex,myExaminationList:myExaminationList), + ObjectivePage(changePageViewIndex: changePageViewIndex,mySelectedExamination:mySelectedExamination), AssessmentPage(changePageViewIndex: changePageViewIndex,), PlanPage(changePageViewIndex: changePageViewIndex,) ], diff --git a/lib/widgets/patients/profile/SOAP/objective_page.dart b/lib/widgets/patients/profile/SOAP/objective_page.dart index c3e8d5db..a1b91864 100644 --- a/lib/widgets/patients/profile/SOAP/objective_page.dart +++ b/lib/widgets/patients/profile/SOAP/objective_page.dart @@ -3,6 +3,7 @@ import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart'; import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/my_selected_examination.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/Text.dart'; @@ -19,9 +20,10 @@ import 'package:font_awesome_flutter/font_awesome_flutter.dart'; class ObjectivePage extends StatefulWidget { final Function changePageViewIndex; - final List myExaminationList; + final List mySelectedExamination; - ObjectivePage({Key key, this.changePageViewIndex, this.myExaminationList}); + ObjectivePage( + {Key key, this.changePageViewIndex, this.mySelectedExamination}); @override _ObjectivePageState createState() => _ObjectivePageState(); @@ -29,7 +31,6 @@ class ObjectivePage extends StatefulWidget { class _ObjectivePageState extends State { bool isSysExaminationExpand = false; - List examinationsList; TextEditingController remarksController = TextEditingController(); BoxDecoration containerBorderDecoration( @@ -124,7 +125,8 @@ class _ObjectivePageState extends State { height: 20, ), Column( - children: widget.myExaminationList.map((examination) { + children: + widget.mySelectedExamination.map((examination) { return Container( margin: EdgeInsets.only( left: 15, right: 15, top: 15), @@ -133,7 +135,10 @@ class _ObjectivePageState extends State { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Texts(examination.nameEn.toUpperCase(), + Texts( + examination + .selectedExamination.nameEn + .toUpperCase(), variant: "bodyText", bold: true, color: Colors.black) @@ -216,13 +221,14 @@ class _ObjectivePageState extends State { ], ), InkWell( - + child: Icon( FontAwesomeIcons.trash, color: Colors.grey, size: 20, ), - onTap: ()=>removeExamination(examination), + onTap: () => removeExamination( + examination.selectedExamination), ) ], ), @@ -277,13 +283,15 @@ class _ObjectivePageState extends State { } removeExamination(MasterKeyModel masterKey) { - Iterable history = widget.myExaminationList.where( + Iterable history = widget.mySelectedExamination + .where( (element) => - masterKey.id == element.id && masterKey.typeId == element.typeId); + masterKey.id == element.selectedExamination.id && + masterKey.typeId == element.selectedExamination.typeId); if (history.length > 0) setState(() { - widget.myExaminationList.remove(history.first); + widget.mySelectedExamination.remove(history.first); }); } @@ -321,7 +329,7 @@ class _ObjectivePageState extends State { context: context, builder: (context) { return AddExaminationDailog( - myExaminationList: widget.myExaminationList, + mySelectedExamination: widget.mySelectedExamination, addSelectedExamination: () { setState(() { Navigator.of(context).pop(); @@ -333,12 +341,12 @@ class _ObjectivePageState extends State { } class AddExaminationDailog extends StatefulWidget { - final List myExaminationList; + final List mySelectedExamination; final Function addSelectedExamination; final Function (MasterKeyModel) removeExamination; const AddExaminationDailog( - {Key key, this.myExaminationList, this.addSelectedExamination, this.removeExamination}) + {Key key, this.mySelectedExamination, this.addSelectedExamination, this.removeExamination}) : super(key: key); @override @@ -422,10 +430,13 @@ class _AddExaminationDailogState extends State { ); } else { + MySelectedExamination mySelectedExamination = new MySelectedExamination( + selectedExamination: examinationInfo + ); widget - .myExaminationList + .mySelectedExamination .add( - examinationInfo); + mySelectedExamination); } }); }), @@ -475,12 +486,13 @@ class _AddExaminationDailogState extends State { } isServiceSelected(MasterKeyModel masterKey) { - Iterable history = + Iterable exam = widget - .myExaminationList + .mySelectedExamination .where((element) => - masterKey.id == element.id && masterKey.typeId == element.typeId); - if (history.length > 0) { + masterKey.id == element.selectedExamination.id && + masterKey.typeId == element.selectedExamination.typeId); + if (exam.length > 0) { return true; } return false; From cd46b4317c29406d4da2ce26d59cec37aca6b223 Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Mon, 28 Dec 2020 10:42:24 +0200 Subject: [PATCH 20/21] fix error null thing --- lib/client/base_app_client.dart | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/client/base_app_client.dart b/lib/client/base_app_client.dart index 53117116..61fca62d 100644 --- a/lib/client/base_app_client.dart +++ b/lib/client/base_app_client.dart @@ -95,8 +95,9 @@ class BaseAppClient { parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage']; if (parsed["ValidationErrors"] != null) { - error = - parsed["ValidationErrors"]["StatusMessage"].toString() + "\n"; + // TODO : return it back after check the StatusMessage it not null + // error = + // parsed["ValidationErrors"]["StatusMessage"].toString() + "\n"; if (parsed["ValidationErrors"]["ValidationErrors"] != null && parsed["ValidationErrors"]["ValidationErrors"].length != 0) { From e6af5a3e39e92b26c2cb6a5392237df46b358c1a Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Mon, 28 Dec 2020 11:07:52 +0200 Subject: [PATCH 21/21] remove is Auth for test target --- lib/client/base_app_client.dart | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/client/base_app_client.dart b/lib/client/base_app_client.dart index 61fca62d..53117116 100644 --- a/lib/client/base_app_client.dart +++ b/lib/client/base_app_client.dart @@ -95,9 +95,8 @@ class BaseAppClient { parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage']; if (parsed["ValidationErrors"] != null) { - // TODO : return it back after check the StatusMessage it not null - // error = - // parsed["ValidationErrors"]["StatusMessage"].toString() + "\n"; + error = + parsed["ValidationErrors"]["StatusMessage"].toString() + "\n"; if (parsed["ValidationErrors"]["ValidationErrors"] != null && parsed["ValidationErrors"]["ValidationErrors"].length != 0) {