diff --git a/lib/core/viewModel/SOAP_view_model.dart b/lib/core/viewModel/SOAP_view_model.dart index 8b789cbc..eaa91131 100644 --- a/lib/core/viewModel/SOAP_view_model.dart +++ b/lib/core/viewModel/SOAP_view_model.dart @@ -26,6 +26,7 @@ import 'package:doctor_app_flutter/models/SOAP/post_chief_complaint_request_mode import 'package:doctor_app_flutter/models/SOAP/post_histories_request_model.dart'; import 'package:doctor_app_flutter/models/SOAP/post_physical_exam_request_model.dart'; import 'package:doctor_app_flutter/models/SOAP/post_progress_note_request_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/selected_items/my_selected_examination.dart'; import 'package:flutter/material.dart'; import '../../locator.dart'; @@ -466,4 +467,15 @@ class SOAPViewModel extends BaseViewModel { break; } } + + int getFirstIndexForOldExamination(List mySelectedExamination){ + Iterable examList = mySelectedExamination.where( + (element) => !element.isLocal); + + if (examList.length > 0) { + return mySelectedExamination.indexOf(examList.first); + } else + return -1; + + } } diff --git a/lib/screens/patients/profile/soap_update/objective/add_examination_page.dart b/lib/screens/patients/profile/soap_update/objective/add_examination_page.dart index 37f67ffc..935ac247 100644 --- a/lib/screens/patients/profile/soap_update/objective/add_examination_page.dart +++ b/lib/screens/patients/profile/soap_update/objective/add_examination_page.dart @@ -71,14 +71,14 @@ class _AddExaminationPageState extends State { masterList: model.physicalExaminationList, isServiceSelected: (master) => isServiceSelected(master), - removeExamination: (history) { + removeExamination: (exam) { setState(() { - widget.removeExamination(history); + widget.removeExamination(exam); }); }, - addHistory: (selectedExamination) { + addExamination: (selectedExamination) { widget.mySelectedExamination - .add(selectedExamination); + .insert(0,selectedExamination); // setState(() {}); }, ), diff --git a/lib/screens/patients/profile/soap_update/objective/add_examination_widget.dart b/lib/screens/patients/profile/soap_update/objective/add_examination_widget.dart index ce2bced1..2bb9b943 100644 --- a/lib/screens/patients/profile/soap_update/objective/add_examination_widget.dart +++ b/lib/screens/patients/profile/soap_update/objective/add_examination_widget.dart @@ -36,7 +36,7 @@ class AddExaminationWidget extends StatefulWidget { } class _AddExaminationWidgetState extends State { - int status = 3; + int status = 1; TextEditingController remarksController = TextEditingController(); MySelectedExamination examination = MySelectedExamination(); diff --git a/lib/screens/patients/profile/soap_update/objective/examination_item_card.dart b/lib/screens/patients/profile/soap_update/objective/examination_item_card.dart index 58dc7180..085089bd 100644 --- a/lib/screens/patients/profile/soap_update/objective/examination_item_card.dart +++ b/lib/screens/patients/profile/soap_update/objective/examination_item_card.dart @@ -4,6 +4,8 @@ import 'package:doctor_app_flutter/models/SOAP/selected_items/my_selected_examin import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:flutter/material.dart'; +import 'package:font_awesome_flutter/font_awesome_flutter.dart'; +import 'package:hexcolor/hexcolor.dart'; import 'package:provider/provider.dart'; class ExaminationItemCard extends StatelessWidget { @@ -42,21 +44,52 @@ class ExaminationItemCard extends StatelessWidget { )), ], ), - AppText( - !examination.isNormal - ? examination.isAbnormal - ? TranslationBase.of(context).abnormal - : TranslationBase.of(context).notExamined - : TranslationBase.of(context).normal, - fontWeight: FontWeight.bold, - fontFamily: 'Poppins', - color: !examination.isNormal - ? examination.isAbnormal - ? Colors.red.shade800 - : Colors.grey.shade800 - : Colors.green.shade800, - fontSize: SizeConfig.textMultiplier * 1.8, + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + AppText( + !examination.isNormal + ? examination.isAbnormal + ? TranslationBase.of(context).abnormal + : TranslationBase.of(context).notExamined + : TranslationBase.of(context).normal, + fontWeight: FontWeight.bold, + fontFamily: 'Poppins', + color: !examination.isNormal + ? examination.isAbnormal + ? Colors.red.shade800 + : Colors.grey.shade800 + : Colors.green.shade800, + fontSize: SizeConfig.textMultiplier * 1.8, + ), + if(!examination.notExamined) + InkWell( + child: Row( + children: [Container( + child: AppText( + examination.isLocal ?TranslationBase + .of(context) + .remove :TranslationBase + .of(context) + .notExamined, + fontSize: 15, + variant: "bodyText", + color: HexColor("#B8382C"),), + ), + Icon( + FontAwesomeIcons.times, + color: HexColor("#B8382C"), + size: 20, + ), + ], + ), + onTap: removeExamination, + ), + ], ), + + + SizedBox( height: 4, ), diff --git a/lib/screens/patients/profile/soap_update/objective/examinations_list_search_widget.dart b/lib/screens/patients/profile/soap_update/objective/examinations_list_search_widget.dart index ed7554e1..497bafa8 100644 --- a/lib/screens/patients/profile/soap_update/objective/examinations_list_search_widget.dart +++ b/lib/screens/patients/profile/soap_update/objective/examinations_list_search_widget.dart @@ -9,14 +9,14 @@ import 'add_examination_widget.dart'; class ExaminationsListSearchWidget extends StatefulWidget { final Function(MasterKeyModel) removeExamination; - final Function(MySelectedExamination) addHistory; + final Function(MySelectedExamination) addExamination; final bool Function(MasterKeyModel) isServiceSelected; final List masterList; final List mySelectedExamination; ExaminationsListSearchWidget( {this.removeExamination, - this.addHistory, + this.addExamination, this.isServiceSelected, this.masterList, this.mySelectedExamination}); @@ -62,7 +62,7 @@ class _ExaminationsListSearchWidgetState ...items.mapIndexed((index, item) { return AddExaminationWidget( item: item, - addExamination: widget.addHistory, + addExamination: widget.addExamination, removeExamination: widget.removeExamination, mySelectedExamination: widget.mySelectedExamination, isServiceSelected: widget.isServiceSelected, diff --git a/lib/screens/patients/profile/soap_update/objective/update_objective_page.dart b/lib/screens/patients/profile/soap_update/objective/update_objective_page.dart index ca2464b1..eb9a6002 100644 --- a/lib/screens/patients/profile/soap_update/objective/update_objective_page.dart +++ b/lib/screens/patients/profile/soap_update/objective/update_objective_page.dart @@ -97,7 +97,6 @@ class _UpdateObjectivePageState extends State { mySelectedExamination.add(tempEam); }); } - widget.changeLoadingState(false); }, builder: (_, model, w) => AppScaffold( @@ -130,8 +129,50 @@ class _UpdateObjectivePageState extends State { openExaminationList(context); }, ), + if (mySelectedExamination.isNotEmpty && + mySelectedExamination.first.isLocal) + Row( + children: [ + AppText( + "New", + fontWeight: FontWeight.w600, + fontFamily: 'Poppins', + color: Colors.blue, + ), + ], + ), Column( - children: mySelectedExamination.map((examination) { + children: mySelectedExamination + .sublist( + 0, + model.getFirstIndexForOldExamination( + mySelectedExamination)) + .map((examination) { + return ExaminationItemCard(examination, () { + removeExamination( + examination.selectedExamination); + }); + }).toList(), + ), + + if (mySelectedExamination.isNotEmpty && + model.getFirstIndexForOldExamination( + mySelectedExamination)>-1) + Row( + children: [ + AppText( + "old", + fontWeight: FontWeight.w600, + fontFamily: 'Poppins', + color: Colors.green, + ), + ], + ), + Column( + children: mySelectedExamination + .sublist(model.getFirstIndexForOldExamination( + mySelectedExamination)) + .map((examination) { return ExaminationItemCard(examination, () { removeExamination( examination.selectedExamination); @@ -276,10 +317,17 @@ class _UpdateObjectivePageState extends State { masterKey.id == element.selectedExamination.id && masterKey.typeId == element.selectedExamination.typeId); - if (history.length > 0) + if (history.length > 0) { setState(() { - mySelectedExamination.remove(history.first); + if (history.first.isLocal) { + mySelectedExamination.remove(history.first); + } else { + history.first.notExamined = true; + history.first.isNormal = false; + history.first.isAbnormal = false; + } }); + } } openExaminationList(BuildContext context) { @@ -298,59 +346,3 @@ class _UpdateObjectivePageState extends State { ); } } - -class AddExaminationDailog extends StatefulWidget { - final List mySelectedExamination; - final Function addSelectedExamination; - final Function(MasterKeyModel) removeExamination; - - const AddExaminationDailog( - {Key key, - this.mySelectedExamination, - this.addSelectedExamination, - this.removeExamination}) - : super(key: key); - - @override - _AddExaminationDailogState createState() => _AddExaminationDailogState(); -} - -class _AddExaminationDailogState extends State { - @override - Widget build(BuildContext context) { - return FractionallySizedBox( - heightFactor: 0.7, - child: BaseView( - onModelReady: (model) async { - if (model.physicalExaminationList.length == 0) { - await model - .getMasterLookup(MasterKeysService.PhysicalExamination); - } - }, - builder: (_, model, w) => AppScaffold( - baseViewModel: model, - isShowAppBar: false, - body: Center( - child: Container( - child: FractionallySizedBox( - widthFactor: 0.9, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - height: 16, - ), - AppText( - TranslationBase.of(context).physicalSystemExamination, - fontWeight: FontWeight.bold, - fontSize: 16, - ), - SizedBox( - height: 16, - ), - ]), - ))), - )), - ); - } -}