diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 089ff3b5..0a094b9b 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -703,4 +703,5 @@ const Map> localizedValues = { "addPrescription": {"en": "Add prescription", "ar": "إضافة الوصفات"}, "edit": {"en": "Edit", "ar": "تعديل"}, "summeryReply": {"en": "Summary Reply", "ar": "موجز الرد"}, + "finish": {"en": "Finish", "ar": "انهاء"}, }; diff --git a/lib/screens/patients/profile/soap_update/assessment/add_assessment_details.dart b/lib/screens/patients/profile/soap_update/assessment/add_assessment_details.dart index 8b9cf7b8..6f51fa40 100644 --- a/lib/screens/patients/profile/soap_update/assessment/add_assessment_details.dart +++ b/lib/screens/patients/profile/soap_update/assessment/add_assessment_details.dart @@ -18,6 +18,7 @@ import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/dialogs/master_key_dailog.dart'; +import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart'; import 'package:doctor_app_flutter/widgets/shared/text_fields/auto_complete_text_field.dart'; import 'package:doctor_app_flutter/widgets/shared/text_fields/text_fields_utils.dart'; @@ -254,6 +255,8 @@ class _AddAssessmentDetailsState extends State { MasterKeyDailog dialog = MasterKeyDailog( list: model.listOfDiagnosisCondition, okText: TranslationBase.of(context).ok, + selectedValue: widget.mySelectedAssessment.selectedDiagnosisCondition, + okFunction: (MasterKeyModel selectedValue) { setState(() { @@ -306,6 +309,7 @@ class _AddAssessmentDetailsState extends State { MasterKeyDailog dialog = MasterKeyDailog( list: model.listOfDiagnosisType, okText: TranslationBase.of(context).ok, + selectedValue: widget.mySelectedAssessment.selectedDiagnosisType, okFunction: (MasterKeyModel selectedValue) { setState(() { @@ -435,6 +439,7 @@ class _AddAssessmentDetailsState extends State { {SOAPViewModel model, MySelectedAssessment mySelectedAssessment, bool isUpdate = false}) async { + GifLoaderDialogUtils.showMyDialog(context); if (isUpdate) { PatchAssessmentReqModel patchAssessmentReqModel = PatchAssessmentReqModel( patientMRN: widget.patientInfo.patientMRN, @@ -465,8 +470,9 @@ class _AddAssessmentDetailsState extends State { await model.postAssessment(postAssessmentRequestModel); } - + GifLoaderDialogUtils.hideDialog(context); if (model.state == ViewState.ErrorLocal) { + Helpers.showErrorToast(model.error); } else { Map profile = await sharedPref.getObj(DOCTOR_PROFILE); @@ -474,10 +480,7 @@ class _AddAssessmentDetailsState extends State { DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile); mySelectedAssessment.icdCode10ID = mySelectedAssessment.selectedICD.code; mySelectedAssessment.doctorName = doctorProfile.doctorName; - - if (!isUpdate) { - widget.addSelectedAssessment(mySelectedAssessment, isUpdate); - } + widget.addSelectedAssessment(mySelectedAssessment, isUpdate); Navigator.of(context).pop(); } } diff --git a/lib/screens/patients/profile/soap_update/assessment/update_assessment_page.dart b/lib/screens/patients/profile/soap_update/assessment/update_assessment_page.dart index 1ab96170..f8da93f5 100644 --- a/lib/screens/patients/profile/soap_update/assessment/update_assessment_page.dart +++ b/lib/screens/patients/profile/soap_update/assessment/update_assessment_page.dart @@ -347,7 +347,7 @@ class _UpdateAssessmentPageState extends State { height: 6, ), AppText( - (assessment.remark != null || + (assessment.remark != null && assessment.remark != '') ? TranslationBase.of( @@ -546,6 +546,7 @@ class _UpdateAssessmentPageState extends State { addSelectedAssessment: (MySelectedAssessment mySelectedAssessment, bool isUpdate) async { setState(() { + if(!isUpdate) mySelectedAssessmentList.add(mySelectedAssessment); }); }); diff --git a/lib/screens/patients/profile/soap_update/plan/update_plan_page.dart b/lib/screens/patients/profile/soap_update/plan/update_plan_page.dart index 114b73d2..47165896 100644 --- a/lib/screens/patients/profile/soap_update/plan/update_plan_page.dart +++ b/lib/screens/patients/profile/soap_update/plan/update_plan_page.dart @@ -42,11 +42,14 @@ class UpdatePlanPage extends StatefulWidget { class _UpdatePlanPageState extends State { bool isAddProgress = true; bool isProgressExpanded = true; - GetPatientProgressNoteResModel patientProgressNote =GetPatientProgressNoteResModel(); + GetPatientProgressNoteResModel patientProgressNote = + GetPatientProgressNoteResModel(); - TextEditingController progressNoteController = TextEditingController(text: null); + TextEditingController progressNoteController = + TextEditingController(text: null); - BoxDecoration containerBorderDecoration(Color containerColor, Color borderColor) { + BoxDecoration containerBorderDecoration( + Color containerColor, Color borderColor) { return BoxDecoration( color: containerColor, shape: BoxShape.rectangle, @@ -72,22 +75,30 @@ class _UpdatePlanPageState extends State { Widget build(BuildContext context) { return BaseView( onModelReady: (model) async { - GetGetProgressNoteReqModel getGetProgressNoteReqModel = GetGetProgressNoteReqModel( - appointmentNo: int.parse(widget.patientInfo.appointmentNo.toString()), - patientMRN: widget.patientInfo.patientMRN, - episodeID: widget.patientInfo.episodeNo.toString(), - editedBy: '', - doctorID: ''); + GetGetProgressNoteReqModel getGetProgressNoteReqModel = + GetGetProgressNoteReqModel( + appointmentNo: + int.parse(widget.patientInfo.appointmentNo.toString()), + patientMRN: widget.patientInfo.patientMRN, + episodeID: widget.patientInfo.episodeNo.toString(), + editedBy: '', + doctorID: ''); await model.getPatientProgressNote(getGetProgressNoteReqModel); if (model.patientProgressNoteList.isNotEmpty) { - progressNoteController.text = Helpers.parseHtmlString(model.patientProgressNoteList[0].planNote); + progressNoteController.text = Helpers.parseHtmlString( + model.patientProgressNoteList[0].planNote); patientProgressNote.planNote = progressNoteController.text; - patientProgressNote.createdByName = model.patientProgressNoteList[0].createdByName; - patientProgressNote.createdOn = model.patientProgressNoteList[0].createdOn; - patientProgressNote.editedOn = model.patientProgressNoteList[0].editedOn; - patientProgressNote.editedByName = model.patientProgressNoteList[0].editedByName; - patientProgressNote.appointmentNo = model.patientProgressNoteList[0].appointmentNo; + patientProgressNote.createdByName = + model.patientProgressNoteList[0].createdByName; + patientProgressNote.createdOn = + model.patientProgressNoteList[0].createdOn; + patientProgressNote.editedOn = + model.patientProgressNoteList[0].editedOn; + patientProgressNote.editedByName = + model.patientProgressNoteList[0].editedByName; + patientProgressNote.appointmentNo = + model.patientProgressNoteList[0].appointmentNo; setState(() { isAddProgress = false; @@ -105,7 +116,9 @@ class _UpdatePlanPageState extends State { widthFactor: 0.90, child: Column( children: [ - SOAPStepHeader(currentIndex: widget.currentIndex, changePageViewIndex: widget.changePageViewIndex), + SOAPStepHeader( + currentIndex: widget.currentIndex, + changePageViewIndex: widget.changePageViewIndex), SizedBox( height: 10, ), @@ -124,33 +137,41 @@ class _UpdatePlanPageState extends State { children: [ if (isAddProgress) Container( - margin: EdgeInsets.only(left: 10, right: 10, top: 15), + margin: EdgeInsets.only( + left: 10, right: 10, top: 15), child: AppTextFieldCustom( - hintText: TranslationBase.of(context).progressNote, + hintText: TranslationBase.of(context) + .progressNote, controller: progressNoteController, minLines: 2, maxLines: 4, inputType: TextInputType.multiline, onChanged: (value) { - patientProgressNote.planNote = value; + setState(() { + patientProgressNote.planNote = value; + }); }, ), ), SizedBox( height: 9, ), - if (patientProgressNote.planNote != null && !isAddProgress) + if (patientProgressNote.planNote != null && + !isAddProgress) Container( margin: EdgeInsets.only( left: 5, right: 5, ), child: Column( - crossAxisAlignment: CrossAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.start, children: [ Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + crossAxisAlignment: + CrossAxisAlignment.start, children: [ Row( children: [ @@ -159,24 +180,39 @@ class _UpdatePlanPageState extends State { fontSize: 12, ), AppText( - patientProgressNote.appointmentNo.toString() ?? '', + patientProgressNote + .appointmentNo != + null + ? patientProgressNote + .appointmentNo + .toString() + : '', fontWeight: FontWeight.w600, + fontSize: 14, ), ], ), AppText( - patientProgressNote.createdOn != null - ? AppDateUtils.getDayMonthYearDateFormatted( - DateTime.parse(patientProgressNote.createdOn)) - : AppDateUtils.getDayMonthYearDateFormatted(DateTime.now()), + patientProgressNote.createdOn != + null + ? AppDateUtils + .getDayMonthYearDateFormatted( + DateTime.parse( + patientProgressNote + .createdOn)) + : AppDateUtils + .getDayMonthYearDateFormatted( + DateTime.now()), fontWeight: FontWeight.w600, fontSize: 14, ) ], ), Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + crossAxisAlignment: + CrossAxisAlignment.start, children: [ Row( children: [ @@ -184,15 +220,21 @@ class _UpdatePlanPageState extends State { 'Condition: ', fontSize: 12, ), - AppText(patientProgressNote.mName ?? '', + AppText( + patientProgressNote.mName ?? + '', fontWeight: FontWeight.w600), ], ), AppText( - patientProgressNote.createdOn != null + patientProgressNote.createdOn != + null ? AppDateUtils.getHour( - DateTime.parse(patientProgressNote.createdOn)) - : AppDateUtils.getHour(DateTime.now()), + DateTime.parse( + patientProgressNote + .createdOn)) + : AppDateUtils.getHour( + DateTime.now()), fontWeight: FontWeight.w600, fontSize: 14, ) @@ -202,7 +244,8 @@ class _UpdatePlanPageState extends State { height: 8, ), Row( - mainAxisAlignment: MainAxisAlignment.start, + mainAxisAlignment: + MainAxisAlignment.start, children: [ Expanded( child: AppText( @@ -214,7 +257,6 @@ class _UpdatePlanPageState extends State { onTap: () { setState(() { isAddProgress = true; - widget.changePageViewIndex(3, isChangeState: false); }); }, child: Icon( @@ -275,30 +317,38 @@ class _UpdatePlanPageState extends State { ), Expanded( child: AppButton( - title: TranslationBase.of(context).next, + title: isAddProgress + ? TranslationBase.of(context).next + : TranslationBase.of(context).finish, fontWeight: FontWeight.w600, color: Colors.red[700], - loading: model.state == ViewState.BusyLocal, disabled: progressNoteController.text.isEmpty, onPressed: () async { if (progressNoteController.text.isNotEmpty) { if (isAddProgress) { - Map profile = await sharedPref.getObj(DOCTOR_PROFILE); - DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile); + Map profile = + await sharedPref.getObj(DOCTOR_PROFILE); + DoctorProfileModel doctorProfile = + DoctorProfileModel.fromJson(profile); setState(() { patientProgressNote.createdByName = - patientProgressNote.createdByName ?? doctorProfile.doctorName; - patientProgressNote.editedByName = doctorProfile.doctorName; - patientProgressNote.createdOn = DateTime.now().toString(); - patientProgressNote.planNote = progressNoteController.text; - isAddProgress = !isAddProgress; + patientProgressNote.createdByName ?? + doctorProfile.doctorName; + patientProgressNote.editedByName = + doctorProfile.doctorName; + patientProgressNote.createdOn = + DateTime.now().toString(); + patientProgressNote.planNote = + progressNoteController.text; }); submitPlan(model); } else { Navigator.of(context).pop(); } } else { - Helpers.showErrorToast(TranslationBase.of(context).progressNoteErrorMsg); + Helpers.showErrorToast( + TranslationBase.of(context) + .progressNoteErrorMsg); } }, ), @@ -320,31 +370,32 @@ class _UpdatePlanPageState extends State { submitPlan(SOAPViewModel model) async { if (progressNoteController.text.isNotEmpty) { widget.changeLoadingState(true); - PostProgressNoteRequestModel postProgressNoteRequestModel = new PostProgressNoteRequestModel( - patientMRN: widget.patientInfo.patientMRN, - episodeId: widget.patientInfo.episodeNo, - appointmentNo: widget.patientInfo.appointmentNo, - planNote: patientProgressNote.planNote, - doctorID: '', - editedBy: ''); + PostProgressNoteRequestModel postProgressNoteRequestModel = + new PostProgressNoteRequestModel( + patientMRN: widget.patientInfo.patientMRN, + episodeId: widget.patientInfo.episodeNo, + appointmentNo: widget.patientInfo.appointmentNo, + planNote: patientProgressNote.planNote, + doctorID: '', + editedBy: ''); if (model.patientProgressNoteList.isEmpty) { await model.postProgressNote(postProgressNoteRequestModel); } else { Map profile = await sharedPref.getObj(DOCTOR_PROFILE); - DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile); postProgressNoteRequestModel.editedBy = doctorProfile.doctorID; await model.patchProgressNote(postProgressNoteRequestModel); } if (model.state == ViewState.ErrorLocal) { - Helpers.showErrorToast(model.error); } else { - widget.changePageViewIndex(4, isChangeState: false); - } + setState(() { + isAddProgress = !isAddProgress; + }); + } widget.changeLoadingState(false); } else { Helpers.showErrorToast(TranslationBase.of(context).progressNoteErrorMsg); diff --git a/lib/screens/patients/profile/soap_update/shared_soap_widgets/steps_widget.dart b/lib/screens/patients/profile/soap_update/shared_soap_widgets/steps_widget.dart index c5c2e8ca..e79c24a7 100644 --- a/lib/screens/patients/profile/soap_update/shared_soap_widgets/steps_widget.dart +++ b/lib/screens/patients/profile/soap_update/shared_soap_widgets/steps_widget.dart @@ -247,6 +247,8 @@ class StepsWidget extends StatelessWidget { "Plan", fontWeight: FontWeight.bold, fontSize: 12, + textAlign: TextAlign.end, + marginLeft: 25, ), StatusLabel( selectedStepId: index, @@ -530,20 +532,22 @@ class StatusLabel extends StatelessWidget { ), border: Border.all(color: HexColor('#707070'), width: 0.30), ), - child: AppText( - stepId == selectedStepId - ? "inProgress" - : stepId < selectedStepId - ? "Completed" - : " Locked ", - fontWeight: FontWeight.bold, - textAlign: TextAlign.center, - fontSize: 10, - color: stepId == selectedStepId - ? Color(0xFFCC9B14) - : stepId < selectedStepId - ? Color(0xFF359846) - : Color(0xFF969696), + child: Center( + child: AppText( + stepId == selectedStepId + ? "inProgress" + : stepId < selectedStepId + ? "Completed" + : "Locked", + fontWeight: FontWeight.bold, + textAlign: TextAlign.center, + fontSize: 10, + color: stepId == selectedStepId + ? Color(0xFFCC9B14) + : stepId < selectedStepId + ? Color(0xFF359846) + : Color(0xFF969696), + ), ), ); } diff --git a/lib/util/translations_delegate_base.dart b/lib/util/translations_delegate_base.dart index 165a9bb5..e30a006a 100644 --- a/lib/util/translations_delegate_base.dart +++ b/lib/util/translations_delegate_base.dart @@ -562,6 +562,7 @@ class TranslationBase { localizedValues['no-priscription-listed'][locale.languageCode]; String get next => localizedValues['next'][locale.languageCode]; + String get finish => localizedValues['finish'][locale.languageCode]; String get previous => localizedValues['previous'][locale.languageCode];