From 04f39315b5a6bfa32032b5b91d0cd5e20682c8cd Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Mon, 5 Apr 2021 11:26:28 +0300 Subject: [PATCH 1/2] finish doctor replay design --- lib/config/config.dart | 1 + lib/config/localized_values.dart | 3 + lib/core/service/doctor_reply_service.dart | 35 ++ .../viewModel/doctor_replay_view_model.dart | 11 + lib/screens/doctor/doctor_repaly_chat.dart | 330 ++++++++++++++++++ lib/screens/doctor/doctor_reply_screen.dart | 15 +- lib/util/translations_delegate_base.dart | 1 + 7 files changed, 394 insertions(+), 2 deletions(-) create mode 100644 lib/screens/doctor/doctor_repaly_chat.dart diff --git a/lib/config/config.dart b/lib/config/config.dart index 06768cbc..a8f7ef6e 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -247,6 +247,7 @@ const GET_PRESCRIPTION_REPORT_ENH = 'Services/Patients.svc/REST/GetPrescriptionReport_enh'; const GET_PHARMACY_LIST = "Services/Patients.svc/REST/GetPharmcyList"; + 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 94173b26..471c2b70 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -822,5 +822,8 @@ const Map> localizedValues = { },"replied": { "en": "Replied", "ar": " تم الرد" + },"typeHereToReply": { + "en": "Type here to reply", + "ar": "اكتب هنا للرد" }, }; diff --git a/lib/core/service/doctor_reply_service.dart b/lib/core/service/doctor_reply_service.dart index 5025037d..44fb2287 100644 --- a/lib/core/service/doctor_reply_service.dart +++ b/lib/core/service/doctor_reply_service.dart @@ -2,7 +2,10 @@ import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/core/model/hospitals_model.dart'; import 'package:doctor_app_flutter/core/service/base/base_service.dart'; import 'package:doctor_app_flutter/models/doctor/list_gt_my_patients_question_model.dart'; +import 'package:doctor_app_flutter/models/doctor/request_add_referred_doctor_remarks.dart'; import 'package:doctor_app_flutter/models/doctor/request_doctor_reply.dart'; +import 'package:doctor_app_flutter/models/patient/my_referral/my_referral_patient_model.dart'; +import 'package:doctor_app_flutter/models/patient/request_my_referral_patient_model.dart'; class DoctorReplyService extends BaseService { @@ -11,7 +14,11 @@ class DoctorReplyService extends BaseService { RequestDoctorReply _requestDoctorReply = RequestDoctorReply(); + List _listMyReferralPatientModel = []; + List get listMyReferralPatientModel => _listMyReferralPatientModel; + Future getDoctorReply() async { + hasError = false; await baseAppClient.post(GT_MY_PATIENT_QUESTION, onSuccess: (dynamic response, int statusCode) { _listDoctorWorkingHoursTable.clear(); @@ -24,4 +31,32 @@ class DoctorReplyService extends BaseService { super.error = error; }, body: _requestDoctorReply.toJson(),); } + + Future replay( + String referredDoctorRemarks, MyReferralPatientModel model) async { + RequestMyReferralPatientModel _requestMyReferralPatient = + RequestMyReferralPatientModel(); + RequestAddReferredDoctorRemarks _requestAddReferredDoctorRemarks = + RequestAddReferredDoctorRemarks(); + + _requestAddReferredDoctorRemarks.admissionNo = model.admissionNo; + _requestAddReferredDoctorRemarks.patientID = model.patientID; + _requestAddReferredDoctorRemarks.referredDoctorRemarks = + referredDoctorRemarks; + _requestAddReferredDoctorRemarks.lineItemNo = model.lineItemNo; + _requestAddReferredDoctorRemarks.referringDoctor = model.referringDoctor; + await baseAppClient.post( + ADD_REFERRED_DOCTOR_REMARKS, + body: _requestAddReferredDoctorRemarks.toJson(), + onSuccess: (dynamic body, int statusCode) { + model.referredDoctorRemarks = referredDoctorRemarks; + listMyReferralPatientModel[listMyReferralPatientModel.indexOf(model)] = + model; + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + ); + } } diff --git a/lib/core/viewModel/doctor_replay_view_model.dart b/lib/core/viewModel/doctor_replay_view_model.dart index 29d3b125..f010bf60 100644 --- a/lib/core/viewModel/doctor_replay_view_model.dart +++ b/lib/core/viewModel/doctor_replay_view_model.dart @@ -1,6 +1,7 @@ import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/service/doctor_reply_service.dart'; import 'package:doctor_app_flutter/models/doctor/list_gt_my_patients_question_model.dart'; +import 'package:doctor_app_flutter/models/patient/my_referral/my_referral_patient_model.dart'; import '../../locator.dart'; import 'base_view_model.dart'; @@ -19,4 +20,14 @@ class DoctorReplayViewModel extends BaseViewModel { } else setState(ViewState.Idle); } + + Future replay(String referredDoctorRemarks, MyReferralPatientModel model) async { + setState(ViewState.BusyLocal); + await _doctorReplyService.replay(referredDoctorRemarks, model); + if (_doctorReplyService.hasError) { + error = _doctorReplyService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } } diff --git a/lib/screens/doctor/doctor_repaly_chat.dart b/lib/screens/doctor/doctor_repaly_chat.dart new file mode 100644 index 00000000..35718793 --- /dev/null +++ b/lib/screens/doctor/doctor_repaly_chat.dart @@ -0,0 +1,330 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/viewModel/doctor_replay_view_model.dart'; +import 'package:doctor_app_flutter/models/doctor/list_gt_my_patients_question_model.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'; +import 'package:doctor_app_flutter/widgets/shared/TextFields.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_bg_widget.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:font_awesome_flutter/font_awesome_flutter.dart'; +import 'package:hexcolor/hexcolor.dart'; + +class DoctorReplayChat extends StatelessWidget { + + final ListGtMyPatientsQuestions reply; + TextEditingController msgController = TextEditingController(); + + DoctorReplayChat( + {Key key, this.reply, + }); + + @override + Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) async {}, + builder: (_, model, w) => AppScaffold( + baseViewModel: model, + isShowAppBar: false, + body: Container( + color: Color(0XFFF2F2F2), + child: Stack( + children: [ + Container( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + padding: EdgeInsets.only( + left: 0, right: 5, bottom: 5, top: 5), + decoration: BoxDecoration( + color: Colors.white, + ), + height: 150, + child: Container( + padding: EdgeInsets.only( + left: 10, right: 10, bottom: 10), + margin: EdgeInsets.only(top: 50), + child: Column( + children: [ + Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + RichText( + text: TextSpan( + style: TextStyle( + fontSize: 1.6 * + SizeConfig.textMultiplier, + color: Colors.black), + children: [ + new TextSpan( + text: reply.patientName + .toString(), + style: TextStyle( + color: Color(0xFF2B353E), + fontWeight: FontWeight.bold, + fontFamily: 'Poppins', + fontSize: 20)), + ], + ), + ), + InkWell( + onTap: () { + Navigator.pop(context); + }, + child: Icon(FontAwesomeIcons.times, + size: 30, + color: Color(0xFF2B353E))) + ], + ), + Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + InkWell( + onTap: () { + // TODO: move to doctor profile + }, + child: RichText( + text: TextSpan( + style: TextStyle( + fontSize: 1.6 * + SizeConfig.textMultiplier, + color: Colors.black), + children: [ + new TextSpan( + text: + 'Tap here to view patient profile' + .toString(), + style: TextStyle( + fontFamily: 'Poppins', + fontSize: 12)), + ], + ), + ), + ), + ], + ), + ], + ), + ), + ), + Expanded( + child: Padding( + padding: const EdgeInsets.all(16.0), + child: SingleChildScrollView( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + + SizedBox(height: 30,), + Container( + // color: Color(0xFF2B353E), + width: MediaQuery.of(context).size.width * 0.8, + padding: EdgeInsets.all(10), + decoration: BoxDecoration( + color: Color(0xFF2B353E), + borderRadius: BorderRadius.all( + Radius.circular(10.0), + ), + border: Border.all( + color: HexColor('#707070') , + width: 0.30), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + margin: EdgeInsets.only(top: 5), + width: 60, + height: 60, + child: Image.asset( + 1 == 1 + ? 'assets/images/male_avatar.png' + : 'assets/images/female_avatar.png', + fit: BoxFit.cover, + ), + ), + Column( + children: [ + AppText( + "07 Jan 2021", + fontSize: 2.5 * SizeConfig.textMultiplier, + fontFamily: 'Poppins', + color: Colors.white, + // fontSize: 18 + ), + AppText( + "07:00 PM", + fontSize: 2.5 * SizeConfig.textMultiplier, + fontFamily: 'Poppins', + color: Colors.white, + // fontSize: 18 + ), + ], + ), + ], + ), + SizedBox( + height: 10, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Column( + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: Container( + width: MediaQuery.of(context).size.width * 0.7, + child: AppText( + "This procedure should be taken only when the patient is below 99o", + fontSize: 15, + fontFamily: 'Poppins', + color: Colors.white, + // fontSize: 18 + ), + ), + ), + ], + ), + ], + ), + ], + ), + ), + SizedBox(height: 30,), + Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Container( + // color: Color(0xFF2B353E), + width: MediaQuery.of(context).size.width * 0.8, + padding: EdgeInsets.all(5), + decoration: BoxDecoration( + color: Colors.white,// Color(0xFF2B353E), + borderRadius: BorderRadius.all( + Radius.circular(10.0), + ), + border: Border.all( + color: HexColor('#707070') , + width: 0.30), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + margin: EdgeInsets.only(top: 5), + width: 60, + height: 60, + child: Image.asset( + 1 == 1 + ? 'assets/images/male_avatar.png' + : 'assets/images/female_avatar.png', + fit: BoxFit.cover, + ), + ), + Column( + children: [ + AppText( + "07 Jan 2021", + fontSize: 2.5 * SizeConfig.textMultiplier, + fontFamily: 'Poppins', + color: Color(0xFF2B353E), + // fontSize: 18 + ), + AppText( + "07:00 PM", + fontSize: 2.5 * SizeConfig.textMultiplier, + fontFamily: 'Poppins', + color: Color(0xFF2B353E), + // fontSize: 18 + ), + ], + ), + ], + ), + SizedBox( + height: 10, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Column( + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: Container( + width: MediaQuery.of(context).size.width * 0.7, + child: AppText( + "This procedure should be taken only when the patient is below 99o", + fontSize: 15, + fontFamily: 'Poppins', + color: Color(0xFF2B353E), + // fontSize: 18 + ), + ), + ), + ], + ), + ], + ), + ], + ), + ), + ], + ), + ], + ), + ), + ), + ) + ], + ), + ), + ], + ), + ), + bottomSheet: Container( + child:TextFields( + hasLabelText: msgController.text != '' + ? true + : false, + showLabelText: false, + hintText: TranslationBase + .of(context) + .typeHereToReply, + fontSize: 13.5, + suffixIcon: FontAwesomeIcons.arrowRight, + suffixIconColor: Colors.green, + // hintColor: Colors.black, + fontWeight: FontWeight.w600, + maxLines: 50, + minLines: 3, + controller: msgController, + validator: (value) { + if (value == null || value == "") + return TranslationBase.of(context) + .emptyMessage; + else + return null; + }), + height: MediaQuery.of(context).size.height * 0.1, + ), + )); + } +} diff --git a/lib/screens/doctor/doctor_reply_screen.dart b/lib/screens/doctor/doctor_reply_screen.dart index b57bd1a2..62d46d5e 100644 --- a/lib/screens/doctor/doctor_reply_screen.dart +++ b/lib/screens/doctor/doctor_reply_screen.dart @@ -1,5 +1,6 @@ import 'package:doctor_app_flutter/core/viewModel/doctor_replay_view_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/screens/doctor/doctor_repaly_chat.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/doctor/doctor_reply_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; @@ -18,7 +19,9 @@ class DoctorReplyScreen extends StatelessWidget { @override Widget build(BuildContext context) { return BaseView( - onModelReady: (model) => model.getDoctorReply(), + onModelReady: (model) { + model.getDoctorReply(); + }, builder: (_, model, w) => AppScaffold( baseViewModel: model, appBarTitle: TranslationBase.of(context).replay2, @@ -35,7 +38,15 @@ class DoctorReplyScreen extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: model.listDoctorWorkingHoursTable.map((reply) { - return DoctorReplyWidget(reply: reply); + return InkWell( + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (BuildContext context) => + DoctorReplayChat(reply: reply))); + }, + child: DoctorReplyWidget(reply: reply)); }).toList(), ) ], diff --git a/lib/util/translations_delegate_base.dart b/lib/util/translations_delegate_base.dart index 5ffdd939..1d47129d 100644 --- a/lib/util/translations_delegate_base.dart +++ b/lib/util/translations_delegate_base.dart @@ -1195,6 +1195,7 @@ class TranslationBase { String get sickLeave => localizedValues['sick_leave'][locale.languageCode]; String get unReplied => localizedValues['unReplied'][locale.languageCode]; String get replied => localizedValues['replied'][locale.languageCode]; + String get typeHereToReply => localizedValues['typeHereToReply'][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate { From e041538fb81d6e6364cb3bd8d338dd1219a975d3 Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Mon, 5 Apr 2021 11:33:15 +0300 Subject: [PATCH 2/2] small fix on schedule --- lib/widgets/doctor/my_schedule_widget.dart | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/lib/widgets/doctor/my_schedule_widget.dart b/lib/widgets/doctor/my_schedule_widget.dart index c28cc8d3..fca0e0b4 100644 --- a/lib/widgets/doctor/my_schedule_widget.dart +++ b/lib/widgets/doctor/my_schedule_widget.dart @@ -78,10 +78,18 @@ class MyScheduleWidget extends StatelessWidget { SizedBox( height: 5, ), - AppText( - work.from + ' - ' + work.to, - fontSize: 2.0 * SizeConfig.textMultiplier, - fontWeight: FontWeight.w300, + Container( + width: MediaQuery.of(context).size.width*0.55, + child: Expanded( + child: Padding( + padding: const EdgeInsets.all(8.0), + child: AppText( + work.from + ' - ' + work.to, + fontSize: 15, + fontWeight: FontWeight.w300, + ), + ), + ), ) ], ),