From 074bee8c4ca5d7b35eba8f59cc98ae47e01089b1 Mon Sep 17 00:00:00 2001 From: "taha.alam" Date: Wed, 6 Nov 2024 15:56:02 +0300 Subject: [PATCH] WD: plan and physical examination completed. --- assets/images/svgs/audit.svg | 4 + assets/images/svgs/delete.svg | 5 + assets/images/svgs/edit.svg | 4 + assets/images/svgs/resolve.svg | 4 + assets/images/svgs/save_as_draft.svg | 6 + lib/config/localized_values.dart | 15 + .../add_details_to_examination_vida_plus.dart | 233 +++++++++ .../add_examination_page_vida_plus.dart | 154 ++++++ .../add_examination_vida_plus_widget.dart | 318 ++++++++++++ ...inations_list_search_vida_plus_widget.dart | 129 +++++ .../objective/list_of_examination.dart | 59 +++ .../update_objective_page_vida_plus.dart | 389 +++++++++++++++ .../objective/widget/EmptyExamination.dart | 26 + .../objective/widget/examination_items.dart | 247 ++++++++++ .../plan/update_plan_page_vida_plus.dart | 457 ++++++++++++++++++ .../plan/widget/ProgressNoteItem.dart | 86 ++++ .../plan/widget/add_progress_note.dart | 65 +++ .../widget/add_progress_note_details.dart | 296 ++++++++++++ .../plan/widget/empty_progress_note.dart | 26 + .../plan/widget/list_of_notes.dart | 19 + .../allergies/update_allergies_widget.dart | 2 +- .../chief_complaint/chief_complaints.dart | 2 +- ...hief_complaint.dart => add_soap_item.dart} | 0 .../update_soap_index_vida_plus.dart | 26 +- .../widgets/SoapDetailItem.dart | 194 ++++++++ .../translations_delegate_base_utils.dart | 15 + .../text_fields/app-textfield-custom.dart | 73 ++- 27 files changed, 2828 insertions(+), 26 deletions(-) create mode 100644 assets/images/svgs/audit.svg create mode 100644 assets/images/svgs/delete.svg create mode 100644 assets/images/svgs/edit.svg create mode 100644 assets/images/svgs/resolve.svg create mode 100644 assets/images/svgs/save_as_draft.svg create mode 100644 lib/screens/patients/profile/soap_update_vida_plus/objective/add_details_to_examination_vida_plus.dart create mode 100644 lib/screens/patients/profile/soap_update_vida_plus/objective/add_examination_page_vida_plus.dart create mode 100644 lib/screens/patients/profile/soap_update_vida_plus/objective/add_examination_vida_plus_widget.dart create mode 100644 lib/screens/patients/profile/soap_update_vida_plus/objective/examinations_list_search_vida_plus_widget.dart create mode 100644 lib/screens/patients/profile/soap_update_vida_plus/objective/list_of_examination.dart create mode 100644 lib/screens/patients/profile/soap_update_vida_plus/objective/update_objective_page_vida_plus.dart create mode 100644 lib/screens/patients/profile/soap_update_vida_plus/objective/widget/EmptyExamination.dart create mode 100644 lib/screens/patients/profile/soap_update_vida_plus/objective/widget/examination_items.dart create mode 100644 lib/screens/patients/profile/soap_update_vida_plus/plan/update_plan_page_vida_plus.dart create mode 100644 lib/screens/patients/profile/soap_update_vida_plus/plan/widget/ProgressNoteItem.dart create mode 100644 lib/screens/patients/profile/soap_update_vida_plus/plan/widget/add_progress_note.dart create mode 100644 lib/screens/patients/profile/soap_update_vida_plus/plan/widget/add_progress_note_details.dart create mode 100644 lib/screens/patients/profile/soap_update_vida_plus/plan/widget/empty_progress_note.dart create mode 100644 lib/screens/patients/profile/soap_update_vida_plus/plan/widget/list_of_notes.dart rename lib/screens/patients/profile/soap_update_vida_plus/subjective/chief_complaint/widgets/{add_chief_complaint.dart => add_soap_item.dart} (100%) create mode 100644 lib/screens/patients/profile/soap_update_vida_plus/widgets/SoapDetailItem.dart diff --git a/assets/images/svgs/audit.svg b/assets/images/svgs/audit.svg new file mode 100644 index 00000000..7d46a569 --- /dev/null +++ b/assets/images/svgs/audit.svg @@ -0,0 +1,4 @@ + + + + diff --git a/assets/images/svgs/delete.svg b/assets/images/svgs/delete.svg new file mode 100644 index 00000000..7cdd0f32 --- /dev/null +++ b/assets/images/svgs/delete.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/assets/images/svgs/edit.svg b/assets/images/svgs/edit.svg new file mode 100644 index 00000000..586202aa --- /dev/null +++ b/assets/images/svgs/edit.svg @@ -0,0 +1,4 @@ + + + + diff --git a/assets/images/svgs/resolve.svg b/assets/images/svgs/resolve.svg new file mode 100644 index 00000000..0685e4a1 --- /dev/null +++ b/assets/images/svgs/resolve.svg @@ -0,0 +1,4 @@ + + + + diff --git a/assets/images/svgs/save_as_draft.svg b/assets/images/svgs/save_as_draft.svg new file mode 100644 index 00000000..a06e6b69 --- /dev/null +++ b/assets/images/svgs/save_as_draft.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index c59b691b..17fac19a 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -254,6 +254,7 @@ const Map> localizedValues = { "beingBad": {"en": "being bad", "ar": "سيء"}, "beingGreat": {"en": "being great", "ar": "رائع"}, "cancel": {"en": "CANCEL", "ar": "الغاء"}, + "cancelSmall": {"en": "Cancel", "ar": "الغاء"}, "ok": {"en": "OK", "ar": "موافق"}, "done": {"en": "DONE", "ar": "تأكيد"}, "resumecall": {"en": "Resume call", "ar": "استئناف المكالمة"}, @@ -1173,9 +1174,23 @@ const Map> localizedValues = { "previousChiefCompaints": {"en": "Previous Chief Compaints", "ar":"رئيس الرسامين السابق"}, "listOfActiveEpisodes": {"en": "List of active episodes , select one to procedd", "ar":"قائمة الحلقات النشطة ، حدد واحدة لتقديمها"}, "select": {"en": "Select", "ar":"اختار"}, + "resolve": {"en": "Resolve", "ar":"حسم"}, + "audit": {"en": "Audit", "ar":"مراجعه الحسابات"}, + "delete": {"en": "Delete", "ar":"حذف"}, + "progressNoteType": {"en": "Progress Note Type", "ar":"نوع ملاحظة التقدم"}, + "doctorProgressNote": {"en": "Doctor Progress Note", "ar":"مذكرة تقدم الطبيب"}, + "addYourNote": {"en": "Add Your Note", "ar":"أضف ملاحظتك"}, + "saveAsDraft": {"en": "Save As Draft", "ar":"حفظ كمسودة"}, + "nurseNote": {"en": "Nurse Note", "ar":"ملاحظة الممرضة"}, + "patientCondition": {"en": "Patient Condition", "ar":"حالة المريض"}, + "examinationPart": {"en": "Examination Part", "ar":"جزء الامتحان"}, "historyOfIllness": {"en": "History of Present Illness*", "ar":"تاريخ المرض الحالي*"}, "historyTakenFrom": {"en": "History taken from", "ar":"التاريخ مأخوذ من"}, "familySpecify": {"en": "Family, Specify", "ar":"العائلة، حدد"}, "otherSpecify": {"en": "Other, Specify", "ar":"أخرى، حدد"}, + "physicalExamination": {"en": "Physical Examination", "ar":"الفحص البدني"}, + "addPhysicalExamination": {"en": "Add Physical Examination", "ar":"إضافة الفحص البدني"}, + "noPhysicalExamination": {"en": "No Physical Examination added, please add it from the button above", "ar":"لم يتم إضافة فحص بدني ، يرجى إضافته من الزر أعلاه"}, + "noProgressNote": {"en": "No Diagnosis added, please add it from the button above", "ar":"لم يتم إضافة تشخيص ، يرجى إضافته من الزر أعلاه"}, }; diff --git a/lib/screens/patients/profile/soap_update_vida_plus/objective/add_details_to_examination_vida_plus.dart b/lib/screens/patients/profile/soap_update_vida_plus/objective/add_details_to_examination_vida_plus.dart new file mode 100644 index 00000000..c310ddc7 --- /dev/null +++ b/lib/screens/patients/profile/soap_update_vida_plus/objective/add_details_to_examination_vida_plus.dart @@ -0,0 +1,233 @@ +import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart'; +import 'package:doctor_app_flutter/core/model/SOAP/selected_items/my_selected_examination.dart'; +import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/screens/patients/patient_search/patient_search_header.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/soap_update/shared_soap_widgets/expandable_SOAP_widget.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/soap_update_vida_plus/objective/widget/examination_items.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/soap_update_vida_plus/subjective/chief_complaint/widgets/add_soap_item.dart'; +import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.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:provider/provider.dart'; + +import '../../../../../core/viewModel/project_view_model.dart'; + +class AddDetailsToExaminationVidaPlus extends StatefulWidget { + final List? mySelectedExamination; + + const AddDetailsToExaminationVidaPlus({super.key, this.mySelectedExamination}); + + @override + State createState() => + _AddDetailsToExaminationVidaPlusState(); +} + +class _AddDetailsToExaminationVidaPlusState extends State { + bool isSysExaminationExpand = false; + + @override + Widget build(BuildContext context) { + print('the widget is build'); + ProjectViewModel projectViewModel = Provider.of(context); + return BaseView( + onModelReady: (model) async {}, + builder: (_, model, w) => AppScaffold( + baseViewModel: model, + isShowAppBar: true, + appBar: PatientSearchHeader( + title: TranslationBase.of(context).examinationPart), + backgroundColor: Colors.white, + body: Padding( + padding: const EdgeInsets.all(20.0), + child: Column( + children: [ + Expanded( + child: ListView.separated( + itemBuilder: (context, index) { + return ExpandableSOAPWidget( + headerTitle: + projectViewModel.isArabic + ? widget.mySelectedExamination![index].selectedExamination!.nameAr != null && widget.mySelectedExamination![index].selectedExamination!.nameAr != "" + ? widget.mySelectedExamination![index].selectedExamination!.nameAr! + : widget.mySelectedExamination![index].selectedExamination!.nameEn! + : widget.mySelectedExamination![index].selectedExamination!.nameEn!, + onTap: () { + setState(() { + isSysExaminationExpand = !isSysExaminationExpand; + }); + }, + child: ExaminationItems(examination:widget.mySelectedExamination![index]), + isExpanded: isSysExaminationExpand, + ); + + }, + separatorBuilder: (context, index) { + return SizedBox(height: 8,); + }, + itemCount: widget?.mySelectedExamination?.length ?? 0), + ), + ], + ), + ))); + } +} + + + + + +/* Container( + padding: EdgeInsets.symmetric(horizontal: 12), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + margin: EdgeInsets.only(bottom: 8), + child: AppText( + TranslationBase.of(context).status, + fontWeight: FontWeight.bold, + fontFamily: 'Poppins', + fontSize: SizeConfig.textMultiplier! * 1.6, + ), + ), + Row( + children: [ + Expanded( + child: InkWell( + onTap: () { + setState(() { + status = 1; + }); + examination.isNormal = true; + examination.isAbnormal = false; + examination.notExamined = false; + }, + child: Row( + children: [ + Container( + padding: EdgeInsets.all(2.0), + margin: EdgeInsets.symmetric(horizontal: 6), + width: 20, + height: 20, + decoration: BoxDecoration( + color: Colors.white, + shape: BoxShape.circle, + border: Border.all(color: Colors.grey, width: 1), + ), + child: Container( + decoration: BoxDecoration( + color: status == 1 ? HexColor("#D02127") : Colors.white, + shape: BoxShape.circle, + ), + ), + ), + AppText( + TranslationBase.of(context).normal, + fontWeight: FontWeight.normal, + fontFamily: 'Poppins', + fontSize: SizeConfig.textMultiplier! * 1.6, + ), + ], + ), + )), + Expanded( + child: InkWell( + onTap: () { + setState(() { + status = 2; + }); + examination.isNormal = false; + examination.isAbnormal = true; + examination.notExamined = false; + }, + child: Row( + children: [ + Container( + padding: EdgeInsets.all(2.0), + margin: EdgeInsets.symmetric(horizontal: 6), + width: 20, + height: 20, + decoration: BoxDecoration( + color: Colors.white, + shape: BoxShape.circle, + border: Border.all(color: Colors.grey, width: 1), + ), + child: Container( + decoration: BoxDecoration( + color: status == 2 ? HexColor("#D02127") : Colors.white, + shape: BoxShape.circle, + ), + ), + ), + AppText( + TranslationBase.of(context).abnormal, + fontWeight: FontWeight.normal, + fontFamily: 'Poppins', + fontSize: SizeConfig.textMultiplier! * 1.6, + ), + ], + ), + )), + if (!examination.isLocal) + Expanded( + child: InkWell( + onTap: () { + setState(() { + status = 3; + }); + examination.isNormal = false; + examination.isAbnormal = false; + examination.notExamined = true; + }, + child: Row( + children: [ + Container( + padding: EdgeInsets.all(2.0), + margin: EdgeInsets.symmetric(horizontal: 6), + width: 20, + height: 20, + decoration: BoxDecoration( + color: Colors.white, + shape: BoxShape.circle, + border: Border.all(color: Colors.grey, width: 1), + ), + child: Container( + decoration: BoxDecoration( + color: status == 3 ? HexColor("#D02127") : Colors.white, + shape: BoxShape.circle, + ), + ), + ), + Expanded( + child: AppText( + TranslationBase.of(context).notExamined, + fontWeight: FontWeight.normal, + fontFamily: 'Poppins', + fontSize: SizeConfig.textMultiplier! * 1.6, + ), + ), + ], + ), + )), + ], + ), + Container( + margin: EdgeInsets.only(top: 8), + child: AppTextFieldCustom( + hintText: TranslationBase.of(context).remarks, + controller: remarksController, + minLines: 2, + maxLines: 4, + inputType: TextInputType.multiline, + onChanged: (value) { + examination.remark = value; + }, + onClick: () {}, + onFieldSubmitted: () {}, + ), + ), + ], + ), + );*/ \ No newline at end of file diff --git a/lib/screens/patients/profile/soap_update_vida_plus/objective/add_examination_page_vida_plus.dart b/lib/screens/patients/profile/soap_update_vida_plus/objective/add_examination_page_vida_plus.dart new file mode 100644 index 00000000..9b2c73a2 --- /dev/null +++ b/lib/screens/patients/profile/soap_update_vida_plus/objective/add_examination_page_vida_plus.dart @@ -0,0 +1,154 @@ +import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart'; +import 'package:doctor_app_flutter/core/model/SOAP/master_key_model.dart'; +import 'package:doctor_app_flutter/core/model/SOAP/selected_items/my_selected_examination.dart'; +import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/screens/patients/patient_search/patient_search_header.dart'; +import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart'; +import 'package:flutter/material.dart'; + +import 'examinations_list_search_vida_plus_widget.dart'; + +class AddExaminationPageVidaPlus extends StatefulWidget { + final List? mySelectedExamination; + final Function(List) addSelectedExamination; + final Function(MasterKeyModel) removeExamination; + + AddExaminationPageVidaPlus( + {this.mySelectedExamination, + required this.addSelectedExamination, + required this.removeExamination}); + + @override + _AddExaminationPageVidaPlusState createState() => + _AddExaminationPageVidaPlusState(); +} + +class _AddExaminationPageVidaPlusState + extends State { + List mySelectedExaminationLocal = []; + + @override + initState() { + super.initState(); + mySelectedExaminationLocal = widget.mySelectedExamination!; + } + + @override + Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) async { + if (model.physicalExaminationList.length == 0) { + WidgetsBinding.instance.addPostFrameCallback((_) async { + await model.getMasterLookup( + MasterKeysService.PhysicalExamination, + ); + }); + } + }, + builder: (_, model, w) => AppScaffold( + baseViewModel: model, + isShowAppBar: true, + appBar: PatientSearchHeader( + title: TranslationBase.of(context).examinationPart), + backgroundColor: Colors.white, + body: Column( + mainAxisAlignment: MainAxisAlignment.start, + mainAxisSize: MainAxisSize.max, + children: [ + Flexible( + child: Padding( + padding: const EdgeInsets.all(16.0), + child: Material( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10), + side: BorderSide( + width: 1, + color: Color(0xFFEFEFEF), + )), + color: Colors.white, + child: Padding( + padding: const EdgeInsets.all(16.0), + child: SingleChildScrollView( + child: Column( + mainAxisSize: MainAxisSize.max, + children: [ + ExaminationsListSearchVidaPlusWidget( + mySelectedExamination: widget.mySelectedExamination, + masterList: model.physicalExaminationList, + isServiceSelected: (master) => + isServiceSelected(master), + removeExamination: (selectedExamination) { + setState(() { + mySelectedExaminationLocal + .remove(selectedExamination); + }); + }, + addExamination: (selectedExamination) { + mySelectedExaminationLocal.insert( + 0, selectedExamination); + //setState(() {}); + }, + ), + ], + ), + ), + ), + ), + ), + ), + ], + ), + bottomNavigationBar: Material( + color: Colors.white, + child: Padding( + padding: const EdgeInsets.all(16.0), + child: Row( + children: [ + Expanded( + child: AppButton( + title: TranslationBase.of(context).cancelSmall, + color: Color(0xffEAEAEA), + fontColor: Colors.black, + fontWeight: FontWeight.w600, + onPressed: () async { + Navigator.pop(context); + }, + ), + ), + SizedBox( + width: 10, + ), + Expanded( + child: AppButton( + title: TranslationBase.of(context).next, + color: Color(0xffD02127), + fontColor: Colors.white, + fontWeight: FontWeight.w600, + onPressed: () async { + Navigator.pop(context); + widget.addSelectedExamination(mySelectedExaminationLocal); + + + }, + ), + ), + ], + ))), + ), + ); + } + + isServiceSelected(MasterKeyModel masterKey) { + Iterable exam = mySelectedExaminationLocal.where( + (element) => + masterKey.id == element.selectedExamination!.id && + masterKey.typeId == element.selectedExamination!.typeId); + if (exam.length > 0) { + return true; + } + return false; + } +} diff --git a/lib/screens/patients/profile/soap_update_vida_plus/objective/add_examination_vida_plus_widget.dart b/lib/screens/patients/profile/soap_update_vida_plus/objective/add_examination_vida_plus_widget.dart new file mode 100644 index 00000000..a4510410 --- /dev/null +++ b/lib/screens/patients/profile/soap_update_vida_plus/objective/add_examination_vida_plus_widget.dart @@ -0,0 +1,318 @@ +// ignore: must_be_immutable +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/model/SOAP/master_key_model.dart'; +import 'package:doctor_app_flutter/core/model/SOAP/selected_items/my_selected_examination.dart'; +import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; +import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/expandable-widget-header-body.dart'; +import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart'; +import 'package:flutter/material.dart'; +import 'package:hexcolor/hexcolor.dart'; +import 'package:provider/provider.dart'; + +// ignore: must_be_immutable +class AddExaminationVidaPlusWidget extends StatefulWidget { + MasterKeyModel? item; + final Function(MySelectedExamination) removeExamination; + final Function(MySelectedExamination) addExamination; + final bool Function(MasterKeyModel) isServiceSelected; + bool isExpand; + + final Function() expandClick; + final List? mySelectedExamination; + + AddExaminationVidaPlusWidget({ + this.item, + required this.removeExamination, + required this.addExamination, + required this.isServiceSelected, + this.isExpand = false, + required this.expandClick, + this.mySelectedExamination, + }); + + @override + _AddExaminationVidaPlusWidgetState createState() => _AddExaminationVidaPlusWidgetState(); +} + +class _AddExaminationVidaPlusWidgetState extends State { + int status = 1; + TextEditingController remarksController = TextEditingController(); + MySelectedExamination examination = MySelectedExamination(); + + @override + void initState() { + if (getSelectedExam(widget.item!) != null) { + examination = getSelectedExam(widget.item!)!; + status = examination.isNormal + ? 1 + : examination.isAbnormal + ? 2 + : 3; + remarksController.text = examination.remark!; + } else { + examination.selectedExamination = widget.item; + } + super.initState(); + } + + @override + Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); + + return Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + InkWell( + onTap: () { + onExamTap(); + }, + child: Row( + children: [ + Checkbox( + value: widget.isServiceSelected(widget.item!), + activeColor: Colors.red[800], + onChanged: (bool? newValue) { + onExamTap(); + }), + Container( + child: AppText( + projectViewModel.isArabic + ? widget.item!.nameAr != null && widget.item!.nameAr != "" + ? widget.item!.nameAr! + : widget.item!.nameEn! + : widget.item!.nameEn!, + color: Color(0xFF575757), + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * (SizeConfig.isWidthLarge ? 3 : 3.8), + letterSpacing: -0.56, + ), + ), + ], + ), + ), + ], + ); + // return Container( + // child: HeaderBodyExpandableNotifier( + // headerWidget: Row( + // mainAxisAlignment: MainAxisAlignment.spaceBetween, + // children: [ + // InkWell( + // onTap: () { + // onExamTap(); + // }, + // child: Row( + // children: [ + // Checkbox( + // value: widget.isServiceSelected(widget.item!), + // activeColor: Colors.red[800], + // onChanged: (bool? newValue) { + // onExamTap(); + // }), + // Container( + // child: AppText( + // projectViewModel.isArabic + // ? widget.item!.nameAr != null && widget.item!.nameAr != "" + // ? widget.item!.nameAr! + // : widget.item!.nameEn! + // : widget.item!.nameEn!, + // color: Color(0xFF575757), + // fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * (SizeConfig.isWidthLarge ? 3 : 3.8), + // letterSpacing: -0.56, + // ), + // ), + // ], + // ), + // ), + // Container( + // margin: EdgeInsets.symmetric(horizontal: 8), + // child: InkWell( + // onTap: widget.expandClick, + // child: Icon(widget.isExpand ? Icons.keyboard_arrow_up : Icons.keyboard_arrow_down), + // ), + // ), + // ], + // ), + // bodyWidget: Container( + // padding: EdgeInsets.symmetric(horizontal: 12), + // child: Column( + // crossAxisAlignment: CrossAxisAlignment.start, + // children: [ + // Container( + // margin: EdgeInsets.only(bottom: 8), + // child: AppText( + // TranslationBase.of(context).status, + // fontWeight: FontWeight.bold, + // fontFamily: 'Poppins', + // fontSize: SizeConfig.textMultiplier! * 1.6, + // ), + // ), + // Row( + // children: [ + // Expanded( + // child: InkWell( + // onTap: () { + // setState(() { + // status = 1; + // }); + // examination.isNormal = true; + // examination.isAbnormal = false; + // examination.notExamined = false; + // }, + // child: Row( + // children: [ + // Container( + // padding: EdgeInsets.all(2.0), + // margin: EdgeInsets.symmetric(horizontal: 6), + // width: 20, + // height: 20, + // decoration: BoxDecoration( + // color: Colors.white, + // shape: BoxShape.circle, + // border: Border.all(color: Colors.grey, width: 1), + // ), + // child: Container( + // decoration: BoxDecoration( + // color: status == 1 ? HexColor("#D02127") : Colors.white, + // shape: BoxShape.circle, + // ), + // ), + // ), + // AppText( + // TranslationBase.of(context).normal, + // fontWeight: FontWeight.normal, + // fontFamily: 'Poppins', + // fontSize: SizeConfig.textMultiplier! * 1.6, + // ), + // ], + // ), + // )), + // Expanded( + // child: InkWell( + // onTap: () { + // setState(() { + // status = 2; + // }); + // examination.isNormal = false; + // examination.isAbnormal = true; + // examination.notExamined = false; + // }, + // child: Row( + // children: [ + // Container( + // padding: EdgeInsets.all(2.0), + // margin: EdgeInsets.symmetric(horizontal: 6), + // width: 20, + // height: 20, + // decoration: BoxDecoration( + // color: Colors.white, + // shape: BoxShape.circle, + // border: Border.all(color: Colors.grey, width: 1), + // ), + // child: Container( + // decoration: BoxDecoration( + // color: status == 2 ? HexColor("#D02127") : Colors.white, + // shape: BoxShape.circle, + // ), + // ), + // ), + // AppText( + // TranslationBase.of(context).abnormal, + // fontWeight: FontWeight.normal, + // fontFamily: 'Poppins', + // fontSize: SizeConfig.textMultiplier! * 1.6, + // ), + // ], + // ), + // )), + // if (!examination.isLocal) + // Expanded( + // child: InkWell( + // onTap: () { + // setState(() { + // status = 3; + // }); + // examination.isNormal = false; + // examination.isAbnormal = false; + // examination.notExamined = true; + // }, + // child: Row( + // children: [ + // Container( + // padding: EdgeInsets.all(2.0), + // margin: EdgeInsets.symmetric(horizontal: 6), + // width: 20, + // height: 20, + // decoration: BoxDecoration( + // color: Colors.white, + // shape: BoxShape.circle, + // border: Border.all(color: Colors.grey, width: 1), + // ), + // child: Container( + // decoration: BoxDecoration( + // color: status == 3 ? HexColor("#D02127") : Colors.white, + // shape: BoxShape.circle, + // ), + // ), + // ), + // Expanded( + // child: AppText( + // TranslationBase.of(context).notExamined, + // fontWeight: FontWeight.normal, + // fontFamily: 'Poppins', + // fontSize: SizeConfig.textMultiplier! * 1.6, + // ), + // ), + // ], + // ), + // )), + // ], + // ), + // Container( + // margin: EdgeInsets.only(top: 8), + // child: AppTextFieldCustom( + // hintText: TranslationBase.of(context).remarks, + // controller: remarksController, + // minLines: 2, + // maxLines: 4, + // inputType: TextInputType.multiline, + // onChanged: (value) { + // examination.remark = value; + // }, + // onClick: () {}, + // onFieldSubmitted: () {}, + // ), + // ), + // ], + // ), + // ), + // isExpand: widget.isExpand, + // ), + // ); + } + + onExamTap() { + setState(() { + if (widget.isServiceSelected(widget.item!)) { + if (examination.isLocal) widget.removeExamination(examination); + widget.expandClick(); + } else { + examination.isNormal = status == 1; + examination.isAbnormal = status == 2; + examination.notExamined = status == 3; + examination.remark = remarksController.text; + widget.addExamination(examination); + widget.expandClick(); + } + }); + } + + MySelectedExamination? getSelectedExam(MasterKeyModel masterKey) { + Iterable exam = widget.mySelectedExamination!.where((element) => masterKey.id == element.selectedExamination!.id && masterKey.typeId == element.selectedExamination!.typeId); + if (exam.length > 0) { + return exam.first; + } + return null; + } +} diff --git a/lib/screens/patients/profile/soap_update_vida_plus/objective/examinations_list_search_vida_plus_widget.dart b/lib/screens/patients/profile/soap_update_vida_plus/objective/examinations_list_search_vida_plus_widget.dart new file mode 100644 index 00000000..954f6cf2 --- /dev/null +++ b/lib/screens/patients/profile/soap_update_vida_plus/objective/examinations_list_search_vida_plus_widget.dart @@ -0,0 +1,129 @@ +import 'package:doctor_app_flutter/core/model/SOAP/master_key_model.dart'; +import 'package:doctor_app_flutter/core/model/SOAP/selected_items/my_selected_examination.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/soap_update_vida_plus/objective/add_examination_vida_plus_widget.dart'; +import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart'; +import 'package:doctor_app_flutter/utils/utils.dart'; +import 'package:doctor_app_flutter/widgets/shared/divider_with_spaces_around.dart'; +import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart'; +import 'package:flutter/material.dart'; + + +class ExaminationsListSearchVidaPlusWidget extends StatefulWidget { + final Function(MySelectedExamination) removeExamination; + final Function(MySelectedExamination) addExamination; + final bool Function(MasterKeyModel) isServiceSelected; + final List? masterList; + final List? mySelectedExamination; + + ExaminationsListSearchVidaPlusWidget({required this.removeExamination, required this.addExamination, required this.isServiceSelected, this.masterList, this.mySelectedExamination}); + + @override + _ExaminationsListSearchVidaPlusWidgetState createState() => _ExaminationsListSearchVidaPlusWidgetState(); +} + +class _ExaminationsListSearchVidaPlusWidgetState extends State { + int expandedIndex = -1; + List? items = []; + TextEditingController filteredSearchController = TextEditingController(); + + @override + void initState() { + items!.addAll(widget.masterList!); + super.initState(); + } + + @override + Widget build(BuildContext context) { + return Column( + children: [ + Material( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10), + side: BorderSide( + width: 1, + color: Color(0xFFEFEFEF), + )), + color: Colors.white,child: Padding( + padding: const EdgeInsets.all(8.0), + child: AppTextFieldCustom( + height: Utils.getTextFieldHeight(), + hintText: TranslationBase.of(context).searchExamination, + isTextFieldHasSuffix: false, + hasBorder: false, + controller: filteredSearchController, + onChanged: (value) { + if (value != null) filterSearchResults(value); + }, + suffixWidget: InkWell( + child: Icon( + Icons.search, + color: Colors.black, + ), + onTap: () {}, + ), + onClick: () {}, + onFieldSubmitted: () {}, + ), + ), + ), + ...items!.mapIndexed((index, item) { + return Column( + children: [ + AddExaminationVidaPlusWidget( + item: item, + addExamination: widget.addExamination, + removeExamination: widget.removeExamination, + mySelectedExamination: widget.mySelectedExamination, + isServiceSelected: widget.isServiceSelected, + isExpand: index == expandedIndex, + expandClick: () { + setState(() { + if (expandedIndex == index) { + expandedIndex = -1; + } else { + expandedIndex = index; + } + }); + }, + ), + Divider() + ], + ); + }).toList(), + ], + ); + } + + void filterSearchResults(String query) { + List dummySearchList = []; + dummySearchList.addAll(widget.masterList as Iterable); + if (query.isNotEmpty) { + List dummyListData = []; + dummySearchList.forEach((item) { + if (item.nameAr!.toLowerCase().contains(query.toLowerCase()) || item.nameEn!.toLowerCase().contains(query.toLowerCase())) { + dummyListData.add(item); + } + }); + setState(() { + items!.clear(); + items!.addAll(dummyListData); + }); + return; + } else { + setState(() { + items!.clear(); + items!.addAll(widget.masterList as Iterable); + }); + } + } +} + +extension FicListExtension on List { + /// Maps each element of the list. + /// The [map] function gets both the original [item] and its [index]. + Iterable mapIndexed(E Function(int index, T item) map) sync* { + for (var index = 0; index < length; index++) { + yield map(index, this[index]); + } + } +} diff --git a/lib/screens/patients/profile/soap_update_vida_plus/objective/list_of_examination.dart b/lib/screens/patients/profile/soap_update_vida_plus/objective/list_of_examination.dart new file mode 100644 index 00000000..a9b246e2 --- /dev/null +++ b/lib/screens/patients/profile/soap_update_vida_plus/objective/list_of_examination.dart @@ -0,0 +1,59 @@ +import 'package:doctor_app_flutter/core/model/SOAP/selected_items/my_selected_examination.dart'; +import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/soap_update_vida_plus/widgets/SoapDetailItem.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; + +import '../../../../../utils/translations_delegate_base_utils.dart'; + +class ListOfExamination extends StatelessWidget { + final List listOfSelection; + + const ListOfExamination({super.key, required this.listOfSelection}); + + @override + Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); + return Flexible( + child: ListView.separated( + physics: NeverScrollableScrollPhysics(), + shrinkWrap: true, + itemBuilder: (_, index) => SoapDetailItem( + title: projectViewModel.isArabic + ? listOfSelection[index] + .selectedExamination! + .nameAr != + null && + listOfSelection[index] + .selectedExamination! + .nameAr != + "" + ? listOfSelection[index] + .selectedExamination! + .nameAr! + : listOfSelection[index] + .selectedExamination! + .nameEn! + : listOfSelection[index] + .selectedExamination! + .nameEn!, + condition: getCondition(listOfSelection[index], context)??TranslationBase.of(context).notExamined, + remarks: listOfSelection[index].remark??'', + onSoapDetailActionClicked: (action) { + ///todo handle the event as per the actiion + /// the action is [SoapDetailItemActions] + }, + status: 'active', + ), + separatorBuilder: (_, __) => Divider(), + itemCount: listOfSelection.length), + ); + } + + String? getCondition(MySelectedExamination examination, BuildContext context) => examination.isNormal + ? TranslationBase.of(context).normal + : examination.isAbnormal + ? TranslationBase.of(context).abnormal + : TranslationBase.of(context).notExamined; +} diff --git a/lib/screens/patients/profile/soap_update_vida_plus/objective/update_objective_page_vida_plus.dart b/lib/screens/patients/profile/soap_update_vida_plus/objective/update_objective_page_vida_plus.dart new file mode 100644 index 00000000..a8a4ddfe --- /dev/null +++ b/lib/screens/patients/profile/soap_update_vida_plus/objective/update_objective_page_vida_plus.dart @@ -0,0 +1,389 @@ +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/enum/master_lookup_key.dart'; +import 'package:doctor_app_flutter/core/enum/view_state.dart'; +import 'package:doctor_app_flutter/core/model/SOAP/master_key_model.dart'; +import 'package:doctor_app_flutter/core/model/SOAP/physical_exam/post_physical_exam_request_model.dart'; +import 'package:doctor_app_flutter/core/model/SOAP/selected_items/my_selected_examination.dart'; +import 'package:doctor_app_flutter/core/model/doctor/doctor_profile_model.dart'; +import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/soap_update/objective/add_examination_page.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/soap_update/shared_soap_widgets/SOAP_step_header.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/soap_update/shared_soap_widgets/expandable_SOAP_widget.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/soap_update/soap_utils.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/soap_update_vida_plus/objective/add_examination_page_vida_plus.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/soap_update_vida_plus/objective/list_of_examination.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/soap_update_vida_plus/objective/widget/EmptyExamination.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/soap_update_vida_plus/subjective/chief_complaint/widgets/add_soap_item.dart'; +import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart'; +import 'package:doctor_app_flutter/utils/utils.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/transitions/fade_page.dart'; +import 'package:flutter/material.dart'; + +import '../../soap_update/objective/examination_item_card.dart'; +import '../../soap_update/objective/objective_call_back.dart'; +import '../../soap_update/shared_soap_widgets/SOAP_open_items.dart'; +import 'add_details_to_examination_vida_plus.dart'; + +class UpdateObjectivePageVidaPlus extends StatefulWidget { + final Function changePageViewIndex; + final Function changeLoadingState; + final int currentIndex; + final PatiantInformtion patientInfo; + + UpdateObjectivePageVidaPlus( + {Key? key, + required this.changePageViewIndex, + required this.patientInfo, + required this.changeLoadingState, + required this.currentIndex}); + + @override + _UpdateObjectivePageVidaPlusState createState() => + _UpdateObjectivePageVidaPlusState(); +} + +class _UpdateObjectivePageVidaPlusState + extends State implements ObjectiveCallBack { + bool isSysExaminationExpand = false; + List mySelectedExamination = []; + + BoxDecoration containerBorderDecoration( + Color containerColor, Color borderColor) { + return BoxDecoration( + color: containerColor, + shape: BoxShape.rectangle, + borderRadius: BorderRadius.all(Radius.circular(6)), + border: Border.fromBorderSide(BorderSide( + color: borderColor, + width: 0.5, + )), + ); + } + + @override + Widget build(BuildContext context) { + + return BaseView( + onModelReady: (model) async { + WidgetsBinding.instance.addPostFrameCallback((_) async { + model.setObjectiveCallBack(this); + mySelectedExamination.clear(); + model.isAddExamInProgress = true; + await model.getPatientPhysicalExam(widget.patientInfo); + if (model.patientPhysicalExamList.isNotEmpty) { + if (model.physicalExaminationList.length == 0) { + await model.getMasterLookup(MasterKeysService.PhysicalExamination); + } + model.patientPhysicalExamList.forEach((element) { + MasterKeyModel? examMaster = model.getOneMasterKey( + masterKeys: MasterKeysService.PhysicalExamination, + id: element.examId, + ); + MySelectedExamination tempEam = + SoapUtils.generateMySelectedExamination( + examination: examMaster, + remark: element.remarks, + isNormal: element.isNormal, + createdBy: element.createdBy, + createdOn: element.createdOn, + editedOn: element.editedOn, + notExamined: element.notExamined, + isNew: element.isNew, + isLocal: false, + isAbnormal: element.isAbnormal, + ); + mySelectedExamination.add(tempEam); + }); + } + widget.changeLoadingState(false);}); + }, + builder: (_, model, w) => AppScaffold( + isShowAppBar: false, + backgroundColor: Theme.of(context).scaffoldBackgroundColor, + body: SingleChildScrollView( + physics: ScrollPhysics(), + child: Center( + child: FractionallySizedBox( + widthFactor: 0.9, + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SOAPStepHeader( + currentIndex: widget.currentIndex, + changePageViewIndex: widget.changePageViewIndex, + patientInfo: widget.patientInfo, + ), + ExpandableSOAPWidget( + headerTitle: + TranslationBase.of(context).physicalExamination, + onTap: () { + setState(() { + isSysExaminationExpand = !isSysExaminationExpand; + }); + }, + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + SizedBox(height: 10,), + AddSoapItem( + title: + TranslationBase.of(context).physicalExamination, + onAddSoapItemClicked: () { + openExaminationList(context); + }), + SizedBox(height: 16,), + + if (mySelectedExamination.isEmpty) ...{ + + Center( + child: Padding( + padding: const EdgeInsets.all(65), + child: EmptyExamination(), + ), + ), + + } else ...{ + Divider(), + ListOfExamination( + listOfSelection: mySelectedExamination + ) + } + + // if (mySelectedExamination.isNotEmpty && mySelectedExamination.first.isLocal) + // Row( + // children: [ + // AppText( + // "New", + // fontWeight: FontWeight.w600, + // fontFamily: 'Poppins', + // color: Color(0xFFCC9B14), + // ), + // ], + // ), + // Column( + // children: mySelectedExamination + // .sublist(0, model.getFirstIndexForOldExamination(mySelectedExamination) == -1 ? 0 : model.getFirstIndexForOldExamination(mySelectedExamination)) + // .map((examination) { + // return ExaminationItemCard(examination, () { + // removeExamination(examination.selectedExamination!); + // }); + // }).toList(), + // ), + // if (mySelectedExamination.isNotEmpty && model.getFirstIndexForOldExamination(mySelectedExamination) > -1) + // Row( + // children: [ + // AppText( + // "Verified", + // fontWeight: FontWeight.w600, + // fontFamily: 'Poppins', + // color: AppGlobal.appGreenColor, + // ), + // ], + // ), + // Column( + // children: mySelectedExamination + // .sublist(model.getFirstIndexForOldExamination(mySelectedExamination) == -1 ? 0 : model.getFirstIndexForOldExamination(mySelectedExamination)) + // .map((examination) { + // return ExaminationItemCard(examination, () { + // removeExamination(examination.selectedExamination!); + // }); + // }).toList(), + // ) + ], + ), + isExpanded: isSysExaminationExpand, + ), + SizedBox( + height: SizeConfig.heightMultiplier! * + (SizeConfig.isHeightVeryShort ? 14 : 12), + ) + ], + ), + ), + ), + ), + ), + ); + } + + submitUpdateObjectivePage(SOAPViewModel model) async { + if (mySelectedExamination.isNotEmpty) { + if (!model.isAddExamInProgress && + widget.patientInfo.admissionNo != null && + widget.patientInfo.admissionNo!.isNotEmpty) { + Navigator.of(context).pop(); + } else { + widget.changeLoadingState(true); + Map profile = await sharedPref.getObj(DOCTOR_PROFILE); + + DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile); + PostPhysicalExamRequestModel postPhysicalExamRequestModel = + new PostPhysicalExamRequestModel(); + mySelectedExamination.forEach((exam) { + if (postPhysicalExamRequestModel + .listHisProgNotePhysicalExaminationVM == + null) + postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM = + []; + ListHisProgNotePhysicalExaminationVM + listHisProgNotePhysicalExaminationVM = + ListHisProgNotePhysicalExaminationVM( + patientMRN: widget.patientInfo.patientMRN, + episodeId: widget.patientInfo.episodeNo == null + ? 0 + : widget.patientInfo.episodeNo, + appointmentNo: widget.patientInfo.appointmentNo == null + ? 0 + : widget.patientInfo.appointmentNo, + remarks: exam.remark ?? '', + createdBy: exam.createdBy ?? doctorProfile.doctorID, + createdOn: exam.createdOn ?? DateTime.now().toIso8601String(), + editedBy: doctorProfile.doctorID, + editedOn: DateTime.now().toIso8601String(), + examId: exam.selectedExamination!.id, + examType: exam.selectedExamination!.typeId, + isAbnormal: exam.isAbnormal, + isNormal: exam.isNormal, + notExamined: exam.notExamined, + examinationType: exam.isNormal + ? 1 + : exam.isAbnormal + ? 2 + : 3, + examinationTypeName: exam.isNormal + ? "Normal" + : exam.isAbnormal + ? 'AbNormal' + : "Not Examined", + isNew: exam.isNew, + ); + if (widget.patientInfo.admissionNo != null && + widget.patientInfo.admissionNo!.isNotEmpty) { + listHisProgNotePhysicalExaminationVM.admissionNo = + int.parse(widget.patientInfo.admissionNo!); + } else { + listHisProgNotePhysicalExaminationVM.admissionNo = 0; + } + postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM! + .add(listHisProgNotePhysicalExaminationVM); + }); + + if (model.patientPhysicalExamList.isEmpty) { + await model.postPhysicalExam(postPhysicalExamRequestModel); + } else { + await model.patchPhysicalExam(postPhysicalExamRequestModel); + } + + if (model.state == ViewState.ErrorLocal) { + widget.changeLoadingState(false); + Utils.showErrorToast(model.error); + if (widget.patientInfo.admissionNo != null && + widget.patientInfo.admissionNo!.isNotEmpty) { + // Navigator.of(context).pop(); + model.isAddExamInProgress = false; + } + } else { + if (widget.patientInfo.admissionNo != null && + widget.patientInfo.admissionNo!.isNotEmpty) { + // Navigator.of(context).pop(); + widget.changeLoadingState(false); + model.isAddExamInProgress = false; + } else { + widget.changeLoadingState(true); + widget.changePageViewIndex(2); + } + } + } + } else { + Utils.showErrorToast(TranslationBase.of(context).examinationErrorMsg); + } + } + + removeExamination(MasterKeyModel masterKey) { + Iterable history = mySelectedExamination.where( + (element) => + masterKey.id == element.selectedExamination!.id && + masterKey.typeId == element.selectedExamination!.typeId); + + if (history.length > 0) { + setState(() { + if (history.first.isLocal) { + mySelectedExamination.remove(history.first); + } else { + history.first.notExamined = true; + history.first.isNormal = false; + history.first.isAbnormal = false; + } + }); + } + } + + openExaminationList(BuildContext context) { + Navigator.push( + context, + FadePage( + page: AddExaminationPageVidaPlus( + mySelectedExamination: mySelectedExamination, + addSelectedExamination: + (List mySelectedExaminationLocal) { + + pushAddExamination(mySelectedExaminationLocal); + + + // mySelectedExaminationLocal.forEach((element) { + // if (mySelectedExamination.singleWhere( + // (it) => + // it.selectedExamination!.id == + // element.selectedExamination!.id, + // orElse: () => MySelectedExamination()) == + // MySelectedExamination()) { + // mySelectedExamination.insert(0, element); + // } + // }); + + /// remove items. + // List removedList = []; + // mySelectedExamination.forEach((element) { + // if (mySelectedExaminationLocal.singleWhere( + // (it) => + // it.selectedExamination!.id == + // element.selectedExamination!.id, + // orElse: () => MySelectedExamination()) == + // MySelectedExamination()) { + // removedList.add(element); + // } + // }); + + // removedList.forEach((element) { + // removeExamination(element.selectedExamination!); + // }); + // Navigator.of(context).pop(); + // setState(() {}); + }, + removeExamination: (masterKey) => removeExamination(masterKey)), + ), + ); + } + + @override + nextFunction(model) async { + await submitUpdateObjectivePage(model); + } + + void pushAddExamination(List mySelectedExaminationLocal) { + Navigator.push( + context, + FadePage( + page: AddDetailsToExaminationVidaPlus( + mySelectedExamination: mySelectedExamination,), + ), + ); + } +} diff --git a/lib/screens/patients/profile/soap_update_vida_plus/objective/widget/EmptyExamination.dart b/lib/screens/patients/profile/soap_update_vida_plus/objective/widget/EmptyExamination.dart new file mode 100644 index 00000000..c552848f --- /dev/null +++ b/lib/screens/patients/profile/soap_update_vida_plus/objective/widget/EmptyExamination.dart @@ -0,0 +1,26 @@ +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_svg/flutter_svg.dart'; + +import '../../../../../../../utils/translations_delegate_base_utils.dart'; + +class EmptyExamination extends StatelessWidget{ + @override + Widget build(BuildContext context) { + return Column( + mainAxisAlignment : MainAxisAlignment.center, + children: [ + SvgPicture.asset('assets/images/svgs/unavailable.svg'), + SizedBox(height: 10,), + AppText( + TranslationBase.of(context).noPhysicalExamination, + fontSize: 12, + fontWeight: FontWeight.w400, + textAlign: TextAlign.center, + color: Color(0xFFADADAD), + ) + ], + ); + } + +} \ No newline at end of file diff --git a/lib/screens/patients/profile/soap_update_vida_plus/objective/widget/examination_items.dart b/lib/screens/patients/profile/soap_update_vida_plus/objective/widget/examination_items.dart new file mode 100644 index 00000000..cc097d2f --- /dev/null +++ b/lib/screens/patients/profile/soap_update_vida_plus/objective/widget/examination_items.dart @@ -0,0 +1,247 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/model/SOAP/master_key_model.dart'; +import 'package:doctor_app_flutter/core/model/SOAP/selected_items/my_selected_examination.dart'; +import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; +import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart'; +import 'package:flutter/material.dart'; +import 'package:hexcolor/hexcolor.dart'; +import 'package:provider/provider.dart'; + +class ExaminationItems extends StatefulWidget { + final MySelectedExamination? examination; + + const ExaminationItems({super.key, this.examination}); + + @override + State createState() => _ExaminationItemsState(); +} + +class _ExaminationItemsState extends State { + bool isExpanded = false; + + int status = 1; + + TextEditingController remarksController = TextEditingController(); + + @override + void initState() { + // TODO: implement initState + super.initState(); + remarksController.text = widget.examination?.remark ?? ""; + } + + @override + Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); + return Column( + children: [ + ListTileTheme( + horizontalTitleGap: 0, + child: CheckboxListTile( + activeColor: Color(0xFFD02127), + checkColor: Colors.white, + contentPadding: EdgeInsets.zero, + side: MaterialStateBorderSide.resolveWith( + (Set states) { + if (states.contains(MaterialState.selected)) { + return const BorderSide(color: Color(0xFFD02127)); + } + return const BorderSide(color: Color(0xFFE6E6E6)); + }, + ), + shape: + RoundedRectangleBorder(borderRadius: BorderRadius.circular(16)), + value: isExpanded, + controlAffinity: ListTileControlAffinity.leading, + onChanged: (bool? value) { + setState(() { + isExpanded = value ?? false; + }); + }, + title: AppText( + projectViewModel.isArabic + ? widget.examination!.selectedExamination!.nameAr != null && + widget.examination!.selectedExamination!.nameAr != "" + ? widget.examination!.selectedExamination!.nameAr! + : widget.examination!.selectedExamination!.nameEn! + : widget.examination!.selectedExamination!.nameEn!, + color: Color(0XFF575757), + fontSize: 14, + fontWeight: FontWeight.w400, + ), + ), + ), + (isExpanded) + ? Container( + padding: EdgeInsets.symmetric(horizontal: 12), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + margin: EdgeInsets.only(bottom: 8), + child: AppText( + TranslationBase.of(context).condition, + fontWeight: FontWeight.bold, + fontFamily: 'Poppins', + fontSize: SizeConfig.textMultiplier! * 1.6, + ), + ), + Row( + children: [ + Expanded( + child: InkWell( + onTap: () { + setState(() { + status = 1; + }); + widget.examination!.isNormal = true; + widget.examination!.isAbnormal = false; + widget.examination!.notExamined = false; + }, + child: Row( + children: [ + Container( + padding: EdgeInsets.all(2.0), + margin: EdgeInsets.symmetric(horizontal: 6), + width: 20, + height: 20, + decoration: BoxDecoration( + color: Colors.white, + shape: BoxShape.circle, + border: + Border.all(color: Colors.grey, width: 1), + ), + child: Container( + decoration: BoxDecoration( + color: status == 1 + ? HexColor("#D02127") + : Colors.white, + shape: BoxShape.circle, + ), + ), + ), + AppText( + TranslationBase.of(context).normal, + fontWeight: FontWeight.normal, + fontFamily: 'Poppins', + fontSize: SizeConfig.textMultiplier! * 1.6, + ), + ], + ), + )), + Expanded( + child: InkWell( + onTap: () { + setState(() { + status = 2; + }); + widget.examination!.isNormal = false; + widget.examination!.isAbnormal = true; + widget.examination!.notExamined = false; + }, + child: Row( + children: [ + Container( + padding: EdgeInsets.all(2.0), + margin: EdgeInsets.symmetric(horizontal: 6), + width: 20, + height: 20, + decoration: BoxDecoration( + color: Colors.white, + shape: BoxShape.circle, + border: + Border.all(color: Colors.grey, width: 1), + ), + child: Container( + decoration: BoxDecoration( + color: status == 2 + ? HexColor("#D02127") + : Colors.white, + shape: BoxShape.circle, + ), + ), + ), + AppText( + TranslationBase.of(context).abnormal, + fontWeight: FontWeight.normal, + fontFamily: 'Poppins', + fontSize: SizeConfig.textMultiplier! * 1.6, + ), + ], + ), + )), + if (widget.examination?.isLocal == false) + Expanded( + child: InkWell( + onTap: () { + setState(() { + status = 3; + }); + widget.examination!.isNormal = false; + widget.examination!.isAbnormal = false; + widget.examination!.notExamined = true; + }, + child: Row( + children: [ + Container( + padding: EdgeInsets.all(2.0), + margin: EdgeInsets.symmetric(horizontal: 6), + width: 20, + height: 20, + decoration: BoxDecoration( + color: Colors.white, + shape: BoxShape.circle, + border: Border.all( + color: Colors.grey, width: 1), + ), + child: Container( + decoration: BoxDecoration( + color: status == 3 + ? HexColor("#D02127") + : Colors.white, + shape: BoxShape.circle, + ), + ), + ), + Expanded( + child: AppText( + TranslationBase.of(context).notExamined, + fontWeight: FontWeight.normal, + fontFamily: 'Poppins', + fontSize: SizeConfig.textMultiplier! * 1.6, + ), + ), + ], + ), + )), + ], + ), + Container( + margin: EdgeInsets.only(top: 8), + child: AppTextFieldCustom( + hintText: TranslationBase.of(context).remarks, + controller: remarksController, + minLines: 2, + maxLines: 4, + inputType: TextInputType.multiline, + onChanged: (value) { + widget.examination!.remark = value; + }, + onClick: () {}, + onFieldSubmitted: () {}, + ), + ), + ], + ), + ) + : SizedBox.shrink(), + SizedBox( + height: 8, + ), + Divider() + ], + ); + } +} diff --git a/lib/screens/patients/profile/soap_update_vida_plus/plan/update_plan_page_vida_plus.dart b/lib/screens/patients/profile/soap_update_vida_plus/plan/update_plan_page_vida_plus.dart new file mode 100644 index 00000000..a3aefa8b --- /dev/null +++ b/lib/screens/patients/profile/soap_update_vida_plus/plan/update_plan_page_vida_plus.dart @@ -0,0 +1,457 @@ +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/enum/view_state.dart'; +import 'package:doctor_app_flutter/core/model/SOAP/progress_note/GetGetProgressNoteResModel.dart'; +import 'package:doctor_app_flutter/core/model/SOAP/progress_note/get_progress_note_req_model.dart'; +import 'package:doctor_app_flutter/core/model/SOAP/progress_note/post_progress_note_request_model.dart'; +import 'package:doctor_app_flutter/core/model/doctor/doctor_profile_model.dart'; +import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; +import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/soap_update/plan/plan_call_back.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/soap_update/shared_soap_widgets/SOAP_step_header.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/soap_update/shared_soap_widgets/expandable_SOAP_widget.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/soap_update_vida_plus/objective/list_of_examination.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/soap_update_vida_plus/plan/widget/add_progress_note.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/soap_update_vida_plus/plan/widget/empty_progress_note.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/soap_update_vida_plus/plan/widget/list_of_notes.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/soap_update_vida_plus/subjective/chief_complaint/widgets/add_soap_item.dart'; +import 'package:doctor_app_flutter/utils/date-utils.dart'; +import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart'; +import 'package:doctor_app_flutter/utils/utils.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/text_fields/app-textfield-custom.dart'; +import 'package:doctor_app_flutter/widgets/transitions/fade_page.dart'; +import 'package:flutter/material.dart'; + +class UpdatePlanPageVidaPlus extends StatefulWidget { + final Function changePageViewIndex; + final PatiantInformtion patientInfo; + final Function changeLoadingState; + final Function changeStateFun; + final SOAPViewModel sOAPViewModel; + + final int currentIndex; + + UpdatePlanPageVidaPlus( + {Key? key, + required this.changePageViewIndex, + required this.patientInfo, + required this.changeLoadingState, + required this.currentIndex, + required this.sOAPViewModel, + required this.changeStateFun}); + + @override + _UpdatePlanPageVidaPlusState createState() => _UpdatePlanPageVidaPlusState(); +} + +class _UpdatePlanPageVidaPlusState extends State + implements PlanCallBack { + bool isAddProgress = true; + bool isProgressExpanded = true; + List listOfProgressNote = [GetPatientProgressNoteResModel()]; + GetPatientProgressNoteResModel patientProgressNote = + GetPatientProgressNoteResModel(); + + TextEditingController progressNoteController = + TextEditingController(text: null); + + BoxDecoration containerBorderDecoration( + Color containerColor, Color borderColor) { + return BoxDecoration( + color: containerColor, + shape: BoxShape.rectangle, + borderRadius: BorderRadius.all(Radius.circular(6)), + border: Border.fromBorderSide(BorderSide( + color: borderColor, + width: 0.5, + )), + ); + } + + @override + void initState() { + super.initState(); + if (patientProgressNote.planNote != null) { + setState(() { + isAddProgress = false; + }); + } + } + + getPatientProgressNote(SOAPViewModel model, + {bool isAddProgress = false}) async { + GetProgressNoteReqModel getGetProgressNoteReqModel = + GetProgressNoteReqModel( + appointmentNo: + int.parse(widget.patientInfo.appointmentNo.toString()), + patientMRN: widget.patientInfo.patientMRN, + episodeID: widget.patientInfo.episodeNo.toString(), + editedBy: '', + doctorID: ''); + await widget.sOAPViewModel + .getPatientProgressNote(getGetProgressNoteReqModel); + + ///TODO set progressNote in model; + if (widget.sOAPViewModel.patientProgressNoteList.isNotEmpty) { + progressNoteController.text = Utils.parseHtmlString( + widget.sOAPViewModel.patientProgressNoteList[0].planNote!); + patientProgressNote.planNote = progressNoteController.text; + + patientProgressNote.createdByName = + widget.sOAPViewModel.patientProgressNoteList[0].createdByName; + patientProgressNote.createdOn = + widget.sOAPViewModel.patientProgressNoteList[0].createdOn; + patientProgressNote.editedOn = + widget.sOAPViewModel.patientProgressNoteList[0].editedOn; + patientProgressNote.editedByName = + widget.sOAPViewModel.patientProgressNoteList[0].editedByName; + patientProgressNote.appointmentNo = + widget.sOAPViewModel.patientProgressNoteList[0].appointmentNo; + setState(() { + isAddProgress = isAddProgress; + widget.sOAPViewModel.isAddProgress = isAddProgress; + widget.sOAPViewModel.progressNoteText = progressNoteController.text; + }); + } + } + + @override + Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) async { + widget.sOAPViewModel.setPlanCallBack(this); + GetProgressNoteReqModel getGetProgressNoteReqModel = + GetProgressNoteReqModel( + appointmentNo: + int.parse(widget.patientInfo.appointmentNo.toString()), + patientMRN: widget.patientInfo.patientMRN, + episodeID: widget.patientInfo.episodeNo.toString(), + editedBy: '', + doctorID: ''); + await widget.sOAPViewModel + .getPatientProgressNote(getGetProgressNoteReqModel); + + if (widget.sOAPViewModel.patientProgressNoteList.isNotEmpty) { + progressNoteController.text = Utils.parseHtmlString( + widget.sOAPViewModel.patientProgressNoteList[0].planNote!); + patientProgressNote.planNote = progressNoteController.text; + patientProgressNote.createdByName = + widget.sOAPViewModel.patientProgressNoteList[0].createdByName; + patientProgressNote.createdOn = + widget.sOAPViewModel.patientProgressNoteList[0].createdOn; + patientProgressNote.editedOn = + widget.sOAPViewModel.patientProgressNoteList[0].editedOn; + patientProgressNote.editedByName = + widget.sOAPViewModel.patientProgressNoteList[0].editedByName; + patientProgressNote.appointmentNo = + widget.sOAPViewModel.patientProgressNoteList[0].appointmentNo; + widget.sOAPViewModel.progressNoteText = progressNoteController.text; + + setState(() { + isAddProgress = false; + widget.sOAPViewModel.isAddProgress = false; + }); + } + widget.changeLoadingState(false); + }, + builder: (_, model, w) => AppScaffold( + backgroundColor: Theme.of(context).scaffoldBackgroundColor, + isShowAppBar: false, + body: SingleChildScrollView( + physics: ScrollPhysics(), + child: Center( + child: FractionallySizedBox( + widthFactor: 0.90, + child: Column( + + children: [ + SOAPStepHeader( + currentIndex: widget.currentIndex, + changePageViewIndex: widget.changePageViewIndex, + patientInfo: widget.patientInfo, + ), + SizedBox( + height: 10, + ), + ExpandableSOAPWidget( + headerTitle: TranslationBase.of(context).progressNote, + onTap: () { + setState(() { + isProgressExpanded = !isProgressExpanded; + }); + }, + child: Column( + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + SizedBox( + height: 10, + ), + AddSoapItem( + title: TranslationBase.of(context) + .addProgressNote, + onAddSoapItemClicked: () { + navigateToAddPlan(); + }), + SizedBox( + height: 16, + ), + + if (listOfProgressNote.isEmpty) ...{ + Center( + child: Padding( + padding: const EdgeInsets.all(65), + child: EmptyProgressNote(), + ), + ), + } else ...{ + Divider(), + ListOfNotes( + notes: listOfProgressNote + ) + } + + // if (mySelectedExamination.isEmpty) ...{ + // + // Center( + // child: Padding( + // padding: const EdgeInsets.all(65), + // child: EmptyExamination(), + // ), + // ), + // + // } else ...{ + // Divider(), + // ListOfExamination( + // listOfSelection: mySelectedExamination + // ) + // } + // Column( + // crossAxisAlignment: CrossAxisAlignment.start, + // children: [ + // if (isAddProgress) + // Container( + // margin: EdgeInsets.only(left: 10, right: 10, top: 15), + // child: AppTextFieldCustom( + // hintText: TranslationBase.of(context).progressNote, + // controller: progressNoteController, + // minLines: 2, + // maxLines: 4, + // inputType: TextInputType.multiline, + // onChanged: (value) { + // setState(() { + // patientProgressNote.planNote = value; + // model.progressNoteText = value!; + // widget.changeStateFun(); + // }); + // }, + // onFieldSubmitted: () {}, + // ), + // ), + // SizedBox( + // height: 9, + // ), + // if (patientProgressNote.planNote != null && !isAddProgress) + // Container( + // margin: EdgeInsets.only( + // left: 5, + // right: 5, + // ), + // child: Column( + // crossAxisAlignment: CrossAxisAlignment.start, + // children: [ + // Row( + // mainAxisAlignment: MainAxisAlignment.spaceBetween, + // crossAxisAlignment: CrossAxisAlignment.start, + // children: [ + // Row( + // children: [ + // AppText( + // 'Appointment No: ', + // fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3, + // letterSpacing: -0.4, + // color: Color(0xFF575757), + // ), + // AppText( + // patientProgressNote.appointmentNo != null ? patientProgressNote.appointmentNo.toString() : '', + // fontWeight: FontWeight.w600, + // letterSpacing: -0.48, + // color: Color(0xFF2B353E), + // fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3.6, + // ), + // ], + // ), + // AppText( + // patientProgressNote.createdOn != null + // ? AppDateUtils.getDayMonthYearDateFormatted(DateTime.parse(patientProgressNote.createdOn!)) + // : AppDateUtils.getDayMonthYearDateFormatted(DateTime.now()), + // fontWeight: FontWeight.w600, + // fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3.6, + // ) + // ], + // ), + // Row( + // mainAxisAlignment: MainAxisAlignment.end, + // crossAxisAlignment: CrossAxisAlignment.start, + // children: [ + // // Row( + // // children: [ + // // AppText( + // // 'Condition: ', + // // fontSize: 12, + // // ), + // // AppText( + // // patientProgressNote.mName ?? + // // '', + // // fontWeight: FontWeight.w600), + // // ], + // // ), + // AppText( + // patientProgressNote.createdOn != null ? AppDateUtils.getHour(DateTime.parse(patientProgressNote.createdOn!)) : AppDateUtils.getHour(DateTime.now()), + // fontWeight: FontWeight.w600, + // color: Color(0xFF575757), + // fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3.6, + // ) + // ], + // ), + // SizedBox( + // height: 8, + // ), + // Row( + // mainAxisAlignment: MainAxisAlignment.start, + // children: [ + // Expanded( + // child: AppText( + // progressNoteController.text, + // fontSize: 10, + // ), + // ), + // InkWell( + // onTap: () { + // setState(() { + // isAddProgress = true; + // widget.sOAPViewModel.isAddProgress = true; + // }); + // }, + // child: Icon( + // DoctorApp.edit, + // size: 18, + // )) + // ], + // ), + // ], + // ), + // ) + // ], + // ), + ], + ), + isExpanded: isProgressExpanded, + ), + SizedBox( + height: SizeConfig.heightMultiplier! * + (SizeConfig.isHeightVeryShort ? 20 : 10), + ), + ], + ), + ), + ), + ), + )); + } + + 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: widget.patientInfo.doctorId, + createdBy: widget.patientInfo.doctorId, + createdByName: widget.patientInfo.doctorName, + editedBy: ''); + + if (widget.sOAPViewModel.patientProgressNoteList.isEmpty) { + await widget.sOAPViewModel + .postProgressNote(postProgressNoteRequestModel); + } else { + Map profile = await sharedPref.getObj(DOCTOR_PROFILE); + DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile); + postProgressNoteRequestModel.editedBy = doctorProfile.doctorID; + await widget.sOAPViewModel + .patchProgressNote(postProgressNoteRequestModel); + } + + if (widget.sOAPViewModel.state == ViewState.ErrorLocal) { + Utils.showErrorToast(widget.sOAPViewModel.error); + } else { + GetProgressNoteReqModel getGetProgressNoteReqModel = + GetProgressNoteReqModel( + appointmentNo: + int.parse(widget.patientInfo.appointmentNo.toString()), + patientMRN: widget.patientInfo.patientMRN, + episodeID: widget.patientInfo.episodeNo.toString(), + editedBy: '', + doctorID: ''); + await widget.sOAPViewModel + .getPatientProgressNote(getGetProgressNoteReqModel); + if (widget.sOAPViewModel.patientProgressNoteList.isNotEmpty) { + progressNoteController.text = Utils.parseHtmlString( + widget.sOAPViewModel.patientProgressNoteList[0].planNote!); + patientProgressNote.planNote = progressNoteController.text; + patientProgressNote.createdByName = + widget.sOAPViewModel.patientProgressNoteList[0].createdByName; + patientProgressNote.createdOn = + widget.sOAPViewModel.patientProgressNoteList[0].createdOn; + patientProgressNote.editedOn = + widget.sOAPViewModel.patientProgressNoteList[0].editedOn; + patientProgressNote.editedByName = + widget.sOAPViewModel.patientProgressNoteList[0].editedByName; + patientProgressNote.appointmentNo = + widget.sOAPViewModel.patientProgressNoteList[0].appointmentNo; + + setState(() { + isAddProgress = false; + widget.sOAPViewModel.isAddProgress = false; + }); + } + + Navigator.of(context).pop(); + Utils.showErrorToast("Episode Created Successfully"); + } + widget.changeLoadingState(false); + } else { + Utils.showErrorToast(TranslationBase.of(context).progressNoteErrorMsg); + } + } + + @override + nextFunction(model) { + if (progressNoteController.text.isNotEmpty) { + if (isAddProgress) { + submitPlan(model); + } else { + Navigator.of(context).pop(); + } + } else { + Utils.showErrorToast(TranslationBase.of(context).progressNoteErrorMsg); + } + } + + void navigateToAddPlan() { + Navigator.push( + context, + FadePage( + page: AddProgressNote ( + + ), + )); + } +} diff --git a/lib/screens/patients/profile/soap_update_vida_plus/plan/widget/ProgressNoteItem.dart b/lib/screens/patients/profile/soap_update_vida_plus/plan/widget/ProgressNoteItem.dart new file mode 100644 index 00000000..09e6d6a3 --- /dev/null +++ b/lib/screens/patients/profile/soap_update_vida_plus/plan/widget/ProgressNoteItem.dart @@ -0,0 +1,86 @@ +import 'package:doctor_app_flutter/screens/patients/profile/soap_update_vida_plus/widgets/SoapDetailItem.dart'; +import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:flutter/material.dart'; + +class ProgressNoteItem extends StatelessWidget { + final String type; + final String speciality; + final String Notes; + final String status; + + const ProgressNoteItem( + {super.key, + required this.type, + required this.speciality, + required this.Notes, + required this.status}); + + @override + Widget build(BuildContext context) => Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Stack( + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + AppText( + "${TranslationBase.of(context).type}:", + color: Color(0XFF2B353E), + fontSize: 10, + fontWeight: FontWeight.w500, + ), + SizedBox( + width: 4, + ), + AppText( + type, + color: Color(0XFF2B353E), + fontSize: 10, + fontWeight: FontWeight.w500, + ), + ], + ), + SizedBox( + height: 8, + ), + Row( + children: [ + AppText( + "${TranslationBase.of(context).speciality}:", + color: Color(0XFF2B353E), + fontSize: 10, + fontWeight: FontWeight.w500, + ), + SizedBox( + width: 4, + ), + AppText( + speciality, + color: Color(0XFF2B353E), + fontSize: 10, + fontWeight: FontWeight.w500, + ), + ], + ), + ], + ), + Align( + alignment: Alignment.topRight, child: Status(status: status)) + ], + ), + SizedBox( + height: 8, + ), + AppText( + Notes, + color: Color(0XFF2B353E), + fontSize: 12, + fontWeight: FontWeight.w600, + ), + ], + ); +} diff --git a/lib/screens/patients/profile/soap_update_vida_plus/plan/widget/add_progress_note.dart b/lib/screens/patients/profile/soap_update_vida_plus/plan/widget/add_progress_note.dart new file mode 100644 index 00000000..b60845bb --- /dev/null +++ b/lib/screens/patients/profile/soap_update_vida_plus/plan/widget/add_progress_note.dart @@ -0,0 +1,65 @@ +import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/screens/patients/patient_search/patient_search_header.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/soap_update_vida_plus/plan/widget/add_progress_note_details.dart'; +import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart'; +import 'package:flutter/material.dart'; + +class AddProgressNote extends StatelessWidget{ + @override + Widget build(BuildContext context) { + return BaseView( + builder: (_, model, w) => AppScaffold( + isShowAppBar: true, + appBar: PatientSearchHeader( + title: TranslationBase.of(context).progressNote + ), + body: Padding( + padding: const EdgeInsets.all(20.0), + child: SingleChildScrollView( + child: AddProgressNoteDetails(), + ), + ), + bottomNavigationBar: Material( + color: Colors.white, + child: Padding( + padding: const EdgeInsets.all(16.0), + child: Row( + children: [ + Expanded( + child: AppButton( + title: TranslationBase.of(context).cancelSmall, + color: Color(0xffEAEAEA), + fontColor: Colors.black, + fontWeight: FontWeight.w600, + onPressed: () async { + Navigator.pop(context); + }, + ), + ), + SizedBox( + width: 10, + ), + Expanded( + child: AppButton( + title: TranslationBase.of(context).save, + color: Color(0xff359846), + fontColor: Colors.white, + fontWeight: FontWeight.w600, + onPressed: () async { + Navigator.pop(context); + + + + }, + ), + ), + ], + ))), + ), + ); + } + +} \ No newline at end of file diff --git a/lib/screens/patients/profile/soap_update_vida_plus/plan/widget/add_progress_note_details.dart b/lib/screens/patients/profile/soap_update_vida_plus/plan/widget/add_progress_note_details.dart new file mode 100644 index 00000000..d8e699f5 --- /dev/null +++ b/lib/screens/patients/profile/soap_update_vida_plus/plan/widget/add_progress_note_details.dart @@ -0,0 +1,296 @@ +import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart'; +import 'package:doctor_app_flutter/utils/utils.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_svg/flutter_svg.dart'; +import 'package:hexcolor/hexcolor.dart'; + +List patientState = ["","Stable", "Not Stable", "Not Defined"]; + +class AddProgressNoteDetails extends StatefulWidget { + @override + State createState() => _AddProgressNoteDetailsState(); +} + +class _AddProgressNoteDetailsState extends State { + String selectedItem = "Stable"; + int status = 1; + final TextEditingController noteController = TextEditingController(); + + + @override + Widget build(BuildContext context) { + return Material( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10), + side: BorderSide( + width: 1, + color: Color(0xFFEFEFEF), + )), + color: Colors.white, + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 12), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + TranslationBase.of(context).addProgressNote, + fontSize: 16, + fontWeight: FontWeight.w600, + textAlign: TextAlign.start, + color: Colors.black, + ), + SizedBox( + height: 16, + ), + Material( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10), + side: BorderSide( + width: 1, + color: Color(0xFFEFEFEF), + )), + color: Colors.white, + child: Padding( + padding: + const EdgeInsets.symmetric(horizontal: 16.0, vertical: 12), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + TranslationBase.of(context).patientCondition, + textAlign: TextAlign.start, + fontWeight: FontWeight.w600, + fontSize: 11, + color: Color(0xFF2E303A), + ), + SizedBox( + height: 4, + ), + DropdownButtonHideUnderline( + child: DropdownButton( + dropdownColor: Colors.white, + iconEnabledColor: Colors.black, + icon: Icon(Icons.keyboard_arrow_down), + isExpanded: true, + value: selectedItem, + iconSize: 25, + elevation: 16, + + onChanged: (newValue) async { + setState(() { + selectedItem = newValue ?? ""; + }); + }, + items: patientState.map((item) { + return DropdownMenuItem( + child: AppText( + item, + fontSize: 14, + letterSpacing: -0.96, + color: AppGlobal.appTextColor, + fontWeight: FontWeight.normal, + textAlign: TextAlign.left, + ), + value: item, + ); + }).toList(), + ), + ), + ], + ), + ), + ), + SizedBox( + height: 16, + ), + AppText( + TranslationBase.of(context).progressNoteType, + fontWeight: FontWeight.bold, + fontFamily: 'Poppins', + fontSize: 11, + ), + SizedBox( + height: 8, + ), + Row( + children: [ + Flexible( + child: InkWell( + onTap: () { + setState(() { + status = 1; + }); + }, + child: Row( + children: [ + Container( + padding: EdgeInsets.all(2.0), + margin: EdgeInsets.symmetric(horizontal: 6), + width: 20, + height: 20, + decoration: BoxDecoration( + color: Colors.white, + shape: BoxShape.circle, + border: Border.all(color: Colors.grey, width: 1), + ), + child: Container( + decoration: BoxDecoration( + color: status == 1 + ? HexColor("#D02127") + : Colors.white, + shape: BoxShape.circle, + ), + ), + ), + AppText( + TranslationBase.of(context).doctorProgressNote, + fontWeight: FontWeight.w600, + fontFamily: 'Poppins', + fontSize: 12, + ), + ], + ), + )), + Flexible( + child: InkWell( + onTap: () { + setState(() { + status = 2; + }); + }, + child: Row( + children: [ + Container( + padding: EdgeInsets.all(2.0), + margin: EdgeInsets.symmetric(horizontal: 6), + width: 20, + height: 20, + decoration: BoxDecoration( + color: Colors.white, + shape: BoxShape.circle, + border: Border.all(color: Colors.grey, width: 1), + ), + child: Container( + decoration: BoxDecoration( + color: status == 2 + ? HexColor("#D02127") + : Colors.white, + shape: BoxShape.circle, + ), + ), + ), + AppText( + TranslationBase.of(context).nurseNote, + fontWeight: FontWeight.w600, + fontFamily: 'Poppins', + fontSize: 12, + ), + ], + ), + ), + ), + ], + ), + SizedBox( + height: 24, + ), + Material( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10), + side: BorderSide( + width: 1, + color: Color(0xFFEFEFEF), + )), + color: Colors.white, + child: Padding( + padding: + const EdgeInsets.symmetric(horizontal: 16.0, vertical: 12), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + TranslationBase.of(context).speciality, + textAlign: TextAlign.start, + fontWeight: FontWeight.w600, + fontSize: 11, + color: Color(0xFF2E303A), + ), + SizedBox( + height: 4, + ), + DropdownButtonHideUnderline( + child: DropdownButton( + dropdownColor: Colors.white, + iconEnabledColor: Colors.black, + icon: Icon(Icons.keyboard_arrow_down), + isExpanded: true, + value: selectedItem, + iconSize: 25, + elevation: 16, + + onChanged: (newValue) async { + setState(() { + selectedItem = newValue ?? ""; + }); + }, + items: patientState.map((item) { + return DropdownMenuItem( + child: AppText( + "item", + fontSize: 14, + letterSpacing: -0.96, + color: AppGlobal.appTextColor, + fontWeight: FontWeight.normal, + textAlign: TextAlign.left, + ), + value: item, + ); + }).toList(), + ), + ), + ], + ), + ), + ), + SizedBox( + height: 16, + ), + AppTextFieldCustom( + hintText: TranslationBase.of(context).addYourNote, + controller: noteController, + inputType: TextInputType.multiline, + maxLines: 25, + minLines: 4, + hasBorder: true, + onClick: () {}, + onChanged: (value) {}, + onFieldSubmitted: () {}, + ), + SizedBox( + height: 16, + ), + Row( + children: [ + SvgPicture.asset('assets/images/svgs/save_as_draft.svg'), + SizedBox( + width: 4, + ), + AppText( + TranslationBase.of(context).saveAsDraft, + textAlign: TextAlign.start, + fontWeight: FontWeight.w600, + fontSize: 10, + color: Color(0xFF449BF1), + ), + ], + ) + ], + ), + ), + ); + } +} diff --git a/lib/screens/patients/profile/soap_update_vida_plus/plan/widget/empty_progress_note.dart b/lib/screens/patients/profile/soap_update_vida_plus/plan/widget/empty_progress_note.dart new file mode 100644 index 00000000..590fe54c --- /dev/null +++ b/lib/screens/patients/profile/soap_update_vida_plus/plan/widget/empty_progress_note.dart @@ -0,0 +1,26 @@ +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_svg/flutter_svg.dart'; + +import '../../../../../../../utils/translations_delegate_base_utils.dart'; + +class EmptyProgressNote extends StatelessWidget{ + @override + Widget build(BuildContext context) { + return Column( + mainAxisAlignment : MainAxisAlignment.center, + children: [ + SvgPicture.asset('assets/images/svgs/unavailable.svg'), + SizedBox(height: 10,), + AppText( + TranslationBase.of(context).noProgressNote, + fontSize: 12, + fontWeight: FontWeight.w400, + textAlign: TextAlign.center, + color: Color(0xFFADADAD), + ) + ], + ); + } + +} \ No newline at end of file diff --git a/lib/screens/patients/profile/soap_update_vida_plus/plan/widget/list_of_notes.dart b/lib/screens/patients/profile/soap_update_vida_plus/plan/widget/list_of_notes.dart new file mode 100644 index 00000000..4929ca0e --- /dev/null +++ b/lib/screens/patients/profile/soap_update_vida_plus/plan/widget/list_of_notes.dart @@ -0,0 +1,19 @@ +import 'package:doctor_app_flutter/core/model/SOAP/progress_note/GetGetProgressNoteResModel.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/soap_update_vida_plus/plan/widget/ProgressNoteItem.dart'; +import 'package:flutter/material.dart'; + +class ListOfNotes extends StatelessWidget{ + final List notes; + + const ListOfNotes({super.key, required this.notes}); + @override + Widget build(BuildContext context) => Flexible( + child: ListView.separated( + physics: NeverScrollableScrollPhysics(), + shrinkWrap: true, + itemBuilder: (_, index) =>ProgressNoteItem(type: 'Doctor Note', speciality: "Internal Medicine", Notes: "Some lines of note for the progress ", status: "stable"), + separatorBuilder: (_, __) => Divider(), + itemCount: notes.length), + ); + +} \ No newline at end of file diff --git a/lib/screens/patients/profile/soap_update_vida_plus/subjective/allergies/update_allergies_widget.dart b/lib/screens/patients/profile/soap_update_vida_plus/subjective/allergies/update_allergies_widget.dart index 762401bf..4f940880 100644 --- a/lib/screens/patients/profile/soap_update_vida_plus/subjective/allergies/update_allergies_widget.dart +++ b/lib/screens/patients/profile/soap_update_vida_plus/subjective/allergies/update_allergies_widget.dart @@ -11,7 +11,7 @@ import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import '../../../soap_update/shared_soap_widgets/SOAP_open_items.dart'; -import '../chief_complaint/widgets/add_chief_complaint.dart'; +import '../chief_complaint/widgets/add_soap_item.dart'; import 'add_allergies.dart'; // ignore: must_be_immutable diff --git a/lib/screens/patients/profile/soap_update_vida_plus/subjective/chief_complaint/chief_complaints.dart b/lib/screens/patients/profile/soap_update_vida_plus/subjective/chief_complaint/chief_complaints.dart index a33ddae8..dc1d7e29 100644 --- a/lib/screens/patients/profile/soap_update_vida_plus/subjective/chief_complaint/chief_complaints.dart +++ b/lib/screens/patients/profile/soap_update_vida_plus/subjective/chief_complaint/chief_complaints.dart @@ -1,5 +1,5 @@ import 'package:doctor_app_flutter/screens/patients/profile/soap_update_vida_plus/subjective/chief_complaint/AddChiefComplaints.dart'; -import 'package:doctor_app_flutter/screens/patients/profile/soap_update_vida_plus/subjective/chief_complaint/widgets/add_chief_complaint.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/soap_update_vida_plus/subjective/chief_complaint/widgets/add_soap_item.dart'; import 'package:doctor_app_flutter/screens/patients/profile/soap_update_vida_plus/subjective/chief_complaint/widgets/complaint_items.dart'; import 'package:doctor_app_flutter/screens/patients/profile/soap_update_vida_plus/subjective/chief_complaint/widgets/empty_complaints.dart'; import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart'; diff --git a/lib/screens/patients/profile/soap_update_vida_plus/subjective/chief_complaint/widgets/add_chief_complaint.dart b/lib/screens/patients/profile/soap_update_vida_plus/subjective/chief_complaint/widgets/add_soap_item.dart similarity index 100% rename from lib/screens/patients/profile/soap_update_vida_plus/subjective/chief_complaint/widgets/add_chief_complaint.dart rename to lib/screens/patients/profile/soap_update_vida_plus/subjective/chief_complaint/widgets/add_soap_item.dart diff --git a/lib/screens/patients/profile/soap_update_vida_plus/update_soap_index_vida_plus.dart b/lib/screens/patients/profile/soap_update_vida_plus/update_soap_index_vida_plus.dart index 33b4fd94..9627e06f 100644 --- a/lib/screens/patients/profile/soap_update_vida_plus/update_soap_index_vida_plus.dart +++ b/lib/screens/patients/profile/soap_update_vida_plus/update_soap_index_vida_plus.dart @@ -5,6 +5,8 @@ import 'package:doctor_app_flutter/core/model/SOAP/selected_items/my_selected_al import 'package:doctor_app_flutter/core/model/SOAP/selected_items/my_selected_history.dart'; import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/soap_update_vida_plus/objective/update_objective_page_vida_plus.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/soap_update_vida_plus/plan/update_plan_page_vida_plus.dart'; import 'package:doctor_app_flutter/screens/patients/profile/soap_update_vida_plus/subjective/update_subjective_page_vida_plus.dart'; import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/app_bar/patient-profile-app-bar.dart'; @@ -14,20 +16,21 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; - class UpdateSoapIndexVidaPlus extends StatefulWidget { final bool isUpdate; - const UpdateSoapIndexVidaPlus({Key? key, this.isUpdate = false}) : super(key: key); + const UpdateSoapIndexVidaPlus({Key? key, this.isUpdate = false}) + : super(key: key); @override - _UpdateSoapIndexVidaPlusState createState() => _UpdateSoapIndexVidaPlusState(); + _UpdateSoapIndexVidaPlusState createState() => + _UpdateSoapIndexVidaPlusState(); } class _UpdateSoapIndexVidaPlusState extends State with TickerProviderStateMixin { PageController? _controller; - int _currentIndex = 0; + int _currentIndex = 3; List myAllergiesList = []; List myHistoryList = []; @@ -92,11 +95,24 @@ class _UpdateSoapIndexVidaPlusState extends State }, scrollDirection: Axis.horizontal, children: [ + UpdatePlanPageVidaPlus( + changePageViewIndex: changePageViewIndex, + currentIndex: _currentIndex, + patientInfo: patient, + changeLoadingState: changeLoadingState, + sOAPViewModel: model, + changeStateFun: changeStateFun, + ), + UpdateObjectivePageVidaPlus( + changePageViewIndex: changePageViewIndex, + currentIndex: _currentIndex, + patientInfo: patient, + changeLoadingState: changeLoadingState), UpdateSubjectivePageVidaPlus( changePageViewIndex: changePageViewIndex, currentIndex: _currentIndex, patientInfo: patient, - changeLoadingState: changeLoadingState) + changeLoadingState: changeLoadingState), ], ), ) diff --git a/lib/screens/patients/profile/soap_update_vida_plus/widgets/SoapDetailItem.dart b/lib/screens/patients/profile/soap_update_vida_plus/widgets/SoapDetailItem.dart new file mode 100644 index 00000000..2750b32a --- /dev/null +++ b/lib/screens/patients/profile/soap_update_vida_plus/widgets/SoapDetailItem.dart @@ -0,0 +1,194 @@ +import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_svg/svg.dart'; + +typedef OnSoapDetailActionClicked = Function(SoapDetailItemActions); + +class SoapDetailItem extends StatelessWidget { + final String title; + final String condition; + final String status; + final String remarks; + final OnSoapDetailActionClicked onSoapDetailActionClicked; + + const SoapDetailItem( + {super.key, + required this.title, + required this.condition, + required this.remarks, + required this.onSoapDetailActionClicked, + required this.status}); + + @override + Widget build(BuildContext context) { + return Padding( + padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Stack( + children: [ + Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + title, + color: Color(0XFF2B353E), + fontSize: 12, + fontWeight: FontWeight.bold, + ), + Row( + children: [ + AppText( + "${TranslationBase.of(context).condition}:", + color: Color(0XFF2B353E), + fontSize: 10, + fontWeight: FontWeight.w500, + ), + SizedBox( + width: 4, + ), + AppText( + condition, + color: Color(0xffD02127), + fontSize: 10, + fontWeight: FontWeight.w500, + ), + ], + ), + Visibility( + visible: remarks.isNotEmpty, + child: Column( + children: [ + SizedBox( + height: 8, + ), + AppText( + remarks, + color: Color(0XFF2B353E), + fontSize: 10, + fontWeight: FontWeight.w400, + ), + ], + )) + ], + ), + Align( + alignment: Alignment.topRight, child: Status(status: status)) + ], + ), + SizedBox( + height: 16, + ), + Row( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () => + onSoapDetailActionClicked(SoapDetailItemActions.EDIT), + child: SoapDetailItemActionsView( + icon: 'assets/images/svgs/edit.svg', + fontColor: Color(0XFF2B353E), + text: TranslationBase.of(context).edit, + ), + ), + GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () => + onSoapDetailActionClicked(SoapDetailItemActions.RESOLVE), + child: SoapDetailItemActionsView( + icon: 'assets/images/svgs/resolve.svg', + fontColor: Color(0XFF359846), + text: TranslationBase.of(context).resolve, + ), + ), + GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () => + onSoapDetailActionClicked(SoapDetailItemActions.AUDIT), + child: SoapDetailItemActionsView( + icon: 'assets/images/svgs/audit.svg', + fontColor: Color(0XFF359846), + text: TranslationBase.of(context).audit, + ), + ), + GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () => + onSoapDetailActionClicked(SoapDetailItemActions.REMOVE), + child: SoapDetailItemActionsView( + icon: 'assets/images/svgs/delete.svg', + fontColor: Color(0XFFD02127), + text: TranslationBase.of(context).delete, + ), + ), + ], + ) + ], + ), + ); + } +} + +class SoapDetailItemActionsView extends StatelessWidget { + final String icon; + final String text; + final Color fontColor; + + const SoapDetailItemActionsView( + {super.key, + required this.icon, + required this.text, + required this.fontColor}); + + @override + Widget build(BuildContext context) => Row( + children: [ + SvgPicture.asset(icon), + SizedBox( + width: 8, + ), + AppText( + text, + color: fontColor, + fontSize: 10, + fontWeight: FontWeight.w500, + ), + ], + ); +} + +class Status extends StatelessWidget { + final String status; + + const Status({super.key, required this.status}); + + @override + Widget build(BuildContext context) { + return Material( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(3), + ), + // color: Color(0xFF359846), + color: (status.toLowerCase() == 'active' || status.toLowerCase() == 'stable') + ? Color(0xFFD8E8DB) + : Color(0x98d02127), + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 6), + child: AppText( + status, + color: (status.toLowerCase() == 'active' || status.toLowerCase() == 'stable') + ? Color(0xFF359846) + : Colors.white, + fontSize: 8, + fontWeight: FontWeight.w600, + ), + )); + } +} + +enum SoapDetailItemActions { EDIT, RESOLVE, AUDIT, REMOVE } diff --git a/lib/utils/translations_delegate_base_utils.dart b/lib/utils/translations_delegate_base_utils.dart index 83e57d30..c9e22c24 100644 --- a/lib/utils/translations_delegate_base_utils.dart +++ b/lib/utils/translations_delegate_base_utils.dart @@ -502,6 +502,7 @@ class TranslationBase { String get beingGreat => localizedValues['beingGreat']![locale.languageCode]!; String get cancel => localizedValues['cancel']![locale.languageCode]!; + String get cancelSmall => localizedValues['cancelSmall']![locale.languageCode]!; String get ok => localizedValues['ok']![locale.languageCode]!; @@ -1903,6 +1904,20 @@ class TranslationBase { String get familySpecify => localizedValues['familySpecify']![locale.languageCode]!; String get otherSpecify => localizedValues['otherSpecify']![locale.languageCode]!; String get historyOfIllness => localizedValues['historyOfIllness']![locale.languageCode]!; + String get physicalExamination => localizedValues['physicalExamination']![locale.languageCode]!; + String get addPhysicalExamination => localizedValues['addPhysicalExamination']![locale.languageCode]!; + String get noPhysicalExamination => localizedValues['noPhysicalExamination']![locale.languageCode]!; + String get examinationPart => localizedValues['examinationPart']![locale.languageCode]!; + String get resolve => localizedValues['resolve']![locale.languageCode]!; + String get audit => localizedValues['audit']![locale.languageCode]!; + String get delete => localizedValues['delete']![locale.languageCode]!; + String get noProgressNote => localizedValues['noProgressNote']![locale.languageCode]!; + String get patientCondition => localizedValues['patientCondition']![locale.languageCode]!; + String get doctorProgressNote => localizedValues['doctorProgressNote']![locale.languageCode]!; + String get nurseNote => localizedValues['nurseNote']![locale.languageCode]!; + String get progressNoteType => localizedValues['progressNoteType']![locale.languageCode]!; + String get addYourNote => localizedValues['addYourNote']![locale.languageCode]!; + String get saveAsDraft => localizedValues['saveAsDraft']![locale.languageCode]!; } class TranslationBaseDelegate extends LocalizationsDelegate { diff --git a/lib/widgets/shared/text_fields/app-textfield-custom.dart b/lib/widgets/shared/text_fields/app-textfield-custom.dart index a15a585f..3d386a27 100644 --- a/lib/widgets/shared/text_fields/app-textfield-custom.dart +++ b/lib/widgets/shared/text_fields/app-textfield-custom.dart @@ -18,6 +18,7 @@ class AppTextFieldCustom extends StatefulWidget { final bool hasBorder; final String? dropDownText; final IconButton? suffixIcon; + final Widget? suffixWidget; final Color? dropDownColor; final bool enabled; final TextInputType? inputType; @@ -42,6 +43,7 @@ class AppTextFieldCustom extends StatefulWidget { this.isTextFieldHasSuffix = false, this.dropDownText, this.suffixIcon, + this.suffixWidget, this.dropDownColor, this.enabled = true, this.inputType, @@ -84,26 +86,32 @@ class _AppTextFieldCustomState extends State { @override void dispose() { - // _focusNode.dispose(); + // _focusNode.dispose(); super.dispose(); } @override Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); - TextInputType localKeyboardType = widget.inputType ?? (widget.maxLines == 1 ? TextInputType.text : TextInputType.multiline); + TextInputType localKeyboardType = widget.inputType ?? + (widget.maxLines == 1 ? TextInputType.text : TextInputType.multiline); return Column( children: [ Container( - height: widget.height != 0 && widget.maxLines == 1 ? widget.height + 8 : null, //MediaQuery.of(context).size.height * 0.098, + height: widget.height != 0 && widget.maxLines == 1 + ? widget.height + 8 + : null, //MediaQuery.of(context).size.height * 0.098, decoration: widget.hasBorder ? TextFieldsUtils.containerBorderDecoration( Color(0Xffffffff), - widget.validationError == null ? Color(0xFFEFEFEF) : Colors.red.shade700, + widget.validationError == null + ? Color(0xFFEFEFEF) + : Colors.red.shade700, ) : null, - padding: EdgeInsets.only(top: 4.0, bottom: 0.0, left: 8.0, right: 8.0), + padding: + EdgeInsets.only(top: 4.0, bottom: 0.0, left: 8.0, right: 8.0), child: InkWell( onTap: widget.onClick, child: Row( @@ -130,25 +138,40 @@ class _AppTextFieldCustomState extends State { ), widget.dropDownText == null ? Container( - height: widget.height != 0 && widget.maxLines == 1 ? widget.height - 22 : null, + height: + widget.height != 0 && widget.maxLines == 1 + ? widget.height - 22 + : null, child: RawKeyboardListener( focusNode: FocusNode(), autofocus: false, onKey: (rawKeyEvent) { - final isFormSkippedEnterEvent = rawKeyEvent is RawKeyDownEvent && rawKeyEvent.isKeyPressed(LogicalKeyboardKey.enter); + final isFormSkippedEnterEvent = + rawKeyEvent is RawKeyDownEvent && + rawKeyEvent.isKeyPressed( + LogicalKeyboardKey.enter); - final needToInsertNewLine = isFormSkippedEnterEvent && localKeyboardType == TextInputType.multiline; + final needToInsertNewLine = + isFormSkippedEnterEvent && + localKeyboardType == + TextInputType.multiline; if (needToInsertNewLine) { - TextEditingControllerHelper.insertText(widget.controller!, '\n'); + TextEditingControllerHelper.insertText( + widget.controller!, '\n'); } }, child: TextFormField( - textAlign: projectViewModel.isArabic ? TextAlign.right : TextAlign.left, + textAlign: projectViewModel.isArabic + ? TextAlign.right + : TextAlign.left, focusNode: _focusNode, textAlignVertical: TextAlignVertical.top, - decoration: TextFieldsUtils.textFieldSelectorDecoration(widget.hintText!, "", true), + decoration: TextFieldsUtils + .textFieldSelectorDecoration( + widget.hintText!, "", true), style: TextStyle( - fontSize: SizeConfig.textMultiplier! * 1.7, + fontSize: + SizeConfig.textMultiplier! * 1.7, fontFamily: 'Poppins', color: Color(0xFF575757), fontWeight: FontWeight.w400, @@ -159,14 +182,18 @@ class _AppTextFieldCustomState extends State { enabled: widget.enabled, minLines: widget.minLines, maxLines: widget.maxLines, - inputFormatters: widget.inputFormatters != null ? widget.inputFormatters : [], + inputFormatters: + widget.inputFormatters != null + ? widget.inputFormatters + : [], onChanged: (value) { if (widget.onChanged != null) { widget.onChanged(value); } setState(() {}); }, - onFieldSubmitted: widget.onFieldSubmitted(), + onFieldSubmitted: + widget.onFieldSubmitted(), obscureText: widget.isSecure), ), ) @@ -185,7 +212,8 @@ class _AppTextFieldCustomState extends State { ? Container( margin: EdgeInsets.only( bottom: widget.isSearchTextField - ? (widget.controller!.text.isEmpty || widget.controller == null) + ? (widget.controller!.text.isEmpty || + widget.controller == null) ? 10 : 25 : 0), @@ -193,16 +221,22 @@ class _AppTextFieldCustomState extends State { : InkWell( child: Icon( Icons.keyboard_arrow_down, - color: widget.dropDownColor != null ? widget.dropDownColor : Color(0xff2E303A), + color: widget.dropDownColor != null + ? widget.dropDownColor + : Color(0xff2E303A), size: 12.0, ), ) - : Container(), + : widget.suffixWidget != null + ? widget.suffixWidget ?? SizedBox.shrink() + : Container(), ], ), ), ), - if (widget.validationError != null && widget.validationError!.isNotEmpty) TextFieldsError(error: widget.validationError!), + if (widget.validationError != null && + widget.validationError!.isNotEmpty) + TextFieldsError(error: widget.validationError!), ], ); } @@ -218,7 +252,8 @@ class TextEditingControllerHelper { } final text = controller.text; - final newText = text.replaceRange(selection.start, selection.end, textToInsert); + final newText = + text.replaceRange(selection.start, selection.end, textToInsert); controller.value = controller.value.copyWith( text: newText, selection: TextSelection.collapsed(